<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../../conn/conn.asp" -->
<!--#include file="../../Inc/Commoncode.asp" -->
<!--#include file="../../Inc/CommonFunction.asp" -->
<!--#include file="../checkvalid.asp"-->
<%
'************************************************************
'	Software name: Finereason HRCMS 7.0
'	软件名称:嘉缘人才网站内容管理系统 V7.0
'	Email: service@finereason.com . QQ:109530926
'	Web: http://www.finereason.com  http://www.yjys.net
'	Copyright (C) FineSincere Inc. All Rights Reserved.
'	版权所有 嘉挚科技 未经嘉挚公司授权不得用于任何商业用途
'
'	文件名称：Admin_Label.asp
'	作    用：网站标签管理
'	最后更新：Fine Sincere (Mr.Hou)
'	最后日期：2007-5-14
'************************************************************
If Not FRAdminLevel(404) Then
	Call ErrorMsg()
End If
Response.Expires = 0 
Response.CacheControl = "no-cache" 
Response.ExpiresAbsolute = Now() - 1 
LabelType=trim(Request("LabelType"))
Dim Action
Dim page,i
Dim totalPut
const MaxPerpage=20
strFileName="Admin_Label.asp?LabelType="&LabelType&"&keyword="&keyword&""
page=Trim(Request("page"))
if request.Form<>"" then
keyword=request.Form("keyword")
LabelType=request.Form("LabelType")
else
LabelType=request("LabelType")
keyword=request("keyword")
end if
if keyword="请输入搜索关键字" then
	keyword=""
end if
if LabelType="" then
	LabelType=0
end if
If page<>"" And IsNumeric(page) Then
	If page<1 Or Len(page)>10 Then
		page=1
	Else
    	page=CLng(page)
	End If
Else
	page=1
End If
%>
<!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" type="text/JavaScript">
function ConfirmDel(ID,Name)
{
   if(confirm("您确定要删除标签【"+Name+"】吗？\n\n警告：此操作不可恢复，请慎重操作！"))
     location.href="<%=strFileName%>&Action=Del&LabelID="+ID
}
function openlabel(filename)
{
	window.open(""+filename+".asp?Action=Add","newwindow","height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no");
	document.getElementById("AddLabelM").style.display="none";
}
</script><style type="text/css">
<!--
#AddLabelM {display:none;background-color:#FFFFFF;position:absolute;left:240px;top:44px;width:150px;height:auto;z-index:1;padding:4px;FILTER: alpha(opacity=90);}
#AddLabelM li{margin:0;padding:0 2px;float:left;width:100%; border-bottom:1px #CCCCCC dashed;}
-->
</style>
</head>
<body>
<div id="AddLabelM"><li><a href="#" onClick="openlabel('GetResumeList');">添加人才函数标签</a></li>
<li><a href="#" onClick="openlabel('GetComList');">添加企业函数标签</a></li>
<li><a href="#" onClick="openlabel('GetHireList');">添加职位函数标签</a></li>
<li><a href="#" onClick="openlabel('GetArticleList');">添加文章函数标签</a></li>
<li><a href="#" onClick="openlabel('GetLink');">添加链接函数标签</a></li></div>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" class="tableBorder">
  <tr>
    <th height="22" align="center" >通用标签管理</th>
  </tr>
  <tr>
    <td height="20"><span class="bodytitle"><font color="ff6600"><b class="style1">　管理选项</b></font>：</span><a href="Admin_Label.asp">管理首页</a> | <a href="#" onClick="window.open ('HtmlLabel.asp?Action=Add','newwindow','height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') ">添加静态标签</a> | <a href="#" onClick="javascript:document.getElementById('AddLabelM').style.display='block'">添加函数标签</a> |&nbsp;[<a href="javascript:location.reload()">刷新页面</a>]</td>
  </tr>
  <tr>
    <td height="20"><font color="ff6600"><b class="style1">　标签类型</b></font>：<a href="Admin_Label.asp">系统内置标签</a> | <a href="Admin_Label.asp?LabelType=5">自定义静态标签</a> | <a href="Admin_Label.asp?LabelType=6">自定义函数标签</a></td>
  </tr>
  <form name="lform" action="Admin_Label.asp?LabelType=<%=LabelType%>&keyword=<%=keyword%>" method="post">
  <tr>
    <td height="20"><font color="ff6600"><b class="style1">　操作选项</b></font>：
      <input type="text" name="keyword" <%if keyword="" then%>value="请输入搜索关键字"<%else%>value="<%=keyword%>"<%end if%> onBlur="if(this.value=='') this.value='请输入搜索关键字';" onFocus="if(this.value=='请输入搜索关键字') this.value='';" size="30" /> <select name="LabelType">
        <option value="1" <%if cint(LabelType)<5 then%>selected="selected"<%end if%>>系统内置标签</option>
        <option value="5" <%if cint(LabelType)=5 then%>selected="selected"<%end if%>>自定义静态标签</option>
        <option value="6" <%if cint(LabelType)>5 then%>selected="selected"<%end if%>>自定义函数标签</option>
      </select>
       <input name="Submit" type="submit" class="inputs" value="搜索"></td>
  </tr>
  </form>
</table>
<%
Action=trim(Request("Action"))
Select Case Action
	Case "Del"
		Call Del()
	Case Else
		Call main()
End Select

if FoundErr=True then
	call Show_Err()
end if

Conn.Close
Set Conn=Nothing

sub main()
	Set rs= Server.CreateObject(FR_HR_RS)
	if LabelType=0 then LabelType=""
	if keyword<>"" then
		If LabelType<>"" Then
			if LabelType<5 then
			sql="select * from JOB_Label where LabelType<5 and LabelName like '%"&keyword&"%' order by LabelID desc"
			else			
			sql="select * from JOB_Label where LabelType="&LabelType&" and LabelName like '%"&keyword&"%' and projectid="&DefaultTPID&" order by LabelID desc"
			end if
		else
		sql="select * from JOB_Label where LabelType<5 and LabelName like '%"&keyword&"%' order by LabelID desc"
		end if
	else
		If LabelType<>"" Then
		sql="select * from JOB_Label where LabelType="&LabelType&" and projectid="&DefaultTPID&" order by LabelID desc"
		else
		sql="select * from JOB_Label where LabelType<5 order by LabelID desc"
		end if
	end if
	rs.open sql,conn,1,1
	if rs.eof and rs.bof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>暂无此类标签，请添加后再进行管理！</li>"
		exit sub
	else
		totalPut=rs.recordcount
		if (page-1)*MaxPerpage>totalput then
			if (totalPut mod MaxPerpage)=0 then
				page= totalPut \ MaxPerpage
			else
				page= totalPut \ MaxPerpage + 1
			end if
		end if
		if page=1 then
			Call MainInfo()
		else
			if (page-1)*MaxPerpage<totalPut then
				rs.move  (page-1)*MaxPerpage
				dim bookmark
				bookmark=rs.bookmark
				Call MainInfo()
			else
				page=1
				Call MainInfo()
			end if
		end if
	end if
	rs.close
	set rs=nothing
End Sub
%>
<%Sub MainInfo()%>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" class="tableBorder mt6">
<form name="form1" method="Post" action="<%=strFileName%>">
	  <tr align="center">
		<th colspan="6" height="22" align="center" class="tableHeaderText"><strong>标签管理</strong></th>
      </tr>
	  <tr align="center">
		<td width="5%" height="22" class=tableHeaderText><strong>编号</strong></td>
		<td width="23%" class=tableHeaderText><strong>标签名称</strong></td> 
		<td width="10%" class=tableHeaderText><strong>标签类型</strong></td>
		<td width="36%" class=tableHeaderText><strong>标签简介</strong></td>
		<td width="16%" class=tableHeaderText><strong>最后编辑时间</strong></td>
		<td width="10%" class=tableHeaderText><strong>操作选项</strong></td>
      </tr>
	<%
		do while not rs.eof
		LabelID=Rs("LabelID")
		LabelName=Rs("LabelName")
		LabelType=Rs("LabelType")
		LabelContent=Rs("LabelContent")
		LabelIntro=Rs("LabelIntro")
		Labeleditdate=Rs("Labeleditdate")
	%>
	  <tr onMouseOver="this.style.background='#FFFFCC'" onMouseOut="this.style.background='#EEF7FD'"align="center">
		<td align="center"><%=LabelID%></td>
		<td align="left"><%=LabelName%></td> 
		<td align="center">
		<%Select Case LabelType
			Case 5
			Response.Write "静态标签"
			Case 6
			Response.Write "函数标签"
			Case 7
			Response.Write "动态标签"
			Case 8
			Response.Write "JS标签"
			Case else
			Response.Write "系统标签"
		End Select%></td>
		<td align="left"><%=LabelIntro%></td>
		<td align="center"><%=Labeleditdate%></td>
		<td align="center">
		<%select case LabelType
			case 0
				alink=Replace(left(LabelContent,InStr(LabelContent, "(")-1),"{$","")&".asp?Action=Modify&LabelID="&LabelID&""
			case 1
				alink="HtmlLabel.asp?Action=Modify&LabelID="&LabelID&""
			case 2
				alink=Replace(left(LabelContent,InStr(LabelContent, "(")-1),"{$","")&".asp?Action=Modify&LabelID="&LabelID&""
			case 3
				alink="DiyLabel.asp?Action=Modify&LabelID="&LabelID&""
			'case 4
				'alink="Jslabel.asp?Action=Modify&LabelID="&LabelID&""
			case 4
				alink="HtmlLabel.asp?Action=Modify&LabelID="&LabelID&""
			case 5
				alink="HtmlLabel.asp?Action=Modify&LabelID="&LabelID&""
			case 6
				alink=Replace(left(LabelContent,InStr(LabelContent, "(")-1),"{$","")&".asp?Action=Modify&LabelID="&LabelID&""
			case 7
				alink="DiyLabel.asp?Action=Modify&LabelID="&LabelID&""
			case 8
				alink="Jslabel.asp?Action=Modify&LabelID="&LabelID&""
		end select%>
		  <a href="#" onClick="window.open ('<%=alink%>','newwindow','height=500,width=550,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no') ">
修改</a> 
<%if LabelType>=5 then%><a href="javascript:ConfirmDel(<%=LabelID%>,'<%=LabelName%>');">删除</a><%end if%></td>
      </tr>
	<%
		i=i+1
		if i>=MaxPerPage then exit do
		rs.movenext
		loop
	%>
		  
		  <tr align="center">
		    <td colspan="6"><%If totalput>0 Then
	Call Showpage(strFileName,totalput,MaxPerPage,false,true,"个标签")
End If%></td>
	      </tr>
</form>
</table>
<%End Sub%>
<%
sub Del()
	LabelID=trim(Request("LabelID"))
	if LabelID="" then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>参数不足！</li>"
		exit sub
	end if
	sql="select * from JOB_Label where LabelID In("& LabelID &")"
    set rs=server.CreateObject ("Adodb.recordset")
	rs.open sql,conn,1,3
	if rs.bof and rs.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>标签不存在或者已被删除！</li>"
		exit sub
	else
		Do While Not(rs.Eof)
			rs.delete
			rs.update
			rs.MoveNext
		Loop
	end if
	rs.close
	set rs=nothing
    response.redirect strFileName
	response.End()
end sub
%>
<!--#include file="../inc/copy.asp" -->
