comparison src/nabble/view/lib/Shared.java @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children 72765b66e2c3
comparison
equal deleted inserted replaced
-1:000000000000 0:7ecd1a4ef557
1
2 package nabble.view.lib;
3
4 import fschmidt.util.java.HtmlUtils;
5 import fschmidt.util.java.MD5Util;
6 import nabble.model.Init;
7 import nabble.model.ModelHome;
8 import nabble.model.Node;
9 import nabble.model.Person;
10 import nabble.model.Site;
11 import nabble.model.User;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14
15 import javax.servlet.ServletException;
16 import javax.servlet.http.HttpServletRequest;
17 import javax.servlet.http.HttpServletResponse;
18 import java.io.IOException;
19 import java.io.PrintWriter;
20 import java.util.ArrayList;
21 import java.util.List;
22
23
24 public final class Shared {
25 private static final Logger logger = LoggerFactory.getLogger(Shared.class);
26
27 private Shared() {} // never
28
29 public static volatile int javascriptVersion = 102;
30
31 public static final int cssVersion = 29;
32
33 public static String getCssPath() {
34 return "/nabble.css?v="+cssVersion;
35 }
36
37 public static String getJavascriptPath(HttpServletRequest request) {
38 return Jtp.getSite(request) == null? "/Javascript.jtp" : "/template/NamlServlet.jtp?macro=javascript_library";
39 }
40
41 public static String getTabsPath() {
42 return "/util/nabbletabs.js";
43 }
44
45 public static String getJQueryPath() {
46 return "/util/jquery-1.7.2.pack.js";
47 }
48
49 public static String getDropdownJsPath() {
50 return "/util/nabbledropdown-2.4.1.js";
51 }
52
53 public static void head(HttpServletRequest request,HttpServletResponse response)
54 throws IOException
55 {
56 head(request, response, true);
57 }
58
59 public static void head(HttpServletRequest request,HttpServletResponse response, boolean useSiteStyle)
60 throws IOException
61 {
62 if( request.getAttribute("head") != null )
63 return;
64 request.setAttribute("head","x");
65 PrintWriter out = response.getWriter();
66 Site site = Jtp.getSite(request);
67 boolean isApp = site != null && site.getRootNode().getKind() == Node.Kind.APP;
68
69 out.print( "\r\n<link rel=\"stylesheet\" href=\"" );
70 out.print( (Shared.getCssPath()) );
71 out.print( "\" type=\"text/css\" />\r\n" );
72 if (isApp && useSiteStyle) {
73 out.print( "\r\n<link rel=\"stylesheet\" href=\"/template/NamlServlet.jtp?macro=site_style\" type=\"text/css\" />\r\n" );
74 }
75 out.print( "\r\n" );
76 loadJavascript(request, out);
77 out.print( "\r\n" );
78 if (isApp) {
79 out.print( "\r\n<script type=\"text/javascript\">\r\n Nabble.setFontSize();\r\n</script>\r\n" );
80 }
81 out.print( "\r\n" );
82
83 loadAnalytics(request,response);
84 }
85
86 public static void loadJavascript(HttpServletRequest request, PrintWriter out) {
87
88 out.print( "\r\n<script src=\"" );
89 out.print( (getJQueryPath()) );
90 out.print( "\" type=\"text/javascript\"></script>\r\n<script src=\"" );
91 out.print( (getDropdownJsPath()) );
92 out.print( "\" type=\"text/javascript\"></script>\r\n<script src=\"" );
93 out.print( (getJavascriptPath(request)) );
94 out.print( "\" type=\"text/javascript\"></script>\r\n" );
95
96 }
97
98 private static void checkHead(HttpServletRequest request) {
99 if( request.getAttribute("head") == null )
100 throw new RuntimeException("Shared.head not called");
101 }
102
103 public static void minHeader(HttpServletRequest request,HttpServletResponse response)
104 throws IOException, ServletException
105 {
106 minHeader(request,response,null);
107 }
108
109 public static void minHeader(HttpServletRequest request,HttpServletResponse response,Node node)
110 throws IOException, ServletException
111 {
112 minHeader(request, response, node, null);
113 }
114
115 public static void minHeaderGlobal(HttpServletRequest request,HttpServletResponse response)
116 throws IOException, ServletException
117 {
118 Site site = Jtp.getSite(request);
119 if (site == null) {
120 String homepageLink = "<a id=\"homelink\" href=\"" + Jtp.homePage() + "\">Nabble</a>";
121 minHeader(request, response, null, new String[] { homepageLink });
122 PrintWriter out = response.getWriter();
123
124 out.print( "\r\n<script type=\"text/javascript\">\r\n if (Nabble.getParent().nabbleinfo && Nabble.getParent().nabbleinfo.what) {\r\n var home = Nabble.get('homelink');\r\n home.setAttribute('href', '/');\r\n home.innerHTML='Back to ' + Nabble.getParent().nabbleinfo.what;\r\n }\r\n</script>\r\n" );
125
126 } else {
127 Node node = site.getRootNode();
128 String homepageLink = "<a href=\"" + Jtp.url(node) + "\">" + node.getSubjectHtml() + "</a>";
129 minHeader(request, response, null, new String[] { homepageLink });
130 }
131 }
132
133 public static void minHeader(HttpServletRequest request, HttpServletResponse response, Node node, String[] breadcrumbLinks)
134 throws IOException, ServletException
135 {
136 minHeader(request, response, node, breadcrumbLinks, true);
137 }
138
139 public static void minHeader(HttpServletRequest request, HttpServletResponse response, Node node, String[] breadcrumbLinks, boolean embeddedRedirect)
140 throws IOException, ServletException
141 {
142 PrintWriter out = response.getWriter();
143 checkHead(request);
144 Node app = node==null ? null : node.getApp();
145 if (embeddedRedirect)
146 embeddedRedirect(request, out, app);
147
148 out.print( "\r\n<div id=\"notice\" class=\"notice rounded-bottom\"></div>\r\n<div class=\"nabble\" id=\"nabble\">\r\n <div class=\"top-bar\">\r\n <div class=\"breadcrumbs\" style=\"float:left;\">\r\n " );
149
150 if (app != null)
151 breadcrumb(request,out,app);
152 else if (breadcrumbLinks != null)
153 breadcrumb(out,breadcrumbLinks);
154
155 out.print( "\r\n</div>\r\n<div style=\"text-align:right;\">\r\n<span style=\"white-space:nowrap;\" id=\"nabble-user-header\"></span>\r\n<script type=\"text/javascript\">Nabble.userHeader();</script>\r\n</div>\r\n</div>\r\n<div style=\"clear:both;\"></div>\r\n" );
156
157 if (request.getAttribute("search") == null) {
158
159 out.print( "\r\n<script type=\"text/javascript\">\r\n Nabble.deleteCookie(\"query\");\r\n Nabble.deleteCookie(\"searchuser\");\r\n Nabble.deleteCookie(\"searchterms\");\r\n</script>\r\n" );
160
161 }
162 }
163
164 public static void noHeader(HttpServletRequest request,HttpServletResponse response)
165 throws IOException, ServletException
166 {
167 PrintWriter out = response.getWriter();
168
169 out.print( "\r\n<div class=\"nabble\" id=\"nabble\">\r\n" );
170
171 }
172
173 public static void editHeader(String firstText, String secondText, PrintWriter out) {
174
175 out.print( "\r\n<div class=\"second-font shaded-bg-color\" style=\"font-size: 120%;padding: .4em;font-weight:bold\">\r\n " );
176 out.print( (firstText) );
177 out.print( " <span class=\"weak-color\">" );
178 out.print( (secondText == null? "" : "&ndash; " + secondText) );
179 out.print( "</span>\r\n</div>\r\n" );
180
181 }
182
183 public static void helpHeader(HttpServletRequest request,HttpServletResponse response)
184 throws IOException, ServletException
185 {
186 Site site = Jtp.getSite(request);
187 String homepageLink = "<a href=\"/\">" + (site == null? "Nabble":site.getRootNode().getSubjectHtml()) + "</a>";
188 String helpLink = "<a href=\"/help/Index.jtp\">Help</a>";
189 minHeader(request, response, null, new String[] { homepageLink, helpLink });
190 }
191
192 public static void footer(HttpServletRequest request,HttpServletResponse response)
193 throws ServletException, IOException
194 {
195 PrintWriter out = response.getWriter();
196 Site site = Jtp.getSite(request);
197 if( site == null ) {
198
199 out.print( "\r\n<table class=\"footer-table shaded-bg-color\">\r\n <tr>\r\n <td class=\"footer-left\">\r\n <a href=\"" );
200 out.print( (Jtp.homePage()) );
201 out.print( "\" target=\"_top\">Free Forum</a> by Nabble\r\n </td>\r\n </tr>\r\n</table>\r\n" );
202
203 } else {
204
205 out.print( "\r\n<table class=\"footer-table shaded-bg-color\">\r\n <tr>\r\n <td class=\"footer-left\">\r\n <a href=\"" );
206 out.print( (Jtp.homePage()) );
207 out.print( "\" target=\"_top\">Free Forum</a>\r\n by Nabble\r\n </td>\r\n <td class=\"footer-right\">\r\n <a href=\"" );
208 out.print( (Jtp.helpIndexUrl(request,response)) );
209 out.print( "\">Help</a>\r\n </td>\r\n </tr>\r\n</table>\r\n" );
210
211 }
212
213 out.print( "\r\n</div>\r\n" );
214
215 }
216
217 public static void noFooter(HttpServletRequest request,HttpServletResponse response)
218 throws ServletException, IOException
219 {
220 PrintWriter out = response.getWriter();
221
222 out.print( "\r\n</div>\r\n" );
223
224 }
225
226 public static void breadcrumb(HttpServletRequest request,PrintWriter out,Node node)
227 throws ServletException, IOException
228 {
229 List<String> links = new ArrayList<String>();
230 node = node.getApp();
231 while (node != null) {
232 links.add(0, "<a href=\"" + Jtp.path(node) + "\">" + node.getSubjectHtml() + "</a>");
233 node = node.getParent();
234 }
235 String[] array = new String[links.size()];
236 links.toArray(array);
237 breadcrumb(out, array);
238 }
239
240 private static void breadcrumb(PrintWriter out, String[] links)
241 throws ServletException, IOException
242 {
243
244 out.print( "<span class=\"weak-color\" style=\"white-space:nowrap\">" );
245
246 for (String s : links) {
247
248 out.print( (s) );
249
250 boolean isLastString = s.equals(links[links.length-1]);
251 if (!isLastString) {
252
253 out.print( "&nbsp;&rsaquo;&nbsp;" );
254
255 }
256 }
257
258 out.print( "</span>" );
259
260 }
261
262 public static void javascriptRedirect(HttpServletRequest request,HttpServletResponse response,String url)
263 throws IOException, ServletException
264 {
265 javascriptRedirect(request,response,url,null);
266 }
267
268 public static void javascriptRedirect(HttpServletRequest request,HttpServletResponse response,String url,String script)
269 throws IOException, ServletException
270 {
271 javascriptRedirect(request, response, url, script, false);
272 }
273
274 public static void javascriptRedirect(HttpServletRequest request,HttpServletResponse response,String url,String script, boolean leaveEmbedding)
275 throws IOException, ServletException
276 {
277 PrintWriter out = response.getWriter();
278
279 out.print( "\r\n<html>\r\n<head>\r\n <script src=\"" );
280 out.print( (getJQueryPath()) );
281 out.print( "\" type=\"text/javascript\"></script>\r\n <script src=\"" );
282 out.print( (getJavascriptPath(request)) );
283 out.print( "\" type=\"text/javascript\"></script>\r\n " );
284 loadAnalytics(request,response);
285 out.print( "\r\n <script type=\"text/javascript\">\r\n " );
286 out.print( (Jtp.hideNull(script)) );
287 out.print( "\r\n var url = \"" );
288 out.print( (HtmlUtils.javascriptStringEncode(url)) );
289 out.print( "\";\r\n\r\n " );
290 out.print( (leaveEmbedding? "top." : "") );
291 out.print( "location.replace(url);\r\n </script>\r\n</head>\r\n</html>\r\n" );
292
293 }
294
295 /* Rebuilds the embedding iframe and reload the contents.*/
296 public static void restartEmbedding(Node node, HttpServletRequest request, HttpServletResponse response)
297 throws IOException, ServletException
298 {
299 PrintWriter out = response.getWriter();
300
301 out.print( "\r\n<html>\r\n <head>\r\n <script src=\"" );
302 out.print( (getJQueryPath()) );
303 out.print( "\" type=\"text/javascript\"></script>\r\n <script src=\"" );
304 out.print( (getJavascriptPath(request)) );
305 out.print( "\" type=\"text/javascript\"></script>\r\n <script type=\"text/javascript\">\r\n Nabble.restartEmbedding(" );
306 out.print( (node.getId()) );
307 out.print( ",'" );
308 out.print( (node.getSite().getBaseUrl()) );
309 out.print( "');\r\n </script>\r\n </head>\r\n</html>\r\n" );
310
311 }
312
313 public static void showPending(PrintWriter out, Node post) {
314 Node.MailToList mail = post.getMailToList();
315 if (mail == null || !(post.getOwner() instanceof User))
316 return;
317 showPending(out, mail.isPending());
318 }
319
320 public static void showPending(PrintWriter out, boolean isPending) {
321 if (isPending) {
322
323 out.print( "\r\n<img src=\"/images/icon_pending.png\" class=\"image16\" title=\"Pending - this message has not been accepted by the mailing list yet\"/>\r\n" );
324
325 }
326 }
327
328 public static void errorMessage(HttpServletRequest request,HttpServletResponse response,String errorMsg,String prompt)
329 throws ServletException, IOException
330 {
331 if( errorMsg==null )
332 return;
333 PrintWriter out = response.getWriter();
334 errorMsg = HtmlUtils.htmlEncode(errorMsg);
335 int posLinkOpen = errorMsg.indexOf("[link]");
336 if (posLinkOpen >= 0) {
337 int posLinkClose = errorMsg.indexOf("[/link]", posLinkOpen);
338 String url = errorMsg.substring(posLinkOpen+6, posLinkClose);
339 errorMsg = errorMsg.substring(0, posLinkOpen) + "<a href=\"" + url + "\">" + url + "</a>" + errorMsg.substring(posLinkClose+7);
340 }
341
342 out.print( "\r\n<table class=\"error-message\" style=\"width:100%\">\r\n <tr>\r\n <td style=\"padding: .4em; width: 40px;\">\r\n <img src=\"/images/icon_alert.png\" class=\"image32\"/>\r\n </td>\r\n <td style=\"padding: .4em;\">\r\n <strong>" );
343 out.print( (errorMsg) );
344 out.print( "</strong>\r\n " );
345 out.print( (prompt == null? "" : "<div style=\"padding-top:.3em\">" + prompt + "</div>") );
346 out.print( "\r\n </td>\r\n </tr>\r\n</table>\r\n" );
347
348 }
349
350 public static void title(HttpServletRequest request,HttpServletResponse response,String s)
351 throws ServletException, IOException
352 {
353 PrintWriter out = response.getWriter();
354 Site site = Jtp.getSite(request);
355
356 out.print( "\r\n<meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" />\r\n<title>" );
357 out.print( (site == null?"Nabble":site.getRootNode().getSubjectHtml()) );
358 out.print( " - " );
359 out.print( (s) );
360 out.print( "</title>\r\n" );
361
362 head(request,response);
363 }
364
365 private static void loadAnalytics(HttpServletRequest request,HttpServletResponse response)
366 throws IOException
367 {
368 PrintWriter out = response.getWriter();
369 HtmlViewUtils.googleAnalytics(out);
370 }
371
372 public static void analytics(HttpServletRequest request,HttpServletResponse response)
373 throws IOException
374 {
375 PrintWriter out = response.getWriter();
376
377 out.print( "\r\n<script type=\"text/javascript\">\r\n if (Nabble.analytics) Nabble.analytics();\r\n</script>\r\n" );
378
379 }
380
381 public static void postInThreadLink(HttpServletRequest request, PrintWriter out, Node post)
382 throws ServletException, IOException
383 {
384 String topicSubject = Jtp.breakUp(post.getTopic().getSubjectHtml());
385 String postSubject = Jtp.breakUp(post.getSubjectHtml());
386 if( postSubject.endsWith(topicSubject) ) {
387
388 out.print( "<a href=\"" );
389 out.print( (Jtp.path(post)) );
390 out.print( "\">" );
391 out.print( (postSubject) );
392 out.print( "</a>" );
393
394 } else {
395
396 out.print( (topicSubject) );
397 out.print( "</a> &nbsp; (<a href=\"" );
398 out.print( (Jtp.path(post)) );
399 out.print( "\">" );
400 out.print( (postSubject) );
401 out.print( "</a>)" );
402
403 }
404 }
405
406 public static void profileHeading(HttpServletRequest request,PrintWriter out,User user,String heading)
407 {
408
409 out.print( "\r\n<h1>" );
410 out.print( (heading) );
411 out.print( "</h1>\r\n" );
412
413 }
414
415 public static void returnToJs(HttpServletRequest request, HttpServletResponse response)
416 throws IOException, ServletException
417 {
418 returnToJs(null, request, response);
419 }
420
421 public static void returnToJs(Node node, HttpServletRequest request, HttpServletResponse response)
422 throws IOException, ServletException
423 {
424 PrintWriter out = response.getWriter();
425 if (node == null) {
426 Site site = Jtp.getSite(request);
427 if (site != null && site.getRootNode().getKind() == Node.Kind.APP)
428 node = site.getRootNode();
429 }
430
431 out.print( "\r\n<div id=\"return-link\" style=\"margin-top:1em\">\r\n " );
432 if (node != null) {
433 out.print( "\r\n &laquo;\r\n <a href=\"" );
434 out.print( (Jtp.path(node)) );
435 out.print( "\">Return to " );
436 out.print( (node.getSubject()) );
437 out.print( "</a>\r\n " );
438 }
439 out.print( "\r\n</div>\r\n" );
440
441 }
442
443 public static void framedCss(PrintWriter out)
444 {
445
446 out.print( "\r\n<style>\r\nbody {\r\n margin: .8em;\r\n}\r\n</style>\r\n" );
447
448 }
449
450 public static void embeddedRedirect(HttpServletRequest request, PrintWriter out, Node forum)
451 throws IOException
452 {
453 // The embedding URL is stored in the node.embedding_url field.
454 String embeddingUrl = null;
455 for(
456 Node node = forum;
457 embeddingUrl == null && node != null;
458 node = node.getParent()
459 ) {
460 embeddingUrl = node.getEmbeddingUrl();
461 }
462
463 if (embeddingUrl == null)
464 return;
465
466 out.print( "\r\n<script type=\"text/javascript\">\r\n if (!Nabble.isEmbedded) {\r\n var url = top.location.href;\r\n var cidPos = url.indexOf(';cid=');\r\n if (cidPos > 0) {\r\n url = url.substring(0, cidPos);\r\n }\r\n\r\n var posHtml = url.lastIndexOf('.html');\r\n var hash;\r\n " );
467
468 /*
469 If the URL is mapped, we extract the last
470 part, which gives information about the item.
471 For example:
472 https://www.nabble.com/text-p100.html
473 We extract "p100", because we know how to
474 rebuild this URL with this information.
475
476 See JsEmbed.jtp for more details on how to
477 rebuild the URL.
478 */
479
480 out.print( "\r\nif (url.indexOf('?') == -1 && posHtml > 0) {\r\n var posStart = url.lastIndexOf('-');\r\n hash = (posStart > 0)? url.substring(posStart, posHtml):'';\r\n} else {\r\n " );
481
482 /*
483 If the URL is NOT mapped, we have to extract
484 the information after the domain.
485 For example:
486 - http://localhost/forum/NewTopic.jtp?forum=2
487 We extract "forum/NewTopic.jtp?forum=2".
488 */
489
490 out.print( "\r\nhash = url.replace('http://', '');\r\nhash = hash.substring(hash.indexOf('/')+1);\r\nhash = '+' + hash;\r\n}\r\n" );
491
492 /*
493 In order to restore the current hash, I append it to the
494 same string after a pipe separator. This will be restored
495 in the Nabble.getCurrentUrl() function in JsEmbed.jtp.
496 */
497
498 out.print( "\r\nif (top.location.hash) {\r\n hash += '|' + top.location.hash.substring(1);\r\n}\r\nif (Nabble.analytics) Nabble.analytics();\r\ntop.location.replace('" );
499 out.print( (embeddingUrl) );
500 out.print( "' + (hash.length==1?'':'#nabble' + encodeURIComponent(hash)));\r\n}\r\n</script>\r\n" );
501
502 }
503
504 public static String getAvatarImageURL(Person visitor, boolean smallImage) {
505 String imageName = smallImage? ModelHome.AVATAR_SMALL : ModelHome.AVATAR_BIG;
506 String defaultImage = "/images/" + imageName;
507 if( visitor instanceof User ) {
508 User user = (User)visitor;
509 if( user.hasAvatar() )
510 return "/file/a" + user.getId() + '/' + imageName;
511 }
512 return defaultImage;
513 }
514
515 public static String getDefaultAvatarImageURL(boolean smallImage) {
516 String imageName = smallImage? ModelHome.AVATAR_SMALL : ModelHome.AVATAR_BIG;
517 return "/images/" + imageName;
518 }
519
520 public static String simpleBannedMessage(Node app) {
521 StringBuilder builder = new StringBuilder();
522 builder
523 .append("Sorry, but the administrators of this ")
524 .append(Jtp.viewName(app).toLowerCase())
525 .append(" have banned you.\n ");
526 return builder.toString();
527 }
528
529 public static String bannedMessage(Node app, boolean isPost) {
530 StringBuilder builder = new StringBuilder();
531 builder.append(simpleBannedMessage(app));
532 if (isPost)
533 builder.append("You can't post a message here, but you can post in other places.");
534 else
535 builder.append("You can't create a forum here, but you can create in other places.");
536 return builder.toString();
537 }
538
539
540 public static void simplePage(String pageTitle, Node node, String messageTitle, String message, HttpServletRequest request, HttpServletResponse response)
541 throws IOException, ServletException
542 {
543 PrintWriter out = response.getWriter();
544
545 out.print( "\r\n<html>\r\n <head>\r\n <META NAME=\"robots\" CONTENT=\"noindex,nofollow\">\r\n " );
546 title(request, response, pageTitle);
547 out.print( "\r\n <style type=\"text/css\">\r\n div.main-title {\r\n font-size:120%;\r\n font-weight:bold;\r\n margin:1em 0;\r\n padding: .2em;\r\n }\r\n </style>\r\n <script type=\"text/javascript\">\r\n " );
548 /* here I set the next url for the login UI */
549 out.print( "\r\n var loginNextUrl = '" );
550 out.print( (node==null?"/":Jtp.url(node)) );
551 out.print( "';\r\n </script>\r\n </head>\r\n <body>\r\n " );
552
553 if (node == null)
554 minHeaderGlobal(request, response);
555 else
556 minHeader(request, response, node);
557
558 out.print( "\r\n<div class=\"shaded-bg-color rounded second-font main-title\">\r\n " );
559 out.print( (messageTitle) );
560 out.print( "\r\n</div>\r\n" );
561 out.print( (message) );
562 out.print( "\r\n" );
563 if (node != null) {
564 out.print( "\r\n<br><br>&laquo; <a href=\"" );
565 out.print( (Jtp.url(node)) );
566 out.print( "\">Back to " );
567 out.print( (node.getSubjectHtml()) );
568 out.print( "</a>\r\n" );
569 } else {
570 out.print( "\r\n<br>\r\n" );
571 }
572 out.print( "\r\n<br/><br/>\r\n" );
573 footer(request,response);
574 out.print( "\r\n" );
575 analytics(request,response);
576 out.print( "\r\n</body>\r\n</html>\r\n" );
577
578 }
579
580 public static void canonical(HttpServletRequest request, HttpServletResponse response)
581 throws IOException, ServletException
582 {
583 String canonical = Jtp.getCanonicalUrl(request);
584 if (canonical != null) {
585 PrintWriter out = response.getWriter();
586
587 out.print( "\r\n<link rel=\"canonical\" href=\"" );
588 out.print( (canonical) );
589 out.print( "\" />\r\n" );
590
591 }
592 }
593
594 /** (To be used by scripts)
595 * http://tablesorter.com/docs/
596 */
597 public static void tableSorter(PrintWriter out, String sortList)
598 throws IOException, ServletException
599 {
600
601 out.print( "\r\n<link rel=\"stylesheet\" href=\"/util/tablesorter/style.css\" type=\"text/css\" />\r\n<script src=\"/util/tablesorter/jquery.tablesorter.min.js\" type=\"text/javascript\"></script>\r\n<script type=\"text/javascript\">\r\n $(document).ready(function() {\r\n $(\"table.tablesorter\").tablesorter(" );
602 out.print( (sortList) );
603 out.print( ");\r\n });\r\n</script>\r\n" );
604
605 }
606
607 /** (To be used by scripts) */
608 public static void countTableRows(PrintWriter out)
609 throws IOException, ServletException
610 {
611
612 out.print( "\r\n<div id=\"rows\"></div>\r\n<script type=\"text/javascript\">\r\n $(document).ready(function() {\r\n var count = $('tbody tr').size();\r\n $(\"#rows\").html(count + \" rows\");\r\n });\r\n</script>\r\n" );
613
614 }
615 }
616