<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="../conn/conn.asp"-->
<!--#include file="../inc/Commoncode.asp"-->
<!--#include file="../inc/CommonFunction.asp"-->
<%link="person_certificate.asp"%>
<!--#include file="checkpmember.asp" -->
<%
sUploadDir=UpFilesPath("Person")
step=trim(request("step"))
if step<>"" then
picture_certiid=trim(request("certi"))
if picture_certiid <>"" then
mystring=split(picture_certiid,",")
select case step
 case "show"
  conn.execute("update JOB_picture set picture_status=0 where picture_member='"&pmember_login&"' and picture_type=21")
  for i=0 to ubound(mystring)
   certiid=Chkint(trim(mystring(i)))
   conn.execute("update JOB_picture set picture_status=1 where picture_member='"&pmember_login&"' and picture_type=21 and picture_id="&certiid&"")
  next
 case "del"
  Set rs= Server.CreateObject("ADODB.RecordSet")
  for i=0 to ubound(mystring)
   certiid=Chkint(trim(mystring(i)))
   sql="select picture_filename from JOB_picture where picture_member='"&pmember_login&"' and picture_type=21 and picture_id="&certiid&""
   rs.open sql,conn,1,1
    prepicture=rs("picture_filename")
   rs.close
   if prepicture<>"" and not isnull(prepicture) then      '原来有图片
   set fileobject=server.createobject("scripting.filesystemobject")
   path=Server.MapPath(sUploadDir&prepicture)
   if fileobject.fileexists(path) then
    set afile=fileobject.getfile(path)
    afile.delete
   end if
   end if
   conn.execute("delete from JOB_picture where picture_member='"&pmember_login&"' and picture_type=21 and picture_id="&certiid&"")
  next
  set rs=nothing
end select
end if
CloseConn
response.redirect "person_certificate.asp"
response.end
end if
%>
<!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>
<link href="../member/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/input.js"></script>
<script language="JavaScript">
<!--
function getFileExtension(filePath) { //v1.0
  fileName = ((filePath.indexOf('/') > -1) ? filePath.substring(filePath.lastIndexOf('/')+1,filePath.length) : filePath.substring(filePath.lastIndexOf('\\')+1,filePath.length));
  return fileName.substring(fileName.lastIndexOf('.')+1,fileName.length);
}
function checkFileUpload(form,extensions) { //v1.0
  document.MM_returnValue = true;
  if (extensions && extensions != '') {
    for (var i = 0; i<form.elements.length; i++) {
      field = form.elements[i];
      if (field.type.toUpperCase() != 'FILE') continue;
      if (field.value == '') {
        alert('文件框中必须保证已经有文件被选中!');
        document.MM_returnValue = false;field.focus();break;
      }
      if (extensions.toUpperCase().indexOf(getFileExtension(field.value).toUpperCase()) == -1) {
        alert('这种文件类型不允许上传!.\n只有以下类型的文件才被允许上传: ' + extensions + '.\n请选择别的文件并重新上传.');
        document.MM_returnValue = false;field.focus();break;
  } } }
}
function Juge(theForm)
{
 var flag=false; //是否有选择证书
 var k=0;
 var refid;
	for(i=0;i<theForm.elements.length;i++) 
	{
		if (theForm.elements[i].name=="certi")
		{		
			if (theForm.elements[i].checked==true) 
			{
				flag=true;
				break;
			}
		}
	}
	if (flag==false)
	{
		alert("请至少选择一项！");
		return false;
	}
}
//-->
</script></head>
<body>
<div class="memmenul">
<div class="leftmenutit"><span>相关证书</span></div>
<ul><li style="padding:2px; background-color:#F1F8Fc;"><span style="MARGIN-LEFT: 5px; LINE-HEIGHT: 18px; padding:4px;"><strong>选择需要上传的证书图片：</strong><br />
      <font color="#333333">（上传证书格式一律为JPG、JPEG或GIF格式，图片大小不能超过</font><strong>100</strong><font color="#333333">K；证件类型包括：学历证书、学位证书、相关技能等级证书……，最多上传四个证书；如果需要更新证书，请再上传一次。）</font></span></li>
<li style="padding:2px; margin-top:8px; background-color:#FFFFFF;"><form action="certificatesave.asp" method="post" enctype="multipart/form-data" name="form1" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG');return document.MM_returnValue">
&nbsp;上传证书：
          <INPUT name="attachment" type="file" class="inputs" style="FONT-SIZE: 12px; FONT-FAMILY: 宋体">
          <INPUT name=Send1 type=submit class="inputs" style="FONT-SIZE: 12px; FONT-FAMILY: 宋体" value=" 上 传 ">
          </form>
    </li>
<li style="padding:2px; background-color:#F1F8Fc; height:16px; padding-top:6px; padding-left:8px;"><strong>给简历配置相关证书：</strong></li>
<li style="padding:2px;background-color:#FFFFFF;"><form name="certiform" action="person_certificate.asp" method="post" onSubmit="return Juge(this)">
                  <TABLE style="BORDER-COLLAPSE: collapse" borderColor=#FFFFFF cellSpacing=0 cellPadding=6 width="95%" border=0>
                    <TBODY>
                      <TR>
                        <%Set rs= Server.CreateObject("ADODB.RecordSet")
						 sql="select * from JOB_picture where picture_member='"&pmember_login&"' and picture_type=21"
						 rs.open sql,conn,1,1
						 if  not rs.eof then
						 for i=1 to rs.recordcount
						 response.write "<TD align='middle' width='50%'>"
						  response.write "<A href='"&sUploadDir&rs("picture_filename")&"' target=_blank><IMG height=120 src='"&sUploadDir&rs("picture_filename")&"' width=200 border=0></A>"
						 response.write "<br><INPUT name='certi' type='checkbox' id='certi' value='"&rs("picture_id")&"'"
						  if rs("picture_status")=1 then
						   response.write " checked"
						  end if
						 response.write "> 证书"&small(i)&""
						 response.write "</TD>"
						 if i mod 2=0 then
						  response.write "</TR><TR>"
						 end if
						 rs.movenext
						next
						end if
						rs.close
						set rs=nothing
						%>
                        </TR>
                    </TBODY>
                  </TABLE>
                  <br>
                  <br>
                  <div align="center">
                    <input type="hidden" name="step">
                    <INPUT name=configure type=submit class="inputs" OnClick="document.certiform.step.value='show'" value="附加至我的简历">
&nbsp;
            <INPUT name=deletecer type=submit class="inputs" OnClick="document.certiform.step.value='del'" value="删　除"> 
            </div>
              </form></li>
</ul>
</div>
<%CloseConn%>