📄 clistpaginationpageurltag.java
字号:
package org.jahia.taglibs.pagination;import org.jahia.data.JahiaData;import org.jahia.data.containers.JahiaContainerList;import org.jahia.data.containers.JahiaContainerListPagination;import org.jahia.exceptions.JahiaException;import org.jahia.services.usermanager.JahiaUser;import org.jahia.taglibs.container.ContainerListTag;import org.jahia.taglibs.button.AbstractButtonTag;import org.jahia.taglibs.util.Utils;import org.jahia.utils.JahiaConsole;import java.io.*;import java.util.*;import javax.servlet.*;import javax.servlet.http.*;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;/** * Get the page number returned from the enclosing CListPaginationTag.getPageNumber() and generate the URL for this page number. * * @author NK * @version 1.0 */public class CListPaginationPageUrlTag extends AbstractButtonTag { private JahiaContainerList containerList = null; private JahiaContainerListPagination cPagination = null; private CListPaginationTag cPaginationTag = null; private String title = ""; private String style = ""; private String method = "get"; private String formName = ""; public void setTitle(String title) { this.title = title; } public void setStyle(String style) { this.style = style; } public void setMethod(String method) { if ( method != null ) { this.method = method; } } public void setFormName(String formName) { if ( formName != null ) { this.formName = formName.trim(); } } public String getTitle() { return this.title; } public String getStyle() { return this.style; } public String getMethod() { return this.method; } public String getFormName() { return this.formName; } public boolean testRights (JahiaData jData) { cPaginationTag = (CListPaginationTag) findAncestorWithClass(this,CListPaginationTag.class); if ( cPaginationTag == null ){ return false; } ContainerListTag parent = (ContainerListTag) findAncestorWithClass(this,ContainerListTag.class); if (parent != null) { this.containerList = parent.getContainerList(); if ( this.containerList != null ){ this.cPagination = this.containerList.getCtnListPagination(); if ( this.cPagination != null && this.cPagination.isValid()) { return true; } } } return false; } public String getLauncher(JahiaData jData) throws JahiaException { this.title = String.valueOf(cPaginationTag.getPageNumber()); String value = jData.gui().drawContainerListWindowPageURL( containerList, cPaginationTag.getPageNumber(), this.method.equals("post") ); if ( value != null && this.method.equals("post") ) { StringBuffer buff = new StringBuffer("javascript:changePage(document."); buff.append(getFormName()); buff.append(",document."); buff.append(getFormName()); buff.append(".ctnscroll_"); buff.append(containerList.getDefinition().getName()); buff.append(",'"); buff.append(value); buff.append("');"); value = buff.toString(); } return value; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -