<%
  import java.text.SimpleDateFormat ;
 
  SimpleDateFormat dateFormat = new SimpleDateFormat("EEE d MMM yyyy HH:mm:ss") ;
  String name = uicomponent.getId() ;
%>
<table class="UIGrid" id="$name" cellspacing="0" borderspacing="0" style="width: 99%; margin: auto;">
  <thead>
    <tr>
      <th>&nbsp;</th>
			<th><%=_ctx.appRes(name+".header.actor")%></th>
			<th><%=_ctx.appRes(name+".header.id")%></th>
			<th><%=_ctx.appRes(name+".header.processName")%></th>
			<th><%=_ctx.appRes(name+".header.taskName")%></th>
			<th><%=_ctx.appRes(name+".header.description")%></th>
			<th><%=_ctx.appRes(name+".header.actorId")%></th>
			<th><%=_ctx.appRes(name+".header.processDateStart")%></th>
			<th><%=_ctx.appRes(name+".header.action")%></th>
    </tr>
  </thead>
  <tbody>
  <%
    def taskList = uicomponent.getTasks();
    if(taskList.size() > 0) {
      def rowClass = null ;
	    boolean even = true ;
      for(task in taskList) {
        if(even) rowClass = "EvenRow" ;  
	      else rowClass =  "OddRow" ; 
	      even = !even ;
  %>
	    <tr class="$rowClass">
	      <td class="Text"><img src="<%=uicomponent.getIconURL(task)%>" alt="$task.taskName" /></td>
	      <td class="Text">
	        <%
            if(task.getActorId().indexOf(":/") > -1) println "<div class=\"Group16x16Icon\"></div>" ;
						else println "<div class=\"User16x16Icon\"></div>" ;
					%>
				</td>
	      <td class="Text">$task.id</td>
	      <td class="Text"><%=uicomponent.getProcessName(task)%></td>
	      <td class="Text">$task.taskName</td>

	      <td class="Text"><%=(task.getDescription() == null ? "&nbsp;" : task.getDescription()) ;%></td>
	      <td class="Text"><%=task.getActorId()%></td>

	      <td class="Text"><%=dateFormat.format(uicomponent.getProcessInstanceStartDate(task))%></td>
	      <td class="Text"><a href="<%=uicomponent.event("ManageState", task.getId())%>"><%= _ctx.appRes("UITaskList.label.managerState") %></a></td>
	    </tr>
  <%
      }
    } else {
  %>
      <tr class="EvenRow"> 
        <td colspan="9" style="text-align:center;font-style:italic; color: #EF5604;"><%=_ctx.appRes("UITaksList.msg.no-task")%></td>
      </tr>
  <%}%>
  </tbody>
</table>
