ccm-sci-publications: It is now possible to add multiple organizers to a proceedings
git-svn-id: https://svn.libreccm.org/ccm/trunk@3461 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d023ece326
commit
d3d0fc2b82
|
|
@ -45,6 +45,11 @@ div.portal-grid-row div.portal-col-50 {
|
|||
width: 50%;
|
||||
}
|
||||
|
||||
div.portal-workspace-columns div.portal-col-75,
|
||||
div.portal-grid-row div.portal-col-75 {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
div.portal-workspace-columns div.portal-col-100,
|
||||
div.portal-grid-row div.portal-col-100 {
|
||||
width: 100%;
|
||||
|
|
|
|||
|
|
@ -31,8 +31,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Content type of proceedings. Provides attributes for storing the data of the conference (name, date, place,
|
||||
* organizer) and for linking the papers (objects of the content type {@link InProceedings} to a proceedings object.
|
||||
* Content type of proceedings. Provides attributes for storing the data of the
|
||||
* conference (name, date, place, organizer) and for linking the papers (objects
|
||||
* of the content type {@link InProceedings} to a proceedings object.
|
||||
*
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
|
|
@ -46,9 +47,10 @@ public class Proceedings extends PublicationWithPublisher {
|
|||
public static final String DATE_TO_OF_CONFERENCE = "dateToOfConference";
|
||||
public static final String PAPERS = "papers";
|
||||
public static final String PAPER_ORDER = "paperOrder";
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.Proceedings";
|
||||
private static final ProceedingsConfig PROCEEDINGS_CONFIG = new ProceedingsConfig();
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.Proceedings";
|
||||
private static final ProceedingsConfig PROCEEDINGS_CONFIG
|
||||
= new ProceedingsConfig();
|
||||
|
||||
public Proceedings() {
|
||||
super(BASE_DATA_OBJECT_TYPE);
|
||||
|
|
@ -78,62 +80,6 @@ public class Proceedings extends PublicationWithPublisher {
|
|||
return (ProceedingsBundle) getContentBundle();
|
||||
}
|
||||
|
||||
public GenericOrganizationalUnit getOrganizerOfConference() {
|
||||
/*DataCollection collection;
|
||||
|
||||
collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (GenericOrganizationalUnit) DomainObjectFactory.newInstance(
|
||||
dobj);
|
||||
}*/
|
||||
|
||||
final GenericOrganizationalUnitBundle bundle = getProceedingsBundle().getOrganizerOfConference();
|
||||
|
||||
if (bundle == null) {
|
||||
return null;
|
||||
} else {
|
||||
return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
|
||||
}
|
||||
}
|
||||
|
||||
public GenericOrganizationalUnit getOrganizerOfConference(
|
||||
final String language) {
|
||||
final GenericOrganizationalUnitBundle bundle = getProceedingsBundle().getOrganizerOfConference();
|
||||
|
||||
if (bundle == null) {
|
||||
return null;
|
||||
} else {
|
||||
return (GenericOrganizationalUnit) bundle.getInstance(language);
|
||||
}
|
||||
}
|
||||
|
||||
public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
||||
/*GenericOrganizationalUnit oldOrga;
|
||||
|
||||
oldOrga = getOrganizerOfConference();
|
||||
if (oldOrga != null) {
|
||||
remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
||||
}
|
||||
|
||||
if (null != organizer) {
|
||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||
DataObject link = add(ORGANIZER_OF_CONFERENCE, organizer);
|
||||
link.set("organizerOrder", 1);
|
||||
link.save();
|
||||
} */
|
||||
|
||||
getProceedingsBundle().setOrganizerOfConference(organizer);
|
||||
}
|
||||
|
||||
public String getNameOfConference() {
|
||||
return (String) get(NAME_OF_CONFERENCE);
|
||||
}
|
||||
|
|
@ -166,26 +112,31 @@ public class Proceedings extends PublicationWithPublisher {
|
|||
set(DATE_TO_OF_CONFERENCE, dateTo);
|
||||
}
|
||||
|
||||
public InProceedingsCollection getPapers() {
|
||||
//return new InProceedingsCollection((DataCollection) get(PAPERS));
|
||||
public ProceedingsOrganizerCollection getOrganizers() {
|
||||
return getProceedingsBundle().getOrganizersOfConference();
|
||||
}
|
||||
|
||||
public void addOrganizer(final GenericOrganizationalUnit organizer) {
|
||||
getProceedingsBundle().addOrganizerOfConference(organizer);
|
||||
}
|
||||
|
||||
public void removeOrganizer(final GenericOrganizationalUnit organizer) {
|
||||
getProceedingsBundle().removeOrganizer(organizer);
|
||||
}
|
||||
|
||||
public boolean hasOrganizers() {
|
||||
return !getOrganizers().isEmpty();
|
||||
}
|
||||
|
||||
public InProceedingsCollection getPapers() {
|
||||
return getProceedingsBundle().getPapers();
|
||||
}
|
||||
|
||||
public void addPaper(InProceedings paper) {
|
||||
/*Assert.exists(paper, InProceedings.class);
|
||||
|
||||
DataObject link = add(PAPERS, paper);
|
||||
|
||||
link.set(PAPER_ORDER, Integer.valueOf((int) getPapers().size()));*/
|
||||
|
||||
getProceedingsBundle().addPaper(paper);
|
||||
}
|
||||
|
||||
public void removePaper(InProceedings paper) {
|
||||
/*Assert.exists(paper, InProceedings.class);
|
||||
remove(PAPERS, paper);*/
|
||||
|
||||
getProceedingsBundle().removePaper(paper);
|
||||
}
|
||||
|
||||
|
|
@ -202,8 +153,10 @@ public class Proceedings extends PublicationWithPublisher {
|
|||
|
||||
@Override
|
||||
public List<ExtraXMLGenerator> getExtraListXMLGenerators() {
|
||||
final List<ExtraXMLGenerator> generators = super.getExtraListXMLGenerators();
|
||||
final List<ExtraXMLGenerator> generators = super
|
||||
.getExtraListXMLGenerators();
|
||||
generators.add(new ProceedingsExtraXmlGenerator());
|
||||
return generators;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ import java.math.BigDecimal;
|
|||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
||||
|
||||
public static final String BASE_DATA_OBJECT_TYPE =
|
||||
"com.arsdigita.cms.contenttypes.ProceedingsBundle";
|
||||
public static final String BASE_DATA_OBJECT_TYPE
|
||||
= "com.arsdigita.cms.contenttypes.ProceedingsBundle";
|
||||
public static final String ORGANIZER_OF_CONFERENCE = "organizerOfConference";
|
||||
public static final String PAPERS = "papers";
|
||||
public static final String PAPER_ORDER = "paperOrder";
|
||||
|
|
@ -61,7 +61,7 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
}
|
||||
|
||||
public ProceedingsBundle(final BigDecimal id)
|
||||
throws DataObjectNotFoundException {
|
||||
throws DataObjectNotFoundException {
|
||||
super(new OID(BASE_DATA_OBJECT_TYPE, id));
|
||||
}
|
||||
|
||||
|
|
@ -80,12 +80,12 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
final String attribute = property.getName();
|
||||
|
||||
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||
final ProceedingsBundle proceedingsBundle =
|
||||
(ProceedingsBundle) source;
|
||||
final ProceedingsBundle proceedingsBundle
|
||||
= (ProceedingsBundle) source;
|
||||
|
||||
if (PAPERS.equals(attribute)) {
|
||||
final DataCollection papers =
|
||||
(DataCollection) proceedingsBundle.get(
|
||||
final DataCollection papers = (DataCollection) proceedingsBundle
|
||||
.get(
|
||||
PAPERS);
|
||||
|
||||
while (papers.next()) {
|
||||
|
|
@ -94,8 +94,9 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
|
||||
return true;
|
||||
} else if (ORGANIZER_OF_CONFERENCE.equals(attribute)) {
|
||||
final DataCollection organizers =
|
||||
(DataCollection) proceedingsBundle.get(
|
||||
final DataCollection organizers
|
||||
= (DataCollection) proceedingsBundle
|
||||
.get(
|
||||
ORGANIZER_OF_CONFERENCE);
|
||||
|
||||
while (organizers.next()) {
|
||||
|
|
@ -112,11 +113,11 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
}
|
||||
|
||||
private void createPaperAssoc(final DataCollection papers) {
|
||||
final InProceedingsBundle draftPaper =
|
||||
(InProceedingsBundle) DomainObjectFactory.
|
||||
newInstance(papers.getDataObject());
|
||||
final InProceedingsBundle draftPaper
|
||||
= (InProceedingsBundle) DomainObjectFactory
|
||||
.newInstance(papers.getDataObject());
|
||||
final InProceedingsBundle livePaper = (InProceedingsBundle) draftPaper.
|
||||
getLiveVersion();
|
||||
getLiveVersion();
|
||||
|
||||
if (livePaper != null) {
|
||||
final DataObject link = add(PAPERS, livePaper);
|
||||
|
|
@ -128,12 +129,12 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
}
|
||||
|
||||
private void createOrganizerAssoc(final DataCollection organizers) {
|
||||
final GenericOrganizationalUnitBundle draftOrganizer =
|
||||
(GenericOrganizationalUnitBundle) DomainObjectFactory.
|
||||
newInstance(organizers.getDataObject());
|
||||
final GenericOrganizationalUnitBundle liveOrganizer =
|
||||
(GenericOrganizationalUnitBundle) draftOrganizer.
|
||||
getLiveVersion();
|
||||
final GenericOrganizationalUnitBundle draftOrganizer
|
||||
= (GenericOrganizationalUnitBundle) DomainObjectFactory
|
||||
.newInstance(organizers.getDataObject());
|
||||
final GenericOrganizationalUnitBundle liveOrganizer
|
||||
= (GenericOrganizationalUnitBundle) draftOrganizer
|
||||
.getLiveVersion();
|
||||
|
||||
if (liveOrganizer != null) {
|
||||
final DataObject link = add(ORGANIZER_OF_CONFERENCE, liveOrganizer);
|
||||
|
|
@ -152,11 +153,11 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
final String attribute = property.getName();
|
||||
if (copier.getCopyType() == ItemCopier.VERSION_COPY) {
|
||||
if (("proceedingsOfConference".equals(attribute))
|
||||
&& (source instanceof GenericOrganizationalUnitBundle)) {
|
||||
final GenericOrganizationalUnitBundle orgaunitBundle =
|
||||
(GenericOrganizationalUnitBundle) source;
|
||||
final DataCollection proceedings =
|
||||
(DataCollection) orgaunitBundle.get(
|
||||
&& (source instanceof GenericOrganizationalUnitBundle)) {
|
||||
final GenericOrganizationalUnitBundle orgaunitBundle
|
||||
= (GenericOrganizationalUnitBundle) source;
|
||||
final DataCollection proceedings
|
||||
= (DataCollection) orgaunitBundle.get(
|
||||
"proceedingsOfConference");
|
||||
|
||||
while (proceedings.next()) {
|
||||
|
|
@ -177,74 +178,107 @@ public class ProceedingsBundle extends PublicationWithPublisherBundle {
|
|||
}
|
||||
|
||||
private void createProceedingsAssoc(
|
||||
final DataCollection proceedings,
|
||||
final GenericOrganizationalUnitBundle orgaunit) {
|
||||
final ProceedingsBundle draftProceedigns = (ProceedingsBundle) DomainObjectFactory.newInstance(proceedings.getDataObject());
|
||||
final ProceedingsBundle liveProceedings = (ProceedingsBundle) draftProceedigns.getLiveVersion();
|
||||
|
||||
final DataCollection proceedings,
|
||||
final GenericOrganizationalUnitBundle orgaunit) {
|
||||
final ProceedingsBundle draftProceedigns
|
||||
= (ProceedingsBundle) DomainObjectFactory
|
||||
.newInstance(proceedings.getDataObject());
|
||||
final ProceedingsBundle liveProceedings
|
||||
= (ProceedingsBundle) draftProceedigns
|
||||
.getLiveVersion();
|
||||
|
||||
if (liveProceedings != null) {
|
||||
final DataObject link = orgaunit.add("proceedingsOfConference", liveProceedings);
|
||||
|
||||
final DataObject link = orgaunit.add("proceedingsOfConference",
|
||||
liveProceedings);
|
||||
|
||||
link.set("organizerOrder", 1);
|
||||
|
||||
|
||||
link.save();
|
||||
|
||||
XMLDeliveryCache.getInstance().removeFromCache(liveProceedings.getOID());
|
||||
|
||||
XMLDeliveryCache.getInstance().removeFromCache(liveProceedings
|
||||
.getOID());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public InProceedingsCollection getPapers() {
|
||||
return new InProceedingsCollection((DataCollection) get(PAPERS));
|
||||
}
|
||||
|
||||
|
||||
public void addPaper(final InProceedings paper) {
|
||||
Assert.exists(paper, InProceedings.class);
|
||||
|
||||
|
||||
final DataObject link = add(PAPERS, paper.getInProceedingsBundle());
|
||||
|
||||
|
||||
link.set(PAPER_ORDER, Integer.valueOf((int) getPapers().size()));
|
||||
|
||||
|
||||
link.save();
|
||||
}
|
||||
|
||||
|
||||
public void removePaper(final InProceedings paper) {
|
||||
Assert.exists(paper, InProceedings.class);
|
||||
|
||||
remove(PAPERS, paper);
|
||||
|
||||
remove(PAPERS, paper.getInProceedingsBundle());
|
||||
}
|
||||
|
||||
public GenericOrganizationalUnitBundle getOrganizerOfConference() {
|
||||
DataCollection collection;
|
||||
|
||||
collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
||||
|
||||
if (0 == collection.size()) {
|
||||
return null;
|
||||
} else {
|
||||
DataObject dobj;
|
||||
|
||||
collection.next();
|
||||
dobj = collection.getDataObject();
|
||||
collection.close();
|
||||
|
||||
return (GenericOrganizationalUnitBundle) DomainObjectFactory.newInstance(
|
||||
dobj);
|
||||
}
|
||||
public ProceedingsOrganizerCollection getOrganizersOfConference() {
|
||||
return new ProceedingsOrganizerCollection((DataCollection) get(
|
||||
ORGANIZER_OF_CONFERENCE));
|
||||
}
|
||||
|
||||
public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
||||
final GenericOrganizationalUnitBundle oldOrga = getOrganizerOfConference();
|
||||
|
||||
if (oldOrga != null) {
|
||||
remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
||||
}
|
||||
|
||||
if (null != organizer) {
|
||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||
DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
||||
organizer.getGenericOrganizationalUnitBundle());
|
||||
link.set("organizerOrder", 1);
|
||||
link.save();
|
||||
}
|
||||
public void addOrganizerOfConference(
|
||||
final GenericOrganizationalUnit organizer) {
|
||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||
|
||||
final DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
||||
organizer
|
||||
.getGenericOrganizationalUnitBundle());
|
||||
link.set("organizerOrder",
|
||||
Integer.valueOf((int) getOrganizersOfConference().size()));
|
||||
|
||||
link.save();
|
||||
}
|
||||
|
||||
public void removeOrganizer(final GenericOrganizationalUnit organizer) {
|
||||
Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||
|
||||
remove(ORGANIZER_OF_CONFERENCE, organizer.getGenericOrganizationalUnitBundle());
|
||||
}
|
||||
|
||||
// public GenericOrganizationalUnitBundle getOrganizerOfConference() {
|
||||
// DataCollection collection;
|
||||
//
|
||||
// collection = (DataCollection) get(ORGANIZER_OF_CONFERENCE);
|
||||
//
|
||||
// if (0 == collection.size()) {
|
||||
// return null;
|
||||
// } else {
|
||||
// DataObject dobj;
|
||||
//
|
||||
// collection.next();
|
||||
// dobj = collection.getDataObject();
|
||||
// collection.close();
|
||||
//
|
||||
// return (GenericOrganizationalUnitBundle) DomainObjectFactory
|
||||
// .newInstance(
|
||||
// dobj);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void setOrganizerOfConference(GenericOrganizationalUnit organizer) {
|
||||
// final GenericOrganizationalUnitBundle oldOrga
|
||||
// = getOrganizerOfConference();
|
||||
//
|
||||
// if (oldOrga != null) {
|
||||
// remove(ORGANIZER_OF_CONFERENCE, oldOrga);
|
||||
// }
|
||||
//
|
||||
// if (null != organizer) {
|
||||
// Assert.exists(organizer, GenericOrganizationalUnit.class);
|
||||
// DataObject link = add(ORGANIZER_OF_CONFERENCE,
|
||||
// organizer.getGenericOrganizationalUnitBundle());
|
||||
// link.set("organizerOrder", 1);
|
||||
// link.save();
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,146 @@
|
|||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.ContentBundle;
|
||||
import com.arsdigita.domain.DomainCollection;
|
||||
import com.arsdigita.domain.DomainObjectFactory;
|
||||
import com.arsdigita.persistence.DataCollection;
|
||||
import com.arsdigita.persistence.DataObject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class ProceedingsOrganizerCollection extends DomainCollection {
|
||||
|
||||
public static final String LINKORDER = "link.organizerOrder";
|
||||
public static final String ORDER = "organizerOrder";
|
||||
private static final Logger s_log =
|
||||
Logger.getLogger(ProceedingsOrganizerCollection.class);
|
||||
|
||||
public ProceedingsOrganizerCollection(final DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(LINKORDER);
|
||||
}
|
||||
|
||||
public Integer getOrganizerOrder() {
|
||||
return (Integer) m_dataCollection.get(LINKORDER);
|
||||
}
|
||||
|
||||
public void setOrganizerOrder(final Integer order) {
|
||||
final DataObject link = (DataObject) get("link");
|
||||
|
||||
link.set(ORDER, order);
|
||||
}
|
||||
|
||||
public void swapWithNext(final GenericOrganizationalUnit organizer) {
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
int nextIndex = 0;
|
||||
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getOrganizerOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getOrganizerOrder(): %d",
|
||||
getOrganizerOrder()));
|
||||
if (this.getOrganizer().equals(organizer)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided article is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (this.next()) {
|
||||
nextIndex = this.getOrganizerOrder();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"The provided organizer is the last "
|
||||
+ "in the collection, so there is no next object "
|
||||
+ "to swap with.");
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
|
||||
while (this.getPosition() != currentPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setOrganizerOrder(nextIndex);
|
||||
this.next();
|
||||
this.setOrganizerOrder(currentIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public void swapWithPrevious(final GenericOrganizationalUnit organizer) {
|
||||
int previousPosition = 0;
|
||||
int previousIndex = 0;
|
||||
int currentPosition = 0;
|
||||
int currentIndex = 0;
|
||||
|
||||
s_log.debug("Searching organizer...");
|
||||
this.rewind();
|
||||
while (this.next()) {
|
||||
currentPosition = this.getPosition();
|
||||
currentIndex = this.getOrganizerOrder();
|
||||
s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
|
||||
currentIndex, this.size()));
|
||||
s_log.debug(String.format("getOrganizerOrder(): %d",
|
||||
getOrganizerOrder()));
|
||||
if (this.getOrganizer().equals(organizer)) {
|
||||
break;
|
||||
}
|
||||
|
||||
previousPosition = currentPosition;
|
||||
previousIndex = currentIndex;
|
||||
}
|
||||
|
||||
if (currentPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organizer is not "
|
||||
+ "part of this collection."));
|
||||
}
|
||||
|
||||
if (previousPosition == 0) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format(
|
||||
"The provided organizer is the first one in this "
|
||||
+ "collection, so there is no previous one to switch "
|
||||
+ "with."));
|
||||
}
|
||||
|
||||
this.rewind();
|
||||
while (this.getPosition() != previousPosition) {
|
||||
this.next();
|
||||
}
|
||||
|
||||
this.setOrganizerOrder(currentIndex);
|
||||
this.next();
|
||||
this.setOrganizerOrder(previousIndex);
|
||||
this.rewind();
|
||||
}
|
||||
|
||||
public GenericOrganizationalUnit getOrganizer() {
|
||||
final ContentBundle bundle = (ContentBundle) DomainObjectFactory
|
||||
.newInstance(m_dataCollection.getDataObject());
|
||||
|
||||
return (GenericOrganizationalUnit) bundle.getPrimaryInstance();
|
||||
}
|
||||
|
||||
public GenericOrganizationalUnit getOrganizer(final String language) {
|
||||
final ContentBundle bundle = (ContentBundle) DomainObjectFactory
|
||||
.newInstance(m_dataCollection.getDataObject());
|
||||
|
||||
return (GenericOrganizationalUnit) bundle.getInstance(language);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ publications.ui.expertise.setOrganization=Set organization
|
|||
publications.ui.expertise.setOrderer=Set orderer
|
||||
publications.ui.proceedings.organizer=Organizer of conference
|
||||
publications.ui.proceedings.organizer.none=No organizer associated
|
||||
publications.ui.proceedings.organizer.remove=Remove
|
||||
publications.ui.proceedings.organizer.remove=\u2716
|
||||
publications.ui.proceedings.organizer.remove.confirm=Do you really want to remove this association?
|
||||
publications.ui.proceedings.setOrganizer=Set organizer of conference
|
||||
publications.ui.unpublished.setOrganization=Set organization
|
||||
|
|
@ -438,3 +438,6 @@ cms.contenttypes.workingpaper.type_label=Publication - Working Paper-
|
|||
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
||||
cms.contenttypes.sciauthor.authoring.contact_properties.description=Contact Properties
|
||||
cms.contenttypes.sciauthor.authoring.contact_properties.title=Contact Properties
|
||||
publications.ui.proceedings.select_organizer.already_added=The selected organization has already been added as organizer.
|
||||
publications.ui.proceedings.organizer.up=\u2b06
|
||||
publications.ui.proceedings.organizer.down=\u2b07
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ publications.ui.expertise.setOrganization=Organisation zuweisen
|
|||
publications.ui.expertise.setOrderer=Auftraggeber zuweisen
|
||||
publications.ui.proceedings.organizer=Veranstalter der Konferenz
|
||||
publications.ui.proceedings.organizer.none=Kein Veranstalter zugewiesen
|
||||
publications.ui.proceedings.organizer.remove=Entfernen
|
||||
publications.ui.proceedings.organizer.remove=\u2716
|
||||
publications.ui.proceedings.organizer.remove.confirm=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
|
||||
publications.ui.proceedings.setOrganizer=Veranstalter der Konferenz zuweisen
|
||||
publications.ui.unpublished.setOrganization=Organisation zuweisen
|
||||
|
|
@ -415,7 +415,7 @@ publications.ui.publication.first_published=Erste Ver\u00f6ffentlichung
|
|||
publications.ui.publication.language=Sprache der Publikation
|
||||
publications.ui.series.number=Band der Reihe
|
||||
person.ui.publications.header=Publikationen mit {0} als Autorin/Autor
|
||||
person.ui.publications.header.alias_of=\ (Alias von {0})
|
||||
person.ui.publications.header.alias_of=(Alias von {0})
|
||||
cms.contenttypes.articleincollectedvolume.type_label=Publikation - Sammelbandbeitrag
|
||||
cms.contenttypes.articleinjournal.type_label=Publikation - Zeitschriftenbeitrag
|
||||
cms.contenttypes.collectedvolume.type_label=Publikation - Sammelband
|
||||
|
|
@ -437,3 +437,6 @@ cms.contenttypes.workingpaper.type_label=Publikation - Arbeitspapier
|
|||
cms.contenttypes.sciauthor.basic_properties.description=Input screen for an atuhor's basic properties as name, christian name, professional titel, etc
|
||||
cms.contenttypes.sciauthor.authoring.contact_properties.description=Kontaktangaben
|
||||
cms.contenttypes.sciauthor.authoring.contact_properties.title=Kontaktangaben
|
||||
publications.ui.proceedings.select_organizer.already_added=Die ausgew\u00e4hlte Organisation wurde bereits als Veranstalter hinzugef\u00fcgt.
|
||||
publications.ui.proceedings.organizer.up=\u2b06
|
||||
publications.ui.proceedings.organizer.down=\u2b07
|
||||
|
|
|
|||
|
|
@ -20,54 +20,57 @@ package com.arsdigita.cms.contenttypes.ui;
|
|||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.bebop.PageState;
|
||||
import com.arsdigita.bebop.event.FormInitListener;
|
||||
import com.arsdigita.bebop.event.FormProcessListener;
|
||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.Folder;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.contenttypes.ProceedingsOrganizerCollection;
|
||||
import com.arsdigita.cms.contenttypes.PublicationsConfig;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.kernel.Kernel;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
* @version $Id$
|
||||
*/
|
||||
public class ProceedingsOrganizerForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
public class ProceedingsOrganizerAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget itemSearch;
|
||||
private final String ITEM_SEARCH = "departmentOrga";
|
||||
private ItemSelectionModel itemModel;
|
||||
private final static PublicationsConfig config = new PublicationsConfig();
|
||||
|
||||
static {
|
||||
config.load();
|
||||
}
|
||||
|
||||
public ProceedingsOrganizerForm(final ItemSelectionModel itemModel) {
|
||||
public ProceedingsOrganizerAddForm(final ItemSelectionModel itemModel) {
|
||||
super("ProceedingsOrganizerForm", itemModel);
|
||||
this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
|
||||
itemSearch = new ItemSearchWidget(ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
GenericOrganizationalUnit.class.getName()));
|
||||
itemSearch.setDefaultCreationFolder(config.getDefaultOrganizationsFolder());
|
||||
ContentType
|
||||
.findByAssociatedObjectType(
|
||||
GenericOrganizationalUnit.class
|
||||
.getName()));
|
||||
itemSearch.setDefaultCreationFolder(config
|
||||
.getDefaultOrganizationsFolder());
|
||||
itemSearch.setEditAfterCreate(false);
|
||||
itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer"));
|
||||
"publications.ui.proceedings.organizer"));
|
||||
add(itemSearch);
|
||||
}
|
||||
|
||||
|
|
@ -83,16 +86,17 @@ public class ProceedingsOrganizerForm
|
|||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
getSelectedObject(state);
|
||||
|
||||
if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
|
||||
GenericOrganizationalUnit organizer =
|
||||
(GenericOrganizationalUnit) data.get(
|
||||
GenericOrganizationalUnit organizer
|
||||
= (GenericOrganizationalUnit) data
|
||||
.get(
|
||||
ITEM_SEARCH);
|
||||
organizer = (GenericOrganizationalUnit) organizer.getContentBundle().
|
||||
getInstance(proceedings.getLanguage());
|
||||
organizer = (GenericOrganizationalUnit) organizer.getContentBundle()
|
||||
.getInstance(proceedings.getLanguage());
|
||||
|
||||
proceedings.setOrganizerOfConference(organizer);
|
||||
proceedings.addOrganizer(organizer);
|
||||
itemSearch.publishCreatedItem(data, organizer);
|
||||
|
||||
}
|
||||
|
|
@ -107,21 +111,36 @@ public class ProceedingsOrganizerForm
|
|||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.no_orga_selected"));
|
||||
"publications.ui.proceedings.organizer.no_orga_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit organizer = (GenericOrganizationalUnit) data.get(ITEM_SEARCH);
|
||||
if (!(organizer.getContentBundle().hasInstance(proceedings.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
getSelectedObject(state);
|
||||
GenericOrganizationalUnit organizer = (GenericOrganizationalUnit) data
|
||||
.get(ITEM_SEARCH);
|
||||
if (!(organizer.getContentBundle()
|
||||
.hasInstance(proceedings.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
organizer = (GenericOrganizationalUnit) organizer.getContentBundle()
|
||||
.getInstance(proceedings.getLanguage());
|
||||
ProceedingsOrganizerCollection organizers = proceedings.getOrganizers();
|
||||
organizers.addFilter(String.format("id = %s",
|
||||
organizer
|
||||
.getContentBundle()
|
||||
.getID()
|
||||
.toString()));
|
||||
if (organizers.size() > 0) {
|
||||
data.addError(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_organizer.already_added"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -42,14 +42,14 @@ public class ProceedingsOrganizerStep extends SimpleEditStep {
|
|||
final String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm setOrganizerForm = new ProceedingsOrganizerForm(itemModel);
|
||||
BasicItemForm setOrganizerForm = new ProceedingsOrganizerAddForm(itemModel);
|
||||
add(SET_PROCEEDINGS_ORGANIZER_STEP,
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.setOrganizer"),
|
||||
new WorkflowLockedComponentAccess(setOrganizerForm, itemModel),
|
||||
setOrganizerForm.getSaveCancelSection().getCancelButton());
|
||||
|
||||
ProceedingsOrganizerSheet sheet = new ProceedingsOrganizerSheet(
|
||||
ProceedingsOrganizerTable sheet = new ProceedingsOrganizerTable(
|
||||
itemModel);
|
||||
setDisplayComponent(sheet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,59 +36,75 @@ import com.arsdigita.cms.ContentSection;
|
|||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
|
||||
import com.arsdigita.cms.contenttypes.Proceedings;
|
||||
import com.arsdigita.cms.contenttypes.ProceedingsOrganizerCollection;
|
||||
import com.arsdigita.cms.dispatcher.ItemResolver;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
import com.arsdigita.dispatcher.ObjectNotFoundException;
|
||||
import com.arsdigita.util.LockableImpl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Jens Pelzetter
|
||||
*/
|
||||
public class ProceedingsOrganizerSheet
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
public class ProceedingsOrganizerTable
|
||||
extends Table
|
||||
implements TableActionListener {
|
||||
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private final String TABLE_COL_UP = "table_col_up";
|
||||
private final String TABLE_COL_DOWN = "table_col_down";
|
||||
private ItemSelectionModel itemModel;
|
||||
|
||||
public ProceedingsOrganizerSheet(final ItemSelectionModel itemModel) {
|
||||
public ProceedingsOrganizerTable(final ItemSelectionModel itemModel) {
|
||||
super();
|
||||
|
||||
this.itemModel = itemModel;
|
||||
|
||||
setEmptyView(new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.none")));
|
||||
"publications.ui.proceedings.organizer.none")));
|
||||
|
||||
TableColumnModel columnModel = getColumnModel();
|
||||
columnModel.add(new TableColumn(
|
||||
0,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer")),
|
||||
TABLE_COL_EDIT));
|
||||
0,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer")),
|
||||
TABLE_COL_EDIT));
|
||||
columnModel.add(new TableColumn(
|
||||
1,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.remove")),
|
||||
TABLE_COL_DEL));
|
||||
1,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.remove")),
|
||||
TABLE_COL_DEL));
|
||||
columnModel.add(new TableColumn(
|
||||
2,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.up")),
|
||||
TABLE_COL_UP));
|
||||
columnModel.add(new TableColumn(
|
||||
3,
|
||||
new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.down")),
|
||||
TABLE_COL_DOWN));
|
||||
|
||||
setModelBuilder(new ProceedingsOrganizerSheetModelBuilder(itemModel));
|
||||
setModelBuilder(new ProceedingsOrganizerTableModelBuilder(itemModel));
|
||||
columnModel.get(0).setCellRenderer(new EditCellRenderer());
|
||||
columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
|
||||
columnModel.get(2).setCellRenderer(new UpCellRenderer());
|
||||
columnModel.get(3).setCellRenderer(new DownCellRenderer());
|
||||
|
||||
addTableActionListener(this);
|
||||
}
|
||||
|
||||
private class ProceedingsOrganizerSheetModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
private class ProceedingsOrganizerTableModelBuilder
|
||||
extends LockableImpl
|
||||
implements TableModelBuilder {
|
||||
|
||||
private ItemSelectionModel itemModel;
|
||||
|
||||
public ProceedingsOrganizerSheetModelBuilder(
|
||||
final ItemSelectionModel itemModel) {
|
||||
public ProceedingsOrganizerTableModelBuilder(
|
||||
final ItemSelectionModel itemModel) {
|
||||
this.itemModel = itemModel;
|
||||
}
|
||||
|
||||
|
|
@ -96,27 +112,23 @@ public class ProceedingsOrganizerSheet
|
|||
public TableModel makeModel(final Table table, final PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||
state);
|
||||
return new ProceedingsOrganizerSheetModel(table, state, proceedings);
|
||||
state);
|
||||
return new ProceedingsOrganizerTableModel(table, state, proceedings);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class ProceedingsOrganizerSheetModel implements TableModel {
|
||||
private class ProceedingsOrganizerTableModel implements TableModel {
|
||||
|
||||
private Table table;
|
||||
private ProceedingsOrganizerCollection organizers;
|
||||
private GenericOrganizationalUnit organizer;
|
||||
private boolean done;
|
||||
|
||||
public ProceedingsOrganizerSheetModel(final Table table,
|
||||
public ProceedingsOrganizerTableModel(final Table table,
|
||||
final PageState state,
|
||||
final Proceedings proceedings) {
|
||||
this.table = table;
|
||||
organizer = proceedings.getOrganizerOfConference();
|
||||
if (organizer == null) {
|
||||
done = false;
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
organizers = proceedings.getOrganizers();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -128,13 +140,12 @@ public class ProceedingsOrganizerSheet
|
|||
public boolean nextRow() {
|
||||
boolean ret;
|
||||
|
||||
if (done) {
|
||||
if ((organizers != null) && organizers.next()) {
|
||||
organizer = organizers.getOrganizer();
|
||||
ret = true;
|
||||
done = false;
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +156,13 @@ public class ProceedingsOrganizerSheet
|
|||
return organizer.getTitle();
|
||||
case 1:
|
||||
return new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.remove"));
|
||||
"publications.ui.proceedings.organizer.remove"));
|
||||
case 2:
|
||||
return new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.up"));
|
||||
case 3:
|
||||
return new Label(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.down"));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
@ -155,11 +172,12 @@ public class ProceedingsOrganizerSheet
|
|||
public Object getKeyAt(final int columnIndex) {
|
||||
return organizer.getID();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class EditCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(Table table,
|
||||
|
|
@ -169,10 +187,10 @@ public class ProceedingsOrganizerSheet
|
|||
Object key,
|
||||
int row,
|
||||
int column) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
CMS.getSecurityManager(state);
|
||||
com.arsdigita.cms.SecurityManager securityManager = CMS
|
||||
.getSecurityManager(state);
|
||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||
state);
|
||||
state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
|
||||
|
|
@ -181,26 +199,26 @@ public class ProceedingsOrganizerSheet
|
|||
GenericOrganizationalUnit organizer;
|
||||
try {
|
||||
organizer = new GenericOrganizationalUnit(
|
||||
(BigDecimal) key);
|
||||
(BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
||||
ContentSection section = organizer.getContentSection();//CMS.getContext().getContentSection();
|
||||
ItemResolver resolver = section.getItemResolver();
|
||||
Link link =
|
||||
new Link(value.toString(),
|
||||
resolver.generateItemURL(state,
|
||||
organizer,
|
||||
section,
|
||||
organizer.getVersion()));
|
||||
Link link = new Link(value.toString(),
|
||||
resolver.generateItemURL(state,
|
||||
organizer,
|
||||
section,
|
||||
organizer
|
||||
.getVersion()));
|
||||
|
||||
return link;
|
||||
} else {
|
||||
GenericOrganizationalUnit organizer;
|
||||
try {
|
||||
organizer = new GenericOrganizationalUnit(
|
||||
(BigDecimal) key);
|
||||
(BigDecimal) key);
|
||||
} catch (ObjectNotFoundException ex) {
|
||||
return new Label(value.toString());
|
||||
}
|
||||
|
|
@ -209,11 +227,12 @@ public class ProceedingsOrganizerSheet
|
|||
return label;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class DeleteCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(Table table,
|
||||
|
|
@ -223,39 +242,106 @@ public class ProceedingsOrganizerSheet
|
|||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
com.arsdigita.cms.SecurityManager securityManager =
|
||||
Utilities.getSecurityManager(state);
|
||||
com.arsdigita.cms.SecurityManager securityManager = Utilities
|
||||
.getSecurityManager(state);
|
||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||
state);
|
||||
state);
|
||||
|
||||
boolean canEdit = securityManager.canAccess(
|
||||
state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||
proceedings);
|
||||
state.getRequest(),
|
||||
com.arsdigita.cms.SecurityManager.DELETE_ITEM,
|
||||
proceedings);
|
||||
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink((Label) value);
|
||||
link.setConfirmation(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.organizer.remove.confirm"));
|
||||
"publications.ui.proceedings.organizer.remove.confirm"));
|
||||
return link;
|
||||
} else {
|
||||
return new Label("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class UpCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
if (0 == row) {
|
||||
Label label = new Label();
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink((Label) value);
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class DownCellRenderer
|
||||
extends LockableImpl
|
||||
implements TableCellRenderer {
|
||||
|
||||
@Override
|
||||
public Component getComponent(
|
||||
Table table,
|
||||
PageState state,
|
||||
Object value,
|
||||
boolean isSelected,
|
||||
Object key,
|
||||
int row,
|
||||
int col) {
|
||||
|
||||
Proceedings proceedings = (Proceedings) itemModel
|
||||
.getSelectedObject(state);
|
||||
ProceedingsOrganizerCollection organizers = proceedings
|
||||
.getOrganizers();
|
||||
|
||||
if ((organizers.size() - 1) == row) {
|
||||
Label label = new Label();
|
||||
return label;
|
||||
} else {
|
||||
ControlLink link = new ControlLink((Label) value);
|
||||
return link;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cellSelected(final TableActionEvent event) {
|
||||
PageState state = event.getPageState();
|
||||
|
||||
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
|
||||
final GenericOrganizationalUnit organizer
|
||||
= new GenericOrganizationalUnit(
|
||||
new BigDecimal(event.getRowKey().toString()));
|
||||
|
||||
final Proceedings proceedings = (Proceedings) itemModel
|
||||
.getSelectedObject(
|
||||
state);
|
||||
|
||||
TableColumn column = getColumnModel().get(event.getColumn().intValue());
|
||||
final ProceedingsOrganizerCollection organizers = proceedings
|
||||
.getOrganizers();
|
||||
|
||||
final TableColumn column = getColumnModel().get(event.getColumn()
|
||||
.intValue());
|
||||
|
||||
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
proceedings.setOrganizerOfConference(null);
|
||||
proceedings.removeOrganizer(organizer);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
|
||||
organizers.swapWithPrevious(organizer);
|
||||
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
|
||||
organizers.swapWithNext(organizer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,4 +349,5 @@ public class ProceedingsOrganizerSheet
|
|||
public void headSelected(final TableActionEvent event) {
|
||||
//Nothing to do.
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -43,9 +43,9 @@ import java.math.BigDecimal;
|
|||
* @version $Id$
|
||||
*/
|
||||
public class ProceedingsPapersAddForm
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
extends BasicItemForm
|
||||
implements FormProcessListener,
|
||||
FormInitListener {
|
||||
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private final String ITEM_SEARCH = "papers";
|
||||
|
|
@ -64,12 +64,13 @@ public class ProceedingsPapersAddForm
|
|||
@Override
|
||||
protected void addWidgets() {
|
||||
m_itemSearch = new ItemSearchWidget(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
ITEM_SEARCH,
|
||||
ContentType.findByAssociatedObjectType(
|
||||
InProceedings.class.getName()));
|
||||
m_itemSearch.setDefaultCreationFolder(config.getDefaultInProceedingsFolder());
|
||||
m_itemSearch.setDefaultCreationFolder(config
|
||||
.getDefaultInProceedingsFolder());
|
||||
m_itemSearch.setLabel(PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_paper"));
|
||||
"publications.ui.proceedings.select_paper"));
|
||||
add(m_itemSearch);
|
||||
}
|
||||
|
||||
|
|
@ -86,13 +87,14 @@ public class ProceedingsPapersAddForm
|
|||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
getSelectedObject(state);
|
||||
|
||||
if (!(this.getSaveCancelSection().getCancelButton().
|
||||
isSelected(state))) {
|
||||
InProceedings paper = (InProceedings) data.get(ITEM_SEARCH);
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.
|
||||
getLanguage());
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(
|
||||
proceedings.
|
||||
getLanguage());
|
||||
|
||||
proceedings.addPaper(paper);
|
||||
m_itemSearch.publishCreatedItem(data, paper);
|
||||
|
|
@ -108,32 +110,34 @@ public class ProceedingsPapersAddForm
|
|||
|
||||
if (data.get(ITEM_SEARCH) == null) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_paper.no_paper_selected"));
|
||||
return;
|
||||
}
|
||||
|
||||
Proceedings proceedings = (Proceedings) getItemSelectionModel().
|
||||
getSelectedObject(state);
|
||||
getSelectedObject(state);
|
||||
InProceedings paper = (InProceedings) data.get(ITEM_SEARCH);
|
||||
if (!(paper.getContentBundle().hasInstance(proceedings.getLanguage(),
|
||||
Kernel.getConfig().
|
||||
languageIndependentItems()))) {
|
||||
languageIndependentItems()))) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_paper.no_suitable_language_variant"));
|
||||
return;
|
||||
}
|
||||
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings.
|
||||
getLanguage());
|
||||
paper = (InProceedings) paper.getContentBundle().getInstance(proceedings
|
||||
.getLanguage());
|
||||
InProceedingsCollection papers = proceedings.getPapers();
|
||||
papers.addFilter(String.format("id = %s", paper.getID().toString()));
|
||||
papers.addFilter(String.format("id = %s", paper.getContentBundle()
|
||||
.getID().toString()));
|
||||
if (papers.size() > 0) {
|
||||
data.addError(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
PublicationGlobalizationUtil.globalize(
|
||||
"publications.ui.proceedings.select_paper.already_added"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue