From f32d96ce692ed450ec543a0108850d482d7a8638 Mon Sep 17 00:00:00 2001 From: jensp Date: Wed, 20 Jul 2011 07:31:20 +0000 Subject: [PATCH] PublicPersonalProfile: Konfiguration wird jetzt eingelesen git-svn-id: https://svn.libreccm.org/ccm/trunk@1025 8810af33-2d31-482b-a856-94f89814c4df --- .../com/arsdigita/runtime/ConfigRegistry.java | 6 ++++- .../src/ccm-sci-publicpersonalprofile.config | 6 ++--- .../SciPublicPersonalProfileConfig.java | 2 +- ...PersonalProfileConfig_parameter.properties | 2 +- .../ui/SciPublicPersonalProfileCreate.java | 27 ++++++++++--------- ...ublicPersonalProfileNavigationAddForm.java | 8 ------ 6 files changed, 23 insertions(+), 28 deletions(-) diff --git a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java index 9919f278a..f6b645382 100755 --- a/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java +++ b/ccm-core/src/com/arsdigita/runtime/ConfigRegistry.java @@ -309,8 +309,10 @@ public class ConfigRegistry { private Properties getProperties(ClassLoader ldr, String resource) { Properties props = new Properties(); + s_log.error(String.format(">>>Trying to get properties from '%s'...", resource)); InputStream is = ldr.getResourceAsStream(resource); if (is != null) { + s_log.error(">>>Create input stream successfully, resource exists..."); try { props.load(is); } catch (IOException e) { @@ -322,7 +324,9 @@ public class ConfigRegistry { throw new UncheckedWrapperException(e); } } - } + } else { + s_log.error(">>>Resource does not exist."); + } return props; } diff --git a/ccm-sci-publicpersonalprofile/src/ccm-sci-publicpersonalprofile.config b/ccm-sci-publicpersonalprofile/src/ccm-sci-publicpersonalprofile.config index a99e7b248..beaacb957 100644 --- a/ccm-sci-publicpersonalprofile/src/ccm-sci-publicpersonalprofile.config +++ b/ccm-sci-publicpersonalprofile/src/ccm-sci-publicpersonalprofile.config @@ -1,7 +1,5 @@ - + diff --git a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig.java b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig.java index d9a67d585..d3b9cd451 100644 --- a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig.java +++ b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig.java @@ -21,7 +21,7 @@ public class SciPublicPersonalProfileConfig extends AbstractConfig { "com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts", Parameter.REQUIRED, Boolean.FALSE); - personType = new StringParameter("com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_class", + personType = new StringParameter("com.arsdigita.cms.contenttypes.PublicPersonalProfile.person_type", Parameter.REQUIRED, "com.arsdigita.cms.contenttypes.GenericPerson"); diff --git a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig_parameter.properties b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig_parameter.properties index d07875087..1597c6048 100644 --- a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig_parameter.properties +++ b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/SciPublicPersonalProfileConfig_parameter.properties @@ -6,4 +6,4 @@ com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts.fo com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.title = Class to restrict the selectable persons to. com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.purpose = Class to restrict the selectable persons to. com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.example = com.arsdigita.cms.contenttypes.GenericPerson -com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.format = [String] \ No newline at end of file +com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.format = [string] \ No newline at end of file diff --git a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileCreate.java b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileCreate.java index 4d507a929..4828abb15 100644 --- a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileCreate.java +++ b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileCreate.java @@ -20,7 +20,6 @@ import com.arsdigita.cms.ContentTypeCollection; import com.arsdigita.cms.Folder; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.GenericPerson; -import com.arsdigita.cms.contenttypes.SciMember; import com.arsdigita.cms.contenttypes.SciPublicPersonalProfile; import com.arsdigita.cms.contenttypes.SciPublicPersonalProfileConfig; import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection; @@ -46,6 +45,10 @@ public class SciPublicPersonalProfileCreate extends PageCreate { private static final SciPublicPersonalProfileConfig config = new SciPublicPersonalProfileConfig(); + static { + config.load(); + } + public SciPublicPersonalProfileCreate(final ItemSelectionModel itemModel, final CreationSelector parent) { super(itemModel, parent); @@ -70,25 +73,23 @@ public class SciPublicPersonalProfileCreate extends PageCreate { new StringParameter(SciPublicPersonalProfile.OWNER); SingleSelect ownerSelect = new SingleSelect(ownerModel); ownerSelect.addValidationListener(new NotNullValidationListener()); - - //DataCollection persons = SessionManager.getSession().retrieve( - // SciMember.BASE_DATA_OBJECT_TYPE); + String personType = config.getPersonType(); - if ((personType == null) || (personType.isEmpty()) ) { + if ((personType == null) || (personType.isEmpty())) { personType = "com.arsdigita.cms.contenttypes.GenericPerson"; } - - ContentTypeCollection types = ContentType.getAllContentTypes(); - types.addFilter(String.format("className = '%s'", personType)); + + ContentTypeCollection types = ContentType.getAllContentTypes(); + types.addFilter(String.format("className = '%s'", personType)); if (types.size() == 0) { personType = "com.arsdigita.cms.contenttypes.GenericPerson"; - } + } DataCollection persons = SessionManager.getSession().retrieve( personType); persons.addFilter("profile is null"); while (persons.next()) { GenericPerson person = - (GenericPerson) DomainObjectFactory.newInstance(persons. + (GenericPerson) DomainObjectFactory.newInstance(persons. getDataObject()); ownerSelect.addOption(new Option(person.getID().toString(), person. getFullName())); @@ -119,12 +120,12 @@ public class SciPublicPersonalProfileCreate extends PageCreate { String id = (String) fse.getFormData().get( SciPublicPersonalProfile.OWNER); - SciMember owner = new SciMember(new BigDecimal(id)); + GenericPerson owner = new GenericPerson(new BigDecimal(id)); validateNameUniqueness(folder, fse, String.format("%s-profile", - SciMember.urlSave( + GenericPerson.urlSave( owner.getFullName()))); } @@ -142,7 +143,7 @@ public class SciPublicPersonalProfileCreate extends PageCreate { GenericPerson owner = new GenericPerson(new BigDecimal(id)); String name = String.format("%s-profile", - SciMember.urlSave(owner.getFullName())); + GenericPerson.urlSave(owner.getFullName())); String title = String.format("%s (Profil)", owner.getFullName()); final ContentPage item = createContentPage(state); diff --git a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileNavigationAddForm.java b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileNavigationAddForm.java index 740383a18..0d9a14bfc 100644 --- a/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileNavigationAddForm.java +++ b/ccm-sci-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/SciPublicPersonalProfileNavigationAddForm.java @@ -1,25 +1,17 @@ package com.arsdigita.cms.contenttypes.ui; -import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; -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.bebop.form.CheckboxGroup; import com.arsdigita.bebop.form.Option; import com.arsdigita.bebop.form.SingleSelect; 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.contenttypes.AuthorshipCollection; -import com.arsdigita.cms.contenttypes.GenericPerson; -import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.ui.ItemSearchWidget; import com.arsdigita.cms.ui.authoring.BasicItemForm; import com.arsdigita.cms.ui.authoring.SimpleEditStep;