SciPublicPersonalProfile:
- Formulare für Content-Center - XML-Config-Dateien etc. git-svn-id: https://svn.libreccm.org/ccm/trunk@999 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d1c2817534
commit
8193889af7
|
|
@ -145,7 +145,7 @@ public class ArticleInJournalPropertyForm
|
|||
super.process(fse);
|
||||
|
||||
FormData data = fse.getFormData();
|
||||
ArticleInJournal article = (ArticleInJournal) initBasicWidgets(fse);
|
||||
ArticleInJournal article = (ArticleInJournal) processBasicWidgets(fse);
|
||||
|
||||
if ((article != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ccm:application xmlns:ccm="http://ccm.redhat.com/ccm-project"
|
||||
name="ccm-sci-personalinformationpage"
|
||||
name="ccm-sci-publicpersonalprofile"
|
||||
prettyName="OpenCCM Content Type"
|
||||
version="6.6.1"
|
||||
release="1"
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<ccm:requires name="ccm-core" version="6.6.0" release="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.6.0" release="ge"/>
|
||||
<ccm:requires name="ccm-sci-types-organization" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-sci-types-organizationwithpublications" version="6.6.0" relation="ge"/>
|
||||
<!--<ccm:requires name="ccm-sci-types-organizationwithpublications" version="6.6.0" relation="ge"/>-->
|
||||
<ccm:requires name="ccm-sci-publications" version="6.6.0" relation="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:directories>
|
||||
|
|
|
|||
|
|
@ -1,25 +0,0 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type PublicPersonalProfile extends ContentPage {
|
||||
|
||||
String homepageUrl = homepage_url VARCHAR(256);
|
||||
|
||||
reference key (ct_public_personal_profiles.profile_id);
|
||||
}
|
||||
|
||||
association {
|
||||
|
||||
PublicPersonalProfile[0..n] profile = join ct_sciorga_members.member_id
|
||||
to ct_public_personal_profile_owner_map.owner_id,
|
||||
join ct_public_personal_profile_owner_map.profile_id
|
||||
to ct_public_personal_profile.profile_id;
|
||||
|
||||
SciMember[0..n] owner = join ct_public_personal_profile.profile_id
|
||||
to ct_public_personal_profile_owner_map.profile_id,
|
||||
join ct_public_personal_profile_owner_map.owner_id
|
||||
to ct_sciorga_members.member_id
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
object type SciPublicPersonalProfile extends ContentPage {
|
||||
|
||||
String[0..1] profileUrl = ct_sci_public_personal_profiles.profile_url VARCHAR(256);
|
||||
Boolean[0..1] showPublicationList = ct_sci_public_personal_profiles.show_publication_list BIT;
|
||||
Boolean[0..1] showProjectList = ct_sci_public_personal_profiles.show_project_list BIT;
|
||||
|
||||
reference key (ct_sci_public_personal_profiles.profile_id);
|
||||
}
|
||||
|
||||
association {
|
||||
|
||||
SciPublicPersonalProfile[0..n] profile = join ct_sciorga_members.member_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;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
|
||||
|
||||
<ctd:content-type
|
||||
label="SciPublicPersonalProfile"
|
||||
description="Item which is used to create a public personal profile."
|
||||
objectType="com.arsdigita.cms.contenttypes.SciPublicPersonalProfile"
|
||||
classname="com.arsdigita.cms.contenttypes.SciPublicPersonalProfile">
|
||||
|
||||
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="scipublicpersonalprofile.ui.profile_properties.title"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciPublicPersonalProfileResources"
|
||||
descriptionKey="scipublicpersonalprofile.ui.profile_properties.title.description"
|
||||
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciPublicPersonalProfileResources"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciPublicPersonalProfilePropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
</ctd:authoring-kit>
|
||||
|
||||
</ctd:content-type>
|
||||
|
||||
</ctd:content-types>
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
Document : SciPublicPersonalProfile.xml
|
||||
Created on : 11. Juli 2011, 13:26
|
||||
Author : jensp
|
||||
Description:
|
||||
Purpose of the document follows.
|
||||
-->
|
||||
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xrd:adapters
|
||||
xmlns:xrd="http://xmlns.redhat.com/schemas/waf/xml-renderer-rules"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://rhea.redhat.com/schemas/waf/xml-renderer-rules xml-renderer-rules.xsd">
|
||||
|
||||
<xrd:context name="com.arsdigita.cms.dispatcher.SimpleXMLGenerator" >
|
||||
|
||||
<xrd:adapter objectType="com.arsdigita.cms.contenttypes.SciPublicPersonalProfile"
|
||||
extends="com.arsdigita.cms.ContentPage">
|
||||
|
||||
</xrd:adapter>
|
||||
|
||||
</xrd:context>
|
||||
|
||||
</xrd:adapters>
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
<load>
|
||||
<requries>
|
||||
<requires>
|
||||
<table name="inits"/>
|
||||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<table name="ct_sciorga_organizations"/>
|
||||
<table name="ct_sciorga_organizations_with_publications"/>
|
||||
<table name="ct_sciorga_departments"/>
|
||||
<!-- <table name="ct_sciorga_organizations"/> -->
|
||||
<!-- <table name="ct_sciorga_organizations_with_publications"/> -->
|
||||
<!-- <table name="ct_sciorga_departments"/> -->
|
||||
<table name="ct_sciorga_projects"/>
|
||||
<table name="ct_publications"/>
|
||||
<initalizer class="com.arsdigita.cms.Initializer"/>
|
||||
|
|
@ -16,10 +16,10 @@
|
|||
<initalizer class="com.arsdigita.cms.contenttypes.SciProjectInitializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<initalizer class="com.arsdigita.cms.contenttypes.SciPublicPersonalProfileInizalizer/>
|
||||
<initalizer class="com.arsdigita.cms.contenttypes.SciPublicPersonalProfileInizalizer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
<schema directory="ccm-sci-publicpersonalprofile"/>
|
||||
<data class="com.arsdigita.cms.contnenttypes.SciPublicPersonalProfileLoader"/>
|
||||
<data class="com.arsdigita.cms.contenttypes.SciPublicPersonalProfileLoader"/>
|
||||
</scripts>
|
||||
</load>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import java.math.BigDecimal;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.util.Assert;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfile extends ContentPage {
|
||||
|
||||
public static final String OWNER = "owner";
|
||||
public static final String PROFILE_URL = "profileUrl";
|
||||
public static final String SHOW_PUBLICATION_LIST = "showPublicationList";
|
||||
public static final String SHOW_PROJECT_LIST = "showProjectList";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.SciPublicPersonalProfile";
|
||||
|
||||
public SciPublicPersonalProfile() {
|
||||
this(BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
public SciPublicPersonalProfile(BigDecimal id)
|
||||
throws DataObjectNotFoundException {
|
||||
this(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
public SciPublicPersonalProfile(OID oid)
|
||||
throws DataObjectNotFoundException {
|
||||
super(oid);
|
||||
}
|
||||
|
||||
public SciPublicPersonalProfile(DataObject dobj) {
|
||||
super(dobj);
|
||||
}
|
||||
|
||||
public SciPublicPersonalProfile(String type) {
|
||||
super(type);
|
||||
}
|
||||
|
||||
public SciMember getOwner() {
|
||||
final DataCollection collection = (DataCollection) get(OWNER);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (SciMember) DomainObjectFactory.newInstance(dobj);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOwner(SciMember owner) {
|
||||
SciMember oldOwner;
|
||||
|
||||
oldOwner = getOwner();
|
||||
if (oldOwner != null) {
|
||||
remove(OWNER, oldOwner);
|
||||
}
|
||||
|
||||
if (null != owner) {
|
||||
Assert.exists(owner, SciMember.class);
|
||||
add(OWNER, owner);
|
||||
}
|
||||
}
|
||||
|
||||
public String getProfileUrl() {
|
||||
return (String) get(PROFILE_URL);
|
||||
}
|
||||
|
||||
public void setProfileUrl(String profileUrl) {
|
||||
set(PROFILE_URL, profileUrl);
|
||||
}
|
||||
|
||||
public Boolean getShowPublicationList() {
|
||||
return (Boolean) get(SHOW_PUBLICATION_LIST);
|
||||
}
|
||||
|
||||
public void setShowPublicationList(Boolean showPublicationList) {
|
||||
set(SHOW_PUBLICATION_LIST, showPublicationList);
|
||||
}
|
||||
|
||||
public Boolean getShowProjectList() {
|
||||
return (Boolean) get(SHOW_PROJECT_LIST);
|
||||
}
|
||||
|
||||
public void setShowProjectList(Boolean showProjectList) {
|
||||
set(SHOW_PROJECT_LIST, showProjectList);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfileInitializer extends ContentTypeInitializer {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SciPublicPersonalProfileInitializer.class);
|
||||
|
||||
public SciPublicPersonalProfileInitializer() {
|
||||
super("ccm-sci-publicpersonalprofile.pdl.mf",
|
||||
SciPublicPersonalProfile.BASE_DATA_OBJECT_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getStylesheets() {
|
||||
return new String[]{
|
||||
"/static/content-types/com/arsdigita/cms/contenttypes/SciPublicPersonalProfile.xsl"
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTraversalXML() {
|
||||
return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciPublicPersonalProfile.xml";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfileLoader extends AbstractContentTypeLoader {
|
||||
|
||||
public SciPublicPersonalProfileLoader() {
|
||||
super();
|
||||
}
|
||||
|
||||
private static final String[] TYPES = {
|
||||
"/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
|
||||
+ "SciPublicPersonalProfile.xml"
|
||||
};
|
||||
|
||||
@Override
|
||||
public String[] getTypes() {
|
||||
return TYPES;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.ColumnPanel;
|
||||
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.FormSectionEvent;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.util.GlobalizationUtil;
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.CreationSelector;
|
||||
import com.arsdigita.cms.ui.authoring.PageCreate;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.ui.authoring.ApplyWorkflowFormSection;
|
||||
import com.arsdigita.cms.ui.authoring.LanguageWidget;
|
||||
import com.arsdigita.cms.contenttypes.SciMember;
|
||||
import com.arsdigita.cms.contenttypes.SciPublicPersonalProfile;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfileCreate extends PageCreate {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "owner";
|
||||
|
||||
public SciPublicPersonalProfileCreate(final ItemSelectionModel itemModel,
|
||||
final CreationSelector parent) {
|
||||
super(itemModel, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
ContentType type = getItemSelectionModel().getContentType();
|
||||
m_workflowSection = new ApplyWorkflowFormSection(type);
|
||||
add(m_workflowSection, ColumnPanel.INSERT);
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.authoring.content_type")));
|
||||
add(new Label(type.getLabel()));
|
||||
add(new Label(GlobalizationUtil.globalize("cms.ui.language.field")));
|
||||
add(new LanguageWidget(LANGUAGE));
|
||||
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
SciMember.class.getName()));
|
||||
add(itemSearch);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
add(new Label(GlobalizationUtil.globalize(
|
||||
"cms.ui.authoring.page_launch_date")));
|
||||
ParameterModel launchDateParam = new DateParameter(LAUNCH_DATE);
|
||||
com.arsdigita.bebop.form.Date launchDate =
|
||||
new com.arsdigita.bebop.form.Date(
|
||||
launchDateParam);
|
||||
if (ContentSection.getConfig().getRequireLaunchDate()) {
|
||||
launchDate.addValidationListener(
|
||||
new LaunchDateValidationListener());
|
||||
// if launch date is required, help user by suggesting today's date
|
||||
launchDateParam.setDefaultValue(new Date());
|
||||
}
|
||||
add(launchDate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final Folder folder = m_parent.getFolder(fse.getPageState());
|
||||
Assert.exists(folder);
|
||||
validateNameUniqueness(folder, fse, getProfileName(fse));
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
final String profileName = getProfileName(fse);
|
||||
final SciMember owner = (SciMember) data.get(ITEM_SEARCH);
|
||||
|
||||
Assert.exists(section, ContentSection.class);
|
||||
|
||||
final ContentPage item = createContentPage(state);
|
||||
item.setLanguage((String) data.get(LANGUAGE));
|
||||
item.setName(profileName);
|
||||
item.setTitle(getProfileTitle(fse));
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
item.setLaunchDate((Date) data.get(LAUNCH_DATE));
|
||||
}
|
||||
|
||||
final ContentBundle bundle = new ContentBundle(item);
|
||||
bundle.setParent(folder);
|
||||
bundle.setContentSection(m_parent.getContentSection(state));
|
||||
bundle.save();
|
||||
|
||||
m_workflowSection.applyWorkflow(state, item);
|
||||
|
||||
SciPublicPersonalProfile profile = new SciPublicPersonalProfile(item.getID());
|
||||
profile.setOwner(owner);
|
||||
profile.save();
|
||||
|
||||
m_parent.editItem(state, item);
|
||||
}
|
||||
|
||||
private String getProfileName(FormSectionEvent fse) {
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
SciMember owner = (SciMember) data.get(ITEM_SEARCH);
|
||||
if (owner == null) {
|
||||
return null;
|
||||
} else {
|
||||
return String.format("profile_%s_%s",
|
||||
owner.getGivenName(),
|
||||
owner.getSurname());
|
||||
}
|
||||
}
|
||||
|
||||
private String getProfileTitle(FormSectionEvent fse) {
|
||||
final FormData data = fse.getFormData();
|
||||
|
||||
SciMember owner = (SciMember) data.get(ITEM_SEARCH);
|
||||
if (owner == null) {
|
||||
return null;
|
||||
} else {
|
||||
return String.format("Profile %s %s",
|
||||
owner.getGivenName(),
|
||||
owner.getSurname());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfileGlobalizationUtil {
|
||||
|
||||
public static final String BUNDLE_NAME =
|
||||
"com.arsdigita.cms.contenttypes.ui.SciPublicPersonalProfileResources";
|
||||
|
||||
public static GlobalizedMessage globalize(String key) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME);
|
||||
}
|
||||
|
||||
public static GlobalizedMessage globalize(String key, Object[] args) {
|
||||
return new GlobalizedMessage(key, BUNDLE_NAME, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.SegmentedPanel;
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ContentSection;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciPublicPersonalProfile;
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfilePropertiesStep extends SimpleEditStep {
|
||||
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
public SciPublicPersonalProfilePropertiesStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
//Use a segemented panel to provide an easy for adding addional forms
|
||||
//to the step.
|
||||
SegmentedPanel segmentedPanel = new SegmentedPanel();
|
||||
|
||||
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||
|
||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel, parent,
|
||||
EDIT_SHEET_NAME);
|
||||
|
||||
BasicPageForm editBasicSheet =
|
||||
new SciPublicPersonalProfilePropertyForm(itemModel,
|
||||
this);
|
||||
basicProperties.add(EDIT_SHEET_NAME,
|
||||
(String) SciPublicPersonalProfileGlobalizationUtil.
|
||||
globalize(
|
||||
"scipublicpersonalprofile.ui.profile.edit_basic_properties").
|
||||
localize(),
|
||||
new WorkflowLockedComponentAccess(editBasicSheet,
|
||||
itemModel),
|
||||
editBasicSheet.getSaveCancelSection().
|
||||
getCancelButton());
|
||||
|
||||
basicProperties.setDisplayComponent(getSciPublicPersonalProfilePropertySheet(
|
||||
itemModel));
|
||||
|
||||
segmentedPanel.addSegment(new Label((String) SciPublicPersonalProfileGlobalizationUtil.
|
||||
globalize("scipublicpersonalprofile.ui.profile.basic_properties").
|
||||
localize()), basicProperties);
|
||||
|
||||
setDisplayComponent(segmentedPanel);
|
||||
}
|
||||
|
||||
public static Component getSciPublicPersonalProfilePropertySheet(
|
||||
ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||
itemModel);
|
||||
|
||||
sheet.add(SciPublicPersonalProfileGlobalizationUtil.globalize("scipublicpersonalprofile.ui.profile_url"),
|
||||
SciPublicPersonalProfile.PROFILE_URL);
|
||||
|
||||
sheet.add(SciPublicPersonalProfileGlobalizationUtil.globalize("scipublicpersonalprofile.ui.show_publication_list"),
|
||||
SciPublicPersonalProfile.SHOW_PUBLICATION_LIST);
|
||||
sheet.add(SciPublicPersonalProfileGlobalizationUtil.globalize("scipublicpersonalprofile.ui.show_project_list"),
|
||||
SciPublicPersonalProfile.SHOW_PROJECT_LIST);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.FormSection;
|
||||
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.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.SciPublicPersonalProfile;
|
||||
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import javax.swing.text.StyledEditorKit.BoldAction;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SciPublicPersonalProfilePropertyForm
|
||||
extends BasicPageForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private SciPublicPersonalProfilePropertiesStep step;
|
||||
private CheckboxGroup showPublicationList;
|
||||
private CheckboxGroup showProjectList;
|
||||
private String SHOW_PUBLICATION_LIST = "showPublicationList";
|
||||
private String SHOW_PROJECT_LIST = "showProjectList";
|
||||
public static final String ID = "SciPublicPersonalProfile_edit";
|
||||
|
||||
public SciPublicPersonalProfilePropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
public SciPublicPersonalProfilePropertyForm(
|
||||
ItemSelectionModel itemModel,
|
||||
SciPublicPersonalProfilePropertiesStep step) {
|
||||
super(ID, itemModel);
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
add(new Label(SciPublicPersonalProfileGlobalizationUtil.globalize(
|
||||
"scipublicpersonalprofile.ui.profile.url")));
|
||||
ParameterModel profileUrlParam =
|
||||
new StringParameter(SciPublicPersonalProfile.PROFILE_URL);
|
||||
TextField profileUrl = new TextField(profileUrlParam);
|
||||
add(profileUrl);
|
||||
|
||||
add(new Label((String) SciPublicPersonalProfileGlobalizationUtil.
|
||||
globalize(
|
||||
"scipublicpersonalprofile.ui.profile.show_publication_list").
|
||||
localize()));
|
||||
showPublicationList = new CheckboxGroup(SHOW_PUBLICATION_LIST + "Group");
|
||||
showPublicationList.addOption(new Option(SHOW_PUBLICATION_LIST, ""));
|
||||
add(showPublicationList);
|
||||
|
||||
add(new Label((String) SciPublicPersonalProfileGlobalizationUtil.
|
||||
globalize(
|
||||
"scipublicpersonalprofile.ui.profile.show_project_list").
|
||||
localize()));
|
||||
showProjectList = new CheckboxGroup(SHOW_PROJECT_LIST + "Group");
|
||||
showProjectList.addOption(new Option(SHOW_PROJECT_LIST, ""));
|
||||
add(showProjectList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
final SciPublicPersonalProfile profile =
|
||||
(SciPublicPersonalProfile) super.
|
||||
initBasicWidgets(fse);
|
||||
|
||||
data.put(SciPublicPersonalProfile.PROFILE_URL, profile.getProfileUrl());
|
||||
if ((profile.getShowPublicationList() != null)
|
||||
&& profile.getShowPublicationList()) {
|
||||
showPublicationList.setValue(state, new String[]{
|
||||
SHOW_PUBLICATION_LIST});
|
||||
}
|
||||
if ((profile.getShowProjectList() != null)
|
||||
&& profile.getShowProjectList()) {
|
||||
showProjectList.setValue(state, new String[]{SHOW_PROJECT_LIST});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
final SciPublicPersonalProfile profile =
|
||||
(SciPublicPersonalProfile) processBasicWidgets(
|
||||
fse);
|
||||
final FormData data = fse.getFormData();
|
||||
final PageState state = fse.getPageState();
|
||||
|
||||
if ((profile != null)
|
||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
profile.setProfileUrl((String) data.get(
|
||||
SciPublicPersonalProfile.PROFILE_URL));
|
||||
|
||||
if (showPublicationList.getValue(state) == null) {
|
||||
profile.setShowPublicationList(Boolean.FALSE);
|
||||
} else {
|
||||
profile.setShowPublicationList(Boolean.TRUE);
|
||||
}
|
||||
|
||||
if (showProjectList.getValue(state) == null) {
|
||||
profile.setShowProjectList(Boolean.FALSE);
|
||||
} else {
|
||||
profile.setShowProjectList(Boolean.TRUE);
|
||||
}
|
||||
|
||||
profile.save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
scipublicpersonalprofile.ui.profile.basic_properties=Basic properties
|
||||
scipublicpersonalprofile.ui.profile.edit_basic_properties=Edit basic properties
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# To change this template, choose Tools | Templates
|
||||
# and open the template in the editor.
|
||||
|
||||
scipublicpersonalprofile.ui.profile.basic_properties=Basiseigenschaften
|
||||
scipublicpersonalprofile.ui.profile.edit_basic_properties=Basiseigenschaften bearbeiten
|
||||
Loading…
Reference in New Issue