Changeset 7394 for trunk/www/main.jsp
- Timestamp:
- Jun 9, 2017, 2:23:58 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/main.jsp
r7114 r7394 37 37 import="net.sf.basedb.core.News" 38 38 import="net.sf.basedb.core.ItemQuery" 39 import="net.sf.basedb.core.ItemResult List"39 import="net.sf.basedb.core.ItemResultIterator" 40 40 import="net.sf.basedb.core.query.Orders" 41 41 import="net.sf.basedb.core.query.Hql" … … 78 78 String broadcastMessage = (String)application.getAttribute("broadcast.message"); 79 79 boolean denyLogin = Boolean.TRUE.equals(application.getAttribute("broadcast.deny-login")); 80 ItemResult List<News> news = null;80 ItemResultIterator<News> news = null; 81 81 JspContext jspContext = ExtensionsControl.createContext(dc, pageContext); 82 82 ExtensionsInvoker<LoginFormAction> invoker = (ExtensionsInvoker<LoginFormAction>)ExtensionsControl.useExtensions(jspContext, "net.sf.basedb.clients.web.login-form"); … … 242 242 { 243 243 %> 244 <div class="item ">244 <div class="item note sticky"> 245 245 <div class="headline"> 246 <base:icon image="warning.png" />247 246 <span class="date"><%=dateFormatter.format(new Date())%></span> 248 247 <%=HTML.encodeTags(broadcastTitle)%><%=denyLogin ? " (login disabled)" : "" %> … … 254 253 255 254 ItemQuery<News> query = News.getQuery(); 255 query.order(Orders.desc(Hql.property("sticky"))); 256 256 query.order(Orders.desc(Hql.property("newsDate"))); 257 257 query.order(Orders.desc(Hql.property("id"))); 258 258 query.setCacheResult(true); 259 259 query.setReturnTotalCount(true); 260 query.setMaxResults(10); 261 news = query.list(dc); 262 for (News n : news) 263 { 264 %> 265 <div class="item"> 260 news = query.iterate(dc); 261 int numListed = 0; 262 while (news.hasNext()) 263 { 264 News n = news.next(); 265 if (numListed >= 10 && !n.isSticky()) break; 266 %> 267 <div class="item <%=n.isSticky() ? "note sticky" : ""%>"> 266 268 <div class="headline"> 267 269 <span class="date"><%=dateFormatter.format(n.getNewsDate())%></span> … … 271 273 </div> 272 274 <% 273 } 274 if (news.getTotalCount() > 10) 275 numListed++; 276 } 277 if (numListed < news.getTotalCount()) 275 278 { 276 279 %> 277 280 <base:icon image="bullet.png" /><a href="info/news.jsp" 278 title="Show older news..."><%=news.getTotalCount()- 10%> more</a>281 title="Show older news..."><%=news.getTotalCount()-numListed%> more</a> 279 282 <% 280 283 }
Note: See TracChangeset
for help on using the changeset viewer.