Author: hansbak
Date: Fri Dec 14 23:16:21 2007 New Revision: 604397 URL: http://svn.apache.org/viewvc?rev=604397&view=rev Log: Added the first version of the Gannt chart working on ofbiz project data, add a demo project to show it, corrected some errors, renamed a screen to a more usefull name and various other things Added: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (with props) ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh (with props) Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties (original) +++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties Fri Dec 14 23:16:21 2007 @@ -22,7 +22,8 @@ nl=Dutch # Override Page and Label title -PageTitleAddDependency=Add Dependency +PageTitleAddDependencyAfter=Add Dependency After the current Task +PageTitleAddDependencyBefore=Add Dependency before the current Task PageTitleAddPartyAssign=Add Party Assign PageTitleAddProject=Add Project PageTitleAddPhase=Add Phase @@ -37,6 +38,7 @@ PageTitleDependencies=Task dependencies PageTitleEditCurrentTimesheet=Edit current timesheet PageTitleEditProject=Edit Project +PageTitleProjectGanttChart=Project Gantt Chart PageTitleEditPhase=Edit Phase PageTitleEditSkill=Edit Skill PageTitleEditSubProject=Edit Sub Project @@ -69,6 +71,7 @@ ProjectMgrEstimatedHours=Estimated Hours ProjectMgrEstimatedNumPeople=Estimated People ProjectMgrFilterOn=Filter on +ProjectMgrGanttChart=Gantt Chart ProjectMgrNewProject=New Project ProjectMgrNewSubProject=New Sub Project ProjectMgrNewSubTask=New Sub Task Added: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml?rev=604397&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (added) +++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml Fri Dec 14 23:16:21 2007 @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity-engine-xml> + <WorkEffort workEffortId="9000" workEffortTypeId="PROJECT" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 15:07:52.901" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-05 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 15:07:52.901" createdByUserLogin="admin" lastModifiedDate="2007-12-15 07:47:57.609" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-15 07:47:57.615" lastUpdatedTxStamp="2007-12-15 07:47:57.175" createdStamp="2007-12-14 15:07:52.901" createdTxStamp="2007-12-14 15:07:52.435"/> + <WorkEffort workEffortId="9001" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9000" workEffortName="phase1" revisionNumber="1" createdDate="2007-12-14 16:45:14.226" createdByUserLogin="admin" lastModifiedDate="2007-12-14 16:45:14.226" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 16:45:14.226" lastUpdatedTxStamp="2007-12-14 16:45:13.956" createdStamp="2007-12-14 16:45:14.226" createdTxStamp="2007-12-14 16:45:13.956"/> + <WorkEffort workEffortId="9002" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:21.831" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task1" estimatedStartDate="2007-12-03 00:00:00.0" estimatedCompletionDate="2007-12-05 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:21.831" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:15:47.898" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:15:47.9" lastUpdatedTxStamp="2007-12-14 17:15:47.659" createdStamp="2007-12-14 16:45:21.833" createdTxStamp="2007-12-14 16:45:21.827"/> + <WorkEffort workEffortId="9003" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:29.453" workEffortParentId="9001" scopeEnumId="WES_PUBLIC" workEffortName="task2" estimatedStartDate="2007-12-05 00:00:00.0" estimatedCompletionDate="2007-12-16 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:29.453" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:01.752" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:01.754" lastUpdatedTxStamp="2007-12-14 17:16:01.539" createdStamp="2007-12-14 16:45:29.453" createdTxStamp="2007-12-14 16:45:29.25"/> + <WorkEffort workEffortId="9004" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:35.939" workEffortParentId="9000" workEffortName="phase2" revisionNumber="1" createdDate="2007-12-14 16:45:35.939" createdByUserLogin="admin" lastModifiedDate="2007-12-14 16:45:35.939" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 16:45:35.939" lastUpdatedTxStamp="2007-12-14 16:45:35.935" createdStamp="2007-12-14 16:45:35.939" createdTxStamp="2007-12-14 16:45:35.935"/> + <WorkEffort workEffortId="9005" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:50.84" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task3" estimatedStartDate="2007-12-16 00:00:00.0" estimatedCompletionDate="2007-12-17 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:50.84" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:11.232" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:11.233" lastUpdatedTxStamp="2007-12-14 17:16:11.218" createdStamp="2007-12-14 16:45:50.841" createdTxStamp="2007-12-14 16:45:50.559"/> + <WorkEffort workEffortId="9006" workEffortTypeId="TASK" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:58.857" workEffortParentId="9004" scopeEnumId="WES_PUBLIC" workEffortName="task4" estimatedStartDate="2007-12-18 00:00:00.0" estimatedCompletionDate="2007-12-20 00:00:00.0" revisionNumber="2" createdDate="2007-12-14 16:45:58.857" createdByUserLogin="admin" lastModifiedDate="2007-12-14 17:16:24.359" lastModifiedByUserLogin="admin" lastUpdatedStamp="2007-12-14 17:16:24.36" lastUpdatedTxStamp="2007-12-14 17:16:24.143" createdStamp="2007-12-14 16:45:58.858" createdTxStamp="2007-12-14 16:45:58.846"/> + + <WorkEffortAssoc workEffortIdFrom="9002" workEffortIdTo="9003" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:48:47.856" lastUpdatedStamp="2007-12-15 07:48:47.857" lastUpdatedTxStamp="2007-12-15 07:48:47.636" createdStamp="2007-12-15 07:48:47.857" createdTxStamp="2007-12-15 07:48:47.636"/> + <WorkEffortAssoc workEffortIdFrom="9003" workEffortIdTo="9005" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:56:09.61" lastUpdatedStamp="2007-12-15 07:56:09.61" lastUpdatedTxStamp="2007-12-15 07:56:09.414" createdStamp="2007-12-15 07:56:09.61" createdTxStamp="2007-12-15 07:56:09.414"/> + <WorkEffortAssoc workEffortIdFrom="9005" workEffortIdTo="9006" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2007-12-15 07:56:18.588" lastUpdatedStamp="2007-12-15 07:56:18.588" lastUpdatedTxStamp="2007-12-15 07:56:18.556" createdStamp="2007-12-15 07:56:18.588" createdTxStamp="2007-12-15 07:56:18.556"/> + +</entity-engine-xml> \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml ------------------------------------------------------------------------------ svn:eol-style = native Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml Fri Dec 14 23:16:21 2007 @@ -23,7 +23,8 @@ <RoleType description="Client Manager" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="CLIENT_MANAGER"/> <RoleType description="Client Analyst" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="CLIENT_ANALYST"/> <RoleType description="Provider Manager" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PROVIDER_MANAGER"/> - <RoleType description="Provider Analyst" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PROVIDER_ANALYST"/> + <RoleType description="Provider Accounting" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PROVIDER_ACCOUNTING"/> + <RoleType description="Provider Analyst" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PROVIDER_ANALYST"/> <RoleType description="Provider Validator" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PROVIDER_VALIDATOR"/> <RoleType description="Provider Functional Implementer" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PRVDER_FUNCTNAL_IMPL"/> <RoleType description="Provider Test Implementer" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PRVDER_TEST_IMPL"/> Modified: ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml Fri Dec 14 23:16:21 2007 @@ -28,8 +28,9 @@ <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> <entity-resource type="group" reader-name="main" loader="main" location="entitydef/entitygroup.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/ProjectMgrTypeData.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/ProjectMgrSecurityData.xml"/> - + <entity-resource type="data" reader-name="seed" loader="main" location="data/ProjectMgrSecurityData.xml"/> + <entity-resource type="data" reader-name="demo" loader="main" location="data/ProjectMgrDemoData.xml"/> + <service-resource type="model" loader="main" location="servicedef/services.xml"/> <webapp name="projectmgr" Modified: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Fri Dec 14 23:16:21 2007 @@ -379,7 +379,7 @@ <if-empty field-name="highInfo.estimatedStartDate"> <set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" /> <else> - <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedStartDate" operator="less"> + <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedStartDate" operator="greater"> <set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" /> </if-compare-field> </else> @@ -389,7 +389,7 @@ <if-empty field-name="highInfo.estimatedCompletionDate"> <set field="highInfo.estimatedCompletionDate" from-field="lowInfo.estimatedCompletionDate" /> <else> - <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedCompletionDate" operator="greater"> + <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedCompletionDate" operator="less"> <set field="highInfo.estimatedCompletionDate" from-field="lowInfo.estimatedCompletionDate" /> </if-compare-field> </else> @@ -443,7 +443,6 @@ <!-- add the estimated/planned hours together --> <call-simple-method method-name="getHours"/> - </simple-method> <simple-method method-name="getHours" short-description="get the planned and estimated hours for a task"> Added: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh?rev=604397&view=auto ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh (added) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh Fri Dec 14 23:16:21 2007 @@ -0,0 +1,69 @@ +/* +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.*; +import java.lang.*; +import org.ofbiz.entity.*; +import org.ofbiz.base.util.*; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.service.LocalDispatcher; +import org.ofbiz.entity.util.*; +import org.ofbiz.base.util.*; +import org.ofbiz.entity.condition.*; +import java.sql.Timestamp; + +LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); +projectId = parameters.get("projectId"); +userLogin = session.getAttribute("userLogin"); + +ganttList = new LinkedList(); // resulting list + +//project info +result = dispatcher.runSync("getProject", UtilMisc.toMap("projectId", projectId, "userLogin", userLogin)); +project = result.get("projectInfo"); +if (project.get("startDate") != null) + context.put("chartStart",project.get("startDate")); +else + context.put("chartStart", UtilDateTime.nowTimestamp()); // default todays date +if (project.get("completionDate") != null ) + context.put("chartEnd",project.get("completionDate")); +else + context.put("chartEnd", UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 14)); // default 14 days long + +// phase list +result = dispatcher.runSync("getProjectPhaseList", UtilMisc.toMap("userLogin", userLogin, "projectId", projectId)); +phases = result.get("phaseList"); +if (phases != null) { + p = phases.iterator(); + while (p.hasNext()) { + phase = p.next(); + ganttList.add(phase); + tasks = delegator.findByAnd("WorkEffort", UtilMisc.toMap("workEffortParentId", phase.get("phaseId"))); + if (tasks != null) { + t = tasks.iterator(); + while (t.hasNext()) { + task = t.next(); + ganttList.add(task); + } + } + } + // add sort? + context.put("tasks", ganttList); +} \ No newline at end of file Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Fri Dec 14 23:16:21 2007 @@ -107,9 +107,9 @@ <response name="success" type="view" value="FindProject"/> <response name="error" type="view" value="FindProject"/> </request-map> - <request-map uri="FindTask"> + <request-map uri="EditProjectTasks"> <security https="true" auth="true"/> - <response name="success" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="EditTask"> <security https="true" auth="true"/> @@ -124,8 +124,8 @@ <request-map uri="createProjectTaskOrPhase"> <security https="true" auth="true"/> <event type="service" invoke="createWorkEffort"/> - <response name="success" type="view" value="FindTask"/> - <response name="error" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> + <response name="error" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="createProjectPhase"> <security https="true" auth="true"/> @@ -154,8 +154,8 @@ <request-map uri="updateProjectTaskOrPhase"> <security https="true" auth="true"/> <event type="service" invoke="updateWorkEffort"/> - <response name="success" type="view" value="FindTask"/> - <response name="error" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> + <response name="error" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="updateProjectPhase"> <security https="true" auth="true"/> @@ -166,8 +166,8 @@ <request-map uri="deleteTask"> <security https="true" auth="true"/> <event type="service" invoke="deleteWorkEffort"/> - <response name="success" type="view" value="FindTask"/> - <response name="error" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> + <response name="error" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="EditTaskAndAssoc"> <security https="true" auth="true"/> @@ -177,14 +177,14 @@ <request-map uri="createTaskAndAssoc"> <security https="true" auth="true"/> <event type="simple" path="org/ofbiz/workeffort/workeffort/WorkflowSimpleEvents.xml" invoke="createWorkEffortAndAssoc"/> - <response name="success" type="view" value="FindTask"/> - <response name="error" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> + <response name="error" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="updateTaskAndAssoc"> <security https="true" auth="true"/> <event type="service" invoke="updateWorkEffortAndAssoc"/> - <response name="success" type="view" value="FindTask"/> - <response name="error" type="view" value="FindTask"/> + <response name="success" type="view" value="EditProjectTasks"/> + <response name="error" type="view" value="EditProjectTasks"/> </request-map> <request-map uri="Dependencies"> <security https="true" auth="true"/> @@ -422,7 +422,7 @@ <view-map name="EditWorkEffort" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProject"/> <view-map name="ChildWorkEfforts" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#ChildWorkEfforts"/> <view-map name="EditProjectAndAssoc" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProjectAndAssoc"/> - <view-map name="FindTask" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#FindTask"/> + <view-map name="EditProjectTasks" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#EditProjectTasks"/> <view-map name="MyTasks" type="screen" page="component://projectmgr/widget/TaskScreens.xml#MyTasks"/> <view-map name="EditTask" type="screen" page="component://projectmgr/widget/TaskScreens.xml#EditTask"/> <view-map name="AddTaskAndAssoc" type="screen" page="component://projectmgr/widget/ProjectScreens.xml#AddTaskAndAssoc"/> 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=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl Fri Dec 14 23:16:21 2007 @@ -16,15 +16,353 @@ specific language governing permissions and limitations under the License. --> -<html> -<header> - <script type="text/javascript" src="/images/dojo/dojo.js" - djConfig="parseOnLoad: true"></script> - -</header> -<body> -<script language="javascript" src="/projectmgr/js/gantt.js" type="text/javascript"></script> -<div id="chartTest1"/> -</body> -</html> +<script language="javascript"> + + dojo.require("dojo.collections.Store"); + dojo.require("dojo.charting.Chart"); + dojo.require('dojo.json'); + dojo.require("dojo.date.common"); + dojo.require("dojo.event.*"); + dojo.require("dojo.io.*"); + + var interv = dojo.date.dateParts.DAY; + + + // our sample data for our gantt chart. + + var docData = null; + var xml = { + url: "/projectmgr/js/data.xml", + mimetype: "text/xml", + load: callBack, + error: function(type, error){ + dojo.debug("type: " + type); + dojo.debug("error: " + error.message); + } + } + + dojo.io.bind(xml); + +/* + function xml2json(dataNode, json){ + var taskNodes = dataNode.getDocumentElement(); + // Convert the xml data to json + for(var i = 0; i < taskNodes.length; i++){ + var taskNode = taskNodes.item(i); + if(taskNode.childNodes.length){ + json.push({high: taskNode.attributes["end"], low: taskNode.attributes["start"], task: taskNode.attribute["label"], type: "p"}); + //Recursive call to crawl the dom + xml2json(taskNode); + }else{ + var dtStart = new Date(taskNode.attributes["start"]); + var dtEnd = new Date(taskNode.attributes["end"]); + json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.attributes["label"], type: taskNode.attributes["type"]}); + } + } + + return json; + } +*/ + function callBack(type, xmlDom, httpreq){ + + var taskNodes = xmlDom.getElementsByTagName("task"); + var json = []; + + // Convert the database data to json + <#if tasks?has_content> + <#list tasks as taskNode> + var dtStart = new Date("${taskNode.estimatedStartDate?string.short}"); + var dtEnd = new Date("${taskNode.estimatedCompletionDate?string.short}"); + <#if taskNode.phaseName?exists> + json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: "${taskNode.phaseName}", type: "p"}); + <#elseif taskNode.workEffortName?exists> + json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: "${taskNode.workEffortName}", type: "t"}); + </#if> + </#list> + </#if> + + // Convert the xml data to json +/* for(var i = 0; i < taskNodes.length; i++){ + var taskNode = taskNodes.item(i); + var dtStart = new Date(taskNode.getAttribute("start")); + var dtEnd = new Date(taskNode.getAttribute("end")); + if(taskNode.childNodes.length){ + json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.getAttribute("label"), type: "p"}); + }else{ + json.push({high: dtEnd.getTime(), low: dtStart.getTime(), task: taskNode.getAttribute("label"), type: taskNode.getAttribute("type")}); + } + } +*/ + //Parameters + var chartStart = new Date("${chartStart?string.short}"); + var dEnd = new Date("${chartEnd?string.short}"); +// var duration = 14; //Duration of the chart + //Calculated parameters + var nbDays = dojo.date.diff(chartStart, dtEnd, interv); + + var store = new dojo.collections.Store(); + store.setData(json); + + // define the chart. + var s1 = new dojo.charting.Series({ + dataSource:store, + bindings:{ id:"id", high:"high", low:"low", label:"task", type:"type" }, + label:"Project tasks" + }); + + // test the evaluate +/* + var data = s1.evaluate(); + var a=[]; + for(var i=0; i<data.length; i++){ + a.push("{ high:"+data[i].high +", low:"+data[i].low + ", label:"+data[i].label + "}"); + } + alert("Data evaluation:\n"+a.join("\n")); +*/ + + ////////////////////// + var data = s1.evaluate(); + + + //create the y-axis with task labels + var yB2 = new dojo.charting.Axis(); + //Range is calculated to nbTasks * 10 + yB2.range={upper:parseInt(data.length * 30),lower:0}; + yB2.origin="min"; + yB2.showTicks = true; + yB2.showLines = true; + + for(var i=data.length-1; i>=0; i--){ + yB2.labels.push({ label: data[i].label, value: parseInt((data.length - i)*30) }); + } + + //create the first x-axis (day-based) + var xB = new dojo.charting.Axis(); + xB.range={upper:dtEnd.getTime(), lower:chartStart.getTime()}; + //setting the origin to more than y-axis.upper cause it to appear above the chart + xB.origin = parseInt(yB2.range.upper + 30); + xB.showTicks = true; + xB.showLines = false; + + var dtStart = chartStart; + for(var i = 0; i < nbDays; i++){ + xB.labels.push({ label: dateFormat(dtStart, '!ddd'), value: dtStart.getTime() }); + dtStart = dojo.date.add(dtStart, interv, 1); + } + + //create the second x-axis (week-based) + var xB2 = new dojo.charting.Axis(); + //use the same range as first axis + xB2.range = xB.range; + xB2.origin="min"; + xB2.showTicks = true; + xB2.showLines = true; + + dtStart = chartStart; + for(var i = 0; i < nbDays; i++){ + if(dateFormat(dtStart, '!ddd') == "Mon"){ + xB2.labels.push({ label: dateFormat(dtStart, '!dd/!mm'), value: dtStart.getTime() }); + } + dtStart = dojo.date.add(dtStart, interv, 1); + } + + + +//gantt series + //to display second axis and labels on same chart, we need a first Plot object + var p2 = new dojo.charting.Plot(xB2, yB2); + + //The second Plot object hold the data Series + var p3 = new dojo.charting.Plot(xB, yB2); + p3.renderType = dojo.charting.RenderPlotSeries.Grouped; + p3.addSeries({ data:s1, plotter: dojo.charting.Plotters.Gantt }); + + var pa2 = new dojo.charting.PlotArea(); + //Add the 2 Plot to the PlotArea + pa2.plots.push(p2); + pa2.plots.push(p3); + + //Calculate chart height & width + var chartH = data.length * 30; // height of the bars + var chartW = nbDays * 50; // width of one day + + pa2.size={width:chartW, height:chartH}; + pa2.padding={top:30, right:30, bottom:30, left:60 }; + + // auto assign colors, and increase the step + s1.color = pa2.nextColor(); + + // Create the Chart and add the PlotArea + var chart = new dojo.charting.Chart(null, "Test chart", "This is a potential description"); + chart.addPlotArea({ x:5,y:60, plotArea:pa2 }); // position of the chart on screen + + + dojo.addOnLoad(function(){ + chart.node = dojo.byId("chartTest1"); + chart.render(); + document.getElementById("chartTest1").setAttribute("style", "width:" + chartW + "; height:" + chartH + ";"); + document.getElementById("plotLabels1").setAttribute("style", "width:" + chartW + "; height:" + chartH + ";"); + //Call PlotArea.render with the custom function + pa2.render(s1, customPlot); + + }); + dojo.debug("--end callBack"); + } + dojo.event.connect(dojo, "loaded", "init") + + function loadData(){ + var xml = { + url: "/projectmgr/js/data.xml", + mimetype: "text/xml", + load: function(type, xmlDom, httpreq){ + docData = xmlDom; + dojo.debug("load " + docData); + +// var params = new Array(); +// var content = navTreeProc.getResultString(xmlDom, params, document); + }, + error: function(type, error){ + dojo.debug("type: " + type); + dojo.debug("error: " + error); + } + } + dojo.io.bind(xml); + } + + function customPlot(node, srcObject){ + //First solution for custom labels + //Display labels in a div elt overlapping the graph + + var x = parseInt(node.getAttribute("x")); + var y = parseInt(node.getAttribute("y")); + var width = parseInt(node.getAttribute("width")) - 10; + + + if(srcObject.type == "p"){ + node.setAttribute("y", y + 15); + node.setAttribute("rx", "10"); + node.setAttribute("ry", "10"); + node.setAttribute("height", "5"); + node.setAttribute("type", "arc"); + node.setAttribute("style", "fill:#000000;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"); +// dojo.debug(srcObject.type); + }else if(srcObject.type == "j"){ + node.setAttribute("x", x + 15); + node.setAttribute("y", y + 10); + node.setAttribute("rx", "10"); + node.setAttribute("ry", "10"); + node.setAttribute("width", "10"); + node.setAttribute("height", "10"); + node.setAttribute("type", "arc"); + node.setAttribute("style", "fill:#00FF00;fill-opacity:0.75000000;fill-rule:evenodd;stroke:#000000;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000"); +// dojo.debug(srcObject.type); + }else{ + node.setAttribute("height", "20"); + } + + var div = document.createElement("div"); + if(srcObject.type != "p"){ + if(srcObject.type == "j"){ + div.setAttribute("class", "milestone-label"); + x += 15; + }else{ + div.setAttribute("class", "bar-label"); + } + div.setAttribute("style", "top:" + parseInt(y + 4) + "px; left:" + parseInt(x + 5) + "px; width:" + width + "px"); + div.appendChild(document.createTextNode(srcObject.task)); + document.getElementById("plotLabels1").appendChild(div); + } + //connect the mouseover event to the task label + dojo.event.connect(div, "onmouseover", dj_global, "onMouseOver"); + + } + + function onMouseOver(evt){ + logMe(evt); + } + + function logMe(evt){ + // FIXME: it appears that we're not actually getting this passed from IE!?! + //if(!evt){ evt = window.event; } + dojo.debug(evt.type + ' was fired'); +/* + lastEvt = dump(evt); + for(var x in evt){ + dojo.debug(x+": "+evt[x]); + } +*/ + dojo.debug("some event was fired"); + } + +function dateFormat(aDate, displayPat){ + /******************************************************** + * Valid Masks: + * !mmmm = Long month (eg. January) + * !mmm = Short month (eg. Jan) + * !mm = Numeric date (eg. 07) + * !m = Numeric date (eg. 7) + * !dddd = Long day (eg. Monday) + * !ddd = Short day (eg. Mon) + * !dd = Numeric day (eg. 07) + * !d = Numeric day (eg. 7) + * !yyyy = Year (eg. 1999) + * !yy = Year (eg. 99) + ********************************************************/ + + intMonth = aDate.getMonth(); + intDate = aDate.getDate(); + intDay = aDate.getDay(); + intYear = aDate.getFullYear(); + + var months_long = new Array ('January','February','March','April', + 'May','June','July','August','September','October','November','December') + var months_short = new Array('Jan','Feb','Mar','Apr','May','Jun', + 'Jul','Aug','Sep','Oct','Nov','Dec') + var days_long = new Array('Sunday','Monday','Tuesday','Wednesday', + 'Thursday','Friday','Saturday') + var days_short = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat') + + var mmmm = months_long[intMonth] + var mmm = months_short[intMonth] + var mm = intMonth < 9?'0'+ (1 + intMonth) + '':(1+intMonth)+''; + var m = 1+intMonth+''; + var dddd = days_long[intDay]; + var ddd = days_short[intDay]; + var dd = intDate<10?'0'+intDate+'':intDate+''; + var d = intDate+''; + var yyyy = intYear; + + century = 0; + while((intYear-century)>=100) + century = century + 100; + + var yy = intYear - century + if(yy<10) + yy = '0' + yy + ''; + + displayDate = new String(displayPat); + + displayDate = displayDate.replace(/!mmmm/i,mmmm); + displayDate = displayDate.replace(/!mmm/i,mmm); + displayDate = displayDate.replace(/!mm/i,mm); + displayDate = displayDate.replace(/!m/i,m); + displayDate = displayDate.replace(/!dddd/i,dddd); + displayDate = displayDate.replace(/!ddd/i,ddd); + displayDate = displayDate.replace(/!dd/i,dd); + displayDate = displayDate.replace(/!d/i,d); + displayDate = displayDate.replace(/!yyyy/i,yyyy); + displayDate = displayDate.replace(/!yy/i,yy); + + return displayDate; +} +</script> + +<div id="chartTest1"/> +<br/><br/> +<#if tasks?has_content> +<br/><br/><br/><br/><br/><br/> + <#list tasks as taskNode> + <br/><br/> + </#list> +</#if> \ No newline at end of file Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Fri Dec 14 23:16:21 2007 @@ -47,10 +47,11 @@ <actions> <set field="projectId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/> </actions> - <menu-item name="projectView" title="${uiLabelMap.ProjectMgrProjectSummary}"><link target="projectView?projectId=${projectId}"/></menu-item> + <menu-item name="ganttchart" title="${uiLabelMap.ProjectMgrGanttChart}"><link target="ganttChart?projectId=${projectId}"/></menu-item> + <menu-item name="projectView" title="${uiLabelMap.ProjectMgrProjectSummary}"><link target="projectView?projectId=${projectId}"/></menu-item> <menu-item name="editproject" title="${uiLabelMap.ProjectMgrEditPoject}"><link target="EditProject?projectId=${projectId}"/></menu-item> <menu-item name="phases" title="${uiLabelMap.ProjectMgrPhases}"><link target="FindPhase?projectId=${projectId}"/></menu-item> - <menu-item name="tasks" title="${uiLabelMap.ProjectMgrTasks}"><link target="FindTask?projectId=${projectId}"/></menu-item> + <menu-item name="tasks" title="${uiLabelMap.ProjectMgrTasks}"><link target="EditProjectTasks?projectId=${projectId}"/></menu-item> <menu-item name="parties" title="${uiLabelMap.ProjectMgrParties}"><link target="ListWorkEffortPartyAssigns?projectId=${projectId}"/></menu-item> <menu-item name="notes" title="${uiLabelMap.CommonNotes}"><link target="EditWorkEffortNotes?projectId=${projectId}"/></menu-item> <menu-item name="subprojects" title="${uiLabelMap.ProjectMgrSubProjects}"><link target="ListSubProjects?projectId=${projectId}"/></menu-item> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml Fri Dec 14 23:16:21 2007 @@ -230,7 +230,7 @@ </section> </screen> - <screen name="FindTask"> + <screen name="EditProjectTasks"> <section> <actions> <set field="titleProperty" value="PageTitleEditTask"/> @@ -251,7 +251,7 @@ <label style="boxhead">${uiLabelMap.${titleProperty}}</label> </container> <container style="screenlet-body"> - <include-form name="ListTasks" location="component://projectmgr/widget/forms/ProjectForms.xml"/> + <include-form name="EditProjectTasks" location="component://projectmgr/widget/forms/ProjectForms.xml"/> </container> </container> <container style="lefthalf"> @@ -552,10 +552,25 @@ </screen> <screen name="ganttChart"> <section> + <actions> + <set field="tabButtonItem" value="ganttchart"/> + <set field="layoutSettings.javaScripts[+0]" value="/images/dojo/dojo.js" global="true"/> + <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh"/> + </actions> <widgets> - <platform-specific> - <html><html-template location="component://projectmgr/webapp/projectmgr/project/gantChart.ftl"/></html> - </platform-specific> + <label text="${project}"></label> + <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}"> + <decorator-section name="body"> + <container style="screenlet"> + <container style="screenlet-title-bar"><label style="boxhead" text="${uiLabelMap.PageTitleProjectGanttChart}"/></container> + <container style="screenlet-body"> + <platform-specific> + <html><html-template location="component://projectmgr/webapp/projectmgr/project/gantChart.ftl"/></html> + </platform-specific> + </container> + </container> + </decorator-section> + </decorator-screen> </widgets> </section> </screen> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/TaskScreens.xml Fri Dec 14 23:16:21 2007 @@ -47,7 +47,7 @@ </container> </container> <container style="screenlet"> - <container style="screenlet-title-bar"><label style="boxhead">${uiLabelMap.PageTitleAddDependency}</label></container> + <container style="screenlet-title-bar"><label style="boxhead">${uiLabelMap.PageTitleAddDependencyBefore}</label></container> <container style="screenlet-body"> <include-form name="AddDependencyBefore" location="component://projectmgr/widget/forms/TaskForms.xml"/> </container> @@ -71,7 +71,7 @@ </container> </container> <container style="screenlet"> - <container style="screenlet-title-bar"><label style="boxhead">${uiLabelMap.PageTitleAddDependency}</label></container> + <container style="screenlet-title-bar"><label style="boxhead">${uiLabelMap.PageTitleAddDependencyAfter}</label></container> <container style="screenlet-body"> <include-form name="AddDependencyAfter" location="component://projectmgr/widget/forms/TaskForms.xml"/> </container> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Fri Dec 14 23:16:21 2007 @@ -158,8 +158,7 @@ <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> </form> - <!--================ Task Lists==============--> - <form name="ListTasks" target="updateProjectTaskOrPhase" title="" list-name="tasks" type="list" separate-columns="true" paginate-target="FindTask"> + <form name="EditProjectTasks" target="updateProjectTaskOrPhase" title="" list-name="tasks" type="list" separate-columns="true" paginate-target="FindTask"> <row-actions> <entity-one entity-name="StatusItem" value-name="currentStatus" auto-field-map="false"> <field-map field-name="statusId" env-name="currentStatusId"/> @@ -191,15 +190,9 @@ <option key="6"/><option key="7"/><option key="8"/><option key="9" description="9 (${uiLabelMap.WorkEffortPriorityLow})"/> </drop-down> </field> - <field use-when="actualStartDate!=null" name="StartDate" entry-name="actualStartDate" title="${uiLabelMap.WorkEffortStartDate}" parameter-name="actualStartDate"><date-time type="date"/></field> - <field use-when="actualStartDate==null" name="StartDate" entry-name="estimatedStartDate" title="${uiLabelMap.WorkEffortStartDate}" parameter-name="estimatedStartDate"><date-time type="date"/></field> - <field use-when="actualCompletionDate!=null" name="CompletionDate" entry-name="actualCompletionDate" title="${uiLabelMap.WorkEffortCompletionDate}" parameter-name="actualCompletionDate"><date-time type="date"/></field> - <field use-when="actualCompletionDate==null" name="CompletionDate" entry-name="estimatedCompletionDate" title="${uiLabelMap.WorkEffortCompletionDate}" parameter-name="estimatedCompletionDate"><date-time type="date"/></field> - <!--field name="description" title="${uiLabelMap.CommonDescription}"><textarea cols="6"/></field--> + <field name="estimatedStartDate" title="${uiLabelMap.WorkEffortEstimatedStartDate}"><date-time type="date"/></field> + <field name="estimatedCompletionDate" title="${uiLabelMap.WorkEffortEstimatedCompletionDate}"><date-time type="date"/></field> <field name="submitButton" title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field> - <!--field name="timeEntries" title="${uiLabelMap.ProjectMgrTimeEntries}" widget-style="buttontext"> - <hyperlink also-hidden="false" description="${uiLabelMap.ProjectMgrTimeEntries}" target="EditTimeEntries?workEffortId=${workEffortId}"/> - </field--> </form> <form name="ListUnassignedTasks" target="updateTaskAndAssoc" title="" list-name="tasks" type="list" separate-columns="true" paginate-target="FindTask"> <row-actions> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml?rev=604397&r1=604396&r2=604397&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/TaskForms.xml Fri Dec 14 23:16:21 2007 @@ -178,7 +178,7 @@ <field name="workEffortAssocTypeId"><hidden value="WORK_EFF_DEPENDENCY"/></field> <field name="fromDate"><hidden/></field> <field name="workEffortId"><hidden/></field> - <field name="workEffortToName" title="${uiLabelMap.CommonName}"><display/></field> + <field name="workEffortToName" title="${uiLabelMap.CommonName}"><hyperlink target="Dependencies?workEffortId=${workEffortIdTo}" description="${workEffortToName}"/></field> <field name="workEffortToParentId" title="${uiLabelMap.ProjectMgrTaskPhase}"><display-entity entity-name="WorkEffort" key-field-name="workEffortId" description="${workEffortName}"/>/></field> <field name="estimatedStartDate" entry-name="workEffortToEstimatedStartDate" title="${uiLabelMap.WorkEffortEstimatedStartDate}"><display type="date"/>/></field> <field name="estimatedCompletionDate" entry-name="workEffortToEstimatedCompletionDate" title="${uiLabelMap.WorkEffortEstimatedCompletionDate}"><display type="date"/></field> |
Free forum by Nabble | Edit this page |