options.addItem().addXref(baseURL+"&submit_metadata",T_options_metadata);
options.addItem().addHighlight("bold").addXref(baseURL+"&submit_roles",T_options_roles);
options.addItem().addXref(baseURL+"&submit_harvesting",T_options_harvest);
// The table of admin roles
Table rolesTable = main.addTable("roles-table", 6, 5);
Row tableRow;
// The header row
Row tableHeader = rolesTable.addRow(Row.ROLE_HEADER);
tableHeader.addCell().addContent(T_role_name);
tableHeader.addCell().addContent(T_role_group);
tableHeader.addCell().addContent(T_role_buttons);
rolesTable.addRow();
/*
* The collection admins
*/
// data row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_admins);
if (admins != null)
{
try
{
AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
tableRow.addCell().addXref(baseURL + "&submit_edit_admin", admins.getName());
}
catch (AuthorizeException authex) {
// add a notice, the user is not authorized to create/edit collection's admin group
tableRow.addCell().addContent(T_not_allowed);
}
try
{
AuthorizeUtil.authorizeRemoveAdminGroup(context, thisCollection);
tableRow.addCell().addButton("submit_delete_admin").setValue(T_delete);
}
catch (AuthorizeException authex)
{
// nothing to add, the user is not allowed to delete the group
}
}
else
{
tableRow.addCell().addContent(T_no_role);
try
{
AuthorizeUtil.authorizeManageAdminGroup(context, thisCollection);
tableRow.addCell().addButton("submit_create_admin").setValue(T_create);
}
catch (AuthorizeException authex) {
// add a notice, the user is not authorized to create/edit collection's admin group
tableRow.addCell().addContent(T_not_allowed);
}
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_admins);
/*
* Workflow steps 1-3
*/
// data row
try
{
AuthorizeUtil.authorizeManageWorkflowsGroup(context, thisCollection);
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_wf_step1);
if (wfStep1 != null)
{
tableRow.addCell().addXref(baseURL + "&submit_edit_wf_step1", wfStep1.getName());
tableRow.addCell().addButton("submit_delete_wf_step1").setValue(T_delete);
}
else
{
tableRow.addCell().addContent(T_no_role);
tableRow.addCell().addButton("submit_create_wf_step1").setValue(T_create);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_wf_step1);
// data row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_wf_step2);
if (wfStep2 != null)
{
tableRow.addCell().addXref(baseURL + "&submit_edit_wf_step2", wfStep2.getName());
tableRow.addCell().addButton("submit_delete_wf_step2").setValue(T_delete);
}
else
{
tableRow.addCell().addContent(T_no_role);
tableRow.addCell().addButton("submit_create_wf_step2").setValue(T_create);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_wf_step2);
// data row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_wf_step3);
if (wfStep3 != null)
{
tableRow.addCell().addXref(baseURL + "&submit_edit_wf_step3", wfStep3.getName());
tableRow.addCell().addButton("submit_delete_wf_step3").setValue(T_delete);
}
else
{
tableRow.addCell().addContent(T_no_role);
tableRow.addCell().addButton("submit_create_wf_step3").setValue(T_create);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_wf_step3);
}
catch (AuthorizeException authex) {
// add a notice, the user is not allowed to manage workflow group
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_wf);
tableRow.addCell().addContent(T_not_allowed);
}
/*
* The collection submitters
*/
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_submitters);
try
{
AuthorizeUtil.authorizeManageSubmittersGroup(context, thisCollection);
if (submitters != null)
{
tableRow.addCell().addXref(baseURL + "&submit_edit_submit", submitters.getName());
tableRow.addCell().addButton("submit_delete_submit").setValue(T_delete);
}
else
{
tableRow.addCell().addContent(T_no_role);
tableRow.addCell().addButton("submit_create_submit").setValue(T_create);
}
}
catch (AuthorizeException authex)
{
tableRow.addCell().addContent(T_not_allowed);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_submitters);
/*
* The collection's default read authorizations
*/
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell(Cell.ROLE_HEADER).addContent(T_label_default_read);
if (defaultRead == null)
{
// Custome reading permissions, we can't handle it, just provide a link to the
// authorizations manager.
tableRow.addCell(1,2).addContent(T_default_read_custom);
}
else if (defaultRead.getID() == 0) {
// Anonymous reading
tableRow.addCell().addContent(T_default_read_anonymous);
addAdministratorOnlyButton(tableRow.addCell(),"submit_create_default_read",T_restrict);
}
else
{
// A specific group is dedicated to reading.
tableRow.addCell().addXref(baseURL + "&submit_edit_default_read", defaultRead.getName());
addAdministratorOnlyButton(tableRow.addCell(),"submit_delete_default_read",T_delete);
}
// help and directions row
tableRow = rolesTable.addRow(Row.ROLE_DATA);
tableRow.addCell();
tableRow.addCell(1,2).addHighlight("fade offset").addContent(T_help_default_read);
try
{
AuthorizeUtil.authorizeManageCollectionPolicy(context, thisCollection);
// add one last link to edit the raw authorizations
Cell authCell =rolesTable.addRow().addCell(1,3);
authCell.addXref(baseURL + "&submit_authorizations", T_edit_authorization);
}
catch (AuthorizeException authex) {
// nothing to add, the user is not authorized to edit collection's policies
}