<!-- #include file="include/admin_onlogin.asp" -->
<%
'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , http://www.topv.com
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************
del_user_true=true
del_upload_true=true
is_clear=false
index_url="photo"
call admin_master(1,0)
call admin_cid_sid()
call admin_header(0,0)
select case jk_mod
case "istop"
  ntit="推荐"&tit_fir
  sql_add=" where istop=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
'pageurl=pageurl&"&"
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?jk_mod='><%response.write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=istop'<%if jk_mod="istop" 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='?jk_mod=<%response.write jk_mod%>&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 colspan=2 align=center>
  <table border=0 cellspacing=0 cellpadding=2>
  <form action='?' method=get>
  <input type=hidden name=jk_mod value='<%response.write jk_mod%>'>
  <input type=hidden name=c_id value='<%response.write cid%>'>
  <input type=hidden name=s_id value='<%response.write sid%>'>
  <tr>
  <td>搜索（<%response.write ntit%>） 关键字：</td>
  <td><input type=text name=keyword value='<%response.write trim(request.querystring("keyword"))%>' size=15 maxlength=20></td>
  <td><select name=sea_type size=1>
<option value='topic'>按标题</option>
<option value='username'>按发布人</option>
</select></td>
  <td><select name=sea_term sizs=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>
  <td><input type=submit value='搜索'></td>
  </tr>
  </form>
  </table>
</td></tr>
</table>
<%
call admin_table(1,1)

if action="handle" then call joekoe_go_handle()

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

call admin_ender(1)

sub joekoe_chk_edit()
  dim name,ispic,spic,pic,remark,username,power,emoney,counter,tim,istop,hidden
  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)
    pic=code_admin("pic",1,100)
    remark=code_admin("remark",1,250)
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      rs.close
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or pic="" or remark="" then
      rs.close
      call admin_error(tit_fir&"名称、地址和说明 不能为空！")
      exit sub
    end if
    spic=code_admin("spic",1,100)
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    istop=0
    if trim(request.form("istop"))="yes" then istop=1
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    call chk_cid_sid()
    rs("c_id")=cid
    rs("s_id")=sid
    rs("name")=name
    rs("spic")=spic
    rs("spic")=spic
    rs("pic")=pic
    rs("remark")=remark
    rs("username")=username
    rs("power")=power
    rs("emoney")=emoney
    rs("counter")=counter
    rs("istop")=istop
    rs("hidden")=hidden
    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 name=add_frm 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=40 name=name value='<%response.write rs("name")%>' maxlength=50><%response.write redx%></td></tr>
<tr><td><%response.write tit_fir%>分类：</td><td><%call chk_csid(nsort,cid,sid)%></td></tr>
<%
  pic=rs("spic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(nsort)
%>
<tr><td><%response.write tit_fir%>小图片：</td><td><input type=text name=spic value='<%response.write pic%>' size=50 maxlength=100>&nbsp;　<a href='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=spic' target=upload_frames>上传小图片</a></td></tr>
<%
  pic=rs("pic")
  ispic=apart_filename(pic,1,"/")
  if ispic="" then ispic=joekoe_cms.rand_file(nsort)
%>
<tr><td><%response.write tit_fir%>地址：</td><td><input type=text name=pic value='<%response.write pic%>' size=50 maxlength=100><%response.write redx%><a href='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=pic' target=upload_frames>上传<%response.write tit_fir%></a></td></tr>
<tr><td>上传文件：</td><td><iframe frameborder=0 name=upload_frames width='100%' height=30 scrolling=no src='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=pic'></iframe></td></tr>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("add_frm","remark","&nbsp;&nbsp;")%></td>
</tr>
<tr><td><%response.write tit_fir%>说明：<br><br><=250字符</td><td><textarea name=remark maxlength=250 rows=8 cols=60><%response.write joekoe_cms.code_word(rs("remark"))%></textarea></td></tr>
<tr><td><%response.write tit_fir%>发布人：</td><td><input type=text name=username value='<%response.write rs("username")%>' size=15 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(rs("emoney"))%>&nbsp;&nbsp;人气：<input type=text name=counter value='<%response.write rs("counter")%>' size=6 maxlength=10>&nbsp;&nbsp;推荐：<input type=checkbox name=istop value='yes'<%if int(rs("istop"))=1 then response.write " checked"%>>&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'<%if rs("hidden")=false then response.write " checked"%>></td></tr>
<%
  call chk_power("浏览",rs("power"),0)
  call submit_edit()
  rs.close
end sub

sub joekoe_chk_add()
  dim name,ispic,spic,pic,remark,username,power,emoney,counter,tim,istop,hidden
  call admin_td("添加"&tit_fir)
  if chk() then
    name=code_admin("name",1,50)
    pic=code_admin("pic",1,100)
    remark=code_admin("remark",1,250)
    csid=trim(request.form("c_id"))
    if cs_nd(csid)=false then
      call admin_error("请选择 "&tit_fir&"类型 ！")
      exit sub
    end if
    if name="" or pic="" or remark="" then
      call admin_error(tit_fir&"名称、地址和说明 不能为空！")
      exit sub
    end if
    spic=code_admin("spic",1,100)
    username=code_admin("username",1,20)
    if symbol_name(username)=false then username=login_username
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    tim=code_admin("tim",1,20)
    tim=joekoe_cms.time_type(tim,1)
    if tim="" then tim=joekoe_cms.now_time
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    istop=0
    if trim(request.form("istop"))="yes" then istop=1
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    call chk_cid_sid()
    sql="select * from "&data_name
    call joekoe_cms.exec(sql,-1)
    rs.open sql,conn,1,3
    rs.addnew
    rs("c_id")=cid
    rs("s_id")=sid
    rs("name")=name
    rs("spic")=spic
    rs("spic")=spic
    rs("pic")=pic
    rs("remark")=remark
    rs("username")=username
    rs("power")=power
    rs("emoney")=emoney
    rs("counter")=counter
    rs("istop")=istop
    rs("hidden")=hidden
    rs("tim")=tim
    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 name=add_frm action='<%response.write pageurl%>action=add' 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=40 name=name value='' maxlength=50><%response.write redx%></td></tr>
<tr><td><%response.write tit_fir%>分类：</td><td><%call chk_csid(nsort,cid,sid)%></td></tr>
<%ispic=joekoe_cms.rand_file(nsort)%>
<tr><td><%response.write tit_fir%>小图片：</td><td><input type=text name=spic value='' size=50 maxlength=100>&nbsp;　<a href='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=spic' target=upload_frames>上传小图片</a></td></tr>
<%ispic=joekoe_cms.rand_file(nsort)%>
<tr><td><%response.write tit_fir%>地址：</td><td><input type=text name=pic value='' size=50 maxlength=100><%response.write redx%><a href='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=pic' target=upload_frames>上传<%response.write tit_fir%></a></td></tr>
<tr><td>上传文件：</td><td><iframe frameborder=0 name=upload_frames width='100%' height=30 scrolling=no src='upload.asp?uppath=photo&upname=<%response.write ispic%>&uptext=pic'></iframe></td></tr>
<tr>
<td><%call frm_ubb_type("")%></td>
<td><%call frm_ubb("add_frm","remark","&nbsp;&nbsp;")%></td>
</tr>
<tr><td><%response.write tit_fir%>说明：<br><br><=250字符</td><td><textarea name=remark maxlength=250 rows=8 cols=60></textarea></td></tr>
<tr><td><%response.write tit_fir%>发布人：</td><td><input type=text name=username value='<%response.write login_username%>' size=15 maxlength=20>&nbsp;&nbsp;<%call chk_emoney(0)%>&nbsp;&nbsp;人气：<input type=text name=counter value='0' size=6 maxlength=10>&nbsp;&nbsp;推荐：<input type=checkbox name=istop value='yes'>&nbsp;&nbsp;隐藏/审核：<input type=checkbox name=hidden value='yes'></td></tr>
<%
  call chk_power("浏览","",1)
  call submit_add()
end sub

sub joekoe_chk_main()
  dim topic,pageurl2
  pageurl2=pageurl
  'if sql_add="" then
    'sql_add=" where types='"&types&"'"
  'else
    'sql_add=sql_add&" and types='"&types&"'"
  'end if
  call sql_cid_sid(sql_add)
  call format_search("name","name,username",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='<%response.write pageurl2%>action=handle' method=post>
<tr align=center>
<td class=td width='7%'>序号</td>
<td class=td width='66%'><%response.write tit_fir%>标题及整理时间<%if sql_tmp<>"" then response.write "（搜索结果："&keyword&"）"%></td>
<td class=td width='22%'>相关属性</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,pic,tim,hidden,istop from "&data_name&sql_add&" order by id desc"
  set rs=server.createobject("adodb.recordset")
  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='<%response.write pageurl2%>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(pageurl2&"action=edit&id="&id,"编辑该"&tit_fir) &"&nbsp;"& pro_hidden(rs("hidden"),1) &"&nbsp;"& pro_istop(rs("istop"))%></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

'****************************************************
' Joekoe CMS 1.2 Free      Power by Joekoe.com
' Email: cms@joekoe.com , service@joekoe.com
' Web: http://www.joekoe.com , http://www.topv.com
' Copyright (C) 2004 Joekoe.com All Rights Reserved.
'****************************************************
%>