Erster Teil für notwendigen Änderungen für die zusätzlichen Felder für PublicPersonalProfile (s. Ticket 805).
git-svn-id: https://svn.libreccm.org/ccm/trunk@1470 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
8e625d43d8
commit
0ed4ddc860
|
|
@ -6,8 +6,10 @@ import com.arsdigita.cms.*;
|
||||||
object type PublicPersonalProfile extends ContentPage {
|
object type PublicPersonalProfile extends ContentPage {
|
||||||
|
|
||||||
String[0..1] profileUrl = ct_public_personal_profiles.profile_url VARCHAR(256);
|
String[0..1] profileUrl = ct_public_personal_profiles.profile_url VARCHAR(256);
|
||||||
Boolean[0..1] showPublicationList = ct_public_personal_profiles.show_publication_list BIT;
|
|
||||||
Boolean[0..1] showProjectList = ct_public_personal_profiles.show_project_list BIT;
|
String[0..1] position = ct_public_personal_profile.position VARCHAR(2048);
|
||||||
|
String[0..1] researchInterests = ct_public_personal_profiles.research_interests CLOB;
|
||||||
|
String[0..1] misc = ct_public_personal_profiles.misc CLOB;
|
||||||
|
|
||||||
reference key (ct_public_personal_profiles.profile_id);
|
reference key (ct_public_personal_profiles.profile_id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,15 +34,15 @@ import com.arsdigita.util.Assert;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A content type representing a profile (a personal homepage) of a person.
|
* A content type representing a profile (a personal homepage) of a person. On
|
||||||
* On the start page of the the profile the contact data and a photo (if any)
|
* the start page of the the profile the contact data and a photo (if any)
|
||||||
* associated with the owner of the profile are shown. Other content items can
|
* associated with the owner of the profile are shown. Other content items can
|
||||||
* be associated with the profile. They are shown in special navigation. Also,
|
* be associated with the profile. They are shown in special navigation. Also,
|
||||||
* there special items for the profile which not backed by a content item.
|
* there special items for the profile which not backed by a content item.
|
||||||
* Instead, they are backed by a Java class which implements the
|
* Instead, they are backed by a Java class which implements the
|
||||||
* {@link ContentGenerator} interface. A profile can either be shown as
|
* {@link ContentGenerator} interface. A profile can either be shown as a
|
||||||
* a standalone page (similar the separate category system) or embedded into
|
* standalone page (similar the separate category system) or embedded into the
|
||||||
* the normal site.
|
* normal site.
|
||||||
*
|
*
|
||||||
* @author Jens Pelzetter
|
* @author Jens Pelzetter
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
|
@ -55,8 +55,11 @@ public class PublicPersonalProfile
|
||||||
public static final String OWNER = "owner";
|
public static final String OWNER = "owner";
|
||||||
public static final String PROFILE_URL = "profileUrl";
|
public static final String PROFILE_URL = "profileUrl";
|
||||||
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
public static final String LINK_LIST_NAME = "publicPersonalProfileNavItems";
|
||||||
|
public static final String POSITION = "position";
|
||||||
|
public static final String RESEARCH_INTERESTS = "researchInterests";
|
||||||
|
public static final String MISC = "misc";
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
public static final String BASE_DATA_OBJECT_TYPE =
|
||||||
"com.arsdigita.cms.contenttypes.PublicPersonalProfile";
|
"com.arsdigita.cms.contenttypes.PublicPersonalProfile";
|
||||||
|
|
||||||
public PublicPersonalProfile() {
|
public PublicPersonalProfile() {
|
||||||
this(BASE_DATA_OBJECT_TYPE);
|
this(BASE_DATA_OBJECT_TYPE);
|
||||||
|
|
@ -123,7 +126,7 @@ public class PublicPersonalProfile
|
||||||
*
|
*
|
||||||
* @return The URL fragment of the profile used to build the URL of the
|
* @return The URL fragment of the profile used to build the URL of the
|
||||||
* profile.
|
* profile.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public String getProfileUrl() {
|
public String getProfileUrl() {
|
||||||
return (String) get(PROFILE_URL);
|
return (String) get(PROFILE_URL);
|
||||||
|
|
@ -133,9 +136,33 @@ public class PublicPersonalProfile
|
||||||
set(PROFILE_URL, profileUrl);
|
set(PROFILE_URL, profileUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPosition() {
|
||||||
|
return (String) get(POSITION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosition(final String position) {
|
||||||
|
set(POSITION, position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getResearchInterests() {
|
||||||
|
return (String) get(RESEARCH_INTERESTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResearchInterests(final String researchInterests) {
|
||||||
|
set(RESEARCH_INTERESTS, researchInterests);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMisc() {
|
||||||
|
return (String) get(MISC);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMisc(final String misc) {
|
||||||
|
set(MISC, misc);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The profile has an extra XML Generator, which is primarily to render
|
* The profile has an extra XML Generator, which is primarily to render the
|
||||||
* the items and the navigation of the profile for the embedded view.
|
* items and the navigation of the profile for the embedded view.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -149,10 +176,10 @@ public class PublicPersonalProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPreviewUrl(final PageState state) {
|
public String getPreviewUrl(final PageState state) {
|
||||||
if(config.getEmbedded()) {
|
if (config.getEmbedded()) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return String.format("/profiles/preview/%s/", getProfileUrl());
|
return String.format("/profiles/preview/%s/", getProfileUrl());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
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.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicPersonalProfilePositionEditForm
|
||||||
|
extends BasicItemForm
|
||||||
|
implements FormProcessListener,
|
||||||
|
FormInitListener {
|
||||||
|
|
||||||
|
public PublicPersonalProfilePositionEditForm(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
super("PublicPersonalProfileEditPosition", itemModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addWidgets() {
|
||||||
|
add(new Label(PublicPersonalProfileGlobalizationUtil.globalize(
|
||||||
|
"publicpersonalprofile.ui.position")));
|
||||||
|
final ParameterModel positionParam = new StringParameter(
|
||||||
|
PublicPersonalProfile.POSITION);
|
||||||
|
final TextArea position = new TextArea(positionParam);
|
||||||
|
position.setCols(75);
|
||||||
|
position.setRows(8);
|
||||||
|
add(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
final PageState state = fse.getPageState();
|
||||||
|
final FormData data = fse.getFormData();
|
||||||
|
final PublicPersonalProfile profile = (PublicPersonalProfile) getItemSelectionModel().
|
||||||
|
getSelectedItem(state);
|
||||||
|
|
||||||
|
data.put(PublicPersonalProfile.POSITION, profile.getPosition());
|
||||||
|
|
||||||
|
setVisible(state, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(final FormSectionEvent fse)
|
||||||
|
throws FormProcessException {
|
||||||
|
final PageState state = fse.getPageState();
|
||||||
|
final FormData data = fse.getFormData();
|
||||||
|
final PublicPersonalProfile profile = (PublicPersonalProfile) getItemSelectionModel().
|
||||||
|
getSelectedItem(state);
|
||||||
|
|
||||||
|
if ((profile != null)
|
||||||
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
|
profile.setPosition((String) data.get(PublicPersonalProfile.POSITION));
|
||||||
|
|
||||||
|
profile.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
init(fse);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
|
import com.arsdigita.bebop.Component;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
|
import com.arsdigita.cms.contenttypes.PublicPersonalProfile;
|
||||||
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Jens Pelzetter
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PublicPersonalProfilePositionStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
private String EDIT_POSITION_SHEET_NAME = "editPosition";
|
||||||
|
|
||||||
|
public PublicPersonalProfilePositionStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent) {
|
||||||
|
this(itemModel, parent, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PublicPersonalProfilePositionStep(final ItemSelectionModel itemModel,
|
||||||
|
final AuthoringKitWizard parent,
|
||||||
|
final String prefix) {
|
||||||
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
final BasicItemForm editPositionForm = new PublicPersonalProfilePositionEditForm(
|
||||||
|
itemModel);
|
||||||
|
add(EDIT_POSITION_SHEET_NAME,
|
||||||
|
(String) PublicPersonalProfileGlobalizationUtil.globalize(
|
||||||
|
"publicpersonalprofile.ui.position.edit").localize(),
|
||||||
|
new WorkflowLockedComponentAccess(editPositionForm, itemModel),
|
||||||
|
editPositionForm.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
setDisplayComponent(getPublicPersonalProfilePositionSheet(itemModel));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Component getPublicPersonalProfilePositionSheet(
|
||||||
|
final ItemSelectionModel itemModel) {
|
||||||
|
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||||
|
itemModel);
|
||||||
|
|
||||||
|
sheet.add(PublicPersonalProfileGlobalizationUtil.globalize(
|
||||||
|
"publicpersonalprofile.ui.position"),
|
||||||
|
PublicPersonalProfile.POSITION);
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue