<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Admin/AdminMain.Master" Inherits="System.Web.Mvc.ViewPage<MvcEnterprise.Models.DataSet1+RollFlashRow>" %>

<asp:Content ID="Content0" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcAjax.js" type="text/javascript"></script>
    <script src="../../Scripts/MicrosoftMvcValidation.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Admin.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.loading.js" type="text/javascript"></script>
	<%var checkItem = Model.ID > 0 ? "input[type='text'][value!='']" : "input[type='text']";%>
	<script type="text/javascript">
		function DeleteItem(e) {
			if (confirm("确认删除？")) {
				$(e).parent().parent().remove();
			}
			return false;
		}
		$(document.body).ready(function () {
			$("form").submit(function () {
				var result = true;
				$("<%= checkItem %>").each(function () {
					if ($.trim(this.value) == "") {
						alert("必须填写此项。");
						$(this).val("").focus();
						result = false;
						return false;
					}
				});
				return result;
			});
		});
	</script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    编辑内容
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <%= Html.ActionLink("返回列表","RollFlashList") %></div>
    <hr />
    <% using (Html.BeginForm()) {%>
	<fieldset>
		<legend>广告参数</legend>
		<div>
			<%--文字对齐--%>
			<span class="editor-label"><%= Html.LabelFor(model => model.text_align) %>：</span>
			<span class="editor-field"><%= Html.DropDownListFor(model => model.text_align, new SelectList(new object[] { new { text = "左对齐", value = "left" }, new { text = "居中对齐", value = "center" }, new { text = "右对齐", value = "right" }}, "value", "text"))%> <%= Html.DisplayToolTipFor(model => model.text_align) %> <%= Html.ValidationMessageFor(model => model.text_align) %></span>
			<%--发布--%>
			<span><%= Html.LabelFor(model => model.ViewFlag) %>：<%= Html.CheckBoxFor(model => model.ViewFlag) %> <%= Html.DisplayToolTipFor(model => model.ViewFlag) %></span>
		</div>
		<div>
			<%--文字高度--%>
			<span class="editor-label"><%= Html.LabelFor(model => model.text_height) %>：</span>
			<span class="editor-field"><%= Html.TextBoxFor(model => model.text_height, new { value = 0}) %> <%= Html.DisplayToolTipFor(model => model.text_height) %> <%= Html.ValidationMessageFor(model => model.text_height) %></span>
		</div>
		<div>
			<%--切换时间--%>
			<span class="editor-label"><%= Html.LabelFor(model => model.interval_time) %>：</span>
			<span class="editor-field"><%= Html.TextBoxFor(model => model.interval_time, new { value = 0}) %> <%= Html.DisplayToolTipFor(model => model.interval_time) %> <%= Html.ValidationMessageFor(model => model.interval_time) %></span>
		</div>
		<div>
			<%--图像宽度--%>
			<span class="editor-label"><%= Html.LabelFor(model => model.focus_width) %>：</span>
			<span class="editor-field"><%= Html.TextBoxFor(model => model.focus_width, new { value = 0}) %> <%= Html.DisplayToolTipFor(model => model.focus_width) %> <%= Html.ValidationMessageFor(model => model.focus_width) %></span>
		</div>
		<div>
			<%--图像高度--%>
			<span class="editor-label"><%= Html.LabelFor(model => model.focus_height) %>：</span>
			<span class="editor-field"><%= Html.TextBoxFor(model => model.focus_height, new { value = 0}) %> <%= Html.DisplayToolTipFor(model => model.focus_height) %> <%= Html.ValidationMessageFor(model => model.focus_height) %></span>
		</div>
	</fieldset>
	<fieldset>
		<legend>广告内容</legend>
		<%
		   var texts = Model.texts.Split('|');
		   var pics = Model.pics.Split('|');
		   var urls = Model.urls.Split('|');
		   for (int i = 0; i < texts.Length; i++)
		   {
		%>
			<div>
				<span class="editor-label">广告文字： </span>
				<span class="editor-field"><input class="required" type="text" name="ItemText<%= i %>" value="<%= texts[i] %>" /><%if (i < texts.Length - 1) { %><input type="button" onclick="return DeleteItem(this);" value="删除" /><%} %></span><br />
				<span class="editor-label">广告图片： </span>
				<span class="editor-field"><%= Html.TextBoxFileUrl("/Content/fckeditor/", "Image", "ItemImage" + i.ToString(), pics[i], null)%></span><br />
				<span class="editor-label">广告链接： </span>
				<span class="editor-field"><input class="required" type="text" name="ItemUrl<%= i %>" value="<%= urls[i] %>" /></span>
			</div>
			<hr />
		<%
		   }
		%>
	</fieldset>
    <div>
        <%----%>
        <%= Html.HiddenFor(model=>model.ID) %>
    </div>
    <p><input type="submit" value="保 存" /> <input type="submit" value="另存为" onclick="$('#ID').val('');" /></p>
    <% } %>
</asp:Content>