SecurityPropertyEdit korrigiert, akzeptiert nun auch GlobalizedMessage für Label.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2209 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-06-15 00:07:05 +00:00
parent 35f35e428f
commit e8a7eb4967
15 changed files with 95 additions and 72 deletions

View File

@ -65,7 +65,7 @@ public class AgendaPropertiesStep extends SimpleEditStep {
editSheet = new AgendaPropertyForm(itemModel, this);
add(EDIT_SHEET_NAME,
"Edit",
GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(editSheet, itemModel),
editSheet.getSaveCancelSection().getCancelButton() );

View File

@ -34,6 +34,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.Service;
import com.arsdigita.cms.util.GlobalizationUtil;
import java.math.BigDecimal;
@ -62,7 +63,7 @@ public class OrganizationImageStep extends SimpleEditStep {
// as soon as SecuityPropertyEditor is refactored to accept a Label or a
// GlobalizedMessage, the Label String has to be globalized!
add( IMAGE_SHEET_NAME,
"Change (OrgImageStep)",
GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(new OrganizationImageForm(
"OrganizationImageForm", itemModel, this),
itemModel));

View File

@ -26,7 +26,7 @@ import com.arsdigita.cms.contenttypes.util.OrganizationGlobalizationUtil;
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.authoring.WorkflowLockedComponentAccess;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
@ -51,7 +51,8 @@ public class OrganizationPropertiesStep
BasicPageForm editSheet;
editSheet = new OrganizationPropertyForm( itemModel, this);
add( EDIT_SHEET_NAME, "Edit",
add( EDIT_SHEET_NAME,
GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(editSheet, itemModel),
editSheet.getSaveCancelSection().getCancelButton() );

View File

@ -60,24 +60,25 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
itemModel, this);
add(ADD_ADDRESS_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.attach_address").localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.attach_address"),
new AttachAddressWorkflowLockedComponentAccess(attachAddressSheet,
itemModel),
attachAddressSheet.getSaveCancelSection().getCancelButton());
add(CHANGE_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.contact.reattach_address").
localize(), new EditAddressWorkflowLockedComponentAccess(
reattachAddressSheet, itemModel), reattachAddressSheet.
getSaveCancelSection().getCancelButton());
add(CHANGE_ADDRESS_SHEET_NAME,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.reattach_address"),
new EditAddressWorkflowLockedComponentAccess(reattachAddressSheet,
itemModel),
reattachAddressSheet.getSaveCancelSection().getCancelButton());
/*add(EDIT_ADDRESS_SHEET_NAME, (String) ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.contact.edit_address").localize(),
new EditAddressWorkflowLockedComponentAccess(editAddressSheet,
itemModel),
editAddressSheet.getSaveCancelSection().getCancelButton());*/
add(DELETE_ADDRESS_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.delete_address").localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.delete_address"),
new EditAddressWorkflowLockedComponentAccess(deleteAddressSheet,
itemModel),
deleteAddressSheet.getSaveCancelSection().getCancelButton());
@ -87,6 +88,11 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
}
/**
*
* @param itemModel
* @return
*/
public static Component getAddressPropertySheet(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(

View File

@ -27,6 +27,7 @@ import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.util.UncheckedWrapperException;
@ -82,6 +83,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@Override
public void addWidgets() {
add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_person")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
@ -97,7 +99,7 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("",
new Label(ContenttypesGlobalizationUtil
new Label(GlobalizationUtil
.globalize("cms.ui.select_one"))));
// Add the Options to the SingleSelect widget

View File

@ -61,9 +61,8 @@ public class GenericContactEntriesPropertiesStep extends SimpleEditStep {
BasicItemForm addContactEntrySheet = new GenericContactEntryAddForm(itemModel);
add(ADD_CONTACT_ENTRY_SHEET_NAME,
(String)ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.add_contactEntry")
.localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.add_contactEntry"),
new WorkflowLockedComponentAccess(addContactEntrySheet,
itemModel),
addContactEntrySheet.getSaveCancelSection().getCancelButton());

View File

@ -84,12 +84,12 @@ public class GenericContactEntriesTable extends Table implements TableActionList
2,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.contactEntry.description")
.localize()));
));
tab_model.add(new TableColumn(
3,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.contactEntry.action")
.localize(),
,
TABLE_COL_DEL));
setModelBuilder(new ContactTableModelBuilder(itemModel));
@ -194,7 +194,6 @@ public class GenericContactEntriesTable extends Table implements TableActionList
0, MAX_DESC_LENGTH)
: m_contactEntry.getDescription();
case 3:
// return GlobalizationUtil.globalize("cms.ui.delete").localize();
return GlobalizationUtil.globalize("cms.ui.delete");
default:
return null;

View File

@ -64,7 +64,9 @@ public class GenericContactEntryAddForm extends BasicItemForm {
ParameterModel contactEntryKeyParam = new StringParameter(GenericContactEntry.KEY);
SingleSelect contactEntryKey = new SingleSelect(contactEntryKeyParam);
contactEntryKey.addValidationListener(new NotNullValidationListener());
contactEntryKey.addOption(new Option("", new Label((String)GlobalizationUtil.globalize("cms.ui.select_one").localize())));
contactEntryKey.addOption(new
Option("", new Label(GlobalizationUtil.globalize(
"cms.ui.select_one")) ));
// Add the Options to the SingleSelect widget
GenericContactEntryKeys keyList = new GenericContactEntryKeys();
@ -103,7 +105,8 @@ public class GenericContactEntryAddForm extends BasicItemForm {
// save only if save button was pressed
if (contact != null
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
&& getSaveCancelSection().getSaveButton()
.isSelected(fse.getPageState())) {
GenericContactEntry contactEntry = new GenericContactEntry(contact,
(String)data.get(GenericContactEntry.KEY),

View File

@ -28,8 +28,8 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
public static final String CHANGE_PERSON_SHEET_NAME = "changePerson";
public static final String DELETE_PERSON_SHEET_NAME = "deletePerson";
private WorkflowLockedComponentAccess addPerson;
private WorkflowLockedComponentAccess editPerson;
private WorkflowLockedComponentAccess delPerson;
// private WorkflowLockedComponentAccess editPerson;
// private WorkflowLockedComponentAccess delPerson;
/**
* Creates a new instance of GenericContactPersonPropertiesStep
@ -48,9 +48,8 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
GenericContactAttachPersonPropertyForm(itemModel, this);
addPerson = new WorkflowLockedComponentAccess(addPersonSheet, itemModel);
add(ADD_PERSON_SHEET_NAME,
(String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.attach_person")
.localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.attach_person"),
addPerson,
addPersonSheet.getSaveCancelSection().getCancelButton());
@ -65,6 +64,7 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
}
public static Component getEmptyPersonPropertySheet(ItemSelectionModel itemModel) {
return new Label(((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.emptyPerson").localize()));
return new Label((ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.emptyPerson") ));
}
}

View File

@ -73,9 +73,8 @@ public class GenericContactPropertiesStep extends SimpleEditStep {
BasicPageForm editBasicSheet = new GenericContactPropertyForm(itemModel, this);
basicProperties.add(
EDIT_BASIC_SHEET_NAME,
(String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.edit_basic_properties")
.localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.edit_basic_properties"),
new WorkflowLockedComponentAccess(
editBasicSheet,
itemModel),
@ -140,20 +139,10 @@ public class GenericContactPropertiesStep extends SimpleEditStep {
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), "name");
if (!ContentSection.getConfig().getHideLaunchDate()) {
sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"),
sheet.add(GlobalizationUtil
.globalize("cms.contenttypes.ui.launch_date"),
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
public String format(DomainObject obj, String attribute, PageState state) {
ContentPage page = (ContentPage) obj;
if (page.getLaunchDate() != null) {
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
} else {
return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize();
}
}
});
new LaunchDateAttributeFormatter() );
}
return sheet;

View File

@ -45,8 +45,8 @@ public class GenericContactTypePropertiesStep extends SimpleEditStep {
BasicItemForm addContactTypeSheet = new GenericContactTypeAddForm(itemModel);
add(ADD_CONTACT_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.add_contacttype").localize(),
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.add_contacttype"),
new WorkflowLockedComponentAccess(addContactTypeSheet, itemModel),
addContactTypeSheet.getSaveCancelSection().getCancelButton());

View File

@ -37,6 +37,8 @@ import com.arsdigita.search.ui.QueryGenerator;
import com.arsdigita.search.QuerySpecification;
import com.arsdigita.toolbox.ui.LayoutPanel;
import org.apache.log4j.Logger;
/**
* Contains a form for specifying search parameters, as well as a
* {@link com.arsdigita.search.ui.ResultsPane} which will perform the search and
@ -46,11 +48,10 @@ import com.arsdigita.toolbox.ui.LayoutPanel;
* @version $Id: ItemSearchSection.java 1940 2009-05-29 07:15:05Z terry $
*/
public class ItemSearchSection extends FormSection
implements Resettable, QueryGenerator {
implements Resettable, QueryGenerator {
private static final org.apache.log4j.Logger s_log =
org.apache.log4j.Logger.
getLogger(ItemSearchSection.class);
private static final Logger s_log = org.apache.log4j.Logger.getLogger(
ItemSearchSection.class);
public static final String SINGLE_TYPE_PARAM = "single_type";
private ItemQueryComponent m_query;
private Component m_results;
@ -158,6 +159,7 @@ public class ItemSearchSection extends FormSection
}
// Hide results by default
@Override
public void register(Page p) {
super.register(p);
p.setVisibleDefault(m_results, false);

View File

@ -54,11 +54,14 @@ public class ItemSearchSectionInline extends ItemSearchSection {
/**
* Construct a new <code>ItemSearchSectionInline</code> component
*
* @param name
* @param context the context for the retrieved items. Should be
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
* @param limitToContentSection limit the search to the current content section
*/
public ItemSearchSectionInline(String name, String context, boolean limitToContentSection) {
public ItemSearchSectionInline(String name,
String context,
boolean limitToContentSection) {
super(name, context, limitToContentSection);
m_name = name;
m_item = new OIDParameter(name + "_itemOID");
@ -66,7 +69,16 @@ public class ItemSearchSectionInline extends ItemSearchSection {
addResultsPane(this);
}
public ItemSearchSectionInline(String name, String context,
/**
* Constructor.
*
* @param name
* @param context
* @param limitToContentSection
* @param type
*/
public ItemSearchSectionInline(String name,
String context,
boolean limitToContentSection,
ContentType type) {
super(name, context, limitToContentSection, type);

View File

@ -47,6 +47,7 @@ import com.arsdigita.cms.ContentCenterServlet;
import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.GlobalizedMessage;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
import com.arsdigita.workflow.simple.Workflow;
@ -60,7 +61,9 @@ import org.apache.log4j.Logger;
* @version $Id: ItemSearchWidget.java 1166 2006-06-14 11:45:15Z fabrice $
*/
public class ItemSearchWidget extends FormSection
implements BebopConstants, FormSubmissionListener, FormInitListener {
implements BebopConstants,
FormSubmissionListener,
FormInitListener {
private static final Logger s_log = Logger.getLogger(ItemSearchWidget.class);
//private Hidden m_selected;
@ -83,8 +86,10 @@ public class ItemSearchWidget extends FormSection
private ParameterModel m_searchModel;
private boolean disableCreatePane = false;
private boolean editAfterCreate = true;
private String searchLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.search").localize();
private String selectedLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.selected").localize();
private GlobalizedMessage searchLabelText = GlobalizationUtil.globalize(
"cms.ui.item_search.search");
private GlobalizedMessage selectedLabelText = GlobalizationUtil.globalize(
"cms.ui.item_search.selected");
public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch";
public static final String SEARCH = "search";
public static final boolean LIMIT_TO_CONTENT_SECTION = false;
@ -108,7 +113,7 @@ public class ItemSearchWidget extends FormSection
private ItemSearchWidget parent;
public SearchFragment(String name, ItemSearchWidget parent) {
super(name, "Search");
super(name, GlobalizationUtil.globalize("cms.ui.search"));
this.parent = parent;
this.setAttribute("onClick", "return " + parent.m_selected.getName(). //+ parent.m_item.getName().
replace('.', '_') + "Popup(this.form)");
@ -129,10 +134,11 @@ public class ItemSearchWidget extends FormSection
private ItemSearchWidget parent;
public ClearFragment(String name, ItemSearchWidget parent) {
super(name, "Clear");
super(name, GlobalizationUtil.globalize("cms.ui.clear"));
this.parent = parent;
this.setAttribute("onClick", "this.form." + parent.m_selected.getName() + ".value = \"\";"
+ "this.form." + parent.m_item.getName() + ".value = \"\";"
this.setAttribute("onClick", "this.form." + parent.m_selected.getName()
+ ".value = \"\";" + "this.form."
+ parent.m_item.getName() + ".value = \"\";"
+ "return false;");
this.setAttribute("value", "Clear");
}
@ -208,7 +214,8 @@ public class ItemSearchWidget extends FormSection
*param
* contentType
*/
public ItemSearchWidget(final ParameterModel model, final ContentType contentType) {
public ItemSearchWidget(final ParameterModel model,
final ContentType contentType) {
super(new BoxPanel(BoxPanel.VERTICAL));
if (!(model instanceof ItemSearchParameter)) {
@ -234,12 +241,14 @@ public class ItemSearchWidget extends FormSection
m_contentType = contentType;
//m_selected = new Hidden(model);
m_selected = new ItemFragment(model, this);
final Label selectedItemLabel = new Label(selectedLabelText);
final Label selectedItemLabel = new Label(GlobalizationUtil.globalize(""
+ " cms.ui.item_search.selected"));
selectedItemLabel.addPrintListener(new PrintListener() {
public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget();
target.setLabel(selectedLabelText);
target.setLabel(GlobalizationUtil.globalize(
"cms.ui.item_search.selected"));
}
});
@ -492,19 +501,19 @@ public class ItemSearchWidget extends FormSection
}
}
public String getSearchLabelText() {
public GlobalizedMessage getSearchLabelText() {
return searchLabelText;
}
public void setSearchLabelText(final String searchLabelText) {
public void setSearchLabelText(final GlobalizedMessage searchLabelText) {
this.searchLabelText = searchLabelText;
}
public String getSelectedLabelText() {
public GlobalizedMessage getSelectedLabelText() {
return selectedLabelText;
}
public void setSelectedLabelText(final String selectedLabelText) {
public void setSelectedLabelText(final GlobalizedMessage selectedLabelText) {
this.selectedLabelText = selectedLabelText;
}

View File

@ -41,10 +41,10 @@ import java.util.Iterator;
import java.util.Map;
/**
* Extends {@link com.arsdigita.bebop.PropertyEditor} to provide
* access control features. Each link may be associated with a {@link
* com.arsdigita.toolbox.ui.ComponentAccess} object; if the current
* does not have sufficient privileges, the link will be hidden.
* Extends {@link com.arsdigita.bebop.PropertyEditor} to provide access control
* features. Each link may be associated with a {@link
* com.arsdigita.toolbox.ui.ComponentAccess} object; if the current does not
* have sufficient privileges, the link will be hidden.
* <p>
* The simple use pattern for this component is as follows:
*