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

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head runat="server">
    <title>栏目美工</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "css/head.htm" -->
    <link rel="stylesheet" href="../Wpedt/WpdccEditor/themes/default/default.css" />
      <style>
        #ColorPicker {
            z-index: 1; /*修改拾色器显示层级*/
        }
    </style>
    <script language="javascript" src="../Js/ColorPicker.js" charset="utf-8"></script>

    <script type="text/javascript" src="../Wpedt/WpdccEditor/kindeditor.js"></script>

    <script type="text/javascript" src="../Wpedt/WpdccEditor/lang/zh_CN.js" charset="utf-8"></script>

    <script type="text/javascript" language="javascript">
    //自定义上传图片控件加载，支持自定义上传图片功能需先引用三个文件，[themes/default/default.css] [kindeditor.js] [lang/zh_CN.js]
			KindEditor.ready(function(K) {
			
				var editor = K.editor({
				    uploadJson : '../Wpedt/WpdccEditor/aspnet/upload_json.ashx',
				    fileManagerJson : '../Wpedt/WpdccEditor/aspnet/file_manager_json.ashx',
					allowFileManager : true
				});
				//
				//fontImg添加文字
				//
				K('#btnZdyTitle').click(function() {
					
				        var dialog= K.dialog({
                        width : 500,
                        title : '栏目标题设置',
                        body : '<div style="margin:10px;"><iframe id="efontEditor" src="visualArtdesignEditor/eWeb.html" frameborder="0" width="460" scrolling="no" height="180"></iframe></div>',
                        closeBtn : {
                                name : '关闭',
                                click : function(e) {
                                        dialog.remove();
                                }
                        },
                        yesBtn : {
                        name : '确定',
                        click : function(e) {
                                        
                                        document.getElementById("moduleTitle").innerHTML=frames["efontEditor"].editor.html();
                                        document.system.centerTopFontvar.value=frames["efontEditor"].editor.html();
                                        dialog.remove(); 
                                }
                        },
                        noBtn : {
                                name : '关闭',
                                click : function(e) {
                                        dialog.remove();
                                }
                        }
                        });
				});
				//--end
				//图片上传--
				K('#btnPic').click(function() {
					editor.loadPlugin('zdyartdesign', function() {
						editor.plugin.zdyartdesignDialog({
							zdylefttopfrontimgUrl : K('#bgImageVar').val(),
							clickFn : function(url) {
							url=K.formatUrl(url, 'relative');
								K('#bgImageVar').val(url);
								editor.hideDialog();
								//change("leftTopFrontImagevar","leftTopFrontImage");//加载预览图片
								//document.getElementById("txtStyle").value=document.getElementById("txtStyle").value+url;
    							url=url.replace(/\.\.\/Images/i,"..")
    							K('#txtPicPath').val(url);
//								addSplitToField(document.getElementById('txtStyle'),url);
//								alert("已将路径添加到文本框！");
                                
							}
						});
					});
				});
			})
    </script>

    <script type="text/javascript">
			  //点击保存
    function checkall()
    {
        var artname=document.getElementById("artDesignName").value;
        if(artname=="" || artname=="undefined" || artname==null){
            alert("栏目美工模板名称不能为空");
            return false ;
        }
        return true ;
    }
    function addSplitToField($t,myValue){
        if (document.selection) {
            $t.focus();
            sel = document.selection.createRange();
            sel.text = myValue;
            $t.focus();
        }
        else if($t.selectionStart || $t.selectionStart == '0') {
            var startPos = $t.selectionStart;
            var endPos = $t.selectionEnd;
            var scrollTop = $t.scrollTop;
            $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
            this.focus();
            $t.selectionStart = startPos + myValue.length;
            $t.selectionEnd = startPos + myValue.length;
            $t.scrollTop = scrollTop;
        }else{
            $t.value += myValue;
            $t.focus();
        }
    }
      // 关闭弹出层 刷新栏目设置
        function delayClose(){
            parent.$.fancybox.close();
            parent.location="manageVisualArtDesign.aspx";
        }
        
        function setcolor(type) {
            var arr = showModalDialog("../Wpedt/WpdccEditor/Dialog/selcolor.htm", "", "dialogWidth:300px; dialogHeight:260px; status:0");
            if (arr != null) {
                var button = eval("document.system." + type);
                button.value = arr;
                var table = eval(type + "Table");
                table.bgColor = arr;
            }
        }

        function setTableColor(type) {

            var button = eval("document.system." + type);
            var table = eval(type + "Table");
            table.bgColor = button.value;
        }
    </script>

</head>
<body>
    <div class="edit-func-box func-box">
        <form id="system" method="post" runat="server">
        <div class="hd b">
            栏目模板美工制作</div>
        <div class="space-4"></div>
            <div class="bd">
            <table class="edit-table">
                <tr>
                    <td>
                        <%--<input type="button" id="btnPreview" value="预 览" class="btn" onclientclick="add_css()" />--%>
                        <asp:Button ID="btnPreview" Text="预 览" CssClass="btn btn-sm btn-primary"  OnClick="Btn_Click"  runat="server"/>
                        <input type="button" id="btnZdyTitle" value="自定义标题" class="btn btn-sm btn-primary" style="display:none;" />
                        &nbsp;取色器：
                        <asp:TextBox ID="txtColor" runat="server" CssClass="input-md"></asp:TextBox>&nbsp;<script>CreateCPBtn('txtColor');</script>

                        <asp:TextBox ID="txtStyle" runat="server" TextMode="MultiLine" Width="490px" Height="300px"
                            Style="margin: 5px 0px;"></asp:TextBox>
                    </td>
                    <td>
                        栏目效果预览面板：
                        <div id="module" class="<%=artCode%> module" style="width: 310px; height: 200px;">
                            <div class="hd b">
                                    <span id="moduleTitle" runat="server">栏目标题</span>
                            </div>
                            <div class="nsy-bd">
                                <div class="model">
                                    <div style="height: 150px">
                                        动态内容</div>
                                </div>
                            </div>
                        </div>
                        <input type="button" id="btnPic" value="上传图片" class="btn btn-sm btn-primary" style="margin: 5px 0px;" /><br />
                        <span>上传的图片路径：</span>
                        <input type="text" id="txtPicPath" class="input-md" style="width:300px;" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                       <a  href="http://www.w3school.com.cn/css/index.asp" target="_blank" >样式参考网站</a>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft">
            <div class="pagination">
                栏目模板名称：<asp:TextBox ID="artDesignName" runat="server" CssClass="input-md"></asp:TextBox>&nbsp;
                <asp:Button ID="btnAdd" runat="server" Text="保存" CssClass="btn btn-sm btn-primary" OnClientClick="return checkall()"
                    OnClick="Btn_Click" />
            </div>
            <!--/action-field-->
        </div>
        <%--  <input id="bgImageVar" type="hidden" runat="server" />--%>
        <asp:HiddenField ID="bgImageVar" runat="server" />
        <asp:HiddenField ID="centerTopFontvar" runat="server" />
        </form>
    </div>
 <!--#include file="Css/foot.htm"-->

</body>
</html>
