Formatierungen, zusätzliche Bundle-Klassen um Sprachumschaltung um Content-Center zu ermöglichen
git-svn-id: https://svn.libreccm.org/ccm/trunk@2103 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
48023b8f55
commit
3ff771bd1e
|
|
@ -33,6 +33,7 @@ import com.arsdigita.categorization.Category;
|
||||||
import com.arsdigita.cms.dispatcher.DefaultTemplateResolver;
|
import com.arsdigita.cms.dispatcher.DefaultTemplateResolver;
|
||||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||||
import com.arsdigita.cms.dispatcher.MultilingualItemResolver;
|
import com.arsdigita.cms.dispatcher.MultilingualItemResolver;
|
||||||
|
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||||
import com.arsdigita.cms.dispatcher.TemplateResolver;
|
import com.arsdigita.cms.dispatcher.TemplateResolver;
|
||||||
import com.arsdigita.cms.lifecycle.PublishLifecycleListener;
|
import com.arsdigita.cms.lifecycle.PublishLifecycleListener;
|
||||||
import com.arsdigita.cms.publishToFile.PublishToFileConfig;
|
import com.arsdigita.cms.publishToFile.PublishToFileConfig;
|
||||||
|
|
@ -622,10 +623,36 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
"com.arsdigita.cms.image_cache.max_age",
|
"com.arsdigita.cms.image_cache.max_age",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
300);
|
300);
|
||||||
|
/**
|
||||||
|
* Enable the PersonOrgaUnitsStep?
|
||||||
|
*/
|
||||||
private final Parameter m_attachPersonOrgaUnitsStep = new BooleanParameter(
|
private final Parameter m_attachPersonOrgaUnitsStep = new BooleanParameter(
|
||||||
"com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step",
|
"com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step",
|
||||||
Parameter.REQUIRED,
|
Parameter.REQUIRED,
|
||||||
Boolean.TRUE);
|
Boolean.TRUE);
|
||||||
|
/**
|
||||||
|
* Enable or disable the XML cache in {@link SimpleXMLGenerator}
|
||||||
|
*/
|
||||||
|
private final Parameter m_enableXmlCache = new BooleanParameter(
|
||||||
|
"com.arsdigita.cms.xml.cache.enable",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
Boolean.FALSE);
|
||||||
|
/**
|
||||||
|
* Maximum number of items stored in the XML cache
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private final Parameter m_xmlCacheSize = new IntegerParameter(
|
||||||
|
"com.arsdigita.cms.xml.cache.size",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
2500);
|
||||||
|
/**
|
||||||
|
* Maximum age of cache entry for the XML cache
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private final Parameter m_xmlCacheAge = new IntegerParameter(
|
||||||
|
"com.arsdigita.cms.xml.cache.age",
|
||||||
|
Parameter.REQUIRED,
|
||||||
|
60 * 60 * 24);
|
||||||
|
|
||||||
// ///////////////////////////////////////////
|
// ///////////////////////////////////////////
|
||||||
// publishToFile package related parameter
|
// publishToFile package related parameter
|
||||||
|
|
@ -735,6 +762,10 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
|
|
||||||
register(m_attachPersonOrgaUnitsStep);
|
register(m_attachPersonOrgaUnitsStep);
|
||||||
|
|
||||||
|
register(m_enableXmlCache);
|
||||||
|
register(m_xmlCacheSize);
|
||||||
|
register(m_xmlCacheAge);
|
||||||
|
|
||||||
loadInfo();
|
loadInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1211,4 +1242,16 @@ public final class CMSConfig extends AbstractConfig {
|
||||||
return (Boolean) get(m_attachPersonOrgaUnitsStep);
|
return (Boolean) get(m_attachPersonOrgaUnitsStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getEnableXmlCache() {
|
||||||
|
return (Boolean) get(m_enableXmlCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getXmlCacheSize() {
|
||||||
|
return (Integer) get(m_xmlCacheSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getXmlCacheAge() {
|
||||||
|
return (Integer) get(m_xmlCacheAge);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -319,3 +319,18 @@ com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.title
|
||||||
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.purpose = Attaches an authoring step to GenericPerson which displays all GenericOrganizationalUnits to which the person is assigned to
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.purpose = Attaches an authoring step to GenericPerson which displays all GenericOrganizationalUnits to which the person is assigned to
|
||||||
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.example = true
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.example = true
|
||||||
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.foramt = [boolean]
|
com.arsdigita.cms.contenttypes.genericperson.attach_person_orgaunits_step.foramt = [boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.xml.cache.enable.title=Enable a XML cache for the SimpleXMLGenerator
|
||||||
|
com.arsdigita.cms.xml.cache.enable.purpose=Enable a XML cache for the SimpleXMLGenerator
|
||||||
|
com.arsdigita.cms.xml.cache.enable.example=true
|
||||||
|
com.arsdigita.cms.xml.cache.enable.format=[boolean]
|
||||||
|
|
||||||
|
com.arsdigita.cms.xml.cache.size.title=Maximum number of items stored in the XML cache
|
||||||
|
com.arsdigita.cms.xml.cache.size.purpose=Maximum number of items stored in the XML cache
|
||||||
|
com.arsdigita.cms.xml.cache.size.example=2500
|
||||||
|
com.arsdigita.cms.xml.cache.size.format=[integer]
|
||||||
|
|
||||||
|
com.arsdigita.cms.xml.cache.age.title=Maximum age of an entry in the XML cache
|
||||||
|
com.arsdigita.cms.xml.cache.age.purpose=Maximum age of an entry in the XML cache
|
||||||
|
com.arsdigita.cms.xml.cache.age.example=60*60*24
|
||||||
|
com.arsdigita.cms.xml.cache.age.format=[integer]
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -55,7 +55,6 @@ cms.contenttypes.ui.person.alias.delete.label=Delete
|
||||||
cms.ui.contentcenter.mainpage.search=Search
|
cms.ui.contentcenter.mainpage.search=Search
|
||||||
cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections
|
cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections
|
||||||
cms.ui.contentcenter.section=Section
|
cms.ui.contentcenter.section=Section
|
||||||
cms.ui.contentcenter.action=Action
|
|
||||||
cms.ui.set_home_folder=Set as home folder
|
cms.ui.set_home_folder=Set as home folder
|
||||||
cms.ui.go_to_home_folder=Go to home folder
|
cms.ui.go_to_home_folder=Go to home folder
|
||||||
cms.ui.no_home_folder_selected=No home folder selected
|
cms.ui.no_home_folder_selected=No home folder selected
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,9 @@
|
||||||
package com.arsdigita.cms.dispatcher;
|
package com.arsdigita.cms.dispatcher;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.caching.CacheTable;
|
||||||
import com.arsdigita.cms.CMS;
|
import com.arsdigita.cms.CMS;
|
||||||
|
import com.arsdigita.cms.CMSConfig;
|
||||||
import com.arsdigita.cms.ContentItem;
|
import com.arsdigita.cms.ContentItem;
|
||||||
import com.arsdigita.cms.ContentItemXMLRenderer;
|
import com.arsdigita.cms.ContentItemXMLRenderer;
|
||||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||||
|
|
@ -40,11 +42,11 @@ import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.metadata.Property;
|
import com.arsdigita.persistence.metadata.Property;
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
import com.arsdigita.xml.Element;
|
import com.arsdigita.xml.Element;
|
||||||
import java.util.HashMap;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -83,8 +85,13 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
*/
|
*/
|
||||||
private String itemElemName = "cms:item";
|
private String itemElemName = "cms:item";
|
||||||
private String itemElemNs = CMS.CMS_XML_NS;
|
private String itemElemNs = CMS.CMS_XML_NS;
|
||||||
private static final Map<OID, Element> cache = new HashMap<OID, Element>();
|
private static final CacheTable CACHE = new CacheTable(
|
||||||
private static final boolean USE_CACHE = false;
|
SimpleXMLGenerator.class.getName() + "Cache",
|
||||||
|
CMSConfig.getInstance().getXmlCacheSize(),
|
||||||
|
CMSConfig.getInstance().getXmlCacheAge(),
|
||||||
|
true);
|
||||||
|
//private static final Map<OID, Element> cache = new HashMap<OID, Element>();
|
||||||
|
//private static final boolean USE_CACHE = false;
|
||||||
|
|
||||||
// Register general purpose adaptor for all content items
|
// Register general purpose adaptor for all content items
|
||||||
static {
|
static {
|
||||||
|
|
@ -189,8 +196,8 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
// This is the preferred method
|
// This is the preferred method
|
||||||
//final Element content = startElement(useContext, parent);
|
//final Element content = startElement(useContext, parent);
|
||||||
final Element content;
|
final Element content;
|
||||||
if (USE_CACHE && cache.containsKey(item.getOID())) {
|
if (CMSConfig.getInstance().getEnableXmlCache() && (CACHE.get(item.getOID().toString()) != null)) {
|
||||||
content = cache.get(item.getOID());
|
content = (Element) CACHE.get(item.getOID().toString());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
content = startElement(useContext);
|
content = startElement(useContext);
|
||||||
|
|
@ -212,7 +219,23 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
|
|
||||||
//parent.addContent(content);
|
//parent.addContent(content);
|
||||||
|
|
||||||
/*
|
//Only cache published items
|
||||||
|
// if (item.isLiveVersion()) {
|
||||||
|
// final Element cachedElem = startElement(useContext);
|
||||||
|
// final Iterator entries = content.getAttributes().entrySet().iterator();
|
||||||
|
// Map.Entry entry;
|
||||||
|
// while (entries.hasNext()) {
|
||||||
|
// entry = (Map.Entry) entries.next();
|
||||||
|
// cachedElem.addAttribute((String) entry.getKey(), (String) entry.getValue());
|
||||||
|
// }
|
||||||
|
// final Iterator childs = content.getChildren().iterator();
|
||||||
|
// while (childs.hasNext()) {
|
||||||
|
// cachedElem.newChildElement((Element) childs.next());
|
||||||
|
// }
|
||||||
|
// CACHE.put(item.getOID().toString(), cachedElem);
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
/*
|
||||||
* 2011-08-27 jensp: Introduced to remove the annoying special templates
|
* 2011-08-27 jensp: Introduced to remove the annoying special templates
|
||||||
* for MultiPartArticle, SiteProxy and others. The method called
|
* for MultiPartArticle, SiteProxy and others. The method called
|
||||||
* here was already definied but not used.
|
* here was already definied but not used.
|
||||||
|
|
@ -231,8 +254,19 @@ public class SimpleXMLGenerator implements XMLGenerator {
|
||||||
// printf("Rendered ExtraXML in %d ms\n", (System.nanoTime() - extraXMLStart) / 1000000);
|
// printf("Rendered ExtraXML in %d ms\n", (System.nanoTime() - extraXMLStart) / 1000000);
|
||||||
// System.out.printf(" -----\n");
|
// System.out.printf(" -----\n");
|
||||||
|
|
||||||
if (USE_CACHE) {
|
if (CMSConfig.getInstance().getEnableXmlCache() && item.isLiveVersion()) {
|
||||||
cache.put(item.getOID(), content);
|
final Element cachedElem = startElement(useContext);
|
||||||
|
final Iterator entries = content.getAttributes().entrySet().iterator();
|
||||||
|
Map.Entry entry;
|
||||||
|
while (entries.hasNext()) {
|
||||||
|
entry = (Map.Entry) entries.next();
|
||||||
|
cachedElem.addAttribute((String) entry.getKey(), (String) entry.getValue());
|
||||||
|
}
|
||||||
|
final Iterator childs = content.getChildren().iterator();
|
||||||
|
while (childs.hasNext()) {
|
||||||
|
cachedElem.newChildElement((Element) childs.next());
|
||||||
|
}
|
||||||
|
CACHE.put(item.getOID().toString(), cachedElem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public abstract class NewItemForm extends Form {
|
||||||
m_emptyLabel.setIdAttr("empty_label");
|
m_emptyLabel.setIdAttr("empty_label");
|
||||||
panel.add(m_emptyLabel);
|
panel.add(m_emptyLabel);
|
||||||
|
|
||||||
m_createLabel = new Label((String)globalize("cms.ui.authoring.create_new").localize(), false);
|
m_createLabel = new Label(globalize("cms.ui.authoring.create_new"), false);
|
||||||
m_createLabel.setIdAttr("create_label");
|
m_createLabel.setIdAttr("create_label");
|
||||||
panel.add(m_createLabel);
|
panel.add(m_createLabel);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ package com.arsdigita.cms.util;
|
||||||
import com.arsdigita.globalization.ChainedResourceBundle;
|
import com.arsdigita.globalization.ChainedResourceBundle;
|
||||||
|
|
||||||
import java.util.PropertyResourceBundle;
|
import java.util.PropertyResourceBundle;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main ResourceBundle for CMS UI.
|
* Main ResourceBundle for CMS UI.
|
||||||
|
|
@ -29,11 +30,13 @@ import java.util.PropertyResourceBundle;
|
||||||
* - putBundle - to override keys already in CMSResources e.g. to customize
|
* - putBundle - to override keys already in CMSResources e.g. to customize
|
||||||
* notification email text
|
* notification email text
|
||||||
*/
|
*/
|
||||||
public class CMSResourceBundle extends ChainedResourceBundle
|
public class CMSResourceBundle extends ChainedResourceBundle implements CMSGlobalized {
|
||||||
implements CMSGlobalized {
|
|
||||||
|
|
||||||
public CMSResourceBundle() {
|
public CMSResourceBundle() {
|
||||||
super();
|
super();
|
||||||
addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME));
|
addBundle((PropertyResourceBundle) getBundle(BUNDLE_NAME,
|
||||||
|
ResourceBundle.Control.getNoFallbackControl(
|
||||||
|
ResourceBundle.Control.FORMAT_DEFAULT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.arsdigita.cms.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class CMSResourceBundle_de extends CMSResourceBundle {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.arsdigita.cms.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class CMSResourceBundle_en_GB extends CMSResourceBundle {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.arsdigita.cms.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter <jens@jp-digital.de>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class CMSResourceBundle_fr extends CMSResourceBundle {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -32,10 +32,8 @@ import com.arsdigita.globalization.GlobalizedMessage;
|
||||||
public class GlobalizationUtil {
|
public class GlobalizationUtil {
|
||||||
|
|
||||||
/** Name of the Java class to handle CMS's globalisation. */
|
/** Name of the Java class to handle CMS's globalisation. */
|
||||||
// public static String s_bundleName =
|
//public static String s_bundleName = "com.arsdigita.cms.util.CMSResourceBundle";
|
||||||
// "com.arsdigita.cms.util.CMSResourceBundle";
|
public static String s_bundleName = "com.arsdigita.cms.CMSResources";
|
||||||
public static String s_bundleName =
|
|
||||||
"com.arsdigita.cms.CMSResources";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This returns a globalized message using the package specific bundle,
|
* This returns a globalized message using the package specific bundle,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue