Diverse Änderungen - von allem etwas.

git-svn-id: https://svn.libreccm.org/ccm/trunk@1114 8810af33-2d31-482b-a856-94f89814c4df
master
quasi 2011-09-11 10:02:25 +00:00
parent f4e0632ce2
commit f5ab0bcfb6
14 changed files with 58 additions and 55 deletions

View File

@ -34,7 +34,8 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
// replaced by AgendaGlobalizationUtil
// import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import java.text.DateFormat;
@ -92,7 +93,7 @@ public class AgendaPropertiesStep extends SimpleEditStep {
PageState state) {
ContentPage page = (ContentPage) item;
if(page.getLaunchDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale())
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale())
.format(page.getLaunchDate());
} else {
return (String)AgendaGlobalizationUtil.globalize("cms.ui.unknown").localize();
@ -121,7 +122,7 @@ public class AgendaPropertiesStep extends SimpleEditStep {
PageState state) {
Agenda agenda = (Agenda) item;
if(agenda.getCreationDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale())
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale())
.format(agenda.getCreationDate());
} else {
return (String)AgendaGlobalizationUtil.globalize("cms.ui.unknown").localize();

View File

@ -31,7 +31,7 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.contenttypes.util.EventGlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import java.text.DateFormat;
import java.util.Calendar;
@ -91,7 +91,7 @@ public class EventPropertiesStep extends SimpleEditStep {
PageState state) {
ContentPage page = (ContentPage) item;
if (page.getLaunchDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale()).format(page.getLaunchDate());
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale()).format(page.getLaunchDate());
} else {
return (String) EventGlobalizationUtil.globalize("cms.ui.unknown").localize();
}
@ -109,11 +109,11 @@ public class EventPropertiesStep extends SimpleEditStep {
if (e.getStartDate() != null) {
if (e.getStartTime() == null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale()).format(e.getStartDate());
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale()).format(e.getStartDate());
} else {
int timezoneOffset = Calendar.getInstance().get(Calendar.ZONE_OFFSET) + Calendar.getInstance().get(Calendar.DST_OFFSET) / (60 * 1000);
Date startDateTime = new Date(e.getStartDate().getTime() + e.getStartTime().getTime() + timezoneOffset);
return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, DispatcherHelper.getNegotiatedLocale()).format(startDateTime);
return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, GlobalizationHelper.getNegotiatedLocale()).format(startDateTime);
}
@ -133,11 +133,11 @@ public class EventPropertiesStep extends SimpleEditStep {
if (e.getEndDate() != null) {
if (e.getEndTime() == null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale()).format(e.getEndDate());
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale()).format(e.getEndDate());
} else {
int timezoneOffset = Calendar.getInstance().get(Calendar.ZONE_OFFSET) + Calendar.getInstance().get(Calendar.DST_OFFSET) / (60 * 1000);
Date endDateTime = new Date(e.getEndDate().getTime() + e.getEndTime().getTime() + timezoneOffset);
return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, DispatcherHelper.getNegotiatedLocale()).format(endDateTime);
return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT, GlobalizationHelper.getNegotiatedLocale()).format(endDateTime);
}

View File

@ -48,7 +48,7 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
@ -158,7 +158,7 @@ public class ImagePropertiesStep extends SimpleEditStep {
if (image.getSkipDay().booleanValue() == true || image.getSkipMonth().booleanValue() == true) {
String month = "";
if (image.getSkipMonth().booleanValue() == false) {
Locale locale = DispatcherHelper.getNegotiatedLocale();
Locale locale = GlobalizationHelper.getNegotiatedLocale();
if (locale != null) {

View File

@ -33,7 +33,7 @@ import com.arsdigita.cms.contenttypes.ArticleSection;
import com.arsdigita.cms.contenttypes.ArticleSectionCollection;
import com.arsdigita.cms.contenttypes.MultiPartArticle;
import com.arsdigita.cms.dispatcher.XMLGenerator;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.xml.Element;
@ -141,7 +141,7 @@ public class ArticleSectionPanel extends SimpleComponent implements
bundle = (ContentBundle) item;
resolved = bundle.getInstance(DispatcherHelper.getNegotiatedLocale().getLanguage());
resolved = bundle.getInstance(GlobalizationHelper.getNegotiatedLocale().getLanguage());
if (resolved == null) {
resolved = bundle.getPrimaryInstance();
}

View File

@ -31,7 +31,8 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.contenttypes.util.NewsItemGlobalizationUtil;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import java.text.DateFormat;
@ -87,7 +88,7 @@ public class NewsItemPropertiesStep extends SimpleEditStep {
PageState state) {
ContentPage page = (ContentPage) item;
if (page.getLaunchDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale()).format(page.getLaunchDate());
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale()).format(page.getLaunchDate());
} else {
return (String) NewsItemGlobalizationUtil.globalize("cms.ui.unknown").localize();
}
@ -123,7 +124,7 @@ public class NewsItemPropertiesStep extends SimpleEditStep {
PageState state) {
NewsItem pr = (NewsItem) item;
if (pr.getNewsDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG, DispatcherHelper.getNegotiatedLocale()).format(pr.getNewsDate());
return DateFormat.getDateInstance(DateFormat.LONG, GlobalizationHelper.getNegotiatedLocale()).format(pr.getNewsDate());
} else {
return (String) NewsItemGlobalizationUtil.globalize("cms.ui.unknown").localize();
}

View File

@ -18,6 +18,8 @@ import java.util.StringTokenizer;
*/
public class GlobalizationHelper {
private static final String LANG_PARAM = "lang";
// Don't instantiate
private GlobalizationHelper() {
}
@ -50,14 +52,6 @@ public class GlobalizationHelper {
preferedLocale = selectedLocale;
} else {
//
String lang = request.getParameter("lang");
if (lang != null && kernelConfig.hasLanguage(lang)) {
preferedLocale = new Locale(lang);
} else {
locales = request.getLocales();
// For everey element in the enumerator
@ -71,7 +65,6 @@ public class GlobalizationHelper {
}
}
}
}
} catch (NullPointerException ex) {
// Don't have to do anything because I want to fall back to default language anyway
// This case should only appear during setup
@ -98,7 +91,7 @@ public class GlobalizationHelper {
*/
public static Locale getSelectedLocale(ServletRequest request) {
// ServletRequest request = ((ServletRequest) DispatcherHelper.getRequest());
String paramValue = request.getParameter("selLang");
String paramValue = request.getParameter(LANG_PARAM);
java.util.Locale selectedLocale = null;
if (paramValue != null) {

View File

@ -304,7 +304,7 @@ public class Element {
* of the current element.
*/
public String getText() {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
org.w3c.dom.NodeList nl = m_element.getChildNodes();
@ -335,7 +335,7 @@ public class Element {
}
public String getCDATASection() {
StringBuffer result = new StringBuffer();
StringBuilder result = new StringBuilder();
org.w3c.dom.NodeList nl = m_element.getChildNodes();
@ -529,7 +529,7 @@ public class Element {
// will return the same XMLHash
List sortedList = getXMLFragments();
Collections.sort(sortedList);
StringBuffer xml = new StringBuffer();
StringBuilder xml = new StringBuilder();
Iterator xmlFragments = sortedList.iterator();
while (xmlFragments.hasNext()) {
xml.append(xmlFragments.next());

View File

@ -295,7 +295,7 @@ public class DataCollectionRenderer extends LockableImpl {
// Quasimodo: BEGIN
// Add attributes for date and time
Locale negLocale = com.arsdigita.dispatcher.DispatcherHelper.
Locale negLocale = com.arsdigita.globalization.GlobalizationHelper.
getNegotiatedLocale();
DateFormat dateFormatter = DateFormat.getDateInstance(
DateFormat.MEDIUM, negLocale);

View File

@ -108,6 +108,7 @@ public class ObjectListPortlet extends Portlet {
return (DataCollectionPropertyRenderer) entry[2];
}
@Override
public void initialize() {
super.initialize();
@ -159,7 +160,7 @@ public class ObjectListPortlet extends Portlet {
}
public void setCheckPermissions(boolean check) {
set(CHECK_PERMISSIONS, new Boolean(check));
set(CHECK_PERMISSIONS, Boolean.valueOf(check));
}
public boolean isCheckingPermissions() {
@ -176,7 +177,7 @@ public class ObjectListPortlet extends Portlet {
}
public void setDescendCategories(boolean descend) {
set(DESCEND_CATEGORIES, new Boolean(descend));
set(DESCEND_CATEGORIES, Boolean.valueOf(descend));
}
public boolean isDescendingCategories() {
@ -184,7 +185,7 @@ public class ObjectListPortlet extends Portlet {
}
public void setExcludeIndexObjects(boolean exclude) {
set(EXCLUDE_INDEX_OBJECTS, new Boolean(exclude));
set(EXCLUDE_INDEX_OBJECTS, Boolean.valueOf(exclude));
}
public boolean isExludingIndexObjects() {
@ -192,7 +193,7 @@ public class ObjectListPortlet extends Portlet {
}
public void setProperties( Object[] properties ) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
if( null != properties ) {
for( int i = 0; i < properties.length; i++ ) {
@ -209,7 +210,9 @@ public class ObjectListPortlet extends Portlet {
public String[] getProperties() {
String properties = (String) get( PROPERTIES );
if( null == properties ) return new String[] { };
if( null == properties ) {
return new String[] { };
}
StringTokenizer tok = new StringTokenizer( properties, "," );
String[] result = new String[ tok.countTokens() ];
@ -254,6 +257,7 @@ public class ObjectListPortlet extends Portlet {
}
@Override
protected AbstractPortletRenderer doGetPortletRenderer() {
return new ObjectListPortletRenderer(this);
}
@ -266,14 +270,17 @@ public class ObjectListPortlet extends Portlet {
m_portlet = portlet;
}
@Override
protected ACSObject loadObject() {
return null;
}
@Override
protected Category loadCategory() {
return m_portlet.getFilterCategory();
}
@Override
protected Category[] loadCategoryPath() {
Category cat = getCategory();
if (cat == null) {
@ -289,6 +296,7 @@ public class ObjectListPortlet extends Portlet {
return (Category[])path.toArray(new Category[path.size()]);
}
@Override
protected Category loadRootCategory() {
Category[] path = getCategoryPath();
return path.length == 0 ? null : path[0];

View File

@ -96,7 +96,7 @@ public abstract class AbstractObjectList
// Quasimodo: Begin
// Limit list to objects in the negotiated language
if (objects != null && objects.size() > 0) {
objects.addEqualsFilter("language", com.arsdigita.dispatcher.DispatcherHelper.getNegotiatedLocale().getLanguage());
objects.addEqualsFilter("language", com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale().getLanguage());
}
// Quasimodo: End

View File

@ -32,7 +32,7 @@ import com.arsdigita.cms.ContentItemXMLRenderer;
import com.arsdigita.cms.ExtraXMLGenerator;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.kernel.Party;
import com.arsdigita.kernel.permissions.PermissionDescriptor;
@ -105,7 +105,7 @@ public class GreetingItem extends AbstractComponent {
* language version.
*/
//ContentItem baseItem = bundle.getPrimaryInstance();
ContentItem baseItem = bundle.getInstance(DispatcherHelper.
ContentItem baseItem = bundle.getInstance(GlobalizationHelper.
getNegotiatedLocale().getLanguage());
// If there is no matching language version for this content item
if (baseItem == null) {

View File

@ -23,7 +23,7 @@ import com.arsdigita.cms.contenttypes.SciMemberSciDepartmentsCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
/**
*
@ -71,7 +71,7 @@ public class SciMemberSciDepartmentAddForm
globalize("cms.ui.select_one").localize())));
RelationAttributeCollection roles = new RelationAttributeCollection(
"SciDepartmentRole");
roles.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (roles.next()) {
RelationAttribute role;
@ -93,7 +93,7 @@ public class SciMemberSciDepartmentAddForm
RelationAttributeCollection statusColl =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus");
statusColl.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (statusColl.next()) {
RelationAttribute status;

View File

@ -23,7 +23,7 @@ import com.arsdigita.cms.contenttypes.SciOrganization;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
/**
*
@ -71,7 +71,7 @@ public class SciMemberSciOrganizationAddForm
globalize("cms.ui.select_one").localize())));
RelationAttributeCollection roles = new RelationAttributeCollection(
"SciOrganizationRole");
roles.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (roles.next()) {
RelationAttribute role;
@ -93,7 +93,7 @@ public class SciMemberSciOrganizationAddForm
RelationAttributeCollection statusColl =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus");
statusColl.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (statusColl.next()) {
RelationAttribute status;

View File

@ -23,7 +23,7 @@ import com.arsdigita.cms.contenttypes.SciMemberSciProjectsCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.dispatcher.DispatcherHelper;
import com.arsdigita.globalization.GlobalizationHelper;
/**
*
@ -71,7 +71,7 @@ public class SciMemberSciProjectAddForm
globalize("cms.ui.select_one").localize())));
RelationAttributeCollection roles = new RelationAttributeCollection(
"SciProjectRole");
roles.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (roles.next()) {
RelationAttribute role;
@ -93,7 +93,7 @@ public class SciMemberSciProjectAddForm
RelationAttributeCollection statusColl =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus");
statusColl.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().
statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
getLanguage());
while (statusColl.next()) {
RelationAttribute status;