sci-types-organization: Bearbeiten-Links in Tabellen ergänzt.

git-svn-id: https://svn.libreccm.org/ccm/trunk@611 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2010-11-16 10:00:02 +00:00
parent 66cf0be88c
commit 24f0131056
7 changed files with 225 additions and 25 deletions

View File

@ -24,6 +24,7 @@ import java.math.BigDecimal;
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;
@ -33,13 +34,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.SciDepartment;
import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
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 org.apache.log4j.Logger;
/**
* Table for showing all {@link SciProject}s linked with a {@link SciDepartment}
@ -52,6 +58,8 @@ public class SciDepartmentProjectsTable
extends Table
implements TableActionListener {
private final Logger s_log = Logger.getLogger(
SciDepartmentProjectsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -205,7 +213,25 @@ public class SciDepartmentProjectsTable
department);
if (canEdit) {
ControlLink link = new ControlLink(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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(value.toString(),
resolver.generateItemURL(state,
project,
section,
project.getVersion()));
return link;
} else {
Label label = new Label(value.toString());
@ -292,7 +318,8 @@ public class SciDepartmentProjectsTable
int row,
int col) {
SciDepartment department = (SciDepartment) m_itemModel.getSelectedObject(
SciDepartment department = (SciDepartment) m_itemModel.
getSelectedObject(
state);
SciDepartmentProjectsCollection projects =
department.getProjects();

View File

@ -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,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.SciDepartment;
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
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;
/**
* Table for showing the subdepartments of a {@link SciDepartment}.
@ -49,6 +55,8 @@ public class SciDepartmentSubDepartmentsTable
extends Table
implements TableActionListener {
private final Logger s_log = Logger.getLogger(
SciDepartmentSubDepartmentsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -202,8 +210,29 @@ public class SciDepartmentSubDepartmentsTable
department);
if (canEdit) {
ControlLink link = new ControlLink(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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(),
resolver.generateItemURL(state,
subDepartment,
section,
subDepartment.
getVersion()));
return link;
} else {
Label label = new Label(value.toString());
return label;
@ -292,7 +321,7 @@ public class SciDepartmentSubDepartmentsTable
SciDepartment department = (SciDepartment) m_itemModel.
getSelectedObject(state);
SciDepartmentSubDepartmentsCollection subDepartments =
department.getSubDepartments();
department.getSubDepartments();
if ((subDepartments.size() - 1) == row) {
Label label = new Label("");

View File

@ -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,19 @@ 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.contenttypes.SciOrganization;
import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
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;
/**
* Table for showing the {@link SciDepartment}s linked to a
@ -52,6 +58,8 @@ public class SciOrganizationDepartmentsTable
extends Table
implements TableActionListener {
private final Logger s_log = Logger.getLogger(
SciOrganizationDepartmentsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -205,8 +213,28 @@ public class SciOrganizationDepartmentsTable
orga);
if (canEdit) {
ControlLink link = new ControlLink(value.toString());
SciDepartment department;
try {
department = 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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(),
resolver.generateItemURL(state,
department,
section,
department.
getVersion()));
return link;
} else {
Label label = new Label(value.toString());
return label;

View File

@ -24,6 +24,7 @@ import java.math.BigDecimal;
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;
@ -33,13 +34,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.SciOrganization;
import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
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 org.apache.log4j.Logger;
/**
* Table for showing the links between a {@link SciOrganization} and
@ -53,6 +59,8 @@ public class SciOrganizationProjectsTable
extends Table
implements TableActionListener {
private final Logger s_log = Logger.getLogger(
SciOrganizationProjectsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -206,8 +214,26 @@ public class SciOrganizationProjectsTable
orga);
if (canEdit) {
ControlLink link = new ControlLink(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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(value.toString(),
resolver.generateItemURL(state,
project,
section,
project.getVersion()));
return link;
} else {
Label label = new Label(value.toString());
return label;
@ -293,10 +319,9 @@ public class SciOrganizationProjectsTable
int row,
int col) {
SciOrganization orga = (SciOrganization) m_itemModel.
SciOrganization orga = (SciOrganization) m_itemModel.
getSelectedObject(state);
SciOrganizationProjectsCollection projects = orga.
getProjects();
SciOrganizationProjectsCollection projects = orga.getProjects();
if ((projects.size() - 1) == row) {
Label label = new Label("");

View File

@ -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,19 @@ 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.contenttypes.SciProject;
import com.arsdigita.cms.contenttypes.SciProjectDepartmentsCollection;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal;
import org.apache.log4j.Logger;
/**
* Table for showing the links between a {@link SciProject} and a
@ -50,6 +56,8 @@ public class SciProjectDepartmentsTable
extends Table
implements TableActionListener {
private final static Logger s_log = Logger.getLogger(
SciProjectDepartmentsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -190,8 +198,39 @@ public class SciProjectDepartmentsTable
Object key,
int row,
int column) {
Label label = new Label(value.toString());
return label;
com.arsdigita.cms.SecurityManager securityManager = Utilities.
getSecurityManager(state);
SciProject project = (SciProject) m_itemModel.getSelectedObject(
state);
boolean canEdit = securityManager.canAccess(state.getRequest(),
com.arsdigita.cms.SecurityManager.EDIT_ITEM,
project);
if (canEdit) {
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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(value.toString(),
resolver.generateItemURL(state,
department,
section,
department.getVersion()));
return link;
} else {
Label label = new Label(value.toString());
return label;
}
}
}
@ -232,7 +271,7 @@ public class SciProjectDepartmentsTable
}
}
private class UpCellRenderer
private class UpCellRenderer
extends LockableImpl
implements TableCellRenderer {
@ -291,7 +330,7 @@ public class SciProjectDepartmentsTable
}
}
@Override
@Override
public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState();

View File

@ -24,6 +24,7 @@ import java.math.BigDecimal;
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;
@ -33,14 +34,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.SciOrganization;
import com.arsdigita.cms.contenttypes.SciProject;
import com.arsdigita.cms.contenttypes.SciProjectOrganizationsCollection;
import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.util.LockableImpl;
import org.apache.log4j.Logger;
/**
* Table for showing the links between a {@link SciProject} and
@ -52,6 +57,8 @@ public class SciProjectOrganizationsTable
extends Table
implements TableActionListener {
private static final Logger s_log = Logger.getLogger(
SciProjectOrganizationsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -204,13 +211,31 @@ public class SciProjectOrganizationsTable
SecurityManager.EDIT_ITEM,
project);
/*if (canEdit) {
ControlLink link = new ControlLink(value.toString());
if (canEdit) {
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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link =
new Link(value.toString(),
resolver.generateItemURL(state,
orga,
section,
orga.getVersion()));
return link;
} else {*/
} else {
Label label = new Label(value.toString());
return label;
//}
}
}
}
@ -295,7 +320,7 @@ public class SciProjectOrganizationsTable
SciProject project = (SciProject) m_itemModel.getSelectedObject(
state);
SciProjectOrganizationsCollection orgas =
project.getOrganizations();
project.getOrganizations();
if ((orgas.size() - 1) == row) {
Label label = new Label("");
@ -310,7 +335,7 @@ public class SciProjectOrganizationsTable
}
}
@Override
@Override
public void cellSelected(TableActionEvent event) {
PageState state = event.getPageState();
@ -321,7 +346,7 @@ public class SciProjectOrganizationsTable
(SciProject) m_itemModel.getSelectedObject(state);
SciProjectOrganizationsCollection subprojects =
project.getOrganizations();
project.getOrganizations();
TableColumn column = getColumnModel().get(event.getColumn().intValue());

View File

@ -24,6 +24,7 @@ import java.math.BigDecimal;
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;
@ -33,12 +34,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.contenttypes.SciProjectSubProjectsCollection;
import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.util.LockableImpl;
import org.apache.log4j.Logger;
/**
* Table of showing the subprojects of a {@link SciProject}.
@ -49,6 +55,8 @@ public class SciProjectSubProjectsTable
extends Table
implements TableActionListener {
private static final Logger s_log = Logger.getLogger(
SciProjectSubProjectsTable.class);
private final String TABLE_COL_EDIT = "table_col_edit";
private final String TABLE_COL_DEL = "table_col_del";
private final String TABLE_COL_UP = "table_col_up";
@ -200,13 +208,32 @@ public class SciProjectSubProjectsTable
SecurityManager.EDIT_ITEM,
project);
/*if (canEdit) {
ControlLink link = new ControlLink(value.toString());
if (canEdit) {
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());
}
ContentSection section = CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver();
Link link = new Link(value.toString(),
resolver.generateItemURL(state,
subProject,
section,
subProject.
getVersion()));
return link;
} else {*/
} else {
Label label = new Label(value.toString());
return label;
//}
}
}
}