<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Article_Add.aspx.cs" Inherits="TotCms.Web.Admin.Article_Add" ValidateRequest="false" %>

<%@ Register src="UI/main_top.ascx" tagname="main_top" tagprefix="uc1" %>

<%@ Register assembly="TotCms.Controls" namespace="TotCms.Controls" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <title>添加文章</title>
    <link href="style/global.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="js/ColorPicker.js"></script>
    <script src="js/xmlhttp.js" type="text/javascript"></script>
    <script src="js/common.js" type="text/javascript"></script>
    <script type="text/javascript">
    function uplink(val){
      if(val){
        for(var j=2;j<=4;j++){
			    document.getElementById("outLink"+j).style.display="none";
		    }
		    document.getElementById("outLink1").style.display="";	
      }else{
        for(var j=2;j<=4;j++){
			    document.getElementById("outLink"+j).style.display="";
		    }
		    document.getElementById("outLink1").style.display="none";	
      }
    }
    function seleTemplate(classid){	
	    var tarobj=document.form1.TemplateId;
	    var xmlhttp;	 
	    xmlhttp=getXMLRequester();		
	    if(xmlhttp){	
		    xmlhttp.onreadystatechange = function doAction() {		
			    if (xmlhttp.readyState == 4)
			    {								
				    var response = xmlhttp.responseXML.documentElement;
				    var classidList = response.getElementsByTagName('category');	
				    xx=classidList[0].getElementsByTagName('showtemplateid');					
				    tmtid=xx[0].firstChild.data;				
				    for(var i=0;i<tarobj.options.length;i++){					
					    if(tmtid==tarobj.options[i].value){
						    tarobj.options[i].selected=true;
					    }
				    }
			    }
		    };
		    xmlhttp.open("POST", "Category_Xml_Detail.aspx?id="+classid,true);
		    xmlhttp.send("");
	    }
    }
    function GetOptionText(str,did){
        var tarobj=document.getElementById(did);
        if(tarobj!=null){
            tarobj.value=str;
        }
    }
    
    function OpenImport() {
        document.getElementById('ImportWord').src = 'ImportWord.aspx';
    }
    function CloseImport() {
        document.getElementById('ImportWord').src = '';
    }
    var cp = new ColorPicker();	
    </script>    
    <script src="../js/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="../js/jquery-ui-1.8.10/js/jquery-ui-1.8.10.custom.min.js" type="text/javascript"></script>
    <link href="../js/jquery-ui-1.8.10/css/ui-lightness/jquery-ui-1.8.10.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
      $(function () {
        $("#dialog:ui-dialog").dialog("destroy");
        $("#dialog-win").dialog({
          autoOpen: false,
          width: 530,
          height: 250,
          modal: true,
          close: function () {

          }
        });

      });      
      function ImportWord_Open() {
        $("#dialog-win").dialog("open");
        document.getElementById('win_frame').src = 'ImportWord.aspx';
        $("#dialog-win").dialog('option', 'title', '导入Word');
      }
      function Upload_Open() {
        $("#dialog-win").dialog("open");
        document.getElementById('win_frame').src = 'Upload.aspx';
        $("#dialog-win").dialog('option', 'title', '上传图片');
      }
      function CloseFrame() {
        $("#dialog-win").dialog("close");
      }
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    
      <uc1:main_top ID="main_top1" runat="server" />
    
    </div>
    <table style="width:100%;" border="0" cellpadding="0" cellspacing="1" 
      class="black_border">
      <tr class="suphead">
        <td colspan="2">
                                        添加文章</td>
    </tr>
    <tr>
      <td class="fields_text">
        栏目：</td>
      <td class="fields_input">
          <asp:Label ID="CategoryTitle" runat="server" CssClass="category"></asp:Label>
          &lt;&lt;-提示：点击左侧“栏目导航”中的栏目名称来选择。
     </td>
    </tr>
    <tr>
      <td class="fields_text" width="100">
        标题：</td>
      <td class="fields_input">
        <asp:TextBox ID="Title" runat="server" CssClass="input_long"></asp:TextBox>
&nbsp; 颜色：<asp:TextBox ID="TitleColor" runat="server" CssClass="input_mini"></asp:TextBox>
          <A id="pick2" onclick="cp.select(document.forms[0].TitleColor,'pick2');return false;" href="#" name="pick2">
	  <img src="images/icon/rect.gif" width="18" height="17" border="0" align="absmiddle" id="ColorpPicker" style="background-color:#006699;" />	  </A>
	  <script type="text/javascript">cp.writeDiv();</script>
          <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
              ControlToValidate="Title" ErrorMessage="请填写文章标题"></asp:RequiredFieldValidator>
                </td>
    </tr>
    <tr>
      <td class="fields_text">
        副标题：</td>
      <td class="fields_input">
        <asp:TextBox ID="SubHeading" runat="server" CssClass="input_long"></asp:TextBox>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        Keywords：</td>
      <td class="fields_input">
        <asp:TextBox ID="KeyWords" runat="server" CssClass="input_middle"></asp:TextBox>
          &nbsp;Tags：<asp:TextBox ID="Tags" runat="server" CssClass="input_normal"></asp:TextBox>
          多个以空格分隔</td>
    </tr>
    <tr>
      <td class="fields_text">
        作者：</td>
      <td class="fields_input">
        <asp:TextBox ID="Author" runat="server" CssClass="input_mini"></asp:TextBox>
&nbsp;<asp:DropDownList ID="DdAuthor" runat="server" OnLoad="DdAuthor_Load" 
          CssClass="select">
          </asp:DropDownList>
          编辑：<asp:TextBox ID="Editor" runat="server" CssClass="input_mini"></asp:TextBox>
&nbsp;<asp:DropDownList ID="DdEditor" runat="server" OnLoad="DdEditor_Load" 
          CssClass="select">
          </asp:DropDownList>
          来源：<asp:TextBox ID="SourceFrom" runat="server" CssClass="input_mini"></asp:TextBox>
          <asp:DropDownList ID="DdFrom" runat="server" OnLoad="DdFrom_Load" 
          CssClass="select">
          </asp:DropDownList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        文章属性：</td>
      <td class="fields_input">
        <asp:CheckBox ID="Images" runat="server" Text="图文" />
        <asp:CheckBox ID="Top1" runat="server" Text="头条" />
        <asp:CheckBox ID="ToHot" runat="server" Text="热点" />
        <asp:CheckBox ID="Recommend" runat="server" Text="推荐" />
        <asp:CheckBox ID="ToTop" runat="server" Text="置顶" />
        <asp:CheckBox ID="IsSlide" runat="server" Text="幻灯片" />
        </td>
    </tr>
    <tr>
      <td class="fields_text">
        选择专题：</td>
      <td class="fields_input">
        <asp:DropDownList ID="SpecialId" runat="server" CssClass="select">
        </asp:DropDownList>
&nbsp;选择文章模板：<asp:DropDownList ID="TemplateId" runat="server" CssClass="select">
        </asp:DropDownList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        缩略图：</td>
      <td class="fields_input">
        <asp:TextBox ID="Photo" runat="server" CssClass="input_middle"></asp:TextBox>
        <input name="UpLoad" type="button" id="UpLoad" value="上传" onclick="Upload_Open()" class="btn-general" />
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        是否外部链接：</td>
      <td class="fields_input">
        <asp:CheckBox ID="IsOutLink" runat="server" OnLoad="IsOutLink_Load" />
          </td>
    </tr>
    <tr id="outLink1" style="display:none;">
      <td class="fields_text">
        外部链接地址：</td>
      <td class="fields_input">
        <asp:TextBox ID="OutLinkUrl" runat="server" CssClass="input_middle"></asp:TextBox>
          </td>
    </tr>
    <tr id="outLink2">
      <td class="fields_text">
        相关文章设置：</td>
      <td class="fields_input">
        关键字：<asp:TextBox ID="RelateKey" runat="server" 
          CssClass="input_normal"></asp:TextBox>
&nbsp;显示个数：<asp:TextBox ID="RelateNum" runat="server" CssClass="input_mini">10</asp:TextBox>
          <asp:RangeValidator ID="RangeValidator1" runat="server" 
              ControlToValidate="RelateNum" ErrorMessage="允许的范围为1-20" MaximumValue="20" 
              MinimumValue="1"></asp:RangeValidator>
          </td>
    </tr>
    <tr id="outLink4">
      <td class="fields_text" valign="top">
        内容编辑：        
        <div style="margin:5px 0px;">
          <input type="button" value="插入分页符" onclick="insertPagestr()" 
          class="btn-general" />
          </div>
          <div style="margin:5px 0px;">
          <input type="button" value="导入WORD" onclick="ImportWord_Open()" 
          class="btn-general" />
          </div>
          <div style="margin:5px 0px;" id="outLink3">
        <asp:CheckBox ID="SaveRemoteImg" runat="server" Text="远程存图" />
        </div>
          </td>
      <td class="fields_input">        
        <asp:TextBox ID="Content" runat="server" CssClass="hidden" 
          TextMode="MultiLine">&nbsp;</asp:TextBox>          
          <cc1:Editor ID="Editor1" runat="server" EditorPath="" 
          FieldName="Content" />
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        文章摘要：</td>
      <td class="fields_input">
        <asp:TextBox ID="Summary" runat="server" CssClass="text_normal" 
          TextMode="MultiLine"></asp:TextBox>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        文章状态：</td>
      <td class="fields_input">
        <asp:DropDownList ID="Checked" runat="server" CssClass="select">
          <asp:ListItem Value="1">已审核</asp:ListItem>
          <asp:ListItem Value="0">未审核</asp:ListItem>
        </asp:DropDownList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
          生成文件名：</td>
      <td class="fields_input">
        <asp:TextBox ID="tbSavePath" runat="server" Width="335px" CssClass="input_long"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
          ControlToValidate="tbSavePath" ErrorMessage="生成文件名不能为空"></asp:RequiredFieldValidator>
      </td>
    </tr>
    <tr>
      <td class="fields_text">
          自定义字段：</td>
      <td class="fields_input">
      <div id="CustomFields" runat="server"></div>
      </td>
    </tr>
    <tr>
      <td></td>
      <td align="left" height="50">
        <asp:Button ID="Button1" runat="server" Text="添加文章" onclick="Button1_Click" 
          CssClass="btn-submit" />
        <input id="Button2" type="reset" value="取 消" class="btn-cancel" onclick="javascript:history.back();" />
        
        </td>
    </tr>
  </table>
  <div id="dialog-win" title="window">
	  <iframe id="win_frame" name="win_frame" src="Blank.htm" width="500" height="170" frameborder="0"></iframe>	
  </div>
  <br />
    </form>
</body>
</html>
