<!-- #include file="include/con_user.asp" -->
<!-- #include file="include/jk_pagecute.asp" -->
<!-- #include file="include/jk_page_cute.asp" -->
<%
dim nummer,nums,rssum,page,viewpage,thepages
nummer=dim_num(0)
nums=nummer
page=1
tit="人才收藏库"

call web_head(2,0,0,0,0)
'----------------------------左边 开始----------------------------
call user_left("")
'----------------------------左边 结束----------------------------
call web_center(0)
'----------------------------中间 开始----------------------------
'response.write joekoe_cms.js_put("",2)
'call joekoe_cms.js_put("style/joekoe_select.js",4)
'call joekoe_cms.js_put("style/web_img.js",4)

if action="add" and joekoe_cms.chk()=false then action=""

select case action
case "add"
  call job_fav_add()
case "clear"
  call job_fav_clear()
case "delete"
  call job_fav_delete()
case else
  call job_fav_main()
end select

'response.write joekoe_cms.js_put("",1)
response.write vbcrlf&ukong
'----------------------------中间 结束----------------------------
call web_end(0,0)

sub job_fav_clear()
  sql="delete from job_fav where username1='"&login_username&"'"
  call joekoe_cms.exec(sql,0)
  call web_js_msg(1,"已成功清空全部"&viewper&"信息！","?")
end sub

sub job_fav_delete()
  dim sel_id,sdim,snum
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  sdim=split(sel_id,",")
  snum=ubound(sdim)
  for i=0 to snum
    if isnumeric(sdim(i)) then
      sql="delete from job_fav where username1='"&login_username&"' and id="&sdim(i)
      call joekoe_cms.exec(sql,0)
    end if
  next
  erase sdim
  call web_js_msg(1,"已成功删除"&(snum+1)&"位我的"&viewper&"！","?")
end sub

sub job_fav_add()
  dim username,utrue
  username=trim(request.form("username"))
  if symbol_name(username)=false then
    call web_js_msg(1,"要添加的"&viewper&"用户名称为空或含有非法字符！","?")
    exit sub
  end if
  set rs=joekoe_cms.exec("select top 1 username,isper from user_data where username='"&username&"'",1)
  if rs.eof then
    rs.close
    call web_js_msg(1,"要添加的"&viewper&"用户名称为不存在！","?")
    exit sub
  else
    if login_isper=rs("isper") then
    rs.close
    call web_js_msg(1,"你不能添加相同类型用户！","?")
    exit sub
    end if
  end if
  rs.close
  set rs=joekoe_cms.exec("select top 1 username2 from job_fav where username2='"&username&"' and username1='"&login_username&"'",1)
  if not rs.eof then
    rs.close
    call web_js_msg(1,"要添加的"&viewper&"已在您的好友列表内！","?")
    exit sub
  end if
  rs.close
  call joekoe_cms.exec("insert into job_fav(username1,username2) values('"&login_username&"','"&username&"')",0)
  call web_js_msg(1,"已成功将用户（"&username&"）加入到您的"&viewper&"中！","?")
end sub

sub job_fav_main()
  dim pageurl,username,sex,sex_name,keyword,sql_add,sql_add2
  pageurl="?"
  sql_add=""
  sql_add2=""
  keyword=joekoe_cms.code_form(request.querystring("keyword"))
  if keyword<>"" then
    sql_add=" and username2 like '%"&keyword&"%'"
    sql_add2=" and job_fav.username2 like '%"&keyword&"%'"
  end if
  sql="select count(id) from job_fav where username1='"&login_username&"'"&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
%>
<table cellspacing=1 cellpadding=4 class=table>
<tr><td class=td0>&nbsp;<%response.write viewper%>&nbsp;-&nbsp;相关操作</td></tr>
<tr><td class=bg_td align=center>
  <table border=0 width='98%'>
  <tr align=center>
  <td width='50%'>
    <table border=0>
    <form action='?' method=get onsubmit="javascript:frm_submitonce(this);">
    <input type=hidden name=action value='search'>
    <tr>
    <td>名称：</td>
    <td><input type=text name=keyword value='<%response.write keyword%>' size=15 maxlength=20></td>
    <td><input type=submit value='查找<%response.write viewper%>'></td>
    </tr>
    </form>
    </table>
  </td>
  <td width='50%'>
    <table border=0>
    <form action='?action=add' method=post onsubmit="javascript:frm_submitonce(this);">
    <input type=hidden name=chk value='yes'>
    <tr>
    <td>名称：</td>
    <td><input type=text name=username value='<%response.write code_admin("fav",2,20)%>' size=15 maxlength=20></td>
    <td><input type=submit value='添加<%response.write viewper%>'></td>
    </tr>
    </form>
    </table>
  </td>
  </tr>
  </table>
</td></tr>
</table>
<table cellspacing=1 cellpadding=4 class=table>
<form name=del_form action='?action=delete' method=post onsubmit="javascript:frm_submitonce(this);">
<input type=hidden name=chk value='yes'>
<%if login_isper=false then%>
<tr align=center>
<td width='7%' class=td0>排序</td>
<td width='15%' class=td0>用户名称</td>
<td width='8%' class=td0>性别</td>
<td width='10%' class=td0>学历</td>
<td width='30%' class=td0>应聘职位</td>
<td width='15%' class=td0>发布日期</td>
<td width='9%' class=td0>发短信</td>
<td width='6%' class=td0>操作</td>
</tr>
<%
  sql="select top "&nummer*viewpage&" person.username,person.iname,person.sex,person.edu,person.job,person.tim,job_fav.id from person inner join job_fav on person.username=job_fav.username2 where job_fav.username1='"&login_username&"' order by job_fav.id desc"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  
  for i=1 to nums
    username=rs("username")
    sex="boy"
    if rs("sex")=false then sex="girl"
%>
<tr class=bg_td align=center>
<td><%response.write (viewpage-1)*nummer+i%></td>
<td><a href='job_person.asp?action=search&sea_type=username&keyword=<%response.write username%>' title='查看 <%response.write rs("iname")%> 详细简历'><%response.write rs("iname")%></td>
<td><script language=javascript>document.write("<img border=0 src='"+web_dir_skin+"small/<%response.write sex%>.gif' alt='<%response.write username%> 是 "+web_n_<%response.write sex%>+"' align=absmiddle>");</script></td>
<td><%response.write rs("edu")%></td>
<td><%response.write rs("job")%></td>
<td><%response.write left(joekoe_cms.time_type(rs("tim"),3),5)%></td>
<td><a href='user_mail.asp?action=msg_write&accept=<%response.write server.urlencode(username)%>' target=_blank><script language=javascript>document.write("<img src='"+web_dir_skin+"mail/msg.gif' alt='给 <%response.write username%> 发送短信' border=0>");</script></a></td>
<td><input type=checkbox name=sel_id value='<%response.write rs("id")%>' class=bg_td></td>
</tr>
<%
    rs.movenext
  next
  rs.close
 
else
%>
<tr align=center>
<td width='9%' class=td0>排序</td>
<td width='20%' class=td0>公司名称</td>
<td width='15%' class=td0>法人代表</td>
<td width='15%' class=td0>注册资金</td>
<td width='15%' class=td0>成立时间</td>
<td width='9%' class=td0>邮件</td>
<td width='9%' class=td0>短信</td>
<td width='8%' class=td0>操作</td>
</tr>
<%
  sql="select top "&nummer*viewpage&" company.username,company.cname,company.fdate,company.trade,company.cxz,company.faren,company.fund,company.tim,company.email,job_fav.id from company inner join job_fav on company.username=job_fav.username2 where job_fav.username1='"&login_username&"' order by job_fav.id desc"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if int(viewpage)>1 then rs.move (viewpage-1)*nummer
  if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
  for i=1 to nums
    username=rs("username")
%>
<tr class=bg_td align=center>
<td><%response.write (viewpage-1)*nummer+i%></td>
<td><a href='job_company.asp?uid=<%response.write username%>' alt='所属行业：<%response.write rs("trade")%><br>企业性质：<%response.write rs("cxz")%><br>点击查看 <%response.write rs("cname")%> 企业详细简历'><%response.write rs("cname")%></td>
<td><%response.write rs("faren")%></td>
<td><%response.write rs("fund")%> 万</td>
<td><%response.write rs("fdate")%></td>
<td><a href='mailto:<%response.write rs("email")%>'><script language=javascript>document.write("<img src='"+web_dir_skin+"small/email.gif' border=0 align=absmiddle title='给 <%response.write rs("cname")%> 发送邮件' border=0>");</script></a></td>
<td><a href='user_mail.asp?action=msg_write&accept=<%response.write server.urlencode(username)%>' target=_blank><script language=javascript>document.write("<img src='"+web_dir_skin+"mail/msg.gif' alt='给 <%response.write username%> 发送短信' border=0>");</script></a></td>
<td><input type=checkbox name=sel_id value='<%response.write rs("id")%>' class=bg_td></td>
</tr>
<%
    rs.movenext
  next
  rs.close
end if
%>
<tr class=bg_tds height=30>
<td colspan=4>共有<font class=red><%response.write rssum%></font>位<%response.write viewper%>&nbsp;页次：<font class=red><%response.write viewpage&"</font>/<font class=red>"&thepages%></font>&nbsp;分页：<% response.write jk_pagecute(nummer,thepages,viewpage,pageurl,3,"#ff0000") %></td>
<td colspan=4 align=center>
  <table border=0 cellspacing=2 cellpadding=2>
  <tr>
  <td><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);" class=bg_tds>所有</td>
  <td><input type=submit value='删除所选' onclick="javascript:return sel_click(this.form);"></td>
  <td><input type=button onclick="javascript:friend_clear();" value="清空所有"></td>
  </tr>
  </table>
</td>
</tr>
</form>
</table>
<script language=javascript>
<!--
function friend_clear()
{
  if (confirm('确定清空所有的<%response.write viewper%>吗?\n\n清空后将无法恢复！'))
  { location.href='?action=clear'; }
}
-->
</script>
<%
end sub
%>