|
From: <pb...@fe...> - 2012-12-16 19:30:29
|
Author: pboy
Date: 2012-12-16 19:30:11 +0000 (Sun, 16 Dec 2012)
New Revision: 2387
Added:
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/ImageSelectResultPane.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/ItemSearchFlatBrowsePane.java
Modified:
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.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/contenttypes/ui/GenericContactAttachAddressPropertyForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFolderBrowser.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchParameter.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPopup.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.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/lifecycle/ItemLifecycleItemPane.java
Log:
Backport ItemSearchWidget and various other minor modifications (r2371, r2374 - r2381) (on behalf of JensP)
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -542,7 +542,16 @@
private final Parameter m_itemSearchDefaultTab =
new StringParameter(
"com.arsdigita.cms.item_search.default_tab",
- Parameter.REQUIRED, "browse");
+ Parameter.REQUIRED, "flatBrowse");
+// private final Parameter m_itemSearchFlatBrowsePaneEnable = new BooleanParameter(
+// "com.arsdigita.cms.item_search.flat_browse_pane.enable",
+// Parameter.REQUIRED,
+// true);
+ private final Parameter m_itemSearchFlatBrowsePanePageSize = new IntegerParameter(
+ "com.arsdigita.cms.item_search.flat_browse_pane.page_size",
+ Parameter.REQUIRED,
+ 20);
+
/////////////////////////////////////////////
// FolderBrowse
/////////////////////////////////////////////
@@ -596,6 +605,7 @@
"com.arsdigita.cms.image_browser.thumbnail_max_height",
Parameter.REQUIRED,
50);
+
// ///////////////////////////////////////////
// publishToFile package related parameter
@@ -695,6 +705,9 @@
// register(m_disableItemPfs);
// register(m_publishToFileClass);
+// register(m_itemSearchFlatBrowsePaneEnable);
+ register(m_itemSearchFlatBrowsePanePageSize);
+
loadInfo();
}
@@ -1142,5 +1155,13 @@
public Integer getImageBrowserThumbnailMaxHeight() {
return (Integer) get(m_imageBrowserThumbnailMaxHeight);
}
+
+// public Boolean getItemSearchFlatBrowsePaneEnable() {
+// return (Boolean) get(m_itemSearchFlatBrowsePaneEnable);
+// }
+
+ public Integer getItemSearchFlatBrowsePanePageSize() {
+ return (Integer) get(m_itemSearchFlatBrowsePanePageSize);
+ }
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSConfig_parameter.properties 2012-12-16 19:30:11 UTC (rev 2387)
@@ -240,7 +240,7 @@
com.arsdigita.cms.allow_content_create_in_section_listing.format=[boolean]
com.arsdigita.cms.item_search.default_tab.title=Set the default table for ItemSearchWidget
-com.arsdigita.cms.item_search.default_tab.purpose=Select either "browse" or "search" for default tab
+com.arsdigita.cms.item_search.default_tab.purpose=Select either "browse", "flatBrowse" or "search" for default tab
com.arsdigita.cms.item_search.default_tab.example=browse
com.arsdigita.cms.item_search.default_tab.format=[string]
@@ -294,9 +294,3 @@
com.arsdigita.cms.image_browser.thumbnail_max_height.purpose=Set the maximum height of the thumbnail in ImageBrowserr
com.arsdigita.cms.image_browser.thumbnail_max_height.example=150
com.arsdigita.cms.image_browser.thumbnail_max_height.format=[integer]
-
-com.arsdigita.cms.xx.title=
-com.arsdigita.cms.xx.purpose=
-com.arsdigita.cms.xx.example=
-com.arsdigita.cms.xx.format=[string]
-
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 19:30:11 UTC (rev 2387)
@@ -39,5 +39,13 @@
cms.ui.item_search.flatBrowse=Select item
cms.ui.category.undeletable=
cms.ui.item_search.flat.filter.submit=
-cms.ui.item_search.search=
cms.ui.item_search.selected=
+cms.ui.item_search.create=
+cms.ui.item_search.create.folder_select=
+cms.ui.image_library=Image Library
+cms.ui.image_upload=Upload Image
+cms.ui.images=Images
+cms.ui.search.create.select_close=
+cms.ui.search.create.select_edit=
+
+cms.ui.clear=
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 19:30:11 UTC (rev 2387)
@@ -570,7 +570,6 @@
cms.ui.item_search.flatBrowse=Select item
cms.ui.category.undeletable=
cms.ui.item_search.flat.filter.submit=
-cms.ui.item_search.search=
cms.ui.item_search.selected=
cms.ui.item_search.create=
cms.ui.item_search.create.folder_select=
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 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 19:30:11 UTC (rev 2387)
@@ -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=Namensanhang
+cms.contenttypes.ui.person.titlepost=Namesanhang
cms.contenttypes.ui.person.birthdate=Geburtstag
cms.contenttypes.ui.person.description=Beschreibung
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -77,6 +77,7 @@
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericAddress"));
+ m_itemSearch.setDisableCreatePane(true);
add(this.m_itemSearch);
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -17,20 +17,19 @@
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.contenttypes.GenericPerson;
+import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.contenttypes.GenericContact;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.RelationAttribute;
import com.arsdigita.cms.contenttypes.GenericContactTypeCollection;
+import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
+import com.arsdigita.cms.ui.ItemSearchWidget;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.kernel.Kernel;
import com.arsdigita.util.UncheckedWrapperException;
-
import org.apache.log4j.Logger;
/**
@@ -88,6 +87,7 @@
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericPerson"));
+ m_itemSearch.setDisableCreatePane(true);
add(this.m_itemSearch);
// GenericContact type field
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -78,6 +78,7 @@
"cms.contenttypes.ui.genericorgaunit.select_contact").localize()));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(GenericContact.class.getName()));
+ m_itemSearch.setDisableCreatePane(true);
add(m_itemSearch);
selectedContactLabel = new Label("");
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -43,27 +43,12 @@
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.cms.util.GlobalizationUtil;
-
-;import com.arsdigita.globalization.GlobalizationHelper;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
+import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.globalization.GlobalizationHelper;
-
-import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.util.LockableImpl;
-
import java.math.BigDecimal;
-
import org.apache.log4j.Logger;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
/**
* Table for showing the contacts associated with an organization.
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -44,13 +44,13 @@
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.globalization.GlobalizationHelper;
-import com.arsdigita.kernel.Kernel;
import org.apache.log4j.Logger;
/**
* Form for adding related persons the an organization.
*
* @author Jens Pelzetter
+ * @version $Id$
*/
public class GenericOrganizationalUnitPersonAddForm
extends BasicItemForm
@@ -81,6 +81,7 @@
findByAssociatedObjectType(getPersonType()));
/*m_itemSearch.getItemField().addValidationListener(
new NotNullValidationListener());*/
+ m_itemSearch.setDisableCreatePane(true);
add(this.m_itemSearch);
selectedPersonNameLabel = new Label("");
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -42,6 +42,7 @@
ITEM_SEARCH,
ContentType.findByAssociatedObjectType(
customizer.getSubordinateOrgaUnitType()));
+ itemSearch.setDisableCreatePane(true);
add(itemSearch);
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -39,6 +39,7 @@
ITEM_SEARCH,
ContentType.findByAssociatedObjectType(
customizer.getSuperiorOrgaUnitType()));
+ itemSearch.setDisableCreatePane(true);
add(itemSearch);
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -56,6 +56,7 @@
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericPerson"));
+ itemSearch.setEditAfterCreate(false);
add(itemSearch);
}
@@ -87,6 +88,7 @@
getLanguage());
person.setAlias(alias);
+ itemSearch.publishCreatedItem(data, alias);
}
init(fse);
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -134,6 +134,7 @@
person.addContact(contact,
(String) data.get(
GenericPersonContactCollection.CONTACTS_KEY));
+ m_itemSearch.publishCreatedItem(data, contact);
}
init(fse);
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonExtraXmlGenerator.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -32,10 +32,10 @@
final Element contactsElem = element.newChildElement("contacts");
while (contacts.next()) {
+ final GenericContact contact = contacts.getContact(GlobalizationHelper.getNegotiatedLocale().getLanguage());
generateContactXml(
contactsElem,
- contacts.getContact(GlobalizationHelper.getNegotiatedLocale().
- getLanguage()),
+ contact,
state);
}
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -51,7 +51,7 @@
final Statement stmt = conn.createStatement();
stmt.addBatch(String.format("CREATE TABLE %s ( "
- + "bundle_id integer NOT NULL)",
+ + "bundle_id integer NOT NULL);",
getBundleTableName()));
stmt.addBatch(String.format("ALTER TABLE ONLY %s "
@@ -95,14 +95,14 @@
while (personsRs.next()) {
stmt.addBatch(String.format("INSERT INTO %s (bundle_id) "
- + "VALUES (%d)",
+ + "VALUES (%d);",
getBundleTableName(),
personsRs.getInt(1)));
stmt.addBatch(String.format(
"UPDATE acs_objects "
+ "SET default_domain_class = '%s',"
+ "object_type = '%s' "
- + "WHERE object_id = %d",
+ + "WHERE object_id = %d;",
getBundleClassName(),
getBundleClassName(),
personsRs.getInt(1)));
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 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -133,6 +133,8 @@
private ItemRevisionAdminPane m_revisionsPane;
private ItemTemplates m_templatesPane;
private Link m_previewLink;
+ private GlobalNavigation m_globalNavigation;
+ private ContentItemContextBar m_contextBar;
private class ItemRequestLocal extends ContentItemRequestLocal {
@@ -194,8 +196,11 @@
m_returnURL = new StringParameter(RETURN_URL);
addGlobalStateParam(m_returnURL);
- add(new GlobalNavigation());
- add(new ContentItemContextBar(m_itemModel));
+ m_globalNavigation = new GlobalNavigation();
+ add(m_globalNavigation);
+
+ m_contextBar = new ContentItemContextBar(m_itemModel);
+ add(m_contextBar);
// Create panels.
m_summaryPane = new Summary(m_itemModel);
@@ -416,7 +421,7 @@
* @param tab The index of the tab to display
*/
public static String getItemURL(ContentItem item, int tab) {
- final ContentSection section = ContentSection.getContentSection(item);
+ final ContentSection section = item.getContentSection();
if (section == null) {
return null;
@@ -505,4 +510,12 @@
&& STREAMLINED_CREATION_ACTIVE.equals(state.getRequest().
getParameter(STREAMLINED_CREATION));
}
+
+ protected TabbedPane getTabbedPane() {
+ return m_tabbedPane;
+ }
+
+ protected WizardSelector getWizardPane() {
+ return m_wizardPane;
+ }
}
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -133,7 +133,7 @@
private FolderAdminPane m_folderPane;
private BrowsePane m_browsePane;
private LayoutPanel m_searchPane;
- private ImagesPane m_imagesPane;
+ //private ImagesPane m_imagesPane;
private RoleAdminPane m_rolePane;
private WorkflowAdminPane m_workflowPane;
private LifecycleAdminPane m_lifecyclePane;
@@ -166,7 +166,7 @@
m_folderPane = getFolderAdminPane();
m_browsePane = getBrowsePane();
m_searchPane = getSearchPane();
- m_imagesPane = getImagesPane();
+ //m_imagesPane = getImagesPane();
m_rolePane = getRoleAdminPane();
m_workflowPane = getWorkflowAdminPane();
m_lifecyclePane = getLifecycleAdminPane();
@@ -249,12 +249,12 @@
return m_searchPane;
}
- protected ImagesPane getImagesPane() {
- if(m_imagesPane == null) {
- m_imagesPane = new ImagesPane();
- }
- return m_imagesPane;
- }
+// protected ImagesPane getImagesPane() {
+// if(m_imagesPane == null) {
+// m_imagesPane = new ImagesPane();
+// }
+// return m_imagesPane;
+// }
protected RoleAdminPane getRoleAdminPane() {
if (m_rolePane == null) {
@@ -375,7 +375,7 @@
//tab(pane, "cms.ui.folders", getFolderAdminPane());
tab(pane, "cms.ui.browse", getBrowsePane());
tab(pane, "cms.ui.search", getSearchPane());
-// tab(pane, "cms.ui.images", getImagesPane());
+ //tab(pane, "cms.ui.images", getImagesPane());
tab(pane, "cms.ui.roles", getRoleAdminPane());
tab(pane, "cms.ui.workflows", getWorkflowAdminPane());
tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane());
@@ -414,8 +414,8 @@
if (pane == m_searchPane) {
m_searchPane.reset(state);
- } else if (pane == m_imagesPane) {
- m_imagesPane.reset(state);
+// } else if (pane == m_imagesPane) {
+// m_imagesPane.reset(state);
} else if (pane == m_folderPane) {
m_folderPane.reset(state);
} else if (pane == m_browsePane) {
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java 2012-12-16 19:19:32 UTC (rev 2386)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -269,7 +269,7 @@
m_selector = new CreationSelector(m_typeSel, m_folderSel);
m_newItemSeg.add(m_selector);
- m_newItemSeg.add(new Label("<br/>", false));
+ //m_newItemSeg.add(new Label("<br/>", false));
// The 'new folder' segment
m_newFolderSeg.addHeader(new Label(globalize("cms.ui.new_folder")));
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,41 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.cms.ReusableImageAsset;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public interface ImageComponent {
+
+ public static final int DISPLAY_ONLY = 0;
+ public static final int SELECT_IMAGE = 1;
+ public static final int ATTACH_IMAGE = 2;
+ public static final int ADMIN_IMAGES = 3;
+
+ public static final String UPLOAD = "upload";
+ public static final String LIBRARY = "library";
+
+ ReusableImageAsset getImage(FormSectionEvent event) throws FormProcessException;
+
+ String getCaption(FormSectionEvent event);
+
+ String getDescription(FormSectionEvent event);
+
+ String getTitle(FormSectionEvent event);
+
+ String getUseContext(FormSectionEvent event);
+
+ SaveCancelSection getSaveCancelSection();
+
+ Form getForm();
+
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,104 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.event.FormInitListener;
+import com.arsdigita.bebop.event.FormProcessListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.cms.ReusableImageAsset;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener {
+
+ private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
+ MapComponentSelectionModel m_imageComponent;
+
+ public ImageComponentAbstractListener(MapComponentSelectionModel imageComponent) {
+ super();
+ m_imageComponent = imageComponent;
+ }
+
+ public void init(FormSectionEvent event)
+ throws FormProcessException {
+ PageState ps = event.getPageState();
+ if (!m_imageComponent.isSelected(ps)) {
+ setImageComponent(ps, ImageComponent.LIBRARY);
+ }
+ }
+
+ public void submitted(FormSectionEvent event) throws FormProcessException {
+ PageState ps = event.getPageState();
+ ImageComponent component = getImageComponent(ps);
+
+ if(component.getSaveCancelSection().getCancelButton().isSelected(ps)) {
+ cancelled(ps);
+ }
+ }
+
+ public void process(FormSectionEvent event) throws FormProcessException {
+ PageState ps = event.getPageState();
+ ImageComponent component = getImageComponent(ps);
+
+ if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
+ return;
+ }
+
+ ReusableImageAsset image = component.getImage(event);
+
+ processImage(event, ps, component, image);
+ }
+
+
+ protected void cancelled(PageState ps) {};
+
+ protected abstract void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image);
+
+ protected ImageComponent getImageComponent(PageState ps) {
+ if (!m_imageComponent.isSelected(ps)) {
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("No component selected");
+ s_log.debug("Selected: " + m_imageComponent.getComponent(ps));
+ }
+
+ m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
+ }
+
+ return (ImageComponent) m_imageComponent.getComponent(ps);
+
+ }
+
+ protected void setImageComponent(PageState ps, final String activeKey) {
+
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Selected component: " + activeKey);
+ }
+
+ Map componentsMap = m_imageComponent.getComponentsMap();
+ Iterator i = componentsMap.keySet().iterator();
+ while (i.hasNext()) {
+ Object key = i.next();
+ Component component = (Component) componentsMap.get(key);
+
+ boolean isVisible = activeKey.equals(key);
+
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Key: " + key + "; Visibility: " + isVisible);
+ }
+
+ ps.setVisible(component, isVisible);
+ }
+ }
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,41 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.event.ActionEvent;
+import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.cms.ReusableImageAsset;
+import com.arsdigita.toolbox.ui.ComponentMap;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener {
+
+ private final ComponentMap m_pane;
+
+ public ImageComponentAdminListener(MapComponentSelectionModel imageComponent, ComponentMap pane) {
+ super(imageComponent);
+ m_pane = pane;
+ }
+
+ @Override
+ protected void cancelled(PageState ps) {
+ m_pane.reset(ps);
+ }
+
+ @Override
+ protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) {
+ m_pane.reset(ps);
+ }
+
+ public void actionPerformed(ActionEvent ev) {
+ setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
+ }
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,38 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+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;
+import com.arsdigita.cms.ReusableImageAsset;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @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;
+
+ public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultPane resultPane) {
+ super(imageComponent);
+ m_resultPane = resultPane;
+ }
+
+ @Override
+ protected void cancelled(PageState ps) {
+ super.cancelled(ps);
+ m_resultPane.reset(ps);
+ }
+
+ protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) {
+ m_imageComponent.setSelectedKey(ps, ImageSelectPage.RESULT);
+ m_resultPane.reset(ps);
+ }
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,183 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.ActionLink;
+import com.arsdigita.bebop.ColumnPanel;
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.Resettable;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.bebop.parameters.NotNullValidationListener;
+import com.arsdigita.cms.ContentItem;
+import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.ReusableImageAsset;
+import com.arsdigita.domain.DataObjectNotFoundException;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable {
+
+ private final ImageChooser m_chooser;
+ private final ItemSelectionModel m_imageModel;
+ private final BigDecimalParameter m_imageID;
+ private final Form m_form;
+ private final TextField m_caption;
+ private final TextField m_description;
+ private final TextField m_title;
+ private final TextField m_useContext;
+ private final SaveCancelSection m_saveCancel;
+ private int m_mode;
+
+ public ImageLibraryComponent() {
+ this(ImageComponent.ATTACH_IMAGE, null);
+ }
+
+ public ImageLibraryComponent(final int mode) {
+ this(mode, null);
+ }
+
+ public ImageLibraryComponent(final int mode, final ImageSelectPage parent) {
+ m_mode = mode;
+ m_imageID = new BigDecimalParameter("imageID");
+ m_imageModel = new ItemSelectionModel(m_imageID);
+ m_chooser = new ImageChooser(ContentItem.DRAFT, m_mode);
+ m_chooser.addImageActionListener(new ImageBrowser.LinkActionListener() {
+
+ public void deleteClicked(final PageState state, final BigDecimal imageID) {
+ ImagesPane.S_LOG.debug("Clicked delete");
+ final ReusableImageAsset image = new ReusableImageAsset(imageID);
+ image.delete();
+ }
+
+ public void linkClicked(final PageState state, final BigDecimal imageID) {
+ ImagesPane.S_LOG.debug("Clicked select");
+ try {
+ final ReusableImageAsset image = new ReusableImageAsset(imageID);
+ if(m_mode == ImageComponent.SELECT_IMAGE) {
+ parent.getResultPane().setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight());
+ }
+ m_imageModel.setSelectedObject(state, image);
+ } catch (DataObjectNotFoundException ex) {
+ ImagesPane.S_LOG.error("Selected non-existant image: " + imageID, ex);
+ }
+ }
+ });
+ add(m_chooser);
+
+ // Form for additional fields and submit
+ m_form = new Form("imageLibraryComponent", new ColumnPanel(2));
+ add(m_form);
+
+ // Initialize all wisgets
+ m_caption = new TextField("caption");
+ m_description = new TextField("description");
+ m_title = new TextField("title");
+ m_useContext = new TextField("useContext");
+
+ // Show additional fields only in default mode a.k.a. ATTACH_IMAGE like
+ // in image-step
+ if (m_mode == ImageComponent.ATTACH_IMAGE) {
+ m_form.add(new Label("Caption"));
+ m_caption.addValidationListener(new NotNullValidationListener());
+ m_caption.setSize(40);
+ m_form.add(m_caption);
+ m_description.addValidationListener(new NotNullValidationListener());
+ m_description.setSize(40);
+ m_title.addValidationListener(new NotNullValidationListener());
+ m_title.setSize(40);
+ // Only show the title and description fields where these have
+ // been explicitly requested.
+ /*
+ * if
+ * (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown())
+ * { m_form.add(new Label("Description"));
+ * m_form.add(m_description); m_form.add(new Label("Title"));
+ * m_form.add(m_title); }
+ */
+ m_form.add(new Label("Use Context"));
+ m_useContext.setSize(40);
+ m_form.add(m_useContext);
+ }
+
+// if (m_mode == ImageComponent.SELECT_IMAGE) {
+// m_form.setOnSubmit("selectImage();");
+// }
+
+ // save and cancel buttons
+ m_saveCancel = new SaveCancelSection();
+ m_saveCancel.getSaveButton().setOnClick("selectImage(this)");
+ m_saveCancel.getCancelButton().setOnClick("selectImage(this)");
+ if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) {
+ m_form.add(m_saveCancel);
+ }
+ }
+
+ public ReusableImageAsset getImage(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (ReusableImageAsset) m_imageModel.getSelectedItem(state);
+ }
+
+ @Override
+ public void register(final Page page) {
+ super.register(page);
+ page.addComponentStateParam(this, m_imageID);
+ }
+
+ public String getCaption(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_caption.getValue(state);
+ }
+
+ public String getDescription(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_description.getValue(state);
+ }
+
+ public String getTitle(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_title.getValue(state);
+ }
+
+ public String getUseContext(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_useContext.getValue(state);
+ }
+
+ public Form getForm() {
+ return m_form;
+ }
+
+ public SaveCancelSection getSaveCancelSection() {
+ return m_saveCancel;
+ }
+
+ public void addUploadLink(final ActionListener actionListener) {
+ // Add action link to image upload component
+ if (m_mode != ImageComponent.DISPLAY_ONLY) {
+ final ActionLink upload = new ActionLink("Upload new image");
+ upload.addActionListener(actionListener);
+ add(upload, ColumnPanel.FULL_WIDTH);
+ }
+ }
+
+ // Reset this component
+ public void reset(final PageState state) {
+ // clear selection
+ m_imageModel.clearSelection(state);
+ m_chooser.clearSelection(state);
+ m_chooser.clearKeyword(state);
+ }
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,137 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.bebop.TabbedPane;
+import com.arsdigita.bebop.event.ActionEvent;
+import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.CMSConfig;
+import com.arsdigita.cms.dispatcher.CMSPage;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import java.util.HashMap;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageSelectPage extends CMSPage {
+
+ private static final Logger S_LOG = Logger.getLogger(ImagesPane.class);
+
+ private final static String XSL_CLASS = "CMS Admin";
+ private TabbedPane m_tabbedPane;
+ private ImageLibraryComponent m_imageLibrary;
+ private ImageUploadComponent m_imageUpload;
+ private ImageSelectResultPane m_resultPane;
+ private BigDecimalParameter m_sectionId;
+ private final StringParameter m_imageComponentKey;
+ private final MapComponentSelectionModel m_imageComponent;
+ private final ImageComponentSelectListener m_selectListener;
+ private static final CMSConfig s_conf = CMSConfig.getInstance();
+ public static final String CONTENT_SECTION = "section_id";
+ public static final String RESULT = "result";
+
+ public ImageSelectPage() {
+ super(GlobalizationUtil.globalize("cms.ui.image_select.page_title").localize().toString(), new SimpleContainer());
+
+ setClassAttr("cms-admin");
+
+ m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
+ addGlobalStateParam(m_sectionId);
+
+ m_imageComponentKey = new StringParameter("imageComponent");
+
+ ParameterSingleSelectionModel componentModel =
+ new ParameterSingleSelectionModel(m_imageComponentKey);
+ m_imageComponent =
+ new MapComponentSelectionModel(componentModel, new HashMap());
+
+ m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultPane());
+
+ m_tabbedPane = createTabbedPane();
+ m_tabbedPane.setIdAttr("page-body");
+
+ add(m_tabbedPane);
+ // ActionListener to change the image component state param to the right value
+ addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent event) {
+ final PageState ps = event.getPageState();
+
+ if (m_tabbedPane.getCurrentPane(ps).equals(m_imageLibrary)) {
+ m_imageComponent.setSelectedKey(ps, ImageComponent.LIBRARY);
+ }
+ if (m_tabbedPane.getCurrentPane(ps).equals(m_imageUpload)) {
+ m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
+ }
+ }
+ });
+
+ add(m_resultPane);
+
+ addGlobalStateParam(m_imageComponentKey);
+ }
+
+ protected ImageLibraryComponent getImageLibraryPane() {
+ if (m_imageLibrary == null) {
+ m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this);
+ m_imageLibrary.getForm().addInitListener(m_selectListener);
+ m_imageLibrary.getForm().addProcessListener(m_selectListener);
+ m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, m_imageLibrary);
+ }
+ return m_imageLibrary;
+ }
+
+ protected ImageUploadComponent getImageUploadPane() {
+
+ if (m_imageUpload == null) {
+ m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
+ m_imageUpload.getForm().addInitListener(m_selectListener);
+ m_imageUpload.getForm().addProcessListener(m_selectListener);
+ m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, m_imageUpload);
+ }
+ return m_imageUpload;
+ }
+
+ protected ImageSelectResultPane getResultPane() {
+ if (m_resultPane == null) {
+ m_resultPane = new ImageSelectResultPane();
+ }
+ return m_resultPane;
+ }
+
+ protected TabbedPane createTabbedPane() {
+ TabbedPane pane = new TabbedPane();
+ pane.setClassAttr(XSL_CLASS);
+
+ addToPane(pane, ImageComponent.LIBRARY, getImageLibraryPane());
+ addToPane(pane, ImageComponent.UPLOAD, getImageUploadPane());
+ pane.setDefaultPane(m_imageLibrary);
+
+ return pane;
+ }
+
+ /**
+ * Adds the specified component, with the specified tab name, to the tabbed
+ * pane only if it is not null.
+ *
+ * @param pane The pane to which to add the tab
+ * @param tabName The name of the tab if it's added
+ * @param comp The component to add to the pane
+ */
+ protected void addToPane(final TabbedPane pane, final String tabName, final Component comp) {
+ if (comp != null) {
+ pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName).localize().toString(), comp);
+ }
+ }
+}
Added: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,81 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.Resettable;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.xml.Element;
+import java.math.BigDecimal;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageSelectResultPane extends SimpleContainer implements Resettable {
+
+ boolean m_valid = false;
+ String m_name;
+ BigDecimal m_id;
+ BigDecimal m_width;
+ BigDecimal m_height;
+
+ public ImageSelectResultPane() {
+ super();
+ }
+
+ public void setResult(final String name, final BigDecimal id, final BigDecimal width, final BigDecimal height) {
+ m_name = name;
+ m_id = id;
+ m_width = width;
+ m_height = height;
+ m_valid = true;
+ }
+
+ @Override
+ public void generateXML(PageState state, Element parent) {
+
+ Element scriptElem = parent.newChildElement("script");
+ scriptElem.addAttribute("type", "text/javascript");
+
+ StringBuilder script = new StringBuilder(1000);
+
+ script.append("function selectImage(button) {");
+ if (m_valid) {
+
+ script.append("if(button.id == \"save\" ) {");
+
+ script.append("window.opener.openCCM.imageSet({");
+ script.append(" src : \"/ccm/cms-service/stream/image/?image_id=");
+ script.append(m_id);
+ script.append("\", ");
+ script.append(" name : \"");
+ script.append(m_name);
+ script.append("\", ");
+ script.append(" width : \"");
+ script.append(m_width);
+ script.append("\", ");
+ script.append(" height : \"");
+ script.append(m_height);
+ script.append("\"");
+ script.append("});");
+ script.append("}");
+
+ script.append("self.close();");
+
+ }
+ script.append("return false;");
+ script.append("}");
+ scriptElem.setText(script.toString());
+ }
+
+ public void reset(PageState state) {
+ m_name = null;
+ m_id = null;
+ m_width = null;
+ m_height = null;
+ m_valid = false;
+ }
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,145 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.ColumnPanel;
+import com.arsdigita.bebop.Form;
+import com.arsdigita.bebop.FormProcessException;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.form.TextArea;
+import com.arsdigita.bebop.form.TextField;
+import com.arsdigita.bebop.parameters.NotNullValidationListener;
+import com.arsdigita.bebop.parameters.StringLengthValidationListener;
+import com.arsdigita.cms.ImageAsset;
+import com.arsdigita.cms.ReusableImageAsset;
+import java.io.File;
+import java.io.IOException;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageUploadComponent extends Form implements ImageComponent {
+
+ private final FileUploadSection m_imageFile;
+ private final TextField m_caption;
+ private final TextField m_title;
+ private final TextArea m_description;
+ private final TextField m_useContext;
+ private final SaveCancelSection m_saveCancel;
+ private int m_mode;
+
+ public ImageUploadComponent() {
+ this(ImageComponent.ATTACH_IMAGE);
+ }
+
+ public ImageUploadComponent(int mode) {
+ super("imageUploadComponent", new ColumnPanel(2));
+ m_mode = mode;
+ setEncType("multipart/form-data");
+ // Ignoring deprecated constructor.
+ m_imageFile = new FileUploadSection("Image Type", "image", ImageAsset.MIME_JPEG);
+ m_imageFile.getFileUploadWidget().addValidationListener(new NotNullValidationListener());
+ add(m_imageFile, ColumnPanel.FULL_WIDTH);
+
+ // Initialize all widgets
+ m_caption = new TextField("caption");
+ m_title = new TextField("title");
+ m_description = new TextArea("description");
+ m_useContext = new TextField("useContext");
+
+ // add widget only if we are in attach mode
+ if (m_mode == ImageComponent.ATTACH_IMAGE) {
+ add(new Label("Caption"));
+ m_caption.addValidationListener(new NotNullValidationListener());
+ m_caption.addValidationListener(new StringLengthValidationListener(40));
+ m_caption.setSize(40);
+ add(m_caption);
+
+ // We only show the title and description fields in the case where
+ // getIsImageStepDescriptionAndTitleShown is false.
+
+// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
+// add(new Label("Title"));
+// m_title.addValidationListener(new NotNullValidationListener());
+// m_title.setSize(40);
+// m_title.addValidationListener(new StringLengthValidationListener(40));
+// add(m_title);
+//
+// add(new Label("Description"));
+// m_description.addValidationListener(new NotNullValidationListener());
+// m_description.addValidationListener(new StringLengthValidationListener(600));
+// m_description.setCols(30);
+// m_description.setRows(5);
+// add(m_description);
+//
+// }
+
+ add(new Label("Use Context"));
+ m_useContext.setSize(40);
+ add(m_useContext);
+ }
+ m_saveCancel = new SaveCancelSection();
+ add(m_saveCancel);
+
+ /*
+ * Removed by Quasimodo: Changed editing workflow, so that library comes
+ * first Also, library mode has now a link to upload images which will
+ * link to this form. Consequently, this link will create a loop, which
+ * isn't fatal but confusing. ActionLink library = new ActionLink(
+ * "Select an existing image" ); library.addActionListener( new
+ * ActionListener() { public void actionPerformed( ActionEvent ev ) {
+ * setImageComponent( ev.getPageState(), LIBRARY ); } } ); add( library,
+ * ColumnPanel.FULL_WIDTH );
+ */
+ }
+
+ public SaveCancelSection getSaveCancelSection() {
+ return m_saveCancel;
+ }
+
+ public ReusableImageAsset getImage(FormSectionEvent event) throws FormProcessException {
+ PageState ps = event.getPageState();
+ String filename = (String) m_imageFile.getFileName(event);
+ File imageFile = m_imageFile.getFile(event);
+ try {
+ ReusableImageAsset image = new ReusableImageAsset();
+ image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
+// image.setDescription((String) m_caption.getValue(ps));
+ return image;
+ } catch (IOException ex) {
+ ImagesPane.S_LOG.error("Error loading image from file", ex);
+ throw new FormProcessException(ex.getMessage());
+ }
+ }
+
+ public String getCaption(FormSectionEvent event) {
+ PageState ps = event.getPageState();
+ return (String) m_caption.getValue(ps);
+ }
+
+ public String getDescription(FormSectionEvent event) {
+ PageState ps = event.getPageState();
+ return (String) m_description.getValue(ps);
+ }
+
+ public String getTitle(FormSectionEvent event) {
+ PageState ps = event.getPageState();
+ return (String) m_title.getValue(ps);
+ }
+
+ public String getUseContext(FormSectionEvent event) {
+ PageState ps = event.getPageState();
+ return (String) m_useContext.getValue(ps);
+ }
+
+ public Form getForm() {
+ return this;
+ }
+
+}
Added: 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 (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 19:30:11 UTC (rev 2387)
@@ -0,0 +1,230 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.ui;
+
+import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.List;
+import com.arsdigita.bebop.ListPanel;
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.Page;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
+import com.arsdigita.bebop.Resettable;
+import com.arsdigita.bebop.SegmentedPanel;
+import com.arsdigita.bebop.SegmentedPanel.Segment;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.bebop.SingleSelectionModel;
+import com.arsdigita.bebop.event.ChangeEvent;
+import com.arsdigita.bebop.event.ChangeListener;
+import com.arsdigita.bebop.list.ListModel;
+import com.arsdigita.bebop.list.ListModelBuilder;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.toolbox.ui.ActionGroup;
+import com.arsdigita.toolbox.ui.LayoutPanel;
+import com.arsdigita.toolbox.ui.Section;
+import com.arsdigita.util.LockableImpl;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.log4j.Logger;
+
+/**
+ * A LayoutPanel to insert into ContentSectionPage or ImageSelectPage
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImagesPane extends LayoutPanel implements Resettable {
+
+ public static final Logger S_LOG = Logger.getLogger(ImagesPane.class);
+ private final StringParameter m_imageComponentKey;
+ private final MapComponentSelectionModel m_imageComponent;
+ private final ImageComponentAdminListener m_adminListener;
+ private ListPanel m_listPanel;
+ final private SegmentedPanel m_body;
+ private HashMap<String, Segment> m_bodySegments = new HashMap();
+ private final SingleSelectionModel m_model;
+ private final List m_links;
+
+ public ImagesPane() {
+ super();
+
+ m_model = new ParameterSingleSelectionModel(new StringParameter(List.SELECTED));
+
+ m_model.addChangeListener(new ImageAdminSelectionListener());
+
+ m_links = new List(new ImageAdminListModelBuilder());
+ m_links.setSelectionModel(m...
[truncated message content] |