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 {
|
||||
|
||||
Date[0..1] projectbegin = ct_sci_projects.projectbegin DATE;
|
||||
Date[0..1] projectend = ct_sci_projects.projectend DATE;
|
||||
Date[0..1] projectBegin = ct_sci_projects.projectbegin 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] projectDescription = ct_sci_projects.description CLOB;
|
||||
String[0..1] funding = ct_sci_projects.funding CLOB;
|
||||
|
|
|
|||
|
|
@ -41,8 +41,12 @@ import java.util.List;
|
|||
*/
|
||||
public class SciProject extends GenericOrganizationalUnit {
|
||||
|
||||
public static final String BEGIN = "projectbegin";
|
||||
public static final String END = "projectend";
|
||||
public static final String BEGIN = "projectBegin";
|
||||
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_DESCRIPTION = "projectDescription";
|
||||
public static final String FUNDING = "funding";
|
||||
|
|
@ -88,6 +92,32 @@ public class SciProject extends GenericOrganizationalUnit {
|
|||
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() {
|
||||
return (Date) get(END);
|
||||
}
|
||||
|
|
@ -96,6 +126,32 @@ public class SciProject extends GenericOrganizationalUnit {
|
|||
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() {
|
||||
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.workflow.WorkflowLockedComponentAccess;
|
||||
import com.arsdigita.domain.DomainObject;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
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) {
|
||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
||||
"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 {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG).format(
|
||||
project.getBegin());
|
||||
|
|
@ -61,6 +87,27 @@ public class SciProjectPropertiesStep
|
|||
if (project.getEnd() == null) {
|
||||
return (String) ContenttypesGlobalizationUtil.globalize(
|
||||
"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 {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG).format(project.
|
||||
getEnd());
|
||||
|
|
@ -82,8 +129,9 @@ public class SciProjectPropertiesStep
|
|||
parent,
|
||||
EDIT_SHEET_NAME);
|
||||
|
||||
final BasicPageForm editBasicSheet = new SciProjectPropertyForm(itemModel,
|
||||
this);
|
||||
final BasicPageForm editBasicSheet = new SciProjectPropertyForm(
|
||||
itemModel,
|
||||
this);
|
||||
|
||||
basicProperties.add(EDIT_SHEET_NAME,
|
||||
(String) SciProjectGlobalizationUtil.globalize(
|
||||
|
|
|
|||
|
|
@ -9,7 +9,9 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Date;
|
||||
import com.arsdigita.bebop.form.Hidden;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||
import com.arsdigita.bebop.parameters.IncompleteDateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||
|
|
@ -48,17 +50,42 @@ public class SciProjectPropertyForm
|
|||
public void 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(
|
||||
"sciproject.ui.begin")));
|
||||
ParameterModel beginParam = new IncompleteDateParameter(SciProject.BEGIN);
|
||||
Calendar today = new GregorianCalendar();
|
||||
Date begin = new Date(beginParam);
|
||||
final IncompleteDateParameter beginParam =
|
||||
new IncompleteDateParameter(SciProject.BEGIN);
|
||||
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));
|
||||
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(
|
||||
"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);
|
||||
end.setYearRange(1970, (today.get(Calendar.YEAR) + 8));
|
||||
add(end);
|
||||
|
|
@ -84,7 +111,11 @@ public class SciProjectPropertyForm
|
|||
final SciProject project = (SciProject) super.initBasicWidgets(fse);
|
||||
|
||||
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_SKIP_MONTH, project.getEndSkipMonth());
|
||||
data.put(SciProject.END_SKIP_DAY, project.getEndSkipDay());
|
||||
data.put(SciProject.PROJECT_SHORT_DESCRIPTION,
|
||||
project.getProjectShortDescription());
|
||||
}
|
||||
|
|
@ -99,7 +130,18 @@ public class SciProjectPropertyForm
|
|||
|
||||
if ((project != null)
|
||||
&& getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
project.setBeginSkipMonth(((IncompleteDateParameter) data.
|
||||
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(
|
||||
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.description=Managed involved organizations
|
||||
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.description=Verwalten von am Projekt beteiligten Organisationen
|
||||
scidepartment.ui.superdepartment.add=\u00dcbergeordnete Abteilung hinzuf\u00fcgen
|
||||
sciproject.ui.edit_basic_properties=Basiseigenschaften
|
||||
|
|
|
|||
Loading…
Reference in New Issue