📄 guibean.java
字号:
if ( scrollingValueOnly ){ return paramValue; } /** @todo this is really ugly... let's remember to clean it up... */ String cacheStatus = jParams.getCacheStatus(); jParams.setCacheStatus(ParamBean.CACHE_OFFONCE); String curPageURL = jParams.composePageUrl(jParams.getPageID()); jParams.setCacheStatus(cacheStatus); curPageURL += "/" + paramName + "/" + paramValue; return curPageURL; } public String drawSearchUrl() throws JahiaException { return drawUrl( "search", null ); } // end drawSearchUrl public String drawSiteMapUrl() throws JahiaException { return drawUrl( "sitemap", null ); } // end drawSiteMapUrl /*** * drawAdministrationLauncher * MJ 21.03.2001 * */ public String drawAdministrationLauncher() throws JahiaException { return jParams.getResponse().encodeURL(jParams.getRequest().getContextPath() + Jahia.getInitAdminServletPath() + "?do=passthru"); } // end drawAdministrationLauncher /*** * drawUrl * EV 15.12.2000 * */ private String drawUrl( String engineName, Object theObj ) throws JahiaException { String html = ""; JahiaEngine theEngine = (JahiaEngine) EnginesRegistry.getInstance().getEngine( engineName ); if (theEngine.authoriseRender(jParams)) { html = theEngine.renderLink( jParams, theObj ); } return html; } // end drawUrl /*** * drawUrlCheckAccess * EV 15.12.2000 * */ private String drawUrlCheckWriteAccess( String engineName, Object theObj ) throws JahiaException { String html = ""; JahiaEngine theEngine = (JahiaEngine) EnginesRegistry.getInstance().getEngine( engineName ); if (theEngine.authoriseRender(jParams)) { //Any resource that implement the ACLResourceInterface if (theObj instanceof ACLResourceInterface) { if (ACLResource.checkWriteAccess((ACLResourceInterface)theObj,currentUser, jParams.getSiteID())) { html = theEngine.renderLink( jParams, theObj ); } } //JahiaContainerList if (theObj instanceof JahiaContainerList) { if (((((JahiaContainerList)theObj).getID() == 0) && (jParams.getPage().checkWriteAccess(currentUser))) || (((JahiaContainerList)theObj).checkWriteAccess(currentUser,jParams.getSiteID()))) { html = theEngine.renderLink( jParams, theObj ); } } } return html; } // end drawUrl /*** * drawUsername * JB 25.04.2001 * */ public String drawUsername() throws JahiaException { if (jParams != null) { return currentUser.getUsername(); } else { return ""; } } // end drawUsername /*** * isEditMode * JB 25.04.2001 * */ public boolean isEditMode() throws JahiaException { if (jParams != null) { return jParams.getOperationMode().equals(jParams.EDIT); } else { return false; } } // end isEditMode /*** * isLogged * JB 25.04.2001 * */ public boolean isLogged() throws JahiaException { if (jParams != null) { String theUserName = currentUser.getUsername(); if (!theUserName.equals("guest" )) { return true; } else { return false; } } else { return false; } } // end isLogged /*** * isPageInPath * JB 25.04.2001 * */ public boolean isPageInPath( int destPageID ) throws JahiaException { if (jParams != null) { Enumeration thePath = thePage.getPagePath(); while (thePath.hasMoreElements()) { JahiaPage aPage = (JahiaPage) thePath.nextElement(); if (aPage.getID() == destPageID) { return true; } } } return false; } // end isPageInPath /*** * isPageInPath * JB 25.04.2001 * */ public boolean isPageInPath( int destPageID, int levels ) throws JahiaException { if (jParams != null) { Enumeration thePath = thePage.getPagePath(levels); while (thePath.hasMoreElements()) { JahiaPage aPage = (JahiaPage) thePath.nextElement(); if (aPage.getID() == destPageID) { return true; } } } return false; } // end isPageInPath /*** * isNS * JB 16.05.2001 * */ public boolean isNS(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "Mozilla" ) != -1) { if (userAgent.indexOf( "MSIE" ) == -1) { return true; } } } return false; } // end isNS /*** * isNS4 * JB 16.05.2001 * */ public boolean isNS4(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "Mozilla/4" ) != -1) { if (userAgent.indexOf( "MSIE" ) == -1) { return true; } } } return false; } // end isNS4 /*** * isNS6 * JB 16.05.2001 * */ public boolean isNS6(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "Mozilla/5" ) != -1) { return true; } } return false; } // end isNS6 /*** * isIE * JB 16.05.2001 * */ public boolean isIE(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "MSIE" ) != -1) { return true; } } return false; } // end isIE /*** * isIE4 * JB 16.05.2001 * */ public boolean isIE4(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "MSIE 4" ) != -1) { return true; } } return false; } // end isIE4 /*** * isIE5 * JB 16.05.2001 * */ public boolean isIE5(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "MSIE 5" ) != -1) { return true; } } return false; } // end isIE5 /*** * isIE6 * JB 16.05.2001 * */ public boolean isIE6(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "MSIE 6" ) != -1) { return true; } } return false; } // end isIE5 /*** * isWindow * JB 13.11.2001 * */ public boolean isWindow(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "Win" ) != -1) { return true; } } return false; } // end isWindow /*** * isUnix * JB 13.11.2001 * */ public boolean isUnix(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "X11" ) != -1) { return true; } } return false; } // end isUnix /*** * isMac * JB 13.11.2001 * */ public boolean isMac(HttpServletRequest req) throws JahiaException { String userAgent = req.getHeader( "user-agent" ); if (userAgent != null) { if (userAgent.indexOf( "Mac" ) != -1) { return true; } } return false; } // end isMac /*** * checkWriteAccess * JB 25.04.2001 * */ public boolean checkWriteAccess() throws JahiaException { if (thePage.checkWriteAccess( currentUser )) { return true; } return false; } // end checkWriteAccess /*** * glueTitle * JB 25.04.2001 * PV 18.06.2001 bug fix * */ public static String glueTitle( String in, int len ) { if (in == null){ return null; } in = JahiaTools.html2text(in); if ( (in.length()) > len && (len > 2)) { in = in.substring( 0, len - 3 ) + "..."; } in = JahiaTools.replacePattern(in," "," "); in = JahiaTools.text2html(in); return in; } // end glueTitle /*** * getLevelID * JB 25.04.2001 * */ public int getLevelID( int level ) throws JahiaException { Enumeration thePath = thePage.getPagePath(); int count_loop = 0; while (thePath.hasMoreElements()) { JahiaPage aPage = (JahiaPage) thePath.nextElement(); count_loop++; if (count_loop == (level)) { return aPage.getID(); } } return -1; } // end getLevelID /*** * getLevel * JB 25.04.2001 * */ public int getLevel() throws JahiaException { Enumeration thePath = thePage.getPagePath(); int count_loop = 0; while (thePath.hasMoreElements()) { JahiaPage aPage = (JahiaPage) thePath.nextElement(); count_loop++; if (aPage.getID() == thePage.getID()) { return count_loop; } } return -1; } // end getLevel /*** * getHomePage, return the site's home page * */ public JahiaPage getHomePage() throws JahiaException { if ( jParams.getSite() == null ) return null; JahiaPageService pageService = ServicesRegistry.getInstance().getJahiaPageService(); // finds origin page JahiaPage originPage = pageService.lookupPage(jParams.getSite().getHomePageID(),jParams); return originPage; } // end getHomePage} // end GuiBean
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -