From 6b677b606ce5cbb4c7e7359fcb1ac5f800edc579 Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 6 Jun 2012 10:47:14 +0000 Subject: [PATCH] =?UTF-8?q?-=20Neuer=20Versuch,=20Ticket=20#1261=20zu=20l?= =?UTF-8?q?=C3=B6sen=20-=20Verschiedene=20PropertyForms=20haben=20in=20ihr?= =?UTF-8?q?er=20validate(FormSectionEvent)=20Methode=20nicht=20super.valid?= =?UTF-8?q?ate(FormSectionEvent)=20=20=20aufgerufen.=20Dadurch=20wurde=20d?= =?UTF-8?q?ie=20validate(FormSectionEvent)=20Methode=20in=20BasicPageForm?= =?UTF-8?q?=20nicht=20ausgef=C3=BChrt.=20M=C3=B6glicherweise=20=20=20ist?= =?UTF-8?q?=20dieses=20Problem=20noch=20bei=20weiteren=20CTs=20vorhanden.?= =?UTF-8?q?=20Vermutlich=20m=C3=BCssen=20von=20BasicPageForm=20abgeleitete?= =?UTF-8?q?ten=20Klassen=20darauf=20=20=20untersucht=20werden,=20ob=20sie?= =?UTF-8?q?=20super.validate(FormSectionEvent)=20aufrufen,=20s.=20Ticket?= =?UTF-8?q?=20#1272.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@1687 8810af33-2d31-482b-a856-94f89814c4df --- ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl | 2 +- .../contenttypes/ui/ArticlePropertyForm.java | 2 +- .../contenttypes/ui/EventPropertyForm.java | 2 + .../contenttypes/ui/HTMLFormPropertyForm.java | 2 +- .../ui/GenericArticlePropertyForm.java | 2 +- .../cms/ui/authoring/BasicPageForm.java | 59 +++++++++---------- .../cms/contenttypes/ui/PublisherCreate.java | 6 +- .../ui/authoring/WebpagePropertiesForm.java | 3 +- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl b/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl index 0002af494..825f1c46a 100755 --- a/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl +++ b/ccm-atoz/pdl/com/arsdigita/atoz/AtoZ.pdl @@ -22,5 +22,5 @@ import com.arsdigita.web.Application; // 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); } diff --git a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java index 0ad5597d1..d5714583a 100755 --- a/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java +++ b/ccm-cms-types-article/src/com/arsdigita/cms/contenttypes/ui/ArticlePropertyForm.java @@ -96,7 +96,7 @@ public class ArticlePropertyForm extends GenericArticlePropertyForm @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ diff --git a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java index 5085db783..c1d393c7f 100755 --- a/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java +++ b/ccm-cms-types-event/src/com/arsdigita/cms/contenttypes/ui/EventPropertyForm.java @@ -242,6 +242,8 @@ public class EventPropertyForm extends BasicPageForm @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); diff --git a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java index 5a00e6285..50856c59f 100644 --- a/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java +++ b/ccm-cms-types-htmlform/src/com/arsdigita/cms/contenttypes/ui/HTMLFormPropertyForm.java @@ -94,7 +94,7 @@ public class HTMLFormPropertyForm extends BasicPageForm implements FormProcessLi @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java index 85e24b503..278a4863e 100755 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericArticlePropertyForm.java @@ -72,7 +72,7 @@ public class GenericArticlePropertyForm extends BasicPageForm @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */ diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java index a3dd23db3..0d7be0a8a 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/BasicPageForm.java @@ -31,6 +31,7 @@ import com.arsdigita.bebop.parameters.DateParameter; 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 javax.servlet.ServletException; 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 (stas@arsdigita.com) * @version $Revision: #22 $ $DateTime: 2004/08/17 23:15:09 $ - **/ + * + */ public abstract class BasicPageForm extends BasicItemForm { private FormSection m_widgetSection; @@ -59,8 +60,7 @@ public abstract class BasicPageForm extends BasicItemForm { * 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 @@ public abstract class BasicPageForm extends BasicItemForm { * * @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 @@ public abstract class BasicPageForm extends BasicItemForm { } /** - * 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 @@ public abstract class BasicPageForm extends BasicItemForm { } /** - * 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 @@ public abstract class BasicPageForm extends BasicItemForm { 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 @@ public abstract class BasicPageForm extends BasicItemForm { 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 @@ public abstract class BasicPageForm extends BasicItemForm { } /** - * 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 @@ public abstract class BasicPageForm extends BasicItemForm { } /** - * Constructs a new LaunchDateValidationListener. + * Constructs a new + * LaunchDateValidationListener. */ public class LaunchDateValidationListener implements ParameterListener { @@ -235,6 +231,5 @@ public abstract class BasicPageForm extends BasicItemForm { return; } } - } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java index 717412926..3405851c5 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublisherCreate.java @@ -67,9 +67,11 @@ public class PublisherCreate extends PageCreate { add(launchDate); } } - + @Override - public void validate(FormSectionEvent fse) throws FormProcessException { + public void validate(FormSectionEvent fse) throws FormProcessException { + //We don't call super.validate(fse); here because the name (URL fragment) of a publisher is generated in a different manner + //than the name (URL fragment) of other content items. Folder folder = m_parent.getFolder(fse.getPageState()); Assert.exists(folder); validateNameUniqueness(folder, fse, Publisher.urlSave(getFullName(fse))); diff --git a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java index 69128864c..fa5f497ea 100755 --- a/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java +++ b/ccm-webpage/src/com/arsdigita/cms/webpage/ui/authoring/WebpagePropertiesForm.java @@ -104,8 +104,9 @@ public class WebpagePropertiesForm } + @Override public void validate(FormSectionEvent e) throws FormProcessException { - FormData d = e.getFormData(); + super.validate(e); } /** Form initialisation hook. Fills widgets with data. */