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

<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>
	<script type="text/javascript">
		function DeleteFlashAd(e) {
			if (confirm("确认删除？")) {
				$(e).parent().parent().remove();
			}
			return false;
		}
		$(document.body).ready(function () {
			$("input[type='text'][value!='']").blur(function () {
				if ($.trim($(this).val()) == "") {
					alert("必须填写此项");
					$(this).val("").focus();
					return false;
				}
			});
		});
	</script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    广告设置
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% Html.EnableClientValidation(); %>
    <%= Html.ValidationSummary() %>
    <%
        using (Html.BeginForm("Setting","Admin"))
      {%>
    <fieldset>
        <legend>轮显广告设置</legend>
        <%
            var texts = Setting.Context.FlashAdTexts.Split('|');
            var images = Setting.Context.FlashAdImages.Split('|');
            var urls = Setting.Context.FlashAdUrls.Split('|');
            for (int i=0; i<texts.Length; i++)
            {
            %>
        <div>
			<%if (string.IsNullOrEmpty(texts[i])){ %>
			<fieldset><legend>添加</legend>
			<%} %>
            <span class="editor-label">广告文字： </span>
            <span class="editor-field"><input type="text" name="FlashAdText<%= i %>" value="<%= texts[i] %>" /><%if (i < texts.Length - 1) { %><input type="button" onclick="return DeleteFlashAd(this);" value="删除" /><%} %></span><br />
            <span class="editor-label">广告图片： </span>
            <span class="editor-field"><%= Html.TextBoxFileUrl("/Content/fckeditor/","Image","FlashAdImage" + i.ToString(),images[i],null) %></span><br />
            <span class="editor-label">广告链接： </span>
            <span class="editor-field"><input type="text" name="FlashAdUrl<%= i %>" value="<%= urls[i] %>" /></span>
			<%if (string.IsNullOrEmpty(texts[i])){ %>
			</fieldset>
			<%} %>
        </div>
        <hr />
            <%
            }
        %>
    </fieldset>
    <p><input type="submit" value="保 存" /> </p>
    <% } %>
</asp:Content>

