Erste Verbesserungen der Lokalisierung ImageStep.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2243 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-07-03 15:17:29 +00:00
parent c9dbcddbd9
commit 5ccdb3bab5
18 changed files with 216 additions and 66 deletions

View File

@ -1,2 +1,4 @@
com.arsdigita.cms.contentassets.image_step_label=Add Images com.arsdigita.cms.contentassets.image_step_label=Add Images
com.arsdigita.cms.contentassets.image_step_description=Add Images com.arsdigita.cms.contentassets.image_step_description=Add Images
cms.contentassets.ui.image_step.add_image=Add Image
cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images.

View File

@ -1,2 +1,4 @@
com.arsdigita.cms.contentassets.image_step_label=Bild hinzuf\u00FCgen com.arsdigita.cms.contentassets.image_step_label=Bild hinzuf\u00fcgen
com.arsdigita.cms.contentassets.image_step_description=Bild hinzuf\u00FCgen com.arsdigita.cms.contentassets.image_step_description=Bild hinzuf\u00fcgen
cms.contentassets.ui.image_step.add_image=Bild hinzuf\u00fcgen
cms.contentassets.ui.image_step.no_image_attached=Diesem Dokument ist noch kein Bild zugeordnet.

View File

@ -1,2 +1,4 @@
com.arsdigita.cms.contentassets.image_step_label=Add Images com.arsdigita.cms.contentassets.image_step_label=Add Images
com.arsdigita.cms.contentassets.image_step_description=Add Images com.arsdigita.cms.contentassets.image_step_description=Add Images
cms.contentassets.ui.image_step.add_image=Add Image
cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images.

View File

@ -36,8 +36,9 @@ import com.arsdigita.xml.Element;
* <code>DataCollectionDefinition</code>. * <code>DataCollectionDefinition</code>.
*/ */
public class ImagePropertyRenderer implements DataCollectionPropertyRenderer { public class ImagePropertyRenderer implements DataCollectionPropertyRenderer {
public static final String XML_NS = public static final String XML_NS =
"http://ccm.redhat.com/london/image_attachments"; "http://ccm.redhat.com/london/image_attachments";
/** /**
* Called from DataCollectionRenderer for every returned item. This method * Called from DataCollectionRenderer for every returned item. This method

View File

@ -42,12 +42,24 @@ public class ImageComponentAttachListener extends ImageComponentAbstractListener
private static final Logger s_log = Logger.getLogger( private static final Logger s_log = Logger.getLogger(
ImageComponentAttachListener.class); ImageComponentAttachListener.class);
/**
* Constructor.
* @param imageComponent
* @param imageStep
*/
public ImageComponentAttachListener(MapComponentSelectionModel imageComponent, public ImageComponentAttachListener(MapComponentSelectionModel imageComponent,
ImageStep imageStep) { ImageStep imageStep) {
super(imageComponent); super(imageComponent);
m_imageStep = imageStep; m_imageStep = imageStep;
} }
/**
*
* @param event
* @param ps
* @param component
* @param image
*/
@Override @Override
protected void processImage(FormSectionEvent event, protected void processImage(FormSectionEvent event,
PageState ps, PageState ps,

View File

@ -28,6 +28,7 @@ import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contentassets.ItemImageAttachment; import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil;
import com.arsdigita.cms.ui.ImageComponent; import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.cms.ui.SecurityPropertyEditor; import com.arsdigita.cms.ui.SecurityPropertyEditor;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
@ -45,6 +46,7 @@ import org.apache.log4j.Logger;
* @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de> * @author Sören Bernstein (quasimodo) <sbernstein@quasiweb.de>
*/ */
public class ImageStep extends SecurityPropertyEditor { public class ImageStep extends SecurityPropertyEditor {
private static final Logger s_log = Logger.getLogger(ImageStep.class); private static final Logger s_log = Logger.getLogger(ImageStep.class);
private final ItemSelectionModel m_itemSelection; private final ItemSelectionModel m_itemSelection;
@ -70,7 +72,10 @@ public class ImageStep extends SecurityPropertyEditor {
m_add = new ImageStepEdit( this ); m_add = new ImageStepEdit( this );
WorkflowLockedComponentAccess addCA = WorkflowLockedComponentAccess addCA =
new WorkflowLockedComponentAccess( m_add, m_itemSelection ); new WorkflowLockedComponentAccess( m_add, m_itemSelection );
addComponent( "add", "Add Image", addCA ); addComponent( "add",
ImageStepGlobalizationUtil.globalize(
"cms.contentassets.ui.image_step.add_image"),
addCA );
m_display = new ImageStepDisplay( this ); m_display = new ImageStepDisplay( this );
setDisplayComponent(m_display); setDisplayComponent(m_display);

View File

@ -34,6 +34,7 @@ import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.contentassets.ItemImageAttachment; import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil;
import com.arsdigita.cms.ui.ImageDisplay; import com.arsdigita.cms.ui.ImageDisplay;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
@ -62,8 +63,8 @@ public class ImageStepDisplay extends SimpleContainer {
m_imageStep = step; m_imageStep = step;
Label mainLabel = new Label Label mainLabel = new Label(ImageStepGlobalizationUtil.globalize(
("This item does not have any associated images."); "cms.contentassets.ui.image_step.no_image_attached"));
mainLabel.setFontWeight(Label.ITALIC); mainLabel.setFontWeight(Label.ITALIC);
List imageList = new List( new ImageListModelBuilder() ) { List imageList = new List( new ImageListModelBuilder() ) {

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2013 Peter Boy, University of Bremen. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
package com.arsdigita.cms.contentassets.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Compilation of methods to simplify the handling of globalizing keys.
* Basically it adds the name of package's resource bundle files to the
* globalize methods and forwards to GlobalizedMessage, shortening the
* method invocation in the various application classes.
*
* @author pb
*/
public class ImageStepGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle RelatedLink's globalisation. */
final public static String BUNDLE_NAME =
"com.arsdigita.cms.contentassets.ImageStepResources";
/** Name of Java resource files to handle CMS globalisation. */
final public static String ALTERNATE_BUNDLE_NAME =
"com.arsdigita.cms.CMSResources";
/**
* Returns a globalized message using the appropriate bundle.
* If the key string contains the modules name image_step the package
* specific bundle is used, otherwise the CMS ResourceBundle.
*/
public static GlobalizedMessage globalize(String key) {
if (key.indexOf(".image_step.") > 0) {
return new GlobalizedMessage(key, BUNDLE_NAME);
} else {
return new GlobalizedMessage(key, ALTERNATE_BUNDLE_NAME);
}
}
/**
* Returns a globalized message object, using the approprate bundle,
* takeing in an Object[] of arguments to interpolate into the retrieved
* message using the MessageFormat class.
* If the key string contains the modules name image_Step the package
* specific bundle is used, otherwise the CMS ResourceBundle.
*/
public static GlobalizedMessage globalize(String key, Object[] args) {
if (key.indexOf(".image_step.") > 0) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
} else {
return new GlobalizedMessage(key, ALTERNATE_BUNDLE_NAME, args);
}
}
}

View File

@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Cannot create XML document
cms.cant_promote_folders=Can't promote folders cms.cant_promote_folders=Can't promote folders
cms.classnotfoundexception=ClassNotFoundException: cms.classnotfoundexception=ClassNotFoundException:
cms.illegalaccessexception=IllegalAccessException: cms.illegalaccessexception=IllegalAccessException:
cms.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length cms.contentasset.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length
cms.image.expected_soi_marker_first=Expected SOI marker first cms.contentasset.image.expected_soi_marker_first=Expected SOI marker first
cms.image.not_a_jpeg_file=Not a JPEG file cms.contentasset.image.not_a_jpeg_file=Not a JPEG file
cms.instantiationexception=Instantiation Exception: cms.instantiationexception=Instantiation Exception:
cms.nosuchmethodexception=No-Such-Method Exception: cms.nosuchmethodexception=No-Such-Method Exception:
cms.templates=Templates cms.templates=Templates
@ -38,7 +38,7 @@ 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=Description:
cms.contenttypes.ui.title=Title: cms.contenttypes.ui.title=Title:
cms.contenttypes.ui.view_image=view image cms.contentasset.image.ui.view_image=view image
# Package com.arsdigita.cms.dispatcher # Package com.arsdigita.cms.dispatcher
@ -986,15 +986,14 @@ cms.ui.item_search.flat.filter.submit=Filter
cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Create new cms.ui.item_search.create=Create new
cms.ui.item_search.create.folder_select=Select folder cms.ui.item_search.create.folder_select=Select folder
cms.ui.image_library=Image Library cms.contentasset.image.ui.image_library=Image Library
cms.ui.image_upload=Upload Image cms.contentasset.image.ui.upload_button=Upload Image
cms.ui.images=Images cms.contentasset.image.ui.images=Images
cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit cms.ui.search.create.select_edit=Select item and edit
cms.ui.clear=Clear cms.ui.clear=Clear
cms.ui.item_search.create.folder_missing=No folder selected cms.ui.item_search.create.folder_missing=No folder selected
cms.ui.images_links=
cms.ui.contentcenter.mainpage.search=Search cms.ui.contentcenter.mainpage.search=Search
cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections
cms.ui.contentcenter.section=Section cms.ui.contentcenter.section=Section
@ -1036,3 +1035,5 @@ cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel 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.use_context=Use Context

View File

@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Kann XML Dokument nicht erstellen
cms.cant_promote_folders=Can't promote folders cms.cant_promote_folders=Can't promote folders
cms.classnotfoundexception=ClassNotFoundException: cms.classnotfoundexception=ClassNotFoundException:
cms.illegalaccessexception=IllegalAccessException: cms.illegalaccessexception=IllegalAccessException:
cms.image.erroneous_jpeg_marker_length=Fehlerhafte L\u00e4nge des JPEG marker cms.contentasset.image.erroneous_jpeg_marker_length=Fehlerhafte L\u00e4nge des JPEG marker
cms.image.expected_soi_marker_first=Zuerst den SOI marker erwartet cms.contentasset.image.expected_soi_marker_first=Zuerst den SOI marker erwartet
cms.image.not_a_jpeg_file=Keine JPEG Datei cms.contentasset.image.not_a_jpeg_file=Keine JPEG Datei
cms.instantiationexception=Ausnahmebedinung bei Instantiierung: cms.instantiationexception=Ausnahmebedinung bei Instantiierung:
cms.nosuchmethodexception=NoSuchMethodException: cms.nosuchmethodexception=NoSuchMethodException:
cms.templates=Vorlagen cms.templates=Vorlagen
@ -38,7 +38,7 @@ 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=Beschreibung:
cms.contenttypes.ui.title=Titel: cms.contenttypes.ui.title=Titel:
cms.contenttypes.ui.view_image=Bild anzeigen cms.contentasset.image.ui.view_image=Bild anzeigen
# Package com.arsdigita.cms.dispatcher # Package com.arsdigita.cms.dispatcher
# ===================================== # =====================================
@ -978,16 +978,15 @@ cms.ui.item_search.flat.filter.submit=Filtern
cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID) cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID)
cms.ui.item_search.create=Neu anlegen cms.ui.item_search.create=Neu anlegen
cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen
cms.ui.image_library=Bilderauswahl cms.contentasset.image.ui.image_library=Bilderauswahl
cms.ui.image_upload=Bild hochladen cms.contentasset.image.ui.upload_button=Bild hochladen
cms.ui.images=Bilder cms.contentasset.image.ui.images=Bilder
cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen
cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten
cms.ui.clear=Zur\u00fccksetzen cms.ui.clear=Zur\u00fccksetzen
cms.ui.type.minimum_number_of_values_bigger_than_maximum_number_of_values=Maximaler Wert kleiner als minimaler Wert cms.ui.type.minimum_number_of_values_bigger_than_maximum_number_of_values=Maximaler Wert kleiner als minimaler Wert
cms.ui.type.minimummaximum_number_of_values_cannot_be_negative=Keine negativen Werte erlaubt cms.ui.type.minimummaximum_number_of_values_cannot_be_negative=Keine negativen Werte erlaubt
cms.ui.item_search.create.folder_missing=kein Ordner ausgew\u00e4hlt cms.ui.item_search.create.folder_missing=kein Ordner ausgew\u00e4hlt
cms.ui.images_links=
cms.ui.contentcenter.mainpage.search=Suche cms.ui.contentcenter.mainpage.search=Suche
cms.ui.contentcenter.mainpage.taskssections=Aufgaben/Content Sections cms.ui.contentcenter.mainpage.taskssections=Aufgaben/Content Sections
cms.ui.contentcenter.section=Content Section cms.ui.contentcenter.section=Content Section
@ -1031,3 +1030,5 @@ cms.contenttyes.link.ui.button_save=Sichern
cms.contenttyes.link.ui.button_reset=Zur\u00fccksetzen cms.contenttyes.link.ui.button_reset=Zur\u00fccksetzen
cms.contenttyes.link.ui.button_cancel=Abbruch 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.use_context=Kontext

View File

@ -33,15 +33,14 @@ cms.ui.item_search.flat.filter.submit=Filter
cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Create new cms.ui.item_search.create=Create new
cms.ui.item_search.create.folder_select=Select folder cms.ui.item_search.create.folder_select=Select folder
cms.ui.image_library=Image Library cms.contentasset.image.ui.image_library=Image Library
cms.ui.image_upload=Upload Image cms.contentasset.image.ui.upload_button=Upload Image
cms.ui.images=Images cms.contentasset.image.ui.images=Images
cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit cms.ui.search.create.select_edit=Select item and edit
cms.ui.clear=Clear cms.ui.clear=Clear
cms.ui.item_search.create.folder_missing=No folder selected cms.ui.item_search.create.folder_missing=No folder selected
cms.ui.images_links=
cms.ui.contentcenter.mainpage.search=Search cms.ui.contentcenter.mainpage.search=Search
cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections
cms.ui.contentcenter.section=Section cms.ui.contentcenter.section=Section
@ -84,3 +83,5 @@ cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel 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.use_context=Use Context

View File

@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Erreur : impossible de cr\u00e9er un document XML
cms.cant_promote_folders=Impossible de remonter le r\u00e9pertoire cms.cant_promote_folders=Impossible de remonter le r\u00e9pertoire
cms.classnotfoundexception=Erreur : classe introuvable cms.classnotfoundexception=Erreur : classe introuvable
cms.illegalaccessexception=Erreur : acc\u00e8s interdit cms.illegalaccessexception=Erreur : acc\u00e8s interdit
cms.image.erroneous_jpeg_marker_length=Extension JPEG erronn\u00e9e cms.contentasset.image.erroneous_jpeg_marker_length=Extension JPEG erronn\u00e9e
cms.image.expected_soi_marker_first=N\u00e9c\u00e9ssite le marqueur SOI en premier cms.contentasset.image.expected_soi_marker_first=N\u00e9c\u00e9ssite le marqueur SOI en premier
cms.image.not_a_jpeg_file=Ceci n'est pas un fichier JPEG cms.contentasset.image.not_a_jpeg_file=Ceci n'est pas un fichier JPEG
cms.instantiationexception=Erreur : instanciation impossible cms.instantiationexception=Erreur : instanciation impossible
cms.nosuchmethodexception=Erreur : pas de m\u00e9thode trouv\u00e9e cms.nosuchmethodexception=Erreur : pas de m\u00e9thode trouv\u00e9e
cms.templates=Gabarits cms.templates=Gabarits
@ -24,7 +24,7 @@ cms.contenttypes.ui.name=Nom (URL)
cms.contenttypes.ui.summary=R\u00e9sum\u00e9 cms.contenttypes.ui.summary=R\u00e9sum\u00e9
cms.contenttypes.ui.summary=R\u00e9sum\u00e9 cms.contenttypes.ui.summary=R\u00e9sum\u00e9
cms.contenttypes.ui.title=Titre de la page cms.contenttypes.ui.title=Titre de la page
cms.contenttypes.ui.view_image=voir l'image cms.contentasset.image.ui.view_image=voir l'image
# Package com.arsdigita.cms.dispatcher # Package com.arsdigita.cms.dispatcher
# ===================================== # =====================================
@ -506,15 +506,14 @@ cms.ui.item_search.flat.filter.submit=Filter
cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Cr\u00e9er cms.ui.item_search.create=Cr\u00e9er
cms.ui.item_search.create.folder_select=Select folder cms.ui.item_search.create.folder_select=Select folder
cms.ui.image_library=Image Library cms.contentasset.image.ui.image_library=Image Library
cms.ui.image_upload=Upload Image cms.contentasset.image.ui.upload_button=Upload Image
cms.ui.images=Images cms.contentasset.image.ui.images=Images
cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit cms.ui.search.create.select_edit=Select item and edit
cms.ui.clear= cms.ui.clear=
cms.ui.item_search.create.folder_missing=No folder selected cms.ui.item_search.create.folder_missing=No folder selected
cms.ui.images_links=
cms.ui.contentcenter.mainpage.search= cms.ui.contentcenter.mainpage.search=
cms.ui.contentcenter.mainpage.taskssections= cms.ui.contentcenter.mainpage.taskssections=
cms.ui.contentcenter.section= cms.ui.contentcenter.section=
@ -558,3 +557,5 @@ cms.contenttyes.link.ui.button_save=Save
cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_reset=Reset
cms.contenttyes.link.ui.button_cancel=Cancel 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.use_context=Use Context

View File

@ -241,8 +241,12 @@ public class ImageBrowser extends Table {
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.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key)); ImageAsset asset = (ImageAsset) DomainObjectFactory
//XXX Find a new way to figure out, if this image is used by any CI so we can decide if it can be deleted .newInstance(new
OID(ImageAsset.BASE_DATA_OBJECT_TYPE,
(BigDecimal) key));
//XXX Find a new way to figure out, if this image is used by any CI so we can
// decide if it can be deleted
// if (!GenericArticleImageAssociation.imageHasAssociation(asset)) { // if (!GenericArticleImageAssociation.imageHasAssociation(asset)) {
// canDelete = true; // canDelete = true;
// } // }
@ -254,7 +258,13 @@ public class ImageBrowser extends Table {
// can delete image because it's not in use // can delete image because it's not in use
if (canDelete) { if (canDelete) {
return super.getComponent(table, state, value, isSelected, key, row, column); return super.getComponent(table,
state,
value,
isSelected,
key,
row,
column);
} }
} }
return new Label(""); return new Label("");

View File

@ -71,7 +71,8 @@ public class ImageChooser extends BoxPanel {
m_keyword = new StringParameter(KEYWORD); m_keyword = new StringParameter(KEYWORD);
m_sel = new ParameterSingleSelectionModel(m_keyword); m_sel = new ParameterSingleSelectionModel(m_keyword);
m_form = new ImageKeywordForm(m_sel); m_form = new ImageKeywordForm(m_sel);
DefaultImageBrowserModelBuilder modelBuilder = new DefaultImageBrowserModelBuilder(m_sel, context); DefaultImageBrowserModelBuilder modelBuilder = new
DefaultImageBrowserModelBuilder(m_sel, context);
m_browser = new ImageBrowser(modelBuilder, mode); m_browser = new ImageBrowser(modelBuilder, mode);
modelBuilder.setImageBrowser(m_browser); modelBuilder.setImageBrowser(m_browser);
@ -221,8 +222,10 @@ public class ImageChooser extends BoxPanel {
final TextField keyword = new TextField(WORD); final TextField keyword = new TextField(WORD);
add(keyword); add(keyword);
m_saveCancel = new SaveCancelSection(); m_saveCancel = new SaveCancelSection();
m_saveCancel.getSaveButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.search")); m_saveCancel.getSaveButton()
m_saveCancel.getCancelButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.clear")); .setButtonLabel(GlobalizationUtil.globalize("cms.ui.search"));
m_saveCancel.getCancelButton()
.setButtonLabel(GlobalizationUtil.globalize("cms.ui.clear"));
add(m_saveCancel); add(m_saveCancel);
addProcessListener(this); addProcessListener(this);

View File

@ -21,6 +21,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -28,8 +29,8 @@ import java.math.BigDecimal;
* An image library component. * An image library component.
* *
* This component can be used in different places to add an image library * 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 * in a convinient way. This class uses a listener class which should be
* from {@link ImageComponentAbstractListener}. * extended from {@link ImageComponentAbstractListener}.
* *
* @author unknown * @author unknown
* @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de> * @author Sören Bernstein (quasimodo) <sbernstein@zes.uni-bremen.de>
@ -96,7 +97,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo
// Show additional fields only in default mode a.k.a. ATTACH_IMAGE like // Show additional fields only in default mode a.k.a. ATTACH_IMAGE like
// in image-step // in image-step
if (m_mode == ImageComponent.ATTACH_IMAGE) { if (m_mode == ImageComponent.ATTACH_IMAGE) {
m_form.add(new Label("Caption")); m_form.add(new Label(GlobalizationUtil
.globalize("cms.contentasset.image.ui.caption")));
m_caption.addValidationListener(new NotNullValidationListener()); m_caption.addValidationListener(new NotNullValidationListener());
m_caption.setSize(40); m_caption.setSize(40);
m_form.add(m_caption); m_form.add(m_caption);
@ -113,7 +115,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo
* m_form.add(m_description); m_form.add(new Label("Title")); * m_form.add(m_description); m_form.add(new Label("Title"));
* m_form.add(m_title); } * m_form.add(m_title); }
*/ */
m_form.add(new Label("Use Context")); m_form.add(new Label(GlobalizationUtil
.globalize("cms.contentasset.image.ui.use_context")));
m_useContext.setSize(40); m_useContext.setSize(40);
m_form.add(m_useContext); m_form.add(m_useContext);
} }
@ -126,7 +129,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo
m_saveCancel = new SaveCancelSection(); m_saveCancel = new SaveCancelSection();
m_saveCancel.getSaveButton().setOnClick("selectImage(this)"); m_saveCancel.getSaveButton().setOnClick("selectImage(this)");
m_saveCancel.getCancelButton().setOnClick("selectImage(this)"); m_saveCancel.getCancelButton().setOnClick("selectImage(this)");
if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) { if (m_mode == ImageComponent.SELECT_IMAGE
|| m_mode == ImageComponent.ATTACH_IMAGE) {
m_form.add(m_saveCancel); m_form.add(m_saveCancel);
} }
} }
@ -178,7 +182,9 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo
public void addUploadLink(final ActionListener actionListener) { public void addUploadLink(final ActionListener actionListener) {
// Add action link to image upload component // Add action link to image upload component
if (m_mode != ImageComponent.DISPLAY_ONLY) { if (m_mode != ImageComponent.DISPLAY_ONLY) {
final ActionLink upload = new ActionLink("Upload new image"); final ActionLink upload = new ActionLink(new
Label(GlobalizationUtil.globalize(
"cms.ui.authoring.upload_a_new_image") ));
upload.addActionListener(actionListener); upload.addActionListener(actionListener);
add(upload, ColumnPanel.FULL_WIDTH); add(upload, ColumnPanel.FULL_WIDTH);
} }

View File

@ -46,7 +46,10 @@ public class ImageSelectPage extends CMSPage {
public static final String RESULT = "result"; public static final String RESULT = "result";
public ImageSelectPage() { public ImageSelectPage() {
super(GlobalizationUtil.globalize("cms.ui.image_select.page_title").localize().toString(), new SimpleContainer()); super(GlobalizationUtil.globalize(
"cms.ui.image_select.page_title")
.localize().toString(),
new SimpleContainer());
setClassAttr("cms-admin"); setClassAttr("cms-admin");
@ -60,13 +63,15 @@ public class ImageSelectPage extends CMSPage {
m_imageComponent = m_imageComponent =
new MapComponentSelectionModel(componentModel, new HashMap()); new MapComponentSelectionModel(componentModel, new HashMap());
m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultComponent()); m_selectListener = new ImageComponentSelectListener(m_imageComponent,
getResultComponent());
m_tabbedPane = createTabbedPane(); m_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body"); m_tabbedPane.setIdAttr("page-body");
add(m_tabbedPane); add(m_tabbedPane);
// ActionListener to change the image component state param to the right value // ActionListener to change the image component state param to the
// right value
addActionListener(new ActionListener() { addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) { public void actionPerformed(ActionEvent event) {
@ -93,10 +98,12 @@ public class ImageSelectPage extends CMSPage {
*/ */
protected ImageLibraryComponent getImageLibraryPane() { protected ImageLibraryComponent getImageLibraryPane() {
if (m_imageLibrary == null) { if (m_imageLibrary == null) {
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this); m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE,
this);
m_imageLibrary.getForm().addInitListener(m_selectListener); m_imageLibrary.getForm().addInitListener(m_selectListener);
m_imageLibrary.getForm().addProcessListener(m_selectListener); m_imageLibrary.getForm().addProcessListener(m_selectListener);
m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, m_imageLibrary); m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY,
m_imageLibrary);
} }
return m_imageLibrary; return m_imageLibrary;
} }
@ -112,7 +119,8 @@ public class ImageSelectPage extends CMSPage {
m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE); m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
m_imageUpload.getForm().addInitListener(m_selectListener); m_imageUpload.getForm().addInitListener(m_selectListener);
m_imageUpload.getForm().addProcessListener(m_selectListener); m_imageUpload.getForm().addProcessListener(m_selectListener);
m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, m_imageUpload); m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD,
m_imageUpload);
} }
return m_imageUpload; return m_imageUpload;
} }
@ -151,9 +159,12 @@ public class ImageSelectPage extends CMSPage {
* @param tabName The name of the tab if it's added * @param tabName The name of the tab if it's added
* @param comp The component to add to the pane * @param comp The component to add to the pane
*/ */
protected void addToPane(final TabbedPane pane, final String tabName, final Component comp) { protected void addToPane(final TabbedPane pane,
final String tabName,
final Component comp) {
if (comp != null) { if (comp != null) {
pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName).localize().toString(), comp); pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName)
.localize().toString(), comp);
} }
} }
} }

View File

@ -17,6 +17,8 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.StringLengthValidationListener; import com.arsdigita.bebop.parameters.StringLengthValidationListener;
import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.util.GlobalizationUtil;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -57,7 +59,9 @@ public class ImageUploadComponent extends Form implements ImageComponent {
m_mode = mode; m_mode = mode;
setEncType("multipart/form-data"); setEncType("multipart/form-data");
// Ignoring deprecated constructor. // Ignoring deprecated constructor.
m_imageFile = new FileUploadSection("Image Type", "image", ImageAsset.MIME_JPEG); m_imageFile = new FileUploadSection("Image Type",
"image",
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);
@ -69,7 +73,8 @@ public class ImageUploadComponent extends Form implements ImageComponent {
// add widget only if we are in attach mode // add widget only if we are in attach mode
if (m_mode == ImageComponent.ATTACH_IMAGE) { if (m_mode == ImageComponent.ATTACH_IMAGE) {
add(new Label("Caption")); add(new Label(GlobalizationUtil
.globalize("cms.contentasset.image.ui.caption")));
m_caption.addValidationListener(new NotNullValidationListener()); m_caption.addValidationListener(new NotNullValidationListener());
m_caption.addValidationListener(new StringLengthValidationListener(40)); m_caption.addValidationListener(new StringLengthValidationListener(40));
m_caption.setSize(40); m_caption.setSize(40);
@ -94,7 +99,8 @@ public class ImageUploadComponent extends Form implements ImageComponent {
// //
// } // }
add(new Label("Use Context")); add(new Label(GlobalizationUtil
.globalize("cms.contentasset.image.ui.use_context")));
m_useContext.setSize(40); m_useContext.setSize(40);
add(m_useContext); add(m_useContext);
} }

View File

@ -74,29 +74,35 @@ public class ImagesPane extends LayoutPanel implements Resettable {
m_imageComponentKey = new StringParameter("imageComponent"); m_imageComponentKey = new StringParameter("imageComponent");
final ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey); final ParameterSingleSelectionModel componentModel = new
m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap()); ParameterSingleSelectionModel(m_imageComponentKey);
m_imageComponent = new MapComponentSelectionModel(componentModel,
new HashMap());
final Map selectors = m_imageComponent.getComponentsMap(); final Map selectors = m_imageComponent.getComponentsMap();
m_adminListener = new ImageComponentAdminListener(m_imageComponent, this); m_adminListener = new ImageComponentAdminListener(m_imageComponent, this);
// Image library component // Image library component
final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES); final ImageLibraryComponent library = new
ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
library.getForm().addInitListener(m_adminListener); library.getForm().addInitListener(m_adminListener);
library.getForm().addProcessListener(m_adminListener); library.getForm().addProcessListener(m_adminListener);
selectors.put(ImageComponent.LIBRARY, library); selectors.put(ImageComponent.LIBRARY, library);
m_bodySegments.put(ImageComponent.LIBRARY, m_body.addSegment( m_bodySegments.put(ImageComponent.LIBRARY, m_body.addSegment(
new Label(GlobalizationUtil.globalize("cms.ui.image_library")), new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.image_library")),
library)); library));
// Image upload component // Image upload component
final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES); final ImageUploadComponent upload = new
ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
upload.getForm().addInitListener(m_adminListener); upload.getForm().addInitListener(m_adminListener);
upload.getForm().addSubmissionListener(m_adminListener); upload.getForm().addSubmissionListener(m_adminListener);
upload.getForm().addProcessListener(m_adminListener); upload.getForm().addProcessListener(m_adminListener);
selectors.put(ImageComponent.UPLOAD, upload); selectors.put(ImageComponent.UPLOAD, upload);
m_bodySegments.put(ImageComponent.UPLOAD, m_body.addSegment( m_bodySegments.put(ImageComponent.UPLOAD, m_body.addSegment(
new Label(GlobalizationUtil.globalize("cms.ui.image_upload")), new Label(GlobalizationUtil.globalize(
"cms.contentasset.image.ui.upload_button")),
upload)); upload));
} }
@ -109,7 +115,8 @@ public class ImagesPane extends LayoutPanel implements Resettable {
while (keys.hasNext()) { while (keys.hasNext()) {
String key = keys.next(); String key = keys.next();
page.setVisibleDefault(m_bodySegments.get(key), m_model.getDefaultSelection().equals(key)); page.setVisibleDefault(m_bodySegments.get(key),
m_model.getDefaultSelection().equals(key));
} }
page.addComponentStateParam(this, m_imageComponentKey); page.addComponentStateParam(this, m_imageComponentKey);
@ -154,8 +161,12 @@ public class ImagesPane extends LayoutPanel implements Resettable {
} }
} }
private class ResettableParameterSingleSelectionModel extends ParameterSingleSelectionModel /**
implements Resettable { *
*/
private class ResettableParameterSingleSelectionModel
extends ParameterSingleSelectionModel
implements Resettable {
private String defaultKey; private String defaultKey;
@ -182,6 +193,9 @@ public class ImagesPane extends LayoutPanel implements Resettable {
} }
} }
/**
*
*/
private class ImageAdminListModel implements ListModel { private class ImageAdminListModel implements ListModel {
private ArrayList<String> m_keys; private ArrayList<String> m_keys;