<!-- #include file="config.asp" -->
<!-- #include file="functions.asp" -->
<!-- #include file="jk_page_cute.asp" -->
<!-- #include file="jk_pagecute.asp" -->
<!-- #include file="jk_upload.asp" -->
<!-- #include file="jk_keyes.asp" -->
<!-- #include file="jk_enurl.asp" -->
<!-- #include file="jk_frm.asp" -->
<!-- #include file="jk_put.asp" -->
<!-- #include file="jk_fso.asp" -->
<!-- #include file="jk_msort.asp" -->
<!-- #include file="admin_fir.asp" -->
<%
if session(session_for&"admin")<>"joekoe_admin" then
  call format_redirect("admins_login.asp")
  response.end
end if
login_username=session(session_for&"admines")

dim tnum,nummer
tnum=10		
nummer=15	

dim admins,s_d,s_tim,del_user_true,del_upload_true,is_clear,istop_var,jk_mod,is_nsort,is_review,id,popedom_num,max_pop,cid,sid,ntit
dim sql_add,pageurl,nums,rssum,page,viewpage,thepages,nsort,data_name
admins=false
del_user_true=false
del_upload_true=false
is_clear=true
istop_var="istop"
s_d="'"
s_tim="now()"
jk_mod=trim(request.querystring("jk_mod"))
jk_mod=replace(jk_mod,"'","")
jk_mod=replace(jk_mod,"""","")
id=trim(request.querystring("id"))
if not isnumeric(id) then id=0
nums=nummer
sql_add=""
pageurl="?jk_mod="&jk_mod&"&"
nsort=""
data_name=""
popedom_num=0
max_pop=50

sub admin_master(tnsort,t2)
  dim m_err
  m_err=true
  sql="select top 1 m_is_nsort,m_is_review,m_popedom,m_nsort,m_index_url,m_data_name,m_tit,m_tit_fir from admin_menu where m_is_master=1 and m_index_url='"&index_url&"'"
  set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then
    is_nsort=rs("m_is_nsort")
    is_review=rs("m_is_review")
    nsort=rs("m_nsort")
    data_name=rs("m_data_name")
    tit=rs("m_tit")
    tit_fir=rs("m_tit_fir")
    popedom_num=rs("m_popedom")
    m_err=false
  end if
  rs.close
  if (tnsort=1 and is_nsort=false) or data_name="" or tit="" or tit_fir="" or not(isnumeric(popedom_num)) then m_err=true
  if m_err=true then
    call admin_msg("本栏目（"&index_url&"）的栏目管理参数还未初始化！\n\n请点击进入管理菜单设置该栏目管理参数。","admins_menu.asp",1)
    call web_clear(1)
  end if
end sub

function object_install(strclassstring)
  on error resume next
  object_install=true
  dim xtestobj
  err=0
  set xtestobj=server.createobject(strclassstring)
  if -2147221005=Err then
    err.clear
    object_install=false
  end if
  set xtestobj=nothing
end function

sub joekoe_is_nsort_review()
  if is_nsort=true then
%>
  <td width=10></td>
  <td><a href='admin_nsort.asp?nsort=<%response.write nsort%>'><%response.write tit_fir%>分类管理</a></td>
<%
  end if
  if is_review=true then
%>
  <td width=10></td>
  <td><a href='admin_review.asp?nsort=<%response.write nsort%>'><%response.write tit_fir%>评论管理</a></td>
<%
  end if
  if is_clear then
%>
  <td width=10></td>
  <td><a href='?action=clear' onclick="javascript:return click_return('清空所有<%response.write tit_fir%>',0);">清空所有<%response.write tit_fir%></a></td>
<%
  end if
end sub

sub joekoe_is_js(var1,var2)
%>
  <td width=10></td>
  <td><a href='?action=js<%response.write var1%>' alt='当您进行了本类的修改操作后请点击更新一下前台的数据' onclick="javascript:return click_return('更新本类前台数据',0);">更新<%response.write var2%>数据</a></td>
<%
end sub

sub joekoe_go_handle()
  dim sel_type,seltype,sel_id,hdim,hnum,hid,hi,htype,hintegral
  htype=1
  sel_type=trim(request.form("sel_type"))
  select case sel_type
  case "推荐","取消推荐"
    seltype=istop_var
    if sel_type="取消推荐" then htype=0
  case "审核","待审核","显示","隐藏"
    seltype="hidden"
    if sel_type="待审核" or sel_type="隐藏" then htype=0
  case "删除"
    seltype="delete"
  case else
    sel_type=""
    seltype=""
  end select
  if joekoe_cms.post_chk()=false or seltype="" then exit sub
  hintegral=mp_integral()
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  select case seltype
  case istop_var,"hidden"
    for hi=0 to hnum
      hid=hdim(hi)
      if isnumeric(hid) then
        sql="update "&data_name&" set "&seltype&"="&htype&" where id="&hid
        call joekoe_cms.exec(sql,0)
      end if
    next
  case "delete"
    for hi=0 to hnum
      hid=hdim(hi)
      if isnumeric(hid) then
        if del_user_true then
          sql="update user_data set integral=integral-"&hintegral&" where username=(select top 1 username from "&data_name&" where id="&hid&") and username<>'"&login_username&"'"
          call joekoe_cms.exec(sql,0)
        end if
        if del_upload_true then call upload_del(index_url,hid)
        call joekoe_cms.exec("delete from "&data_name&" where id="&hid,0)
if data_name="video" then call joekoe_cms.exec("delete from video_url where nameid="&hid,0)
      end if
    next
  end select
  erase hdim
  action=""
  call admin_event(sel_type&" "&(hnum+1)&"条（"&tit_fir&"）记录",0,0)
  response.write vbcrlf&"<script language=javascript>alert(""已成功（"&sel_type&"）操作了"&(hnum+1)&"条记录！"");</script>"
end sub

sub joekoe_go_clear()
  dim tdim,tnum,ti
  sql="select count(id) from "&data_name
  set rs=joekoe_cms.exec(sql,1)
  if rs(0)=0 then
    rs.close
    call admin_msg("暂时没有（"&tit_fir&"）数据！","?",1)
    exit sub
  end if
  rs.close
  sql="select id from "&data_name&" order by id"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  tdim=rs.getrows()
  rs.close
  tnum=ubound(tdim,2)
  for ti=0 to tnum
    call upload_del(index_url,tdim(0,ti))
  next
  erase tdim
  call joekoe_cms.exec("delete from "&data_name,0)
if data_name="video" then call joekoe_cms.exec("delete from video_url",0)
  call admin_event("清空所有 "&tit_fir&" 数据！",0,0)
  call admin_msg("已成功清空所有 "&tit_fir&" 数据！","?",1)
end sub

sub admin_header(t1,t2)
  if session(session_for&"admines")<>web_dim(3) then
    if popedom_formated(session(session_for&"popedom"),popedom_num,0)=0 or admins=true then
      call format_redirect("admin.asp?action=main&error=popedom")
    end if
  end if
  call admin_title(1)
  call admin_td(tit)
end sub

function var_dim_num(vnum)
  dim tmp_dim
  tmp_dim=split(web_dim(12),"|")
  var_dim_num=tmp_dim(vnum-1)
  erase tmp_dim
end function

function popedom_formated(popedom1,popedomnum,popedomtype)
  dim poptemp
  poptemp=0
  if len(popedom1)=50 and int(popedomnum)>0 then poptemp=mid(popedom1,popedomnum,1)
  if popedomtype<>0 then
    if poptemp=0 then
      poptemp=1
    else
      poptemp=0
    end if
  end if
  if poptemp<>0 then poptemp=1
  if popedomnum=-1 then poptemp=1
  popedom_formated=poptemp
end function

sub admin_title(tt)
  response.write vbcrlf&"<html>" & _
		 vbcrlf&"<head>" & _
		 vbcrlf&"<title>"&web_dim(1)&" - 管理后台</title>" & _
		 vbcrlf&"<meta http-equiv=Content-Type content=text/html; charset=gb2312>" & _
		 vbcrlf&"<link type=text/css href='../../images/admin/admin_joekoe.css' rel=stylesheet>"
  if tt=1 then
    response.write vbcrlf&"<script language=javascript src='images/admin/admin.js'></script>" & _
		   vbcrlf&"<script language=javascript src='style/joekoe_select.js'></script>" & _
		   vbcrlf&"</head>" & _
		   vbcrlf&"<body topmargin=0 leftmargin=0>" & _
		   vbcrlf&"<center>"
    call admin_table(0,1)
  end if
end sub

function mp_integral()
  mp_integral=dim_num(24)
end function

function img_admin(apic,atit)
  dim tmp1
  tmp1=apic
  if var_null(tmp1)="" then tmp1="s_"
  img_admin="<img border=0 src='../../images/admin/"&tmp1&".gif' alt='"&atit&"' align=absmiddle>"
end function

function pro_edit(pt,ptit)
  pro_edit="<a href='"&pt&"'>"&img_admin("edit",ptit)&"</a>"
end function

function pro_istop(pt)
  if pt=1 or pt=true then pro_istop=img_admin("istop","推荐")
end function

function pro_ispic(pt)
  if pt=true then pro_ispic=img_admin("ispic","图片")
end function

function pro_cod(pt)
  if int(pt)=2 then
    pro_cod=img_admin("cod2","HTML 编码")
  else
    pro_cod=img_admin("cod1","UBB 编码")
  end if
end function

function pro_hidden(pt,ptt)
  if pt=true or pt=1 then
    pro_hidden="<font class=gray alt='当前状态为：显示'>显示</font>"
  else
    pro_hidden="<font class=red2 alt='当前状态为：待审核/隐藏'>审核</font>"
  end if
end function
sub textarea_resize(textareaname)
%>
<p>
<a href="javascript:textarea_resize('<%response.write textareaname%>','-');">
<img src='../../../../../images/admin/resize_minus.gif' border=0></a>
<br>
<a href='javascript:;' onclick="javascript:textarea_resize('<%response.write textareaname%>','+');">
<img src='../../../../../images/admin/resize_plus.gif' border=0></a>
</p>
<%
end sub
%>