Weiter Verbesserungen Lokalisierung, einfügen von setHint() zu Titel, Name und Beschreibung bei Bookmark, Arikel, Agenda MPA.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2245 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-07-05 08:24:11 +00:00
parent d03a076b08
commit 3c7e8ddbc3
28 changed files with 427 additions and 134 deletions

View File

@ -46,7 +46,11 @@ import java.util.Map;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* Component displays an "attach new images" screen composed of a listing of
* images of the system to select from and a link to upload a new image. It is
* part of the entry point image authoring step {@see ImageStep}.
* *
* It doesn't engage a lot of its own logik but uses CMS default image classes.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
@ -61,7 +65,7 @@ public class ImageStepEdit extends SimpleContainer
private final ImageComponentAttachListener m_attachListener; private final ImageComponentAttachListener m_attachListener;
/** /**
* Creates a new ImageStepEdit form. * Constructor, creates a new ImageStepEdit form.
* *
* @param step the parent {@link ImageStep} form * @param step the parent {@link ImageStep} form
*/ */
@ -100,6 +104,10 @@ public class ImageStepEdit extends SimpleContainer
} }
/**
*
* @param p
*/
@Override @Override
public void register(Page p) { public void register(Page p) {
super.register(p); super.register(p);
@ -124,6 +132,11 @@ public class ImageStepEdit extends SimpleContainer
return m_imageComponent.getComponentsMap().values().iterator(); return m_imageComponent.getComponentsMap().values().iterator();
} }
/**
*
* @param ps
* @param activeKey
*/
private void setImageComponent(PageState ps, final String activeKey) { private void setImageComponent(PageState ps, final String activeKey) {
m_imageComponent.setSelectedKey(ps, activeKey); m_imageComponent.setSelectedKey(ps, activeKey);

View File

@ -106,6 +106,8 @@ public class AgendaPropertyForm extends BasicPageForm
TextArea summary = new TextArea(summaryParam); TextArea summary = new TextArea(summaryParam);
summary.setCols(40); summary.setCols(40);
summary.setRows(5); summary.setRows(5);
summary.setHint(AgendaGlobalizationUtil.globalize(
"cms.contenttypes.ui.summary"));
add(summary); add(summary);
add(new Label(AgendaGlobalizationUtil add(new Label(AgendaGlobalizationUtil

View File

@ -94,6 +94,7 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm
TextArea lead = new TextArea(leadParam); TextArea lead = new TextArea(leadParam);
lead.setCols(40); lead.setCols(40);
lead.setRows(5); lead.setRows(5);
lead.setHint(GlobalizationUtil.globalize("cms.contenttypes.ui.lead_hint"));
add(lead); add(lead);
} }

View File

@ -166,6 +166,8 @@ public abstract class MultiPartArticleForm extends FormSection
} }
summaryWidget.setRows(5); summaryWidget.setRows(5);
summaryWidget.setCols(30); summaryWidget.setCols(30);
summaryWidget.setHint(GlobalizationUtil.globalize(
"cms.contenttypes.ui.summary_hint"));
add(summaryWidget); add(summaryWidget);
} }

View File

@ -36,7 +36,7 @@ cms.contenttypes.ui.homepage=Homepage:
cms.contenttypes.ui.launch_date=Launch Date: cms.contenttypes.ui.launch_date=Launch Date:
cms.contenttypes.ui.lead=Description: cms.contenttypes.ui.lead=Description:
cms.contenttypes.ui.name=Name (URL stub): cms.contenttypes.ui.name=Name (URL stub):
cms.contenttypes.ui.summary=Description: cms.contenttypes.ui.summary=Summary:
cms.contenttypes.ui.title=Title: cms.contenttypes.ui.title=Title:
cms.contentasset.image.ui.view_image=view image cms.contentasset.image.ui.view_image=view image
@ -308,7 +308,7 @@ cms.ui.authoringkit.component=Component:
cms.ui.authoringkit.content_type_id=Content Type ID# cms.ui.authoringkit.content_type_id=Content Type ID#
cms.ui.authoringkit.create_component=Create Component: cms.ui.authoringkit.create_component=Create Component:
cms.ui.authoringkit.createcomponent=CreateComponent: cms.ui.authoringkit.createcomponent=CreateComponent:
cms.ui.authoringkit.current_row_does_not_exists=Current row does not exists cms.ui.authoringkit.current_row_dont_exists=Current row does not exists
cms.ui.authoringkit.description=Description: cms.ui.authoringkit.description=Description:
cms.ui.authoringkit.description_bundle=Description Bundle cms.ui.authoringkit.description_bundle=Description Bundle
cms.ui.authoringkit.description_key=Description Key cms.ui.authoringkit.description_key=Description Key
@ -1037,3 +1037,23 @@ cms.contenttyes.link.ui.button_cancel=Cancel
cms.contenttyes.link.ui.table_no_entries=There are no links for this content item cms.contenttyes.link.ui.table_no_entries=There are no links for this content item
cms.contentasset.image.ui.caption=Caption: cms.contentasset.image.ui.caption=Caption:
cms.contentasset.image.ui.use_context=Use Context: cms.contentasset.image.ui.use_context=Use Context:
cms.contentasset.image.ui.type=Image Type
cms.contentasset.image.ui.table.link_select=select
cms.contentasset.image.ui.delete_link=delete
cms.contentasset.image.ui.table.header_thumb=Thumbnail
cms.contentasset.image.ui.table.header_name=Name
cms.contentasset.image.ui.table.header_size=Size
cms.contentasset.image.ui.table.header_type=Type
cms.contentasset.image.ui.table.header_action_select=Action
cms.contentasset.image.ui.table.link_delete=Remove from the system
cms.contentasset.image.ui.table.header_action_delete=Delete from the system
cms.contentasset.image.ui.display.name=Name:
cms.contentasset.image.ui.display.type=Image Type:
cms.contentasset.image.ui.display.width=Width:
cms.contentasset.image.ui.display.height=Height:
cms.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.lead_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.summary_hint=Propably 3-4 sentences to characterize the most important and interesting aspects of the item. By default it will be displayed along with the title in all item list, making up an rich information site.
cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besides special circumstances, should not exceed 2 text lines.
cms.contenttypes.ui.name_hint=Nicht Teil des Dokumentes wie es Besuchern angezeigt wird. Es handelt sich um den letzten Teil der URL (nach dem letzten "/") und ist somit Teil der Internet Addresse dieses Dokumentes. Es wird oben im Adressfeld des Browsers angezeigt. Es wird automatisch aus dem Titel generiert, wobei unzul\u00e4ssige Zeichen ersetzt werden. Bei einem sehr langen Titel kann eine manuelle K\u00fcrzung sinnvoll sein, um \u00fcberlange Adresszeilen zu vermeiden.

View File

@ -36,7 +36,7 @@ cms.contenttypes.ui.homepage=Homepage:
cms.contenttypes.ui.launch_date=Ver\u00f6ffentlichungsdatum: cms.contenttypes.ui.launch_date=Ver\u00f6ffentlichungsdatum:
cms.contenttypes.ui.lead=Beschreibung (Lead Text): cms.contenttypes.ui.lead=Beschreibung (Lead Text):
cms.contenttypes.ui.name=Name (als Teil-URL): cms.contenttypes.ui.name=Name (als Teil-URL):
cms.contenttypes.ui.summary=Beschreibung: cms.contenttypes.ui.summary=Zusammenfassung:
cms.contenttypes.ui.title=Titel: cms.contenttypes.ui.title=Titel:
cms.contentasset.image.ui.view_image=Bild anzeigen cms.contentasset.image.ui.view_image=Bild anzeigen
@ -305,7 +305,7 @@ cms.ui.authoringkit.component=Komponente:
cms.ui.authoringkit.content_type_id=Dokumententyp ID# cms.ui.authoringkit.content_type_id=Dokumententyp ID#
cms.ui.authoringkit.create_component=Komponente erstellen: cms.ui.authoringkit.create_component=Komponente erstellen:
cms.ui.authoringkit.createcomponent=Komponentenerstellung: cms.ui.authoringkit.createcomponent=Komponentenerstellung:
cms.ui.authoringkit.current_row_does_not_exists=Aktuelle Zeile existiert nicht cms.ui.authoringkit.current_row_dont_exists=Aktuelle Zeile existiert nicht
cms.ui.authoringkit.description=Beschreibung: cms.ui.authoringkit.description=Beschreibung:
cms.ui.authoringkit.description_bundle=Beschreibung Bundle cms.ui.authoringkit.description_bundle=Beschreibung Bundle
cms.ui.authoringkit.description_key=Beschreibung Key cms.ui.authoringkit.description_key=Beschreibung Key
@ -1032,3 +1032,23 @@ cms.contenttyes.link.ui.button_cancel=Abbruch
cms.contenttyes.link.ui.table_no_entries=Es sind noch keine Links zugeordnet. cms.contenttyes.link.ui.table_no_entries=Es sind noch keine Links zugeordnet.
cms.contentasset.image.ui.caption=Bildunterschrift: cms.contentasset.image.ui.caption=Bildunterschrift:
cms.contentasset.image.ui.use_context=Kontext: cms.contentasset.image.ui.use_context=Kontext:
cms.contentasset.image.ui.type=Bild Typ
cms.contentasset.image.ui.table.link_select=ausw\u00e4hlen
cms.contentasset.image.ui.delete_link=l\u00f6schen
cms.contentasset.image.ui.table.header_thumb=Vorschau
cms.contentasset.image.ui.table.header_name=Name
cms.contentasset.image.ui.table.header_size=Gr\u00f6\u00dfe
cms.contentasset.image.ui.table.header_type=Typ
cms.contentasset.image.ui.table.header_action_select=Aktion
cms.contentasset.image.ui.table.link_delete=Aus dem System endg\u00fcltig l\u00f6schen
cms.contentasset.image.ui.table.header_action_delete=Aus dem System l\u00f6schen
cms.contentasset.image.ui.display.name=Name:
cms.contentasset.image.ui.display.type=Bild Typ:
cms.contentasset.image.ui.display.width=Breite:
cms.contentasset.image.ui.display.height=H\u00f6he:
cms.ui.description_hint=Eine kurze Charakterisierung des Dokumentes, nach M\u00f6glichkeit nicht l\u00e4nger als 2-3 S\u00e4tze. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen.
cms.contenttypes.ui.lead_hint=Eine kurze Charakterisierung des Dokumentes, nach M\u00f6glichkeit nicht l\u00e4nger als 2-3 S\u00e4tze. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen.
cms.contenttypes.ui.description_hint=Eine kurze Charakterisierung des Dokumentes, nach M\u00f6glichkeit nicht l\u00e4nger als 2-3 S\u00e4tze. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen.
cms.contenttypes.ui.summary_hint=Nach M\u00f6glichkeit maximal 3-4 S\u00e4tze zur Charakterisierung der wichtigsten und f\u00fcr Leser interessantesten Aspekte des Dokuments. Standardm\u00e4\u00dfig wird die Beschreibung zusammen mit dem Titel in allen Dokumentenliste angezeigt, um so Seiten mit hohem Informationsgehalt zu erzeugen.
cms.contenttypes.ui.title_hint=Titel des Dokuments wie ihn Besucher lesen sollen. Abgesehen von Sonderf\u00e4llen sollten 2 Zeilen auf keinen Fall \u00fcberschritten werden. Eine Beschr\u00e4nkung auf eine Zeile ist vorzuziehen. Der Titel wird jedesmal zusammen mit dem Dokument angezeigt.
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.

View File

@ -85,3 +85,23 @@ cms.contenttyes.link.ui.button_cancel=Cancel
cms.contenttyes.link.ui.table_no_entries=There are no links for this content item cms.contenttyes.link.ui.table_no_entries=There are no links for this content item
cms.contentasset.image.ui.caption=Caption: cms.contentasset.image.ui.caption=Caption:
cms.contentasset.image.ui.use_context=Use Context: cms.contentasset.image.ui.use_context=Use Context:
cms.contentasset.image.ui.type=Image Type
cms.contentasset.image.ui.table.link_select=select
cms.contentasset.image.ui.delete_link=delete
cms.contentasset.image.ui.table.header_thumb=Thumbnail
cms.contentasset.image.ui.table.header_name=Name
cms.contentasset.image.ui.table.header_size=Size
cms.contentasset.image.ui.table.header_type=Type
cms.contentasset.image.ui.table.header_action_select=Action
cms.contentasset.image.ui.table.link_delete=Remove from the system
cms.contentasset.image.ui.table.header_action_delete=Delete from the system
cms.contentasset.image.ui.display.name=Name:
cms.contentasset.image.ui.display.type=Image Type:
cms.contentasset.image.ui.display.width=Width:
cms.contentasset.image.ui.display.height=Height:
cms.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.lead_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.summary_hint=Propably 3-4 sentences to characterize the most important and interesting aspects of the item. By default it will be displayed along with the title in all item list, making up an rich information site.
cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besides special circumstances, should not exceed 2 text lines.
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.

View File

@ -198,7 +198,7 @@ cms.ui.authoringkit.component=Composant
cms.ui.authoringkit.content_type_id=Type de contenu ID# cms.ui.authoringkit.content_type_id=Type de contenu ID#
cms.ui.authoringkit.create_component=Cr\u00e9er le composant cms.ui.authoringkit.create_component=Cr\u00e9er le composant
cms.ui.authoringkit.createcomponent=Cr\u00e9er le composant cms.ui.authoringkit.createcomponent=Cr\u00e9er le composant
cms.ui.authoringkit.current_row_does_not_exists=La ligne en cours n'exsite pas cms.ui.authoringkit.current_row_dont_exists=La ligne en cours n'exsite pas
cms.ui.authoringkit.description=Description cms.ui.authoringkit.description=Description
cms.ui.authoringkit.do_you_really_want_to_delete_this_authoring_step=Etes-vous sur de vouloir effacer cette \u00e9tape d'\u00e9criture ? cms.ui.authoringkit.do_you_really_want_to_delete_this_authoring_step=Etes-vous sur de vouloir effacer cette \u00e9tape d'\u00e9criture ?
cms.ui.authoringkit.label=Etiquette cms.ui.authoringkit.label=Etiquette
@ -559,3 +559,23 @@ cms.contenttyes.link.ui.button_cancel=Cancel
cms.contenttyes.link.ui.table_no_entries=There are no links for this content item cms.contenttyes.link.ui.table_no_entries=There are no links for this content item
cms.contentasset.image.ui.caption=Caption: cms.contentasset.image.ui.caption=Caption:
cms.contentasset.image.ui.use_context=Use Context: cms.contentasset.image.ui.use_context=Use Context:
cms.contentasset.image.ui.type=Image Type
cms.contentasset.image.ui.table.link_select=select
cms.contentasset.image.ui.delete_link=delete
cms.contentasset.image.ui.table.header_thumb=Thumbnail
cms.contentasset.image.ui.table.header_name=Name
cms.contentasset.image.ui.table.header_size=Size
cms.contentasset.image.ui.table.header_type=Type
cms.contentasset.image.ui.table.header_action_select=Action
cms.contentasset.image.ui.table.link_delete=Remove from the system
cms.contentasset.image.ui.table.header_action_delete=Delete from the system
cms.contentasset.image.ui.display.name=Name:
cms.contentasset.image.ui.display.type=Image Type:
cms.contentasset.image.ui.display.width=Width:
cms.contentasset.image.ui.display.height=Height:
cms.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.lead_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.description_hint=A short characterization of this item. You should limit the text to 2-3 senentces. By default the description is displayed along with the title in every item list.
cms.contenttypes.ui.summary_hint=Propably 3-4 sentences to characterize the most important and interesting aspects of the item. By default it will be displayed along with the title in all item list, making up an rich information site.
cms.contenttypes.ui.title_hint=The title of the item readable by the user. Besides special circumstances, should not exceed 2 text lines.
cms.contenttypes.ui.name_hint=Not part of the item as displayed to the user. It is the last part of the URL (after the last "/") and is part of the internet address of this item. It is displayed in the browsers address field. Made up automatically using the title, illegal characters replaced. With a long title you may choose to shorten it to avoid overly long internet addresses.

View File

@ -60,7 +60,7 @@ public class GenericArticlePropertiesStep extends SimpleEditStep {
BasicPageForm editSheet; BasicPageForm editSheet;
editSheet = new GenericArticlePropertyForm(itemModel, this); editSheet = new GenericArticlePropertyForm(itemModel, this);
add(EDIT_SHEET_NAME, add(EDIT_SHEET_NAME,
"Edit", GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(editSheet, itemModel), new WorkflowLockedComponentAccess(editSheet, itemModel),
editSheet.getSaveCancelSection().getCancelButton()); editSheet.getSaveCancelSection().getCancelButton());
} }

View File

@ -52,13 +52,13 @@ public class GenericOrganizationalUnitContactPropertiesStep
new GenericOrganizationalUnitContactAddForm(itemModel, new GenericOrganizationalUnitContactAddForm(itemModel,
this); this);
add(ADD_CONTACT_SHEET_NAME, add(ADD_CONTACT_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.add_contact").localize(), "cms.contenttypes.ui.genericorgaunit.add_contact"),
new WorkflowLockedComponentAccess(addContactSheet, itemModel), new WorkflowLockedComponentAccess(addContactSheet, itemModel),
addContactSheet.getSaveCancelSection().getCancelButton()); addContactSheet.getSaveCancelSection().getCancelButton());
GenericOrganizationalUnitContactTable contactsTable = new GenericOrganizationalUnitContactTable( GenericOrganizationalUnitContactTable contactsTable = new
itemModel, this); GenericOrganizationalUnitContactTable(itemModel, this);
setDisplayComponent(contactsTable); setDisplayComponent(contactsTable);
} }

View File

@ -57,14 +57,13 @@ public class GenericOrganizationalUnitPersonPropertiesStep
new GenericOrganizationalUnitPersonAddForm(itemModel, new GenericOrganizationalUnitPersonAddForm(itemModel,
this); this);
add(ADD_PERSON_SHEET_NAME, add(ADD_PERSON_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.add_person").localize(), "cms.contenttypes.ui.genericorgaunit.add_person"),
new WorkflowLockedComponentAccess(addPersonSheet, itemModel), new WorkflowLockedComponentAccess(addPersonSheet, itemModel),
addPersonSheet.getSaveCancelSection().getCancelButton()); addPersonSheet.getSaveCancelSection().getCancelButton());
GenericOrganizationalUnitPersonsTable personsTable = new GenericOrganizationalUnitPersonsTable( GenericOrganizationalUnitPersonsTable personsTable = new
itemModel, GenericOrganizationalUnitPersonsTable(itemModel,this);
this);
setDisplayComponent(personsTable); setDisplayComponent(personsTable);
} }

View File

@ -28,16 +28,18 @@ import com.arsdigita.bebop.event.TableActionAdapter;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
import com.arsdigita.bebop.table.DefaultTableCellRenderer; import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.bebop.table.TableCellRenderer; import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS; import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Service; import com.arsdigita.cms.Service;
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.mimetypes.MimeType; import com.arsdigita.mimetypes.MimeType;
import com.arsdigita.mimetypes.image.ImageSizer;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
@ -66,24 +68,36 @@ import org.apache.log4j.Logger;
*/ */
public class ImageBrowser extends Table { public class ImageBrowser extends Table {
private static final Logger s_log = Logger.getLogger(ImageBrowser.class);
private ImageBrowserModelBuilder m_builder; private ImageBrowserModelBuilder m_builder;
private static final String[] HEADERS = {"Thumbnail", "Name", "Size", "Type", "Action", ""};
// match columns by (symbolic) index, makes for easier reordering
/** Index into TableColumn for Thumb column */
private static final int THUMB = 0; private static final int THUMB = 0;
/** Index into TableColumn for Name column */
private static final int NAME = 1; private static final int NAME = 1;
/** Index into TableColumn for Size column */
private static final int SIZE = 2; private static final int SIZE = 2;
/** Index into TableColumn for Type column */
private static final int TYPE = 3; private static final int TYPE = 3;
private static final int LINK = 4; /** Index into TableColumn for Select link column */
private static final int SELECT = 4;
/** Index into TableColumn for Delete link column */
private static final int DELETE = 5; private static final int DELETE = 5;
private int m_numColumns = -1; private int m_numColumns = -1;
private int m_mode; private int m_mode;
private Dimension m_thumbSize; private Dimension m_thumbSize;
private static final Logger s_log = Logger.getLogger(ImageBrowser.class);
/** /**
* Construct a new ImageBrowser with default mode. * Construct a new ImageBrowser with default mode.
* *
* @param builder the {@link ImageBrowserModelBuilder} that will supply this * @param builder the {@link ImageBrowserModelBuilder} that will supply this
* component with its {@link ImageBrowserModel} during each request * component with its {@link ImageBrowserModel} during each
* request
*/ */
public ImageBrowser(ImageBrowserModelBuilder b) { public ImageBrowser(ImageBrowserModelBuilder b) {
@ -91,27 +105,63 @@ public class ImageBrowser extends Table {
} }
/** /**
* Construct a new ImageBrowser with requested mode. * Construct a new ImageBrowser table with requested mode.
* *
* @param builder the {@link ImageBrowserModelBuilder} that will supply this * @param builder the {@link ImageBrowserModelBuilder} that will supply this
* component with its {@link ImageBrowserModel} during each request * component with its {@link ImageBrowserModel} during each
* request
* @param mode the component mode (see {@link ImageComponent}) * @param mode the component mode (see {@link ImageComponent})
*/ */
public ImageBrowser(ImageBrowserModelBuilder b, int mode) { public ImageBrowser(ImageBrowserModelBuilder b, int mode) {
super(new BuilderAdapter(b), HEADERS); super(); // Create an empty table
m_builder = b;
m_mode = mode; m_mode = mode;
setThumbnailSize(CMS.getConfig().getImageBrowserThumbnailMaxWidth(), setThumbnailSize(CMS.getConfig().getImageBrowserThumbnailMaxWidth(),
CMS.getConfig().getImageBrowserThumbnailMaxHeight()); CMS.getConfig().getImageBrowserThumbnailMaxHeight());
m_builder = b;
getHeader().setDefaultRenderer(new DefaultTableCellRenderer(false)); /* Add columns and column header to the yet empty table */
addColumn(new ThumbnailCellRenderer()); TableColumnModel model = getColumnModel();
addColumn(new DefaultTableCellRenderer(false)); model.add(new TableColumn(
addColumn(new DefaultTableCellRenderer(false)); THUMB,
addColumn(new DefaultTableCellRenderer(false)); new Label(GlobalizationUtil.globalize(
addColumn(new SelectCellRenderer()); "cms.contentasset.image.ui.table.header_thumb")
addColumn(new DeleteCellRenderer()); ) ));
model.add(new TableColumn(
NAME,
new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.header_name")
) ));
model.add(new TableColumn(
SIZE,
new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.header_size")
) ));
model.add(new TableColumn(
TYPE,
new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.header_type")
) ));
model.add(new TableColumn(
SELECT,
new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.header_action_select")
) ));
model.add(new TableColumn( // Temporary not used due to consistency
DELETE, null // probs with images probably in use
// new Label(GlobalizationUtil.globalize(
// "cms.contentasset.image.ui.table.header_action_delete"))
));
model.get(THUMB).setCellRenderer(new ThumbnailCellRenderer());
model.get(NAME).setCellRenderer(new DefaultTableCellRenderer(false));
model.get(SIZE).setCellRenderer(new DefaultTableCellRenderer(false));
model.get(TYPE).setCellRenderer(new DefaultTableCellRenderer(false));
model.get(SELECT).setCellRenderer(new SelectCellRenderer());
model.get(DELETE).setCellRenderer(new DeleteCellRenderer());
setModelBuilder(new BuilderAdapter(b));
setCellPadding("4"); setCellPadding("4");
setBorder("1"); setBorder("1");
@ -119,13 +169,6 @@ public class ImageBrowser extends Table {
setClassAttr("imageBrowser"); setClassAttr("imageBrowser");
} }
/**
*
* @param renderer
*/
private void addColumn(TableCellRenderer renderer) {
getColumn(++m_numColumns).setCellRenderer(renderer);
}
/** /**
* *
@ -181,10 +224,12 @@ public class ImageBrowser extends Table {
@Override @Override
public void cellSelected(TableActionEvent e) { public void cellSelected(TableActionEvent e) {
int c = e.getColumn().intValue(); int c = e.getColumn().intValue();
if (c == LINK) { if (c == SELECT) {
linkClicked(e.getPageState(), new BigDecimal((String) e.getRowKey())); linkClicked(e.getPageState(),
new BigDecimal((String) e.getRowKey()));
} else if (c == DELETE) { } else if (c == DELETE) {
deleteClicked(e.getPageState(), new BigDecimal((String) e.getRowKey())); deleteClicked(e.getPageState(),
new BigDecimal((String) e.getRowKey()));
} }
} }
@ -206,9 +251,13 @@ public class ImageBrowser extends Table {
String url = Service.getImageURL(a); String url = Service.getImageURL(a);
// Sets url paramter to resize the images server-side // Sets url paramter to resize the images server-side
String resizeParam = "&maxWidth=" + new Double(m_thumbSize.getWidth()).intValue() + "&maxHeight=" + new Double(m_thumbSize.getHeight()).intValue(); String resizeParam = "&maxWidth="
+ new Double(m_thumbSize.getWidth()).intValue()
+ "&maxHeight="
+ new Double(m_thumbSize.getHeight()).intValue();
Image img = new Image(URL.getDispatcherPath() + url + resizeParam, a.getName()); Image img = new Image(URL.getDispatcherPath() + url
+ resizeParam, a.getName());
img.setBorder("0"); img.setBorder("0");
return new Link(img, url); return new Link(img, url);
@ -224,16 +273,30 @@ public class ImageBrowser extends Table {
super(true); super(true);
} }
/**
*
* @param table
* @param state
* @param value
* @param isSelected
* @param key
* @param row
* @param column
* @return
*/
@Override @Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) { if (m_mode == ImageComponent.SELECT_IMAGE
return super.getComponent(table, state, value, isSelected, key, row, column); || m_mode == ImageComponent.ATTACH_IMAGE) {
return super.getComponent(table, state, value,
isSelected, key, row, column);
} }
return new Label(""); // return new Label(""); // this variant is deprecated!
return new Label();
} }
} }
@ -247,6 +310,17 @@ public class ImageBrowser extends Table {
super(true); super(true);
} }
/**
*
* @param table
* @param state
* @param value
* @param isSelected
* @param key
* @param row
* @param column
* @return
*/
@Override @Override
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
@ -258,7 +332,8 @@ public class ImageBrowser extends Table {
boolean canDelete = false; boolean canDelete = false;
// SecurityManager sm = Utilities.getSecurityManager(state); // SecurityManager sm = Utilities.getSecurityManager(state);
SecurityManager sm = CMS.getSecurityManager(state); SecurityManager sm = CMS.getSecurityManager(state);
if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) { if (sm.canAccess(state.getRequest(),
SecurityManager.DELETE_IMAGES)) {
try { try {
ImageAsset asset = (ImageAsset) DomainObjectFactory ImageAsset asset = (ImageAsset) DomainObjectFactory
.newInstance(new .newInstance(new
@ -286,7 +361,9 @@ public class ImageBrowser extends Table {
column); column);
} }
} }
return new Label(""); // return (Component) null; // used to work for other tables but
// doesn't here for some reason.
return new Label();
} }
} }
@ -378,11 +455,19 @@ public class ImageBrowser extends Table {
return m.getMimeType(); return m.getMimeType();
case ImageBrowser.LINK: case ImageBrowser.SELECT:
return "select"; // Due to current design has to be a string! Localisation
// works here nevertheless.
return (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.link_select")
.localize();
case ImageBrowser.DELETE: case ImageBrowser.DELETE:
return "delete"; // Due to current design has to be a string! Localisation
// works here nevertheless.
return (String) GlobalizationUtil.globalize(
"cms.contentasset.image.ui.table.link_delete")
.localize();
default: default:
return null; return null;

View File

@ -27,9 +27,12 @@ import org.apache.log4j.Logger;
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
*/ */
public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener { public abstract class ImageComponentAbstractListener implements FormInitListener,
FormProcessListener,
FormSubmissionListener {
private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class); private static final Logger s_log = Logger.getLogger(
ImageComponentSelectListener.class);
MapComponentSelectionModel m_imageComponent; MapComponentSelectionModel m_imageComponent;
public ImageComponentAbstractListener(MapComponentSelectionModel imageComponent) { public ImageComponentAbstractListener(MapComponentSelectionModel imageComponent) {
@ -62,7 +65,9 @@ public abstract class ImageComponentAbstractListener implements FormInitListener
} }
/** /**
* Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent, com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent, com.arsdigita.cms.ReusableImageAsset) } * Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent,
* com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent,
* com.arsdigita.cms.ReusableImageAsset) }
* if the save button was pressed. * if the save button was pressed.
* *
* @param event the {@link FormSectionEvent} * @param event the {@link FormSectionEvent}

View File

@ -19,10 +19,12 @@ import org.apache.log4j.Logger;
*/ */
public class ImageComponentSelectListener extends ImageComponentAbstractListener { public class ImageComponentSelectListener extends ImageComponentAbstractListener {
private static final Logger S_LOG = Logger.getLogger(ImageComponentSelectListener.class); private static final Logger S_LOG = Logger.getLogger(
ImageComponentSelectListener.class);
private final ImageSelectResultComponent m_resultPane; private final ImageSelectResultComponent m_resultPane;
public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultComponent resultPane) { public ImageComponentSelectListener(MapComponentSelectionModel imageComponent,
ImageSelectResultComponent resultPane) {
super(imageComponent); super(imageComponent);
m_resultPane = resultPane; m_resultPane = resultPane;
} }
@ -33,7 +35,17 @@ public class ImageComponentSelectListener extends ImageComponentAbstractListener
m_resultPane.reset(ps); m_resultPane.reset(ps);
} }
protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) { /**
*
* @param event
* @param ps
* @param component
* @param image
*/
protected void processImage(FormSectionEvent event,
PageState ps,
ImageComponent component,
ReusableImageAsset image) {
m_imageComponent.setSelectedKey(ps, ImageSelectPage.RESULT); m_imageComponent.setSelectedKey(ps, ImageSelectPage.RESULT);
m_resultPane.reset(ps); m_resultPane.reset(ps);
} }

View File

@ -24,6 +24,7 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.Service; import com.arsdigita.cms.Service;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.mimetypes.MimeType; import com.arsdigita.mimetypes.MimeType;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import com.arsdigita.web.URL; import com.arsdigita.web.URL;
@ -35,10 +36,6 @@ import java.math.BigDecimal;
* Displays a single ImageAsset, showing its image, width, height, * Displays a single ImageAsset, showing its image, width, height,
* name and mime-type. * name and mime-type.
* *
* TODO: Method generateImagePropertiesXML currently just generates the
* property values. The labels (including localization) are handled by the
* theme. Has to be refactord to provide labels including localization as well.
*
* @author Michael Pih (pihman@arsdigita.com) * @author Michael Pih (pihman@arsdigita.com)
* @author Stanislav Freidin (sfreidin@arsdigita.com) * @author Stanislav Freidin (sfreidin@arsdigita.com)
* @version $Id: ImageDisplay.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ImageDisplay.java 287 2005-02-22 00:29:02Z sskracic $
@ -93,9 +90,7 @@ public class ImageDisplay extends SimpleComponent {
} }
/** /**
* Generates the property xml. The xml contains no labels for meta date as * Generates the property xml.
* name, type, width, and height. Labels are currently handled by theme!
* A proper localization has to be done in theme as well!
* *
* @param image * @param image
* @param state * @param state
@ -104,23 +99,44 @@ public class ImageDisplay extends SimpleComponent {
protected void generateImagePropertiesXML(ImageAsset image, protected void generateImagePropertiesXML(ImageAsset image,
PageState state, PageState state,
Element element) { Element element) {
element.addAttribute("name_label", (String)GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.name")
.localize());
element.addAttribute("name", image.getName()); element.addAttribute("name", image.getName());
element.addAttribute("src", URL.getDispatcherPath() + element.addAttribute("src", URL.getDispatcherPath() +
Service.getImageURL(image)); Service.getImageURL(image));
element.addAttribute("mime_type_label", (String)GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.type")
.localize());
MimeType mimeType = image.getMimeType(); MimeType mimeType = image.getMimeType();
if ( mimeType != null ) { if ( mimeType != null ) {
element.addAttribute("mime_type", mimeType.getLabel()); element.addAttribute("mime_type", mimeType.getLabel());
} }
element.addAttribute("width_label", (String)GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.width")
.localize());
BigDecimal width = image.getWidth(); BigDecimal width = image.getWidth();
if ( width != null ) { if ( width != null ) {
element.addAttribute("width", width.toString()); element.addAttribute("width", width.toString());
} else {
element.addAttribute("width", (String)GlobalizationUtil.globalize(
"cms.ui.unknown")
.localize());
} }
element.addAttribute("height_label", (String)GlobalizationUtil.globalize(
"cms.contentasset.image.ui.display.height")
.localize());
BigDecimal height = image.getHeight(); BigDecimal height = image.getHeight();
if ( height != null ) { if ( height != null ) {
element.addAttribute("height", height.toString()); element.addAttribute("height", height.toString());
} else {
element.addAttribute("height", (String)GlobalizationUtil.globalize(
"cms.ui.unknown")
.localize());
} }
} }

View File

@ -35,7 +35,8 @@ import java.math.BigDecimal;
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
*/ */
public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable { public class ImageLibraryComponent extends SimpleContainer
implements ImageComponent, Resettable {
private final ImageChooser m_chooser; private final ImageChooser m_chooser;
private final ItemSelectionModel m_imageModel; private final ItemSelectionModel m_imageModel;

View File

@ -18,7 +18,8 @@ import com.arsdigita.xml.Element;
* *
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
*/ */
public class ImageSelectResultComponent extends SimpleContainer implements Resettable { public class ImageSelectResultComponent extends SimpleContainer
implements Resettable {
boolean m_valid = false; boolean m_valid = false;
ImageAsset m_image; ImageAsset m_image;
@ -32,7 +33,10 @@ public class ImageSelectResultComponent extends SimpleContainer implements Reset
* *
* @param iamge an {@link ImageAsset} * @param iamge an {@link ImageAsset}
*/ */
public void setResult(final ImageAsset image/*, final String name, final BigDecimal id, final BigDecimal width, final BigDecimal height*/) { public void setResult(final ImageAsset image/*, final String name,
* final BigDecimal id,
* final BigDecimal width,
* final BigDecimal height*/) {
m_image = image; m_image = image;
m_valid = (m_image != null); m_valid = (m_image != null);
} }

View File

@ -58,11 +58,12 @@ public class ImageUploadComponent extends Form implements ImageComponent {
super("imageUploadComponent", new ColumnPanel(2)); super("imageUploadComponent", new ColumnPanel(2));
m_mode = mode; m_mode = mode;
setEncType("multipart/form-data"); setEncType("multipart/form-data");
// Ignoring deprecated constructor. m_imageFile = new FileUploadSection(GlobalizationUtil.globalize(
m_imageFile = new FileUploadSection("Image Type", "cms.contentasset.image.ui.type"),
"image", "image",
ImageAsset.MIME_JPEG); ImageAsset.MIME_JPEG);
m_imageFile.getFileUploadWidget().addValidationListener(new NotNullValidationListener()); m_imageFile.getFileUploadWidget()
.addValidationListener(new NotNullValidationListener());
add(m_imageFile, ColumnPanel.FULL_WIDTH); add(m_imageFile, ColumnPanel.FULL_WIDTH);
// Initialize all widgets // Initialize all widgets
@ -123,7 +124,8 @@ public class ImageUploadComponent extends Form implements ImageComponent {
return m_saveCancel; return m_saveCancel;
} }
public ReusableImageAsset getImage(FormSectionEvent event) throws FormProcessException { public ReusableImageAsset getImage(FormSectionEvent event)
throws FormProcessException {
PageState ps = event.getPageState(); PageState ps = event.getPageState();
String filename = (String) m_imageFile.getFileName(event); String filename = (String) m_imageFile.getFileName(event);
File imageFile = m_imageFile.getFile(event); File imageFile = m_imageFile.getFile(event);

View File

@ -56,7 +56,8 @@ public class ImagesPane extends LayoutPanel implements Resettable {
public ImagesPane() { public ImagesPane() {
super(); super();
m_model = new ResettableParameterSingleSelectionModel(new StringParameter(List.SELECTED)); m_model = new ResettableParameterSingleSelectionModel(new
StringParameter(List.SELECTED));
m_model.setDefaultSelection(ImageComponent.LIBRARY); m_model.setDefaultSelection(ImageComponent.LIBRARY);
m_model.addChangeListener(new ImageAdminSelectionListener()); m_model.addChangeListener(new ImageAdminSelectionListener());
@ -210,7 +211,8 @@ public class ImagesPane extends LayoutPanel implements Resettable {
} }
public Object getElement() { public Object getElement() {
return GlobalizationUtil.globalize("cms.ui.image_" + m_keys.get(m_index)).localize(); return GlobalizationUtil.globalize(
"cms.ui.image_" + m_keys.get(m_index)).localize();
} }
public String getKey() { public String getKey() {
@ -218,7 +220,8 @@ public class ImagesPane extends LayoutPanel implements Resettable {
} }
} }
private class ImageAdminListModelBuilder extends LockableImpl implements ListModelBuilder { private class ImageAdminListModelBuilder extends LockableImpl
implements ListModelBuilder {
public ListModel makeModel(final List list, final PageState state) { public ListModel makeModel(final List list, final PageState state) {
ArrayList<String> keys = new ArrayList(2); ArrayList<String> keys = new ArrayList(2);
@ -242,7 +245,9 @@ public class ImagesPane extends LayoutPanel implements Resettable {
S_LOG.debug("The selection model is selected; displaying " S_LOG.debug("The selection model is selected; displaying "
+ "the item pane"); + "the item pane");
ImagesPane.this.setActiveImageComponent(state, state.getControlEventValue()); ImagesPane.this.setActiveImageComponent(
state,
state.getControlEventValue());
} }
} }
} }

View File

@ -49,10 +49,11 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
ContentTypeCollection m_types; ContentTypeCollection m_types;
/** /**
* Construct a new AuthoringKitSelector. Load all the possible authoring kits from the database and construct * Construct a new AuthoringKitSelector. Load all the possible authoring kits
* components for them. * from the database and construct components for them.
* *
* @param model the {@link ItemSelectionModel} which will supply the selector with the id of a content type * @param model the {@link ItemSelectionModel} which will supply the selector
* with the id of a content type
* *
* @pre itemModel != null * @pre itemModel != null
*/ */
@ -83,8 +84,8 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
} }
/** /**
* Instantiate all the authoring kit wizards. The child class should call this method after it is done with * Instantiate all the authoring kit wizards. The child class should call
* initialization * this method after it is done with initialization.
*/ */
protected void processKit() { protected void processKit() {
while (m_types.next()) { while (m_types.next()) {
@ -103,8 +104,9 @@ public abstract class AuthoringKitSelector extends SimpleContainer {
} }
/** /**
* Instantiate an authoring kit component. Child classes should override this to do the right thing. It is * Instantiate an authoring kit component. Child classes should override
* permissible for this method to return null. * this to do the right thing. It is permissible for this method to
* return null.
* *
* @param kit for this kit * @param kit for this kit
* @param type for this type * @param type for this type

View File

@ -71,13 +71,13 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
/** /**
* <p>This class represents a single authoring kit. The wizard * This class represents a single authoring kit. The wizard accepts a
* accepts a {@link ContentType} in the constructor; it then extracts * {@link ContentType} in the constructor; it then extracts
* the {@link AuthoringKit} for the content type, and creates the * the {@link AuthoringKit} for the content type, and creates the
* components for all the steps in the kit.</p> * components for all the steps in the kit.</p>
* *
* <p>Note that the individual authoring kit steps must provide the * Note that the individual authoring kit steps must provide the following
* following constructor: * constructor:
* *
* <blockquote><pre><code> * <blockquote><pre><code>
* public TheClass(ItemSelectionModel model, AuthoringKitWizard parent) { ... } * public TheClass(ItemSelectionModel model, AuthoringKitWizard parent) { ... }
@ -103,7 +103,8 @@ public class AuthoringKitWizard extends LayoutPanel implements Resettable {
ContentType.class ContentType.class
}; };
//private static final ArrayList s_assets = new ArrayList(); //private static final ArrayList s_assets = new ArrayList();
private static final java.util.List<AssetStepEntry> s_assets = new ArrayList<AssetStepEntry>(); private static final java.util.List<AssetStepEntry> s_assets = new
ArrayList<AssetStepEntry>();
private final Object[] m_vals; private final Object[] m_vals;
private final ContentType m_type; private final ContentType m_type;
private final AuthoringKit m_kit; private final AuthoringKit m_kit;

View File

@ -185,6 +185,7 @@ public abstract class BasicItemForm extends FormSection
titleWidget.setOnKeyUp( titleWidget.setOnKeyUp(
"if (defaulting) { this.form." + NAME "if (defaulting) { this.form." + NAME
+ ".value = urlize(this.value) }"); + ".value = urlize(this.value) }");
titleWidget.setHint(getTitleHint());
add(titleWidget); add(titleWidget);
// For some content types it is maybe useful to change the label of // For some content types it is maybe useful to change the label of
@ -201,6 +202,7 @@ public abstract class BasicItemForm extends FormSection
+ "{ defaulting = true; this.value = urlize(this.form." + TITLE + "{ defaulting = true; this.value = urlize(this.form." + TITLE
+ ".value) } " + " else { this.value = urlize(this.value); }"); + ".value) } " + " else { this.value = urlize(this.value); }");
nameWidget.addValidationListener(new NotNullValidationListener()); nameWidget.addValidationListener(new NotNullValidationListener());
nameWidget.setHint(getNameHint());
add(nameWidget); add(nameWidget);
} }
@ -428,6 +430,19 @@ public abstract class BasicItemForm extends FormSection
return GlobalizationUtil.globalize("cms.contenttypes.ui.title"); return GlobalizationUtil.globalize("cms.contenttypes.ui.title");
} }
/**
* Provides the text for the unser hint providing some detailed information
* how to use this widget.
*
* This method can be overwritten to adjust the text for some content types.
* {@link getTitleLabel()}
*
* @return
*/
protected GlobalizedMessage getTitleHint() {
return GlobalizationUtil.globalize("cms.contenttypes.ui.title_hint");
}
/** /**
* jensp, 2011-01-28 * jensp, 2011-01-28
* This method does the same as {@link #getTitleLabel() } for the label of * This method does the same as {@link #getTitleLabel() } for the label of
@ -438,4 +453,17 @@ public abstract class BasicItemForm extends FormSection
protected GlobalizedMessage getNameLabel() { protected GlobalizedMessage getNameLabel() {
return GlobalizationUtil.globalize("cms.contenttypes.ui.name"); return GlobalizationUtil.globalize("cms.contenttypes.ui.name");
} }
/**
* Provides the text for the unser hint providing some detailed information
* how to use this widget.
*
* This method can be overwritten to adjust the text for some content types.
* {@link getNameLabel()}
*
* @return
*/
protected GlobalizedMessage getNameHint() {
return GlobalizationUtil.globalize("cms.contenttypes.ui.name_hint");
}
} }

View File

@ -37,12 +37,11 @@ import java.math.BigDecimal;
/** /**
* An invisible component which contains all the * An invisible component which contains all the possible authoring kits.
* possible authoring kits. The kits are loaded from the database * The kits are loaded from the database at construction time. The selector
* at construction time. The selector chooses which kit to display * chooses which kit to display at page rendering time based on the value
* at page rendering time based on the value of the * of the content_type state parameter.
* content_type state parameter. *
* <p>
* Essentially, this component is a hack which is used to get around * Essentially, this component is a hack which is used to get around
* the fact that we cannot instantiate stateful components dynamically. * the fact that we cannot instantiate stateful components dynamically.
* *
@ -54,9 +53,8 @@ public class WizardSelector extends AuthoringKitSelector
private ItemSelectionModel m_itemSel; private ItemSelectionModel m_itemSel;
/** /**
* Construct a new WizardSelector. Load all the possible * Construct a new WizardSelector. Load all the possible authoring kits
* authoring kits from the database and construct wizards * from the database and construct wizards for them.
* for them.
* *
* @param model the {@link ItemSelectionModel} which will * @param model the {@link ItemSelectionModel} which will
* supply the wizard with its item * supply the wizard with its item
@ -66,21 +64,21 @@ public class WizardSelector extends AuthoringKitSelector
* *
* @pre itemModel != null * @pre itemModel != null
*/ */
public WizardSelector( public WizardSelector(ItemSelectionModel model,
ItemSelectionModel model, SingleSelectionModel typeModel SingleSelectionModel typeModel) {
) {
super(typeModel); super(typeModel);
m_itemSel = model; m_itemSel = model;
super.processKit(); super.processKit();
} }
// Get the wizard for the given kit /**
public Component instantiateKitComponent( * Get the wizard for the given kit.
AuthoringKit kit, ContentType type */
) { public Component instantiateKitComponent(AuthoringKit kit,
ContentType type) {
ItemSelectionModel itemModel = ItemSelectionModel itemModel = new
new ItemSelectionModel(type, ItemSelectionModel(type,
(BigDecimalParameter)m_itemSel.getStateParameter()); (BigDecimalParameter)m_itemSel.getStateParameter());
AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel); AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel);
@ -99,7 +97,9 @@ public class WizardSelector extends AuthoringKitSelector
// Get the current item and extract its content type // Get the current item and extract its content type
if(!m_itemSel.isSelected(state)) if(!m_itemSel.isSelected(state))
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.authoring.missing_item_id").localize()); throw new RuntimeException( (String) GlobalizationUtil.globalize(
"cms.ui.authoring.missing_item_id")
.localize());
ContentItem item = ContentItem item =
(ContentItem)m_itemSel.getSelectedObject(state); (ContentItem)m_itemSel.getSelectedObject(state);
@ -111,7 +111,9 @@ public class WizardSelector extends AuthoringKitSelector
// Try to get the default content type // Try to get the default content type
typeId = (BigDecimal)getComponentSelectionModel().getSelectedKey(state); typeId = (BigDecimal)getComponentSelectionModel().getSelectedKey(state);
if(typeId == null) { if(typeId == null) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.authoring.missing_content_type").localize()); throw new RuntimeException((String) GlobalizationUtil.globalize(
"cms.ui.authoring.missing_content_type")
.localize());
} }
} else { } else {
typeId = type.getID(); typeId = type.getID();
@ -127,7 +129,9 @@ public class WizardSelector extends AuthoringKitSelector
Component c = getCurrentWizard(state); Component c = getCurrentWizard(state);
if(c == null) { if(c == null) {
throw new RuntimeException( (String) GlobalizationUtil.globalize("cms.ui.authoring.no_current_wizard").localize()); throw new RuntimeException( (String) GlobalizationUtil.globalize(
"cms.ui.authoring.no_current_wizard")
.localize());
} }
c.generateXML(state, parent); c.generateXML(state, parent);

View File

@ -96,7 +96,8 @@ public class KitPanel extends BoxPanel
//display heading //display heading
SimpleContainer heading = new SimpleContainer(); SimpleContainer heading = new SimpleContainer();
heading.add(new Label(GlobalizationUtil.globalize("cms.ui.authoringkit.authoring_kit_for"))); heading.add(new Label(GlobalizationUtil.globalize(
"cms.ui.authoringkit.authoring_kit_for")));
heading.add(makeContentType()); heading.add(makeContentType());
//edit kit //edit kit
@ -178,7 +179,8 @@ public class KitPanel extends BoxPanel
//delete step //delete step
m_deleteStepPanel = new DeleteStep(m_stepTable.getRowSelectionModel(), m_type); m_deleteStepPanel = new DeleteStep(m_stepTable.getRowSelectionModel(),
m_type);
m_deleteStepPanel.addProcessListener(clearStepsProcessListener); m_deleteStepPanel.addProcessListener(clearStepsProcessListener);
m_deleteStepPanel.addSubmissionListener(clearStepsSubmissionListener); m_deleteStepPanel.addSubmissionListener(clearStepsSubmissionListener);
@ -188,7 +190,8 @@ public class KitPanel extends BoxPanel
//create component info //create component info
SimpleContainer createComponent = new SimpleContainer(); SimpleContainer createComponent = new SimpleContainer();
createComponent.add(new Label(GlobalizationUtil.globalize("cms.ui.authoringkit.create_component"))); createComponent.add(new Label(GlobalizationUtil.globalize(
"cms.ui.authoringkit.create_component")));
createComponent.add(makeCreateComponent()); createComponent.add(makeCreateComponent());
createComponent.add(new TypeSecurityContainer(m_editKit)); createComponent.add(new TypeSecurityContainer(m_editKit));
@ -247,12 +250,14 @@ public class KitPanel extends BoxPanel
ContentType type = m_type.getContentType(s); ContentType type = m_type.getContentType(s);
String createComponent; String createComponent;
if (type.getAuthoringKit() != null){ if (type.getAuthoringKit() != null){
createComponent = type.getAuthoringKit().getCreateComponent(); createComponent = type.getAuthoringKit()
.getCreateComponent();
if (createComponent == null) { if (createComponent == null) {
createComponent = "n/a"; createComponent = "n/a";
} }
} else { } else {
createComponent = "n/a - This is not a creatable Content Type"; createComponent =
"n/a - This is not a creatable Content Type";
} }
t.setLabel(createComponent); t.setLabel(createComponent);
@ -328,7 +333,8 @@ public class KitPanel extends BoxPanel
ContentType type = m_type.getContentType(s); ContentType type = m_type.getContentType(s);
try { try {
AuthoringKit k = type.getAuthoringKit(); AuthoringKit k = type.getAuthoringKit();
// k may be null if it's a non-creatable content type; // k may be null if it's a non-creatable
// content type;
return k; return k;
} catch (DataObjectNotFoundException e) { } catch (DataObjectNotFoundException e) {
@ -357,7 +363,10 @@ public class KitPanel extends BoxPanel
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
if (currentStep == null) { if (currentStep == null) {
throw new IllegalArgumentException( (String) GlobalizationUtil.globalize("cms.ui.authoringkit.current_row_does_not_exists").localize()); throw new IllegalArgumentException( (String)
GlobalizationUtil.globalize(
"cms.ui.authoringkit.current_row_dont_exists")
.localize());
} }
switch (columnIndex) { switch (columnIndex) {
@ -372,7 +381,8 @@ public class KitPanel extends BoxPanel
return currentStep.getLabel(); return currentStep.getLabel();
} else if (currentStep.getLabelBundle() == null) { } else if (currentStep.getLabelBundle() == null) {
return new Label return new Label
(GlobalizationUtil.globalize(currentStep.getLabelKey())); (GlobalizationUtil
.globalize(currentStep.getLabelKey()));
} else { } else {
return new Label return new Label
(new GlobalizedMessage(currentStep.getLabelKey(), (new GlobalizedMessage(currentStep.getLabelKey(),
@ -396,14 +406,18 @@ public class KitPanel extends BoxPanel
case 5: case 5:
return "delete"; return "delete";
default: default:
throw new IllegalArgumentException("columnIndex exceeds " + throw new IllegalArgumentException(
"columnIndex exceeds " +
"number of columns available"); "number of columns available");
} }
} }
public Object getKeyAt(int columnIndex) { public Object getKeyAt(int columnIndex) {
if (currentStep == null) { if (currentStep == null) {
throw new IllegalArgumentException( (String) GlobalizationUtil.globalize("cms.ui.authoringkit.current_row_does_not_exists").localize()); throw new IllegalArgumentException( (String)
GlobalizationUtil.globalize(
"cms.ui.authoringkit.current_row_dont_exists")
.localize());
} else { } else {
return currentStep.getID(); return currentStep.getID();
} }

View File

@ -10,13 +10,19 @@
<xsl:template match="cms:imageDisplay"> <xsl:template match="cms:imageDisplay">
<table> <table>
<tr> <tr>
<td class="form_label" valign="top">Name:</td> <td class="form_label" valign="top">
<!-- Name: -->
<xsl:value-of select="@name_label"/>
</td>
<td class="form_value" valign="top"> <td class="form_value" valign="top">
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="form_label" valign="top">Image Type:</td> <td class="form_label" valign="top">
<!-- Image Type: -->
<xsl:value-of select="@mime_type_label"/>
</td>
<td class="form_value" valign="top"> <td class="form_value" valign="top">
<xsl:choose> <xsl:choose>
<xsl:when test="@mime_type"> <xsl:when test="@mime_type">
@ -29,7 +35,10 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="form_label" valign="top">Width:</td> <td class="form_label" valign="top">
<!-- Width: -->
<xsl:value-of select="@width_label"/>
</td>
<td class="form_value" valign="top"> <td class="form_value" valign="top">
<xsl:choose> <xsl:choose>
<xsl:when test="@width"> <xsl:when test="@width">
@ -42,7 +51,10 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="form_label" valign="top">Height:</td> <td class="form_label" valign="top">
<!-- Height: -->
<xsl:value-of select="@height_label"/>
</td>
<td class="form_value" valign="top"> <td class="form_value" valign="top">
<xsl:choose> <xsl:choose>
<xsl:when test="@height"> <xsl:when test="@height">

View File

@ -49,6 +49,7 @@ public class Element {
* owner document * owner document
*/ */
private org.w3c.dom.Document m_doc; private org.w3c.dom.Document m_doc;
private static ThreadLocal s_localDocument = new ThreadLocal() { private static ThreadLocal s_localDocument = new ThreadLocal() {
@Override @Override
public Object initialValue() { public Object initialValue() {
@ -59,7 +60,9 @@ public class Element {
return builder.newDocumentBuilder().newDocument(); return builder.newDocumentBuilder().newDocument();
} catch (ParserConfigurationException e) { } catch (ParserConfigurationException e) {
s_log.error(e); s_log.error(e);
throw new UncheckedWrapperException("INTERNAL: Could not create thread local DOM document.", e); throw new UncheckedWrapperException(
"INTERNAL: Could not create thread local DOM document.",
e);
} }
} }
@ -77,7 +80,9 @@ public class Element {
// return m_doc; // return m_doc;
// } // }
// public void importElement(final Element element) { // public void importElement(final Element element) {
// element.m_element = (org.w3c.dom.Element) this.m_element.getOwnerDocument().importNode(element.m_element, true); // element.m_element = (org.w3c.dom.Element) this.m_element
// .getOwnerDocument().importNode(element.m_element,
// true);
// } // }
public void syncDocs() { public void syncDocs() {