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 |