<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="property_parameter.aspx.cs" Inherits="YXShop.Web.admin.templates.label.property_parameter" %>

<!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>
    <link href="../../style/admin.css" rel="stylesheet" type="text/css" />
    <script src="../../../scripts/prototype.js" type="text/javascript"></script>
    <script src="../../scripts/public.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

function ReturnValue()
{
    var ShowMode;
    var o=document.getElementsByName("rbl_ShowMode");//显示模式
    var len=o.length;   
    for (var i=0;i<len ;i++ )
    {
        if( o[i].checked==true )
        {
            ShowMode=o[i].value;
        }
    }
    
    var ProductClassId="0";
    var len=o.length;   
    for (var i=0;i<len ;i++ )
    {
        if(o[i].checked==true )
        {
            ShowMode=o[i].value;
            if(ShowMode=="2")
            {
                 ProductClassId=document.getElementById("hfcid").value;
            }
        }
    }
    
    var ProGroupRows=document.getElementById("txtProGroupRows").value //属性组显示行数  
    var ProGroupColumns=document.getElementById("txtProGroupColumns").value;//属性组显示列数          
    var ProValueRows =document.getElementById("txtProValueRows").value; //属性值显示行数
    var ProValueColumns = document.getElementById("txtProValueColumns").value;//属性值显示列数

    var PropertyGroupState;
    o=document.getElementsByName("rblPropertyGroupState");//属性组显示状态
    var len=o.length;   
    for (var i=0;i<len ;i++ )
    {
        if( o[i].checked==true )
        {
            PropertyGroupState=o[i].value;
        }
    }


    var PropertyValueState;
    o=document.getElementsByName("rblPropertyValueState");//属性值显示状态
    var len=o.length;   
    for (var i=0;i<len ;i++ )       
    {
        if( o[i].checked==true )
        {
            PropertyValueState=o[i].value;
        }
    }
    //自定义内容
    var mystyle = document.getElementById("txtLabelContent").value;
    if(mystyle=="")
    {
        alert("自定义内容不能为空！");
        return false;
    }
    var cnm ="[YX:Loop,YX:LableType=ProductType,YX:ShowMode="+ShowMode+",YX:ProGroupRows="+ProGroupRows+",YX:ProGroupColumns="
    +ProGroupColumns+",YX:ProValueRows="+ProValueRows+",YX:ProValueColumns="
    +ProValueColumns+ ",YX:PropertyGroupState="+ PropertyGroupState+",YX:PropertyValueState="+PropertyValueState+
    ",YX:ProductClassId="+ProductClassId+"]"+mystyle+"[/YX:Loop]";
    alert(mystyle);
    parent.getValue(cnm);
    CloseDiv();

}

    function getValue(value)
    {
        var textObj=document.getElementById("txtLabelContent");
        var textFeildValue=value;
        if(value!="") 
        {
            if(document.all)
            {     
                if(textObj.createTextRange && textObj.caretPos)
                {   
                    var caretPos=textObj.caretPos;   
                    caretPos.text=caretPos.text.charAt(caretPos.text.length-1)==''?textFeildValue+'':textFeildValue;   
                }
                else
                {   
                    textObj.value=textFeildValue;   
                }   
            }
            else
            {   
                if(textObj.setSelectionRange)
                {   
                    var rangeStart =textObj.selectionStart;   
                    var rangeEnd=textObj.selectionEnd;   
                    var tempStr1=textObj.value.substring(0,rangeStart);   
                    var tempStr2 =textObj.value.substring(rangeEnd);   
                    textObj.value=tempStr1+textFeildValue+tempStr2;   
                }
                else
                {   
                    alert("This version of Mozilla based browser does not support setSelectionRange");   
                }   
            }
        }
    }
    function setCaret(textObj)
    {   
        if(textObj.createTextRange)
        {   
            textObj.caretPos=document.selection.createRange().duplicate();   
        }   
    } 

function OptionProduct()
{
    var ShowMode;
    var o=document.getElementsByName("rbl_ShowMode");//显示模式
    var len=o.length;   
    for (var i=0;i<len ;i++ )
    {
        if(o[i].checked==true )
        {
            ShowMode=o[i].value;
            if(ShowMode=="2")
            {
                 document.getElementById("OptionProduct").style.display="";
            }
            else
            {
                 document.getElementById("OptionProduct").style.display="none";
            }
        }
    }
}

function CloseDiv()
{
    parent.document.getElementById("LabelDivid").style.display="none";
}

</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <table style="width: 99%; margin-top:5px" class="form_table_input">
            <tr>
            <td>显示方式：<asp:HiddenField ID="hfLabelClass" runat="server" /></td>
               <td colspan="3"> 
                   <asp:RadioButtonList ID="rbl_ShowMode" runat="server" RepeatDirection="Horizontal" RepeatColumns="5" onclick="javascript:OptionProduct()">
                        <asp:ListItem Value="1">传商品分类ID查询</asp:ListItem>
                        <asp:ListItem Value="2">指定分类显示商品</asp:ListItem>
                  </asp:RadioButtonList></td>
            </tr>
            <tr id="OptionProduct" style="display:none">
                <td>选择分类：</td>
                <td colspan="3">
                    <asp:TextBox ID="txtProductClass" runat="server"></asp:TextBox>
                     <asp:HiddenField runat="server" ID="hfcid" />
                </td>
            </tr>
            <tr>
             <td width="100">属性组显示行数</td>
                <td width="200">
                    <asp:TextBox ID="txtProGroupRows" Width="100px" runat="server"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">4</asp:TextBox>
                </td>
                <td width="100">属性值显示行数</td>
                <td width="200">
                    <asp:TextBox ID="txtProValueRows" Width="100px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" runat="server">1</asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>属性组显示列数</td>
                <td>
                    <asp:TextBox ID="txtProGroupColumns" Width="100px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" runat="server">1</asp:TextBox>
                </td>
                <td>属性值显示列数</td>
                <td>
                    <asp:TextBox ID="txtProValueColumns" Width="100px"  onkeyup="value=value.replace(/[^\d]/g,'') " 
                        onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" runat="server">8</asp:TextBox>
                </td>
            </tr>
            <tr>
                <td>属性组显示状态</td>
                <td>
                    <asp:RadioButtonList ID="rblPropertyGroupState" runat="server" RepeatDirection="Horizontal">
                         <asp:ListItem Value="flase" Text="否" />
                         <asp:ListItem Value="true" Text="是" Selected="True" />
                    </asp:RadioButtonList>
                    <span style="color:Red">注：是表示设置的属性组显示行/列数没有显示完出折叠按钮，否反之</span>
                </td>
                <td>属性值显示状态</td>
                <td>
                    <asp:RadioButtonList ID="rblPropertyValueState" runat="server" RepeatDirection="Horizontal">
                         <asp:ListItem Value="flase" Text="否" />
                         <asp:ListItem Value="true" Text="是" Selected="True" />
                    </asp:RadioButtonList>
                    <span style="color:Red">注：是表示设置的属性值显示行/列数没有显示完出折叠按钮，否反之</span>
                </td>
            </tr>
            <tr>
                <td>
                    显示参数</td>
                <td colspan="3">
                    <asp:DropDownList ID="ddl_Properties" runat="server" onchange="javascript:getValue(this.value);">
                        <asp:ListItem Value="">--请选择参数--</asp:ListItem>
                        <asp:ListItem Value="[#Name]">属性名称</asp:ListItem>
                        <asp:ListItem Value="[#Value]">属性值</asp:ListItem>
                        <asp:ListItem Value="[#Whole]">全部</asp:ListItem>
                    </asp:DropDownList>
                    <span style="color:Red">注：参数中全部表示当有这个参数就显示此组属性的全部搜索。</span>
                </td>
                
            </tr>
            <tr>
                <td valign="top">
                     &nbsp;
                </td>
                <td colspan="3">
                    <asp:TextBox runat="server" ID="txtLabelContent" height="200" onselect="setCaret(this);"  onclick="setCaret(this);"  onkeyup="setCaret(this);" Width="500" TextMode="MultiLine"></asp:TextBox>
                </td>
            </tr>
            
            <tr>
                <td colspan="4" align="center" style="text-align:center">
                   <input id="bt_Exc" type="button" value="提交" onclick="ReturnValue()" />
                    &nbsp;<input class="form" type="button" value=" 关 闭 "  onclick="javascript:CloseDiv();" /></td>
            </tr>
            </table>
    </div>
    </form>
</body>
</html>
