My Tasks improvements, fixes to webscript empty filter argument handling.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5581 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2007-04-30 20:59:55 +00:00
parent 2a583fe2dc
commit 72b5e97ad2
5 changed files with 164 additions and 17 deletions

View File

@@ -0,0 +1,27 @@
<table cellpadding='2' cellspacing='0'>
<tr>
<td>ICON</td>
<td>Document NAME</td>
<td>Something</td>
</tr>
<tr>
<td>ICON</td>
<td>Document NAME</td>
<td>Something</td>
</tr>
<tr>
<td>ICON</td>
<td>Document NAME</td>
<td>Something</td>
</tr>
<tr>
<td>ICON</td>
<td>Document NAME</td>
<td>Something</td>
</tr>
<tr>
<td>ICON</td>
<td>Document NAME</td>
<td>Something</td>
</tr>
</table>

View File

@@ -19,7 +19,7 @@
<#-- get the filter mode from the passed in args --> <#-- get the filter mode from the passed in args -->
<#-- filters: 0=all, 1=word, 2=html, 3=pdf, 4=recent --> <#-- filters: 0=all, 1=word, 2=html, 3=pdf, 4=recent -->
<#if args.f?exists><#assign filter=args.f?number><#else><#assign filter=0></#if> <#if args.f?exists && args.f?length!=0><#assign filter=args.f?number><#else><#assign filter=0></#if>
<#-- get the path location from the passed in args --> <#-- get the path location from the passed in args -->
<#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if> <#if args.p?exists><#assign path=args.p><#else><#assign path=""></#if>

View File

@@ -34,7 +34,7 @@
<#-- get the filter mode from the passed in args --> <#-- get the filter mode from the passed in args -->
<#-- filters: 0=all, 1=today, 2=next week, 3=no due date, 4=overdue --> <#-- filters: 0=all, 1=today, 2=next week, 3=no due date, 4=overdue -->
<#if args.f?exists><#assign filter=args.f?number><#else><#assign filter=0></#if> <#if args.f?exists && args.f?length!=0><#assign filter=args.f?number><#else><#assign filter=0></#if>
<table border=0 cellspacing=0 cellpadding=0 class="taskTable"> <table border=0 cellspacing=0 cellpadding=0 class="taskTable">
<tr> <tr>
@@ -68,7 +68,7 @@
(filter=2 && hasDue && (dateCompare(due?date, date?date) == 1 && dateCompare(date?date, due?date, weekms) == 1)) || (filter=2 && hasDue && (dateCompare(due?date, date?date) == 1 && dateCompare(date?date, due?date, weekms) == 1)) ||
(filter=4 && hasDue && (dateCompare(date?date, due?date) == 1))> (filter=4 && hasDue && (dateCompare(date?date, due?date) == 1))>
<#assign count=count+1> <#assign count=count+1>
<div class="taskRow"> <div class="taskRow" id="${t.id}">
<div class="taskTitle"> <div class="taskTitle">
<div class="taskIndicator"> <div class="taskIndicator">
<#if hasDue> <#if hasDue>
@@ -94,14 +94,23 @@
</div> </div>
</div> </div>
<div class="taskDetail"> <div class="taskDetail">
<table cellpadding='2' cellspacing='0' style="margin-left:32px;"> <div style="float:left">
<tr><td class="taskMetadata">Type:</td><td class="taskMetadata">${t.type?html}</td></tr> <table cellpadding='2' cellspacing='0' style="margin-left:32px;margin-top:20px">
<tr><td class="taskMetadata">Start Date:</td><td class="taskMetadata">${t.startDate?date}</td></tr> <tr><td class="taskMetaprop">Status:</td><td class="taskMetadata">${t.properties["bpm:status"]}</td>
<tr><td class="taskMetadata">Priority:</td><td class="taskMetadata">${t.properties["bpm:priority"]}</td> <tr><td class="taskMetaprop">Priority:</td><td class="taskMetadata">${t.properties["bpm:priority"]}</td>
<tr><td class="taskMetadata">Status:</td><td class="taskMetadata">${t.properties["bpm:status"]}</td> <tr><td class="taskMetaprop">Start Date:</td><td class="taskMetadata">${t.startDate?date}</td></tr>
<tr><td class="taskMetadata">Percent Complete:</td><td class="taskMetadata">${t.properties["bpm:percentComplete"]}%</td> <tr><td class="taskMetaprop">Type:</td><td class="taskMetadata">${t.type?html}</td></tr>
<tr><td class="taskMetaprop">Complete:</td><td class="taskMetadata">${t.properties["bpm:percentComplete"]}%</td>
</table> </table>
</div> </div>
<div class="taskResourceHeader">Resources:</div>
<div class="taskResources"></div>
<div>
<table class="taskActions" style="padding-left:16px">
<tr><td>Approve</td><td style="padding-left:64px">Reject</td></tr>
</table>
</div>
</div>
</div> </div>
</#if> </#if>
</#list> </#list>
@@ -217,10 +226,10 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited
.taskDetail .taskDetail
{ {
color: #5A5741;
background-color: #DFC900; background-color: #DFC900;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif; font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
font-size: 12px; font-size: 12px;
color: #000000;
margin: 0px; margin: 0px;
display: none; display: none;
overflow: hidden; overflow: hidden;
@@ -233,12 +242,55 @@ a.filterLinkSelected:link, a.filterLinkSelected:visited
border-top: 1px solid #82770B !important; border-top: 1px solid #82770B !important;
} }
.taskResources
{
border-left: 1px solid #0092DD;
border-top: 1px solid #0092DD;
border-bottom: 1px solid #CCD4DB;
border-right: 1px solid #CCD4DB;
background-color: #F8FCFD;
margin: 4px 0px 0px 16px;
width: 400px;
height: 80px;
overflow: hidden;
}
.taskResourceHeader
{
color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
padding: 0px 0px 0px 16px;
font-weight: bold;
display: inline;
}
.taskResources td
{
color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
}
.taskActions td
{
color: #5A5741;
font-size: 14px;
font-weight: bold;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
}
.taskMetadata .taskMetadata
{ {
color: #5A5741; color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif; font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
} }
.taskMetaprop
{
color: #5A5741;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
font-weight: bold;
}
.paperEdgeRight .paperEdgeRight
{ {
background-image: url(../images/parts/paper_rightedge.png); background-image: url(../images/parts/paper_rightedge.png);

View File

@@ -58,7 +58,7 @@ public class TaskInfoBean
private WorkflowService workflowService; private WorkflowService workflowService;
/** /**
* Returns information on the node identified by the 'taskId' * Returns information for the workflow task identified by the 'taskId'
* parameter found in the ExternalContext. * parameter found in the ExternalContext.
* <p> * <p>
* The result is the formatted HTML to show on the client. * The result is the formatted HTML to show on the client.
@@ -86,6 +86,35 @@ public class TaskInfoBean
} }
} }
/**
* Returns the resource list for the workflow task identified by the 'taskId'
* parameter found in the ExternalContext.
* <p>
* The result is the formatted HTML to show on the client.
*/
public void sendTaskResources() throws IOException
{
FacesContext context = FacesContext.getCurrentInstance();
ResponseWriter out = context.getResponseWriter();
String taskId = (String)context.getExternalContext().getRequestParameterMap().get("taskId");
if (taskId == null || taskId.length() == 0)
{
throw new IllegalArgumentException("'taskId' parameter is missing");
}
WorkflowTask task = this.workflowService.getTaskById(taskId);
if (task != null)
{
Repository.getServiceRegistry(context).getTemplateService().processTemplate(
"/alfresco/templates/client/task_resource_panel.ftl", getModel(task), out);
}
else
{
out.write("<span class='errorMessage'>Task could not be found.</span>");
}
}
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------
// Bean getters and setters // Bean getters and setters

View File

@@ -14,16 +14,31 @@ var MyTasks = {
var items = $$('#taskPanel .taskItem'); var items = $$('#taskPanel .taskItem');
var infos = $$('#taskPanel .taskInfo'); var infos = $$('#taskPanel .taskInfo');
var details = $$('#taskPanel .taskDetail'); var details = $$('#taskPanel .taskDetail');
var resources = $$('#taskPanel .taskResources');
var fxInfo = new Fx.Elements(infos, {wait: false, duration: 500, transition: Fx.Transitions.linear}); var fxInfo = new Fx.Elements(infos, {wait: false, duration: 500, transition: Fx.Transitions.linear});
var fxDetail = new Fx.Elements(details, {wait: false, duration: 500, transition: Fx.Transitions.linear}); var fxDetail = new Fx.Elements(details, {wait: false, duration: 500, transition: Fx.Transitions.linear,
onComplete: function()
{
// event handler to ensure
this.elements.each(function(detail, i)
{
if (detail.parentNode.isOpen == true)
{
detail.getElementsByTagName("div")[2].setStyle('overflow', 'auto');
}
});
}
});
tasks.each(function(task, i) tasks.each(function(task, i)
{ {
var item = items[i]; var item = items[i];
var info = infos[i]; var info = infos[i];
var detail = details[i]; var detail = details[i];
var resource = resources[i];
// animated elements defaults // animated elements defaults
task.isOpen = false; task.isOpen = false;
task.loadingResources = false;
item.defBColor = (item.getStyle('background-color') == 'transparent') ? '' : item.getStyle('background-color'); item.defBColor = (item.getStyle('background-color') == 'transparent') ? '' : item.getStyle('background-color');
detail.defHeight = 0; detail.defHeight = 0;
detail.setStyle('opacity', 0); detail.setStyle('opacity', 0);
@@ -117,12 +132,32 @@ var MyTasks = {
// flag this task as open // flag this task as open
task.isOpen = true; task.isOpen = true;
if (task.loadingResources == false)
{
// ajax call to populate the task resource list
task.loadingResources = true;
YAHOO.util.Connect.asyncRequest(
"POST",
getContextPath() + '/ajax/invoke/TaskInfoBean.sendTaskResources',
{
success: function(response)
{
// set the resource list panel html
var resource = response.argument[0];
resource.innerHTML = response.responseText;
},
failure: handleErrorYahoo, // global error handler
argument: [resource]
},
"taskId=" + task.id);
}
// fade in info button // fade in info button
animInfo[i] = {'opacity': [infoOpacity, 1]}; animInfo[i] = {'opacity': [infoOpacity, 1]};
// slide and fade in the details panel // slide and fade in the details panel
animDetail[i] = { animDetail[i] = {
'height': [detailHeight, detail.defHeight + 100], 'height': [detailHeight, detail.defHeight + 140],
'opacity': [detail.getStyle('opacity'), 1]}; 'opacity': [detail.getStyle('opacity'), 1]};
// close other open tasks and toggle this one if it's already open // close other open tasks and toggle this one if it's already open
@@ -154,6 +189,8 @@ var MyTasks = {
{ {
animInfo[j] = {'opacity': [otherOpacity, 0]}; animInfo[j] = {'opacity': [otherOpacity, 0]};
} }
otherDetail.getElementsByTagName("div")[2].setStyle('overflow', 'hidden');
} }
}); });
} }
@@ -170,6 +207,8 @@ var MyTasks = {
animDetail[i] = { animDetail[i] = {
'height': [detailHeight, detail.defHeight], 'height': [detailHeight, detail.defHeight],
'opacity': [detail.getStyle('opacity'), 0]}; 'opacity': [detail.getStyle('opacity'), 0]};
detail.getElementsByTagName("div")[2].setStyle('overflow', 'hidden');
} }
fxInfo.start(animInfo); fxInfo.start(animInfo);
fxDetail.start(animDetail); fxDetail.start(animDetail);