<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="scriptOptions.aspx.cs" Inherits="PPFOR.Admin.DesignCenter.Label.scriptOptions" %>

<!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 runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <script src="/ckeditor/ckeditor.js" type="text/javascript"></script>
    <script src ="../../JS/label.js" type="text/javascript"></script>   
    <link href="../../Css/global.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
    function saveContent()
    {
        var fStr=",<br />&nbsp;";
        var data=formatContent("[PPFOR:UnLoop","") + fStr + formatContent("PPFOR:Class",getRadioValue("menuType"));         
       
        var menuId = getSelectValue("PPFOR_menuList");
        if(menuId!=""){
            data+=fStr + formatContent("PPFOR:MenuID",menuId);
        }
        
        data+=fStr + formatContent("PPFOR:Type","Script");     
              
        var objListDirectly= document.getElementById("listDirectly");            
        if(objListDirectly!=null && objListDirectly.type=='checkbox' && !objListDirectly.disabled)
        {
            data+=fStr + formatContent("PPFOR:ListDirectly",objListDirectly.checked?'True':'False');
            if(objListDirectly.checked){                
                var objHideRoot= document.getElementById("hideRoot");            
                if(objHideRoot!=null && objHideRoot.type=='checkbox' && !objHideRoot.disabled)
                {
                    data+=fStr + formatContent("PPFOR:HideRoot",objHideRoot.checked?'True':'False');
                } 
            }
        }         

        data+=formatContent("]","") + "<br />" + ckEditor.getData() + "<br />" + formatContent("[/PPFOR:UnLoop]","");
        
        parent.window.resetHTML(data);
        parent.popup_close();
    }
    function getRadioValue(name)
    {
        var radioes = document.getElementsByName(name); 
        for(var i=0;i<radioes.length;i++)
        {
             if(radioes[i].checked){
                return radioes[i].value;
             }
        }
        return "";
    }
    function getSelectValue(id)
    {
        var obj= document.getElementById(id);
        if(obj!=null && obj.style.display!='none')
        {
            return (obj.options[obj.selectedIndex].value);
        }
        else
        {     
            return "";
        }
    }
    function showParamSelect(type)
    {
        var obj1=document.getElementById("scriptLanguageParam");
        var obj2=document.getElementById("scriptMenuParam");
        var obj3=document.getElementById("scriptTypeParam");
        var obj4=document.getElementById("scriptPageParam");
        var obj5=document.getElementById("scriptGroupParam");
        var objMenuList=document.getElementById("displayMenuList");
        if(type=="Language")
        {
            obj1.style.display="";
            obj2.style.display="none";
            obj3.style.display="none";
            obj4.style.display="none";
            obj5.style.display="none";
            objMenuList.style.display="none";
        }
        else if(type=="Menu") 
        {
            obj1.style.display="none";
            obj2.style.display="";
            obj3.style.display="none";  
            obj4.style.display="none"; 
            obj5.style.display="none";
            objMenuList.style.display="none";
        }
        else if(type=="Type")
        {
            obj1.style.display="none";
            obj2.style.display="none";
            obj3.style.display="";   
            obj4.style.display="none";
            obj5.style.display="none";
            objMenuList.style.display="";
        }  
        else if(type=="Page")
        {
            obj1.style.display="none";
            obj2.style.display="none";
            obj3.style.display="none"; 
            obj4.style.display="";  
            obj5.style.display="none";
            objMenuList.style.display="";
        }     
        else if(type=="Group")
        {
            obj1.style.display="none";
            obj2.style.display="none";
            obj3.style.display="none"; 
            obj4.style.display="none";  
            obj5.style.display="";
            objMenuList.style.display="";
        }
    }
    function changeHideRoot(b)
    {
        var obj=document.getElementById("hideRoot");
        if(obj!=null){
            obj.disabled=!b;
        }
    }
    </script>
    <title>导航参数设置</title>
</head>
<body>
    <form id="form1" runat="server" onsubmit="saveContent();return false;">
    <table width="98%" cellpadding="0" cellspacing="0" class="fortable" style="margin:6px;">
    <thead>
      <tr>
        <td colspan="2" align="center">选择标签参数--导航类</td>
      </tr>  
    </thead>
      <tr>
        <td align="right" style="width:15%">导航类型：</td>
        <td>
           <input type="radio" value="Language" name="menuType" checked="checked" onclick="showParamSelect('Language');"/>多语言导航
           <input type="radio" value="Menu" name="menuType" onclick="showParamSelect('Menu');"/>栏目导航
           <input type="radio" value="CommentGroup" name="menuType" onclick="showParamSelect('Group');"/>评论组导航
           <input type="radio" value="JobType" name="menuType" onclick="showParamSelect('Type');"/>招聘类型导航
           <br />
           <input type="radio" value="NewsType" name="menuType" onclick="showParamSelect('Type');"/>新闻类型导航
           <input type="radio" value="ProductType" name="menuType" onclick="showParamSelect('Type');"/>商品类型导航
           <input type="radio" value="Page" name="menuType" onclick="showParamSelect('Page');"/>单页面导航
           <input type="radio" value="PictureType" name="menuType" onclick="showParamSelect('Type');"/>图片类型导航
           <input type="radio" value="DownloadType" name="menuType" onclick="showParamSelect('Type');"/>下载类型导航           
       </td>
      </tr>    
      <tr id="displayMenuList" style="display:none;">
        <td align="right">导航栏目：</td>
        <td>
        <asp:DropDownList ID="PPFOR_menuList" runat="server" Width="150px">
        <asp:ListItem Text="--选择栏目--" Value="0"></asp:ListItem>
        <asp:ListItem Text="*自适应栏目*" Value="0"></asp:ListItem>
        </asp:DropDownList>
        <input type="checkbox" id="listDirectly" value="listDirectly" onclick="changeHideRoot(this.checked);" />仅显示直属类型
        <input type="checkbox" id="hideRoot" value="hideRoot" disabled="disabled" />不显示顶级类型
        </td>
      </tr>
      <tr>
        <td align="right">导航参数：</td>
        <td align="left">
            <select id="scriptLanguageParam" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择语言参数</option>     
            <option value="{#MenuID}">02.&nbsp;语言ID</option>
            <option value="{#MenuTitle}">03.&nbsp;语言名称</option>
            <option value="{#MenuURL}">04.&nbsp;语言链接</option>                          
            </select>
            <select id="scriptMenuParam" style="display:none;" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择栏目参数</option>
            <option value="{#MenuParentID}">02.&nbsp;父栏目ID</option>           
            <option value="{#MenuID}">03.&nbsp;栏目ID</option>
            <option value="{#MenuTitle}">04.&nbsp;栏目标题</option>
            <option value="{#MenuURL}">05.&nbsp;栏目链接</option> 
            <option value="{#MenuTarget}">06.&nbsp;打开位置</option>                      
            </select>
            <select id="scriptTypeParam" style="display:none;" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择类型参数</option>  
            <option value="{#MenuParentID}">02.&nbsp;父类型ID</option>            
            <option value="{#MenuID}">03.&nbsp;类型ID</option>
            <option value="{#MenuTitle}">04.&nbsp;类型名称</option>
            <option value="{#MenuURL}">05.&nbsp;类型链接</option>                      
            </select>
            <select id="scriptPageParam" style="display:none;" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择页面参数</option>  
            <option value="{#MenuParentID}">02.&nbsp;父页面ID</option>            
            <option value="{#MenuID}">03.&nbsp;页面ID</option>
            <option value="{#MenuTitle}">04.&nbsp;页面标题</option>
            <option value="{#MenuURL}">05.&nbsp;页面链接</option>                      
            </select>
            <select id="scriptGroupParam" style="display:none;" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择评论组参数</option>                    
            <option value="{#MenuID}">02.&nbsp;评论组ID</option>
            <option value="{#MenuTitle}">03.&nbsp;评论组名称</option>
            <option value="{#MenuURL}">04.&nbsp;评论组链接</option>                      
            </select>
            <asp:DropDownList ID="PPFOR_xmlScriptList" runat="server">
            <asp:ListItem Text="--系统内置标签--" Value=""></asp:ListItem>
            </asp:DropDownList>
            <br />
            <select id="Select1" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择菜单标签</option>                  
            <option value="{#Menu_Begin}{#Menu_End}">02.&nbsp;菜单标记</option>
            <option value="{#Menu_Loop}{#Menu_EndLoop}">03.&nbsp;菜单循环标记</option>
            <option value="{#Menu_CaseDefault}{#Menu_EndCase}">04.&nbsp;默认菜单标记</option>
            <option value="{#Menu_CaseRoot}{#Menu_EndCase}">05.&nbsp;无子菜单标记</option>
            <option value="{#Menu_CaseSub}{#Menu_EndCase}">06.&nbsp;有子菜单标记</option>
            </select>
            <select id="Select2" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="">01.&nbsp;选择子菜单标签</option>     
            <option value="{#Item_Begin}{#Item_End}">02.&nbsp;子菜单标记</option>
            <option value="{#Item_Loop}{#Item_EndLoop}">03.&nbsp;子菜单循环标记</option>
            <option value="{#Item_CaseDefault}{#Item_EndCase}">04.&nbsp;默认菜单标记</option>
            <option value="{#Item_CaseRoot}{#Item_EndCase}">05.&nbsp;无子菜单标记</option>
            <option value="{#Item_CaseSub}{#Item_EndCase}">06.&nbsp;有子菜单标记</option>
            <option value="{#Item_Sub}">07.&nbsp;子菜单无限循环占位标记</option>  
            </select><br />
            <asp:TextBox ID="PPFOR_scriptOptionContent" runat="server" TextMode="MultiLine" Rows="5" Width="98%"></asp:TextBox>
           <script type="text/javascript">
            var ckEditor=CKEDITOR.replace("PPFOR_scriptOptionContent", {
             toolbar:'EditLabelOptions',
             height:'100'
            });
            function appenHTML(text)
            {
                ckEditor.insertHtml(text);
            }
            function resetHTML(text)
            {
                ckEditor.setData(text);
                ckEditor.focus();
            } 
            </script>
         </td>
      </tr>      
      <tr style="display:none"> 
        <td align="center" colspan="2" valign="middle" style="height:50px">            
            <asp:Button ID="PPFOR_setScriptOptions" CssClass="inputbutton" runat="server" Text="确定" OnClick="PPFOR_setScriptOptionsClick"/>
            <input name="reset" type="reset" id="reset1" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" value="重置" />
            <script type="text/javascript"> 
                parent.popup_clearButtons();
                parent.popup_addButton(document.getElementById('PPFOR_setScriptOptions'));
                parent.popup_addButton(document.getElementById('reset1'));
             </script>
        </td>
      </tr>
    </table>
    </form>
</body>
</html>
