<!-- #include file="include/admin_onlogin.asp" -->
<!-- #include file="include/jk_email.asp" -->
<%
del_user_true=true
del_upload_true=true
is_clear=false
istop_var="isgood"
index_url="pris"
call admin_master(1,0)
call admin_cid_sid()
call admin_header(0,0)
select case jk_mod
case "isgood"
  ntit="推荐"&tit_fir
  sql_add=" where hidden=1 and isgood=1"
case "sh"
  ntit="待审核"&tit_fir
  sql_add=" where hidden=0"
case else
  jk_mod=""
  ntit=tit_fir&"列表"
  sql_add=" where hidden=1"
end select
%>
<script language="JavaScript">
function sel_type(trsurl,turl)
{
	var sn,i,wdim,temp1,nurl;
	wdim=turl.split("|");
	sn=wdim.length;
	for (i=0;i<sn;i++)
	{
	nurl=wdim[i];
		temp1="<OPTION value='"+nurl+"'";
		if (trsurl==nurl) { temp1+=" selected"; }
		temp1+=">"+nurl+"</option>";
	document.write(temp1);
	}
}
</script>

<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'><%response.write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=isgood'<%if jk_mod="isgood" then response.write " class=red"%>>推荐<%response.write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?jk_mod=sh'<%if jk_mod="sh" then response.write " class=red"%>>待审核<%response.write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?action=add&c_id=<%response.write cid%>&s_id=<%response.write sid%>'<%if action="add" then response.write " class=red"%>>添加<%response.write tit_fir%></a></td>
<%call joekoe_is_nsort_review()%>
  </tr>
  </table>
</td></tr>
</table>
<%
call admin_table(1,1)

if action="handle" then call joekoe_go_handle()

select case action
case "edit"
  call joekoe_chk_edit()
case "add"
  call joekoe_chk_add()
case else
  call joekoe_chk_main()
end select

call admin_ender(1)

sub joekoe_chk_edit()
  dim name,url,pic,ispic,username,dname,sname,country,lang,remark,counter,isgood,hidden,tim,nname,email,types,price,phone,now_time,address
  call admin_td("编辑"&tit_fir)
  sql="select top 1 * from "&data_name&" where id="&id
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
    call admin_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  end if
  if chk() then
    name=code_admin("name",1,50)
    csid=trim(request.form("c_id"))
	dname=code_admin("dname",1,100)
    sname=code_admin("sname",1,100)
    nname=code_admin("nname",1,100)
    email=code_admin("email",1,100)
    remark=code_admin("remark",1,250)
	address=code_admin("address",1,100)
    if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or nname="" or remark="" or email_ok(email,50)=false then 
      call admin_error(tit_fir&"名称、联系人、电子邮件、"&tit_fir&"说明 为空或电子邮件不符合规则！")
      exit sub
    end if
    username=code_admin("username",1,20)
    types=code_admin("types",1,100)  
    price=code_admin("price",1,100)
    url=code_admin("url",1,100)
    if url="http://" or isnull(url) then url=""
    phone=code_admin("phone",1,100)
    pic=code_admin("pic",1,100)
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    isgood=false
    if trim(request.form("isgood"))="yes" then isgood=true
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    call chk_cid_sid()
      rs("c_id")=cid
      rs("s_id")=sid
      rs("username")=username
      rs("types")=types
	  rs("dname")=dname
      rs("hidden")=hidden
      rs("name")=name
      rs("nname")=nname
      rs("sname")=sname
      rs("remark")=remark
      rs("email")=email
      rs("price")=price
      rs("url")=url
      rs("phone")=phone
      rs("isgood")=isgood
      if len(pic)<3 then
        rs("pic")=""
      else
        rs("pic")=pic
      end if
      'rs("tim")=joekoe_cms.now_time
      rs("counter")=counter
	  rs("address")=address
      rs.update
      rs.close
      call upload_note(index_url,id)
      call admin_msg("已成功编辑了一个"&tit_fir&"！","?jk_mod="&jk_mod&"&c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  cid=rs("c_id")
  sid=rs("s_id")
%>
  <form action='<%response.write pageurl%>action=edit&id=<%response.write id%>' method=post>
  <input type=hidden name=chk value='yes'>
  <input type=hidden name=upid value=''>
  <tr>
  <td><%response.write tit_fir%>名称：</td>
  <td><input type=text size=58 name=name value='<%response.write rs("name")%>' maxlength=50><%response.write redx%></td>
  </tr>
  <tr class=bg_td>
  <td><%response.write tit_fir%>类型：</td>
  <td><%call chk_csid(nsort,cid,sid)%>&nbsp;&nbsp;&nbsp;&nbsp;
  <%response.write tit_fir%>性质：<select size=1 name=types>
  <script language=javascript>
<!--
sel_type('<%=rs("types")%>','行政机关|社会团体|事业单位|国有企业|三资企业|集体企业|乡镇企业|私营企业');
-->
</script>

</SELECT>
  <%response.write redx%></td></tr>
  <tr class=bg_td><td>注册资金：</td><td><input type=text size=9 name=price value='<%response.write rs("price")%>' maxlength=20>万人民币&nbsp;&nbsp;&nbsp;&nbsp;员工人数：<input type=text size=11 name=yname  value='<%response.write rs("yname")%>' maxlength=50>个人<%=redx%>&nbsp;&nbsp;&nbsp;发 布 人：<input type=text size=11 name=username  value='<%response.write rs("username")%>' maxlength=50></td></tr>
  <tr class=bg_td><td>法人代表：</td><td><input type=text size=11 name=fname  value='<%response.write rs("fname")%>' maxlength=50><%=redx%>&nbsp;&nbsp;&nbsp;成立时间：<input type=text size=11 name=sname  value='<%response.write rs("sname")%>' maxlength=50><%=redx%>2004-10-01&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;推荐：<input type=checkbox name=isgood value='yes'<%if rs("isgood") then response.write " checked"%>>&nbsp;&nbsp;隐藏：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%>></td></tr>
  <tr class=bg_td><td>所在地区：</td><td><select name=dname  size=1>
  <script language=javascript>
<!--
sel_type('<%=rs("dname")%>','北京市|天津市|上海市|重庆市|山西省|安徽省|福建省|甘肃省|广东省|广西省|河南省|河北省|四川省|贵州省|湖北省|湖南省|吉林省|江苏省|江西省|辽宁省|青海省|山东省|陕西省|云南省|浙江省|海南省|台湾省|黑龙江省|宁夏自治区|西藏自治区|内蒙古自治区|香港特别行政区|澳门特别行政区');
-->
</script>
</SELECT>
  <%response.write redx%>&nbsp;&nbsp;联系人：<input type=text size=20 name=nname value='<%response.write rs("nname")%>' maxlength=50></td></tr>
  <tr class=bg_td><td>联系地址：</td><td><input type=text size=38 name=address value='<%response.write rs("address")%>' maxlength=100>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮政编码：<input type=text size=20 name=yzbm value='<%response.write rs("yzbm")%>' maxlength=100></td></tr>
  <tr class=bg_td><td>联系电话：</td><td><input type=text size=20 name=phone value='<%response.write rs("phone")%>' maxlength=50>&nbsp;&nbsp;电子邮件：<input type=text size=20 name=email value='<%response.write rs("email")%>' maxlength=50><%=redx%></td></tr>
  <tr class=bg_td><td>相关网址：</td><td><input type=text size=40 name=url value='<%response.write rs("url")%>' maxlength=100>&nbsp;&nbsp;浏览：<input type=text name=counter value='<%response.write rs("counter")%>' size=6 maxlength=10>&nbsp;人次</td></tr>
  <tr class=bg_td>
  <td valign=top class=htd><br><%response.write tit_fir%>说明：<br><=250B</td>
  <td>
  <table border=0><tr>
  <td><textarea name=remark rows=3 cols=65><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td>
  </tr></table>
  </td>
  </tr>
  <tr class=bg_td>
  <td><%response.write tit_fir%>图片：</td>
  <td><input type=text name=pic value='<%response.write rs("pic")%>' size=40 maxlength=100></td>
  </tr>
  <tr class=bg_td>
  <td>上传图片：</td>  <td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='../upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
  </tr>
<%
  call submit_edit()
end sub

sub joekoe_chk_add()
  dim name,url,pic,ispic,username,country,lang,remark,counter,isgood,hidden,tim,dname,fname,yzbm,sname,nname,yname,email,types,price,phone,now_time,address
  call admin_td("添加"&tit_fir)
  if chk() then
    name=code_admin("name",1,50)
    csid=trim(request.form("c_id"))
    nname=code_admin("nname",1,100)
	fname=code_admin("fname",1,100)
	yname=code_admin("yname",1,100)
	nname=code_admin("nname",1,100)
	dname=code_admin("dname",1,100)
	sname=code_admin("sname",1,100)
    email=code_admin("email",1,100)
	yzbm=code_admin("yzbm",1,100)
    remark=code_admin("remark",1,250)
	address=code_admin("address",1,100)
    if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or nname="" or remark="" or email_ok(email,50)=false then 
      call admin_error(tit_fir&"名称、联系人、电子邮件、"&tit_fir&"说明 为空或电子邮件不符合规则！")
      exit sub
    end if
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    isgood=false
    if trim(request.form("isgood"))="yes" then isgood=true
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    username=code_admin("username",1,20)
    types=code_admin("types",1,100)  
    price=code_admin("price",1,100)
    url=code_admin("url",1,100)
    if url="http://" or isnull(url) then url=""
    phone=code_admin("phone",1,100)
    pic=code_admin("pic",1,100)
    call chk_cid_sid()
      sql="select * from "&data_name
      rs.open sql,conn,1,3
      rs.addnew
     rs("c_id")=cid
      rs("s_id")=sid
      rs("username")=login_username
      rs("types")=types
      rs("hidden")=hidden
      rs("name")=name
	  rs("dname")=dname
	  rs("fname")=fname
      rs("nname")=nname
	  rs("yname")=yname
      rs("remark")=remark
	  rs("yzbm")=yzbm
      rs("email")=email
	  rs("sname")=sname
      rs("price")=price
      rs("url")=url
      rs("phone")=phone
      rs("isgood")=isgood
      if len(pic)<3 then
        rs("pic")=""
      else
        rs("pic")=pic
      end if
      rs("tim")=joekoe_cms.now_time
      rs("counter")=counter
	  rs("address")=address
      rs.update
      rs.close
      call upload_note(index_url,first_id(data_name,"id"))
      call admin_msg("已成功添加了一个"&tit_fir&"！","?jk_mod="&jk_mod&"&c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  ispic=joekoe_cms.rand_file(index_url)
%>
  <form action='<%response.write pageurl%>action=add' method=post>
  <input type=hidden name=chk value='yes'>
  <input type=hidden name=upid value=''>
  <tr class=bg_td>
  <td width='15%'><%response.write tit_fir%>名称：</td>
  <td width='85%'><input type=text size=58 name=name value='' maxlength=50><%response.write redx%></td>
  </tr>
  <tr class=bg_td>
  <td><%response.write tit_fir%>类型：</td>
  <td><%call chk_csid(nsort,cid,sid)%>&nbsp;&nbsp;&nbsp;&nbsp;
  <%response.write tit_fir%>性质：<select name=types size=1>
  <option value='社会团体' selected>社会团体</option>
  <option value='事业单位'>事业单位</option>
  <option value='国有企业'>国有企业</option>
  <option value='三资企业'>三资企业</option>
  <option value='集体企业'>集体企业</option>
  <option value='乡镇企业'>乡镇企业</option>
  <option value='私营企业'>私营企业</option>
  </select><%response.write redx%></td>
  </tr>
    <tr class=bg_td><td>注册资金：</td><td><input type=text size=13 name=price value='' maxlength=20>万人民币<%=redx%>&nbsp;&nbsp;&nbsp;员工人数：<input type=text size=13 name=yname maxlength=50>个人<%=redx%>&nbsp;&nbsp;浏览：<input type=text name=counter value='' size=6 maxlength=10>&nbsp;人次</td></tr>
  <tr class=bg_td><td>法人代表：</td><td><input type=text size=13 name=fname value='' maxlength=20><%=redx%>&nbsp;&nbsp;&nbsp;成立时间：<input type=text size=20 name=sname maxlength=50><%=redx%>2004-10-01</td></tr>
  <tr class=bg_td><td>所在地区：</td><td><select name=dname  size=1>
  <option value='北京市' selected>北京市</option>
  <option value='天津市'>天津市</option>
  <option value='上海市'>上海市</option>
  <option value='重庆市'>重庆市</option>
  <option value='山西省'>山西省</option>
  <option value='安徽省'>安徽省</option>
  <option value='福建省'>福建省</option>
  <option value='甘肃省'>甘肃省</option>
  <option value='广东省'>广东省</option>
  <option value='广西省'>广西省</option>
  <option value='河南省'>河南省</option>
  <option value='河北省'>河北省</option>
  <option value='四川省'>四川省</option>
  <option value='贵州省'>贵州省</option>
  <option value='湖北省'>湖北省</option>
  <option value='湖南省'>湖南省</option>
  <option value='吉林省'>吉林省</option>
  <option value='江苏省'>江苏省</option>
  <option value='江西省'>江西省</option>
  <option value='辽宁省'>辽宁省</option>
  <option value='青海省'>青海省</option>
  <option value='山东省'>山东省</option>
  <option value='陕西省'>陕西省</option>
  <option value='云南省'>云南省</option>
  <option value='浙江省'>浙江省</option>
  <option value='海南省'>海南省</option>
  <option value='台湾省'>台湾省</option>
  <option value='黑龙江省'>黑龙江省</option>
  <option value='宁夏自治区'>宁夏自治区</option>
  <option value='新疆自治区'>新疆自治区</option>
  <option value='西藏自治区'>西藏自治区</option>
  <option value='内蒙古自治区'>内蒙古自治区</option>
  <option value='香港特别行政区'>香港特别行政区</option>
  <option value='澳门特别行政区'>澳门特别行政区</option>
  </select><%response.write redx%>&nbsp;&nbsp;联系人：<input type=text size=20 name=nname maxlength=50><%=redx%>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;推荐：<input type=checkbox name=isgood value='yes'>&nbsp;&nbsp;隐藏：<input type=checkbox name=hidden value='yes'></td></tr>
  <tr class=bg_td><td>联系地址：</td><td><input type=text size=38 name=address value='' maxlength=100>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮政编码：<input type=text size=20 name=yzbm value='' maxlength=100></td></tr>
  <tr class=bg_td><td>联系电话：</td><td><input type=text size=20 name=phone value='' maxlength=50>&nbsp;&nbsp;&nbsp;电子邮件：<input type=text size=20 name=email maxlength=50><%=redx%></td></tr>
  <tr class=bg_td><td>相关网址：</td><td><input type=text size=52 name=url value='http://' maxlength=100></td></tr>
  <tr class=bg_td><td valign=top class=htd><br><%response.write tit_fir%>说明：<br><=250B</td><td><table border=0><tr><td><textarea name=remark rows=3 cols=60></textarea></td><td width=5></td></tr></table></td></tr>
  <tr class=bg_td>
  <td><%response.write tit_fir%>图片：</td>
  <td><input type=text name=pic value='<%response.write pic%>' size=40 maxlength=100></td></tr>
  <tr class=bg_td>
  <td>上传图片：</td>
  <td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='../upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic'></iframe></td>
  </tr>
<%
  call submit_add()
end sub

sub joekoe_chk_main()
  dim topic,pageurl2
  pageurl2=pageurl
  call sql_cid_sid(sql_add)
  call format_search("name","name",2,1)
%>
<tr valign=top align=center>
<td width='20%'>
  <table class=table2>
  <tr><td><%response.write img_admin("s_left_sort","")%> <a href='?jk_mod=<%response.write jk_mod%>'><%response.write ntit%></a></td></tr>
  <tr><td height=5></td></tr>
  <tr><td class=htd><%call left_sort(pageurl2,"")%></td></tr>
  </table>
</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
<form name=sel_form action='?jk_mod=<%response.write jk_mod%>&action=handle' method=post>
<tr align=center>
<td class=td width='7%'>序号</td>
<td class=td width='70%'><%response.write tit_fir%>标题及整理时间<%if sql_tmp<>"" then response.write "（搜索结果："&keyword&"）"%></td>
<td class=td width='18%'>相关属性</td>
<td class=td width='5%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
</tr>
<%
  sql="select count(id) from "&data_name&sql_add
  set rs=joekoe_cms.exec(sql,1)
  rssum=rs(0)
  rs.close
  call format_pagecute()
  sql="select top "&nummer*viewpage&" id,c_id,s_id,name,url,tim,isgood,hidden from "&data_name&sql_add&" order by id desc"
  call joekoe_cms.exec(sql,-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
    id=rs("id")
    topic=rs("name")
%>
<tr align=center>
<td class=tims><a href='<%response.write index_url%>_view.asp?id=<%response.write id%>' target=_blank><%response.write (viewpage-1)*nummer+i%></a></td>
<td>
  <table border=0 cellspacing=0 cellpadding=0 width='100%'>
  <tr>
  <td><a href='?jk_mod=<%response.write jk_mod%>&action=edit&id=<%response.write id%>'><%response.write joekoe_cms.code_html(topic,1,(18+tnum))%></a></td>
  <td align=right><font class=tims><%response.write joekoe_cms.time_type(rs("tim"),4)%></font></td>
  </tr>
  </table>
</td>
<td align=left><%response.write pro_edit("?jk_mod="&jk_mod&"&action=edit&id="&id,"编辑该"&tit_fir) &"&nbsp;"& pro_hidden(rs("hidden"),1) &"&nbsp;"& pro_istop(rs("isgood"))%></td>
<td><input type=checkbox name=sel_id value='<%response.write id%>'></td>
</tr>
<%
    rs.movenext
  next
  rs.close
%>
<tr class=tr1>
<td colspan=2>
现有<font class=red><%response.write rssum%></font>个<%response.write tit_fir%>，
页次：<font class=red><%response.write viewpage%></font>/<font class=red><%response.write thepages%></font>
分页：<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td>
<td colspan=2 align=center>
<select name=sel_type size=1>
<option value='推荐'>推荐</option>
<option value='取消推荐'>取消推荐</option>
<option value='审核'>审核</option>
<option value='待审核'>待审核</option>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);">
</td>
</tr>
</form>
  </table>
</td>
</tr>
<%
end sub
%>