Update of 
/var/cvs/contributions/CMSContainer/cmsc/edit-webapp/src/webapp/editors
In directory 
james.mmbase.org:/tmp/cvs-serv32535/cmsc/edit-webapp/src/webapp/editors

Modified Files:
        dashboard.jsp editors.js 
Log Message:
CMSC-241 Show top 5 most urgent tasks on dashboard


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer/cmsc/edit-webapp/src/webapp/editors
See also: http://www.mmbase.org/jira/browse/CMSC-241


Index: dashboard.jsp
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/edit-webapp/src/webapp/editors/dashboard.jsp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- dashboard.jsp       9 Feb 2009 14:48:31 -0000       1.14
+++ dashboard.jsp       25 Mar 2009 02:18:04 -0000      1.15
@@ -1,5 +1,34 @@
 <%...@page language="java" contentType="text/html;charset=UTF-8"
 %><%...@include file="globals.jsp"
+%><%!/*
+* Comparator to order mmbase nodes on status. Sorting is not done on 
alphabetical order but on the value of status where 
+* status "init" has position 1; status "notified" position 2 and status "done" 
position 3. And if the same status, order
+* by "deadline" down.
+*/
+static public class StatusComparator implements Comparator {
+   private static final String INIT = "task.status.init"; 
+   private static final String NOTIFIED = "task.status.notified";
+   private static final String DONE = "task.status.done";
+   
+   public int compare(Object o1, Object o2) {
+      String status1 = ((org.mmbase.bridge.Node) o1).getStringValue("status"); 
+      String status2 = ((org.mmbase.bridge.Node) o2).getStringValue("status");
+      if (status1.equals(INIT) && status2.equals(INIT) || 
+         status1.equals(NOTIFIED) && status2.equals(NOTIFIED) || 
+         status1.equals(DONE) && status2.equals(DONE)) {
+         
+         return 0;
+      }
+      else if (status1.equals(INIT) && status2.equals(NOTIFIED) ||
+             status1.equals(INIT) && status2.equals(DONE) ||
+             status1.equals(NOTIFIED) && status2.equals(DONE)) {
+         return -1;
+      }
+      else {
+         return 1;
+      }
+   }
+}
 %><mm:content type="text/html" encoding="UTF-8" expires="0"
 ><%--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 >"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>--%>
 <html:html xhtml="true">
@@ -41,19 +70,18 @@
        <div id="content">
 
 <mm:cloud jspvar="cloud" loginpage="login.jsp">
+<mm:cloudinfo type="user" id="cloudusername" write="false" />
 
 <c:set var="dashboardRepositorySize" value="10"/>
        <mm:haspage page="/editors/repository/">
     <c:set var="dashboardRepositoryTitle"><fmt:message 
key="dashboard.repository.header"><fmt:param>${dashboardRepositorySize}</fmt:param></fmt:message></c:set>
        <cmscedit:contentblock title="${dashboardRepositoryTitle}" 
titleMode="plain"
                titleClass="content_block_pink" bodyClass="body_table">
-               <mm:cloudinfo type="user" id="cloudusername" write="false" />
 
       <mm:listnodescontainer type="contentelement">
                        <mm:constraint field="lastmodifier" operator="EQUAL" 
referid="cloudusername" />
          <mm:maxnumber value="${dashboardRepositorySize}" />
          <mm:sortorder field="lastmodifieddate" direction="down" />
-
                <table>
          <thead>
             <tr>
@@ -89,8 +117,92 @@
       </table>
       </mm:listnodescontainer>
        </cmscedit:contentblock>
+   </mm:haspage>
+
 
+    <c:set var="dashboardTaskSize" value="5"/>
+    <c:set var="tmpRole" value="assignedrel"/>
+    <mm:haspage page="/editors/taskmanagement/">
+    <c:set var="dashboardTaskTitle"><fmt:message 
key="dashboard.task.header"><fmt:param>${dashboardTaskSize}</fmt:param></fmt:message></c:set>
+    <cmscedit:contentblock title="${dashboardTaskTitle}" titleMode="plain"
+      titleClass="content_block_pink" bodyClass="body_table">
+
+     <mm:listnodescontainer type="user">
+        <mm:constraint field="user.username" operator="EQUAL" 
referid="cloudusername" />
+        <mm:maxnumber value="10" />
+        <mm:listnodes>
+           <mm:relatednodescontainer type="task" role="${tmpRole}" 
searchdirs="source">
+              <mm:maxnumber value="${dashboardTaskSize}" />
+              <table>
+                 <thead>
+                    <tr>
+                      <th><fmt:message key="dashboard.task.created" /></th>
+                      <th><fmt:message key="dashboard.task.deadline" /></th>
+                      <th><fmt:message key="dashboard.task.title" /></th>
+                      <th><fmt:message key="dashboard.task.status" /></th>
+                      <th><fmt:message key="dashboard.task.contenttitle" 
/></th>
+                      <th><fmt:message key="dashboard.task.nodetype" /></th>
+                      <th><fmt:message key="dashboard.task.description" /></th>
+                    </tr>
+                 </thead>
+                 <tbody class="hover">
+                    <c:set var="taskList" value="" /><c:set var="isSwapClass" 
value="true"/>
+                    <mm:relatednodes comparator="StatusComparator">
+                       <c:set var="taskId"><mm:field name="number"/></c:set>
+                       <c:if test="${not fn:contains(taskList, taskId) and 
fn:length(taskList) le dashboardTaskSize}">
+                       <tr <c:if test="${isSwapClass}">class="swap"</c:if>>
+                          <td><mm:field name="creationdate" 
id="created"><mm:time time="${created}" format="d/M/yyyy HH:mm" 
/></mm:field></td>
+                          <td><mm:field name="deadline" id="deadl"><mm:time 
time="${deadl}" format="d/M/yyyy HH:mm"/></mm:field></td>
+                          <td><mm:field name="title"/></td>
+                          <c:set var="elementtitel"><mm:field 
name="title"/></c:set>
+                          <c:set var="elementnumber"/>
+                          <c:set var="elementtype"/>
+                          <mm:relatednodescontainer type="contentelement" 
role="taskrel" searchdirs="destination">
+                             <mm:maxnumber value="1" />
+                             <mm:relatednodes>
+                                <c:set var="elementtitel"><mm:field 
name="title"/></c:set>
+                                <c:set var="elementnumber"><mm:field 
name="number"/></c:set>
+                                <c:set var="elementtype"><mm:field 
name="number"><mm:isnotempty><mm:nodeinfo 
type="guitype"/></mm:isnotempty></mm:field></c:set>
+                             </mm:relatednodes>
+                          </mm:relatednodescontainer>
+                          <c:set var="status"><mm:field name="status" 
/></c:set>
+                          <td><fmt:message key="${status}" /></td>
+                          <td>
+                             <c:choose>
+                                <c:when test="${empty elementnumber}">
+                                   <fmt:message 
key="dashboard.task.noelement"/>
+                                </c:when>
+                                <c:otherwise>
+                                   <mm:hasrank minvalue="basic user">
+                                      <a 
href="javascript:window.top.openRepositoryWithContent('<mm:write 
referid="elementnumber"/>');"><img src="gfx/icons/edit.png" align="top" 
alt="<fmt:message key="dashboard.task.editelement"/>" title="<fmt:message 
key="dashboard.task.editelement"/>"/></a> ${elementtitel}
+                                   </mm:hasrank>
+                                </c:otherwise>
+                             </c:choose>
+                          </td>
+                          <td>${elementtype}</td>
+                          <td>
+                             <mm:hasrank minvalue="basic user">
+                                <mm:field name="number" jspvar="number" 
write="false"/>
+                                <mm:url 
page="/editors/taskmanagement/tasklist.jsp" id="returnTaskedit" write="false" />
+                                <a 
href="javascript:window.top.openTasksWithTask('<mm:write 
referid="number"/>');"><img src="gfx/icons/edit2.png" align="top" 
alt="<fmt:message key="dashboard.task.edit"/>" title="<fmt:message 
key="dashboard.task.edit"/>"/></a> <mm:field name="description" />
+                             </mm:hasrank>
+                          </td>
+                       </tr>
+                       <c:set var="taskList">${taskList},${taskId}</c:set>
+                       <c:choose>
+                          <c:when test="${isSwapClass eq 'false'}"><c:set 
var="isSwapClass" value="true"/></c:when>
+                          <c:when test="${isSwapClass eq 'true'}"><c:set 
var="isSwapClass" value="false"/></c:when>
+                       </c:choose>
+                       </c:if>
+                    </mm:relatednodes>
+                 </tbody>
+              </table>
+           </mm:relatednodescontainer>
+        </mm:listnodes>
+     </mm:listnodescontainer>
+   </cmscedit:contentblock>
    </mm:haspage>
+
 </mm:cloud>
        </div>
 </body>


Index: editors.js
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer/cmsc/edit-webapp/src/webapp/editors/editors.js,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- editors.js  10 Sep 2007 15:57:46 -0000      1.4
+++ editors.js  25 Mar 2009 02:18:04 -0000      1.5
@@ -1,5 +1,6 @@
 var repositoryUrl = 'repository/index.jsp';
 var siteUrl = 'site/index.jsp';
+var taskUrl = 'taskmanagement/index.jsp'
 
 function openRepository() {
        window.bottompane.location = repositoryUrl;
@@ -29,3 +30,7 @@
                window.toppane.initMenu();
        }
 }
\ No newline at end of file
+
+function openTasksWithTask(tasknumber) {
+       window.bottompane.location = taskUrl + '?tasknumber=' + tasknumber;
+}
\ No newline at end of file
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to