svn commit: r597971 - in /ofbiz/trunk/specialpurpose/projectmgr: ./ script/ script/org/ script/org/ofbiz/ script/org/ofbiz/project/ servicedef/ webapp/projectmgr/project/ widget/ widget/forms/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r597971 - in /ofbiz/trunk/specialpurpose/projectmgr: ./ script/ script/org/ script/org/ofbiz/ script/org/ofbiz/project/ servicedef/ webapp/projectmgr/project/ widget/ widget/forms/

hansbak-2
Author: hansbak
Date: Sun Nov 25 02:41:31 2007
New Revision: 597971

URL: http://svn.apache.org/viewvc?rev=597971&view=rev
Log:
added services to get project dates and status from the task level

Added:
    ofbiz/trunk/specialpurpose/projectmgr/script/
    ofbiz/trunk/specialpurpose/projectmgr/script/org/
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/
    ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml   (with props)
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/
    ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml   (with props)
Removed:
    ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/project/editproject.ftl
Modified:
    ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml?rev=597971&r1=597970&r2=597971&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/ofbiz-component.xml Sun Nov 25 02:41:31 2007
@@ -24,13 +24,14 @@
     <resource-loader name="main" type="component"/>
     <classpath type="dir" location="script"/>
     <classpath type="dir" location="config"/>
-    <classpath type="jar" location="build/lib/*"/>
+
     <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"/>
-    <!-- service-resource type="model" loader="main" location="servicedef/services.xml"/-->
-
+
+    <service-resource type="model" loader="main" location="servicedef/services.xml"/>
+    
     <webapp name="projectmgr"
         title="Project"
         server="default-server"

Added: 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=597971&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (added)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Sun Nov 25 02:41:31 2007
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<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="getProject" short-description="get Project information" login-required="true">
+        <!-- get the phase seq id -->
+        <if-empty field-name="parameters.projectId">
+            <return/>
+        </if-empty>
+        <entity-one entity-name="WorkEffort" value-name="project">
+            <field-map field-name="workEffortId" env-name="parameters.projectId"/>
+        </entity-one>
+        <set field="highInfo.projectId" from-field="project.workEffortId"/>
+        <set field="highInfo.projectName" from-field="project.workEffortName"/>
+        <set field="highInfo.projectDescription" from-field="project.description"/>
+        <set field="highInfo.priority" from-field="project.priority"/>
+        <set field="highInfo.scopeEnumId" from-field="project.scopeEnumId"/>
+        <entity-one entity-name="StatusItem" value-name="highSeq">
+            <field-map field-name="statusId" env-name="phase.currentStatusId"/>
+        </entity-one>
+        <set field="highInfo.sequenceId" from-field="highSeq.sequenceId"/>
+        
+        <!-- loop through the related phases and tasks -->
+        <get-related value-name="project" relation-name="ChildWorkEffort" list-name="phases"/>
+        <iterate entry-name="phase" list-name="phases">
+            <log level="always" message="====processing phase: ${phase.workEffortName}"></log>
+            <get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks"/>
+            <iterate entry-name="lowInfo" list-name="tasks">
+                <log level="always" message="====processing task: ${lowInfo.workEffortName}"></log>
+                <call-simple-method method-name="combineInfo"/>
+            </iterate>
+        </iterate>
+        
+        <!-- translate squenceId back into statusId -->
+        <entity-and entity-name="StatusItem" list-name="statusses">
+            <field-map field-name="sequenceId" env-name="highInfo.sequenceId"/>
+            <field-map field-name="statusTypeId" value="TASK_STATUS"/>
+        </entity-and>
+        <first-from-list entry-name="status" list-name="statusses"/>
+        <clear-field field-name="highInfo.sequenceId"/>
+        <set field="highInfo.statusId" from-field="status.statusId"/>
+
+        <!-- results -->
+        <field-to-result field-name="highInfo" result-name="projectInfo"/>
+        <field-to-result field-name="parameters.projectId" result-name="projectId"/>        
+        <field-to-result field-name="parameters.phaseId" result-name="phaseIdId"/>        
+        <field-to-result field-name="parameters.taskId" result-name="taskId"/>        
+    </simple-method>
+    
+    <simple-method method-name="getProjectPhase" short-description="get Project Phase information" login-required="true">
+        <!-- get the phase seq id -->
+        <entity-one entity-name="StatusItem" value-name="highSeq">
+            <field-map field-name="statusId" env-name="phase.currentStatusId"/>
+        </entity-one>
+        <set field="highInfo.sequenceId" from-field="highSeq.sequenceId"/>
+        
+        <entity-one entity-name="WorkEffort" value-name="phase">
+            <field-map field-name="workEffortId" env-name="parameters.phaseId"/>
+        </entity-one>
+        <set field="highInfo.phaseId" from-field="phase.worEffortId"/>
+        <set field="highInfo.phaseName" from-field="phase.worEffortName"/>
+        <set field="highInfo.phaseDescription" from-field="phase.description"/>
+        <set field="highInfo.priority" from-field="phase.priority"/>
+        <set field="highInfo.scopeEnumId" from-field="phase.scopeEnumId"/>
+        
+        <!-- loop through the related tasks -->
+        <get-related value-name="phase" relation-name="ChildWorkEffort" list-name="tasks"/>
+        <iterate entry-name="lowInfo" list-name="tasks">
+            <call-simple-method method-name="combineInfo"/>
+        </iterate>
+        
+        <!-- translate squenceId back into statusId -->
+        <entity-and entity-name="StatusItem" list-name="statusses">
+            <field-map field-name="sequenceId" env-name="highInfo.sequenceId"/>
+            <field-map field-name="statusTypeId" value="TASK_STATUS"/>
+        </entity-and>
+        <first-from-list entry-name="status" list-name="statusses"/>
+        <clear-field field-name="highInfo.sequenceId"/>
+        <set field="highInfo.statusId" from-field="status.statusId"/>
+
+        <!-- results -->
+        <field-to-result field-name="highInfo" result-name="phaseInfo"/>
+        <field-to-result field-name="parameters.projectId" result-name="projectId"/>        
+        <field-to-result field-name="parameters.phaseId" result-name="phaseIdId"/>        
+        <field-to-result field-name="parameters.taskId" result-name="taskId"/>        
+    </simple-method>
+    
+    <simple-method method-name="getProjectTask" short-description="get Project task information" login-required="true">
+        <entity-one entity-name="WorkEffort" value-name="lowInfo">
+            <field-map field-name="workEffortId" env-name="parameters.taskId"/>
+        </entity-one>
+        <set field="highInfo.taskId" from-field="lowInfo.worEffortId"/>
+        <set field="highInfo.taskName" from-field="lowInfo.worEffortName"/>
+        <set field="highInfo.tasDescription" from-field="lowInfo.description"/>
+        <set field="highInfo.priority" from-field="lowInfo.priority"/>
+        <set field="highInfo.scopeEnumId" from-field="lowInfo.scopeEnumId"/>
+        <call-simple-method method-name="combineInfo"/>
+        <clear-field field-name="highInfo.sequenceId"/>
+        <set field="highInfo.statusId" from-field="lowInfo.currentStatusId"/>
+        <field-to-result field-name="highInfo"/>
+        <field-to-result field-name="parameters.projectId" result-name="projectId"/>        
+        <field-to-result field-name="parameters.phaseId" result-name="phaseIdId"/>        
+        <field-to-result field-name="parameters.taskId" result-name="taskId"/>        
+    </simple-method>
+
+    <!-- Internal functions  -->
+    <simple-method method-name="combineInfo" short-description="combine lower level status, dates of tasks.">
+        <!-- in/output highInfo infoMap -->
+        <!-- input lowInfo info map -->
+        <log level="always" message="========Lowinfo:${lowInfo} ===highInfo: ${highInfo}"></log>
+        <!-- set the dates from the lower level tasks -->
+        <if-not-empty field-name="lowInfo.estimatedStartDate">
+            <if-empty field-name="highInfo.estimatedStartDate">
+                <set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" />
+                <log level="always" message="======Setting: ${highInfo.estimatedStartDate} from ${lowInfo.estimatedStartDate}"></log>
+                <else>
+                    <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="estimatedStartDate" operator="less">
+                        <set field="highInfo.estimatedStartDate" from-field="lowInfo.estimatedStartDate" />
+                    </if-compare-field>
+                </else>
+            </if-empty>
+        </if-not-empty>
+        <if-not-empty field-name="lowInfo.estimatedCompletionDate">
+            <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">
+                        <set field="highInfo.estimatedCompletionDate" from-field="lowInfo.estimatedCompletionDate" />
+                    </if-compare-field>
+                </else>
+            </if-empty>
+        </if-not-empty>
+        <if-not-empty field-name="lowInfo.actualStartDate">
+            <if-empty field-name="highInfo.actualStartDate">
+                <set field="highInfo.actualStartDate" from-field="lowInfo.actualStartDate" />
+                <else>
+                    <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="actualStartDate" operator="greater">
+                        <set field="highInfo.actualStartDate" from-field="lowInfo.actualStartDate" />
+                    </if-compare-field>
+                </else>
+            </if-empty>
+        </if-not-empty>
+        <if-not-empty field-name="lowInfo.actualCompletionDate">
+            <if-empty field-name="highInfo.actualCompletionDate">
+                <set field="highInfo.actualCompletionDate" from-field="lowInfo.actualCompletionDate" />
+                <else>
+                    <if-compare-field map-name="highInfo" to-map-name="lowInfo" field-name="actualCompletionDate" operator="less">
+                        <set field="highInfo.actualCompletionDate" from-field="lowInfo.actualCompletionDate" />
+                    </if-compare-field>
+                </else>
+            </if-empty>
+        </if-not-empty>
+        
+        <!-- get the status from the lowerlevel tasks follow the sequence in the StatusItem entity and us the lowest-->
+        <entity-one entity-name="StatusItem" value-name="status">
+            <field-map field-name="statusId" env-name="lowInfo.currentStatusId"/>
+        </entity-one>
+        <if-empty field-name="highInfo.sequenceId">
+            <set field="highInfo.sequenceId" from-field="status.sequenceId"/>
+            <else>
+                <if-compare-field field-name="highInfo.sequenceId" operator="greater" to-field-name="status.sequenceId">
+                    <set field="highInfo.sequenceId" from-field="status.sequenceId"/>
+                </if-compare-field>
+            </else>
+        </if-empty>
+    </simple-method>
+    
+                
+</simple-methods>

Propchange: ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=597971&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (added)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Sun Nov 25 02:41:31 2007
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+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.
+-->
+
+<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/services.xsd">
+    <description>Project Manager service definitions.</description>
+
+    <service name="getProject" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="getProject">
+        <description>Get project information and realated phase and task info.</description>
+        <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="projectInfo" type="Map" mode="OUT" optional="true"/>
+    </service>
+    
+    <service name="getProjectPhase" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="getProjectPhase">
+        <description>Get project phase information and related task info.</description>
+        <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="projectPhaseId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="phaseInfo" type="Map" mode="OUT" optional="false"/>
+    </service>
+    
+    <service name="getProjectTask" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="getProjectTask">
+        <description>Get project task information and related timesheet info.</description>
+        <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="projectPhaseId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="projectTaskId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="taskInfo" type="Map" mode="OUT" optional="true"/>
+    </service>
+    
+</services>

Propchange: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml?rev=597971&r1=597970&r2=597971&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/ProjectScreens.xml Sun Nov 25 02:41:31 2007
@@ -103,16 +103,21 @@
                 <set field="tabButtonItem" value="editproject"/>                
                 <set field="labelTitleProperty" value="PageTitleEditProject"/>
                 <set field="workEffortId" from-field="parameters.workEffortIdFrom"/>
-                <entity-one entity-name="WorkEffort" value-name="project"/>
-                <script location="component://projectmgr/webapp/projectmgr/WEB-INF/actions/MilliSecToHour.bsh"/>
+                <service service-name="getProject" result-map-name="result">
+                    <field-map field-name="projectId" env-name="parameters.workEffortIdFrom"/>
+                </service>
+                <set field="project" from-field="result.projectInfo"/>
             </actions>
-            <widgets>                
+            <widgets>
+                <label text="========${project.estimatedStartDate}"></label>                
                 <decorator-screen name="CommonProjectDecorator" location="${parameters.mainDecoratorLocation}">
-                    <decorator-section name="body">                                                                              
-                        <!-- To add a new Project -->                        
-                        <platform-specific>
-                            <html><html-template location="component://projectmgr/webapp/projectmgr/project/editproject.ftl"/></html>
-                        </platform-specific>
+                    <decorator-section name="body">  
+                        <container style="screenlet">
+                            <container style="screenlet-title-bar"><label style="boxhead">${uiLabelMap.PageTitleEditProject} ${uiLabelMap.CommonInformation}</label></container>                                
+                            <container style="screenlet-body">
+                                <include-form name="EditProject" location="component://projectmgr/widget/forms/ProjectForms.xml"/>
+                            </container>
+                        </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=597971&r1=597970&r2=597971&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Sun Nov 25 02:41:31 2007
@@ -18,6 +18,42 @@
     under the License.
 -->
 <forms xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <form name="EditProject" type="single" target="updateProject" default-map-name="project">
+        <alt-target use-when="project==null" target="createProject"/>
+        <field name="workEffortIdFrom"><hidden value="${parameters.workEffortIdFrom}"/></field>
+        <field name="DONE_PAGE"><hidden value="${donePage}"/></field>
+        <field name="workEffortTypeId"><hidden value="PROJECT"/></field>
+        <field name="projectId" parameter-name="workEffortId"><hidden/></field>
+        <field name="projectName" parameter-name="workEffortName" title="${uiLabelMap.CommonName}*"><text/></field>
+        <field name="projectDescription" parameter-name="description" title="${uiLabelMap.CommonDescription}"><text/></field>
+        <field use-when="project!=null" name="statusId" title="${uiLabelMap.CommonStatus}"><display-entity entity-name="StatusItem" key-field-name="statusId"/></field>
+        <field use-when="project==null" name="statusId" parameter-name="currentStatusId"><hidden value="CAL_ACCEPTED"/></field>
+        <field name="priority" title="${uiLabelMap.CommonPriority}">
+            <drop-down allow-empty="true" current="selected">
+                <option key="1" description="1 (${uiLabelMap.WorkEffortPriorityHigh})"/>
+                <option key="2" description="2"/>
+                <option key="3" description="3"/>
+                <option key="4" description="4"/>
+                <option key="5" description="5"/>
+                <option key="6" description="6"/>
+                <option key="7" description="7"/>
+                <option key="8" description="8"/>
+                <option key="9" description="9 (${uiLabelMap.WorkEffortPriorityLow})"/>
+            </drop-down>
+        </field>
+        <field name="scopeEnumId" title="${uiLabelMap.ProjectMgrWorkEffortScopeEnumId}">
+            <drop-down allow-empty="false">
+                <entity-options entity-name="Enumeration" description="${description}" key-field-name="enumId">
+                    <entity-constraint name="enumTypeId" value="WORK_EFF_SCOPE"/>
+                </entity-options>
+            </drop-down>
+        </field>
+        <field use-when="project!=null" name="estimatedStartDate" title="${uiLabelMap.FormFieldTitle_estimatedStartDate}"><display description="${bsh:project.get(&quot;estimatedStartDate&quot;)!=null?project.get(&quot;estimatedStartDate&quot;).toString().substring(0,10):&quot;&quot;;}"/></field>
+        <field use-when="project!=null" name="estimatedCompletionDate" title="${uiLabelMap.FormFieldTitle_estimatedCompletionDate}"><display description="${bsh:project.get(&quot;estimatedCompletionDate&quot;)!=null?project.get(&quot;estimatedCompletionDate&quot;).toString().substring(0,10):&quot;&quot;;}"/></field>
+        <field use-when="project!=null" name="actualStartDate" title="${uiLabelMap.FormFieldTitle_actualStartDate}"><display description="${bsh:project.get(&quot;actualStartDate&quot;)!=null?project.get(&quot;actualStartDate&quot;).toString().substring(0,10):&quot;&quot;;}"/></field>
+        <field use-when="project!=null" name="actualCompletionDate" title="${uiLabelMap.FormFieldTitle_actualCompletionDate}"><display description="${bsh:project.get(&quot;actualCompletionDate&quot;)!=null?project.get(&quot;actualCompletionDate&quot;).toString().substring(0,10):&quot;&quot;;}"/></field>
+        <field name="save" title="${uiLabelMap.CommonSave}"><submit/></field>
+    </form>
     
  <!--================ Project Lists==============-->
     <form name="ListProjects" type="list" list-name="projects" paginate-target="FindProject">