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

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>菜单制作</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/adminCssEdit.htm" -->
    <link rel="stylesheet" href="../Editor/WpdccEditor/themes/default/default.css" />
    <script type="text/javascript" src="../Editor/WpdccEditor/kindeditor.js"></script>
    <script type="text/javascript" src="../Editor/WpdccEditor/lang/zh_CN.js" charset="utf-8"></script>
</head>
<body>
    <div class="edit-func-box func-box">
        <div class="hd">
            菜单制作</div>
        <form id="Form1" method="post" runat="server">
        <div class="bd">
            <table class="edit-table">
                <tr>
                    <td style="width:550px;">
                        <textarea name="content" style="width: 100%; height:490px; visibility: hidden;" ></textarea>
                    </td>
                    <td>
                        <iframe id="menusetpre" src="MenuSetPreview.aspx" width="100%" height="486" frameborder="0" ></iframe>
                        <div class="menuSet-btn">辅助功能：<input type="button" value="将系统菜单代码导入编辑器" class="btn" style="width:190px;" onClick="insetmenu()" />&nbsp;&nbsp;&nbsp;&nbsp;菜单样式选择：<select id="styleselect" class="drop-txt"><option value="0">无样式</option><option value="1">横向菜单样式</option><option value="2">纵向菜单样式</option></select></div>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft">
            <div class="pagination">
            菜单名称：<asp:TextBox ID="menuName" runat="server" class="input-txt" notnull="true" msgname="菜单名称" MaxLength="50"></asp:TextBox>&nbsp;&nbsp;
                <asp:Button ID="add" runat="server" class="btn" Text="保 存" onclientclick="return checkall()" OnClick="btnSave_Click"></asp:Button>&nbsp;&nbsp;
                <input id="content1" type="hidden" name="content1" runat="server" />
                <script type="text/javascript" language="javascript">
    var cont=document.getElementById("content1").value;
    var editor;
    
            KindEditor.ready(function(K) {
				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 : '../Editor/WpdccEditor/plugins/code/prettify.css',
	                cssData : '',
	                width : '100%',
	                minWidth : 550,//编辑器宽度
	                minHeight : 100,
	                minChangeSize : 5,
	                items : [
		                'source', '|', 'undo', 'redo', '|', 'cut', 'copy', 'paste',
		                'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
		                'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
		                'superscript', "|", 'selectall', '/',
		                'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
		                'italic', 'underline', 'strikethrough', 'lineheight', '|', 'image','multiimage', 'table', 'hr',
		                'anchor', 'link', 'unlink', '|', 'fullscreen'
	                ],
	                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 : '../Editor/WpdccEditor/aspnet/upload_json.ashx',
				    fileManagerJson : '../Editor/WpdccEditor/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();
					    });
				    }
				});
				editor.insertHtml(cont);
			});
			
			
	//点击添加
	function checkall(){
	
	    if(checkAllValidate()){
	        //获取文章内容
	        var etxtisempty = editor.isEmpty();
	        if(etxtisempty){
	            alert("不能为空！");
	            return false ;
	        }else{
                document.getElementById("content1").value =editor.html();
                return true ;
            }
	    }else{
	        return false ;
	    }
	}
	function insetmenu()
	{
	    var msp_iframe = document.getElementById("menusetpre").contentWindow
	    editor.insertHtml(msp_iframe.document.getElementById("menulist1").value);
	    //判断是否选择菜单样式
	    var selsty=document.getElementById("styleselect");
	    if(selsty.value==0)
	    {
	        //alert("未使用样式!");
	    }
	    else if(selsty.value==1)
	    {
	        editor.insertHtml("<link href=\"Images\/Menu\/menu1.css\" rel=\"stylesheet\" type=\"text\/css\" \/>");
	        editor.insertHtml("<script src=\"Images\/Menu\/menu1.js\"><\/script>");
	        //alert("横向菜单样式!");
	    }
	    else if(selsty.value==2)
	    {
	        editor.insertHtml("<link href=\"Images\/Menu\/menu2.css\" rel=\"stylesheet\" type=\"text\/css\" \/>");
	        editor.insertHtml("<script src=\"Images\/Menu\/menu2.js\"><\/script>");
	        //alert("纵向菜单样式!");
	    }
	    else
	    {
	        alert("菜单样式选择出错!");
	    }
	}
    </script>
            </div>
            <!--/action-field-->
        </div>
        </form>
    </div>
</body>
</html>
