<%@ Page Language="c#" Inherits="Web.User.modifySiteContribute" CodeBehind="modifySiteContribute.aspx.cs" %>

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>sitecontribute</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/userCssEdit.htm" -->

</head>
<body>
    <form method="post" runat="server">
    <div class="edit-func-box func-box">
        <div class="hd">
            编辑</div>
        <div class="bd">
            <table class="edit-table" id="Table1">
                <tr>
                    <th>
                        投稿栏目：
                    </th>
                    <td>
                        <asp:DropDownList ID="contributeClass" runat="server" DataTextField="name" DataValueField="bigClassId" Enabled="False">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        文章标题：
                    </th>
                    <td>
                        <asp:TextBox ID="intactTitle" runat="server" notNull="true" msgName="文章标题" class="input-md w3" MaxLength="250"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="* "
                            ControlToValidate="intactTitle"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <th>
                        相关信息：
                    </th>
                    <td>
                        <asp:TextBox ID="about" runat="server" regex="[^&quot;^'^\*^\?^,^\.^(^)]+" regexMsg="相关信息格式不正确" MaxLength="50" class="input-md w3"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="非法字符串！" ControlToValidate="about" ValidationExpression="[^&quot;^'^\*^\?^,^\.^(^)]+"></asp:RegularExpressionValidator>
                        &nbsp;<span class="lgrey">用来查找相关文章，中间用“|”隔开；不能出现""'*?,.()等字符</span>
                    </td>
                </tr>
                <tr>
                    <th>
                    </th>
                    <td>
                        <div class="more-edit">
                            <div class="more-edit-fn">
                            作者：<asp:TextBox ID="author" runat="server" notNull="true" msgName="作者" class="input-md" MaxLength="50" Width="60"></asp:TextBox>
                        作者信箱：<asp:TextBox ID="authorMail" runat="server" regex="/^(\w)+(\.\w+)*@(\w)+((\.\w{2,3}){1,3})$/" regexMsg="信箱格式不正确" class="input-md" MaxLength="50" Width="108"></asp:TextBox>
                        &emsp;来源：<asp:TextBox ID="copyFrom" runat="server" notNull="true" msgName="来源" class="input-md" MaxLength="100" Width="108"></asp:TextBox>
                        来源地址：<asp:TextBox ID="copyFromLink" runat="server" class="input-md" MaxLength="50" Width="108"></asp:TextBox>
                        &emsp;内容分页：
                        <asp:DropDownList ID="pageType" runat="server" onchange="ShowPageTag(this.selectedIndex);" CssClass="input-md" Width="80">
                            <asp:ListItem Value="0">不分页</asp:ListItem>
                            <asp:ListItem Value="2">手动分页</asp:ListItem>
                        </asp:DropDownList>
                        &nbsp;<a id="pageTagA" href="javascript:void(0);" onclick="InsertPagingTag();" title="插入文章内容分页标记" style="display:none;" ><span class="blue">插入分页标记</span></a>
                        <asp:TextBox ID="autoPageCharNum" runat="server" Visible="False">10000</asp:TextBox>
                        <asp:Panel ID="ReadPointPanel" runat="server" Visible="False">
                            文章阅读点数：
                            <asp:TextBox ID="readPoint" runat="server">0</asp:TextBox>
                        </asp:Panel>
                        
                            </div>
                        </div>
                    </td>
                </tr>
                <tr>
                    <th>
                        文章内容：
                    </th>
                    <td>
                        <textarea name="content" style="width: 100%; height:480px; visibility: hidden;" ></textarea>
                    </td>
                </tr>
            </table> 
        </div>
        <div class="ft">
            <div class="action-field text-center">
                <asp:Button ID="ok" runat="server" Text="保 存" OnClick="ok_Click" CommandName="add" class="btn btn-sm btn-primary" OnClientClick="return checkAll();"></asp:Button>&nbsp;
                <asp:Button ID="cancel" runat="server" Text="取 消" CausesValidation="False" OnClick="cancel_Click" class="btn btn-sm btn-primary"></asp:Button>
            </div>
            <!--/action-field-->
        </div>
        <div>
            <input id="content1" type="hidden" name="content1" runat="server" />
            <input id="listTitle" type="hidden" name="listTitle" runat="server" />
        </div>
    </div>
    <!--#include file = "../Css/foot.htm" -->
    <script type="text/javascript">
        //声明编辑器
        var contentTxt;
    KindEditor.ready(function(K) {
				    var editor = K.create('textarea[name="content"]', {
				    designMode : true,
	                fullscreenMode : false,
	                filterMode : false,//是否开启过滤HTML代码
	                wellFormatMode : true,
	                shadowMode : true,
	                loadStyleMode : true,
	                basePath : K.basePath,
	                themesPath : K.basePath + 'themes/',
	                langPath : K.basePath + 'lang/',
	                pluginsPath : K.basePath + 'plugins/',
	                themeType : 'default',
	                langType : 'zh_CN',
	                urlType : '',
	                newlineTag : 'p',
	                resizeType : 2,
	                syncType : 'form',
	                pasteType : 2,
	                dialogAlignType : 'page',
	                useContextmenu : true,//是否启用右键菜单
	                fullscreenShortcut : false,
	                bodyClass : 'ke-content',
	                indentChar : '\t',
	                cssPath : '../Wpedt/UserEditor/plugins/code/prettify.css',
	                cssData : '',
	                width : '100%',
	                minWidth : 650,
	                minHeight : 100,
	                minChangeSize : 5,
	                items : [
		                'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
		                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
		                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
		                'superscript', 'clearhtml', 'selectall', '|', 'fullscreen', '/',
		                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
		                'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image','multiimage', 'flash',
		                'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
		                'anchor', 'link', 'unlink', '|', 'quickformat'
	                ],
	                noDisableItems : ['source', 'fullscreen'],
	                colorTable : [
		                ['#E53333', '#E56600', '#FF9900', '#64451D', '#DFC5A4', '#FFE500'],
		                ['#009900', '#006600', '#99BB00', '#B8D100', '#60D978', '#00D5FF'],
		                ['#337FE5', '#003399', '#4C33E5', '#9933E5', '#CC33E5', '#EE33EE'],
		                ['#FFFFFF', '#CCCCCC', '#999999', '#666666', '#333333', '#000000']
	                ],
	                fontSizeTable : ['9px', '10px', '12px', '14px', '16px', '18px', '24px', '32px'],
	                htmlTags : {
		                font : ['color', 'size', 'face', '.background-color'],
		                span : [
			                '.color', '.background-color', '.font-size', '.font-family', '.background',
			                '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.line-height'
		                ],
		                div : [
			                'align', '.border', '.margin', '.padding', '.text-align', '.color',
			                '.background-color', '.font-size', '.font-family', '.font-weight', '.background',
			                '.font-style', '.text-decoration', '.vertical-align', '.margin-left'
		                ],
		                table: [
			                'border', 'cellspacing', 'cellpadding', 'width', 'height', 'align', 'bordercolor',
			                '.padding', '.margin', '.border', 'bgcolor', '.text-align', '.color', '.background-color',
			                '.font-size', '.font-family', '.font-weight', '.font-style', '.text-decoration', '.background',
			                '.width', '.height', '.border-collapse'
		                ],
		                'td,th': [
			                'align', 'valign', 'width', 'height', 'colspan', 'rowspan', 'bgcolor',
			                '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.font-weight',
			                '.font-style', '.text-decoration', '.vertical-align', '.background', '.border'
		                ],
		                a : ['href', 'target', 'name'],
		                embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'],
		                img : ['src', 'width', 'height', 'border', 'alt', 'title', 'align', '.width', '.height', '.border'],
		                'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [
			                'align', '.text-align', '.color', '.background-color', '.font-size', '.font-family', '.background',
			                '.font-weight', '.font-style', '.text-decoration', '.vertical-align', '.text-indent', '.margin-left'
		                ],
		                pre : ['class'],
		                hr : ['class', '.page-break-after'],
		                'br,tbody,tr,strong,b,sub,sup,em,i,u,strike,s,del' : []
	                },
	                layout : '<div class="container"><div class="toolbar"></div><div class="edit"></div><div class="statusbar"></div></div>',
	                
	                uploadJson : '../Wpedt/UserEditor/aspnet/upload_json.ashx',
				    fileManagerJson : '../Wpedt/UserEditor/aspnet/file_manager_json.ashx',
				    
				    allowFileManager : true,
				    afterCreate : function() {
					    var self = this;
					    K.ctrl(document, 13, function() {
						    self.sync();
						    K('form[name=example]')[0].submit();
					    });
					    K.ctrl(self.edit.doc, 13, function() {
						    self.sync();
						    K('form[name=example]')[0].submit();
					    });
				    }
					
					
				});
				
				//编辑时加载内容
                var initcontxt=document.getElementById("content1");
                    editor.insertHtml(initcontxt.value);
                    
                    contentTxt=editor;
			});
			
    </script>
    
    <script type="text/javascript">
    
		 // 显示分页标记
		function ShowPageTag(selectedIndex) 
		{
			if (selectedIndex!=1)
	        {
	            document.getElementById("pageTagA").style.display = "none";
	        }
	        else
	        {
		        document.getElementById("pageTagA").style.display = "";
	        }
		}
		
		function InsertPagingTag()
		{
			contentTxt.focus();
            contentTxt.insertHtml("<button id=\"ZDSOFTPAGINGTAG\">分页标记</button>");
            contentTxt.focus();
		}
	
    function checkAll()
    {
        //验证
        if (checkAllValidate()){
            //保存
            //判断内容是否为空
            var etxtisempty = contentTxt.isEmpty();
            if(etxtisempty){
                     alert("文章内容不能为空！");
                    return false ;
                }else{
                    //获取文章内容
                    var gettxttitle= contentTxt.html();
                    var contxt=document.getElementById("content1");
                    contxt.value =gettxttitle;
                    return true ;
                }
        }else{
            return false ;
        }
    }
    
    ShowPageTag(document.all.pageType.selectedIndex);
            
    </script>
    
    </form>
</body>
</html>
