Weitere Verbesserungen Multilanguage Support.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2205 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
114dab54a3
commit
09ee19c021
|
|
@ -55,7 +55,7 @@ public class ArticlePropertiesStep extends GenericArticlePropertiesStep {
|
|||
BasicPageForm editSheet;
|
||||
editSheet = new ArticlePropertyForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME,
|
||||
"Edit",
|
||||
"Edit", // curently add accepts just a String, not a Label
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.contenttypes.Bookmark;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
|
|
@ -35,8 +37,7 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
|||
* Authoring step to edit the simple attributes of the Bookmark content
|
||||
* type (and its subclasses).
|
||||
*/
|
||||
public class BookmarkPropertiesStep
|
||||
extends SimpleEditStep {
|
||||
public class BookmarkPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
|
|
@ -67,16 +68,18 @@ public class BookmarkPropertiesStep
|
|||
itemModel ) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
|
||||
|
||||
// sheet.add( "Page Title:", Bookmark.TITLE );
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.title"), Bookmark.TITLE );
|
||||
// sheet.add( "Name (URL):", Bookmark.NAME );
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.name"), Bookmark.NAME );
|
||||
// sheet.add( "Description:", Bookmark.DESCRIPTION );
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.summary"), Bookmark.DESCRIPTION );
|
||||
// sheet.add( "URL:", Bookmark.URL );
|
||||
sheet.add(new GlobalizedMessage
|
||||
("cms.contenttypes.ui.bookmark.url",Bookmark.RESOURCES),
|
||||
Bookmark.URL );
|
||||
|
|
|
|||
|
|
@ -29,6 +29,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.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
|
@ -67,9 +68,10 @@ public class EventPropertiesStep extends SimpleEditStep {
|
|||
BasicPageForm editSheet;
|
||||
|
||||
editSheet = new EventPropertyForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME, "Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
add(EDIT_SHEET_NAME,
|
||||
"Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getEventPropertySheet(itemModel));
|
||||
}
|
||||
|
|
@ -93,81 +95,20 @@ public class EventPropertiesStep extends SimpleEditStep {
|
|||
.globalize("cms.contenttypes.ui.name"), Event.NAME);
|
||||
sheet.add( EventGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.event.lead"), Event.LEAD);
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(EventGlobalizationUtil
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat
|
||||
.getDateInstance(DateFormat.LONG,
|
||||
GlobalizationHelper
|
||||
.getNegotiatedLocale())
|
||||
.format(page
|
||||
.getLaunchDate());
|
||||
} else {
|
||||
return (String) EventGlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
|
||||
sheet.add( EventGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.event.start_time"), Event.START_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
new DateTimeAttributeFormatter() );
|
||||
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
Event e = (Event) item;
|
||||
|
||||
if (e.getStartDate() != null) {
|
||||
|
||||
if (e.getStartTime() == null) {
|
||||
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, GlobalizationHelper.getNegotiatedLocale()).format(startDateTime);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
return (String) EventGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sheet.add( EventGlobalizationUtil.globalize("cms.contenttypes.ui.event.end_time"), Event.END_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
Event e = (Event) item;
|
||||
if (e.getEndDate() != null) {
|
||||
|
||||
if (e.getEndTime() == null) {
|
||||
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, GlobalizationHelper.getNegotiatedLocale()).format(endDateTime);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
return (String) EventGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
sheet.add( EventGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.event.end_time"), Event.END_DATE,
|
||||
new DateTimeAttributeFormatter() );
|
||||
if (!Event.getConfig().getHideDateDescription()) {
|
||||
sheet.add( EventGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.event.date_description"),
|
||||
|
|
@ -199,4 +140,63 @@ public class EventPropertiesStep extends SimpleEditStep {
|
|||
}
|
||||
return sheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private class which implements an AttributeFormatter interface for
|
||||
* date values.
|
||||
* Its format(...) class returns a string representation for either a
|
||||
* false or a true value.
|
||||
*/
|
||||
private static class DateTimeAttributeFormatter
|
||||
implements DomainObjectPropertySheet.AttributeFormatter {
|
||||
|
||||
/**
|
||||
* Constructor, does nothing.
|
||||
*/
|
||||
public DateTimeAttributeFormatter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatter for the value of an attribute.
|
||||
*
|
||||
* It currently relays on the prerequisite that the passed in property
|
||||
* attribute is in fact a date property. No type checking yet!
|
||||
*
|
||||
* Note: the format method has to be executed at each page request. Take
|
||||
* care to properly adjust globalization and localization here!
|
||||
*
|
||||
* @param obj Object containing the attribute to format.
|
||||
* @param attribute Name of the attribute to retrieve and format
|
||||
* @param state PageState of the request
|
||||
* @return A String representation of the retrieved boolean
|
||||
* attribute of the domain object.
|
||||
*/
|
||||
public String format(DomainObject obj, String attribute, PageState state) {
|
||||
|
||||
if ( obj != null && obj instanceof Event) {
|
||||
|
||||
Event event = (Event) obj;
|
||||
Object field = event.get(attribute);
|
||||
|
||||
if( field != null ) {
|
||||
// Note: No type safety here! We relay that it is
|
||||
// attached to a date property!
|
||||
return DateFormat.getDateTimeInstance(
|
||||
DateFormat.LONG,
|
||||
DateFormat.SHORT,
|
||||
GlobalizationHelper.getNegotiatedLocale()
|
||||
)
|
||||
.format(field);
|
||||
} else {
|
||||
return (String)GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,16 +84,24 @@ public class ImagePropertiesStep extends SimpleEditStep {
|
|||
BasicPageForm editSheet;
|
||||
|
||||
m_imageComponentKey = new StringParameter("imageComponent");
|
||||
ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey);
|
||||
m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap());
|
||||
ParameterSingleSelectionModel componentModel =
|
||||
new ParameterSingleSelectionModel(m_imageComponentKey);
|
||||
m_imageComponent = new MapComponentSelectionModel(componentModel,
|
||||
new HashMap());
|
||||
Map selectors = m_imageComponent.getComponentsMap();
|
||||
uploadSheet = new ImageUploadComponent();
|
||||
uploadSheet.getForm().addProcessListener(new ImageUploadListerner());
|
||||
selectors.put(UPLOAD, uploadSheet);
|
||||
|
||||
editSheet = new ImagePropertyForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
|
||||
add(UPLOAD_SHEET_NAME, "Upload", new WorkflowLockedComponentAccess(uploadSheet, itemModel), uploadSheet.getSaveCancelSection().getCancelButton());
|
||||
add(EDIT_SHEET_NAME,
|
||||
"Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
add(UPLOAD_SHEET_NAME,
|
||||
"Upload",
|
||||
new WorkflowLockedComponentAccess(uploadSheet, itemModel),
|
||||
uploadSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getImagePropertySheet(itemModel));
|
||||
}
|
||||
|
|
@ -114,7 +122,12 @@ public class ImagePropertiesStep extends SimpleEditStep {
|
|||
@Override
|
||||
protected ImageAsset getImageAsset(PageState state) {
|
||||
try {
|
||||
ImageAsset image = ((Image) itemModel.getSelectedItem(state)).getImage().proportionalResizeToWidth(Image.getConfig().getMaxImageWidth());
|
||||
ImageAsset image = ((Image)
|
||||
itemModel
|
||||
.getSelectedItem(state))
|
||||
.getImage()
|
||||
.proportionalResizeToWidth(Image.getConfig()
|
||||
.getMaxImageWidth());
|
||||
return image;
|
||||
} catch (NullPointerException ex) {
|
||||
return null;
|
||||
|
|
@ -124,74 +137,40 @@ public class ImagePropertiesStep extends SimpleEditStep {
|
|||
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), Image.TITLE);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.title"),
|
||||
Image.TITLE);
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.name"),
|
||||
Image.NAME);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
@Override
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
|
||||
sheet.add(ImageGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.image.width"), Image.WIDTH);
|
||||
.globalize("cms.contenttypes.ui.image.width"),
|
||||
Image.WIDTH);
|
||||
sheet.add(ImageGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.image.height"), Image.HEIGHT);
|
||||
.globalize("cms.contenttypes.ui.image.height"),
|
||||
Image.HEIGHT);
|
||||
sheet.add(ImageGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.image.caption"), Image.CAPTION);
|
||||
.globalize("cms.contenttypes.ui.image.caption"),
|
||||
Image.CAPTION);
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.description"), Image.DESCRIPTION);
|
||||
.globalize("cms.contenttypes.ui.description"),
|
||||
Image.DESCRIPTION);
|
||||
sheet.add(ImageGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.image.artist"), Image.ARTIST);
|
||||
.globalize("cms.contenttypes.ui.image.artist"),
|
||||
Image.ARTIST);
|
||||
sheet.add(ImageGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.image.publishDate"),
|
||||
Image.PUBLISHDATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
@Override
|
||||
public String format(DomainObject item, String attribute, PageState state) {
|
||||
Image image = (Image) item;
|
||||
if ((image.getPublishDate()) != null) {
|
||||
if (image.getSkipDay().booleanValue() == true || image.getSkipMonth().booleanValue() == true) {
|
||||
String month = "";
|
||||
if (image.getSkipMonth().booleanValue() == false) {
|
||||
Locale locale = GlobalizationHelper.getNegotiatedLocale();
|
||||
|
||||
if (locale != null) {
|
||||
|
||||
DateFormatSymbols dfs = new DateFormatSymbols(locale);
|
||||
String[] months = dfs.getMonths();
|
||||
month = months[image.getPublishDate().getMonth()] + " ";
|
||||
}
|
||||
}
|
||||
String year = Integer.toString(image.getPublishDate().getYear() + 1900);
|
||||
return month + year;
|
||||
} else {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG).format(image.getPublishDate());
|
||||
}
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
new ImageDateAttributeFormatter()
|
||||
);
|
||||
sheet.add(ImageGlobalizationUtil.globalize(
|
||||
"cms.contenttypes.ui.image.source"),
|
||||
Image.SOURCE);
|
||||
|
|
@ -331,4 +310,78 @@ public class ImagePropertiesStep extends SimpleEditStep {
|
|||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Private class which implements an AttributeFormatter interface for
|
||||
* boolean values.
|
||||
* Its format(...) class returns a string representation for either a
|
||||
* false or a true value.
|
||||
*/
|
||||
private static class ImageDateAttributeFormatter
|
||||
implements DomainObjectPropertySheet.AttributeFormatter {
|
||||
|
||||
/**
|
||||
* Constructor, does nothing.
|
||||
*/
|
||||
public ImageDateAttributeFormatter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatter for the value of an attribute.
|
||||
*
|
||||
* It currently relays on the prerequisite that the passed in property
|
||||
* attribute is in fact a date property. No type checking yet!
|
||||
*
|
||||
* Note: the format method has to be executed at each page request. Take
|
||||
* care to properly adjust globalization and localization here!
|
||||
*
|
||||
* @param obj Object containing the attribute to format.
|
||||
* @param attribute Name of the attribute to retrieve and format
|
||||
* @param state PageState of the request
|
||||
* @return A String representation of the retrieved boolean
|
||||
* attribute of the domain object.
|
||||
*/
|
||||
public String format(DomainObject obj, String attribute, PageState state) {
|
||||
|
||||
if ( obj != null && obj instanceof Image) {
|
||||
|
||||
Image image = (Image) obj;
|
||||
|
||||
if ((image.getPublishDate()) != null) {
|
||||
if (image.getSkipDay().booleanValue() == true
|
||||
|| image.getSkipMonth().booleanValue() == true) {
|
||||
String month = "";
|
||||
if (image.getSkipMonth().booleanValue() == false) {
|
||||
Locale locale = GlobalizationHelper.getNegotiatedLocale();
|
||||
|
||||
if (locale != null) {
|
||||
|
||||
DateFormatSymbols dfs = new DateFormatSymbols(locale);
|
||||
String[] months = dfs.getMonths();
|
||||
month = months[image.getPublishDate().getMonth()]
|
||||
+ " ";
|
||||
}
|
||||
}
|
||||
String year = Integer
|
||||
.toString(image.getPublishDate().getYear()
|
||||
+ 1900);
|
||||
return month + year;
|
||||
} else {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(image.getPublishDate());
|
||||
}
|
||||
|
||||
} else {
|
||||
return (String)GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -86,19 +86,7 @@ public class MultiPartArticleEdit extends SimpleEditStep {
|
|||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(page.getLaunchDate());
|
||||
} else {
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
});
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"),
|
||||
MultiPartArticle.SUMMARY );
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ public class Organization extends ContentPage {
|
|||
public static final String IMAGE_ID = "imageID";
|
||||
|
||||
/** Data object type for tihs domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Organization";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.Organization";
|
||||
|
||||
public Organization () {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public class OrganizationImageStep extends SimpleEditStep {
|
|||
add( IMAGE_SHEET_NAME,
|
||||
"Change (OrgImageStep)",
|
||||
new WorkflowLockedComponentAccess(new OrganizationImageForm(
|
||||
"OrganizationImageForm", itemModel, this),
|
||||
"OrganizationImageForm", itemModel, this),
|
||||
itemModel));
|
||||
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel, false);
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ import java.math.BigDecimal;
|
|||
* reference purposes. Reference code is an arbitrary string that is used for
|
||||
* out-of-system reference. The type inherits name (filename), title, body
|
||||
* (TextAsset), and metadata from
|
||||
* <code>com.arsdigita.cms.contenttypes.Genericrticle</code>, and also provides the
|
||||
* capability to associate contact information with this press release.
|
||||
* <code>com.arsdigita.cms.contenttypes.Genericrticle</code>, and also provides
|
||||
* the capability to associate contact information with this press release.
|
||||
*
|
||||
* @version $Revision: #6 $ $Date: 2004/08/17 $
|
||||
**/
|
||||
|
|
@ -41,14 +41,15 @@ public class PressRelease extends GenericArticle {
|
|||
|
||||
// is the CardBin sort of contact support needed here?
|
||||
// implements ContactSupport {
|
||||
/** PDL property name for contact info */
|
||||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** PDL property name for summary */
|
||||
public static final String SUMMARY = "summary";
|
||||
/** PDL property name for contact info */
|
||||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** PDL property name for reference code */
|
||||
public static final String REFERENCE_CODE = "referenceCode";
|
||||
/** Data object type for this domain object */
|
||||
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contenttypes.PressRelease";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.PressRelease";
|
||||
|
||||
public PressRelease() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
@ -77,14 +78,6 @@ public class PressRelease extends GenericArticle {
|
|||
}
|
||||
|
||||
/* accessors *****************************************************/
|
||||
public String getContactInfo() {
|
||||
return (String) get(CONTACT_INFO);
|
||||
}
|
||||
|
||||
public void setContactInfo(String contactInfo) {
|
||||
set(CONTACT_INFO, contactInfo);
|
||||
}
|
||||
|
||||
public String getSummary() {
|
||||
return (String) get(SUMMARY);
|
||||
}
|
||||
|
|
@ -93,6 +86,14 @@ public class PressRelease extends GenericArticle {
|
|||
set(SUMMARY, summary);
|
||||
}
|
||||
|
||||
public String getContactInfo() {
|
||||
return (String) get(CONTACT_INFO);
|
||||
}
|
||||
|
||||
public void setContactInfo(String contactInfo) {
|
||||
set(CONTACT_INFO, contactInfo);
|
||||
}
|
||||
|
||||
public String getReferenceCode() {
|
||||
return (String) get(REFERENCE_CODE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
press_release.authoring.basic_properties.description=Edit the title, name, contact info, summary, ref. code and release date
|
||||
cms.contenttypes.ui.pressrelease.contact_info=Contact Info:
|
||||
cms.contenttypes.ui.pressrelease.ref_code=Ref. Code:
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
press_release.authoring.basic_properties.description=Editieren von Titel, Name, Kontakt Information, Zusammenfassung, Ref. Id und Erscheinungsdatum
|
||||
cms.contenttypes.ui.pressrelease.contact_info=Kontaktinformation:
|
||||
cms.contenttypes.ui.pressrelease.ref_code=Referenz:
|
||||
|
|
|
|||
|
|
@ -1 +1,3 @@
|
|||
press_release.authoring.basic_properties.description=Edit the title, name, contact info, summary, ref. code and release date
|
||||
cms.contenttypes.ui.pressrelease.contact_info=Contact:
|
||||
cms.contenttypes.ui.pressrelease.ref_code=Code de r\u00e9f\u00e9rence:
|
||||
|
|
|
|||
|
|
@ -24,13 +24,14 @@ import com.arsdigita.cms.ContentPage;
|
|||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.PressRelease;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.cms.contenttypes.util.PressReleaseGlobalizationUtil;
|
||||
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.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
import java.text.DateFormat;
|
||||
|
||||
|
|
@ -39,13 +40,18 @@ import java.text.DateFormat;
|
|||
* (and its subclasses). The attributes edited are 'name', 'title', 'release
|
||||
* date' and 'reference code'. This authoring step replaces the
|
||||
* <code>com.arsdigita.ui.authoring.PageEdit</code> step for this type.
|
||||
**/
|
||||
public class PressReleasePropertiesStep
|
||||
extends SimpleEditStep {
|
||||
*/
|
||||
public class PressReleasePropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param itemModel
|
||||
* @param parent
|
||||
*/
|
||||
public PressReleasePropertiesStep( ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent ) {
|
||||
super( itemModel, parent );
|
||||
|
|
@ -54,7 +60,12 @@ public class PressReleasePropertiesStep
|
|||
BasicPageForm editSheet;
|
||||
|
||||
editSheet = new PressReleasePropertyForm( itemModel, this);
|
||||
add( EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
// SecurityPropertyEditor#add currently accepts just a String as label
|
||||
// parameter. As soon as it is refactored, a GlobalizedMessage or a
|
||||
// Label should be used.
|
||||
add( EDIT_SHEET_NAME,
|
||||
"Edit",
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton() );
|
||||
|
||||
setDisplayComponent( getPressReleasePropertySheet( itemModel ) );
|
||||
|
|
@ -73,28 +84,27 @@ public class PressReleasePropertiesStep
|
|||
itemModel ) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel );
|
||||
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.name"), PressRelease.NAME);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.contact_info"), PressRelease.CONTACT_INFO );
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.summary"), PressRelease.SUMMARY );
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), PressRelease.TITLE);
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.title"),
|
||||
PressRelease.TITLE);
|
||||
sheet.add( GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.name"),
|
||||
PressRelease.NAME);
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.summary"),
|
||||
PressRelease.SUMMARY );
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if(page.getLaunchDate() != null) {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(page.getLaunchDate());
|
||||
} else {
|
||||
return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.ref_code"), PressRelease.REFERENCE_CODE );
|
||||
sheet.add(PressReleaseGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.pressrelease.contact_info"),
|
||||
PressRelease.CONTACT_INFO );
|
||||
sheet.add(PressReleaseGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.pressrelease.ref_code"),
|
||||
PressRelease.REFERENCE_CODE );
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.arsdigita.bebop.parameters.ParameterModel;
|
|||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.PressRelease;
|
||||
import com.arsdigita.cms.contenttypes.util.PressReleaseGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
||||
|
|
@ -39,16 +40,18 @@ import com.arsdigita.cms.util.GlobalizationUtil;
|
|||
* Form to edit the basic properties of a press release. These are name, title,
|
||||
* release date and reference code. This form can be extended to create forms
|
||||
* for PressRelease subclasses.
|
||||
**/
|
||||
*/
|
||||
public class PressReleasePropertyForm extends BasicPageForm
|
||||
implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private PressReleasePropertiesStep m_step;
|
||||
|
||||
/** contact info parameter name */
|
||||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** summary parameter name */
|
||||
public static final String SUMMARY = "summary";
|
||||
/** contact info parameter name */
|
||||
public static final String CONTACT_INFO = "contactInfo";
|
||||
/** Reference code parameter name */
|
||||
public static final String REF_CODE = "ref_code";
|
||||
/** Release date parameter name */
|
||||
|
|
@ -73,7 +76,8 @@ public class PressReleasePropertyForm extends BasicPageForm
|
|||
* PressRelease to work on
|
||||
* @param step The PressReleasePropertiesStep which controls this form.
|
||||
*/
|
||||
public PressReleasePropertyForm( ItemSelectionModel itemModel, PressReleasePropertiesStep step ) {
|
||||
public PressReleasePropertyForm( ItemSelectionModel itemModel,
|
||||
PressReleasePropertiesStep step ) {
|
||||
super( ID, itemModel );
|
||||
m_step = step;
|
||||
addSubmissionListener(this);
|
||||
|
|
@ -85,21 +89,24 @@ public class PressReleasePropertyForm extends BasicPageForm
|
|||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.contact_info")));
|
||||
ParameterModel contactInfoParam = new StringParameter(CONTACT_INFO);
|
||||
CMSDHTMLEditor contactInfo = new CMSDHTMLEditor(contactInfoParam);
|
||||
contactInfo.setCols(40);
|
||||
contactInfo.setRows(10);
|
||||
add(contactInfo);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.summary")));
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.summary")));
|
||||
ParameterModel summaryParam = new StringParameter(SUMMARY);
|
||||
TextArea summary = new TextArea(summaryParam);
|
||||
summary.setCols(40);
|
||||
summary.setRows(7);
|
||||
add(summary);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.reference_code")));
|
||||
add(new Label(PressReleaseGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.pressrelease.contact_info")));
|
||||
ParameterModel contactInfoParam = new StringParameter(CONTACT_INFO);
|
||||
CMSDHTMLEditor contactInfo = new CMSDHTMLEditor(contactInfoParam);
|
||||
contactInfo.setCols(40);
|
||||
contactInfo.setRows(10);
|
||||
add(contactInfo);
|
||||
|
||||
add(new Label(PressReleaseGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.pressrelease.ref_code")));
|
||||
ParameterModel refCodeParam = new StringParameter(REF_CODE);
|
||||
TextField refCode = new TextField(refCodeParam);
|
||||
refCode.setSize(30);
|
||||
|
|
@ -107,18 +114,22 @@ public class PressReleasePropertyForm extends BasicPageForm
|
|||
add(refCode);
|
||||
}
|
||||
|
||||
/** Form initialisation hook. Fills widgets with data. */
|
||||
/**
|
||||
* Form initialisation hook. Fills widgets with data.
|
||||
*/
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PressRelease release
|
||||
= (PressRelease) super.initBasicWidgets(fse);
|
||||
|
||||
data.put(CONTACT_INFO, release.getContactInfo());
|
||||
data.put(SUMMARY, release.getSummary());
|
||||
data.put(CONTACT_INFO, release.getContactInfo());
|
||||
data.put(REF_CODE, release.getReferenceCode());
|
||||
}
|
||||
|
||||
/** Cancels streamlined editing. */
|
||||
/**
|
||||
* Cancels streamlined editing.
|
||||
*/
|
||||
public void submitted( FormSectionEvent fse ) {
|
||||
if (m_step != null &&
|
||||
getSaveCancelSection().getCancelButton()
|
||||
|
|
@ -127,7 +138,9 @@ public class PressReleasePropertyForm extends BasicPageForm
|
|||
}
|
||||
}
|
||||
|
||||
/** Form processing hook. Saves PressRelease object. */
|
||||
/**
|
||||
* Form processing hook. Saves PressRelease object.
|
||||
*/
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
|
||||
|
|
@ -138,9 +151,9 @@ public class PressReleasePropertyForm extends BasicPageForm
|
|||
&& getSaveCancelSection().getSaveButton()
|
||||
.isSelected(fse.getPageState())) {
|
||||
|
||||
release.setReferenceCode((String) data.get(REF_CODE));
|
||||
release.setContactInfo((String) data.get(CONTACT_INFO));
|
||||
release.setSummary((String) data.get(SUMMARY));
|
||||
release.setContactInfo((String) data.get(CONTACT_INFO));
|
||||
release.setReferenceCode((String) data.get(REF_CODE));
|
||||
release.save();
|
||||
}
|
||||
if (m_step != null) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Jens Pelzetter, Center of Social Politic Research, University of Bremen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.util;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.util.*;
|
||||
import com.arsdigita.globalization.Globalized;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* Compilation of methods to simplify the handling of globalizing keys.
|
||||
* Basically it adds the name of package's resource bundle files to the
|
||||
* globalize methods and forwards to GlobalizedMessage, shortening the
|
||||
* method invocation in the various application classes.
|
||||
*
|
||||
*/
|
||||
public class PressReleaseGlobalizationUtil implements Globalized {
|
||||
|
||||
/** Name of Java resource files to handle PressRelease's globalisation. */
|
||||
final public static String BUNDLE_NAME =
|
||||
"com.arsdigita.cms.contenttypes.PressReleaseResources";
|
||||
|
||||
/**
|
||||
* Returns a globalized message using the package specific bundle,
|
||||
* provided by BUNDLE_NAME.
|
||||
*/
|
||||
public static GlobalizedMessage globalize (String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a globalized message object, using the package specific bundle,
|
||||
* as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
|
||||
* interpolate into the retrieved message using the MessageFormat class.
|
||||
*/
|
||||
public static GlobalizedMessage globalize (String key, Object[] args) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1,5 @@
|
|||
service.authoring.basic_properties.description=Edit the title, name, contact info, summary, ref. code and release date
|
||||
cms.contenttypes.ui.service.services_provided=Services Provided:
|
||||
cms.contenttypes.ui.service.opening_times=Opening Times:
|
||||
cms.contenttypes.ui.service.contacts=Contacts:
|
||||
cms.contenttypes.ui.service.address=Address:
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
service.authoring.basic_properties.description=Editieren von Titel, Name, etc.
|
||||
cms.contenttypes.ui.service.services_provided=Verf\u00fcgbarer Service:
|
||||
cms.contenttypes.ui.service.opening_times=\u00d6ffnungszeiten:
|
||||
cms.contenttypes.ui.service.contacts=Kontakte:
|
||||
cms.contenttypes.ui.service.address=Adresse:
|
||||
|
|
|
|||
|
|
@ -1 +1,5 @@
|
|||
service.authoring.basic_properties.description=Edit the title, name, contact info, summary, ref. code and release date
|
||||
cms.contenttypes.ui.service.services_provided=Services propos\u00e9s:
|
||||
cms.contenttypes.ui.service.opening_times=Heures d'ouverture:
|
||||
cms.contenttypes.ui.service.contacts=Contacts:
|
||||
cms.contenttypes.ui.service.address=Addresse:
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import com.arsdigita.cms.ContentPage;
|
|||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.Service;
|
||||
import com.arsdigita.cms.contenttypes.util.ServiceGlobalizationUtil;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
|
|
@ -56,7 +57,9 @@ public class ServicePropertiesStep extends SimpleEditStep {
|
|||
BasicPageForm editSheet;
|
||||
|
||||
editSheet = new ServicePropertyForm(itemModel,this);
|
||||
add(EDIT_SHEET_NAME, "Edit", new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
add(EDIT_SHEET_NAME,
|
||||
"Edit", // currently just a String is acepted!
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getServicePropertySheet(itemModel));
|
||||
|
|
@ -76,29 +79,33 @@ public class ServicePropertiesStep extends SimpleEditStep {
|
|||
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.name"), Service.NAME);
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.title"), Service.TITLE);
|
||||
sheet.add( GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.title"),
|
||||
Service.TITLE);
|
||||
sheet.add( GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.name"),
|
||||
Service.NAME);
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.launch_date"),
|
||||
sheet.add(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.launch_date"),
|
||||
ContentPage.LAUNCH_DATE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
ContentPage page = (ContentPage) item;
|
||||
if(page.getLaunchDate() != null) {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG)
|
||||
.format(page.getLaunchDate());
|
||||
} else {
|
||||
return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
new LaunchDateAttributeFormatter() );
|
||||
}
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"), Service.SUMMARY);
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.services_provided"), Service.SERVICES_PROVIDED);
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.opening_times"), Service.OPENING_TIMES);
|
||||
sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.contacts"), Service.CONTACTS);
|
||||
sheet.add( GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.summary"),
|
||||
Service.SUMMARY);
|
||||
sheet.add( ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.services_provided"),
|
||||
Service.SERVICES_PROVIDED);
|
||||
sheet.add( ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.opening_times"),
|
||||
Service.OPENING_TIMES);
|
||||
sheet.add( ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.address"),
|
||||
Service.ADDRESS);
|
||||
sheet.add( ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.contacts"),
|
||||
Service.CONTACTS);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,15 +30,18 @@ import com.arsdigita.bebop.parameters.ParameterModel;
|
|||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.Service;
|
||||
import com.arsdigita.cms.contenttypes.util.ServiceGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
|
||||
/**
|
||||
* Form to edit the basic properties of an service. This form can be extended to
|
||||
* create forms for Service subclasses.
|
||||
**/
|
||||
*/
|
||||
public class ServicePropertyForm extends BasicPageForm
|
||||
implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
private ServicePropertiesStep m_step;
|
||||
|
||||
|
|
@ -73,7 +76,8 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
* Service to work on
|
||||
* @param step The ServicePropertiesStep which controls this form.
|
||||
*/
|
||||
public ServicePropertyForm( ItemSelectionModel itemModel, ServicePropertiesStep step ) {
|
||||
public ServicePropertyForm( ItemSelectionModel itemModel,
|
||||
ServicePropertiesStep step ) {
|
||||
super( ID, itemModel );
|
||||
m_step = step;
|
||||
addSubmissionListener(this);
|
||||
|
|
@ -85,14 +89,16 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.summary")));
|
||||
add(new Label(GlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.summary")));
|
||||
ParameterModel summaryParam = new StringParameter(SUMMARY);
|
||||
TextArea summary = new TextArea(summaryParam);
|
||||
summary.setCols(40);
|
||||
summary.setRows(5);
|
||||
add(summary);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.services_provided")));
|
||||
add(new Label(ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.services_provided")));
|
||||
ParameterModel servicesProvidedParam =
|
||||
new StringParameter(SERVICES_PROVIDED);
|
||||
TextArea servicesProvided = new TextArea(servicesProvidedParam);
|
||||
|
|
@ -100,14 +106,16 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
servicesProvided.setRows(5);
|
||||
add(servicesProvided);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.opening_times")));
|
||||
add(new Label(ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.opening_times")));
|
||||
ParameterModel openingTimesParam = new StringParameter(OPENING_TIMES);
|
||||
TextArea openingTimes = new TextArea(openingTimesParam);
|
||||
openingTimes.setCols(40);
|
||||
openingTimes.setRows(5);
|
||||
add(openingTimes);
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.address")));
|
||||
add(new Label(ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.address")));
|
||||
ParameterModel addressParam = new StringParameter(ADDRESS);
|
||||
TextArea address = new TextArea(addressParam);
|
||||
address.setCols(40);
|
||||
|
|
@ -115,7 +123,8 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
add(address);
|
||||
|
||||
|
||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.contacts")));
|
||||
add(new Label(ServiceGlobalizationUtil
|
||||
.globalize("cms.contenttypes.ui.service.contacts")));
|
||||
ParameterModel contactsParam = new StringParameter(CONTACTS);
|
||||
TextArea contacts = new TextArea(contactsParam);
|
||||
contacts.setCols(40);
|
||||
|
|
@ -124,7 +133,9 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
|
||||
}
|
||||
|
||||
/** Form initialisation hook. Fills widgets with data. */
|
||||
/**
|
||||
* Form initialisation hook. Fills widgets with data.
|
||||
*/
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
Service service = (Service) super.initBasicWidgets(fse);
|
||||
|
|
@ -136,7 +147,9 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
data.put(CONTACTS, service.getContacts());
|
||||
}
|
||||
|
||||
/** Cancels streamlined editing. */
|
||||
/**
|
||||
* Cancels streamlined editing.
|
||||
*/
|
||||
public void submitted( FormSectionEvent fse ) {
|
||||
if (m_step != null &&
|
||||
getSaveCancelSection().getCancelButton()
|
||||
|
|
@ -145,7 +158,9 @@ public class ServicePropertyForm extends BasicPageForm
|
|||
}
|
||||
}
|
||||
|
||||
/** Form processing hook. Saves Service object. */
|
||||
/**
|
||||
* Form processing hook. Saves Service object.
|
||||
*/
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Jens Pelzetter, University of Bremen
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.util;
|
||||
|
||||
import com.arsdigita.globalization.Globalized;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
* Compilation of methods to simplify the handling of globalizing keys.
|
||||
* Basically it adds the name of package's resource bundle files to the
|
||||
* globalize methods and forwards to GlobalizedMessage, shortening the
|
||||
* method invocation in the various application classes.
|
||||
*
|
||||
*/
|
||||
public class ServiceGlobalizationUtil implements Globalized {
|
||||
|
||||
/** Name of Java resource files to handle PressRelease's globalisation. */
|
||||
final public static String BUNDLE_NAME =
|
||||
"com.arsdigita.cms.contenttypes.ServiceResources";
|
||||
|
||||
/**
|
||||
* Returns a globalized message using the package specific bundle,
|
||||
* provided by BUNDLE_NAME.
|
||||
*/
|
||||
public static GlobalizedMessage globalize (String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a globalized message object, using the package specific bundle,
|
||||
* as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
|
||||
* interpolate into the retrieved message using the MessageFormat class.
|
||||
*/
|
||||
public static GlobalizedMessage globalize (String key, Object[] args) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||
}
|
||||
}
|
||||
|
|
@ -45,8 +45,7 @@ public class DefaultImageBrowserModelBuilder extends LockableImpl
|
|||
implements ImageBrowserModelBuilder, PaginationModelBuilder {
|
||||
|
||||
private SingleSelectionModel m_keywordModel;
|
||||
private static ImageBrowserModel EMPTY_MODEL =
|
||||
new EmptyImageBrowserModel();
|
||||
private static ImageBrowserModel EMPTY_MODEL = new EmptyImageBrowserModel();
|
||||
private ImageBrowser m_imageBrowser;
|
||||
private RequestLocal m_size;
|
||||
private String m_key;
|
||||
|
|
|
|||
|
|
@ -25,11 +25,17 @@ import com.arsdigita.bebop.event.ActionListener;
|
|||
import com.arsdigita.bebop.event.RequestEvent;
|
||||
import com.arsdigita.bebop.event.RequestListener;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.ContentItemPage;
|
||||
import com.arsdigita.cms.ui.SecurityPropertyEditor;
|
||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.toolbox.ui.ComponentAccess;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
import java.text.DateFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -98,14 +104,14 @@ public class SimpleEditStep extends SecurityPropertyEditor
|
|||
* Construct a new SimpleEditStep component
|
||||
*
|
||||
* @param itemModel The {@link ItemSelectionModel} which will
|
||||
* be responsible for loading the current item
|
||||
* be responsible for loading the current item
|
||||
*
|
||||
* @param parent The parent wizard which contains the form.
|
||||
* The component may use the wizard's methods, such as stepForward
|
||||
* and stepBack, in its process listener.
|
||||
* @param parent The parent wizard which contains the form. The component
|
||||
* may use the wizard's methods, such as stepForward
|
||||
* and stepBack, in its process listener.
|
||||
*
|
||||
* @param paramSuffix Additional global parameter name suffix if
|
||||
* there are multiple SimpleEditStep instances in an authoring kit.
|
||||
* @param paramSuffix Additional global parameter name suffix if there are
|
||||
* multiple SimpleEditStep instances in an authoring kit.
|
||||
*/
|
||||
public SimpleEditStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent,
|
||||
|
|
@ -229,4 +235,62 @@ public class SimpleEditStep extends SecurityPropertyEditor
|
|||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Public class which implements an AttributeFormatter interface for
|
||||
* boolean values.
|
||||
* Its format(...) class returns a string representation for either a
|
||||
* false or a true value.
|
||||
*/
|
||||
protected static class LaunchDateAttributeFormatter
|
||||
implements DomainObjectPropertySheet.AttributeFormatter {
|
||||
|
||||
/**
|
||||
* Constructor, does nothing.
|
||||
*/
|
||||
public LaunchDateAttributeFormatter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Formatter for the value of a (LaunchDate) attribute.
|
||||
*
|
||||
* It currently relays on the prerequisite that the passed in property
|
||||
* attribute is in fact a date property. No type checking yet!
|
||||
*
|
||||
* Note: the format method has to be executed at each page request. Take
|
||||
* care to properly adjust globalization and localization here!
|
||||
*
|
||||
* @param obj Object containing the attribute to format.
|
||||
* @param attribute Name of the attribute to retrieve and format
|
||||
* @param state PageState of the request
|
||||
* @return A String representation of the retrieved boolean
|
||||
* attribute of the domain object.
|
||||
*/
|
||||
public String format(DomainObject obj, String attribute, PageState state) {
|
||||
|
||||
if ( obj != null && obj instanceof ContentPage) {
|
||||
|
||||
ContentPage page = (ContentPage) obj;
|
||||
Object field = page.get(attribute);
|
||||
|
||||
if( field != null ) {
|
||||
// Note: No type safety here! We relay that it is
|
||||
// attached to a date property!
|
||||
return DateFormat.getDateInstance(
|
||||
DateFormat.LONG,
|
||||
GlobalizationHelper.getNegotiatedLocale()
|
||||
)
|
||||
.format(field);
|
||||
} else {
|
||||
return (String)GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import org.apache.log4j.Logger;
|
|||
* @author Michael Pih
|
||||
* @version $Id: OptionGroup.java 738 2005-09-01 12:36:52Z sskracic $ */
|
||||
public abstract class OptionGroup extends Widget
|
||||
implements BebopConstants {
|
||||
implements BebopConstants {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger( OptionGroup.class );
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
*
|
||||
* @param label The label for the attribute
|
||||
* @param attribute The name for the attribute. Could be a simple name
|
||||
* or a compound path, such as "foo.bar.baz"
|
||||
* or a compound path, such as "foo.bar.baz" (usually a
|
||||
* PDL property)
|
||||
* @deprecated use add(GlobalizedMessage label, String attribute) instead
|
||||
*/
|
||||
public void add(String label, String attribute) {
|
||||
|
|
@ -134,7 +135,8 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
*
|
||||
* @param label The label for the attribute
|
||||
* @param attribute The name for the attribute. Could be a simple name
|
||||
* or a compound path, such as "foo.bar.baz"
|
||||
* or a compound path, such as "foo.bar.baz" (usually a
|
||||
* PDL property)
|
||||
*/
|
||||
public void add(GlobalizedMessage label, String attribute) {
|
||||
// Determine if we are dealing with a simple string or a complex
|
||||
|
|
@ -152,8 +154,11 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
* to a String.
|
||||
*
|
||||
* @param label The label for the attribute
|
||||
* @param attribute The name for the attribute
|
||||
* @param attribute The name for the attribute. Could be a simple name
|
||||
* or a compound path, such as "foo.bar.baz" (usually a
|
||||
* PDL property)
|
||||
* @param formatter An instance of AttributeFormatter
|
||||
*
|
||||
* @deprecated Use add(GlobalizedMessage label, String attribute,
|
||||
* AttributeFormatter f) instead
|
||||
*/
|
||||
|
|
@ -167,7 +172,9 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
* to a String.
|
||||
*
|
||||
* @param label The label for the attribute
|
||||
* @param attribute The name for the attribute
|
||||
* @param attribute The name for the attribute. Could be a simple name
|
||||
* or a compound path, such as "foo.bar.baz" (usually a
|
||||
* PDL property)
|
||||
* @param formatter An instance of AttributeFormatter
|
||||
*/
|
||||
public void add(GlobalizedMessage label, String attribute,
|
||||
|
|
@ -190,7 +197,9 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
}
|
||||
|
||||
/**
|
||||
* An interface which can transform some property to a string.
|
||||
* An interface which can transform the value of a (domain) property to a
|
||||
* string.
|
||||
*
|
||||
* Most of the time, classes which implement this interface will just
|
||||
* return <code>object.get(attribute).toString()</code>
|
||||
* <p>In case of associations, however, more complicated processing
|
||||
|
|
@ -199,16 +208,26 @@ public class DomainObjectPropertySheet extends PropertySheet {
|
|||
public interface AttributeFormatter {
|
||||
|
||||
/**
|
||||
* Retrieve the string value for the specified attribute
|
||||
* of the object.
|
||||
* Formatter for the value of an attribute. It has to retrieve the value
|
||||
* for the specified attribute of the object and format it as an string
|
||||
* if it is one already.
|
||||
*
|
||||
* Note: the format method has to be executed at each page request. Take
|
||||
* care to properly adjust globalization and localization inside thes
|
||||
* method and not earlier in one of the classes using it!
|
||||
*
|
||||
* @param obj The domain object
|
||||
* @param attribute The name of the attribute to get
|
||||
* @param obj Object containing the attribute to format.
|
||||
* @param attribute Name of the attribute to retrieve and format
|
||||
* @param state PageState of the request
|
||||
* @return A String representation of the retrieved attribute
|
||||
* of the domain object.
|
||||
*/
|
||||
String format(DomainObject obj, String attribute, PageState state);
|
||||
}
|
||||
|
||||
// Associates a label with the attribute and the formatter
|
||||
/**
|
||||
* Associates a label with the attribute and the formatter.
|
||||
*/
|
||||
protected static class Property {
|
||||
|
||||
private GlobalizedMessage m_label;
|
||||
|
|
|
|||
Loading…
Reference in New Issue