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

<!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>
    <link href="../../Css/global.css" rel="stylesheet" type="text/css" />
    <script src="../../JS/label.js" type="text/javascript"></script> 
    <script type="text/javascript" src="../../js/ajax.js"></script>
    <script language="javascript" type="text/javascript">
        function saveContent()
        {
            var fStr=",<br />&nbsp;";
            var data=formatContent("[PPFOR:Loop","") + fStr + formatContent("PPFOR:Class","JobPosts");
            
            var type=getRadioValue("jobPostListType");
            if(type!=null && type!="")
            {
                data+=fStr + formatContent("PPFOR:Type",type);
            }
            else
            {
                type='';
            }                
            
            var objMenuId= document.getElementById("PPFOR_jobPostMenuId");            
            if(objMenuId!=null && objMenuId.style.display!="none" && objMenuId.selectedIndex>=0)
            {
                var menuId=objMenuId.options[objMenuId.selectedIndex].value;
                if(menuId!=null && menuId!="")
                {
                    data+=fStr + formatContent("PPFOR:MenuID",menuId);
                }
            }
        
            var objTypeId= document.getElementById("jobTypeId");            
            if(objTypeId!=null && type!='History' && objTypeId.selectedIndex>=0)
            {
                var typeId=objTypeId.options[objTypeId.selectedIndex].value;
                if(typeId!=null && typeId!="")
                {
                    data+=fStr + formatContent("PPFOR:ClassID",typeId);
                }
            }
            
            var objMemberLimit= document.getElementById("memberLimit");            
            if(objMemberLimit!=null && objMemberLimit.type=='checkbox' && !objMemberLimit.disabled)
            {
                data+=fStr + formatContent("PPFOR:MemberLimit",objMemberLimit.checked?'True':'False');
            }   
            
            var objOutFormat= document.getElementById("outFormat");
            if(objOutFormat!=null)
            {
                data+=fStr + formatContent("PPFOR:Format",objOutFormat.value!='' ? objOutFormat.value : "Table");
            }
            
            var objLoopNumber= document.getElementById("PPFOR_loopNumber");
            if(objLoopNumber!=null && objLoopNumber.value!="")
            {
                data+=fStr + formatContent("PPFOR:LoopNumber",objLoopNumber.value);
            }           
            
            var objColumnNumber= document.getElementById("PPFOR_jobPostColumnNumber");
            if(objColumnNumber!=null && objColumnNumber.value!="")
            {
                data+=fStr + formatContent("PPFOR:ColumnNumber",objColumnNumber.value);
            }
            
            var objTitleNumber= document.getElementById("PPFOR_jobPostTitleNumber");
            if(objTitleNumber!=null && objTitleNumber.value!="")
            {
                data+=fStr + formatContent("PPFOR:TitleNumber",objTitleNumber.value);
            }      
            
            var objContentNumber= document.getElementById("PPFOR_jobPostContentNumber");
            if(objContentNumber!=null && objContentNumber.value!="")
            {
                data+=fStr + formatContent("PPFOR:ContentNumber", objContentNumber.value);
            }            
            
            data+=formatContent("]","") + "<br />" + ckEditor.getData() + "<br />" + formatContent("[/PPFOR:Loop]","");
            
            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)
            {
                return (obj.options[obj.selectedIndex].value);
            }
            else
            {     
                return "";
            }
        }
        
        function changeNumberOption()
        {
            var rValue=getRadioValue("jobPostListType");
            if(rValue=="List")
            {
                document.getElementById("listNumber").style.display="none";
                document.getElementById("listNumberPerPage").style.display="";
            }
            else
            {
                document.getElementById("listNumberPerPage").style.display="none";
                document.getElementById("listNumber").style.display="";
            }                      
        }
        
        function showTypeIds(objMenu)
        {
            var obj= document.getElementById("PPFOR_jobTypeId");
            var objTypeId=document.getElementById("jobTypeId");
            var id=objMenu.options[objMenu.selectedIndex].value;
            if(obj!=null && objTypeId!=null && id>=0)
            {
                while(objTypeId.options.length>0)
                {
                    objTypeId.removeChild(objTypeId.options[0]);
                }
                for(var i=0;i<obj.options.length;i++)
                {                
                     if(obj.options[i].getAttribute("optionMenuId")==id)
                     {
                        objTypeId.options.add(new Option(obj.options[i].text,obj.options[i].value)); 
                     }
                }
                if(objTypeId.options.length==0)
                {
                    objTypeId.style.display="none";
                }
                else
                {
                    objTypeId.style.display="";
                }
                changeParams(objTypeId);
            }
        }
        function clearParam(obj)
        {
            while(obj.options.length>1)
            {
                obj.removeChild(obj.options[obj.options.length-1]);
            }
        }
        function initParams()
        {
            var url="jobPostOptions.aspx?action=getparams&lanid=" + document.getElementById('language').value + "&tid=0";
            DoAjax(url,"GET",null,setParams);      
        }
        function changeParams(obj)
        {        
            var url="jobPostOptions.aspx?action=getparams&lanid=" + document.getElementById('language').value + "&tid=" + obj.value;
            DoAjax(url,"GET",null,setParams);       
        }
        function setParams(xmlHttp)
        {
            var objParams=document.getElementById('jobPostExtendParams');
            clearParam(objParams);   
            var xmlDoc=xmlHttp.responseXML || xmlHttp.responseXML.documentElement;
            if(xmlDoc!=null)
            {          
                try
                {
                    var parameters=xmlDoc.getElementsByTagName("Parameters");  
                    if(parameters!=null && parameters.length==1)
                    {                
                        oParams = parameters[0].getElementsByTagName("Param");
                        if(oParams!=null && oParams.length==1)
                        {         
                            var options=oParams[0].getElementsByTagName("Option");      
                            if(options!=null && options.length>0){   
                                for(var j=0;j<options.length;j++)
                                {  
                                    var text=options[j].getElementsByTagName("Text");
                                    var value=options[j].getElementsByTagName("Value");
                                    var order=j+1;
                                    objParams.options.add(new Option((order<10 ? '0' + order : order) + '. ' + text[0].firstChild.nodeValue,value[0].firstChild.nodeValue)); 
                                }
                            }
                        }     
                        oParams = parameters[0].getElementsByTagName("Content");
                        if(oParams!=null && oParams.length==1)
                        {                                   
                            var options=oParams[0].getElementsByTagName("Option");    
                            if(options!=null && options.length>0){                               
                                objParams.options.add(new Option('选择扩展内容',''));  
                                for(var j=0;j<options.length;j++)
                                {  
                                    var text=options[j].getElementsByTagName("Text");
                                    var value=options[j].getElementsByTagName("Value");
                                    var order=j+1;
                                    objParams.options.add(new Option((order<10 ? '0' + order : order) + '. ' + text[0].firstChild.nodeValue,value[0].firstChild.nodeValue)); 
                                }
                            }
                        }                        
                    }  
                }
                catch(e){}              
            }    
        }
    </script>
    <title>招聘职位参数设置</title>
</head>
<body onload="initParams();">
    <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="New" name="jobPostListType" onclick="changeNumberOption();"/>最新      
           <input type="radio" value="List" name="jobPostListType" checked="checked" onclick="changeNumberOption();"/>招聘职位列表           
       </td>
      </tr>
      <tr>
        <td align="right">循环<span id="listNumber" style="display:<%=PPFOR_displayListNumberOption %>">条数</span><span id="listNumberPerPage" style="display:<%=PPFOR_displayListNumberPerPageOption %>">每页条数</span>：</td>
        <td><asp:TextBox Text="8" MaxLength="10" ID="PPFOR_loopNumber" runat="server" Width="150px"/>
            <select id="outFormat">               
                <option value="" selected="selected">--选择输出格式--</option>
                <option value="Table">Table(默认)</option>                
                <option value="None">无格式</option>
            </select>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="PPFOR_loopNumber" runat="server" Display="Dynamic" SetFocusOnError="true"><br />循环条数必须填写</asp:RequiredFieldValidator>
            <asp:RangeValidator ID="RangeValidator1" ControlToValidate="PPFOR_loopNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="2147483647" Type="Integer"><br />循环条数必须填写正整数</asp:RangeValidator>            
        </td>
      </tr>
      <tr>
        <td align="right">招聘职位类型：</td>
        <td><asp:DropDownList ID="PPFOR_jobPostMenuId" runat="server" Width="150px">
        <asp:ListItem Text="--选择栏目--" Value="0"></asp:ListItem>
        <asp:ListItem Text="*自适应栏目*" Value="0"></asp:ListItem>
        </asp:DropDownList>
        <select id="jobTypeId" style="display:none;" onchange="changeParams(this);"></select>
        <asp:DropDownList ID="PPFOR_jobTypeId" runat="server" Width="150px" Enabled="false">
        </asp:DropDownList>       
        </td>
      </tr>
      <tr>
        <td align="right">招聘职位参数：</td>
        <td align="left">
            <select id="jobPostParam" onchange="appenHTML(this.value);this.selectedIndex=0;">
            <option value="" selected="selected">01.&nbsp;选择基本参数</option>
            <option value="&lt;a href='{#ClassURL}'&gt;{#Class}&lt;/a&gt;">02.&nbsp;招聘职位类型</option>                    
            <option value="&lt;a href='{#URL}'&gt;{#Title}&lt;/a&gt;">03.&nbsp;职位名称</option>
            <option value="{#ID}">04.&nbsp;职位ID</option>   
            <option value="&lt;a target'=_blank' href='{#ResumeURL}'&gt;{#ResumeTitle}&lt;/a&gt;">05.&nbsp;简历链接</option>        
            <option value="{#Content}">06.&nbsp;职位简介</option>                                    
            <option value="&lt;img border='0' title='{#Title}' src='{#SmallPicture}' &gt;">07.&nbsp;职位图片</option>
            <option value="{#Click}">08.&nbsp;浏览次数</option>
            <option value="{#StartDate}">09.&nbsp;招聘起始日期</option>
            <option value="{#StartTime}">10.&nbsp;招聘起始时间</option>
            <option value="{#StartDateTime}">11.&nbsp;招聘起始日期时间</option>   
            <option value="{#EndDate}">12.&nbsp;招聘终止日期</option>
            <option value="{#EndTime}">13.&nbsp;招聘终止时间</option>
            <option value="{#EndDateTime}">14.&nbsp;招聘终止日期时间</option>   
            <option value="{#PublishDate}">15.&nbsp;发布日期</option>
            <option value="{#PublishTime}">16.&nbsp;发布时间</option>  
            <option value="{#PublishDateTime}">17.&nbsp;发布日期时间</option>  
            <option value="{#Date}">18.&nbsp;更新日期</option>
            <option value="{#Time}">19.&nbsp;更新时间</option>
            <option value="{#DateTime}">20.&nbsp;更新日期时间</option>   
            <option value="{#CommentCount}">21.&nbsp;评论总数</option>           
          </select>
          <select id="jobPostExtendParams" onchange="appenHTML(this.value);">
            <option value="" selected="selected">选择扩展参数</option>
          </select>
          <input type="checkbox" id="memberLimit" />开启会员等级限制
          <input id="language" type="hidden" value="<%=PPFOR_languageId %>" />
          <br />
            <asp:TextBox ID="PPFOR_jobPostOptionContent" runat="server" TextMode="MultiLine" Rows="5" Width="98%"></asp:TextBox>
           <script type="text/javascript">
            var ckEditor=CKEDITOR.replace("<%=PPFOR_jobPostOptionContent.ClientID%>", {
             toolbar:'EditLabelOptions',
             height:'100'
            });
            function appenHTML(text)
            {
                ckEditor.insertHtml(text);
            }
            </script>
         </td>
      </tr>
      <tr>
        <td align="right">每行显示招聘职位条数：</td>
        <td><asp:TextBox ID="PPFOR_jobPostColumnNumber" runat="server" Width="150px" />
            <asp:RangeValidator ID="RangeValidator2" ControlToValidate="PPFOR_jobPostColumnNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="2147483647" Type="Integer">招聘职位条数必须填写正整数</asp:RangeValidator>            
        </td>
      </tr>
      <tr>
        <td align="right">招聘职位名称显示字数：</td>
        <td><asp:TextBox ID="PPFOR_jobPostTitleNumber" runat="server" Width="150px"/>
            <asp:RangeValidator ID="RangeValidator3" ControlToValidate="PPFOR_jobPostTitleNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="1000" Type="Integer">招聘职位名称显示字数必须填写1至1000之间的整数</asp:RangeValidator>            
        </td>
      </tr>      
      <tr>
        <td align="right">招聘职位简介截取字数：</td>
        <td><asp:TextBox ID="PPFOR_jobPostContentNumber" runat="server" Width="150px"/>
           <asp:RangeValidator ID="RangeValidator4" ControlToValidate="PPFOR_jobPostContentNumber" runat="server"  Display="Dynamic" SetFocusOnError="true" MinimumValue="1" MaximumValue="1000" Type="Integer">招聘职位简介截取字数必须填写1至1000之间的整数</asp:RangeValidator> 
        </td>
      </tr>      
      <tr style="display:none;">
        <td align="center" colspan="2" valign="middle" style="height:50px">            
            <asp:Button ID="PPFOR_setJobPostOptions" CssClass="inputbutton" runat="server" Text="确定" OnClick="PPFOR_setJobPostOptionsClick"/>
            <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_setJobPostOptions'));
                parent.popup_addButton(document.getElementById('reset1'));
             </script>
        </td>
      </tr>
     </table>
    </form>
</body>
</html>
