<!--#include file="Admin_check.asp"-->
<%dim bbsinfo,action,strt,i,uploadtype,badwords,badcontent,str,offbbsinfo,obbs,paper,count,sql,id,ggtitle,ggok,content,contentok,thisbbs,bad,b,content2,lgname,lgpwd,lgpwdmd5,bdlist2
dim name,url,picurl,readme,come
%>


<link rel=stylesheet type=text/css href=inc/css.css>
<STYLE type=text/css>BODY {
	SCROLLBAR-FACE-COLOR: #749AEC;  SCROLLBAR-HIGHLIGHT-COLOR:#749AEC; SCROLLBAR-3DLIGHT-COLOR: #749AEC; SCROLLBAR-ARROW-COLOR:#F4F6FC; SCROLLBAR-TRACK-COLOR: #B0C7F4; SCROLLBAR-DARKSHADOW-COLOR: #749AEC}
</style>
<body topmargin="0" leftmargin="0">


<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" bgcolor="#749AEC">
  <tr>
    <td class=td1 width="100%" height="35">&nbsp;
    奖项管理页面</td>
  </tr>
</table>
<table border="3" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#749AEC" width="100%">
  <tr>
    <td width="100%" valign="top" height="475">

<%
come=Request.ServerVariables("HTTP_REFERER")
  dim nm
 if request("action")="save" then
		call savegrade()
	 elseif request("action")="add" then
		call add()
	 elseif request("action")="savenew" then
		call savenew()
	elseif request("action")="del" then
		call del()
	else
		call gradeinfo()
	end if
sub gradeinfo()%>
<form method="POST" action=admin_jz.asp?action=save>
<div align="center"><center>
<table border="0" cellpadding="1" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="98%"  height="46">
    <td width="100%" height="46">
    <p style="margin-top: 0; margin-bottom: 0"><b>注意</b>：<br>
    ①、编号中必须添入数值，否则不能保存。<br>
    ②、请完整填写所有数据，然后进行保存。<br>
    ③、奖章图片放在images/cham/下面。<br>
    ④、点击[<font color="#FF0000">添加奖项</font>]切换到奖项添加页面。</p>
    </td>
  </tr>
</table>
  </center>
</div>
<table width="98%" border="0" cellspacing="1" cellpadding="3" align=center>
<br><center>奖项属性管理器 [<a href="?action=add"><font color=red>添加奖项</font></a>]</center>
<hr size=1 color=white width=98% >
<tr bgcolor=#D6DFF7> 
<td width="30"><b>编号</b></td>
<td width="60"><b>奖项名称</b></td>
<td width="120"><b>相关说明</b></td>
<td width="142"><b>图片名</b></td>
<td width="100"><b>图片</b></td>
<td width="107"><B>操作</B></td>
</tr>
<%set rs=server.createobject("adodb.recordset")
  set rs=conn.execute("select * from KK_jzdata")
  nm=1
  do while not rs.eof
%>
<tr bgcolor=#D6DFF7> 
<td width="30">
<input type=hidden value="<%=nm%>" name="jzcount">
<p align="center">
<input size=3 value="<%=rs("jzid")%>" name="jzid" type=text></td>
<td width="60">
<input size=10 value="<%=rs("jzname")%>" name="jzname" type=text></td>
<td width="120">
<input size=43 value="<%=rs("jzsm")%>" name="jzsm" type=text></td>
<td width="142">
<input size=10 value="<%=rs("jzpicurl")%>" name="jzpicurl" type=text></td>
<td width="100"><img src=images/cham/<%=rs("jzpicurl")%> border=0></td>
<td width="107"><a href="?action=del&jzid=<%=rs("jzid")%>">删除</a></td>
</tr>
<%
nm=nm+1
rs.movenext
loop
rs.close
set rs=nothing
%>
<tr bgcolor=#D6DFF7> 
<td width="500" colspan=6><center> 
<input type="submit" name="Submit" value="提 交"></center>
</td>
</tr>
</table>
</form>
<%end sub
sub savegrade()
	Server.ScriptTimeout=99999999
	dim jzname,jzpicurl,jzsm,jzid	
	for i=1 to request.form("jzcount").count
	jzname=request.form("jzname")(i)
	jzpicurl=request.form("jzpicurl")(i)
	jzsm=request.form("jzsm")(i)
	jzid=request.form("jzid")(i)
	if isnumeric(jzid) and jzname<>"" and jzpicurl<>"" and jzsm<>"" then
	conn.execute("update KK_jzdata set jzname='"&jzname&"',jzpicurl='"&jzpicurl&"',jzsm='"&jzsm&"' where jzid="&jzid)
	end if
	next
call alert("·奖项设置修改成功","admin_jz.asp")
	set rs=nothing
end sub
sub add()%>
<form method="POST" action=admin_jz.asp?action=savenew>
<div align="center"><center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="98%" background-color: #663300" id="AutoNumber2" height="46">
    <tr><td width="100%" height="54">
    <p style="margin-top: 0; margin-bottom: 0"><b>注意</b>：<br>
    ①、点击左面导航[<font color="#FF0000">奖章管理</font>]切换到奖项添加页面。<br>
    ②、请完整填写所有数据，然后进行保存。<br>
	③、图片请放在images/cham/下面</p>
</td>
</tr>
</table>
</center>
</div>
<table width="98%" border="0" cellspacing="1" cellpadding="3"  align=center height="93">
<br><center><font color=red>添加新的奖项</font></center>
<tr bgcolor=#D6DFF7> 
<td width="40%" height="20"><b>奖项名称</b></td>
<td width="60%" height="20">
<input size=30 name="jzname" type=text></td>
</tr>
<tr bgcolor=#D6DFF7>
<td width="40%" height="19"><b>奖项说明</b></td>
<td width="60%" height="19">
<input size=30 name="jzsm" type=text></td>
</tr>
<tr bgcolor=#D6DFF7>
<td width="40%" height="10"><b>奖项图片</b></td>
<td width="60%" height="10">
<input size=30 name="jzpicurl" type=text></td>
</tr>
<tr bgcolor=#D6DFF7>
<td width="100%" height="10" colspan="2"><center>
<input type="submit" name="Submit" value="提 交"></center> </td>
</tr>
</table>
</form><hr size=1 color=white width=98% >
<%
end sub
sub savenew()
if request.form("jzname")="" then
call alert("·请输入奖项名称。","admin_jz.asp?action=add")

	exit sub
end if
if request.form("jzsm")="" then
call alert("·请输入奖项描述。","admin_jz.asp?action=add")
	exit sub
end if
if request.form("jzpicurl")="" then
call alert("·请输入图片名。","admin_jz.asp?action=add")
	exit sub
end if
set rs = server.CreateObject ("Adodb.recordset")
sql="select * from KK_jzdata where jzname='"&request.form("jzname")&"'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
rs.addnew
rs("jzname")=request.form("jzname")
rs("jzsm")=request.form("jzsm")
rs("jzpicurl")=request.form("jzpicurl")
rs.update
else
call alert("·该奖项已存在！","admin_jz.asp?action=add")
	exit sub
end if
rs.close
set rs=nothing
call alert("·该奖项已被成功添加！建议您到奖项管理器中进行属性操作！","admin_jz.asp")
end sub
sub del()
dim xzid
if BBS94KK.Fun.isInteger(request("jzid")) then
conn.execute("delete from KK_jzdata where jzid="&request("jzid"))
call alert("·删除成功！建议您到奖项属性管理器中进行其他操作！","admin_jz.asp")
set rs=nothing
end if
end sub
'closedb
Sub Alert(message,rurl)
	message = replace(message,"'","\'")
	rurl = replace(rurl,"'","\'")
	Response.Write ("<script LANGUAGE='javascript'>alert('" & message & "');window.location.href='"&rurl&"';</script>")
	Response.End
End Sub
%>

</td>
  </tr>
</table>
