<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Article_Edit.aspx.cs" Inherits="TotCms.Web.Admin.Article_Edit" 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 id="Head1" 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==1){
        for(var j=2;j<=3;j++){
			    document.getElementById("outLink"+j).style.display="none";
		    }
		    document.getElementById("outLink1").style.display="";	
      }else{
        for(var j=2;j<=3;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 InsertHTML() {
		  // Get the editor instance that we want to interact with.
		  var oEditor = CKEDITOR.instances.Content;
		  var value = win_frame.document.getElementById('TextBox1').value + win_frame.document.getElementById('TextBox2').value;
		  // Check the active editing mode.
		  if (oEditor.mode == 'wysiwyg') {
		    // Insert the desired HTML.
		    oEditor.insertHtml(value);
		  }
		  else {
		    alert('You must be on WYSIWYG mode!');
		  }
		  CloseFrame();
		}
    var cp = new ColorPicker();	
    </script>
    <script src="../ckeditor/ckeditor.js" type="text/javascript"></script>
  <script src="../ckeditor/ckeditor.js" type="text/javascript"></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");
      }
      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" Text="Label"></asp:Label>
        <asp:TextBox ID="CategoryId" runat="server" CssClass="hidden"></asp:TextBox>
          <input id="Button4" type="button" value="..." onclick="popupWindow('Category_Tree.aspx','category_tree',400,300,1)" />
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 题：</td>
      <td class="fields_input">
        <asp:TextBox ID="Title" runat="server" CssClass="input_middle"></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></td>
    </tr>
    <tr>
      <td class="fields_text">
        副标题：</td>
      <td class="fields_input">
        <asp:TextBox ID="SubHeading" runat="server" CssClass="input_middle"></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"></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:TextBox ID="Editor" runat="server" CssClass="input_mini"></asp:TextBox>
&nbsp;来源：<asp:TextBox ID="SourceFrom" runat="server" CssClass="input_mini"></asp:TextBox>
          </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">
        </asp:DropDownList>
&nbsp;选择文章模板：<asp:DropDownList ID="TemplateId" runat="server">
        </asp:DropDownList>
          </td>
    </tr>
    <tr>
      <td class="fields_text">
        缩略图：</td>
      <td class="fields_input">
        <asp:TextBox ID="Photo" runat="server"></asp:TextBox>
        <input name="UpLoad" type="button" id="UpLoad" value="上传" onclick="popupWindow('Upload.aspx','UpLoad',420,130,1)" />
          </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"></asp:TextBox>
&nbsp;显示个数：<asp:TextBox ID="RelateNum" runat="server" CssClass="input_mini">10</asp:TextBox>
          </td>
    </tr>
    <tr id="outLink3">
      <td class="fields_input" colspan="2">
        <asp:TextBox ID="Content" runat="server" CssClass="hidden" 
          TextMode="MultiLine">文章内容</asp:TextBox>
          <!-- This div will hold the editor. -->
	        <div id="editor"></div>
          <script type="text/javascript">
		      //<![CDATA[
			      // Replace the <textarea id="Content"> with an CKEditor instance.
			      var editor = CKEDITOR.replace( 'Content',
			      {
            filebrowserBrowseUrl : 'ckfinder/ckfinder.html',//启用浏览功能
            filebrowserImageBrowseUrl : 'ckfinder/ckfinder.html?Type=Images',
            filebrowserFlashBrowseUrl : 'ckfinder/ckfinder.html?Type=Flash',
            filebrowserUploadUrl : 'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Files',
            filebrowserImageUploadUrl : 'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Images',
            filebrowserFlashUploadUrl : 'ckfinder/core/connector/aspx/connector.aspx?command=QuickUpload&type=Flash'
            }
            );
          function insertPagestr() {
            if (editor.mode == 'wysiwyg') {
              editor.insertText('$PageSplit$');
            }
          }
		      //]]>
		      </script>
          <input type="button" value="插入分页符" onclick="insertPagestr()" />
          <input type="button" value="导入WORD文档" onclick="ImportWord_Open()" />
          </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">
          <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="Hits" runat="server" CssClass="input_normal">1</asp:TextBox>
          </td>
    </tr>
    <tr style="display:none;">
      <td class="fields_text">
          生成文件名：</td>
      <td class="fields_input">
        <asp:TextBox ID="SavePath" runat="server" CssClass="input_middle"></asp:TextBox>
      </td>
    </tr>
    <tr>
      <td class="fields_text">
          自定义字段：</td>
      <td class="fields_input">
      <div id="CustomFields" runat="server"></div>
      </td>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <asp:Button ID="IsOutLink" runat="server" Text="Button" Visible="False" />
        <asp:Button ID="Button1" runat="server" Text="修改文章" onclick="Button1_Click" />
        <input id="Button2" type="reset" value="取 消" /></td>
    </tr>
  </table>
  <div id="dialog-win" title="导入WORD文档">
	  <iframe id="win_frame" name="win_frame" src="ImportWord.aspx" width="500" height="170" frameborder="0"></iframe>	
  </div>
  <script type="text/javascript">uplink(<%= _isoutlink %>);</script>
    </form>
    
</body>
</html>
