From: <ssk...@vh...> - 2006-05-11 14:23:10
|
Author: sskracic Date: 2006-05-11 16:19:52 +0200 (Thu, 11 May 2006) New Revision: 1136 Modified: trunk/ccm-ldn-navigation/application.xml trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java Log: Category URLs in categoryMenu widget will be generated as /ccm/<navapp_url>/path/to/cat regardless of the current page context (/ccm/navigation/, /ccm/content/, ...). URLs will resort to "redirect URLs" only when URL of a category or any of its ancestors is not set. Modified: trunk/ccm-ldn-navigation/application.xml =================================================================== --- trunk/ccm-ldn-navigation/application.xml 2006-05-10 19:21:49 UTC (rev 1135) +++ trunk/ccm-ldn-navigation/application.xml 2006-05-11 14:19:52 UTC (rev 1136) @@ -3,7 +3,7 @@ name="ccm-ldn-navigation" prettyName="Navigation" version="6.3.0" - release="6" + release="7" webapp="ROOT"> <ccm:dependencies> <ccm:requires name="ccm-core" version="6.2.0" relation="ge"/> Modified: trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java =================================================================== --- trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-05-10 19:21:49 UTC (rev 1135) +++ trunk/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/category/AbstractTree.java 2006-05-11 14:19:52 UTC (rev 1136) @@ -5,12 +5,12 @@ * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -24,6 +24,7 @@ import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; +import com.arsdigita.kernel.URLService; import com.arsdigita.web.Application; import com.arsdigita.web.URL; import com.arsdigita.web.Web; @@ -43,7 +44,6 @@ public abstract class AbstractTree extends CategoryComponent { - protected Element generateTreeXML(HttpServletRequest request, HttpServletResponse response, Category cat, @@ -59,12 +59,12 @@ childList = new TreeSet(); children.put(parentID, childList); } - + childList.add(new CategorySortKeyPair (category, (BigDecimal)cats.get("parents.link.sortKey"))); } - + String url = null; Application app = Web.getContext().getApplication(); if (app instanceof Navigation) { @@ -88,18 +88,23 @@ path.close(); if( common ) url = ""; + } else { + url = URLService.locate(cat.getOID()); + if (!url.endsWith("/")) { + url = null; + } } - return generateNodeXML(request, - response, + return generateNodeXML(request, + response, cat, null, selected, children, url); - + } - + protected Element generateNodeXML(HttpServletRequest request, HttpServletResponse response, Category cat, @@ -111,9 +116,14 @@ return null; } - String url = (path == null) ? - Navigation.redirectURL(cat.getOID()) : - URL.here(Web.getRequest(), path + "/").toString(); + String url = null; + if (path == null) { + url = Navigation.redirectURL(cat.getOID()); + } else if (path.endsWith("/")) { + url = path; + } else { + url = URL.here(Web.getRequest(), path + "/").toString(); + } Element el = generateCategoryXML(request, response, @@ -142,7 +152,7 @@ children, child.getURL() == null || path == null ? null : - path + "/" + child.getURL() + url + child.getURL() + "/" ); if (childEl != null) { el.addContent(childEl); @@ -167,7 +177,7 @@ public BigDecimal getSortKey() { return m_sortKey; } - + public int compareTo(Object o) { return m_sortKey.compareTo(((CategorySortKeyPair)o).m_sortKey); } |