<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
dim act,tablename,thisTitle,id
if not isempty(request("type")) then
	tablename=request("type")
else
	Response.Write("<script>alert(""资源操作类型不能为空""); history.back();</script>")
	Response.End
end if
if not isempty(request("id")) then
	id=Clng(request("id"))
else
	Response.Write("<script>alert(""ID不能为空""); history.back();</script>")
	Response.End
end if
Select Case LCase(tablename)
			Case "t_author"
				thisTitle="添加作者"
			Case "t_from"
				thisTitle="添加来源"
			Case "t_special"
				thisTitle="添加专题"
End Select
%>
<HTML>
<HEAD>
<TITLE><%=thisTitle%></TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<style>
body,td,input,textarea {font-size:9pt}
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {
	color: #FFFFFF;
	font-weight: bold;
}
</style>

</HEAD>
<BODY>
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p16")
'''''''''''''''''''''''''''''''''''''''''''''''
%>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<%
act=request.QueryString("act")
if(act="mod") then	
	title=trim(request.Form("title"))
	'添加到库
	set rs=server.createobject("adodb.recordset")
	rs.open "select * from "&tablename&" where title='"&title&"' and id<>"&id,conn,3,1
	if not rs.eof then
		response.Write("<script>alert(""该标题已存在!"");history.back();</script>")
		response.End()
	end if
	rs.close
	sql="select top 1 * from "&tablename&" where id="&id&" order by id desc "
	rs.open sql,conn,3,3	
	rs("title")=title	
	rs.update
	rs.close
	set rs=nothing
	response.Write("修改成功~!<p>")
	response.Write("<br><p><center><a href=resource_manage.asp?type="&tablename&">返回</a></center>")	
else
	set rs=server.createobject("adodb.recordset")
	sql="select top 1 title from "&tablename&" where id="&id&" order by id desc "
	rs.open sql,conn,3,1	
	if rs.eof or rs.bof then
		response.Write("没有找到ID为"&id&"的记录！")
		response.End()
	else
		title=rs("title")
	end if
	rs.close
	set rs=nothing
%>
<FORM method="POST" name="form1" action="?act=mod&type=<%=tablename%>" style="margin:0 0 0 0;">
  <TABLE width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#666666">
<TR bgcolor="#FF9900">
  <TD height="24" colspan="2"><div align="center" class="style1"><%=thisTitle%></div></TD>
  </TR>
<TR bgcolor="#F5F5F5">
  <TD width="14%"><div align="center">标题：</div></TD>
  <TD width="86%"><input name="title" type="text" id="title" size="30" value="<%=title%>"></TD>
</TR>
<TR bgcolor="#F5F5F5">
	<TD align=right>&nbsp;	  </TD>
    <TD align=right><div align="left"> 
		<input type="hidden" name="id" value="<%=id%>">
        <input type=submit name=b1 value="提 交">&nbsp;&nbsp;
        <input type=reset name=b2 value="重 填">       
    </div></TD>
</TR>
</TABLE>
</FORM>
<%
end if
%>
</BODY>
</HTML>
<%
call connclose()
%>