<!-- #include file="include/admin_onlogin.asp" -->
<%
del_user_true=true
del_upload_true=true
is_clear=false
istop_var="isgood"
index_url="flea"
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
%>
<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>
<tr>
<td></td>
<td></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,country,lang,remark,counter,isgood,hidden,nname,email,types,price,tim,phone,now_time
 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"))
    nname=code_admin("nname",1,100)
    email=code_admin("email",1,100)
    remark=code_admin("remark",1,250)
        if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or nname="" or email="" or remark="" then 
call admin_error(tit_fir&"你的姓名、交易名称、地址和联系方法 不能为空！")
     exit sub
    end if
    username=code_admin("username",1,20)
    types=code_admin("types",1,100)  
    price=code_admin("price",1,100)
	tim=code_admin("tim",1,100)
    url=code_admin("url",1,100)
    phone=code_admin("phone",1,100)
    pic=code_admin("pic",1,100)
    isgood=false
    hidden=true
      call chk_cid_sid()
      rs("c_id")=cid
      rs("s_id")=sid
      rs("username")=login_username
      rs("types")=types
      rs("hidden")=hidden
      rs("name")=name
      rs("nname")=nname
      rs("remark")=remark
      rs("email")=email
      rs("price")=price
	  rs("tim")=tim
      rs("url")=url
      rs("phone")=phone
      rs("isgood")=isgood
      if len(pic)<3 then
        rs("pic")="no_pic.gif"
      else
        rs("pic")=pic
      end if
      rs("counter")=0
    rs.update
    rs.close
    call upload_note(index_url,id)
    call admin_msg("成功编辑一个"&tit_fir&"信息！",pageurl&"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=60 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;
  供需类型：<select name=types size=1>
  <%
  types=rs("types")
 response.write select_type("供方",country)
 response.write select_type("求方",country)
  %>
</select><%response.write redx%></td></tr>
  <tr class=bg_td><td>交易价格：</td><td><input type=text size=20 name=price value='<%response.write rs("price")%>' maxlength=20>&nbsp;&nbsp;发布时间：<input type=text size=12 name=tim value='<%response.write rs("tim")%>' maxlength=12>&nbsp;&nbsp;联 系 人：<input type=text size=10 name=nname  value='<%response.write rs("nname")%>' maxlength=50><%=redx%></td></tr>
  <tr class=bg_td><td>联系地址：</td><td><input type=text size=70 name=url value='<%response.write rs("url")%>' 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></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>&nbsp;&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic' target=upload_frame>上传图片</a>&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word' target=upload_frame>上传至内容</a></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>
  <tr class=bg_td><td valign=top class=htd><br>交易说明：<br><=250B</td><td><textarea name=remark rows=5 cols=70><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td></tr>
<%
  call submit_edit()
end sub

sub joekoe_chk_add()
  dim name,url,pic,ispic,username,country,lang,remark,counter,isgood,hidden,nname,email,types,price,tim,phone,now_time
  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)
    email=code_admin("email",1,100)
    remark=code_admin("remark",1,250)
        if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or nname="" or email="" or remark="" then 
call admin_error(tit_fir&"你的姓名、交易名称、地址和联系方法 不能为空！")
     exit sub
    end if
    isgood=false
    hidden=true
    username=code_admin("username",1,20)
    types=code_admin("types",1,100)  
    price=code_admin("price",1,100)
	tim=code_admin("tim",1,100)
    url=code_admin("url",1,100)
    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("nname")=nname
      rs("remark")=remark
      rs("email")=email
      rs("price")=price
	  rs("tim")=tim
      rs("url")=url
      rs("phone")=phone
      rs("isgood")=isgood
      if len(pic)<3 then
        rs("pic")="no_pic.gif"
      else
        rs("pic")=pic
      end if
      rs("counter")=0
    rs.update
    rs.close
    call upload_note(index_url,first_id(data_name,"id"))
    call admin_msg("成功添加一个新的"&tit_fir&"信息！",pageurl&"c_id="&cid&"&s_id="&sid,0)
    exit sub
  end if
  call form_first()
  ispic=joekoe_cms.rand_file(nsort)
%>
<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=60 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;
  供需类型：<select name=types size=1>
<option value='供方' selected>供方</option>
<option value='求方'>求方</option>
</select><%response.write redx%></td></tr>
  <tr class=bg_td><td>交易价格：</td><td><input type=text size=20 name=price value='面谈' maxlength=20>&nbsp;&nbsp;发布时间：<input type=text size=12 name=tim value='2005-11-21' maxlength=12>&nbsp;&nbsp;联 系 人：<input type=text size=10 name=nname maxlength=50 value="88852门户网"><%=redx%></td></tr>
  <tr class=bg_td><td>联系地址：</td><td><input type=text size=70 name=url value='' maxlength=100></td></tr>
  <tr class=bg_td><td>联系电话：</td><td><input type=text size=20 name=phone value='未知' maxlength=50>&nbsp;&nbsp;电子邮件：<input type=text size=20 name=email maxlength=50 value="@"></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>&nbsp;&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write ispic%>&uptext=pic' target=upload_frame>上传图片</a>&nbsp;&nbsp;<a href='upload.asp?uppath=<%response.write index_url%>&upname=<%response.write left(index_url,1)%>&uptext=word' target=upload_frame>上传至内容</a></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>
  <tr class=bg_td><td valign=top class=htd><br>交易说明：<br><=250B</td><td><textarea name=remark rows=5 cols=70></textarea></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>
  <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>
  <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,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></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

function select_type(st1,st2)
  select_type=vbcrlf&"<option"
  if st1=st2 then select_type=select_type&" selected"
  select_type=select_type&">"&st1&"</option>"
end function
%>