<!-- #Include File="Include/AMH_Onlogin.asp" -->
<!-- #Include File="../Include/Inc_UpRemote.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

del_user_true=true
del_upload_true=true
dim ddim,dnum
Index_Url="Photo"
PageUrl = PageUrl&"ChannelIDs="&iChannelIDs&"&"
Call AMH_Master(1,2)
Call AMH_Header(1)
Select Case AsaiMHMod
Case "istop"
	ntit="推荐"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1 and isgood=1"
Case "sh"
	ntit="待审核"&tit_fir
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=0"
Case Else
	ntit=tit_fir&"列表"
	sql_add="ChannelIDs="&iChannelIDs&" and hidden=1"
End Select
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?ChannelIDs=<%=iChannelIDs%>'><%Response.Write tit_fir%>列表</a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=istop&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="istop" then Response.Write " class=red"%>>推荐<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?AsaiMHMod=sh&ChannelIDs=<%=iChannelIDs%>'<%if AsaiMHMod="sh" then Response.Write " class=red"%>>待审核<%Response.Write tit_fir%></a></td>
  <td width=10></td>
  <td><a href='?Action=Add&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>'<%if action="add" then Response.Write " class=red"%>>添加<%Response.Write tit_fir%></a></td>
<%call AsaiMHIs_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=ChannelIDs value='<%Response.Write iChannelIDs%>'>
  <input type=hidden name=AsaiMHMod value='<%Response.Write AsaiMHMod%>'>
  <input type=hidden name=ClassID value='<%Response.Write ClassID%>'>
  <tr>
  <td>搜索（<%Response.Write ntit%>） 关键字：</td>
  <td><input type=text name=keyword value='<%Response.Write Cls.Code_Query("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 size=1><option value='all'>满足所有条件</option><option value='only'>满足一个条件</option></seelct></td>
  <td><input type=submit value='搜索' class=btn></td>
  </tr>
  </form>
  </table>
</td></tr>
</table>
<%
Call AMH_Table(1)
If Action="handle" Then call AsaiMHGo_Handle()
Select Case LCase(Action)
Case "clear"
	AsaiMHGo_Clear()
Case "add"
	AsaiMHPhoto_Add()
Case "edit"
	AsaiMHPhoto_Edit()
Case Else
	AsaiMHPhoto_Main()
End Select
Call AMH_Ender(tit)

Sub AsaiMHPhoto_Edit()
  dim Name,Power,Emoney,keyes,username,tim,Remark,counter,urls,Isfocus,hidden,pic,oSpecialID,oIncludeInfo,Istop,isgood,tcolor,viewtype
  call AMH_td("编辑"&tit_fir)
  sql="select top 1 * from "&Data_Name&" where id="&id
  Call Cls.Exe_Conn(Rs,SQL,3)
  if rs.eof then
    rs.close
    call AMH_msg(tit_fir&"ID（"&id&"）不存在！","?",1)
    exit sub
  End If
  if chk() then
    pic=Cls.Code_Admin("pic",1,100)
    Urls=Cls.Code_Remark("Urls")
    Name=Cls.Code_Admin("Name",1,150)
    Remark=Cls.Code_Remark("Remark")
	if Cls.Code_Remark("remote")="yes" then Remark=DoRemoteUpload(Remark,Cls.ChannelUpMax,Cls.ChannelUpFileType(4),Cls.ChannelUploadDir,Cls.Get_ChannelSetup(Cls.ChannelSetup,15))
    csid=Cls.Code_Form("ClassID")
    if cs_nd(csid)=false then
      rs.close
      call AMH_error("请选择 "&tit_fir&"分类！<br />如有下级分类，请如实选择所属下级分类")
      exit sub
    End If
    if name="" or pic="" or urls="" or remark="" then
      call AMH_error(tit_fir&"标题、小图片、图片地址 和 "&tit_fir&"内容 不能为空！")
      exit sub
    end if
	viewtype=Cls.Code_Int("viewtype",0)
    keyes=Cls.code_admin("keyes",1,20)
    power=Cls.code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=Cls.code_admin("username",1,20)
    if ChkName(username)=false then username=login_username
    tim=Cls.Code_Admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    isgood=false
    if Cls.Code_Form("isgood")="yes" then isgood=true
	Istop=0
    if Cls.Code_Form("Istop")="yes" then istop=1
	Isfocus=false
    if Cls.Code_Form("Isfocus")="yes" then Isfocus=true
    oSpecialID=Cls.Code_Int("SpecialID",0)
    tcolor=Cls.Code_Form("tcolor")
    Call Chk_Cid()
    rs("ChannelIDs")=iChannelIDs
    rs("SpecialID")=oSpecialID
    rs("ClassID")=cid
    rs("name")=name
	rs("viewtype")=viewtype
    rs("url")=urls
    rs("power")=power
    rs("emoney")=emoney
    rs("username")=username
    rs("tim")=tim
    rs("counter")=counter
	rs("Isfocus")=Isfocus
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("remark")=remark
    rs("isgood")=isgood
    rs("Istop")=Istop
    rs("cod")=1
    rs("tcolor")=tcolor
    rs("isUpdate")=True
    rs.update
    rs.close
    call AMH_msg("已成功编辑了一个"&tit_fir&"！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&ChannelIDs="&iChannelIDs,0)
    exit sub
  End If
  call form_first()
  iChannelIDs=rs("ChannelIDs")
  oSpecialID=rs("SpecialID")
  cid=rs("ClassID")
  pic=rs("pic")
%>
<form name=add_frm action='?AsaiMHMod=<%Response.Write AsaiMHMod%>&ChannelIDs=<%=iChannelIDs%>&ClassID=<%Response.Write ClassID%>&action=edit&id=<%Response.Write id%>' method=post onSubmit="return checkPost(5);">
<input type=hidden name=chk value='yes'>
<tr>
<td><%Response.Write tit_fir%>标题：</td>
<td><input type=text name=name value='<%Response.Write rs("name")%>' size=60 maxlength=40><%Response.Write redx%>&nbsp;&nbsp;<%=ShowColor("tcolor",rs("tcolor"))%></td>
</tr>
<%dim preset:preset=split(Cls.ChannelPreset,"|||")
  Response.Write ShowClassSel(iChannelIDs,CID,Cls.ClassDepth)
  Response.Write ShowSpecialSel(iChannelIDs,rs("SpecialID"))
  Response.Write ShowKeyWord(rs("keyes"),preset(0))
%>
<input type=hidden name=PhotoSize value='' size=10 maxlength=10>
<%  Response.Write ShowsPicUpload(iChannelIDs,pic,"pic")%>
<tr>
<td>分页方式：</td>
<td><input type="radio" name=viewtype value="0" <%if rs("viewtype")=0 then response.Write " checked"%>>默认&nbsp;&nbsp;<input type="radio" name=viewtype value="1" <%if rs("viewtype")=1 then response.Write " checked"%>>多页显示&nbsp;&nbsp;<input type="radio" name=viewtype value="2" <%if rs("viewtype")=2 then response.Write " checked"%>>单页显示&nbsp;&nbsp;<input type="radio" name=viewtype  value="3" <%if rs("viewtype")=3 then response.Write " checked"%>>单页JS&nbsp;&nbsp;<%Response.Write redx%></td>
</tr>
<tr valign=top>
<td>图片地址：</td>
<td><input type=hidden name=Urls value=''>
	<select name=Url style="width:80%;height:100" size=2 onclick="doPreviews('Url','<%=Cls.Web_Dir%>','<%=Cls.Web_Dir&Cls.Web_Upload%>');" ondblclick="ModifyUrl('图片地址','Url');">
	<%
	dim StrDownloadUrl
	StrDownloadUrl=Trim(rs("Url"))
	if Instr(StrDownloadUrl,"@@@") >0 then
		StrDownloadUrl=Split(StrDownloadUrl,"@@@")
		for i=0 to Ubound(StrDownloadUrl)
	%>
		<option value="<%=StrDownloadUrl(i)%>"><%=StrDownloadUrl(i)%></option>
	<%
		Next
	else
	%>
		<option value="<%=StrDownloadUrl%>"><%=StrDownloadUrl%></option>
	<%end if%>
	</select><%Response.Write redx%><br />
	<input type=button name=addurl value='添加图片地址' onclick="AddUrl('图片地址','Url');" class=btn>
	<input type=button name=addurl value='修改当前地址' onclick="ModifyUrl('图片地址','Url');" class=btn>
	<input type=button name=addurl value='删除当前地址' onclick="DelUrl('图片地址','Url');" class=btn>
	<input type=button name=upurl value='↑' onclick="UpUrl('图片地址','Url');" class=btn>
	<input type=button name=Downurl value='↓' onclick="DownUrl('图片地址','Url');" class=btn>
	<input type=button name=SelectFile value='从已上传文件中选择' onclick="SelectFiles('<%=iChannelIDs%>','2','Url','');" class=btn>
</tr>
<tr>
<td>上传<%Response.Write tit_fir%>：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='<%=Cls.Web_Dir%>Include/Upload.asp?ID=<%=iChannelIDs%>&Type=4&Obj=Url&TObj=TempUploadFiles'></iframe></td>
</tr>
<%
  Response.Write ShowUploadList()
  Response.Write ShowMoreItem(0,0)
  Response.Write ShowEditor(iChannelIDs,5,"add_frm","remark","内容","TempUploadFiles",Cls.code_word(rs("remark")))
  Response.Write ShowPutInfo(rs("username"),rs("tim"))
  Response.Write ShowRelateInfo(rs("isgood"),rs("istop"),rs("Isfocus"),rs("hidden"),rs("counter"))
  Response.Write ShowLimit(rs("power"),0,rs("emoney"))
    Call Submit_edit()
    rs.close
End Sub

Sub AsaiMHPhoto_Add()
  dim Name,Power,Emoney,keyes,username,tim,Remark,counter,Urls,Isfocus,hidden,pic,oSpecialID,oIncludeInfo,Istop,isgood,tcolor,viewtype
  call AMH_td("添加"&tit_fir)
  if chk() then
    pic=Cls.code_admin("pic",1,100)
    Urls=Cls.Code_Remark("Urls")  'Cls.code_admin("url",1,200)
    Name=Cls.Code_Admin("Name",1,150)
    Remark=Cls.Code_Remark("Remark")
	if Cls.Code_Remark("remote")="yes" then Remark=DoRemoteUpload(Remark,Cls.ChannelUpMax,Cls.ChannelUpFileType(4),Cls.ChannelUploadDir,Cls.Get_ChannelSetup(Cls.ChannelSetup,15))
    csid=Cls.Code_Form("ClassID")
    if cs_nd(csid)=false then
      call AMH_error("请选择 "&tit_fir&"分类！<br />如有下级分类，请如实选择所属下级分类")
      exit sub
    End If
    if name="" then
      call AMH_error(tit_fir&"标题不能为空！")
      exit sub
    end if
    if pic="" then
      call AMH_error(tit_fir&"小图片地址不能为空！")
      exit sub
    end if	
    if Urls="" then
      call AMH_error(tit_fir&"图片地址不能为空！")
      exit sub
    end if
    if remark="" then
      call AMH_error(tit_fir&"内容 不能为空！")
      exit sub
    end if
    viewtype=Cls.Code_Int("viewtype",0)
    keyes=Cls.code_admin("keyes",1,20)
    power=Cls.code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if not isnumeric(emoney) then emoney=0
    username=Cls.code_admin("username",1,20)
    if ChkName(username)=false then username=login_username
    tim=Cls.Code_Admin("tim",1,20)
    tim=Cls.time_type(tim,1)
    if tim="" then tim=Cls.now_time
    counter=trim(request.form("counter"))
    if not isnumeric(counter) then counter=0
    isgood=false
    if Cls.Code_Form("isgood")="yes" then isgood=true
	istop=0
    if Cls.Code_Form("istop")="yes" then istop=1
	Isfocus=false
    if Cls.Code_Form("Isfocus")="yes" then Isfocus=true
    hidden=true
    if trim(request.form("hidden"))="yes" then hidden=false
    oSpecialID=Cls.Code_Int("SpecialID",0)
    tcolor=Cls.Code_Form("tcolor")
    Call Chk_Cid()
    sql="select * from "&Data_Name
    call Cls.exec(sql,-1)
    rs.open sql,conn,1,3
    rs.addnew
    rs("ChannelIDs")=iChannelIDs
    rs("SpecialID")=oSpecialID
    rs("ClassID")=cid
    rs("Name")=Name
	rs("viewtype")=viewtype
    rs("emoney")=emoney
    rs("power")=power
	rs("Url")=Urls
    rs("username")=username
    rs("tim")=tim
    rs("counter")=counter
	rs("Isfocus")=Isfocus
    rs("hidden")=hidden
    rs("keyes")=keyes
    rs("pic")=pic
    rs("Remark")=Remark
    rs("isgood")=isgood
    rs("Istop")=Istop
    rs("cod")=1
    rs("tcolor")=tcolor
	rs("HtmlFileDate")=Cls.HtmlRndFileName()
    rs("isUpdate")=True
    rs.update
    rs.close
    Call Cls.Channel_Count(iChannelIDs)
    call AMH_msg("已成功添加了一个"&tit_fir&"！","?AsaiMHMod="&AsaiMHMod&"&ClassID="&cid&"&ChannelIDs="&iChannelIDs,0)
    exit sub
  End If
  call form_first()
%>
<form name=add_frm action='<%Response.Write PageUrl%>Action=add' method=post  onSubmit="return checkPost(5);">
<input type=hidden name=chk value='yes'>
<tr>
<td><%Response.Write tit_fir%>标题：</td>
<td><input type=text name=name size=60 maxlength=100><%Response.Write redx%>&nbsp;&nbsp;<%Response.write ShowColor("tcolor","")%></td>
</tr>
<%dim preset:preset=split(Cls.ChannelPreset,"|||")
  Response.Write ShowClassSel(iChannelIDs,ClassID,Cls.ClassDepth)
  Response.Write ShowSpecialSel(iChannelIDs,0)
  Response.Write ShowKeyWord("",preset(0))
%>
<input type=hidden name=PhotoSize value='' size=10 maxlength=10>
<%Response.Write ShowsPicUpload(iChannelIDs,"","pic")%>
<tr>
<td>分页方式：</td>
<td><input type="radio" name=viewtype value="0" checked="checked">默认&nbsp;&nbsp;<input type="radio" name=viewtype value="1">多页显示&nbsp;&nbsp;<input type="radio" name=viewtype value="2">单页显示&nbsp;&nbsp;<input type="radio" name=viewtype value="3">单页JS&nbsp;&nbsp;<%Response.Write redx%></td>
</tr>
<tr valign=top>
<td>图片地址：</td>
<td><input type=hidden name=Urls value=''>
	<select name=Url style="width:80%;height:100" size=2 onclick="doPreviews('Url','<%=Cls.Web_Dir%>','<%=Cls.Web_Dir&Cls.Web_Upload%>');" ondblclick="ModifyUrl('图片地址','Url');"></select><%Response.Write redx%><br />
	<input type=button name=addurl value='添加图片地址' onclick="AddUrl('图片地址','Url');" class=btn>
	<input type=button name=addurl value='修改当前地址' onclick="ModifyUrl('图片地址','Url');" class=btn>
	<input type=button name=addurl value='删除当前地址' onclick="DelUrl('图片地址','Url');" class=btn>
	<input type=button name=upurl value='↑' onclick="UpUrl('图片地址','Url');" class=btn>
	<input type=button name=Downurl value='↓' onclick="DownUrl('图片地址','Url');" class=btn>
	<input type=button name=SelectFile value='从已上传文件中选择' onclick="SelectFiles('<%=iChannelIDs%>','2','Url','');" class=btn>
</tr>
<tr>
<td>上传<%Response.Write tit_fir%>：</td>
<td><iframe frameborder=0 name=upload_frame width='100%' height=30 scrolling=no src='<%=Cls.Web_Dir%>Include/Upload.asp?ID=<%=iChannelIDs%>&Type=4&Obj=Url&TObj=TempUploadFiles'></iframe></td>
</tr>
<%
  Response.Write ShowUploadList()
  Response.Write ShowMoreItem(0,0)
  Response.Write ShowEditor(iChannelIDs,5,"add_frm","remark","内容","TempUploadFiles","")
  Response.Write ShowPutInfo(Login_username,Cls.Now_time)
  Response.Write ShowRelateInfo("",Istop,"",1,0)
  Response.Write ShowLimit("",1,0)
	Call Submit_Add()
End Sub

Sub AsaiMHPhoto_Main()
	Dim Name,Classid,types,tcolor,pageurl2,obj_page
	pageurl2=pageurl
	Call SQL_ClassID(sql_add)
	Call format_search("Name","Name,username",2,1)	
  Call AMH_Td(tit_fir&"列表")
%>
<tr valign=top align=center>
<td width='20%'>
  <table border=0 width='100%'>
  <tr><td height=5></td></tr>
  <tr><td class=htd><%Call Left_Channel_Class(pageurl2,iChannelIDs)%></td></tr>
  </table>
</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
<form name=sel_form action='<%Response.Write PageUrl%>ClassID=<%Response.Write cid%>&Action=handle' method=post>
<tr align=center>
<td class=td width='7%'>序号</td>
<td class=td width='60%'><%Response.Write tit_fir%>标题及整理时间<%if keyword<>"" then Response.Write "（搜索结果："&keyword&"）"%></td>
<td class=td width='28%'>相关属性</td>
<td class=td width='5%'><input type=checkbox name=sel_all value='yes' onclick="javascript:select_all(this.form);"></td>
</tr>
<%
  set obj_page=New Cls_PageCute
  obj_page.nummer=nummer
  obj_page.pageurl=pageurl
  obj_page.page_tit=tit_fir
  obj_page.page_unit="条"
  obj_page.v_id="id"
  call obj_page.p_init("id,Name,pic,tim,hidden,Isfocus,Classid,isgood,Istop,cod,tcolor",Data_Name,sql_add,"id desc")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  call obj_page.p_main("id,Name,pic,tim,hidden,Isfocus,Classid,isgood,Istop,cod,tcolor",Data_Name,sql_add,"id desc")
  for i=1 to obj_page.page_num
    id=rs("id")
    Classid=rs("Classid")
    Name=rs("Name")
    Classid=rs("Classid")
    Name=Cls.code_html(Name,1,(18+tnum))
    tcolor=rs("tcolor")
    if Cls.Is_Null(tcolor)<>"" then
      Name="<font color=#"&tcolor&">"&Name&"</font>"
    End If
%>
<tr align=center>
<td class=tims><a href='<%Response.Write Cls.Web_Dir%><%Response.Write Index_Url%>/View.asp?id=<%Response.Write id%>' target=_blank><%Response.Write obj_page.page_now+i%></a></td>
<td>
  <table border=0 cellspacing=0 cellpadding=0 width='100%'>
  <tr>
  <td>
  <a href='<%Response.Write PageUrl%>Action=edit&id=<%Response.Write id%>'><%Response.Write Name%></a>
  </td>
  <td align=right><font class=tims><%Response.Write Cls.time_type(rs("tim"),4)%></font></td>
  </tr>
  </table>
</td>
<td align=left><%Response.Write pro_edit(PageUrl&"Action=edit&id="&id,"编辑该"&tit_fir) &"&nbsp;"& pro_hidden(rs("hidden"),1) &"&nbsp;"& pro_cod(rs("cod")) &"&nbsp;"& pro_isgood(rs("isgood")) &"&nbsp;"& pro_Isfocus(rs("Isfocus")) &"&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>
  <table border=0 cellspacing=0 cellpadding=2>
  <tr class=tr1>
  <td><%Response.Write obj_page.page_var%></td>
  <td width=3></td>
  <td>分页：</td>
  <td><%Response.Write obj_page.page_cute%></td>
  </tr>
  </table>
</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>
<option value='取消固顶'>取消固顶</option>
<option value='审核'>审核</option>
<option value='待审核'>待审核</option>
<option value='删除'>删除</option>
</select>
<input type=submit value='操作' onclick="return sel_click(this.form);" class=btn>
</td>
</tr>
</form>
  </table>
</td>
</tr>
<%
  set obj_page=nothing
End Sub

%>
