Mulitlanguage Fähigkeit für Navigation
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-94f89814c4dfmaster
parent
8b99a67aa5
commit
2753d7f5d4
|
|
@ -24,9 +24,9 @@ import com.arsdigita.cms.CMS;
|
||||||
import com.arsdigita.cms.ContentBundle;
|
import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.domain.DomainObjectXMLRenderer;
|
import com.arsdigita.domain.DomainObjectXMLRenderer;
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.london.navigation.ui.AbstractComponent;
|
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
|
@ -137,7 +137,19 @@ public class ContentList extends AbstractComponent {
|
||||||
// but don't process it on top of what has already been done
|
// but don't process it on top of what has already been done
|
||||||
ACSObject indexItem = category.getIndexObject();
|
ACSObject indexItem = category.getIndexObject();
|
||||||
if ((indexItem != null) && (indexItem instanceof ContentBundle)) {
|
if ((indexItem != null) && (indexItem instanceof ContentBundle)) {
|
||||||
ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion();
|
|
||||||
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion(); */
|
||||||
|
ContentItem cItem = ((ContentBundle) indexItem).negotiate(request.getLocales());
|
||||||
|
// If there is no matching language version for this content item
|
||||||
|
if(cItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
cItem = ((ContentBundle) indexItem).getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentItem cIndexItem = cItem.getLiveVersion();
|
||||||
|
|
||||||
if (cIndexItem != null) {
|
if (cIndexItem != null) {
|
||||||
indexItemIdString = cIndexItem.getID().toString();
|
indexItemIdString = cIndexItem.getID().toString();
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +174,17 @@ public class ContentList extends AbstractComponent {
|
||||||
// above (ie inherited from parent category)
|
// above (ie inherited from parent category)
|
||||||
ACSObject indexItem = category.getIndexObject();
|
ACSObject indexItem = category.getIndexObject();
|
||||||
if ((indexItem != null) && (indexItem instanceof ContentBundle)) {
|
if ((indexItem != null) && (indexItem instanceof ContentBundle)) {
|
||||||
ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion();
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* ContentItem cIndexItem = ((ContentBundle) indexItem).getPrimaryInstance().getLiveVersion(); */
|
||||||
|
ContentItem cItem = ((ContentBundle) indexItem).negotiate(request.getLocales());
|
||||||
|
// If there is no matching language version for this content item
|
||||||
|
if(cItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
cItem = ((ContentBundle) indexItem).getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
ContentItem cIndexItem = cItem.getLiveVersion();
|
||||||
//log.debug("indexItem : "+cIndexItem);
|
//log.debug("indexItem : "+cIndexItem);
|
||||||
if (cIndexItem != null) {
|
if (cIndexItem != null) {
|
||||||
processItem(cIndexItem, null, null, items);
|
processItem(cIndexItem, null, null, items);
|
||||||
|
|
@ -240,7 +262,15 @@ public class ContentList extends AbstractComponent {
|
||||||
if (item instanceof ContentBundle) {
|
if (item instanceof ContentBundle) {
|
||||||
log.debug("looking at item : "+item);
|
log.debug("looking at item : "+item);
|
||||||
|
|
||||||
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* item = ((ContentBundle) item).getPrimaryInstance(); */
|
||||||
|
item = ((ContentBundle) item).negotiate(DispatcherHelper.getRequest().getLocales());
|
||||||
|
// If there is no matching language version for this content item
|
||||||
|
if(item == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
item = ((ContentBundle) item).getPrimaryInstance();
|
item = ((ContentBundle) item).getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
//This can cause item to become null, if there is no instance of it for the default language
|
//This can cause item to become null, if there is no instance of it for the default language
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,11 @@ public class GreetingItem extends AbstractComponent {
|
||||||
*/
|
*/
|
||||||
//ContentItem baseItem = bundle.getPrimaryInstance();
|
//ContentItem baseItem = bundle.getPrimaryInstance();
|
||||||
ContentItem baseItem = bundle.negotiate(request.getLocales());
|
ContentItem baseItem = bundle.negotiate(request.getLocales());
|
||||||
|
// If there is no matching language version for this content item
|
||||||
|
if(baseItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
baseItem = bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
Element itemEl = content.newChildElement("cms:item",
|
Element itemEl = content.newChildElement("cms:item",
|
||||||
CMS.CMS_XML_NS);
|
CMS.CMS_XML_NS);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import com.arsdigita.cms.ContentBundle;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentSectionConfig;
|
import com.arsdigita.cms.ContentSectionConfig;
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
|
import com.arsdigita.dispatcher.DispatcherHelper;
|
||||||
import com.arsdigita.london.navigation.Navigation;
|
import com.arsdigita.london.navigation.Navigation;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
|
|
||||||
|
|
@ -107,7 +108,15 @@ public class GreetingItemExtraXML extends AbstractComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
ContentBundle bundle = (ContentBundle) item;
|
ContentBundle bundle = (ContentBundle) item;
|
||||||
ContentItem baseItem = bundle.getPrimaryInstance();
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* ContentItem baseItem = bundle.getPrimaryInstance(); */
|
||||||
|
ContentItem baseItem = bundle.negotiate(DispatcherHelper.getRequest().getLocales());
|
||||||
|
// If there is no matching language version for this content item
|
||||||
|
if(baseItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
baseItem = bundle.getPrimaryInstance();
|
||||||
|
}
|
||||||
|
|
||||||
return baseItem;
|
return baseItem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,16 @@ public class NavigationRootIndexItem extends AbstractComponent {
|
||||||
Element parentElement = Navigation.newElement(TAG_PARENT);
|
Element parentElement = Navigation.newElement(TAG_PARENT);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ContentItem indexItem = ((ContentBundle) Navigation.getConfig().getDefaultCategoryRoot().getIndexObject()).getPrimaryInstance().getLiveVersion();
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* ContentItem indexItem = ((ContentBundle) Navigation.getConfig().getDefaultCategoryRoot().getIndexObject()).getPrimaryInstance().getLiveVersion(); */
|
||||||
|
ContentItem indexItem = ((ContentBundle) Navigation.getConfig().getDefaultCategoryRoot().getIndexObject()).negotiate(request.getLocales());
|
||||||
|
// if there is no matching language version for this content item
|
||||||
|
if(indexItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
indexItem = ((ContentBundle) Navigation.getConfig().getDefaultCategoryRoot().getIndexObject()).getPrimaryInstance();
|
||||||
|
}
|
||||||
|
indexItem = indexItem.getLiveVersion();
|
||||||
Element itemElement = parentElement.newChildElement(TAG_ITEM, CMS.CMS_XML_NS);
|
Element itemElement = parentElement.newChildElement(TAG_ITEM, CMS.CMS_XML_NS);
|
||||||
DomainObjectXMLRenderer renderer = new DomainObjectXMLRenderer(itemElement);
|
DomainObjectXMLRenderer renderer = new DomainObjectXMLRenderer(itemElement);
|
||||||
// not sure these are necessary
|
// not sure these are necessary
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,17 @@ public class RelatedItems extends AbstractComponent {
|
||||||
|
|
||||||
// on category pages, we obtain a ContentBundle
|
// on category pages, we obtain a ContentBundle
|
||||||
if (obj instanceof ContentBundle) {
|
if (obj instanceof ContentBundle) {
|
||||||
obj = ((ContentBundle) obj).getPrimaryInstance();
|
|
||||||
|
/*Fix by Quasimodo*/
|
||||||
|
/* getPrimaryInstance doesn't negotiate the language of the content item */
|
||||||
|
/* obj = ((ContentBundle) obj).getPrimaryInstance(); */
|
||||||
|
ContentItem cItem = ((ContentBundle) obj).negotiate(request.getLocales());
|
||||||
|
// if there is no matching language version of the content item
|
||||||
|
if(cItem == null) {
|
||||||
|
// get the primary instance instead (fallback)
|
||||||
|
cItem = ((ContentBundle) obj).getPrimaryInstance();
|
||||||
|
}
|
||||||
|
obj = cItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj instanceof ContentPage)) {
|
if (!(obj instanceof ContentPage)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue