1 package org.jahia.deprecated.taglibs.pagination; 2 3 import javax.servlet.jsp.JspException ; 4 5 import org.jahia.data.JahiaData; 6 import org.jahia.data.containers.JahiaContainerList; 7 import org.jahia.data.containers.JahiaContainerListPagination; 8 import org.jahia.deprecated.taglibs.button.AbstractButtonTag; 9 import org.jahia.deprecated.taglibs.container.ContainerListTag; 10 import org.jahia.exceptions.JahiaException; 11 12 18 19 public class CListPaginationPageUrlTag extends AbstractButtonTag { 20 21 private JahiaContainerList containerList = null; 22 private JahiaContainerListPagination cPagination = null; 23 private CListPaginationTag cPaginationTag = null; 24 25 private String title = ""; 26 private String style = ""; 27 private String method = "get"; 28 private String formName = ""; 29 30 public void setTitle(String title) { 31 this.title = title; 32 } 33 34 public void setStyle(String style) { 35 this.style = style; 36 } 37 38 public void setMethod(String method) { 39 if ( method != null ) 40 { 41 this.method = method; 42 } 43 } 44 45 public void setFormName(String formName) { 46 if ( formName != null ) 47 { 48 this.formName = formName.trim(); 49 } 50 } 51 52 public String getTitle() { 53 return this.title; 54 } 55 56 public String getStyle() { 57 return this.style; 58 } 59 60 public String getMethod() { 61 return this.method; 62 } 63 64 public String getFormName() { 65 return this.formName; 66 } 67 68 public boolean testRights (JahiaData jData) { 69 cPaginationTag = (CListPaginationTag) findAncestorWithClass(this,CListPaginationTag.class); 70 if ( cPaginationTag == null ){ 71 return false; 72 } 73 ContainerListTag parent = (ContainerListTag) findAncestorWithClass(this,ContainerListTag.class); 74 if (parent != null) { 75 this.containerList = parent.getContainerList(); 76 if ( this.containerList != null ){ 77 this.cPagination = this.containerList.getCtnListPagination(); 78 if ( this.cPagination != null && this.cPagination.isValid()) 79 { 80 return true; 81 } 82 } 83 } 84 return false; 85 } 86 87 public String getLauncher(JahiaData jData) throws JahiaException { 88 this.title = String.valueOf(cPaginationTag.getPageNumber()); 89 90 String value = jData.gui().drawContainerListWindowPageURL( containerList, cPaginationTag.getPageNumber(), this.method.equals("post") ); 91 if ( value != null && this.method.equals("post") ) 92 { 93 StringBuffer buff = new StringBuffer ("javascript:changePage(document."); 94 buff.append(getFormName()); 95 buff.append(",document."); 96 buff.append(getFormName()); 97 buff.append(".ctnscroll_"); 98 buff.append(containerList.getDefinition().getName()); 99 buff.append(",'"); 100 buff.append(value); 101 buff.append("');"); 102 value = buff.toString(); 103 } 104 return value; 105 } 106 107 public int doEndTag() throws JspException { 108 containerList = null; 111 cPagination = null; 112 cPaginationTag = null; 113 114 title = ""; 115 style = ""; 116 method = "get"; 117 formName = ""; 118 return EVAL_PAGE; 119 } 120 121 } | Popular Tags |