Tabellen für Verknüpfungen um Anzeige der Sprache des verknüpften Items ergänzt.

git-svn-id: https://svn.libreccm.org/ccm/trunk@978 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-06-23 09:49:00 +00:00
parent fe237419bf
commit e0571cf4ee
37 changed files with 1200 additions and 199 deletions

View File

@ -60,6 +60,8 @@ import org.apache.log4j.Logger;
* *
* @author Jens Pelzetter * @author Jens Pelzetter
*/ */
public class GenericOrganizationalUnitContactTable extends Table implements public class GenericOrganizationalUnitContactTable extends Table implements
TableActionListener { TableActionListener {
@ -271,14 +273,25 @@ public class GenericOrganizationalUnitContactTable extends Table implements
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
contact.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
contact, contact,
section, section,
contact.getVersion())); contact.getVersion()));
return link; return link;
} else { } else {
return new Label(value.toString()); GenericContact contact;
try {
contact = new GenericContact((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)", value.toString(),
contact.getLanguage()));
return label;
} }
} }
} }
@ -385,7 +398,8 @@ public class GenericOrganizationalUnitContactTable extends Table implements
int row, int row,
int col) { int col) {
GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. GenericOrganizationalUnit orgaunit =
(GenericOrganizationalUnit) m_itemModel.
getSelectedObject(state); getSelectedObject(state);
GenericOrganizationalUnitContactCollection contacts = GenericOrganizationalUnitContactCollection contacts =
orgaunit.getContacts(); orgaunit.getContacts();

View File

@ -247,7 +247,9 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
person.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
person, person,
section, section,
@ -255,7 +257,21 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
return link; return link;
} else { } else {
return new Label(value.toString()); GenericPerson person;
try {
person = new GenericPerson((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
person.getLanguage()));
return label;
} }
} }
} }

View File

@ -260,14 +260,27 @@ public class GenericPersonContactTable extends Table implements
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
contact.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
contact, contact,
section, section,
contact.getVersion())); contact.getVersion()));
return link; return link;
} else { } else {
return new Label(value.toString()); GenericContact contact;
try {
contact = new GenericContact((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
contact.getLanguage()));
return label;
} }
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,17 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;
import com.arsdigita.cms.contenttypes.CollectedVolume; import com.arsdigita.cms.contenttypes.CollectedVolume;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* Sheet which displays the collected volume to which an article in a collected * Sheet which displays the collected volume to which an article in a collected
@ -98,7 +104,8 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
@Override @Override
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
ArticleInCollectedVolume article = (ArticleInCollectedVolume) itemModel. ArticleInCollectedVolume article =
(ArticleInCollectedVolume) itemModel.
getSelectedObject(state); getSelectedObject(state);
return new ArticleInCollectedVolumeCollectedVolumeSheetModel(table, return new ArticleInCollectedVolumeCollectedVolumeSheetModel(table,
state, state,
@ -173,8 +180,49 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
ArticleInCollectedVolume article =
(ArticleInCollectedVolume) itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
SecurityManager.EDIT_ITEM,
article);
if (canEdit) {
CollectedVolume collectedVolume;
try {
collectedVolume = new CollectedVolume((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section =
CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(
String.format("%s (%s)",
value.toString(),
collectedVolume.getLanguage()),
resolver.generateItemURL(state,
collectedVolume,
section,
collectedVolume.getVersion()));
return link;
} else {
CollectedVolume collectedVolume;
try {
collectedVolume = new CollectedVolume((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
collectedVolume.
getLanguage()));
return label;
}
} }
} }
@ -191,7 +239,8 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet
int column) { int column) {
SecurityManager securityManager = SecurityManager securityManager =
Utilities.getSecurityManager(state); Utilities.getSecurityManager(state);
ArticleInCollectedVolume article = (ArticleInCollectedVolume) itemModel. ArticleInCollectedVolume article =
(ArticleInCollectedVolume) itemModel.
getSelectedObject(state); getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,17 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.ArticleInJournal; import com.arsdigita.cms.contenttypes.ArticleInJournal;
import com.arsdigita.cms.contenttypes.Journal; import com.arsdigita.cms.contenttypes.Journal;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -161,8 +167,48 @@ public class ArticleInJournalJournalSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
ArticleInJournal article = (ArticleInJournal) itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(
state.getRequest(),
SecurityManager.EDIT_ITEM,
article);
if (canEdit) {
Journal journal;
try {
journal = new Journal((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
journal.getLanguage()),
resolver.generateItemURL(state,
journal,
section,
journal.getVersion()));
return link;
} else {
Journal journal;
try {
journal = new Journal((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
journal.getLanguage()));
return label;
}
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume;
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection;
import com.arsdigita.cms.contenttypes.CollectedVolume; import com.arsdigita.cms.contenttypes.CollectedVolume;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -198,10 +203,42 @@ public class CollectedVolumeArticlesTable
collectedVolume); collectedVolume);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ArticleInCollectedVolume article;
try {
article = new ArticleInCollectedVolume((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
article.getLanguage()),
resolver.generateItemURL(state,
article,
section,
article.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); ArticleInCollectedVolume article;
try {
article = new ArticleInCollectedVolume((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
article.getLanguage()));
return label; return label;
} }
} }
@ -310,19 +347,19 @@ public class CollectedVolumeArticlesTable
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
CollectedVolume collectedVolume = CollectedVolume collectedVolume =
(CollectedVolume) m_itemModel.getSelectedObject(state); (CollectedVolume) m_itemModel.getSelectedObject(state);
ArticleInCollectedVolumeCollection articles = ArticleInCollectedVolumeCollection articles =
collectedVolume.getArticles(); collectedVolume.getArticles();
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
collectedVolume.removeArticle(article); collectedVolume.removeArticle(article);
} else if(column.getHeaderKey().toString().equals(TABLE_COL_UP)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
articles.swapWithPrevious(article); articles.swapWithPrevious(article);
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
articles.swapWithNext(article); articles.swapWithNext(article);
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,11 +13,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Expertise; import com.arsdigita.cms.contenttypes.Expertise;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -140,8 +146,46 @@ public class ExpertiseOrdererSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
Expertise expertise = (Expertise) itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
expertise);
if (canEdit) {
GenericOrganizationalUnit orderer;
try {
orderer = new GenericOrganizationalUnit((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
orderer.getLanguage()),
resolver.generateItemURL(state,
orderer,
section,
orderer.getVersion()));
return link;
} else {
GenericOrganizationalUnit orderer;
try {
orderer = new GenericOrganizationalUnit((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
orderer.getLanguage()));
return label;
}
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,11 +13,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.Expertise; import com.arsdigita.cms.contenttypes.Expertise;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -141,8 +147,46 @@ public class ExpertiseOrganizationSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
Expertise expertise = (Expertise) itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
expertise);
if (canEdit) {
GenericOrganizationalUnit orga;
try {
orga = new GenericOrganizationalUnit((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
orga.getLanguage()),
resolver.generateItemURL(state,
orga,
section,
orga.getVersion()));
return link;
} else {
GenericOrganizationalUnit orga;
try {
orga = new GenericOrganizationalUnit((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
orga.getLanguage()));
return label;
}
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,17 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.InProceedings; import com.arsdigita.cms.contenttypes.InProceedings;
import com.arsdigita.cms.contenttypes.Proceedings; import com.arsdigita.cms.contenttypes.Proceedings;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* Sheet which displays the proceedings associated with a InProceedings. * Sheet which displays the proceedings associated with a InProceedings.
@ -170,8 +176,48 @@ public class InProceedingsProceedingsSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
InProceedings inProceedings = (InProceedings) itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
inProceedings);
if (canEdit) {
Proceedings proceedings;
try {
proceedings = new Proceedings((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
proceedings.getLanguage()),
resolver.generateItemURL(state,
proceedings,
section,
proceedings.getVersion()));
return link;
} else {
Proceedings proceedings;
try {
proceedings = new Proceedings((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label =
new Label(String.format("%s (%s)",
value.toString(),
proceedings.getLanguage()));
return label;
}
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,11 +13,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.InternetArticle; import com.arsdigita.cms.contenttypes.InternetArticle;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -145,8 +151,50 @@ public class InternetArticleOrganizationSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
InternetArticle article = (InternetArticle) itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
article);
if (canEdit) {
GenericOrganizationalUnit organization;
try {
organization = new GenericOrganizationalUnit(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
organization.getLanguage()),
resolver.generateItemURL(state,
organization,
section,
organization.getVersion()));
return link;
} else {
GenericOrganizationalUnit organization;
try {
organization = new GenericOrganizationalUnit(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
organization.getLanguage()));
return label;
}
} }
} }

View File

@ -210,14 +210,28 @@ public class JournalArticlesTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
article.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
article, article,
section, section,
article.getVersion())); article.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); ArticleInJournal article;
try {
article = new ArticleInJournal((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
article.getLanguage()));
return label; return label;
} }
} }
@ -296,8 +310,7 @@ public class JournalArticlesTable
int row, int row,
int col) { int col) {
Journal journal = (Journal) m_itemModel. Journal journal = (Journal) m_itemModel.getSelectedObject(state);
getSelectedObject(state);
ArticleInJournalCollection articles = journal.getArticles(); ArticleInJournalCollection articles = journal.getArticles();
if ((articles.size() - 1) == row) { if ((articles.size() - 1) == row) {
@ -335,9 +348,9 @@ public class JournalArticlesTable
} else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) { } else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
s_log.debug("Removing article assoc..."); s_log.debug("Removing article assoc...");
journal.removeArticle(article); journal.removeArticle(article);
} else if(col.getHeaderKey().toString().equals(TABLE_COL_UP)) { } else if (col.getHeaderKey().toString().equals(TABLE_COL_UP)) {
articles.swapWithPrevious(article); articles.swapWithPrevious(article);
} else if(col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { } else if (col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
articles.swapWithNext(article); articles.swapWithNext(article);
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,11 +13,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.Proceedings; import com.arsdigita.cms.contenttypes.Proceedings;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -142,8 +148,50 @@ public class ProceedingsOrganizerSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
Proceedings proceedings = (Proceedings) itemModel.getSelectedObject(
state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
proceedings);
if (canEdit) {
GenericOrganizationalUnit organizer;
try {
organizer = new GenericOrganizationalUnit(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
organizer.getLanguage()),
resolver.generateItemURL(state,
organizer,
section,
organizer.getVersion()));
return link;
} else {
GenericOrganizationalUnit organizer;
try {
organizer = new GenericOrganizationalUnit(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
organizer.getLanguage()));
return label;
}
} }
} }
@ -192,7 +240,7 @@ public class ProceedingsOrganizerSheet
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
proceedings.setOrganizerOfConference(null); proceedings.setOrganizerOfConference(null);
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,14 +32,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection;
import com.arsdigita.cms.contenttypes.CollectedVolume;
import com.arsdigita.cms.contenttypes.InProceedings; import com.arsdigita.cms.contenttypes.InProceedings;
import com.arsdigita.cms.contenttypes.InProceedingsCollection; import com.arsdigita.cms.contenttypes.InProceedingsCollection;
import com.arsdigita.cms.contenttypes.Proceedings; import com.arsdigita.cms.contenttypes.Proceedings;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -204,10 +207,44 @@ public class ProceedingsPapersTable
proceedings); proceedings);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); InProceedings inProceedings;
try {
inProceedings = new InProceedings((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(String.format("%s (%s)",
value.toString(),
inProceedings.getLanguage()),
resolver.generateItemURL(state,
inProceedings,
section,
inProceedings.
getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); InProceedings inProceedings;
try {
inProceedings = new InProceedings((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
inProceedings.getLanguage()));
return label; return label;
} }
} }
@ -258,7 +295,7 @@ public class ProceedingsPapersTable
PageState state, PageState state,
Object value, Object value,
boolean isSelected, boolean isSelected,
Object key, Object key,
int row, int row,
int col) { int col) {
if (0 == row) { if (0 == row) {
@ -287,10 +324,10 @@ public class ProceedingsPapersTable
int col) { int col) {
Proceedings proceedings = Proceedings proceedings =
(Proceedings) m_itemModel.getSelectedObject( (Proceedings) m_itemModel.getSelectedObject(
state); state);
InProceedingsCollection papers = InProceedingsCollection papers =
proceedings.getPapers(); proceedings.getPapers();
if ((papers.size() - 1) if ((papers.size() - 1)
== row) { == row) {
@ -313,20 +350,19 @@ public class ProceedingsPapersTable
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
Proceedings proceedings = Proceedings proceedings =
(Proceedings) m_itemModel.getSelectedItem(state); (Proceedings) m_itemModel.getSelectedItem(state);
InProceedingsCollection papers = InProceedingsCollection papers =
proceedings.getPapers(); proceedings.getPapers();
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
proceedings.removePaper(paper); proceedings.removePaper(paper);
} else if(column.getHeaderKey().toString().equals(TABLE_COL_UP)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
papers.swapWithPrevious(paper); papers.swapWithPrevious(paper);
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
papers.swapWithNext(paper); papers.swapWithNext(paper);
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,13 +32,17 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.AuthorshipCollection; import com.arsdigita.cms.contenttypes.AuthorshipCollection;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -227,10 +232,42 @@ public class PublicationAuthorsTable
publication); publication);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); GenericPerson author;
try {
author = new GenericPerson((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
author.getLanguage()),
resolver.generateItemURL(state,
author,
section,
author.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); GenericPerson author;
try {
author = new GenericPerson((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
author.getLanguage()));
return label; return label;
} }
} }
@ -380,19 +417,19 @@ public class PublicationAuthorsTable
} else if (column.getHeaderKey().toString().equals( } else if (column.getHeaderKey().toString().equals(
TABLE_COL_EDIT_ASSOC)) { TABLE_COL_EDIT_ASSOC)) {
while(authors.next()) { while (authors.next()) {
if (authors.getAuthor().equals(author)) { if (authors.getAuthor().equals(author)) {
break; break;
} }
} }
((PublicationAuthorsPropertyStep)editStep).setSelectedAuthor(author); ((PublicationAuthorsPropertyStep) editStep).setSelectedAuthor(author);
((PublicationAuthorsPropertyStep)editStep).setSelectedAuthorEditor( ((PublicationAuthorsPropertyStep) editStep).setSelectedAuthorEditor(
authors.isEditor()); authors.isEditor());
editStep.showComponent(state, editStep.showComponent(state,
PublicationAuthorsPropertyStep.ADD_AUTHOR_SHEET_NAME); PublicationAuthorsPropertyStep.ADD_AUTHOR_SHEET_NAME);
authors.close(); authors.close();
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
publication.removeAuthor(author); publication.removeAuthor(author);

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.Series;
import com.arsdigita.cms.contenttypes.SeriesCollection; import com.arsdigita.cms.contenttypes.SeriesCollection;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -179,10 +184,42 @@ public class PublicationSeriesTable
publication); publication);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); Series series;
try {
series = new Series((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
series.getLanguage()),
resolver.generateItemURL(state,
series,
section,
series.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Series series;
try {
series = new Series((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
series.getLanguage()));
return label; return label;
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,11 +13,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.PublicationWithPublisher; import com.arsdigita.cms.contenttypes.PublicationWithPublisher;
import com.arsdigita.cms.contenttypes.Publisher; import com.arsdigita.cms.contenttypes.Publisher;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -72,7 +78,8 @@ public class PublicationWithPublisherSetPublisherSheet
@Override @Override
public TableModel makeModel(final Table table, final PageState state) { public TableModel makeModel(final Table table, final PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
PublicationWithPublisher publication = (PublicationWithPublisher) itemModel. PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject(state); getSelectedObject(state);
return new PublicationWithPublisherSetPublisherSheetModel(table, return new PublicationWithPublisherSetPublisherSheetModel(table,
state, state,
@ -146,8 +153,51 @@ public class PublicationWithPublisherSetPublisherSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
publication);
if (canEdit) {
Publisher publisher;
try {
publisher = new Publisher(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
publisher.getLanguage()),
resolver.generateItemURL(state,
publisher,
section,
publisher.getVersion()));
return link;
} else {
Publisher publisher;
try {
publisher = new Publisher(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
publisher.getLanguage()));
return label;
}
} }
} }
@ -165,7 +215,8 @@ public class PublicationWithPublisherSetPublisherSheet
int col) { int col) {
com.arsdigita.cms.SecurityManager securityManager = com.arsdigita.cms.SecurityManager securityManager =
Utilities.getSecurityManager(state); Utilities.getSecurityManager(state);
PublicationWithPublisher publication = (PublicationWithPublisher) itemModel. PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject( getSelectedObject(
state); state);
@ -191,13 +242,14 @@ public class PublicationWithPublisherSetPublisherSheet
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.getSelectedObject(state); PublicationWithPublisher publication =
(PublicationWithPublisher) itemModel.
getSelectedObject(state);
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) { if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
} else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
} else if(column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
publication.setPublisher(null); publication.setPublisher(null);
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,16 +32,18 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.EditshipCollection; import com.arsdigita.cms.contenttypes.EditshipCollection;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.Series;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.domain.DomainObject; import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DateFormat; import java.text.DateFormat;
@ -235,10 +238,40 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
series); series);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); GenericPerson editor;
try {
editor = new GenericPerson((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
editor.getLanguage()),
resolver.generateItemURL(state,
editor,
section,
editor.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); GenericPerson editor;
try {
editor = new GenericPerson((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
editor.getLanguage()));
return label; return label;
} }
} }
@ -315,7 +348,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
private class UpCellRenderer private class UpCellRenderer
extends LockableImpl extends LockableImpl
implements TableCellRenderer { implements TableCellRenderer {
@Override @Override
public Component getComponent( public Component getComponent(
Table table, Table table,
@ -325,7 +358,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
Object key, Object key,
int row, int row,
int col) { int col) {
if (0 == row) { if (0 == row) {
s_log.debug("Row is first row in table, don't show up link"); s_log.debug("Row is first row in table, don't show up link");
Label label = new Label(""); Label label = new Label("");
@ -341,7 +374,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
private class DownCellRenderer private class DownCellRenderer
extends LockableImpl extends LockableImpl
implements TableCellRenderer { implements TableCellRenderer {
@Override @Override
public Component getComponent( public Component getComponent(
Table table, Table table,
@ -351,11 +384,11 @@ public class SeriesEditshipTable extends Table implements TableActionListener {
Object key, Object key,
int row, int row,
int col) { int col) {
Series = (Series) m_itemModel. Series = (Series) m_itemModel.
getSelectedObject(state); getSelectedObject(state);
EditshipCollection editors = series.getEditors(); EditshipCollection editors = series.getEditors();
if ((editors.size() - 1) if ((editors.size() - 1)
== row) { == row) {
s_log.debug("Row is last row in table, don't show down link"); s_log.debug("Row is last row in table, don't show down link");

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Publication;
import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.Series;
import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection; import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -179,10 +184,42 @@ public class SeriesVolumesTable extends Table implements TableActionListener {
series); series);
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); Publication volume;
try {
volume = new Publication((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
volume.getLanguage()),
resolver.generateItemURL(state,
volume,
section,
volume.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Publication volume;
try {
volume = new Publication((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
volume.getLanguage()));
return label; return label;
} }
} }

View File

@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -12,12 +13,18 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.Publisher;
import com.arsdigita.cms.contenttypes.UnPublished; import com.arsdigita.cms.contenttypes.UnPublished;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* *
@ -143,8 +150,50 @@ public class UnPublishedOrganizationSheet
final Object key, final Object key,
final int row, final int row,
final int column) { final int column) {
Label label = new Label(value.toString()); com.arsdigita.cms.SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
UnPublished unPublished =
(UnPublished) itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
unPublished);
if (canEdit) {
GenericOrganizationalUnit organization;
try {
organization = new Publisher(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(String.format("%s (%s)",
value.toString(),
organization.getLanguage()),
resolver.generateItemURL(state,
organization,
section,
organization.getVersion()));
return link;
} else {
GenericOrganizationalUnit organization;
try {
organization = new Publisher(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
organization.getLanguage()));
return label;
}
} }
} }

View File

@ -86,15 +86,15 @@ public class SciDepartmentProjectsTable
"sciorganization.ui.department.project.remove").localize(), "sciorganization.ui.department.project.remove").localize(),
TABLE_COL_DEL)); TABLE_COL_DEL));
/*colModel.add(new TableColumn( /*colModel.add(new TableColumn(
2, 2,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.project.up").localize(), "sciorganization.ui.department.project.up").localize(),
TABLE_COL_UP)); TABLE_COL_UP));
colModel.add(new TableColumn( colModel.add(new TableColumn(
3, 3,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.project.down").localize(), "sciorganization.ui.department.project.down").localize(),
TABLE_COL_DOWN));*/ TABLE_COL_DOWN));*/
setModelBuilder( setModelBuilder(
new SciDepartmentProjectsTableModelBuilder(itemModel)); new SciDepartmentProjectsTableModelBuilder(itemModel));
@ -226,7 +226,9 @@ public class SciDepartmentProjectsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
project.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
project, project,
section, section,
@ -234,7 +236,19 @@ public class SciDepartmentProjectsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciProject project;
try {
project = new SciProject((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
project.getLanguage()));
return label; return label;
} }
} }

View File

@ -223,7 +223,9 @@ public class SciDepartmentSubDepartmentsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
subDepartment.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
subDepartment, subDepartment,
section, section,
@ -234,7 +236,20 @@ public class SciDepartmentSubDepartmentsTable
} else { } else {
Label label = new Label(value.toString()); SciDepartment subDepartment;
try {
subDepartment = new SciDepartment(
(BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
subDepartment.getLanguage()));
return label; return label;
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,11 +32,16 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.SciDepartment; import com.arsdigita.cms.contenttypes.SciDepartment;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
/** /**
* Sheet for showing the superior department of a {@link SciDepartment}. * Sheet for showing the superior department of a {@link SciDepartment}.
@ -170,8 +176,51 @@ public class SciDepartmentSuperDepartmentSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
SciDepartment department = (SciDepartment) m_itemModel.
getSelectedObject(state);
boolean canEdit = securityManager.canAccess(
state.getRequest(),
SecurityManager.EDIT_ITEM,
department);
if (canEdit) {
SciDepartment subDepartment;
try {
subDepartment = new SciDepartment((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(String.format("%s (%s)",
value.toString(),
subDepartment.getLanguage()),
resolver.generateItemURL(state,
subDepartment,
section,
subDepartment.
getVersion()));
return link;
} else {
SciDepartment subDepartment;
try {
subDepartment = new SciDepartment((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
subDepartment.getLanguage()));
return label;
}
} }
} }
@ -215,7 +264,8 @@ public class SciDepartmentSuperDepartmentSheet
public void cellSelected(TableActionEvent event) { public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
SciDepartment department = (SciDepartment) m_itemModel.getSelectedObject( SciDepartment department =
(SciDepartment) m_itemModel.getSelectedObject(
state); state);
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());

View File

@ -47,7 +47,7 @@ public class SciMemberSciDepartmentsTable
private SciMemberSciDepartmentsStep step; private SciMemberSciDepartmentsStep step;
public SciMemberSciDepartmentsTable(ItemSelectionModel itemModel, public SciMemberSciDepartmentsTable(ItemSelectionModel itemModel,
SciMemberSciDepartmentsStep step) { SciMemberSciDepartmentsStep step) {
super(); super();
this.itemModel = itemModel; this.itemModel = itemModel;
this.step = step; this.step = step;
@ -103,8 +103,8 @@ public class SciMemberSciDepartmentsTable
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
SciMember member = (SciMember) itemModel.getSelectedObject(state); SciMember member = (SciMember) itemModel.getSelectedObject(state);
return new SciMemberSciDepartmentsTableModel(table, return new SciMemberSciDepartmentsTableModel(table,
state, state,
member); member);
} }
} }
@ -115,8 +115,8 @@ public class SciMemberSciDepartmentsTable
private SciDepartment department; private SciDepartment department;
public SciMemberSciDepartmentsTableModel(Table table, public SciMemberSciDepartmentsTableModel(Table table,
PageState state, PageState state,
SciMember member) { SciMember member) {
this.table = table; this.table = table;
this.departments = member.getDepartments(); this.departments = member.getDepartments();
} }
@ -146,7 +146,8 @@ public class SciMemberSciDepartmentsTable
case 0: case 0:
return department.getTitle(); return department.getTitle();
case 1: case 1:
RelationAttributeCollection role = new RelationAttributeCollection( RelationAttributeCollection role =
new RelationAttributeCollection(
"SciDepartmentRole", "SciDepartmentRole",
departments.getRoleName()); departments.getRoleName());
if (role.next()) { if (role.next()) {
@ -158,7 +159,8 @@ public class SciMemberSciDepartmentsTable
"cms.ui.unknownRole").localize(); "cms.ui.unknownRole").localize();
} }
case 2: case 2:
RelationAttributeCollection status = new RelationAttributeCollection( RelationAttributeCollection status =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus", "GenericOrganizationalUnitMemberStatus",
departments.getStatus()); departments.getStatus());
if (status.next()) { if (status.next()) {
@ -219,14 +221,28 @@ public class SciMemberSciDepartmentsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
department.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
department, department,
section, department. section,
department.
getVersion())); getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciDepartment department;
try {
department = new SciDepartment((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
logger.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
department.getLanguage()));
return label; return label;
} }
} }
@ -305,8 +321,7 @@ public class SciMemberSciDepartmentsTable
SciMember member = (SciMember) itemModel.getSelectedObject(state); SciMember member = (SciMember) itemModel.getSelectedObject(state);
SciMemberSciDepartmentsCollection departments = member. SciMemberSciDepartmentsCollection departments = member.getDepartments();
getDepartments();
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());

View File

@ -146,7 +146,8 @@ public class SciMemberSciOrganizationsTable
case 0: case 0:
return organization.getTitle(); return organization.getTitle();
case 1: case 1:
RelationAttributeCollection role = new RelationAttributeCollection( RelationAttributeCollection role =
new RelationAttributeCollection(
"SciOrganizationRole", "SciOrganizationRole",
organizations.getRoleName()); organizations.getRoleName());
if (role.next()) { if (role.next()) {
@ -158,7 +159,8 @@ public class SciMemberSciOrganizationsTable
"cms.ui.unknownRole").localize(); "cms.ui.unknownRole").localize();
} }
case 2: case 2:
RelationAttributeCollection status = new RelationAttributeCollection( RelationAttributeCollection status =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus", "GenericOrganizationalUnitMemberStatus",
organizations.getStatus()); organizations.getStatus());
if (status.next()) { if (status.next()) {
@ -219,14 +221,29 @@ public class SciMemberSciOrganizationsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
organization.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
organization, organization,
section, organization. section,
organization.
getVersion())); getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciOrganization organization;
try {
organization = new SciOrganization((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
logger.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
organization.getLanguage()));
return label; return label;
} }
} }

View File

@ -47,7 +47,7 @@ public class SciMemberSciProjectsTable
private SciMemberSciProjectsStep step; private SciMemberSciProjectsStep step;
public SciMemberSciProjectsTable(ItemSelectionModel itemModel, public SciMemberSciProjectsTable(ItemSelectionModel itemModel,
SciMemberSciProjectsStep step) { SciMemberSciProjectsStep step) {
super(); super();
this.itemModel = itemModel; this.itemModel = itemModel;
this.step = step; this.step = step;
@ -103,8 +103,8 @@ public class SciMemberSciProjectsTable
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
SciMember member = (SciMember) itemModel.getSelectedObject(state); SciMember member = (SciMember) itemModel.getSelectedObject(state);
return new SciMemberSciProjectsTableModel(table, return new SciMemberSciProjectsTableModel(table,
state, state,
member); member);
} }
} }
@ -115,8 +115,8 @@ public class SciMemberSciProjectsTable
private SciProject project; private SciProject project;
public SciMemberSciProjectsTableModel(Table table, public SciMemberSciProjectsTableModel(Table table,
PageState state, PageState state,
SciMember member) { SciMember member) {
this.table = table; this.table = table;
this.projects = member.getProjects(); this.projects = member.getProjects();
} }
@ -146,7 +146,8 @@ public class SciMemberSciProjectsTable
case 0: case 0:
return project.getTitle(); return project.getTitle();
case 1: case 1:
RelationAttributeCollection role = new RelationAttributeCollection( RelationAttributeCollection role =
new RelationAttributeCollection(
"SciProjectRole", "SciProjectRole",
projects.getRoleName()); projects.getRoleName());
if (role.next()) { if (role.next()) {
@ -158,7 +159,8 @@ public class SciMemberSciProjectsTable
"cms.ui.unknownRole").localize(); "cms.ui.unknownRole").localize();
} }
case 2: case 2:
RelationAttributeCollection status = new RelationAttributeCollection( RelationAttributeCollection status =
new RelationAttributeCollection(
"GenericOrganizationalUnitMemberStatus", "GenericOrganizationalUnitMemberStatus",
projects.getStatus()); projects.getStatus());
if (status.next()) { if (status.next()) {
@ -219,14 +221,28 @@ public class SciMemberSciProjectsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
project.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
project, project,
section, project. section, project.
getVersion())); getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciProject project;
try {
project = new SciProject((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
logger.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
project.getLanguage()));
return label; return label;
} }
} }
@ -300,13 +316,12 @@ public class SciMemberSciProjectsTable
public void cellSelected(TableActionEvent event) { public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState(); PageState state = event.getPageState();
SciProject project = new SciProject(new BigDecimal(event. SciProject project = new SciProject(new BigDecimal(event.getRowKey().
getRowKey().toString())); toString()));
SciMember member = (SciMember) itemModel.getSelectedObject(state); SciMember member = (SciMember) itemModel.getSelectedObject(state);
SciMemberSciProjectsCollection projects = member. SciMemberSciProjectsCollection projects = member.getProjects();
getProjects();
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());

View File

@ -235,7 +235,6 @@ public class SciOrganizationDepartmentsTable
getVersion())); getVersion()));
return link; return link;
} else { } else {
SciDepartment department; SciDepartment department;
try { try {

View File

@ -87,15 +87,15 @@ public class SciOrganizationProjectsTable
"sciorganization.ui.organization.project.remove").localize(), "sciorganization.ui.organization.project.remove").localize(),
TABLE_COL_DEL)); TABLE_COL_DEL));
/*colModel.add(new TableColumn( /*colModel.add(new TableColumn(
2, 2,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.organization.project.up").localize(), "sciorganization.ui.organization.project.up").localize(),
TABLE_COL_UP)); TABLE_COL_UP));
colModel.add(new TableColumn( colModel.add(new TableColumn(
3, 3,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.organization.project.down").localize(), "sciorganization.ui.organization.project.down").localize(),
TABLE_COL_DOWN));*/ TABLE_COL_DOWN));*/
setModelBuilder( setModelBuilder(
new SciOrganizationProjectsTableModelBuilder(itemModel)); new SciOrganizationProjectsTableModelBuilder(itemModel));
@ -226,7 +226,9 @@ public class SciOrganizationProjectsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
project.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
project, project,
section, section,
@ -235,7 +237,19 @@ public class SciOrganizationProjectsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciProject project;
try {
project = new SciProject((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
project.getLanguage()));
return label; return label;
} }
} }

View File

@ -218,7 +218,9 @@ public class SciProjectDepartmentsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
department.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
department, department,
section, section,
@ -226,7 +228,18 @@ public class SciProjectDepartmentsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciDepartment department;
try {
department = new SciDepartment((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
department.getLanguage()));
return label; return label;
} }
} }

View File

@ -225,7 +225,9 @@ public class SciProjectOrganizationsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
orga.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
orga, orga,
section, section,
@ -233,7 +235,19 @@ public class SciProjectOrganizationsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciOrganization orga;
try {
orga = new SciOrganization((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
orga.getLanguage()));
return label; return label;
} }
} }

View File

@ -83,15 +83,15 @@ public class SciProjectSubProjectsTable
"sciorganization.ui.project.subproject.remove").localize(), "sciorganization.ui.project.subproject.remove").localize(),
TABLE_COL_DEL)); TABLE_COL_DEL));
/*colModel.add(new TableColumn( /*colModel.add(new TableColumn(
2, 2,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.subproject.up").localize(), "sciorganization.ui.project.subproject.up").localize(),
TABLE_COL_UP)); TABLE_COL_UP));
colModel.add(new TableColumn( colModel.add(new TableColumn(
3, 3,
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.subproject.down").localize(), "sciorganization.ui.project.subproject.down").localize(),
TABLE_COL_DOWN));*/ TABLE_COL_DOWN));*/
setModelBuilder( setModelBuilder(
new SciProjectSubProjectsTableModelBuilder(itemModel)); new SciProjectSubProjectsTableModelBuilder(itemModel));
@ -221,7 +221,9 @@ public class SciProjectSubProjectsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
subProject.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
subProject, subProject,
section, section,
@ -231,7 +233,19 @@ public class SciProjectSubProjectsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciProject subProject;
try {
subProject = new SciProject((BigDecimal) key);
} catch (DataObjectNotFoundException ex) {
s_log.warn(String.format("No object with key '%s' found.",
key),
ex);
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
subProject.getLanguage()));
return label; return label;
} }
} }

View File

@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.ControlLink;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.Link;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
import com.arsdigita.bebop.Table; import com.arsdigita.bebop.Table;
import com.arsdigita.bebop.event.TableActionEvent; import com.arsdigita.bebop.event.TableActionEvent;
@ -31,12 +32,17 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.contenttypes.SciProject;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.dispatcher.ObjectNotFoundException;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -120,8 +126,8 @@ public class SciProjectSuperProjectSheet
m_done = false; m_done = false;
} else { } else {
m_done = true; m_done = true;
logger.debug(String.format("Super project to show: %s", m_superProject. logger.debug(String.format("Super project to show: %s",
getTitle())); m_superProject.getTitle()));
} }
} }
@ -132,7 +138,7 @@ public class SciProjectSuperProjectSheet
public boolean nextRow() { public boolean nextRow() {
boolean ret; boolean ret;
if (m_done) { if (m_done) {
logger.debug("Returning true for nextRow()"); logger.debug("Returning true for nextRow()");
ret = true; ret = true;
@ -176,8 +182,50 @@ public class SciProjectSuperProjectSheet
Object key, Object key,
int row, int row,
int column) { int column) {
Label label = new Label(value.toString()); SecurityManager securityManager =
return label; Utilities.getSecurityManager(state);
SciProject project = (SciProject) m_itemModel.getSelectedObject(
state);
boolean canEdit = securityManager.canAccess(
state.getRequest(),
SecurityManager.EDIT_ITEM,
project);
if (canEdit) {
SciProject subProject;
try {
subProject = new SciProject((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(String.format("%s (%s)",
value.toString(),
subProject.getLanguage()),
resolver.generateItemURL(state,
subProject,
section,
subProject.
getVersion()));
return link;
} else {
SciProject subDepartment;
try {
subDepartment = new SciProject((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
subDepartment.getLanguage()));
return label;
}
} }
} }

View File

@ -192,20 +192,31 @@ public class PublicationSciDepartmentTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
department.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
department, department,
section, section,
department.getVersion())); department.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciDepartmentWithPublications department;
try {
department =
new SciDepartmentWithPublications((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
department.getLanguage()));
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
extends LockableImpl extends LockableImpl
implements TableCellRenderer { implements TableCellRenderer {
@ -239,24 +250,26 @@ public class PublicationSciDepartmentTable
} }
} }
} }
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
PageState state =event.getPageState(); PageState state = event.getPageState();
SciDepartmentWithPublications department = new SciDepartmentWithPublications( SciDepartmentWithPublications department =
new SciDepartmentWithPublications(
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
Publication publication = (Publication) itemModel.getSelectedObject(state); Publication publication = (Publication) itemModel.getSelectedObject(
state);
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) { if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
//Nothing to do //Nothing to do
} else if(TABLE_COL_DEL.equals(column.getHeaderKey().toString())) { } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
Assert.exists(department, SciDepartmentWithPublications.class); Assert.exists(department, SciDepartmentWithPublications.class);
publication.remove("departments", department); publication.remove("departments", department);
} }
} }
public void headSelected(final TableActionEvent event) { public void headSelected(final TableActionEvent event) {

View File

@ -193,14 +193,27 @@ public class PublicationSciOrganizationTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
organization.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
organization, organization,
section, section,
organization.getVersion())); organization.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciOrganizationWithPublications organization;
try {
organization =
new SciOrganizationWithPublications((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(
String.format("%s (%s)",
value.toString(),
organization.getLanguage()));
return label; return label;
} }
} }

View File

@ -106,7 +106,7 @@ public class PublicationSciProjectTable
publication); publication);
} }
} }
private class PublicationSciProjectTableModel implements TableModel { private class PublicationSciProjectTableModel implements TableModel {
private Table table; private Table table;
@ -114,14 +114,14 @@ public class PublicationSciProjectTable
private SciProjectWithPublications project; private SciProjectWithPublications project;
public PublicationSciProjectTableModel(final Table table, public PublicationSciProjectTableModel(final Table table,
final PageState state, final PageState state,
final Publication publication) { final Publication publication) {
this.table = table; this.table = table;
projects = projects =
new PublicationSciProjectCollection((DataCollection) publication. new PublicationSciProjectCollection((DataCollection) publication.get(
get("projects")); "projects"));
} }
public int getColumnCount() { public int getColumnCount() {
@ -159,8 +159,8 @@ public class PublicationSciProjectTable
return project.getID(); return project.getID();
} }
} }
private class EditCellRenderer private class EditCellRenderer
extends LockableImpl extends LockableImpl
implements TableCellRenderer { implements TableCellRenderer {
@ -193,20 +193,32 @@ public class PublicationSciProjectTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = Link link =
new Link(value.toString(), new Link(String.format("%s (%s)",
value.toString(),
project.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
project, project,
section, section,
project.getVersion())); project.getVersion()));
return link; return link;
} else { } else {
Label label = new Label(value.toString()); SciProjectWithPublications project;
try {
project =
new SciProjectWithPublications((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label = new Label(String.format("%s (%s)",
value.toString(),
project.getLanguage()));
return label; return label;
} }
} }
} }
private class DeleteCellRenderer private class DeleteCellRenderer
extends LockableImpl extends LockableImpl
implements TableCellRenderer { implements TableCellRenderer {
@ -240,24 +252,25 @@ public class PublicationSciProjectTable
} }
} }
} }
public void cellSelected(final TableActionEvent event) { public void cellSelected(final TableActionEvent event) {
PageState state =event.getPageState(); PageState state = event.getPageState();
SciProjectWithPublications project = new SciProjectWithPublications( SciProjectWithPublications project = new SciProjectWithPublications(
new BigDecimal(event.getRowKey().toString())); new BigDecimal(event.getRowKey().toString()));
Publication publication = (Publication) itemModel.getSelectedObject(state); Publication publication = (Publication) itemModel.getSelectedObject(
state);
TableColumn column = getColumnModel().get(event.getColumn().intValue()); TableColumn column = getColumnModel().get(event.getColumn().intValue());
if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) { if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
//Nothing to do //Nothing to do
} else if(TABLE_COL_DEL.equals(column.getHeaderKey().toString())) { } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
Assert.exists(project, SciProjectWithPublications.class); Assert.exists(project, SciProjectWithPublications.class);
publication.remove("projects", project); publication.remove("projects", project);
} }
} }
public void headSelected(final TableActionEvent event) { public void headSelected(final TableActionEvent event) {

View File

@ -193,7 +193,9 @@ public class SciDepartmentPublicationsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
publication.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
publication, publication,
section, section,
@ -202,7 +204,17 @@ public class SciDepartmentPublicationsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Publication publication;
try {
publication = new Publication((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label =
new Label(String.format("%s (%s)",
value.toString(),
publication.getLanguage()));
return label; return label;
} }
} }

View File

@ -189,7 +189,9 @@ public class SciOrganizationPublicationsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
publication.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
publication, publication,
section, section,
@ -198,7 +200,17 @@ public class SciOrganizationPublicationsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Publication publication;
try {
publication = new Publication((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label =
new Label(String.format("%s (%s)",
value.toString(),
publication.getLanguage()));
return label; return label;
} }
} }

View File

@ -189,7 +189,9 @@ public class SciProjectPublicationsTable
ContentSection section = CMS.getContext().getContentSection(); ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(), Link link = new Link(String.format("%s (%s)",
value.toString(),
publication.getLanguage()),
resolver.generateItemURL(state, resolver.generateItemURL(state,
publication, publication,
section, section,
@ -198,7 +200,16 @@ public class SciProjectPublicationsTable
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Publication publication;
try {
publication = new Publication((BigDecimal) key);
} catch (ObjectNotFoundException ex) {
return new Label(value.toString());
}
Label label =
new Label(String.format("%s (%s)",
value.toString(),
publication.getLanguage()));
return label; return label;
} }
} }