Author: hansbak
Date: Tue Oct 14 06:28:47 2008 New Revision: 704533 URL: http://svn.apache.org/viewvc?rev=704533&view=rev Log: improvements to the ganntchart Removed: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.groovy ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.groovy?rev=704533&r1=704532&r2=704533&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.groovy (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.groovy Tue Oct 14 06:28:47 2008 @@ -44,11 +44,9 @@ result = dispatcher.runSync("getProjectPhaseList", [userLogin : userLogin , projectId : projectId]); phases = result.phaseList; if (phases){ - phaseNr = 1; - taskNr = 10000; - phases.each { phase -> - newPhase = phase; - newPhase.phaseNr = phaseNr; + phases.each { phase -> + newPhase = phase; + newPhase.phaseNr = phase.phaseId; if (!newPhase.estimatedStartDate && newPhase.actualStartDate) { newPhase.estimatedStartDate = newPhase.actualStartDate; } @@ -62,14 +60,14 @@ newPhase.estimatedCompletionDate = UtilDateTime.addDaysToTimestamp(newPhase.estimatedStartDate, 3); } newPhase.workEffortTypeId = "PHASE"; - ganttList.add(newPhase); - tasks = delegator.findByAnd("WorkEffort", ["workEffortParentId" : phase.phaseId], ["workEffortName"]); - if (tasks){ - tasks.each { task -> - resultTaskInfo = dispatcher.runSync("getProjectTask", [userLogin : userLogin , taskId : task.workEffortId]); - taskInfo = resultTaskInfo.taskInfo; - taskInfo.taskNr = taskNr++; - taskInfo.phaseNr = phaseNr; + ganttList.add(newPhase); + tasks = delegator.findByAnd("WorkEffort", ["workEffortParentId" : phase.phaseId], ["workEffortName"]); + if (tasks){ + tasks.each { task -> + resultTaskInfo = dispatcher.runSync("getProjectTask", [userLogin : userLogin , taskId : task.workEffortId]); + taskInfo = resultTaskInfo.taskInfo; + taskInfo.taskNr = task.workEffortId; + taskInfo.phaseNr = phase.phaseId; if (!taskInfo.estimatedStartDate && taskInfo.actualStartDate) { taskInfo.estimatedStartDate = taskInfo.actualStartDate; } @@ -85,11 +83,39 @@ taskInfo.estimatedStartDate = UtilDateTime.toDateString(taskInfo.estimatedStartDate, "MM/dd/yyyy"); taskInfo.estimatedCompletionDate = UtilDateTime.toDateString(taskInfo.estimatedCompletionDate, "MM/dd/yyyy"); taskInfo.workEffortTypeId = "TASK"; - ganttList.add(taskInfo); - } - } - phaseNr++; - } + if (taskInfo.currentStatusId == "PTS_COMPLETED") { + taskInfo.completion = 100; + }else{ + taskInfo.completion = 0; + } + taskInfo.url = "/projectmgr/control/taskView?workEffortId="+task.workEffortId; + resultTaskResource = dispatcher.runSync("getTasksByParties", [userLogin : userLogin , workEffortId : task.workEffortId]); + taskParties = resultTaskResource.taskParties; + resource = ""; + int i = 0; + if (taskParties){ + taskParties.each { parties -> + symbol = " "; + partyname = parties.partyName; + name = partyname.substring(partyname.indexOf(",")+1 , partyname.length()); + if (i > 0){ + symbol = ", "; + } + resource = resource + symbol + name; + i++; + } + } + taskInfo.resource = resource ; + + // dependency + preTasks = delegator.findByAnd("WorkEffortAssoc", ["workEffortIdTo" : task.workEffortId], ["workEffortIdFrom"]); + if (preTasks) { + taskInfo.preDecessor = preTasks[0].workEffortIdFrom; + } + ganttList.add(taskInfo); + } + } + } } context.phaseTaskList = ganttList; Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl?rev=704533&r1=704532&r2=704533&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl Tue Oct 14 06:28:47 2008 @@ -22,9 +22,9 @@ <script language="javascript"> var g = new JSGantt.GanttChart('g',document.getElementById('GanttChartDIV'), 'day'); -g.setShowRes(0); // Show/Hide Responsible (0/1) +g.setShowRes(1); // Show/Hide Responsible (0/1) g.setShowDur(1); // Show/Hide Duration (0/1) -g.setShowComp(0); // Show/Hide % Complete(0/1) +g.setShowComp(1); // Show/Hide % Complete(0/1) // Parameters (pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen) @@ -33,9 +33,10 @@ g.AddTaskItem(new JSGantt.TaskItem(${t.phaseNr}, "${t.phaseName}", "", "", "#00ff00", "", 0, "", 0, 1, 0, 1)); </#if> <#if t.workEffortTypeId == "TASK"> - g.AddTaskItem(new JSGantt.TaskItem(${t.taskNr},"${t.taskName}","${t.estimatedStartDate}", "${t.estimatedCompletionDate}","#009900", "", 0, "", 0, 0, ${t.phaseNr}, 1)); + g.AddTaskItem(new JSGantt.TaskItem(${t.taskNr},"${t.taskName}","${t.estimatedStartDate}", "${t.estimatedCompletionDate}","#009900", "${t.url}", 0 , "${t.resource?if_exists}", ${t.completion?if_exists} , 0, ${t.phaseNr}, 1<#if t.preDecessor?exists>, ${t.preDecessor}</#if>)); </#if> </#list> + <#-- TaskItem(pID, pName, pStart, pEnd, pColor, pLink, pMile, pRes, pComp, pGroup, pParent, pOpen, pDepend) |
Free forum by Nabble | Edit this page |