<%@ page language="C#" masterpagefile="~/HL_Admin/AdminIndexMaster.master" autoeventwireup="true" inherits="HL_Admin_Admin_LabelTemplateStatic, HoWaveVGO" title="Untitled Page" enableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script src="Js/tabpane.js" type="text/javascript"></script>
<style type="text/css">
.label_square{width:100px;height:30px;line-height:30px;border:solid 1px #449AE8;background:#E0EEF5;text-align:center;margin:5px;float:left;cursor: pointer;}
.drag_lablestyle{width:100px;height:30px;line-height:30px;border:solid 1px #449AE8;background:#E0EEFE;text-align:center;margin:5px;float:left;}
.modalPopup {
	background-color:#FFFFFF;
	border-color:#FFFFFF;
    border:1px;
	width:800px;
	 position:absolute;
	top:0px ; left:0px;
	filter:progid:DXImageTransform.Microsoft.Gradient (startColorStr='#F7FCFF', endColorStr='#C7DEED', gradientType='0');
	}
.modalBackground {
	background-color:#C0C0C0;
	filter:alpha(opacity=70);
	opacity:0.7;
}
</style>
<script id="pejs" type="text/javascript">
<!--
var dragspan;
var src;
var labeltype;

function dit(outype)
{
    window.drag = 1;
    window.event.returnValue = false;
    
    dragspan = document.createElement('div');
    dragspan.style.position = "absolute";
    dragspan.className = "drag_lablestyle";
    var mousePos = mouseCoords(window.event);
    dragspan.style.left = mousePos.x + 10;
    dragspan.style.top = mousePos.y + 8;
    dragspan.style.zIndex=100;
    dragspan.appendChild(document.createTextNode(window.event.srcElement.innerHTML));
    if(outype == 0)
    {
        src = "{HL.Config." + window.event.srcElement.getAttribute("value") + "}";
    }
    else if(outype == 1)
    {
        src = window.event.srcElement.getAttribute("value");
    }
    else
    {
        src = "<xsl:value-of select=\"@" + window.event.srcElement.innerHTML + "\"/>";
    }
    labeltype = outype; 
    document.body.appendChild(dragspan);
}
    
function cit()
{
    var target =document.getElementById('ctl00_ContentPlaceHolder1_TemplateContent');
    target.focus();
    if(labeltype == 1)
    {
        var link= "Admin_labelparameter.aspx?a=a&n=" + escape(src);
        var ret = showModalDialog(link,'','dialogWidth:500px; dialogHeight:350px; help: no; scroll: no; status: no; edge: sunken;');
        if (ret != null)
        {
            if (ret.replace(/^\s+|\s+$/g,"") == "")
            {
                alert("不能输入空值");
            }
            else
            {
                target.focus();
                var tarobj = document.selection.createRange();
                tarobj.text = ret;
            }
        }
    }
    else
    {
        var tarobj = document.selection.createRange();
        tarobj.text = src;
    }
    if(window.drag)
    {
        window.drag = 0;
        window.event.returnValue = true;
    }
}

function dragend()
{
    if(window.drag)
    {
        document.body.removeChild(dragspan);
        cit();
    }
    
}

function dragmove()
{
    if(window.drag)
    {
        var ev = ev || window.event;
        var mousePos = mouseCoords(ev);

        ev.returnValue = false;
                 
        dragspan.style.left = mousePos.x + 10;
        dragspan.style.top = mousePos.y + 8;
    }
}

function dragclear()
{
    if(window.drag)
    {
        document.body.removeChild(dragspan);
        window.drag = 0;
        window.event.returnValue = true;
    }
    
}
   
function mouseCoords(ev) {
    if(ev.pageX || ev.pageY) {
      return {x:ev.pageX, y:ev.pageY};
    }
    return {
      x:ev.clientX + document.documentElement.scrollLeft - document.body.clientLeft,
      y:ev.clientY + document.documentElement.scrollTop - document.body.clientTop
    };
}

function movePoint() 
{
    if(window.drag)
    {
        var rng = event.srcElement.createTextRange(); 
        rng.moveToPoint(event.x,event.y); 
        rng.select(); 
    }
}

var fpath = '/App_Themes/AdminDefaultTheme/';

function sizeChange(size){
    var obj=document.getElementById('ctl00_ContentPlaceHolder1_TemplateContent');
    var height = parseInt(obj.offsetHeight);
    if (height+size>=100){
        obj.style.height=height+size;
    }
}

function SetParam(Obj){
    var mLabelName = document.getElementById('ctl00_ContentPlaceHolder1_LabelName');
    if(Obj.value!=""){
        if(mLabelName.value.indexOf(" "+Obj.name+"=\"")==-1){
            newstr = mLabelName.value.replace(" }","");
            mLabelName.value = newstr + " " + Obj.name + "=\"" + Obj.value + "\" }";
        }else{
            a = mLabelName.value.split(" "+Obj.name+"=\"");
            b = a[1].split("\"");
            pvalue = b[0];
            oldparm = " "+Obj.name + "=\"" + pvalue + "\"";
            newparm = " "+Obj.name + "=\"" + Obj.value + "\"";
            mLabelName.value = mLabelName.value.replace(oldparm,newparm);
        }
        
    }else{
        if(mLabelName.value.indexOf(" "+Obj.name+"=\"")>0){
            a = mLabelName.value.split(" "+Obj.name+"=\"");
            b = a[1].split("\"");
            pvalue = b[0];
            prarmstr = " "+Obj.name + "=\"" + pvalue + "\"";
            mLabelName.value = mLabelName.value.replace(prarmstr,"");
        }
    }
}

function showhiddenparmlistDiv(){
    obj = document.getElementById("parmlistDiv");
    if(obj.style.display=="none"){
        obj.style.display="";
    }else{
        obj.style.display="none";
    }
}
-->
</script>

<asp:ScriptManager runat="server" EnablePartialRendering="true"/>
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" 
            TargetControlID="ShowButton"
            PopupControlID="Panel1" 
            BackgroundCssClass="modalBackground"                     
            CancelControlID="closeB" 
             DropShadow="true"
             Drag="true"
             X="100"
             Y="20"
             PopupDragHandleControlID="bar" />
             
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" style="display: none;" >
 
<div style="text-align:left; padding:2px; border:1px solid #C7DEED;">
  <div id="bar" runat="server" style="width:100%; text-align:center; border:1px inset #FFFFFF; background-color:#AEB4D5; line-height:20px;" onmousedown="location.href='#';"><b>标签预览区</b></div>
  <asp:UpdatePanel id="UpdatePanel1" runat="server">
  <ContentTemplate>
  <div style="text-align:left; height:350px;">

    <div id="parmlistDiv"><asp:Literal ID="ParmList" runat="server"></asp:Literal></div>
    
    <div>
        <div style="width:100%; line-height:25px;"><div style="float:left; text-align:right; width:15%;">标签：</div><div style="float:left; text-align:left;">
          <asp:TextBox id="LabelName" runat="server" Width="500"></asp:TextBox> <a href="#" onclick="{return showhiddenparmlistDiv();}">↑↓</a></div>
        </div>
        
        <div style="padding-left:20px;"><asp:Button ID="ShowButton2" OnClick="ShowButton_Click" runat="server" Text="预 览" /> 
          <asp:Button ID="ShowButton3" OnClick="ShowButton_Click2" runat="server" Text="源 码" />
        </div>
        
        <div style="height:300px; margin-top:5px; background-color:White; overflow: auto; font:16px;">

          <asp:Literal ID="ShowPlace" runat="server"></asp:Literal>
         
        </div>
    </div>
    
  </div>
  </ContentTemplate>
</asp:UpdatePanel>
</div>
<div style="line-height:20px; padding:0 5px 5px 5px;" ><asp:Button ID="closeB" runat="server" Text="关 闭" /></div>
</asp:Panel>


<asp:Panel ID="Panel2" runat="server">
<table class="adminheading">                       
   <tr>
      <th>标签管理</th> 
      <td align="right"><div style="width:50px"><a href="Admin_Lable.aspx">返回</a></div></td>
      <td class="rtdw"></td>
   </tr>                        
</table> 
<table class="nick" cellpadding="1" cellspacing="1" border="0" onmouseup="dragclear()" onmousemove="dragmove()">
      <tr><td class="tit" colspan="3">标签内容编辑</td></tr>
      <tr>
          <td style="text-align: left; vertical-align: top; width:70%">
              <asp:TextBox ID="TemplateContent" TextMode="MultiLine"  Height="450px" Width="99%"  runat="server" CssClass="TextBoxStyle"/>
          </td>
          <td style=" cursor: hand; cursor:pointer;width:1%;"></td>
          <td style="text-align: left; vertical-align: top; width:29%; padding-top:5px;" id="LabelTitle">
             <div class="tab-page" id="labeltempate_module" style="width:250px">
                <script type="text/javascript">
                   var tabPane1 = new WebFXTabPane( document.getElementById( "labeltempate_module" ), 1 )
                </script>
                <div class="tab-page" id="label_parm">
                   <h2 class="tab">标签参数</h2>
                   <script type="text/javascript">
                      tabPane1.addTabPage( document.getElementById( "label_parm" ) );
                   </script>
                   <div style="overflow: auto; height:390px;">
                       <asp:Literal ID="LabelParms" runat="server" />
                   </div>
                </div>
                <div class="tab-page" id="label_function">
                   <h2 class="tab">系统标签</h2>
                   <script type="text/javascript">
                       tabPane1.addTabPage( document.getElementById( "label_function" ) );
                   </script>
                   <asp:Literal ID="SysLabel" runat="server" />
                </div>
                <div class="tab-page" id="label_label">
                   <h2 class="tab">内容标签</h2>
                   <script type="text/javascript">
                       tabPane1.addTabPage( document.getElementById( "label_label" ) );
                   </script> 
                   <div>
                        <asp:DropDownList ID="LabelClassSelect" runat="server" AutoPostBack="true" OnSelectedIndexChanged="select_LabelClassSelect" AppendDataBoundItems="true">
                           <asp:ListItem Text="全部标签" Value="全部标签" />
                        </asp:DropDownList>
                   </div>
                   <div id="SysLabelDiv" style="overflow: auto; height:390px;"> 
                     <asp:Literal ID="LabelList" runat="server" />
                   </div>              
                </div>
             </div>  
          </td>
      </tr>
   </table>  
   <div class="div_btm">
       <asp:Button ID="PreStepButton" Text=" 上 一 步 " runat="server"  OnClick="PreStepButton_Click"/>&nbsp;
       <asp:Button ID="FinishButton" runat="server"  Text="保 存" OnClick="FinishButton_Click" />&nbsp;
       <asp:Button ID="ShowButton" runat="server"  Text="预 览"  />&nbsp;
       <input id="BtnCancel" type="button" value="取　消" onclick="window.location.href='Admin_Lable.aspx'"  style="cursor: pointer; cursor: hand; width: 88px;" />
   </div>
   </asp:Panel>
</asp:Content>

