From: <pb...@fe...> - 2012-12-16 20:27:36
|
Author: pboy Date: 2012-12-16 20:27:20 +0000 (Sun, 16 Dec 2012) New Revision: 2392 Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources.properties releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java releases/2.0.0/ccm-core/src/com/arsdigita/categorization/Category.java releases/2.0.0/ccm-core/src/com/arsdigita/categorization/CategoryLocalizationCollection.java Log: UI enhancemnt: category localisation editible (backport r2390), added comments. (on behalf of quasimodo) Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources.properties =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 20:27:20 UTC (rev 2392) @@ -105,7 +105,7 @@ cms.contenttypes.ui.event_end_time=Event End Time: cms.contenttypes.ui.government_uid=Government UID: cms.contenttypes.ui.grade=Grade: -cms.contenttypes.ui.homepage=Homepage? +cms.contenttypes.ui.homepage=Homepage: cms.contenttypes.ui.job_description=Job Description: cms.contenttypes.ui.launch_date=Launch Date: cms.contenttypes.ui.lead=Description: Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 20:27:20 UTC (rev 2392) @@ -70,7 +70,7 @@ cms.contenttypes.shared.assign_categories.title=Kategorien zuweisen cms.contenttypes.shared.assign_categories.description=Kategorien zuweisen cms.contenttypes.shared.attach_files.title=Dateien zuordnen -cms.contenttypes.shared.attach_files.description=Dateien anh\u00c4ngen +cms.contenttypes.shared.attach_files.description=Dateien anh\u00e4ngen cms.contenttypes.shared.basic_properties.description=Basiseigenschaften editieren cms.contenttypes.shared.basic_properties.title=Basiseigenschaften cms.contenttypes.shared.body_text.title=Haupttext @@ -105,7 +105,7 @@ cms.contenttypes.ui.event_end_time=Event Ende um\: cms.contenttypes.ui.government_uid=Government UID: cms.contenttypes.ui.grade=Grad: -cms.contenttypes.ui.homepage=Homepage? +cms.contenttypes.ui.homepage=Homepage: cms.contenttypes.ui.job_description=Job Beschreibung: cms.contenttypes.ui.launch_date=Ver\u00f6ffentlichungsdatum: cms.contenttypes.ui.lead=Beschreibung (Lead Text): @@ -160,8 +160,8 @@ cms.installer.cannot_find_group_for_email=Kann email-Gruppe nicht finden cms.installer.cannot_read_line_of_data=Kann Datensatz nicht lesen cms.installer.cannot_set_template_text=Kann Template Text nicht festlegen -cms.installer.could_not_load_section=Kann die folgende ContentSection nicht laden '{0}' -cms.installer.deploy=anwenden +cms.installer.could_not_load_section=Kann die ContentSection '{0}' nicht laden +cms.installer.deploy=Anwenden cms.installer.failed_to_update_the_default_content_section=Update der Default Content Section gescheitert. cms.installer.formbuilder.form=Form cms.installer.formbuilder.form_section=Form Abschnitt @@ -187,7 +187,7 @@ cms.publishToFile.could_not_get_object_for_oid=Could not get object for oid cms.publishToFile.error_executing=Ausf\u00fchrungsfehler bei '{0}' \: cms.publishToFile.exit_value_was=Exit Code war -cms.publishToFile.interrupted_when_doing=Unterbrochen bei Ausf\u00fchren von '{0}' +cms.publishToFile.interrupted_when_doing=Unterbrochen beim Ausf\u00fchren von '{0}' cms.publishToFile.invalid_brokenlinkaction=Ung\u00fcltige BrokenLinkAction\: cms.publishToFile.invalid_reference_target_type=Ung\u00fcltige reference target type\: cms.publishToFile.malformed_url=Falsche Struktur der URL\: @@ -232,7 +232,7 @@ cms.ui.browse=Dokumente cms.ui.browse_items_by_category=Durchsicht der Elemente nach Kategorien cms.ui.cancel=Abbruch -cms.ui.cancel_hit=Abbruch dr\u00fccken +cms.ui.cancel_hit=Abbruch gedr\u00fcckt cms.ui.cancelled=abgebrochen cms.ui.cannot_assign_groups_to_owner=cannot assign groups to owner cms.ui.categories=Kategorien @@ -241,7 +241,7 @@ cms.ui.content_item=Dokument cms.ui.content_section=Content section cms.ui.content_section_configuration=<h2>Content Section Configuration</h2> -cms.ui.content_types=Dokument Typen +cms.ui.content_types=Dokumenttypen cms.ui.contents_of=Inhalt von cms.ui.create=Erstellen cms.ui.cse=Bald abgelaufen @@ -324,10 +324,10 @@ cms.ui.template=Vorlage cms.ui.Templates=Vorlagen cms.ui.the_model_is_empty=Das Modell ist leer -cms.ui.there_are_no_items=Keine elemente vorhanden. +cms.ui.there_are_no_items=Keine Elemente vorhanden. cms.ui.there_was_no_one_matching_the_search_criteria=Kein Element erf\u00fcllte die Suchkriterien. cms.ui.this_should_never_happen=Dies sollte nie passieren\! -cms.ui.types=Dokument Typen +cms.ui.types=Dokumenttypen cms.ui.unknown=unbekannt cms.ui.upload_new_content=Neuen Inhalt laden cms.ui.use_custom_permissions=Benutzerspezifische Rechte @@ -352,9 +352,9 @@ # Package com.arsdigita.cms.ui.authoring # ====================================== -cms.ui.authoring.an_item_with_this_name_already_exists=Ein Item mit diesem Namen existiert +cms.ui.authoring.an_item_with_this_name_already_exists=Ein Item mit diesem Namen existiert bereits cms.ui.authoring.bad_getblob_datatype=Ung\u00fcltiger Datentyp getBlob -cms.ui.authoring.bad_getclob_datatype=Ung\u00fcltiger Datentyp getBlob +cms.ui.authoring.bad_getclob_datatype=Ung\u00fcltiger Datentyp getClob cms.ui.authoring.body=Textbereich: cms.ui.authoring.caption=Untertitel: cms.ui.authoring.content_type=Inhaltstyp: @@ -457,7 +457,7 @@ cms.ui.category.localization_error_locale=Bitte w\u00e4hlen Sie eine Sprache aus cms.ui.category.localization_locale=Sprache cms.ui.category.localization_name=Name -cms.ui.category.localization_none=Diese Kaegorie hat keine Sprachversionen +cms.ui.category.localization_none=Diese Kategorie hat keine Sprachversionen cms.ui.category.localization_url=URL cms.ui.category.name_not_unique=Es gibt bereits eine Kategorie mit diesem Namen. cms.ui.category.no_categorized_objects=Es gibt keine kategorisierten Objekte @@ -489,8 +489,8 @@ cms.ui.cse.itemName=Name cms.ui.cse.view=Anzeigen cms.ui.cse.viewLink=anzeigen -cms.ui.cse.edit=Edit -cms.ui.cse.editLink=edit +cms.ui.cse.edit=Bearbeiten +cms.ui.cse.editLink=bearbeiten cms.ui.cse.endDateTime=aktiv bis @@ -498,7 +498,7 @@ # =================================== cms.ui.folder.cancelled=Abgebrochen cms.ui.folder.cannot_find_a_root_folder=Kein Wurzelverzeichnis gefunden. -cms.ui.folder.na=K.A. +cms.ui.folder.na=k.A. cms.ui.folder.no_source_items_specified=Kein Quelldokument angegeben. cms.ui.folder.parent=\u00dcbergeordneter Ordner cms.ui.folder.rename=Ordner umbenennen @@ -507,7 +507,7 @@ # ======================================== cms.ui.formbuilder.description=Beschreibung: cms.ui.formbuilder.name=Name: -cms.ui.formbuilder.oh_no_you_dont=Nicht, sie wollen nicht +cms.ui.formbuilder.oh_no_you_dont=Nein, das wollen sie nicht cms.ui.formbuilder.title=Titel\: Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 20:27:20 UTC (rev 2392) @@ -15,7 +15,7 @@ cms.contenttypes.ui.person.surname=Nachname cms.contenttypes.ui.person.givenname=Vorname cms.contenttypes.ui.person.titlepre=Titel -cms.contenttypes.ui.person.titlepost=Namesanhang +cms.contenttypes.ui.person.titlepost=Namensanhang cms.contenttypes.ui.person.birthdate=Geburtstag cms.contenttypes.ui.person.description=Beschreibung Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -509,7 +509,7 @@ return ContentSection.getConfig().getUseStreamlinedCreation() && STREAMLINED_CREATION_ACTIVE.equals(state.getRequest(). getParameter(STREAMLINED_CREATION)); - } + } protected TabbedPane getTabbedPane() { return m_tabbedPane; Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -34,7 +34,6 @@ import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.Service; -import com.arsdigita.cms.ui.ImageComponent; import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.mimetypes.MimeType; @@ -62,6 +61,7 @@ * </code></pre></blockquote> * * @author Stanislav Freidin + * @author Sören Bernstein (quasimodo) <sbe...@qu...> * @version $Id$ */ public class ImageBrowser extends Table { @@ -80,7 +80,7 @@ private static final Logger s_log = Logger.getLogger(ImageBrowser.class); /** - * Construct a new ImageBrowser + * Construct a new ImageBrowser with default mode. * * @param builder the {@link ImageBrowserModelBuilder} that will supply this * component with its {@link ImageBrowserModel} during each request @@ -90,6 +90,13 @@ this(b, ImageComponent.ATTACH_IMAGE); } + /** + * Construct a new ImageBrowser with requested mode. + * + * @param builder the {@link ImageBrowserModelBuilder} that will supply this + * component with its {@link ImageBrowserModel} during each request + * @param mode the component mode (see {@link ImageComponent}) + */ public ImageBrowser(ImageBrowserModelBuilder b, int mode) { super(new BuilderAdapter(b), HEADERS); m_mode = mode; Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -1,6 +1,5 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * */ package com.arsdigita.cms.ui; @@ -11,11 +10,18 @@ import com.arsdigita.cms.ReusableImageAsset; /** - * + * Interface for ImageCompnents. + * + * All components for image handling (like {@link ImageLibraryComponent} or + * {@link ImageUploadComponent}) should implement this interface. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public interface ImageComponent { + /** + * The modes + */ public static final int DISPLAY_ONLY = 0; public static final int SELECT_IMAGE = 1; public static final int ATTACH_IMAGE = 2; Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -18,7 +18,13 @@ import org.apache.log4j.Logger; /** - * + * An abstract listener for {@link ImageComponent}. + * + * This listener provides the base implementation which is shared between all + * listeners of this kind. + * + * This listerner is used by {@link ImageSelectPage}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener { @@ -39,6 +45,13 @@ } } + /** + * Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button + * was pressed. + * + * @param event the {@link FormSectionEvent} + * @throws FormProcessException + */ public void submitted(FormSectionEvent event) throws FormProcessException { PageState ps = event.getPageState(); ImageComponent component = getImageComponent(ps); @@ -48,6 +61,13 @@ } } + /** + * 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. + * + * @param event the {@link FormSectionEvent} + * @throws FormProcessException + */ public void process(FormSectionEvent event) throws FormProcessException { PageState ps = event.getPageState(); ImageComponent component = getImageComponent(ps); @@ -62,8 +82,21 @@ } + /** + * To be overridden by child if neccessary. + * + * @param ps + */ protected void cancelled(PageState ps) {}; + /** + * Process the input. + * + * @param event the {@link FormSectionEvent} + * @param ps {@link PageState} + * @param component an {@link ImageComponent} + * @param image the {@link ReusableImageAsset} + */ protected abstract void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image); protected ImageComponent getImageComponent(PageState ps) { @@ -80,6 +113,12 @@ } + /** + * Sets the active component + * + * @param ps Page state + * @param activeKey the key of the active component + */ protected void setImageComponent(PageState ps, final String activeKey) { if (s_log.isDebugEnabled()) { Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -13,7 +13,10 @@ import com.arsdigita.toolbox.ui.ComponentMap; /** - * + * A listener to administer images. + * + * This listerner is used by {@link ImagesPane}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener { Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -4,7 +4,6 @@ */ package com.arsdigita.cms.ui; -import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.MapComponentSelectionModel; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormSectionEvent; @@ -12,15 +11,18 @@ import org.apache.log4j.Logger; /** - * + * A listener to select an image and save it for later use. + * + * This listerner is used by {@link ImageSelectPage}. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageComponentSelectListener extends ImageComponentAbstractListener { private static final Logger S_LOG = Logger.getLogger(ImageComponentSelectListener.class); - private final ImageSelectResultPane m_resultPane; + private final ImageSelectResultComponent m_resultPane; - public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultPane resultPane) { + public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultComponent resultPane) { super(imageComponent); m_resultPane = resultPane; } Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -25,7 +25,13 @@ import java.math.BigDecimal; /** + * An image library component. * + * This component can be used in different places to add an image library + * in a convinient way. This class uses a listener class which should be extended + * from {@link ImageComponentAbstractListener}. + * + * @author unknown * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable { @@ -67,7 +73,7 @@ try { final ReusableImageAsset image = new ReusableImageAsset(imageID); if(m_mode == ImageComponent.SELECT_IMAGE) { - parent.getResultPane().setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight()); + parent.getResultComponent().setResult(image); } m_imageModel.setSelectedObject(state, image); } catch (DataObjectNotFoundException ex) { @@ -164,6 +170,11 @@ return m_saveCancel; } + /** + * Add a link to an {@link ImageUploadComponent} + * + * @param actionListener + */ public void addUploadLink(final ActionListener actionListener) { // Add action link to image upload component if (m_mode != ImageComponent.DISPLAY_ONLY) { @@ -173,7 +184,9 @@ } } - // Reset this component + /** + * Reset this component. + */ public void reset(final PageState state) { // clear selection m_imageModel.clearSelection(state); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -21,7 +21,11 @@ import org.apache.log4j.Logger; /** - * + * A {@link CMSPage} to select and upload images. + * + * This page is used by /web/templates/ccm-cms/content-section/admin/image_select.jsp + * which is used by the OpenCCM plugin for Xihna editor. + * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageSelectPage extends CMSPage { @@ -32,7 +36,7 @@ private TabbedPane m_tabbedPane; private ImageLibraryComponent m_imageLibrary; private ImageUploadComponent m_imageUpload; - private ImageSelectResultPane m_resultPane; + private ImageSelectResultComponent m_result; private BigDecimalParameter m_sectionId; private final StringParameter m_imageComponentKey; private final MapComponentSelectionModel m_imageComponent; @@ -56,7 +60,7 @@ m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap()); - m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultPane()); + m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultComponent()); m_tabbedPane = createTabbedPane(); m_tabbedPane.setIdAttr("page-body"); @@ -77,11 +81,16 @@ } }); - add(m_resultPane); + add(m_result); addGlobalStateParam(m_imageComponentKey); } + /** + * Create the image library pane + * + * @return m_imageLibrary + */ protected ImageLibraryComponent getImageLibraryPane() { if (m_imageLibrary == null) { m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this); @@ -92,6 +101,11 @@ return m_imageLibrary; } + /** + * Create the image upload pane + * + * @return m_imageUpload + */ protected ImageUploadComponent getImageUploadPane() { if (m_imageUpload == null) { @@ -103,13 +117,21 @@ return m_imageUpload; } - protected ImageSelectResultPane getResultPane() { - if (m_resultPane == null) { - m_resultPane = new ImageSelectResultPane(); + /** + * Creates an {@link ImageSelectResultComponent} + * + * @return m_resultPane + */ + protected ImageSelectResultComponent getResultComponent() { + if (m_result == null) { + m_result = new ImageSelectResultComponent(); } - return m_resultPane; + return m_result; } + /** + * Create the tabbed pane + */ protected TabbedPane createTabbedPane() { TabbedPane pane = new TabbedPane(); pane.setClassAttr(XSL_CLASS); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -21,7 +21,13 @@ import java.io.IOException; /** + * An image upload component. * + * This component can be used in different places to add image upload capabilities + * in a convinient way. This class uses a listener class which should be extended + * from {@link ImageComponentAbstractListener}. + * + * @author unknown * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ public class ImageUploadComponent extends Form implements ImageComponent { @@ -34,10 +40,18 @@ private final SaveCancelSection m_saveCancel; private int m_mode; + /** + * Creates an ImageUploadComponent in attach mode. + */ public ImageUploadComponent() { this(ImageComponent.ATTACH_IMAGE); } + /** + * Creates an ImageUploadComponent with the selected mode. + * + * @param mode The operation mode (see {@link ImageComponent) + */ public ImageUploadComponent(int mode) { super("imageUploadComponent", new ColumnPanel(2)); m_mode = mode; Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -34,7 +34,7 @@ import org.apache.log4j.Logger; /** - * A LayoutPanel to insert into ContentSectionPage or ImageSelectPage + * A {@link LayoutPanel} to insert into {@link ContentSectionPage}. * * @author Sören Bernstein (quasimodo) <sbe...@ze...> */ @@ -77,6 +77,7 @@ final Map selectors = m_imageComponent.getComponentsMap(); m_adminListener = new ImageComponentAdminListener(m_imageComponent, this); + // Image library component final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES); library.getForm().addInitListener(m_adminListener); library.getForm().addProcessListener(m_adminListener); @@ -86,6 +87,7 @@ new Label(GlobalizationUtil.globalize("cms.ui.image_library")), library)); + // Image upload component final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES); upload.getForm().addInitListener(m_adminListener); upload.getForm().addSubmissionListener(m_adminListener); @@ -126,6 +128,11 @@ page.addComponentStateParam(this, m_imageComponentKey); } + /** + * Resets this pane and all its resettable components. + * + * @param state Page state + */ @Override public final void reset(final PageState state) { super.reset(state); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -22,9 +22,12 @@ import com.arsdigita.bebop.BaseLink; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Form; +import com.arsdigita.bebop.FormModel; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Link; +import com.arsdigita.bebop.Page; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.ParameterSingleSelectionModel; import com.arsdigita.bebop.SimpleContainer; import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.event.ActionEvent; @@ -32,6 +35,7 @@ import com.arsdigita.bebop.event.ChangeEvent; import com.arsdigita.bebop.event.ChangeListener; import com.arsdigita.bebop.form.Submit; +import com.arsdigita.bebop.parameters.StringParameter; import com.arsdigita.categorization.CategorizedCollection; import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryCollection; @@ -75,40 +79,35 @@ * @version $Id$ */ class CategoryItemPane extends BaseItemPane { - - private static final Logger s_log = Logger.getLogger - (CategoryItemPane.class); - + + private static final Logger s_log = Logger.getLogger(CategoryItemPane.class); private final SingleSelectionModel m_model; private final CategoryRequestLocal m_category; - private final SimpleContainer m_detailPane; public CategoryItemPane(final SingleSelectionModel model, - final CategoryRequestLocal category, - final ActionLink addLink, - final ActionLink editLink, - final ActionLink deleteLink) { + final CategoryRequestLocal category, + final ActionLink addLink, + final ActionLink editLink, + final ActionLink deleteLink) { m_model = model; m_category = category; // Details - m_detailPane = new SimpleContainer(); add(m_detailPane); setDefault(m_detailPane); final ActionLink orderItemsLink = new ActionLink(new Label( - gz("cms.ui.category.categorized_objects"))) { + gz("cms.ui.category.categorized_objects"))) { @Override public boolean isVisible(PageState state) { // update for live items only if (!super.isVisible(state)) { return false; } - CategorizedCollection items = m_category.getCategory - (state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE); - items.addEqualsFilter(ContentItem.VERSION,ContentItem.LIVE); + CategorizedCollection items = m_category.getCategory(state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE); + items.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE); boolean canOrder = items.size() > 1; items.close(); return canOrder; @@ -123,55 +122,54 @@ // Change index item final ActionLink indexLink = new ActionLink(new Label(gz( - "cms.ui.category.change_index_item"))); + "cms.ui.category.change_index_item"))); final Form indexForm = new IndexItemSelectionForm(m_category); add(indexForm); ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz( - "cms.ui.category.view_index_item")),""); + "cms.ui.category.view_index_item")), ""); EditItemLink editIndexLink = new EditItemLink(new Label(gz( - "cms.ui.category.edit_index_item")),""); + "cms.ui.category.edit_index_item")), ""); // Summary m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink, - viewIndexLink, editIndexLink, orderItemsLink)); - + viewIndexLink, editIndexLink, orderItemsLink)); + // Quasimodo: BEGIN // Localizations ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz( - "cms.ui.category.localization_add"))) { + "cms.ui.category.localization_add"))) { @Override public boolean isVisible(PageState state) { // Only show addLanguage button, if there are langauges to add - int countSupportedLanguages = ( - Kernel.getConfig()).getSupportedLanguagesTokenizer() - .countTokens(); - long countLanguages = + int countSupportedLanguages = (Kernel.getConfig()).getSupportedLanguagesTokenizer() + .countTokens(); + long countLanguages = m_category.getCategory(state) - .getCategoryLocalizationCollection().size(); - - if(countLanguages < countSupportedLanguages) { + .getCategoryLocalizationCollection().size(); + + if (m_category.getCategory(state).canEdit() + && countLanguages < countSupportedLanguages) { return true; } else { return false; } } }; - + CategoryLocalizationAddForm addCategoryLocalizationForm = - new CategoryLocalizationAddForm(m_category); + new CategoryLocalizationAddForm(m_category); m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink)); add(addCategoryLocalizationForm); connect(addCategoryLocalizationLink, addCategoryLocalizationForm); connect(addCategoryLocalizationForm); // Quasimodo: END - + // Subcategories m_detailPane.add(new SubcategorySection(addLink)); // Linked categories - final ActionLink linkAddLink = new ActionLink - (new Label(gz("cms.ui.category.linked_add"))); + final ActionLink linkAddLink = new ActionLink(new Label(gz("cms.ui.category.linked_add"))); final Form linkForm = new LinkForm(m_category); add(linkForm); @@ -196,6 +194,7 @@ } private class EditVisible extends VisibilityComponent { + EditVisible(final Component child) { super(child, null); } @@ -207,6 +206,7 @@ } private class AdminVisible extends VisibilityComponent { + AdminVisible(final Component child) { super(child, null); } @@ -220,9 +220,9 @@ private class SummarySection extends Section { SummarySection(final ActionLink editLink, - final ActionLink deleteLink, - final ActionLink indexLink, - final ActionLink orderItemsLink) { + final ActionLink deleteLink, + final ActionLink indexLink, + final ActionLink orderItemsLink) { setHeading(new Label(gz("cms.ui.category.details"))); final ActionGroup group = new ActionGroup(); @@ -241,11 +241,11 @@ * the user to view and edit the content index item. */ SummarySection(final ActionLink editLink, - final ActionLink deleteLink, - final ActionLink indexLink, - final BaseLink viewIndexItem, - final BaseLink editIndexItem, - final ActionLink orderItemsLink) { + final ActionLink deleteLink, + final ActionLink indexLink, + final BaseLink viewIndexItem, + final BaseLink editIndexItem, + final ActionLink orderItemsLink) { setHeading(new Label(gz("cms.ui.category.details"))); final ActionGroup group = new ActionGroup(); @@ -262,6 +262,7 @@ } private class Properties extends PropertyList { + @Override protected final java.util.List properties(final PageState state) { final java.util.List props = super.properties(state); @@ -272,20 +273,19 @@ if (item != null) { itemTitle = item.getDisplayName(); - } else if (!category.ignoreParentIndexItem() - && category.getParentCategoryCount() > 0) - { - Category ancestor = findParentCategoryWithNonInheritedIndexItem(category); - if (ancestor != null) { - if (ancestor.getIndexObject() != null) { - itemTitle = ancestor.getIndexObject().getDisplayName(); - } - itemTitle += " (Inherited from " - + ancestor.getDisplayName() + ")"; - } else { - // The complete hierarchy is set to inherit. - // Just leave the itemTitle as None. - } + } else if (!category.ignoreParentIndexItem() + && category.getParentCategoryCount() > 0) { + Category ancestor = findParentCategoryWithNonInheritedIndexItem(category); + if (ancestor != null) { + if (ancestor.getIndexObject() != null) { + itemTitle = ancestor.getIndexObject().getDisplayName(); + } + itemTitle += " (Inherited from " + + ancestor.getDisplayName() + ")"; + } else { + // The complete hierarchy is set to inherit. + // Just leave the itemTitle as None. + } } props.add(new Property(gz("cms.ui.name"), @@ -295,57 +295,77 @@ props.add(new Property(gz("cms.ui.category.url"), category.getURL(""))); props.add(new Property(gz("cms.ui.category.is_not_abstract"), - category.isAbstract() ? - gz("cms.ui.no") : - gz("cms.ui.yes"))); + category.isAbstract() + ? gz("cms.ui.no") + : gz("cms.ui.yes"))); props.add(new Property(gz("cms.ui.category.is_enabled"), - category.isEnabled("") ? - gz("cms.ui.yes") : - gz("cms.ui.no"))); + category.isEnabled("") + ? gz("cms.ui.yes") + : gz("cms.ui.no"))); props.add(new Property(gz("cms.ui.category.index_item"), - itemTitle)); + itemTitle)); return props; } } } - + // Loop over the parents and recurse up the hierarchy the find the first // parent with an explicit index item ignoreParentIndexItem is true. private Category findParentCategoryWithNonInheritedIndexItem(Category c) { - if (c.getParentCategoryCount() == 0) { - return null; - } - CategoryCollection parents = c.getParents(); - while (parents.next()) { - Category p = parents.getCategory(); - if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) { - return p; - } - // Try the parents of this parent. - Category gp = findParentCategoryWithNonInheritedIndexItem(p); - if (gp != null) { - return gp; - } - } - return null; + if (c.getParentCategoryCount() == 0) { + return null; + } + CategoryCollection parents = c.getParents(); + while (parents.next()) { + Category p = parents.getCategory(); + if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) { + return p; + } + // Try the parents of this parent. + Category gp = findParentCategoryWithNonInheritedIndexItem(p); + if (gp != null) { + return gp; + } + } + return null; } - + // Quasimodo: BEGIN // CategoryLocalizationSection private class CategoryLocalizationSection extends Section { + + private CategoryLocalizationTable m_catLocalizationTable; + private CategoryLocalizationEditForm m_editCategoryLocalizationForm; + private StringParameter m_catLocaleParam; + private ParameterSingleSelectionModel m_catLocale; + CategoryLocalizationSection(ActionLink addLink) { setHeading(new Label(gz("cms.ui.category.localizations"))); - + m_catLocaleParam = new StringParameter("catLocale"); + m_catLocale = new ParameterSingleSelectionModel(m_catLocaleParam); + final ActionGroup group = new ActionGroup(); setBody(group); - - group.setSubject(new CategoryLocalizationTable(m_category, m_model)); + m_catLocalizationTable = new CategoryLocalizationTable(m_category, m_model, m_catLocale); + group.setSubject(m_catLocalizationTable); group.addAction(new AdminVisible(addLink), ActionGroup.ADD); + + m_editCategoryLocalizationForm = new CategoryLocalizationEditForm(m_category, m_catLocale); + add(m_editCategoryLocalizationForm); + connect(m_editCategoryLocalizationForm); + connect(m_catLocalizationTable, 0, m_editCategoryLocalizationForm); } + + @Override + public void register(Page page) { + super.register(page); + page.addComponentStateParam(m_editCategoryLocalizationForm, m_catLocaleParam); + } } private class SubcategorySection extends Section { + SubcategorySection(final ActionLink addLink) { setHeading(new Label(gz("cms.ui.category.subcategories"))); @@ -358,6 +378,7 @@ } private class LinkedCategorySection extends Section { + LinkedCategorySection(final ActionLink linkAddLink) { setHeading(new Label(gz("cms.ui.category.linked"))); @@ -375,6 +396,7 @@ } private class CategoryTemplateSection extends Section { + CategoryTemplateSection() { setHeading(new Label(gz("cms.ui.category.templates"))); @@ -388,6 +410,7 @@ } private class PermissionsSection extends Section { + @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -400,7 +423,7 @@ final ActionGroup group = new ActionGroup(); setBody(group); - PrivilegeDescriptor[] privs = new PrivilegeDescriptor[] { + PrivilegeDescriptor[] privs = new PrivilegeDescriptor[]{ PrivilegeDescriptor.EDIT, Category.MAP_DESCRIPTOR, PrivilegeDescriptor.DELETE, @@ -413,8 +436,7 @@ privMap.put(Category.MAP_DESCRIPTOR.getName(), "Categorize Items"); privMap.put("admin", "Admin"); - final CMSPermissionsPane permPane = new CMSPermissionsPane - (privs, privMap, new ACSObjectSelectionModel(m_model)) { + final CMSPermissionsPane permPane = new CMSPermissionsPane(privs, privMap, new ACSObjectSelectionModel(m_model)) { @Override public void showAdmin(PageState ps) { Assert.exists(m_model.getSelectedKey(ps)); @@ -425,7 +447,7 @@ }; final ActionLink restoreDefault = new ActionLink(new Label(gz( - "cms.ui.restore_default_permissions"))) { + "cms.ui.restore_default_permissions"))) { @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -434,7 +456,7 @@ }; final ActionLink useCustom = new ActionLink(new Label(gz( - "cms.ui.use_custom_permissions"))) { + "cms.ui.use_custom_permissions"))) { @Override public boolean isVisible(PageState ps) { Category cat = m_category.getCategory(ps); @@ -460,18 +482,18 @@ parent = cat.getDefaultParentCategory(); } catch (CategoryNotFoundException ce) { throw new IllegalStateException( - "link shouldn't exist for root categories"); + "link shouldn't exist for root categories"); } PermissionService.setContext(cat, parent); // revoke all direct permissions so category will only // have inherited permissions ObjectPermissionCollection perms = - PermissionService.getDirectGrantedPermissions( + PermissionService.getDirectGrantedPermissions( cat.getOID()); while (perms.next()) { PermissionService.revokePermission( - new PermissionDescriptor( + new PermissionDescriptor( perms.getPrivilege(), cat.getOID(), perms.getGranteeOID())); } @@ -510,26 +532,26 @@ add(new Submit("Done")); } - } /* * This private class creates a link to the index item for a category. */ private class ViewItemLink extends Link { + ViewItemLink(Component c, String s) { - super(c,s); + super(c, s); } - // Build the preview link. This uses a standard redirect link to find + // Build the preview link. This uses a standard redirect link to find // the content. The prepareURL method is called by the printwriter @Override protected String prepareURL(final PageState state, String location) { - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) - .getDirectIndexObject())) - .getPrimaryInstance(); - if(indexItem==null) { + ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); + if (indexItem == null) { return ""; } else { return "/redirect/?oid=" + URLEncoder.encode(indexItem.getOID().toString()); @@ -543,7 +565,7 @@ return false; } ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject(); - if(indexItem==null) { + if (indexItem == null) { return false; } else { return true; @@ -552,37 +574,40 @@ }; private class EditItemLink extends Link { + EditItemLink(Component c, String s) { - super(c,s); + super(c, s); } /** - * Build the preview link. This is based on code in the - * ContentSoonExpiredPane class. The prepareURL method of the parent - * is overwritten. This method is called by the printwriter + * Build the preview link. This is based on code in the + * ContentSoonExpiredPane class. The prepareURL method of the parent is + * overwritten. This method is called by the printwriter */ @Override protected String prepareURL(final PageState state, String location) { boolean canEdit = false; - ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state) - .getDirectIndexObject())) - .getPrimaryInstance(); - if(indexItem==null) { + ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state) + .getDirectIndexObject())) + .getPrimaryInstance(); + if (indexItem == null) { return ""; } - if (!isItemEditable(indexItem,state)) { + if (!isItemEditable(indexItem, state)) { return ""; } else { BigDecimal draftID = indexItem.getDraftVersion().getID(); - return "item.jsp?item_id=" + draftID + "&set_tab=" + - ContentItemPage.AUTHORING_TAB; + return "item.jsp?item_id=" + draftID + "&set_tab=" + + ContentItemPage.AUTHORING_TAB; } } /** * We only show this link when an index item exists for this category * and the user is allowed to edit this item. + * * @param state + * * @return */ @Override @@ -591,32 +616,33 @@ return false; } ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject(); - if(indexItem==null) { + if (indexItem == null) { return false; } else { - return isItemEditable((ContentItem)indexItem,state); + return isItemEditable((ContentItem) indexItem, state); } } /** - * This method checks whether a usern is allowed to edit a - * particular item. + * This method checks whether a usern is allowed to edit a particular + * item. * * @param item * @param state + * * @return */ private boolean isItemEditable(ContentItem item, PageState state) { BigDecimal id = item.getID(); User user = Web.getContext().getUser(); ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(), - Integer.parseInt(id.toString()))); + Integer.parseInt(id.toString()))); Iterator permissions = PermissionService.getImpliedPrivileges( - ci.getOID(), user.getOID()); + ci.getOID(), user.getOID()); while (permissions.hasNext()) { - PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next(); - if (permission.equals(PrivilegeDescriptor.ADMIN) || - permission.equals(PrivilegeDescriptor.EDIT)) { + PrivilegeDescriptor permission = (PrivilegeDescriptor) permissions.next(); + if (permission.equals(PrivilegeDescriptor.ADMIN) + || permission.equals(PrivilegeDescriptor.EDIT)) { return true; } } Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationEditForm.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -20,6 +20,7 @@ import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; @@ -37,30 +38,27 @@ * in order to present forms for managing the multi-language categories. * * @author Sören Bernstein (quasimodo) qu...@ze... - * @version $Id: CategoryLocalizationEditForm.java $ + * @version $Id: CategoryLocalizationEditForm.java $ */ public class CategoryLocalizationEditForm extends CategoryLocalizationForm { - + private static final Logger s_log = Logger.getLogger (CategoryLocalizationEditForm.class); - - private final String m_categoryLocalizationLocale; - + + private final SingleSelectionModel m_catLocale; /** * Creates a new instance of CategoryLocalizationEditForm */ - public CategoryLocalizationEditForm(final CategoryRequestLocal category, - final String locale) { - + public CategoryLocalizationEditForm(final CategoryRequestLocal category, SingleSelectionModel catLocale) { + super("EditCategoryLocalization", gz( "cms.ui.category.localization_edit"), category); - - // Speichere Locale ab - m_categoryLocalizationLocale = locale; - + + m_catLocale = catLocale; + addInitListener(new InitListener()); addProcessListener(new ProcessListener()); - + } /** @@ -69,45 +67,46 @@ private class InitListener implements FormInitListener { public final void init(final FormSectionEvent e) throws FormProcessException { - + final PageState state = e.getPageState(); final Category category = m_category.getCategory(state); + final String categoryLocalizationLocale = (String) m_catLocale.getSelectedKey(state); + // Hide Locale-Widget and lock it (read-only) - m_locale.addOption(new Option(m_categoryLocalizationLocale, - new Locale(m_categoryLocalizationLocale).getDisplayLanguage()), state); -// m_locale.setValue(state, m_categoryLocalizationLocale); + m_locale.addOption(new Option(categoryLocalizationLocale, + new Locale(categoryLocalizationLocale).getDisplayLanguage()), state); + m_locale.setValue(state, categoryLocalizationLocale); // m_locale.setVisible(state, false); m_locale.lock(); - - m_name.setValue(state, category.getName((String) m_locale.getValue(state))); - m_description.setValue(state, category.getDescription( - (String) m_locale.getValue(state))); - m_url.setValue(state, category.getURL((String) m_locale.getValue(state))); - if (category.isEnabled((String) m_locale.getValue(state))) { + m_name.setValue(state, category.getName(categoryLocalizationLocale)); + m_description.setValue(state, category.getDescription(categoryLocalizationLocale)); + m_url.setValue(state, category.getURL(categoryLocalizationLocale)); + + if (category.isEnabled(categoryLocalizationLocale)) { m_isEnabled.setValue(state, "yes"); } else { m_isEnabled.setValue(state, "no"); } } } - + /** * ##todo: document purpose of this */ private class ProcessListener implements FormProcessListener { public final void process(final FormSectionEvent e) throws FormProcessException { - + final PageState state = e.getPageState(); final Category category = m_category.getCategory(state); - + if (s_log.isDebugEnabled()) { s_log.debug("Editing localization for locale " + m_locale + " for category " + category); } - + if (category.canEdit()) { category.setName((String) m_name.getValue(state), (String) m_locale.getValue(state)); Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java =================================================================== --- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 20:22:48 UTC (rev 2391) +++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 20:27:20 UTC (rev 2392) @@ -21,7 +21,6 @@ import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; -import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.SingleSelectionModel; import com.arsdigita.bebop.Table; @@ -35,13 +34,7 @@ import com.arsdigita.categorization.Category; import com.arsdigita.categorization.CategoryLocalization; import com.arsdigita.categorization.CategoryLocalizationCollection; -import com.arsdigita.cms.CMS; -import com.arsdigita.cms.ContentSection; -import com.arsdigita.cms.SecurityManager; -import com.arsdigita.cms.dispatcher.ItemResolver; -import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.util.GlobalizationUtil; -import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import java.util.Locale; @@ -49,8 +42,8 @@ /** * Lists all existing localizations for a selected category. * - * This class is part of the admin GUI of CCM and extends the standard form - * in order to present forms for managing the multi-language categories. + * This class is part of the admin GUI of CCM and extends the standard form in + * order to present forms for managing the multi-language categories. * * @author Sören Bernstein (quasimodo) qu...@ze... */ @@ -60,17 +53,18 @@ private final SingleSelectionModel m_model; private final String TABLE_COL_LANG = "table_col_lang"; private final String TABLE_COL_DEL = "table_col_del"; + private final SingleSelectionModel m_catLocale; /** * Creates a new instance of CategoryLocalizationTable */ - public CategoryLocalizationTable(final CategoryRequestLocal category, - final SingleSelectionModel model) { + public CategoryLocalizationTable(final CategoryRequestLocal category, final SingleSelectionModel model, SingleSelectionModel catLocale) { super(); m_category = category; m_model = model; + m_catLocale = catLocale; // if table is empty: setEmptyView(new Label(GlobalizationUtil.globalize( @@ -139,7 +133,7 @@ /** * Check collection for the existence of another row. - * + * * If exists, fetch the value of current CategoryLocalization object * into m_categoryLocalization class variable. */ @@ -158,6 +152,7 @@ /** * Return the + * * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) */ public Object getElementAt(int columnIndex) { @@ -194,25 +189,15 @@ private class EditCellRenderer extends LockableImpl implements TableCellRenderer { public Component getComponent(Table table, PageState state, Object value, - boolean isSelected, Object key, + boolean isSelected, final Object key, int row, int column) { -// -// if (canEdit) { -// CategoryLocalization cl; -// -// try { -// cl = new CategoryLocalization((BigDecimal) key); -// } catch (DataObjectNotFoundException ex) { -// return new Label(value.toString()); -// } -// -// ContentSection section = CMS.getContext().getContentSection(); -// ItemResolver resolver = section.getItemResolver(); -// -// return new Link(value.toString(), resolver.generateItemURL(state, cl, section, cl.getVersion())); - ControlLink link = new ControlLink(value.toString()); - return link; + + if (m_category.getCategory(state).canEdit()) { + return new ControlLink(value.toString()); + } else { + return new Label(value.toString()); + } } } @@ -222,17 +207,21 @@ boolean isSelected, Object key, int row, int column) { - ControlLink link = new ControlLink(value.toString()); - link.setConfirmation((String) GlobalizationUtil.globalize( - "cms.ui.category.localization_confirm_delete").localize()); - return link; + if (m_category.getCategory(state).canDelete()) { + ControlLink link = new ControlLink(value.toString()); + link.setConfirmation((String) GlobalizationUtil.globalize( + "cms.ui.category.localization_confirm_delete").localize()); + return link; + } else { + return null; + } } } /** - * Provide implementation to TableActionListener method. - * Code that comes into picture when a link on the table is clicked. - * Handles edit and delete event. + * Provide implementation to TableActionListener method. Code that comes + * into picture when a link on the table is clicked. Handles edit and delete + * event. */ public void cellSelected(TableActionEvent evt) { @@ -250,6 +239,7 @@ // Edit ... [truncated message content] |