<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../checkvalid.asp"-->
<%
If Not FRAdminLevel(404) Then
	Call ErrorMsg()
End If
Dim Action
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>Finereason HRCMS 7.0 后台管理系统</title>
<link href="../css/style<%=sk%>.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../inc/input.js"></script>
<script language="javascript">
<!--
function fnRemoveBrank(strSource)
{
 return strSource.replace(/^\s*/,'').replace(/\s*$/,'');
}
function String.prototype.lenB()
{
return this.replace(/[^\x00-\xff]/g,"**").length;
}
function Juge(theForm)
{
  if (fnRemoveBrank(theForm.LabelName.value) == "")
  {
    alert("请输入标签名称!");
    theForm.LabelName.focus();
    return (false);
  }
//  if (fnRemoveBrank(theForm.cid.value) == "")
//  {
//    alert("请选择频道!");
//    theForm.cid.focus();
//    return (false);
//  }
//    if (fnRemoveBrank(theForm.tid.value) == "")
//  {
//    alert("请选择栏目!");
//    theForm.tid.focus();
//    return (false);
//  } 
//    var objv = fnRemoveBrank(theForm.imgnum.value);
//	var pattern = /^[0-9]+$/;
//	flag = pattern.test(objv);
//	if(!flag)
//	{
//	alert("图片数量应该为整数数字!");
//	theForm.imgnum.focus();
//	return (false);
//	} 
//    var objv = fnRemoveBrank(theForm.imgw.value);
//	var pattern = /^[0-9]+$/;
//	flag = pattern.test(objv);
//	if(!flag)
//	{
//	alert("图片宽度应该为整数数字!");
//	theForm.imgw.focus();
//	return (false);
//	}  
//  	var objv = fnRemoveBrank(theForm.imgh.value);
//	var pattern = /^[0-9]+$/;
//	flag = pattern.test(objv);
//	if(!flag)
//	{
//	alert("图片高度应该为整数数字!");
//	theForm.imgh.focus();
//	return (false);
//	} 
//    if (fnRemoveBrank(theForm.order.value) == "")
//  {
//    alert("请选择排序方式!");
//    theForm.order.focus();
//    return (false);
//  } 
//	var objv = fnRemoveBrank(theForm.font_left.value);
//	var pattern = /^[0-9]+$/;
//	flag = pattern.test(objv);
//	if(!flag)
//	{
//	alert("标题字数应该为整数数字!");
//	theForm.font_left.focus();
//	return (false);
//	}
   if (fnRemoveBrank(theForm.Labelorder.value) != "")
  {
	var objv = fnRemoveBrank(theForm.Labelorder.value);
	var pattern = /^[0-9]+$/;
	  flag = pattern.test(objv);
	  if(!flag)
	  {
		alert("标签级别要求为数字!请重新输入。");
		theForm.Labelorder.focus();
		return (false);
	   }
   } 
 }
 //-->
</script></head>
<body>
<%
Action=trim(Request("Action"))
select case Action
	Case "Add"
		Call ShowData()
	Case "Modify"
		Call ShowData()
	Case "SaveData"
		Call SaveData()
end select
Sub ShowData()
LabelID=trim(request.QueryString("LabelID"))
If LabelID<>"" and IsNumeric(LabelID) Then
	sql="select * from JOB_Label where LabelID=" & LabelID
	set rs=server.CreateObject (FR_HR_RS)
	rs.open sql,conn,1,1
	if not rs.eof then
		LabelName=Rs("LabelName")
		LabelName=Replace(LabelName,"{$FR_","")
		LabelName=Replace(LabelName,"}","")
		LabelType=Rs("LabelType")
		LabelContent=Rs("LabelContent")
		LabelContent=Replace(LabelContent,"{$GetHireList(","")
		LabelContent=Replace(LabelContent,")}","")
		LabelContents=Split(LabelContent,",")
		LabelIntro=Rs("LabelIntro")
		Labelorder=Rs("Labelorder")
	end if
	rs.Close
	Set rs=Nothing
nums=LabelContents(0)
rows=LabelContents(1)
sqlfield=LabelContents(2)
Hirefield=Split(sqlfield,"|")
comflag=LabelContents(3)
commands=LabelContents(4)
groupid=LabelContents(5)
hireflag=LabelContents(6)
hirecommands=LabelContents(7)
usergroup=LabelContents(8)
hirestype=LabelContents(9)
order=LabelContents(10)
target=LabelContents(11)
else
Hirefield=Split("0|0|0|0|0|0|0|0|0|0|0|0|0","|")
nums=20
rows=2
groupid=0
'name_left=20
'hire_left=5
'hire_nums=3
LabelName=""
LabelIntro="请输入标签介绍..."
Labelorder=0
End If
%>
<table width="51%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th colspan="2" align="right"><%if LabelID<>"" then:Response.Write("编辑"&LabelName):else:Response.Write("添加职位列表"):end if%>标签</th>
  </tr>
  <form action="?Action=SaveData&LabelID=<%=LabelID%>" method="post" name="labelform" onSubmit="return Juge(this)">
  <tr>
    <td align="right">标签名称：</td>
    <td>{$FR_<input name="LabelName" type="text" size="15" value="<%=LabelName%>" <%if LabelID<>"" and LabelType=<5 then Response.Write("readonly")%> />
      }请输入中文汉字作为标签名称</td>
  </tr>
  <tr>
    <td width="22%" align="right">显示职位数量：</td>
    <td width="78%"><input name="nums" type="text" size="4" value="<%=nums%>"></td>
  </tr>
  <tr>
    <td align="right">显示列数：</td>
    <td><label>
      <input name="rows" type="text" size="4" value="<%=rows%>">
    列</label></td>
  </tr>
  <tr>
    <td align="right">显示内容项目：</td>
    <td><input name="Hirefield0" type="checkbox" class="checkbox" value="1" <%if Hirefield(0)=1 then Response.Write("checked")%>>
职位名称 
  <input name="Hirefield1" type="checkbox" class="checkbox" value="1" <%if Hirefield(1)=1 then Response.Write("checked")%>>
  公司名称
  <input name="Hirefield2" type="checkbox" class="checkbox" value="1" <%if Hirefield(2)=1 then Response.Write("checked")%>>
  招聘人数
  <input name="Hirefield3" type="checkbox" class="checkbox" value="1" <%if Hirefield(3)=1 then Response.Write("checked")%>>
  招聘类别
  <input name="Hirefield4" type="checkbox" class="checkbox" value="1" <%if Hirefield(4)=1 then Response.Write("checked")%>>
  招聘部门
  <input name="Hirefield5" type="checkbox" class="checkbox" value="1" <%if Hirefield(5)=1 then Response.Write("checked")%>>
  工作地区
  <input name="Hirefield6" type="checkbox" class="checkbox" value="1" <%if Hirefield(6)=1 then Response.Write("checked")%>>
  薪资待遇
  <input name="Hirefield7" type="checkbox" class="checkbox" value="1" <%if Hirefield(7)=1 then Response.Write("checked")%>>
  专业要求
  <input name="Hirefield8" type="checkbox" class="checkbox" value="1" <%if Hirefield(8)=1 then Response.Write("checked")%>>
  学历要求
  <input name="Hirefield9" type="checkbox" class="checkbox" value="1" <%if Hirefield(9)=1 then Response.Write("checked")%>>
  工作经验
  <input name="Hirefield10" type="checkbox" class="checkbox" value="1" <%if Hirefield(10)=1 then Response.Write("checked")%>>
  性别要求
  <input name="Hirefield11" type="checkbox" class="checkbox" value="1" <%if Hirefield(11)=1 then Response.Write("checked")%>>
  年龄要求
  <input name="Hirefield12" type="checkbox" class="checkbox" value="1" <%if Hirefield(12)=1 then Response.Write("checked")%>>
  截止日期</td>
  </tr>
  <tr>
    <td align="right">是否已审核的企业：</td>
    <td><input name="comflag" type="checkbox" class="checkbox" id="comflag" value="1" <%if comflag=1 then Response.Write("checked")%>>
是</td>
  </tr>
  <tr>
    <td align="right">企业是否已推荐：</td>
    <td><input name="commands" type="checkbox" class="checkbox" id="commands" value="1" <%if commands=1 then Response.Write("checked")%>>
是</td>
  </tr>
  <tr>
    <td align="right">企业会员组：</td>
    <td><select name="groupid">
        <option value="0" <%if groupid="0" then Response.Write("selected") %>>全部组</option>
        <%sql="select * from JOB_Group where Group_membertype=2"
			set rsw=conn.execute(sql)
			if not rsw.eof then
			do while not rsw.eof%>
        <option value="<%=rsw("Group_id")%>" <%if groupid=trim(rsw("Group_id")) then Response.Write("selected") %>><%=rsw("Group_name")%></option>
        <%rsw.movenext
			loop
			end if
			rsw.close
			set rsw=nothing%>
      </select></td>
  </tr>
  <tr>
    <td align="right">是否已审核的职位：</td>
    <td><input name="hireflag" type="checkbox" class="checkbox" id="hireflag" value="1" <%if hireflag=1 then Response.Write("checked")%>>
      是</td>
  </tr>
  <tr>
    <td align="right">职位是否已推荐：</td>
    <td><input name="hirecommands" type="checkbox" class="checkbox" id="hirecommands" value="1" <%if hirecommands=1 then Response.Write("checked")%>>
      是</td>
  </tr>
  <tr>
    <td align="right">招聘人才类型：</td>
    <td><select name="usergroup">
      <option value="0" <%if usergroup=0 then Response.Write("selected")%>>普通人才</option>
      <option value="1" <%if usergroup=1 then Response.Write("selected")%>>毕业生</option>
      <option value="2" <%if usergroup=2 then Response.Write("selected")%>>高级人才</option>
      <option value="3" <%if usergroup=3 then Response.Write("selected")%>>全部</option>
    </select></td>
  </tr>
  <tr>
    <td align="right">招聘职位类别：</td>
    <td><select name="hirestype">
      <option value="1" <%if hirestype=1 then Response.Write("selected")%>>全职</option>
      <option value="2" <%if hirestype=2 then Response.Write("selected")%>>兼职</option>
      <option value="3" <%if hirestype=3 then Response.Write("selected")%>>两者均可</option>
    </select></td>
  </tr>
  
  <tr>
    <td align="right">排序方式：</td>
    <td><select name="order">
        <option value="hire_announcedate desc" <%if order="hire_announcedate desc" then Response.Write("selected")%>>按更新时间正序排列</option>
		<option value="hire_announcedate asc" <%if order="hire_announcedate asc" then Response.Write("selected")%>>按更新时间反序排列</option>
		<option value="hire_visitcount desc" <%if order="hire_visitcount desc" then Response.Write("selected")%>>按点击次数</option>
      </select></td>
  </tr>
  <tr>
    <td align="right">打开方式：</td>
    <td><select name="target">
        <option value="_blank" <%if target="_blank" then Response.Write("selected")%>>新窗口打开</option>
        <option value="_self" <%if target="_self" then Response.Write("selected")%>>原窗口打开</option>
    </select></td>
  </tr>
  <tr>
    <td align="right">标签介绍：</td>
    <td><label>
      <textarea name="LabelIntro" cols="60" rows="4"><%=LabelIntro%></textarea>
    </label></td>
  </tr>
  <tr>
    <td align="right">标签级别：</td>
    <td><input name="Labelorder" type="text" size="4" value="<%=Labelorder%>">
      级别较高标签将被优先转换</td>
  </tr>
  <tr>
    <td colspan="2" align="center"><label>
      <input name="Submit" type="submit" class="inputs" value="保　存">
       　 
      <input name="Submit2" type="reset" class="inputs" value="重　置">　
       <input name="Submit3" type="button" class="inputs" value="取  消" onClick="window.close();">
    </label></td>
  </tr>
  </form>
</table>
<%End Sub%>
</body>
</html>
<%Sub SaveData()
	LabelID=trim(request.QueryString("LabelID"))
	LabelName=Trim(Request.Form("LabelName"))
	LabelName=Replace(LabelName,LabelName,"{$FR_"&LabelName&"}")
	If LabelName="" Then
		Response.Write ("<script language=JavaScript>{alert('请输入标签名称！');history.back();}</script>")
		Response.End 
	End If
	'判断默认方案下是否有同名的标签名称存在
	if LabelID="" then
		sql="select LabelName from job_label where LabelName='"&LabelName&"' and projectid="&DefaultTPID&""
		set rs=Server.CreateObject(FR_HR_RS)
		rs.open sql,conn,1,1
		if not rs.eof then
			Response.Write ("<script language=JavaScript>{alert('同名的标签名称已经存在！');history.back();}</script>")
			Response.End
		end if
		rs.close
		set rs=nothing
	end if
	
	nums=Trim(Request.Form("nums"))
	if nums="" then
	nums=60
	end if
	rows=Trim(Request.Form("rows"))
	if rows="" then
	rows=2
	end if
	Hirefield0=Trim(Request.Form("Hirefield0"))
	if Hirefield0="" then
	Hirefield0=0
	end if
	Hirefield1=Trim(Request.Form("Hirefield1"))
	if Hirefield1="" then
	Hirefield1=0
	end if
	Hirefield2=Trim(Request.Form("Hirefield2"))
	if Hirefield2="" then
	Hirefield2=0
	end if
	Hirefield3=Trim(Request.Form("Hirefield3"))
	if Hirefield3="" then
	Hirefield3=0
	end if
	Hirefield4=Trim(Request.Form("Hirefield4"))
	if Hirefield4="" then
	Hirefield4=0
	end if
	Hirefield5=Trim(Request.Form("Hirefield5"))
	if Hirefield5="" then
	Hirefield5=0
	end if
	Hirefield6=Trim(Request.Form("Hirefield6"))
	if Hirefield6="" then
	Hirefield6=0
	end if
	Hirefield7=Trim(Request.Form("Hirefield7"))
	if Hirefield7="" then
	Hirefield7=0
	end if
	Hirefield8=Trim(Request.Form("Hirefield8"))
	if Hirefield8="" then
	Hirefield8=0
	end if
	Hirefield9=Trim(Request.Form("Hirefield9"))
	if Hirefield9="" then
	Hirefield9=0
	end if
	Hirefield10=Trim(Request.Form("Hirefield10"))
	if Hirefield10="" then
	Hirefield10=0
	end if
	Hirefield11=Trim(Request.Form("Hirefield11"))
	if Hirefield11="" then
	Hirefield11=0
	end if
	Hirefield12=Trim(Request.Form("Hirefield12"))
	if Hirefield12="" then
	Hirefield12=0
	end if
	sqlfield=Hirefield0&"|"&Hirefield1&"|"&Hirefield2&"|"&Hirefield3&"|"&Hirefield4&"|"&Hirefield5&"|"&Hirefield6&"|"&Hirefield7&"|"&Hirefield8&"|"&Hirefield9&"|"&Hirefield10&"|"&Hirefield11&"|"&Hirefield12
	comflag=Trim(Request.Form("comflag"))
	if comflag="" then
	comflag=0
	end if
	commands=Trim(Request.Form("commands"))
	if commands="" then
	commands=0
	end if
	groupid=Trim(Request.Form("groupid"))
	hireflag=Trim(Request.Form("hireflag"))
	if hireflag="" then
	hireflag=0
	end if
	hirecommands=Trim(Request.Form("hirecommands"))
	if hirecommands="" then
	hirecommands=0
	end if
	usergroup=Trim(Request.Form("usergroup"))
	hirestype=Trim(Request.Form("hirestype"))
	order=Trim(Request.Form("order"))
	target=Trim(Request.Form("target"))
	LabelContent="{$GetHireList("&nums&","&rows&","&sqlfield&","&comflag&","&commands&","&groupid&","&hireflag&","&hirecommands&","&usergroup&","&hirestype&","&order&","&target&")}"
	LabelIntro=Trim(Request.Form("LabelIntro"))
	Labelorder=Trim(Request.Form("Labelorder"))
	If Labelorder="" then
		Labelorder=0
	end if

	set rs=Server.CreateObject(FR_HR_RS)
	if LabelID<>"" and IsNumeric(LabelID) then
	sql="select * from JOB_Label where LabelID=" & LabelID
	else
	sql="select * from JOB_Label"
	end if
	rs.open sql,conn,1,3
	if LabelID="" then
	rs.AddNew
	rs("LabelType")=6
	rs("Labeladddate")=now()
	end if
	rs("LabelName")=LabelName
	rs("LabelContent")=LabelContent
	rs("LabelIntro")=LabelIntro
	rs("Labelorder")=Labelorder
	rs("Labeleditdate")=now()
	rs("projectid")=DefaultTPID
	rs.update
	rs.close
	set rs=nothing
	Response.Write ("<script language=JavaScript>{alert('操作成功！');window.opener.location.reload();window.close();}</script>")
	Response.End
end sub
%>