<!--#include file=cookies.asp-->
<%
dim flag
flag=request.cookies("foxwww")("fox")
if flag<9 then
response.Write "<script LANGUAGE='javascript'>alert('你目前的级别不允许此操作！');history.go(-1);</script>"
response.end
end if
%>
<%

function leftshow(str,leftc)
if len(str)>=leftc then
leftshow=left(str,leftc)&".."
else
leftshow=str
end if
end function

function htmlencode(reString)
dim Str
str=reString
str=replace(str, "&", "&amp;")
str=replace(str, ">", "&gt;")
str=replace(str, "<", "&lt;")
htmlencode=Str
end function



sub editsiteinfo()
Dim infostrSourceFile,infoobjXML
infostrSourceFile=Server.MapPath("xml/info.xml")
Set infoobjXML=Server.CreateObject("Microsoft.XMLDOM")
infoobjXML.load(infostrSourceFile)
Dim infoobjNodes
Set infoobjNodes=infoobjXML.selectSingleNode("xml/qqinfo/qqset[siteid ='1']")
If Not IsNull(infoobjNodes) then
infoobjNodes.childNodes(0).text=htmlencode(request.form("sitename"))
infoobjNodes.childNodes(1).text=htmlencode(request.form("siteskin"))
infoobjNodes.childNodes(2).text=htmlencode(request.form("siteshowx"))
infoobjNodes.childNodes(3).text=htmlencode(request.form("siteshowy"))
infoobjXML.save(infostrSourceFile)
%>
<script language="javascript">
alert("参数修改成功！")
location.href="?type=manage"
</script>
<%
Else
%>
<script language="javascript">
alert("Xml 未成功打开！")
history.back()
</script>
<%
End If
Set infoobjNodes=nothing
Set infoobjXML=nothing
end sub


sub addinfo()
if trim(request.form("qq"))="" or trim(request.form("dis"))="" or trim(request.form("face"))="" then
%>
<script language="javascript">
alert("没有填入必要的数据！")
history.back()
</script>
<%
response.end
end if

dim jtb_color
if trim(request.form("color"))="" then
jtb_color="#000000"
else
jtb_color=htmlencode(request.form("color"))
end if

Dim strSourceFile,objXML,oListNode,oDetailsNode,AllNodesNum
strSourceFile=Server.MapPath("xml/qq.xml")
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.load(strSourceFile)
Dim objRootlist
Set objRootlist=objXML.documentElement.selectSingleNode("qqlist")
dim id
If objRootlist.hasChildNodes then
id=objRootlist.lastChild.lastChild.text+1
Else
id=1
End If
Set objRootlist=nothing
Set oListNode=objXML.documentElement.selectSingleNode("qqlist").AppendChild(objXML.createElement("qq"))
Set oDetailsNode=oListNode.appendChild(objXML.createElement("qid"))
oDetailsNode.Text=htmlencode(request.form("qq"))
Set oDetailsNode=oListNode.appendChild(objXML.createElement("dis"))
oDetailsNode.Text=htmlencode(request.form("dis"))
Set oDetailsNode=oListNode.appendChild(objXML.createElement("face"))
oDetailsNode.Text=htmlencode(request.form("face"))
Set oDetailsNode=oListNode.appendChild(objXML.createElement("color"))
oDetailsNode.Text=jtb_color
Set oDetailsNode=oListNode.appendChild(objXML.createElement("id"))
oDetailsNode.Text=id
objXML.save(strSourceFile)
Set objRootlist=nothing
Set oListNode=nothing
Set oDetailsNode=nothing
Set objXML=nothing
%>
<script language="javascript">
alert("添加新的QQ号成功！")
location.href="?type=manage"
</script>
<%
response.end
end sub



sub editinfo()
dim editid:editid=request.querystring("id")
if not IsNumeric(editid) or editid="" then
%>
<script language="javascript">
alert("非法操作！")
history.back()
</script>
<%
response.end
else
editid=clng(editid)
end if
if trim(request.form("qq"))="" or trim(request.form("dis"))="" or trim(request.form("face"))="" then
%>
<script language="javascript">
alert("没有添入必要的数据！")
history.back()
</script>
<%
response.end
end if
Dim strSourceFile,objXML
strSourceFile=Server.MapPath("xml/qq.xml")
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.load(strSourceFile) 
Dim objNodes
Set objNodes=objXML.selectSingleNode("xml/qqlist/qq[id ='"&editid&"']")
If Not IsNull(objNodes) then
objNodes.childNodes(0).text=htmlencode(request.form("qq"))
objNodes.childNodes(1).text=htmlencode(request.form("dis"))
objNodes.childNodes(2).text=htmlencode(request.form("face"))
objNodes.childNodes(3).text=htmlencode(request.form("color"))
objXML.save(strSourceFile)
Set objNodes=nothing
Set objXML=nothing
%>
<script language="javascript">
alert("修改成功！")
location.href="?type=manage"
</script>
<%
else
%>
<script language="javascript">
alert("修改失败！")
location.href="?type=manage"
</script>
<%
end if
response.end
end sub

sub delinfo()
dim delid
delid=request.querystring("id")
if not IsNumeric(delid) or delid="" then
%>
<script language="javascript">
alert("非法操作！")
location.href="<%=jurl%>?type=manage"
</script>
<%
response.end
else
delid=clng(delid)
end if
Dim strSourceFile,objXML
strSourceFile=Server.MapPath("xml/qq.xml")
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.load(strSourceFile)
Dim objNodes
Set objNodes=objXML.selectSingleNode("xml/qqlist/qq[id ='"&delid&"']")
if Not IsNull(objNodes) then
if request.querystring("yn")="" then
%>
<script language="javascript">
if(confirm("确认要删除[<%=objNodes.childNodes(0).text%>]的信息吗？"))
window.location="?type=manage&act=delete&id=<%=delid%>&yn=1"
else
history.back()
</script>
<%
else
objNodes.parentNode.removeChild(objNodes)
objXML.save(strSourceFile)
%>
<script language="javascript">
alert("删除成功！")
location.href="?type=manage"
</script>
<%
end if
else
%>
<script language="javascript">
alert("没有找到指定的条目！")
location.href="?type=manage"
</script>
<%
End If
Set objNodes=nothing
Set objXML=nothing
response.end
end sub


select case request.querystring("act")
case "login"
case "editsiteinfo" call editsiteinfo()
case "add" call addinfo()
case "edit" call editinfo()
case "delete" call delinfo()
end select
%>
<link rel="stylesheet" type="text/css" href="../fox.CSS">
<style type=text/css>
BODY{
	margin:0px;
	FONT-SIZE: 12px;
	FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	background-color: #CCCC99; 
	scrollbar-highlight-color: #CC9933; 
	scrollbar-arrow-color: #FFFFFF; 
	scrollbar-base-color: #CC9933
}
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#111111; text-decoration:none; }
a:hover { color:#384780;text-decoration:underline; }
.sec_menu { border-left:2px solid #CC3300; border-right:2px solid #CC3300; border-bottom:2px solid #CC3300; overflow:hidden; background:#ffffff; }
.menu_title {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title span { position:relative; top:2px; left:8px; color:#FFFF00; font-weight:bold; }
.menu_title2 {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title2 span { position:relative; top:2px; left:8px; color:#FEFEFE; font-weight:bold; }
input,select,Textarea{
font-family:宋体,Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
</style>
<table border="0" width="500" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td width="500">
    <fieldset align="center">
    <legend>在线客服管理</legend>
<%
Dim infostrSourceFile,infoobjXML
infostrSourceFile=Server.MapPath("xml/info.xml")
Set infoobjXML=Server.CreateObject("Microsoft.XMLDOM")
infoobjXML.load(infostrSourceFile)
Dim infoobjNodes
Set infoobjNodes=infoobjXML.selectSingleNode("xml/qqinfo/qqset[siteid ='1']")
If Not IsNull(infoobjNodes) then
%>
    <form method="post" action="?type=manage&act=editsiteinfo">
    <table border="0" width="500">    
      <tr>
        <td width="500" height="25">&nbsp;参数设置</td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;网站名：<input type="text" name="sitename" size="15" value="<%=infoobjNodes.childNodes(0).text%>">&nbsp;使用皮肤：<input type="text" name="siteskin" size="5" value="<%=infoobjNodes.childNodes(1).text%>"></td>
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;显示界面X坐标：<input type="text" name="siteshowx" size="10" value="<%=infoobjNodes.childNodes(2).text%>">&nbsp;Y坐标：<input type="text" name="siteshowy" size="10" value="<%=infoobjNodes.childNodes(3).text%>">&nbsp;<input type="submit" name="submit" value="修改"></td>
      </tr> 
      <tr>
        <td width="500" height="10"></td>
      </tr>
    </table>
    </form>
<%
Else
%>
<script language="javascript">
alert("Xml 未成功打开！")
history.back()
</script>
<%
response.end
End If
Set infoobjNodes=nothing
Set infoobjXML=nothing
%>
    <table border="0" width="500" bordercolorlight="#CCCCCC" cellspacing="0" cellpadding="0" bordercolordark="#D6D6D6" style="border-width: 1px">
      <tr>
        <td width="180" height="25">&nbsp;QQ号</td>
        <td width="180" height="25">&nbsp;描述</td>
        <td width="80" height="25">&nbsp;头像</td>
        <td width="30" align="center" height="25">编辑</td>
        <td width="30" align="center" height="25">删除</td>
      </tr>
<%
Dim strSourceFile,objXML,objRootsite,AllNodesNum
strSourceFile=Server.MapPath("xml/qq.xml")
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.load(strSourceFile)
Set objRootsite=objXML.documentElement.selectSingleNode("qqlist")
AllNodesNum=objRootsite.childNodes.length-1
Dim iCount
For iCount=0 to AllNodesNum
%>
      <tr>
        <td width="180" height="25">&nbsp;<%=objRootsite.childNodes.item(iCount).childNodes.item(0).text%></td>
        <td width="180" height="25">&nbsp;<%=objRootsite.childNodes.item(iCount).childNodes.item(1).text%></td>
        <td width="80" height="25">&nbsp;<img src="images/qqface/<%=objRootsite.childNodes.item(iCount).childNodes.item(2).text%>_m.gif" border="0"></td>
        <td width="30" align="center" height="25"><a href="?type=manage&mtype=edit&id=<%=objRootsite.childNodes.item(iCount).childNodes.item(4).text%>">编辑</a></td>
        <td width="30" align="center" height="25"><a href="?type=manage&act=delete&id=<%=objRootsite.childNodes.item(iCount).childNodes.item(4).text%>">删除</a></td>
      </tr>
<%
Next
Set objRootsite=nothing
Set objXML=nothing
%>      
    </table>
    <form method="post" action="?type=manage&act=add">
    <table border="0" width="500">
      <tr>
        <td width="500" height="10"></td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;添加新的QQ号</td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;QQ号：<input type="text" name="qq" size="20"></td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;描述：<input type="text" name="dis" size="25"></td>
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;颜色：<input type="text" name="color" size="25"> 输入颜色代码例如：#000000</td>  
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;头像：<br>   
        <%dim fcount:for fcount=1 to 100%>
        <input type="radio" name="face" value="<%=fcount%>"><img src="images/qqface/<%=fcount%>_m.gif" border="0">                                                      
        <%next%>                                                      
        </td>                                                                           
      </tr>
      <tr>
        <td width="500" height="10"></td>
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;<input type="submit" name="submit" value="确定添加">&nbsp;<input type="reset" name="reset" value="取消重置"></td>
      </tr>
      <tr>
        <td width="500" height="10"></td>
      </tr>
    </table>
    </form>
    </fieldset>
    </td>
  </tr>
</table>
<%
sub neditinfo()
%>
<table border="0" width="500" cellpadding="0" cellspacing="0" align="center">
  <tr>
    <td width="500">
    <fieldset align="center">
    <legend>编辑QQ信息</legend>    
<%
dim neditid:neditid=request.querystring("id")
if not IsNumeric(neditid) or neditid="" then
%>
<script language="javascript">
alert("非法操作！")
history.back()
</script>
<%
response.end
else
neditid=clng(neditid)
end if
Dim strSourceFile,objXML
strSourceFile=Server.MapPath("xml/qq.xml")
Set objXML=Server.CreateObject("Microsoft.XMLDOM")
objXML.load(strSourceFile)
Dim objNodes
Set objNodes=objXML.selectSingleNode("xml/qqlist/qq[id ='"&neditid&"']")
If Not IsNull(objNodes) then
%>
    <form method="post" action="?type=manage&act=edit&id=<%=neditid%>">
    <table border="0" width="500">
      <tr>
        <td width="500" height="10"></td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;修改指定的QQ信息</td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;QQ号：<input type="text" name="qq" size="20" value="<%=objNodes.childNodes(0).text%>"></td>
      </tr>     
      <tr>
        <td width="500" height="25">&nbsp;描述：<input type="text" name="dis" size="25" value="<%=objNodes.childNodes(1).text%>"> </td>                                                                         
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;颜色：<input type="text" name="color" size="25" value="<%=objNodes.childNodes(3).text%>"> 输入颜色代码例如：#000000</td>  
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;头像：<br>
        <%dim fcount:for fcount=1 to 100%>
        <input type="radio" name="face" value="<%=fcount%>"<%if objNodes.childNodes(2).text=cstr(fcount) then response.write" checked"%>><img src="images/qqface/<%=fcount%>_m.gif" border="0">                                      
        <%next%>                                      
        </td>                                                                           
      </tr>
      <tr>
        <td width="500" height="10"></td>
      </tr>
      <tr>
        <td width="500" height="25">&nbsp;<input type="submit" name="submit" value="确定修改">&nbsp;<input type="reset" name="reset" value="取消重置"></td>
      </tr>
      <tr>
        <td width="500" height="10"></td>
      </tr>
    </table>
    </form>
    </fieldset>
    </td>
  </tr>
</table>
<%
else
%>
<script language="javascript">
alert("发生错误！")
history.back()
</script>
<%
end if
Set objNodes=nothing
Set objXML=nothing
end sub
%>


<%if request.querystring("type")="manage" then
select case request.querystring("mtype")
case "edit" call neditinfo()
end select
%>

<%

end if
%>
</body>
</html>