<%@ LANGUAGE = VBScript.Encode %>
<!--#include file="../Include/conn.asp" -->
<!--#include file="../Include/ConnDatabase.asp" -->
<!--#include file="Admin_htmlconfig.asp"-->
<%
'=====================================
'天天企业网站管理系统  TianTianCMS
'天天网络科技工作室版权所有
'官方客服中心 http://www.ip126.com
'微信公众号 ip126com
'QQ:530051328 mail:bbfhq@163.com
'=====================================
%>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312" />
<TITLE>招聘编辑</TITLE>
<link rel="stylesheet" href="Images/Admin.css">
<script language="javascript" src="../Script/Admin.js"></script>
</HEAD>
<BODY>
<%
if Instr(session("AdminPurview"),"|25,")=0 then
  response.write ("<br><br><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>")
  response.end
end if
dim Result
Result=request.QueryString("Result")
dim ID,JobNameCh,JobNameEn,ViewFlagCh,ViewFlagEn,JobAddressCh,JobAddressEn
dim JobNumber,EmolumentCh,EmolumentEn,ResponsibilityCh,ResponsibilityEn,RequirementCh,RequirementEn,StartDate,EndDate
dim eEmployerCh,eEmployerEn,eContactCh,eContactEn,eTel,eAddressCh,eAddressEn,ePostCode,eEmail,CommendFlag,TopFlag
ID=request.QueryString("ID")
call JobsEdit()
%>

<br>
<table class="tableborder" width="95%" border="0" align="center" cellpadding="3" cellspacing="1">
  <form name="editForm" method="post" action="RecruitmentEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
    <tr>
      <th height="22" colspan="2">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>招聘】</th>
    </tr>
    <tr>
    <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>招聘职位：</td>
        <td class="forumrowhighlight"><input name="JobNameCh" type="text" id="JobNameCh" style="WIDTH: 240;" value="<%=JobNameCh%>">&nbsp;<font color="red">*</font>&nbsp;显示：<input name="ViewFlagCh" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" checked <%if ViewFlagCh then response.write ("checked")%>>&nbsp;中文</td>
    </tr>
	<%if chinato=1 then%>      <tr>
       
        <td class="forumrowhighlight"><input name="JobNameEn" type="text" id="JobNameEn" style="WIDTH: 240;" value="<%=JobNameEn%>">&nbsp;&nbsp;&nbsp;显示：<input name="ViewFlagEn" type="checkbox" value="1" style='HEIGHT: 13px;WIDTH: 13px;' <%if ViewFlagEn then response.write ("checked")%>> 英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td align="right" class="forumRow">状　　态：</td>
        <td class="forumRowHighlight"><input name="CommendFlag" type="checkbox" style="HEIGHT: 13px;WIDTH: 13px;" value="1" <%if CommendFlag then response.write ("checked")%>>&nbsp;推荐&nbsp;<input name="TopFlag" type="checkbox" value="1" style="HEIGHT: 13px;WIDTH: 13px;" <%if TopFlag then response.write ("checked")%>>&nbsp;置顶</td>
      </tr>
      <tr>
        <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>工作地点：</td>
        <td class="forumrowhighlight"><input name="JobAddressCh" type="text" id="JobAddressCh" style="WIDTH: 240;" value="<%=JobAddressCh%>">&nbsp;<font color="red">*</font>&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><input name="JobAddressEn" type="text" id="JobAddressEn" style="WIDTH: 240;" value="<%=JobAddressEn%>">&nbsp;&nbsp;&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow">招聘人数：</td>
        <td class="forumrowhighlight"><input name="JobNumber" type="text" id="JobNumber" style="WIDTH: 240" value="<%=JobNumber%>"  onKeyUp="if(isNaN(value)){alert('只允许输入数字');value='';}" onafterpaste="this.value=this.value.replace(/\D/g,'')">&nbsp;<font color="red">*</font>&nbsp;人</td>
      </tr>
      <tr>
        <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>月&nbsp;薪&nbsp;水：</td>
        <td class="forumrowhighlight"><input name="EmolumentCh" type="text" id="EmolumentCh" style="WIDTH: 240;" value="<%=EmolumentCh%>"> <font color="red">*</font>&nbsp;元&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><input name="EmolumentEn" type="text" id="EmolumentEn" style="WIDTH: 240;" value="<%=EmolumentEn%>"> &nbsp;&nbsp;美元&nbsp;&nbsp;&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow">开始日期：</td>
        <td class="forumrowhighlight"><input name="StartDate" type="text" id="StartDate" style="WIDTH: 240;" value="<% if StartDate="" then response.write now() else response.write (StartDate) end if%>" maxlength="24">&nbsp;<font color="red">*</font>&nbsp;默认为当前时间，可手动输入日期格式</td>
      </tr>
      <tr>
        <td height="20" align="right" class="forumrow">结束日期：</td>
        <td class="forumrowhighlight"><input name="EndDate" type="text" id="EndDate" style="WIDTH: 240;" value="<% if EndDate="" then response.write (DateAdd("m",3,now())) else response.write (EndDate) end if%>" maxlength="24">&nbsp;<font color="red">*</font>&nbsp;默认为3个月，可手动输入日期格式</td>
      </tr>
      <tr>
        <td height="20" align="right" valign="top" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>工作职责：</td>
        <td class="forumrowhighlight"><textarea name="ResponsibilityCh" rows="8" id="ResponsibilityCh" style="WIDTH: 80%;"><%=ResponsibilityCh%></textarea>&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>      <tr>
       
        <td class="forumrowhighlight"><textarea name="ResponsibilityEn" rows="8" id="Responsibilityen" style="WIDTH: 80%;"><%=ResponsibilityEn%></textarea>&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" valign="top" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>职位要求：</td>
        <td class="forumrowhighlight"><textarea name="RequirementCh" rows="8" id="RequirementCh" style="WIDTH: 80%;"><%=RequirementCh%></textarea>&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><textarea name="RequirementEn" rows="8" id="Requirementen" style="WIDTH: 80%;"><%=RequirementEn%></textarea>&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>用人单位：</td>
        <td class="forumrowhighlight"><input name="eEmployerCh" type="text" id="eEmployerCh" style="WIDTH: 300;" value="<%=eEmployerCh%>">&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><input name="eEmployerEn" type="text" id="eEmployerEn" style="WIDTH: 300;" value="<%=eEmployerEn%>">&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>联 系 人：</td>
        <td class="forumrowhighlight"><input name="eContactCh" type="text" id="eContactCh" style="WIDTH: 300;" value="<%=eContactCh%>">&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><input name="eContactEn" type="text" id="eContactEn" style="WIDTH: 300;" value="<%=eContactEn%>">&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow">联系电话：</td>
        <td class="forumrowhighlight"><input name="eTel" type="text" id="eTel" style="WIDTH: 300;" value="<%=eTel%>"></td>
      </tr>
      <tr>
        <td height="20" align="right" class="forumrow" <%if chinato=1 Then response.write "rowspan=2"%>>联系地址：</td>
        <td class="forumrowhighlight"><input name="eAddressCh" type="text" id="eAddressCh" style="WIDTH: 300;" value="<%=eAddressCh%>">&nbsp;中文</td>
      </tr>
	  <%if chinato=1 then%>
      <tr>        
        <td class="forumrowhighlight"><input name="eAddressEn" type="text" id="eAddressEn" style="WIDTH: 300;" value="<%=eAddressEn%>">&nbsp;英文</td>
      </tr>
	  <%End if%>
      <tr>
        <td height="20" align="right" class="forumrow">邮&nbsp;&nbsp;&nbsp;&nbsp;编：</td>
        <td class="forumrowhighlight"><input name="ePostCode" type="text" id="ePostCode" style="WIDTH: 88;" value="<%=ePostCode%>" maxlength="10"></td>
      </tr>
      <tr>
        <td height="20" align="right" class="forumrow">联系邮箱：</td>
        <td class="forumrowhighlight"><input name="eEmail" type="text" id="eEmail" style="WIDTH: 300;" value="<%=eEmail%>"></td>
      </tr>
      <tr>
        <td height="30" align="right" class="forumrow">&nbsp;</td>
        <td valign="bottom" class="forumrowhighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
    </tr>
  </form>
</table>
</BODY>
</HTML>
<%
sub JobsEdit()
  dim Action,rsCheckAdd,rs,sql
  Action=request.QueryString("Action")
  if Action="SaveEdit" then
    set rs = server.createobject("adodb.recordset")
    if len(trim(request.Form("JobNameCh")))<1 or len(trim(request.Form("JobAddressCh")))<1 or len(trim(request.Form("EmolumentCh")))<1 then
      response.write ("<script language=javascript> alert('""中文名称、工作地点、月薪水为必填项目！');history.back(-1);</script>")
      response.end
    end if
    if request.Form("ViewFlagEn")=1 then
      if len(trim(request.Form("JobNameEn")))<1 or len(trim(request.Form("JobAddressCh")))<1 or len(trim(request.Form("EmolumentCh")))<1 then
      response.write ("<script language=javascript> alert('您已经选择了""英文""显示，因此英文名称、工作地点、月薪水为必填项目！');history.back(-1);</script>")
      response.end
      end if
    end if
    if not IsNumeric(trim(request.Form("JobNumber"))) then
      response.write ("<script language=javascript> alert('""职位数量""请输入数字！');history.back(-1);</script>")
      response.end
    end if
    if not (IsDate(trim(request.Form("StartDate"))) or IsDate(trim(request.Form("EndDate")))) then
      response.write ("<script language=javascript> alert('""开始日期、结束日期""为必填项目，且为日期格式！');history.back(-1);</script>")
      response.end
    end if
    if Result="Add" then
	  sql="select * from TianTianCMS_Recruitment"
      rs.open sql,conn,1,3
      rs.addnew
      rs("JobNameCh")=trim(Request.Form("JobNameCh"))
      rs("JobNameEn")=trim(Request.Form("JobNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        rs("ViewFlagEn")=0
	  end If
	  if Request.Form("CommendFlag")=1 then
        rs("CommendFlag")=Request.Form("CommendFlag")
	  else
        rs("CommendFlag")=0
	  end If
	  if Request.Form("TopFlag")=1 then
        rs("TopFlag")=Request.Form("TopFlag")
	  else
        rs("TopFlag")=0
	  end if	  
	  rs("JobAddressCh")=trim(Request.Form("JobAddressCh"))
	  rs("JobAddressEn")=trim(Request.Form("JobAddressEn"))
	  rs("JobNumber")=trim(Request.Form("JobNumber"))
	  rs("EmolumentCh")=trim(Request.Form("EmolumentCh"))
	  rs("EmolumentEn")=trim(Request.Form("EmolumentEn"))
	  rs("StartDate")=trim(Request.Form("StartDate"))
	  rs("EndDate")=trim(Request.Form("EndDate"))
	  rs("ResponsibilityCh")=StrReplace(Request.Form("ResponsibilityCh"))
	  rs("ResponsibilityEn")=StrReplace(Request.Form("ResponsibilityEn"))
	  rs("RequirementCh")=StrReplace(Request.Form("RequirementCh"))
	  rs("RequirementEn")=StrReplace(Request.Form("RequirementEn"))
	  rs("AddTime")=now()
	  rs("UpdateTime")=rs("AddTime")
	  rs("eEmployerCh")=trim(Request.Form("eEmployerCh"))
	  rs("eEmployerEn")=trim(Request.Form("eEmployerEn"))
	  rs("eContactCh")=trim(Request.Form("eContactCh"))
	  rs("eContactEn")=trim(Request.Form("eContactEn"))
	  rs("eTel")=trim(Request.Form("eTel"))
	  rs("eAddressCh")=trim(Request.Form("eAddressCh"))
	  rs("eAddressEn")=trim(Request.Form("eAddressEn"))
	  rs("ePostCode")=trim(Request.Form("ePostCode"))
	  rs("eEmail")=trim(Request.Form("eEmail"))
	  rs.update
	  rs.close
	  set rs=Nothing
	  set rs=server.createobject("adodb.recordset")
	  sql="select top 1 ID from TianTianCMS_Recruitment order by ID desc"
	  rs.open sql,conn,1,1
	  ID=rs("ID")
	  rs.close
	  set rs=Nothing
	  if ISHTML = 1 then
	  call html2("/CH/html/","/CH/",""&JobName&""&Separated&""&ID&"."&HTMLName&"","RecruitmentShow.Asp","ID=",ID,"","")
	  if chinato=1 then call html2("/EN/html/","/EN/",""&JobName&""&Separated&""&ID&"."&HTMLName&"","RecruitmentShow.Asp","ID=",ID,"","")
	  End If
	end if
	if Result="Modify" then
      sql="select * from TianTianCMS_Recruitment where ID="&ID
      rs.open sql,conn,1,3
      rs("JobNameCh")=trim(Request.Form("JobNameCh"))
      if chinato=1 then rs("JobNameEn")=trim(Request.Form("JobNameEn"))
	  if Request.Form("ViewFlagCh")=1 then
        rs("ViewFlagCh")=Request.Form("ViewFlagCh")
	  else
        rs("ViewFlagCh")=0
	  end if
	  if Request.Form("ViewFlagEn")=1 then
        if chinato=1 then rs("ViewFlagEn")=Request.Form("ViewFlagEn")
	  else
        if chinato=1 then rs("ViewFlagEn")=0
	  end If
	  if Request.Form("CommendFlag")=1 then
        rs("CommendFlag")=Request.Form("CommendFlag")
	  else
        rs("CommendFlag")=0
	  end If
	  if Request.Form("TopFlag")=1 then
        rs("TopFlag")=Request.Form("TopFlag")
	  else
        rs("TopFlag")=0
	  end if	  
	  rs("JobAddressCh")=trim(Request.Form("JobAddressCh"))
	  if chinato=1 then rs("JobAddressEn")=trim(Request.Form("JobAddressEn"))
	  rs("JobNumber")=trim(Request.Form("JobNumber"))
	  rs("EmolumentCh")=trim(Request.Form("EmolumentCh"))
	  if chinato=1 then rs("EmolumentEn")=trim(Request.Form("EmolumentEn"))
	  rs("StartDate")=trim(Request.Form("StartDate"))
	  rs("EndDate")=trim(Request.Form("EndDate"))
	  rs("ResponsibilityCh")=StrReplace(Request.Form("ResponsibilityCh"))
	  if chinato=1 then rs("ResponsibilityEn")=StrReplace(Request.Form("ResponsibilityEn"))
	  rs("RequirementCh")=StrReplace(Request.Form("RequirementCh"))
	  if chinato=1 then rs("RequirementEn")=StrReplace(Request.Form("RequirementEn"))
	  rs("UpdateTime")=now()
	  rs("eEmployerCh")=trim(Request.Form("eEmployerCh"))
	  if chinato=1 then rs("eEmployerEn")=trim(Request.Form("eEmployerEn"))
	  rs("eContactCh")=trim(Request.Form("eContactCh"))
	  if chinato=1 then rs("eContactEn")=trim(Request.Form("eContactEn"))
	  rs("eTel")=trim(Request.Form("eTel"))
	  rs("eAddressCh")=trim(Request.Form("eAddressCh"))
	  if chinato=1 then rs("eAddressEn")=trim(Request.Form("eAddressEn"))
	  rs("ePostCode")=trim(Request.Form("ePostCode"))
	  rs("eEmail")=trim(Request.Form("eEmail"))
	  rs.update
	  rs.close
	  set rs=Nothing
	  if ISHTML = 1 then
	  call html2("/CH/html/","/CH/",""&JobName&""&Separated&""&ID&"."&HTMLName&"","RecruitmentShow.Asp","ID=",ID,"","")
	  if chinato=1 then call html2("/EN/html/","/EN/",""&JobName&""&Separated&""&ID&"."&HTMLName&"","RecruitmentShow.Asp","ID=",ID,"","")
	  End If
	end if
    if ISHTML = 1 then
        response.write "<script language='javascript'>alert('设置成功，接着生成相关静态页！');location.replace('Admin_htmlindex.asp?htmlsc=Admin_htmljobsort.asp');</script>"
	Else
	response.write "<script language='javascript'>alert('设置成功！');location.replace('RecruitmentList.asp');</script>"
	End If
  else
	if Result="Modify" then
      set rs = server.createobject("adodb.recordset")
      sql="select * from TianTianCMS_Recruitment where ID="& ID
      rs.open sql,conn,1,1
	  JobNameCh=rs("JobNameCh")
	  JobNameEn=rs("JobNameEn")
	  ViewFlagCh=rs("ViewFlagCh")
	  ViewFlagEn=rs("ViewFlagEn")
	  CommendFlag=rs("CommendFlag")
	  TopFlag=rs("TopFlag")
	  JobAddressCh=rs("JobAddressCh")
	  JobAddressEn=rs("JobAddressEn")
	  JobNumber=rs("JobNumber")
	  EmolumentCh=rs("EmolumentCh")
	  EmolumentEn=rs("EmolumentEn")
	  ResponsibilityCh=ReStrReplace(rs("ResponsibilityCh"))
	  ResponsibilityEn=ReStrReplace(rs("ResponsibilityEn"))
	  RequirementCh=ReStrReplace(rs("RequirementCh"))
	  RequirementEn=ReStrReplace(rs("RequirementEn"))
	  StartDate=rs("StartDate")	
	  EndDate=rs("EndDate")	  
      eEmployerCh=rs("eEmployerCh")
	  eEmployerEn=rs("eEmployerEn")
	  eContactCh=rs("eContactCh")
	  eContactEn=rs("eContactEn")
	  eTel=rs("eTel")
	  eAddressCh=rs("eAddressCh")
	  eAddressEn=rs("eAddressEn")
	  ePostCode=rs("ePostCode")
	  eEmail=rs("eEmail")
	  rs.close
      set rs=nothing
	end if
  end if
end sub
%>