Erster Teil Lokalisierung RelatedLink.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2241 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-07-03 00:03:39 +00:00
parent 42a4e3f278
commit 26ced22594
15 changed files with 295 additions and 130 deletions

View File

@ -42,13 +42,13 @@ public class RelatedLinkPropertiesStep extends LinkPropertiesStep {
* current link * current link
*/ */
public RelatedLinkPropertiesStep(ItemSelectionModel itemModel, public RelatedLinkPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) { AuthoringKitWizard parent) {
super(itemModel, parent); super(itemModel, parent);
} }
/** /**
* Sets a RelatedLinkSelectionModel as the * Sets a RelatedLinkSelectionModel as the LinkSelectionModel for this
* LinkSelectionModel for this authoring step. * authoring step.
* Also, set the linkListName and contentType if neccessary * Also, set the linkListName and contentType if neccessary
*/ */
@Override @Override

View File

@ -48,7 +48,9 @@ public class RelatedLinkTable extends LinkTable {
* @param link The <code>LinkSelectionModel</code> to track the * @param link The <code>LinkSelectionModel</code> to track the
* current link * current link
*/ */
public RelatedLinkTable(ItemSelectionModel item, LinkSelectionModel link, String linkListName) { public RelatedLinkTable(ItemSelectionModel item,
LinkSelectionModel link,
String linkListName) {
super(item, link); super(item, link);
setModelBuilder(new RelatedLinkTableModelBuilder(item, linkListName)); setModelBuilder(new RelatedLinkTableModelBuilder(item, linkListName));
@ -78,6 +80,18 @@ public class RelatedLinkTable extends LinkTable {
* TableCellRenderer class for LinkTable * TableCellRenderer class for LinkTable
*/ */
private class RelatedLinkRenderer implements TableCellRenderer { private class RelatedLinkRenderer implements TableCellRenderer {
/**
*
* @param table
* @param state
* @param value
* @param isSelected
* @param key
* @param row
* @param column
* @return
*/
public Component getComponent(Table table, public Component getComponent(Table table,
PageState state, PageState state,
Object value, Object value,

View File

@ -1011,3 +1011,27 @@ cms.ui.authoring.create_new=Create&nbsp;new:
cms.ui.authoring.go=Go cms.ui.authoring.go=Go
cms.ui.upload=File Upload cms.ui.upload=File Upload
cms.ui.section.new_section_name=Name of the new Content Section cms.ui.section.new_section_name=Name of the new Content Section
cms.contenttyes.link.ui.table_header_link=Link
cms.contenttyes.link.ui.table_header_descr=Description
cms.contenttyes.link.ui.table_header_edit=Edit
cms.contenttyes.link.ui.table_header_delete=Delete
cms.contenttyes.link.ui.table_header_move_up=Move Up
cms.contenttyes.link.ui.table_header_move_down=Move Down
cms.contenttyes.link.ui.table_cell_edit_link=edit
cms.contenttyes.link.ui.table_cell_delete_link=delete
cms.contenttyes.link.ui.table_cell_move_up=up
cms.contenttyes.link.ui.table_cell_move_down=down
cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item
cms.contenttyes.link.ui.option_group.link_type.external=URL
cms.contenttyes.link.ui.option_group.link_type.internal=Content Item
cms.contenttyes.link.ui.option.new_window=Open URL in a new window
cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one):
cms.contenttyes.link.ui.target_uri=URL:
cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/
cms.contenttyes.link.ui.target_content_item=Content Item
cms.contenttyes.link.ui.target_parameters=Parameters (optional)
cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'.
cms.contenttyes.link.ui.button_create=Create
cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel

View File

@ -1005,3 +1005,28 @@ cms.ui.authoring.go=Anlegen
#File Upload #File Upload
cms.ui.upload=Datei laden cms.ui.upload=Datei laden
cms.ui.section.new_section_name=Name der neuen Content Section cms.ui.section.new_section_name=Name der neuen Content Section
cms.contenttyes.link.ui.table_header_link=Link
cms.contenttyes.link.ui.table_header_descr=Beschreibung
cms.contenttyes.link.ui.table_header_edit=Bearbeiten
cms.contenttyes.link.ui.table_header_delete=DeleteEntfernen
cms.contenttyes.link.ui.table_header_move_up=Nach Oben bewegen
cms.contenttyes.link.ui.table_header_move_down=Nach Unten bewegen
cms.contenttyes.link.ui.table_cell_edit_link=bearbeiten
cms.contenttyes.link.ui.table_cell_delete_link=entfernen
cms.contenttyes.link.ui.table_cell_move_up=nach oben
cms.contenttyes.link.ui.table_cell_move_down=nach unten
cms.contenttyes.link.ui.link_type_subtitle=Bitte entweder einen externen Link oder ein Dokument (interner Link) w\u00e4hlen
itte entweder einen externen Link oder ein Dokument (interner Link) w\u00e4hlen
cms.contenttyes.link.ui.option_group.link_type.external=URL
cms.contenttyes.link.ui.option_group.link_type.internal=Dokument
cms.contenttyes.link.ui.option.new_window=URL in einem neuen Fenster \u00f6ffnen
cms.contenttyes.link.ui.option_group.link_type.label=Einen Link Typ w\u00e4hlen:
cms.contenttyes.link.ui.target_uri=URL:
cms.contenttyes.link.ui.target_uri_hint=Eine URL eingeben, z.B. einer externen Seite wie http://www.beispiel.de/ziel.html oder relativ zu dieser Site /ccm/navigation/beispiel
cms.contenttyes.link.ui.target_content_item=Dokument
cms.contenttyes.link.ui.target_parameters=Parameter (bei Bedarf)
cms.contenttyes.link.ui.target_parameters_hint=
cms.contenttyes.link.ui.button_create=Erstellen
cms.contenttyes.link.ui.button_save=Sichern
cms.contenttyes.link.ui.button_reset=Zur\u00fccksetzen
cms.contenttyes.link.ui.button_cancel=Abbruch

View File

@ -59,3 +59,27 @@ cms.ui.authoring.go=Go
#File Upload #File Upload
cms.ui.upload=File Upload cms.ui.upload=File Upload
cms.ui.section.new_section_name= cms.ui.section.new_section_name=
cms.contenttyes.link.ui.table_header_link=Link
cms.contenttyes.link.ui.table_header_descr=Description
cms.contenttyes.link.ui.table_header_edit=Edit
cms.contenttyes.link.ui.table_header_delete=Delete
cms.contenttyes.link.ui.table_header_move_up=Move Up
cms.contenttyes.link.ui.table_header_move_down=Move Down
cms.contenttyes.link.ui.table_cell_edit_link=edit
cms.contenttyes.link.ui.table_cell_delete_link=delete
cms.contenttyes.link.ui.table_cell_move_up=up
cms.contenttyes.link.ui.table_cell_move_down=down
cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item
cms.contenttyes.link.ui.option_group.link_type.external=URL
cms.contenttyes.link.ui.option_group.link_type.internal=Content Item
cms.contenttyes.link.ui.option.new_window=Open URL in a new window
cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one):
cms.contenttyes.link.ui.target_uri=URL:
cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/
cms.contenttyes.link.ui.target_content_item=Content Item
cms.contenttyes.link.ui.target_parameters=Parameters (optional)
cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'.
cms.contenttyes.link.ui.button_create=Create
cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel

View File

@ -533,3 +533,27 @@ cms.ui.title=Title
#File Upload #File Upload
cms.ui.upload=Transf\u00e9re cms.ui.upload=Transf\u00e9re
cms.ui.section.new_section_name= cms.ui.section.new_section_name=
cms.contenttyes.link.ui.table_header_link=Link
cms.contenttyes.link.ui.table_header_descr=Description
cms.contenttyes.link.ui.table_header_edit=Edit
cms.contenttyes.link.ui.table_header_delete=Delete
cms.contenttyes.link.ui.table_header_move_up=Move Up
cms.contenttyes.link.ui.table_header_move_down=Move Down
cms.contenttyes.link.ui.table_cell_edit_link=edit
cms.contenttyes.link.ui.table_cell_delete_link=delete
cms.contenttyes.link.ui.table_cell_move_up=up
cms.contenttyes.link.ui.table_cell_move_down=down
cms.contenttyes.link.ui.link_type_subtitle=Choose either a URL or a Content Item
cms.contenttyes.link.ui.option_group.link_type.external=URL
cms.contenttyes.link.ui.option_group.link_type.internal=Content Item
cms.contenttyes.link.ui.option.new_window=Open URL in a new window
cms.contenttyes.link.ui.option_group.link_type.label=Link Type (Choose one):
cms.contenttyes.link.ui.target_uri=URL:
cms.contenttyes.link.ui.target_uri_hint=Enter a URL such as http://www.example.com/ or /ccm/forum/
cms.contenttyes.link.ui.target_content_item=Content Item
cms.contenttyes.link.ui.target_parameters=Parameters (optional)
cms.contenttyes.link.ui.target_parameters_hint=Enter parameters for the item URL. Separate items with '&'.
cms.contenttyes.link.ui.button_create=Create
cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel

View File

@ -31,10 +31,9 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedContainer;
/** /**
* Authoring step to create a link and change ordering. This class is * Authoring step to create a link and change ordering. This class is
* declared abstract, as this and related Link* base classes do not * declared abstract, as this and related Link* base classes do not
* assign the Links to a specific * assign the Links to a specific role/association.
* role/association. <code>RelatedLinkPropertiesStep</code> extends * <code>RelatedLinkPropertiesStep</code> extends this functionality to
* this functionality to view/assign RelatedLinks in the specific "links" * view/assign RelatedLinks in the specific "links" role on ContentItem.
* role on ContentItem.
*/ */
public abstract class LinkPropertiesStep extends ResettableContainer { public abstract class LinkPropertiesStep extends ResettableContainer {

View File

@ -66,13 +66,12 @@ import org.apache.log4j.Logger;
* @author Sören Bernstein (sbernstein@zes.uni-bremen.de) * @author Sören Bernstein (sbernstein@zes.uni-bremen.de)
*/ */
public class LinkPropertyForm extends FormSection public class LinkPropertyForm extends FormSection
implements FormInitListener, FormProcessListener, FormValidationListener, implements FormInitListener, FormProcessListener,
FormSubmissionListener { FormValidationListener, FormSubmissionListener {
private static final Logger s_log = Logger.getLogger(LinkPropertyForm.class); private static final Logger s_log = Logger.getLogger(LinkPropertyForm.class);
/**
* Name of this form /** Name of this form */
*/
public static final String ID = "link_edit"; public static final String ID = "link_edit";
public static final String SSL_PROTOCOL = "https://"; public static final String SSL_PROTOCOL = "https://";
public static final String HTTP_PROTOCOL = "http://"; public static final String HTTP_PROTOCOL = "http://";
@ -109,7 +108,7 @@ public class LinkPropertyForm extends FormSection
* *
* @param itemModel * @param itemModel
* @param link * @param link
* @param contentType * * @param contentType
*/ */
public LinkPropertyForm(ItemSelectionModel itemModel, public LinkPropertyForm(ItemSelectionModel itemModel,
LinkSelectionModel link, LinkSelectionModel link,
@ -137,17 +136,19 @@ public class LinkPropertyForm extends FormSection
* Adds widgets to the form. * Adds widgets to the form.
*/ */
protected void addWidgets() { protected void addWidgets() {
/* Add the standard title field */
m_title = new TextField("title"); m_title = new TextField("title");
m_title.addValidationListener(new NotNullValidationListener()); m_title.addValidationListener(new NotNullValidationListener());
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.title"))); add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.title")));
add(m_title); add(m_title);
/* Add the standard description field */
m_description = new TextArea("description"); m_description = new TextArea("description");
m_description.setCols(40); m_description.setCols(40);
m_description.setRows(5); m_description.setRows(5);
add(new Label(GlobalizationUtil.globalize( add(new Label(GlobalizationUtil.globalize(
"cms.contenttypes.ui.description"))); "cms.contenttypes.ui.description")));
add(m_description); add(m_description);
add(new Label( add(new Label(
@ -181,19 +182,33 @@ public class LinkPropertyForm extends FormSection
+ "</script>\n", + "</script>\n",
false)); false));
add(new Label("Choose either a URL or a Content Item", Label.BOLD), /* Sub-title external URL / internal URL (content item) */
ColumnPanel.FULL_WIDTH); add(new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.link_type_subtitle"),
Label.BOLD),
ColumnPanel.FULL_WIDTH);
/* Option group to choose either external oder internal */
m_linkType = new RadioGroup("linkType"); m_linkType = new RadioGroup("linkType");
Option m_external = new Option(Link.EXTERNAL_LINK, "URL");
//m_external.setOnClick("toggle_link_fields(false)"); Option m_external = new Option(
Link.EXTERNAL_LINK,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.option_group.link_type.external")));
m_external.setOnClick("enableUrlFields()"); m_external.setOnClick("enableUrlFields()");
Option m_internal = new Option(Link.INTERNAL_LINK, "Content Item"); Option m_internal = new Option(
//m_internal.setOnClick("toggle_link_fields(true)"); Link.INTERNAL_LINK,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.option_group.link_type.internal")));
m_internal.setOnClick("enableItemFields()"); m_internal.setOnClick("enableItemFields()");
Option m_selectWindow = new Option(Link.TARGET_WINDOW, /* Single option whether to open in new window, strongly discouraged!*/
"Open URL in new window"); Option m_selectWindow = new Option(
Link.TARGET_WINDOW,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.option.new_window")));
// "Open URL in new window");
m_URIOption = new CheckboxGroup("openOption"); m_URIOption = new CheckboxGroup("openOption");
m_URIOption.addOption(m_selectWindow); m_URIOption.addOption(m_selectWindow);
@ -201,28 +216,35 @@ public class LinkPropertyForm extends FormSection
m_linkType.addOption(m_internal); m_linkType.addOption(m_internal);
m_linkType.setOptionSelected(m_external); m_linkType.setOptionSelected(m_external);
m_linkType.addValidationListener(new NotNullValidationListener()); m_linkType.addValidationListener(new NotNullValidationListener());
add(new Label("Link Type (Choose one):")); add(new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.option_group.link_type.label")));
add(m_linkType); add(m_linkType);
add(m_URIOption, ColumnPanel.FULL_WIDTH); add(m_URIOption, ColumnPanel.FULL_WIDTH);
/* External target */
m_targetURI = new TextField("targetURI"); m_targetURI = new TextField("targetURI");
m_targetURI.setOnFocus("toggle_link_fields(false)"); m_targetURI.setOnFocus("toggle_link_fields(false)");
m_targetURI.setHint( m_targetURI.setHint(GlobalizationUtil.globalize(
"Enter a URL such as http://www.example.com/ or /ccm/forum/"); "cms.contenttyes.link.ui.target_uri_hint"));
add(new Label("URL: ")); add(new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.target_uri")));
add(m_targetURI); add(m_targetURI);
add(new Label("Content Item:")); /* Internal target */
add(new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.target_content_item") ));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, m_contentType); m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, m_contentType);
m_itemSearch.getSearchButton().setOnFocus("toggle_link_fields(true)"); m_itemSearch.getSearchButton().setOnFocus("toggle_link_fields(true)");
m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)"); m_itemSearch.getClearButton().setOnFocus("toggle_link_fields(true)");
add(m_itemSearch); add(m_itemSearch);
add(new Label("Parameters")); /* Optional parameters for internal target */
add(new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.target_parameters") ));
m_itemParams = new TextField("itemParams"); m_itemParams = new TextField("itemParams");
m_itemParams.setOnFocus("toggle_link_fields(true)"); m_itemParams.setOnFocus("toggle_link_fields(true)");
m_itemParams.setHint( m_itemParams.setHint(GlobalizationUtil.globalize(
"Enter parameters for the item URL. Separate items with '&'."); "cms.contenttyes.link.ui.target_parameters_hint") );
add(m_itemParams); add(m_itemParams);
add(new Label( add(new Label(
@ -252,9 +274,11 @@ public class LinkPropertyForm extends FormSection
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (m_linkModel.isSelected(e.getPageState())) { if (m_linkModel.isSelected(e.getPageState())) {
target.setButtonLabel("Cancel"); target.setButtonLabel(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.button_cancel"));
} else { } else {
target.setButtonLabel("Reset"); target.setButtonLabel(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.button_reset"));
} }
} }
}); });
@ -264,9 +288,11 @@ public class LinkPropertyForm extends FormSection
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (m_linkModel.isSelected(e.getPageState())) { if (m_linkModel.isSelected(e.getPageState())) {
target.setButtonLabel("Save"); target.setButtonLabel(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.button_save"));
} else { } else {
target.setButtonLabel("Create"); target.setButtonLabel(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.button_create"));
} }
} }
}); });
@ -348,24 +374,23 @@ public class LinkPropertyForm extends FormSection
} else { } else {
// No idea, just throw the error // No idea, just throw the error
throw new FormProcessException("URL is not valid: " + ex.getMessage()); throw new FormProcessException("URL is not valid: " +
ex.getMessage());
} }
try { try {
URL test = new URL(newURL); URL test = new URL(newURL);
} catch (MalformedURLException ex2) { } catch (MalformedURLException ex2) {
StringBuffer msg = new StringBuffer(); StringBuilder msg = new StringBuilder();
if (localLink) { if (localLink) {
// For local link, report the error after we put a // For local link, report the error after we put a
// protocol and servername on it // protocol and servername on it
msg.append("Local URL is not valid: "); msg.append("Local URL is not valid: ");
msg.append(ex2.getMessage()); msg.append(ex2.getMessage());
} else { } else {
// For external link, report the error before we tried // For external link, report the error before we tried
// to munge it // to munge it
msg.append("External URL is not valid: "); msg.append("External URL is not valid: ");
msg.append(ex.getMessage()); msg.append(ex.getMessage());
} }
@ -534,16 +559,17 @@ public class LinkPropertyForm extends FormSection
} }
// Quasimodo: BEGIN // Quasimodo: BEGIN
// This is part of the patch to make RelatedLink (and Link) multilanguage compatible // This is part of the patch to make RelatedLink (and Link)
// Here we have to link to the content bundle instead of the content item, if there's one // multilanguage compatible. Here we have to link to the
// content bundle instead of the content item, if there's one
// else we don't have a proper multilanguage support' // else we don't have a proper multilanguage support'
ContentItem ci = (ContentItem) data.get(ITEM_SEARCH); ContentItem ci = (ContentItem) data.get(ITEM_SEARCH);
// If the selected target item ci has a parent of type ContentBundle // If the selected target item ci has a parent of type ContentBundle
if (ci.getParent() instanceof ContentBundle) { if (ci.getParent() instanceof ContentBundle) {
// Then there a multiple language versions of this content item and we want to // Then there a multiple language versions of this content item
// link to the content bundle, so we can later negotiate the language depending // and we want to link to the content bundle, so we can later
// on browser settings // negotiate the language depending on browser settings
ci = (ContentItem) ci.getParent(); ci = (ContentItem) ci.getParent();
} }

View File

@ -20,6 +20,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.ExternalLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal; import com.arsdigita.bebop.RequestLocal;
@ -29,23 +30,29 @@ import com.arsdigita.bebop.event.TableActionListener;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.Link; import com.arsdigita.cms.contenttypes.Link;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.PersistenceException; import com.arsdigita.persistence.PersistenceException;
import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.arsdigita.bebop.ExternalLink;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.dispatcher.Utilities;
/** /**
* Bebop table to display a list of Links associated with a ContentItem * Bebop table to display a list of Links associated with a ContentItem.
*
* It is the UI for the CMS build in Link asset.
*
* It's current prominent use is by the RelatedLink asset authjoring step.
* *
* @version $Revision: #6 $ $Date: 2004/08/17 $ * @version $Revision: #6 $ $Date: 2004/08/17 $
* @author Nobuko Asakai (nasakai@redhat.com) * @author Nobuko Asakai (nasakai@redhat.com)
@ -63,6 +70,15 @@ public class LinkTable extends Table {
private TableColumn m_delCol; private TableColumn m_delCol;
private RequestLocal m_size; private RequestLocal m_size;
private RequestLocal m_editor; private RequestLocal m_editor;
// match columns by (symbolic) index, makes for easier reordering
private static final int COL_IDX_LINK = 0; //Link;
private static final int COL_IDX_DESCR = 1; //Description;
private static final int COL_IDX_EDIT = 2; //Description;
private static final int COL_IDX_DELETE = 3; //Description;
private static final int COL_IDX_MOVE_UP = 4; //Description;
private static final int COL_IDX_MOVE_DOWN = 5; //Description;
protected static final String EDIT_EVENT = "Edit"; protected static final String EDIT_EVENT = "Edit";
protected static final String DELETE_EVENT = "Delete"; protected static final String DELETE_EVENT = "Delete";
protected static final String UP_EVENT = "up"; protected static final String UP_EVENT = "up";
@ -79,6 +95,7 @@ public class LinkTable extends Table {
* current link * current link
*/ */
public LinkTable(ItemSelectionModel item, LinkSelectionModel link) { public LinkTable(ItemSelectionModel item, LinkSelectionModel link) {
super(); super();
m_itemModel = item; m_itemModel = item;
m_linkModel = link; m_linkModel = link;
@ -86,15 +103,16 @@ public class LinkTable extends Table {
m_size = new RequestLocal(); m_size = new RequestLocal();
m_editor = new RequestLocal() { m_editor = new RequestLocal() {
/**
*
*/
public Object initialValue(PageState state) { public Object initialValue(PageState state) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = CMS.getSecurityManager(state);
ContentItem item = (ContentItem) m_itemModel.getSelectedObject( ContentItem item = (ContentItem) m_itemModel
state); .getSelectedObject(state);
Boolean val = new Boolean(sm.canAccess( Boolean val = new Boolean(sm.canAccess(state.getRequest(),
state.getRequest(), SecurityManager.EDIT_ITEM,
SecurityManager.EDIT_ITEM, item));
item));
return val; return val;
} }
}; };
@ -110,28 +128,66 @@ public class LinkTable extends Table {
* Sets up the columns to display. * Sets up the columns to display.
*/ */
protected void addColumns() { protected void addColumns() {
TableColumnModel model = getColumnModel(); TableColumnModel model = getColumnModel();
int i = 0;
m_titleCol = new TableColumn(i, "Link"); m_titleCol = new TableColumn(
m_descCol = new TableColumn(++i, "Description"); COL_IDX_LINK,
m_editCol = new TableColumn(++i, "Edit"); new Label(GlobalizationUtil.globalize(
m_delCol = new TableColumn(++i, "Delete"); "cms.contenttyes.link.ui.table_header_link"))
m_moveUpCol = new TableColumn(++i, ""); );
m_moveDownCol = new TableColumn(++i, ""); m_descCol = new TableColumn(
COL_IDX_DESCR,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_header_descr"))
);
m_editCol = new TableColumn(
COL_IDX_EDIT,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_header_edit"))
);
m_delCol = new TableColumn(
COL_IDX_DELETE,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_header_delete"))
);
m_moveUpCol = new TableColumn(
COL_IDX_MOVE_UP,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_header_move_up"))
);
m_moveDownCol = new TableColumn(
COL_IDX_MOVE_DOWN,
new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_header_move_down"))
);
model.add(m_titleCol); model.add(m_titleCol);
model.add(m_descCol); model.add(m_descCol);
model.add(m_editCol); model.add(m_editCol);
model.add(m_delCol); model.add(m_delCol);
model.add(m_moveUpCol); model.add(m_moveUpCol);
model.add(m_moveDownCol); model.add(m_moveDownCol);
setColumnModel(model); setColumnModel(model);
} }
/** /**
* TableCellRenderer class for LinkTable * Internal private class TableCellRenderer class for LinkTable
*/ */
private class LinkTableRenderer implements TableCellRenderer { private class LinkTableRenderer implements TableCellRenderer {
/**
*
* @param table
* @param state
* @param value
* @param isSelected
* @param key
* @param row
* @param column
* @return
*/
public Component getComponent(Table table, public Component getComponent(Table table,
PageState state, PageState state,
Object value, Object value,
@ -139,6 +195,7 @@ public class LinkTable extends Table {
Object key, Object key,
int row, int row,
int column) { int column) {
Link link = (Link) value; Link link = (Link) value;
boolean isFirst = (row == 0); boolean isFirst = (row == 0);
if (m_size.get(state) == null) { if (m_size.get(state) == null) {
@ -163,22 +220,29 @@ public class LinkTable extends Table {
} else if (column == m_editCol.getModelIndex()) { } else if (column == m_editCol.getModelIndex()) {
if (Boolean.TRUE.equals(m_editor.get(state))) { if (Boolean.TRUE.equals(m_editor.get(state))) {
if (isSelected) { if (isSelected) {
return new Label(EDIT_EVENT, Label.BOLD); return new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_edit_link"),
Label.BOLD);
} else { } else {
return new ControlLink(EDIT_EVENT); return new ControlLink( new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_edit_link")) );
} }
} else { } else {
return new Label(EDIT_EVENT); return new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_edit_link"));
} }
} else if (column == m_delCol.getModelIndex()) { } else if (column == m_delCol.getModelIndex()) {
if (Boolean.TRUE.equals(m_editor.get(state))) { if (Boolean.TRUE.equals(m_editor.get(state))) {
return new ControlLink(DELETE_EVENT); return new ControlLink( new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_delete_link")) );
} else { } else {
return new Label(DELETE_EVENT); return new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_delete_link"));
} }
} else if (column == m_moveUpCol.getModelIndex()) { } else if (column == m_moveUpCol.getModelIndex()) {
if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) { if (Boolean.TRUE.equals(m_editor.get(state)) && !isFirst) {
Label upLabel = new Label(UP_EVENT); Label upLabel = new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_move_up"));
upLabel.setClassAttr("linkSort"); upLabel.setClassAttr("linkSort");
return new ControlLink(upLabel); return new ControlLink(upLabel);
} else { } else {
@ -186,7 +250,8 @@ public class LinkTable extends Table {
} }
} else if (column == m_moveDownCol.getModelIndex()) { } else if (column == m_moveDownCol.getModelIndex()) {
if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) { if (Boolean.TRUE.equals(m_editor.get(state)) && !isLast) {
Label downLabel = new Label(DOWN_EVENT); Label downLabel = new Label(GlobalizationUtil.globalize(
"cms.contenttyes.link.ui.table_cell_move_down"));
downLabel.setClassAttr("linkSort"); downLabel.setClassAttr("linkSort");
return new ControlLink(downLabel); return new ControlLink(downLabel);
} else { } else {

View File

@ -47,6 +47,7 @@ public final class AssignedTaskTable extends Table {
(AssignedTaskTable.class); (AssignedTaskTable.class);
public AssignedTaskTable(final WorkflowRequestLocal workflow) { public AssignedTaskTable(final WorkflowRequestLocal workflow) {
super(new AssignedTaskTableModelBuilder(workflow), super(new AssignedTaskTableModelBuilder(workflow),
new String[] { lz("cms.ui.name"), "", "" }); new String[] { lz("cms.ui.name"), "", "" });

View File

@ -34,7 +34,7 @@ import java.util.Iterator;
/** /**
* *
* @version $Id: AssignedTaskTableModelBuilder.java 1563 2007-04-18 15:58:17Z apevec $ *
*/ */
class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder { class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder {
@ -93,7 +93,7 @@ class AssignedTaskTableModelBuilder extends AbstractTableModelBuilder {
return m_task.isLocked() ? m_task.getLockedUser() : null; return m_task.isLocked() ? m_task.getLockedUser() : null;
case 2: case 2:
return m_task.getTaskType().getID().equals(CMSTaskType.DEPLOY) ? return m_task.getTaskType().getID().equals(CMSTaskType.DEPLOY) ?
(Object) new Label("") : (Object) new Label("") : // null should work as well
(Object) lz("cms.ui.workflow.task.finish"); (Object) lz("cms.ui.workflow.task.finish");
default: default:
throw new IllegalStateException(); throw new IllegalStateException();

View File

@ -100,12 +100,25 @@ public class Label extends BlockStylable implements Cloneable {
} }
/** /**
* <p> Creates a new label with the specified text and output escaping * Creates a new label with the specified text as GlobalizedMessage
* turned on if * and fontweight.
*
* @param label The text to display as GlobalizedMessage
* @param fontWeight The fontWeight e.g., Label.BOLD. Whether it has any
* effect depends on the theme! Take it just as a hint.
*/
public Label(GlobalizedMessage label, String fontWeight) {
this(label, true);
m_fontWeight = fontWeight;
}
/**
* <p> Creates a new label with the specified text as GlobalizedMessage
* and output escaping turned on if
* <code>escaping</code> is * <code>escaping</code> is
* <code>true</code>. </p> * <code>true</code>. </p>
* *
* @param label the text to display * @param label the text to display as GlobalizedMessage
* @param escaping Whether or not to perform output escaping * @param escaping Whether or not to perform output escaping
*/ */
public Label(GlobalizedMessage label, boolean escaping) { public Label(GlobalizedMessage label, boolean escaping) {
@ -130,9 +143,9 @@ public class Label extends BlockStylable implements Cloneable {
* @param label The text to display * @param label The text to display
* @param fontWeight The fontWeight e.g., Label.BOLD * @param fontWeight The fontWeight e.g., Label.BOLD
* *
* @deprecated without dir3ect replacement. Refactor to use * @deprecated without direct replacement. Refactor to use
* Label(GlobalizedMEssage) instead and modify the theme to * Label(GlobalizedMEssage) instead and modify the theme to
* use proper text marking. * use proper text marking. (Or use setFontWeight separately.
*/ */
public Label(String label, String fontWeight) { public Label(String label, String fontWeight) {
this(label, true); this(label, true);

View File

@ -1,24 +0,0 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* 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.bebop.util;
/** @deprecated Use {@link com.arsdigita.util.Lockable} instead. */
public interface Lockable extends com.arsdigita.util.Lockable {
}

View File

@ -1,26 +0,0 @@
/*
* Copyright (C) 2001-2004 Red Hat Inc. All Rights Reserved.
*
* 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.bebop.util;
/**
* @deprecated Use {@link com.arsdigita.util.LockableImpl} instead.
**/
public class LockableImpl extends com.arsdigita.util.LockableImpl {
}

View File

@ -69,7 +69,7 @@ public class Task extends AuditedACSObject implements Cloneable {
private static final Logger s_log = Logger.getLogger(Task.class); private static final Logger s_log = Logger.getLogger(Task.class);
public static final String BASE_DATA_OBJECT_TYPE = public static final String BASE_DATA_OBJECT_TYPE =
"com.arsdigita.workflow.simple.Task"; "com.arsdigita.workflow.simple.Task";
public static final String LABEL = "label"; public static final String LABEL = "label";
public static final String DESCRIPTION = "description"; public static final String DESCRIPTION = "description";