<!--#include file="sys_top.asp"-->
<!--#include file="inc/class_news.asp" -->
<% dim action,foundErr,errMsg
   action=request("action")
   id=clng(request("id"))
   foundErr=False
   if action="save" then
      title=Encode(trim(request("title")))
	  classid=trim(request("classid"))
	  pathid=","&classid&getPathID(classid)&","
	  author=Encode(trim(request("author")))
	  ctime=trim(request("ctime"))
	  hits=trim(request("hits"))
	  orderid=trim(request("orderid"))
	  picture=trim(request("picture"))
	  detail=CheckPar(request("detail"))
	  iscommend=request("iscommend")
	  isshow=request("isshow")
	  seo_title=Encode(request("seo_title"))
	  seo_keywords=Encode(request("seo_keywords"))
	  seo_description=Encode(request("seo_description"))
	  if title="" then
	      foundErr=true
		  errMsg=errMsg&"<li>新闻标题不能为空</li>"  
	  end if
	  if not isInteger(hits) then
	      foundErr=true
		  errMsg=errMsg&"<li>点击次数必须为整数</li>"  
	  end if
	  if not isInteger(orderid) then
	      foundErr=true
		  errMsg=errMsg&"<li>顺序编号必须为整数</li>"  
	  end if
	  
	  if not isDate(ctime) then
	      foundErr=true
		  errMsg=errMsg&"<li>发布时间日期格式不对</li>"  
	  end if
	  
	  if foundErr then
	     WriteErrMsg()
	     response.End()
	  end if
	  
      dRsOpen rs,"select * from news where id="&id,conn,1,3
	  rs("title")=title
	  rs("classid")=classid
	  rs("author")=author
	  rs("pathid")=pathid
	  rs("ctime")=ctime
	  rs("hits")=hits
	  rs("orderid")=orderid
	  rs("picture")=picture
	  rs("detail")=detail
	  rs("iscommend")=iscommend
	  rs("isshow")=isshow
	  rs("seo_title")=seo_title
	  rs("seo_keywords")=seo_keywords
	  rs("seo_description")=seo_description
	  rs.update
	  dRsClose rs
	  BoxAlert "修改成功","news_list.asp"
	  response.End()
   end if
   
   dRsOpen rs,"select * from news where id="&id,conn,1,1
      seo_title=rs("seo_title")
	  seo_keywords=rs("seo_keywords")
	  seo_description=rs("seo_description")
 %>
<div class="nav"><a href="news_list.asp">新闻列表</a> | 添加新闻 </div>
<form name="myform" method="post" action="?action=save&id=<%=id%>">
<table class="tableStyle2 width1">
     <tr class="title"><td colspan="2">添加新闻</td></tr>
     <tr><td>新闻标题</td><td><input type="text" name="title" size="50" value="<%=rs("title")%>" maxlength="200" /> <font color="#FF0000">*</font></td></tr>
     <tr><td>所属类别</td><td>
     <select name="classid" id="classid"> 
       <%=getAllOption(5,"┣",0) %>
        <script type="text/javascript">
           document.getElementById("classid").value='<%=rs("classid")%>';
       </script>
     </select></td></tr>
      <tr><td>页面标题</td><td><input type="text" name="seo_title" size="60" value="<%=seo_title%>"  maxlength="255"  /><br />浏览器标题显示的内容</td></tr>
     <tr><td>页面关键词</td><td><input type="text" name="seo_keywords" value="<%=seo_keywords%>"  size="60" maxlength="255"  /><br />关键词之间用英文逗号,隔开,3-8个关键词最佳</td></tr>
     <tr><td>页面描述</td><td><textarea name="seo_description" rows="5"  cols="60"><%=seo_description%></textarea><br />255个文字以内最佳</td></tr>
     <tr><td>作者</td><td><input type="text" name="author" maxlength="50" value="<%=rs("author")%>" /></td></tr>
     <tr><td>发布时间</td><td><input type="text" name="ctime" maxlength="50" value="<%=rs("ctime")%>" /></td></tr>
     <tr><td>点击次数</td><td><input type="text" name="hits" size="10" value="<%=rs("hits")%>" maxlength="10" /> <font color="#FF0000">不建议修改</font></td></tr>
     <tr><td>顺序编号</td><td><input type="text" name="orderid" value="<%=rs("orderid")%>" size="10" maxlength="50" /> <font color="#FF0000">从小到大排列，如果相同，后添加的排在前面</font></td></tr>
     <tr><td>新闻推荐</td><td>
         <input type="radio" name="iscommend" id="iscommend1"  value="1" <% if rs("iscommend")=True then%>checked="checked"<% end if%> /><label for="iscommend1">推荐</label>
         <input type="radio" name="iscommend"  value="0" id="iscommend2" <% if rs("iscommend")=False then%>checked="checked"<% end if%>  /><label for="iscommend2">不推荐</label>     </td></tr>
     <tr><td>前台显示</td><td>
          <input type="radio" id="isshow1" name="isshow"  value="1" <% if rs("isshow")=True then%>checked="checked"<% end if%> /><label for="isshow1">显示</label>
          <input type="radio" id="isshow2" name="isshow"  value="0" <% if rs("isshow")=False then%>checked="checked"<% end if%> /><label for="isshow2">不显示</label> </td></tr>
     <tr><td>新闻图片</td><td><input type="text" name="picture" value="<%=rs("picture")%>" size="34"/> 
     <iframe src="upload.asp?inputname=picture" frameborder=0  scrolling=no style="width:295px; height:22px; line-height:22px; vertical-align:middle; border:0px; padding:0px; margin:0px;"></iframe></td></tr>
     <tr><td>详细内容</td><td>
	     <% 
		     editorWidth="100%"
		     editorHeight="700px"
			 editorName="detail"
			 editorValue=rs("detail")
         %>
	     <!--#include file="inc/editor.asp"--></td></tr>
    
    
     <tr><td align="center" colspan="2">
         <input type="submit" value="保存"  class="buttonStyle1"  />&nbsp;&nbsp;&nbsp;&nbsp;
         <input type="reset" value="重置"  class="buttonStyle1"  />
     </td></tr>
</table>
</form>
<!--#include file="sys_foot.asp"-->