← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3585: Case entry - Visit plan - Combined VisitPlanSelectAction.java and VisitPlanAction.java into one.

 

------------------------------------------------------------
revno: 3585
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-12 15:32:03 +0700
message:
  Case entry - Visit plan - Combined VisitPlanSelectAction.java and VisitPlanAction.java into one.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanSelectAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlanSelect.vm
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanAction.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlan.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanAction.java	2011-05-12 07:02:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanAction.java	2011-05-12 08:32:03 +0000
@@ -28,7 +28,10 @@
 package org.hisp.dhis.caseentry.action.visitplan;
 
 import java.util.Collection;
+import java.util.HashSet;
 
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
 import org.hisp.dhis.patient.PatientAttribute;
 import org.hisp.dhis.patient.PatientAttributeService;
 
@@ -47,6 +50,13 @@
     // Dependencies
     // -------------------------------------------------------------------------
 
+    private OrganisationUnitSelectionManager selectionManager;
+
+    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+    {
+        this.selectionManager = selectionManager;
+    }
+
     private PatientAttributeService patientAttributeService;
 
     public void setPatientAttributeService( PatientAttributeService patientAttributeService )
@@ -58,13 +68,20 @@
     // Output
     // -------------------------------------------------------------------------
 
-    private Collection<PatientAttribute> attributes;
+    private Collection<PatientAttribute> attributes = new HashSet<PatientAttribute>();
 
     public Collection<PatientAttribute> getAttributes()
     {
         return attributes;
     }
 
+    private OrganisationUnit organisationUnit;
+
+    public OrganisationUnit getOrganisationUnit()
+    {
+        return organisationUnit;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -72,9 +89,12 @@
     public String execute()
         throws Exception
     {
-        // ---------------------------------------------------------------------
-        // Make attributes available so that users can sort based on attributes
-        // ---------------------------------------------------------------------
+        organisationUnit = selectionManager.getSelectedOrganisationUnit();
+
+        if ( organisationUnit == null )
+        {
+            return SUCCESS;
+        }
 
         attributes = patientAttributeService.getAllPatientAttributes();
 

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanSelectAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanSelectAction.java	2011-03-31 01:49:21 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/visitplan/VisitPlanSelectAction.java	1970-01-01 00:00:00 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2004-2009, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-package org.hisp.dhis.caseentry.action.visitplan;
-
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Abyot Asalefew Gizaw
- * @version $Id$
- */
-public class VisitPlanSelectAction
-    implements Action
-{
-    private static final String VISIT_PLAN = "visitplan";
-
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitSelectionManager selectionManager;
-
-    public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
-    {
-        this.selectionManager = selectionManager;
-    }
-
-    // -------------------------------------------------------------------------
-    // Input/output
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnit organisationUnit;
-
-    public OrganisationUnit getOrganisationUnit()
-    {
-        return organisationUnit;
-    }
-
-    // -------------------------------------------------------------------------
-    // Action implementation
-    // -------------------------------------------------------------------------
-
-    public String execute()
-        throws Exception
-    {
-        organisationUnit = selectionManager.getSelectedOrganisationUnit();
-
-        if ( organisationUnit == null )
-        {
-            return SUCCESS;
-        }
-
-        return VISIT_PLAN;
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-05-12 07:02:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml	2011-05-12 08:32:03 +0000
@@ -228,17 +228,12 @@
 	</bean>
 
 	<!-- Visit Plan -->
-
-	<bean id="org.hisp.dhis.caseentry.action.visitplan.VisitPlanSelectAction"
-		class="org.hisp.dhis.caseentry.action.visitplan.VisitPlanSelectAction"
-		scope="prototype">
-		<property name="selectionManager"
-			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
-	</bean>
-
+	
 	<bean id="org.hisp.dhis.caseentry.action.visitplan.VisitPlanAction"
 		class="org.hisp.dhis.caseentry.action.visitplan.VisitPlanAction"
 		scope="prototype">
+		<property name="selectionManager"
+			ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
 		<property name="patientAttributeService"
 			ref="org.hisp.dhis.patient.PatientAttributeService" />
 	</bean>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-05-12 07:02:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2011-05-12 08:32:03 +0000
@@ -138,16 +138,7 @@
         <result name="success" type="redirect">getDataRecords.action?programId=${programId}</result>
     </action>
 	    
-    <!-- Visit Plan -->
-    
-    <action name="visitPlanSelect" class="org.hisp.dhis.caseentry.action.visitplan.VisitPlanSelectAction">
-      <interceptor-ref name="organisationUnitTreeStack"/>
-      <result name="visitplan" type="chain">visitplan</result>
-      <result name="success" type="velocity">/main.vm</result>
-      <param name="page">/dhis-web-caseentry/visitPlanSelect.vm</param>
-      <param name="menu">/dhis-web-caseentry/reportsMenu.vm</param>      
-      <param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/visitPlan.js</param>      
-    </action>   
+    <!-- Visit Plan -->  
     
     <action name="visitplan" class="org.hisp.dhis.caseentry.action.visitplan.VisitPlanAction">
       <interceptor-ref name="organisationUnitTreeStack"/>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm	2011-04-06 06:44:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/index.vm	2011-05-12 08:32:03 +0000
@@ -5,6 +5,6 @@
     #introListImgItem( "dataEntrySelect.action" "data_entry" "dataentry" )
 	#introListImgItem( "multipledataEntrySelect.action" "multiple_dataentry" "dataentry" )
     #introListImgItem( "reportSelect.action" "summary_report" "summaryreport" )
-    #introListImgItem( "visitPlanSelect.action" "visit_plan" "visitplan" )
+    #introListImgItem( "visitplan.action" "visit_plan" "visitplan" )
     #introListImgItem( "caseAggregationForm.action" "case_aggregation" "caseaggregation" )
 </ul>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js	2011-05-12 07:02:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/visitPlan.js	2011-05-12 08:32:03 +0000
@@ -3,7 +3,7 @@
 
 function organisationUnitSelected( orgUnits )
 {
-    window.location.href = 'visitPlanSelect.action';
+    window.location.href = 'visitplan.action';
 }
 
 selection.setListenerFunction( organisationUnitSelected );

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2010-08-05 12:25:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/menu.vm	2011-05-12 08:32:03 +0000
@@ -8,7 +8,7 @@
 <h2>$i18n.getString( "reports" )&nbsp;</h2>
 <ul>
     <li><a href="reportSelect.action">$i18n.getString( "summary_report" )&nbsp;</a></li>     
-    <li><a href="visitPlanSelect.action">$i18n.getString( "visit_plan" )&nbsp;</a></li>    
+    <li><a href="visitplan.action">$i18n.getString( "visit_plan" )&nbsp;</a></li>    
 </ul>
 
 <h2>$i18n.getString( "case_aggregation" )&nbsp;</h2>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlan.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlan.vm	2011-05-12 07:02:28 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlan.vm	2011-05-12 08:32:03 +0000
@@ -10,7 +10,7 @@
     <tr>
         <td>$i18n.getString( "sort_by" )</td>
         <td>
-            <select id="sortingAttributeId" name="sortingAttributeId" style="min-width:350px"  onchange="sortByAttribute( this.options[this.selectedIndex].value )" #if( $attributes.size() == 0 ) disabled="disabled" #end>
+            <select id="sortingAttributeId" name="sortingAttributeId" style="min-width:350px"  onchange="sortByAttribute( this.options[this.selectedIndex].value )" #if( $attributes && $attributes.size() == 0 ) disabled="disabled" #end>
 				<option value="-1">[ $i18n.getString( "select_sorting_attribute" ) ]</option>
                 #foreach( $attribute in $attributes )
                     <option value="$attribute.id" #if( $sortingAttribute && $attribute.id == $sortingAttribute.id ) selected="selected" #end>$encoder.htmlEncode( $attribute.name )</option>
@@ -21,7 +21,5 @@
 </table>
 
 <hr style="clear:both">
-    
-<div id="contentDiv">
-	#parse ( "/dhis-web-caseentry/loadVisitPlan.vm" )
-</div>
\ No newline at end of file
+
+<div id="contentDiv"></div>
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlanSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlanSelect.vm	2011-03-24 17:27:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/visitPlanSelect.vm	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<h3>$i18n.getString( "visit_plan" )</h3>
-
-<table>
-	<tr>
-		<td><label>$i18n.getString( "registering_unit" )</label></td>
-		<td>
-			<input type="text" readonly="readonly" #if( $organisationUnit ) value="$encoder.htmlEncode( $organisationUnit.name )" #else value="[$i18n.getString( "select" )]" #end style="min-width:350px">
-		</td>
-	</tr>
-</table>
-
-<hr style="clear:both">