taylor 2004/09/25 23:10:05 Modified: components/page-manager/src/java/org/apache/jetspeed/page/impl CastorXmlPageManager.java Log: patch from Randy Watler to fix nav links (tabs, folders) when using role-based fallback profiling rule Revision Changes Path 1.13 +31 -10 jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/CastorXmlPageManager.java Index: CastorXmlPageManager.java =================================================================== RCS file: /home/cvs/jakarta-jetspeed-2/components/page-manager/src/java/org/apache/jetspeed/page/impl/CastorXmlPageManager.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CastorXmlPageManager.java 17 Sep 2004 20:01:03 -0000 1.12 +++ CastorXmlPageManager.java 26 Sep 2004 06:10:05 -0000 1.13 @@ -420,22 +420,43 @@ // set page path with page/path properties, assumes // page names and relative paths are relative to // request path and that any page paths with no url - // separator should have the page extension appended; - // better rules might be applied with differentiation - // between control, page, and path properties + // separator should have the page extension appended if (locatorProperties[i].getValue() != null) { + // get locator path property pagePath = locatorProperties[i].getValue(); + if (pagePath == null) + pagePath = ""; + // append page extension if required if ((pagePath.indexOf("/") == -1) && ! pagePath.endsWith(Page.DOCUMENT_TYPE)) pagePath = pagePath + Page.DOCUMENT_TYPE; + // remove default page and let folder perform defaulting + // if request path is probably referencing a folder, (i.e. + // not a page) + if (pagePath.equals(FolderImpl.FALLBACK_DEFAULT_PAGE)) + pagePath = ""; + // relative path: append to request path if page path is specified + // or if request path is probably referencing a folder, (i.e. + // not a page); the empty page path here forces a folder path + // to be created with a trailing slash... the folder then will + // choose its default page name according to its own rules. if (! pagePath.startsWith("/")) - { - int lastSlashIndex = requestPath.lastIndexOf('/'); - if (lastSlashIndex > 0) - pagePath = requestPath.substring(0, lastSlashIndex) + "/" + pagePath; + if ((pagePath.length() > 0) || ! requestPath.endsWith(Page.DOCUMENT_TYPE)) + { + // append page path to request path + int lastSlashIndex = requestPath.lastIndexOf('/'); + if (lastSlashIndex > 0) + pagePath = requestPath.substring(0, lastSlashIndex) + "/" + pagePath; + else if (requestPath.length() > 1) + pagePath = requestPath + "/" + pagePath; + else + pagePath = "/" + pagePath; + } else - pagePath = "/" + pagePath; - } + { + // default page path to page request path + pagePath = requestPath; + } } else pagePath = requestPath;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]