Author: pboy Date: 2012-12-01 15:22:13 +0000 (Sat, 01 Dec 2012) New Revision: 2331 Modified: trunk/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl trunk/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java trunk/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java trunk/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java trunk/ccm-navigation/src/com/arsdigita/navigation/Loader.java trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java Log: (a) Another try to improve checking for unique URL. Various PropertyForms use in their validate(FormSectionEvent)-method not super.validate(FormSectionEvent). Because of this BasicPageForm.validate() will not be executed. This problem may exist in another content types, probably all classes derived from BasicPageForm have to be checked. (b) Improved error message in ccm-navigation, if template directory can not be found. Modified: trunk/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl =================================================================== --- trunk/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl 2012-12-01 15:22:13 UTC (rev 2331) @@ -22,5 +22,5 @@ // In contrast to other applications atoz_app is needed here and used in // associations, e.g. AtoZProvider. object type AtoZ extends Application { - reference key (atoz_app.application_id); + reference key (atoz_app.application_id); } Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -72,7 +72,7 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ 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-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -31,6 +31,7 @@ import com.arsdigita.bebop.parameters.ParameterData; import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.cms.ContentBundle; +import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.Folder; @@ -43,12 +44,12 @@ import java.util.Date; /** - * A form for editing subclasses of ContentPage. This is just a convenience - * class. + * A form for editing subclasses of ContentPage. This is just a convenience class. * * @author Stanislav Freidin (st...@ar...) * @version $Revision: #22 $ $DateTime: 2004/08/17 23:15:09 $ - **/ + * + */ public abstract class BasicPageForm extends BasicItemForm { private FormSection m_widgetSection; @@ -59,8 +60,7 @@ * Construct a new BasicPageForm * * @param formName the name of this form - * @param itemModel The {@link ItemSelectionModel} which will - * be responsible for loading the current item + * @param itemModel The {@link ItemSelectionModel} which will be responsible for loading the current item */ public BasicPageForm(String formName, ItemSelectionModel itemModel) { super(formName, itemModel); @@ -71,8 +71,7 @@ * * @param formName the name of this form * @param columnPanel the columnpanel of the form - * @param itemModel The {@link ItemSelectionModel} which will - * be responsible for loading the current item + * @param itemModel The {@link ItemSelectionModel} which will be responsible for loading the current item */ public BasicPageForm(String formName, ColumnPanel columnPanel, @@ -81,8 +80,8 @@ } /** - * Add various widgets to the form. Child classes should override - * this method to perform all their widget-adding needs + * Add various widgets to the form. Child classes should override this method to perform all their widget-adding + * needs */ @Override protected void addWidgets() { @@ -109,13 +108,10 @@ } /** - * Utility method to initialize the name/title widgets. Child classes - * may call this method from the init listener + * Utility method to initialize the name/title widgets. Child classes may call this method from the init listener * - * @param e the {@link FormSectionEvent} which was passed to the - * init listener - * @return the ContentPage instance which was extracted from the - * ItemSelectionModel + * @param e the {@link FormSectionEvent} which was passed to the init listener + * @return the ContentPage instance which was extracted from the ItemSelectionModel */ public ContentPage initBasicWidgets(FormSectionEvent e) { Assert.exists(getItemSelectionModel()); @@ -143,9 +139,10 @@ return item; } - /*@Override + @Override public void validate(final FormSectionEvent fse) throws FormProcessException { - ACSObject parent = getItemSelectionModel().getSelectedItem(fse.getPageState()).getParent(); + final ContentItem item = getItemSelectionModel().getSelectedItem(fse.getPageState()); + ACSObject parent = item.getParent(); if (parent instanceof ContentBundle) { @@ -154,16 +151,18 @@ if (parent instanceof Folder) { final Folder folder = (Folder) parent; Assert.exists(folder); - validateNameUniqueness(folder, fse); + final FormData data = fse.getFormData(); + final String name = data.getString(NAME); + if (!item.getName().equals(name)) { + validateNameUniqueness(folder, fse); + } } - }*/ + } /** - * Utility method to process the name/title widgets. Child classes - * may call this method from the process listener. + * Utility method to process the name/title widgets. Child classes may call this method from the process listener. * - * @param e the {@link FormSectionEvent} which was passed to the - * process listener + * @param e the {@link FormSectionEvent} which was passed to the process listener */ public ContentPage processBasicWidgets(FormSectionEvent e) { Assert.exists(getItemSelectionModel()); @@ -187,15 +186,11 @@ } /** - * A utility method that will create a new item and tell the selection - * model to select the new item. Creation components may call this method - * in the process listener of their form. See {@link PageCreate} for - * an example. + * A utility method that will create a new item and tell the selection model to select the new item. Creation + * components may call this method in the process listener of their form. See {@link PageCreate} for an example. * * @param state the current page state - * @return the new content item (or a proper subclass thereof) - * @pre state != null - * @post return != null + * @return the new content item (or a proper subclass thereof) @pre state != null @post return != null */ public ContentPage createContentPage(PageState state) throws FormProcessException { @@ -220,7 +215,8 @@ } /** - * Constructs a new <code>LaunchDateValidationListener</code>. + * Constructs a new + * <code>LaunchDateValidationListener</code>. */ public class LaunchDateValidationListener implements ParameterListener { @@ -235,6 +231,5 @@ return; } } - } } Modified: trunk/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java =================================================================== --- trunk/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -96,7 +96,7 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ Modified: trunk/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java =================================================================== --- trunk/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -242,6 +242,8 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { + super.validate(e); + FormData d = e.getFormData(); java.util.Date startDate = d.getDate(START_DATE); java.util.Date endDate = d.getDate(END_DATE); Modified: trunk/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java =================================================================== --- trunk/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -94,7 +94,7 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ Modified: trunk/ccm-navigation/src/com/arsdigita/navigation/Loader.java =================================================================== --- trunk/ccm-navigation/src/com/arsdigita/navigation/Loader.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-navigation/src/com/arsdigita/navigation/Loader.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -182,6 +182,9 @@ String templatesFile = (String)get(m_templatesFile); InputStream file = Thread.currentThread().getContextClassLoader() .getResourceAsStream(templatesFile); + if (file == null) { + throw new UncheckedWrapperException(String.format("Failed to open templates files %s.", templatesFile)); + } BufferedReader templates = new BufferedReader( new InputStreamReader( file ) ); Modified: trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java =================================================================== --- trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java 2012-12-01 09:32:20 UTC (rev 2330) +++ trunk/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java 2012-12-01 15:22:13 UTC (rev 2331) @@ -104,8 +104,9 @@ } + @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ |