<!--#include file="../Inc/Consts.inc" -->
<!--#include file="Admin_htmlconfig.Asp"-->
<!--#include file="../Inc/common.Asp" -->
<!--#include file="../Inc/strfunc.Asp" -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="Images/Admin_style.css">
<script src="../tqeditor/TQEditor.js" type="text/javascript"></script>
<script language="javascript" src="Admin.js"></script>
<script language="javascript" src="js/setday.js"></script>
<script language=javascript>
ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.editForm.submit();}}
}
</script>
<%
If InStr(SsMasterPurview, "|18,") = 0 Then response.Write ("<br /><br /><div align=""center""><font style=""color:red; font-size:9pt; "")>您没有管理该模块的权限！</font></div>"):response.End
Dim Result,rs,sql
Result = request.QueryString("Result")
Dim ID, JobName, ViewFlag, JobAddress, JobNumber, Emolument, StartDate, EndDate, Responsibility, Requirement
Dim eEmployer, eContact, eTel, eAddress, ePostCode, eEmail
ID = request.QueryString("ID")
Call JobsEdit()
%>
<br />
<table class="tableBorder" width="95%" border="0" align="center" cellpadding="5" cellspacing="1">
  <form name="editForm" method="post" action="Ss_JobsEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
    <tr>
      <th height="22" colspan="2" sytle="line-height:150%">【<%If Result = "Add" then%>添加<%ElseIf Result = "Modify" then%>修改<%End If%>招聘】</th>
    </tr>
    <tr>
      <td width="20%" align="right" class="forumRow">职位名称：</td>
      <td width="80%" class="forumRowHighlight"><input name="JobName" type="text" id="JobName" style="width: 280" value="<%=JobName%>" maxlength="280">
        是否生效：<input name="ViewFlag" type="checkbox" value="1" <%if ViewFlag then response.write ("checked")%>> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">工作地点：</td>
      <td class="forumRowHighlight"><input name="JobAddress" type="text" style="width: 180" value="<%=JobAddress%>" maxlength="180"> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">招聘人数：</td>
      <td class="forumRowHighlight"><input name="JobNumber" type="text" style="width: 80" value="<%=JobNumber%>" maxlength="80">
      <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">薪水待遇：</td>
      <td class="forumRowHighlight"><input name="Emolument" type="text" style="width: 80" value="<%=Emolument%>" maxlength="80"> <font color="red">*</font></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">时间：</td>
      <td class="forumRowHighlight"><input name="StartDate" type="text" id="StartDate" style="width: 120" value="<% if StartDate="" then response.write date() else response.write (StartDate) end if%>" readonly  onclick="setday(this)" > → <input name="EndDate" type="text" id="EndDate" style="width: 120" value="<% if EndDate="" then response.write (DateAdd("m",3,date())) else response.write (EndDate) end if%>"  readonly  onclick="setday(this)" > <font color="red">*</font> 默认为当前时间开始，三个月后结束(可手工修改)。</td>
    </tr>
    <tr>
      <td align="right" class="forumRow">工作职责：</td>
      <td class="forumRowHighlight"><input name="Responsibility" type="text" style="width: 500" value="<%=Responsibility%>" maxlength="500"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">职位要求：</td>
      <td class="forumRowHighlight">
      <textarea id="Requirement" rows="18" cols="100"  name="Requirement" wrap="virtual" onkeydown="ctlent()"><%=Requirement%></textarea>
<script type="text/javascript" defer> 
 new tqEditor('Requirement', {toolbar:'admin',uploadFieldName:'filedata',imageUploadUrl:'./upload.asp', imageFileTypes:'*.jpg;*.gif;*.png;*.jpeg',directInsertUploadImage:'true'}); 
</script>
      </td>
    </tr>
    <tr>
      <td align="right" class="forumRow">招聘单位：</td>
      <td class="forumRowHighlight"><input name="eEmployer" type="text" style="width: 280" value="<%=eEmployer%>" maxlength="280"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">联系人：</td>
      <td class="forumRowHighlight"><input name="eContact" type="text" style="width: 180" value="<%=eContact%>" maxlength="180"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">联系电话：</td>
      <td class="forumRowHighlight"><input name="eTel" type="text" style="width: 180" value="<%=eTel%>" maxlength="180"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">联系地址：</td>
      <td class="forumRowHighlight"><input name="eAddress" type="text" style="width: 280" value="<%=eAddress%>" maxlength="280"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">邮政编码：</td>
      <td class="forumRowHighlight"><input name="ePostCode" type="text" style="width: 80" value="<%=ePostCode%>" maxlength="80"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow">电子信箱：</td>
      <td class="forumRowHighlight"><input name="eEmail" type="text" style="width: 280" value="<%=eEmail%>" maxlength="280"></td>
    </tr>
    <tr>
      <td align="right" class="forumRow"></td>
      <td class="forumRowHighlight"><input name="submitSaveEdit" type="submit" id="submitSaveEdit" value="保存"> <input type="button" value="返回上一页" onclick="history.back(-1)"></td>
    </tr>
  </form>
</table>
<%
Sub JobsEdit()
    Dim Action, rsCheckAdd
    Action = request.QueryString("Action")
    If Action = "SaveEdit" Then
        If Len(Trim(request.Form("JobName")))<1 Then Call Alert("请填写招聘职位名称！","b-1"):response.End
        If Len(Trim(request.Form("JobAddress")))<1 Or Len(Trim(request.Form("Emolument")))<1 Then Call Alert("请填写工作地点、薪水待遇！","b-1"):response.End
        If Not IsNumeric(Trim(request.Form("JobNumber"))) Then Call Alert("请正确填写招聘人数！","b-1"):response.End
        If Not (IsDate(Trim(request.Form("StartDate"))) Or IsDate(Trim(request.Form("EndDate")))) Then Call Alert("请正确填写开始、结束日期！","b-1"):response.End
        If Result = "Add" Then
            sql = "select ID,JobName,ViewFlag,JobAddress,JobNumber,Emolument,StartDate,EndDate,Responsibility,Requirement,UpdateTime,eEmployer,eContact,eTel,eAddress,ePostCode,eEmail from ["&Datapre&"_Jobs]"
            set rs=db(sql,3)
            rs.addnew
            call savedatas()
            rs.update
            ID = rs("ID")
            rs.Close:Set rs = Nothing
            If ISHTML = 1 Then Call htmll("", "", ""&JobNameDiy&""&Separated&""&ID&"."&HTMLName&"", "JobsView.Asp", "ID=", ID, "", "")
        End If
        If Result = "Modify" Then
            sql = "select ID,JobName,ViewFlag,JobAddress,JobNumber,Emolument,StartDate,EndDate,Responsibility,Requirement,UpdateTime,eEmployer,eContact,eTel,eAddress,ePostCode,eEmail from ["&Datapre&"_Jobs] where ID="&ID
            set rs=db(sql,3)
            call savedatas()
            rs.update
            rs.Close:Set rs = Nothing
            If ISHTML = 1 Then Call htmll("", "", ""&JobNameDiy&""&Separated&""&ID&"."&HTMLName&"", "JobsView.Asp", "ID=", ID, "", "")
        End If
        If ISHTML = 1 Then
            Call Alert("提交成功，相关静态页面已更新！","Ss_JobsList.asp")
        Else
            Call Alert("提交成功！","Ss_JobsList.asp")
        End If
    Else
        If Result = "Modify" Then
            sql = "select ID,JobName,ViewFlag,JobAddress,JobNumber,Emolument,StartDate,EndDate,Responsibility,Requirement,eEmployer,eContact,eTel,eAddress,ePostCode,eEmail from ["&Datapre&"_Jobs] where ID="& ID
            set rs=db(sql,2)
            JobName = rs("JobName")
            ViewFlag = rs("ViewFlag")
            JobAddress = rs("JobAddress")
            JobNumber = rs("JobNumber")
            Emolument = rs("Emolument")
            StartDate = rs("StartDate")
            EndDate = rs("EndDate")
            Responsibility = ReStrReplace(rs("Responsibility"))
            Requirement = ReStrReplace(rs("Requirement"))
            eEmployer = rs("eEmployer")
            eContact = rs("eContact")
            eTel = rs("eTel")
            eAddress = rs("eAddress")
            ePostcode = rs("ePostcode")
            eEmail = rs("eEmail")
            rs.Close:Set rs = Nothing
        End If
    End If
End Sub

Sub savedatas()
rs("JobName") = Trim(Request.Form("JobName"))
            If Request.Form("ViewFlag") = 1 Then
                rs("ViewFlag") = 1
            Else
                rs("ViewFlag") = 0
            End If
            rs("JobAddress") = Trim(Request.Form("JobAddress"))
            rs("JobNumber") = Trim(Request.Form("JobNumber"))
            rs("Emolument") = Trim(Request.Form("Emolument"))
            rs("StartDate") = Trim(Request.Form("StartDate"))
            rs("EndDate") = Trim(Request.Form("EndDate"))
            rs("Responsibility") = StrReplace(Request.Form("Responsibility"))
            rs("Requirement") = Request.Form("Requirement")
            rs("UpdateTime") = Now()
            rs("eEmployer") = Trim(Request.Form("eEmployer"))
            rs("eContact") = Trim(Request.Form("eContact"))
            rs("eTel") = Trim(Request.Form("eTel"))
            rs("eAddress") = Trim(Request.Form("eAddress"))
            rs("ePostcode") = Trim(Request.Form("ePostcode"))
            rs("eEmail") = Trim(Request.Form("eEmail"))
end sub
%>