You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(48) |
Dec
(31) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(22) |
Feb
(68) |
Mar
(185) |
Apr
(11) |
May
(21) |
Jun
(23) |
Jul
(46) |
Aug
(69) |
Sep
(211) |
Oct
(26) |
Nov
(51) |
Dec
(52) |
| 2006 |
Jan
(13) |
Feb
(13) |
Mar
(8) |
Apr
(21) |
May
(17) |
Jun
(100) |
Jul
(34) |
Aug
(23) |
Sep
(26) |
Oct
(16) |
Nov
|
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(66) |
Oct
(10) |
Nov
(1) |
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(3) |
May
(8) |
Jun
(5) |
Jul
(31) |
Aug
(8) |
Sep
(11) |
Oct
(6) |
Nov
|
Dec
|
| 2012 |
Jan
(13) |
Feb
(2) |
Mar
(9) |
Apr
(6) |
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(120) |
| 2013 |
Jan
(6) |
Feb
(35) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pb...@fe...> - 2012-12-16 19:53:58
|
Author: pboy
Date: 2012-12-16 19:53:49 +0000 (Sun, 16 Dec 2012)
New Revision: 2388
Modified:
trunk/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java
Log:
Added log date format. (on behalf of quasimodo)
Modified: trunk/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java
===================================================================
--- trunk/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java 2012-12-16 19:30:11 UTC (rev 2387)
+++ trunk/ccm-navigation/src/com/arsdigita/navigation/DataCollectionRenderer.java 2012-12-16 19:53:49 UTC (rev 2388)
@@ -105,7 +105,8 @@
/**
* Sets the context of the traversal adapter used the render the objects
- * if {@link #m_specializeObjects} is set to <code>true</code>
+ * if {@link #m_specializeObjects} is set to
+ * <code>true</code>
*
* @param context The adapter context.
*/
@@ -125,6 +126,7 @@
/**
* @param objects
* @param pageNumber current page, starting from 1
+ *
* @return
*/
public Element generateXML(DataCollection objects,
@@ -140,7 +142,7 @@
// Quasimodo: End
Element content = Navigation.newElement("objectList");
-
+
//Return the empty nav:item & nav:paginator tags.
// Quasimodo: Why should I??? There is no need for a paginator if there aren't any elements
if (!m_navItems) {
@@ -203,9 +205,9 @@
paginator.addAttribute("objectCount", new Long(objectCount).toString());
content.addContent(paginator);
-
+
int index = 0;
- while (objects.next()) {
+ while (objects.next()) {
DataObject dobj = objects.getDataObject();
ACSObject object = null;
if (m_specializeObjects) {
@@ -216,8 +218,8 @@
} else {
s_log.debug("Specializing successful.");
}
- }
- Element item = Navigation.newElement(content, "item");
+ }
+ Element item = Navigation.newElement(content, "item");
Iterator attributes = m_attributes.iterator();
while (attributes.hasNext()) {
@@ -225,13 +227,13 @@
String[] paths = StringUtils.split(name, '.');
outputValue(item, dobj, name, paths, 0);
}
-
+
Iterator properties = m_properties.iterator();
while (properties.hasNext()) {
DataCollectionPropertyRenderer property = (DataCollectionPropertyRenderer) properties.next();
property.render(objects, item);
}
-
+
Element path = Navigation.newElement(item, "path");
path.setText(getStableURL(dobj, object));
//item.addContent(path);
@@ -239,9 +241,9 @@
generateItemXML(item, dobj, object, index);
index++;
- //content.addContent(item);
+ //content.addContent(item);
}
-
+
return content;
}
@@ -300,12 +302,13 @@
// Quasimodo: BEGIN
// Add attributes for date and time
Locale negLocale = com.arsdigita.globalization.GlobalizationHelper.getNegotiatedLocale();
- DateFormat dateFormatter = DateFormat.getDateInstance(
- DateFormat.MEDIUM, negLocale);
- DateFormat timeFormatter = DateFormat.getTimeInstance(
- DateFormat.SHORT, negLocale);
+ DateFormat dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, negLocale);
+ DateFormat longDateFormatter = DateFormat.getDateInstance(DateFormat.LONG, negLocale);
+ DateFormat timeFormatter = DateFormat.getTimeInstance(DateFormat.SHORT, negLocale);
attribute.addAttribute("date", dateFormatter.format(date));
+ attribute.addAttribute("longDate", longDateFormatter.format(date));
attribute.addAttribute("time", timeFormatter.format(date));
+ attribute.addAttribute("monthName", calDate.getDisplayName(Calendar.MONTH, Calendar.LONG, negLocale));
// Quasimodo: END
}
|
|
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] |
|
From: <pb...@fe...> - 2012-12-16 19:10:40
|
Author: pboy
Date: 2012-12-16 19:10:33 +0000 (Sun, 16 Dec 2012)
New Revision: 2385
Modified:
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.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/contenttypes/upgrades/Upgrade664to665.java
Log:
Fixed upgrade scripts (backport part of r2378) (on behalf of JensP).
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java 2012-12-16 19:05:12 UTC (rev 2384)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java 2012-12-16 19:10:33 UTC (rev 2385)
@@ -187,12 +187,12 @@
final StringBuilder attributeValues = new StringBuilder();
for (Map.Entry<String, String> attribute : getAttributes().entrySet()) {
attributeValues.append(",");
- if (attribute.getValue().startsWith("character")) {
- attributeValues.append('\"');
+ if (attribute.getValue().startsWith("character") || attribute.getValue().startsWith("BIT") || attribute.getValue().startsWith("boolean")) {
+ attributeValues.append('\'');
}
attributeValues.append(entry.getAttributes().get(attribute.getKey()));
- if (attribute.getValue().startsWith("character")) {
- attributeValues.append('\"');
+ if (attribute.getValue().startsWith("character") || attribute.getValue().startsWith("BIT") || attribute.getValue().startsWith("boolean")) {
+ attributeValues.append('\'');
}
}
stmt.addBatch(String.format("INSERT INTO %s ("
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:05:12 UTC (rev 2384)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java 2012-12-16 19:10:33 UTC (rev 2385)
@@ -88,14 +88,15 @@
"SELECT parent_id "
+ "FROM cms_items "
+ "JOIN %s "
- + "ON cms_items.item_id = %s.bundle_id",
- getBundleTableName(),
- getBundleTableName()));
+ + "ON cms_items.item_id = %s.%s;",
+ getContentItemTableName(),
+ getContentItemTableName(),
+ getIdColName()));
while (personsRs.next()) {
stmt.addBatch(String.format("INSERT INTO %s (bundle_id) "
+ "VALUES (%d)",
- getBundleClassName(),
+ getBundleTableName(),
personsRs.getInt(1)));
stmt.addBatch(String.format(
"UPDATE acs_objects "
Modified: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 19:05:12 UTC (rev 2384)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 19:10:33 UTC (rev 2385)
@@ -28,9 +28,9 @@
//Reload authoring steps
XMLContentTypeHandler handler = new XMLContentTypeHandler();
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericContact.xml", handler);
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.xml", handler);
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericPerson.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericContact.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericOrganizationalUnit.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericPerson.xml", handler);
}
public static void main(final String[] args) {
|
|
From: <pb...@fe...> - 2012-12-16 19:05:21
|
Author: pboy
Date: 2012-12-16 19:05:12 +0000 (Sun, 16 Dec 2012)
New Revision: 2384
Added:
releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
Modified:
releases/2.0.0/ccm-core/src/com/arsdigita/packaging/Upgrade.java
Log:
Fixed upgrade scripts (backport r2370) (on behalf of JensP).
Added: releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
===================================================================
--- releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java (rev 0)
+++ releases/2.0.0/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 19:05:12 UTC (rev 2384)
@@ -0,0 +1,40 @@
+package com.arsdigita.cms.contenttypes.upgrades;
+
+import com.arsdigita.cms.contenttypes.XMLContentTypeHandler;
+import com.arsdigita.util.cmd.Program;
+import com.arsdigita.xml.XML;
+import org.apache.commons.cli.CommandLine;
+
+/**
+ *
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
+ */
+public class Upgrade664to665 extends Program {
+
+ public Upgrade664to665() {
+ super("Upgrade664to665", "1.0.0", "", true, true);
+ }
+
+ @Override
+ protected void doRun(CommandLine cmdLine) {
+ new CreateContactBundles().doUpgrade();
+ new CreateOrgaUnitBundles().doUpgrade();
+ new CreatePersonBundles().doUpgrade();
+ new GenericContactGenericPersonAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericContactAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericOrgaUnitAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericPersonAssocUpgrade().doUpgrade();
+
+ //Reload authoring steps
+ XMLContentTypeHandler handler = new XMLContentTypeHandler();
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericContact.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericPerson.xml", handler);
+ }
+
+ public static void main(final String[] args) {
+ new Upgrade664to665().run(args);
+ }
+
+}
Modified: releases/2.0.0/ccm-core/src/com/arsdigita/packaging/Upgrade.java
===================================================================
--- releases/2.0.0/ccm-core/src/com/arsdigita/packaging/Upgrade.java 2012-12-16 18:29:36 UTC (rev 2383)
+++ releases/2.0.0/ccm-core/src/com/arsdigita/packaging/Upgrade.java 2012-12-16 19:05:12 UTC (rev 2384)
@@ -55,33 +55,18 @@
private static final Logger logger = Logger.getLogger(Upgrade.class);
private static final Options s_options = getOptions();
-
private String m_from;
private String m_to;
private final List m_scripts;
static {
logger.debug("Static initalizer starting...");
- s_options.addOption
- (OptionBuilder
- .isRequired()
- .hasArg()
- .withLongOpt("from-version")
- .withDescription("Upgrade from version VERSION")
- .create());
- s_options.addOption
- (OptionBuilder
- .isRequired()
- .hasArg()
- .withLongOpt("to-version")
- .withDescription("Upgrade to version VERSION")
- .create());
- s_options.addOption
- (OptionBuilder
- .hasArg()
- .withLongOpt("parameters")
- .withDescription("Parameters to pass to upgrade scripts")
- .create());
+ s_options.addOption(OptionBuilder.isRequired().hasArg().withLongOpt("from-version").withDescription(
+ "Upgrade from version VERSION").create());
+ s_options.addOption(OptionBuilder.isRequired().hasArg().withLongOpt("to-version").withDescription(
+ "Upgrade to version VERSION").create());
+ s_options.addOption(OptionBuilder.hasArg().withLongOpt("parameters").withDescription(
+ "Parameters to pass to upgrade scripts").create());
logger.debug("Static initalizer finished.");
}
@@ -147,8 +132,7 @@
final String spec = key + ".upgrade";
- final InputStream in = Thread.currentThread().getContextClassLoader
- ().getResourceAsStream(spec);
+ final InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(spec);
if (in == null) {
System.err.println("Cannot find " + spec);
@@ -158,20 +142,19 @@
XML.parse(in, new Parser());
if (m_scripts.isEmpty()) {
- System.err.println("No appropriate upgrades found; make sure " +
- "that your 'to' and 'from' versions match " +
- "the intended upgrade exactly");
+ System.err.println("No appropriate upgrades found; make sure " + "that your 'to' and 'from' versions match "
+ + "the intended upgrade exactly");
return false;
} else {
- System.out.println("Number of scripts: " + m_scripts.size() );
+ System.out.println("Number of scripts: " + m_scripts.size());
}
//Iterator iter = m_scripts.iterator();
//while (iter.hasNext()) {
- for(int k = 0; k < m_scripts.size(); k++) {
-
+ for (int k = 0; k < m_scripts.size(); k++) {
+
System.out.printf("Running script %d/%d\n", (k + 1), m_scripts.size());
- final String[] parts = (String[]) m_scripts.get(k); //(String[]) iter.next();
+ final String[] parts = (String[]) m_scripts.get(k); //(String[]) iter.next();
final String classname = parts[0];
final String sql = parts[1];
@@ -185,7 +168,7 @@
try {
method = clacc.getMethod("main",
- new Class[] {String[].class});
+ new Class[]{String[].class});
} catch (NoSuchMethodException nsme) {
throw new UncheckedWrapperException(nsme);
} catch (SecurityException se) {
@@ -196,29 +179,27 @@
LinkedList ll = new LinkedList();
if (params != null) {
for (int i = 0; i < params.length; i++) {
- String[] split = StringUtils.split(params[i],',');
+ String[] split = StringUtils.split(params[i], ',');
for (int j = 0; j < split.length; j++) {
ll.add(split[j]);
}
}
}
- try {
- method.invoke(null, new Object[] {ll.toArray(new String[] {})});
- } catch (IllegalAccessException iae) {
+ try {
+ method.invoke(null, new Object[]{ll.toArray(new String[]{})});
+ } catch (IllegalAccessException iae) {
throw new UncheckedWrapperException(iae);
- } catch (InvocationTargetException ite) {
+ } catch (InvocationTargetException ite) {
throw new UncheckedWrapperException(ite);
}
-
+
} else if (sql != null) {
final SchemaLoader loader = new SchemaLoader(sql);
- System.out.println("Running SQL upgrade " + loader + ", " +
- "loaded from the classpath");
+ System.out.println("Running SQL upgrade " + loader + ", " + "loaded from the classpath");
- final Connection conn = Connections.acquire
- (RuntimeConfig.getConfig().getJDBCURL());
+ final Connection conn = Connections.acquire(RuntimeConfig.getConfig().getJDBCURL());
loader.run(conn);
@@ -229,16 +210,18 @@
}
} else {
throw new IllegalStateException();
- }
+ }
+
}
return true;
}
/**
- *
+ *
*/
private class Parser extends DefaultHandler {
+
private String m_version;
@Override
@@ -266,14 +249,12 @@
final String sql = attrs.getValue(uri, "sql");
if (classname == null && sql == null
- || classname != null && sql != null) {
- throw new IllegalArgumentException
- ("The script element must have a 'class' " +
- "argument or a 'sql' argument; it may not " +
- "have both");
+ || classname != null && sql != null) {
+ throw new IllegalArgumentException("The script element must have a 'class' "
+ + "argument or a 'sql' argument; it may not " + "have both");
}
- m_scripts.add(new String[] {classname, sql});
+ m_scripts.add(new String[]{classname, sql});
}
}
}
@@ -286,5 +267,6 @@
m_version = null;
}
}
+
}
}
|
|
From: <pb...@fe...> - 2012-12-16 18:29:46
|
Author: pboy Date: 2012-12-16 18:29:36 +0000 (Sun, 16 Dec 2012) New Revision: 2383 Removed: trunk/ccm-core/web/assets/mathjax/LICENSE trunk/ccm-core/web/assets/mathjax/MathJax.js trunk/ccm-core/web/assets/mathjax/README-branch.txt trunk/ccm-core/web/assets/mathjax/README.md trunk/ccm-core/web/assets/mathjax/config/ trunk/ccm-core/web/assets/mathjax/docs/ trunk/ccm-core/web/assets/mathjax/extensions/ trunk/ccm-core/web/assets/mathjax/fonts/ trunk/ccm-core/web/assets/mathjax/images/ trunk/ccm-core/web/assets/mathjax/jax/ trunk/ccm-core/web/assets/mathjax/test/ trunk/ccm-core/web/assets/mathjax/unpacked/ Log: Removed expanded mathjax. (on behalf of quasimodo) Deleted: trunk/ccm-core/web/assets/mathjax/LICENSE =================================================================== --- trunk/ccm-core/web/assets/mathjax/LICENSE 2012-12-16 18:26:28 UTC (rev 2382) +++ trunk/ccm-core/web/assets/mathjax/LICENSE 2012-12-16 18:29:36 UTC (rev 2383) @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. Deleted: trunk/ccm-core/web/assets/mathjax/MathJax.js =================================================================== --- trunk/ccm-core/web/assets/mathjax/MathJax.js 2012-12-16 18:26:28 UTC (rev 2382) +++ trunk/ccm-core/web/assets/mathjax/MathJax.js 2012-12-16 18:29:36 UTC (rev 2383) @@ -1,30 +0,0 @@ -/************************************************************* - * - * MathJax.js - * - * The main code for the MathJax math-typesetting library. See - * http://www.mathjax.org/ for details. - * - * --------------------------------------------------------------------- - * - * Copyright (c) 2009-2012 Design Science, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -if (!window.MathJax) {window.MathJax = {}} - -MathJax.isPacked = true; - -if(document.getElementById&&document.childNodes&&document.createElement){if(!window.MathJax){window.MathJax={}}if(!MathJax.Hub){MathJax.version="2.0";MathJax.fileversion="2.0.3";(function(d){var b=window[d];if(!b){b=window[d]={}}var f=[];var c=function(g){var h=g.constructor;if(!h){h=new Function("")}for(var i in g){if(i!=="constructor"&&g.hasOwnProperty(i)){h[i]=g[i]}}return h};var a=function(){return new Function("return arguments.callee.Init.call(this,arguments)")};var e=a();e.prototype={bug_test:1};if(!e.prototype.bug_test){a=function(){return function(){return arguments.callee.Init.call(this,arguments)}}}b.Object=c({constructor:a(),Subclass:function(g,i){var h=a();h.SUPER=this;h.Init=this.Init;h.Subclass=this.Subclass;h.Augment=this.Augment;h.protoFunction=this.protoFunction;h.can=this.can;h.has=this.has;h.isa=this.isa;h.prototype=new this(f);h.prototype.constructor=h;h.Augment(g,i);return h},Init:function(g){var h=this;if(g.length===1&&g[0]===f){return h}if(!(h instanceof g.callee)){h=new g.callee(f)}return h.Init.apply(h,g)||h},Augment:function(g,h){var i;if(g!=null){for(i in g){if(g.hasOwnProperty(i)){this.protoFunction(i,g[i])}}if(g.toString!==this.prototype.toString&&g.toString!=={}.toString){this.protoFunction("toString",g.toString)}}if(h!=null){for(i in h){if(h.hasOwnProperty(i)){this[i]=h[i]}}}return this},protoFunction:function(h,g){this.prototype[h]=g;if(typeof g==="function"){g.SUPER=this.SUPER.prototype}},prototype:{Init:function(){},SUPER:function(g){return g.callee.SUPER},can:function(g){return typeof(this[g])==="function"},has:function(g){return typeof(this[g])!=="undefined"},isa:function(g){return(g instanceof Object)&&(this instanceof g)}},can:function(g){return this.prototype.can.call(this,g)},has:function(g){return this.prototype.has.call(this,g)},isa:function(h){var g=this;while(g){if(g===h){return true}else{g=g.SUPER}}return false},SimpleSUPER:c({constructor:function(g){return this.SimpleSUPER.define(g)},define:function(g){var i={};if(g!=null){for(var h in g){if(g.hasOwnProperty(h)){i[h]=this.wrap(h,g[h])}}if(g.toString!==this.prototype.toString&&g.toString!=={}.toString){i.toString=this.wrap("toString",g.toString)}}return i},wrap:function(i,h){if(typeof(h)==="function"&&h.toString().match(/\.\s*SUPER\s*\(/)){var g=new Function(this.wrapper);g.label=i;g.original=h;h=g;g.toString=this.stringify}return h},wrapper:function(){var h=arguments.callee;this.SUPER=h.SUPER[h.label];try{var g=h.original.apply(this,arguments)}catch(i){delete this.SUPER;throw i}delete this.SUPER;return g}.toString().replace(/^\s*function\s*\(\)\s*\{\s*/i,"").replace(/\s*\}\s*$/i,""),toString:function(){return this.original.toString.apply(this.original,arguments)}})})})("MathJax");(function(BASENAME){var BASE=window[BASENAME];if(!BASE){BASE=window[BASENAME]={}}var CALLBACK=function(data){var cb=new Function("return arguments.callee.execute.apply(arguments.callee,arguments)");for(var id in CALLBACK.prototype){if(CALLBACK.prototype.hasOwnProperty(id)){if(typeof(data[id])!=="undefined"){cb[id]=data[id]}else{cb[id]=CALLBACK.prototype[id]}}}cb.toString=CALLBACK.prototype.toString;return cb};CALLBACK.prototype={isCallback:true,hook:function(){},data:[],object:window,execute:function(){if(!this.called||this.autoReset){this.called=!this.autoReset;return this.hook.apply(this.object,this.data.concat([].slice.call(arguments,0)))}},reset:function(){delete this.called},toString:function(){return this.hook.toString.apply(this.hook,arguments)}};var ISCALLBACK=function(f){return(typeof(f)==="function"&&f.isCallback)};var EVAL=function(code){return eval.call(window,code)};EVAL("var __TeSt_VaR__ = 1");if(window.__TeSt_VaR__){try{delete window.__TeSt_VaR__}catch(error){window.__TeSt_VaR__=null}}else{if(window.execScript){EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";window.execScript(code);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}else{EVAL=function(code){BASE.__code=code;code="try {"+BASENAME+".__result = eval("+BASENAME+".__code)} catch(err) {"+BASENAME+".__result = err}";var head=(document.getElementsByTagName("head"))[0];if(!head){head=document.body}var script=document.createElement("script");script.appendChild(document.createTextNode(code));head.appendChild(script);head.removeChild(script);var result=BASE.__result;delete BASE.__result;delete BASE.__code;if(result instanceof Error){throw result}return result}}}var USING=function(args,i){if(arguments.length>1){if(arguments.length===2&&!(typeof arguments[0]==="function")&&arguments[0] instanceof Object&&typeof arguments[1]==="number"){args=[].slice.call(args,i)}else{args=[].slice.call(arguments,0)}}if(args instanceof Array&&args.length===1){args=args[0]}if(typeof args==="function"){if(args.execute===CALLBACK.prototype.execute){return args}return CALLBACK({hook:args})}else{if(args instanceof Array){if(typeof(args[0])==="string"&&args[1] instanceof Object&&typeof args[1][args[0]]==="function"){return CALLBACK({hook:args[1][args[0]],object:args[1],data:args.slice(2)})}else{if(typeof args[0]==="function"){return CALLBACK({hook:args[0],data:args.slice(1)})}else{if(typeof args[1]==="function"){return CALLBACK({hook:args[1],object:args[0],data:args.slice(2)})}}}}else{if(typeof(args)==="string"){return CALLBACK({hook:EVAL,data:[args]})}else{if(args instanceof Object){return CALLBACK(args)}else{if(typeof(args)==="undefined"){return CALLBACK({})}}}}}throw Error("Can't make callback from given data")};var DELAY=function(time,callback){callback=USING(callback);callback.timeout=setTimeout(callback,time);return callback};var WAITFOR=function(callback,signal){callback=USING(callback);if(!callback.called){WAITSIGNAL(callback,signal);signal.pending++}};var WAITEXECUTE=function(){var signals=this.signal;delete this.signal;this.execute=this.oldExecute;delete this.oldExecute;var result=this.execute.apply(this,arguments);if(ISCALLBACK(result)&&!result.called){WAITSIGNAL(result,signals)}else{for(var i=0,m=signals.length;i<m;i++){signals[i].pending--;if(signals[i].pending<=0){signals[i].call()}}}};var WAITSIGNAL=function(callback,signals){if(!(signals instanceof Array)){signals=[signals]}if(!callback.signal){callback.oldExecute=callback.execute;callback.execute=WAITEXECUTE;callback.signal=signals}else{if(signals.length===1){callback.signal.push(signals[0])}else{callback.signal=callback.signal.concat(signals)}}};var AFTER=function(callback){callback=USING(callback);callback.pending=0;for(var i=1,m=arguments.length;i<m;i++){if(arguments[i]){WAITFOR(arguments[i],callback)}}if(callback.pending===0){var result=callback();if(ISCALLBACK(result)){callback=result}}return callback};var HOOKS=MathJax.Object.Subclass({Init:function(reset){this.hooks=[];this.reset=reset},Add:function(hook,priority){if(priority==null){priority=10}if(!ISCALLBACK(hook)){hook=USING(hook)}hook.priority=priority;var i=this.hooks.length;while(i>0&&priority<this.hooks[i-1].priority){i--}this.hooks.splice(i,0,hook);return hook},Remove:function(hook){for(var i=0,m=this.hooks.length;i<m;i++){if(this.hooks[i]===hook){this.hooks.splice(i,1);return}}},Execute:function(){var callbacks=[{}];for(var i=0,m=this.hooks.length;i<m;i++){if(this.reset){this.hooks[i].reset()}var result=this.hooks[i].apply(window,arguments);if(ISCALLBACK(result)&&!result.called){callbacks.push(result)}}if(callbacks.length===1){return null}if(callbacks.length===2){return callbacks[1]}return AFTER.apply({},callbacks)}});var EXECUTEHOOKS=function(hooks,data,reset){if(!hooks){return null}if(!(hooks instanceof Array)){hooks=[hooks]}if(!(data instanceof Array)){data=(data==null?[]:[data])}var handler=HOOKS(reset);for(var i=0,m=hooks.length;i<m;i++){handler.Add(hooks[i])}return handler.Execute.apply(handler,data)};var QUEUE=BASE.Object.Subclass({Init:function(){this.pending=0;this.running=0;this.queue=[];this.Push.apply(this,arguments)},Push:function(){var callback;for(var i=0,m=arguments.length;i<m;i++){callback=USING(arguments[i]);if(callback===arguments[i]&&!callback.called){callback=USING(["wait",this,callback])}this.queue.push(callback)}if(!this.running&&!this.pending){this.Process()}return callback},Process:function(queue){while(!this.running&&!this.pending&&this.queue.length){var callback=this.queue[0];queue=this.queue.slice(1);this.queue=[];this.Suspend();var result=callback();this.Resume();if(queue.length){this.queue=queue.concat(this.queue)}if(ISCALLBACK(result)&&!result.called){WAITFOR(result,this)}}},Suspend:function(){this.running++},Resume:function(){if(this.running){this.running--}},call:function(){this.Process.apply(this,arguments)},wait:function(callback){return callback}});var SIGNAL=QUEUE.Subclass({Init:function(name){QUEUE.prototype.Init.call(this);this.name=name;this.posted=[];this.listeners=HOOKS(true)},Post:function(message,callback,forget){callback=USING(callback);if(this.posting||this.pending){this.Push(["Post",this,message,callback,forget])}else{this.callback=callback;callback.reset();if(!forget){this.posted.push(message)}this.Suspend();this.posting=true;var result=this.listeners.Execute(message);if(ISCALLBACK(result)&&!result.called){WAITFOR(result,this)}this.Resume();delete this.posting;if(!this.pending){this.call()}}return callback},Clear:function(callback){callback=USING(callback);if(this.posting||this.pending){callback=this.Push(["Clear",this,callback])}else{this.posted=[];callback()}return callback},call:function(){this.callback(this);this.Process()},Interest:function(callback,ignorePast,priority){callback=USING(callback);this.listeners.Add(callback,priority);if(!ignorePast){for(var i=0,m=this.posted.length;i<m;i++){callback.reset();var result=callback(this.posted[i]);if(ISCALLBACK(result)&&i===this.posted.length-1){WAITFOR(result,this)}}}return callback},NoInterest:function(callback){this.listeners.Remove(callback)},MessageHook:function(msg,callback,priority){callback=USING(callback);if(!this.hooks){this.hooks={};this.Interest(["ExecuteHooks",this])}if(!this.hooks[msg]){this.hooks[msg]=HOOKS(true)}this.hooks[msg].Add(callback,priority);for(var i=0,m=this.posted.length;i<m;i++){if(this.posted[i]==msg){callback.reset();callback(this.posted[i])}}return callback},ExecuteHooks:function(msg,more){var type=((msg instanceof Array)?msg[0]:msg);if(!this.hooks[type]){return null}return this.hooks[type].Execute(msg)}},{signals:{},find:function(name){if(!SIGNAL.signals[name]){SIGNAL.signals[name]=new SIGNAL(name)}return SIGNAL.signals[name]}});BASE.Callback=BASE.CallBack=USING;BASE.Callback.Delay=DELAY;BASE.Callback.After=AFTER;BASE.Callback.Queue=QUEUE;BASE.Callback.Signal=SIGNAL.find;BASE.Callback.Hooks=HOOKS;BASE.Callback.ExecuteHooks=EXECUTEHOOKS})("MathJax");(function(d){var a=window[d];if(!a){a=window[d]={}}var c=(navigator.vendor==="Apple Computer, Inc."&&typeof navigator.vendorSub==="undefined");var f=0;var g=function(h){if(document.styleSheets&&document.styleSheets.length>f){f=document.styleSheets.length}if(!h){h=(document.getElementsByTagName("head"))[0];if(!h){h=document.body}}return h};var e=[];var b=function(){for(var j=0,h=e.length;j<h;j++){a.Ajax.head.removeChild(e[j])}e=[]};a.Ajax={loaded:{},loading:{},loadHooks:{},timeout:15*1000,styleDelay:1,config:{root:""},STATUS:{OK:1,ERROR:-1},rootPattern:new RegExp("^\\["+d+"\\]"),fileURL:function(h){return h.replace(this.rootPattern,this.config.root)},Require:function(j,m){m=a.Callback(m);var k;if(j instanceof Object){for(var h in j){}k=h.toUpperCase();j=j[h]}else{k=j.split(/\./).pop().toUpperCase()}j=this.fileURL(j);if(this.loaded[j]){m(this.loaded[j])}else{var l={};l[k]=j;this.Load(l,m)}return m},Load:function(j,l){l=a.Callback(l);var k;if(j instanceof Object){for(var h in j){}k=h.toUpperCase();j=j[h]}else{k=j.split(/\./).pop().toUpperCase()}j=this.fileURL(j);if(this.loading[j]){this.addHook(j,l)}else{this.head=g(this.head);if(this.loader[k]){this.loader[k].call(this,j,l)}else{throw Error("Can't load files of type "+k)}}return l},LoadHook:function(k,l,j){l=a.Callback(l);if(k instanceof Object){for(var h in k){k=k[h]}}k=this.fileURL(k);if(this.loaded[k]){l(this.loaded[k])}else{this.addHook(k,l,j)}return l},addHook:function(i,j,h){if(!this.loadHooks[i]){this.loadHooks[i]=MathJax.Callback.Hooks()}this.loadHooks[i].Add(j,h)},Preloading:function(){for(var k=0,h=arguments.length;k<h;k++){var j=this.fileURL(arguments[k]);if(!this.loading[j]){this.loading[j]={preloaded:true}}}},loader:{JS:function(i,k){var h=document.createElement("script");var j=a.Callback(["loadTimeout",this,i]);this.loading[i]={callback:k,message:a.Message.File(i),timeout:setTimeout(j,this.timeout),status:this.STATUS.OK,script:h};h.onerror=j;h.type="text/javascript";h.src=i;this.head.appendChild(h)},CSS:function(h,j){var i=document.createElement("link");i.rel="stylesheet";i.type="text/css";i.href=h;this.loading[h]={callback:j,message:a.Message.File(h),status:this.STATUS.OK};this.head.appendChild(i);this.timer.create.call(this,[this.timer.file,h],i)}},timer:{create:function(i,h){i=a.Callback(i);if(h.nodeName==="STYLE"&&h.styleSheet&&typeof(h.styleSheet.cssText)!=="undefined"){i(this.STATUS.OK)}else{if(window.chrome&&typeof(window.sessionStorage)!=="undefined"&&h.nodeName==="STYLE"){i(this.STATUS.OK)}else{if(c){this.timer.start(this,[this.timer.checkSafari2,f++,i],this.styleDelay)}else{this.timer.start(this,[this.timer.checkLength,h,i],this.styleDelay)}}}return i},start:function(i,h,j,k){h=a.Callback(h);h.execute=this.execute;h.time=this.time;h.STATUS=i.STATUS;h.timeout=k||i.timeout;h.delay=h.total=0;if(j){setTimeout(h,j)}else{h()}},time:function(h){this.total+=this.delay;this.delay=Math.floor(this.delay*1.05+5);if(this.total>=this.timeout){h(this.STATUS.ERROR);return 1}return 0},file:function(i,h){if(h<0){a.Ajax.loadTimeout(i)}else{a.Ajax.loadComplete(i)}},execute:function(){this.hook.call(this.object,this,this.data[0],this.data[1])},checkSafari2:function(h,i,j){if(h.time(j)){return}if(document.styleSheets.length>i&&document.styleSheets[i].cssRules&&document.styleSheets[i].cssRules.length){j(h.STATUS.OK)}else{setTimeout(h,h.delay)}},checkLength:function(h,k,m){if(h.time(m)){return}var l=0;var i=(k.sheet||k.styleSheet);try{if((i.cssRules||i.rules||[]).length>0){l=1}}catch(j){if(j.message.match(/protected variable|restricted URI/)){l=1}else{if(j.message.match(/Security error/)){l=1}}}if(l){setTimeout(a.Callback([m,h.STATUS.OK]),0)}else{setTimeout(h,h.delay)}}},loadComplete:function(h){h=this.fileURL(h);var i=this.loading[h];if(i&&!i.preloaded){a.Message.Clear(i.message);clearTimeout(i.timeout);if(i.script){if(e.length===0){setTimeout(b,0)}e.push(i.script)}this.loaded[h]=i.status;delete this.loading[h];this.addHook(h,i.callback)}else{if(i){delete this.loading[h]}this.loaded[h]=this.STATUS.OK;i={status:this.STATUS.OK}}if(!this.loadHooks[h]){return null}return this.loadHooks[h].Execute(i.status)},loadTimeout:function(h){if(this.loading[h].timeout){clearTimeout(this.loading[h].timeout)}this.loading[h].status=this.STATUS.ERROR;this.loadError(h);this.loadComplete(h)},loadError:function(h){a.Message.Set("File failed to load: "+h,null,2000);a.Hub.signal.Post(["file load error",h])},Styles:function(j,k){var h=this.StyleString(j);if(h===""){k=a.Callback(k);k()}else{var i=document.createElement("style");i.type="text/css";this.head=g(this.head);this.head.appendChild(i);if(i.styleSheet&&typeof(i.styleSheet.cssText)!=="undefined"){i.styleSheet.cssText=h}else{i.appendChild(document.createTextNode(h))}k=this.timer.create.call(this,k,i)}return k},StyleString:function(m){if(typeof(m)==="string"){return m}var j="",n,l;for(n in m){if(m.hasOwnProperty(n)){if(typeof m[n]==="string"){j+=n+" {"+m[n]+"}\n"}else{if(m[n] instanceof Array){for(var k=0;k<m[n].length;k++){l={};l[n]=m[n][k];j+=this.StyleString(l)}}else{if(n.substr(0,6)==="@media"){j+=n+" {"+this.StyleString(m[n])+"}\n"}else{if(m[n]!=null){l=[];for(var h in m[n]){if(m[n].hasOwnProperty(h)){if(m[n][h]!=null){l[l.length]=h+": "+m[n][h]}}}j+=n+" {"+l.join("; ")+"}\n"}}}}}}return j}}})("MathJax");MathJax.HTML={Element:function(c,e,d){var f=document.createElement(c);if(e){if(e.style){var b=e.style;e.style={};for(var g in b){if(b.hasOwnProperty(g)){e.style[g.replace(/-([a-z])/g,this.ucMatch)]=b[g]}}}MathJax.Hub.Insert(f,e)}if(d){for(var a=0;a<d.length;a++){if(d[a] instanceof Array){f.appendChild(this.Element(d[a][0],d[a][1],d[a][2]))}else{f.appendChild(document.createTextNode(d[a]))}}}return f},ucMatch:function(a,b){return b.toUpperCase()},addElement:function(b,a,d,c){return b.appendChild(this.Element(a,d,c))},TextNode:function(a){return document.createTextNode(a)},addText:function(a,b){return a.appendChild(this.TextNode(b))},setScript:function(a,b){if(this.setScriptBug){a.text=b}else{while(a.firstChild){a.removeChild(a.firstChild)}this.addText(a,b)}},getScript:function(a){var b=(a.text===""?a.innerHTML:a.text);return b.replace(/^\s+/,"").replace(/\s+$/,"")},Cookie:{prefix:"mjx",expires:365,Set:function(a,d){var c=[];if(d){for(var f in d){if(d.hasOwnProperty(f)){c.push(f+":"+d[f].toString().replace(/&/g,"&&"))}}}var b=this.prefix+"."+a+"="+escape(c.join("&;"));if(this.expires){var e=new Date();e.setDate(e.getDate()+this.expires);b+="; expires="+e.toGMTString()}document.cookie=b+"; path=/"},Get:function(c,h){if(!h){h={}}var g=new RegExp("(?:^|;\\s*)"+this.prefix+"\\."+c+"=([^;]*)(?:;|$)");var b=g.exec(document.cookie);if(b&&b[1]!==""){var e=unescape(b[1]).split("&;");for(var d=0,a=e.length;d<a;d++){b=e[d].match(/([^:]+):(.*)/);var f=b[2].replace(/&&/g,"&");if(f==="true"){f=true}else{if(f==="false"){f=false}else{if(f.match(/^-?(\d+(\.\d+)?|\.\d+)$/)){f=parseFloat(f)}}}h[b[1]]=f}}return h}}};MathJax.Message={ready:false,log:[{}],current:null,textNodeBug:(navigator.vendor==="Apple Computer, Inc."&&typeof navigator.vendorSub==="undefined")||(window.hasOwnProperty&&window.hasOwnProperty("konqueror")),styles:{"#MathJax_Message":{position:"fixed",left:"1px",bottom:"2px","background-color":"#E6E6E6",border:"1px solid #959595",margin:"0px",padding:"2px 8px","z-index":"102",color:"black","font-size":"80%",width:"auto","white-space":"nowrap"},"#MathJax_MSIE_Frame":{position:"absolute",top:0,left:0,width:"0px","z-index":101,border:"0px",margin:"0px",padding:"0px"}},browsers:{MSIE:function(a){MathJax.Hub.config.styles["#MathJax_Message"].position="absolute";MathJax.Message.quirks=(document.compatMode==="BackCompat")},Chrome:function(a){MathJax.Hub.config.styles["#MathJax_Message"].bottom="1.5em";MathJax.Hub.config.styles["#MathJax_Message"].left="1em"}},Init:function(a){if(a){this.ready=true}if(!document.body||!this.ready){return false}if(this.div&&this.div.parentNode==null){this.div=document.getElementById("MathJax_Message");if(this.div){this.text=this.div.firstChild}}if(!this.div){var b=document.body;if(MathJax.Hub.Browser.isMSIE){b=this.frame=this.addDiv(document.body);b.removeAttribute("id");b.style.position="absolute";b.style.border=b.style.margin=b.style.padding="0px";b.style.zIndex="101";b.style.height="0px";b=this.addDiv(b);b.id="MathJax_MSIE_Frame";window.attachEvent("onscroll",this.MoveFrame);window.attachEvent("onresize",this.MoveFrame);this.MoveFrame()}this.div=this.addDiv(b);this.div.style.display="none";this.text=this.div.appendChild(document.createTextNode(""))}return true},addDiv:function(a){var b=document.createElement("div");b.id="MathJax_Message";if(a.firstChild){a.insertBefore(b,a.firstChild)}else{a.appendChild(b)}return b},MoveFrame:function(){var a=(MathJax.Message.quirks?document.body:document.documentElement);var b=MathJax.Message.frame;b.style.left=a.scrollLeft+"px";b.style.top=a.scrollTop+"px";b.style.width=a.clientWidth+"px";b=b.firstChild;b.style.height=a.clientHeight+"px"},filterText:function(a,b){if(MathJax.Hub.config.messageStyle==="simple"){if(a.match(/^Loading /)){if(!this.loading){this.loading="Loading "}a=this.loading;this.loading+="."}else{if(a.match(/^Processing /)){if(!this.processing){this.processing="Processing "}a=this.processing;this.processing+="."}else{if(a.match(/^Typesetting /)){if(!this.typesetting){this.typesetting="Typesetting "}a=this.typesetting;this.typesetting+="."}}}}return a},Set:function(b,c,a){if(this.timer){clearTimeout(this.timer);delete this.timeout}if(c==null){c=this.log.length;this.log[c]={}}this.log[c].text=b;this.log[c].filteredText=b=this.filterText(b,c);if(typeof(this.log[c].next)==="undefined"){this.log[c].next=this.current;if(this.current!=null){this.log[this.current].prev=c}this.current=c}if(this.current===c&&MathJax.Hub.config.messageStyle!=="none"){if(this.Init()){if(this.textNodeBug){this.div.innerHTML=b}else{this.text.nodeValue=b}this.div.style.display="";if(this.status){window.status="";delete this.status}}else{window.status=b;this.status=true}}if(a){setTimeout(MathJax.Callback(["Clear",this,c]),a)}else{if(a==0){this.Clear(c,0)}}return c},Clear:function(b,a){if(this.log[b].prev!=null){this.log[this.log[b].prev].next=this.log[b].next}if(this.log[b].next!=null){this.log[this.log[b].next].prev=this.log[b].prev}if(this.current===b){this.current=this.log[b].next;if(this.text){if(this.div.parentNode==null){this.Init()}if(this.current==null){if(this.timer){clearTimeout(this.timer);delete this.timer}if(a==null){a=600}if(a===0){this.Remove()}else{this.timer=setTimeout(MathJax.Callback(["Remove",this]),a)}}else{if(MathJax.Hub.config.messageStyle!=="none"){if(this.textNodeBug){this.div.innerHTML=this.log[this.current].filteredText}else{this.text.nodeValue=this.log[this.current].filteredText}}}if(this.status){window.status="";delete this.status}}else{if(this.status){window.status=(this.current==null?"":this.log[this.current].text)}}}delete this.log[b].next;delete this.log[b].prev;delete this.log[b].filteredText},Remove:function(){this.text.nodeValue="";this.div.style.display="none"},File:function(b){var a=MathJax.Ajax.config.root;if(b.substr(0,a.length)===a){b="[MathJax]"+b.substr(a.length)}return this.Set("Loading "+b)},Log:function(){var b=[];for(var c=1,a=this.log.length;c<a;c++){b[c]=this.log[c].text}return b.join("\n")}};MathJax.Hub={config:{root:"",config:[],styleSheets:[],styles:{".MathJax_Preview":{color:"#888"}},jax:[],extensions:[],preJax:null,postJax:null,displayAlign:"center",displayIndent:"0",preRemoveClass:"MathJax_Preview",showProcessingMessages:true,messageStyle:"normal",delayStartupUntil:"none",skipStartupTypeset:false,"v1.0-compatible":true,elements:[],positionToHash:false,showMathMenu:true,showMathMenuMSIE:true,menuSettings:{zoom:"None",CTRL:false,ALT:false,CMD:false,Shift:false,discoverable:false,zscale:"200%",renderer:"",font:"Auto",context:"MathJax",mpContext:false,mpMouse:false,texHints:true},errorSettings:{message:["[Math Processing Error]"],style:{color:"#CC0000","font-style":"italic"}}},preProcessors:MathJax.Callback.Hooks(true),inputJax:{},outputJax:{order:{}},processUpdateTime:250,processUpdateDelay:10,signal:MathJax.Callback.Signal("Hub"),Config:function(a){this.Insert(this.config,a);if(this.config.Augment){this.Augment(this.config.Augment)}},CombineConfig:function(c,f){var b=this.config,g,e;c=c.split(/\./);for(var d=0,a=c.length;d<a;d++){g=c[d];if(!b[g]){b[g]={}}e=b;b=b[g]}e[g]=b=this.Insert(f,b);return b},Register:{PreProcessor:function(){MathJax.Hub.preProcessors.Add.apply(MathJax.Hub.preProcessors,arguments)},MessageHook:function(){return MathJax.Hub.signal.MessageHook.apply(MathJax.Hub.signal,arguments)},StartupHook:function(){return MathJax.Hub.Startup.signal.MessageHook.apply(MathJax.Hub.Startup.signal,arguments)},LoadHook:function(){return MathJax.Ajax.LoadHook.apply(MathJax.Ajax,arguments)}},getAllJax:function(e){var c=[],b=this.elementScripts(e);for(var d=0,a=b.length;d<a;d++){if(b[d].MathJax&&b[d].MathJax.elementJax){c.push(b[d].MathJax.elementJax)}}return c},getJaxByType:function(f,e){var c=[],b=this.elementScripts(e);for(var d=0,a=b.length;d<a;d++){if(b[d].MathJax&&b[d].MathJax.elementJax&&b[d].MathJax.elementJax.mimeType===f){c.push(b[d].MathJax.elementJax)}}return c},getJaxByInputType:function(f,e){var c=[],b=this.elementScripts(e);for(var d=0,a=b.length;d<a;d++){if(b[d].MathJax&&b[d].MathJax.elementJax&&b[d].type&&b[d].type.replace(/ *;(.|\s)*/,"")===f){c.push(b[d].MathJax.elementJax)}}return c},getJaxFor:function(a){if(typeof(a)==="string"){a=document.getElementById(a)}if(a&&a.MathJax){return a.MathJax.elementJax}if(a&&a.isMathJax){while(a&&!a.jaxID){a=a.parentNode}if(a){return MathJax.OutputJax[a.jaxID].getJaxFromMath(a)}}return null},isJax:function(a){if(typeof(a)==="string"){a=document.getElementById(a)}if(a&&a.isMathJax){return 1}if(a&&a.tagName!=null&&a.tagName.toLowerCase()==="script"){if(a.MathJax){return(a.MathJax.state===MathJax.ElementJax.STATE.PROCESSED?1:-1)}if(a.type&&this.inputJax[a.type.replace(/ *;(.|\s)*/,"")]){return -1}}return 0},setRenderer:function(d,c){if(!d){return}if(!MathJax.OutputJax[d]){this.config.menuSettings.renderer="";var b="[MathJax]/jax/output/"+d+"/config.js";return MathJax.Ajax.Require(b,["setRenderer",this,d,c])}else{this.config.menuSettings.renderer=d;if(c==null){c="jax/mml"}var a=this.outputJax;if(a[c]&&a[c].length){if(d!==a[c][0].id){a[c].unshift(MathJax.OutputJax[d]);return this.signal.Post(["Renderer Selected",d])}}return null}},Queue:function(){return this.queue.Push.apply(this.queue,arguments)},Typeset:function(e,f){if(!MathJax.isReady){return null}var c=this.elementCallback(e,f);var b=MathJax.Callback.Queue();for(var d=0,a=c.elements.length;d<a;d++){if(c.elements[d]){b.Push(["PreProcess",this,c.elements[d]],["Process",this,c.elements[d]])}}return b.Push(c.callback)},PreProcess:function(e,f){var c=this.elementCallback(e,f);var b=MathJax.Callback.Queue();for(var d=0,a=c.elements.length;d<a;d++){if(c.elements[d]){b.Push(["Post",this.signal,["Begin PreProcess",c.elements[d]]],(arguments.callee.disabled?{}:["Execute",this.preProcessors,c.elements[d]]),["Post",this.signal,["End PreProcess",c.elements[d]]])}}return b.Push(c.callback)},Process:function(a,b){return this.takeAction("Process",a,b)},Update:function(a,b){return this.takeAction("Update",a,b)},Reprocess:function(a,b){return this.takeAction("Reprocess",a,b)},Rerender:function(a,b){return this.takeAction("Rerender",a,b)},takeAction:function(g,e,h){var c=this.elementCallback(e,h);var b=MathJax.Callback.Queue(["Clear",this.signal]);for(var d=0,a=c.elements.length;d<a;d++){if(c.elements[d]){var f={scripts:[],start:new Date().getTime(),i:0,j:0,jax:{},jaxIDs:[]};b.Push(["Post",this.signal,["Begin "+g,c.elements[d]]],["Post",this.signal,["Begin Math",c.elements[d],g]],["prepareScripts",this,g,c.elements[d],f],["Post",this.signal,["Begin Math Input",c.elements[d],g]],["processInput",this,f],["Post",this.signal,["End Math Input",c.elements[d],g]],["prepareOutput",this,f,"preProcess"],["Post",this.signal,["Begin Math Output",c.elements[d],g]],["processOutput",this,f],["Post",this.signal,["End Math Output",c.elements[d],g]],["prepareOutput",this,f,"postProcess"],["Post",this.signal,["End Math",c.elements[d],g]],["Post",this.signal,["End "+g,c.elements[d]]])}}return b.Push(c.callback)},scriptAction:{Process:function(a){},Update:function(b){var a=b.MathJax.elementJax;if(a&&a.needsUpdate()){a.Remove(true);b.MathJax.state=a.STATE.UPDATE}else{b.MathJax.state=a.STATE.PROCESSED}},Reprocess:function(b){var a=b.MathJax.elementJax;if(a){a.Remove(true);b.MathJax.state=a.STATE.UPDATE}},Rerender:function(b){var a=b.MathJax.elementJax;if(a){a.Remove(true);b.MathJax.state=a.STATE.OUTPUT}}},prepareScripts:function(h,e,g){if(arguments.callee.disabled){return}var b=this.elementScripts(e);var f=MathJax.ElementJax.STATE;for(var d=0,a=b.length;d<a;d++){var c=b[d];if(c.type&&this.inputJax[c.type.replace(/ *;(.|\n)*/,"")]){if(c.MathJax){if(c.MathJax.elementJax&&c.MathJax.elementJax.hover){MathJax.Extension.MathEvents.Hover.ClearHover(c.MathJax.elementJax)}if(c.MathJax.state!==f.PENDING){this.scriptAction[h](c)}}if(!c.MathJax){c.MathJax={state:f.PENDING}}if(c.MathJax.state!==f.PROCESSED){g.scripts.push(c)}}}},checkScriptSiblings:function(a){if(a.MathJax.checked){return}var b=this.config,f=a.previousSibling;if(f&&f.nodeName==="#text"){var d,e,c=a.nextSibling;if(c&&c.nodeName!=="#text"){c=null}if(b.preJax){if(typeof(b.preJax)==="string"){b.preJax=new RegExp(b.preJax+"$")}d=f.nodeValue.match(b.preJax)}if(b.postJax&&c){if(typeof(b.postJax)==="string"){b.postJax=new RegExp("^"+b.postJax)}e=c.nodeValue.match(b.postJax)}if(d&&(!b.postJax||e)){f.nodeValue=f.nodeValue.replace(b.preJax,(d.length>1?d[1]:""));f=null}if(e&&(!b.preJax||d)){c.nodeValue=c.nodeValue.replace(b.postJax,(e.length>1?e[1]:""))}if(f&&!f.nodeValue.match(/\S/)){f=f.previousSibling}}if(b.preRemoveClass&&f&&f.className===b.preRemoveClass){a.MathJax.preview=f}a.MathJax.checked=1},processInput:function(a){var b,i=MathJax.ElementJax.STATE;var h,e,d=a.scripts.length;try{while(a.i<d){h=a.scripts[a.i];if(!h){a.i++;continue}e=h.previousSibling;if(e&&e.className==="MathJax_Error"){e.parentNode.removeChild(e)}if(!h.MathJax||h.MathJax.state===i.PROCESSED){a.i++;continue}if(!h.MathJax.elementJax||h.MathJax.state===i.UPDATE){this.checkScriptSiblings(h);var g=h.type.replace(/ *;(.|\s)*/,"");b=this.inputJax[g].Process(h,a);if(typeof b==="function"){if(b.called){continue}this.RestartAfter(b)}b.Attach(h,this.inputJax[g].id);this.saveScript(b,a,h,i)}else{if(h.MathJax.state===i.OUTPUT){this.saveScript(h.MathJax.elementJax,a,h,i)}}a.i++;var c=new Date().getTime();if(c-a.start>this.processUpdateTime&&a.i<a.scripts.length){a.start=c;this.RestartAfter(MathJax.Callback.Delay(1))}}}catch(f){return this.processError(f,a,"Input")}if(a.scripts.length&&this.config.showProcessingMessages){MathJax.Message.Set("Processing math: 100%",0)}a.start=new Date().getTime();a.i=a.j=0;return null},saveScript:function(a,d,b,c){if(!this.outputJax[a.mimeType]){b.MathJax.state=c.UPDATE;throw Error("No output jax registered for "+a.mimeType)}a.outputJax=this.outputJax[a.mimeType][0].id;if(!d.jax[a.outputJax]){if(d.jaxIDs.length===0){d.jax[a.outputJax]=d.scripts}else{if(d.jaxIDs.length===1){d.jax[d.jaxIDs[0]]=d.scripts.slice(0,d.i)}d.jax[a.outputJax]=[]}d.jaxIDs.push(a.outputJax)}if(d.jaxIDs.length>1){d.jax[a.outputJax].push(b)}b.MathJax.state=c.OUTPUT},prepareOutput:function(c,f){while(c.j<c.jaxIDs.length){var e=c.jaxIDs[c.j],d=MathJax.OutputJax[e];if(d[f]){try{var a=d[f](c);if(typeof a==="function"){if(a.called){continue}this.RestartAfter(a)}}catch(b){if(!b.restart){MathJax.Message.Set("Error preparing "+e+" output ("+f+")",null,600);MathJax.Hub.lastPrepError=b;c.j++}return MathJax.Callback.After(["prepareOutput",this,c,f],b.restart)}}c.j++}return null},processOutput:function(h){var b,g=MathJax.ElementJax.STATE,d,a=h.scripts.length;try{while(h.i<a){d=h.scripts[h.i];if(!d||!d.MathJax){h.i++;continue}var c=d.MathJax.elementJax;if(!c){h.i++;continue}b=MathJax.OutputJax[c.outputJax].Process(d,h);d.MathJax.state=g.PROCESSED;h.i++;if(d.MathJax.preview){d.MathJax.preview.innerHTML=""}this.signal.Post(["New Math",c.inputID]);var e=new Date().getTime();if(e-h.start>this.processUpdateTime&&h.i<h.scripts.length){h.start=e;this.RestartAfter(MathJax.Callback.Delay(this.processUpdateDelay))}}}catch(f){return this.processError(f,h,"Output")}if(h.scripts.length&&this.config.showProcessingMessages){MathJax.Message.Set("Typesetting math: 100%",0);MathJax.Message.Clear(0)}h.i=h.j=0;return null},processMessage:function(d,b){var a=Math.floor(d.i/(d.scripts.length)*100);var c=(b==="Output"?"Typesetting":"Processing");if(this.config.showProcessingMessages){MathJax.Message.Set(c+" math: "+a+"%",0)}},processError:function(b,c,a){if(!b.restart){if(!this.config.errorSettings.message){throw b}this.formatError(c.scripts[c.i],b);c.i++}this.processMessage(c,a);return MathJax.Callback.After(["process"+a,this,c],b.restart)},formatError:function(a,c){var b=MathJax.HTML.Element("span",{className:"MathJax_Error"},this.config.errorSettings.message);b.jaxID="Error";if(MathJax.Extension.MathEvents){b.oncontextmenu=MathJax.Extension.MathEvents.Event.Menu;b.onmousedown=MathJax.Extension.MathEvents.Event.Mousedown}else{MathJax.Ajax.Require("[MathJax]/extensions/MathEvents.js",function(){b.oncontextmenu=MathJax.Extension.MathEvents.Event.Menu;b.onmousedown=MathJax.Extension.MathEvents.Event.Mousedown})}a.parentNode.insertBefore(b,a);if(a.MathJax.preview){a.MathJax.preview.innerHTML=""}this.lastError=c},RestartAfter:function(a){throw this.Insert(Error("restart"),{restart:MathJax.Callback(a)})},elementCallback:function(c,f){if(f==null&&(c instanceof Array||typeof c==="function")){try{MathJax.Callback(c);f=c;c=null}catch(d){}}if(c==null){c=this.config.elements||[]}if(!(c instanceof Array)){c=[c]}c=[].concat(c);for(var b=0,a=c.length;b<a;b++){if(typeof(c[b])==="string"){c[b]=document.getElementById(c[b])}}if(c.length==0){c.push(document.body)}if(!f){f={}}return{elements:c,callback:f}},elementScripts:function(a){if(typeof(a)==="string"){a=document.getElementById(a)}if(a==null){a=document.body}if(a.tagName!=null&&a.tagName.toLowerCase()==="script"){return[a]}return a.getElementsByTagName("script")},Insert:function(c,a){for(var b in a){if(a.hasOwnProperty(b)){if(typeof a[b]==="object"&&!(a[b] instanceof Array)&&(typeof c[b]==="object"||typeof c[b]==="function")){this.Insert(c[b],a[b])}else{c[b]=a[b]}}}return c}};MathJax.Hub.Insert(MathJax.Hub.config.styles,MathJax.Message.styles);MathJax.Hub.Insert(MathJax.Hub.config.styles,{".MathJax_Error":MathJax.Hub.config.errorSettings.style});MathJax.Extension={};MathJax.Hub.Configured=MathJax.Callback({});MathJax.Hub.Startup={script:"",queue:MathJax.Callback.Queue(),signal:MathJax.Callback.Signal("Startup"),params:{},Config:function(){this.queue.Push(["Post",this.signal,"Begin Config"]);var b=MathJax.HTML.Cookie.Get("user");if(b.URL||b.Config){if(confirm("MathJax has found a user-configuration cookie that includes code to be run. Do you want to run it?\n\n(You should press Cancel unless you set up the cookie yourself.)")){if(b.URL){this.queue.Push(["Require",MathJax.Ajax,b.URL])}if(b.Config){this.queue.Push(new Function(b.Config))}}else{MathJax.HTML.Cookie.Set("user",{})}}if(this.params.config){var d=this.params.config.split(/,/);for(var c=0,a=d.length;c<a;c++){if(!d[c].match(/\.js$/)){d[c]+=".js"}this.queue.Push(["Require",MathJax.Ajax,this.URL("config",d[c])])}}if(this.script.match(/\S/)){this.queue.Push(this.script+";\n1;")}this.queue.Push(["ConfigDelay",this],["ConfigBlocks",this],["ConfigDefault",this],[function(e){return e.loadArray(MathJax.Hub.config.config,"config",null,true)},this],["Post",this.signal,"End Config"])},ConfigDelay:function(){var a=this.params.delayStartupUntil||MathJax.Hub.config.delayStartupUntil;if(a==="onload"){return this.onload}if(a==="configured"){return MathJax.Hub.Configured}return a},ConfigBlocks:function(){var c=document.getElementsByTagName("script");var f=null,b=MathJax.Callback.Queue();for(var d=0,a=c.length;d<a;d++){var e=String(c[d].type).replace(/ /g,"");if(e.match(/^text\/x-mathjax-config(;.*)?$/)&&!e.match(/;executed=true/)){c[d].type+=";executed=true";f=b.Push(c[d].innerHTML+";\n1;")}}return f},ConfigDefault:function(){var a=MathJax.Hub.config;if(a["v1.0-compatible"]&&(a.jax||[]).length===0&&!this.params.config&&(a.config||[]).length===0){return MathJax.Ajax.Require(this.URL("extensions","v1.0-warning.js"))}},Cookie:function(){return this.queue.Push(["Post",this.signal,"Begin Cookie"],["Get",MathJax.HTML.Cookie,"menu",MathJax.Hub.config.menuSettings],[function(d){var f=d.menuSettings.renderer,b=d.jax;if(f){var c="output/"+f;b.sort();for(var e=0,a=b.length;e<a;e++){if(b[e].substr(0,7)==="output/"){break}}if(e==a-1){b.pop()}else{while(e<a){if(b[e]===c){b.splice(e,1);break}e++}}b.unshift(c)}},MathJax.Hub.config],["Post",this.signal,"End Cookie"])},Styles:function(){return this.queue.Push(["Post",this.signal,"Begin Styles"],["loadArray",this,MathJax.Hub.config.styleSheets,"config"],["Styles",MathJax.Ajax,MathJax.Hub.config.styles],["Post",this.signal,"End Styles"])},Jax:function(){var f=MathJax.Hub.config,c=MathJax.Hub.outputJax;for(var g=0,b=f.jax.length,d=0;g<b;g++){var e=f.jax[g].substr(7);if(f.jax[g].substr(0,7)==="output/"&&c.order[e]==null){c.order[e]=d;d++}}var a=MathJax.Callback.Queue();return a.Push(["Post",this.signal,"Begin Jax"],["loadArray",this,f.jax,"jax","config.js"],["Post",this.signal,"End Jax"])},Extensions:function(){var a=MathJax.Callback.Queue();return a.Push(["Post",this.signal,"Begin Extensions"],["loadArray",this,MathJax.Hub.config.extensions,"extensions"],["Post",this.signal,"End Extensions"])},Message:function(){MathJax.Message.Init(true)},Menu:function(){var b=MathJax.Hub.config.menuSettings,a=MathJax.Hub.outputJax,d;for(var c in a){if(a.hasOwnProperty(c)){if(a[c].length){d=a[c];break}}}if(d&&d.length){if(b.renderer&&b.renderer!==d[0].id){d.unshift(MathJax.OutputJax[b.renderer])}b.renderer=d[0].id}},Hash:function(){if(MathJax.Hub.config.positionToHash&&document.location.hash){setTimeout("document.location = document.location.hash",1)}},MenuZoom:function(){if(!MathJax.Extension.MathMenu){setTimeout(MathJax.Callback(["Require",MathJax.Ajax,"[MathJax]/extensions/MathMenu.js",{}]),1000)}if(!MathJax.Extension.MathZoom){setTimeout(MathJax.Callback(["Require",MathJax.Ajax,"[MathJax]/extensions/MathZoom.js",{}]),2000)}},onLoad:function(a){var b=this.onload=MathJax.Callback(function(){MathJax.Hub.Startup.signal.Post("onLoad")});if(document.body&&document.readyState&&document.readyState!=="loading"){return[b]}if(window.addEventListener){window.addEventListener("load",b,false);if(!this.params.noDOMContentEvent){window.addEventListener("DOMContentLoaded",b,false)}}else{if(window.attachEvent){window.attachEvent("onload",b)}else{window.onload=b}}return b},Typeset:function(a,b){if(MathJax.Hub.config.skipStartupTypeset){return function(){}}return this.queue.Push(["Post",this.signal,"Begin Typeset"],["Typeset",MathJax.Hub,a,b],["Post",this.signal,"End Typeset"])},URL:function(b,a){if(!a.match(/^([a-z]+:\/\/|\[|\/)/)){a="[MathJax]/"+b+"/"+a}return a},loadArray:function(b,f,c,a){if(b){if(!(b instanceof Array)){b=[b]}if(b.length){var h=MathJax.Callback.Queue(),j={},e;for(var g=0,d=b.length;g<d;g++){e=this.URL(f,b[g]);if(c){e+="/"+c}if(a){h.Push(["Require",MathJax.Ajax,e,j])}else{h.Push(MathJax.Ajax.Require(e,j))}}return h.Push({})}}return null}};(function(d){var b=window[d],e="["+d+"]";var c=b.Hub,a=b.Ajax,f=b.Callback;var g=MathJax.Object.Subclass({JAXFILE:"jax.js",require:null,config:{},Init:function(i,h){if(arguments.length===0){return this}return(this.constructor.Subclass(i,h))()},Augment:function(k,j){var i=this.constructor,h={};if(k!=null){for(var l in k){if(k.hasOwnProperty(l)){if(typeof k[l]==="function"){i.protoFunction(l,k[l])}else{h[l]=k[l]}}}if(k.toString!==i.prototype.toString&&k.toString!=={}.toString){i.protoFunction("toString",k.toString)}}c.Insert(i.prototype,h);i.Augment(null,j);return this},Translate:function(h,i){throw Error(this.directory+"/"+this.JAXFILE+" failed to define the Translate() method")},Register:function(h){},Config:function(){this.config=c.CombineConfig(this.id,this.config);if(this.config.Augment){this.Augment(this.config.Augment)}},Startup:function(){},loadComplete:function(i){if(i==="config.js"){return a.loadComplete(this.directory+"/"+i)}else{var h=f.Queue();h.Push(c.Register.StartupHook("End Config",{}),["Post",c.Startup.signal,this.id+" Jax Config"],["Config",this],["Post",c.Startup.signal,this.id+" Jax Require"],[function(j){return MathJax.Hub.Startup.loadArray(j.require,this.directory)},this],[function(j,k){return MathJax.Hub.Startup.loadArray(j.extensions,"extensions/"+k)},this.config||{},this.id],["Post",c.Startup.signal,this.id+" Jax Startup"],["Startup",this],["Post",c.Startup.signal,this.id+" Jax Ready"]);if(this.copyTranslate){h.Push([function(j){j.preProcess=j.preTranslate;j.Process=j.Translate;j.postProcess=j.postTranslate},this.constructor.prototype])}return h.Push(["loadComplete",a,this.directory+"/"+i])}}},{id:"Jax",version:"2.0",directory:e+"/jax",extensionDir:e+"/extensions"});b.InputJax=g.Subclass({elementJax:"mml",copyTranslate:true,Process:function(l,q){var j=f.Queue(),o;var k=this.elementJax;if(!(k instanceof Array)){k=[k]}for(var n=0,h=k.length;n<h;n++){o=b.ElementJax.directory+"/"+k[n]+"/"+this.JAXFILE;if(!this.require){this.require=[]}else{if(!(this.require instanceof Array)){this.require=[this.require]}}this.require.push(o);j.Push(a.Require(o))}o=this.directory+"/"+this.JAXFILE;var p=j.Push(a.Require(o));if(!p.called){this.constructor.prototype.Process=function(){if(!p.called){return p}throw Error(o+" failed to load properly")}}k=c.outputJax["jax/"+k[0]];if(k){j.Push(a.Require(k[0].directory+"/"+this.JAXFILE))}return j.Push({})},needsUpdate:function(h){var i=h.SourceElement();return(h.originalText!==b.HTML.getScript(i))},Register:function(h){if(!c.inputJax){c.inputJax={}}c.inputJax[h]=this}},{id:"InputJax",version:"2.0",directory:g.directory+"/input",extensionDir:g.extensionDir});b.OutputJax=g.Subclass({copyTranslate:true,preProcess:function(j){var i,h=this.directory+"/"+this.JAXFILE;this.constructor.prototype.preProcess=function(k){if(!i.called){return i}throw Error(h+" failed to load properly")};i=a.Require(h);return i},Register:function(i){var h=c.outputJax;if(!h[i]){h[i]=[]}if(h[i].length&&(this.id===c.config.menuSettings.renderer||(h.order[this.id]||0)<(h.order[h[i][0].id]||0))){h[i].unshift(this)}else{h[i].push(this)}if(!this.require){this.require=[]}else{if(!(this.require instanceof Array)){this.require=[this.require]}}this.require.push(b.ElementJax.directory+"/"+(i.split(/\//)[1])+"/"+this.JAXFILE)},Remove:function(h){}},{id:"OutputJax",version:"2.0",directory:g.directory+"/output",extensionDir:g.extensionDir,fontDir:e+(b.isPacked?"":"/..")+"/fonts",imageDir:e+(b.isPacked?"":"/..")+"/images"});b.ElementJax=g.Subclass({Init:function(i,h){return this.constructor.Subclass(i,h)},inputJax:null,outputJax:null,inputID:null,originalText:"",mimeType:"",Text:function(i,j){var h=this.SourceElement();b.HTML.setScript(h,i);h.MathJax.state=this.STATE.UPDATE;return c.Update(h,j)},Reprocess:function(i){var h=this.SourceElement();h.MathJax.state=this.STATE.UPDATE;return c.Reprocess(h,i)},Update:function(h){return this.Rerender(h)},Rerender:function(i){var h=this.SourceElement();h.MathJax.state=this.STATE.OUTPUT;return c.Process(h,i)},Remove:function(h){if(this.hover){this.hover.clear(this)}b.OutputJax[this.outputJax].Remove(this);if(!h){c.signal.Post(["Remove Math",this.inputID]);this.Detach()}},needsUpdate:function(){return b.InputJax[this.inputJax].needsUpdate(this)},SourceElement:function(){return document.getElementById(this.inputID)},Attach:function(i,j){var h=i.MathJax.elementJax;if(i.MathJax.state===this.STATE.UPDATE){h.Clone(this)}else{h=i.MathJax.elementJax=this;if(i.id){this.inputID=i.id}else{i.id=this.inputID=b.ElementJax.GetID();this.newID=1}}h.originalText=b.HTML.getScript(i);h.inputJax=j;if(h.root){h.root.inputID=h.inputID}return h},Detach:function(){var h=this.SourceElement();if(!h){return}try{delete h.MathJax}catch(i){h.MathJax=null}if(this.newID){h.id=""}},Clone:function(h){var i;for(i in this){if(!this.hasOwnProperty(i)){continue}if(typeof(h[i])==="undefined"&&i!=="newID"){delete this[i]}}for(i in h){if(!h.hasOwnProperty(i)){continue}if(typeof(this[i])==="undefined"||(this[i]!==h[i]&&i!=="inputID")){this[i]=h[i]}}}},{id:"ElementJax",version:"2.0",directory:g.directory+"/element",extensionDir:g.extensionDir,ID:0,STATE:{PENDING:1,PROCESSED:2,UPDATE:3,OUTPUT:4},GetID:function(){this.ID++;return"MathJax-Element-"+this.ID},Subclass:function(){var h=g.Subclass.apply(this,arguments);h.loadComplete=this.prototype.loadComplete;return h}});b.ElementJax.prototype.STATE=b.ElementJax.STATE;b.OutputJax.Error={id:"Error",version:"2.0",config:{},ContextMenu:function(){return b.Extension.MathEvents.Event.ContextMenu.apply(b.Extension.MathEvents.Event,arguments)},Mousedown:function(){return b.Extension.MathEvents.Event.AltContextMenu.apply(b.Extension.MathEvents.Event,arguments)},getJaxFromMath:function(){return{inputJax:"Error",outputJax:"Error",originalText:"Math Processing Error"}}};b.InputJax.Error={id:"Error",version:"2.0",config:{},sourceMenuTitle:"Error Message"}})("MathJax");(function(l){var f=window[l];if(!f){f=window[l]={}}var c=f.Hub;var q=c.Startup;var u=c.config;var e=document.getElementsByTagName("head")[0];if(!e){e=document.childNodes[0]}var b=(document.documentElement||document).getElementsByTagName("script");var d=new RegExp("(^|/)"+l+"\\.js(\\?.*)?$");for(var o=b.length-1;o>=0;o--){if(b[o].src.match(d)){q.script=b[o].innerHTML;if(RegExp.$2){var r=RegExp.$2.substr(1).split(/\&/);for(var n=0,h=r.length;n<h;n++){var k=r[n].match(/(.*)=(.*)/);if(k){q.params[unescape(k[1])]=unescape(k[2])}}}u.root=b[o].src.replace(/(^|\/)[^\/]*(\?.*)?$/,"");break}}f.Ajax.config=u;var a={isMac:(navigator.platform.substr(0,3)==="Mac"),isPC:(navigator.platform.substr(0,3)==="Win"),isMSIE:(window.ActiveXObject!=null&&window.clipboardData!=null),isFirefox:(window.netscape!=null&&document.ATTRIBUTE_NODE!=null&&!window.opera),isSafari:(navigator.userAgent.match(/ (Apple)?WebKit\//)!=null&&(!window.chrome||window.chrome.loadTimes==null)),isChrome:(window.chrome!=null&&window.chrome.loadTimes!=null),isOpera:(window.opera!=null&&window.opera.version!=null),isKonqueror:(window.hasOwnProperty&&window.hasOwnProperty("konqueror")&&navigator.vendor=="KDE"),versionAtLeast:function(x){var w=(this.version).split(".");x=(new String(x)).split(".");for(var y=0,j=x.length;y<j;y++){if(w[y]!=x[y]){return parseInt(w[y]||"0")>=parseInt(x[y])}}return true},Select:function(j){var i=j[c.Browser];if(i){return i(c.Browser)}return null}};var g=navigator.userAgent.replace(/^Mozilla\/(\d+\.)+\d+ /,"").replace(/[a-z][-a-z0-9._: ]+\/\d+[^ ]*-[^ ]*\.([a-z][a-z])?\d+ /i,"").replace(/Gentoo |Ubuntu\/(\d+\.)*\d+ (\([^)]*\) )?/,"");c.Browser=c.Insert(c.Insert(new String("Unknown"),{version:"0.0"}),a);for(var t in a){if(a.hasOwnProperty(t)){if(a[t]&&t.substr(0,2)==="is"){t=t.slice(2);if(t==="Mac"||t==="PC"){continue}c.Browser=c.Insert(new String(t),a);var p=new RegExp(".*(Version)/((?:\\d+\\.)+\\d+)|.*("+t+")"+(t=="MSIE"?" ":"/")+"((?:\\d+\\.)*\\d+)|(?:^|\\(| )([a-z][-a-z0-9._: ]+|(?:Apple)?WebKit)/((?:\\d+\\.)+\\d+)");var s=p.exec(g)||["","","","unknown","0.0"];c.Browser.name=(s[1]=="Version"?t:(s[3]||s[5]));c.Browser.version=s[2]||s[4]||s[6];break}}}c.Browser.Select({Safari:function(j){var i=parseInt((String(j.version).split("."))[0]);if(i>85){j.webkit=j.version}if(i>=534){j.version="5.1"}else{if(i>=533){j.version="5.0"}else{if(i>=526){j.version="4.0"}else{if(i>=525){j.version="3.1"}else{if(i>500){j.version="3.0"}else{if(i>400){j.version="2.0"}else{if(i>85){j.version="1.0"}}}}}}}j.isMobile=(navigator.appVersion.match(/Mobile/i)!=null);j.noContextMenu=j.isMobile},Firefox:function(j){if((j.version==="0.0"||navigator.userAgent.match(/Firefox/)==null)&&navigato... [truncated message content] |
|
From: <pb...@fe...> - 2012-12-16 18:26:40
|
Author: pboy
Date: 2012-12-16 18:26:28 +0000 (Sun, 16 Dec 2012)
New Revision: 2382
Added:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java
Removed:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
Modified:
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java
trunk/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java
trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java
trunk/ccm-core/src/com/arsdigita/dispatcher/DispatcherConfig.java
trunk/ccm-core/src/com/arsdigita/kernel/security/SecurityConfig.java
Log:
Fixed various formattings, added documentation, code consolidation.
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ContenttypesResources_de.properties 2012-12-16 18:26:28 UTC (rev 2382)
@@ -15,7 +15,7 @@
cms.contenttypes.ui.person.surname=Nachname
cms.contenttypes.ui.person.givenname=Vorname
cms.contenttypes.ui.person.titlepre=Titel
-cms.contenttypes.ui.person.titlepost=Namesanhang
+cms.contenttypes.ui.person.titlepost=Namensanhang
cms.contenttypes.ui.person.birthdate=Geburtstag
cms.contenttypes.ui.person.description=Beschreibung
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -55,7 +55,8 @@
"cms.contenttypes.ui.person.alias.select").localize()));
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
- "com.arsdigita.cms.contenttypes.GenericPerson"));
+ "com.arsdigita.cms.contenttypes.GenericPerson"));
+ itemSearch.setEditAfterCreate(false);
add(itemSearch);
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactAddForm.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -134,6 +134,7 @@
person.addContact(contact,
(String) data.get(
GenericPersonContactCollection.CONTACTS_KEY));
+ m_itemSearch.publishCreatedItem(data, contact);
}
init(fse);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -34,7 +34,6 @@
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Service;
-import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.mimetypes.MimeType;
@@ -62,6 +61,7 @@
* </code></pre></blockquote>
*
* @author Stanislav Freidin
+ * @author Sören Bernstein (quasimodo) <sbe...@qu...>
* @version $Id$
*/
public class ImageBrowser extends Table {
@@ -80,7 +80,7 @@
private static final Logger s_log = Logger.getLogger(ImageBrowser.class);
/**
- * Construct a new ImageBrowser
+ * Construct a new ImageBrowser with default mode.
*
* @param builder the {@link ImageBrowserModelBuilder} that will supply this
* component with its {@link ImageBrowserModel} during each request
@@ -90,6 +90,13 @@
this(b, ImageComponent.ATTACH_IMAGE);
}
+ /**
+ * Construct a new ImageBrowser with requested mode.
+ *
+ * @param builder the {@link ImageBrowserModelBuilder} that will supply this
+ * component with its {@link ImageBrowserModel} during each request
+ * @param mode the component mode (see {@link ImageComponent})
+ */
public ImageBrowser(ImageBrowserModelBuilder b, int mode) {
super(new BuilderAdapter(b), HEADERS);
m_mode = mode;
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -1,6 +1,5 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ *
*/
package com.arsdigita.cms.ui;
@@ -11,11 +10,18 @@
import com.arsdigita.cms.ReusableImageAsset;
/**
- *
+ * Interface for ImageCompnents.
+ *
+ * All components for image handling (like {@link ImageLibraryComponent} or
+ * {@link ImageUploadComponent}) should implement this interface.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public interface ImageComponent {
+ /**
+ * The modes
+ */
public static final int DISPLAY_ONLY = 0;
public static final int SELECT_IMAGE = 1;
public static final int ATTACH_IMAGE = 2;
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -18,7 +18,13 @@
import org.apache.log4j.Logger;
/**
- *
+ * An abstract listener for {@link ImageComponent}.
+ *
+ * This listener provides the base implementation which is shared between all
+ * listeners of this kind.
+ *
+ * This listerner is used by {@link ImageSelectPage}.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener {
@@ -39,6 +45,13 @@
}
}
+ /**
+ * Call {@link #cancelled(com.arsdigita.bebop.PageState)} if the cancel button
+ * was pressed.
+ *
+ * @param event the {@link FormSectionEvent}
+ * @throws FormProcessException
+ */
public void submitted(FormSectionEvent event) throws FormProcessException {
PageState ps = event.getPageState();
ImageComponent component = getImageComponent(ps);
@@ -48,6 +61,13 @@
}
}
+ /**
+ * Call {@link #processImage(com.arsdigita.bebop.event.FormSectionEvent, com.arsdigita.bebop.PageState, com.arsdigita.cms.ui.ImageComponent, com.arsdigita.cms.ReusableImageAsset) }
+ * if the save button was pressed.
+ *
+ * @param event the {@link FormSectionEvent}
+ * @throws FormProcessException
+ */
public void process(FormSectionEvent event) throws FormProcessException {
PageState ps = event.getPageState();
ImageComponent component = getImageComponent(ps);
@@ -62,8 +82,21 @@
}
+ /**
+ * To be overridden by child if neccessary.
+ *
+ * @param ps
+ */
protected void cancelled(PageState ps) {};
+ /**
+ * Process the input.
+ *
+ * @param event the {@link FormSectionEvent}
+ * @param ps {@link PageState}
+ * @param component an {@link ImageComponent}
+ * @param image the {@link ReusableImageAsset}
+ */
protected abstract void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image);
protected ImageComponent getImageComponent(PageState ps) {
@@ -80,6 +113,12 @@
}
+ /**
+ * Sets the active component
+ *
+ * @param ps Page state
+ * @param activeKey the key of the active component
+ */
protected void setImageComponent(PageState ps, final String activeKey) {
if (s_log.isDebugEnabled()) {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -13,7 +13,10 @@
import com.arsdigita.toolbox.ui.ComponentMap;
/**
- *
+ * A listener to administer images.
+ *
+ * This listerner is used by {@link ImagesPane}.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
class ImageComponentAdminListener extends ImageComponentAbstractListener implements ActionListener {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -4,7 +4,6 @@
*/
package com.arsdigita.cms.ui;
-import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.FormSectionEvent;
@@ -12,15 +11,18 @@
import org.apache.log4j.Logger;
/**
- *
+ * A listener to select an image and save it for later use.
+ *
+ * This listerner is used by {@link ImageSelectPage}.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public class ImageComponentSelectListener extends ImageComponentAbstractListener {
private static final Logger S_LOG = Logger.getLogger(ImageComponentSelectListener.class);
- private final ImageSelectResultPane m_resultPane;
+ private final ImageSelectResultComponent m_resultPane;
- public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultPane resultPane) {
+ public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultComponent resultPane) {
super(imageComponent);
m_resultPane = resultPane;
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -25,7 +25,13 @@
import java.math.BigDecimal;
/**
+ * An image library component.
*
+ * This component can be used in different places to add an image library
+ * in a convinient way. This class uses a listener class which should be extended
+ * from {@link ImageComponentAbstractListener}.
+ *
+ * @author unknown
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable {
@@ -67,7 +73,7 @@
try {
final ReusableImageAsset image = new ReusableImageAsset(imageID);
if(m_mode == ImageComponent.SELECT_IMAGE) {
- parent.getResultPane().setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight());
+ parent.getResultComponent().setResult(image);
}
m_imageModel.setSelectedObject(state, image);
} catch (DataObjectNotFoundException ex) {
@@ -164,6 +170,11 @@
return m_saveCancel;
}
+ /**
+ * Add a link to an {@link ImageUploadComponent}
+ *
+ * @param actionListener
+ */
public void addUploadLink(final ActionListener actionListener) {
// Add action link to image upload component
if (m_mode != ImageComponent.DISPLAY_ONLY) {
@@ -173,7 +184,9 @@
}
}
- // Reset this component
+ /**
+ * Reset this component.
+ */
public void reset(final PageState state) {
// clear selection
m_imageModel.clearSelection(state);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -21,7 +21,11 @@
import org.apache.log4j.Logger;
/**
- *
+ * A {@link CMSPage} to select and upload images.
+ *
+ * This page is used by /web/templates/ccm-cms/content-section/admin/image_select.jsp
+ * which is used by the OpenCCM plugin for Xihna editor.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public class ImageSelectPage extends CMSPage {
@@ -32,7 +36,7 @@
private TabbedPane m_tabbedPane;
private ImageLibraryComponent m_imageLibrary;
private ImageUploadComponent m_imageUpload;
- private ImageSelectResultPane m_resultPane;
+ private ImageSelectResultComponent m_result;
private BigDecimalParameter m_sectionId;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
@@ -56,7 +60,7 @@
m_imageComponent =
new MapComponentSelectionModel(componentModel, new HashMap());
- m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultPane());
+ m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultComponent());
m_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body");
@@ -77,11 +81,16 @@
}
});
- add(m_resultPane);
+ add(m_result);
addGlobalStateParam(m_imageComponentKey);
}
+ /**
+ * Create the image library pane
+ *
+ * @return m_imageLibrary
+ */
protected ImageLibraryComponent getImageLibraryPane() {
if (m_imageLibrary == null) {
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this);
@@ -92,6 +101,11 @@
return m_imageLibrary;
}
+ /**
+ * Create the image upload pane
+ *
+ * @return m_imageUpload
+ */
protected ImageUploadComponent getImageUploadPane() {
if (m_imageUpload == null) {
@@ -103,13 +117,21 @@
return m_imageUpload;
}
- protected ImageSelectResultPane getResultPane() {
- if (m_resultPane == null) {
- m_resultPane = new ImageSelectResultPane();
+ /**
+ * Creates an {@link ImageSelectResultComponent}
+ *
+ * @return m_resultPane
+ */
+ protected ImageSelectResultComponent getResultComponent() {
+ if (m_result == null) {
+ m_result = new ImageSelectResultComponent();
}
- return m_resultPane;
+ return m_result;
}
+ /**
+ * Create the tabbed pane
+ */
protected TabbedPane createTabbedPane() {
TabbedPane pane = new TabbedPane();
pane.setClassAttr(XSL_CLASS);
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultComponent.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -0,0 +1,84 @@
+/*
+ * 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.cms.ImageAsset;
+import com.arsdigita.cms.Service;
+import com.arsdigita.xml.Element;
+
+/**
+ * A component which will insert a javascript to the xml output with the
+ * image information for the OpenCCM plugin for Xinha editor.
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageSelectResultComponent extends SimpleContainer implements Resettable {
+
+ boolean m_valid = false;
+ ImageAsset m_image;
+
+ public ImageSelectResultComponent() {
+ super();
+ }
+
+ /**
+ * Save image imformation
+ *
+ * @param iamge an {@link ImageAsset}
+ */
+ public void setResult(final ImageAsset image/*, final String name, final BigDecimal id, final BigDecimal width, final BigDecimal height*/) {
+ m_image = image;
+ m_valid = (m_image != null);
+ }
+
+ @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 : \"");
+ script.append(Service.getImageURL(m_image));
+ script.append("\", ");
+ script.append(" name : \"");
+ script.append(m_image.getDisplayName());
+ script.append("\", ");
+ script.append(" width : \"");
+ script.append(m_image.getWidth());
+ script.append("\", ");
+ script.append(" height : \"");
+ script.append(m_image.getHeight());
+ script.append("\"");
+ script.append("});");
+ script.append("}");
+
+ script.append("self.close();");
+
+ }
+ script.append("return false;");
+ script.append("}");
+ scriptElem.setText(script.toString());
+ }
+
+ /**
+ * Reset this component.
+ *
+ * @param state Page state
+ */
+ public void reset(PageState state) {
+ setResult(null);
+ }
+}
Deleted: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -1,81 +0,0 @@
-/*
- * 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;
- }
-}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -21,7 +21,13 @@
import java.io.IOException;
/**
+ * An image upload component.
*
+ * This component can be used in different places to add image upload capabilities
+ * in a convinient way. This class uses a listener class which should be extended
+ * from {@link ImageComponentAbstractListener}.
+ *
+ * @author unknown
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public class ImageUploadComponent extends Form implements ImageComponent {
@@ -34,10 +40,18 @@
private final SaveCancelSection m_saveCancel;
private int m_mode;
+ /**
+ * Creates an ImageUploadComponent in attach mode.
+ */
public ImageUploadComponent() {
this(ImageComponent.ATTACH_IMAGE);
}
+ /**
+ * Creates an ImageUploadComponent with the selected mode.
+ *
+ * @param mode The operation mode (see {@link ImageComponent)
+ */
public ImageUploadComponent(int mode) {
super("imageUploadComponent", new ColumnPanel(2));
m_mode = mode;
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -34,7 +34,7 @@
import org.apache.log4j.Logger;
/**
- * A LayoutPanel to insert into ContentSectionPage or ImageSelectPage
+ * A {@link LayoutPanel} to insert into {@link ContentSectionPage}.
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
@@ -77,6 +77,7 @@
final Map selectors = m_imageComponent.getComponentsMap();
m_adminListener = new ImageComponentAdminListener(m_imageComponent, this);
+ // Image library component
final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
library.getForm().addInitListener(m_adminListener);
library.getForm().addProcessListener(m_adminListener);
@@ -86,6 +87,7 @@
new Label(GlobalizationUtil.globalize("cms.ui.image_library")),
library));
+ // Image upload component
final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
upload.getForm().addInitListener(m_adminListener);
upload.getForm().addSubmissionListener(m_adminListener);
@@ -126,6 +128,11 @@
page.addComponentStateParam(this, m_imageComponentKey);
}
+ /**
+ * Resets this pane and all its resettable components.
+ *
+ * @param state Page state
+ */
@Override
public final void reset(final PageState state) {
super.reset(state);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryItemPane.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -75,20 +75,17 @@
* @version $Id$
*/
class CategoryItemPane extends BaseItemPane {
-
- private static final Logger s_log = Logger.getLogger
- (CategoryItemPane.class);
-
+
+ private static final Logger s_log = Logger.getLogger(CategoryItemPane.class);
private final SingleSelectionModel m_model;
private final CategoryRequestLocal m_category;
-
private final SimpleContainer m_detailPane;
public CategoryItemPane(final SingleSelectionModel model,
- final CategoryRequestLocal category,
- final ActionLink addLink,
- final ActionLink editLink,
- final ActionLink deleteLink) {
+ final CategoryRequestLocal category,
+ final ActionLink addLink,
+ final ActionLink editLink,
+ final ActionLink deleteLink) {
m_model = model;
m_category = category;
@@ -99,16 +96,15 @@
setDefault(m_detailPane);
final ActionLink orderItemsLink = new ActionLink(new Label(
- gz("cms.ui.category.categorized_objects"))) {
+ gz("cms.ui.category.categorized_objects"))) {
@Override
public boolean isVisible(PageState state) {
// update for live items only
if (!super.isVisible(state)) {
return false;
}
- CategorizedCollection items = m_category.getCategory
- (state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE);
- items.addEqualsFilter(ContentItem.VERSION,ContentItem.LIVE);
+ CategorizedCollection items = m_category.getCategory(state).getObjects(ContentItem.BASE_DATA_OBJECT_TYPE);
+ items.addEqualsFilter(ContentItem.VERSION, ContentItem.LIVE);
boolean canOrder = items.size() > 1;
items.close();
return canOrder;
@@ -123,55 +119,53 @@
// Change index item
final ActionLink indexLink = new ActionLink(new Label(gz(
- "cms.ui.category.change_index_item")));
+ "cms.ui.category.change_index_item")));
final Form indexForm = new IndexItemSelectionForm(m_category);
add(indexForm);
ViewItemLink viewIndexLink = new ViewItemLink(new Label(gz(
- "cms.ui.category.view_index_item")),"");
+ "cms.ui.category.view_index_item")), "");
EditItemLink editIndexLink = new EditItemLink(new Label(gz(
- "cms.ui.category.edit_index_item")),"");
+ "cms.ui.category.edit_index_item")), "");
// Summary
m_detailPane.add(new SummarySection(editLink, deleteLink, indexLink,
- viewIndexLink, editIndexLink, orderItemsLink));
-
+ viewIndexLink, editIndexLink, orderItemsLink));
+
// Quasimodo: BEGIN
// Localizations
ActionLink addCategoryLocalizationLink = new ActionLink(new Label(gz(
- "cms.ui.category.localization_add"))) {
+ "cms.ui.category.localization_add"))) {
@Override
public boolean isVisible(PageState state) {
// Only show addLanguage button, if there are langauges to add
- int countSupportedLanguages = (
- Kernel.getConfig()).getSupportedLanguagesTokenizer()
- .countTokens();
- long countLanguages =
+ int countSupportedLanguages = (Kernel.getConfig()).getSupportedLanguagesTokenizer()
+ .countTokens();
+ long countLanguages =
m_category.getCategory(state)
- .getCategoryLocalizationCollection().size();
-
- if(countLanguages < countSupportedLanguages) {
+ .getCategoryLocalizationCollection().size();
+
+ if (countLanguages < countSupportedLanguages) {
return true;
} else {
return false;
}
}
};
-
+
CategoryLocalizationAddForm addCategoryLocalizationForm =
- new CategoryLocalizationAddForm(m_category);
+ new CategoryLocalizationAddForm(m_category);
m_detailPane.add(new CategoryLocalizationSection(addCategoryLocalizationLink));
add(addCategoryLocalizationForm);
connect(addCategoryLocalizationLink, addCategoryLocalizationForm);
connect(addCategoryLocalizationForm);
// Quasimodo: END
-
+
// Subcategories
m_detailPane.add(new SubcategorySection(addLink));
// Linked categories
- final ActionLink linkAddLink = new ActionLink
- (new Label(gz("cms.ui.category.linked_add")));
+ final ActionLink linkAddLink = new ActionLink(new Label(gz("cms.ui.category.linked_add")));
final Form linkForm = new LinkForm(m_category);
add(linkForm);
@@ -196,6 +190,7 @@
}
private class EditVisible extends VisibilityComponent {
+
EditVisible(final Component child) {
super(child, null);
}
@@ -207,6 +202,7 @@
}
private class AdminVisible extends VisibilityComponent {
+
AdminVisible(final Component child) {
super(child, null);
}
@@ -220,9 +216,9 @@
private class SummarySection extends Section {
SummarySection(final ActionLink editLink,
- final ActionLink deleteLink,
- final ActionLink indexLink,
- final ActionLink orderItemsLink) {
+ final ActionLink deleteLink,
+ final ActionLink indexLink,
+ final ActionLink orderItemsLink) {
setHeading(new Label(gz("cms.ui.category.details")));
final ActionGroup group = new ActionGroup();
@@ -241,11 +237,11 @@
* the user to view and edit the content index item.
*/
SummarySection(final ActionLink editLink,
- final ActionLink deleteLink,
- final ActionLink indexLink,
- final BaseLink viewIndexItem,
- final BaseLink editIndexItem,
- final ActionLink orderItemsLink) {
+ final ActionLink deleteLink,
+ final ActionLink indexLink,
+ final BaseLink viewIndexItem,
+ final BaseLink editIndexItem,
+ final ActionLink orderItemsLink) {
setHeading(new Label(gz("cms.ui.category.details")));
final ActionGroup group = new ActionGroup();
@@ -262,6 +258,7 @@
}
private class Properties extends PropertyList {
+
@Override
protected final java.util.List properties(final PageState state) {
final java.util.List props = super.properties(state);
@@ -272,20 +269,19 @@
if (item != null) {
itemTitle = item.getDisplayName();
- } else if (!category.ignoreParentIndexItem()
- && category.getParentCategoryCount() > 0)
- {
- Category ancestor = findParentCategoryWithNonInheritedIndexItem(category);
- if (ancestor != null) {
- if (ancestor.getIndexObject() != null) {
- itemTitle = ancestor.getIndexObject().getDisplayName();
- }
- itemTitle += " (Inherited from "
- + ancestor.getDisplayName() + ")";
- } else {
- // The complete hierarchy is set to inherit.
- // Just leave the itemTitle as None.
- }
+ } else if (!category.ignoreParentIndexItem()
+ && category.getParentCategoryCount() > 0) {
+ Category ancestor = findParentCategoryWithNonInheritedIndexItem(category);
+ if (ancestor != null) {
+ if (ancestor.getIndexObject() != null) {
+ itemTitle = ancestor.getIndexObject().getDisplayName();
+ }
+ itemTitle += " (Inherited from "
+ + ancestor.getDisplayName() + ")";
+ } else {
+ // The complete hierarchy is set to inherit.
+ // Just leave the itemTitle as None.
+ }
}
props.add(new Property(gz("cms.ui.name"),
@@ -295,57 +291,67 @@
props.add(new Property(gz("cms.ui.category.url"),
category.getURL("")));
props.add(new Property(gz("cms.ui.category.is_not_abstract"),
- category.isAbstract() ?
- gz("cms.ui.no") :
- gz("cms.ui.yes")));
+ category.isAbstract()
+ ? gz("cms.ui.no")
+ : gz("cms.ui.yes")));
props.add(new Property(gz("cms.ui.category.is_enabled"),
- category.isEnabled("") ?
- gz("cms.ui.yes") :
- gz("cms.ui.no")));
+ category.isEnabled("")
+ ? gz("cms.ui.yes")
+ : gz("cms.ui.no")));
props.add(new Property(gz("cms.ui.category.index_item"),
- itemTitle));
+ itemTitle));
return props;
}
}
}
-
+
// Loop over the parents and recurse up the hierarchy the find the first
// parent with an explicit index item ignoreParentIndexItem is true.
private Category findParentCategoryWithNonInheritedIndexItem(Category c) {
- if (c.getParentCategoryCount() == 0) {
- return null;
- }
- CategoryCollection parents = c.getParents();
- while (parents.next()) {
- Category p = parents.getCategory();
- if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) {
- return p;
- }
- // Try the parents of this parent.
- Category gp = findParentCategoryWithNonInheritedIndexItem(p);
- if (gp != null) {
- return gp;
- }
- }
- return null;
+ if (c.getParentCategoryCount() == 0) {
+ return null;
+ }
+ CategoryCollection parents = c.getParents();
+ while (parents.next()) {
+ Category p = parents.getCategory();
+ if (p.getDirectIndexObject() != null || p.ignoreParentIndexItem()) {
+ return p;
+ }
+ // Try the parents of this parent.
+ Category gp = findParentCategoryWithNonInheritedIndexItem(p);
+ if (gp != null) {
+ return gp;
+ }
+ }
+ return null;
}
-
+
// Quasimodo: BEGIN
// CategoryLocalizationSection
private class CategoryLocalizationSection extends Section {
+
+ private CategoryLocalizationTable m_catLocalizationTable;
+ private CategoryLocalizationEditForm m_editCategoryLocalizationForm;
+
CategoryLocalizationSection(ActionLink addLink) {
setHeading(new Label(gz("cms.ui.category.localizations")));
-
+
final ActionGroup group = new ActionGroup();
setBody(group);
-
- group.setSubject(new CategoryLocalizationTable(m_category, m_model));
+ m_catLocalizationTable = new CategoryLocalizationTable(m_category, m_model);
+ group.setSubject(m_catLocalizationTable);
group.addAction(new AdminVisible(addLink), ActionGroup.ADD);
+
+ m_editCategoryLocalizationForm = new CategoryLocalizationEditForm(m_category, "de");
+ connect(m_editCategoryLocalizationForm);
+ connect(m_catLocalizationTable, 0, m_editCategoryLocalizationForm);
+
}
}
private class SubcategorySection extends Section {
+
SubcategorySection(final ActionLink addLink) {
setHeading(new Label(gz("cms.ui.category.subcategories")));
@@ -358,6 +364,7 @@
}
private class LinkedCategorySection extends Section {
+
LinkedCategorySection(final ActionLink linkAddLink) {
setHeading(new Label(gz("cms.ui.category.linked")));
@@ -375,6 +382,7 @@
}
private class CategoryTemplateSection extends Section {
+
CategoryTemplateSection() {
setHeading(new Label(gz("cms.ui.category.templates")));
@@ -388,6 +396,7 @@
}
private class PermissionsSection extends Section {
+
@Override
public boolean isVisible(PageState ps) {
Category cat = m_category.getCategory(ps);
@@ -400,7 +409,7 @@
final ActionGroup group = new ActionGroup();
setBody(group);
- PrivilegeDescriptor[] privs = new PrivilegeDescriptor[] {
+ PrivilegeDescriptor[] privs = new PrivilegeDescriptor[]{
PrivilegeDescriptor.EDIT,
Category.MAP_DESCRIPTOR,
PrivilegeDescriptor.DELETE,
@@ -413,8 +422,7 @@
privMap.put(Category.MAP_DESCRIPTOR.getName(), "Categorize Items");
privMap.put("admin", "Admin");
- final CMSPermissionsPane permPane = new CMSPermissionsPane
- (privs, privMap, new ACSObjectSelectionModel(m_model)) {
+ final CMSPermissionsPane permPane = new CMSPermissionsPane(privs, privMap, new ACSObjectSelectionModel(m_model)) {
@Override
public void showAdmin(PageState ps) {
Assert.exists(m_model.getSelectedKey(ps));
@@ -425,7 +433,7 @@
};
final ActionLink restoreDefault = new ActionLink(new Label(gz(
- "cms.ui.restore_default_permissions"))) {
+ "cms.ui.restore_default_permissions"))) {
@Override
public boolean isVisible(PageState ps) {
Category cat = m_category.getCategory(ps);
@@ -434,7 +442,7 @@
};
final ActionLink useCustom = new ActionLink(new Label(gz(
- "cms.ui.use_custom_permissions"))) {
+ "cms.ui.use_custom_permissions"))) {
@Override
public boolean isVisible(PageState ps) {
Category cat = m_category.getCategory(ps);
@@ -460,18 +468,18 @@
parent = cat.getDefaultParentCategory();
} catch (CategoryNotFoundException ce) {
throw new IllegalStateException(
- "link shouldn't exist for root categories");
+ "link shouldn't exist for root categories");
}
PermissionService.setContext(cat, parent);
// revoke all direct permissions so category will only
// have inherited permissions
ObjectPermissionCollection perms =
- PermissionService.getDirectGrantedPermissions(
+ PermissionService.getDirectGrantedPermissions(
cat.getOID());
while (perms.next()) {
PermissionService.revokePermission(
- new PermissionDescriptor(
+ new PermissionDescriptor(
perms.getPrivilege(), cat.getOID(),
perms.getGranteeOID()));
}
@@ -510,15 +518,15 @@
add(new Submit("Done"));
}
-
}
/*
* This private class creates a link to the index item for a category.
*/
private class ViewItemLink extends Link {
+
ViewItemLink(Component c, String s) {
- super(c,s);
+ super(c, s);
}
// Build the preview link. This uses a standard redirect link to find
@@ -526,10 +534,10 @@
@Override
protected String prepareURL(final PageState state, String location) {
- ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state)
- .getDirectIndexObject()))
- .getPrimaryInstance();
- if(indexItem==null) {
+ ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state)
+ .getDirectIndexObject()))
+ .getPrimaryInstance();
+ if (indexItem == null) {
return "";
} else {
return "/redirect/?oid=" + URLEncoder.encode(indexItem.getOID().toString());
@@ -543,7 +551,7 @@
return false;
}
ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject();
- if(indexItem==null) {
+ if (indexItem == null) {
return false;
} else {
return true;
@@ -552,36 +560,38 @@
};
private class EditItemLink extends Link {
+
EditItemLink(Component c, String s) {
- super(c,s);
+ super(c, s);
}
/**
- * Build the preview link. This is based on code in the
- * ContentSoonExpiredPane class. The prepareURL method of the parent
- * is overwritten. This method is called by the printwriter
+ * Build the preview link. This is based on code in the
+ * ContentSoonExpiredPane class. The prepareURL method of the parent is
+ * overwritten. This method is called by the printwriter
*/
@Override
protected String prepareURL(final PageState state, String location) {
boolean canEdit = false;
- ContentItem indexItem = ((ContentBundle)(m_category.getCategory(state)
- .getDirectIndexObject()))
- .getPrimaryInstance();
- if(indexItem==null) {
+ ContentItem indexItem = ((ContentBundle) (m_category.getCategory(state)
+ .getDirectIndexObject()))
+ .getPrimaryInstance();
+ if (indexItem == null) {
return "";
}
- if (!isItemEditable(indexItem,state)) {
+ if (!isItemEditable(indexItem, state)) {
return "";
} else {
BigDecimal draftID = indexItem.getDraftVersion().getID();
- return "item.jsp?item_id=" + draftID + "&set_tab=" +
- ContentItemPage.AUTHORING_TAB;
+ return "item.jsp?item_id=" + draftID + "&set_tab="
+ + ContentItemPage.AUTHORING_TAB;
}
}
/**
* We only show this link when an index item exists for this category
* and the user is allowed to edit this item.
+ *
* @param state
* @return
*/
@@ -591,16 +601,16 @@
return false;
}
ACSObject indexItem = m_category.getCategory(state).getDirectIndexObject();
- if(indexItem==null) {
+ if (indexItem == null) {
return false;
} else {
- return isItemEditable((ContentItem)indexItem,state);
+ return isItemEditable((ContentItem) indexItem, state);
}
}
/**
- * This method checks whether a usern is allowed to edit a
- * particular item.
+ * This method checks whether a usern is allowed to edit a particular
+ * item.
*
* @param item
* @param state
@@ -610,13 +620,13 @@
BigDecimal id = item.getID();
User user = Web.getContext().getUser();
ContentItem ci = new ContentItem(new OID(ContentItem.class.getName(),
- Integer.parseInt(id.toString())));
+ Integer.parseInt(id.toString())));
Iterator permissions = PermissionService.getImpliedPrivileges(
- ci.getOID(), user.getOID());
+ ci.getOID(), user.getOID());
while (permissions.hasNext()) {
- PrivilegeDescriptor permission = (PrivilegeDescriptor)permissions.next();
- if (permission.equals(PrivilegeDescriptor.ADMIN) ||
- permission.equals(PrivilegeDescriptor.EDIT)) {
+ PrivilegeDescriptor permission = (PrivilegeDescriptor) permissions.next();
+ if (permission.equals(PrivilegeDescriptor.ADMIN)
+ || permission.equals(PrivilegeDescriptor.EDIT)) {
return true;
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/category/CategoryLocalizationTable.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -27,6 +27,7 @@
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent;
import com.arsdigita.bebop.event.TableActionListener;
+import com.arsdigita.bebop.table.DefaultTableCellRenderer;
import com.arsdigita.bebop.table.TableCellRenderer;
import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel;
@@ -49,8 +50,8 @@
/**
* Lists all existing localizations for a selected category.
*
- * This class is part of the admin GUI of CCM and extends the standard form
- * in order to present forms for managing the multi-language categories.
+ * This class is part of the admin GUI of CCM and extends the standard form in
+ * order to present forms for managing the multi-language categories.
*
* @author Sören Bernstein (quasimodo) qu...@ze...
*/
@@ -75,7 +76,7 @@
// if table is empty:
setEmptyView(new Label(GlobalizationUtil.globalize(
"cms.ui.category.localization_none")));
- TableColumnModel tab_model = getColumnModel();
+TableColumnModel tab_model = getColumnModel();
// define columns
// XXX globalize
@@ -139,7 +140,7 @@
/**
* Check collection for the existence of another row.
- *
+ *
* If exists, fetch the value of current CategoryLocalization object
* into m_categoryLocalization class variable.
*/
@@ -158,6 +159,7 @@
/**
* Return the
+ *
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
*/
public Object getElementAt(int columnIndex) {
@@ -197,22 +199,22 @@
boolean isSelected, Object key,
int row, int column) {
-//
+
// if (canEdit) {
-// CategoryLocalization cl;
-//
-// try {
-// cl = new CategoryLocalization((BigDecimal) key);
-// } catch (DataObjectNotFoundException ex) {
-// return new Label(value.toString());
-// }
-//
-// ContentSection section = CMS.getContext().getContentSection();
-// ItemResolver resolver = section.getItemResolver();
-//
+// CategoryLocalization cl;
+
+// try {
+// cl = new CategoryLocalization((BigDecimal) key);
+// } catch (DataObjectNotFoundException ex) {
+// return new Label(value.toString());
+// }
+
+// ContentSection section = CMS.getContext().getContentSection();
+// ItemResolver resolver = section.getItemResolver();
+
// return new Link(value.toString(), resolver.generateItemURL(state, cl, section, cl.getVersion()));
- ControlLink link = new ControlLink(value.toString());
- return link;
+ ControlLink link = new ControlLink(value.toString());
+ return link;
}
}
@@ -230,9 +232,9 @@
}
/**
- * Provide implementation to TableActionListener method.
- * Code that comes into picture when a link on the table is clicked.
- * Handles edit and delete event.
+ * Provide implementation to TableActionListener method. Code that comes
+ * into picture when a link on the table is clicked. Handles edit and delete
+ * event.
*/
public void cellSelected(TableActionEvent evt) {
@@ -260,8 +262,8 @@
}
/**
- * provide Implementation to TableActionListener method.
- * Does nothing in our case.
+ * provide Implementation to TableActionListener method. Does nothing in our
+ * case.
*/
public void headSelected(TableActionEvent e) {
throw new UnsupportedOperationException("Not Implemented");
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -15,7 +15,10 @@
import org.apache.log4j.Logger;
/**
- *
+ * A listener to attach an image to a content item.
+ *
+ * This listerner is used by {@link ImageStepEdit}.
+ *
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public class ImageComponentAttachListener extends ImageComponentAbstractListener {
@@ -43,6 +46,5 @@
attachment.setCaption(component.getCaption(event));
-// setImageComponent(ps, ImageComponent.LIBRARY);
}
}
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -18,8 +18,6 @@
package com.arsdigita.cms.contentassets.ui;
-import com.arsdigita.cms.contentassets.ItemImageAttachment;
-
import com.arsdigita.bebop.AbstractSingleSelectionModel;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
@@ -29,6 +27,7 @@
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
+import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.cms.ui.SecurityPropertyEditor;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
@@ -36,15 +35,14 @@
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID;
import com.arsdigita.toolbox.ui.OIDParameter;
-
import java.util.Iterator;
-
import org.apache.log4j.Logger;
/**
- * Pluggable authoring step to add an ImageAsset to a content item
- * Currently only supports adding one image though the PDL has
- * association for multiple.
+ * Pluggable authoring step to add an ImageAsset to a content item.
+ *
+ * @author unknown
+ * @author Sören Bernstein (quasimodo) <sbe...@qu...>
*/
public class ImageStep extends SecurityPropertyEditor {
@@ -175,6 +173,13 @@
}
}
+ /**
+ * Show display pane.
+ *
+ * Also, reset the forms for reuse.
+ *
+ * @param state
+ */
@Override
public void showDisplayPane(PageState state) {
super.showDisplayPane(state);
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -18,8 +18,6 @@
package com.arsdigita.cms.contentassets.ui;
-import com.arsdigita.cms.contentassets.ItemImageAttachment;
-
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink;
@@ -35,25 +33,25 @@
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.ReusableImageAsset;
+import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.ui.ImageDisplay;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.LockableImpl;
import com.arsdigita.xml.Element;
-
import javax.servlet.ServletException;
-
import org.apache.log4j.Logger;
/**
- * Pluggable authoring step to add an ImageAsset to a content item
- * Currently only supports adding one image though the PDL has
- * association for multiple.
+ * Pluggable authoring step to add an ImageAsset to a content item.
+ *
+ * @author unknown
+ * @author Sören Bernstein (quasimodo) <sbe...@qu...>
*/
public class ImageStepDisplay extends SimpleContainer {
- private static final Logger s_log = Logger.getLogger(ImageStepDisplay.class);
+ private static final Logger S_LOG = Logger.getLogger(ImageStepDisplay.class);
private final ImageStep m_imageStep;
@@ -69,6 +67,7 @@
mainLabel.setFontWeight(Label.ITALIC);
List imageList = new List( new ImageListModelBuilder() ) {
+ @Override
public void respond( PageState ps ) throws ServletException {
if( DELETE.equals( ps.getControlEventName() ) ) {
String attachment = ps.getControlEventValue();
@@ -168,6 +167,7 @@
}
+ @Override
protected ImageAsset getImageAsset( PageState ps ) {
return attachment.getImage();
}
@@ -191,6 +191,7 @@
container.add( useContextPanel );
ControlLink delete = new ControlLink( "Delete" ) {
+ @Override
public void setControlEvent( PageState ps ) {
String oid = ps.getControlEventValue();
ps.setControlEvent( list, DELETE, oid );
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 18:17:07 UTC (rev 2381)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 18:26:28 UTC (rev 2382)
@@ -45,17 +45,26 @@
import java.util.Map;
import org.apache.log4j.Logger;
+/**
+ * Pluggable authoring step to add an ImageAsset to a content item.
+ *
+ * @author unknown
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
public class ImageStepEdit extends SimpleContainer
- implements Resettable/*
- * , FormProcessListener, FormInitListener
- */ {
+ implements Resettable {
- private static final Logger s_log = Logger.getLogger(ImageStepEdit.class);
+ private static final Logger S_LOG = Logger.getLogger(ImageStepEdit.class);
private final ImageStep m_imageStep;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
private final ImageComponentAttachListener m_attachListener;
+ /**
+ * Creates a new ImageStepEidt form.
+ *
+ * @param step the parent {@link ImageStep} form
+ */
public ImageStepEdit(ImageStep step) {
m_imageStep = step;
@@ -73,7 +82,6 @@
library.getForm().addInitListener(m_attachListener);
library.getForm().addProcessListener(m_attachListener);
library.addUploadLink(new ActionListener() {
-
public void actionPerformed(ActionEvent ev) {
setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
}
@@ -105,15 +113,15 @@
p.addComponentStateParam(this, m_imageComponentKey);
}
- Iterator getImageComponents() {
+ protected Iterator getImageComponents() {
return m_imageComponent.getComponentsMap().values().iterator();
}
private void setImageComponent(PageState ps, final String activeKey) {
m_imageComponent.setSelectedKey(ps, activeKey);
- if (s_log.isDebugEnabled()) {
- s_log.debug("Selected component: " + activeKey);
+ if (S_LOG.isDebugEnabled()) {
+ S_LOG.debug("Selected component: " + activeKey);
}
Map componentsMap = m_imageComponent.getComponentsMap();
@@ -124,15 +132,19 @@
boolean isVisible = activeKey.equals(key);
- if (s_log.isDebugEnabled()) {
- s_log.debug("Key: " + key + "; Visibility: " + isVisible);
+ if (S_LOG.isDebugEnabled()) ...
[truncated message content] |
|
From: <pb...@fe...> - 2012-12-16 18:17:16
|
Author: pboy
Date: 2012-12-16 18:17:07 +0000 (Sun, 16 Dec 2012)
New Revision: 2381
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
Log:
Enhanced ItemSelectPage: component communication established. (on behalf of quasimodo)
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:13:14 UTC (rev 2380)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:17:07 UTC (rev 2381)
@@ -4,11 +4,11 @@
*/
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 java.math.BigDecimal;
import org.apache.log4j.Logger;
/**
@@ -25,9 +25,14 @@
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_resultPane.setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight());
-
m_imageComponent.setSelectedKey(ps, ImageSelectPage.RESULT);
+ m_resultPane.reset(ps);
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:13:14 UTC (rev 2380)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:17:07 UTC (rev 2381)
@@ -42,10 +42,14 @@
private int m_mode;
public ImageLibraryComponent() {
- this(ImageComponent.ATTACH_IMAGE);
+ 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);
@@ -62,6 +66,9 @@
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);
@@ -105,8 +112,14 @@
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);
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:13:14 UTC (rev 2380)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:17:07 UTC (rev 2381)
@@ -38,7 +38,6 @@
private final MapComponentSelectionModel m_imageComponent;
private final ImageComponentSelectListener m_selectListener;
private static final CMSConfig s_conf = CMSConfig.getInstance();
- private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
public static final String RESULT = "result";
@@ -85,7 +84,7 @@
protected ImageLibraryComponent getImageLibraryPane() {
if (m_imageLibrary == null) {
- m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE);
+ 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);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:13:14 UTC (rev 2380)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:17:07 UTC (rev 2381)
@@ -16,10 +16,7 @@
*/
public class ImageSelectResultPane extends SimpleContainer implements Resettable {
- public static final int UNSET = 0;
- public static final int CANCEL = 1;
- public static final int SELECT = 2;
- int m_state = UNSET;
+ boolean m_valid = false;
String m_name;
BigDecimal m_id;
BigDecimal m_width;
@@ -34,46 +31,44 @@
m_id = id;
m_width = width;
m_height = height;
- m_state = SELECT;
+ m_valid = true;
}
@Override
public void generateXML(PageState state, Element parent) {
- if (m_state != UNSET) {
+ Element scriptElem = parent.newChildElement("script");
+ scriptElem.addAttribute("type", "text/javascript");
- Element scriptElem = parent.newChildElement("script");
- scriptElem.addAttribute("type", "text/javascript");
- scriptElem.addAttribute("eventHandler", "onload");
+ StringBuilder script = new StringBuilder(1000);
- StringBuilder script = new StringBuilder(1000);
+ script.append("function selectImage(button) {");
+ if (m_valid) {
- script.append("alert(\"SCRIPT\");");
+ 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("}");
- if (m_state == SELECT) {
-// script.append("window.opener.document.OpenCCM.imageSet(");
- script.append("window.openCCM.imageSet(");
- script.append("{");
- script.append(" src : \"/theme/mandalay/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("self.close();");
- script.append("return false;");
- scriptElem.setText(script.toString());
}
+ script.append("return false;");
+ script.append("}");
+ scriptElem.setText(script.toString());
}
public void reset(PageState state) {
@@ -81,6 +76,6 @@
m_id = null;
m_width = null;
m_height = null;
- m_state = UNSET;
+ m_valid = false;
}
}
Modified: trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
===================================================================
--- trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 18:13:14 UTC (rev 2380)
+++ trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 18:17:07 UTC (rev 2381)
@@ -293,8 +293,8 @@
// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true});
// searchDialog.show();
var selectWindow = window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no");
- selectWindow.openCCM = this;
-// return false;
+ window.openCCM = this;
+ return false;
};
OpenCCM.prototype.imageSet = function(imageData)
|
|
From: <pb...@fe...> - 2012-12-16 18:13:22
|
Author: pboy
Date: 2012-12-16 18:13:14 +0000 (Sun, 16 Dec 2012)
New Revision: 2380
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
Log:
Enhanced ItemSearchCreatePane UI: window either closes or redirects to edit page (configurable) (on behalt of JensP).
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 18:04:05 UTC (rev 2379)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 18:13:14 UTC (rev 2380)
@@ -62,11 +62,13 @@
private final SingleSelectionModel m_model;
private final FolderSelectionModel m_folderSel; // To support legacy UI code
private String defaultFolder;
+ private boolean editAfterCreate = true;
private final CreationSelector m_creator;
private final ContentItemRequestLocal m_contentItem = new ContentItemRequestLocal() {
};
- private final Link m_selectCloseLink;
- private final Link m_selectEditLink;
+ //private final Link m_selectCloseLink;
+ //private final Link m_selectEditLink;
+ private final Link m_fallBackLink;
private final SegmentedPanel m_segPanel;
private final Segment m_creationSeg;
private final Segment m_newItemSeg;
@@ -119,8 +121,8 @@
m_segPanel.add(m_creationSeg);
add(m_segPanel);
- m_selectCloseLink = new Link(
- (String) GlobalizationUtil.globalize("cms.ui.search.create.select_close").localize(),
+ m_fallBackLink = new Link(
+ (String) GlobalizationUtil.globalize("cms.ui.search.create.fallback").localize(),
new PrintListener() {
public void prepare(final PrintEvent event) {
@@ -139,26 +141,119 @@
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
+ final String scriptAction;
+ if (editAfterCreate) {
+ ((Label) target.getChild()).setLabel((String) GlobalizationUtil.globalize(
+ "cms.ui.search.create.select_edit").localize());
+
+ final ContentSection section = item.getContentSection();
+ final String nodeURL = section.getPath() + "/";
+ final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
+ ContentItemPage.AUTHORING_TAB, true);
+ target.setTarget(linkTarget);
+ scriptAction = "";
+ } else {
+ ((Label) target.getChild()).setLabel((String) GlobalizationUtil.globalize(
+ "cms.ui.search.create.select_close").localize());
+ scriptAction = "self.close();\n"
+ + "return false;";
+ }
+
target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+ "window.opener.document.%s.value=\"%s\";"
+ "window.opener.document.%s.value=\"%s\";"
- + "self.close();"
- + "return false;",
+ + "%s",
widget,
item.getID().toString(),
searchWidget,
title,
publishWidget,
- Boolean.TRUE.toString()));
+ Boolean.TRUE.toString(),
+ scriptAction));
}
});
- m_selectEditLink = new Link((String) GlobalizationUtil.globalize("cms.ui.search.create.select_edit").localize(),
- new PrintListener() {
+// m_selectCloseLink = new Link(
+// (String) GlobalizationUtil.globalize("cms.ui.search.create.select_close").localize(),
+// new PrintListener() {
+//
+// public void prepare(final PrintEvent event) {
+// final Link target = (Link) event.getTarget();
+// final PageState state = event.getPageState();
+//
+// final ContentItem item = m_contentItem.getContentItem(state);
+// final String title;
+// if (item instanceof ContentPage) {
+// title = ((ContentPage) item).getTitle();
+// } else {
+// title = item.getName();
+// }
+//
+// final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
+// final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
+// final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
+//
+// target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+// + "window.opener.document.%s.value=\"%s\";"
+// + "window.opener.document.%s.value=\"%s\";"
+// + "self.close();"
+// + "return false;",
+// widget,
+// item.getID().toString(),
+// searchWidget,
+// title,
+// publishWidget,
+// Boolean.TRUE.toString()));
+// }
+//
+// });
+//
+// m_selectEditLink = new Link((String) GlobalizationUtil.globalize("cms.ui.search.create.select_edit").localize(),
+// new PrintListener() {
+//
+// public void prepare(final PrintEvent event) {
+// final Link target = (Link) event.getTarget();
+// final PageState state = event.getPageState();
+//
+// final ContentItem item = m_contentItem.getContentItem(state);
+// final String title;
+// if (item instanceof ContentPage) {
+// title = ((ContentPage) item).getTitle();
+// } else {
+// title = item.getName();
+// }
+//
+//
+// final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
+// final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
+// final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
+//
+// final ContentSection section = item.getContentSection();
+// final String nodeURL = section.getPath() + "/";
+// final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
+// ContentItemPage.AUTHORING_TAB, true);
+// target.setTarget(linkTarget);
+// target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+// + "window.opener.document.%s.value=\"%s\";"
+// + "window.opener.document.%s.value=\"%s\";",
+// widget,
+// item.getID().toString(),
+// searchWidget,
+// title,
+// publishWidget,
+// Boolean.TRUE.toString()));
+//
+// }
+//
+// });
+ final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL);
+ final Label jsLabel = new Label("", false);
+ jsLabel.addPrintListener(new PrintListener() {
+
public void prepare(final PrintEvent event) {
- final Link target = (Link) event.getTarget();
+ final Label target = (Label) event.getTarget();
final PageState state = event.getPageState();
final ContentItem item = m_contentItem.getContentItem(state);
@@ -169,33 +264,44 @@
title = item.getName();
}
-
final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
- final ContentSection section = item.getContentSection();
- final String nodeURL = section.getPath() + "/";
- final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
- ContentItemPage.AUTHORING_TAB, true);
- target.setTarget(linkTarget);
- target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
- + "window.opener.document.%s.value=\"%s\";"
- + "window.opener.document.%s.value=\"%s\";",
- widget,
- item.getID().toString(),
- searchWidget,
- title,
- publishWidget,
- Boolean.TRUE.toString()));
+ final String scriptAction;
+ if (editAfterCreate) {
+ final ContentSection section = item.getContentSection();
+ final String nodeURL = section.getPath() + "/";
+ final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
+ ContentItemPage.AUTHORING_TAB, true);
+ scriptAction = String.format("window.location.href = \"/ccm/%s\";", linkTarget);
+ } else {
+ scriptAction = "self.close();";
+ }
+ target.setLabel(String.format("<script type=\"text/javascript\">"
+ + "<!--\n"
+ + "window.opener.document.%s.value=\"%s\";\n"
+ + "window.opener.document.%s.value=\"%s\";\n"
+ + "window.opener.document.%s.value=\"%s\";\n"
+ + "%s\n"
+ + "-->\n"
+ + "</script>",
+ widget,
+ item.getID().toString(),
+ searchWidget,
+ title,
+ publishWidget,
+ Boolean.TRUE.toString(),
+ scriptAction));
+
}
});
-
- final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL);
- linkPanel.add(m_selectCloseLink);
- linkPanel.add(m_selectEditLink);
+ linkPanel.add(jsLabel);
+ //linkPanel.add(m_selectCloseLink);
+ //linkPanel.add(m_selectEditLink);
+ linkPanel.add(m_fallBackLink);
m_linkSeg.add(linkPanel);
m_segPanel.add(m_linkSeg);
@@ -260,4 +366,12 @@
this.defaultFolder = defaultFolder;
}
+ protected boolean getEditAfterCreate() {
+ return editAfterCreate;
+ }
+
+ protected void setEditAfterCreate(final boolean editAfterCreate) {
+ this.editAfterCreate = editAfterCreate;
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 18:04:05 UTC (rev 2379)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 18:13:14 UTC (rev 2380)
@@ -87,6 +87,7 @@
addGlobalStateParam(new StringParameter("defaultCreationFolder"));
addGlobalStateParam(new IntegerParameter("lastTab"));
addGlobalStateParam(new BooleanParameter("disableCreatePane"));
+ addGlobalStateParam(new BooleanParameter("editAfterCreate"));
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
addGlobalStateParam(m_sectionId);
@@ -134,6 +135,10 @@
if (state.getValue(new StringParameter("defaultCreationFolder")) != null) {
m_create.setDefaultFolder((String) state.getValue(new StringParameter("defaultCreationFolder")));
}
+
+ if (state.getValue(new BooleanParameter("editAfterCreate")) != null) {
+ m_create.setEditAfterCreate((Boolean) state.getValue(new BooleanParameter("editAfterCreate")));
+ }
// if (m_lastTab != m_tabbedPane.getSelectedIndex(state)) {
// m_lastTab = m_tabbedPane.getSelectedIndex(state);
@@ -339,5 +344,9 @@
protected void setDefaultCreationFolder(final Folder folder) {
m_create.setDefaultFolder(folder.getOID().toString());
}
+
+ protected void setEditAfterCreate(final boolean editAfterCreate) {
+ m_create.setEditAfterCreate(editAfterCreate);
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 18:04:05 UTC (rev 2379)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 18:13:14 UTC (rev 2380)
@@ -81,6 +81,7 @@
private ParameterModel m_model;
private ParameterModel m_searchModel;
private boolean disableCreatePane = false;
+ private boolean editAfterCreate = true;
private String searchLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.search").localize();
private String selectedLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.selected").localize();
public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch";
@@ -277,6 +278,7 @@
}
params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']");
params.setParameter("disableCreatePane", Boolean.toString(disableCreatePane));
+ params.setParameter("editAfterCreate", Boolean.toString(editAfterCreate));
if (m_defaultCreationFolder != null) {
params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
@@ -533,4 +535,8 @@
public void setDisableCreatePane(final boolean disableCreatePane) {
this.disableCreatePane = disableCreatePane;
}
+
+ public void setEditAfterCreate(final boolean editAfterCreate) {
+ this.editAfterCreate = editAfterCreate;
+ }
}
\ No newline at end of file
|
|
From: <pb...@fe...> - 2012-12-16 18:04:16
|
Author: pboy
Date: 2012-12-16 18:04:05 +0000 (Sun, 16 Dec 2012)
New Revision: 2379
Added:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js
trunk/ccm-core/src/com/arsdigita/bebop/Paginator.java
trunk/ccm-core/src/com/arsdigita/bebop/SaveCancelSection.java
trunk/ccm-core/src/com/arsdigita/bebop/ui/BebopResources.properties
trunk/ccm-core/src/com/arsdigita/bebop/ui/BebopResources_de.properties
trunk/ccm-core/src/com/arsdigita/bebop/ui/BebopResources_fr.properties
Log:
On behalf of quasimodo:
ccm-cms
* Added ImageComponentAdminListener
* ImagePane: Fixed Reste & Cancel
* Improved various localisations
* Added ResultPane for ImageSelectPage which creates Javascript including required parameter
* Fixed DefaultImageModelBuilder (reset paginator)
* Enhanced ImagesPane
ccm-core
* Enhanced localization
Xinha-Plugin
* Various minor enhancements
* Enlarged window
* Window scrollable
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 18:04:05 UTC (rev 2379)
@@ -1109,3 +1109,4 @@
cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit
+cms.ui.clear=Clear
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 18:04:05 UTC (rev 2379)
@@ -1100,3 +1100,4 @@
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.clear=Zur\u00fccksetzen
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 18:04:05 UTC (rev 2379)
@@ -48,3 +48,4 @@
cms.ui.search.create.select_close=
cms.ui.search.create.select_edit=
+cms.ui.clear=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 18:04:05 UTC (rev 2379)
@@ -579,3 +579,4 @@
cms.ui.search.create.select_close=
cms.ui.search.create.select_edit=
+cms.ui.clear=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/DefaultImageBrowserModelBuilder.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -31,29 +31,33 @@
/**
* Builds an {@link ImageBrowserModel} by selecting all images which match the
- * given keyword. The keyword is supplied by the <code>getSelectedKey</code>
- * method of a <code>SingleSelectionModel</code>. If the keyword is empty
- * or null, the builder will return an {@link EmptyImageBrowserModel}
+ * given keyword. The keyword is supplied by the
+ * <code>getSelectedKey</code> method of a
+ * <code>SingleSelectionModel</code>. If the keyword is empty or null, the
+ * builder will return an {@link EmptyImageBrowserModel}
*
* @author Stanislav Freidin (sfr...@ar...)
- * @version $Id$
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ * @version $Id: DefaultImageBrowserModelBuilder.java 1940 2009-05-29 07:15:05Z
+ * terry $
*/
public class DefaultImageBrowserModelBuilder extends LockableImpl
implements ImageBrowserModelBuilder, PaginationModelBuilder {
private SingleSelectionModel m_keywordModel;
private static ImageBrowserModel EMPTY_MODEL =
- new EmptyImageBrowserModel();
+ new EmptyImageBrowserModel();
private ImageBrowser m_imageBrowser;
private RequestLocal m_size;
+ private String m_key;
private RequestLocal m_imageColl;
private String m_context;
/**
- * Construct a new DefaultImageBrowserModelBuilder
+ * Construct a new DefaultImageBrowserModelBuilder
*
* @param keywordModel The SingleSelectionModel whose getSelectedKey(state)
- * method returns a string keyword
+ * method returns a string keyword
* @param context the context for the retrieved items. Should be
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
*/
@@ -63,19 +67,29 @@
m_keywordModel = keywordModel;
m_context = context;
m_size = new RequestLocal();
+ m_key = "";
m_imageColl = new RequestLocal();
}
/**
- * Construct a new DefaultImageBrowserModelBuilder
+ * Construct a new DefaultImageBrowserModelBuilder
*
* @param keywordModel The SingleSelectionModel whose getSelectedKey(state)
- * method returns a string keyword
+ * method returns a string keyword
*/
public DefaultImageBrowserModelBuilder(SingleSelectionModel keywordModel) {
this(keywordModel, ContentItem.DRAFT);
}
+ public ImageAssetCollection getImageCollectionByKeyword(PageState state) {
+ String key = (String) m_keywordModel.getSelectedKey(state);
+ if (!m_key.equals(key)) {
+ m_key = key;
+
+ }
+ return ReusableImageAsset.getReusableImagesByKeyword(key, m_context);
+ }
+
/**
* Construct an ImageBrowserModel for the current request
*/
@@ -84,8 +98,7 @@
// pass through key even if null -- null key will return all rows in m_context.
//ImageAssetCollection c = ReusableImageAsset.getReusableImagesByKeyword(key, m_context);
- return new DefaultImageBrowserModel((ImageAssetCollection) m_imageColl.
- get(s));
+ return new DefaultImageBrowserModel((ImageAssetCollection) m_imageColl.get(s));
}
/**
@@ -106,27 +119,42 @@
public int getTotalSize(Paginator paginator, PageState state) {
- Integer size = (Integer) m_size.get(state);
+ int size = 0;
- if (size == null) {
+ if (m_size.get(state) == null) {
String key = (String) m_keywordModel.getSelectedKey(state);
- ImageAssetCollection c = ReusableImageAsset.
- getReusableImagesByKeyword(key, m_context);
- if (c == null) {
- return 0;
+
+ //HACK: (by Quasimodo)
+ // So, there is something broken. The selectedPage has to be resettet to
+ // 1, if the keyword changes and therefor the imageCollection changes its
+ // size.
+ // Also, setting the imaheCollection range in this method seems to be
+ // wrong, because it changes the funtionality from a getter method to
+ // something more complex.
+ if (m_key == null || (key != null && !m_key.equalsIgnoreCase(key))) {
+ paginator.setSelectedPageNum(state, 1);
+ m_key = key;
}
+ // End hack
+
+ ImageAssetCollection imageCollection = ReusableImageAsset.getReusableImagesByKeyword(key, m_context);
+ if (imageCollection != null) {
+ size = (int) imageCollection.size();
+ }
+
+ m_size.set(state, size);
- size = new Integer( (int) ReusableImageAsset.getReusableImagesByKeyword(key, m_context).size());
+ // This should not be done here.
+ imageCollection.setRange(new Integer(paginator.getFirst(state)),
+ new Integer(paginator.getLast(state) + 1));
+ m_imageColl.set(state, imageCollection);
- c.setRange(new Integer(paginator.getFirst(state)),
- new Integer(paginator.getLast(state) + 1));
-
- m_size.set(state, size);
- m_imageColl.set(state, c);
+ } else {
+ size = ((Integer) m_size.get(state)).intValue();
}
- return size.intValue();
+ return size;
}
public void setImageBrowser(ImageBrowser ib) {
@@ -134,11 +162,11 @@
}
/**
- * Indicates whether the paginator should be visible,
- * based on the visibility of the image browser itself.
+ * Indicates whether the paginator should be visible, based on the
+ * visibility of the image browser itself.
*
- * @return true if image browser is visible, or if the
- * associated image browser is unknown.
+ * @return true if image browser is visible, or if the associated image
+ * browser is unknown.
*/
public boolean isVisible(PageState state) {
return (m_imageBrowser != null) ? m_imageBrowser.isVisible(state) : true;
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -18,7 +18,6 @@
*/
package com.arsdigita.cms.ui;
-
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData;
@@ -41,12 +40,12 @@
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.util.GlobalizationUtil;
-
/**
- * Sticks a form at the top of an {@link ImageBrowser} in order to
- * search images by keyword
+ * Sticks a form at the top of an {@link ImageBrowser} in order to search images
+ * by keyword
*
* @author Stanislav Freidin (sfr...@ar...)
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
* @version $Id$
*/
public class ImageChooser extends BoxPanel {
@@ -56,11 +55,9 @@
private Paginator m_paginator;
private StringParameter m_keyword;
private SingleSelectionModel m_sel;
-
public static final String KEYWORD = "kw";
public static int LIST_SIZE = 20;
-
/**
* Construct a new ImageChooser
*
@@ -74,15 +71,12 @@
m_keyword = new StringParameter(KEYWORD);
m_sel = new ParameterSingleSelectionModel(m_keyword);
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);
modelBuilder.setImageBrowser(m_browser);
- m_paginator = new Paginator
- (modelBuilder,
- LIST_SIZE);
+ m_paginator = new Paginator(modelBuilder, LIST_SIZE);
super.add(m_form);
super.add(m_paginator);
super.add(m_browser);
@@ -112,6 +106,7 @@
/**
* Add the "keyword" parameter to the page state
*/
+ @Override
public void register(Page p) {
p.addComponent(this);
p.addComponentStateParam(this, m_keyword);
@@ -119,8 +114,7 @@
/**
* Add an action listener to the browser. The inner class
- * {@link ImageBrowser.LinkActionListener} will probably be
- * used here.
+ * {@link ImageBrowser.LinkActionListener} will probably be used here.
*
* @param l the action listener.
*/
@@ -129,8 +123,8 @@
}
/**
- * Add a submission listener to the form. The listener will
- * fire whenever a button on the form is clicked.
+ * Add a submission listener to the form. The listener will fire whenever a
+ * button on the form is clicked.
*
* @param l the action listener.
*/
@@ -153,8 +147,8 @@
}
/**
- * Set the specified keyword. All images matching the keyword
- * will be displayed in the browser.
+ * Set the specified keyword. All images matching the keyword will be
+ * displayed in the browser.
*
* @param state The page state
* @param word The new keyword
@@ -177,7 +171,7 @@
* @return the current keyword
*/
public String getKeyword(PageState state) {
- return (String)m_sel.getSelectedKey(state);
+ return (String) m_sel.getSelectedKey(state);
}
/**
@@ -207,29 +201,28 @@
* The form which specifies a keyword for the image browser.
*/
public static class ImageKeywordForm extends Form
- implements FormProcessListener, FormInitListener {
+ implements FormProcessListener, FormInitListener {
private SingleSelectionModel m_sel;
private SaveCancelSection m_saveCancel;
-
public static String WORD = "word";
/**
* Construct a new ImageKeywordForm
- * @param sel The SingleSelectionModel which the form will use to
- * set the keyword
+ *
+ * @param sel The SingleSelectionModel which the form will use to set
+ * the keyword
*/
public ImageKeywordForm(SingleSelectionModel sel) {
super("ImageKeywordForm", new BoxPanel(BoxPanel.HORIZONTAL));
m_sel = sel;
add(new Label(GlobalizationUtil.globalize("cms.ui.enter_a_keyword")));
- TextField t = new TextField(WORD);
- // allow null keyword field for view all
- //t.addValidationListener(new NotNullValidationListener("keyword"));
- add(t);
+ final TextField keyword = new TextField(WORD);
+ add(keyword);
m_saveCancel = new SaveCancelSection();
- m_saveCancel.getSaveButton().setButtonLabel("Search");
+ m_saveCancel.getSaveButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.search"));
+ m_saveCancel.getCancelButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.clear"));
add(m_saveCancel);
addProcessListener(this);
@@ -241,10 +234,10 @@
/**
* Set the keyword in the text widget
*/
- public void init(FormSectionEvent e) throws FormProcessException {
- PageState s = e.getPageState();
- FormData data = e.getFormData();
- data.put(WORD, m_sel.getSelectedKey(s));
+ public void init(final FormSectionEvent event) throws FormProcessException {
+ final PageState state = event.getPageState();
+ final FormData data = event.getFormData();
+ data.put(WORD, m_sel.getSelectedKey(state));
}
/**
@@ -261,10 +254,15 @@
return m_sel;
}
- public void process(FormSectionEvent e) {
- FormData data = e.getFormData();
- PageState state = e.getPageState();
- m_sel.setSelectedKey(state, (String)data.get(WORD));
+ public void process(final FormSectionEvent event) {
+ final FormData data = event.getFormData();
+ final PageState state = event.getPageState();
+ if (m_saveCancel.getCancelButton().isSelected(state)) {
+ m_sel.clearSelection(event.getPageState());
+ data.put(WORD, null);
+ } else {
+ m_sel.setSelectedKey(state, (String) data.get(WORD));
+ }
}
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -11,6 +11,7 @@
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;
@@ -20,7 +21,7 @@
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
-public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener {
+public abstract class ImageComponentAbstractListener implements FormInitListener, FormProcessListener, FormSubmissionListener {
private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
MapComponentSelectionModel m_imageComponent;
@@ -38,6 +39,15 @@
}
}
+ 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);
@@ -51,6 +61,9 @@
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) {
@@ -68,7 +81,6 @@
}
protected void setImageComponent(PageState ps, final String activeKey) {
- m_imageComponent.setSelectedKey(ps, activeKey);
if (s_log.isDebugEnabled()) {
s_log.debug("Selected component: " + activeKey);
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAdminListener.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -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);
+ }
+}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -17,18 +17,17 @@
*/
public class ImageComponentSelectListener extends ImageComponentAbstractListener {
- private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
+ private static final Logger S_LOG = Logger.getLogger(ImageComponentSelectListener.class);
+ private final ImageSelectResultPane m_resultPane;
- public ImageComponentSelectListener(MapComponentSelectionModel imageComponent) {
+ public ImageComponentSelectListener(MapComponentSelectionModel imageComponent, ImageSelectResultPane resultPane) {
super(imageComponent);
+ m_resultPane = resultPane;
}
protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) {
- // SELECT {
- String name = image.getDisplayName();
- BigDecimal id = image.getID();
- BigDecimal width = image.getWidth();
- BigDecimal height = image.getHeight();
- // SELECT }
+ m_resultPane.setResult(image.getDisplayName(), image.getID(), image.getWidth(), image.getHeight());
+
+ m_imageComponent.setSelectedKey(ps, ImageSelectPage.RESULT);
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -45,26 +45,26 @@
this(ImageComponent.ATTACH_IMAGE);
}
- public ImageLibraryComponent(int mode) {
+ public ImageLibraryComponent(final int mode) {
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(PageState ps, BigDecimal imageID) {
- ImagesPane.s_log.debug("Clicked delete");
- ReusableImageAsset image = new ReusableImageAsset(imageID);
+ 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(PageState ps, BigDecimal imageID) {
- ImagesPane.s_log.debug("Clicked select");
+ public void linkClicked(final PageState state, final BigDecimal imageID) {
+ ImagesPane.S_LOG.debug("Clicked select");
try {
- ReusableImageAsset image = new ReusableImageAsset(imageID);
- m_imageModel.setSelectedObject(ps, image);
+ final ReusableImageAsset image = new ReusableImageAsset(imageID);
+ m_imageModel.setSelectedObject(state, image);
} catch (DataObjectNotFoundException ex) {
- ImagesPane.s_log.error("Selected non-existant image: " + imageID, ex);
+ ImagesPane.S_LOG.error("Selected non-existant image: " + imageID, ex);
}
}
});
@@ -112,35 +112,35 @@
}
}
- public ReusableImageAsset getImage(FormSectionEvent event) {
- PageState ps = event.getPageState();
- return (ReusableImageAsset) m_imageModel.getSelectedItem(ps);
+ public ReusableImageAsset getImage(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (ReusableImageAsset) m_imageModel.getSelectedItem(state);
}
@Override
- public void register(Page p) {
- super.register(p);
- p.addComponentStateParam(this, m_imageID);
+ public void register(final Page page) {
+ super.register(page);
+ page.addComponentStateParam(this, m_imageID);
}
- public String getCaption(FormSectionEvent event) {
- PageState ps = event.getPageState();
- return (String) m_caption.getValue(ps);
+ public String getCaption(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_caption.getValue(state);
}
- public String getDescription(FormSectionEvent event) {
- PageState ps = event.getPageState();
- return (String) m_description.getValue(ps);
+ public String getDescription(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_description.getValue(state);
}
- public String getTitle(FormSectionEvent event) {
- PageState ps = event.getPageState();
- return (String) m_title.getValue(ps);
+ public String getTitle(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_title.getValue(state);
}
- public String getUseContext(FormSectionEvent event) {
- PageState ps = event.getPageState();
- return (String) m_useContext.getValue(ps);
+ public String getUseContext(final FormSectionEvent event) {
+ final PageState state = event.getPageState();
+ return (String) m_useContext.getValue(state);
}
public Form getForm() {
@@ -151,19 +151,20 @@
return m_saveCancel;
}
- public void addUploadLink(ActionListener actionListener) {
+ public void addUploadLink(final ActionListener actionListener) {
// Add action link to image upload component
if (m_mode != ImageComponent.DISPLAY_ONLY) {
- ActionLink upload = new ActionLink("Upload new image");
+ final ActionLink upload = new ActionLink("Upload new image");
upload.addActionListener(actionListener);
add(upload, ColumnPanel.FULL_WIDTH);
}
}
- // Reset this component
- public void reset(PageState ps) {
+ // Reset this component
+ public void reset(final PageState state) {
// clear selection
- m_imageModel.clearSelection(ps);
- m_chooser.clearKeyword(ps);
+ m_imageModel.clearSelection(state);
+ m_chooser.clearSelection(state);
+ m_chooser.clearKeyword(state);
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -12,8 +12,6 @@
import com.arsdigita.bebop.TabbedPane;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.RequestEvent;
-import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMSConfig;
@@ -28,11 +26,13 @@
*/
public class ImageSelectPage extends CMSPage {
- public static final Logger s_log = Logger.getLogger(ImagesPane.class);
+ 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;
@@ -40,9 +40,10 @@
private static final CMSConfig s_conf = CMSConfig.getInstance();
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
+ public static final String RESULT = "result";
public ImageSelectPage() {
- super(GlobalizationUtil.globalize("cms.ui.image_selelect.page_title").localize().toString(), new SimpleContainer());
+ super(GlobalizationUtil.globalize("cms.ui.image_select.page_title").localize().toString(), new SimpleContainer());
setClassAttr("cms-admin");
@@ -55,7 +56,8 @@
new ParameterSingleSelectionModel(m_imageComponentKey);
m_imageComponent =
new MapComponentSelectionModel(componentModel, new HashMap());
- m_selectListener = new ImageComponentSelectListener(m_imageComponent);
+
+ m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultPane());
m_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body");
@@ -73,9 +75,11 @@
if (m_tabbedPane.getCurrentPane(ps).equals(m_imageUpload)) {
m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
}
-
}
});
+
+ add(m_resultPane);
+
addGlobalStateParam(m_imageComponentKey);
}
@@ -100,6 +104,13 @@
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);
@@ -119,7 +130,7 @@
* @param tabName The name of the tab if it's added
* @param comp The component to add to the pane
*/
- protected void addToPane(TabbedPane pane, String tabName, Component comp) {
+ 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: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectResultPane.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -0,0 +1,86 @@
+/*
+ * 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 {
+
+ public static final int UNSET = 0;
+ public static final int CANCEL = 1;
+ public static final int SELECT = 2;
+ int m_state = UNSET;
+ 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_state = SELECT;
+ }
+
+ @Override
+ public void generateXML(PageState state, Element parent) {
+
+ if (m_state != UNSET) {
+
+ Element scriptElem = parent.newChildElement("script");
+ scriptElem.addAttribute("type", "text/javascript");
+ scriptElem.addAttribute("eventHandler", "onload");
+
+ StringBuilder script = new StringBuilder(1000);
+
+ script.append("alert(\"SCRIPT\");");
+
+ if (m_state == SELECT) {
+// script.append("window.opener.document.OpenCCM.imageSet(");
+ script.append("window.openCCM.imageSet(");
+ script.append("{");
+ script.append(" src : \"/theme/mandalay/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("self.close();");
+ script.append("return false;");
+ scriptElem.setText(script.toString());
+
+ }
+ }
+
+ public void reset(PageState state) {
+ m_name = null;
+ m_id = null;
+ m_width = null;
+ m_height = null;
+ m_state = UNSET;
+ }
+}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -8,7 +8,6 @@
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormSectionEvent;
@@ -114,7 +113,7 @@
// image.setDescription((String) m_caption.getValue(ps));
return image;
} catch (IOException ex) {
- ImagesPane.s_log.error("Error loading image from file", ex);
+ ImagesPane.S_LOG.error("Error loading image from file", ex);
throw new FormProcessException(ex.getMessage());
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -4,20 +4,32 @@
*/
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.SimpleComponent;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
+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;
@@ -28,114 +40,191 @@
*/
public class ImagesPane extends LayoutPanel implements Resettable {
- public static final Logger s_log = Logger.getLogger(ImagesPane.class);
- //private ImageChooser imageChooser;
+ 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 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() {
- // Left column is empty, this is only to provide the same layout for all
- // tabs in ContentSectionPage
- setLeft(new SimpleComponent());
+ super();
- SegmentedPanel body = new SegmentedPanel();
- setBody(body);
+ m_model = new ParameterSingleSelectionModel(new StringParameter(List.SELECTED));
+ m_model.addChangeListener(new ImageAdminSelectionListener());
+
+ m_links = new List(new ImageAdminListModelBuilder());
+ m_links.setSelectionModel(m_model);
+
+ final SimpleContainer left = new SimpleContainer();
+ setLeft(left);
+
+ final LinksSection staff = new LinksSection();
+ left.add(staff);
+
+ m_body = new SegmentedPanel();
+ setBody(m_body);
+
m_imageComponentKey = new StringParameter("imageComponent");
- ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey);
+ final ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey);
m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap());
- Map selectors = m_imageComponent.getComponentsMap();
-// m_adminListener = new ImageComponentAdminListener(m_imageComponent);
-
- ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
- // For future use
- //upload.getForm().addInitListener(m_adminListener);
- // upload.addProcessListener(m_adminListener);
- selectors.put(ImageComponent.UPLOAD, upload);
- body.addSegment(
- new Label(GlobalizationUtil.globalize("cms.ui.image_upload")),
- upload);
+ final Map selectors = m_imageComponent.getComponentsMap();
+ m_adminListener = new ImageComponentAdminListener(m_imageComponent, this);
- ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
- // For future use
- //library.getForm().addInitListener(m_adminListener);
- // library.getForm().addProcessListener(m_adminListener);
-// library.addUploadLink(new ActionListener() {
-//
-// public void actionPerformed(ActionEvent ev) {
-// setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
-// }
-// });
+ final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
+ library.getForm().addInitListener(m_adminListener);
+ library.getForm().addProcessListener(m_adminListener);
+ library.addUploadLink(m_adminListener);
selectors.put(ImageComponent.LIBRARY, library);
- body.addSegment(
+ m_bodySegments.put(ImageComponent.LIBRARY, m_body.addSegment(
new Label(GlobalizationUtil.globalize("cms.ui.image_library")),
- library);
+ library));
+ final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
+ upload.getForm().addInitListener(m_adminListener);
+ upload.getForm().addSubmissionListener(m_adminListener);
+ upload.getForm().addProcessListener(m_adminListener);
+ selectors.put(ImageComponent.UPLOAD, upload);
+ m_bodySegments.put(ImageComponent.UPLOAD, m_body.addSegment(
+ new Label(GlobalizationUtil.globalize("cms.ui.image_upload")),
+ upload));
+
}
@Override
- public final void register(Page page) {
+ public final void register(final Page page) {
super.register(page);
- Map componentsMap = m_imageComponent.getComponentsMap();
-// Iterator i = componentsMap.keySet().iterator();
-// while (i.hasNext()) {
-// Object key = i.next();
-// Component component = (Component) componentsMap.get(key);
-//
-// page.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
-// }
+ Iterator<String> keys = m_bodySegments.keySet().iterator();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ page.setVisibleDefault(m_bodySegments.get(key), ImageComponent.LIBRARY.equals(key));
+// for (int index = 0; index < m_bodySegments.get(key).size(); index++) {
+
+// Component component = m_bodySegments.get(key).get(index);
+// page.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
+// }
+ }
+
+ // final Map componentsMap = m_imageComponent.getComponentsMap();
+ //
+ // final Iterator keyIter = componentsMap.keySet().iterator();
+ // while (keyIter.hasNext()) {
+ // final Object key = keyIter.next();
+ // final Component component = (Component) componentsMap.get(key);
+ //
+ // page.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
+ // }
+ //
page.addComponentStateParam(this, m_imageComponentKey);
}
@Override
- public final void reset(PageState state) {
+ public final void reset(final PageState state) {
super.reset(state);
- }
- private final class SubmissionListener implements FormSubmissionListener {
+ Iterator<String> keys = m_bodySegments.keySet().iterator();
- public final void submitted(final FormSectionEvent e) {
- final PageState s = e.getPageState();
+ while (keys.hasNext()) {
+ String key = keys.next();
+ state.setVisible(m_bodySegments.get(key), ImageComponent.LIBRARY.equals(key));
+ for (int index = 0; index < m_bodySegments.get(key).size(); index++) {
+
+ Component component = m_bodySegments.get(key).get(index);
+// state.setVisible(component, ImageComponent.LIBRARY.equals(key));
+ // Reset all components if they are of type Resettable
+
+ if (component instanceof Resettable) {
+ ((Resettable) component).reset(state);
+ }
+ }
}
- }
-
-// private void setImageComponent(PageState ps, final String activeKey) {
-// m_imageComponent.setSelectedKey(ps, activeKey);
+
+
+// final Map componentsMap = m_imageComponent.getComponentsMap();
+// m_imageComponent.setSelectedKey(state, ImageComponent.LIBRARY);
+// final Iterator keyIter = componentsMap.keySet().iterator();
+// while (keyIter.hasNext()) {
+// final Object key = keyIter.next();
+// final Component component = (Component) componentsMap.get(key);
//
-// if (s_log.isDebugEnabled()) {
-// s_log.debug("Selected component: " + activeKey);
-// }
+// state.setVisible(component, ImageComponent.LIBRARY.equals(key));
//
-// 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);
+// // Reset all components if they are of type Resettable
+// if (component instanceof Resettable) {
+// ((Resettable) component).reset(state);
// }
-//
-// ps.setVisible(component, isVisible);
// }
-// }
+ }
-// public void init(FormSectionEvent event)
-// throws FormProcessException {
-// PageState ps = event.getPageState();
-// setImageComponent(ps, ImageComponent.LIBRARY);
-//
-//// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
-//// if (null == attachment) {
-// // XXX: Do something
-//// }
-// }
+ private class ImageAdminListModel implements ListModel {
+
+ private ArrayList<String> m_keys;
+ private int m_index = -1;
+
+ public ImageAdminListModel(ArrayList keys) {
+ m_keys = keys;
+ }
+
+ public boolean next() {
+ return (m_index++ < m_keys.size() - 1);
+ }
+
+ public Object getElement() {
+ return GlobalizationUtil.globalize("cms.ui.image_" + m_keys.get(m_index)).localize();
+ }
+
+ public String getKey() {
+ return m_keys.get(m_index);
+ }
+ }
+
+ private class ImageAdminListModelBuilder extends LockableImpl implements ListModelBuilder {
+
+ public ListModel makeModel(final List list, final PageState state) {
+ ArrayList<String> keys = new ArrayList(2);
+ keys.add(ImageComponent.LIBRARY);
+ keys.add(ImageComponent.UPLOAD);
+ return new ImageAdminListModel(keys);
+ }
+ }
+
+ private class ImageAdminSelectionListener implements ChangeListener {
+
+ public final void stateChanged(final ChangeEvent e) {
+ S_LOG.debug("Selection state changed; I may change "
+ + "the body's visible pane");
+
+ final PageState state = e.getPageState();
+
+// getBody().reset(state);
+
+ if (m_model.isSelected(state)) {
+ S_LOG.debug("The selection model is selected; displaying "
+ + "the item pane");
+
+// getBody().push(state, getItemPane());
+ }
+ }
+ }
+
+ private class LinksSection extends Section {
+
+ LinksSection() {
+ setHeading(GlobalizationUtil.globalize("cms.ui.images_links"));
+
+ final ActionGroup group = new ActionGroup();
+ setBody(group);
+
+ group.setSubject(m_links);
+ }
+ }
}
Modified: trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
===================================================================
--- trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 18:04:05 UTC (rev 2379)
@@ -286,12 +286,15 @@
OpenCCM.prototype.imageBrowse = function(window)
{
- this.imageSet({
- src : "/theme/mandalay/ccm/cms-service/stream/image/?image_id=9001",
- width : "304",
- height : "420",
- name : "Schild.jpg"
- });
+ var baseURL = window.location.href;
+ var offset = baseURL.lastIndexOf("/");
+ var destURL = baseURL.slice(0, offset+1) + "image_select.jsp";
+
+// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true});
+// searchDialog.show();
+ var selectWindow = window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no");
+ selectWindow.openCCM = this;
+// return false;
};
OpenCCM.prototype.imageSet = function(imageData)
Modified: trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js
===================================================================
--- trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/links/links.js 2012-12-16 18:04:05 UTC (rev 2379)
@@ -204,13 +204,13 @@
OpenCCM.prototype.linkBrowse = function(window)
{
- baseURL = window.location.href;//.pathname;
- offset = baseURL.lastIndexOf("/");
- destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')";
+ var baseURL = window.location.href;
+ var offset = baseURL.lastIndexOf("/");
+ var destURL = baseURL.slice(0, offset+1) + "search.jsp?useURL=true&widget=getElementById('" + this.dialogs["links"].id["ci_href"] + "')";
// var searchDialog = new Xinha.Dialog(this.editor, destURL, '');//,{width:800, height:600}, {'closable':true});
// searchDialog.show();
- window.open(destURL, "_blank", "directories=no,toolbar=no,width=600,height=400,status=no,menubar=no");
+ window.open(destURL, "_blank", "scrollbars=yes,directories=no,toolbar=no,width=800,height=600,status=no,menubar=no");
return false;
}
Modified: trunk/ccm-core/src/com/arsdigita/bebop/Paginator.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/bebop/Paginator.java 2012-12-16 17:51:19 UTC (rev 2378)
+++ trunk/ccm-core/src/com/arsdigita/bebop/Paginator.java 2012-12-16 18:04:05 UTC (rev 2379)
@@ -18,7 +18,6 @@
*/
package com.arsdigita.bebop;
-
import com.arsdigita.bebop.list.ListModel;
import com.arsdigita.bebop.list.ListModelBuilder;
import com.arsdigita.bebop.parameters.IntegerParameter;
@@ -27,12 +26,12 @@
import com.arsdigita.xml.Element;
/**
- * A pagination component
- * used to select different page views from a list of items.
+ * A pagination component used to select different page views from a list of
+ * items.
*
* <p>In most cases, this component will be used with either a {@link
- * List} or a {@link Table}. Here is an example on how to use this
- * pagination component with a Table:
+ * List} or a {@link Table}. Here is an example on how to use this pagination
+ * component with a Table:
*
* <blockquote><pre><code>
* Table myTable = new Table(new myTableModelBuilder(),
@@ -44,11 +43,11 @@
* p.add(myTable);
* </code></pre></blockquote>
*
- * <p>The model builder that is used in <code>myTable</code> was designed
- * to also implement the {@link PaginationModelBuilder}
- * interface. With both interfaces being implemented by the same
- * class, it is much easier to cache the results of operations
- * performed on the {@link com.arsdigita.persistence.DataQuery} used to generate the results.
+ * <p>The model builder that is used in
+ * <code>myTable</code> was designed to also implement the {@link PaginationModelBuilder}
+ * interface. With both interfaces being implemented by the same class, it is
+ * much easier to cache the results of operations performed on the {@link com.arsdigita.persistence.DataQuery}
+ * used to generate the results.
*
* <blockquote><pre><code>
* public class myTableModelBuilder extends LockableImpl
@@ -79,16 +78,16 @@
* }
* </code></pre></blockquote>
*
- * <p>Subclasses that wish to render the page links in a different format
- * will override the {@link #buildPaginationDisplay()} method. The
- * implementation of this method must set the selection model used to
- * retrieve the page number by calling the {@link
- * #setPageNumSelectionModel(SingleSelectionModel)} method. Aside from
- * changing the display, this pagination component will hide itself if
- * {@link PaginationModelBuilder#getTotalSize(Paginator, PageState)}
- * is less than the page size (i.e., a single page can be used to
- * display the entire results). This default behavior can be changed
- * by calling {@link #setHiddenIfSinglePage(boolean)} with
+ * <p>Subclasses that wish to render the page links in a different format will
+ * override the {@link #buildPaginationDisplay()} method. The implementation of
+ * this method must set the selection model used to retrieve the page number by
+ * calling the {@link
+ * #setPageNumSelectionModel(SingleSelectionModel)} method. Aside from changing
+ * the display, this pagination component will hide itself if
+ * {@link PaginationModelBuilder#getTotalSize(Paginator, PageState)} is less
+ * than the page size (i.e., a single page can be used to display the entire
+ * results). This default behavior can be changed by calling {@link #setHiddenIfSinglePage(boolean)}
+ * with
* <code>false</code>.
*
* @see PaginationModelBuilder
@@ -96,48 +95,44 @@
* @author Phong Nguyen
* @version $Id$
* @since 4.6.10
- **/
+ *
+ */
public class Paginator extends SimpleContainer implements Resettable {
// $Change: 44247 $
// $Revision: #16 $
// $DateTime: 2004/08/16 18:10:38 $
// $Author$
-
// The builder which returns the total number of items to
// paginate.
private PaginationModelBuilder m_builder;
-
// The selection model that returns the selected page number. The
// contained ParameterModel should be a StringParameter, since
// this is the default for List and Table.
private SingleSelectionModel m_pageNumModel;
-
// The selection model that returns the number of items to display
// for one page.
private SingleSelectionModel m_pageSizeModel;
-
// This is used to determine if this component should be hidden
// when there is only a single page to display. Defaults to true.
private boolean m_hiddenIfSinglePage;
-
// A label that contains a space, " ". This is used to insert
// spaces between the page links from within the list's
// generateXML() method.
private BoxPanel m_spacePanel;
private Label m_space;
-
// defined in List.java
private static final String _SELECT_EVENT = "s";
/**
* Constructor.
*
- * @param builder The builder used to retrieve the total number of
- * results to paginate.
- * @param defaultPageSize The default number of results to display on
- * each page.
- **/
+ * @param builder The builder used to retrieve the total number of results
+ * to paginate.
+ * @param defaultPageSize The default number of results to display on each
+ * page.
+ *
+ */
public Paginator(PaginationModelBuilder builder, int defaultPageSize) {
super();
@@ -157,16 +152,15 @@
}
/**
- * Builds the display for rendering the page links. Subclasses can
- * override this method to provide a different rendering of the
- * page links. If this is the case, make sure that the {@link
- * #setPageNumSelectionModel(SingleSelectionModel)} method is
- * called to set the selection model for retrieving the selected
- * page number.
- **/
+ * Builds the display for rendering the page links. Subclasses can override
+ * this method to provide a different rendering of the page links. If this
+ * is the case, make sure that the {@link
+ * #setPageNumSelectionModel(SingleSelectionModel)} method is called to set
+ * the selection model for retrieving the selected page number.
+ *
+ */
protected void buildPaginationDisplay() {
- PaginatorList list = new PaginatorList
- (new PageListModelBuilder(this, getPaginationModelBuilder()));
+ PaginatorList list = new PaginatorList(new PageListModelBuilder(this, getPaginationModelBuilder()));
setPageNumSelectionModel(list.getSelectionModel());
// This is used within the list's generateXML() method to
@@ -183,14 +177,14 @@
}
/**
- * Sets the selection model that is used for returning the
- * selected page number. Subclasses that override the {@link
- * #buildPaginationDisplay()} method will need to call this
- * method.
+ * Sets the selection model that is used for returning the selected page
+ * number. Subclasses that override the {@link
+ * #buildPaginationDisplay()} method will need to call this method.
*
- * @param pageNumModel The selection model used for returning the
- * selected page number.
- **/
+ * @param pageNumModel The selection model used for returning the selected
+ * page number.
+ *
+ */
protected void setPageNumSelectionModel(SingleSelectionModel pageNumModel) {
m_pageNumModel = pageNumModel;
}
@@ -200,7 +194,8 @@
*
* @param state Represents the current state of the request.
* @return The selected page number.
- **/
+ *
+ */
public int getSelectedPageNum(PageState state) {
String pageNum = (String) m_pageNumModel.getSelectedKey(state);
if (pageNum == null) {
@@ -215,7 +210,8 @@
*
* @param state Represents the current state of the request.
* @param pageNum The number of the page to set as selected.
- **/
+ *
+ */
public void setSelectedPageNum(PageState state, int pageNum) {
m_pageNumModel.setSelectedKey(state, String.valueOf(pageNum));
}
@@ -225,7 +221,8 @@
*
* @param state Represents the current state of the request.
* @return The number of items to display per page.
- **/
+ *
+ */
public int getPageSize(PageState state) {
return ((Integer) m_pageSizeModel.getSelectedKey(state)).intValue();
}
@@ -235,22 +232,23 @@
*
* @param state Represents the current state of the request.
* @param pageSize The number of items to display per page.
- **/
+ *
+ */
public void setPageSize(PageState state, int pageSize) {
m_pageSizeModel.setSelectedKey(state, new Integer(pageSize));
}
/**
- * This returns the total number of pages that will be displayed
- * by this paginator.
+ * This returns the total ...
[truncated message content] |
|
From: <pb...@fe...> - 2012-12-16 17:51:29
|
Author: pboy
Date: 2012-12-16 17:51:19 +0000 (Sun, 16 Dec 2012)
New Revision: 2378
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
Log:
Various fixes ItemSearchWidget, fixed upgrade scripts (on behalt of JensP).
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactAddForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonAddForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSubordinateOrgaUnitAddForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -42,6 +42,7 @@
ITEM_SEARCH,
ContentType.findByAssociatedObjectType(
customizer.getSubordinateOrgaUnitType()));
+ itemSearch.setDisableCreatePane(true);
add(itemSearch);
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitSuperiorOrgaUnitAddForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -39,6 +39,7 @@
ITEM_SEARCH,
ContentType.findByAssociatedObjectType(
customizer.getSuperiorOrgaUnitType()));
+ itemSearch.setDisableCreatePane(true);
add(itemSearch);
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -55,7 +55,7 @@
"cms.contenttypes.ui.person.alias.select").localize()));
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(
- "com.arsdigita.cms.contenttypes.GenericPerson"));
+ "com.arsdigita.cms.contenttypes.GenericPerson"));
add(itemSearch);
}
@@ -87,6 +87,7 @@
getLanguage());
person.setAlias(alias);
+ itemSearch.publishCreatedItem(data, alias);
}
init(fse);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractAssocUpgrade.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -187,12 +187,12 @@
final StringBuilder attributeValues = new StringBuilder();
for (Map.Entry<String, String> attribute : getAttributes().entrySet()) {
attributeValues.append(",");
- if (attribute.getValue().startsWith("character")) {
- attributeValues.append('\"');
+ if (attribute.getValue().startsWith("character") || attribute.getValue().startsWith("BIT") || attribute.getValue().startsWith("boolean")) {
+ attributeValues.append('\'');
}
attributeValues.append(entry.getAttributes().get(attribute.getKey()));
- if (attribute.getValue().startsWith("character")) {
- attributeValues.append('\"');
+ if (attribute.getValue().startsWith("character") || attribute.getValue().startsWith("BIT") || attribute.getValue().startsWith("boolean")) {
+ attributeValues.append('\'');
}
}
stmt.addBatch(String.format("INSERT INTO %s ("
Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/AbstractBundleUpgrade.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -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 "
@@ -88,20 +88,21 @@
"SELECT parent_id "
+ "FROM cms_items "
+ "JOIN %s "
- + "ON cms_items.item_id = %s.bundle_id",
- getBundleTableName(),
- getBundleTableName()));
+ + "ON cms_items.item_id = %s.%s;",
+ getContentItemTableName(),
+ getContentItemTableName(),
+ getIdColName()));
while (personsRs.next()) {
stmt.addBatch(String.format("INSERT INTO %s (bundle_id) "
- + "VALUES (%d)",
- getBundleClassName(),
+ + "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: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -28,9 +28,9 @@
//Reload authoring steps
XMLContentTypeHandler handler = new XMLContentTypeHandler();
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericContact.xml", handler);
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.xml", handler);
- XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericPerson.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericContact.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericOrganizationalUnit.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/GenericPerson.xml", handler);
}
public static void main(final String[] args) {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -25,6 +25,7 @@
import com.arsdigita.bebop.event.RequestEvent;
import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.bebop.parameters.BooleanParameter;
import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMSConfig;
@@ -85,6 +86,7 @@
addGlobalStateParam(new StringParameter("publishWidget"));
addGlobalStateParam(new StringParameter("defaultCreationFolder"));
addGlobalStateParam(new IntegerParameter("lastTab"));
+ addGlobalStateParam(new BooleanParameter("disableCreatePane"));
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
addGlobalStateParam(m_sectionId);
@@ -103,10 +105,11 @@
final PageState state = event.getPageState();
final String query = (String) state.getValue(new StringParameter(ItemSearchPopup.QUERY));
+ final Boolean disableCreatePane = (Boolean) state.getValue(new BooleanParameter("disableCreatePane"));
BigDecimal typeParam =
(BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
- if (typeParam == null) {
+ if ((typeParam == null) || disableCreatePane) {
m_tabbedPane.setTabVisible(state, m_create, false);
m_create.setVisible(state, false);
} else {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 17:47:04 UTC (rev 2377)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 17:51:19 UTC (rev 2378)
@@ -80,6 +80,7 @@
private Folder m_defaultCreationFolder;
private ParameterModel m_model;
private ParameterModel m_searchModel;
+ private boolean disableCreatePane = false;
private String searchLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.search").localize();
private String selectedLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.selected").localize();
public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch";
@@ -275,6 +276,7 @@
params.setParameter("single_type", typeURLFrag);
}
params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']");
+ params.setParameter("disableCreatePane", Boolean.toString(disableCreatePane));
if (m_defaultCreationFolder != null) {
params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
@@ -523,4 +525,12 @@
}
}
}
+
+ public boolean getDisableCreatePane() {
+ return disableCreatePane;
+ }
+
+ public void setDisableCreatePane(final boolean disableCreatePane) {
+ this.disableCreatePane = disableCreatePane;
+ }
}
\ No newline at end of file
|
|
From: <pb...@fe...> - 2012-12-16 17:47:15
|
Author: pboy
Date: 2012-12-16 17:47:04 +0000 (Sun, 16 Dec 2012)
New Revision: 2377
Added:
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
Removed:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java
Modified:
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java
Log:
ImageSelectPage & ImagePane: Various fixes (on behalf of quasimodo)
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAbstractListener.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -0,0 +1,92 @@
+/*
+ * 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.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 {
+
+ 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 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 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) {
+ m_imageComponent.setSelectedKey(ps, 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);
+ }
+ }
+}
Deleted: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -1,116 +0,0 @@
-/*
- * 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.cms.ReusableImageAsset;
-import java.util.Iterator;
-import java.util.Map;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Sören Bernstein (quasimodo) <sbe...@ze...>
- */
-public class ImageComponentAttachListener implements FormInitListener, FormProcessListener {
-
- private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
- MapComponentSelectionModel m_imageComponent;
-
- public ImageComponentAttachListener(MapComponentSelectionModel imageComponent) {
- super();
- m_imageComponent = imageComponent;
- }
-
- public void init(FormSectionEvent event)
- throws FormProcessException {
- PageState ps = event.getPageState();
- setImageComponent(ps, ImageComponent.LIBRARY);
-
-// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
-// if (null == attachment) {
- // XXX: Do something
-// }
- }
-
- 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);
-
-
-// ContentItem item = m_imageStep.getItem(ps);
-// if (null == item) {
-// s_log.error("No item selected in ImageStepEdit",
-// new RuntimeException());
-// return;
-// }
-
-// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
-// if (null == attachment) {
-// attachment = new ItemImageAttachment(item, image);
-// }
-// attachment.setCaption(component.getCaption(event));
-
- // We only set the description and title based on the UI in
- // the case where getIsImageStepDescriptionAndTitleShown is true.
- // Otherwise, we leave this as the default value. This means
- // existing values are not overwritten if the image is edited when
- // isImageStepDescriptionAndTitleShown is false.
-// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
-// attachment.setDescription(component.getDescription(event));
-// attachment.setTitle(component.getTitle(event));
-// }
-// attachment.setUseContext(component.getUseContext(event));
- }
-
- private 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);
-
- }
-
- private void setImageComponent(PageState ps, final String activeKey) {
- m_imageComponent.setSelectedKey(ps, 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);
- }
- }
-}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -4,51 +4,26 @@
*/
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.cms.ReusableImageAsset;
import java.math.BigDecimal;
-import java.util.Iterator;
-import java.util.Map;
import org.apache.log4j.Logger;
/**
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
-public class ImageComponentSelectListener implements FormInitListener, FormProcessListener {
+public class ImageComponentSelectListener extends ImageComponentAbstractListener {
private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
- MapComponentSelectionModel m_imageComponent;
public ImageComponentSelectListener(MapComponentSelectionModel imageComponent) {
- super();
- m_imageComponent = imageComponent;
+ super(imageComponent);
}
- public void init(FormSectionEvent event)
- throws FormProcessException {
- PageState ps = event.getPageState();
-
- this.m_imageComponent.getComponent(ps);
- setImageComponent(ps, ImageComponent.LIBRARY);
- }
-
- 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);
-
+ protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) {
// SELECT {
String name = image.getDisplayName();
BigDecimal id = image.getID();
@@ -56,41 +31,4 @@
BigDecimal height = image.getHeight();
// SELECT }
}
-
- private 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);
-
- }
-
- private void setImageComponent(PageState ps, final String activeKey) {
- m_imageComponent.setSelectedKey(ps, 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);
- }
- }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -10,6 +10,7 @@
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;
@@ -27,7 +28,7 @@
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
-public class ImageLibraryComponent extends SimpleContainer implements ImageComponent {
+public class ImageLibraryComponent extends SimpleContainer implements ImageComponent, Resettable {
private final ImageChooser m_chooser;
private final ItemSelectionModel m_imageModel;
@@ -158,4 +159,11 @@
add(upload, ColumnPanel.FULL_WIDTH);
}
}
+
+ // Reset this component
+ public void reset(PageState ps) {
+ // clear selection
+ m_imageModel.clearSelection(ps);
+ m_chooser.clearKeyword(ps);
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -6,9 +6,14 @@
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.event.RequestEvent;
+import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.CMSConfig;
@@ -31,6 +36,7 @@
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();
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
@@ -49,20 +55,35 @@
new ParameterSingleSelectionModel(m_imageComponentKey);
m_imageComponent =
new MapComponentSelectionModel(componentModel, new HashMap());
+ m_selectListener = new ImageComponentSelectListener(m_imageComponent);
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);
+ }
+
+ }
+ });
addGlobalStateParam(m_imageComponentKey);
}
protected ImageLibraryComponent getImageLibraryPane() {
if (m_imageLibrary == null) {
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE);
- m_imageLibrary.getForm().addInitListener(new ImageComponentSelectListener(m_imageComponent));
- m_imageLibrary.getForm().addProcessListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageLibrary.getForm().addInitListener(m_selectListener);
+ m_imageLibrary.getForm().addProcessListener(m_selectListener);
m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, m_imageLibrary);
}
return m_imageLibrary;
@@ -72,8 +93,8 @@
if (m_imageUpload == null) {
m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
- m_imageUpload.getForm().addInitListener(new ImageComponentSelectListener(m_imageComponent));
- m_imageUpload.getForm().addProcessListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageUpload.getForm().addInitListener(m_selectListener);
+ m_imageUpload.getForm().addProcessListener(m_selectListener);
m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, m_imageUpload);
}
return m_imageUpload;
@@ -83,8 +104,8 @@
TabbedPane pane = new TabbedPane();
pane.setClassAttr(XSL_CLASS);
- addToPane(pane, "library", getImageLibraryPane());
- addToPane(pane, "upload", getImageUploadPane());
+ addToPane(pane, ImageComponent.LIBRARY, getImageLibraryPane());
+ addToPane(pane, ImageComponent.UPLOAD, getImageUploadPane());
pane.setDefaultPane(m_imageLibrary);
return pane;
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -32,6 +32,7 @@
//private ImageChooser imageChooser;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
+// private final ImageComponentAdminListener m_adminListener;
public ImagesPane() {
// Left column is empty, this is only to provide the same layout for all
@@ -47,20 +48,21 @@
m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap());
Map selectors = m_imageComponent.getComponentsMap();
-
+// m_adminListener = new ImageComponentAdminListener(m_imageComponent);
+
ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
- //upload.getForm().addInitListener(new ImageComponentAdminListener(m_imageComponent));
// For future use
- // upload.addProcessListener(new ImageComponentAdminListener(m_imageComponent));
+ //upload.getForm().addInitListener(m_adminListener);
+ // upload.addProcessListener(m_adminListener);
selectors.put(ImageComponent.UPLOAD, upload);
body.addSegment(
new Label(GlobalizationUtil.globalize("cms.ui.image_upload")),
upload);
ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
- //library.getForm().addInitListener(new ImageComponentAdminListener(m_imageComponent));
// For future use
- // library.getForm().addProcessListener(new ImageComponentAdminListener);
+ //library.getForm().addInitListener(m_adminListener);
+ // library.getForm().addProcessListener(m_adminListener);
// library.addUploadLink(new ActionListener() {
//
// public void actionPerformed(ActionEvent ev) {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/SecurityPropertyEditor.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -225,6 +225,7 @@
* @param form The form
* @param cancelButton the "Cancel" button on the form
*/
+ @Override
public void addListeners(FormSection form, Submit cancelButton) {
addSecurityListener(form);
super.addListeners(form, cancelButton);
@@ -247,6 +248,7 @@
super();
}
+ @Override
public PropertyEditorModel makeModel(PropertyEditor p, PageState s) {
return new AccessListModel (
getProperties(p),
@@ -273,16 +275,19 @@
m_manager = Utilities.getSecurityManager(m_state);
}
+ @Override
public boolean next() {
while(super.next()) {
Object key = getKey();
ComponentAccess ca = (ComponentAccess)m_access.get(key);
- if(ca == null) // No access restricitons
+ if(ca == null) {
return true;
+ }
- if ( ca.canAccess(m_state, m_manager) ) // Access checks out
+ if ( ca.canAccess(m_state, m_manager) ) {
return true;
+ }
// Otherwise, skip the property
}
Added: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java (rev 0)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -0,0 +1,48 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.arsdigita.cms.contentassets.ui;
+
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.cms.ContentItem;
+import com.arsdigita.cms.ReusableImageAsset;
+import com.arsdigita.cms.contentassets.ItemImageAttachment;
+import com.arsdigita.cms.ui.ImageComponent;
+import com.arsdigita.cms.ui.ImageComponentAbstractListener;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageComponentAttachListener extends ImageComponentAbstractListener {
+
+ private final ImageStep m_imageStep;
+ private static final Logger s_log = Logger.getLogger(ImageComponentAttachListener.class);
+
+ public ImageComponentAttachListener(MapComponentSelectionModel imageComponent, ImageStep imageStep) {
+ super(imageComponent);
+ m_imageStep = imageStep;
+ }
+
+ @Override
+ protected void processImage(FormSectionEvent event, PageState ps, ImageComponent component, ReusableImageAsset image) {
+ ContentItem item = m_imageStep.getItem(ps);
+ if (null == item) {
+ s_log.error("No item selected in ImageStepEdit",
+ new RuntimeException());
+ return;
+ }
+ ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+ if (null == attachment) {
+ attachment = new ItemImageAttachment(item, image);
+ }
+
+ attachment.setCaption(component.getCaption(event));
+
+// setImageComponent(ps, ImageComponent.LIBRARY);
+ }
+}
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -75,7 +75,6 @@
new WorkflowLockedComponentAccess( m_add, m_itemSelection );
addComponent( "add", "Add Image", addCA );
-
m_display = new ImageStepDisplay( this );
setDisplayComponent(m_display);
@@ -175,4 +174,10 @@
return m_attachmentOID;
}
}
+
+ @Override
+ public void showDisplayPane(PageState state) {
+ super.showDisplayPane(state);
+ m_add.reset(state);
+ }
}
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 09:35:50 UTC (rev 2376)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 17:47:04 UTC (rev 2377)
@@ -27,15 +27,11 @@
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.ParameterEvent;
import com.arsdigita.bebop.event.ParameterListener;
import com.arsdigita.bebop.parameters.ParameterData;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.cms.ui.ImageLibraryComponent;
@@ -47,16 +43,18 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
-
import org.apache.log4j.Logger;
public class ImageStepEdit extends SimpleContainer
- implements Resettable, FormProcessListener, FormInitListener {
+ implements Resettable/*
+ * , FormProcessListener, FormInitListener
+ */ {
private static final Logger s_log = Logger.getLogger(ImageStepEdit.class);
private final ImageStep m_imageStep;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
+ private final ImageComponentAttachListener m_attachListener;
public ImageStepEdit(ImageStep step) {
m_imageStep = step;
@@ -69,10 +67,11 @@
new MapComponentSelectionModel(componentModel, new HashMap());
Map selectors = m_imageComponent.getComponentsMap();
+ m_attachListener = new ImageComponentAttachListener(m_imageComponent, m_imageStep);
ImageLibraryComponent library = new ImageLibraryComponent();
- library.getForm().addInitListener(this);
- library.getForm().addProcessListener(this);
+ library.getForm().addInitListener(m_attachListener);
+ library.getForm().addProcessListener(m_attachListener);
library.addUploadLink(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
@@ -81,10 +80,10 @@
});
selectors.put(ImageComponent.LIBRARY, library);
add(library);
-
+
ImageUploadComponent upload = new ImageUploadComponent();
- upload.getForm().addInitListener(this);
- upload.getForm().addProcessListener(this);
+ upload.getForm().addInitListener(m_attachListener);
+ upload.getForm().addProcessListener(m_attachListener);
selectors.put(ImageComponent.UPLOAD, upload);
add(upload);
@@ -110,20 +109,6 @@
return m_imageComponent.getComponentsMap().values().iterator();
}
- private 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);
-
- }
-
private void setImageComponent(PageState ps, final String activeKey) {
m_imageComponent.setSelectedKey(ps, activeKey);
@@ -147,64 +132,34 @@
}
}
- public void init(FormSectionEvent event)
- throws FormProcessException {
- PageState ps = event.getPageState();
-
- ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
- if (null == attachment) {
- // XXX: Do something
- }
- }
-
- public void process(FormSectionEvent event) throws FormProcessException {
- PageState ps = event.getPageState();
- ImageComponent component = getImageComponent(ps);
-
- if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
- return;
- }
-
- ContentItem item = m_imageStep.getItem(ps);
- if (null == item) {
- s_log.error("No item selected in ImageStepEdit",
- new RuntimeException());
- return;
- }
-
- ReusableImageAsset image = component.getImage(event);
-
- ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
- if (null == attachment) {
- attachment = new ItemImageAttachment(item, image);
- }
- attachment.setCaption(component.getCaption(event));
-
- // We only set the description and title based on the UI in
- // the case where getIsImageStepDescriptionAndTitleShown is true.
- // Otherwise, we leave this as the default value. This means
- // existing values are not overwritten if the image is edited when
- // isImageStepDescriptionAndTitleShown is false.
- if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
- attachment.setDescription(component.getDescription(event));
- attachment.setTitle(component.getTitle(event));
- }
- attachment.setUseContext(component.getUseContext(event));
- }
-
- public void reset(PageState state) {
- Page p = state.getPage();
-
+ // Reset this component and all of it's resettable childs
+ public void reset(PageState ps) {
Map componentsMap = m_imageComponent.getComponentsMap();
+ m_imageComponent.setSelectedKey(ps, ImageComponent.LIBRARY);
Iterator i = componentsMap.keySet().iterator();
while (i.hasNext()) {
Object key = i.next();
Component component = (Component) componentsMap.get(key);
- p.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
+ ps.setVisible(component, ImageComponent.LIBRARY.equals(key));
+
+ // Reset all components if they are of type Resettable
+ if (component instanceof Resettable) {
+ ((Resettable) component).reset(ps);
+ }
}
}
+ // We only set the description and title based on the UI in
+ // the case where getIsImageStepDescriptionAndTitleShown is true.
+ // Otherwise, we leave this as the default value. This means
+ // existing values are not overwritten if the image is edited when
+ // isImageStepDescriptionAndTitleShown is false.
+// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
+// attachment.setDescription(component.getDescription(event));
+// attachment.setTitle(component.getTitle(event));
+// }
+// attachment.setUseContext(component.getUseContext(event));
private class UniqueUseContextListener implements ParameterListener {
public void validate(ParameterEvent ev)
|
|
From: <pb...@fe...> - 2012-12-16 09:36:00
|
Author: pboy
Date: 2012-12-16 09:35:50 +0000 (Sun, 16 Dec 2012)
New Revision: 2376
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
Log:
Various fixes ItemSearchWidget (on behalt of JensP).
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -5,7 +5,7 @@
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel;
-import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
@@ -15,7 +15,7 @@
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SegmentedPanel.Segment;
import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.FormCancelListener;
+import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
@@ -25,32 +25,31 @@
import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.NewItemForm;
-import com.arsdigita.cms.ui.authoring.WizardSelector;
import com.arsdigita.cms.ui.folder.FlatFolderPicker;
import com.arsdigita.cms.ui.folder.FolderRequestLocal;
import com.arsdigita.cms.ui.folder.FolderSelectionModel;
import com.arsdigita.cms.ui.item.ContentItemRequestLocal;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.persistence.OID;
-import com.arsdigita.web.RedirectSignal;
-import com.arsdigita.web.URL;
import java.math.BigDecimal;
+import java.util.TooManyListenersException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
/**
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
* @author Jens Pelzetter <je...@jp...>
*/
-class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener {
+class ItemSearchCreateItemPane extends CMSContainer implements FormInitListener,
+ FormProcessListener,
+ FormSubmissionListener {
public static final String WIDGET_PARAM = "widget";
public static final String SEARCHWIDGET_PARAM = "searchWidget";
@@ -60,12 +59,10 @@
private final NewItemForm m_newItem;
private final SingleSelectionModel m_typeSel;
private final FlatFolderPicker m_folderPicker;
- //private final BaseTree m_tree;
private final SingleSelectionModel m_model;
- private final FolderSelectionModel m_folderSel; // To support legacy UI code
- private final FolderRequestLocal m_folder;
+ private final FolderSelectionModel m_folderSel; // To support legacy UI code
+ private String defaultFolder;
private final CreationSelector m_creator;
- private final ItemSearchPage m_parent;
private final ContentItemRequestLocal m_contentItem = new ContentItemRequestLocal() {
};
private final Link m_selectCloseLink;
@@ -78,41 +75,25 @@
public ItemSearchCreateItemPane(final ItemSearchPage parent) {
super();
- this.m_parent = parent;
-
m_segPanel = new SegmentedPanel("itemSearchCreate");
m_creationSeg = new Segment();
m_newItemSeg = new Segment();
m_linkSeg = new Segment();
m_newItem = new SectionNewItemForm("newItem");
- //m_newItem.addProcessListener(this);
- //m_tree = new BaseTree(new FolderTreeModelBuilder());
- //m_model = m_tree.getSelectionModel();
m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
m_folderSel = new FolderSelectionModel(m_model);
- m_folder = new FolderRequestLocal(m_folderSel);
-// m_newItemSeg = addSegment();
this.setIdAttr("folder-new-item");
-// m_newItemSeg.addHeader(new Label(GlobalizationUtil.globalize("cms.ui.new_item")));
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
-// m_typeSel.addChangeListener(this);
m_creator = new CreationSelector(m_typeSel, m_folderSel) {
@Override
public void editItem(final PageState state, final ContentItem item) {
- //final ContentSection section = getContentSection(state);
- //final String nodeURL = URL.getDispatcherPath() + section.getPath() + "/";
- //final String target = ItemSearchContentItemPage.getItemURL(nodeURL, item.getID(),
- // ContentItemPage.AUTHORING_TAB, true);
-
- //throw new RedirectSignal(target, true);
-
m_creationSeg.setVisible(state, false);
m_linkSeg.setVisible(state, true);
@@ -126,12 +107,11 @@
final BoxPanel folderRow = new BoxPanel(BoxPanel.HORIZONTAL);
folderRow.add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.create.folder_select")));
m_folderPicker = new FlatFolderPicker("flatFolder");
- //m_newItem.add(m_folderPicker);
folderRow.add(m_folderPicker);
m_newItem.add(folderRow);
-
m_newItemSeg.add(m_newItem);
+ m_newItem.addInitListener(this);
m_newItem.addProcessListener(this);
m_newItem.addSubmissionListener(this);
@@ -234,6 +214,17 @@
page.addComponentStateParam(this, m_folderSel.getStateParameter());
}
+ public void init(final FormSectionEvent fse) throws FormProcessException {
+ final PageState state = fse.getPageState();
+ final FormData data = fse.getFormData();
+ if (((data.get("flatFolder") == null) || "".equals(data.get("flatFolder")))
+ && (defaultFolder != null)) {
+ data.put("flatFolder", defaultFolder.toString());
+ }
+
+
+ }
+
public void submitted(final FormSectionEvent fse) {
final PageState state = fse.getPageState();
@@ -260,4 +251,13 @@
}
}
+
+ protected String getDefaultFolder() {
+ return defaultFolder;
+ }
+
+ protected void setDefaultFolder(final String defaultFolder) {
+ this.defaultFolder = defaultFolder;
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -54,6 +54,7 @@
private final Table resultsTable;
private final Paginator paginator;
private final StringParameter queryParam;
+ private final Submit submit;
private final static CMSConfig CMS_CONFIG = CMSConfig.getInstance();
public ItemSearchFlatBrowsePane(final String name) {
@@ -69,7 +70,8 @@
boxPanel.add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.flat.filter")));
final TextField filter = new TextField(new StringParameter(QUERY_PARAM));
boxPanel.add(filter);
- boxPanel.add(new Submit(FILTER_SUBMIT, GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit")));
+ submit = new Submit(FILTER_SUBMIT, GlobalizationUtil.globalize("cms.ui.item_search.flat.filter.submit"));
+ boxPanel.add(submit);
mainPanel.add(boxPanel);
resultsTable = new ResultsTable();
@@ -179,13 +181,14 @@
final ContentType type = new ContentType(typeId);
collection.set(state, session.retrieve(type.getClassName()));
}
+ ((DataCollection)collection.get(state)).addFilter("version = 'draft'");
final String query = (String) state.getValue(queryParam);
if ((query != null) && !query.isEmpty()) {
((DataCollection) collection.get(state)).addFilter(String.format(
- "(lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%'))",
+ "((lower(%s) like lower('%%%s%%')) or (lower(%s) like lower('%%%s%%')))",
ContentItem.NAME, query,
- ContentPage.TITLE, query));
+ ContentPage.TITLE, query));
}
((DataCollection) collection.get(state)).addOrder("title asc, name asc");
@@ -302,6 +305,9 @@
return link;
}
-
}
+
+ protected Submit getSubmit() {
+ return submit;
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -25,18 +25,21 @@
import com.arsdigita.bebop.event.RequestEvent;
import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.bebop.parameters.IntegerParameter;
import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.CMS;
import com.arsdigita.cms.CMSConfig;
import com.arsdigita.cms.CMSExcursion;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.Folder;
import com.arsdigita.cms.dispatcher.CMSPage;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.dispatcher.RequestContext;
import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.persistence.OID;
import com.arsdigita.templating.PresentationManager;
import com.arsdigita.templating.Templating;
+import com.arsdigita.toolbox.ui.OIDParameter;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.xml.Document;
import com.arsdigita.web.Web;
@@ -63,6 +66,7 @@
private ItemSearchPopup m_search;
private ItemSearchCreateItemPane m_create;
private BigDecimalParameter m_sectionId;
+ private int m_lastTab;
private static final CMSConfig s_conf = CMSConfig.getInstance();
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
@@ -79,7 +83,8 @@
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
addGlobalStateParam(new StringParameter("searchWidget"));
addGlobalStateParam(new StringParameter("publishWidget"));
-
+ addGlobalStateParam(new StringParameter("defaultCreationFolder"));
+ addGlobalStateParam(new IntegerParameter("lastTab"));
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
addGlobalStateParam(m_sectionId);
@@ -91,6 +96,7 @@
m_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body");
add(m_tabbedPane);
+
addRequestListener(new RequestListener() {
public void pageRequested(final RequestEvent event) {
@@ -98,17 +104,8 @@
final String query = (String) state.getValue(new StringParameter(ItemSearchPopup.QUERY));
- if (m_tabbedPane.getCurrentPane(state) == m_create) {
- return;
- }
-
- if ((query == null) || query.isEmpty()) {
- m_tabbedPane.setSelectedIndex(state, 1);
- } else {
- m_tabbedPane.setSelectedIndex(state, 0);
- }
-
- BigDecimal typeParam = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
+ BigDecimal typeParam =
+ (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
if (typeParam == null) {
m_tabbedPane.setTabVisible(state, m_create, false);
m_create.setVisible(state, false);
@@ -116,11 +113,81 @@
m_tabbedPane.setTabVisible(state, m_create, true);
m_create.setVisible(state, true);
}
+
+ if (state.getValue(new IntegerParameter("lastTab")) == null) {
+ if ((query == null) || query.isEmpty()) {
+ m_tabbedPane.setSelectedIndex(state, 1);
+ } else {
+ m_tabbedPane.setSelectedIndex(state, 0);
+ }
+
+// m_tabbedPane.setTabVisible(state, m_create, false);
+// m_create.setVisible(state, false);
+
+ }
+
+ state.setValue(new IntegerParameter("lastTab"), m_tabbedPane.getSelectedIndex(state));
+
+ if (state.getValue(new StringParameter("defaultCreationFolder")) != null) {
+ m_create.setDefaultFolder((String) state.getValue(new StringParameter("defaultCreationFolder")));
+ }
+
+// if (m_lastTab != m_tabbedPane.getSelectedIndex(state)) {
+// m_lastTab = m_tabbedPane.getSelectedIndex(state);
+// return;
+// }
+//
+// //If create pane is selected do nothing (else we don't stay in the create pane)
+// if (m_tabbedPane.getCurrentPane(state) == m_create) {
+// return;
+// }
+//
+// if ((query == null) || query.isEmpty()) {
+// m_tabbedPane.setSelectedIndex(state, 1);
+// } else {
+// m_tabbedPane.setSelectedIndex(state, 1);
+// }
+
+// if (m_tabbedPane.getCurrentPane(state) == m_create) {
+// m_tabbedPane.setTabVisible(state, m_create, false);
+// m_create.setVisible(state, false);
+// }
+//
+// m_lastTab = m_tabbedPane.getSelectedIndex(state);
}
});
+
+// m_tabbedPane.addActionListener(new ActionListener() {
+//
+// public void actionPerformed(final ActionEvent event) {
+// final PageState state = event.getPageState();
+//
+// }
+//
+// });
+
+// m_flatBrowse.addProcessListener(new FormProcessListener() {
+//
+// public void process(final FormSectionEvent fse) throws FormProcessException {
+// if (m_flatBrowse.getSubmit().isSelected(fse.getPageState())) {
+// enableCreatePane(fse.getPageState());
+// }
+// }
+//
+// });
}
+// private void enableCreatePane(final PageState state) {
+// final BigDecimal typeParam = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
+// if (typeParam == null) {
+// m_tabbedPane.setTabVisible(state, m_create, false);
+// m_create.setVisible(state, false);
+// } else {
+// m_tabbedPane.setTabVisible(state, m_create, true);
+// m_create.setVisible(state, true);
+// }
+// }
/**
* Creates, and then caches, the Browse pane. Overriding this method to return null will prevent this tab from
* appearing. Note: not implemented yet.
@@ -257,12 +324,17 @@
}.run();
}
-
+
protected void setTabActive(final PageState state, final Component component, final boolean value) {
m_tabbedPane.setTabVisible(state, component, value);
}
- protected void setTabActive(final PageState state, final int index, final boolean value) {
+ protected void setTabActive(final PageState state, final int index, final boolean value) {
m_tabbedPane.setTabVisible(state, index, value);
}
+
+ protected void setDefaultCreationFolder(final Folder folder) {
+ m_create.setDefaultFolder(folder.getOID().toString());
+ }
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -40,12 +40,17 @@
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ContentType;
+import com.arsdigita.cms.ContentTypeLifecycleDefinition;
+import com.arsdigita.cms.Folder;
import com.arsdigita.cms.Workspace;
import com.arsdigita.cms.WorkspaceServlet;
+import com.arsdigita.cms.lifecycle.LifecycleDefinition;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.web.ParameterMap;
import com.arsdigita.web.URL;
+import com.arsdigita.workflow.simple.Workflow;
+import java.util.Date;
import org.apache.log4j.Logger;
/**
@@ -72,6 +77,7 @@
private String m_name;
private String m_searchName;
private String m_clearName;
+ private Folder m_defaultCreationFolder;
private ParameterModel m_model;
private ParameterModel m_searchModel;
private String searchLabelText = (String) GlobalizationUtil.globalize("cms.ui.item_search.search").localize();
@@ -245,7 +251,7 @@
});
//m_item = new ItemFragment(model, this);
- m_publish = new Hidden(PUBLISH);
+ m_publish = new Hidden(PUBLISH);
add(m_publish);
m_item = new TextField(m_searchModel);
@@ -270,6 +276,10 @@
}
params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']");
+ if (m_defaultCreationFolder != null) {
+ params.setParameter("defaultCreationFolder", m_defaultCreationFolder.getOID().toString());
+ }
+
String searchURL = WorkspaceServlet.getURLStubForClass(
ItemSearchPage.class.getName());
s_log.debug("Search URL stub is: " + searchURL);
@@ -280,28 +290,28 @@
URL url = URL.there(state.getRequest(), searchURL, params);
- t.setLabel(" <script language=javascript> "
- + " <!-- \n"
- + " function "
- //+ m_item.getName().replace('.', '_')
- + m_selected.getName().replace('.', '_')
- + "Popup(theForm) { \n"
- + "var width = screen.width * 0.5;\n"
- + "var height = screen.height * 0.5;\n"
- + "if ((width < 800) && (screen.width >= 800)) {\n"
- + "width = 800;\n"
- + "}\n"
- + "if ((height < 600) && (screen.height >= 600)) {\n"
- + "height = 600;\n"
- + "}\n"
- + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.
- getName() + "').value , "
- //+ "\"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes\");\n"
- + "\"search\", \"toolbar=no,width=\" + width + \",height=\" + height + \",status=no,scrollbars=yes,resize=yes\");\n "
- + "return false;\n"
- + " } \n"
- + " --> \n"
- + " </script> ");
+ t.setLabel(
+ " <script language=javascript> "
+ + " <!-- \n"
+ + " function "
+ + m_selected.getName().replace('.', '_')
+ + "Popup(theForm) { \n"
+ + "var width = screen.width * 0.5;\n"
+ + "var height = screen.height * 0.5;\n"
+ + "if ((width < 800) && (screen.width >= 800)) {\n"
+ + "width = 800;\n"
+ + "}\n"
+ + "if ((height < 600) && (screen.height >= 600)) {\n"
+ + "height = 600;\n"
+ + "}\n"
+ + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('"
+ + m_item.getName() + "').value , "
+ + "\"search\", \"toolbar=no,width=\" + width + \",height=\" + height + \",status=no,scrollbars=yes,resize=yes\");\n"
+ + "document." + formName + "." + m_publish.getName() + ".value = \"false\";\n "
+ + "return false;\n"
+ + " } \n"
+ + " --> \n"
+ + " </script> ");
}
});
@@ -485,8 +495,32 @@
return selectedLabelText;
}
- public void setSelectedLabelText(String selectedLabelText) {
+ public void setSelectedLabelText(final String selectedLabelText) {
this.selectedLabelText = selectedLabelText;
}
-}
+ public void setDefaultCreationFolder(final Folder folder) {
+ m_defaultCreationFolder = folder;
+ }
+
+ public void publishCreatedItem(final FormData data, final ContentItem item) {
+ final String publishStr = data.getString(ItemSearchWidget.PUBLISH);
+ final Boolean publish = Boolean.valueOf(publishStr);
+ if (publish) {
+ final LifecycleDefinition lifecycleDef = ContentTypeLifecycleDefinition.getLifecycleDefinition(
+ item.getContentSection(), item.getContentType());
+
+ if (lifecycleDef == null) {
+ s_log.warn(String.format("Cannot publish item %s because it has no default lifecycle",
+ item.getOID().toString()));
+ } else {
+ item.publish(lifecycleDef, new Date());
+ item.getLifecycle().start();
+ final Workflow workflow = Workflow.getObjectWorkflow(item);
+ if (workflow != null) {
+ workflow.delete();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -19,27 +19,20 @@
package com.arsdigita.cms.ui.authoring;
import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.PrintEvent;
-import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentTypeCollection;
-import com.arsdigita.cms.ui.ScriptPrinter;
+import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.util.GlobalizationUtil;
-import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.xml.Element;
-import org.apache.log4j.Logger;
-
import java.math.BigDecimal;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
+import org.apache.log4j.Logger;
/**
* Selects a component based on content type. Helper class for {@link
@@ -54,7 +47,6 @@
private Map m_comps;
private MapComponentSelectionModel m_sel;
ContentTypeCollection m_types;
- private ScriptPrinter scriptPrinter;
/**
* Construct a new AuthoringKitSelector. Load all the possible authoring kits from the database and construct
@@ -105,23 +97,7 @@
m_comps.put(type.getID(), c);
s_log.info("Added component " + c + " for "
+ type.getAssociatedObjectType());
- }
-
- if (c instanceof LayoutPanel) {
- Label label = new Label("", false);
- label.addPrintListener(new PrintListener() {
-
- public void prepare(final PrintEvent event) {
- final Label label = (Label) event.getTarget();
- if (scriptPrinter != null) {
- label.setLabel(scriptPrinter.printScript(event.getPageState()));
- }
- }
-
- });
-
- ((LayoutPanel) c).setBottom(label);
- }
+ }
}
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -4,15 +4,14 @@
*/
package com.arsdigita.cms.ui.folder;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.event.PrintListener;
-import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.event.PrintEvent;
+import com.arsdigita.bebop.event.PrintListener;
+import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.Folder;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID;
-import com.arsdigita.toolbox.ui.OIDParameter;
import java.util.TooManyListenersException;
/**
@@ -21,8 +20,7 @@
*/
public abstract class AbstractFolderPicker extends SingleSelect {
- public AbstractFolderPicker(String name) {
- //super(new OIDParameter(name));
+ public AbstractFolderPicker(String name) {
super(new StringParameter(name));
try {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:31:34 UTC (rev 2375)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:35:50 UTC (rev 2376)
@@ -27,33 +27,13 @@
protected void addOptions(PageState state, SingleSelect target) {
target.addOption(new Option("", ""));
- final ContentSection section = CMS.getContext().getContentSection();
- //final String sectionName = section.getName();
+ final ContentSection section = CMS.getContext().getContentSection();
final Folder root = section.getRootFolder();
- final String path = ""; // String.format("%s:", sectionName);
-
- //addFolders(target, path, root.getChildren().addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE));
+ final String path = "";
+
addFolder(target, path, root);
-
-// DataCollection terms = SessionManager.getSession()
-// .retrieve(Term.BASE_DATA_OBJECT_TYPE);
-// terms.addPath("model.id");
-// terms.addPath("model.objectType");
-// terms.addPath("model.name");
-// terms.addPath("domain.title");
-// terms.addOrder("domain.title");
-// terms.addOrder("model.name");
-//
-// target.addOption(new Option(null, "-- pick one --"));
-// while (terms.next()) {
-// target.addOption(
-// new Option(new OID((String)terms.get("model.objectType"),
-// terms.get("model.id")).toString(),
-// terms.get("domain.title") + " -> " +
-// terms.get("model.name")));
-// }
}
private void addFolders(final SingleSelect target, final String path, ItemCollection folders) {
|
Author: pboy
Date: 2012-12-16 09:31:34 +0000 (Sun, 16 Dec 2012)
New Revision: 2375
Added:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
trunk/ccm-cms/web/templates/ccm-cms/content-section/admin/image_select.jsp
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html
trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
Log:
ImageSelectPage & ImagePane: Fixed event handling, added image_search.jsp. (on behalf of quasimodo)
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:31:34 UTC (rev 2375)
@@ -1103,5 +1103,9 @@
cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Create new
cms.ui.item_search.create.folder_select=Select folder
+cms.ui.image_library=Image Library
+cms.ui.image_upload=Upload Image
+cms.ui.images=Images
cms.ui.search.create.select_close=Select item and close
cms.ui.search.create.select_edit=Select item and edit
+
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:31:34 UTC (rev 2375)
@@ -1094,5 +1094,9 @@
cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID)
cms.ui.item_search.create=Neu anlegen
cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen
+cms.ui.image_library=Bilderauswahl
+cms.ui.image_upload=Bild hochladen
+cms.ui.images=Bilder
cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen
cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten
+
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:31:34 UTC (rev 2375)
@@ -42,5 +42,9 @@
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=
+
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:31:34 UTC (rev 2375)
@@ -573,5 +573,9 @@
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=
+
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -219,7 +219,7 @@
boolean isSelected, Object key,
int row, int column) {
- if (m_mode == ImageComponent.SELECT_IMAGE) {
+ if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) {
return super.getComponent(table, state, value, isSelected, key, row, column);
}
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentAttachListener.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -0,0 +1,116 @@
+/*
+ * 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.cms.ReusableImageAsset;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageComponentAttachListener implements FormInitListener, FormProcessListener {
+
+ private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
+ MapComponentSelectionModel m_imageComponent;
+
+ public ImageComponentAttachListener(MapComponentSelectionModel imageComponent) {
+ super();
+ m_imageComponent = imageComponent;
+ }
+
+ public void init(FormSectionEvent event)
+ throws FormProcessException {
+ PageState ps = event.getPageState();
+ setImageComponent(ps, ImageComponent.LIBRARY);
+
+// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+// if (null == attachment) {
+ // XXX: Do something
+// }
+ }
+
+ 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);
+
+
+// ContentItem item = m_imageStep.getItem(ps);
+// if (null == item) {
+// s_log.error("No item selected in ImageStepEdit",
+// new RuntimeException());
+// return;
+// }
+
+// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+// if (null == attachment) {
+// attachment = new ItemImageAttachment(item, image);
+// }
+// attachment.setCaption(component.getCaption(event));
+
+ // We only set the description and title based on the UI in
+ // the case where getIsImageStepDescriptionAndTitleShown is true.
+ // Otherwise, we leave this as the default value. This means
+ // existing values are not overwritten if the image is edited when
+ // isImageStepDescriptionAndTitleShown is false.
+// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
+// attachment.setDescription(component.getDescription(event));
+// attachment.setTitle(component.getTitle(event));
+// }
+// attachment.setUseContext(component.getUseContext(event));
+ }
+
+ private 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);
+
+ }
+
+ private void setImageComponent(PageState ps, final String activeKey) {
+ m_imageComponent.setSelectedKey(ps, 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: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponentSelectListener.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -0,0 +1,96 @@
+/*
+ * 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.cms.ReusableImageAsset;
+import java.math.BigDecimal;
+import java.util.Iterator;
+import java.util.Map;
+import org.apache.log4j.Logger;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageComponentSelectListener implements FormInitListener, FormProcessListener {
+
+ private static final Logger s_log = Logger.getLogger(ImageComponentSelectListener.class);
+ MapComponentSelectionModel m_imageComponent;
+
+ public ImageComponentSelectListener(MapComponentSelectionModel imageComponent) {
+ super();
+ m_imageComponent = imageComponent;
+ }
+
+ public void init(FormSectionEvent event)
+ throws FormProcessException {
+ PageState ps = event.getPageState();
+
+ this.m_imageComponent.getComponent(ps);
+ setImageComponent(ps, ImageComponent.LIBRARY);
+ }
+
+ 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);
+
+ // SELECT {
+ String name = image.getDisplayName();
+ BigDecimal id = image.getID();
+ BigDecimal width = image.getWidth();
+ BigDecimal height = image.getHeight();
+ // SELECT }
+ }
+
+ private 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);
+
+ }
+
+ private void setImageComponent(PageState ps, final String activeKey) {
+ m_imageComponent.setSelectedKey(ps, 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);
+ }
+ }
+}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -12,7 +12,6 @@
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.SimpleContainer;
-import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextField;
@@ -42,7 +41,7 @@
private int m_mode;
public ImageLibraryComponent() {
- this(ImageComponent.SELECT_IMAGE);
+ this(ImageComponent.ATTACH_IMAGE);
}
public ImageLibraryComponent(int mode) {
@@ -107,8 +106,9 @@
// save and cancel buttons
m_saveCancel = new SaveCancelSection();
- m_form.add(m_saveCancel);
-
+ if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) {
+ m_form.add(m_saveCancel);
+ }
}
public ReusableImageAsset getImage(FormSectionEvent event) {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -5,12 +5,17 @@
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.MapComponentSelectionModel;
+import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.TabbedPane;
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;
/**
*
@@ -18,34 +23,47 @@
*/
public class ImageSelectPage extends CMSPage {
+ public 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 BigDecimalParameter m_sectionId;
+ private final StringParameter m_imageComponentKey;
+ private final MapComponentSelectionModel m_imageComponent;
private static final CMSConfig s_conf = CMSConfig.getInstance();
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
public ImageSelectPage() {
- super(GlobalizationUtil.globalize("cms.ui.item_search.page_title").localize().toString(), new SimpleContainer());
+ super(GlobalizationUtil.globalize("cms.ui.image_selelect.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_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body");
+
add(m_tabbedPane);
+ addGlobalStateParam(m_imageComponentKey);
}
protected ImageLibraryComponent getImageLibraryPane() {
if (m_imageLibrary == null) {
m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE);
-// library.getForm().addInitListener(this);
-// library.getForm().addProcessListener(this);
+ m_imageLibrary.getForm().addInitListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageLibrary.getForm().addProcessListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, m_imageLibrary);
}
return m_imageLibrary;
}
@@ -54,8 +72,9 @@
if (m_imageUpload == null) {
m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
-// upload.getForm().addInitListener(this);
-// upload.getForm().addProcessListener(this);
+ m_imageUpload.getForm().addInitListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageUpload.getForm().addProcessListener(new ImageComponentSelectListener(m_imageComponent));
+ m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, m_imageUpload);
}
return m_imageUpload;
}
@@ -81,24 +100,7 @@
*/
protected void addToPane(TabbedPane pane, String tabName, Component comp) {
if (comp != null) {
- pane.addTab(GlobalizationUtil.globalize("cms.ui.item_search." + tabName).localize().toString(), comp);
+ pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName).localize().toString(), comp);
}
}
-
- /* Listeners */
-
- /**
- * InitListener
- *
- * this init listener selects the object with the submitted oid
- */
-// private init() {
-//
-// }
-
- /**
- * ProcessListener
- *
- * this process listener
- */
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -8,6 +8,7 @@
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SaveCancelSection;
import com.arsdigita.bebop.event.FormSectionEvent;
@@ -35,9 +36,9 @@
private int m_mode;
public ImageUploadComponent() {
- this(ImageComponent.ATTACH_IMAGE);
+ this(ImageComponent.ATTACH_IMAGE);
}
-
+
public ImageUploadComponent(int mode) {
super("imageUploadComponent", new ColumnPanel(2));
m_mode = mode;
@@ -110,7 +111,7 @@
try {
ReusableImageAsset image = new ReusableImageAsset();
image.loadFromFile(filename, imageFile, ImageAsset.MIME_JPEG);
- image.setDescription((String) m_caption.getValue(ps));
+// image.setDescription((String) m_caption.getValue(ps));
return image;
} catch (IOException ex) {
ImagesPane.s_log.error("Error loading image from file", ex);
@@ -141,4 +142,5 @@
public Form getForm() {
return this;
}
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 09:31:34 UTC (rev 2375)
@@ -4,8 +4,6 @@
*/
package com.arsdigita.cms.ui;
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.Page;
@@ -14,19 +12,12 @@
import com.arsdigita.bebop.Resettable;
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SimpleComponent;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
-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.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.LayoutPanel;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
@@ -35,9 +26,9 @@
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
-public class ImagesPane extends LayoutPanel implements Resettable, FormProcessListener, FormInitListener {
+public class ImagesPane extends LayoutPanel implements Resettable {
- public static final Logger s_log = Logger.getLogger(BrowsePane.class);
+ public static final Logger s_log = Logger.getLogger(ImagesPane.class);
//private ImageChooser imageChooser;
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
@@ -58,25 +49,27 @@
Map selectors = m_imageComponent.getComponentsMap();
ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
- upload.getForm().addInitListener(this);
- upload.getForm().addProcessListener(this);
+ //upload.getForm().addInitListener(new ImageComponentAdminListener(m_imageComponent));
+ // For future use
+ // upload.addProcessListener(new ImageComponentAdminListener(m_imageComponent));
selectors.put(ImageComponent.UPLOAD, upload);
body.addSegment(
new Label(GlobalizationUtil.globalize("cms.ui.image_upload")),
upload);
ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
- library.getForm().addInitListener(this);
- library.getForm().addProcessListener(this);
- library.addUploadLink(new ActionListener() {
-
- public void actionPerformed(ActionEvent ev) {
- setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
- }
- });
+ //library.getForm().addInitListener(new ImageComponentAdminListener(m_imageComponent));
+ // For future use
+ // library.getForm().addProcessListener(new ImageComponentAdminListener);
+// library.addUploadLink(new ActionListener() {
+//
+// public void actionPerformed(ActionEvent ev) {
+// setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
+// }
+// });
selectors.put(ImageComponent.LIBRARY, library);
body.addSegment(
- new Label(GlobalizationUtil.globalize("cms.ui.image_browser")),
+ new Label(GlobalizationUtil.globalize("cms.ui.image_library")),
library);
}
@@ -84,6 +77,17 @@
@Override
public final void register(Page page) {
super.register(page);
+ Map componentsMap = m_imageComponent.getComponentsMap();
+
+// Iterator i = componentsMap.keySet().iterator();
+// while (i.hasNext()) {
+// Object key = i.next();
+// Component component = (Component) componentsMap.get(key);
+//
+// page.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
+// }
+
+ page.addComponentStateParam(this, m_imageComponentKey);
}
@Override
@@ -91,45 +95,6 @@
super.reset(state);
}
- /*
- * // Private classes and methods private final class ProcessListener
- * implements FormProcessListener {
- */
- public void process(FormSectionEvent event) throws FormProcessException {
- PageState ps = event.getPageState();
-// ImageComponent component = getImageComponent(ps);
-//
-// if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
-// return;
-// }
-//
-// ContentItem item = m_imageStep.getItem(ps);
-// if (null == item) {
-// s_log.error("No item selected in ImageStepEdit", new RuntimeException());
-// return;
-// }
-//
-// ReusableImageAsset image = component.getImage(event);
-//
-// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
-// if (null
-// == attachment) {
-// attachment = new ItemImageAttachment(item, image);
-// }
-// attachment.setCaption(component.getCaption(event));
-//
-// // We only set the description and title based on the UI in
-// // the case where getIsImageStepDescriptionAndTitleShown is true.
-// // Otherwise, we leave this as the default value. This means
-// // existing values are not overwritten if the image is edited when
-// // isImageStepDescriptionAndTitleShown is false.
-// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
-// attachment.setDescription(component.getDescription(event));
-// attachment.setTitle(component.getTitle(event));
-// }
-// attachment.setUseContext(component.getUseContext(event));
- }
-
private final class SubmissionListener implements FormSubmissionListener {
public final void submitted(final FormSectionEvent e) {
@@ -138,36 +103,37 @@
}
}
- private void setImageComponent(PageState ps, final String activeKey) {
- m_imageComponent.setSelectedKey(ps, 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);
- }
- }
-
- public void init(FormSectionEvent event)
- throws FormProcessException {
- PageState ps = event.getPageState();
-
-// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
-// if (null == attachment) {
- // XXX: Do something
+// private void setImageComponent(PageState ps, final String activeKey) {
+// m_imageComponent.setSelectedKey(ps, 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);
+// }
+// }
+
+// public void init(FormSectionEvent event)
+// throws FormProcessException {
+// PageState ps = event.getPageState();
+// setImageComponent(ps, ImageComponent.LIBRARY);
+//
+//// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+//// if (null == attachment) {
+// // XXX: Do something
+//// }
+// }
}
Modified: trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html
===================================================================
--- trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.html 2012-12-16 09:31:34 UTC (rev 2375)
@@ -17,6 +17,10 @@
width: 8em;
}
+ fieldset.preview {
+ display: none;
+ }
+
.value {
margin-left: 5.5em;
margin-right: 1em;
@@ -48,7 +52,15 @@
width: 100% !important;
}
+ div.preview {
+ magirn:
+ }
+ label.preview {
+ display: block;
+ font-weight: bold;
+ }
+
.itemname {
margin: 0.1em;
border: none;
@@ -152,16 +164,18 @@
</div>
<input type="hidden" name="[aspect]" id="[aspect]"/>
</fieldset>
- </div>
- <div>
- <l10n>Image Preview:</l10n><br />
- <iframe id="[ipreview]" frameborder="0" style="border : 1px solid gray;" height="200" width="100%" src="about:blank"></iframe>
+ <fieldset id="[preview]" class="preview">
+ <legend>
+ <l10n>Preview</l10n>
+ </legend>
+ <img src="about:blank" id="[ipreview]">
+ </fieldset>
</div>
<div class="buttons" id="[buttons]">
- <input type="button" id="[ok]" value="_(OK)" />
- <input type="button" id="[remove]" value="_(Remove)" />
- <input type="button" id="[cancel]" value="_(Cancel)" />
+ <input type="button" id="[ok]" value="_(OK)" />
+ <input type="button" id="[remove]" value="_(Remove)"/>
+ <input type="button" id="[cancel]" value="_(Cancel)"/>
</div>
</div>
Modified: trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js
===================================================================
--- trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 09:26:24 UTC (rev 2374)
+++ trunk/ccm-cms/web/assets/xinha/plugins/OpenCCM/images/images.js 2012-12-16 09:31:34 UTC (rev 2375)
@@ -57,6 +57,7 @@
data.caption = (image.parentNode.nextSibling.tagName.toLowerCase() == "span") ? image.parentNode.nextSibling.firstChild.nodeValue : "";
}
+ // Calculate aspect ratio
data.aspect = data.width / data.height;
}
@@ -72,21 +73,34 @@
var dialog = this.dialogs["images"] = new Xinha.Dialog(editor, OpenCCM.imagesHtml, 'Xinha',{width:410})
// Connect the OK and Cancel buttons
- dialog.getElementById('ok').onclick = function() {self.imageApply();}
- dialog.getElementById('remove').onclick = function() { self.imageRemove(); };
- dialog.getElementById('cancel').onclick = function() { self.dialogs["images"].hide()};
+ dialog.getElementById("ok").onclick = function() {self.imageApply();}
+ dialog.getElementById("remove").onclick = function() { self.imageRemove(); };
+ dialog.getElementById("cancel").onclick = function() { self.dialogs["images"].hide()};
// Connect the Select button
- dialog.getElementById('browse').onclick = function() { self.imageBrowse(window); };
+ dialog.getElementById("browse").onclick = function() { self.imageBrowse(window); };
- // Connect onkeyup ecent handler with dimension filed to recalculate the size according to aspect ratio
- dialog.getElementById('width').onkeyup = function() { self.calcHeight(); };
- dialog.getElementById('height').onkeyup = function() { self.calcWidth(); };
+ // Connect onkeyup event handler with dimension filed to recalculate the size according to aspect ratio
+ dialog.getElementById("width").onkeyup = function() { self.calcHeight(); };
+ dialog.getElementById("height").onkeyup = function() { self.calcWidth(); };
+ // OnResize
+ this.dialogs["images"].onresize = function ()
+ {
+ var newHeightForPreview =
+ parseInt(this.height, 10)
+// - this.getElementById("h1").offsetHeight
+// - this.getElementById("buttons").offsetHeight
+// - this.getElementById("inputs").offsetHeight
+ - parseInt(this.rootElem.style.paddingBottom, 10);
+ this.getElementById("preview").style.height = ((newHeightForPreview > 0) ? newHeightForPreview : 0) + "px";
+ this.getElementById("preview").style.width = "98%";
+ };
+
this.imageDialogReady = true;
};
-//
+// Write HTML code
OpenCCM.prototype.imageApply = function()
{
@@ -272,12 +286,27 @@
OpenCCM.prototype.imageBrowse = function(window)
{
+ this.imageSet({
+ src : "/theme/mandalay/ccm/cms-service/stream/image/?image_id=9001",
+ width : "304",
+ height : "420",
+ name : "Schild.jpg"
+ });
+};
+
+OpenCCM.prototype.imageSet = function(imageData)
+{
var dialog = this.dialogs["images"];
- dialog.getElementById(dialog.id["src"]).value = "/theme/mandalay/ccm/cms-service/stream/image/?image_id=9001";
- dialog.getElementById(dialog.id["width"]).value = "304";
- dialog.getElementById(dialog.id["height"]).value = "420";
- dialog.getElementById(dialog.id["name"]).value = "Schild.jpg";
+ dialog.getElementById(dialog.id["src"]).value = imageData.src;
+ dialog.getElementById(dialog.id["ipreview"]).src = imageData.src;
+ dialog.getElementById(dialog.id["width"]).value = imageData.width;
+ dialog.getElementById(dialog.id["height"]).value = imageData.height;
+ dialog.getElementById(dialog.id["name"]).value = imageData.name;
dialog.getElementById(dialog.id["aspect"]).value = dialog.getElementById(dialog.id["width"]).value / dialog.getElementById(dialog.id["height"]).value;
+ if(imageData.src != "")
+ {
+ dialog.getElementById(dialog.id["preview"]).style.display = "block";
+ }
};
OpenCCM.prototype.calcWidth = function()
Added: trunk/ccm-cms/web/templates/ccm-cms/content-section/admin/image_select.jsp
===================================================================
--- trunk/ccm-cms/web/templates/ccm-cms/content-section/admin/image_select.jsp (rev 0)
+++ trunk/ccm-cms/web/templates/ccm-cms/content-section/admin/image_select.jsp 2012-12-16 09:31:34 UTC (rev 2375)
@@ -0,0 +1,30 @@
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
+
+ <jsp:directive.page import="com.arsdigita.cms.ui.ImageSelectPage"/>
+ <jsp:directive.page import="com.arsdigita.cms.ContentSectionServlet"/>
+ <jsp:directive.page import="com.arsdigita.cms.ContentSection"/>
+ <jsp:directive.page import="com.arsdigita.cms.dispatcher.Utilities"/>
+ <jsp:directive.page import="com.arsdigita.dispatcher.*"/>
+ <jsp:directive.page import="java.util.Date"/>
+
+ <jsp:declaration>
+ private ImageSelectPage imageSelectPage = new ImageSelectPage();
+ </jsp:declaration>
+
+ <jsp:scriptlet>
+ // Restore the wrapped request
+ request = DispatcherHelper.getRequest();
+ DispatcherHelper.cacheDisable(response);
+
+ ContentSection section =
+ ContentSectionServlet.getContentSection(request);
+
+ if (! ContentSectionServlet.checkAdminAccess(request, section)) {
+ throw new com.arsdigita.cms.dispatcher.AccessDeniedException();
+ }
+
+ RequestContext context = DispatcherHelper.getRequestContext(request);
+ imageSelectPage.init();
+ imageSelectPage.dispatch(request, response, context);
+ </jsp:scriptlet>
+</jsp:root>
|
Author: pboy
Date: 2012-12-16 09:26:24 +0000 (Sun, 16 Dec 2012)
New Revision: 2374
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java
Log:
Further enhanced ItemSearchWidget.
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:26:24 UTC (rev 2374)
@@ -1103,3 +1103,5 @@
cms.ui.item_search.selected=Selected content item (id)
cms.ui.item_search.create=Create new
cms.ui.item_search.create.folder_select=Select folder
+cms.ui.search.create.select_close=Select item and close
+cms.ui.search.create.select_edit=Select item and edit
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:26:24 UTC (rev 2374)
@@ -1094,3 +1094,5 @@
cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID)
cms.ui.item_search.create=Neu anlegen
cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen
+cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen
+cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:26:24 UTC (rev 2374)
@@ -42,3 +42,5 @@
cms.ui.item_search.selected=
cms.ui.item_search.create=
cms.ui.item_search.create.folder_select=
+cms.ui.search.create.select_close=
+cms.ui.search.create.select_edit=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:26:24 UTC (rev 2374)
@@ -573,3 +573,5 @@
cms.ui.item_search.selected=
cms.ui.item_search.create=
cms.ui.item_search.create.folder_select=
+cms.ui.search.create.select_close=
+cms.ui.search.create.select_edit=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/PageLocations.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -28,5 +28,5 @@
**/
public interface PageLocations {
public String SECTION_PAGE = "admin/index.jsp";
- public String ITEM_PAGE = "admin/item.jsp";
+ public String ITEM_PAGE = "admin/item.jsp";
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentItemPage.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -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;
@@ -504,5 +509,13 @@
return ContentSection.getConfig().getUseStreamlinedCreation()
&& STREAMLINED_CREATION_ACTIVE.equals(state.getRequest().
getParameter(STREAMLINED_CREATION));
+ }
+
+ protected TabbedPane getTabbedPane() {
+ return m_tabbedPane;
}
+
+ protected WizardSelector getWizardPane() {
+ return m_wizardPane;
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -5,30 +5,44 @@
package com.arsdigita.cms.ui;
import com.arsdigita.bebop.BoxPanel;
+import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SegmentedPanel.Segment;
import com.arsdigita.bebop.SingleSelectionModel;
-import com.arsdigita.bebop.event.ActionEvent;
-import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.FormCancelListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormSubmissionListener;
+import com.arsdigita.bebop.event.PrintEvent;
+import com.arsdigita.bebop.event.PrintListener;
+import com.arsdigita.bebop.form.Option;
+import com.arsdigita.bebop.form.SingleSelect;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.CMS;
+import com.arsdigita.cms.ContentItem;
+import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.ContentType;
+import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.NewItemForm;
+import com.arsdigita.cms.ui.authoring.WizardSelector;
import com.arsdigita.cms.ui.folder.FlatFolderPicker;
-import com.arsdigita.cms.ui.folder.FolderItemPane;
import com.arsdigita.cms.ui.folder.FolderRequestLocal;
import com.arsdigita.cms.ui.folder.FolderSelectionModel;
-import com.arsdigita.cms.ui.folder.FolderTreeModelBuilder;
+import com.arsdigita.cms.ui.item.ContentItemRequestLocal;
import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.persistence.OID;
+import com.arsdigita.web.RedirectSignal;
+import com.arsdigita.web.URL;
import java.math.BigDecimal;
/**
@@ -38,29 +52,38 @@
*/
class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener {
+ public static final String WIDGET_PARAM = "widget";
+ public static final String SEARCHWIDGET_PARAM = "searchWidget";
+ public static final String PUBLISHWIDGET_PARAM = "publishWidget";
private static final String CONTENT_TYPE_ID = "ct";
private static final String FOLDER_ID = "folder_id";
- private NewItemForm m_newItem;
- private SingleSelectionModel m_typeSel;
- private FlatFolderPicker m_folderPicker;
+ private final NewItemForm m_newItem;
+ private final SingleSelectionModel m_typeSel;
+ private final FlatFolderPicker m_folderPicker;
//private final BaseTree m_tree;
private final SingleSelectionModel m_model;
private final FolderSelectionModel m_folderSel; // To support legacy UI code
private final FolderRequestLocal m_folder;
private final CreationSelector m_creator;
- private final ItemSearchPage parent;
- private SegmentedPanel m_segPanel;
- private Segment m_creationSeg;
- private Segment m_newItemSeg;
+ private final ItemSearchPage m_parent;
+ private final ContentItemRequestLocal m_contentItem = new ContentItemRequestLocal() {
+ };
+ private final Link m_selectCloseLink;
+ private final Link m_selectEditLink;
+ private final SegmentedPanel m_segPanel;
+ private final Segment m_creationSeg;
+ private final Segment m_newItemSeg;
+ private final Segment m_linkSeg;
public ItemSearchCreateItemPane(final ItemSearchPage parent) {
super();
- this.parent = parent;
+ this.m_parent = parent;
m_segPanel = new SegmentedPanel("itemSearchCreate");
m_creationSeg = new Segment();
m_newItemSeg = new Segment();
+ m_linkSeg = new Segment();
m_newItem = new SectionNewItemForm("newItem");
//m_newItem.addProcessListener(this);
@@ -78,7 +101,25 @@
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
// m_typeSel.addChangeListener(this);
- m_creator = new CreationSelector(m_typeSel, m_folderSel);
+ m_creator = new CreationSelector(m_typeSel, m_folderSel) {
+
+ @Override
+ public void editItem(final PageState state, final ContentItem item) {
+
+ //final ContentSection section = getContentSection(state);
+ //final String nodeURL = URL.getDispatcherPath() + section.getPath() + "/";
+ //final String target = ItemSearchContentItemPage.getItemURL(nodeURL, item.getID(),
+ // ContentItemPage.AUTHORING_TAB, true);
+
+ //throw new RedirectSignal(target, true);
+
+ m_creationSeg.setVisible(state, false);
+ m_linkSeg.setVisible(state, true);
+
+ m_contentItem.set(state, item);
+ }
+
+ };
m_creationSeg.add(m_creator);
m_creationSeg.add(new Label("<br/>", false));
@@ -96,9 +137,89 @@
m_segPanel.add(m_newItemSeg);
m_segPanel.add(m_creationSeg);
-
add(m_segPanel);
+ m_selectCloseLink = new Link(
+ (String) GlobalizationUtil.globalize("cms.ui.search.create.select_close").localize(),
+ new PrintListener() {
+
+ public void prepare(final PrintEvent event) {
+ final Link target = (Link) event.getTarget();
+ final PageState state = event.getPageState();
+
+ final ContentItem item = m_contentItem.getContentItem(state);
+ final String title;
+ if (item instanceof ContentPage) {
+ title = ((ContentPage) item).getTitle();
+ } else {
+ title = item.getName();
+ }
+
+ final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
+ final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
+ final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
+
+ target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+ + "window.opener.document.%s.value=\"%s\";"
+ + "window.opener.document.%s.value=\"%s\";"
+ + "self.close();"
+ + "return false;",
+ widget,
+ item.getID().toString(),
+ searchWidget,
+ title,
+ publishWidget,
+ Boolean.TRUE.toString()));
+ }
+
+ });
+
+ m_selectEditLink = new Link((String) GlobalizationUtil.globalize("cms.ui.search.create.select_edit").localize(),
+ new PrintListener() {
+
+ public void prepare(final PrintEvent event) {
+ final Link target = (Link) event.getTarget();
+ final PageState state = event.getPageState();
+
+ final ContentItem item = m_contentItem.getContentItem(state);
+ final String title;
+ if (item instanceof ContentPage) {
+ title = ((ContentPage) item).getTitle();
+ } else {
+ title = item.getName();
+ }
+
+
+ final String widget = (String) state.getValue(new StringParameter(WIDGET_PARAM));
+ final String searchWidget = (String) state.getValue(new StringParameter(SEARCHWIDGET_PARAM));
+ final String publishWidget = (String) state.getValue(new StringParameter(PUBLISHWIDGET_PARAM));
+
+ final ContentSection section = item.getContentSection();
+ final String nodeURL = section.getPath() + "/";
+ final String linkTarget = ContentItemPage.getItemURL(nodeURL, item.getID(),
+ ContentItemPage.AUTHORING_TAB, true);
+ target.setTarget(linkTarget);
+ target.setOnClick(String.format("window.opener.document.%s.value=\"%s\";"
+ + "window.opener.document.%s.value=\"%s\";"
+ + "window.opener.document.%s.value=\"%s\";",
+ widget,
+ item.getID().toString(),
+ searchWidget,
+ title,
+ publishWidget,
+ Boolean.TRUE.toString()));
+
+ }
+
+ });
+
+ final BoxPanel linkPanel = new BoxPanel(BoxPanel.VERTICAL);
+ linkPanel.add(m_selectCloseLink);
+ linkPanel.add(m_selectEditLink);
+ m_linkSeg.add(linkPanel);
+
+ m_segPanel.add(m_linkSeg);
+
}
@Override
@@ -107,6 +228,7 @@
page.setVisibleDefault(m_newItemSeg, true);
page.setVisibleDefault(m_creationSeg, false);
+ page.setVisibleDefault(m_linkSeg, false);
page.addComponentStateParam(this, m_typeSel.getStateParameter());
page.addComponentStateParam(this, m_folderSel.getStateParameter());
@@ -117,29 +239,14 @@
final BigDecimal typeID = m_newItem.getTypeID(state);
m_typeSel.setSelectedKey(state, typeID);
- final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state);
- m_folderSel.setSelectedKey(state, folderId);
-
+ final OID folderOID = OID.valueOf((String) m_folderPicker.getValue(state));
+ m_folderSel.setSelectedKey(state, folderOID.get("id"));
m_newItemSeg.setVisible(state, false);
m_creationSeg.setVisible(state, true);
}
public void process(final FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final Object source = fse.getSource();
- //if (source == m_newItem) {
- final BigDecimal typeID = m_newItem.getTypeID(state);
- m_typeSel.setSelectedKey(state, typeID);
- final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state);
- m_folderSel.setSelectedKey(state, folderId);
-
- //m_newItem.setVisible(state, false);
- //m_creator.setVisible(state, true);
- m_newItemSeg.setVisible(state, false);
- m_creationSeg.setVisible(state, true);
- //parent.setTabActive(state, this, true);
- //newItemMode(state);
- //}
+ //Nothing
}
private static class SectionNewItemForm extends NewItemForm {
@@ -151,5 +258,6 @@
public ContentSection getContentSection(PageState s) {
return CMS.getContext().getContentSection();
}
+
}
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -5,7 +5,6 @@
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.GridPanel;
import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.Page;
@@ -13,7 +12,6 @@
import com.arsdigita.bebop.PaginationModelBuilder;
import com.arsdigita.bebop.Paginator;
import com.arsdigita.bebop.RequestLocal;
-import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.FormInitListener;
import com.arsdigita.bebop.event.FormProcessListener;
@@ -37,14 +35,10 @@
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.Session;
import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.toolbox.ui.DataQueryBuilder;
-import com.arsdigita.toolbox.ui.DataTable;
import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
-import org.bouncycastle.asn1.ess.ContentIdentifier;
/**
*
@@ -297,7 +291,10 @@
final ContentPage page = new ContentPage((BigDecimal) key);
link.setOnClick(String.format(
- "window.opener.document.%s.value=\"%s\";window.opener.document.%s.value=\"%s\";self.close();return false;",
+ "window.opener.document.%s.value=\"%s\";"
+ + "window.opener.document.%s.value=\"%s\";"
+ + "self.close();"
+ + "return false;",
widget,
key.toString(),
searchWidget,
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -78,6 +78,7 @@
addGlobalStateParam(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
addGlobalStateParam(new StringParameter("searchWidget"));
+ addGlobalStateParam(new StringParameter("publishWidget"));
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
addGlobalStateParam(m_sectionId);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchWidget.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -59,8 +59,9 @@
private static final Logger s_log = Logger.getLogger(ItemSearchWidget.class);
//private Hidden m_selected;
- private TextField m_selected;
+ private TextField m_selected;
private TextField m_item;
+ private Hidden m_publish;
private Submit m_search;
private Submit m_clear;
private Label m_jsLabel;
@@ -78,6 +79,7 @@
public static final String BEBOP_ITEM_SEARCH = "bebop:itemSearch";
public static final String SEARCH = "search";
public static final boolean LIMIT_TO_CONTENT_SECTION = false;
+ public static final String PUBLISH = "publish";
private class ItemFragment extends TextField {
@@ -184,18 +186,18 @@
}
/**
- * Construct a new ItemSearchWidget. The model must be an
- * ItemSearchParameter
+ * Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
*/
public ItemSearchWidget(ParameterModel model) {
this(model, null);
}
/**
- * Construct a new ItemSearchWidget. The model must be an
- * ItemSearchParameter
+ * Construct a new ItemSearchWidget. The model must be an ItemSearchParameter
+ *
* @param model
- * @param contentType
+ *param
+ * contentType
*/
public ItemSearchWidget(final ParameterModel model, final ContentType contentType) {
super(new BoxPanel(BoxPanel.VERTICAL));
@@ -203,7 +205,7 @@
if (!(model instanceof ItemSearchParameter)) {
throw new IllegalArgumentException(
"The ItemSearch widget " + model.getName()
- + " must be backed by a ItemSearchParameter parmeter model");
+ + " must be backed by a ItemSearchParameter parameter model");
}
m_name = model.getName();
@@ -223,22 +225,29 @@
m_contentType = contentType;
//m_selected = new Hidden(model);
m_selected = new ItemFragment(model, this);
- final Label selectedItemLabel = new Label(selectedLabelText);
+ final Label selectedItemLabel = new Label(selectedLabelText);
selectedItemLabel.addPrintListener(new PrintListener() {
+
public void prepare(final PrintEvent event) {
- final Label target = (Label) event.getTarget();
- target.setLabel(selectedLabelText);
+ final Label target = (Label) event.getTarget();
+ target.setLabel(selectedLabelText);
}
+
});
final Label searchLabel = new Label(searchLabelText);
searchLabel.addPrintListener(new PrintListener() {
public void prepare(final PrintEvent event) {
final Label target = (Label) event.getTarget();
- target.setLabel(searchLabelText);
+ target.setLabel(searchLabelText);
}
+
});
//m_item = new ItemFragment(model, this);
+
+ m_publish = new Hidden(PUBLISH);
+ add(m_publish);
+
m_item = new TextField(m_searchModel);
m_search = new SearchFragment(m_searchName, this);
m_clear = new ClearFragment(m_clearName, this);
@@ -255,12 +264,12 @@
CMS.getContext().getContentSection().getID());
params.setParameter("widget", formName + ".elements['" + m_selected. //m_item.
getName() + "']");
- params.setParameter("searchWidget", formName + ".elements['" + m_item.getName() + "']");
+ params.setParameter("searchWidget", formName + ".elements['" + m_item.getName() + "']");
if (typeURLFrag != null) {
params.setParameter("single_type", typeURLFrag);
}
+ params.setParameter("publishWidget", formName + ".elements['" + m_publish.getName() + "']");
-
String searchURL = WorkspaceServlet.getURLStubForClass(
ItemSearchPage.class.getName());
s_log.debug("Search URL stub is: " + searchURL);
@@ -277,9 +286,18 @@
//+ m_item.getName().replace('.', '_')
+ m_selected.getName().replace('.', '_')
+ "Popup(theForm) { \n"
- + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.getName() + "').value , "
+ + "var width = screen.width * 0.5;\n"
+ + "var height = screen.height * 0.5;\n"
+ + "if ((width < 800) && (screen.width >= 800)) {\n"
+ + "width = 800;\n"
+ + "}\n"
+ + "if ((height < 600) && (screen.height >= 600)) {\n"
+ + "height = 600;\n"
+ + "}\n"
+ + " aWindow = window.open(\"" + url + "&query=\" + document.getElementById('" + m_item.
+ getName() + "').value , "
//+ "\"search\", \"toolbar=no,width=800,height=600,status=no,scrollbars=yes,resize=yes\");\n"
- + "\"search\", \"toolbar=no,width=\" + screen.width*0.5 + \",height=\" + screen.height*0.5 + \",status=no,scrollbars=yes,resize=yes\");\n"
+ + "\"search\", \"toolbar=no,width=\" + width + \",height=\" + height + \",status=no,scrollbars=yes,resize=yes\");\n "
+ "return false;\n"
+ " } \n"
+ " --> \n"
@@ -292,12 +310,12 @@
final FormSection searchSection = new FormSection(new BoxPanel(BoxPanel.VERTICAL));
final BoxPanel searchRow = new BoxPanel(BoxPanel.HORIZONTAL);
searchRow.add(searchLabel);
- searchRow.add(m_item);
+ searchRow.add(m_item);
searchRow.add(m_search);
searchRow.add(m_clear);
final BoxPanel itemRow = new BoxPanel(BoxPanel.HORIZONTAL);
- itemRow.add(selectedItemLabel);
- itemRow.add(m_selected);
+ itemRow.add(selectedItemLabel);
+ itemRow.add(m_selected);
searchSection.add(searchRow);
searchSection.add(itemRow);
searchSection.add(m_jsLabel);
@@ -363,6 +381,7 @@
m_topHR.setVisible(s, false);
m_bottomHR.setVisible(s, false);
m_search.setVisible(s, true);
+ e.getFormData().put(PUBLISH, Boolean.FALSE.toString());
} catch (IllegalStateException ex) {
// component is in metaform. nothing to do here. Custom generateXML must hide for us
}
@@ -403,10 +422,10 @@
if (m_contentType != null) {
state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
- m_contentType.getID());
+ m_contentType.getID());
} else {
state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
- null);
+ null);
}
throw new FormProcessException("item search FormSection submit");
} else if (m_search.isSelected(state)) {
@@ -423,10 +442,10 @@
if (m_contentType != null) {
state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
- m_contentType.getID());
+ m_contentType.getID());
} else {
state.setValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM),
- null);
+ null);
}
throw new FormProcessException("item search FormSection submit");
} else if (m_clear.isSelected(state)) {
@@ -436,7 +455,7 @@
m_searchComponent.setVisible(state, false);
m_topHR.setVisible(state, false);
m_bottomHR.setVisible(state, false);
- m_search.setVisible(state, true);
+ m_search.setVisible(state, true);
} catch (IllegalStateException ex) {
// component is in metaform. nothing to do here. Custom generateXML must hide for us
}
@@ -455,9 +474,9 @@
}
public String getSearchLabelText() {
- return searchLabelText;
+ return searchLabelText;
}
-
+
public void setSearchLabelText(final String searchLabelText) {
this.searchLabelText = searchLabelText;
}
@@ -469,5 +488,5 @@
public void setSelectedLabelText(String selectedLabelText) {
this.selectedLabelText = selectedLabelText;
}
-
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/AuthoringKitSelector.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -18,46 +18,49 @@
*/
package com.arsdigita.cms.ui.authoring;
-
import com.arsdigita.bebop.Component;
+import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel;
+import com.arsdigita.bebop.event.PrintEvent;
+import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.cms.AuthoringKit;
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ContentTypeCollection;
+import com.arsdigita.cms.ui.ScriptPrinter;
import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.xml.Element;
import org.apache.log4j.Logger;
import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
-
/**
* Selects a component based on content type. Helper class for {@link
* com.arsdigita.cms.ui.authoring.WizardSelector}.
*
- * @version $Id$
+ * @version $Id$
*/
public abstract class AuthoringKitSelector extends SimpleContainer {
private static Logger s_log =
- Logger.getLogger(AuthoringKitSelector.class);
-
+ Logger.getLogger(AuthoringKitSelector.class);
private Map m_comps;
private MapComponentSelectionModel m_sel;
ContentTypeCollection m_types;
+ private ScriptPrinter scriptPrinter;
/**
- * Construct a new AuthoringKitSelector. Load all the possible
- * authoring kits from the database and construct components
- * for them.
+ * Construct a new AuthoringKitSelector. Load all the possible authoring kits from the database and construct
+ * components for them.
*
- * @param model the {@link ItemSelectionModel} which will
- * supply the selector with the id of a content type
+ * @param model the {@link ItemSelectionModel} which will supply the selector with the id of a content type
*
* @pre itemModel != null
*/
@@ -68,62 +71,78 @@
m_sel = new MapComponentSelectionModel(model, m_comps);
m_types = ContentType.getAllContentTypes();
- if ( m_types.isEmpty() ) {
+ if (m_types.isEmpty()) {
m_types.close();
- throw new IllegalStateException( (String) GlobalizationUtil.globalize("cms.ui.authoring.no_content_types_were_found").localize());
+ throw new IllegalStateException((String) GlobalizationUtil.globalize(
+ "cms.ui.authoring.no_content_types_were_found").localize());
}
-
}
// Overloaded add methods
+ @Override
public void add(Component c) {
throw new UnsupportedOperationException();
}
// Overloaded add methods
+ @Override
public void add(Component c, int constraints) {
throw new UnsupportedOperationException();
}
/**
- * Instantiate all the authoring kit wizards.
- * The child class should call this method after it is done
- * with initialization
+ * Instantiate all the authoring kit wizards. The child class should call this method after it is done with
+ * initialization
*/
protected void processKit() {
- while(m_types.next()) {
+ while (m_types.next()) {
ContentType type = m_types.getContentType();
AuthoringKit kit = type.getAuthoringKit();
- if(kit != null) {
+ if (kit != null) {
Component c = instantiateKitComponent(kit, type);
- if(c != null) {
+ if (c != null) {
super.add(c);
m_comps.put(type.getID(), c);
s_log.info("Added component " + c + " for "
+ type.getAssociatedObjectType());
}
+
+ if (c instanceof LayoutPanel) {
+ Label label = new Label("", false);
+ label.addPrintListener(new PrintListener() {
+
+ public void prepare(final PrintEvent event) {
+ final Label label = (Label) event.getTarget();
+ if (scriptPrinter != null) {
+ label.setLabel(scriptPrinter.printScript(event.getPageState()));
+ }
+ }
+
+ });
+
+ ((LayoutPanel) c).setBottom(label);
+ }
}
}
}
/**
- * Instantiate an authoring kit component. Child classes should
- * override this to do the right thing. It is permissible for this
- * method to return null.
+ * Instantiate an authoring kit component. Child classes should override this to do the right thing. It is
+ * permissible for this method to return null.
*
- * @param kit for this kit
+ * @param kit for this kit
* @param type for this type
*/
protected abstract Component instantiateKitComponent(
- AuthoringKit kit, ContentType type
- );
+ AuthoringKit kit, ContentType type);
/**
* @param id The content type id
+ *
* @return The component the given type id
*/
public Component getComponent(BigDecimal id) {
- return (Component)m_comps.get(id);
+ return (Component) m_comps.get(id);
}
/**
@@ -135,14 +154,13 @@
// Choose the right component and run it
public void generateXML(PageState state, Element parent) {
- if ( isVisible(state) ) {
+ if (isVisible(state)) {
Component c = m_sel.getComponent(state);
- if ( c == null) {
+ if (c == null) {
throw new IllegalStateException("No component for "
+ m_sel.getSelectedKey(state));
}
c.generateXML(state, parent);
}
- }
-
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicItemForm.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -31,6 +31,7 @@
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.FormValidationListener;
+import com.arsdigita.bebop.form.Hidden;
import com.arsdigita.bebop.form.TextField;
import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.TrimmedStringParameter;
@@ -66,6 +67,7 @@
private final ItemSelectionModel m_itemModel;
private SaveCancelSection m_saveCancelSection;
private FormSection m_widgetSection;
+ public static final String CONTENT_ITEM_ID = ContentItem.ID;
public static final String NAME = ContentItem.NAME;
public static final String TITLE = ContentPage.TITLE;
public static final String LANGUAGE = ContentItem.LANGUAGE;
@@ -137,7 +139,12 @@
*/
protected void addWidgets() {
//add(new FormErrorDisplay(this), ColumnPanel.FULL_WIDTH | ColumnPanel.LEFT);
-
+
+ //add(new Label("id"));
+ final Hidden id = new Hidden(CONTENT_ITEM_ID);
+ //final TextField id = new TextField(CONTENT_ITEM_ID);
+ add(id);
+
// JavaScript auto-name generation is off by default.
// It is turned on under the following circumstances
//
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -123,6 +123,7 @@
if (item != null) {
// Preset fields
+ data.put(CONTENT_ITEM_ID, item.getID().toString());
data.put(NAME, item.getName());
data.put(TITLE, item.getTitle());
// data.put(DESCRIPTION, item.getDescription());
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/SimpleEditStep.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -18,6 +18,7 @@
*/
package com.arsdigita.cms.ui.authoring;
+import com.arsdigita.bebop.Label;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -26,9 +27,12 @@
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
+import com.arsdigita.bebop.event.PrintEvent;
+import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.RequestEvent;
import com.arsdigita.bebop.event.RequestListener;
import com.arsdigita.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.ContentItemPage;
@@ -133,7 +137,7 @@
component.setItemSelectionModel(itemModel);
addDisplayComponent(component);
- }
+ }
}
/**
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/WizardSelector.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -22,6 +22,7 @@
import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Resettable;
+import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.SingleSelectionModel;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.AuthoringKit;
@@ -29,6 +30,7 @@
import com.arsdigita.cms.ContentType;
import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.toolbox.ui.LayoutPanel;
import com.arsdigita.xml.Element;
import java.math.BigDecimal;
@@ -81,7 +83,7 @@
new ItemSelectionModel(type,
(BigDecimalParameter)m_itemSel.getStateParameter());
- AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel);
+ AuthoringKitWizard w = new AuthoringKitWizard(type, itemModel);
return w;
}
@@ -114,7 +116,7 @@
} else {
typeId = type.getID();
}
-
+
// Return the selected wizard
return (Component)getComponent(typeId);
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/AbstractFolderPicker.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -8,6 +8,7 @@
import com.arsdigita.bebop.event.PrintListener;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.PageState;
+import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.Folder;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID;
@@ -19,42 +20,46 @@
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
*/
public abstract class AbstractFolderPicker extends SingleSelect {
-
+
public AbstractFolderPicker(String name) {
- super(new OIDParameter(name));
-
+ //super(new OIDParameter(name));
+ super(new StringParameter(name));
+
try {
addPrintListener(new PrintListener() {
+
@Override
- public void prepare(PrintEvent ev) {
- addOptions(ev.getPageState(),
- (SingleSelect)ev.getTarget());
- }
- });
+ public void prepare(PrintEvent ev) {
+ addOptions(ev.getPageState(),
+ (SingleSelect) ev.getTarget());
+ }
+
+ });
} catch (TooManyListenersException ex) {
throw new RuntimeException("this cannot happen");
- }
+ }
}
-
+
public Folder getFolder(PageState state) {
- OID oid = (OID)getValue(state);
-
+ OID oid = OID.valueOf((String) getValue(state));//(OID) getValue(state);
+
if (oid == null) {
return null;
+ } else {
+ return (Folder) DomainObjectFactory.newInstance(oid);
}
- return (Folder)DomainObjectFactory.newInstance(oid);
}
-
- public void setCategory(PageState state,
- Folder folder) {
+
+ public void setFolder(PageState state,
+ Folder folder) {
if (folder == null) {
setValue(state, null);
} else {
- setValue(state, folder.getOID());
+ setValue(state, folder.getOID().toString());
}
}
-
+
protected abstract void addOptions(PageState state,
SingleSelect target);
-
+
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -25,7 +25,7 @@
}
protected void addOptions(PageState state, SingleSelect target) {
- target.addOption(new Option(null, ""));
+ target.addOption(new Option("", ""));
final ContentSection section = CMS.getContext().getContentSection();
//final String sectionName = section.getName();
@@ -70,7 +70,7 @@
path = String.format("%s/%s", prefix, folder.getName());
}
- target.addOption(new Option(folder.getID().toString(), path));
+ target.addOption(new Option(folder.getOID().toString(), path));
final ItemCollection children = folder.getChildren();
children.addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE);
Modified: trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java 2012-12-16 09:21:24 UTC (rev 2373)
+++ trunk/ccm-core/src/com/arsdigita/bebop/TabbedPane.java 2012-12-16 09:26:24 UTC (rev 2374)
@@ -100,7 +100,7 @@
while (i.hasNext()) {
Pane pane = (Pane) i.next();
p.setVisibleDefault(pane.getComponent(), pane == m_defaultPane);
- }
+ }
}
/**
|
|
From: <pb...@fe...> - 2012-12-16 09:21:34
|
Author: pboy
Date: 2012-12-16 09:21:24 +0000 (Sun, 16 Dec 2012)
New Revision: 2373
Modified:
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
Log:
Restructured internal classes.
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 09:20:21 UTC (rev 2372)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java 2012-12-16 09:21:24 UTC (rev 2373)
@@ -21,8 +21,6 @@
import com.arsdigita.cms.contentassets.ItemImageAttachment;
import com.arsdigita.bebop.AbstractSingleSelectionModel;
-import com.arsdigita.bebop.ActionLink;
-import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.RequestLocal;
@@ -31,7 +29,7 @@
import com.arsdigita.bebop.parameters.ParameterModel;
import com.arsdigita.cms.ContentItem;
import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.ImageChooser;
+import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.cms.ui.SecurityPropertyEditor;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
@@ -83,8 +81,8 @@
Iterator imageComponents = m_add.getImageComponents();
while( imageComponents.hasNext() ) {
- ImageStepEdit.ImageComponent component =
- (ImageStepEdit.ImageComponent) imageComponents.next();
+ ImageComponent component =
+ (ImageComponent) imageComponents.next();
addListeners( component.getForm(),
component.getSaveCancelSection().getCancelButton() );
Modified: trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java
===================================================================
--- trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 09:20:21 UTC (rev 2372)
+++ trunk/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepEdit.java 2012-12-16 09:21:24 UTC (rev 2373)
@@ -15,20 +15,15 @@
* 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.ui;
-import com.arsdigita.bebop.ActionLink;
-import com.arsdigita.bebop.ColumnPanel;
import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.MapComponentSelectionModel;
import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
-import com.arsdigita.bebop.SaveCancelSection;
+import com.arsdigita.bebop.Resettable;
import com.arsdigita.bebop.SimpleContainer;
import com.arsdigita.bebop.event.ActionEvent;
import com.arsdigita.bebop.event.ActionListener;
@@ -37,27 +32,17 @@
import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.event.ParameterEvent;
import com.arsdigita.bebop.event.ParameterListener;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.BigDecimalParameter;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
import com.arsdigita.bebop.parameters.ParameterData;
-import com.arsdigita.bebop.parameters.StringLengthValidationListener;
import com.arsdigita.bebop.parameters.StringParameter;
import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ImageAsset;
-import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ReusableImageAsset;
import com.arsdigita.cms.contentassets.ItemImageAttachment;
-import com.arsdigita.cms.ui.FileUploadSection;
-import com.arsdigita.cms.ui.ImageBrowser;
-import com.arsdigita.cms.ui.ImageChooser;
-import com.arsdigita.domain.DataObjectNotFoundException;
+import com.arsdigita.cms.ui.ImageComponent;
+import com.arsdigita.cms.ui.ImageLibraryComponent;
+import com.arsdigita.cms.ui.ImageUploadComponent;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.util.Assert;
import com.arsdigita.util.StringUtils;
-import java.io.File;
-import java.io.IOException;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Iterator;
@@ -66,454 +51,190 @@
import org.apache.log4j.Logger;
public class ImageStepEdit extends SimpleContainer
- implements FormProcessListener, FormInitListener {
+ implements Resettable, FormProcessListener, FormInitListener {
private static final Logger s_log = Logger.getLogger(ImageStepEdit.class);
-
private final ImageStep m_imageStep;
-
private final StringParameter m_imageComponentKey;
private final MapComponentSelectionModel m_imageComponent;
- private final String UPLOAD = "upload";
- private final String LIBRARY = "library";
-
- public ImageStepEdit( ImageStep step ) {
+ public ImageStepEdit(ImageStep step) {
m_imageStep = step;
- m_imageComponentKey = new StringParameter( "imageComponent" );
+ m_imageComponentKey = new StringParameter("imageComponent");
ParameterSingleSelectionModel componentModel =
- new ParameterSingleSelectionModel( m_imageComponentKey );
+ new ParameterSingleSelectionModel(m_imageComponentKey);
m_imageComponent =
- new MapComponentSelectionModel( componentModel, new HashMap() );
+ new MapComponentSelectionModel(componentModel, new HashMap());
Map selectors = m_imageComponent.getComponentsMap();
+ ImageLibraryComponent library = new ImageLibraryComponent();
+ library.getForm().addInitListener(this);
+ library.getForm().addProcessListener(this);
+ library.addUploadLink(new ActionListener() {
+
+ public void actionPerformed(ActionEvent ev) {
+ setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
+ }
+ });
+ selectors.put(ImageComponent.LIBRARY, library);
+ add(library);
+
ImageUploadComponent upload = new ImageUploadComponent();
upload.getForm().addInitListener(this);
upload.getForm().addProcessListener(this);
- selectors.put( UPLOAD, upload );
- add( upload );
+ selectors.put(ImageComponent.UPLOAD, upload);
+ add(upload);
- ImageLibraryComponent library = new ImageLibraryComponent();
- library.getForm().addInitListener(this);
- library.getForm().addProcessListener(this);
- selectors.put( LIBRARY, library );
- add( library );
}
@Override
- public void register( Page p ) {
- super.register( p );
+ public void register(Page p) {
+ super.register(p);
Map componentsMap = m_imageComponent.getComponentsMap();
Iterator i = componentsMap.keySet().iterator();
- while( i.hasNext() ) {
+ while (i.hasNext()) {
Object key = i.next();
- Component component = (Component) componentsMap.get( key );
+ Component component = (Component) componentsMap.get(key);
- p.setVisibleDefault( component, LIBRARY.equals( key ) );
+ p.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
}
- p.addComponentStateParam( this, m_imageComponentKey );
+ p.addComponentStateParam(this, m_imageComponentKey);
}
Iterator getImageComponents() {
return m_imageComponent.getComponentsMap().values().iterator();
}
- private 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 ) );
+ private 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, UPLOAD );
+ m_imageComponent.setSelectedKey(ps, ImageComponent.UPLOAD);
}
- return (ImageComponent) m_imageComponent.getComponent( ps );
+ return (ImageComponent) m_imageComponent.getComponent(ps);
}
- private void setImageComponent( PageState ps, final String activeKey ) {
- m_imageComponent.setSelectedKey( ps, activeKey );
+ private void setImageComponent(PageState ps, final String activeKey) {
+ m_imageComponent.setSelectedKey(ps, activeKey);
- if( s_log.isDebugEnabled() ) {
- s_log.debug( "Selected component: " + activeKey );
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Selected component: " + activeKey);
}
Map componentsMap = m_imageComponent.getComponentsMap();
Iterator i = componentsMap.keySet().iterator();
- while( i.hasNext() ) {
+ while (i.hasNext()) {
Object key = i.next();
- Component component = (Component) componentsMap.get( key );
+ Component component = (Component) componentsMap.get(key);
- boolean isVisible = activeKey.equals( key );
+ boolean isVisible = activeKey.equals(key);
- if( s_log.isDebugEnabled() ) {
- s_log.debug( "Key: " + key + "; Visibility: " + isVisible );
+ if (s_log.isDebugEnabled()) {
+ s_log.debug("Key: " + key + "; Visibility: " + isVisible);
}
- ps.setVisible( component, isVisible );
+ ps.setVisible(component, isVisible);
}
}
public void init(FormSectionEvent event)
- throws FormProcessException {
+ throws FormProcessException {
PageState ps = event.getPageState();
- ItemImageAttachment attachment = m_imageStep.getAttachment( ps );
- if( null == attachment ) {
+ ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+ if (null == attachment) {
// XXX: Do something
}
}
- public void process( FormSectionEvent event ) throws FormProcessException {
+ public void process(FormSectionEvent event) throws FormProcessException {
PageState ps = event.getPageState();
- ImageComponent component = getImageComponent( ps );
+ ImageComponent component = getImageComponent(ps);
- if( !component.getSaveCancelSection().getSaveButton().isSelected( ps ) ) {
+ if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
return;
}
- ContentItem item = m_imageStep.getItem( ps );
- if( null == item ) {
- s_log.error( "No item selected in ImageStepEdit",
- new RuntimeException() );
+ ContentItem item = m_imageStep.getItem(ps);
+ if (null == item) {
+ s_log.error("No item selected in ImageStepEdit",
+ new RuntimeException());
return;
}
- ReusableImageAsset image = component.getImage( event );
+ ReusableImageAsset image = component.getImage(event);
- ItemImageAttachment attachment = m_imageStep.getAttachment( ps );
- if( null == attachment ) {
- attachment = new ItemImageAttachment( item, image );
+ ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+ if (null == attachment) {
+ attachment = new ItemImageAttachment(item, image);
}
- attachment.setCaption( component.getCaption( event ) );
+ attachment.setCaption(component.getCaption(event));
// We only set the description and title based on the UI in
// the case where getIsImageStepDescriptionAndTitleShown is true.
// Otherwise, we leave this as the default value. This means
// existing values are not overwritten if the image is edited when
// isImageStepDescriptionAndTitleShown is false.
- if(ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
- attachment.setDescription(component.getDescription( event ));
- attachment.setTitle(component.getTitle( event ));
- }
- attachment.setUseContext( component.getUseContext( event ) );
- }
-
- interface ImageComponent {
- 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();
- }
-
- private 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;
-
- public ImageUploadComponent() {
- super("imageStepEditUpload", new ColumnPanel(2));
-
- 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 );
-
- add(new Label("Caption"));
- m_caption = new TextField("caption");
- m_caption.addValidationListener(new NotNullValidationListener());
- m_caption.addValidationListener(new StringLengthValidationListener(40));
- m_caption.setSize(40);
- add(m_caption);
-
- m_title = new TextField("title");
- m_description = new TextArea("description");
-
- // 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 = new TextField("useContext");
- m_useContext.setSize(40);
-// Removed to use multiple images with fancyBox
-// m_useContext.addValidationListener( new UniqueUseContextListener() );
- 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 whixh 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 );
- */
+ if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
+ attachment.setDescription(component.getDescription(event));
+ attachment.setTitle(component.getTitle(event));
}
-
- 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 ) {
- 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;
- }
+ attachment.setUseContext(component.getUseContext(event));
}
- private class ImageLibraryComponent extends SimpleContainer
- implements ImageComponent {
- private final ImageChooser m_chooser;
- private final ItemSelectionModel m_imageModel;
- private final BigDecimalParameter m_imageID;
+ public void reset(PageState state) {
+ Page p = state.getPage();
+
+ Map componentsMap = m_imageComponent.getComponentsMap();
+ Iterator i = componentsMap.keySet().iterator();
+ while (i.hasNext()) {
+ Object key = i.next();
+ Component component = (Component) componentsMap.get(key);
- 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;
-
- public ImageLibraryComponent() {
- m_imageID = new BigDecimalParameter( "imageID" );
- m_imageModel = new ItemSelectionModel( m_imageID );
-
- m_chooser = new ImageChooser( ContentItem.DRAFT );
- m_chooser.addImageActionListener( new ImageBrowser.LinkActionListener() {
- public void deleteClicked( PageState ps, BigDecimal imageID ) {
- s_log.debug( "Clicked delete" );
-
- ReusableImageAsset image =
- new ReusableImageAsset( imageID );
- image.delete();
- }
-
- public void linkClicked( PageState ps, BigDecimal imageID ) {
- s_log.debug( "Clicked select" );
- try {
- ReusableImageAsset image =
- new ReusableImageAsset( imageID );
-
- m_imageModel.setSelectedObject( ps, image );
- } catch( DataObjectNotFoundException ex ) {
- s_log.error( "Selected non-existant image: " + imageID, ex );
- }
- }
- } );
- // Don't display the delete links
- /*
- m_chooser.getImageBrowser().getColumn(5)
- .setCellRenderer( new TableCellRenderer() {
- public Component getComponent( Table table, PageState state,
- Object value, boolean isSelected,
- Object key, int row,
- int column ) {
- return new Label( " ", false );
- }
- } );
- */
- add( m_chooser );
-
- m_form = new Form( "imageStepEditLibrary", new ColumnPanel( 2 ) );
- add( m_form );
-
- m_form.add(new Label("Caption"));
- m_caption = new TextField("caption");
- m_caption.addValidationListener(new NotNullValidationListener());
- m_caption.setSize(40);
- m_form.add(m_caption);
-
- m_description = new TextField("description");
- m_description.addValidationListener(new NotNullValidationListener());
- m_description.setSize(40);
-
- m_title = new TextField("title");
- 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 = new TextField("useContext");
- m_useContext.setSize(40);
-// Removed to use multiple images with fancyBox
-// m_useContext.addValidationListener( new UniqueUseContextListener() );
- m_form.add(m_useContext);
-
- m_saveCancel = new SaveCancelSection();
- m_form.add(m_saveCancel);
-
- ActionLink upload = new ActionLink( "Upload a new image" );
- upload.addActionListener( new ActionListener() {
- public void actionPerformed( ActionEvent ev ) {
- setImageComponent( ev.getPageState(), UPLOAD );
- }
- } );
- add( upload, ColumnPanel.FULL_WIDTH );
+ p.setVisibleDefault(component, ImageComponent.LIBRARY.equals(key));
}
-
- public ReusableImageAsset getImage( FormSectionEvent event ) {
- PageState ps = event.getPageState();
-
- return (ReusableImageAsset) m_imageModel.getSelectedItem( ps );
- }
-
- @Override
- public void register( Page p ) {
- super.register( p );
-
- p.addComponentStateParam( this, m_imageID );
- }
-
- 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 m_form;
- }
-
- public SaveCancelSection getSaveCancelSection() {
- return m_saveCancel;
- }
}
private class UniqueUseContextListener implements ParameterListener {
- public void validate( ParameterEvent ev )
- throws FormProcessException
- {
+
+ public void validate(ParameterEvent ev)
+ throws FormProcessException {
PageState ps = ev.getPageState();
ParameterData data = ev.getParameterData();
- ContentItem item = m_imageStep.getItem( ps );
- Assert.exists( item, ContentItem.class );
+ ContentItem item = m_imageStep.getItem(ps);
+ Assert.exists(item, ContentItem.class);
String value = data.getValue().toString();
- value = StringUtils.trimleft( value );
- if( StringUtils.emptyString( value ) ) {
+ value = StringUtils.trimleft(value);
+ if (StringUtils.emptyString(value)) {
value = null;
}
- data.setValue( value );
+ data.setValue(value);
DataCollection attachments =
- ItemImageAttachment.getImageAttachments( item );
- attachments
- .addEqualsFilter(ItemImageAttachment.USE_CONTEXT, value );
+ ItemImageAttachment.getImageAttachments(item);
+ attachments.addEqualsFilter(ItemImageAttachment.USE_CONTEXT, value);
try {
- if( attachments.next() ) {
- ItemImageAttachment attachment = m_imageStep.getAttachment( ps );
- BigDecimal dupAttachmentID = (BigDecimal)
- attachments.get( ItemImageAttachment.ID );
+ if (attachments.next()) {
+ ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+ BigDecimal dupAttachmentID = (BigDecimal) attachments.get(ItemImageAttachment.ID);
- if( null == attachment ||
- !attachment.getID().equals( dupAttachmentID ) )
- {
- data.addError( "There is already an image for this " +
- "item with this context" );
+ if (null == attachment
+ || !attachment.getID().equals(dupAttachmentID)) {
+ data.addError("There is already an image for this "
+ + "item with this context");
}
}
} finally {
|
|
From: <pb...@fe...> - 2012-12-16 09:20:32
|
Author: pboy
Date: 2012-12-16 09:20:21 +0000 (Sun, 16 Dec 2012)
New Revision: 2372
Added:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java
Log:
New image tab in content center, external page in Xinha plugin.
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java 2012-12-16 09:14:07 UTC (rev 2371)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ContentSectionPage.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -133,6 +133,7 @@
private FolderAdminPane m_folderPane;
private BrowsePane m_browsePane;
private LayoutPanel m_searchPane;
+ private ImagesPane m_imagesPane;
private RoleAdminPane m_rolePane;
private WorkflowAdminPane m_workflowPane;
private LifecycleAdminPane m_lifecyclePane;
@@ -165,6 +166,7 @@
m_folderPane = getFolderAdminPane();
m_browsePane = getBrowsePane();
m_searchPane = getSearchPane();
+ m_imagesPane = getImagesPane();
m_rolePane = getRoleAdminPane();
m_workflowPane = getWorkflowAdminPane();
m_lifecyclePane = getLifecycleAdminPane();
@@ -247,6 +249,13 @@
return m_searchPane;
}
+ protected ImagesPane getImagesPane() {
+ if(m_imagesPane == null) {
+ m_imagesPane = new ImagesPane();
+ }
+ return m_imagesPane;
+ }
+
protected RoleAdminPane getRoleAdminPane() {
if (m_rolePane == null) {
m_rolePane = new RoleAdminPane();
@@ -366,6 +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.roles", getRoleAdminPane());
tab(pane, "cms.ui.workflows", getWorkflowAdminPane());
tab(pane, "cms.ui.lifecycles", getLifecycleAdminPane());
@@ -404,6 +414,8 @@
if (pane == m_searchPane) {
m_searchPane.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: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 09:14:07 UTC (rev 2371)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -34,6 +34,7 @@
import com.arsdigita.cms.ImageAsset;
import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.Service;
+import com.arsdigita.cms.ui.ImageComponent;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.mimetypes.MimeType;
@@ -46,8 +47,8 @@
import org.apache.log4j.Logger;
/**
- * Displays a list of images in a Table. The table will look
- * something like this:
+ * Displays a list of images in a Table. The table will look something like
+ * this:
*
* <blockquote><pre><code>
* +-----------+-------+-------+------+----------+
@@ -73,7 +74,8 @@
private static final int TYPE = 3;
private static final int LINK = 4;
private static final int DELETE = 5;
- private static final int NUM_COLUMNS = 6;
+ private int m_numColumns = -1;
+ private int m_mode;
private Dimension m_thumbSize;
private static final Logger s_log = Logger.getLogger(ImageBrowser.class);
@@ -84,18 +86,24 @@
* component with its {@link ImageBrowserModel} during each request
*/
public ImageBrowser(ImageBrowserModelBuilder b) {
+
+ this(b, ImageComponent.ATTACH_IMAGE);
+ }
+
+ public ImageBrowser(ImageBrowserModelBuilder b, int mode) {
super(new BuilderAdapter(b), HEADERS);
+ m_mode = mode;
setThumbnailSize(CMS.getConfig().getImageBrowserThumbnailMaxWidth(),
- CMS.getConfig().getImageBrowserThumbnailMaxHeight());
+ CMS.getConfig().getImageBrowserThumbnailMaxHeight());
m_builder = b;
getHeader().setDefaultRenderer(new DefaultTableCellRenderer(false));
- getColumn(0).setCellRenderer(new ThumbnailCellRenderer());
- getColumn(1).setCellRenderer(new DefaultTableCellRenderer(false));
- getColumn(2).setCellRenderer(new DefaultTableCellRenderer(false));
- getColumn(3).setCellRenderer(new DefaultTableCellRenderer(false));
- getColumn(4).setCellRenderer(new DefaultTableCellRenderer(true));
- getColumn(5).setCellRenderer(new DeleteCellRenderer());
+ addColumn(new ThumbnailCellRenderer());
+ addColumn(new DefaultTableCellRenderer(false));
+ addColumn(new DefaultTableCellRenderer(false));
+ addColumn(new DefaultTableCellRenderer(false));
+ addColumn(new SelectCellRenderer());
+ addColumn(new DeleteCellRenderer());
setCellPadding("4");
setBorder("1");
@@ -103,6 +111,14 @@
setClassAttr("imageBrowser");
}
+ private void addColumn(TableCellRenderer renderer) {
+ getColumn(++m_numColumns).setCellRenderer(renderer);
+ }
+
+ public int getNumColumns() {
+ return m_numColumns;
+ }
+
/**
* @return the size, in pixels, of the thumbnail images
*/
@@ -112,7 +128,8 @@
/**
* Set the thumbnail size
- * @param size the size, in pixels, of the thumbnail images
+ *
+ * @param size the size, in pixels, of the thumbnail images
*/
public final void setThumbnailSize(int width, int height) {
m_thumbSize = new Dimension(width, height);
@@ -127,17 +144,15 @@
/**
* @param state The current page state
- * @return the {@link ImageBrowserModel} used in the current
- * request
+ * @return the {@link ImageBrowserModel} used in the current request
*/
public ImageBrowserModel getImageBrowserModel(PageState state) {
return ((ImageModelAdapter) getTableModel(state)).getModel();
}
/**
- * An action listener that only gets fired when the "select"
- * link is clicked. Child classes should override the
- * linkClicked method.
+ * An action listener that only gets fired when the "select" link is
+ * clicked. Child classes should override the linkClicked method.
*/
public static abstract class LinkActionListener
extends TableActionAdapter {
@@ -192,6 +207,26 @@
}
}
+ // Renders the select link if the mode needs one
+ private class SelectCellRenderer extends DefaultTableCellRenderer {
+
+ public SelectCellRenderer() {
+ super(true);
+ }
+
+ @Override
+ public Component getComponent(Table table, PageState state, Object value,
+ boolean isSelected, Object key,
+ int row, int column) {
+
+ if (m_mode == ImageComponent.SELECT_IMAGE) {
+ return super.getComponent(table, state, value, isSelected, key, row, column);
+ }
+
+ return new Label("");
+ }
+ }
+
// Renders the delete link if the user has permission to delete
// the asset and it's not used in an article.
private class DeleteCellRenderer extends DefaultTableCellRenderer {
@@ -204,27 +239,32 @@
public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key,
int row, int column) {
- boolean canDelete = false;
- // SecurityManager sm = Utilities.getSecurityManager(state);
- SecurityManager sm = CMS.getSecurityManager(state);
- if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) {
- try {
- ImageAsset asset = (ImageAsset) DomainObjectFactory.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key));
+
+ // Only show delete link in admin mode
+ if (m_mode == ImageComponent.ADMIN_IMAGES) {
+
+ boolean canDelete = false;
+ // SecurityManager sm = Utilities.getSecurityManager(state);
+ SecurityManager sm = CMS.getSecurityManager(state);
+ if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) {
+ try {
+ ImageAsset asset = (ImageAsset) DomainObjectFactory.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)) {
// canDelete = true;
// }
- } catch (DataObjectNotFoundException e) {
- // can't find asset, can't delete it
+ } catch (DataObjectNotFoundException e) {
+ // can't find asset, can't delete it
+ }
+
}
-
+
+ // can delete image because it's not in use
+ if (canDelete) {
+ return super.getComponent(table, state, value, isSelected, key, row, column);
+ }
}
-
- if (canDelete) {
- return super.getComponent(table, state, value, isSelected, key, row, column);
- } else {
- return new Label("");
- }
+ return new Label("");
}
}
@@ -262,7 +302,8 @@
@Override
public int getColumnCount() {
- return ImageBrowser.NUM_COLUMNS;
+ return ((ImageBrowser)m_model).getNumColumns();
+ // return ImageBrowser.s_numColumns;
}
@Override
@@ -311,7 +352,7 @@
return m.getMimeType();
case ImageBrowser.LINK:
- return "select";
+ return "select";
case ImageBrowser.DELETE:
return "delete";
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java 2012-12-16 09:14:07 UTC (rev 2371)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -66,32 +66,47 @@
*
* @param context the context for the retrieved items. Should be
* {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
+ * @param mode the display mode for the ImageBrowser
*/
- public ImageChooser(String context) {
+ public ImageChooser(String context, int mode) {
super(BoxPanel.VERTICAL);
m_keyword = new StringParameter(KEYWORD);
m_sel = new ParameterSingleSelectionModel(m_keyword);
m_form = new ImageKeywordForm(m_sel);
- DefaultImageBrowserModelBuilder modelBuilder =
- new DefaultImageBrowserModelBuilder(m_sel, context);
- m_browser = new ImageBrowser(modelBuilder);
- modelBuilder.setImageBrowser(m_browser);
+ DefaultImageBrowserModelBuilder modelBuilder =
+ new DefaultImageBrowserModelBuilder(m_sel, context);
+ m_browser = new ImageBrowser(modelBuilder, mode);
+ modelBuilder.setImageBrowser(m_browser);
- m_paginator = new Paginator
- (modelBuilder,
- LIST_SIZE);
+ m_paginator = new Paginator
+ (modelBuilder,
+ LIST_SIZE);
super.add(m_form);
- super.add(m_paginator);
+ super.add(m_paginator);
super.add(m_browser);
}
/**
* Construct a new ImageChooser
+ *
+ * @param context the context for the retrieved items. Should be
+ * {@link ContentItem#DRAFT} or {@link ContentItem#LIVE}
*/
+ public ImageChooser(String context) {
+ this(context, ImageComponent.ATTACH_IMAGE);
+ }
+
+ public ImageChooser(int mode) {
+ this(ContentItem.DRAFT, mode);
+ }
+
+ /**
+ * Construct a new ImageChooser
+ */
public ImageChooser() {
- this(ContentItem.DRAFT);
+ this(ContentItem.DRAFT, ImageComponent.ATTACH_IMAGE);
}
/**
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageComponent.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -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: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -0,0 +1,161 @@
+/*
+ * 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.SaveCancelSection;
+import com.arsdigita.bebop.SimpleContainer;
+import com.arsdigita.bebop.event.ActionEvent;
+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 {
+
+ 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.SELECT_IMAGE);
+ }
+
+ public ImageLibraryComponent(int mode) {
+ 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(PageState ps, BigDecimal imageID) {
+ ImagesPane.s_log.debug("Clicked delete");
+ ReusableImageAsset image = new ReusableImageAsset(imageID);
+ image.delete();
+ }
+
+ public void linkClicked(PageState ps, BigDecimal imageID) {
+ ImagesPane.s_log.debug("Clicked select");
+ try {
+ ReusableImageAsset image = new ReusableImageAsset(imageID);
+ m_imageModel.setSelectedObject(ps, 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);
+ }
+
+ // save and cancel buttons
+ m_saveCancel = new SaveCancelSection();
+ m_form.add(m_saveCancel);
+
+ }
+
+ public ReusableImageAsset getImage(FormSectionEvent event) {
+ PageState ps = event.getPageState();
+ return (ReusableImageAsset) m_imageModel.getSelectedItem(ps);
+ }
+
+ @Override
+ public void register(Page p) {
+ super.register(p);
+ p.addComponentStateParam(this, m_imageID);
+ }
+
+ 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 m_form;
+ }
+
+ public SaveCancelSection getSaveCancelSection() {
+ return m_saveCancel;
+ }
+
+ public void addUploadLink(ActionListener actionListener) {
+ // Add action link to image upload component
+ if (m_mode != ImageComponent.DISPLAY_ONLY) {
+ ActionLink upload = new ActionLink("Upload new image");
+ upload.addActionListener(actionListener);
+ add(upload, ColumnPanel.FULL_WIDTH);
+ }
+ }
+}
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -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.SimpleContainer;
+import com.arsdigita.bebop.TabbedPane;
+import com.arsdigita.bebop.parameters.BigDecimalParameter;
+import com.arsdigita.cms.CMSConfig;
+import com.arsdigita.cms.dispatcher.CMSPage;
+import com.arsdigita.cms.util.GlobalizationUtil;
+
+/**
+ *
+ * @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ */
+public class ImageSelectPage extends CMSPage {
+
+ private final static String XSL_CLASS = "CMS Admin";
+ private TabbedPane m_tabbedPane;
+ private ImageLibraryComponent m_imageLibrary;
+ private ImageUploadComponent m_imageUpload;
+ private BigDecimalParameter m_sectionId;
+ private static final CMSConfig s_conf = CMSConfig.getInstance();
+ private static final boolean LIMIT_TO_CONTENT_SECTION = false;
+ public static final String CONTENT_SECTION = "section_id";
+
+ public ImageSelectPage() {
+ super(GlobalizationUtil.globalize("cms.ui.item_search.page_title").localize().toString(), new SimpleContainer());
+
+ setClassAttr("cms-admin");
+
+ m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
+ addGlobalStateParam(m_sectionId);
+
+ m_tabbedPane = createTabbedPane();
+ m_tabbedPane.setIdAttr("page-body");
+ add(m_tabbedPane);
+
+ }
+
+ protected ImageLibraryComponent getImageLibraryPane() {
+ if (m_imageLibrary == null) {
+ m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE);
+// library.getForm().addInitListener(this);
+// library.getForm().addProcessListener(this);
+ }
+ return m_imageLibrary;
+ }
+
+ protected ImageUploadComponent getImageUploadPane() {
+
+ if (m_imageUpload == null) {
+ m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE);
+// upload.getForm().addInitListener(this);
+// upload.getForm().addProcessListener(this);
+ }
+ return m_imageUpload;
+ }
+
+ protected TabbedPane createTabbedPane() {
+ TabbedPane pane = new TabbedPane();
+ pane.setClassAttr(XSL_CLASS);
+
+ addToPane(pane, "library", getImageLibraryPane());
+ addToPane(pane, "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(TabbedPane pane, String tabName, Component comp) {
+ if (comp != null) {
+ pane.addTab(GlobalizationUtil.globalize("cms.ui.item_search." + tabName).localize().toString(), comp);
+ }
+ }
+
+ /* Listeners */
+
+ /**
+ * InitListener
+ *
+ * this init listener selects the object with the submitted oid
+ */
+// private init() {
+//
+// }
+
+ /**
+ * ProcessListener
+ *
+ * this process listener
+ */
+}
Added: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -0,0 +1,144 @@
+/*
+ * 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: trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java 2012-12-16 09:20:21 UTC (rev 2372)
@@ -0,0 +1,173 @@
+/*
+ * 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.Label;
+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.SimpleComponent;
+import com.arsdigita.bebop.event.ActionEvent;
+import com.arsdigita.bebop.event.ActionListener;
+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.bebop.parameters.StringParameter;
+import com.arsdigita.cms.ContentItem;
+import com.arsdigita.cms.ReusableImageAsset;
+import com.arsdigita.cms.util.GlobalizationUtil;
+import com.arsdigita.toolbox.ui.LayoutPanel;
+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, FormProcessListener, FormInitListener {
+
+ public static final Logger s_log = Logger.getLogger(BrowsePane.class);
+ //private ImageChooser imageChooser;
+ private final StringParameter m_imageComponentKey;
+ private final MapComponentSelectionModel m_imageComponent;
+
+ public ImagesPane() {
+ // Left column is empty, this is only to provide the same layout for all
+ // tabs in ContentSectionPage
+ setLeft(new SimpleComponent());
+
+ SegmentedPanel body = new SegmentedPanel();
+ setBody(body);
+
+ m_imageComponentKey = new StringParameter("imageComponent");
+
+ ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey);
+ m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap());
+
+ Map selectors = m_imageComponent.getComponentsMap();
+
+ ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES);
+ upload.getForm().addInitListener(this);
+ upload.getForm().addProcessListener(this);
+ selectors.put(ImageComponent.UPLOAD, upload);
+ body.addSegment(
+ new Label(GlobalizationUtil.globalize("cms.ui.image_upload")),
+ upload);
+
+ ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES);
+ library.getForm().addInitListener(this);
+ library.getForm().addProcessListener(this);
+ library.addUploadLink(new ActionListener() {
+
+ public void actionPerformed(ActionEvent ev) {
+ setImageComponent(ev.getPageState(), ImageComponent.UPLOAD);
+ }
+ });
+ selectors.put(ImageComponent.LIBRARY, library);
+ body.addSegment(
+ new Label(GlobalizationUtil.globalize("cms.ui.image_browser")),
+ library);
+
+ }
+
+ @Override
+ public final void register(Page page) {
+ super.register(page);
+ }
+
+ @Override
+ public final void reset(PageState state) {
+ super.reset(state);
+ }
+
+ /*
+ * // Private classes and methods private final class ProcessListener
+ * implements FormProcessListener {
+ */
+ public void process(FormSectionEvent event) throws FormProcessException {
+ PageState ps = event.getPageState();
+// ImageComponent component = getImageComponent(ps);
+//
+// if (!component.getSaveCancelSection().getSaveButton().isSelected(ps)) {
+// return;
+// }
+//
+// ContentItem item = m_imageStep.getItem(ps);
+// if (null == item) {
+// s_log.error("No item selected in ImageStepEdit", new RuntimeException());
+// return;
+// }
+//
+// ReusableImageAsset image = component.getImage(event);
+//
+// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+// if (null
+// == attachment) {
+// attachment = new ItemImageAttachment(item, image);
+// }
+// attachment.setCaption(component.getCaption(event));
+//
+// // We only set the description and title based on the UI in
+// // the case where getIsImageStepDescriptionAndTitleShown is true.
+// // Otherwise, we leave this as the default value. This means
+// // existing values are not overwritten if the image is edited when
+// // isImageStepDescriptionAndTitleShown is false.
+// if (ItemImageAttachment.getConfig().getIsImageStepDescriptionAndTitleShown()) {
+// attachment.setDescription(component.getDescription(event));
+// attachment.setTitle(component.getTitle(event));
+// }
+// attachment.setUseContext(component.getUseContext(event));
+ }
+
+ private final class SubmissionListener implements FormSubmissionListener {
+
+ public final void submitted(final FormSectionEvent e) {
+ final PageState s = e.getPageState();
+
+ }
+ }
+
+ private void setImageComponent(PageState ps, final String activeKey) {
+ m_imageComponent.setSelectedKey(ps, 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);
+ }
+ }
+
+ public void init(FormSectionEvent event)
+ throws FormProcessException {
+ PageState ps = event.getPageState();
+
+// ItemImageAttachment attachment = m_imageStep.getAttachment(ps);
+// if (null == attachment) {
+ // XXX: Do something
+// }
+ }
+}
|
|
From: <pb...@fe...> - 2012-12-16 09:14:17
|
Author: pboy
Date: 2012-12-16 09:14:07 +0000 (Sun, 16 Dec 2012)
New Revision: 2371
Modified:
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
trunk/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java
trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
trunk/ccm-core/src/com/arsdigita/categorization/Category.java
trunk/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategoryForm.java
trunk/ccm-core/src/com/arsdigita/packaging/Upgrade.java
Log:
Enhanced ItemSearchWidget, some minor fixes.
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources.properties 2012-12-16 09:14:07 UTC (rev 2371)
@@ -1101,3 +1101,5 @@
cms.ui.category.undeletable=This category can't be deleted.
cms.ui.item_search.flat.filter.submit=Filter
cms.ui.item_search.selected=Selected content item (id)
+cms.ui.item_search.create=Create new
+cms.ui.item_search.create.folder_select=Select folder
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties 2012-12-16 09:14:07 UTC (rev 2371)
@@ -1092,3 +1092,5 @@
cms.ui.category.undeletable=Diese Kategorie kann nicht gel\u00f6scht werden.
cms.ui.item_search.flat.filter.submit=Filtern
cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID)
+cms.ui.item_search.create=Neu anlegen
+cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties 2012-12-16 09:14:07 UTC (rev 2371)
@@ -40,3 +40,5 @@
cms.ui.category.undeletable=
cms.ui.item_search.flat.filter.submit=
cms.ui.item_search.selected=
+cms.ui.item_search.create=
+cms.ui.item_search.create.folder_select=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties 2012-12-16 09:14:07 UTC (rev 2371)
@@ -571,3 +571,5 @@
cms.ui.category.undeletable=
cms.ui.item_search.flat.filter.submit=
cms.ui.item_search.selected=
+cms.ui.item_search.create=
+cms.ui.item_search.create.folder_select=
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/FlatItemList.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -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")));
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchCreateItemPane.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -4,19 +4,27 @@
*/
package com.arsdigita.cms.ui;
+import com.arsdigita.bebop.BoxPanel;
+import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.ParameterSingleSelectionModel;
import com.arsdigita.bebop.SegmentedPanel;
import com.arsdigita.bebop.SegmentedPanel.Segment;
import com.arsdigita.bebop.SingleSelectionModel;
+import com.arsdigita.bebop.event.ActionEvent;
+import com.arsdigita.bebop.event.ActionListener;
import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent;
+import com.arsdigita.bebop.event.FormSubmissionListener;
import com.arsdigita.bebop.parameters.BigDecimalParameter;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.NewItemForm;
+import com.arsdigita.cms.ui.folder.FlatFolderPicker;
+import com.arsdigita.cms.ui.folder.FolderItemPane;
import com.arsdigita.cms.ui.folder.FolderRequestLocal;
import com.arsdigita.cms.ui.folder.FolderSelectionModel;
import com.arsdigita.cms.ui.folder.FolderTreeModelBuilder;
@@ -26,55 +34,114 @@
/**
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ * @author Jens Pelzetter <je...@jp...>
*/
-class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener {
+class ItemSearchCreateItemPane extends CMSContainer implements FormProcessListener, FormSubmissionListener {
private static final String CONTENT_TYPE_ID = "ct";
+ private static final String FOLDER_ID = "folder_id";
private NewItemForm m_newItem;
private SingleSelectionModel m_typeSel;
- private final BaseTree m_tree;
+ private FlatFolderPicker m_folderPicker;
+ //private final BaseTree m_tree;
private final SingleSelectionModel m_model;
private final FolderSelectionModel m_folderSel; // To support legacy UI code
private final FolderRequestLocal m_folder;
- private CreationSelector m_selector;
+ private final CreationSelector m_creator;
+ private final ItemSearchPage parent;
+ private SegmentedPanel m_segPanel;
+ private Segment m_creationSeg;
private Segment m_newItemSeg;
- public ItemSearchCreateItemPane() {
+ public ItemSearchCreateItemPane(final ItemSearchPage parent) {
+ super();
-// m_newItem = new SectionNewItemForm("newItem");
-// m_newItem.addProcessListener(this);
+ this.parent = parent;
- m_tree = new BaseTree(new FolderTreeModelBuilder());
- m_model = m_tree.getSelectionModel();
+ m_segPanel = new SegmentedPanel("itemSearchCreate");
+ m_creationSeg = new Segment();
+ m_newItemSeg = new Segment();
+
+ m_newItem = new SectionNewItemForm("newItem");
+ //m_newItem.addProcessListener(this);
+
+ //m_tree = new BaseTree(new FolderTreeModelBuilder());
+ //m_model = m_tree.getSelectionModel();
+ m_model = new ParameterSingleSelectionModel(new BigDecimalParameter(FOLDER_ID));
m_folderSel = new FolderSelectionModel(m_model);
m_folder = new FolderRequestLocal(m_folderSel);
// m_newItemSeg = addSegment();
this.setIdAttr("folder-new-item");
-// m_newItemSeg.addHeader(new Label(GlobalizationUtil.globalize("cms.ui.new_item")));
+// m_newItemSeg.addHeader(new Label(GlobalizationUtil.globalize("cms.ui.new_item")));
m_typeSel = new ParameterSingleSelectionModel(new BigDecimalParameter(CONTENT_TYPE_ID));
// m_typeSel.addChangeListener(this);
- m_selector = new CreationSelector(m_typeSel, m_folderSel);
- this.add(m_selector);
- this.add(new Label("<br/>", false));
+ m_creator = new CreationSelector(m_typeSel, m_folderSel);
+ m_creationSeg.add(m_creator);
+ m_creationSeg.add(new Label("<br/>", false));
-// add(m_newItem);
+ final BoxPanel folderRow = new BoxPanel(BoxPanel.HORIZONTAL);
+ folderRow.add(new Label(GlobalizationUtil.globalize("cms.ui.item_search.create.folder_select")));
+ m_folderPicker = new FlatFolderPicker("flatFolder");
+ //m_newItem.add(m_folderPicker);
+ folderRow.add(m_folderPicker);
+ m_newItem.add(folderRow);
+ m_newItemSeg.add(m_newItem);
+ m_newItem.addProcessListener(this);
+ m_newItem.addSubmissionListener(this);
+
+ m_segPanel.add(m_newItemSeg);
+ m_segPanel.add(m_creationSeg);
+
+ add(m_segPanel);
+
}
- public void process(FormSectionEvent e) {
- PageState s = e.getPageState();
- final Object source = e.getSource();
- if (source == m_newItem) {
- BigDecimal typeID = m_newItem.getTypeID(s);
- m_typeSel.setSelectedKey(s, typeID);
- //newItemMode(s);
- }
+ @Override
+ public void register(final Page page) {
+ super.register(page);
+
+ page.setVisibleDefault(m_newItemSeg, true);
+ page.setVisibleDefault(m_creationSeg, false);
+
+ page.addComponentStateParam(this, m_typeSel.getStateParameter());
+ page.addComponentStateParam(this, m_folderSel.getStateParameter());
}
+ public void submitted(final FormSectionEvent fse) {
+ final PageState state = fse.getPageState();
+
+ final BigDecimal typeID = m_newItem.getTypeID(state);
+ m_typeSel.setSelectedKey(state, typeID);
+ final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state);
+ m_folderSel.setSelectedKey(state, folderId);
+
+ m_newItemSeg.setVisible(state, false);
+ m_creationSeg.setVisible(state, true);
+ }
+
+ public void process(final FormSectionEvent fse) throws FormProcessException {
+ final PageState state = fse.getPageState();
+ final Object source = fse.getSource();
+ //if (source == m_newItem) {
+ final BigDecimal typeID = m_newItem.getTypeID(state);
+ m_typeSel.setSelectedKey(state, typeID);
+ final BigDecimal folderId = (BigDecimal) m_folderPicker.getValue(state);
+ m_folderSel.setSelectedKey(state, folderId);
+
+ //m_newItem.setVisible(state, false);
+ //m_creator.setVisible(state, true);
+ m_newItemSeg.setVisible(state, false);
+ m_creationSeg.setVisible(state, true);
+ //parent.setTabActive(state, this, true);
+ //newItemMode(state);
+ //}
+ }
+
private static class SectionNewItemForm extends NewItemForm {
public SectionNewItemForm(String name) {
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchFlatBrowsePane.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -65,6 +65,8 @@
public ItemSearchFlatBrowsePane(final String name) {
super(name);
+ setIdAttr("itemSearchFlatBrowse");
+
final BoxPanel mainPanel = new BoxPanel(BoxPanel.VERTICAL);
queryParam = new StringParameter(QUERY_PARAM);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/ItemSearchPage.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -61,12 +61,11 @@
private ItemSearchFlatBrowsePane m_flatBrowse;
private ItemSearchBrowsePane m_browse;
private ItemSearchPopup m_search;
- //private ItemSearchCreateItemPane m_create;
+ private ItemSearchCreateItemPane m_create;
private BigDecimalParameter m_sectionId;
private static final CMSConfig s_conf = CMSConfig.getInstance();
private static final boolean LIMIT_TO_CONTENT_SECTION = false;
public static final String CONTENT_SECTION = "section_id";
- //private final boolean showFlatBrowsePane;
/**
* Construct a new ItemSearchPage
@@ -80,18 +79,13 @@
addGlobalStateParam(new StringParameter(ItemSearchPopup.WIDGET_PARAM));
addGlobalStateParam(new StringParameter("searchWidget"));
- //showFlatBrowsePane = s_conf.getItemSearchFlatBrowsePaneEnable();
-
-
m_sectionId = new BigDecimalParameter(CONTENT_SECTION);
addGlobalStateParam(m_sectionId);
+ m_flatBrowse = getFlatBrowsePane();
m_browse = getBrowsePane();
-// if (showFlatBrowsePane) {
-// m_flatBrowse = getFlatBrowsePane();
-// }
m_search = getSearchPane();
-// m_create = getCreatePane();
+ m_create = getCreatePane();
m_tabbedPane = createTabbedPane();
m_tabbedPane.setIdAttr("page-body");
@@ -102,6 +96,10 @@
final PageState state = event.getPageState();
final String query = (String) state.getValue(new StringParameter(ItemSearchPopup.QUERY));
+
+ if (m_tabbedPane.getCurrentPane(state) == m_create) {
+ return;
+ }
if ((query == null) || query.isEmpty()) {
m_tabbedPane.setSelectedIndex(state, 1);
@@ -109,10 +107,14 @@
m_tabbedPane.setSelectedIndex(state, 0);
}
- //if (showFlatBrowsePane) {
- // m_tabbedPane.setTabVisible(state, 0, false);
- // m_tabbedPane.setSelectedIndex(state, 1);
- //}
+ BigDecimal typeParam = (BigDecimal) state.getValue(new BigDecimalParameter(ItemSearch.SINGLE_TYPE_PARAM));
+ if (typeParam == null) {
+ m_tabbedPane.setTabVisible(state, m_create, false);
+ m_create.setVisible(state, false);
+ } else {
+ m_tabbedPane.setTabVisible(state, m_create, true);
+ m_create.setVisible(state, true);
+ }
}
});
@@ -152,13 +154,14 @@
return m_search;
}
-// protected ItemSearchCreateItemPane getCreatePane() {
-// if(m_create == null) {
-// m_create = new ItemSearchCreateItemPane();
-// }
-//
-// return m_create;
-// }
+ protected ItemSearchCreateItemPane getCreatePane() {
+ if (m_create == null) {
+ m_create = new ItemSearchCreateItemPane(this);
+ }
+
+ return m_create;
+ }
+
/**
* Created the TabbedPane to use for this page. Sets the class attribute for this tabbed pane. The default
* implementation uses a
@@ -172,12 +175,11 @@
TabbedPane pane = new TabbedPane();
pane.setClassAttr(XSL_CLASS);
- //if (showFlatBrowsePane) {
- addToPane(pane, "flatBrowse", getFlatBrowsePane());
- //}
+
+ addToPane(pane, "flatBrowse", getFlatBrowsePane());
addToPane(pane, "browse", getBrowsePane());
addToPane(pane, "search", getSearchPane());
-// addToPane(pane, "create", getCreatePane());
+ addToPane(pane, "create", getCreatePane());
if ("browse".equals(s_conf.getItemSearchDefaultTab())) {
pane.setDefaultPane(m_browse);
@@ -185,14 +187,10 @@
if ("search".equals(s_conf.getItemSearchDefaultTab())) {
pane.setDefaultPane(m_search);
}
- //if ("flatBrowse".equals(s_conf.getItemSearchDefaultTab()) && showFlatBrowsePane) {
- pane.setDefaultPane(m_flatBrowse);
- //} else {
- pane.setDefaultPane(m_browse);
- //}
- //pane.addActionListener(this);
-// pane.setTabVisible(null, pane, true);
+ //pane.setDefaultPane(m_flatBrowse);
+ pane.setDefaultPane(m_browse);
+
return pane;
}
@@ -258,5 +256,12 @@
}.run();
}
+
+ protected void setTabActive(final PageState state, final Component component, final boolean value) {
+ m_tabbedPane.setTabVisible(state, component, value);
+ }
+ protected void setTabActive(final PageState state, final int index, final boolean value) {
+ m_tabbedPane.setTabVisible(state, index, value);
+ }
}
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/NewItemForm.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -21,6 +21,7 @@
import com.arsdigita.bebop.BoxPanel;
import com.arsdigita.bebop.Form;
import com.arsdigita.bebop.Label;
+import com.arsdigita.bebop.Page;
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.event.PrintEvent;
import com.arsdigita.bebop.event.PrintListener;
@@ -72,20 +73,21 @@
*
*/
public NewItemForm(String name) {
- super(name, new BoxPanel(BoxPanel.HORIZONTAL));
+ //super(name, new BoxPanel(BoxPanel.HORIZONTAL));
+ super(name, new BoxPanel(BoxPanel.VERTICAL));
setIdAttr("new_item_form");
- BoxPanel panel = (BoxPanel) getPanel();
+ BoxPanel panel = new BoxPanel(BoxPanel.HORIZONTAL);//(BoxPanel) getPanel();
panel.setWidth("2%");
panel.setBorder(0);
m_emptyLabel = new Label(globalize("cms.ui.authoring.no_types_registered"), false);
m_emptyLabel.setIdAttr("empty_label");
- add(m_emptyLabel);
+ panel.add(m_emptyLabel);
m_createLabel = new Label(globalize("cms.ui.authoring.create_new"), false);
m_createLabel.setIdAttr("create_label");
- add(m_createLabel);
+ panel.add(m_createLabel);
m_typeWidget = new SingleSelect(new BigDecimalParameter(TYPE_ID));
try {
@@ -162,11 +164,12 @@
throw new UncheckedWrapperException("Too many listeners: " + e.getMessage(), e);
}
- add(m_typeWidget);
+ panel.add(m_typeWidget);
m_submit = new Submit("new", globalize("cms.ui.authoring.go"));
- add(m_submit);
-
+ panel.add(m_submit);
+
+ add(panel);
}
public abstract ContentSection getContentSection(PageState state);
Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-cms/src/com/arsdigita/cms/ui/folder/FlatFolderPicker.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -7,21 +7,36 @@
import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.form.Option;
import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
+import com.arsdigita.cms.CMS;
+import com.arsdigita.cms.ContentSection;
+import com.arsdigita.cms.Folder;
+import com.arsdigita.cms.ItemCollection;
/**
*
* @author Sören Bernstein (quasimodo) <sbe...@ze...>
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
*/
public class FlatFolderPicker extends AbstractFolderPicker {
-
+
public FlatFolderPicker(String name) {
super(name);
}
-
- protected void addOptions(PageState state, SingleSelect target) {
+
+ protected void addOptions(PageState state, SingleSelect target) {
+ target.addOption(new Option(null, ""));
+
+ final ContentSection section = CMS.getContext().getContentSection();
+ //final String sectionName = section.getName();
+ final Folder root = section.getRootFolder();
+
+ final String path = ""; // String.format("%s:", sectionName);
+
+ //addFolders(target, path, root.getChildren().addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE));
+ addFolder(target, path, root);
+
+
// DataCollection terms = SessionManager.getSession()
// .retrieve(Term.BASE_DATA_OBJECT_TYPE);
// terms.addPath("model.id");
@@ -39,5 +54,30 @@
// terms.get("domain.title") + " -> " +
// terms.get("model.name")));
// }
- }
+ }
+
+ private void addFolders(final SingleSelect target, final String path, ItemCollection folders) {
+ while (folders.next()) {
+ addFolder(target, path, (Folder) folders.getContentItem());
+ }
+ }
+
+ private void addFolder(final SingleSelect target, final String prefix, final Folder folder) {
+ final String path;
+ if ("/".equals(folder.getName()) || (prefix == null) || prefix.isEmpty() || prefix.endsWith("/")) {
+ path = String.format("%s%s", prefix, folder.getName());
+ } else {
+ path = String.format("%s/%s", prefix, folder.getName());
+ }
+
+ target.addOption(new Option(folder.getID().toString(), path));
+
+ final ItemCollection children = folder.getChildren();
+ children.addEqualsFilter("objectType", Folder.BASE_DATA_OBJECT_TYPE);
+
+ if (!children.isEmpty()) {
+ addFolders(target, path, children);
+ }
+ }
+
}
Modified: trunk/ccm-core/src/com/arsdigita/categorization/Category.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/categorization/Category.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-core/src/com/arsdigita/categorization/Category.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -42,14 +42,12 @@
import com.arsdigita.util.HierarchyDenormalization;
import com.arsdigita.util.StringUtils;
import com.arsdigita.util.UncheckedWrapperException;
-
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
-
import org.apache.log4j.Logger;
/**
@@ -86,7 +84,7 @@
* @version $Revision: 1.1 $ $DateTime: $
*
* <p>Localization is done with some new classes, so the category tree is
- * now multilanguage. This is completly transparent to the rest of the
+ * now multilanguage. This is completly transparent to the rest of the
* system (hopefully) and uses the negotiated language from the browser
* environment. The following attributes are localizable:
*
@@ -178,6 +176,7 @@
private CategoryLocalizationCollection m_categoryLocalizationCollection;
// Quasimodo: End
+ @Override
protected String getBaseDataObjectType() {
return BASE_DATA_OBJECT_TYPE;
}
@@ -378,7 +377,7 @@
public String getName(String locale) {
// Test for localized version
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
// Return value of isEnabled from localized version, so categories could be disabled depending on locale
@@ -468,7 +467,7 @@
* Returns the name of the <b>preferred</b> category along with its default ancestors.
* Equivalent to #getQualifiedName(String,boolean) if this Category is not a synonym.
* Synonym name is appended in parentheses.
- *
+ *
* @param delimiter string to separate category names
* @param includeRoot should root category be shown
* @return category path
@@ -529,7 +528,7 @@
*/
public void setName(String name, String locale) {
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
m_categoryLocalizationCollection.getCategoryLocalization().setName(
name);
@@ -558,7 +557,7 @@
// Test for localized version
// HACK
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
// Return value of isEnabled from localized version, so categories could be disabled depending on locale
@@ -603,7 +602,7 @@
*/
public void setDescription(String description, String locale) {
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
m_categoryLocalizationCollection.getCategoryLocalization().
setDescription(description);
@@ -631,7 +630,7 @@
public String getURL(String locale) {
// Test for localized version
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
// Return value of isEnabled from localized version, so categories could be disabled depending on locale
@@ -664,7 +663,7 @@
*/
public void setURL(String url, String locale) {
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
m_categoryLocalizationCollection.getCategoryLocalization().setURL(
url);
@@ -693,19 +692,19 @@
* 2. If not, check if localized version exists
* 2.1 If so, return isEnabled from localized version
* 2.2 If not, return Category.getConfig().getShowInternalName()
- *
+ *
*/
public boolean isEnabled(String locale) {
- // If locale == "" return global status
+ // If locale is empty return global status
// or if globally disabled, return category as disabled
- if (locale == "" || ((Boolean) get(IS_ENABLED)).booleanValue() == false) {
+ if (locale.isEmpty() || ((Boolean) get(IS_ENABLED)).booleanValue() == false) {
return ((Boolean) get(IS_ENABLED)).booleanValue();
}
// Test for localized version
// HACK
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
// Return value of isEnabled from localized version, so categories could be disabled depending on locale
@@ -742,7 +741,7 @@
*/
public void setEnabled(boolean isEnabled, String locale) {
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
m_categoryLocalizationCollection.getCategoryLocalization().
setEnabled(isEnabled);
@@ -757,7 +756,7 @@
* <code>false</false> otherwise.
*/
public void setEnabled(boolean isEnabled) {
- set(IS_ENABLED, new Boolean(isEnabled));
+ set(IS_ENABLED, isEnabled);
}
/**
@@ -777,7 +776,7 @@
* @see #isAbstract()
*/
public void setAbstract(boolean isAbstract) {
- set(IS_ABSTRACT, new Boolean(isAbstract));
+ set(IS_ABSTRACT, isAbstract);
}
/**
@@ -799,7 +798,7 @@
* <code>false</code> otherwise
*/
public void setIgnoreParentIndexItem(boolean ignoreParentIndexItem) {
- set(IGNORE_PARENT_INDEX_ITEM, new Boolean(ignoreParentIndexItem));
+ set(IGNORE_PARENT_INDEX_ITEM, ignoreParentIndexItem);
}
/**
@@ -851,6 +850,7 @@
/**
* @see com.arsdigita.domain.DomainObject#beforeSave()
*/
+ @Override
protected void beforeSave() {
super.beforeSave();
if (get(DEFAULT_ANCESTORS) == null) {
@@ -861,6 +861,7 @@
/**
* Placed a hook for a CategoryListener trigger.
*/
+ @Override
protected void beforeDelete() {
Categorization.triggerDeletionEvent(this);
super.beforeDelete();
@@ -890,6 +891,7 @@
* must call {@link #deleteCategoryAndOrphan()}, {@link
* #deleteCategorySubtree()}, or {@link #deleteCategoryAndRemap()}.
*/
+ @Override
public void delete() {
// see if the only "children" are non-default
DataAssociationCursor children = getRelatedCategories(CHILD);
@@ -1081,9 +1083,9 @@
}
/**
- * Add a preferred category, which marks the current category as a synonym.
+ * Add a preferred category, which marks the current category as a synonym.
* When a synonym category is selected, preferred category should be used instead
- * i.e. assigned to the item.
+ * i.e. assigned to the item.
*/
public void addPreferredCategory(Category preferred) {
addMapping(preferred, PREFERRED);
@@ -1206,7 +1208,7 @@
category.setDefaultAncestors(null);
}
} catch (CategoryNotFoundException e) {
- ;// leave the context alone and thus we want to do nothing
+ // leave the context alone and thus we want to do nothing
}
remove(RELATED, category);
Categorization.triggerRemoveChildEvent(this, category);
@@ -1560,7 +1562,7 @@
int count = 0;
while (cursor.next()) {
DataObject link = cursor.getLink();
- link.set(SORT_KEY, new Integer(count));
+ link.set(SORT_KEY, new BigDecimal(count));
count++;
}
}
@@ -1601,8 +1603,8 @@
DataObject link1 = null;
DataObject link2 = null;
- BigDecimal key1 = null;
- BigDecimal key2 = null;
+ BigDecimal key1;
+ BigDecimal key2;
DataAssociationCursor cursor =
((DataAssociation) get(CHILD_OBJECTS)).cursor();
@@ -1729,8 +1731,8 @@
return pathExtension;
}
- StringBuffer sb =
- new StringBuffer(path.length() + pathExtension.length() + 1);
+ StringBuilder sb =
+ new StringBuilder(path.length() + pathExtension.length() + 1);
sb.append(path).append(".").append(pathExtension);
return sb.toString();
}
@@ -1855,7 +1857,7 @@
}
StringTokenizer st = new StringTokenizer(path, delim);
- StringBuffer subpath = new StringBuffer();
+ StringBuilder subpath = new StringBuilder();
while (st.hasMoreTokens()) {
subpath.append(st.nextToken()).append(delim);
@@ -1890,7 +1892,7 @@
}
private static String appendID(String path) {
- StringBuffer sb = new StringBuffer(path.length() + 3);
+ StringBuilder sb = new StringBuilder(path.length() + 3);
sb.append(path).append(".").append(ID);
return sb.toString();
}
@@ -1969,8 +1971,9 @@
}
}
+ @Override
public String toString() {
- StringBuffer result = new StringBuffer(128);
+ StringBuilder result = new StringBuilder(128);
result.append("name=").append(getName()).append("; ");
result.append("oid=").append(getOID());
return result.toString();
@@ -2213,7 +2216,7 @@
String url) {
// If locale don't exist
- if (locale != "" && m_categoryLocalizationCollection != null && !m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && !m_categoryLocalizationCollection.
localizationExists(locale)) {
// Get DataAssociation
@@ -2241,7 +2244,7 @@
public boolean delLanguage(String locale) {
// If locale exist
- if (locale != "" && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
+ if (!locale.isEmpty() && m_categoryLocalizationCollection != null && m_categoryLocalizationCollection.
localizationExists(locale)) {
// Get DataAssociation
Modified: trunk/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategoryForm.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategoryForm.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-core/src/com/arsdigita/categorization/ui/ACSObjectCategoryForm.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -45,22 +45,22 @@
/**
* abstract form for assigning categories to acs_objects. The assigned
- * categories are those specified by the category widget, which is
- * retrieved by the concrete subclass' implementation of getCategoryWidget.
- *
- * The category widget may be an implementation of CategoryWidget, which
- * generates a javascript tree of categories. Implementations need only
+ * categories are those specified by the category widget, which is
+ * retrieved by the concrete subclass' implementation of getCategoryWidget.
+ *
+ * The category widget may be an implementation of CategoryWidget, which
+ * generates a javascript tree of categories. Implementations need only
* specify an XML prefix and namespace.
- *
+ *
* The object that is to be assigned to the categories is specified
* by the concrete subclass' implentation of getObject
- *
+ *
* @author chr...@we...
*
- *
+ *
*/
// this class has been abstracted out from the original cms specific category form
-// in ccm-cms
+// in ccm-cms
public abstract class ACSObjectCategoryForm extends Form {
private Widget m_category;
@@ -111,10 +111,10 @@
ACSObject object = getObject(state);
- HashSet curSelectesdCat = new HashSet();
+ HashSet curSelectedCat = new HashSet();
CategoryCollection cats = new CategorizedObject(object).getParents();
while (cats.next()) {
- curSelectesdCat.add(cats.getCategory().getID());
+ curSelectedCat.add(cats.getCategory().getID());
}
BigDecimal[] ids = (BigDecimal[]) m_category.getValue(state);
@@ -123,7 +123,7 @@
new OID(Category.BASE_DATA_OBJECT_TYPE,
ids[i]));
- if(!curSelectesdCat.contains(ids[i])) {
+ if(!curSelectedCat.contains(ids[i])) {
cat.addChild(object);
} else {
cat.removeChild(object);
Modified: trunk/ccm-core/src/com/arsdigita/packaging/Upgrade.java
===================================================================
--- trunk/ccm-core/src/com/arsdigita/packaging/Upgrade.java 2012-12-16 09:09:00 UTC (rev 2370)
+++ trunk/ccm-core/src/com/arsdigita/packaging/Upgrade.java 2012-12-16 09:14:07 UTC (rev 2371)
@@ -55,33 +55,18 @@
private static final Logger logger = Logger.getLogger(Upgrade.class);
private static final Options s_options = getOptions();
-
private String m_from;
private String m_to;
private final List m_scripts;
static {
logger.debug("Static initalizer starting...");
- s_options.addOption
- (OptionBuilder
- .isRequired()
- .hasArg()
- .withLongOpt("from-version")
- .withDescription("Upgrade from version VERSION")
- .create());
- s_options.addOption
- (OptionBuilder
- .isRequired()
- .hasArg()
- .withLongOpt("to-version")
- .withDescription("Upgrade to version VERSION")
- .create());
- s_options.addOption
- (OptionBuilder
- .hasArg()
- .withLongOpt("parameters")
- .withDescription("Parameters to pass to upgrade scripts")
- .create());
+ s_options.addOption(OptionBuilder.isRequired().hasArg().withLongOpt("from-version").withDescription(
+ "Upgrade from version VERSION").create());
+ s_options.addOption(OptionBuilder.isRequired().hasArg().withLongOpt("to-version").withDescription(
+ "Upgrade to version VERSION").create());
+ s_options.addOption(OptionBuilder.hasArg().withLongOpt("parameters").withDescription(
+ "Parameters to pass to upgrade scripts").create());
logger.debug("Static initalizer finished.");
}
@@ -147,8 +132,7 @@
final String spec = key + ".upgrade";
- final InputStream in = Thread.currentThread().getContextClassLoader
- ().getResourceAsStream(spec);
+ final InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(spec);
if (in == null) {
System.err.println("Cannot find " + spec);
@@ -158,18 +142,19 @@
XML.parse(in, new Parser());
if (m_scripts.isEmpty()) {
- System.err.println("No appropriate upgrades found; make sure " +
- "that your 'to' and 'from' versions match " +
- "the intended upgrade exactly");
+ System.err.println("No appropriate upgrades found; make sure " + "that your 'to' and 'from' versions match "
+ + "the intended upgrade exactly");
return false;
} else {
- System.out.println("Number of scripts: " + m_scripts.size() );
+ System.out.println("Number of scripts: " + m_scripts.size());
}
- Iterator iter = m_scripts.iterator();
- while (iter.hasNext()) {
+ //Iterator iter = m_scripts.iterator();
+ //while (iter.hasNext()) {
+ for (int k = 0; k < m_scripts.size(); k++) {
- final String[] parts = (String[]) iter.next();
+ System.out.printf("Running script %d/%d\n", (k + 1), m_scripts.size());
+ final String[] parts = (String[]) m_scripts.get(k); //(String[]) iter.next();
final String classname = parts[0];
final String sql = parts[1];
@@ -183,7 +168,7 @@
try {
method = clacc.getMethod("main",
- new Class[] {String[].class});
+ new Class[]{String[].class});
} catch (NoSuchMethodException nsme) {
throw new UncheckedWrapperException(nsme);
} catch (SecurityException se) {
@@ -194,7 +179,7 @@
LinkedList ll = new LinkedList();
if (params != null) {
for (int i = 0; i < params.length; i++) {
- String[] split = StringUtils.split(params[i],',');
+ String[] split = StringUtils.split(params[i], ',');
for (int j = 0; j < split.length; j++) {
ll.add(split[j]);
}
@@ -202,7 +187,7 @@
}
try {
- method.invoke(null, new Object[] {ll.toArray(new String[] {})});
+ method.invoke(null, new Object[]{ll.toArray(new String[]{})});
} catch (IllegalAccessException iae) {
throw new UncheckedWrapperException(iae);
} catch (InvocationTargetException ite) {
@@ -212,11 +197,9 @@
} else if (sql != null) {
final SchemaLoader loader = new SchemaLoader(sql);
- System.out.println("Running SQL upgrade " + loader + ", " +
- "loaded from the classpath");
+ System.out.println("Running SQL upgrade " + loader + ", " + "loaded from the classpath");
- final Connection conn = Connections.acquire
- (RuntimeConfig.getConfig().getJDBCURL());
+ final Connection conn = Connections.acquire(RuntimeConfig.getConfig().getJDBCURL());
loader.run(conn);
@@ -235,9 +218,10 @@
}
/**
- *
+ *
*/
private class Parser extends DefaultHandler {
+
private String m_version;
@Override
@@ -265,14 +249,12 @@
final String sql = attrs.getValue(uri, "sql");
if (classname == null && sql == null
- || classname != null && sql != null) {
- throw new IllegalArgumentException
- ("The script element must have a 'class' " +
- "argument or a 'sql' argument; it may not " +
- "have both");
+ || classname != null && sql != null) {
+ throw new IllegalArgumentException("The script element must have a 'class' "
+ + "argument or a 'sql' argument; it may not " + "have both");
}
- m_scripts.add(new String[] {classname, sql});
+ m_scripts.add(new String[]{classname, sql});
}
}
}
@@ -285,5 +267,6 @@
m_version = null;
}
}
+
}
}
|
|
From: <pb...@fe...> - 2012-12-16 09:09:11
|
Author: pboy
Date: 2012-12-16 09:09:00 +0000 (Sun, 16 Dec 2012)
New Revision: 2370
Added:
trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
Log:
Fixed update script.
Added: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java
===================================================================
--- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java (rev 0)
+++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/upgrades/Upgrade664to665.java 2012-12-16 09:09:00 UTC (rev 2370)
@@ -0,0 +1,40 @@
+package com.arsdigita.cms.contenttypes.upgrades;
+
+import com.arsdigita.cms.contenttypes.XMLContentTypeHandler;
+import com.arsdigita.util.cmd.Program;
+import com.arsdigita.xml.XML;
+import org.apache.commons.cli.CommandLine;
+
+/**
+ *
+ * @author Jens Pelzetter <je...@jp...>
+ * @version $Id$
+ */
+public class Upgrade664to665 extends Program {
+
+ public Upgrade664to665() {
+ super("Upgrade664to665", "1.0.0", "", true, true);
+ }
+
+ @Override
+ protected void doRun(CommandLine cmdLine) {
+ new CreateContactBundles().doUpgrade();
+ new CreateOrgaUnitBundles().doUpgrade();
+ new CreatePersonBundles().doUpgrade();
+ new GenericContactGenericPersonAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericContactAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericOrgaUnitAssocUpgrade().doUpgrade();
+ new GenericOrgaUnitGenericPersonAssocUpgrade().doUpgrade();
+
+ //Reload authoring steps
+ XMLContentTypeHandler handler = new XMLContentTypeHandler();
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericContact.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericOrganizationalUnit.xml", handler);
+ XML.parseResource("/WEB-INF/content-types/com/arsdigita/cms/contenttypes/GenericPerson.xml", handler);
+ }
+
+ public static void main(final String[] args) {
+ new Upgrade664to665().run(args);
+ }
+
+}
|
|
From: <pb...@fe...> - 2012-12-12 18:13:41
|
Author: pboy Date: 2012-12-12 18:13:29 +0000 (Wed, 12 Dec 2012) New Revision: 2369 Removed: contrib/camden/ccm-ldn-camden-wordxml/trunk/ Log: Code reorganized according to directory structure convention (part 2). |
|
From: <pb...@fe...> - 2012-12-12 18:12:29
|
Author: pboy Date: 2012-12-12 18:12:15 +0000 (Wed, 12 Dec 2012) New Revision: 2368 Added: contrib/camden/ccm-ldn-camden-wordxml/application.xml contrib/camden/ccm-ldn-camden-wordxml/pdl/ contrib/camden/ccm-ldn-camden-wordxml/sql/ contrib/camden/ccm-ldn-camden-wordxml/src/ contrib/camden/ccm-ldn-camden-wordxml/web/ Removed: contrib/camden/ccm-ldn-camden-wordxml/trunk/application.xml contrib/camden/ccm-ldn-camden-wordxml/trunk/pdl/ contrib/camden/ccm-ldn-camden-wordxml/trunk/sql/ contrib/camden/ccm-ldn-camden-wordxml/trunk/src/ contrib/camden/ccm-ldn-camden-wordxml/trunk/web/ Log: Code reorganized according to directory structure convention. Copied: contrib/camden/ccm-ldn-camden-wordxml/application.xml (from rev 2359, contrib/camden/ccm-ldn-camden-wordxml/trunk/application.xml) =================================================================== --- contrib/camden/ccm-ldn-camden-wordxml/application.xml (rev 0) +++ contrib/camden/ccm-ldn-camden-wordxml/application.xml 2012-12-12 18:12:15 UTC (rev 2368) @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-ldn-camden-wordxml" + prettyName="Red Hat CCM Content Types" + version="1.0.0" + release="1" + webapp="ROOT"> + <ccm:dependencies> + <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> + <ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/> + <ccm:requires name="ccm-ldn-aplaws" version="1.9.1" relation="ge"/> + <ccm:requires name="ccm-ldn-navigation" version="1.4.4" relation="ge"/> + <ccm:requires name="ccm-ldn-util" version="1.4.1" relation="ge"/> + <ccm:requires name="ccm-ldn-rss" version="1.4.2" relation="ge"/> + </ccm:dependencies> + <ccm:directories> + <ccm:directory name="pdl"/> + <ccm:directory name="sql"/> + <ccm:directory name="src"/> + </ccm:directories> + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + The Camden WordXML Content Type for the Red Hat CCM CMS. + </ccm:description> +</ccm:application> Deleted: contrib/camden/ccm-ldn-camden-wordxml/trunk/application.xml =================================================================== --- contrib/camden/ccm-ldn-camden-wordxml/trunk/application.xml 2012-12-12 18:04:45 UTC (rev 2367) +++ contrib/camden/ccm-ldn-camden-wordxml/trunk/application.xml 2012-12-12 18:12:15 UTC (rev 2368) @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" - name="ccm-ldn-camden-wordxml" - prettyName="Red Hat CCM Content Types" - version="1.0.0" - release="1" - webapp="ROOT"> - <ccm:dependencies> - <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> - <ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/> - <ccm:requires name="ccm-ldn-aplaws" version="1.9.1" relation="ge"/> - <ccm:requires name="ccm-ldn-navigation" version="1.4.4" relation="ge"/> - <ccm:requires name="ccm-ldn-util" version="1.4.1" relation="ge"/> - <ccm:requires name="ccm-ldn-rss" version="1.4.2" relation="ge"/> - </ccm:dependencies> - <ccm:directories> - <ccm:directory name="pdl"/> - <ccm:directory name="sql"/> - <ccm:directory name="src"/> - </ccm:directories> - <ccm:contacts> - <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> - <ccm:contact uri="mailto:rh...@re..." type="support"/> - </ccm:contacts> - <ccm:description> - The Camden WordXML Content Type for the Red Hat CCM CMS. - </ccm:description> -</ccm:application> |
|
From: <pb...@fe...> - 2012-12-12 18:04:57
|
Author: pboy Date: 2012-12-12 18:04:45 +0000 (Wed, 12 Dec 2012) New Revision: 2367 Removed: contrib/camden/ccm-ldn-camden-foi/trunk/ Log: Code reorganized according to directory structure convention (part 2). |
|
From: <pb...@fe...> - 2012-12-12 18:02:59
|
Author: pboy Date: 2012-12-12 18:02:47 +0000 (Wed, 12 Dec 2012) New Revision: 2366 Added: contrib/camden/ccm-ldn-camden-foi/application.xml contrib/camden/ccm-ldn-camden-foi/pdl/ contrib/camden/ccm-ldn-camden-foi/sql/ contrib/camden/ccm-ldn-camden-foi/src/ contrib/camden/ccm-ldn-camden-foi/web/ Removed: contrib/camden/ccm-ldn-camden-foi/trunk/application.xml contrib/camden/ccm-ldn-camden-foi/trunk/pdl/ contrib/camden/ccm-ldn-camden-foi/trunk/sql/ contrib/camden/ccm-ldn-camden-foi/trunk/src/ contrib/camden/ccm-ldn-camden-foi/trunk/web/ Log: Code reorganized according to directory structure convention. Copied: contrib/camden/ccm-ldn-camden-foi/application.xml (from rev 2359, contrib/camden/ccm-ldn-camden-foi/trunk/application.xml) =================================================================== --- contrib/camden/ccm-ldn-camden-foi/application.xml (rev 0) +++ contrib/camden/ccm-ldn-camden-foi/application.xml 2012-12-12 18:02:47 UTC (rev 2366) @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-ldn-camden-foi" + prettyName="Red Hat CCM Content Types" + version="1.0.4" + release="1" + webapp="ROOT"> + <ccm:dependencies> + <ccm:requires name="ccm-core" version="6.3.3" relation="ge"/> + <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> + <ccm:requires name="ccm-ldn-aplaws" version="1.9.1" relation="ge"/> + <ccm:requires name="ccm-ldn-navigation" version="1.4.4" relation="ge"/> + <ccm:requires name="ccm-ldn-util" version="1.4.1" relation="ge"/> + <ccm:requires name="ccm-ldn-rss" version="1.4.2" relation="ge"/> + </ccm:dependencies> + <ccm:directories> + <ccm:directory name="pdl"/> + <ccm:directory name="sql"/> + <ccm:directory name="src"/> + </ccm:directories> + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + The Camden FOI Content Type for the Red Hat CCM CMS. + </ccm:description> +</ccm:application> Deleted: contrib/camden/ccm-ldn-camden-foi/trunk/application.xml =================================================================== --- contrib/camden/ccm-ldn-camden-foi/trunk/application.xml 2012-12-12 18:00:48 UTC (rev 2365) +++ contrib/camden/ccm-ldn-camden-foi/trunk/application.xml 2012-12-12 18:02:47 UTC (rev 2366) @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" - name="ccm-ldn-camden-foi" - prettyName="Red Hat CCM Content Types" - version="1.0.4" - release="1" - webapp="ROOT"> - <ccm:dependencies> - <ccm:requires name="ccm-core" version="6.3.3" relation="ge"/> - <ccm:requires name="ccm-cms" version="6.2.0" relation="ge"/> - <ccm:requires name="ccm-ldn-aplaws" version="1.9.1" relation="ge"/> - <ccm:requires name="ccm-ldn-navigation" version="1.4.4" relation="ge"/> - <ccm:requires name="ccm-ldn-util" version="1.4.1" relation="ge"/> - <ccm:requires name="ccm-ldn-rss" version="1.4.2" relation="ge"/> - </ccm:dependencies> - <ccm:directories> - <ccm:directory name="pdl"/> - <ccm:directory name="sql"/> - <ccm:directory name="src"/> - </ccm:directories> - <ccm:contacts> - <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> - <ccm:contact uri="mailto:rh...@re..." type="support"/> - </ccm:contacts> - <ccm:description> - The Camden FOI Content Type for the Red Hat CCM CMS. - </ccm:description> -</ccm:application> |
|
From: <pb...@fe...> - 2012-12-12 18:01:00
|
Author: pboy Date: 2012-12-12 18:00:48 +0000 (Wed, 12 Dec 2012) New Revision: 2365 Removed: contrib/camden/ccm-ldn-camden-eforms/trunk/ Log: Code reorganized according to directory structure convention (part 2). |
|
From: <pb...@fe...> - 2012-12-12 18:00:09
|
Author: pboy Date: 2012-12-12 17:59:56 +0000 (Wed, 12 Dec 2012) New Revision: 2364 Added: contrib/camden/ccm-ldn-camden-eforms/application.xml contrib/camden/ccm-ldn-camden-eforms/pdl/ contrib/camden/ccm-ldn-camden-eforms/sql/ contrib/camden/ccm-ldn-camden-eforms/src/ Removed: contrib/camden/ccm-ldn-camden-eforms/trunk/application.xml contrib/camden/ccm-ldn-camden-eforms/trunk/pdl/ contrib/camden/ccm-ldn-camden-eforms/trunk/sql/ contrib/camden/ccm-ldn-camden-eforms/trunk/src/ Log: Code reorganized according to directory structure convention. Copied: contrib/camden/ccm-ldn-camden-eforms/application.xml (from rev 2359, contrib/camden/ccm-ldn-camden-eforms/trunk/application.xml) =================================================================== --- contrib/camden/ccm-ldn-camden-eforms/application.xml (rev 0) +++ contrib/camden/ccm-ldn-camden-eforms/application.xml 2012-12-12 17:59:56 UTC (rev 2364) @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" + name="ccm-ldn-camden-eforms" + prettyName="Camden eForms Content Type" + version="1.0.1" + release="1" + webapp="ROOT"> + <ccm:dependencies> + <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> + <ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/> + </ccm:dependencies> + <ccm:directories> + <ccm:directory name="pdl"/> + <ccm:directory name="sql"/> + <ccm:directory name="src"/> + </ccm:directories> + <ccm:contacts> + <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> + <ccm:contact uri="mailto:rh...@re..." type="support"/> + </ccm:contacts> + <ccm:description> + The Camden eForms Content Type for the APLAWS+ CMS. + </ccm:description> +</ccm:application> Deleted: contrib/camden/ccm-ldn-camden-eforms/trunk/application.xml =================================================================== --- contrib/camden/ccm-ldn-camden-eforms/trunk/application.xml 2012-12-12 17:55:33 UTC (rev 2363) +++ contrib/camden/ccm-ldn-camden-eforms/trunk/application.xml 2012-12-12 17:59:56 UTC (rev 2364) @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project" - name="ccm-ldn-camden-eforms" - prettyName="Camden eForms Content Type" - version="1.0.1" - release="1" - webapp="ROOT"> - <ccm:dependencies> - <ccm:requires name="ccm-core" version="6.1.1" relation="ge"/> - <ccm:requires name="ccm-cms" version="6.1.1" relation="ge"/> - </ccm:dependencies> - <ccm:directories> - <ccm:directory name="pdl"/> - <ccm:directory name="sql"/> - <ccm:directory name="src"/> - </ccm:directories> - <ccm:contacts> - <ccm:contact uri="http://www.redhat.com/software/rhea" type="website"/> - <ccm:contact uri="mailto:rh...@re..." type="support"/> - </ccm:contacts> - <ccm:description> - The Camden eForms Content Type for the APLAWS+ CMS. - </ccm:description> -</ccm:application> |
|
From: <pb...@fe...> - 2012-12-12 17:55:44
|
Author: pboy Date: 2012-12-12 17:55:33 +0000 (Wed, 12 Dec 2012) New Revision: 2363 Removed: contrib/camden/ccm-ldn-camden-consultation/trunk/ Log: Code reorganized according to directory structure convention (part 2). |