<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_Admin_ShopIndexArticleAdd, mallz" title="添加文章" validaterequest="false" enableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<script type="text/javascript">
   function  selectArtitleType()
   {  
      var UploadPicObj, SelectObj;
      if(document.getElementById("ctl00_ContentPlaceHolder1_Edit_ArticleType")==null){
        SelectObj=document.getElementById("ctl00_ContentPlaceHolder1_Add_ArticleType");
        UploadPicObj=document.getElementById("ctl00_ContentPlaceHolder1_Add_UploadPic");
      }else{
        SelectObj=document.getElementById("ctl00_ContentPlaceHolder1_Edit_ArticleType");
        UploadPicObj=document.getElementById("ctl00_ContentPlaceHolder1_Edit_UploadPic");
      }
      if(SelectObj.options[SelectObj.selectedIndex].value=="Text")
      {
         UploadPicObj.style.display="none";
      }
      else
      {
          UploadPicObj.style.display="";
      }
   }
   
   function selectLinkType()
   {
      var SelectLinkTypeObj, SelectLinkTypeObj2, LinkType_1Obj, LinkType_2Obj;
      if(document.getElementById("ctl00_ContentPlaceHolder1_Add_LinkType_0")==null){
          SelectLinkTypeObj=document.getElementById("ctl00_ContentPlaceHolder1_Edit_LinkType_0");
          SelectLinkTypeObj2=document.getElementById("ctl00_ContentPlaceHolder1_Edit_LinkType_1");
          LinkType_1Obj=document.getElementById("ctl00_ContentPlaceHolder1_edit_LinkTypetr_1");
          LinkType_2Obj=document.getElementById("ctl00_ContentPlaceHolder1_edit_LinkTypetr_2");
      }else{
          SelectLinkTypeObj=document.getElementById("ctl00_ContentPlaceHolder1_Add_LinkType_0");
          SelectLinkTypeObj2=document.getElementById("ctl00_ContentPlaceHolder1_Add_LinkType_1");
          LinkType_1Obj=document.getElementById("ctl00_ContentPlaceHolder1_add_LinkTypetr_1");
          LinkType_2Obj=document.getElementById("ctl00_ContentPlaceHolder1_add_LinkTypetr_2");
      }
      
      if(SelectLinkTypeObj.checked)
      {
         LinkType_1Obj.style.display="none";
         LinkType_2Obj.style.display="";
      }
      else
      {
         LinkType_1Obj.style.display="";
         LinkType_2Obj.style.display="none";
      }
   }
   
    function addheight(action){
        var change=30;
        var obj=document.getElementById("ctl00_ContentPlaceHolder1_Add_Content___Frame");
        if(obj==null)
          obj=document.getElementById("ctl00_ContentPlaceHolder1_Edit_Content___Frame");
        var newheight;
        if(obj.style.height=="" || obj.style.height!=null)
            oldheight = 100;
        else
            oldheight = obj.style.height;
        if(action=="add"){
          newheight = parseInt(oldheight, 10) + change;
        }
        else if(action=="sub") {	//大于最小高度100时才执行
          newheight = parseInt(oldheight, 10);
          if(newheight>70){
           newheight=newheight-change;
          }		  
		}
        obj.style.height = newheight + 'px';
   } 
   

function OpenFileList(boj){
    
    window.open("Admin_PageFileList.aspx?obj=ctl00_ContentPlaceHolder1_"+boj,"","width=500px; height=350px; help=no; scroll=no; status=no; edge=sunken;");
}
</script>
   
   
<table class="adminheading">
   <tr>
      <th valign="middle" class="menus" align="left">文章管理</th>
      <td align="right">
        <div style="width:50px"><asp:HyperLink ID="ReturnBack" runat="server" Text="返回"  NavigateUrl="Admin_ShopIndexArticle.aspx"/>
        </div>
      </td>
   </tr>
</table>
    

   
        <table class="nick" ID="AddTable" runat="server">
           <tr><td colspan="2" class="tit">新建文章</td></tr>
            <tr>
              <td class="ltd">文章短标题</td>
              <td class="rtd">
                 <asp:TextBox ID="Add_ShortTitle" runat="server" Width="250px"  MaxLength="50" /> 限50个中文字符
                 </td>
           </tr>
           <tr>
              <td class="ltd">文章长标题</td>
              <td class="rtd">
                 <asp:TextBox ID="Add_LongTitle" runat="server" Width="500px" MaxLength="100"/> 限100个中文字符
                 </td>
           </tr>
           <tr>
              <td class="ltd"><div style="width:90px;">所属模块</div></td>
              <td class="rtd">
                 <asp:DropDownList ID="Add_Channel" EnableViewState="true" AppendDataBoundItems="True" runat="server" DataTextField="Title" DataValueField="id" />
              </td>
           </tr>
           <tr  style="display:none;">
              <td class="ltd">标题类型</td>
              <td class="rtd">
                 <asp:DropDownList ID="Add_TitleType" runat="server">
                    <asp:ListItem Text="顶部标题" Value="1" />
                    <asp:ListItem Text="列表标题" Value="2" />
                 </asp:DropDownList>
              </td>
           </tr>
            <tr>
              <td class="ltd">文章类型</td>
              <td class="rtd">
                 <asp:DropDownList ID="Add_ArticleType" runat="server" >
                    <asp:ListItem  Text="图片" Value="IMG" />
                    <asp:ListItem  Text="文字" Value="Text" />
                    <asp:ListItem  Text="图文" Value="IMGText" />       
                 </asp:DropDownList>
              </td>
           </tr>
           <tr id="Add_UploadPic">
              <td class="ltd">上传图片</td>
              <td class="rtd">
                 <div style="float:left;">
                 <asp:FileUpload ID="Add_FileUpload" runat="server" />
                 </div>
                 <div id="previewImage" style="float:left; display:none; margin-left:15px; border:solid 1px white; height:120px; width:120px; text-align:center;">
                   缩微图
                 </div>
              </td>
           </tr>
           <tr>
              <td class="ltd">是否高亮显示</td>
              <td class="rtd">
                 <asp:RadioButtonList ID="Add_IsHighDisplay" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal">
                    <asp:ListItem Text="否" Value="0" Selected="True" />
                    <asp:ListItem Text="是" Value="1" />
                 </asp:RadioButtonList>
              </td>
           </tr>
           <tr>
              <td class="ltd">所属商品分类</td>
              <td class="rtd">
                 <asp:DropDownList ID="Add_ClassID" runat="server" AppendDataBoundItems="True" EnableViewState="true" DataTextField="ClassName" DataValueField="ClassID" >
                    <asp:ListItem Text="不属于任何分类" Value="-1" />
                 </asp:DropDownList>
              </td>
           </tr>
           <tr>
              <td class="ltd">所属专题</td>
              <td class="rtd">
                <asp:DropDownList ID="Add_SpecialID" runat="server" DataTextField="SpecialName" DataValueField="SpecialID" EnableViewState="true" AppendDataBoundItems="True">
                   <asp:ListItem Text="首页" Value="-1" />
                </asp:DropDownList>
              </td>
           </tr>     
           <tr>
              <td class="ltd">是否转向链接</td>
              <td class="rtd">
                 <asp:RadioButtonList ID="Add_LinkType" runat="server"  RepeatLayout="Flow" RepeatDirection="Horizontal">
                    <asp:ListItem Text="否" Value="0"  Selected="True"/>
                    <asp:ListItem Text="是" Value="1" />
                 </asp:RadioButtonList>
              </td>
           </tr>
          <tr id="add_LinkTypetr_1" style=" display:none;">
              <td class="ltd">转向链接URL</td>
              <td class="rtd"><asp:TextBox ID="Add_LinkUrl" Text="#" runat="server" Width="300px" />
                  <asp:RequiredFieldValidator ID="RequiredFieldValidator11" runat="server" ControlToValidate="Add_LinkUrl" ErrorMessage="地址不能为空" />
              </td>
           </tr>
           <tr id="add_LinkTypetr_2">
              <td class="ltd">文章内容</td>
              <td class="rtd">
                <asp:TextBox ID="Add_Content" runat="server" style="display:none;" />
                 <iframe src="Editor/Editor.aspx?ID=ctl00_ContentPlaceHolder1_Add_Content" width="100%" height="200" frameborder="0"></iframe>
              </td>
           </tr>      
           <tr>
              <td class="ltd">文章状态</td>
              <td class="rtd"><asp:RadioButtonList ID="Add_Status" runat="server" RepeatDirection="Horizontal">
                    <asp:ListItem Text="草稿" Value="1" />
                    <asp:ListItem Text="待审核" Value="-1" />
                    <asp:ListItem Text="通过" Value="3"  Selected="True"/>
                 </asp:RadioButtonList></td>
           </tr>
            <tr>
              <td class="ltd">文章属性</td>
              <td class="rtd">
                  <asp:CheckBox ID="Add_IsTop" runat="server" /> 固顶
                  <asp:CheckBox ID="Add_IsElite" runat="server" /> 推荐
              </td>
           </tr>
            <tr>
              <td class="ltd">录入者</td>
              <td class="rtd"><asp:TextBox ID="Add_Editor" runat="server" /></td>
           </tr>
            <tr>
              <td class="ltd">起始点击数</td>
              <td class="rtd"><asp:TextBox ID="Add_Hits" runat="server" /></td>
           </tr>
           <tr>
              <td class="ltd">录入时间</td>
              <td class="rtd"><asp:TextBox ID="Add_InputTime" runat="server"/></td>
           </tr>
           <tr>
              <td class="ltd">文章有效期</td>
              <td class="rtd"><asp:TextBox ID="Add_Validay" runat="server"/>天</td>
           </tr>
           <tr>
              <td class="ltd">文章模板</td>
              <td class="rtd"><asp:TextBox ID="Add_TemplatePath" runat="server" Width="200"/>
              <input value="浏 览" type="button" name="ll" onclick="return OpenFileList('Add_TemplatePath')" /> （留空则使用默认）
              </td>
           </tr>
           <tr>
                <td colspan="2">
                  <div class="div_btm">
                  <asp:Button ID="Add" OnClick="AddArticle_OnClick" Text=" 添 加 " runat="server"/>
                  <input onclick="location.href='Admin_ShopIndexArticle.aspx'" type="button" value=" 返 回 " />
                  </div>
                </td>
           </tr>
          </table>
          <br />


        <table class="nick" ID="EditTable" runat="server">
           <tr><td colspan="2" class="tit">设置文章</td></tr>
            <tr>
              <td class="ltd">文章编号</td>
              <td class="rtd">
                <asp:Label ID="Edit_ArticleID" runat="server" />
              </td>
            </tr>
            <tr>
              <td class="ltd">文章短标题</td>
              <td class="rtd">
                 <asp:TextBox ID="Edit_ShortTitle" runat="server" Width="250px"  MaxLength="50" /> 限50个中文字符
                 </td>
           </tr>
           <tr>
              <td class="ltd">文章长标题</td>
              <td class="rtd">
                 <asp:TextBox ID="Edit_LongTitle" runat="server" Width="500px" MaxLength="100"/> 限100个中文字符
                 </td>
           </tr>
           <tr>
              <td class="ltd">所属模块</td>
              <td class="rtd">
                <asp:DropDownList ID="Edit_Channel" runat="server" DataTextField="Title" DataValueField="id" EnableViewState="true" AppendDataBoundItems="True"　/> 
              </td>
           </tr>
           <tr>
              <td class="ltd">标题类型</td>
              <td class="rtd">
                 <asp:DropDownList ID="Edit_TitleType" runat="server" >
                    <asp:ListItem Text="顶部标题" Value="1" />
                    <asp:ListItem Text="列表标题" Value="2" />
                 </asp:DropDownList>
              </td>
           </tr>
            <tr>
              <td class="ltd">显示类型</td>
              <td class="rtd">
                 <asp:DropDownList ID="Edit_ArticleType" runat="server" >
                    <asp:ListItem  Text="图片" Value="IMG" />
                    <asp:ListItem  Text="文字" Value="Text" />   
                    <asp:ListItem  Text="图文" Value="IMGText" />                                    
                 </asp:DropDownList>
                 
              </td>
           </tr>
           <tr id="Edit_UploadPic">
              <td class="ltd">上传图片</td>
              <td class="rtd">
                 <div style="float:left">
                 <asp:FileUpload ID="Edit_FileUpload" runat="server" />
                 </div>
                 <div id="previewImage2" style="float:left; margin-left:15px; border:solid 1px white; height:120px; width:120px; text-align:center;">
                  <div>缩微图</div>
                  <asp:Image runat="server" ID="IndxeImg" Width="100px" Height="100px"  /> 
               </div>
              </td>
           </tr>
           <tr>
              <td class="ltd">是否高亮显示</td>
              <td class="rtd">
                 <asp:RadioButtonList ID="Edit_IsHighDisplay" runat="server"  RepeatLayout="Flow" RepeatDirection="Horizontal">
                    <asp:ListItem Text="否" Value="0"  Selected="True"/>
                    <asp:ListItem Text="是" Value="1" />
                 </asp:RadioButtonList>
              </td>
           </tr>
           <tr>
              <td class="ltd">所属商品分类</td>
              <td class="rtd">
                 <asp:DropDownList ID="Edit_ClassID" runat="server"  AppendDataBoundItems="True" EnableViewState="true" DataTextField="ClassName" DataValueField="ClassID" >
                    <asp:ListItem Text="不属于任何分类" Value="-1" />
                 </asp:DropDownList>
              </td>
           </tr>
           <tr>
              <td class="ltd">文章状态</td>
              <td class="rtd">
                 <asp:RadioButtonList ID="Edit_Status" runat="server" RepeatDirection="Horizontal" >
                    <asp:ListItem Text="草稿" Value="1" />
                    <asp:ListItem Text="待审核" Value="-1" />
                    <asp:ListItem Text="通过" Value="3" />
                 </asp:RadioButtonList></td>
           </tr>
           <tr>
              <td class="ltd">所属专题</td>
              <td class="rtd">
                <asp:DropDownList ID="Edit_SpecialID" runat="server" EnableViewState="true" AppendDataBoundItems="True"  DataTextField="SpecialName" DataValueField="SpecialID" >
                   <asp:ListItem Text="首页" Value="-1" />
                </asp:DropDownList>
              </td>
           </tr>
           <tr>
              <td class="ltd">是否转向链接</td>
              <td class="rtd">
                 <asp:RadioButtonList ID="Edit_LinkType" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal">
                    <asp:ListItem Text="否" Value="0"  Selected="True"/>
                    <asp:ListItem Text="是" Value="1" />
                 </asp:RadioButtonList>
              </td>
           </tr>          
           <tr id="edit_LinkTypetr_1">
              <td class="ltd">转向链接URL</td>
              <td class="rtd"><asp:TextBox ID="Edit_LinkUrl" runat="server" Width="300px"/>
                  <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Edit_LinkUrl"
                      ErrorMessage="地址不能为空"></asp:RequiredFieldValidator></td>
           </tr>
           <tr id="edit_LinkTypetr_2">
              <td class="ltd">文章内容 </td>
              <td class="rtd">
                  <asp:TextBox ID="Edit_Content" runat="server"  style="display:none;" />
                 <iframe src="Editor/Editor.aspx?ID=ctl00_ContentPlaceHolder1_Edit_Content" width="100%" height="200" frameborder="0"></iframe>
               </td>
           </tr>
           <tr>
              <td class="ltd">文章属性</td>
              <td class="rtd">
                 <asp:CheckBox ID="Edit_IsTop" runat="server"  /> 固顶
                 <asp:CheckBox ID="Edit_IsElite" runat="server" /> 推荐
              </td>
           </tr>
            <tr>
              <td class="ltd">录入者</td>
              <td class="rtd"><asp:TextBox ID="Edit_Editor" runat="server" /></td>
           </tr>
            <tr>
              <td class="ltd">起始点击数</td>
              <td class="rtd"><asp:TextBox ID="Edit_Hits" runat="server" /></td>
           </tr>
           <tr>
              <td class="ltd">录入时间</td>
              <td class="rtd"><asp:TextBox ID="Edit_InputTime" runat="server" /></td>
           </tr>
           <tr>
              <td class="ltd">文章有效期</td>
              <td class="rtd"><asp:TextBox ID="Edit_Validay" runat="server" />天</td>
           </tr>
           <tr>
              <td class="ltd">文章模板</td>
              <td class="rtd"><asp:TextBox ID="Edit_TemplatePath" runat="server" Width="200"/>
              <input value="浏 览" type="button" name="ll" onclick="return OpenFileList('Edit_TemplatePath')" />
              （留空则使用默认）
              </td>
           </tr>
           <tr>
            <td colspan="2">
                <div class="div_btm">
                    <asp:Button ID="Update" Text=" 保 存 " OnClick="EditArticle_OnClick"  runat="server" />
                    <input value=" 取 消 " onclick="history.back()" type="button" name="cs" />
                </div>
                <script type="text/javascript">
                   selectLinkType();
                   selectArtitleType();           
                 </script>
            </td>
           </tr>
          </table>

</asp:Content>

