<!--#include file="Access.asp"  -->
<!-- #include file="inc/functions.asp" -->
<!-- #include file="../func/rand.asp" -->
<!-- #include file="x_to_html/index_to_html.asp" -->
<!-- #include file="x_to_html/category_article_to_html.asp" -->

<% '添加数据到数据表

act1=Request("act1")
If act1="save" Then 
a_id=trim(request.form("l_id"))
l_author=request.form("l_author")
l_name=trim(request.form("name"))
l_type=trim(request.form("type"))
l_content=trim(request.form("content"))
l_view_yes=trim(request.form("view_yes"))
l_index_push=trim(request.form("index_push"))
l_time=now()

set rs=server.createobject("adodb.recordset")
sql="select * from web_info"
rs.open(sql),cn,1,3
rs.addnew
rs("author")=l_author
rs("name")=l_name
rs("type")=l_type
rs("content")=l_content
rs("index_push")=cint(l_index_push)
rs("view_yes")=cint(l_view_yes)
rs("time")=l_time
rs.update

rs.close
set rs=nothing
%>

<% '生成html
set rs2=server.createobject("adodb.recordset")
sql="select top 1 [id] from [web_info] where [name]='"&l_name&"' order by [time] desc"
rs2.open(sql),cn,1,1
if not rs2.eof and not rs2.bof then
a_id=rs2("id")
end if
rs2.close
set rs2=nothing

filepath="/category/html/"&a7&".html"

call category_article_to_html(a_id,filepath)
call index_to_html()
%>

<%
response.Write "<script language='javascript'>alert('修改成功！');location.href='info_list.asp';</script>"
end if 
 %>
 

	<%
Call header()

%>

  <form id="form1" name="form1" method="post" action="?act1=save&page=<%=page%>&act=<%=act%>&keywords=<%=keywords%>">
         <script language='javascript'>
function checksignup1() {
if ( document.form1.l_author.value == '' ) {
window.alert('请选择作者^_^');
document.form1.l_author.focus();
return false;}

if ( document.form1.name.value == '' ) {
window.alert('请输入标题^_^');
document.form1.name.focus();
return false;}

if ( document.form1.type.value == '' ) {
window.alert('请选择分类^_^');
document.form1.type.focus();
return false;}

return true;}
</script>      
	<table cellpadding='3' cellspacing='1' border='0' class='tableBorder' align=center>
	<tr>
	  <th class='tableHeaderText' colspan=2 height=25>添加分类信息</th>
	<tr>
	<td width="15%" height=23 class='forumRowHighLight'>发布者</td>
	<td width="85%" class='forumRowHighLight'><select name="l_author" id="l_author">
<option value="">请选择</option>
<% set rsp=server.createobject("adodb.recordset")
		   sql="select id,username from web_register"
		   rsp.open(sql),cn,1,1
		   if not rsp.eof and not rsp.bof then
		   do while not rsp.eof 
		   %> <option value="<%=rsp("id")%>">[<%=rsp("id")%>] <%=rsp("username")%></option>
            <%
			rsp.movenext
			loop
			end if
			rsp.close
			set rsp=nothing%></select></td>
	</tr>
	  <tr>
	    <td class='forumRow' height=30>信息标题</td>
	    <td class='forumRow'><input name='name' type='text' id='name'  size='70' value=''>
</td>
      </tr>
	 <tr>
	    <td class='forumRowHighLight' height=30>信息分类</td>
	    <td class='forumRowHighLight'><label>
	      <select name="type" id="type">
		  <option value="">请选择</option>
	       <% set rsp=server.createobject("adodb.recordset")
		   sql="select id,name from web_info_type "
		   rsp.open(sql),cn,1,1
		   if not rsp.eof and not rsp.bof then
		   do while not rsp.eof 
		   %> <option value="<%=rsp("id")%>" ><%=rsp("name")%></option>
            <%
			rsp.movenext
			loop
			end if
			rsp.close
			set rsp=nothing%></select>
	    </label>
	  <INPUT type=submit value='提交' onClick='javascript:return checksignup1()' name=Submit></td>
      </tr>	<tr>
	  <td class='forumRow' height=23>信息内容 </td>
	  <td class='forumRow'> <textarea name='content' style='display:none' dataType='Require'></textarea>
 <iframe ID='eWebEditor1' src='editor/ewebeditor.htm?id=content&style=coolblue&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename' frameborder='0' scrolling='no' width='100%' HEIGHT='350'></iframe></td>
	</tr>
	  
	  <tr>
	    <td class='forumRowHighLight' height=23><span class="forumRow">是否显示</span></td>
	    <td class='forumRowHighLight'><input type="radio" name="view_yes" value="1" checked>
是
      &nbsp;
      <input name="view_yes" type="radio" value="0" >
否</td>
      </tr>
	  <tr>
	  <td class='forumRow' height=23>是否推荐</td>
	  <td class='forumRow'><label>
	       <input type="radio" name="index_push" value="1">
      是
      &nbsp;
      <input name="index_push" type="radio" value="0" checked>
      否</label></td>
	</tr>
	<tr><td height="50" colspan=2  class='forumRow'><div align="center">
	  <INPUT type=submit value='提交' onClick='javascript:return checksignup1()' name=Submit>
	  </div></td></tr>
	</table>
</form>
<%
Call DbconnEnd()
 %>