<!--#include file="../setting/conn.asp"--><!--#include file="../inc/cls_other.asp"-->
<%:SoonBiz.chkadmin:cid=0:act=SoonBiz.ract:jinlan="<a href=''>有问必答管理</a>":Select Case act:Case "cls" : adminclass :case "savenewclass" : saveclass(false) :case "saveeditclass": saveclass(true) :case "delclass" : delclass :Case "list" : list :Case "readask" : readask:Case "savereply" : savereply:Case "savereply_e" : savereply_e :Case "savetitle" : savetitle :Case "editreply" : editreply :Case "changeclass":SoonBiz.Execute("update "& sheethead &"_ask set classid="&SoonBiz.rid("targetclassid") &" where id in ("&SoonBiz.rids&")"):SoonBiz.ok:Case "del" : DelAsk :Case "delreply" : DelReply :End Select:SoonBiz.adfoot:setallnothing:Sub DelReply:id=SoonBiz.rid("id"):SoonBiz.Execute("delete from "& sheethead &"_ask where id="&id):SoonBiz.ok:End Sub:Sub DelAsk():Dim idlist:idlist=SoonBiz.rids:SoonBiz.execute("delete from "& sheethead &"_ask where id in ("& idlist &")"):SoonBiz.Execute("delete from "& sheethead &"_ask where askid in ("& idlist &")"):Delimage "ask",idlist:SoonBiz.ok:End Sub:Sub adminclass():Dim tr:tr="<tr> <td id=""title_{$id}"">{$title}</td> <td id=""cls_{$id}"" align='center'>{$cls}</td> <td align='center'><a href=""javascript:editclass({$id})"">修改</a> <a href='?act=delclass&id={$id}' onClick=""return confirm('确定要删除么!')"">删除</a></td></tr>":SoonBiz.topplus="<script src=""../inc/admin_ask.js"" type=""text/javascript""></script>":SoonBiz.adhead:SoonBiz.nstate(jinlan & " - 分类管理"):Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write " <tr>":Response.Write " <th width=""*"">分类名称</th>":Response.Write " <th width=""40"">排序</th>":Response.Write " <th width=""120"">操作</th>":Response.Write " </tr>":Response.Write SoonBiz.replaceMdb("admin_ask","select * from ["& sheethead &"_class] where cid=0 order by cls asc,id asc",tr,"",1):Response.Write "</table>":Response.Write "<br />":Response.Write "<div class=""navoperate"">":Response.Write " <h1>操作导航:</h1>":Response.Write " [<a href=""javascript:edit('classinfo',240,160)"">添加新分类</a>]":Response.Write "</div>":Response.Write "<div id=""classinfo"" class=""edit"">":Response.Write " <span class='close'><a href='javascript:closediv(""classinfo"")'><img src='../images/close.gif' align='absmiddle' /></a></span>":Response.Write " <h1 id=""classth"">添加新分类</h1>":Response.Write " <form method=""post"" action=""?act=savenewclass"" id=""classform"">":Response.Write " <p>分类名称: <input type=""text"" name=""title"" id=""title"" size=""20""/></p>":Response.Write " <p>排序(数字):<input type=""text"" name=""cls"" id=""cls"" value=""100"" size=""3"" /></p>":Response.Write " <div class=""operate""><input type=""submit"" value=""提交"" /></div>":Response.Write " </form>":Response.Write "</div>":Response.Write "<div id=""bg""></div>":End Sub:Sub saveclass(isedit):Dim title,cls:Dim rs,sql:title=SoonBiz.RequestStr("分类名称","title","post",1,1,255,30,1):cls=SoonBiz.rid("cls"):ShowErr(""):SoonBiz.ConnectionDatabase:Set rs=server.CreateObject("adodb.recordset")
If isedit Then
id=SoonBiz.rid("id"):sql="select * from "& sheethead &"_class where id="&id:rs.open sql,conn,1,3
Else:rs.open ""& sheethead &"_class",conn,1,3:rs.addnew
End if:Rs("title")=title:Rs("cls")=cls:Rs("treeid")=cls:rs.update:SoonBiz.LoadClass:SoonBiz.ok:End Sub:Sub delclass():Dim rs:Dim sql:id=SoonBiz.rid("id"):sql="select id from "& sheethead &"_ask where classid="&id:set rs=SoonBiz.execute(sql)
If not rs.eof Then
ErrMsg=ErrMsg & "<li>这个分类下还有问题,请先删除问题再删除分类</li>"
End if:rs.close:Set rs=Nothing:ShowErr(""):sql="delete from "& sheethead &"_class where id="&id:SoonBiz.execute(sql):SoonBiz.LoadClass:SoonBiz.ok:End Sub:Sub list():Dim shujun,astr:Dim jinlan:Dim isover :jinlan="问题管理":isover=SoonBiz.rid("isover"):astr=SoonBiz.PlusSQL("select * from ["& sheethead &"_ask] where askid=0 ","?act="&act)
If isover>-1 Then 
astr(0)=astr(0) & " and isover="&isover:astr(1)=astr(1) & "&amp;isover="&isover:astr(2)=astr(2) & "CheckSel(""isover"","& isover &");"
End If:astr(0)=astr(0) & " order by id desc":shujun="<tr onmouseover=""this.style.backgroundColor='#e2e8f4'"" onmouseout=""this.style.backgroundColor=''"" ><td align='center'>{$id}</td><td><a href=?act=readask&id={$id}>{$title}</a></td><td align='center'>{$nickname}</td><td align='center'><script type=""text/javascript"">document.write(classname[{$classid}]);</script></td><td align='center'><script type=""text/javascript"">isover({$isover});</script></td><td align='center'>{$reps}</td><td align='center'>{$stime_short}</td><td align='center'><input type='checkbox' name='id' id='id' value='{$id}' /></td></tr>":SoonBiz.adhead:SoonBiz.nstate(jinlan):Response.Write SoonBiz.JsClassName(0):listfilter:Response.Write "<form method=post action=""?"" id=""myform"" name=""myform"">":Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr>":Response.Write " <th width=40>id</th>":Response.Write " <th width=*>问题</th>":Response.Write " <th width=80>提问人</th>":Response.Write " <th width=180>所属分类</th>":Response.Write " <th width=60>状态</th>":Response.Write " <th width=40>回复</th>":Response.Write " <th width=80>时间</th>":Response.Write " <th width=40>选择</th>":Response.Write "</tr>":Response.write SoonBiz.ReplaceMdb("user_ask",astr(0),shujun,"",0):Response.write "</table>":Response.Write "<div class=""operate"">":Response.Write " <input type=""button"" onClick=""CheckAll(myform)"" value=""全选"">":Response.Write " <input type=""button"" onClick=""ContraSel(myform)"" value=""反选"">":Response.Write " <input type=""button"" onClick=""Csubmit('myform','?act=del&cid="& cid &"','确定要删除选择的文件么?\n删除后不可恢复!')"" value=""删除"">":Response.Write " <select name=""targetclassid"" onchange=""Csubmit('myform','?act=changeclass&cid="& cid &"','确认要转移到'+this.options[this.selectedIndex].text+'吗')"">":Response.Write " <option value="""">转移分类</option>":Response.Write " <option value=""0"">不属于任何分类</option>":Response.write SoonBiz.ReplaceClass("admin_ask.asp",cid,0,"<option value='{$id}'>{$title}</option>","all"):Response.Write " </select>":Response.Write "</div>":Response.Write "</form>":Response.Write SoonBiz.pagelist(""):Response.Write "<script language=""javascript"">"& astr(2) &"</script> ":End Sub:Sub listfilter():Dim tr:Dim trhtml:tr="<option value=""{$id}"">{$title}</option>":Response.Write "<div class=""listfilter"">":Response.Write "<form method=post action=""?act=list"">":Response.Write " <input type=""text"" name=""keyword"" class='inputsearch' id=""keyword"">":Response.Write " <select name=""myfield"" id=""myfield"">":Response.Write " <option value=""title"" selected=""selected"">按问题主题搜索</option>":Response.Write " <option value=""nickname"">按提问人昵称搜索</option>":Response.Write " </select>":Response.Write " <select name=""classid"" id=""classid"">":Response.Write " <option value="""">全部分类</option>":Response.Write SoonBiz.ReplaceClass("",cid,0,tr,"all"):Response.Write " </select>":Response.Write " <select id=""isover"" name=""isover"">":Response.Write " <option value="""">全部问题</option>":Response.Write " <option value=""0"">新问题</option>":Response.Write " <option value=""1"">正在处理</option>":Response.Write " <option value=""1"">已经完成</option>":Response.Write " </select>":Response.Write " <input type='submit' name=""submit"" id=""submit"" class=""submit"" value='显示'>":Response.Write " </form>":Response.Write "</div>":End Sub:Sub readask():Dim tr:Dim sql:id=SoonBiz.rid("id"):jinlan="<a href='?'>问题管理</a>":SoonBiz.iseditor=true:SoonBiz.adhead:SoonBiz.nstate(jinlan):tr="<div><div class=askstate> <a href='?act=delask&id={$id}' onClick=""return confirm('确定要删除么!')"">删除</a>┆<span class='askstatecolor'><script type=""text/javascript"">isover({$isover});</script></span></div> <div class='asktitle'>问题</div></div> <div class=ask> <h1><div id='title{$id}'>{$title}</div></h1> <div id='content{$id}'>{$content}</div> </div>":sql="select * from ["& sheethead &"_ask] where id="&id:Response.write SoonBiz.ReplaceMdb("user_ask",sql,tr,"",1):sql="select * from ["& sheethead &"_ask] where askid="& id &" order by id asc":tr=" <div class='reply'><div class='editask'><a href=""?act=editreply&id={$id}"">编辑</a>┆<a href='?act=delreply&id={$id}'>删除</a></div><div class='answertitle'>回复</div></div> <div class=answer> <div id='content{$id}'>{$content}</div> </div>":Response.write SoonBiz.ReplaceMdb("user_ask",sql,tr,999999,1):Response.Write "<br />":Response.Write "<form method=""post"" action=""?act=savereply&askid="& id &""">":Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr><th colspan=2>回复</th></tr>":Response.Write "<tr>":Response.Write " <td colspan=2>":Response.Write " <textarea id=""content"" rows="""" cols="""" name=""content""></textarea><script type=""text/javascript"">SoonhostEdit('content')</script>":Response.Write " <div class=""operate""><input type=""submit"" value=""提交"" /></div>":Response.Write " <iframe id=""upfile"" src=""admin_img.asp?obj=content&amp;cid="& cid &"&amp;fid=ask"& id &""" frameborder=""0"" scrolling=""No"" width=""100%"" height=""280""></iframe>":Response.Write " </td>":Response.Write "</tr>":Response.Write "</table>":Response.Write "</form>":SoonBiz.Execute("update "& sheethead &"_ask set isover=1 where isover=0 and id="&id):End Sub:Sub savereply():Dim askid,content:Dim sql:Dim fid:Dim rs:askid=SoonBiz.rid("askid"):content=SoonBiz.RequestStr("回复内容","content","post",1,2,500000,0,1):ShowErr(""):SoonBiz.ConnectionDatabase:Set rs=server.CreateObject("adodb.recordset"):rs.open ""& sheethead &"_ask",conn,1,3:rs.addnew:rs("uid")=SoonBiz.user_id:rs("nickname")=SoonBiz.user_nickname:rs("stime")=now:rs("content")=content:rs("atype")=2:rs("askid")=askid:rs.update:rs.close:Set rs=Nothing:SoonBiz.Execute("update "& sheethead &"_ask set isover=2,reps=reps+1 where id="&askid):SucMsg=SucMsg & "<li>回复成功!</li>":SucMsg=SucMsg & "<li><a href='?act=list'>返回问题列表!</a></li>":SoonBiz.adsuccess(SucMsg):End Sub:Sub editreply() :Dim id,content,askid:Dim rs,sql:id=SoonBiz.rid("id"):Set rs=SoonBiz.execute("select * from "& sheethead &"_ask where id="&id):content=rs("content"):askid=rs("askid"):Rs.Close:Set Rs=Nothing:SoonBiz.iseditor=true:SoonBiz.adhead:SoonBiz.nstate("编辑问题回复"):Response.Write "<form method=""post"" action=""?act=savereply_e&id="& id &""">":Response.Write "<table cellspacing=1 class=tableborder1>":Response.Write "<tr><th colspan=2>编辑回复</th></tr>":Response.Write "<tr>":Response.Write " <td colspan=2>":Response.Write " <textarea id=""content"" rows="""" cols="""" name=""content"">"& content &"</textarea><script type=""text/javascript"">SoonhostEdit('content')</script>":Response.Write " </td>":Response.Write "</tr>":Response.Write "</table>":Response.Write "<div class=""operate""><input type=""submit"" value=""提交"" /></div>":Response.Write "</form>":Response.Write "<iframe id=""upfile"" src=""admin_img.asp?obj=content&amp;cid="& cid &"&fid=ask_"& askid &""" frameborder=""0"" scrolling=""No"" width=""100%"" height=""280""></iframe>":End Sub:Sub savereply_e():Dim content,sql:id=SoonBiz.rid("id"):content=Trim(Request.Form("content")):sql="update "& sheethead &"_ask set content='"& SoonBiz.Checkstr(content) &"' where id="&id:SoonBiz.Execute(sql):SoonBiz.adsuccess("保存成功!"):End Sub
%>