NewsEdit.asp
上传用户:dbstep
上传日期:2022-08-06
资源大小:2803k
文件大小:10k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

ASP/ASPX

  1. <HTML xmlns="http://www.w3.org/1999/xhtml">
  2. <HEAD>
  3. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
  4. <TITLE>编辑新闻</TITLE>
  5. <link rel="stylesheet" href="Images/CssAdmin.css">
  6. <script language="javascript" src="../skweb/JS/Admin.js"></script>
  7. </HEAD>
  8. <!--#include file="../skweb/Const.asp" -->
  9. <!--#include file="../skweb/ConnSiteData.asp" -->
  10. <!-- #include file="../fckeditor/fckeditor.asp" -->
  11. <!--#include file="CheckAdmin.asp"-->
  12. <%
  13. if Instr(session("AdminPurview"),"|23,")=0 then 
  14.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  15.   response.end
  16. end if
  17. '========判断是否具有管理权限
  18. %>
  19. <BODY>
  20. <% 
  21. dim Result
  22. Result=request.QueryString("Result")
  23. dim ID,NewsName,ViewFlag,SortName,SortID,SortPath,VoticeFlag,BigPic
  24. dim GroupID,GroupIdName,Exclusive,NoticeFlag,Source,Content
  25. ID=request.QueryString("ID")
  26. call NewsEdit() 
  27. %>
  28.  
  29. <table width="100%" border="0" cellpadding="3"  >
  30.   <form name="editForm" method="post" action="NewsEdit.asp?Action=SaveEdit&Result=<%=Result%>&ID=<%=ID%>">
  31.   <tr>
  32.     <td height="24" nowrap bgcolor="#EBF2F9"><table width="100%" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC" id=editNews idth="100%">
  33.    <tr>
  34.         <td height="29" colspan="2" background="Images/menutitle.gif" bgcolor="#FFFFFF"><table width="470" border="0" cellspacing="0" cellpadding="0">
  35.           <tr>
  36.             <td width="121"><strong><font color="#000000" size="2">新闻管理</font></strong></td>
  37.             <td width="87"><a href="NewsEdit.asp?Result=Add"><img src="Images/x1.gif" width="52" height="17" border="0"></a></td>
  38.             <td width="87"><a href="NewsList.asp"><img src="Images/xlm.gif" width="52" height="17" border="0"></a></td>
  39.             <td width="87"><a href="NewsSort.asp"><img src="Images/xx.gif" width="52" height="17" border="0"></a></td>
  40.             <td width="88">&nbsp;</td>
  41.           </tr>
  42.         </table></td>
  43.       </tr>
  44.       <tr>
  45.         <td height="24" align="right" bgcolor="#FFFFFF">新闻名称:</td>
  46.         <td bgcolor="#FFFFFF"><input name="NewsName" type="text" class="textfield" id="NewsName" style="WIDTH: 240;" value="<%=NewsName%>" maxlength="100">&nbsp;*&nbsp;不少于3个字符
  47.           <input name="ViewFlag" type="checkbox" style='HEIGHT: 13px;WIDTH: 13px;' value="1" <%if ViewFlag then response.write ("checked")%>>&nbsp;显示
  48.           <input name="NoticeFlag" type="checkbox" style="HEIGHT: 13px;WIDTH: 13px;" value="1" <%if NoticeFlag then response.write ("checked")%>>
  49.           &nbsp;公告</td>
  50.       </tr>
  51.       <tr>
  52.         <td height="24" align="right" bgcolor="#FFFFFF">所属类别:</td>
  53.         <td bgcolor="#FFFFFF"><input name="SortID" type="text" class="textfield" id="SortID" style="WIDTH: 40;background-color:#EBF2F9;" value="<%=SortID%>" readonly>&nbsp;<input name="SortPath" type="text" class="textfield" id="SortPath" style="WIDTH: 80;background-color:#EBF2F9;" value="<%=SortPath%>" readonly>&nbsp;<input name="SortName" type="text" class="textfield" id="SortName" value="<%=SortName%>" style="WIDTH: 140;background-color:#EBF2F9;" readonly>&nbsp;<a href="javaScript:OpenScript('SelectSort.asp?Result=News',500,500,'')"><img src="Images/Select.gif" width="30" height="16" border="0" align="absmiddle"></a></td>
  54.       </tr>
  55.       <tr>
  56.         <td height="24" align="right" bgcolor="#FFFFFF">新闻来源:</td>
  57.         <td bgcolor="#FFFFFF"><input name="Source" type="text" class="textfield" style="WIDTH: 240;" value="<%=Source%>" maxlength="100"></td>
  58.       </tr>
  59.       <tr>
  60.         <td height="24" align="right" bgcolor="#FFFFFF">查看权限:</td>
  61.         <td bgcolor="#FFFFFF"><select name="GroupID" class="textfield">
  62.           <% call SelectGroup() %>
  63.           </select>
  64.           <input name="Exclusive" type="radio" value="&gt;="  <%if Exclusive="" or Exclusive=">=" then response.write ("checked")%>> 隶属<input type="radio"  <%if Exclusive="=" then response.write ("checked")%> name="Exclusive" value="=">专属&nbsp;[隶属:权限值≥可查看,专属:权限值=可查看]</td>
  65.       </tr>
  66.   <tr>
  67.         <td height="24" align="right" bgcolor="#FFFFFF">新闻主图:</td>
  68.         <td bgcolor="#FFFFFF"><input name="BigPic" type="text" class="textfield" style="WIDTH: 240;" value="<%=BigPic%>" maxlength="100">&nbsp;<a href="javaScript:OpenScript('UpFileForm.asp?Result=BigPic',460,180)"><img src="Images/Upload.gif" width="30" height="16" border="0" align="absmiddle"></a></td>
  69.       </tr>
  70.       <tr>
  71.         <td height="24" align="right" bgcolor="#FFFFFF">首页标记:</td>
  72.         <td bgcolor="#FFFFFF"><input name="VoticeFlag" type="checkbox" id="VoticeFlag" style="HEIGHT: 13px;WIDTH: 13px;" value="1" <%if VoticeFlag then response.write ("checked")%>>
  73. &nbsp;&nbsp;首页标记要在首页显示FLASH图片必须选上</td>
  74.       </tr>
  75.    <tr>
  76.         <td height="24" align="right" bgcolor="#FFFFFF">备注说明:</td>
  77.         <td bgcolor="#FFFFFF"><font color="red">上传文件必须是JPEG格式,宽为360PX 高180px 以首页合协处理</font></td>
  78.       </tr>
  79.       <tr>
  80.         <td height="24" align="right" valign="top" bgcolor="#FFFFFF">信息内容:<br>
  81.         <td bgcolor="#FFFFFF"><%
  82. Dim oFCKeditor
  83. Set oFCKeditor = New FCKeditor
  84. oFCKeditor.BasePath = "../fckeditor/" 
  85. oFCKeditor.ToolbarSet = "Default" 
  86. oFCKeditor.Width = "100%" 
  87. oFCKeditor.Height = "400" 
  88. oFCKeditor.Value = content
  89. oFCKeditor.Create "Content" 
  90. %></td>
  91.       </tr>
  92.       <tr>
  93.         <td height="30" align="right" bgcolor="#FFFFFF">&nbsp;</td>
  94.         <td valign="bottom" bgcolor="#FFFFFF"><input name="submitSaveEdit" type="submit" class="button"  id="submitSaveEdit" value="保存" style="WIDTH: 80;" ></td>
  95.       </tr>
  96.     </table></td>
  97.   </tr>
  98.   </form>
  99. </table>
  100. </BODY>
  101. </HTML>
  102. <%
  103. sub NewsEdit()
  104.   dim Action,rsRepeat,rs,sql
  105.   Action=request.QueryString("Action")
  106.   if Action="SaveEdit" then '保存编辑产品信息
  107.     set rs = server.createobject("adodb.recordset")
  108.     if len(trim(request.Form("NewsName")))<3 then
  109.       response.write ("<script language=javascript> alert('新闻名称为必填项目!');history.back(-1);</script>")
  110.       response.end
  111.     end if
  112.     if Result="Add" then '创建产品信息
  113.   sql="select * from sk_News"
  114.       rs.open sql,conn,1,3
  115.       rs.addnew
  116.       rs("NewsName")=trim(Request.Form("NewsName"))
  117.   if Request.Form("ViewFlag")=1 then
  118.         rs("ViewFlag")=Request.Form("ViewFlag")
  119.   else
  120.         rs("ViewFlag")=0
  121.   end if
  122.   if Request.Form("SortID")="" and Request.Form("SortPath")="" then
  123.         response.write ("<script language=javascript> alert('请选择所属分类!');history.back(-1);</script>")
  124.         response.end
  125.   else
  126.     rs("SortID")=Request.Form("SortID")
  127. rs("SortPath")=Request.Form("SortPath")
  128.   end if
  129.   rs("Source")=trim(Request.Form("Source"))
  130.   if Request.Form("NoticeFlag")=1 then
  131.         rs("NoticeFlag")=Request.Form("NoticeFlag")
  132.   else
  133.         rs("NoticeFlag")=0
  134.   end if
  135.       GroupIdName=split(Request.Form("GroupID"),"┎╂┚")
  136.   rs("GroupID")=GroupIdName(0)
  137.   rs("Exclusive")=trim(Request.Form("Exclusive"))
  138.      rs("BigPic")=trim(Request.Form("BigPic"))
  139.   if Request.Form("VoticeFlag")=1 then
  140.         rs("VoticeFlag")=Request.Form("VoticeFlag")
  141.   else
  142.         rs("VoticeFlag")=0
  143.   end if
  144.   rs("Content")=trim(Request.Form("Content"))
  145.   rs("AddTime")=now()
  146. end if  
  147. if Result="Modify" then '修改产品信息
  148.       sql="select * from sk_News where ID="&ID
  149.       rs.open sql,conn,1,3
  150.       rs("NewsName")=trim(Request.Form("NewsName"))
  151.   if Request.Form("ViewFlag")=1 then
  152.         rs("ViewFlag")=Request.Form("ViewFlag")
  153.   else
  154.         rs("ViewFlag")=0
  155.   end if
  156.   if Request.Form("SortID")<>"" and Request.Form("SortPath")<>"" then
  157.     rs("SortID")=Request.Form("SortID")
  158. rs("SortPath")=Request.Form("SortPath")
  159.   else
  160.         response.write ("<script language=javascript> alert('请选择所属分类!');history.back(-1);</script>")
  161.         response.end
  162.   end if
  163.   rs("Source")=trim(Request.Form("Source"))
  164.   if Request.Form("NoticeFlag")=1 then
  165.         rs("NoticeFlag")=Request.Form("NoticeFlag")
  166.   else
  167.         rs("NoticeFlag")=0
  168.   end if
  169.       GroupIdName=split(Request.Form("GroupID"),"┎╂┚")
  170.   rs("GroupID")=GroupIdName(0)
  171.   rs("Exclusive")=trim(Request.Form("Exclusive"))
  172.   rs("BigPic")=trim(Request.Form("BigPic"))
  173.   if Request.Form("VoticeFlag")=1 then
  174.         rs("VoticeFlag")=Request.Form("VoticeFlag")
  175.   else
  176.         rs("VoticeFlag")=0
  177.   end if
  178.   rs("Content")=trim(Request.Form("Content"))
  179. end if
  180. rs.update
  181. rs.close
  182.     set rs=nothing 
  183.      Response.Redirect("Tips/news.asp")
  184.   else '提取产品信息
  185. if Result="Modify" then
  186.       set rs = server.createobject("adodb.recordset")
  187.       sql="select * from sk_News where ID="& ID
  188.       rs.open sql,conn,1,1
  189.       if rs.bof and rs.eof then
  190.         response.write ("数据库读取记录出错!")
  191.         response.end
  192.       end if
  193.   NewsName=rs("NewsName")
  194.   ViewFlag=rs("ViewFlag")
  195.   SortName=SortText(rs("SortID"))
  196.   SortID=rs("SortID")
  197.   SortPath=rs("SortPath")
  198.   Source=rs("Source")
  199.   NoticeFlag=rs("NoticeFlag")
  200.   GroupID=rs("GroupID")
  201.   Exclusive=rs("Exclusive")
  202.   BigPic=rs("BigPic")
  203.   VoticeFlag=rs("VoticeFlag")
  204.       Content=rs("Content")
  205.   rs.close
  206.       set rs=nothing 
  207.     end if
  208.   end if
  209. end sub
  210. %>
  211. <% 
  212. sub SelectGroup()
  213.   dim rs,sql
  214.   set rs = server.createobject("adodb.recordset")
  215.   sql="select GroupID,GroupName from sk_MemGroup"
  216.   rs.open sql,conn,1,1
  217.   if rs.bof and rs.eof then
  218.     response.write("未设组别")
  219.   end if
  220.   while not rs.eof
  221.     response.write("<option value='"&rs("GroupID")&"┎╂┚"&rs("GroupName")&"'")
  222.     if GroupID=rs("GroupID") then response.write ("selected")
  223.     response.write(">"&rs("GroupName")&"</option>")
  224.     rs.movenext
  225.   wend
  226.   rs.close
  227.   set rs=nothing
  228. end sub
  229. %>
  230. <%
  231. '生成所属类别--------------------------
  232. Function SortText(ID)
  233.   Dim rs,sql
  234.   Set rs=server.CreateObject("adodb.recordset")
  235.   sql="Select * From sk_NewsSort where ID="&ID
  236.   rs.open sql,conn,1,1
  237.   SortText=rs("SortName")
  238.   rs.close
  239.   set rs=nothing
  240. End Function
  241. %>