⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auditnews.jsp

📁 该源码为JSP的开发案例集锦
💻 JSP
字号:
<%@ page contentType="text/html; charset=gb2312" %>
<%@ include file="verify.jsp" %>
<%@ include file="../share/connection.jsp" %>
<%@ include file="../share/function_titlename.jsp" %>
<%@ include file="../share/function.jsp" %>

<html>
<head>
<title>新闻审核</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../jscss/styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
.cell {  border: #A4A4A4 ; border-style: solid; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 1px; border-left-width: 0px}
.cell2 {  border: #A4A4A4 ; border-style: solid; border-top-width: 0px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 0px}

</style>



<%
int flag=0;
String newsid;
String newstitle;
String departid;
String newscontent;
String username;
String usermail;
String userphone;
String adddate;
String departName;
int ispublic;
int level;
int ishtml;
String sqlList;
String sqlDepart;
String sqlNews;
String sqlSaveEdit;
ResultSet rsNews;
ResultSet rsList;
ResultSet rsDepart;
String action=request.getParameter("action");
String actionArray[]={"list","audit","save"};
for(int i=0;i<actionArray.length;i++)
{
if (action.equalsIgnoreCase(actionArray[i]))
 {
   flag=i;
	break;
  }
}
switch(flag)
{
	case 0:
	%>
	
<TABLE width="80%" height=20 
      border=0 align="center" cellPadding=0 cellSpacing=0 background="../images/adminbg.gif" bgColor=#587dbc>
  <TBODY>
    <TR> 
      <TD> <div align="center"><font color="#000000"><strong>审核新闻</strong></font></div></TD>
    </TR>
  </TBODY>
</TABLE>
	
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #003366">
  <tr>
    <td>
      <%
	out.print("等待审核的新闻:<br>");
sqlList="select news_title,news_id,depart_name " 
	+"from cs_news,cs_depart "
	+"where news_departid=depart_id and news_outeraudit=0 "
	+"order by news_adddate desc";
rsList=stm.executeQuery(sqlList);
while(rsList.next())
{
  out.print(rsList.getString("news_title")+"----"+rsList.getString("depart_name"));
  %>
      <a href="auditnews.jsp?action=audit&newsid=<%=rsList.getInt("news_id")%>">审核</a> 
      |||<a href="delnews.jsp?newsid=<%=rsList.getInt("news_id")%>">删除</a>
      <%
  out.print("<br>");
}
	break;  
case 1:


	newsid=request.getParameter("newsid");
	sqlNews="select * from cs_news,cs_user where news_id="+newsid
	+" and news_userid=user_id";
	rsNews=stm.executeQuery(sqlNews);
	if(rsNews.next())
	{
	}
	else
	{
		out.print("error");
		return;
	}
	newscontent=rsNews.getString("news_content");
	newstitle=rsNews.getString("news_title");
	username=rsNews.getString("user_truename");
	usermail=rsNews.getString("user_email");
	userphone=rsNews.getString("user_phone");
	adddate=rsNews.getString("news_adddate");
	departid=rsNews.getString("news_departid");
	ispublic=rsNews.getInt("news_ispublic");
	level=rsNews.getInt("news_level");
	ishtml=rsNews.getInt("news_ishtml");
	sqlDepart="select * from cs_depart where depart_id="+departid;
rsDepart=stm.executeQuery(sqlDepart);
if(rsDepart.next())
{
		departName=rsDepart.getString("depart_name");
}
else
{
	out.print("此新闻无部门");
	return;
}
String sqlattach_News="select * from cs_news_attachfile where news_id="+newsid;
		ResultSet rsattachNews=stm.executeQuery(sqlattach_News);
	%>
    </td>
  </tr>
</table>
<FORM name=frmNewsInfo action='auditnews.jsp?action=save' method=post >
  <TABLE width="80%" height=20 
      border=0 align="center" cellPadding=0 cellSpacing=0 background="../images/adminbg.gif" bgColor=#587dbc>
    <TBODY>
      <TR> 
        <TD> <div align="center"><font color="#000000"><strong>审核新闻</strong></font></div></TD>
      </TR>
    </TBODY>
  </TABLE>
  <table width="80%" align=center cellpadding=3 cellspacing=1 style="border:1px solid #003366">
    <TBODY>
	<tr class="cell"> 
      <TD width=16% class="cell2"><b>标题</b>:<BR> </TD>
	  <TD width=84% class="cell"> <%=newstitle%></TD>
	</TR>
	<TR> 
	  <TD width=16% class="cell2"><strong>所在部门:</strong></TD>
	  <TD class="cell"> <%=departName%> </TD>
	</TR>
	<TR> 
	  <TD class="cell2" ><strong>发布人:</strong></TD>
	  <TD class="cell"><a href='mailto:<%=usermail%>'><%=username%></a></TD>
	</TR>
	<TR> 
	  <TD class="cell2"><strong>电话:</strong></TD>
	  <TD class="cell"><%=userphone%></TD>
	</TR>
	<TR> 
	  <TD class="cell2"><strong>日期:</strong></TD>
	  <TD class="cell"><%=adddate%></TD>
	</TR>
	<TR> 
	  <TD class="cell2"><B>内容</B><BR> </TD>
	  <TD class="cell"> 
	  <%
						  if(ishtml==1)
						  {
						  	out.println(newscontent);	
						}
						else
						{
						  out.println(myTools.nl2br(newscontent));
						  }
	  %>
	  
	  <!--%=newscontent%-->
	  <br>
		<%
		while(rsattachNews.next())
		{
		String attachfile_name=new String();
        String attachfile_name1=new String();
		String attachfile_name2=new String();
		attachfile_name=rsattachNews.getString("attachfile_name");
		attachfile_name1=myTitlename.toUtf8String(attachfile_name);
		%> 
		<a href=<%="../"+rsattachNews.getString("attachfile_path")+"/static_news/"+attachfile_name1%>>

		 <font color="#330099"><u><%=attachfile_name%></u></font>
		  </a>
		  <%
		  }
		  %>
			</TD>
	</TR>
	<TR> 
	  <TD class="cell2"><strong>类型:</strong></TD>
	    <TD align="center" bordercolor="#A4A4A4" class="cell"> 
          <input name="ispublic" type="checkbox" value="1" <%=((ispublic==0)?"":"checked")%>>
          部门新闻 
          <input name="level" type="checkbox" value="1" <%=((level==0)?"":"checked")%>>
          学院首页</TD>
	</TR>
	<TR> 
	  <TD colspan="2" align="center" > <input type="hidden"  name="newsid" value="<%=newsid%>"> 
		<input type=submit value="确 认" name=Submit>
             
       <input type="button" name="Cancel" value="返 回" onClick="history.back()">  </TD>
	</TR>
  </table>

</form>
<%
break;
case 2:
ispublic=Integer.parseInt(((request.getParameter("ispublic")==null)?"0":"1"));
level=Integer.parseInt(((request.getParameter("level")==null)?"0":"1"));
newsid=request.getParameter("newsid");
sqlNews="UPDATE cs_news SET "
	+"news_outeraudit=1,"
	+"news_ispublic="+ispublic+","
	+"news_level="+level+","
	+"news_editby=0,"
	+"news_outeraudit =1 "
	+"where news_id="+newsid;

	if(stm.executeUpdate(sqlNews)==1)
        {
          out.print("审核新闻成功");
        }
}
%>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -