1 5 6 package com.raptus.owxv3.libtags; 7 8 import java.io.IOException ; 9 import java.util.*; 10 11 import javax.servlet.http.*; 12 import javax.servlet.jsp.*; 13 import javax.servlet.jsp.tagext.TagSupport ; 14 15 import org.apache.struts.Globals; 16 import org.apache.struts.action.Action; 17 import org.apache.struts.util.*; 18 19 import com.raptus.owxv3.LoggingManager; 20 import com.raptus.owxv3.api.*; 21 import com.raptus.owxv3.api.components.*; 22 import com.raptus.owxv3.modules.base.*; 23 import com.raptus.owxv3.modules.categories.*; 24 25 46 public class TreeBrowserTag extends TagSupport 47 { 48 55 private String treeStyle = "pics"; 56 public String getStyle() { return treeStyle; } 57 public void setStyle(String ts) { this.treeStyle = ts; } 58 59 62 private String treeBeanName = "mod_base_publics_index2"; 63 public String getBeanname() { return treeBeanName; } 64 public void setBeanname(String bn) { this.treeBeanName = bn; } 65 66 67 68 69 70 private String cat_linkpfx = "catlink"; 71 public String getCatlinkpfx() { return cat_linkpfx; } 72 public void setCatlinkpfx(String v) { this.cat_linkpfx = v; } 73 74 private String cat_parapfx = "cat"; 75 public String getCatparapfx() { return cat_parapfx; } 76 public void setCatparapfx(String v) { this.cat_parapfx = v; } 77 78 private String pic_close = null; 79 public String getPicclose() { return pic_close; } 80 public void setPicclose(String v) { this.pic_close = v; } 81 82 private String pic_open = null; 83 public String getPicopen() { return pic_open; } 84 public void setPicopen(String v) { this.pic_open = v; } 85 86 private String pic_firstopen = null; 87 public String getPicfirstopen() { return pic_firstopen; } 88 public void setPicfirstopen(String v) { this.pic_firstopen = v; } 89 90 private String pic_firstempty = null; 91 public String getPicfirstempty() { return pic_firstempty; } 92 public void setPicfirstempty(String v) { this.pic_firstempty = v; } 93 94 private String pic_firstclose = null; 95 public String getPicfirstclose() { return pic_firstclose; } 96 public void setPicfirstclose(String v) { this.pic_firstclose = v; } 97 98 private String pic_lastopen = null; 99 public String getPiclastopen() { return pic_lastopen; } 100 public void setPiclastopen(String v) { this.pic_lastopen = v; } 101 102 private String pic_lastempty = null; 103 public String getPiclastempty() { return pic_lastempty; } 104 public void setPiclastempty(String v) { this.pic_lastempty = v; } 105 106 private String pic_lastclose = null; 107 public String getPiclastclose() { return pic_lastclose; } 108 public void setPiclastclose(String v) { this.pic_lastclose = v; } 109 110 private String pic_l = null; 111 public String getPicl() { return pic_l; } 112 public void setPicl(String v) { this.pic_l = v; } 113 114 private String pic_t = null; 115 public String getPict() { return pic_t; } 116 public void setPict(String v) { this.pic_t = v; } 117 118 private String pic_bar = null; 119 public String getPicbar() { return pic_bar; } 120 public void setPicbar(String v) { this.pic_bar = v; } 121 122 private String pic_blank = null; 123 public String getPicblank() { return pic_blank; } 124 public void setPicblank(String v) { this.pic_blank = v; } 125 126 private String picWidth = "19"; 127 public String getPicwidthr() { return picWidth; } 128 public void setPicwidth(String v) { this.picWidth = v; } 129 130 private String picHeight = "19"; 131 public String getPicheight() { return picHeight; } 132 public void setPicheight(String v) { this.picHeight = v; } 133 134 137 public int doStartTag() throws JspException 138 { 139 try 140 { 141 if(treeStyle.equalsIgnoreCase("pics") || treeStyle.equalsIgnoreCase("pic")) 142 renderPicBasedTreeBrowser(); 143 else if(treeStyle.equalsIgnoreCase("css")) 144 renderCssBasedTreeBrowser(); 145 else if(treeStyle.equalsIgnoreCase("sbb")) 146 renderSbbBasedTreeBrowser(); 147 else 148 LoggingManager.log("Unknown tree style specified.", this); 149 } 150 catch(IOException e) { 151 LoggingManager.log("IOException occured during rendering. " + e.getMessage(), this); 152 } 153 154 return (SKIP_BODY); 155 } 156 157 162 public int doEndTag() throws JspException 163 { 164 return (EVAL_PAGE); 165 } 166 167 170 protected void renderCssBasedTreeBrowser() throws JspException, IOException 171 { 172 HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); 173 HttpSession session = request.getSession(); 174 JspWriter out = pageContext.getOut(); 175 176 CategoryPagedBean treeBean = (CategoryPagedBean) session.getAttribute(treeBeanName); 177 if(treeBean == null) 178 { 179 LoggingManager.log("FAILED to find the treeBean!", this); 180 return; 181 } 182 183 Vector categs = treeBean.getCategories(); Vector catnam = treeBean.getCategoryNames(); Vector stats = treeBean.getFolderStatus(); String currentcat = treeBean.getSelCatID(); String url = treeBean.getURL() + "?"; 188 Hashtable paramValues = treeBean.getValues(); String key = null; 190 String active = ""; 191 GResCategory cats[] = new GResCategory[ categs.size() ]; 192 193 Locale locale = null; 195 String loc = request.getParameter("locale"); 196 if(loc != null) 197 { 198 if(loc.indexOf("_") > 0) 199 locale = new java.util.Locale (loc. substring(0, loc.indexOf("_")), loc.substring(loc.indexOf("_") + 1) ); 200 else 201 locale = new java.util.Locale (loc,""); 202 } 203 else 204 locale = (Locale) session.getAttribute(Globals.LOCALE_KEY); 205 206 MessageResources mr = MessageResources.getMessageResources(com.raptus.owxv3.Constants.OWXRESOURCES); 208 String selcategoryalt = mr.getMessage(locale,"publics.category.alt.selectcat"); 209 String opencloseiconalt = mr.getMessage(locale,"publics.category.alt.openclosefolder"); 210 211 if(categs.size() != catnam.size()) 212 { 213 out.println("Not enough categ names!<br>"); 214 out.flush(); 215 } 216 if(categs.size() != stats.size()) 217 { 218 out.println("Not enough status values!<br>"); 219 out.flush(); 220 } 221 222 for(Enumeration e = paramValues.keys(); e.hasMoreElements() ; ) 224 { 225 key = (String ) e.nextElement(); 226 if(!key.equals("selcatid") && !key.equals("catid") && !key.equals("first") ) 227 url = url + key + "=" + java.net.URLEncoder.encode( (String )paramValues.get(key) ) + "&"; 228 } 229 230 for(int i = 0; i < categs.size(); i++) 232 cats[i] = (GResCategory) categs.elementAt(i); 233 234 for(int i = 0; i < cats.length; i++) 236 { 237 GResCategory cat = (GResCategory) categs.elementAt(i); 238 if(cat == null) 239 continue; 241 if(cat.getCategoryID().equals(currentcat)) 243 active = "-active"; 244 else 245 active = ""; 246 247 out.println("<!-- Category/Style-Css: " + cat.getCategoryID() + " Level: " + cat.getLevel() + " Name: " + (String ) catnam.elementAt(i) + " Selected: " + currentcat + " -->"); 248 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + 249 "' title='" + selcategoryalt + 250 "' class='" + cat_linkpfx + cat.getLevel() + active + "'><p class='" + cat_parapfx + cat.getLevel() + active + "'> " + 251 (String ) catnam.elementAt(i) + " </p></a>"); 252 253 } 255 } 256 257 260 protected void renderPicBasedTreeBrowser() throws JspException, IOException 261 { 262 HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); 263 HttpSession session = request.getSession(); 264 JspWriter out = pageContext.getOut(); 265 266 CategoryPagedBean treeBean = (CategoryPagedBean) session.getAttribute(treeBeanName); 267 if(treeBean == null) 268 { 269 LoggingManager.log("FAILED to find the treeBean!", this); 270 return; 271 } 272 273 Vector categs = treeBean.getCategories(); Vector catnam = treeBean.getCategoryNames(); Vector stats = treeBean.getFolderStatus(); String currentcat = treeBean.getSelCatID(); String url = treeBean.getURL() + "?"; 278 Hashtable paramValues = treeBean.getValues(); String key = null; 280 String active = ""; 281 GResCategory cats[] = new GResCategory[ categs.size() ]; 282 283 Locale locale = null; 285 String loc = request.getParameter("locale"); 286 if(loc != null) 287 { 288 if(loc.indexOf("_") > 0) 289 locale = new java.util.Locale (loc. substring(0, loc.indexOf("_")), loc.substring(loc.indexOf("_") + 1) ); 290 else 291 locale = new java.util.Locale (loc,""); 292 } 293 else 294 locale = (Locale) session.getAttribute(Globals.LOCALE_KEY); 295 296 MessageResources mr = MessageResources.getMessageResources(com.raptus.owxv3.Constants.OWXRESOURCES); 298 String selcategoryalt = mr.getMessage(locale,"publics.category.alt.selectcat"); 299 String opencloseiconalt = mr.getMessage(locale,"publics.category.alt.openclosefolder"); 300 301 if(pic_close == null) pic_close = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.close"); 302 if(pic_open == null) pic_open = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.open"); 303 if(pic_firstopen == null) pic_firstopen = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.firstopen"); 304 if(pic_firstempty == null) pic_firstempty = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.firstempty"); 305 if(pic_firstclose == null) pic_firstclose = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.firstclose"); 306 if(pic_lastopen == null) pic_lastopen = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.lastopen"); 307 if(pic_lastempty == null) pic_lastempty = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.lastempty"); 308 if(pic_lastclose == null) pic_lastclose = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.lastclose"); 309 if(pic_l == null) pic_l = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.l"); 310 if(pic_t == null) pic_t = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.t"); 311 if(pic_bar == null) pic_bar = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.bar"); 312 if(pic_blank == null) pic_blank = RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.image.blank"); 313 314 String wstr = "border=0 align='absmiddle' alt='" + opencloseiconalt + "' width='" + picWidth + "' height='" + picHeight + "'"; 315 String wstr2 = "border=0 align='absmiddle' width='" + picWidth + "' height='" + picHeight + "'"; 316 String img_close = "<img SRC='" + pic_close + "'"+wstr+"> "; 317 String img_open = "<img SRC='" + pic_open + "'"+wstr+"> "; 318 String img_firstopen = "<img SRC='" + pic_firstopen + "'"+wstr+"> "; 319 String img_firstempty = "<img SRC='" + pic_firstempty + "'"+wstr2+"> "; 320 String img_firstclose = "<img SRC='" + pic_firstclose + "'"+wstr+"> "; 321 String img_lastopen = "<img SRC='" + pic_lastopen + "'"+wstr+"> "; 322 String img_lastempty = "<img SRC='" + pic_lastempty + "'"+wstr2+"> "; 323 String img_lastclose = "<img SRC='" + pic_lastclose + "'"+wstr+"> "; 324 String img_l ="<img SRC='" + pic_l + "'"+wstr+">"; 325 String img_t = "<img SRC='" + pic_t + "'"+wstr+">"; 326 String img_bar = "<img SRC='" + pic_bar + "'"+wstr+">"; 327 String img_blank = "<img width=19 height=19 SRC='" + pic_blank + "'" + wstr + ">"; 328 329 if(categs.size() != catnam.size()) 330 { 331 out.println("Not enough categ names!<br>"); 332 out.flush(); 333 } 334 if(categs.size() != stats.size()) 335 { 336 out.println("Not enough status values!<br>"); 337 out.flush(); 338 } 339 340 for(Enumeration e = paramValues.keys(); e.hasMoreElements() ; ) 342 { 343 key = (String ) e.nextElement(); 344 if(!key.equals("selcatid") && !key.equals("catid") && !key.equals("first") ) 345 url = url + key + "=" + java.net.URLEncoder.encode( (String )paramValues.get(key) ) + "&"; 346 } 347 348 for(int i = 0; i < categs.size(); i++) 350 cats[i] = (GResCategory) categs.elementAt(i); 351 352 for(int i = 0; i < cats.length; i++) 354 { 355 GResCategory cat = (GResCategory) categs.elementAt(i); 356 if(cat == null) 357 continue; 359 if(cat.getCategoryID().equals(currentcat)) 361 active = "-active"; 362 else 363 active = ""; 364 365 GResCategory c = cat; Vector res = null; res = new Vector(); for(int l = 0; l < cat.getLevel(); l++) 370 { 371 int parentid = c.getParent(); 372 String stat = ""; 373 374 for(int j = 0; j < cats.length; j++) 376 { 377 if(cats[j].getRowID() == parentid) 378 { 379 stat = (String ) stats.elementAt(j); 380 if( stat.equals("folder_open_last") || stat.equals("folder_open_last_end") ) 381 res.addElement(img_blank); 382 else 383 res.addElement(img_bar); 384 385 c = cats[j]; 387 break; 388 } 389 } 390 } 392 boolean lastlevel = false; 394 if( (i + 1) == cats.length) 395 { 396 lastlevel = true; 397 } 398 else 399 { 400 if( cats[i+1].getLevel() <= cat.getLevel() ) 401 lastlevel = true; 402 } 403 404 out.println("<!-- Category: " + cat.getCategoryID() + " Level: " + cat.getLevel() + " Name: " + (String ) catnam.elementAt(i) + " Selected: " + currentcat + " -->"); 406 for(int j = res.size()-2; j >= 0; j--) 407 out.println( (String ) res.elementAt(j) ); 408 409 if( ((String ) stats.elementAt(i)).equals("folder_open") ) 411 { 412 if(!lastlevel) 413 { 414 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 415 if(cat.getLevel()>0 ) 416 { 417 if(cats[i+1].getLevel() != cat.getLevel()) 418 out.println(img_t+img_open); 419 else 420 out.println(img_t+img_lastopen); 421 } 422 else 423 out.println(img_firstopen); 424 out.println("</a>"); 425 } 426 else 427 { 428 if(cat.getLevel()>0) 429 out.println(img_t+img_lastempty); 430 else 431 out.println(img_firstempty); 432 } 433 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 434 "class='" + cat_linkpfx + cat.getLevel() + active + "' " + 435 "title='" + selcategoryalt + "'>" + 436 (String )catnam.elementAt(i)+"</a><br>"); 437 } 438 439 if(((String )stats.elementAt(i)).equals("folder_close")) 441 { 442 if(!lastlevel) 443 { 444 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 445 if(cat.getLevel() >0) 446 out.println(img_t+img_close); 447 else 448 out.println(img_firstclose); 449 out.println("</a>"); 450 } 451 else 452 { 453 if(cat.getLevel()>0) 454 out.println(img_t+img_lastempty); 455 else 456 out.println(img_firstempty); 457 } 458 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 459 "class='" + cat_linkpfx + cat.getLevel() + active + "' " + 460 "title='" + selcategoryalt + "'>" + 461 (String )catnam.elementAt(i)+"</a><br>"); 462 i = skipSubFolders(i+1, categs, cat); 463 continue; 464 } 465 466 if( ((String )stats.elementAt(i)).equals("folder_open_last") || 468 ((String )stats.elementAt(i)).equals("folder_open_last_end") ) 469 { 470 if(!lastlevel) 471 { 472 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 473 if(cat.getLevel() >0 ) 474 { 475 if(i<cats.length-1) 476 { 477 if(cats[i+1].getLevel()<cat.getLevel()) 478 out.println(img_l+img_lastopen); 479 else 480 out.println(img_l+img_open); 481 } 482 else 483 out.println(img_l+img_lastopen); 484 } 485 else 486 out.println(img_open); 487 488 out.println("</a>"); 489 } 490 else 491 { 492 if(cat.getLevel()>0) 493 out.println(img_l+img_lastempty); 494 else 495 out.println(img_firstempty); 496 } 497 498 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 499 "class='" + cat_linkpfx + cat.getLevel() + active + "' " + 500 "title='" + selcategoryalt + "'>" + 501 (String )catnam.elementAt(i)+"</a><br>"); 502 } 503 504 if( ((String )stats.elementAt(i)).equals("folder_close_last") || 506 ((String )stats.elementAt(i)).equals("folder_close_last_end") ) 507 { 508 if(!lastlevel) 509 { 510 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 511 if(cat.getLevel() >0) 512 out.println(img_l+img_close); 513 else 514 out.println(img_l+img_close); 515 516 out.println("</a>"); 517 } 518 else 519 { 520 if(cat.getLevel()>0) 521 out.println(img_l+img_lastempty); 522 else 523 out.println(img_firstempty); 524 } 525 526 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 527 "class='" + cat_linkpfx + cat.getLevel() + active + "' " + 528 "title='" + selcategoryalt + "'>" + 529 (String )catnam.elementAt(i)+"</a><br>"); 530 i = skipSubFolders(i+1, categs, cat); 531 continue; 532 } 533 } 535 } 536 537 546 protected void renderSbbBasedTreeBrowser() throws JspException, IOException 547 { 548 HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); 549 HttpSession session = request.getSession(); 550 JspWriter out = pageContext.getOut(); 551 552 CategoryPagedBean treeBean = (CategoryPagedBean) session.getAttribute(treeBeanName); 553 if(treeBean == null) 554 { 555 LoggingManager.log("FAILED to find the treeBean!", this); 556 return; 557 } 558 559 Vector categs = treeBean.getCategories(); Vector catnam = treeBean.getCategoryNames(); Vector stats = treeBean.getFolderStatus(); String currentcat = treeBean.getSelCatID(); String url = treeBean.getURL() + "?"; 564 Hashtable paramValues = treeBean.getValues(); String key = null; 566 String active = ""; 567 GResCategory cats[] = new GResCategory[ categs.size() ]; 568 569 Locale locale = null; 571 String loc = request.getParameter("locale"); 572 if(loc != null) 573 { 574 if(loc.indexOf("_") > 0) 575 locale = new java.util.Locale (loc. substring(0, loc.indexOf("_")), loc.substring(loc.indexOf("_") + 1) ); 576 else 577 locale = new java.util.Locale (loc,""); 578 } 579 else 580 locale = (Locale) session.getAttribute(Globals.LOCALE_KEY); 581 582 MessageResources mr = MessageResources.getMessageResources(com.raptus.owxv3.Constants.OWXRESOURCES); 584 String selcategoryalt = mr.getMessage(locale,"publics.category.alt.selectcat"); 585 String opencloseiconalt = mr.getMessage(locale,"publics.category.alt.openclosefolder"); 586 587 String wstr = "border=0 align='absmiddle' alt='" + opencloseiconalt + "' width='" + picWidth + "' height='" + picHeight + "'"; 588 String img_plus = "<img SRC='" + RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.treesbb.plus") + "'"+wstr+">"; 589 String img_minus = "<img SRC='" + RequestUtils.message(pageContext, Action.MESSAGES_KEY, Globals.LOCALE_KEY, "owx.api.components.fc_categories.treesbb.minus") + "'"+wstr+">"; 590 591 if(categs.size() != catnam.size()) 592 { 593 out.println("Not enough categ names!<br>"); 594 out.flush(); 595 } 596 if(categs.size() != stats.size()) 597 { 598 out.println("Not enough status values!<br>"); 599 out.flush(); 600 } 601 602 for(Enumeration e = paramValues.keys(); e.hasMoreElements() ; ) 604 { 605 key = (String ) e.nextElement(); 606 if(!key.equals("selcatid") && !key.equals("catid") && !key.equals("first") ) 607 url = url + key + "=" + java.net.URLEncoder.encode( (String )paramValues.get(key) ) + "&"; 608 } 609 610 for(int i = 0; i < categs.size(); i++) 612 cats[i] = (GResCategory) categs.elementAt(i); 613 614 for(int i = 0; i < cats.length; i++) 616 { 617 GResCategory cat = (GResCategory) categs.elementAt(i); 618 if(cat == null) 619 continue; 621 if(cat.getCategoryID().equals(currentcat)) 623 active = "-active"; 624 else 625 active = ""; 626 627 if(cat.getLevel() != 1) 629 { 630 out.println("<!-- Category/Style-Sbb: " + cat.getCategoryID() + " Level: " + cat.getLevel() + " Name: " + (String ) catnam.elementAt(i) + " Selected: " + currentcat + " -->"); 631 out.println("<table class='kat-tab'><tr>"); 632 out.println("<td class='kat-img'></td><td class='kat-name'>"); 633 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + 634 "' title='" + selcategoryalt + 635 "' class='" + cat_linkpfx + cat.getLevel() + active + "'><p class='" + cat_parapfx + cat.getLevel() + active + "'> " + 636 (String ) catnam.elementAt(i) + " </p></a>"); 637 out.println("</td></tr></table>"); 638 639 continue; } 641 642 boolean lastlevel = false; 644 if( (i + 1) == cats.length) 645 { 646 lastlevel = true; 647 } 648 else 649 { 650 if( cats[i+1].getLevel() <= cat.getLevel() ) 651 lastlevel = true; 652 } 653 654 if( ((String ) stats.elementAt(i)).equals("folder_open") ) 656 { 657 out.println("<table class='kat-tab'><tr>"); 658 if(!lastlevel) 659 { 660 out.println("<td class='kat-img'>"); 661 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 662 out.println(img_minus); 663 out.println("</a></td>"); 664 } 665 else 666 { 667 out.println("<td class='kat-img'>"); 668 out.println(" "); 670 out.println("</td>"); 671 } 672 673 out.println("<td class='kat-name'>"); 674 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 675 "title='" + selcategoryalt + "' " + 676 "class='" + cat_linkpfx + cat.getLevel() + active + "'>" + 677 "<p class='" + cat_parapfx + cat.getLevel() + active + "'>" + 678 (String ) catnam.elementAt(i) + "</a></p>"); 679 out.println("</td></tr></table>"); 680 } 681 682 if(((String )stats.elementAt(i)).equals("folder_close")) 684 { 685 out.println("<table class='kat-tab'><tr>"); 686 if(!lastlevel) 687 { 688 out.println("<td class='kat-img'>"); 689 out.println("<a HREF='" + url + "catid=" + cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 690 out.println(img_plus); 691 out.println("</a></td>"); 692 } 693 else 694 { 695 out.println("<td class='kat-img'>"); 696 out.println(" "); 698 out.println("</td>"); 699 } 700 701 out.println("<td class='kat-name'>"); 702 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 703 "title='" + selcategoryalt + "' " + 704 "class='" + cat_linkpfx + cat.getLevel() + active + "'>" + 705 "<p class='" + cat_parapfx + cat.getLevel() + active + "'>" + 706 (String ) catnam.elementAt(i) + "</a></p>"); 707 out.println("</td></tr></table>"); 708 709 i = skipSubFolders(i+1, categs, cat); 710 continue; 711 } 712 713 if( ((String )stats.elementAt(i)).equals("folder_open_last") || 715 ((String )stats.elementAt(i)).equals("folder_open_last_end") ) 716 { 717 out.println("<table class='kat-tab'><tr>"); 718 if(!lastlevel) 719 { 720 out.println("<td class='kat-img'>"); 721 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 722 out.println(img_minus); 723 out.println("</a></td>"); 724 } 725 else 726 { 727 out.println("<td class='kat-img'>"); 728 out.println(" "); 730 out.println("</td>"); 731 } 732 733 out.println("<td class='kat-name'>"); 734 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 735 "title='" + selcategoryalt + "' " + 736 "class='" + cat_linkpfx + cat.getLevel() + active + "'>" + 737 "<p class='" + cat_parapfx + cat.getLevel() + active + "'>" + 738 (String ) catnam.elementAt(i) + "</a></p>"); 739 out.println("</td></tr></table>"); 740 741 } 742 743 if( ((String )stats.elementAt(i)).equals("folder_close_last") || 745 ((String )stats.elementAt(i)).equals("folder_close_last_end") ) 746 { 747 out.println("<table class='kat-tab'><tr>"); 748 if(!lastlevel) 749 { 750 out.println("<td class='kat-img'>"); 751 out.println("<a HREF='"+url+"catid="+cat.getCategoryID()+"&selcatid="+currentcat+"'>"); 752 out.println(img_plus); 753 out.println("</a></td>"); 754 } 755 else 756 { 757 out.println("<td class='kat-img'>"); 758 out.println(" "); 760 out.println("</td>"); 761 } 762 763 out.println("<td class='kat-name'>"); 764 out.println("<a HREF='" + url + "selcatid=" + cat.getCategoryID() + "' " + 765 "title='" + selcategoryalt + "' " + 766 "class='" + cat_linkpfx + cat.getLevel() + active + "'>" + 767 "<p class='" + cat_parapfx + cat.getLevel() + active + "'>" + 768 (String ) catnam.elementAt(i) + "</a></p>"); 769 out.println("</td></tr></table>"); 770 771 i = skipSubFolders(i+1, categs, cat); 772 continue; 773 } 774 } 776 } 777 778 781 protected int skipSubFolders(int j, Vector categs, GResCategory cat) 782 { 783 while(true) 784 { 785 if(j >= categs.size()) 786 break; 787 788 GResCategory cat1 = (GResCategory)categs.elementAt(j); 789 if(cat1 == null) 790 break; 791 792 if(cat1.getLevel() <= cat.getLevel()) 793 break; 794 795 j++; 796 } 797 798 return(j-1); 799 } 800 801 } 802 803 | Popular Tags |