PublicPersonalProfile: Typ der Person ist nun konfigurierbar.
git-svn-id: https://svn.libreccm.org/ccm/trunk@1024 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
9a21b549ea
commit
cd321662c6
|
|
@ -144,7 +144,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
|
||||
connect(m_elementAddForm, elementSelect,
|
||||
AddElement.CONTENT_ITEM_ELEMENT, itemForm);
|
||||
connect(itemForm);
|
||||
connect(itemForm);
|
||||
}
|
||||
|
||||
// XXX A temporary, low-impact fix.
|
||||
|
|
@ -175,7 +175,7 @@ final class ContentTypeItemPane extends BaseItemPane {
|
|||
group.setSubject(new ContentTypePropertyList(m_type));
|
||||
|
||||
group.addAction(new TypeSecurityContainer(editLink));
|
||||
group.addAction(new TypeSecurityContainer(deleteLink));
|
||||
group.addAction(new TypeSecurityContainer(deleteLink));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ object type SciPublicPersonalProfile extends ContentPage {
|
|||
|
||||
association {
|
||||
|
||||
SciPublicPersonalProfile[0..n] profile = join ct_sciorga_members.member_id
|
||||
SciPublicPersonalProfile[0..n] profile = join cms_persons.person_id
|
||||
to ct_sci_public_personal_profile_owner_map.owner_id,
|
||||
join ct_sci_public_personal_profile_owner_map.profile_id
|
||||
to ct_sci_public_personal_profiles.profile_id;
|
||||
|
||||
SciMember[0..n] owner = join ct_sci_public_personal_profiles.profile_id
|
||||
to ct_sci_public_personal_profile_owner_map.profile_id,
|
||||
join ct_sci_public_personal_profile_owner_map.owner_id
|
||||
to ct_sciorga_members.member_id;
|
||||
GenericPerson[0..n] owner = join ct_sci_public_personal_profiles.profile_id
|
||||
to ct_sci_public_personal_profile_owner_map.profile_id,
|
||||
join ct_sci_public_personal_profile_owner_map.owner_id
|
||||
to cms_persons.person_id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public class SciPublicPersonalProfile extends ContentPage {
|
|||
super(type);
|
||||
}
|
||||
|
||||
public SciMember getOwner() {
|
||||
public GenericPerson getOwner() {
|
||||
final DataCollection collection = (DataCollection) get(OWNER);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
|
|
@ -55,12 +55,12 @@ public class SciPublicPersonalProfile extends ContentPage {
|
|||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (SciMember) DomainObjectFactory.newInstance(dobj);
|
||||
return (GenericPerson) DomainObjectFactory.newInstance(dobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOwner(SciMember owner) {
|
||||
SciMember oldOwner;
|
||||
public void setOwner(GenericPerson owner) {
|
||||
GenericPerson oldOwner;
|
||||
|
||||
oldOwner = getOwner();
|
||||
if (oldOwner != null) {
|
||||
|
|
@ -68,7 +68,7 @@ public class SciPublicPersonalProfile extends ContentPage {
|
|||
}
|
||||
|
||||
if (null != owner) {
|
||||
Assert.exists(owner, SciMember.class);
|
||||
Assert.exists(owner, GenericPerson.class);
|
||||
add(OWNER, owner);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.arsdigita.runtime.AbstractConfig;
|
|||
import com.arsdigita.util.parameter.BooleanParameter;
|
||||
import com.arsdigita.util.parameter.StringParameter;
|
||||
import com.arsdigita.util.parameter.Parameter;
|
||||
import javax.swing.text.StyledEditorKit.BoldAction;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -14,6 +13,7 @@ import javax.swing.text.StyledEditorKit.BoldAction;
|
|||
public class SciPublicPersonalProfileConfig extends AbstractConfig {
|
||||
|
||||
private final Parameter showUnfinishedParts;
|
||||
private final Parameter personType;
|
||||
|
||||
public SciPublicPersonalProfileConfig() {
|
||||
showUnfinishedParts =
|
||||
|
|
@ -21,8 +21,12 @@ 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",
|
||||
Parameter.REQUIRED,
|
||||
"com.arsdigita.cms.contenttypes.GenericPerson");
|
||||
|
||||
register(showUnfinishedParts);
|
||||
register(personType);
|
||||
|
||||
loadInfo();
|
||||
}
|
||||
|
|
@ -30,4 +34,8 @@ public class SciPublicPersonalProfileConfig extends AbstractConfig {
|
|||
public final boolean getShowUnFinishedParts() {
|
||||
return (Boolean) get(showUnfinishedParts);
|
||||
}
|
||||
|
||||
public final String getPersonType() {
|
||||
return (String) get(personType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,3 +2,8 @@ com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts.ti
|
|||
com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts.purpose = Show parts of the SciPublicPersonalProfile which do not work yet.
|
||||
com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts.example = false
|
||||
com.arsdigita.cms.contenttypes.SciPublicPersonalProfile.show_unfinished_parts.format = [boolean]
|
||||
|
||||
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]
|
||||
|
|
@ -16,10 +16,13 @@ import com.arsdigita.cms.ContentBundle;
|
|||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
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;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||
|
|
@ -38,14 +41,16 @@ import java.util.Date;
|
|||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfileCreate extends PageCreate {
|
||||
|
||||
|
||||
private static final String SELECTED_PERSON = "selectedPerson";
|
||||
|
||||
private static final SciPublicPersonalProfileConfig config =
|
||||
new SciPublicPersonalProfileConfig();
|
||||
|
||||
public SciPublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
||||
final CreationSelector parent) {
|
||||
super(itemModel, parent);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
//super.addWidgets();
|
||||
|
|
@ -58,25 +63,38 @@ public class SciPublicPersonalProfileCreate extends PageCreate {
|
|||
add(new Label(type.getLabel()));
|
||||
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
||||
add(new LanguageWidget(LANGUAGE));
|
||||
|
||||
|
||||
add(new Label(SciPublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"scipublicpersonalprofile.ui.create.select_person")));
|
||||
ParameterModel ownerModel =
|
||||
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()) ) {
|
||||
personType = "com.arsdigita.cms.contenttypes.GenericPerson";
|
||||
}
|
||||
|
||||
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(
|
||||
SciMember.BASE_DATA_OBJECT_TYPE);
|
||||
personType);
|
||||
persons.addFilter("profile is null");
|
||||
while (persons.next()) {
|
||||
SciMember member =
|
||||
(SciMember) DomainObjectFactory.newInstance(persons.
|
||||
GenericPerson person =
|
||||
(GenericPerson) DomainObjectFactory.newInstance(persons.
|
||||
getDataObject());
|
||||
ownerSelect.addOption(new Option(member.getID().toString(), member.
|
||||
ownerSelect.addOption(new Option(person.getID().toString(), person.
|
||||
getFullName()));
|
||||
}
|
||||
add(ownerSelect);
|
||||
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.authoring.page_launch_date")));
|
||||
|
|
@ -93,57 +111,58 @@ public class SciPublicPersonalProfileCreate extends PageCreate {
|
|||
add(launchDate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
Folder folder = m_parent.getFolder(fse.getPageState());
|
||||
Assert.exists(folder);
|
||||
String id = (String) fse.getFormData().get(
|
||||
SciPublicPersonalProfile.OWNER);
|
||||
|
||||
|
||||
SciMember owner = new SciMember(new BigDecimal(id));
|
||||
|
||||
|
||||
validateNameUniqueness(folder,
|
||||
fse,
|
||||
String.format("%s-profile",
|
||||
SciMember.urlSave(
|
||||
owner.getFullName())));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
final FormData data = fse.getFormData();
|
||||
final PageState state = fse.getPageState();
|
||||
final ContentSection section = m_parent.getContentSection(state);
|
||||
final Folder folder = m_parent.getFolder(state);
|
||||
|
||||
|
||||
Assert.exists(section, ContentSection.class);
|
||||
|
||||
|
||||
String id = (String) fse.getFormData().get(
|
||||
SciPublicPersonalProfile.OWNER);
|
||||
|
||||
SciMember owner = new SciMember(new BigDecimal(id));
|
||||
|
||||
GenericPerson owner = new GenericPerson(new BigDecimal(id));
|
||||
String name = String.format("%s-profile",
|
||||
SciMember.urlSave(owner.getFullName()));
|
||||
String title = String.format("%s (Profil)", owner.getFullName());
|
||||
|
||||
|
||||
final ContentPage item = createContentPage(state);
|
||||
item.setLanguage((String) data.get(LANGUAGE));
|
||||
item.setName(name);
|
||||
item.setTitle(title);
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
|
||||
}
|
||||
|
||||
final ContentBundle bundle = new ContentBundle(item);
|
||||
|
||||
final ContentBundle bundle = new ContentBundle(item);
|
||||
bundle.setParent(folder);
|
||||
bundle.setContentSection(m_parent.getContentSection(state));
|
||||
bundle.save();
|
||||
|
||||
SciPublicPersonalProfile profile = new SciPublicPersonalProfile(item.getOID());
|
||||
|
||||
SciPublicPersonalProfile profile = new SciPublicPersonalProfile(item.
|
||||
getOID());
|
||||
profile.setOwner(owner);
|
||||
profile.save();
|
||||
|
||||
|
||||
m_parent.editItem(state, item);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,14 @@ import com.arsdigita.bebop.Label;
|
|||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SegmentedPanel;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciPublicPersonalProfile;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -83,7 +82,7 @@ public class SciPublicPersonalProfilePropertiesStep extends SimpleEditStep {
|
|||
public String format(DomainObject obj, String attribute, PageState state) {
|
||||
SciPublicPersonalProfile profile = (SciPublicPersonalProfile) obj;
|
||||
|
||||
SciMember owner = profile.getOwner();
|
||||
GenericPerson owner = profile.getOwner();
|
||||
|
||||
if (owner == null) {
|
||||
return "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue