SciProject: Für Anfangs- und Enddatum eines Projektes jetzt auch unvollständige Datumsangaben (z.B. nur das Jahr oder nur
Jahr und Monat) verwendet werden. git-svn-id: https://svn.libreccm.org/ccm/trunk@1206 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
de2f262c22
commit
1e6abe269d
|
|
@ -5,8 +5,12 @@ import com.arsdigita.cms.*;
|
||||||
|
|
||||||
object type SciProject extends GenericOrganizationalUnit {
|
object type SciProject extends GenericOrganizationalUnit {
|
||||||
|
|
||||||
Date[0..1] projectbegin = ct_sci_projects.projectbegin DATE;
|
Date[0..1] projectBegin = ct_sci_projects.projectbegin DATE;
|
||||||
Date[0..1] projectend = ct_sci_projects.projectend DATE;
|
Boolean[0..1] projectBeginSkipMonth = ct_sci_projects.projectbegin_skip_month;
|
||||||
|
Boolean[0..1] projectBeginSkipDay = ct_sci_projects.projectbegin_skip_day;
|
||||||
|
Date[0..1] projectEnd = ct_sci_projects.projectend DATE;
|
||||||
|
Boolean[0..1] projectEndSkipMonth = ct_sci_projects.projectend_skip_month;
|
||||||
|
Boolean[0..1] projectEndSkipDay = ct_sci_projects.projectend_skip_day;
|
||||||
String[0..1] projectShortDesc = ct_sci_projects.shortdesc VARCHAR(5000);
|
String[0..1] projectShortDesc = ct_sci_projects.shortdesc VARCHAR(5000);
|
||||||
String[0..1] projectDescription = ct_sci_projects.description CLOB;
|
String[0..1] projectDescription = ct_sci_projects.description CLOB;
|
||||||
String[0..1] funding = ct_sci_projects.funding CLOB;
|
String[0..1] funding = ct_sci_projects.funding CLOB;
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,12 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class SciProject extends GenericOrganizationalUnit {
|
public class SciProject extends GenericOrganizationalUnit {
|
||||||
|
|
||||||
public static final String BEGIN = "projectbegin";
|
public static final String BEGIN = "projectBegin";
|
||||||
public static final String END = "projectend";
|
public static final String BEGIN_SKIP_MONTH = "projectBeginSkipMonth";
|
||||||
|
public static final String BEGIN_SKIP_DAY = "projectBeginSkipDay";
|
||||||
|
public static final String END = "projectEnd";
|
||||||
|
public static final String END_SKIP_MONTH = "projectEndSkipMonth";
|
||||||
|
public static final String END_SKIP_DAY = "projectEndSkipDay";
|
||||||
public static final String PROJECT_SHORT_DESCRIPTION = "projectShortDesc";
|
public static final String PROJECT_SHORT_DESCRIPTION = "projectShortDesc";
|
||||||
public static final String PROJECT_DESCRIPTION = "projectDescription";
|
public static final String PROJECT_DESCRIPTION = "projectDescription";
|
||||||
public static final String FUNDING = "funding";
|
public static final String FUNDING = "funding";
|
||||||
|
|
@ -87,6 +91,32 @@ public class SciProject extends GenericOrganizationalUnit {
|
||||||
public void setBegin(Date begin) {
|
public void setBegin(Date begin) {
|
||||||
set(BEGIN, begin);
|
set(BEGIN, begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getBeginSkipMonth() {
|
||||||
|
final Object value = get(BEGIN_SKIP_MONTH);
|
||||||
|
if (value == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeginSkipMonth(final Boolean skipMonth) {
|
||||||
|
set(BEGIN_SKIP_MONTH, skipMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getBeginSkipDay() {
|
||||||
|
final Object value = get(BEGIN_SKIP_DAY);
|
||||||
|
if (value == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBeginSkipDay(final Boolean skipDay) {
|
||||||
|
set(BEGIN_SKIP_DAY, skipDay);
|
||||||
|
}
|
||||||
|
|
||||||
public Date getEnd() {
|
public Date getEnd() {
|
||||||
return (Date) get(END);
|
return (Date) get(END);
|
||||||
|
|
@ -95,6 +125,32 @@ public class SciProject extends GenericOrganizationalUnit {
|
||||||
public void setEnd(Date end) {
|
public void setEnd(Date end) {
|
||||||
set(END, end);
|
set(END, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean getEndSkipMonth() {
|
||||||
|
final Object value = get(END_SKIP_MONTH);
|
||||||
|
if (value == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndSkipMonth(final Boolean skipMonth) {
|
||||||
|
set(END_SKIP_MONTH, skipMonth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getEndSkipDay() {
|
||||||
|
final Object value = get(END_SKIP_DAY);
|
||||||
|
if (value == null) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return (Boolean) value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEndSkipDay(final Boolean skipDay) {
|
||||||
|
set(END_SKIP_DAY, skipDay);
|
||||||
|
}
|
||||||
|
|
||||||
public String getProjectShortDescription() {
|
public String getProjectShortDescription() {
|
||||||
return (String) get(PROJECT_SHORT_DESCRIPTION);
|
return (String) get(PROJECT_SHORT_DESCRIPTION);
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,13 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||||
import com.arsdigita.domain.DomainObject;
|
import com.arsdigita.domain.DomainObject;
|
||||||
|
import com.arsdigita.globalization.GlobalizationHelper;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
|
import java.text.DateFormatSymbols;
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.GregorianCalendar;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -44,6 +49,27 @@ public class SciProjectPropertiesStep
|
||||||
if (project.getBegin() == null) {
|
if (project.getBegin() == null) {
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
return (String) ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown").localize();
|
"cms.ui.unknown").localize();
|
||||||
|
} else if (project.getBeginSkipMonth()
|
||||||
|
|| project.getBeginSkipDay()) {
|
||||||
|
String month = "";
|
||||||
|
final Calendar begin = new GregorianCalendar();
|
||||||
|
begin.setTime(project.getBegin());
|
||||||
|
if (!project.getBeginSkipMonth()) {
|
||||||
|
final Locale locale = GlobalizationHelper.
|
||||||
|
getNegotiatedLocale();
|
||||||
|
if (locale != null) {
|
||||||
|
final DateFormatSymbols dfs = new DateFormatSymbols(
|
||||||
|
locale);
|
||||||
|
String[] months = dfs.getMonths();
|
||||||
|
month = String.format("%s ",
|
||||||
|
months[begin.get(
|
||||||
|
Calendar.MONTH)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String.format("%s %s",
|
||||||
|
month,
|
||||||
|
Integer.toString(begin.get(
|
||||||
|
Calendar.YEAR)));
|
||||||
} else {
|
} else {
|
||||||
return DateFormat.getDateInstance(DateFormat.LONG).format(
|
return DateFormat.getDateInstance(DateFormat.LONG).format(
|
||||||
project.getBegin());
|
project.getBegin());
|
||||||
|
|
@ -61,6 +87,27 @@ public class SciProjectPropertiesStep
|
||||||
if (project.getEnd() == null) {
|
if (project.getEnd() == null) {
|
||||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
return (String) ContenttypesGlobalizationUtil.globalize(
|
||||||
"cms.ui.unknown").localize();
|
"cms.ui.unknown").localize();
|
||||||
|
} else if (project.getEndSkipMonth()
|
||||||
|
|| project.getEndSkipDay()) {
|
||||||
|
String month = "";
|
||||||
|
final Calendar end = new GregorianCalendar();
|
||||||
|
end.setTime(project.getEnd());
|
||||||
|
if (!project.getEndSkipMonth()) {
|
||||||
|
final Locale locale = GlobalizationHelper.
|
||||||
|
getNegotiatedLocale();
|
||||||
|
if (locale != null) {
|
||||||
|
final DateFormatSymbols dfs = new DateFormatSymbols(
|
||||||
|
locale);
|
||||||
|
String[] months = dfs.getMonths();
|
||||||
|
month = String.format("%s ",
|
||||||
|
months[end.get(
|
||||||
|
Calendar.MONTH)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return String.format("%s %s",
|
||||||
|
month,
|
||||||
|
Integer.toString(end.get(
|
||||||
|
Calendar.YEAR)));
|
||||||
} else {
|
} else {
|
||||||
return DateFormat.getDateInstance(DateFormat.LONG).format(project.
|
return DateFormat.getDateInstance(DateFormat.LONG).format(project.
|
||||||
getEnd());
|
getEnd());
|
||||||
|
|
@ -82,8 +129,9 @@ public class SciProjectPropertiesStep
|
||||||
parent,
|
parent,
|
||||||
EDIT_SHEET_NAME);
|
EDIT_SHEET_NAME);
|
||||||
|
|
||||||
final BasicPageForm editBasicSheet = new SciProjectPropertyForm(itemModel,
|
final BasicPageForm editBasicSheet = new SciProjectPropertyForm(
|
||||||
this);
|
itemModel,
|
||||||
|
this);
|
||||||
|
|
||||||
basicProperties.add(EDIT_SHEET_NAME,
|
basicProperties.add(EDIT_SHEET_NAME,
|
||||||
(String) SciProjectGlobalizationUtil.globalize(
|
(String) SciProjectGlobalizationUtil.globalize(
|
||||||
|
|
@ -109,7 +157,7 @@ public class SciProjectPropertiesStep
|
||||||
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
|
||||||
parent),
|
parent),
|
||||||
SciProjectGlobalizationUtil.globalize("sciproject.ui.contacts"));
|
SciProjectGlobalizationUtil.globalize("sciproject.ui.contacts"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,9 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
import com.arsdigita.bebop.form.Date;
|
import com.arsdigita.bebop.form.Date;
|
||||||
|
import com.arsdigita.bebop.form.Hidden;
|
||||||
import com.arsdigita.bebop.form.TextArea;
|
import com.arsdigita.bebop.form.TextArea;
|
||||||
|
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||||
import com.arsdigita.bebop.parameters.IncompleteDateParameter;
|
import com.arsdigita.bebop.parameters.IncompleteDateParameter;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
|
|
@ -48,17 +50,42 @@ public class SciProjectPropertyForm
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
|
final ParameterModel beginSkipMonthParam =
|
||||||
|
new BooleanParameter(SciProject.BEGIN_SKIP_MONTH);
|
||||||
|
final Hidden beginSkipMonth = new Hidden(beginSkipMonthParam);
|
||||||
|
add(beginSkipMonth);
|
||||||
|
|
||||||
|
final ParameterModel beginSkipDayParam =
|
||||||
|
new BooleanParameter(SciProject.BEGIN_SKIP_DAY);
|
||||||
|
final Hidden beginSkipDay = new Hidden(beginSkipDayParam);
|
||||||
|
add(beginSkipDay);
|
||||||
|
|
||||||
add(new Label(SciProjectGlobalizationUtil.globalize(
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
"sciproject.ui.begin")));
|
"sciproject.ui.begin")));
|
||||||
ParameterModel beginParam = new IncompleteDateParameter(SciProject.BEGIN);
|
final IncompleteDateParameter beginParam =
|
||||||
Calendar today = new GregorianCalendar();
|
new IncompleteDateParameter(SciProject.BEGIN);
|
||||||
Date begin = new Date(beginParam);
|
beginParam.allowSkipMonth(true);
|
||||||
|
beginParam.allowSkipDay(true);
|
||||||
|
final Calendar today = new GregorianCalendar();
|
||||||
|
final Date begin = new Date(beginParam);
|
||||||
begin.setYearRange(1970, (today.get(Calendar.YEAR) + 2));
|
begin.setYearRange(1970, (today.get(Calendar.YEAR) + 2));
|
||||||
add(begin);
|
add(begin);
|
||||||
|
|
||||||
|
final ParameterModel endSkipMonthParam =
|
||||||
|
new BooleanParameter(SciProject.END_SKIP_MONTH);
|
||||||
|
final Hidden endSkipMonth = new Hidden(endSkipMonthParam);
|
||||||
|
add(endSkipMonth);
|
||||||
|
|
||||||
|
final ParameterModel endSkipDayParam = new BooleanParameter(
|
||||||
|
SciProject.END_SKIP_DAY);
|
||||||
|
final Hidden endSkipDay = new Hidden(endSkipDayParam);
|
||||||
|
add(endSkipDay);
|
||||||
|
|
||||||
add(new Label(SciProjectGlobalizationUtil.globalize(
|
add(new Label(SciProjectGlobalizationUtil.globalize(
|
||||||
"sciproject.ui.end")));
|
"sciproject.ui.end")));
|
||||||
ParameterModel endParam = new IncompleteDateParameter(SciProject.END);
|
final IncompleteDateParameter endParam = new IncompleteDateParameter(SciProject.END);
|
||||||
|
endParam.allowSkipMonth(true);
|
||||||
|
endParam.allowSkipDay(true);
|
||||||
Date end = new Date(endParam);
|
Date end = new Date(endParam);
|
||||||
end.setYearRange(1970, (today.get(Calendar.YEAR) + 8));
|
end.setYearRange(1970, (today.get(Calendar.YEAR) + 8));
|
||||||
add(end);
|
add(end);
|
||||||
|
|
@ -84,7 +111,11 @@ public class SciProjectPropertyForm
|
||||||
final SciProject project = (SciProject) super.initBasicWidgets(fse);
|
final SciProject project = (SciProject) super.initBasicWidgets(fse);
|
||||||
|
|
||||||
data.put(SciProject.BEGIN, project.getBegin());
|
data.put(SciProject.BEGIN, project.getBegin());
|
||||||
|
data.put(SciProject.BEGIN_SKIP_MONTH, project.getBeginSkipMonth());
|
||||||
|
data.put(SciProject.BEGIN_SKIP_DAY, project.getBeginSkipDay());
|
||||||
data.put(SciProject.END, project.getEnd());
|
data.put(SciProject.END, project.getEnd());
|
||||||
|
data.put(SciProject.END_SKIP_MONTH, project.getEndSkipMonth());
|
||||||
|
data.put(SciProject.END_SKIP_DAY, project.getEndSkipDay());
|
||||||
data.put(SciProject.PROJECT_SHORT_DESCRIPTION,
|
data.put(SciProject.PROJECT_SHORT_DESCRIPTION,
|
||||||
project.getProjectShortDescription());
|
project.getProjectShortDescription());
|
||||||
}
|
}
|
||||||
|
|
@ -99,8 +130,19 @@ public class SciProjectPropertyForm
|
||||||
|
|
||||||
if ((project != null)
|
if ((project != null)
|
||||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||||
project.setBegin((java.util.Date) data.get(SciProject.BEGIN));
|
project.setBeginSkipMonth(((IncompleteDateParameter) data.
|
||||||
project.setEnd((java.util.Date) data.get(SciProject.END));
|
getParameter(SciProject.BEGIN).
|
||||||
|
getModel()).isMonthSkipped());
|
||||||
|
project.setBeginSkipDay(
|
||||||
|
((IncompleteDateParameter) data.getParameter(
|
||||||
|
SciProject.BEGIN).getModel()).isDaySkipped());
|
||||||
|
project.setBegin((java.util.Date) data.get(SciProject.BEGIN));
|
||||||
|
project.setEndSkipMonth(
|
||||||
|
((IncompleteDateParameter) data.getParameter(
|
||||||
|
SciProject.END).getModel()).isMonthSkipped());
|
||||||
|
project.setEndSkipDay(((IncompleteDateParameter) data.getParameter(
|
||||||
|
SciProject.END).getModel()).isDaySkipped());
|
||||||
|
project.setEnd((java.util.Date) data.get(SciProject.END));
|
||||||
project.setProjectShortDescription((String) data.get(
|
project.setProjectShortDescription((String) data.get(
|
||||||
SciProject.PROJECT_SHORT_DESCRIPTION));
|
SciProject.PROJECT_SHORT_DESCRIPTION));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,3 +84,4 @@ sciproject.ui.involved_orgas.delete.confirm=Are you sure to remove the selected
|
||||||
sciproject.ui.involved_orgas.title=Involved Organizations
|
sciproject.ui.involved_orgas.title=Involved Organizations
|
||||||
sciproject.ui.involved_orgas.description=Managed involved organizations
|
sciproject.ui.involved_orgas.description=Managed involved organizations
|
||||||
scidepartment.ui.superdepartment.add=Add superior department
|
scidepartment.ui.superdepartment.add=Add superior department
|
||||||
|
sciproject.ui.edit_basic_properties=Basic properties
|
||||||
|
|
|
||||||
|
|
@ -85,3 +85,4 @@ sciproject.ui.involved_orgas.delete.confirm=Sind Sie sicher, dass die die ausgew
|
||||||
sciproject.ui.involved_orgas.title=Beteiligte Organisationen
|
sciproject.ui.involved_orgas.title=Beteiligte Organisationen
|
||||||
sciproject.ui.involved_orgas.description=Verwalten von am Projekt beteiligten Organisationen
|
sciproject.ui.involved_orgas.description=Verwalten von am Projekt beteiligten Organisationen
|
||||||
scidepartment.ui.superdepartment.add=\u00dcbergeordnete Abteilung hinzuf\u00fcgen
|
scidepartment.ui.superdepartment.add=\u00dcbergeordnete Abteilung hinzuf\u00fcgen
|
||||||
|
sciproject.ui.edit_basic_properties=Basiseigenschaften
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue