svn commit: r605153 - in /ofbiz/trunk/specialpurpose/projectmgr: config/ data/ script/org/ofbiz/project/ servicedef/ webapp/projectmgr/WEB-INF/ 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: r605153 - in /ofbiz/trunk/specialpurpose/projectmgr: config/ data/ script/org/ofbiz/project/ servicedef/ webapp/projectmgr/WEB-INF/ widget/ widget/forms/

hansbak-2
Author: hansbak
Date: Tue Dec 18 01:32:50 2007
New Revision: 605153

URL: http://svn.apache.org/viewvc?rev=605153&view=rev
Log:
implemented a project template function from which new projects can be copied and templates can be created

Modified:
    ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties
    ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.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/controller.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
    ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml

Modified: ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties?rev=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/config/ProjectMgrUiLabels.properties Tue Dec 18 01:32:50 2007
@@ -96,6 +96,7 @@
 ProjectMgrResourceName=Resource Name
 ProjectMgrSkillStandards=Skill Standards
 ProjectMgrSkillType=Skill Type
+ProjectMgrSaveAsTemplate=Save As Template
 ProjectMgrSubProjectName=Sub Project Name
 ProjectMgrSubProjects=Sub Projects
 ProjectMgrSubTaskName=Sub Task Name

Modified: ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml?rev=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/data/ProjectMgrTypeData.xml Tue Dec 18 01:32:50 2007
@@ -27,5 +27,11 @@
     <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"/>
+    <RoleType description="Provider Test Implementer" hasTable="N" parentTypeId="PROJECT_TEAM" roleTypeId="PRVDER_TEST_IMPL"/>
+    
+    <!-- to be able to store project templates -->
+    <WorkEffortType workEffortTypeId="TEMPLATE" description="Template"/>
+    <WorkEffortType workEffortTypeId="PROJECT_TEMPLATE" parentTypeId="TEMPLATE" description="Project Template"/>
+    <WorkEffortType workEffortTypeId="PHASE_TEMPLATE" parentTypeId="TEMPLATE" description="Project Phase Template"/>
+    <WorkEffortType workEffortTypeId="TASK_TEMPLATE" parentTypeId="TEMPLATE" description="Project Task Template"/>
 </entity-engine-xml>

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=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/script/org/ofbiz/project/ProjectServices.xml Tue Dec 18 01:32:50 2007
@@ -211,6 +211,24 @@
         <field-to-result field-name="project.workEffortName" result-name="projectName"/>
     </simple-method>
     
+    <simple-method method-name="createProject" short-description="if templateId is present copy a project from a template">
+        <if-not-empty field-name="parameters.templateId">
+            <set field="parameters.projectId" from-field="parameters.templateId"/>
+            <call-simple-method method-name="copyProject"/>
+            <else>
+                <set-service-fields service-name="createWorkEffort" map-name="parameters" to-map-name="parm"/>
+                <call-service service-name="createWorkEffort" in-map-name="parm">
+                    <result-to-result result-name="workEffortId"/>
+                </call-service>
+            </else>
+        </if-not-empty>
+    </simple-method>
+    
+    <simple-method method-name="copyProjectToTemplate" short-description="copy a project to a workeffortType starting with 'template'">
+        <set field="toTemplate" value="dummy"/>
+        <call-simple-method method-name="copyProject"/>
+    </simple-method>
+    
     <simple-method method-name="copyProject" short-description="copy a project with related phases and tasks however no actual data">
         <entity-one entity-name="WorkEffort" value-name="project">
             <field-map field-name="workEffortId" env-name="parameters.projectId"/>
@@ -220,9 +238,18 @@
             <field-to-result map-name="parameters" field-name="projectId"/>
             <add-error error-list-name="error_list"><fail-message message="Project: ${parameters.projectId} not found"/></add-error>
         </if-empty>
-        
-        <set field="newProject.workEffortName" from-field="project.workEffortName"/>
-        <set field="newProject.workEffortTypeId" from-field="project.workEffortTypeId"/>
+        <if-not-empty field-name="parameters.workEffortName">
+            <set field="newProject.workEffortName" from-field="parameters.workEffortName"/>
+            <else>
+                <set field="newProject.workEffortName" from-field="project.workEffortName"/>
+            </else>
+        </if-not-empty>
+        <if-not-empty field-name="toTemplate">
+            <set field="newProject.workEffortTypeId" value="PROJECT_TEMPLATE"/>
+            <else>
+                <set field="newProject.workEffortTypeId" value="PROJECT"/>
+            </else>            
+        </if-not-empty>
         <set field="newProject.currentStatusId" value="CAL_ACCEPTED"/>            
         <call-service service-name="createWorkEffort" in-map-name="newProject">
             <result-to-field result-name="workEffortId" field-name="newProjectId"/>
@@ -242,8 +269,13 @@
         <if-not-empty field-name="phases">
             <iterate entry-name="phase" list-name="phases">
                 <clear-field field-name="newPhase"/>
+                <if-not-empty field-name="toTemplate">
+                    <set field="newPhase.workEffortTypeId" value="PHASE_TEMPLATE"/>
+                    <else>
+                        <set field="newPhase.workEffortTypeId" value="PHASE"/>
+                    </else>            
+                </if-not-empty>
                 <set field="newPhase.workEffortName" from-field="phase.workEffortName"/>
-                <set field="newPhase.workEffortTypeId" from-field="phase.workEffortTypeId"/>
                 <set field="newPhase.workEffortParentId" from-field="newProjectId"/>
                 <set field="newPhase.currentStatusId" value="CAL_ACCEPTED"/>            
                 <call-service service-name="createWorkEffort" in-map-name="newPhase">
@@ -254,8 +286,13 @@
                 <if-not-empty field-name="tasks">
                     <iterate entry-name="task" list-name="tasks">
                         <clear-field field-name="newTask"/>
+                        <if-not-empty field-name="toTemplate">
+                            <set field="newTask.workEffortTypeId" value="TASK_TEMPLATE"/>
+                            <else>
+                                <set field="newTask.workEffortTypeId" value="TASK"/>
+                            </else>            
+                        </if-not-empty>
                         <set field="newTask.workEffortName" from-field="task.workEffortName"/>
-                        <set field="newTask.workEffortTypeId" from-field="task.workEffortTypeId"/>
                         <set field="newTask.priority" from-field="task.priority"/>
                         <set field="newTask.workEffortParentId" from-field="newPhaseId"/>
                         <set field="newTask.currentStatusId" value="CAL_ACCEPTED"/>            

Modified: ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml?rev=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/servicedef/services.xml Tue Dec 18 01:32:50 2007
@@ -42,10 +42,33 @@
         <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
         <attribute name="projectInfo" type="java.util.Map" mode="OUT" optional="true"/>
     </service>
-
+    
+    <service name="createProject" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="createProject">
+        <description>Copy a project planning from a template.</description>
+        <permission-service service-name="workEffortGenericPermission" main-action="CREATE"/>
+        <implements service="interfaceWorkEffort"/>        
+        <auto-attributes mode="INOUT" include="pk" optional="true"/>
+        <attribute name="projectId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="workEffortId" type="String" mode="INOUT" optional="true"/>
+        <attribute name="templateId" type="String" mode="IN" optional="true"/>
+        <attribute name="quickAssignPartyId" type="String" mode="IN" optional="true"/>
+        <attribute name="requirementId" type="String" mode="IN" optional="true"/>
+        <attribute name="communicationEventId" type="String" mode="IN" optional="true"/>
+        <override name="workEffortTypeId" optional="false"/>
+        <override name="workEffortName" optional="false"/>
+        <override name="currentStatusId" optional="false"/>
+    </service>
+    
     <service name="copyProject" engine="simple"
         location="org/ofbiz/project/ProjectServices.xml" invoke="copyProject">
         <description>Copy a project planning data but ignore the actual data.</description>
+        <attribute name="projectId" type="String" mode="INOUT" optional="false"/>
+    </service>
+    
+    <service name="copyProjectToTemplate" engine="simple"
+        location="org/ofbiz/project/ProjectServices.xml" invoke="copyProjectToTemplate">
+        <description>Copy a project planning data to a template project.</description>
         <attribute name="projectId" type="String" mode="INOUT" optional="false"/>
     </service>
     

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=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/webapp/projectmgr/WEB-INF/controller.xml Tue Dec 18 01:32:50 2007
@@ -57,19 +57,25 @@
     </request-map>
     <request-map uri="createProject">
         <security https="true" auth="true"/>
-        <event type="service" invoke="createWorkEffort"/>
-        <response name="success" type="request-redirect" value="EditProject"/>
+        <event type="service" invoke="createProject"/>
+        <response name="success" type="request-redirect" value="projectView"/>
         <response name="error" type="view" value="EditProject"/>
     </request-map>
     <request-map uri="updateProject">
         <security https="true" auth="true"/>
         <event type="service" invoke="updateWorkEffort"/>
-        <response name="success" type="view" value="EditProject"/>
+        <response name="success" type="view" value="projectView"/>
         <response name="error" type="view" value="EditProject"/>
     </request-map>
     <request-map uri="copyProject">
         <security https="true" auth="true"/>
         <event type="service" invoke="copyProject"/>
+        <response name="success" type="view" value="projectView"/>
+        <response name="error" type="view" value="projectView"/>
+    </request-map>
+    <request-map uri="copyProjectToTemplate">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="copyProjectToTemplate"/>
         <response name="success" type="view" value="projectView"/>
         <response name="error" type="view" value="projectView"/>
     </request-map>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml?rev=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/Menus.xml Tue Dec 18 01:32:50 2007
@@ -85,6 +85,14 @@
             </condition>
             <link target="scheduleProject?projectId=${projectId}"></link>
         </menu-item>
+        <menu-item name="copyProjectToTemplate" title="${uiLabelMap.ProjectMgrSaveAsTemplate}">
+            <condition>
+                <not>
+                    <if-empty field-name="project"/>
+                </not>
+            </condition>
+            <link target="copyProjectToTemplate?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>

Modified: ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml?rev=605153&r1=605152&r2=605153&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml (original)
+++ ofbiz/trunk/specialpurpose/projectmgr/widget/forms/ProjectForms.xml Tue Dec 18 01:32:50 2007
@@ -21,6 +21,13 @@
     xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-form.xsd">
     <form name="EditProject" type="single" target="updateProject" default-map-name="project">
         <alt-target use-when="project==null" target="createProject"/>
+        <field use-when="project==null" name="templateId">
+            <drop-down allow-empty="true">
+                <entity-options entity-name="WorkEffort" description="${workEffortName}" key-field-name="workEffortId">
+                    <entity-constraint name="workEffortTypeId" value="PROJECT_TEMPLATE"/>
+                </entity-options>        
+            </drop-down>
+        </field>
         <field name="workEffortTypeId"><hidden value="PROJECT"/></field>
         <field name="projectId"><hidden/></field>
         <field name="workEffortId"><hidden value="${projectId}"/></field>