← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2090: Replaced orgunit filter with orgunit tree in report params screen

 

------------------------------------------------------------
revno: 2090
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-07-05 23:54:20 +0200
message:
  Replaced orgunit filter with orgunit tree in report params screen
removed:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportParams.js
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js


--
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-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2010-07-04 23:55:46 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml	2010-07-05 21:54:20 +0000
@@ -205,7 +205,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <param name="page">/dhis-web-reporting/inputReportParamsForm.vm</param>
       <param name="menu">/dhis-web-reporting/menu.vm</param>
-      <param name="javascripts">javascript/report.js,javascript/table.js,javascript/reportParams.js</param>
+      <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/report.js,javascript/table.js</param>
       <param name="requiredAuthorities">F_REPORT_VIEW</param>
     </action>
     

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm	2009-03-24 10:31:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/inputReportParamsForm.vm	2010-07-05 21:54:20 +0000
@@ -41,7 +41,7 @@
     </tr>
     <tr>
         <td>
-            <select id="reportingPeriod" name="reportingPeriod" style="min-width:325px">               
+            <select id="reportingPeriod" name="reportingPeriod" style="width:325px">               
                 #foreach ( $key in $reportingPeriods.keySet() )
                     <option value="$key">$reportingPeriods.get( $key )</option>
                 #end
@@ -61,25 +61,15 @@
     <tr>
         <th>$i18n.getString( "parent_organisationunit" )</th>
     </tr>
-    <tr>
-        <td>
-        	<select id="organisationUnitLevelParent" style="min-width:325px" onchange="getOrganisationUnitsParent()">
-        		<option value="-1">[ $i18n.getString( "select_organisation_unit_level" ) ]</option>
-        		#foreach( $level in $levels )
-        			<option value="$level.level">$level.name</option>
-		        #end
-	        </select>
-        </td>
-	</tr>
-	<tr>
-		<td>
-			<select id="parentOrganisationUnitId" name="parentOrganisationUnitId" style="min-width:325px">
-				#foreach( $unit in $organisationUnits )
-					<option value="$unit.id">$unit.name</option>
-				#end
-			</select>
-		</td>
-	</tr>
+    <td>
+		<div id="selectionTree" style="width:325px; height:270px"></div>	            
+		<script type="text/javascript">
+			selectionTreeSelection.setMultipleSelectionAllowed( false );
+			selectionTreeSelection.setListenerFunction( paramParentOrganisationUnitSet );
+			selectionTree.clearSelectedOrganisationUnits();
+		    selectionTree.buildSelectionTree();
+		</script>
+    </td>
     <tr>
         <td colspan="4" style="height:10px"></td>
     </tr>
@@ -93,25 +83,15 @@
 	<tr>
         <th>$i18n.getString( "organisation_unit" )</th>
     </tr>
-	<tr>
-        <td>
-            <select id="organisationUnitLevelSingle" style="min-width:325px" onchange="getOrganisationUnitsSingle()">
-                <option value="-1">[ $i18n.getString( "select_organisation_unit_level" ) ]</option>
-                #foreach( $level in $levels )
-                    <option value="$level.level">$level.name</option>
-                #end
-            </select>
-        </td>
-    </tr>
-    <tr>
-        <td>
-            <select id="organisationUnitId" name="organisationUnitId" style="min-width:325px">
-                #foreach( $unit in $organisationUnits )
-                    <option value="$unit.id">$unit.name</option>
-                #end
-            </select>
-        </td>
-    </tr>
+    <td>
+		<div id="selectionTree" style="width:325px; height:270px"></div>	            
+		<script type="text/javascript">
+			selectionTreeSelection.setMultipleSelectionAllowed( false );
+			selectionTreeSelection.setListenerFunction( paramOrganisationUnitSet );
+			selectionTree.clearSelectedOrganisationUnits();
+		    selectionTree.buildSelectionTree();
+		</script>
+    </td>
     <tr>
         <td colspan="4" style="height:10px"></td>
     </tr>

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2010-02-10 19:12:22 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2010-07-05 21:54:20 +0000
@@ -1,4 +1,17 @@
 
+var paramParentOrganisationUnit = null;
+var paramOrganisationUnit = null;
+
+function paramParentOrganisationUnitSet( id )
+{
+	paramParentOrganisationUnit = id;
+}
+
+function paramOrganisationUnitSet( id )
+{
+	paramOrganisationUnit = id;
+}
+
 var tempUrl = null;
 
 function runAndViewReport( reportId, reportUrl )
@@ -10,14 +23,14 @@
         url += "&reportingPeriod=" + getListValue( "reportingPeriod" );
     }
     
-    if ( document.getElementById( "parentOrganisationUnitId" ) != null )
+    if ( paramParentOrganisationUnit != null )
     {
-        url += "&parentOrganisationUnitId=" + getListValue( "parentOrganisationUnitId" );
+        url += "&parentOrganisationUnitId=" + paramParentOrganisationUnit;
     }
     
-    if ( document.getElementById( "organisationUnitId" ) != null )
+    if ( paramOrganisationUnit != null )
     {
-        url += "&organisationUnitId=" + getListValue( "organisationUnitId" );
+        url += "&organisationUnitId=" + paramOrganisationUnit;
     }
     
 	tempUrl = reportUrl;

=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportParams.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportParams.js	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportParams.js	1970-01-01 00:00:00 +0000
@@ -1,74 +0,0 @@
-
-// -----------------------------------------------------------------------------
-// Report params
-// -----------------------------------------------------------------------------
-
-function getOrganisationUnitsParent()
-{
-    var organisationUnitLevel = getListValue( "organisationUnitLevelParent" );
-    
-    if ( organisationUnitLevel != null )
-    {
-        var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
-        
-        var request = new Request();
-        request.setResponseTypeXML( 'organisationUnit' );
-        request.setCallbackSuccess( getOrganisationUnitsParentReceived );
-        request.send( url );        
-    }
-}
-
-function getOrganisationUnitsParentReceived( xmlObject )
-{   
-    var availableOrganisationUnits = document.getElementById( "parentOrganisationUnitId" );
-    
-    clearList( availableOrganisationUnits );
-    
-    var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-    
-    for ( var i = 0; i < organisationUnits.length; i++ )
-    {
-        var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
-        var option = document.createElement( "option" );
-        option.value = id;
-        option.text = organisationUnitName;
-        availableOrganisationUnits.add( option, null );
-    }
-}
-
-function getOrganisationUnitsSingle()
-{
-    var organisationUnitLevel = getListValue( "organisationUnitLevelSingle" );
-    
-    if ( organisationUnitLevel != null )
-    {
-        var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
-        
-        var request = new Request();
-        request.setResponseTypeXML( 'organisationUnit' );
-        request.setCallbackSuccess( getOrganisationUnitsSingleReceived );
-        request.send( url );        
-    }
-}
-
-function getOrganisationUnitsSingleReceived( xmlObject )
-{   
-    var availableOrganisationUnits = document.getElementById( "organisationUnitId" );
-    
-    clearList( availableOrganisationUnits );
-    
-    var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-    
-    for ( var i = 0; i < organisationUnits.length; i++ )
-    {
-        var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
-        var option = document.createElement( "option" );
-        option.value = id;
-        option.text = organisationUnitName;
-        availableOrganisationUnits.add( option, null );
-    }
-}

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2010-07-05 21:00:54 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2010-07-05 21:54:20 +0000
@@ -1,4 +1,17 @@
 
+var paramParentOrganisationUnit = null;
+var paramOrganisationUnit = null;
+
+function paramParentOrganisationUnitSet( id )
+{
+	paramParentOrganisationUnit = id;
+}
+
+function paramOrganisationUnitSet( id )
+{
+	paramOrganisationUnit = id;
+}
+
 // -----------------------------------------------------------------------------
 // Create ReportTable
 // -----------------------------------------------------------------------------
@@ -12,14 +25,14 @@
         url += "&reportingPeriod=" + getListValue( "reportingPeriod" );
     }
     
-    if ( document.getElementById( "parentOrganisationUnitId" ) != null )
+    if ( paramParentOrganisationUnit != null )
     {
-        url += "&parentOrganisationUnitId=" + getListValue( "parentOrganisationUnitId" );
+        url += "&parentOrganisationUnitId=" + paramParentOrganisationUnit;
     }
     
-    if ( document.getElementById( "organisationUnitId" ) != null )
+    if ( paramOrganisationUnit != null )
     {
-        url += "&organisationUnitId=" + getListValue( "organisationUnitId" );
+        url += "&organisationUnitId=" + paramOrganisationUnit;
     }
     
     var request = new Request();