<%@ Page Language="C#" ValidateRequest="false" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_ClassSingle" Title="单页面管理" Codebehind="KS.ClassSingle.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
<div id="manage_top" class="menu_top_fixed">
    <ul class="titleTab">
      <li><a href="KS.Class.Aspx?from=<%=KSCMS.S("from") %>">栏目管理</a></li>
      <li class="curr"><a href="KS.ClassSingle.aspx">单页面管理</a></li>
    </ul>
</div>  
<div class="menu_top_fixed_height"></div>     
<asp:Panel ID="ClassList" runat="server" Width="100%">
   <div class="content-area">  
   <div class="myTitle">
       <span class="fr"><a href="KS.ClassSingle.aspx?action=add" class="mr20 button button_on">添加单页面</a>
         <%if (from!="shop"){ %>
         <a href="javascript:;" onclick="refreshClass()" class="mr20 button">生成HTML</a>
         <%} %></span>
       单页面管理</div>
<script>
    function refreshClass() {
        var sid = null;
        for (var i = 0; i < document.getElementsByName("ids").length; i++) {
            var KS = document.getElementsByName("ids")[i];
            if (KS.checked == true) {
                if (sid == null)
                    sid = KS.value;
                else
                    sid += "," + KS.value;
            }
        }
        if (sid != null) {
            top.openWin("生成静态HTML操作", "refresh/KS.RefreshHtml.aspx?action=refreshClass&classid=" + sid, false, 600, 250);
        } else {
            KesionJS.Alert("请选择要发布的栏目！");
        }
    }
</script>

   <asp:Repeater ID="list" runat="server">
          <HeaderTemplate>
           <table width="99%" cellpadding="0" cellspacing="0" class="CTable">
           <tr class="CTitle">
			   <th scope="col" width="30">选中</th>
               <th width="50">栏目ID</th>
               <th scope="col"  width="600" style="text-align:left">单页面名称</th>
           
               <th scope="col">序号</th>
               <th scope="col" width="35">编辑</th>
               <th scope="col" width="35">删除</th>
			</tr>
          </HeaderTemplate>
          <ItemTemplate>
         
            <tr id='sub<%#Eval("classid") %>' onmouseover="jQuery('#a<%# Eval("classid") %>').show();jQuery(this).addClass('CtrMouseOver');jQuery(this).removeClass('CtrMouseOut');" onmouseout="jQuery('#a<%# Eval("classid") %>').hide(); jQuery(this).addClass('CtrMouseOut');jQuery(this).removeClass('CtrMouseOver');" onclick="chk(this)">
             <td class="Ctd" style="height:30px;text-align:center;"><input type="checkbox" name="ids" value='<%#Eval("classID")%>' /></td>
             <td class="Ctd" style="height:30px;text-align:center;"><%# Eval("classid") %></td>
             <td class="Ctd">
         <%# getClassName(Convert.ToInt32(Eval("ClassID")),Eval("Classname", "{0}"), Convert.ToInt16(Eval("child")), Utils.StrToInt(Convert.ToString(Eval("NextID"))), Convert.ToInt16(Eval("depth", "{0}")), Convert.ToInt16(Eval("ClassType", "{0}")))%>
               
               <span style="display:none;padding-left:20px;" id="a<%# Eval("classid") %>">
                <a href='<%# GetClassUrl(Convert.ToInt32(Eval("ClassID"))) %>'target="_blank" style="color:#999">预览</a>
               </span>

               </td>
          
             <td class="Ctd" align="center"><%# Container.ItemIndex + 1 + (CurrPage - 1) * PageSize%></td>
             <td class="Ctd" align="center"><a class="edit" title="编辑" href="KS.ClassSingle.Aspx?classid=<%# Eval("classid") %><%=urlParam %>"></a></td>
             <td class="Ctd" align="center"><a  class="delete" title="删除单页面" href="KS.ClassSingle.Aspx?Action=del&Ids=<%# Eval("classid") %><%=urlParam %>" onclick="return(confirm('此操作不可逆，确定删除栏目吗?'));"></a></td>

            </tr>
          </ItemTemplate>
          <FooterTemplate>
           <tr style="display:<%# bool.Parse((list.Items.Count==0).ToString())?"":"none"%>">
                <td class="Ctd" style="text-align:center" colspan="10">
                 <a href="KS.ClassSingle.aspx?action=add"> 还没有添加任何单页面，点此添加&raquo;</a>
                </td>
               </tr> 
          </table>
          </FooterTemplate>
        </asp:Repeater>
        <div class="listedit">
      	  <input type='checkbox' name='chkall' id='chkall' onClick='CheckAll(this.form);'/><label for="chkall">全部选中</label>
          <asp:LinkButton ID="delbutton" runat="server" OnClientClick="if (GetIDS('del')){return true}else{return false}" onclick="BtnDelete_Click" CssClass="button">删除单页面</asp:LinkButton>
      	</div>
            <KS:Page ID="Page1" runat="server" />
        </asp:Panel> 
        
<asp:Panel ID="ClassAdd" runat="server" Width="100%">
        <script>
            function CheckForm()
            {
             
                if(jQuery('#<%=this.TxtTitle.ClientID %>').val()==''){
                    KesionJS.Alert('请输入单页面名称！', "jQuery('#<%=this.TxtTitle.ClientID %>').focus()");
                    return false;
                }
                if (jQuery('#<%=this.SingleFname.ClientID %>').val()==''){
                    KesionJS.Alert('请输入单页生成文件名！',"jQuery('#<%=this.SingleFname.ClientID %>').focus()");
                    return false;
                }
                if (jQuery('#<%=this.ClassTemplate.ClientID %>').val()=='')
                {
                    KesionJS.Alert('请绑定单页模板！',"jQuery('#<%=this.ClassTemplate.ClientID %>').focus()");
                    return false;
                }
                return true;
            }
        </script>
  <div class="content-area"> 
      <div class="myTitle" style="display:none;">
<%=!string.IsNullOrEmpty(KSCMS.S("classid"))? string.Format("修改单页面内容[<a href='{0}' target='_blank'>预览</a>]", MyCache.GetClassUrl(ClassID)):"添加单页面" %></div>
      	<div class="tab-page" id="ClassSinglePanel">
         <script type="text/javascript">
             var tabPane1 = new WebFXTabPane( document.getElementById( "ClassSinglePanel" ), 1 )
         </script>
             
		 <div class="tab-page" id="tab0">
		  <h2 class="tab">基本信息</h2>
			<script type="text/javascript">
						 tabPane1.addTabPage( document.getElementById( "tab0" ) );
			</script>

        <table width="100%" border="0" cellpadding="1" cellspacing="1" class="CTable no-borderTable"> 
          <tr>
            <td class="lefttd" height="30" align="right" style="width: 151px"><b>单页面名称：</b></td>
            <td class="righttd">
            <input type="hidden" name="backurl" value="KS.ClassSingle.aspx" />
                &nbsp;<asp:TextBox ID="TxtTitle" Width="300px" CssClass="textbox" runat="server"></asp:TextBox>
                <span class="tips">如：关于我们，联系我们等。</span></td>
          </tr>
            <tr>
                <td align="right" class="lefttd" style="width: 200px; height: 37px;"><strong>
                           所属栏目：</strong>
                         </td>
                         <td  class="righttd" style="height: 37px">
                              &nbsp;<asp:DropDownList ID="ParentID" runat="server">
                             <asp:ListItem Value="0">-无（作为一级栏目）-</asp:ListItem>
                             </asp:DropDownList>&nbsp;
                             <span id="ParentIDMessage" runat="server"></span>
                             <span class="tips">不能指定为外部频道或单页栏目</span>
                       </td>
                     </tr>

            
            <tr>
                <td align="right" class="lefttd" height="30" style="width: 151px">
                    <strong>单页面图片：</strong></td>
                <td class="righttd">
                    &nbsp;<asp:TextBox ID="PhotoUrl" Width="300px" CssClass="textbox" runat="server"></asp:TextBox>&nbsp;<input type="button" class="button" onclick="SelectFiles('<%=this.PhotoUrl.ClientID %>',0);" value="选择图片"></td>
            </tr>
           

            <tr>
                <td align="right" class="lefttd" height="30" style="width: 151px">
                    <strong>单页面内容：</strong>
                    <br /> 使用标签“<font color=green>{$GetClassIntro}</font>”调用。
                    </td>
                <td class="righttd">
                <textarea name="content" id="content" runat="server" style="width:95%;height:350px;"></textarea>
                  <%
                     Kesion.APPCode.EditorAPI.EchoEditor("editor", this.content.ClientID, "Common", 0, false, true);    
                  %> 
                </td>
            </tr>
             <tr>
                <td align="right" class="lefttd" height="30" style="width: 151px">
                    <strong>是否生成静态HTML：</strong></td>
                <td class="righttd">
                     <asp:DropDownList ID="DrpSinglePageHtml" runat="server">
                         <asp:ListItem Value="1" Selected="True">不启用</asp:ListItem>
                         <asp:ListItem Value="3">启用</asp:ListItem>
                        </asp:DropDownList>
                    文件名：<asp:TextBox CssClass="textbox" ID="SingleFname" runat="server"></asp:TextBox><font color=red>如 about.html,intro.html等</font>
                         <div class="tips">单页面生成路径为：文章模型设置的总生成路径+单页文件名。</div></td>
            </tr>     

              <tbody id="ClassTemplateArea">
              <tr>
                <td align="right" class="lefttd">
                    <strong>WEB版栏目模板：</strong></td>
                <td class="righttd" style="height: 30px">
                    <asp:TextBox CssClass="textbox" ID="ClassTemplate" runat="server" Width="480px"></asp:TextBox>
                    <input type="button" class="button" onmouseover="this.className='button_on';" onmouseout="this.className='button';" value="选择模板..." onClick="SelectTemplate('<%=this.ClassTemplate.ClientID %>',0);"/></td>
            </tr>
              <tr<%=MyCache.GetCacheConfig(72)=="0"?" style='display:none'":"" %>>
                <td align="right" class="lefttd">
                    <strong>手机版栏目模板：</strong></td>
                <td class="righttd" style="height: 30px">
                    <asp:TextBox ID="TxtClass3GTemplate" runat="server" CssClass="textbox" 
                        Width="480px"></asp:TextBox>
                    <input class="button" onClick="SelectTemplate('<%=this.TxtClass3GTemplate.ClientID %>',1);" 
                        onmouseout="this.className='button';" onmouseover="this.className='button_on';" type="button" value="选择模板..." /></td>
              </tr>
            </tbody>
          </table>
        </div>
               <div class="tab-page" id="tab1">
		  <h2 class="tab">其他选项</h2>
			<script type="text/javascript">
						 tabPane1.addTabPage( document.getElementById( "tab1" ) );
			</script>
        <table width="100%" border="0" cellpadding="1" cellspacing="1" class="CTable no-borderTable"> 
          <tr>
                    <td  height="30" align="right"  class="lefttd" style="width: 227px">
                        <strong>栏目META关键词</strong>：<br />
                       </td>
                    <td class="righttd">
                        <asp:TextBox CssClass="textbox textarea" ID="MetaKeyWord" runat="server" Rows="3" TextMode="MultiLine" Width="378px" Height="80px"></asp:TextBox>
                        <a class="textarea_min" href="javascript:zoomtextarea(-2,'<%=this.MetaKeyWord.ClientID %>');">
                         </a>
                         <a class="textarea_max" href="javascript:zoomtextarea(2,'<%=this.MetaKeyWord.ClientID %>');">
                          </a><br />  
                         <span class="tips">针对搜索引擎设置的关键词</span>
                        </td>
                  </tr>
                  <tr>
                         <td align="right"  class="lefttd" style="height: 76px; width: 227px;">
                             <strong>栏目META网页描述：<br />
                             </strong></td>
                         <td  class="righttd" style="height: 76px">
                             <asp:TextBox CssClass="textbox textarea" ID="MetaDescript" runat="server" rows="3" TextMode="MultiLine" Width="376px" Height="80px"></asp:TextBox>
                               <a class="textarea_min" href="javascript:zoomtextarea(-2,'<%=this.MetaDescript.ClientID %>');"> </a>
                               <a class="textarea_max" href="javascript:zoomtextarea(2,'<%=this.MetaDescript.ClientID %>');"></a>  
                             <br />
                             <span class="tips">针对搜索引擎设置的网页描述</span>
                        </td>
                  </tr>
             <tr>
                <td align="right" class="lefttd" height="30" style="width: 151px">
                    <strong>创建时间：</strong></td>
                <td class="righttd">
                    &nbsp;<asp:TextBox ID="AddDate" Width="300px" CssClass="textbox Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" runat="server"></asp:TextBox>
                    </td>
            </tr>
          </table>
         </div>
    </div>
          <br />
              <KS:Foot ID="CopyRight1" runat="server" SubmitButtonText="确定保存(0)" OnSubmit="CopyRight1_Submit"/>
	</div>   
          </asp:Panel>
        
    
</asp:Content>