NewsBrowser.jsp
7.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="java.util.*" %>
<%@page import="weaver.hrm.User"%>
<%@page import="weaver.systeminfo.SystemEnv"%>
<%@ page import="weaver.file.FileUpload" %>
<jsp:useBean id="RecordSet" class="weaver.conn.RecordSet" scope="page" />
<%@ include file="MobileInit.jsp"%>
<HTML>
<HEAD>
<base target="_self">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
<script type='text/javascript' src='/js/jquery/jquery_wev8.js'></script>
</HEAD>
<%
String name = Util.null2String(fu.getParameter("name"));
String publishtype = Util.null2String(fu.getParameter("publishtype"));
String sqlwhere = "";
int ishead = 0;
if(!sqlwhere.equals("")) ishead = 1;
if(!name.equals("")){
if(ishead==0){
ishead = 1;
sqlwhere += " where frontpagename like '%" +name+"%' ";
}
else
sqlwhere += " and frontpagename like '%" +name +"%' ";
}
String sqlstr = "";
if(ishead==0){
ishead = 1;
sqlwhere += " where id != 0 " ;
}
if(!sqlwhere.equals(""))
{
if(!publishtype.equals(""))
{
ishead = 1;
sqlwhere += " and publishtype="+publishtype+" " ;
}
}
else
{
if(!publishtype.equals(""))
{
ishead = 1;
sqlwhere += " where publishtype="+publishtype+" " ;
}
}
int pagenum=Util.getIntValue(fu.getParameter("pagenum"),1);
//int perpage=Util.getIntValue(request.getParameter("perpage"),0);
int perpage=30;
//添加判断权限的内容--new
String temptable = "newstemptable"+ Util.getRandom() ;
String news_SearchSql = "";
//System.out.println("sqlwhere:"+sqlwhere);
if(RecordSet.getDBType().equals("oracle")){
if(user.getLogintype().equals("1")){
news_SearchSql = "create table "+temptable+" as select * from (select id, frontpagename, frontpagedesc from DocFrontpage "+ sqlwhere +" order by id desc) where rownum<"+ (pagenum*perpage+2);
}
}else if(RecordSet.getDBType().equals("mysql")){
if(user.getLogintype().equals("1")){
news_SearchSql = "create table "+temptable+" from (select id, frontpagename, frontpagedesc from DocFrontpage "+ sqlwhere +" order by id desc limit "+(pagenum*perpage+1)+" ) ";
}
}else{
if(user.getLogintype().equals("1")){
news_SearchSql = "select top "+(pagenum*perpage+1)+" id, frontpagename, frontpagedesc into "+temptable+" from DocFrontpage "+ sqlwhere +" order by id desc";
}
}
//添加判断权限的内容--new*/
RecordSet.executeSql(news_SearchSql);
RecordSet.executeSql("Select count(id) RecordSetCounts from "+temptable);
boolean hasNextPage=false;
int RecordSetCounts = 0;
if(RecordSet.next()){
RecordSetCounts = RecordSet.getInt("RecordSetCounts");
}
if(RecordSetCounts>pagenum*perpage){
hasNextPage=true;
}
String sqltemp="";
if(RecordSet.getDBType().equals("oracle")){
sqltemp="select * from (select * from "+temptable+" order by id) where rownum< "+(RecordSetCounts-(pagenum-1)*perpage+1);
}else if(RecordSet.getDBType().equals("mysql")){
sqltemp="select * from "+temptable+" order by id limit "+(RecordSetCounts-(pagenum-1)*perpage)+" ";
}else{
sqltemp="select top "+(RecordSetCounts-(pagenum-1)*perpage)+" * from "+temptable+" order by id";
}
RecordSet.executeSql(sqltemp);
%>
<BODY style="overflow-y: hidden;padding: 0px;margin: 0px;">
<FORM NAME="SearchForm" action="NewsBrowser.jsp" method=post>
<input type="hidden" name="pagenum" value=''>
<input type="hidden" name="publishtype" value='<%=publishtype%>'>
<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
<colgroup>
<col width="10">
<col width="">
<col width="10">
<tr>
<td ></td>
<td valign="top">
<TABLE class=Shadow border="0" height="100%" width="100%">
<tr>
<td valign="top">
<table width=100% class=ViewForm>
<TR>
<TD width=15%><%=SystemEnv.getHtmlLabelName(24256,user.getLanguage())%></TD>
<TD width=85% class=field><input name=name value="<%=name%>" class="inputstyle"></TD>
</TR>
<TR class=Spacing style="height:1px;"><TD class=Line1 colspan=2></TD></TR>
<TR class=separator style="height:1px;"><TD class=Sep1 colspan=2></TD></TR>
</table>
<div style="height: 420px;overflow: auto;width: 100%">
<TABLE ID=BrowseTable class=BroswerStyle cellspacing="0" cellpadding="0" width="100%" >
<TR class=DataHeader>
<TH width=0% style="display:none"><%=SystemEnv.getHtmlLabelName(84,user.getLanguage())%></TH>
<TH> <%=SystemEnv.getHtmlLabelName(195,user.getLanguage())%></TH>
<TH> <%=SystemEnv.getHtmlLabelName(433,user.getLanguage())%></TH>
</TR>
<TR class=Line style="height:1px;"><TH colSpan=3 style="padding:0;"> </TH></TR>
<%
int i=0;
int totalline=1;
if(RecordSet.last()){
do{
String ids = RecordSet.getString("id");
String names = Util.toScreen(RecordSet.getString("frontpagename"),user.getLanguage());
String descs = Util.toScreen(RecordSet.getString("frontpagedesc"),user.getLanguage());
if(i==0){
i=1;
%>
<TR class=DataLight>
<%
}else{
i=0;
%>
<TR class=DataDark>
<%
}
%>
<TD style="display:none"><A HREF=#><%=ids%></A></TD>
<td style="padding-left: 5px"> <%=names%> </TD>
<TD> <%=descs%> </TD>
</TR>
<%
if(hasNextPage){
totalline+=1;
if(totalline>perpage) break;
}
}while(RecordSet.previous());
}
RecordSet.executeSql("drop table "+temptable);
%>
</TABLE>
</div>
<div align="center" style="background:rgb(246, 246, 246);vertical-align: middle;padding-top: 8px;border-top:#dadee5 solid 1px;">
<BUTTON type="button" class=btnSearch onclick="document.SearchForm.submit();" accessKey=S id="searchBtn"><U>S</U>-<%=SystemEnv.getHtmlLabelName(197,user.getLanguage())%></BUTTON>
<BUTTON type="button" class=btn accessKey=2 id="clearBtn" onclick="btnclear_onclick();"><U>2</U>-<%=SystemEnv.getHtmlLabelName(311,user.getLanguage())%></BUTTON>
<BUTTON type="button" class=btnReset accessKey=T id="cancelBtn" onclick="window.parent.close();";><U>T</U>-<%=SystemEnv.getHtmlLabelName(201,user.getLanguage())%></BUTTON>
<%if(pagenum>1){%>
<input type=submit onclick="document.all('pagenum').value=<%=pagenum-1%>;" value="上一页" />
<%}%>
<%if(hasNextPage){%>
<input type=submit onclick="document.all('pagenum').value=<%=pagenum+1%>;" value="下一页"/>
<%}%>
</div>
</td>
</tr>
</TABLE>
</td>
<td></td>
</tr>
<tr>
<td height="10" colspan="3"></td>
</tr>
</table>
</FORM>
</BODY>
</HTML>
<script type="text/javascript">
<!--
function BrowseTable_onmouseover(e){
var e=e||event;
var target=e.srcElement||e.target;
if("TD"==target.nodeName){
jQuery(target).parents("tr")[0].className = "Selected";
}else if("A"==target.nodeName){
jQuery(target).parents("tr")[0].className = "Selected";
}
}
function BrowseTable_onmouseout(e){
var e=e||event;
var target=e.srcElement||e.target;
var p;
if(target.nodeName == "TD" || target.nodeName == "A" ){
p=jQuery(target).parents("tr")[0];
if( p.rowIndex % 2 ==0){
p.className = "DataDark";
}else{
p.className = "DataLight";
}
}
}
function BrowseTable_onclick(e){
var e=e||event;
var target=e.srcElement||e.target;
if( "TD"==target.nodeName||"A"==target.nodeNmae){
window.parent.returnValue = {id:$($(target).parents("tr")[0].cells[0]).text(),name:$($(target).parents("tr")[0].cells[1]).text()};
window.parent.close();
}
}
jQuery(document).ready(function(){
jQuery("#BrowseTable").bind("click",BrowseTable_onclick);
jQuery("#BrowseTable").bind("mouseover",BrowseTable_onmouseover);
jQuery("#BrowseTable").bind("mouseout",BrowseTable_onmouseout);
})
function btnclear_onclick(){
window.parent.returnValue = {id:"",name:""};
window.parent.close()
}
//-->
</script>