diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java index 24865df6d..57afde08d 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitContactTable.java @@ -60,6 +60,8 @@ import org.apache.log4j.Logger; * * @author Jens Pelzetter */ + + public class GenericOrganizationalUnitContactTable extends Table implements TableActionListener { @@ -271,14 +273,25 @@ public class GenericOrganizationalUnitContactTable extends Table implements ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + contact.getLanguage()), resolver.generateItemURL(state, contact, section, contact.getVersion())); return link; } 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 col) { - GenericOrganizationalUnit orgaunit = (GenericOrganizationalUnit) m_itemModel. + GenericOrganizationalUnit orgaunit = + (GenericOrganizationalUnit) m_itemModel. getSelectedObject(state); GenericOrganizationalUnitContactCollection contacts = orgaunit.getContacts(); diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java index e07d3cecb..7e542c7e1 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPersonsTable.java @@ -247,7 +247,9 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + person.getLanguage()), resolver.generateItemURL(state, person, section, @@ -255,7 +257,21 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements return link; } 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; } } } diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java index 2f77e1aa2..465beff14 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonContactTable.java @@ -260,14 +260,27 @@ public class GenericPersonContactTable extends Table implements ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + contact.getLanguage()), resolver.generateItemURL(state, contact, section, contact.getVersion())); return link; } 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; } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java index 408db577c..dda8e06eb 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInCollectedVolumeCollectedVolumeSheet.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume; import com.arsdigita.cms.contenttypes.CollectedVolume; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * Sheet which displays the collected volume to which an article in a collected @@ -98,7 +104,8 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet @Override public TableModel makeModel(Table table, PageState state) { table.getRowSelectionModel().clearSelection(state); - ArticleInCollectedVolume article = (ArticleInCollectedVolume) itemModel. + ArticleInCollectedVolume article = + (ArticleInCollectedVolume) itemModel. getSelectedObject(state); return new ArticleInCollectedVolumeCollectedVolumeSheetModel(table, state, @@ -173,8 +180,49 @@ public class ArticleInCollectedVolumeCollectedVolumeSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + SecurityManager securityManager = + 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) { SecurityManager securityManager = Utilities.getSecurityManager(state); - ArticleInCollectedVolume article = (ArticleInCollectedVolume) itemModel. + ArticleInCollectedVolume article = + (ArticleInCollectedVolume) itemModel. getSelectedObject(state); boolean canEdit = securityManager.canAccess( diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java index a0fb10e90..a416637c3 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalJournalSheet.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.ArticleInJournal; import com.arsdigita.cms.contenttypes.Journal; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -161,8 +167,48 @@ public class ArticleInJournalJournalSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java index 73e268526..105a16c74 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/CollectedVolumeArticlesTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolume; import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection; import com.arsdigita.cms.contenttypes.CollectedVolume; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -198,10 +203,42 @@ public class CollectedVolumeArticlesTable collectedVolume); 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; } 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; } } @@ -310,19 +347,19 @@ public class CollectedVolumeArticlesTable new BigDecimal(event.getRowKey().toString())); CollectedVolume collectedVolume = - (CollectedVolume) m_itemModel.getSelectedObject(state); + (CollectedVolume) m_itemModel.getSelectedObject(state); ArticleInCollectedVolumeCollection articles = - collectedVolume.getArticles(); + collectedVolume.getArticles(); TableColumn column = getColumnModel().get(event.getColumn().intValue()); 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); - } else if(column.getHeaderKey().toString().equals(TABLE_COL_UP)) { + } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) { articles.swapWithPrevious(article); - } else if(column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { + } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { articles.swapWithNext(article); } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java index 6fbda5263..72efcd75c 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.contenttypes.Expertise; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -140,8 +146,46 @@ public class ExpertiseOrdererSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java index 792b5c931..5864998e8 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrganizationSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.contenttypes.Expertise; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -141,8 +147,46 @@ public class ExpertiseOrganizationSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java index 4d2a37c84..7b7744e97 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InProceedingsProceedingsSheet.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.ItemSelectionModel; import com.arsdigita.cms.contenttypes.InProceedings; import com.arsdigita.cms.contenttypes.Proceedings; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * Sheet which displays the proceedings associated with a InProceedings. @@ -170,8 +176,48 @@ public class InProceedingsProceedingsSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java index fff3f0b6f..44ddfdd7a 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/InternetArticleOrganizationSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.InternetArticle; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -145,8 +151,50 @@ public class InternetArticleOrganizationSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/JournalArticlesTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/JournalArticlesTable.java index c361f5503..f26350b98 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/JournalArticlesTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/JournalArticlesTable.java @@ -210,14 +210,28 @@ public class JournalArticlesTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + article.getLanguage()), resolver.generateItemURL(state, article, section, article.getVersion())); return link; } 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; } } @@ -296,8 +310,7 @@ public class JournalArticlesTable int row, int col) { - Journal journal = (Journal) m_itemModel. - getSelectedObject(state); + Journal journal = (Journal) m_itemModel.getSelectedObject(state); ArticleInJournalCollection articles = journal.getArticles(); if ((articles.size() - 1) == row) { @@ -335,9 +348,9 @@ public class JournalArticlesTable } else if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) { s_log.debug("Removing article assoc..."); journal.removeArticle(article); - } else if(col.getHeaderKey().toString().equals(TABLE_COL_UP)) { + } else if (col.getHeaderKey().toString().equals(TABLE_COL_UP)) { articles.swapWithPrevious(article); - } else if(col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { + } else if (col.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { articles.swapWithNext(article); } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java index 5df365d36..8e6f7709d 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsOrganizerSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.Proceedings; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -142,8 +148,50 @@ public class ProceedingsOrganizerSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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()); - 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)) { proceedings.setOrganizerOfConference(null); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java index 496af1d6b..62818b29a 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPapersTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; -import com.arsdigita.cms.contenttypes.ArticleInCollectedVolumeCollection; -import com.arsdigita.cms.contenttypes.CollectedVolume; import com.arsdigita.cms.contenttypes.InProceedings; import com.arsdigita.cms.contenttypes.InProceedingsCollection; import com.arsdigita.cms.contenttypes.Proceedings; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -204,10 +207,44 @@ public class ProceedingsPapersTable proceedings); 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; } 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; } } @@ -258,7 +295,7 @@ public class ProceedingsPapersTable PageState state, Object value, boolean isSelected, - Object key, + Object key, int row, int col) { if (0 == row) { @@ -287,10 +324,10 @@ public class ProceedingsPapersTable int col) { Proceedings proceedings = - (Proceedings) m_itemModel.getSelectedObject( + (Proceedings) m_itemModel.getSelectedObject( state); InProceedingsCollection papers = - proceedings.getPapers(); + proceedings.getPapers(); if ((papers.size() - 1) == row) { @@ -313,20 +350,19 @@ public class ProceedingsPapersTable new BigDecimal(event.getRowKey().toString())); Proceedings proceedings = - (Proceedings) m_itemModel.getSelectedItem(state); + (Proceedings) m_itemModel.getSelectedItem(state); InProceedingsCollection papers = - proceedings.getPapers(); + proceedings.getPapers(); TableColumn column = getColumnModel().get(event.getColumn().intValue()); 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); - } else if(column.getHeaderKey().toString().equals(TABLE_COL_UP)) { + } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) { papers.swapWithPrevious(paper); - } else if(column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { + } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) { papers.swapWithNext(paper); } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java index 157ce45cc..a0c956dfc 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationAuthorsTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.AuthorshipCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.Publication; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -227,10 +232,42 @@ public class PublicationAuthorsTable publication); 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; } 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; } } @@ -380,19 +417,19 @@ public class PublicationAuthorsTable } else if (column.getHeaderKey().toString().equals( TABLE_COL_EDIT_ASSOC)) { - while(authors.next()) { + while (authors.next()) { if (authors.getAuthor().equals(author)) { break; } } - ((PublicationAuthorsPropertyStep)editStep).setSelectedAuthor(author); - ((PublicationAuthorsPropertyStep)editStep).setSelectedAuthorEditor( + ((PublicationAuthorsPropertyStep) editStep).setSelectedAuthor(author); + ((PublicationAuthorsPropertyStep) editStep).setSelectedAuthorEditor( authors.isEditor()); editStep.showComponent(state, PublicationAuthorsPropertyStep.ADD_AUTHOR_SHEET_NAME); - + authors.close(); } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) { publication.removeAuthor(author); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationSeriesTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationSeriesTable.java index b6a96ab5a..e71b7efc8 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationSeriesTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationSeriesTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.SeriesCollection; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -179,10 +184,42 @@ public class PublicationSeriesTable publication); 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; } 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; } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherSetPublisherSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherSetPublisherSheet.java index dbd83b3e0..14f6d06f9 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherSetPublisherSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/PublicationWithPublisherSetPublisherSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.contenttypes.PublicationWithPublisher; import com.arsdigita.cms.contenttypes.Publisher; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -72,7 +78,8 @@ public class PublicationWithPublisherSetPublisherSheet @Override public TableModel makeModel(final Table table, final PageState state) { table.getRowSelectionModel().clearSelection(state); - PublicationWithPublisher publication = (PublicationWithPublisher) itemModel. + PublicationWithPublisher publication = + (PublicationWithPublisher) itemModel. getSelectedObject(state); return new PublicationWithPublisherSetPublisherSheetModel(table, state, @@ -146,8 +153,51 @@ public class PublicationWithPublisherSetPublisherSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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) { com.arsdigita.cms.SecurityManager securityManager = Utilities.getSecurityManager(state); - PublicationWithPublisher publication = (PublicationWithPublisher) itemModel. + PublicationWithPublisher publication = + (PublicationWithPublisher) itemModel. getSelectedObject( state); @@ -191,13 +242,14 @@ public class PublicationWithPublisherSetPublisherSheet public void cellSelected(final TableActionEvent event) { PageState state = event.getPageState(); - PublicationWithPublisher publication = (PublicationWithPublisher) itemModel.getSelectedObject(state); + PublicationWithPublisher publication = + (PublicationWithPublisher) itemModel. + getSelectedObject(state); TableColumn column = getColumnModel().get(event.getColumn().intValue()); 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); } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java index cb34f449b..403e91190 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.EditshipCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.ui.authoring.SimpleEditStep; -import com.arsdigita.domain.DomainObject; -import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import java.text.DateFormat; @@ -235,10 +238,40 @@ public class SeriesEditshipTable extends Table implements TableActionListener { series); 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; } 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; } } @@ -315,7 +348,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener { private class UpCellRenderer extends LockableImpl implements TableCellRenderer { - + @Override public Component getComponent( Table table, @@ -325,7 +358,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener { Object key, int row, int col) { - + if (0 == row) { s_log.debug("Row is first row in table, don't show up link"); Label label = new Label(""); @@ -341,7 +374,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener { private class DownCellRenderer extends LockableImpl implements TableCellRenderer { - + @Override public Component getComponent( Table table, @@ -351,11 +384,11 @@ public class SeriesEditshipTable extends Table implements TableActionListener { Object key, int row, int col) { - + Series = (Series) m_itemModel. getSelectedObject(state); EditshipCollection editors = series.getEditors(); - + if ((editors.size() - 1) == row) { s_log.debug("Row is last row in table, don't show down link"); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesVolumesTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesVolumesTable.java index 0e100945d..ddad21b47 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesVolumesTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesVolumesTable.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.Publication; import com.arsdigita.cms.contenttypes.Series; import com.arsdigita.cms.contenttypes.VolumeInSeriesCollection; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; import org.apache.log4j.Logger; @@ -179,10 +184,42 @@ public class SeriesVolumesTable extends Table implements TableActionListener { series); 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; } 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; } } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedOrganizationSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedOrganizationSheet.java index 7ee3bf379..a907e573e 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedOrganizationSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/UnPublishedOrganizationSheet.java @@ -3,6 +3,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.contenttypes.Publisher; import com.arsdigita.cms.contenttypes.UnPublished; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * @@ -143,8 +150,50 @@ public class UnPublishedOrganizationSheet final Object key, final int row, final int column) { - Label label = new Label(value.toString()); - return label; + com.arsdigita.cms.SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java index bb47a57fa..1056dca74 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java @@ -86,15 +86,15 @@ public class SciDepartmentProjectsTable "sciorganization.ui.department.project.remove").localize(), TABLE_COL_DEL)); /*colModel.add(new TableColumn( - 2, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.department.project.up").localize(), - TABLE_COL_UP)); + 2, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.project.up").localize(), + TABLE_COL_UP)); colModel.add(new TableColumn( - 3, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.department.project.down").localize(), - TABLE_COL_DOWN));*/ + 3, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.department.project.down").localize(), + TABLE_COL_DOWN));*/ setModelBuilder( new SciDepartmentProjectsTableModelBuilder(itemModel)); @@ -226,7 +226,9 @@ public class SciDepartmentProjectsTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + project.getLanguage()), resolver.generateItemURL(state, project, section, @@ -234,7 +236,19 @@ public class SciDepartmentProjectsTable return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java index 1b398afab..638053bbc 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java @@ -223,7 +223,9 @@ public class SciDepartmentSubDepartmentsTable ContentSection section = CMS.getContext().getContentSection(); 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, subDepartment, section, @@ -234,7 +236,20 @@ public class SciDepartmentSubDepartmentsTable } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java index 7b47314db..453032dd1 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.SciDepartment; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; /** * Sheet for showing the superior department of a {@link SciDepartment}. @@ -170,8 +176,51 @@ public class SciDepartmentSuperDepartmentSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + SecurityManager securityManager = + 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) { PageState state = event.getPageState(); - SciDepartment department = (SciDepartment) m_itemModel.getSelectedObject( + SciDepartment department = + (SciDepartment) m_itemModel.getSelectedObject( state); TableColumn column = getColumnModel().get(event.getColumn().intValue()); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java index bab362185..e8c0fbe00 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java @@ -47,7 +47,7 @@ public class SciMemberSciDepartmentsTable private SciMemberSciDepartmentsStep step; public SciMemberSciDepartmentsTable(ItemSelectionModel itemModel, - SciMemberSciDepartmentsStep step) { + SciMemberSciDepartmentsStep step) { super(); this.itemModel = itemModel; this.step = step; @@ -103,8 +103,8 @@ public class SciMemberSciDepartmentsTable table.getRowSelectionModel().clearSelection(state); SciMember member = (SciMember) itemModel.getSelectedObject(state); return new SciMemberSciDepartmentsTableModel(table, - state, - member); + state, + member); } } @@ -115,8 +115,8 @@ public class SciMemberSciDepartmentsTable private SciDepartment department; public SciMemberSciDepartmentsTableModel(Table table, - PageState state, - SciMember member) { + PageState state, + SciMember member) { this.table = table; this.departments = member.getDepartments(); } @@ -146,7 +146,8 @@ public class SciMemberSciDepartmentsTable case 0: return department.getTitle(); case 1: - RelationAttributeCollection role = new RelationAttributeCollection( + RelationAttributeCollection role = + new RelationAttributeCollection( "SciDepartmentRole", departments.getRoleName()); if (role.next()) { @@ -158,7 +159,8 @@ public class SciMemberSciDepartmentsTable "cms.ui.unknownRole").localize(); } case 2: - RelationAttributeCollection status = new RelationAttributeCollection( + RelationAttributeCollection status = + new RelationAttributeCollection( "GenericOrganizationalUnitMemberStatus", departments.getStatus()); if (status.next()) { @@ -219,14 +221,28 @@ public class SciMemberSciDepartmentsTable ContentSection section = CMS.getContext().getContentSection(); 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, department, - section, department. + section, + department. getVersion())); return link; } 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; } } @@ -305,8 +321,7 @@ public class SciMemberSciDepartmentsTable SciMember member = (SciMember) itemModel.getSelectedObject(state); - SciMemberSciDepartmentsCollection departments = member. - getDepartments(); + SciMemberSciDepartmentsCollection departments = member.getDepartments(); TableColumn column = getColumnModel().get(event.getColumn().intValue()); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java index 1f271a23b..ca2915382 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java @@ -146,7 +146,8 @@ public class SciMemberSciOrganizationsTable case 0: return organization.getTitle(); case 1: - RelationAttributeCollection role = new RelationAttributeCollection( + RelationAttributeCollection role = + new RelationAttributeCollection( "SciOrganizationRole", organizations.getRoleName()); if (role.next()) { @@ -158,7 +159,8 @@ public class SciMemberSciOrganizationsTable "cms.ui.unknownRole").localize(); } case 2: - RelationAttributeCollection status = new RelationAttributeCollection( + RelationAttributeCollection status = + new RelationAttributeCollection( "GenericOrganizationalUnitMemberStatus", organizations.getStatus()); if (status.next()) { @@ -219,14 +221,29 @@ public class SciMemberSciOrganizationsTable ContentSection section = CMS.getContext().getContentSection(); 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, organization, - section, organization. + section, + organization. getVersion())); return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java index a4fa08248..58c9bc001 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java @@ -47,7 +47,7 @@ public class SciMemberSciProjectsTable private SciMemberSciProjectsStep step; public SciMemberSciProjectsTable(ItemSelectionModel itemModel, - SciMemberSciProjectsStep step) { + SciMemberSciProjectsStep step) { super(); this.itemModel = itemModel; this.step = step; @@ -103,8 +103,8 @@ public class SciMemberSciProjectsTable table.getRowSelectionModel().clearSelection(state); SciMember member = (SciMember) itemModel.getSelectedObject(state); return new SciMemberSciProjectsTableModel(table, - state, - member); + state, + member); } } @@ -115,8 +115,8 @@ public class SciMemberSciProjectsTable private SciProject project; public SciMemberSciProjectsTableModel(Table table, - PageState state, - SciMember member) { + PageState state, + SciMember member) { this.table = table; this.projects = member.getProjects(); } @@ -146,7 +146,8 @@ public class SciMemberSciProjectsTable case 0: return project.getTitle(); case 1: - RelationAttributeCollection role = new RelationAttributeCollection( + RelationAttributeCollection role = + new RelationAttributeCollection( "SciProjectRole", projects.getRoleName()); if (role.next()) { @@ -158,7 +159,8 @@ public class SciMemberSciProjectsTable "cms.ui.unknownRole").localize(); } case 2: - RelationAttributeCollection status = new RelationAttributeCollection( + RelationAttributeCollection status = + new RelationAttributeCollection( "GenericOrganizationalUnitMemberStatus", projects.getStatus()); if (status.next()) { @@ -219,14 +221,28 @@ public class SciMemberSciProjectsTable ContentSection section = CMS.getContext().getContentSection(); 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, project, section, project. getVersion())); return link; } 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; } } @@ -300,13 +316,12 @@ public class SciMemberSciProjectsTable public void cellSelected(TableActionEvent event) { PageState state = event.getPageState(); - SciProject project = new SciProject(new BigDecimal(event. - getRowKey().toString())); + SciProject project = new SciProject(new BigDecimal(event.getRowKey(). + toString())); SciMember member = (SciMember) itemModel.getSelectedObject(state); - SciMemberSciProjectsCollection projects = member. - getProjects(); + SciMemberSciProjectsCollection projects = member.getProjects(); TableColumn column = getColumnModel().get(event.getColumn().intValue()); diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java index 9d918e67f..a8bd06228 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java @@ -235,7 +235,6 @@ public class SciOrganizationDepartmentsTable getVersion())); return link; - } else { SciDepartment department; try { diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java index 7dd62618b..bd151d675 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java @@ -87,15 +87,15 @@ public class SciOrganizationProjectsTable "sciorganization.ui.organization.project.remove").localize(), TABLE_COL_DEL)); /*colModel.add(new TableColumn( - 2, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.organization.project.up").localize(), - TABLE_COL_UP)); + 2, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.project.up").localize(), + TABLE_COL_UP)); colModel.add(new TableColumn( - 3, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.organization.project.down").localize(), - TABLE_COL_DOWN));*/ + 3, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.organization.project.down").localize(), + TABLE_COL_DOWN));*/ setModelBuilder( new SciOrganizationProjectsTableModelBuilder(itemModel)); @@ -226,7 +226,9 @@ public class SciOrganizationProjectsTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + project.getLanguage()), resolver.generateItemURL(state, project, section, @@ -235,7 +237,19 @@ public class SciOrganizationProjectsTable return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java index 385ff898b..09ffe765e 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java @@ -218,7 +218,9 @@ public class SciProjectDepartmentsTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + department.getLanguage()), resolver.generateItemURL(state, department, section, @@ -226,7 +228,18 @@ public class SciProjectDepartmentsTable return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java index 20b559622..13bc310af 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java @@ -225,7 +225,9 @@ public class SciProjectOrganizationsTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + orga.getLanguage()), resolver.generateItemURL(state, orga, section, @@ -233,7 +235,19 @@ public class SciProjectOrganizationsTable return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java index fdda0c957..aa7ae11a1 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java @@ -83,15 +83,15 @@ public class SciProjectSubProjectsTable "sciorganization.ui.project.subproject.remove").localize(), TABLE_COL_DEL)); /*colModel.add(new TableColumn( - 2, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.project.subproject.up").localize(), - TABLE_COL_UP)); + 2, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.project.subproject.up").localize(), + TABLE_COL_UP)); colModel.add(new TableColumn( - 3, - SciOrganizationGlobalizationUtil.globalize( - "sciorganization.ui.project.subproject.down").localize(), - TABLE_COL_DOWN));*/ + 3, + SciOrganizationGlobalizationUtil.globalize( + "sciorganization.ui.project.subproject.down").localize(), + TABLE_COL_DOWN));*/ setModelBuilder( new SciProjectSubProjectsTableModelBuilder(itemModel)); @@ -221,7 +221,9 @@ public class SciProjectSubProjectsTable ContentSection section = CMS.getContext().getContentSection(); 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, subProject, section, @@ -231,7 +233,19 @@ public class SciProjectSubProjectsTable return link; } 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; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java index 739c2cad0..abe16001b 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java @@ -22,6 +22,7 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.Link; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.Table; 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.TableModel; 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.SecurityManager; import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.Utilities; +import com.arsdigita.dispatcher.ObjectNotFoundException; import com.arsdigita.util.LockableImpl; +import java.math.BigDecimal; import org.apache.log4j.Logger; /** @@ -120,8 +126,8 @@ public class SciProjectSuperProjectSheet m_done = false; } else { m_done = true; - logger.debug(String.format("Super project to show: %s", m_superProject. - getTitle())); + logger.debug(String.format("Super project to show: %s", + m_superProject.getTitle())); } } @@ -132,7 +138,7 @@ public class SciProjectSuperProjectSheet public boolean nextRow() { boolean ret; - + if (m_done) { logger.debug("Returning true for nextRow()"); ret = true; @@ -176,8 +182,50 @@ public class SciProjectSuperProjectSheet Object key, int row, int column) { - Label label = new Label(value.toString()); - return label; + SecurityManager securityManager = + 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; + } } } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java index 9d3a68fe5..890b2516c 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java @@ -192,20 +192,31 @@ public class PublicationSciDepartmentTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + department.getLanguage()), resolver.generateItemURL(state, department, section, department.getVersion())); return link; } 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; } } } - - private class DeleteCellRenderer + + private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { @@ -239,24 +250,26 @@ public class PublicationSciDepartmentTable } } } - - public void cellSelected(final TableActionEvent event) { - PageState state =event.getPageState(); - - SciDepartmentWithPublications department = new SciDepartmentWithPublications( + + public void cellSelected(final TableActionEvent event) { + PageState state = event.getPageState(); + + SciDepartmentWithPublications department = + new SciDepartmentWithPublications( new BigDecimal(event.getRowKey().toString())); - - Publication publication = (Publication) itemModel.getSelectedObject(state); - + + Publication publication = (Publication) itemModel.getSelectedObject( + state); + TableColumn column = getColumnModel().get(event.getColumn().intValue()); - + if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) { //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); - + publication.remove("departments", department); - } + } } public void headSelected(final TableActionEvent event) { diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java index f41e3ff14..1a7123425 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java @@ -193,14 +193,27 @@ public class PublicationSciOrganizationTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + organization.getLanguage()), resolver.generateItemURL(state, organization, section, organization.getVersion())); return link; } 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; } } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java index bc21f119c..f6a85d9f8 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java @@ -106,7 +106,7 @@ public class PublicationSciProjectTable publication); } } - + private class PublicationSciProjectTableModel implements TableModel { private Table table; @@ -114,14 +114,14 @@ public class PublicationSciProjectTable private SciProjectWithPublications project; public PublicationSciProjectTableModel(final Table table, - final PageState state, - final Publication publication) { + final PageState state, + final Publication publication) { this.table = table; projects = - new PublicationSciProjectCollection((DataCollection) publication. - get("projects")); + new PublicationSciProjectCollection((DataCollection) publication.get( + "projects")); } public int getColumnCount() { @@ -159,8 +159,8 @@ public class PublicationSciProjectTable return project.getID(); } } - - private class EditCellRenderer + + private class EditCellRenderer extends LockableImpl implements TableCellRenderer { @@ -193,20 +193,32 @@ public class PublicationSciProjectTable ContentSection section = CMS.getContext().getContentSection(); ItemResolver resolver = section.getItemResolver(); Link link = - new Link(value.toString(), + new Link(String.format("%s (%s)", + value.toString(), + project.getLanguage()), resolver.generateItemURL(state, project, section, project.getVersion())); return link; } 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; } } } - - private class DeleteCellRenderer + + private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { @@ -240,24 +252,25 @@ public class PublicationSciProjectTable } } } - - public void cellSelected(final TableActionEvent event) { - PageState state =event.getPageState(); - + + public void cellSelected(final TableActionEvent event) { + PageState state = event.getPageState(); + SciProjectWithPublications project = new SciProjectWithPublications( new BigDecimal(event.getRowKey().toString())); - - Publication publication = (Publication) itemModel.getSelectedObject(state); - + + Publication publication = (Publication) itemModel.getSelectedObject( + state); + TableColumn column = getColumnModel().get(event.getColumn().intValue()); - + if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) { //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); - + publication.remove("projects", project); - } + } } public void headSelected(final TableActionEvent event) { diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java index 5b98f7218..e1174db8b 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java @@ -193,7 +193,9 @@ public class SciDepartmentPublicationsTable ContentSection section = CMS.getContext().getContentSection(); 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, publication, section, @@ -202,7 +204,17 @@ public class SciDepartmentPublicationsTable return link; } 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; } } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java index f3e1b6527..d18ab28ba 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java @@ -189,7 +189,9 @@ public class SciOrganizationPublicationsTable ContentSection section = CMS.getContext().getContentSection(); 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, publication, section, @@ -198,7 +200,17 @@ public class SciOrganizationPublicationsTable return link; } 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; } } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java index adf9b3409..1da215821 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java @@ -189,7 +189,9 @@ public class SciProjectPublicationsTable ContentSection section = CMS.getContext().getContentSection(); 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, publication, section, @@ -198,7 +200,16 @@ public class SciProjectPublicationsTable return link; } 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; } }