<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<!--#include file="../inc/sendmail.asp"-->
<%link="person_sendresume.asp"%>
<!--#include file="checkpmember.asp" -->
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>外发简历--<%=SiteTitle%></title>
<script src="../js/main.js" language="javascript"></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.sendresume.value) == "")
  {
    alert("请输入职位名称!");
    theForm.sendresume.focus();
    return (false);
  }
  var objv = fnRemoveBrank(theForm.sendemail.value);
  var pattern = /^([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)*@([a-zA-Z0-9_-])+(\.([a-zA-Z0-9_-])+)+$/;
  flag = pattern.test(objv);
  if(!flag)
  {
    alert("电子邮件：格式不正确！请重新输入。");
	theForm.sendemail.focus();
	return (false); 
  }
 }

function runscript(r,n){
	window.open("person_templates_view.asp?rid="+r+"&TemplateID="+n+"","templates_view")
}
-->
</script>
<link href="../member/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/input.js"></script>
</head>
<body>
<div class="memmenul">
<%step=trim(request("step"))
Select Case step
	Case "send"
		Call send()
	Case Else
		Call main()
End Select%>
<%Sub main()%>
<div class="leftmenutit"><span>外发简历</span></div>
<table width="98%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center">
<form action="person_sendresume.asp?step=send" method="post" onSubmit="return Juge(this)">
  <tr>
    <td>您可以用在<%=sitename%>创建的简历申请本网站以外的职位。</td>
  </tr>
  <tr>
    <td>职位名称：　<input name="sendresume" type="text" size="30" /></td>
  </tr>
  <tr>
    <td>企业E-mail：<input name="sendemail" type="text" size="30" /></td>
  </tr>
  <tr>
    <td class="tdcolor">选择简历</td>
  </tr>
  <tr>
    <td>
<%set rs=server.createobject("ADODB.Recordset")
sql="select * from job_p_resume where resume_pmember='"&pmember_login&"' order by resume_announcedate desc"
rs.open sql,conn,1,1
if not rs.eof then%>
<table width="90%" border="0" cellspacing="0" cellpadding="0" class="mtable" align="center" style="border:1px #ABCEE2 solid;">
  <tr>
    <td width="51%"><strong>&nbsp; 简历名称</strong></td>
    <td width="37%" align="center"><strong>简历语言</strong></td>
    <td width="12%" align="center"><strong>操作</strong></td>
  </tr>
<%do while not rs.eof%>
  <tr>
    <td><input type="radio" name="resumeid" value="<%=rs("resume_id")%>" <%if rs("resume_personinfo")<>1 or rs("resume_education")<>1 or rs("resume_train")<>1 or rs("resume_lang")<>1 or rs("resume_work")<>1 or rs("resume_careerwill")<>1 then Response.Write "disabled"%> /><%=rs("resume_title")%></td>
    <td align="center"><%if rs("resume_chinese")=1 then%>中文<%end if%>
      <%if rs("resume_personinfo")<>1 or rs("resume_education")<>1 or rs("resume_train")<>1 or rs("resume_lang")<>1 or rs("resume_work")<>1 or rs("resume_careerwill")<>1 then%>
      &nbsp;-&nbsp;<strong><font color="#FF0000">不完整</font></strong>
      <%end if%></td>
    <td align="center"><a href="#" onclick="runscript(<%=rs("resume_id")%>,<%=rs("resume_template")%>)">预览</a></td>
  </tr>
<%
rs.movenext
loop
else
Response.Write("尚未创建简历！")
end if
rs.close
set rs=nothing
%>
</table>

	</td>
  </tr>
  <tr>
    <td class="tdcolor">附求职信</td>
  </tr>
  <tr>
    <td>
 <%
set rs=server.createobject("ADODB.Recordset")
sql="select letter_id,letter_title from job_p_letter where letter_pmember='"&pmember_login&"' order by letter_announcedate desc"
rs.open sql,conn,1,1
if not rs.eof then
%><table width="90%" border="0" cellspacing="0" cellpadding="0" align="center" class="mtable">
  <tr>
  <%i=0
	do while not rs.eof
	i=i+1%>
    <td><input type="radio" name="letterid" value="<%=rs("letter_id")%>"/><%=rs("letter_title")%></td><%if i mod 2=0 then%>
  </tr>
  <%end if
	  rs.movenext
	  loop
	  end if
	  rs.close
set rs=nothing%>
</table>
	</td>
  </tr>
  <tr>
    <td><input name="Submit" type="submit" value="发　送" class="inputs"></td>
  </tr>
  </form>
</table>
<%End Sub%>
</div>
<%
conn.close:set conn=nothing%>
<%Sub send()
sendresume=CheckStr(trim(request("sendresume")))
 if sendresume="" then
  Response.Write ("<script language=JavaScript>{alert('错误：职位名称不能为空!');location.href = 'javascript:history.go(-1)';}</script>")
  Response.End
 end if
sendemail=CheckStrbox(request("sendemail"))
 If sendemail="" Then
  Response.Write ("<script language=JavaScript>{alert('错误：E-mail不能为空!');location.href = 'javascript:history.go(-1)';}</script>")
  Response.End
 End If
resumeid=request("resumeid")
If resumeid="" or not IsNumeric(resumeid) Then
Response.Write ("<script language=JavaScript>{alert('错误：请选择简历!');location.href = 'javascript:history.go(-1)';}</script>")
Response.End
else
	set rs=conn.execute("select * from job_p_resume where resume_pmember='"&pmember_login&"'and resume_id="&resumeid&"")
	TemplateID=rs("resume_template")
	rs.close
	set rs=nothing
	'读取模版内容
	set rs=conn.execute("select * from JOB_Template where ChannelID=1 and TemplateID="&TemplateID&" and IsDefaultInProject="&FR_HR_True&" and typeid=13")
		if not rs.eof then
		TemplateContent=rs("TemplateContent")
		else
		Response.Write("读取模板出错!")
		Response.end()
		end if
	rs.close
	set rs=nothing
'读取求职信
letterid=request("letterid")
	if letterid<>"" and IsNumeric(letterid) then
	set rs=conn.execute("select letter_id,letter_content from job_p_letter where letter_pmember='"&pmember_login&"' and letter_id="&letterid&"")
		if not rs.eof then
		letter_content=rs("letter_content")
		letter_content="求职信<br>"&letter_content
		end if
	rs.close
	set rs=nothing
	end if
'邮件内容
SendResumeContent=TemplateContent
SendResumeContent=ReplaceLableFlag(ReplaceAllLabel(SendResumeContent))
SendResumeContent=CreateHTMLReplace(ResumeContentHtml(SendResumeContent,resumeid))
SendResumeContent="<div style='font-size:14px; line-height:150%; text-align:left;'>您好："&pmember_login&"对贵公司 "&sendresume&" 职位很感兴趣，通过"&sitename&" “外发简历”平台向您投递个人简历，如果您对投递者有意向，可直接按简历中联系方式和"&pmember_login&"联系。<br>我们期望与您合作，为您提供大量的优秀人才！ 如您有意向，请<a href="&siteurl&" target=_blank>登陆我们网站，筛选更多优秀人才！</a>"&letter_content&"</div><br>"&SendResumeContent
Call SendMail(sendemail,"应聘"&sendresume&"，"&pmember_login&"通过"&sitename&"给您发送简历",SendResumeContent)
Response.Write ("<script language=JavaScript>{alert('发送成功!');location.href = 'javascript:history.go(-1)';}</script>")
Response.End
End If
Conn.close:Set Conn=Nothing
End Sub%>