Division workflow = division.addDivision("workflow-tasks");
workflow.setHead(T_w_head1);
workflow.addPara(T_w_info1);
// Tasks you own
Table table = workflow.addTable("workflow-tasks",ownedItems.size() + 2,5);
table.setHead(T_w_head2);
Row header = table.addRow(Row.ROLE_HEADER);
header.addCellContent(T_w_column1);
header.addCellContent(T_w_column2);
header.addCellContent(T_w_column3);
header.addCellContent(T_w_column4);
header.addCellContent(T_w_column5);
if (ownedItems.size() > 0)
{
for (WorkflowItem owned : ownedItems)
{
int workflowItemID = owned.getID();
String url = contextPath+"/handle/"+owned.getCollection().getHandle()+"/workflow?workflowID="+workflowItemID;
DCValue[] titles = owned.getItem().getDC("title", null, Item.ANY);
String collectionName = owned.getCollection().getMetadata("name");
EPerson submitter = owned.getSubmitter();
String submitterName = submitter.getFullName();
String submitterEmail = submitter.getEmail();
Message state = getWorkflowStateMessage(owned);
Row row = table.addRow();
CheckBox remove = row.addCell().addCheckBox("workflowID");
remove.setLabel("selected");
remove.addOption(workflowItemID);
// The task description
row.addCell().addXref(url,state);
// The item description
if (titles != null && titles.length > 0)
{
String displayTitle = titles[0].value;
if (displayTitle.length() > 50)
displayTitle = displayTitle.substring(0,50)+ " ...";
row.addCell().addXref(url,displayTitle);
}
else
row.addCell().addXref(url,T_untitled);
// Submitted too
row.addCell().addXref(url,collectionName);
// Submitted by
Cell cell = row.addCell();
cell.addContent(T_email);
cell.addXref("mailto:"+submitterEmail,submitterName);
}
Row row = table.addRow();
row.addCell(0,5).addButton("submit_return_tasks").setValue(T_w_submit_return);
}
else
{
Row row = table.addRow();
row.addCell(0,5).addHighlight("italic").addContent(T_w_info2);
}
// Tasks in the pool
table = workflow.addTable("workflow-tasks",pooledItems.size()+2,5);
table.setHead(T_w_head3);
header = table.addRow(Row.ROLE_HEADER);
header.addCellContent(T_w_column1);
header.addCellContent(T_w_column2);
header.addCellContent(T_w_column3);
header.addCellContent(T_w_column4);
header.addCellContent(T_w_column5);
if (pooledItems.size() > 0)
{
for (WorkflowItem pooled : pooledItems)
{
int workflowItemID = pooled.getID();
String url = contextPath+"/handle/"+pooled.getCollection().getHandle()+"/workflow?workflowID="+workflowItemID;
DCValue[] titles = pooled.getItem().getDC("title", null, Item.ANY);
String collectionName = pooled.getCollection().getMetadata("name");
EPerson submitter = pooled.getSubmitter();
String submitterName = submitter.getFullName();
String submitterEmail = submitter.getEmail();
Message state = getWorkflowStateMessage(pooled);
Row row = table.addRow();
CheckBox remove = row.addCell().addCheckBox("workflowID");
remove.setLabel("selected");
remove.addOption(workflowItemID);
// The task description
row.addCell().addXref(url,state);
// The item description
if (titles != null && titles.length > 0)
{
String displayTitle = titles[0].value;
if (displayTitle.length() > 50)
displayTitle = displayTitle.substring(0,50)+ " ...";
row.addCell().addXref(url,displayTitle);
}
else
row.addCell().addXref(url,T_untitled);
// Submitted too
row.addCell().addXref(url,collectionName);
// Submitted by
Cell cell = row.addCell();
cell.addContent(T_email);
cell.addXref("mailto:"+submitterEmail,submitterName);
}
Row row = table.addRow();
row.addCell(0,5).addButton("submit_take_tasks").setValue(T_w_submit_take);
}
else
{
Row row = table.addRow();
row.addCell(0,5).addHighlight("italic").addContent(T_w_info3);
}
}