<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Template_EditLabel.aspx.cs" Inherits="PowerEasy.Module.General.WebSite.Admin.Template.Template_EditLabel" ValidateRequest="false" EnableTheming="false" Theme="" StylesheetTheme=""%>

<!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">
    <title>标签编辑器</title>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <style type="text/css">
     a,area,label,input {blr:expression(this.onFocus=this.blur());outline-style:none;  } /* for IE */
     :focus {-moz-outline-style: none; }  /*for Firefox   */
        
    #LabelAdd,#LabelInfo{ line-height:24px; font-size:12px;}
    #LabelAdd input,#LabelInfo input{ border:1px solid #ccc;border: expression((this.type=="checkbox" || this.type=="radio") ?"0px":"style"); border-radius:2px; height:20px; line-height:20px; padding:0 3px;}
    #LabelAdd select,#LabelInfo select{border:1px solid #ccc; border-radius:2px;} 
    #LabelInfo .tit{ height:26px; line-height:26px; padding:10px 0px 0px;}  
    #LabelInfo .tit h4{ font-size:14px; padding:0 15px; margin:0; border-bottom:1px solid #ccc;}
    #LabelInfo .con{}
    #LabelInfo .con .hd{line-height:20px; color:#999; padding:5px 15px; margin:0px; background:#f2f2f2;border-bottom:1px solid #ccc;}
    #LabelInfo .bd{ height:220px; overflow-y:scroll; overflow-x:hidden;}
    #LabelInfo .bot{padding:10px; background:#f5f5f5;border-top:1px solid #ccc;}   
    #LabelInfo .bot div{height:26px; line-height:26px;padding:2px;}
    #LabelInfo .bot div.c1{padding-left:140px;}
    #LabelInfo .bot div.c2{ padding-left:210px;}
    #LabelInfo .bot input,#LabelInfo .bot label,#LabelInfo .bot span{display:block; float:left;}         
    #LabelInfo .bot  div.c2 input{display:block;float:left;height:24px;line-height:24px;background:#4b8df9;border:1px solid #3079ed;border-radius:2px;margin-right:5px;padding:0 14px;color:#fff; outline:none;}
    #LabelInfo .bot span{color:#3179ed;padding-left:10px; width:250px;} 
    
    #LabelAdd .tit{padding-top:15px; height:36px; line-height:36px;border-bottom:1px solid #ccc;font-size:14px; font-weight:bold; text-align:center;}
    #LabelAdd .con{text-align:center; padding:10px 0;}
    
    select#ddlnodeId{ width:200px;}
    .editlabeltr{height: 0;line-height:0;}
    .editlabeltdleft{width:45%;}
    </style>

</head>
<body>
    <form runat="server" id="form1">
    <table runat="server" id="LabelAdd" visible="false" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td class="tit">选择内容标签</td>
      </tr>
        <tr>
       <td class="con">
            选择分类：<asp:DropDownList ID="LabelTypeDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="LabelTypeDropDownList_SelectedIndexChanged">
            </asp:DropDownList>
            选择标签：
            <asp:DropDownList ID="LabelDropDownList" runat="server" AutoPostBack="true" OnSelectedIndexChanged="LabelDropDownList_SelectedIndexChanged">
            </asp:DropDownList>
       </td>
      </tr>
    </table>
    <table runat="server" id="LabelInfo" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td class="tit">
                <h4><asp:Label ID="LabelName" runat="server"></asp:Label></h4>
            </td>
        </tr>
        <tr>
            <td class="con">
                    <div class="hd">
                        <asp:Label ID="labelintro" runat="server">无标签说明</asp:Label></div>
                    <div class="bd">
                        <pe:ExtendedLabel HtmlEncode="false" ID="labelbody" runat="server"></pe:ExtendedLabel>
                    </div>
            </td>
        </tr>
        <tr>
            <td class="bot">
                <div class="c1"><input id="InstertAllParm" type="checkbox" /><label for="InstertAllParm">插入所有参数</label><span>否则与默认值相等的参数将不被插入。</span></div>
                <div class="c2"><asp:Button runat="server" ID="saveadd" CssClass="inputbutton" Text="添加" OnClientClick="submitdate(1);return false;" Visible="false" />
                <asp:Button runat="server" ID="saveedit" CssClass="inputbutton" Text="保存" OnClientClick="submitdate(0);return false;" />
                <input type="button" class="inputbutton" value="取消" onclick="drapDrop();" /></div>
            </td>
        </tr>
    </table>
    <script language="JavaScript" type="text/javascript">
        function drapDrop() {
            parent.petemplate.PELabeldivoverlayCloseWindow();
        }

        function submitdate(type) {
            var returnstr;
            returnstr = "{PE.Label id=\"" + document.getElementById("<% =LabelName.ClientID %>").innerHTML + "\"";
            var oSpanArr = document.getElementsByTagName('SPAN');
            var isInstertAllParm = document.getElementById("InstertAllParm").checked;
            for (var i = 0; i < oSpanArr.length; i++) {
                var defaultvalue = oSpanArr[i].getAttribute("defaultvalue");
                switch (oSpanArr[i].getAttribute("stype")) {
                    case "0":
                        var pvalue = document.getElementById(oSpanArr[i].getAttribute("sid")).value;
                        if (pvalue != "" && (pvalue != defaultvalue || isInstertAllParm) && i > 0)
                            returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"" + pvalue + "\"";
                        break;
                    case "1":
                        var oSelectArr = document.getElementById(oSpanArr[i].getAttribute("sid"));
                        for (var j = 0; j < oSelectArr.length; j++) {
                            if (oSelectArr[j].selected == true && (j != defaultvalue || isInstertAllParm)) {
                                returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"" + oSelectArr[j].value + "\"";
                            }
                        }
                        break;
                    case "2":
                        if (document.getElementById(oSpanArr[i].getAttribute("sid")).checked) {
                            if (defaultvalue != "true" || isInstertAllParm) {
                                returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"true\"";
                            }
                        }
                        else {
                            if (defaultvalue != "false" || isInstertAllParm) {
                                returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"false\"";
                            }
                        }
                        break;
                    case "3":
                        var oSelectArr = document.getElementById(oSpanArr[i].getAttribute("sid"));
                        var numlist = "";
                        for (var j = 0; j < oSelectArr.length; j++) {
                            if (oSelectArr[j].selected == true) {
                                if (numlist != "") {
                                    numlist += ",";
                                }
                                numlist += oSelectArr[j].value;
                            }
                        }
                        if (numlist != "") {
                            if (defaultvalue != numlist || isInstertAllParm) {
                                returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"" + numlist + "\"";
                            }
                        }
                        break;
                    case "4":
                        var oBox = document.getElementById(oSpanArr[i].getAttribute("sid"));
                        var oSelect = document.getElementById("ddl" + oSpanArr[i].getAttribute("sid"));
                        var fval = oBox.value;
                        if (fval.toLowerCase() == oSelect.options[oSelect.selectedIndex].text.toLowerCase()) {
                            fval = oSelect.value;
                        } else {
                            for (var k = 0; k < oSelect.options.length; k++) {
                                if (fval.toLowerCase() == oSelect.options[k].text.toLowerCase()) {
                                    fval = oSelect.options[k].value;
                                    break;
                                }
                            }
                        }
                        if (defaultvalue != fval || isInstertAllParm) {
                            returnstr += " " + oSpanArr[i].getAttribute("sid") + "=\"" + fval + "\"";
                        }
                        break;
                }
            }

            if (document.getElementById('page') != null) {
                if (document.getElementById('page').checked == true) {
                    returnstr += " page=\"true\"";
                    returnstr += " pagesize=\"" + document.getElementById("pagesize").value + "\"";
                    if (document.getElementById('urlpage').checked == true) {
                        returnstr += " urlpage=\"true\"";
                    }
                }
            }

            if (document.getElementById('cachetime').value != "" && document.getElementById("cachetime").value != "0") {
                returnstr += " cachetime=\"" + document.getElementById("cachetime").value + "\"";
            }

            if (document.getElementById('nolabelproc').checked == true) {
                returnstr += " noprocinlabel=\"true\"";
            }

            if (document.getElementById("spantype").value != "") {
                returnstr += " span=\"" + document.getElementById("spantype").value + "\"";
            }

            if (document.getElementById("cssname").value != "") {
                returnstr += " class=\"" + document.getElementById("cssname").value + "\"";
            }
            if (type == 0){
               <% if(labeledittype==1){ %>
                 parent.petemplate.editGLabelText(<%=labelgid %>,'<%=labelcontainername %>',<%=glabelindex %>,returnstr + " /}");
               <%}else{ %>
                 parent.petemplate.editLabelText(<%=labelid %>,returnstr + " /}");
               <%} %>
            }else
            {
               parent.petemplate.AddLabelText(<%=labelid %>,returnstr + " /}");
            }
        }
    </script>
    </form>
</body>
</html>

