PublicPersonalProfile: Konfiguration wird jetzt eingelesen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1025 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
cd321662c6
commit
f32d96ce69
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<registry>
|
||||
<!--
|
||||
<config class="com.arsdigita.cms.contenttypes.SciPublicPersonalProfileConfig"
|
||||
storage="ccm-sci-publicpersonalprofile.properties"/>
|
||||
-->
|
||||
<config class="com.arsdigita.cms.contenttypes.SciPublicPersonalProfileConfig"
|
||||
storage="ccm-sci-publicpersonalprofile/profile.properties"/>
|
||||
</registry>
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.person_type.format = [string]
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue