Author: hansbak
Date: Mon Dec 17 07:20:13 2007 New Revision: 604892 URL: http://svn.apache.org/viewvc?rev=604892&view=rev Log: a very first basic scheduler to get my feet wet....also added demo data for task estimates Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties?rev=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties (original) +++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties Mon Dec 17 07:20:13 2007 @@ -60,6 +60,7 @@ PageTitleTaskInformation=Task information PageTitleUnassignedTask=Unassigned Task ProjectMgrActualHours=Actual Hours +ProjectMgrSchedule=Schedule ProjectMgrCompanyName=Ofbiz Company ProjectMgrCompanySubtitle=Project ProjectMgrDependencies=Dependencies Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml?rev=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrDemoData.xml Mon Dec 17 07:20:13 2007 @@ -23,16 +23,22 @@ <!-- make sure they show up as resources --> <PartyRole partyId="DemoCustomer" roleTypeId="PROJECT_TEAM"/> <PartyRole partyId="admin" roleTypeId="PROJECT_TEAM"/> - - <!-- Demo project, phases and tasks --> + + <!-- some skills required. --> + <SkillType skillTypeId="9000" description="Computer language Java"/> + <!-- Demo project, phases and tasks with estimated time--> <WorkEffort workEffortId="9000" workEffortTypeId="PROJECT" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 15:07:52.901" scopeEnumId="WES_PUBLIC" workEffortName="Demo Project" revisionNumber="1"/> <WorkEffort workEffortId="9001" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:14.226" workEffortParentId="9000" workEffortName="phase1" revisionNumber="1" /> <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="1" /> + <WorkEffortSkillStandard workEffortId="9002" skillTypeId="9000" estimatedDuration="16.0"/> <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="1" /> + <WorkEffortSkillStandard workEffortId="9003" skillTypeId="9000" estimatedDuration="24.0"/> <WorkEffort workEffortId="9004" workEffortTypeId="PHASE" currentStatusId="CAL_ACCEPTED" lastStatusUpdate="2007-12-14 16:45:35.939" workEffortParentId="9000" workEffortName="phase2" revisionNumber="1"/> <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="1"/> + <WorkEffortSkillStandard workEffortId="9005" skillTypeId="9000" estimatedDuration="32.0"/> <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="1"/> - + <WorkEffortSkillStandard workEffortId="9002" skillTypeId="9000" estimatedDuration="40.0"/> + <!-- task dependencies --> <WorkEffortAssoc workEffortIdFrom="9002" workEffortIdTo="9003" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/> <WorkEffortAssoc workEffortIdFrom="9003" workEffortIdTo="9005" workEffortAssocTypeId="WORK_EFF_DEPENDENCY" sequenceNum="0" fromDate="2000-01-01 00:00:00.0"/> 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=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Mon Dec 17 07:20:13 2007 @@ -21,7 +21,7 @@ <simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/simple-methods.xsd"> - <simple-method method-name="projectScheduler" short-description="Project Schulers sets the planningdates according task requirements and available resources"> + <simple-method method-name="scheduleProject" short-description="Project Schulers sets the planningdates according task requirements and available resources"> <!-- theory behind the program - - - - - - - - - - - - - @@ -53,6 +53,74 @@ The system will then sort the list by sequence and will insert the planned dates according the startdate and sat and sundays. --> + + <!-- constants --> + <set field="nameOrder" value="10" type="Integer"/> + + <!-- create the tasklist --> + <field-to-result map-name="parameters" field-name="projectId"/> + <entity-one entity-name="WorkEffort" value-name="project"> + <field-map field-name="workEffortId" env-name="parameters.projectId"/> + </entity-one> + <set field="seq" value="0" type="Double"/> + <string-to-list string="workEffortName" list-name="order"/> + <get-related value-name="project" relation-name="ChildWorkEffort" list-name="phases" order-by-list-name="order"/> + <iterate entry-name="phase" list-name="phases"> + <get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks" order-by-list-name="order"/> + <iterate entry-name="task" list-name="tasks"> + <clear-field field-name="t"/> + <set field="t.workEffortId" from-field="task.workEffortId"/> + <set field="t.seq" from-field="seq"/> + <calculate field-name="seq"> + <calcop operator="get" field-name="seq"/> + <calcop operator="add" field-name="nameOrder"/> + </calculate> + <!-- get estimated hours --> + <get-related value-name="task" relation-name="WorkEffortSkillStandard" list-name="estimates"/> + <set field="total" value="0" type="Double"/> + <iterate entry-name="estimate" list-name="estimates"> + <calculate field-name="total"> + <calcop operator="get" field-name="total"/> + <calcop operator="add" field-name="estimate.estimatedDuration"></calcop> + </calculate> + </iterate> + <if-compare field-name="total" operator="not-equals" value="0"> + <calculate field-name="t.estimatedDays"> + <calcop operator="divide" field-name="total"> + <number value="8"/> + </calcop> + </calculate> + <else> + <set field="t.estimatedDays" value="1" type="Double"/> + </else> + </if-compare> + <field-to-list field-name="t" list-name="taskList"/> + </iterate> + </iterate> + + <!-- rearrange according dependencies which override the default sequence--> + <!-- to be added --> + + + <!-- order the list--> + <order-map-list list-name="taskList"> + <order-by field-name="seq"/> + </order-map-list> + + <now-timestamp-to-env env-name="currentDate"/> + <!-- iterate through the sorted list and set estimated start and end dates --> + <iterate entry-name="listItem" list-name="taskList"> + <set field="listItem.estimatedStartDate" from-field="currentDate"/> + <calculate field-name="dayNbr"></calculate> + <call-class-method class-name="org.ofbiz.base.util.UtilDateTime" method-name="addDaysToTimestamp" ret-field-name="currentDate"> + <field field-name="currentDate" type="java.sql.Timestamp"/> + <field field-name="listItem.estimatedDays" type="Double"/> + </call-class-method> + <set field="listItem.estimatedCompletionDate" from-field="currentDate"/> + <clear-field field-name="upd"/> + <set-service-fields service-name="updateWorkEffort" map-name="listItem" to-map-name="upd"/> + <call-service service-name="updateWorkEffort" in-map-name="upd"/> + </iterate> </simple-method> <simple-method method-name="updateTimeEntryByWorkeffort" short-description="Update workeffort by workeffort and timesheetId "> Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Mon Dec 17 07:20:13 2007 @@ -43,6 +43,12 @@ <attribute name="projectInfo" type="java.util.Map" mode="OUT" optional="true"/> </service> + <service name="scheduleProject" engine="simple" + location="org/ofbiz/project/ProjectServices.xml" invoke="scheduleProject"> + <description>(re) calculate the estimated start and enddates of tasks within a project</description> + <attribute name="projectId" type="String" mode="INOUT" optional="true"/> + </service> + <service name="getProjectIdAndName" engine="simple" location="org/ofbiz/project/ProjectServices.xml" invoke="getProjectIdAndName"> <description>Get the projectId and Name when a phase or task is provided.</description> Modified: 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=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/actions/GanttChart.bsh Mon Dec 17 07:20:13 2007 @@ -33,19 +33,22 @@ 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) +if (project != null && project.get("startDate") != null) context.put("chartStart",project.get("startDate")); else context.put("chartStart", UtilDateTime.nowTimestamp()); // default todays date -if (project.get("completionDate") != null ) +if (project != null && project.get("completionDate") != null ) context.put("chartEnd",project.get("completionDate")); else context.put("chartEnd", UtilDateTime.addDaysToTimestamp(UtilDateTime.nowTimestamp(), 14)); // default 14 days long + +if (project == null) return; // phase list result = dispatcher.runSync("getProjectPhaseList", UtilMisc.toMap("userLogin", userLogin, "projectId", projectId)); 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=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Mon Dec 17 07:20:13 2007 @@ -67,11 +67,17 @@ <response name="success" type="view" value="EditProject"/> <response name="error" type="view" value="EditProject"/> </request-map> - <request-map uri="deleteProject"> - <security https="true" auth="true"/> - <event type="service" invoke="deleteWorkEffort"/> - <response name="success" type="view" value="FindProject"/> - <response name="error" type="view" value="FindProject"/> + <request-map uri="deleteProject"> + <security https="true" auth="true"/> + <event type="service" invoke="deleteWorkEffort"/> + <response name="success" type="view" value="FindProject"/> + <response name="error" type="view" value="FindProject"/> + </request-map> + <request-map uri="scheduleProject"> + <security https="true" auth="true"/> + <event type="service" invoke="scheduleProject"/> + <response name="success" type="view" value="ganttChart"/> + <response name="error" type="view" value="ganttChart"/> </request-map> <request-map uri="FindResource"> <security https="true" auth="true"/> 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=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl (original) +++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/gantChart.ftl Mon Dec 17 07:20:13 2007 @@ -147,7 +147,7 @@ // 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 + chart.addPlotArea({ x:5,y:100, plotArea:pa2 }); // position of the chart on screen dojo.addOnLoad(function(){ Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml?rev=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/CommonScreens.xml Mon Dec 17 07:20:13 2007 @@ -102,6 +102,7 @@ </condition> <widgets> <include-menu name="ProjectTabBar" location="component://projectmgr/widget/Menus.xml"/> + <include-menu name="ProjectSubTabBar" location="component://projectmgr/widget/Menus.xml"/> <label style="head1" text="${uiLabelMap.ProjectMgrProjectCurrent}: ${project.workEffortName}[${project.workEffortId}]"/> </widgets> </section> Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=604892&r1=604891&r2=604892&view=diff ============================================================================== --- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original) +++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Mon Dec 17 07:20:13 2007 @@ -32,7 +32,7 @@ <menu-item name="request" title="${uiLabelMap.WorkEffortRequestList}"><link target="requestlist"/></menu-item> <menu-item name="help" title="Help" align-style="col-right"> - <link target="http://docs.ofbiz.org/display/OFBENDUSER/Project+Manager+Role?decorator=printable" url-mode="plain" target-window="new"/> + <link target="http://docs.ofbiz.org/display/OFBENDUSER/Project+Manager+Application+Roles?decorator=printable" url-mode="plain" target-window="new"/> </menu-item> <menu-item name="Logout" title="Logout" align-style="col-right" widget-style="headerButtonRight" selected-style="headerButtonRightSelected"> <condition><not><if-empty field-name="userLogin"/></not></condition> @@ -46,17 +46,38 @@ <menu name="ProjectTabBar" type="simple" menu-container-style="button-bar tab-bar" default-selected-style="selected"> <actions> <set field="projectId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/> - </actions> + </actions> <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="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="EditProjectTasks?projectId=${projectId}"/></menu-item> <menu-item name="parties" title="${uiLabelMap.ProjectMgrResources}"><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> - <!--menu-item name="treeDetails" title="${uiLabelMap.ProjectMgrTreeDetails}"><link target="ChildWorkEfforts?projectId=${projectId}&trail=${workEffortId}&workEffortTypeId=PROJECT&workEffortAssocTypeId=WORK_EFF_BREAKDOWN"/></menu-item--> - </menu> + <menu-item name="subprojects" title="${uiLabelMap.ProjectMgrSubProjects}"><link target="ListSubProjects?projectId=${projectId}"/></menu-item> + <!--menu-item name="treeDetails" title="${uiLabelMap.ProjectMgrTreeDetails}"><link target="ChildWorkEfforts?projectId=${projectId}&trail=${workEffortId}&workEffortTypeId=PROJECT&workEffortAssocTypeId=WORK_EFF_BREAKDOWN"/></menu-item--> + </menu> + <menu name="ProjectSubTabBar" type="simple" menu-container-style="button-bar button-style-2" default-selected-style="selected"> + <actions> + <set field="projectId" from-field="parameters.projectId" default-value="${parameters.workEffortId}"/> + </actions> + <menu-item name="newProject" title="${uiLabelMap.ProjectMgrNewProject}"> + <condition> + <not> + <if-empty field-name="project"/> + </not> + </condition> + <link target="EditProject"></link> + </menu-item> + <menu-item name="schedule" title="${uiLabelMap.ProjectMgrSchedule}"> + <condition> + <not> + <if-empty field-name="project"/> + </not> + </condition> + <link target="scheduleProject?projectId=${projectId}"></link> + </menu-item> + </menu> <menu name="TaskTabBar" type="simple" menu-container-style="button-bar tab-bar" default-selected-style="selected"> <menu-item name="taskView" title="${uiLabelMap.ProjectMgrTaskSummary}"><link target="taskView?workEffortId=${workEffortId}"/></menu-item> <menu-item name="edittask" title="${uiLabelMap.ProjectMgrEditTask}"><link target="EditTask?workEffortId=${workEffortId}"/></menu-item> |
Free forum by Nabble | Edit this page |