From 2753d7f5d4530dd4e589aa3145626686cdefac87 Mon Sep 17 00:00:00 2001 From: quasi Date: Thu, 1 Oct 2009 09:06:10 +0000 Subject: [PATCH] =?UTF-8?q?Mulitlanguage=20F=C3=A4higkeit=20f=C3=BCr=20Nav?= =?UTF-8?q?igation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ich konnte zwar nicht alle Stellen im laufenden System verifizieren, aber nach meinen Verständnis sollte die Unterstützung nun vollständig sein. git-svn-id: https://svn.libreccm.org/ccm/trunk@271 8810af33-2d31-482b-a856-94f89814c4df --- .../london/navigation/ui/ContentList.java | 338 ++++++++++-------- .../london/navigation/ui/GreetingItem.java | 41 ++- .../navigation/ui/GreetingItemExtraXML.java | 41 ++- .../ui/NavigationRootIndexItem.java | 27 +- .../london/navigation/ui/RelatedItems.java | 50 +-- 5 files changed, 280 insertions(+), 217 deletions(-) diff --git a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/ContentList.java b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/ContentList.java index b6a40ac10..8c5b8b8af 100755 --- a/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/ContentList.java +++ b/ccm-ldn-navigation/src/com/arsdigita/london/navigation/ui/ContentList.java @@ -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,9 +24,9 @@ import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentBundle; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; +import com.arsdigita.dispatcher.DispatcherHelper; import com.arsdigita.domain.DomainObjectXMLRenderer; import com.arsdigita.kernel.ACSObject; -import com.arsdigita.london.navigation.ui.AbstractComponent; import com.arsdigita.persistence.OID; import com.arsdigita.xml.Element; @@ -71,28 +71,28 @@ import org.apache.log4j.Logger; */ public class ContentList extends AbstractComponent { // extends SimpleComponent - + public static final String versionId = "$Id: ContentList.java 1173 2006-06-14 13:54:39Z fabrice $"; - + private static Logger log = Logger.getLogger(ContentList.class);; private static final String TAG_ITEMLISTS = "cms:contentLists"; - + private static final String TAG_ITEMLIST = "cms:contentList"; private static final String TAG_ITEMLIST_TYPE = "type"; - + private static final String TAG_ITEM = "cms:item"; private static final String TAG_ITEM_ISINDEX = "name"; private static final String TAG_ITEM_ISINDEX_VALUE = "index"; - + private static final String NAVIGATION_ROOT_NAME = "Navigation"; private static final String CATEGORYID_PARAM = "categoryID"; private static final String CONTENTITEM_CLASS_NAME = ContentItem.class.getName(); - + public ContentList() { super(); } - + /** * Generates the XML. * @@ -101,185 +101,215 @@ public class ContentList extends AbstractComponent { */ public Element generateXML(HttpServletRequest request, HttpServletResponse response) { //PageState state, Element parent - + Element parent = new Element(TAG_ITEMLISTS, CMS.CMS_XML_NS); - + //if (isVisible(state)) { - - String indexItemIdString = null; - - // check if we are currently displaying an item - HashMap items = new HashMap(); - HashMap sortKeys = new HashMap(); - ContentItem currentItem = null; - try { - currentItem = CMS.getContext().getContentItem(); - log.debug("ContentList: CMS.getContext().getContentItem() returned : "+currentItem); - } catch (IllegalStateException e) { - // we're dealing with a category - } - - if (currentItem != null) { - - // take the first category in the list, should do the trick???? - Iterator categories = currentItem.getCategories(null); - if (categories.hasNext()) { - Category category = (Category) categories.next(); - String currentItemClassName = currentItem.getClass().getName(); - String currentItemIdString = currentItem.getID().toString(); - log.debug("ContentList: looking at the first category of the item : "+category.getName()); - // only navigation categories (not sure this was truely necessary in fact) - // if (getNavigationRootCategory().isMemberOfSubtree(category)) { - processCategory(category, currentItemClassName, currentItemIdString, items, sortKeys); - // } - - // now that we look at only one category, also mark the indexItem as such - // but don't process it on top of what has already been done - ACSObject indexItem = category.getIndexObject(); - if ((indexItem != null) && (indexItem instanceof ContentBundle)) { - ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion(); - if (cIndexItem != null) { - indexItemIdString = cIndexItem.getID().toString(); - } - } - - } else { - log.warn("ContentList: item has no category, contentList will be empty."); - } - - } else { - // we're viewing a category. process it - //String categoryIdString = state.getRequest().getParameter(CATEGORYID_PARAM); - //Category category = new Category(new OID(Category.class.getName(), new BigDecimal(categoryIdString))); - Category category = getCategory(); - log.debug("ContentList: getCategory returned : "+getCategory()); - - if (category != null) { - - processCategory(category, null, null, items, sortKeys); - - // process the index item, just in case it isn't in the lists - // above (ie inherited from parent category) - ACSObject indexItem = category.getIndexObject(); - if ((indexItem != null) && (indexItem instanceof ContentBundle)) { - ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion(); - //log.debug("indexItem : "+cIndexItem); - if (cIndexItem != null) { - processItem(cIndexItem, null, null, items); - indexItemIdString = cIndexItem.getID().toString(); - } - //log.debug("indexItemIdString is : "+indexItemIdString); - } - } - } + + String indexItemIdString = null; + + // check if we are currently displaying an item + HashMap items = new HashMap(); + HashMap sortKeys = new HashMap(); + ContentItem currentItem = null; + try { + currentItem = CMS.getContext().getContentItem(); + log.debug("ContentList: CMS.getContext().getContentItem() returned : "+currentItem); + } catch (IllegalStateException e) { + // we're dealing with a category + } + + if (currentItem != null) { + + // take the first category in the list, should do the trick???? + Iterator categories = currentItem.getCategories(null); + if (categories.hasNext()) { + Category category = (Category) categories.next(); + String currentItemClassName = currentItem.getClass().getName(); + String currentItemIdString = currentItem.getID().toString(); + log.debug("ContentList: looking at the first category of the item : "+category.getName()); + // only navigation categories (not sure this was truely necessary in fact) + // if (getNavigationRootCategory().isMemberOfSubtree(category)) { + processCategory(category, currentItemClassName, currentItemIdString, items, sortKeys); + // } - // output the XML - ContentItem item; - Element itemElement; - DomainObjectXMLRenderer renderer; - String itemIdString; - Iterator classes = items.keySet().iterator(); - String className; - List list; - Element clElement; - while (classes.hasNext()) { - className = (String) classes.next(); - list = (List) items.get(className); - //log.debug("looking at items of type : "+className); - - clElement = parent.newChildElement(TAG_ITEMLIST, CMS.CMS_XML_NS); - //exportAttributes(content); ??? - clElement.addAttribute(TAG_ITEMLIST_TYPE, className); - - for (int i=0; i