Current status
parent
5c9ad7eaa8
commit
795bc99f2d
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.SegmentedPanel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.globalization.GlobalizedMessage;
|
||||
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConfig;
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class SciProjectDescriptionStep extends SimpleEditStep {
|
||||
|
||||
private final SegmentedPanel segmentedPanel;
|
||||
|
||||
public SciProjectDescriptionStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final StringParameter selectedLanguageParameter) {
|
||||
|
||||
super(itemModel, parent, selectedLanguageParameter);
|
||||
|
||||
segmentedPanel = new SegmentedPanel();
|
||||
setDefaultEditKey(SciProjectUiConstants.EDIT_DESC_SHEET_NAME);
|
||||
|
||||
addSteps(itemModel, parent);
|
||||
|
||||
setDisplayComponent(segmentedPanel);
|
||||
}
|
||||
|
||||
protected SegmentedPanel getSegmentedPanel() {
|
||||
return segmentedPanel;
|
||||
}
|
||||
|
||||
protected void addSteps(final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent) {
|
||||
|
||||
addStep(new SciProjectDescriptionTextStep(item, parent),
|
||||
"sciproject.ui.steps.description.title");
|
||||
|
||||
final SciProjectConfig config = SciProjectConfig.getConfig();
|
||||
|
||||
if (config.isEnableSponsor()) {
|
||||
addStep(new SciProjectSponsorStep(itemModel, parent),
|
||||
"sciproject.ui.steps.sponsor.title");
|
||||
}
|
||||
|
||||
if (config.isEnableFunding()) {
|
||||
addStep(new SciProjectFundingStep(itemModel, parent),
|
||||
"sciproject.ui.steps.funding.title");
|
||||
}
|
||||
}
|
||||
|
||||
protected void addStep(final SimpleEditStep step, final String labelKey) {
|
||||
|
||||
segmentedPanel.addSegment(
|
||||
new Label(new GlobalizedMessage(
|
||||
labelKey,
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE)),
|
||||
step
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
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.globalization.GlobalizedMessage;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
|
||||
import org.scientificcms.contenttypes.sciproject.SciProjectConstants;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class SciProjectDescriptionTextStep extends SimpleEditStep {
|
||||
|
||||
public SciProjectDescriptionTextStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
|
||||
this(itemModel, parent, selectedLanguageParam, null);
|
||||
}
|
||||
|
||||
public SciProjectDescriptionTextStep(
|
||||
final ItemSelectionModel itemModel,
|
||||
final AuthoringKitWizard parent,
|
||||
final StringParameter selectedLanguageParam,
|
||||
final String suffix) {
|
||||
|
||||
super(itemModel, parent, selectedLanguageParam, suffix);
|
||||
|
||||
final BasicItemForm descTextEditSheet
|
||||
= new SciProjectDescriptionTextForm(
|
||||
itemModel, selectedLanguageParam);
|
||||
add(SciProjectUiConstants.EDIT_DESC_TEXT_SHEET_NAME,
|
||||
new GlobalizedMessage("sciproject.ui.desc.text.edit",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
new WorkflowLockedComponentAccess(descTextEditSheet, itemModel),
|
||||
descTextEditSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
final SciProjectDescriptionUploadForm uploadDescForm
|
||||
= new SciProjectDescriptionUploadForm(
|
||||
itemModel,
|
||||
selectedLanguageParam);
|
||||
add(SciProjectUiConstants.UPLOAD_DESC_TEXT_SHEET_NAME,
|
||||
new GlobalizedMessage("sciproject.ui.desc.upload",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
uploadDescForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(
|
||||
getSciProjectEditDescTextSheet(itemModel,
|
||||
selectedLanguageParam)
|
||||
);
|
||||
}
|
||||
|
||||
public static Component getSciProjectEditDescTextSheet(
|
||||
final ItemSelectionModel itemModel,
|
||||
final StringParameter selectedLanguageParam) {
|
||||
|
||||
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
|
||||
itemModel);
|
||||
|
||||
sheet.add(new GlobalizedMessage(
|
||||
"sciproject.ui.desc", SciProjectConstants.SCI_PROJECT_BUNDLE),
|
||||
SciProjectUiConstants.PROJECT_DESCRIPTION);
|
||||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ public class SciProjectPropertiesStep extends SimpleEditStep {
|
|||
super(itemModel, parent, selectedLanguageParam);
|
||||
|
||||
segmentedPanel = new SegmentedPanel();
|
||||
setDefaultEditKey(SciProjectUiConstants.EDIT_SHEET_NAME);
|
||||
setDefaultEditKey(SciProjectUiConstants.EDIT_CONTACT_SHEET_NAME);
|
||||
|
||||
addBasicProperties(itemModel, parent, selectedLanguageParam);
|
||||
addSteps(itemModel, parent);
|
||||
|
|
@ -124,7 +124,7 @@ public class SciProjectPropertiesStep extends SimpleEditStep {
|
|||
itemModel,
|
||||
parent,
|
||||
selectedLanguageParameter,
|
||||
SciProjectUiConstants.EDIT_SHEET_NAME
|
||||
SciProjectUiConstants.EDIT_CONTACT_SHEET_NAME
|
||||
);
|
||||
|
||||
final BasicPageForm editBasicSheet = new SciProjectPropertyForm(
|
||||
|
|
@ -132,8 +132,7 @@ public class SciProjectPropertiesStep extends SimpleEditStep {
|
|||
this,
|
||||
selectedLanguageParameter);
|
||||
|
||||
basicProperties.add(
|
||||
SciProjectUiConstants.EDIT_SHEET_NAME,
|
||||
basicProperties.add(SciProjectUiConstants.EDIT_CONTACT_SHEET_NAME,
|
||||
new GlobalizedMessage("sciproject.ui.edit_basic_sheet",
|
||||
SciProjectConstants.SCI_PROJECT_BUNDLE
|
||||
),
|
||||
|
|
|
|||
|
|
@ -15,7 +15,14 @@ public final class SciProjectUiConstants {
|
|||
|
||||
public static final String BEGIN = "begin";
|
||||
|
||||
public static final String EDIT_SHEET_NAME = "edit";
|
||||
public static final String EDIT_CONTACT_SHEET_NAME = "edit";
|
||||
|
||||
public static final String EDIT_DESC_SHEET_NAME = "editProjectDesc";
|
||||
|
||||
public static final String EDIT_DESC_TEXT_SHEET_NAME = "editProjectDescText";
|
||||
|
||||
public static final String UPLOAD_DESC_TEXT_SHEET_NAME
|
||||
= "uploadProjectDescText";
|
||||
|
||||
public static final String END = "end";
|
||||
|
||||
|
|
@ -23,6 +30,8 @@ public final class SciProjectUiConstants {
|
|||
|
||||
public static final String PROJECT_SHORT_DESCRIPTION = "shortDescription";
|
||||
|
||||
public static final String PROJECT_DESCRIPTION = "description";
|
||||
|
||||
public static final String TITLE = "title";
|
||||
|
||||
private SciProjectUiConstants() {
|
||||
|
|
|
|||
|
|
@ -17,10 +17,16 @@ import org.libreccm.configuration.Setting;
|
|||
@Configuration
|
||||
public class SciProjectConfig {
|
||||
|
||||
@Setting()
|
||||
@Setting
|
||||
private String contactTypesBundleName
|
||||
= "org.scientificcms.contenttypes.sciproject.DefaultContactTypes";
|
||||
|
||||
@Setting
|
||||
private boolean enableSponsor = true;
|
||||
|
||||
@Setting
|
||||
private boolean enableFunding = true;
|
||||
|
||||
public static SciProjectConfig getConfig() {
|
||||
final ConfigurationManager confManager = CdiUtil.createCdiUtil()
|
||||
.findBean(ConfigurationManager.class);
|
||||
|
|
@ -39,4 +45,22 @@ public class SciProjectConfig {
|
|||
this.contactTypesBundleName = contactTypesBundle;
|
||||
}
|
||||
|
||||
public boolean isEnableSponsor() {
|
||||
return enableSponsor;
|
||||
}
|
||||
|
||||
public void setEnableSponsor(final boolean enableSponsor) {
|
||||
this.enableSponsor = enableSponsor;
|
||||
}
|
||||
|
||||
public boolean isEnableFunding() {
|
||||
return enableFunding;
|
||||
}
|
||||
|
||||
public void setEnableFunding(final boolean enableFunding) {
|
||||
this.enableFunding = enableFunding;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue