Teil 2 Feintuning XML-Output
git-svn-id: https://svn.libreccm.org/ccm/trunk@1609 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
f5489167fc
commit
36b38964e1
|
|
@ -329,7 +329,7 @@ cms.ui.there_are_no_items=There are no items.
|
|||
cms.ui.there_was_no_one_matching_the_search_criteria=There was no one matching the search criteria.
|
||||
cms.ui.this_should_never_happen=This should never happen
|
||||
cms.ui.types=Content types
|
||||
cms.ui.unknown=<i>unknown</i>
|
||||
cms.ui.unknown=unknown
|
||||
cms.ui.upload_new_content=Upload new content
|
||||
cms.ui.use_custom_permissions=Use Custom Permissions
|
||||
cms.ui.user=User
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ cms.ui.there_are_no_items=Keine elemente vorhanden.
|
|||
cms.ui.there_was_no_one_matching_the_search_criteria=Kein Element erf\u00fcllte die Suchkriterien.
|
||||
cms.ui.this_should_never_happen=Dies sollte nie passieren\!
|
||||
cms.ui.types=Dokument Typen
|
||||
cms.ui.unknown=<i>unbekannt</i>
|
||||
cms.ui.unknown=unbekannt
|
||||
cms.ui.upload_new_content=Neuen Inhalt laden
|
||||
cms.ui.use_custom_permissions=Benutzerspezifische Rechte
|
||||
cms.ui.user=Benutzer
|
||||
|
|
|
|||
|
|
@ -27,7 +27,8 @@ object type Journal extends ContentPage {
|
|||
|
||||
Integer[0..1] firstYear = ct_journal.firstyear INTEGER;
|
||||
Integer[0..1] lastYear = ct_journal.lastyear INTEGER;
|
||||
String[0..1] issn = ct_journal.issn VARCHAR(9);
|
||||
String[0..1] issn = ct_journal.issn VARCHAR(9);
|
||||
String[0..1] abstract = ct_journal.abstract VARCHAR(4096);
|
||||
|
||||
reference key (ct_journal.journal_id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,8 +48,12 @@ association {
|
|||
to cms_person_bundles.bundle_id;
|
||||
|
||||
// Additional attributes for the editship
|
||||
Date[0..1] dateFrom = ct_series_editship.dateFrom DATE;
|
||||
Date[0..1] dateTo = ct_series_editship.dateTo DATE;
|
||||
Date[0..1] dateFrom = ct_series_editship.date_from DATE;
|
||||
Boolean[0..1] dateFromSkipMonth = ct_series_editship.date_from_skip_month;
|
||||
Boolean[0..1] dateFromSkipDay = ct_series_editship.date_from_skip_day;
|
||||
Date[0..1] dateTo = ct_series_editship.date_to DATE;
|
||||
Boolean[0..1] dateToSkipMonth = ct_series_editship.date_to_skip_month;
|
||||
Boolean[0..1] dateToSkipDay = ct_series_editship.date_to_skip_day;
|
||||
|
||||
//Sorting is first done by the period defined by from and to,
|
||||
//and secondly by the following order attribute
|
||||
|
|
|
|||
|
|
@ -33,9 +33,17 @@ import org.apache.log4j.Logger;
|
|||
public class EditshipCollection extends DomainCollection {
|
||||
|
||||
public static final String LINK_FROM = "link.dateFrom";
|
||||
public static final String LINK_FROM_SKIP_MONTH = "link.dateFromSkipMonth";
|
||||
public static final String LINK_FROM_SKIP_DAY = "link.dateFromSkipDay";
|
||||
public static final String LINK_TO = "link.dateTo";
|
||||
public static final String LINK_TO_SKIP_MONTH = "link.dateToSkipMonth";
|
||||
public static final String LINK_TO_SKIP_DAY = "link.dateToSkipDay";
|
||||
public static final String FROM = "dateFrom";
|
||||
public static final String FROM_SKIP_MONTH = "dateFromSkipMonth";
|
||||
public static final String FROM_SKIP_DAY = "dateFromSkipDay";
|
||||
public static final String TO = "dateTo";
|
||||
public static final String TO_SKIP_MONTH = "dateToSkipMonth";
|
||||
public static final String TO_SKIP_DAY = "dateToSkipDay";
|
||||
public static final String LINKORDER = "link.editor_order";
|
||||
public static final String ORDER = "editor_order";
|
||||
private final static Logger s_log =
|
||||
|
|
@ -50,22 +58,57 @@ public class EditshipCollection extends DomainCollection {
|
|||
public Date getFrom() {
|
||||
return (Date) m_dataCollection.get(LINK_FROM);
|
||||
}
|
||||
|
||||
public Boolean getFromSkipMonth() {
|
||||
return (Boolean) m_dataCollection.get(LINK_FROM_SKIP_MONTH);
|
||||
}
|
||||
|
||||
public Boolean getFromSkipDay() {
|
||||
return (Boolean) m_dataCollection.get(LINK_FROM_SKIP_DAY);
|
||||
}
|
||||
|
||||
public void setFrom(Date from) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
final DataObject link = (DataObject) get("link");
|
||||
link.set(FROM, from);
|
||||
}
|
||||
|
||||
public void setFromSkipMonth(final Boolean skipMonth) {
|
||||
final DataObject link = (DataObject) get("link");
|
||||
link.set(FROM_SKIP_MONTH, skipMonth);
|
||||
}
|
||||
|
||||
public void setFromSkipDay(final Boolean skipDay) {
|
||||
final DataObject link = (DataObject) get("link");
|
||||
link.set(FROM_SKIP_DAY, skipDay);
|
||||
}
|
||||
|
||||
public Date getTo() {
|
||||
return (Date) m_dataCollection.get(LINK_TO);
|
||||
}
|
||||
|
||||
public Boolean getToSkipMonth() {
|
||||
return (Boolean) m_dataCollection.get(LINK_TO_SKIP_MONTH);
|
||||
}
|
||||
|
||||
public Boolean getToSkipDay() {
|
||||
return (Boolean) m_dataCollection.get(LINK_TO_SKIP_DAY);
|
||||
}
|
||||
|
||||
public void setTo(Date to) {
|
||||
DataObject link = (DataObject) this.get("link");
|
||||
|
||||
link.set(TO, to);
|
||||
}
|
||||
|
||||
public void setToSkipMonth(final Boolean skipMonth) {
|
||||
final DataObject link = (DataObject) get("link");
|
||||
link.set(TO_SKIP_MONTH, skipMonth);
|
||||
}
|
||||
|
||||
public void setToSkipDay(final Boolean skipDay) {
|
||||
final DataObject link = (DataObject) get("link");
|
||||
link.set(TO_SKIP_DAY, skipDay);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the order attribute for the current association.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class Journal extends ContentPage {
|
|||
public static final String ISSN = "issn";
|
||||
public static final String FIRST_YEAR = "firstYear";
|
||||
public static final String LAST_YEAR = "lastYear";
|
||||
public static final String ABSTRACT = "abstract";
|
||||
public static final String ARTICLES = "articles";
|
||||
public static final String ARTICLE_ORDER = "articleOrder";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
|
|
@ -91,6 +92,14 @@ public class Journal extends ContentPage {
|
|||
set(LAST_YEAR, lastYear);
|
||||
}
|
||||
|
||||
public String getAbstract() {
|
||||
return (String) get(ABSTRACT);
|
||||
}
|
||||
|
||||
public void setAbstract(final String abstractStr) {
|
||||
set(ABSTRACT, abstractStr);
|
||||
}
|
||||
|
||||
public ArticleInJournalCollection getArticles() {
|
||||
//return new ArticleInJournalCollection((DataCollection) get(ARTICLES));
|
||||
return getJournalBundle().getArticles();
|
||||
|
|
|
|||
|
|
@ -19,13 +19,14 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentPage;
|
||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||
import com.arsdigita.cms.contenttypes.ui.SeriesExtraXmlGenerator;
|
||||
import com.arsdigita.domain.DataObjectNotFoundException;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
import com.arsdigita.persistence.OID;
|
||||
import com.arsdigita.util.Assert;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -75,27 +76,27 @@ public class Series extends ContentPage {
|
|||
return (SeriesBundle) getContentBundle();
|
||||
}
|
||||
|
||||
public EditshipCollection getEditors() {
|
||||
//return new EditshipCollection((DataCollection) get(EDITORS));
|
||||
public EditshipCollection getEditors() {
|
||||
return getSeriesBundle().getEditors();
|
||||
}
|
||||
|
||||
public void addEditor(final GenericPerson editor,
|
||||
final Date from,
|
||||
final Date to) {
|
||||
// Assert.exists(editor, GenericPerson.class);
|
||||
//
|
||||
// DataObject link = add(EDITORS, editor);
|
||||
// link.set(EDITOR_FROM, from);
|
||||
// link.set(EDITOR_TO, to);
|
||||
// link.set(EDITOR_ORDER, Integer.valueOf((int)getEditors().size()));
|
||||
|
||||
getSeriesBundle().addEditor(editor, from, to);
|
||||
public void addEditor(final GenericPerson editor,
|
||||
final Date from,
|
||||
final Boolean fromSkipMonth,
|
||||
final Boolean fromSkipDay,
|
||||
final Date to,
|
||||
final Boolean toSkipMonth,
|
||||
final Boolean toSkipDay) {
|
||||
getSeriesBundle().addEditor(editor,
|
||||
from,
|
||||
fromSkipMonth,
|
||||
fromSkipDay,
|
||||
to,
|
||||
toSkipMonth,
|
||||
toSkipDay);
|
||||
}
|
||||
|
||||
public void removeEditor(final GenericPerson editor) {
|
||||
//Assert.exists(editor, GenericPerson.class);
|
||||
//remove(EDITORS, editor);
|
||||
public void removeEditor(final GenericPerson editor) {
|
||||
getSeriesBundle().removeEditor(editor);
|
||||
}
|
||||
|
||||
|
|
@ -103,28 +104,35 @@ public class Series extends ContentPage {
|
|||
return !this.getEditors().isEmpty();
|
||||
}
|
||||
|
||||
public VolumeInSeriesCollection getVolumes() {
|
||||
//return new VolumeInSeriesCollection((DataCollection) get(PUBLICATIONS));
|
||||
public VolumeInSeriesCollection getVolumes() {
|
||||
return getSeriesBundle().getVolumes();
|
||||
}
|
||||
|
||||
public void addVolume(final Publication publication, final Integer volume) {
|
||||
// Assert.exists(publication, Publication.class);
|
||||
//
|
||||
// DataObject link = add(PUBLICATIONS, publication);
|
||||
//
|
||||
// link.set(VOLUME_OF_SERIES, volume);
|
||||
getSeriesBundle().addVolume(publication, volume);
|
||||
}
|
||||
|
||||
public void removeVolume(final Publication publication) {
|
||||
//Assert.exists(publication, Publication.class);
|
||||
//remove(PUBLICATIONS, publication);
|
||||
public void removeVolume(final Publication publication) {
|
||||
getSeriesBundle().removeVolume(publication);
|
||||
}
|
||||
|
||||
public boolean hasVolumes() {
|
||||
return !this.getVolumes().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExtraXMLGenerator> getExtraXMLGenerators() {
|
||||
final List<ExtraXMLGenerator> generators = super.getExtraXMLGenerators();
|
||||
generators.add(new SeriesExtraXmlGenerator());
|
||||
return generators;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
||||
final ExtraXMLGenerator generator = new SeriesExtraXmlGenerator();
|
||||
generator.setListMode(true);
|
||||
return generators;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ public class SeriesBundle extends ContentBundle {
|
|||
public static final String EDITORS = "editors";
|
||||
public static final String EDITOR_FROM = "dateFrom";
|
||||
public static final String EDITOR_TO = "dateTo";
|
||||
public static final String EDITOR_FROM_SKIP_MONTH = "dateFromSkipMonth";
|
||||
public static final String EDITOR_FROM_SKIP_DAY = "dateFromSkipDay";
|
||||
public static final String EDITOR_TO_SKIP_MONTH = "dateToSkipMonth";
|
||||
public static final String EDITOR_TO_SKIP_DAY = "dateToSkipDay";
|
||||
public static final String EDITOR_ORDER = "editor_order";
|
||||
public static final String PUBLICATIONS = "publications";
|
||||
public static final String VOLUME_OF_SERIES = "volumeOfSeries";
|
||||
|
|
@ -106,7 +110,15 @@ public class SeriesBundle extends ContentBundle {
|
|||
final DataObject link = add(EDITORS, livePerson);
|
||||
|
||||
link.set(EDITOR_FROM, editors.get("link." + EDITOR_FROM));
|
||||
link.set(EDITOR_FROM_SKIP_MONTH,
|
||||
editors.get("link." + EDITOR_FROM_SKIP_MONTH));
|
||||
link.set(EDITOR_FROM_SKIP_DAY,
|
||||
editors.get("link." + EDITOR_FROM_SKIP_DAY));
|
||||
link.set(EDITOR_TO, editors.get("link." + EDITOR_TO));
|
||||
link.set(EDITOR_TO_SKIP_MONTH,
|
||||
editors.get("link." + EDITOR_TO_SKIP_MONTH));
|
||||
link.set(EDITOR_TO_SKIP_DAY,
|
||||
editors.get("link." + EDITOR_TO_SKIP_DAY));
|
||||
link.set(EDITOR_ORDER, editors.get("link." + EDITOR_ORDER));
|
||||
|
||||
link.save();
|
||||
|
|
@ -175,7 +187,15 @@ public class SeriesBundle extends ContentBundle {
|
|||
final DataObject link = editor.add("series", liveSeries);
|
||||
|
||||
link.set(EDITOR_FROM, series.get("link." + EDITOR_FROM));
|
||||
link.set(EDITOR_FROM_SKIP_MONTH,
|
||||
series.get("link." + EDITOR_FROM_SKIP_MONTH));
|
||||
link.set(EDITOR_FROM_SKIP_DAY,
|
||||
series.get("link." + EDITOR_FROM_SKIP_DAY));
|
||||
link.set(EDITOR_TO, series.get("link." + EDITOR_TO));
|
||||
link.set(EDITOR_TO_SKIP_MONTH,
|
||||
series.get("link." + EDITOR_TO_SKIP_MONTH));
|
||||
link.set(EDITOR_TO_SKIP_DAY,
|
||||
series.get("link." + EDITOR_TO_SKIP_DAY));
|
||||
link.set(EDITOR_ORDER, series.get("link." + EDITOR_ORDER));
|
||||
|
||||
link.save();
|
||||
|
|
@ -188,13 +208,21 @@ public class SeriesBundle extends ContentBundle {
|
|||
|
||||
public void addEditor(final GenericPerson editor,
|
||||
final Date from,
|
||||
final Date to) {
|
||||
final Boolean fromSkipMonth,
|
||||
final Boolean fromSkipDay,
|
||||
final Date to,
|
||||
final Boolean toSkipMonth,
|
||||
final Boolean toSkipDay) {
|
||||
Assert.exists(editor, GenericPerson.class);
|
||||
|
||||
final DataObject link = add(EDITORS, editor.getGenericPersonBundle());
|
||||
|
||||
link.set(EDITOR_FROM, from);
|
||||
link.set(EDITOR_FROM_SKIP_MONTH, fromSkipMonth);
|
||||
link.set(EDITOR_FROM_SKIP_DAY, fromSkipDay);
|
||||
link.set(EDITOR_TO, to);
|
||||
link.set(EDITOR_TO_SKIP_MONTH, toSkipMonth);
|
||||
link.set(EDITOR_TO_SKIP_DAY, toSkipDay);
|
||||
link.set(EDITOR_ORDER, Integer.valueOf((int) getEditors().size()));
|
||||
|
||||
link.save();
|
||||
|
|
@ -209,8 +237,8 @@ public class SeriesBundle extends ContentBundle {
|
|||
public VolumeInSeriesCollection getVolumes() {
|
||||
return new VolumeInSeriesCollection((DataCollection) get(PUBLICATIONS));
|
||||
}
|
||||
|
||||
public void addVolume(final Publication publication,
|
||||
|
||||
public void addVolume(final Publication publication,
|
||||
final Integer volume) {
|
||||
Assert.exists(publication, Publication.class);
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public class UnPublishedBundle extends PublicationBundle {
|
|||
if (orgaunitLive != null) {
|
||||
final DataObject link = add(ORGANIZATION, orgaunitLive);
|
||||
|
||||
link.set("orgaOrder", link.get("link.orgaOrder"));
|
||||
link.set("orgaOrder", 1);
|
||||
|
||||
link.save();
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ public class UnPublishedBundle extends PublicationBundle {
|
|||
final DataObject link = orgaBundle.add("unPublished",
|
||||
liveUnPublished);
|
||||
|
||||
link.set("orgaOrder", publications.get("link.orderOrder"));
|
||||
link.set("orgaOrder", 1);
|
||||
|
||||
link.save();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,6 +84,10 @@ public class JournalPropertiesStep extends SimpleEditStep {
|
|||
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.lastYearOfPublication"),
|
||||
Journal.LAST_YEAR);
|
||||
|
||||
sheet.add(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.abstract"),
|
||||
Journal.ABSTRACT);
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(ContenttypesGlobalizationUtil.globalize(
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import com.arsdigita.bebop.event.FormSectionEvent;
|
|||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.event.ParameterEvent;
|
||||
import com.arsdigita.bebop.event.ParameterListener;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.IntegerParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterData;
|
||||
|
|
@ -47,50 +48,50 @@ public class JournalPropertyForm
|
|||
implements FormProcessListener,
|
||||
FormInitListener,
|
||||
FormSubmissionListener {
|
||||
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(JournalPropertyForm.class);
|
||||
private JournalPropertiesStep m_step;
|
||||
public static final String ID = "JournalEdit";
|
||||
|
||||
|
||||
public JournalPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
|
||||
public JournalPropertyForm(ItemSelectionModel itemModel,
|
||||
JournalPropertiesStep step) {
|
||||
super(ID, itemModel);
|
||||
m_step = step;
|
||||
addSubmissionListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.issn").localize()));
|
||||
ParameterModel issnParam = new StringParameter(Journal.ISSN);
|
||||
TextField issn = new TextField(issnParam);
|
||||
issn.addValidationListener(new ParameterListener() {
|
||||
|
||||
|
||||
public void validate(ParameterEvent event) throws
|
||||
FormProcessException {
|
||||
ParameterData data = event.getParameterData();
|
||||
String value = (String) data.getValue();
|
||||
|
||||
|
||||
if (value.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
value = value.replace("-", "");
|
||||
|
||||
|
||||
if (value.length() != 8) {
|
||||
data.invalidate();
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.invalid_issn"));
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Long num = Long.parseLong(value);
|
||||
} catch (NumberFormatException ex) {
|
||||
|
|
@ -101,52 +102,64 @@ public class JournalPropertyForm
|
|||
}
|
||||
});
|
||||
add(issn);
|
||||
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.firstYearOfPublication").localize()));
|
||||
ParameterModel firstYearParam = new IntegerParameter(Journal.FIRST_YEAR);
|
||||
TextField firstYear = new TextField(firstYearParam);
|
||||
add(firstYear);
|
||||
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.lastYearOfPublication").localize()));
|
||||
ParameterModel lastYearParam = new IntegerParameter(Journal.LAST_YEAR);
|
||||
TextField lastYear = new TextField(lastYearParam);
|
||||
add(lastYear);
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.journal.abstract").localize()));
|
||||
ParameterModel abstractParam = new StringParameter(Journal.ABSTRACT);
|
||||
TextArea abstractArea = new TextArea(abstractParam);
|
||||
abstractArea.setCols(60);
|
||||
abstractArea.setRows(18);
|
||||
add(abstractArea);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
public void init(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
Journal journal = (Journal) super.initBasicWidgets(fse);
|
||||
|
||||
|
||||
data.put(Journal.ISSN, journal.getISSN());
|
||||
data.put(Journal.FIRST_YEAR, journal.getFirstYear());
|
||||
data.put(Journal.LAST_YEAR, journal.getLastYear());
|
||||
data.put(Journal.ABSTRACT, journal.getAbstract());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
public void process(FormSectionEvent fse) throws FormProcessException {
|
||||
FormData data = fse.getFormData();
|
||||
Journal journal = (Journal) super.processBasicWidgets(fse);
|
||||
|
||||
|
||||
if ((journal != null) && getSaveCancelSection().getSaveButton().
|
||||
isSelected(fse.getPageState())) {
|
||||
|
||||
|
||||
String issn = (String) data.get(Journal.ISSN);
|
||||
issn = issn.replace("-", "");
|
||||
journal.setISSN(issn);
|
||||
|
||||
|
||||
Integer firstYear = (Integer) data.get(Journal.FIRST_YEAR);
|
||||
journal.setFirstYear(firstYear);
|
||||
|
||||
|
||||
Integer lastYear = (Integer) data.get(Journal.LAST_YEAR);
|
||||
journal.setLastYear(lastYear);
|
||||
|
||||
String abstractStr = (String) data.get(Journal.ABSTRACT);
|
||||
journal.setAbstract(abstractStr);
|
||||
|
||||
journal.save();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void submitted(FormSectionEvent fse) throws FormProcessException {
|
||||
if ((m_step != null) && getSaveCancelSection().getCancelButton().
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public class ProceedingsExtraXmlGenerator implements ExtraXMLGenerator {
|
|||
if (organizer != null) {
|
||||
final XmlGenerator generator = new XmlGenerator(organizer);
|
||||
generator.setItemElemName("organizer", "");
|
||||
generator.setListMode(true);
|
||||
generator.generateXML(state, parent, "");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,15 +20,16 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
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.cms.contenttypes.GenericPerson;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class PublicationAuthorsPropertyStep extends SimpleEditStep {
|
||||
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ public class PublicationAuthorsTable
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Publication publication = (Publication) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
|
|
@ -314,7 +314,7 @@ public class PublicationAuthorsTable
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Publication publication = (Publication) m_itemModel.
|
||||
getSelectedObject(state);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,12 +40,14 @@ public class PublicationExtraXmlGenerator implements ExtraXMLGenerator {
|
|||
final Publication publication = (Publication) item;
|
||||
createAuthorsXml(publication, element, state);
|
||||
createOrgaUnitsXml(publication, element, state);
|
||||
createSeriesXml(publication, element, state);
|
||||
|
||||
final List<PublicationFormat> formats = SciPublicationsExporters.
|
||||
getInstance().getSupportedFormats();
|
||||
|
||||
if (!listMode) {
|
||||
createSeriesXml(publication, element, state);
|
||||
|
||||
final List<PublicationFormat> formats = SciPublicationsExporters.
|
||||
getInstance().getSupportedFormats();
|
||||
|
||||
|
||||
for (PublicationFormat format : formats) {
|
||||
createExportLink(format, element, (Publication) item, state);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -389,3 +389,7 @@ publication.ui.series.volumes.remove=Remove volume
|
|||
publications.ui.journal.firstYearOfPublication=First year of publication
|
||||
publications.ui.journal.edit_basic_sheet\ =Basic properties
|
||||
publications.ui.journal.edit_basic_sheet=Edit basic properties
|
||||
publications.ui.journal.abstract=Short description of the Journal
|
||||
publications.ui.journal_properties.title=Basic properties
|
||||
publications.ui.proceedings_properties.title=Basic properties
|
||||
publications.ui.series.volumes.edit_assoc=Edit
|
||||
|
|
|
|||
|
|
@ -388,3 +388,7 @@ publication.ui.series.volumes.remove=Band entfernen
|
|||
publications.ui.journal.firstYearOfPublication=Erstes Erscheinungsjahr
|
||||
publications.ui.journal.edit_basic_sheet\ =Basiseigenschaften
|
||||
publications.ui.journal.edit_basic_sheet=Basiseigenschaften bearbeiten
|
||||
publications.ui.journal.abstract=Kurze Beschreibung der Zeitschrift
|
||||
publications.ui.journal_properties.title=Basiseigenschaften
|
||||
publications.ui.proceedings_properties.title=Basiseigenschaften
|
||||
publications.ui.series.volumes.edit_assoc=Bearbeiten
|
||||
|
|
|
|||
|
|
@ -26,7 +26,10 @@ import com.arsdigita.bebop.PageState;
|
|||
import com.arsdigita.bebop.SaveCancelSection;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.Hidden;
|
||||
import com.arsdigita.bebop.parameters.BooleanParameter;
|
||||
import com.arsdigita.bebop.parameters.DateParameter;
|
||||
import com.arsdigita.bebop.parameters.IncompleteDateParameter;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
|
@ -35,7 +38,6 @@ import com.arsdigita.cms.contenttypes.GenericPerson;
|
|||
import com.arsdigita.cms.contenttypes.Series;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
|
|
@ -80,18 +82,49 @@ public class SeriesEditshipAddForm
|
|||
selectedEditorLabel = new Label("");
|
||||
add(selectedEditorLabel);
|
||||
|
||||
final ParameterModel fromSkipMonthParam =
|
||||
new BooleanParameter(
|
||||
EditshipCollection.FROM_SKIP_MONTH);
|
||||
Hidden fromSkipMonth = new Hidden(fromSkipMonthParam);
|
||||
add(fromSkipMonth);
|
||||
|
||||
final ParameterModel fromSkipDayParam =
|
||||
new BooleanParameter(
|
||||
EditshipCollection.FROM_SKIP_DAY);
|
||||
Hidden fromSkipDay = new Hidden(fromSkipDayParam);
|
||||
add(fromSkipDay);
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.from").localize()));
|
||||
ParameterModel fromParam = new DateParameter(EditshipCollection.FROM);
|
||||
IncompleteDateParameter fromParam =
|
||||
new IncompleteDateParameter(
|
||||
EditshipCollection.FROM);
|
||||
fromParam.allowSkipDay(true);
|
||||
fromParam.allowSkipMonth(true);
|
||||
com.arsdigita.bebop.form.Date from = new com.arsdigita.bebop.form.Date(
|
||||
fromParam);
|
||||
Calendar today = new GregorianCalendar();
|
||||
from.setYearRange(1900, today.get(Calendar.YEAR));
|
||||
add(from);
|
||||
|
||||
final ParameterModel toSkipMonthParam =
|
||||
new BooleanParameter(
|
||||
EditshipCollection.TO_SKIP_MONTH);
|
||||
Hidden toSkipMonth = new Hidden(toSkipMonthParam);
|
||||
add(toSkipMonth);
|
||||
|
||||
final ParameterModel toSkipDayParam =
|
||||
new BooleanParameter(EditshipCollection.TO_SKIP_DAY);
|
||||
Hidden toSkipDay = new Hidden(toSkipDayParam);
|
||||
add(toSkipDay);
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.to").localize()));
|
||||
ParameterModel toParam = new DateParameter(EditshipCollection.TO);
|
||||
IncompleteDateParameter toParam =
|
||||
new IncompleteDateParameter(
|
||||
EditshipCollection.TO);
|
||||
toParam.allowSkipMonth(true);
|
||||
toParam.allowSkipDay(true);
|
||||
com.arsdigita.bebop.form.Date to = new com.arsdigita.bebop.form.Date(
|
||||
toParam);
|
||||
to.setYearRange(1900, today.get(Calendar.YEAR));
|
||||
|
|
@ -103,19 +136,15 @@ public class SeriesEditshipAddForm
|
|||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
GenericPerson editor;
|
||||
Date from;
|
||||
Date to;
|
||||
|
||||
editor = editStep.getSelectedEditor();
|
||||
from = editStep.getSelectedEditorDateFrom();
|
||||
to = editStep.getSelectedEditorDateTo();
|
||||
GenericPerson editor = editStep.getSelectedEditor();
|
||||
Date from = editStep.getSelectedEditorDateFrom();
|
||||
Date to = editStep.getSelectedEditorDateTo();
|
||||
|
||||
if (editor == null) {
|
||||
m_itemSearch.setVisible(state, true);
|
||||
selectedEditorLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, editor);
|
||||
//data.put(ITEM_SEARCH, editor);
|
||||
data.put(EditshipCollection.FROM, from);
|
||||
data.put(EditshipCollection.TO, to);
|
||||
|
||||
|
|
@ -134,8 +163,8 @@ public class SeriesEditshipAddForm
|
|||
Series series =
|
||||
(Series) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if (!(this.getSaveCancelSection().
|
||||
getCancelButton().isSelected(state))) {
|
||||
if (this.getSaveCancelSection().
|
||||
getSaveButton().isSelected(state)) {
|
||||
GenericPerson editor;
|
||||
editor = editStep.getSelectedEditor();
|
||||
|
||||
|
|
@ -146,7 +175,15 @@ public class SeriesEditshipAddForm
|
|||
|
||||
series.addEditor(editorToAdd,
|
||||
(Date) data.get(EditshipCollection.FROM),
|
||||
(Date) data.get(EditshipCollection.TO));
|
||||
(Boolean) data.get(
|
||||
EditshipCollection.FROM_SKIP_MONTH),
|
||||
(Boolean) data.get(
|
||||
EditshipCollection.FROM_SKIP_DAY),
|
||||
(Date) data.get(EditshipCollection.TO),
|
||||
(Boolean) data.get(
|
||||
EditshipCollection.TO_SKIP_MONTH),
|
||||
(Boolean) data.get(
|
||||
EditshipCollection.TO_SKIP_DAY));
|
||||
} else {
|
||||
EditshipCollection editors;
|
||||
|
||||
|
|
@ -159,7 +196,15 @@ public class SeriesEditshipAddForm
|
|||
}
|
||||
|
||||
editors.setFrom((Date) data.get(EditshipCollection.FROM));
|
||||
editors.setFromSkipMonth((Boolean) data.get(
|
||||
EditshipCollection.FROM_SKIP_MONTH));
|
||||
editors.setFromSkipDay((Boolean) data.get(
|
||||
EditshipCollection.FROM_SKIP_DAY));
|
||||
editors.setTo((Date) data.get(EditshipCollection.TO));
|
||||
editors.setToSkipMonth((Boolean) data.get(
|
||||
EditshipCollection.TO_SKIP_MONTH));
|
||||
editors.setToSkipDay((Boolean) data.get(
|
||||
EditshipCollection.TO_SKIP_DAY));
|
||||
|
||||
editStep.setSelectedEditor(null);
|
||||
editStep.setSelectedEditorDateFrom(null);
|
||||
|
|
@ -179,17 +224,19 @@ public class SeriesEditshipAddForm
|
|||
editStep.setSelectedEditor(null);
|
||||
editStep.setSelectedEditorDateFrom(null);
|
||||
editStep.setSelectedEditorDateTo(null);
|
||||
}
|
||||
|
||||
init(fse);
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
boolean editing = false;
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
if ((editStep.getSelectedEditor() == null)
|
||||
&& (data.get(ITEM_SEARCH) == null)) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.no_editor_selected"));
|
||||
return;
|
||||
|
|
@ -198,24 +245,22 @@ public class SeriesEditshipAddForm
|
|||
Series series =
|
||||
(Series) getItemSelectionModel().getSelectedObject(state);
|
||||
GenericPerson editor = (GenericPerson) data.get(ITEM_SEARCH);
|
||||
if (!(editor.getContentBundle().hasInstance(series.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.no_suitable_language_variant"));
|
||||
return;
|
||||
if (editor == null) {
|
||||
editor = editStep.getSelectedEditor();
|
||||
editing = true;
|
||||
}
|
||||
|
||||
editor = (GenericPerson) editor.getContentBundle().getInstance(series.
|
||||
getLanguage());
|
||||
EditshipCollection editors = series.getEditors();
|
||||
editors.addFilter(String.format("id = %s", editor.getID().toString()));
|
||||
if (editors.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.already_added"));
|
||||
}
|
||||
|
||||
editors.close();
|
||||
if (!editing) {
|
||||
EditshipCollection editors = series.getEditors();
|
||||
editors.addFilter(
|
||||
String.format("id = %s", editor.getID().toString()));
|
||||
if (editors.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.editship.already_added"));
|
||||
}
|
||||
|
||||
editors.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
|
|
@ -250,7 +250,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
|
|||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link =
|
||||
new Link(String.format("%s (%s)",
|
||||
new Link(String.format("%s",
|
||||
value.toString(),
|
||||
editor.getLanguage()),
|
||||
resolver.generateItemURL(state,
|
||||
|
|
@ -269,7 +269,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
|
|||
ex);
|
||||
return new Label(value.toString());
|
||||
}
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
Label label = new Label(String.format("%s",
|
||||
value.toString(),
|
||||
editor.getLanguage()));
|
||||
return label;
|
||||
|
|
@ -290,7 +290,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,179 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.Page;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.cms.ContentItem;
|
||||
import com.arsdigita.cms.ExtraXMLGenerator;
|
||||
import com.arsdigita.cms.contenttypes.EditshipCollection;
|
||||
import com.arsdigita.cms.contenttypes.GenericPerson;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.contenttypes.Series;
|
||||
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
|
||||
import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
|
||||
import com.arsdigita.globalization.GlobalizationHelper;
|
||||
import com.arsdigita.xml.Element;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SeriesExtraXmlGenerator implements ExtraXMLGenerator {
|
||||
|
||||
private boolean listMode = false;
|
||||
|
||||
public void generateXML(final ContentItem item,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
if (!(item instanceof Series)) {
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"ExtraXMLGenerator '%s' only supports items of type '%s'.",
|
||||
getClass().getName(),
|
||||
Series.class.getName()));
|
||||
}
|
||||
|
||||
final Series series = (Series) item;
|
||||
createEditorsXml(series, element, state);
|
||||
if (!listMode) {
|
||||
createVolumesXml(series, element, state);
|
||||
}
|
||||
}
|
||||
|
||||
private void createEditorsXml(final Series series,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final EditshipCollection editors = series.getEditors();
|
||||
if ((editors == null) || editors.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Element editorsElem = parent.newChildElement("editors");
|
||||
while (editors.next()) {
|
||||
createEditorXml(editors.getEditor(),
|
||||
editors.getEditorOrder(),
|
||||
editors.getFrom(),
|
||||
editors.getFromSkipMonth(),
|
||||
editors.getFromSkipDay(),
|
||||
editors.getTo(),
|
||||
editors.getToSkipMonth(),
|
||||
editors.getToSkipDay(),
|
||||
editorsElem,
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
private void createEditorXml(final GenericPerson editor,
|
||||
final Integer order,
|
||||
final Date from,
|
||||
final Boolean fromSkipMonth,
|
||||
final Boolean fromSkipDay,
|
||||
final Date to,
|
||||
final Boolean toSkipMonth,
|
||||
final Boolean toSkipDay,
|
||||
final Element editorsElem,
|
||||
final PageState state) {
|
||||
final XmlGenerator generator = new XmlGenerator(editor);
|
||||
generator.setItemElemName("editor", "");
|
||||
generator.addItemAttribute("order", order.toString());
|
||||
if (from != null) {
|
||||
createDateAttr(generator, from, "from");
|
||||
generator.addItemAttribute("fromSkipMonth", fromSkipMonth.toString());
|
||||
generator.addItemAttribute("fromSkipDay", fromSkipDay.toString());
|
||||
}
|
||||
if (to != null) {
|
||||
createDateAttr(generator, to, "to");
|
||||
generator.addItemAttribute("toSkipMonth", toSkipMonth.toString());
|
||||
generator.addItemAttribute("toSkipDay", toSkipDay.toString());
|
||||
}
|
||||
generator.setListMode(listMode);
|
||||
generator.generateXML(state, editorsElem, "");
|
||||
}
|
||||
|
||||
private void createVolumesXml(final Series series,
|
||||
final Element parent,
|
||||
final PageState state) {
|
||||
final VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
if ((volumes == null) || volumes.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Element volumesElem = parent.newChildElement("volumes");
|
||||
while (volumes.next()) {
|
||||
createVolumeXml(volumes.getPublication(GlobalizationHelper.
|
||||
getNegotiatedLocale().getLanguage()),
|
||||
volumes.getVolumeOfSeries(),
|
||||
volumesElem,
|
||||
state);
|
||||
}
|
||||
}
|
||||
|
||||
private void createDateAttr(final XmlGenerator generator,
|
||||
final Date date,
|
||||
final String prefix) {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(date);
|
||||
|
||||
generator.addItemAttribute(String.format("%sYear", prefix),
|
||||
Integer.toString(cal.get(Calendar.YEAR)));
|
||||
generator.addItemAttribute(String.format("%sMonth", prefix),
|
||||
Integer.toString(cal.get(Calendar.MONTH)));
|
||||
generator.addItemAttribute(String.format("%sDay", prefix),
|
||||
Integer.toString(cal.get(
|
||||
Calendar.DAY_OF_MONTH)));
|
||||
|
||||
final Locale locale = GlobalizationHelper.getNegotiatedLocale();
|
||||
final DateFormat dateFormat = DateFormat.getDateInstance(
|
||||
DateFormat.MEDIUM, locale);
|
||||
final DateFormat longDateFormat = DateFormat.getDateInstance(
|
||||
DateFormat.LONG, locale);
|
||||
generator.addItemAttribute(String.format("%sDate", prefix),
|
||||
dateFormat.format(date));
|
||||
generator.addItemAttribute(String.format("%sLongDate", prefix),
|
||||
longDateFormat.format(date));
|
||||
generator.addItemAttribute(String.format("%sMonthName", prefix),
|
||||
cal.getDisplayName(Calendar.MONTH,
|
||||
Calendar.LONG,
|
||||
locale));
|
||||
|
||||
}
|
||||
|
||||
private void createVolumeXml(final Publication publication,
|
||||
final Integer volume,
|
||||
final Element volumesElem,
|
||||
final PageState state) {
|
||||
final XmlGenerator generator = new XmlGenerator(publication);
|
||||
generator.setItemElemName("publication", "");
|
||||
if (volume != null) {
|
||||
generator.addItemAttribute("volumeNr", volume.toString());
|
||||
}
|
||||
generator.setListMode(true);
|
||||
generator.generateXML(state, volumesElem, "");
|
||||
}
|
||||
|
||||
public void addGlobalStateParams(final Page page) {
|
||||
//nothing
|
||||
}
|
||||
|
||||
public void setListMode(final boolean listMode) {
|
||||
this.listMode = listMode;
|
||||
}
|
||||
|
||||
private class XmlGenerator extends SimpleXMLGenerator {
|
||||
|
||||
private final ContentItem item;
|
||||
|
||||
public XmlGenerator(final ContentItem item) {
|
||||
super();
|
||||
this.item = item;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContentItem getContentItem(final PageState state) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,6 @@ import com.arsdigita.bebop.event.FormProcessListener;
|
|||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||
import com.arsdigita.bebop.form.TextArea;
|
||||
import com.arsdigita.bebop.form.TextField;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import com.arsdigita.cms.contenttypes.Series;
|
|||
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -51,10 +52,15 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
private SaveCancelSection m_saveCancelSection;
|
||||
private final String ITEM_SEARCH = "volumes";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private SimpleEditStep editStep;
|
||||
private Label selectedVolumeLabel;
|
||||
private TextField volumeOfSeries;
|
||||
|
||||
public SeriesVolumeAddForm(ItemSelectionModel itemModel) {
|
||||
public SeriesVolumeAddForm(ItemSelectionModel itemModel,
|
||||
SimpleEditStep editStep) {
|
||||
super("VolumesEntryForm", itemModel);
|
||||
m_itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -68,11 +74,14 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
Publication.class.getName()));
|
||||
add(m_itemSearch);
|
||||
|
||||
selectedVolumeLabel = new Label("");
|
||||
add(selectedVolumeLabel);
|
||||
|
||||
add(new Label((String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series").localize()));
|
||||
ParameterModel volumeOfSeriesParam = new IntegerParameter(
|
||||
VolumeInSeriesCollection.VOLUME_OF_SERIES);
|
||||
TextField volumeOfSeries = new TextField(volumeOfSeriesParam);
|
||||
volumeOfSeries = new TextField(volumeOfSeriesParam);
|
||||
add(volumeOfSeries);
|
||||
}
|
||||
|
||||
|
|
@ -81,6 +90,27 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
|
||||
final Publication publication = ((SeriesVolumesStep) editStep).
|
||||
getSelectedPublication();
|
||||
final Integer volume =
|
||||
((SeriesVolumesStep) editStep).getSelectedVolume();
|
||||
|
||||
if (publication == null) {
|
||||
m_itemSearch.setVisible(state, true);
|
||||
selectedVolumeLabel.setVisible(state, false);
|
||||
} else {
|
||||
data.put(ITEM_SEARCH, publication);
|
||||
if ((volume == null)) {
|
||||
volumeOfSeries.setValue(state, 0);
|
||||
} else {
|
||||
volumeOfSeries.setValue(state, volume);
|
||||
}
|
||||
|
||||
m_itemSearch.setVisible(state, false);
|
||||
selectedVolumeLabel.setLabel(publication.getTitle(), state);
|
||||
selectedVolumeLabel.setVisible(state, true);
|
||||
}
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
|
|
@ -93,13 +123,41 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
|
||||
if (!(this.getSaveCancelSection().getCancelButton().
|
||||
isSelected(state))) {
|
||||
Publication volume = (Publication) data.get(ITEM_SEARCH);
|
||||
volume = (Publication) volume.getContentBundle().getInstance(series.
|
||||
getLanguage());
|
||||
Publication volume = ((SeriesVolumesStep) editStep).
|
||||
getSelectedPublication();
|
||||
|
||||
series.addVolume(volume,
|
||||
(Integer) data.get(
|
||||
VolumeInSeriesCollection.VOLUME_OF_SERIES));
|
||||
Integer volOfSeries;
|
||||
if (this.volumeOfSeries.getValue(state) == null) {
|
||||
volOfSeries = null;
|
||||
} else {
|
||||
volOfSeries = data.getInteger(
|
||||
VolumeInSeriesCollection.VOLUME_OF_SERIES);
|
||||
}
|
||||
|
||||
if (volume == null) {
|
||||
volume = (Publication) data.get(ITEM_SEARCH);
|
||||
volume = (Publication) volume.getContentBundle().getInstance(series.
|
||||
getLanguage());
|
||||
|
||||
series.addVolume(volume,
|
||||
(Integer) data.get(
|
||||
VolumeInSeriesCollection.VOLUME_OF_SERIES));
|
||||
} else {
|
||||
VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
|
||||
while (volumes.next()) {
|
||||
if (volumes.getPublication().equals(volume)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
volumes.setVolumeOfSeries(volOfSeries);
|
||||
|
||||
((SeriesVolumesStep) editStep).setSelectedPublication(null);
|
||||
((SeriesVolumesStep) editStep).setSelectedVolume(null);
|
||||
|
||||
volumes.close();
|
||||
}
|
||||
}
|
||||
|
||||
init(fse);
|
||||
|
|
@ -109,8 +167,10 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
public void validate(FormSectionEvent fse) throws FormProcessException {
|
||||
final PageState state = fse.getPageState();
|
||||
final FormData data = fse.getFormData();
|
||||
boolean editing = false;
|
||||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
if ((((SeriesVolumesStep) editStep).getSelectedPublication() == null)
|
||||
&& (data.get(ITEM_SEARCH) == null)) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series.no_volume_selected"));
|
||||
|
|
@ -120,24 +180,21 @@ public class SeriesVolumeAddForm extends BasicItemForm {
|
|||
Series series = (Series) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
Publication volume = (Publication) data.get(ITEM_SEARCH);
|
||||
if (!(volume.getContentBundle().hasInstance(series.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series.no_suitable_language_variant"));
|
||||
return;
|
||||
if (volume == null) {
|
||||
volume = ((SeriesVolumesStep) editStep).getSelectedPublication();
|
||||
editing = true;
|
||||
}
|
||||
|
||||
volume = (Publication) volume.getContentBundle().getInstance(series.
|
||||
getLanguage());
|
||||
VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
volumes.addFilter(String.format("id = %s", volume.getID().toString()));
|
||||
if (volumes.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series.already_added"));
|
||||
}
|
||||
|
||||
volumes.close();
|
||||
if (!editing) {
|
||||
VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
volumes.addFilter(
|
||||
String.format("id = %s", volume.getID().toString()));
|
||||
if (volumes.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volume_of_series.already_added"));
|
||||
}
|
||||
volumes.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.Publication;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
|
|
@ -28,10 +29,13 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
|||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id4
|
||||
*/
|
||||
public class SeriesVolumesStep extends SimpleEditStep {
|
||||
|
||||
private static final String ADD_VOLUME_SHEET_NAME = "addVolume";
|
||||
protected static final String ADD_VOLUME_SHEET_NAME = "addVolume";
|
||||
private Publication selectedPublication;
|
||||
private Integer selectedVolume;
|
||||
|
||||
public SeriesVolumesStep(
|
||||
ItemSelectionModel itemModel,
|
||||
|
|
@ -46,16 +50,31 @@ public class SeriesVolumesStep extends SimpleEditStep {
|
|||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addVolumeSheet =
|
||||
new SeriesVolumeAddForm(itemModel);
|
||||
new SeriesVolumeAddForm(itemModel, this);
|
||||
add(ADD_VOLUME_SHEET_NAME,
|
||||
(String) PublicationGlobalizationUtil.globalize(
|
||||
(String) PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.add_volume").localize(),
|
||||
new WorkflowLockedComponentAccess(addVolumeSheet, itemModel),
|
||||
addVolumeSheet.getSaveCancelSection().getCancelButton());
|
||||
new WorkflowLockedComponentAccess(addVolumeSheet, itemModel),
|
||||
addVolumeSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
SeriesVolumesTable volumesTable = new SeriesVolumesTable(
|
||||
itemModel);
|
||||
itemModel, this);
|
||||
setDisplayComponent(volumesTable);
|
||||
}
|
||||
|
||||
public Publication getSelectedPublication() {
|
||||
return selectedPublication;
|
||||
}
|
||||
|
||||
public void setSelectedPublication(final Publication selectedPublication) {
|
||||
this.selectedPublication = selectedPublication;
|
||||
}
|
||||
|
||||
public Integer getSelectedVolume() {
|
||||
return selectedVolume;
|
||||
}
|
||||
|
||||
public void setSelectedVolume(final Integer selectedVolume) {
|
||||
this.selectedVolume = selectedVolume;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ import com.arsdigita.cms.contenttypes.Publication;
|
|||
import com.arsdigita.cms.contenttypes.Series;
|
||||
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -49,18 +49,23 @@ import org.apache.log4j.Logger;
|
|||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class SeriesVolumesTable extends Table implements TableActionListener {
|
||||
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(SeriesVolumesTable.class);
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_EDIT_ASSOC = "table_col_edit_assoc";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
private SimpleEditStep editStep;
|
||||
|
||||
public SeriesVolumesTable(ItemSelectionModel itemModel) {
|
||||
public SeriesVolumesTable(ItemSelectionModel itemModel,
|
||||
SimpleEditStep editStep) {
|
||||
super();
|
||||
m_itemModel = itemModel;
|
||||
this.editStep = editStep;
|
||||
|
||||
setEmptyView(
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
|
|
@ -79,13 +84,21 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
colModel.add(new TableColumn(
|
||||
2,
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volumes.edit_assoc").localize(),
|
||||
TABLE_COL_EDIT_ASSOC));
|
||||
colModel.add(new TableColumn(
|
||||
3,
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volumes.remove").localize(),
|
||||
TABLE_COL_DEL));
|
||||
|
||||
setModelBuilder(new SeriesVolumesTableModelBuilder(itemModel));
|
||||
|
||||
colModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
colModel.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||
colModel.get(2).setCellRenderer(new EditAssocCellRenderer());
|
||||
colModel.get(3).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class SeriesVolumesTableModelBuilder
|
||||
|
|
@ -149,6 +162,10 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
case 1:
|
||||
return m_volumesCollection.getVolumeOfSeries();
|
||||
case 2:
|
||||
return PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.series.volumes.edit_assoc").
|
||||
localize();
|
||||
case 3:
|
||||
return PublicationGlobalizationUtil.globalize(
|
||||
"publication.ui.series.volumes.remove").localize();
|
||||
default:
|
||||
|
|
@ -175,7 +192,7 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
|
|
@ -197,9 +214,8 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
ContentSection section = CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link =
|
||||
new Link(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
volume.getLanguage()),
|
||||
new Link(String.format("%s",
|
||||
value.toString()),
|
||||
resolver.generateItemURL(state,
|
||||
volume,
|
||||
section,
|
||||
|
|
@ -217,9 +233,38 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
Label label = new Label(String.format("%s (%s)",
|
||||
value.toString(),
|
||||
volume.getLanguage()));
|
||||
Label label = new Label(String.format("%s",
|
||||
value.toString()));
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class EditAssocCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
public Component getComponent(final Table table,
|
||||
final PageState state,
|
||||
final Object value,
|
||||
final boolean isSelected,
|
||||
final Object key,
|
||||
final int row,
|
||||
final int column) {
|
||||
final SecurityManager securityManager =
|
||||
CMS.getSecurityManager(state);
|
||||
final Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
series);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
Label label = new Label(value.toString());
|
||||
return label;
|
||||
}
|
||||
}
|
||||
|
|
@ -239,7 +284,7 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
int row,
|
||||
int col) {
|
||||
SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
CMS.getSecurityManager(state);
|
||||
Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
boolean canDelete = securityManager.canAccess(
|
||||
|
|
@ -271,11 +316,28 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
|
|||
|
||||
Series series = (Series) m_itemModel.getSelectedObject(state);
|
||||
|
||||
//VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
|
||||
VolumeInSeriesCollection volumes = series.getVolumes();
|
||||
|
||||
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
|
||||
} else if (TABLE_COL_EDIT_ASSOC.equals(column.getHeaderKey().toString())) {
|
||||
while (volumes.next()) {
|
||||
if (volumes.getPublication(publication.getLanguage()).equals(
|
||||
publication)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
((SeriesVolumesStep) editStep).setSelectedPublication(
|
||||
publication);
|
||||
((SeriesVolumesStep) editStep).setSelectedVolume(volumes.
|
||||
getVolumeOfSeries());
|
||||
|
||||
volumes.close();
|
||||
|
||||
editStep.showComponent(state,
|
||||
SeriesVolumesStep.ADD_VOLUME_SHEET_NAME);
|
||||
} else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
|
||||
series.removeVolume(publication);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ import com.arsdigita.xml.Element;
|
|||
*/
|
||||
public class UnPublishedExtraXmlGenerator implements ExtraXMLGenerator {
|
||||
|
||||
private boolean listMode = false;
|
||||
|
||||
public void generateXML(final ContentItem item,
|
||||
final Element element,
|
||||
final PageState state) {
|
||||
|
|
@ -40,6 +42,7 @@ public class UnPublishedExtraXmlGenerator implements ExtraXMLGenerator {
|
|||
if (orga != null) {
|
||||
final XmlGenerator generator = new XmlGenerator(orga);
|
||||
generator.setItemElemName("organization", "");
|
||||
generator.setListMode(listMode);
|
||||
generator.generateXML(state, parent, "");
|
||||
}
|
||||
}
|
||||
|
|
@ -51,7 +54,7 @@ public class UnPublishedExtraXmlGenerator implements ExtraXMLGenerator {
|
|||
|
||||
@Override
|
||||
public void setListMode(final boolean listMode) {
|
||||
//nothing
|
||||
this.listMode = listMode;
|
||||
}
|
||||
|
||||
private class XmlGenerator extends SimpleXMLGenerator {
|
||||
|
|
|
|||
Loading…
Reference in New Issue