📄 viewnews.jsp
字号:
<%@page language="java" contentType="text/html;charset=GBK"%>
<%@page import="java.util.*,java.text.*,oa.main.DealString"%>
<%
oa.bean.MainBean myBean =null;
try{
myBean = new oa.bean.MainBean();
DealString ds = new DealString();
//取得菜单类别
String strId1 = ds.toString((String)request.getParameter("txt_type1"));
String strId2 = ds.toString((String)request.getParameter("txt_type2"));
if(strId1.equals(""))strId1 = "1";
if(strId2.equals(""))strId2 = "0";
int intId1 = Integer.parseInt(strId1);
String strMenuName = myBean.toMenu1(strId1);
String strMenuName2 = myBean.toMenu2(strId1,strId2);
String strFileId = ds.toString((String)request.getParameter("txt_fileid"));
if(strFileId.equals(""))strFileId = "0";
String strSub = ds.toString((String)request.getParameter("txt_sub"));
if(strSub.equals("")) strSub="0";
String wtb = "";
if(Integer.parseInt(strSub)>3) wtb = "0";
else wtb = "1";
String strEdit = ds.toString((String)request.getParameter("txt_edit"));
if(strEdit.equals("")) strEdit = "0";
String strmenuid = ds.toString((String)request.getParameter("txt_menuid"));
if(strmenuid.equals("")) strmenuid = "0";
String strtopicid = ds.toString((String)request.getParameter("txt_topicid"));
if(strtopicid.equals("")) strtopicid = "0";
String strsearch = ds.toString((String)request.getParameter("txt_search"));
if(strsearch.equals("")) strsearch="0";
//增加访问次数
//myBean.addTime(strFileId);
String css = (String)session.getAttribute("CSS");
//取得文章编号
String appendix="0";
String ftp = "0";
String pathappendix= oa.main.ParentBean.FilesPath+"news/appendix/";
pathappendix = (new oa.main.DealString()).Replace(pathappendix,"\\","/");
String path= oa.main.ParentBean.FilesPath+"news/img/";
path = (new oa.main.DealString()).Replace(path,"\\","/");
String strftpsite=myBean.getftpsite()+"/";
String strtitle ="";
String strfrom = "";
String strAuthor= "";
String straddtime = "";
String strtimes = "";
String strcontent ="";
String strOrgid = "";
String strpic ="";
String strftp ="";
String strOldOrgid="";
String stredittime="";
if(!strFileId.equals("0"))
{
Hashtable hash = (Hashtable)myBean.getOneNews(strFileId);
strtitle = (String)hash.get("TITLE");
strfrom = (String)hash.get("FROMSITE");
strAuthor= (String)hash.get("AUTHOR");
straddtime = (String)hash.get("ADDTIME");
stredittime = (String)hash.get("EDITTIME");
strtimes = (String)hash.get("TIMES");
strcontent = myBean.getOneContent(strFileId);
//strcontent = strcontent.replaceAll("\\","//");
strOrgid = (String)hash.get("ORGID");
strpic = (String)hash.get("IMG");
strftp = (String)hash.get("FTPFILE");
strOldOrgid=(String)hash.get("OLDORGID");
}
String strOrgids[] = strOrgid.split(",");
String strpics[] = strpic.split(",");
String strftps[] = strftp.split(",");
String strOldOrgids[] = strOldOrgid.split(",");
//取得相关评论
int jc = 0;
Vector vetcom = (Vector)myBean.getRelateCom(strFileId);
jc=vetcom.size();
String strcId[] = new String[jc];//评论编号
String strcContent[] = new String[jc];//评论内容
String strcTime[] = new String[jc];//评论时间
String strcCritic[] = new String[jc];//评论人
for(int ic=0;ic<vetcom.size();ic++)
{
Hashtable hash = (Hashtable)vetcom.get(ic);
strcId[ic] = (String)hash.get("ID");
strcContent[ic] = (String)hash.get("CONTENT");
strcTime[ic] = (String)hash.get("TIME");
strcCritic[ic] = (String)hash.get("CRITIC");
}
//取得相关文章
int rel_len = 0;
Vector rel_rect = (Vector)myBean.getRelateArticle(strFileId);
rel_len=rel_rect.size();
String rel1[] = new String[rel_len];
String rel2[] = new String[rel_len];
String rel3[] = new String[rel_len];
String rel4[] = new String[rel_len];
for(int ic=0;ic<rel_rect.size();ic++)
{
Hashtable hash = (Hashtable)rel_rect.get(ic);
rel1[ic] = (String)hash.get("ID");
rel2[ic] = (String)hash.get("TITLE");
rel3[ic] = (String)hash.get("ADDTIME");
rel4[ic] = (String)hash.get("HITS");
}
//对于已经发布的文章进行特殊处理
String confdir = oa.main.ParentBean.FilesPath;
confdir = (new oa.main.DealString()).Replace(confdir,"\\","/");
String ip = "http://"+request.getServerName();
String port = request.getServerPort()+"";
if(!port.equals("80"))ip+=":"+port;
strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/oa/manage/upload/img/","photo.jsp?photo=");
strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/oa/manage/upload/appendix/",confdir+"news/appendix/");
strcontent = (new oa.main.DealString()).Replace(strcontent,"/temp_sure/","/downloadservlet?type=1&&filename=temp_sure/");
ip = "http://10.0.0.92";
strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/oa/manage/upload/img/","photo.jsp?photo=");
strcontent = (new oa.main.DealString()).Replace(strcontent,ip+"/oa/manage/upload/appendix/",confdir+"news/appendix/");
strcontent = (new oa.main.DealString()).Replace(strcontent,"/temp_sure/","/downloadservlet?type=1&&filename=temp_sure/");
strcontent = (new oa.main.DealString()).Replace(strcontent,"photo="+confdir+"news/img/","photo=");
%>
<link href="../css/child.css" type=text/css rel=stylesheet>
<script language=JavaScript src="../scripts/viewnews.js"></script>
<div align="center">
<table border="0" cellPadding="0" align=center cellSpacing="0" width="790" background="../images/bg01.gif">
<tr width="100%">
<td width="11">
<td valign="top">
<table width="97%" border="0">
<tr><td align=left>当前位置:<%=myBean.getArcPath(strFileId)%> >> 正文</td></tr>
</table>
<table width="98%" border="0" cellpadding=10>
<tr>
<td align="center" bgcolor="#F3F3F3"><font style="font-size:16px"><b><%=strtitle%></b></font></td>
</tr>
<tr>
<td align="right"><font color="#999999">来源:<%=strfrom%><font color="#CC0000"></font>
发布时间:<%=straddtime%></font></td>
</tr>
</table> <br>
<table width="97%" border="0" cellpadding="0" align=right style="word-break:break-all;">
<tr>
<td align=left>
<p><font id="zoom" class="bgword"><%=strcontent%></font></p>
</td>
</tr>
<tr><td align="left">(编辑:<%=strAuthor%>)</td><tr>
<tr><td align="left">(修改:<%=stredittime%>)</td><tr>
<tr><td align="left">(被访问次数:<%=strtimes%>)</td><tr>
<tr>
<td align="right">
<script language=JavaScript>
<!-- Begin if (window.print)
{
document.write('【<a href="#" onClick="javascript:window.print()"><font color=cc0000>打印本文</font></a>】 ');
}
//-->
</script>
<%if(myBean.ifCanCom()){%>【<font color=#cc0000><a onclick="setcomment();" style="cursor:hand;" target=_blank title="对此文章发表评论">发表评论</a></font>】
<%}%>
【<a href="javascript:doZoom(16)"><font color=#cc0000>大</font></a>
<a href="javascript:doZoom(14)"><font color=#cc0000>中</font></a>
<a href="javascript:doZoom(12)"><font color=#cc0000>小</font></a>】
【<a href="javascript:window.close()"><font color=#cc0000>关闭窗口</font></a>】</td>
</tr>
<tr><td>
<table bgcolor="#F3F3F3" cellpadding=5 cellspacing=1 width="100%" align=left style="word-break:break-all;">
<tbody>
<tr align=left>
<td bgcolor="#F3F3F3">【 附 件 下 载 】</td>
</tr>
</tbody>
</table>
</td></tr>
<tr><td align=left><%
for (int i=0;i<strOrgids.length&&i<strOldOrgids.length;i++){
// out.print(strOldOrgids[i]);
if((!strOrgids[i].equals(""))&&(!strOldOrgids[i].equals(""))){
%>
<a href="../../articledownloadservlet?newname=<%=strOrgids[i]%>&newfile=<%=strOldOrgids[i]%>"><%=strOldOrgids[i]%></a></font>
<%
}
}
%>
</tr></td>
<tr><td>
<table bgcolor="#F3F3F3" cellpadding=5 cellspacing=1 width="100%" align=left>
<tbody>
<tr align=left>
<td bgcolor="#F3F3F3">【 F T P 下 载 】</td>
</tr>
</tbody>
</table>
</td></tr>
<tr><td>
<%
if(!ftp.equals("0")){%>
<table>
<tr>
<td align=left>
<%for(int i=0;i<strftps.length;i++)
{
if(!strftps[i].equals(""))
{
ftp="1";
%>
<li><a href=<%=strftpsite%><%=strftps[i]%>>下载<%=i+1%></a></li>
<%}
}%>
</td>
</tr>
</table>
<%}%>
</td></tr>
<tr><td>
<table bgcolor="#F3F3F3" cellpadding=5 cellspacing=1 width="100%" align=left>
<tbody>
<tr align=left>
<td bgcolor="#F3F3F3">【 相 关 文 章 】</td>
</tr>
<tr>
<td bgcolor=#ffffff>
</td>
</tr>
</tbody>
</table>
</td></tr>
<%if(rel_len!=0){%>
<tr><td>
<table bgcolor=#cccccc cellpadding=5 cellspacing=1 width="100%" align=left>
<tbody>
<tr>
<td bgcolor=#ffffff align=left>
<%for(int kc=0;kc<rel_len;kc++){%>
<li> <a onclick="view('<%=rel1[kc]%>');" target="_blank" style="cursor:hand;" title="<%=rel4[kc]%>"><%=rel2[kc]%></a><font color="#616161"> (<%=rel3[kc]%>)</font>
</li>
<%}%>
</td>
</tr>
</tbody>
</table>
</td></tr>
<%}%>
<tr><td>
<table bgcolor="#F3F3F3" cellpadding=5 cellspacing=1 width="100%" align=left>
<tbody>
<tr align=left>
<td bgcolor="#F3F3F3">【 相 关 评 论 】</td>
</tr>
<tr>
<td bgcolor=#ffffff>
</td>
</tr>
</tbody>
</table>
</td></tr>
<%if(jc!=0){%>
<tr><td>
<table bgcolor=#cccccc cellpadding=5 cellspacing=1 width="100%" align=left>
<tbody>
<tr>
<td bgcolor=#ffffff align=left>
<li> <a onclick="viewcom('');" target="_blank" style="cursor:hand;">查看评论</a>
</li>
</td>
</tr>
</tbody>
</table>
</td></tr>
<%}%>
</table>
</td>
<td width="150" valign="top" bgcolor="#F3F3F3">
<TABLE cellSpacing=0 cellPadding=0 width=172 border=0>
<TBODY>
<TR><TD vAlign=top align=right><IMG height=26 src="../images/search.gif" width=172></TD></TR>
<TR><TD vAlign=top align=middle>
<TABLE width=123 border=0>
<TBODY>
<TR><TD align=middle><INPUT class=inputter size=16 value="关键字:" name="keyword"></TD></TR>
<TR><TD align=middle>
<select style="WIDTH: 123px" name=select2>
<option value="1" selected>标题</option>
<option value="2">关键字</option>
</select>
</TD></TR>
<TR><TD align=middle>
<SELECT style="WIDTH: 123px" name="s2">
<option value="all" selected>所有时间</option>
<option value="1">昨天以来</option>
<option value="3">3 天以来</option>
<option value="7">7 天以来</option>
<option value="15">15天以来</option>
<option value="30">30天以来</option>
<option value="60">60天以来</option>
<option value="90">90天以来</option>
</SELECT>
</TD></TR>
<TR><TD align=right height=25><IMG style="cursor:hand;" height=17 src="../images/index_top_search.gif" width=49 onclick="search(form1)"></TD></TR>
</TBODY>
</TABLE>
</TD></TR>
</table>
</td>
<td width="11"></td>
</tr>
</table>
</div>
<input type=hidden name=comtitle value="">
<script>
function setcomment()
{
document.all.txt_type1.value = "<%=strId1%>";
document.all.txt_type2.value = "<%=strId2%>";
document.all.txt_fileid.value = "<%=strFileId%>";
document.all.txt_edit.value = "1";
document.all.txt_menuid.value = "1";
document.all.txt_topicid.value = "";
document.all.txt_search.value = "";
document.all.comtitle.value="<%=strtitle%>";
document.all.form1.action = "index.jsp";
document.all.form1.submit();
}
function view(id)
{
document.all.txt_type1.value = "<%=strId1%>";
document.all.txt_type2.value = "<%=strId2%>";
document.all.txt_fileid.value = id;
document.all.txt_edit.value = "";
document.all.txt_menuid.value = "";
document.all.txt_topicid.value = "";
document.all.txt_search.value = "";
//document.all.form1.action = "index.jsp";
//document.all.form1.submit();
var hWnd = window.open("index.jsp?txt_fileid="+id+"&txt_type1="+document.all.txt_type1.value+"&txt_type2="+document.all.txt_type2.value,"help");
hWnd.focus();
}
function search(theform)
{
document.all.txt_type1.value = "<%=strId1%>";
document.all.txt_type2.value = "<%=strId2%>";
document.all.txt_fileid.value = "";
document.all.txt_edit.value = "";
document.all.txt_menuid.value = "";
document.all.txt_topicid.value = "";
document.all.txt_search.value = "search.jsp?s1=1&s2=all&keyword="+theform.keyword.value;
document.all.form1.action = "index.jsp";
document.all.form1.submit();
}
function viewcom()
{
document.all.comtitle.value="<%=strtitle%>";
var go = "com.jsp?id=<%=strFileId%>";
var oawin = window.open(go,"_blank","height=350,width=600,scrollbars=yes,resizable=yes,left=200,top=200'");
oawin.focus();
oawin.opener=window;
}
function doZoom(size)
{
document.getElementById('zoom').style.fontSize=size+'px'
}
</script>
<%}finally{
if(myBean!=null)myBean.closeConn();
}%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -