← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 22: and function Indicator Group Editor in dhis-web-maintenance-datadictionary

 

------------------------------------------------------------
revno: 22
committer: TranThanhTri tranthanhtri84@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-03-10 10:06:07 +0530
message:
  and function Indicator Group Editor in dhis-web-maintenance-datadictionary
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/xwork.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu/MainMenu.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2009-03-09 08:28:19 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/util/commons.js	2009-03-10 04:36:07 +0000
@@ -345,7 +345,7 @@
 /**
  * Show div at center of screen.
  */
-function showDivCenter( id )
+function setPositionCenter( id )
 {
 	var div = document.getElementById(id);
 	
@@ -354,8 +354,6 @@
 	
 	var x = (document.documentElement.clientHeight / 2) - new Number(height.replace('px',''))/2;
 	var y = (document.documentElement.clientWidth / 2) - new Number(width.replace('px',''))/2;	
-	
-	div.style.display = 'block';
 	div.style.top = x +"px";
 	div.style.left  = y +"px";		
 }
@@ -391,8 +389,8 @@
 	divEffect.style.height = height + "px";
 	divEffect.style.background = "#000000";
 	divEffect.style.opacity = 0.5;
-	divEffect.style.zIndex = 100000000;
-	divEffect.innerHTML = "<div style='background-color:#EFEFEF;position:absolute;top:300px;width:100%;text-align:center'><img src=\"../images/ajax-loader.gif\"/></div>";	
+	divEffect.style.zIndex = 100;
+	//divEffect.innerHTML = "<div style='background-color:#EFEFEF;position:absolute;top:300px;width:100%;text-align:center'><img src=\"../images/ajax-loader.gif\"/></div>";	
 	document.body.appendChild( divEffect );	
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/UpdateDataElementGroupAction.java	2009-03-10 04:36:07 +0000
@@ -88,6 +88,15 @@
     {
         this.selectedDataElements = selectedDataElements;
     }
+    
+    private String mode;
+
+    public void setMode( String mode )
+    {
+        this.mode = mode;
+    }
+    
+    
 
     // -------------------------------------------------------------------------
     // Output
@@ -108,16 +117,27 @@
         throws Exception
     {
         dataElementGroup = dataElementService.getDataElementGroup( id );
-
-        if ( name != null )
-        {
-            if ( name.trim().length() > 0 )
-            {
-                dataElementGroup.setName( CodecUtils.unescape( name ) );
+        
+        if(mode!=null){
+            if(mode.equalsIgnoreCase( "editor" )){
+             
+                if ( name != null )
+                {
+                    if ( name.trim().length() > 0 )
+                    {
+                        dataElementGroup.setName( CodecUtils.unescape( name ) );
+                    }
+                }
+                
+            }else{
+                dataElementGroup.setName( name );
             }
-
+        }else{
+            dataElementGroup.setName( name ); 
         }
 
+        
+
         Set<DataElement> members = new HashSet<DataElement>();
 
         if ( groupMembers != null )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/AddIndicatorGroupAction.java	2009-03-10 04:36:07 +0000
@@ -34,12 +34,14 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.system.util.CodecUtils;
 
 import com.opensymphony.xwork.ActionSupport;
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: AddIndicatorGroupAction.java 3305 2007-05-14 18:55:52Z larshelg $
+ * @version $Id: AddIndicatorGroupAction.java 3305 2007-05-14 18:55:52Z larshelg
+ *          $
  */
 public class AddIndicatorGroupAction
     extends ActionSupport
@@ -54,7 +56,7 @@
     {
         this.indicatorService = indicatorService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -73,13 +75,41 @@
         this.groupMembers = groupMembers;
     }
 
+    private String mode;
+
+    public void setMode( String mode )
+    {
+        this.mode = mode;
+    }
+    
+    private IndicatorGroup indicatorGroup;
+    
+    public IndicatorGroup getIndicatorGroup()
+    {
+        return indicatorGroup;
+    }
+    
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public String execute() throws Exception
+
+
+    public String execute()
+        throws Exception
     {
-        IndicatorGroup indicatorGroup = new IndicatorGroup( name );
+        indicatorGroup = new IndicatorGroup( name );
+        
+        if ( mode != null )
+        {
+            if ( mode.equalsIgnoreCase( "editor" ) )
+            {
+
+                indicatorGroup.setName( CodecUtils.unescape( name ) );
+
+            }
+        }
         
         Set<Indicator> members = new HashSet<Indicator>();
 
@@ -88,14 +118,14 @@
             for ( String id : groupMembers )
             {
                 Indicator indicator = indicatorService.getIndicator( Integer.parseInt( id ) );
-                
+
                 members.add( indicator );
             }
         }
-        
+
         indicatorGroup.setMembers( members );
-        
-        indicatorService.addIndicatorGroup( indicatorGroup );        
+
+        indicatorService.addIndicatorGroup( indicatorGroup );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/UpdateIndicatorGroupAction.java	2009-03-10 04:36:07 +0000
@@ -34,12 +34,14 @@
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorGroup;
 import org.hisp.dhis.indicator.IndicatorService;
+import org.hisp.dhis.system.util.CodecUtils;
 
 import com.opensymphony.xwork.ActionSupport;
 
 /**
  * @author Torgeir Lorange Ostby
- * @version $Id: UpdateIndicatorGroupAction.java 3305 2007-05-14 18:55:52Z larshelg $
+ * @version $Id: UpdateIndicatorGroupAction.java 3305 2007-05-14 18:55:52Z
+ *          larshelg $
  */
 public class UpdateIndicatorGroupAction
     extends ActionSupport
@@ -54,7 +56,7 @@
     {
         this.indicatorService = indicatorService;
     }
-    
+
     // -------------------------------------------------------------------------
     // Input
     // -------------------------------------------------------------------------
@@ -73,6 +75,10 @@
         this.name = name;
     }
 
+    /*
+     * This property use when using submit
+     */
+
     private Collection<String> groupMembers;
 
     public void setGroupMembers( Collection<String> groupMembers )
@@ -80,29 +86,95 @@
         this.groupMembers = groupMembers;
     }
 
+    /*
+     * This property use when using ajax
+     */
+
+    private String selectedIndicators[] = new String[0];
+
+    public void setSelectedIndicators( String[] selectedIndicators )
+    {
+        this.selectedIndicators = selectedIndicators;
+    }
+
+    /*
+     * This property is mode of user interface (normal or editor)
+     */
+
+    private String mode;
+
+    public void setMode( String mode )
+    {
+        this.mode = mode;
+    }
+
+    private IndicatorGroup indicatorGroup;
+
+    public IndicatorGroup getIndicatorGroup()
+    {
+        return indicatorGroup;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
-    public String execute() throws Exception
+    public String execute()
+        throws Exception
     {
-        IndicatorGroup indicatorGroup = indicatorService.getIndicatorGroup( id );
+        indicatorGroup = indicatorService.getIndicatorGroup( id );
+
+        if ( mode != null )
+        {
+            if ( mode.equalsIgnoreCase( "editor" ) )
+            {
+                if(name!=null){
+                    if(name.length() > 0){
+                        indicatorGroup.setName( CodecUtils.unescape( name ) );
+                    }
+                }                
+
+            }
+            else
+            {
+                indicatorGroup.setName( name );
+            }
+        }
+        else
+        {
+
+            indicatorGroup.setName( name );
+
+        }
 
         Set<Indicator> members = new HashSet<Indicator>();
-        
+
         if ( groupMembers != null )
         {
             for ( String memberId : groupMembers )
             {
-                members.add( indicatorService.getIndicator( Integer.parseInt( memberId ) ) );            
-            }
-        }
-        
-        indicatorGroup.setName( name );
+                members.add( indicatorService.getIndicator( Integer.parseInt( memberId ) ) );
+            }
+        }
+
+        if ( selectedIndicators != null )
+        {
+            if ( selectedIndicators.length > 0 )
+            {
+                for ( int i = 0; i < selectedIndicators.length; i++ )
+                {
+                    Indicator indicator = indicatorService.getIndicator( Integer.parseInt( selectedIndicators[i] ) );
+                    members.add( indicator );                   
+                }
+
+            }
+
+        }
+
         indicatorGroup.setMembers( members );
-        
+
         indicatorService.updateIndicatorGroup( indicatorGroup );
-        
+
         return SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties	2009-03-10 04:36:07 +0000
@@ -332,3 +332,7 @@
 numerator_aggregation_operator					= Numerator aggregation operator
 denominator_aggregation_operator				= Denominator aggregation operator
 forum											= Forum
+indicator_group_editor 							= Indicator Group Editor
+select_indicator_group							= Please select indicator group !
+confirm_delete_indicator_group					= Do you want delete this indicator ?
+update_indicator_group_member					= Update Indicator Member
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/xwork.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/xwork.xml	2009-03-08 06:36:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/xwork.xml	2009-03-10 04:36:07 +0000
@@ -223,6 +223,53 @@
       <interceptor-ref name="transactionStack"/>
     </action>
     
+    <!-- Indicator Group Editor -->
+    
+    <action name="indicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicator.GetIndicatorListAction">
+      <result name="success" type="velocity">/main.vm</result>
+	  <param name="page">/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm</param>
+	  <param name="menu">/dhis-web-maintenance-datadictionary/menu/MainMenu.vm</param>
+	  <param name="javascripts">javascript/indicatorGroupEditor.js</param>
+	  <param name="stylesheets">style/indicatorGroupEditor.css</param>
+	  <interceptor-ref name="transactionStack"/>
+    </action>
+    
+    <action name="getIndicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicatorgroup.GetIndicatorGroupAction">
+	  <result name="success" type="velocity-xml">/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm</result>
+	  <interceptor-ref name="transactionStack"/>
+    </action>
+    
+    <action name="addIndicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicatorgroup.AddIndicatorGroupAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm</result>	  
+      <interceptor-ref name="transactionStack"/>
+	  <param name="requiredAuthorities">F_INDICATORGROUP_ADD</param>
+    </action>
+    
+    <action name="renameIndicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicatorgroup.UpdateIndicatorGroupAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm</result>	  
+      <interceptor-ref name="transactionStack"/>
+	  <param name="requiredAuthorities">F_INDICATORGROUP_UPDATE</param>
+    </action>
+	
+	<action name="deleteIndicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicatorgroup.RemoveIndicatorGroupAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-datadictionary/responseSuccess.vm</result>
+      <interceptor-ref name="transactionStack"/>
+	  <param name="requiredAuthorities">F_INDICATORGROUP_DELETE</param>
+    </action>
+	
+	<action name="updateIndicatorGroupEditor"
+      class="org.hisp.dhis.dd.action.indicatorgroup.UpdateIndicatorGroupAction">
+      <result name="success" type="velocity-xml">/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm</result>	 
+      <interceptor-ref name="transactionStack"/>
+	  <param name="requiredAuthorities">F_INDICATORGROUP_UPDATE</param>
+    </action>
+      
+    
     <!-- IndicatorGroup -->
     
     <action name="indicatorGroup"

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/indicatorGroupEditor.vm	2009-03-10 04:36:07 +0000
@@ -0,0 +1,110 @@
+<style type="text/css">
+
+.select 
+{
+	border:#666666 thin solid;
+	min-width:300px;
+	size:30;
+}
+
+</style>
+
+<h3>$i18n.getString( "indicator_group_editor" )</h3>
+
+<span id='message' style="position:fixed;top:80px;right:5px;"></span>
+
+<table >	
+	<tr>
+		<th>$i18n.getString( "indicator_group" )</th>
+		<th><span id="groupNameView" style="display:block;"></span></th>		
+		<td></td>
+		<th>$i18n.getString( "available_indicators" )</th>
+		
+	</tr>
+	
+	<tr>
+		<td><input id="indicatorGroupsFilter" type="text" style="width:300px;" onkeyup="filterIndicatorGroups();"></td>
+		<td><input id="selecteIndicatorsFilter" type="text" style="width:300px;" onkeyup="filterSelectedIndicators();"></td>
+		<td></td>
+		<td><input id="availableIndicatorsFilter" type="text" style="width:300px;" onkeyup="filterAvailableIndicators();"></td>
+	</tr>
+
+	<tr>
+		<td>
+			<select class="select" id="indicatorGroups" size="30" onchange="getIndicatorGroup( this );">				
+			</select>
+		</td>
+		<td>
+			<select class="select" id="selectedIndicators" multiple="multiple" size="30"  ondblclick="removeSelectedIndicators();">
+			</select>
+		</td>
+		
+		<td>
+			<input type="button" value="&lt;" onclick="addSelectedIndicators();" style="width:30px"><br><br>
+			<input type="button" value="&gt;" onclick="removeSelectedIndicators();" style="width:30px">
+		</td>
+		<td>
+			<select class="select" id="availableIndicators" multiple="multiple" size="30"  ondblclick="addSelectedIndicators();" disabled="true">				
+			</select>
+		</td>
+	</tr>
+	<tr>
+		<td>			
+			<a href="javascript:sortList( 'indicatorGroups', 'ASC' );"><img align="absmiddle" src="images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>
+			<a href="javascript:sortList( 'indicatorGroups', 'DES' );"><img align="absmiddle" src="images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>			
+			<input type="button" value="$i18n.getString( 'new' )" onclick="javascript:showAddIndicatorGroupForm()" style="width:70px"><input 
+			       type="button" value="$i18n.getString( 'rename' )" onclick="javascript:showRenameIndicatorGroupForm()" style="width:70px"><input 
+			       type="button" value="$i18n.getString( 'delete' )" onclick="javascript:deleteIndicatorGroup()" style="width:70px">
+		</td>
+		<td>
+			<a href="javascript:sortList( 'selectedIndicatoss', 'ASC' );"><img align="absmiddle" src="images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>
+			<a href="javascript:sortList( 'selectedIndicatoss', 'DES' );"><img align="absmiddle" src="images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>			
+			<input type="button" value="$i18n.getString( 'update_indicator_group_member' )" onclick="javascript:updateIndicatorGroupMembers()">
+		</td>
+		<td></td>
+		<td>
+			<a href="javascript:sortList( 'availableIndicators', 'ASC' );"><img align="absmiddle" src="images/sort_ascending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>
+			<a href="javascript:sortList( 'availableIndicators', 'DES' );"><img align="absmiddle" src="images/sort_descending.png" style="border:#666666 thin solid;cursor:pointer;width:20px;"></a>			
+		</td>
+		
+		
+	</tr>
+</table>
+
+<div id="addIndicatorGroupForm" style="position:fixed;background-color:#FFFFFF;border:thin #000000 solid;height:70px;width:450px;display:none;z-index:10000;">
+
+<table width="100%" height="100%" border="0" cellpadding="2" cellspacing="2"> 
+
+  <tr align="center">
+    <td>$i18n.getString( "name" )</td>
+	<td><input type="text" id="groupName" style="width:20em"/></td>
+	<td><input id="addRenameGroupButton" type="button" value="$i18n.getString( 'ok' )">
+	<input type="button" onclick="showHideDiv( 'addDataElementGroupForm' ); deleteDivEffect();" value="$i18n.getString( 'cancel' )"/></td>
+  </tr>
+
+</table>
+
+</div>
+
+<script type="text/javascript">
+
+	var i18n_select_indicator_group = '$encoder.jsEscape( $i18n.getString( "select_indicator_group" ) , "'")';
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_data_element_group" ) , "'")';
+	var i18n_member_of = '$encoder.jsEscape( $i18n.getString( "member_of" ) , "'")';
+	var i18n_update_success = '$encoder.jsEscape( $i18n.getString( "update_success" ) , "'")';
+		
+	var indicatorGroups = new Object();
+	#foreach( $indicatorGroup in $indicatorGroups )
+		indicatorGroups['$indicatorGroup.id'] = '$encoder.jsEscape( $indicatorGroup.name, "'" )';
+	#end
+
+	var availableIndicators = new Object();
+	#foreach( $indicator in $indicators )
+		availableIndicators['$indicator.id'] = '$encoder.jsEscape( $indicator.name, "'" )';
+	#end
+	var selectedIndicators = new Object();	
+	
+	initList();
+	
+</script>
+

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditor.js	2009-03-10 04:36:07 +0000
@@ -0,0 +1,327 @@
+function initList() {
+	var list = document.getElementById('indicatorGroups');
+	var id;
+
+	for (id in indicatorGroups) {
+		list.add(new Option(indicatorGroups[id], id), null);
+	}
+
+	list = document.getElementById('availableIndicators');
+
+	for (id in availableIndicators) {
+		list.add(new Option(availableIndicators[id], id), null);
+	}
+
+	if (list.selectedIndex == -1) {
+		list.disabled = true;
+	}
+}
+
+/*==============================================================================
+ *Move selected indicator 
+ *==============================================================================*/
+
+function addSelectedIndicators()
+{
+    var list = document.getElementById( 'availableIndicators' );
+
+    while ( list.selectedIndex != -1 )
+    {
+        var id = list.options[list.selectedIndex].value;
+
+        list.options[list.selectedIndex].selected = false;
+
+        selectedIndicators[id] = availableIndicators[id];       
+    
+    }
+    filterSelectedIndicators();
+    filterAvailableIndicators();
+}
+
+function removeSelectedIndicators()
+{
+    var list = document.getElementById( 'selectedIndicators' );   
+
+    while ( list.selectedIndex != -1 )
+    {
+        var id = list.options[list.selectedIndex].value;
+
+        list.options[list.selectedIndex].selected = false; 
+        
+        delete selectedIndicators[id];        
+    }
+    
+    filterSelectedIndicators();
+    filterAvailableIndicators();
+}
+
+/*==============================================================================
+ * Get Indicator
+ *==============================================================================*/
+ 
+ function getIndicatorGroup( listbox ){
+	
+	selectedIndicators = new Object();
+    var id = listbox.options[ listbox.selectedIndex ].value;  
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( getIndicatorGroupCompleted );
+    request.send( 'getIndicatorGroupEditor.action?id=' + id );    
+}
+
+function getIndicatorGroupCompleted( xmlObject )
+{   
+    var selectedList = document.getElementById( 'selectedIndicators' );   
+    selectedList.length = 0;
+    var name = xmlObject.getElementsByTagName('name')[0].firstChild.nodeValue;
+    var indicatorList = xmlObject.getElementsByTagName('indicators')[0].getElementsByTagName('indicator');	
+    for ( var i = 0; i < indicatorList.length; i++ )
+    {
+        indicator = indicatorList.item(i);  
+        var id = indicator.getElementsByTagName('id')[0].firstChild.nodeValue;
+        var name = indicator.getElementsByTagName('name')[0].firstChild.nodeValue;
+        selectedIndicators[id] = name;
+    }
+    filterSelectedIndicators();   
+    document.getElementById( 'groupNameView').innerHTML = i18n_member_of + " <b>" + name + "</b>";
+    document.getElementById('availableIndicators').disabled=false;
+    
+}
+
+/*==============================================================================
+ *   Filter Indicator 
+ *==============================================================================*/
+
+function filterSelectedIndicators(){
+	var filter = document.getElementById( 'selecteIndicatorsFilter' ).value;
+    var list = document.getElementById( 'selectedIndicators' );
+    
+    list.options.length = 0;
+    
+    for ( var id in selectedIndicators )
+    {
+        var value = selectedIndicators[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+function filterIndicatorGroups()
+{
+    var filter = document.getElementById( 'indicatorGroupsFilter' ).value;
+    var list = document.getElementById( 'indicatorGroups' );
+    
+    list.options.length = 0;
+    
+    for ( var id in indicatorGroups )
+    {
+        var value = indicatorGroups[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+function filterAvailableIndicators()
+{
+    var filter = document.getElementById( 'availableIndicatorsFilter' ).value;
+    var list = document.getElementById( 'availableIndicators' );
+    
+    list.options.length = 0;
+    
+    for ( var id in availableIndicators )
+    {
+        var value = availableIndicators[id];
+        
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
+            list.add( new Option( value, id ), null );
+        }
+    }
+}
+
+/*==============================================================================
+ *  New  Indicator Group
+ *==============================================================================*/
+
+
+function showAddIndicatorGroupForm(){
+	document.getElementById( 'groupName' ).value='';    
+    document.getElementById( 'addRenameGroupButton' ).onclick=validateAddIndicatorGroup;
+    setPositionCenter( 'addIndicatorGroupForm' );	
+    showDivEffect();
+	toggleById('addIndicatorGroupForm');
+}
+function validateAddIndicatorGroup(){
+	var name = getFieldValue('groupName');
+	var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( validateAddIndicatorGroupReceived );
+    request.send( 'validateIndicatorGroup.action?name=' + name ); 
+}
+
+function validateAddIndicatorGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );
+    
+    if(type=='input')
+    {
+        alert(xmlObject.firstChild.nodeValue);
+    }
+    if(type=='success')
+    {
+        createNewGroup();
+    }
+}
+
+function createNewGroup(){
+	var name = document.getElementById( 'groupName' ).value;    
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( createNewGroupReceived );
+    request.send( 'addIndicatorGroupEditor.action?name=' + name + "&mode=editor"  );    
+}
+
+function createNewGroupReceived( xmlObject )
+{       
+    var id = xmlObject.getElementsByTagName( "id" )[0].firstChild.nodeValue;
+    var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
+    var list = document.getElementById( 'indicatorGroups' );
+    var option = new Option( name, id );
+    option.selected = true;
+    list.add(option , null );   
+    document.getElementById( 'groupNameView' ).innerHTML = name;        
+    selectedIndicators = new Object();
+    filterSelectedIndicators();
+    toggleById( 'addIndicatorGroupForm' );
+    deleteDivEffect();  
+}
+
+/*==============================================================================
+ * Update Indicator Group
+ *==============================================================================*/
+
+function showRenameIndicatorGroupForm(){
+
+	var list = byId('indicatorGroups');
+	if(list.value==''){
+		alert(i18n_select_indicator_group);
+	}else{
+		document.getElementById( 'groupName' ).value = list.options[ list.selectedIndex ].text
+		document.getElementById( 'addRenameGroupButton' ).onclick=validateRenameIndicatorGroup;
+		setPositionCenter( 'addIndicatorGroupForm' );	
+		showDivEffect();
+		toggleById('addIndicatorGroupForm');
+	}
+	
+} 
+
+function validateRenameIndicatorGroup(){
+	var name = getFieldValue('groupName');
+	var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( validateRenameIndicatorGroupReceived );
+	request.send( 'validateIndicatorGroup.action?name=' + name ); 	
+}
+
+function validateRenameIndicatorGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );
+    
+    if(type=='input')
+    {
+        alert(xmlObject.firstChild.nodeValue);
+    }
+    if(type=='success')
+    {
+        renameGroup();
+    }
+}
+function renameGroup(){
+	var name = document.getElementById( 'groupName' ).value;    
+    var request = new Request();
+    request.setResponseTypeXML( 'xmlObject' );
+    request.setCallbackSuccess( renameGroupReceived );
+    request.send( 'renameIndicatorGroupEditor.action?name=' + name + "&mode=editor&id=" +  byId('indicatorGroups').value);	
+}
+function renameGroupReceived( xmlObject ){
+	var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
+    var list = document.getElementById( 'indicatorGroups' );
+    list.options[ list.selectedIndex ].text = name; 
+    document.getElementById( 'groupNameView' ).innerHTML = name;        
+    showHideDiv( 'addIndicatorGroupForm' );
+    deleteDivEffect(); 
+}
+
+/*==============================================================================
+ * Update Member of Indicator Group
+ *==============================================================================*/
+ 
+function updateIndicatorGroupMembers(){
+	try{
+		var indicatorGroupsSelect = document.getElementById( 'indicatorGroups' );
+	    var id = indicatorGroupsSelect.options[ indicatorGroupsSelect.selectedIndex ].value;	
+		
+	    var request = new Request();
+
+	    var requestString = 'updateIndicatorGroupEditor.action';
+
+	    var params = "id=" + id;
+		params += "&mode=editor";
+
+	    var selectedIndicatorMembers = document.getElementById( 'selectedIndicators' );
+
+	    for ( var i = 0; i < selectedIndicatorMembers.options.length; ++i)
+	    {
+	        params += '&selectedIndicators=' + selectedIndicatorMembers.options[i].value;
+	    }   
+	    request.sendAsPost( params );
+	    request.setResponseTypeXML( 'xmlObject' );  
+	    request.setCallbackSuccess( updateIndicatorGroupMembersReceived );
+	    request.send( requestString );  
+	}catch( e ){
+		alert(i18n_select_indicator_group);
+	}
+}
+
+function updateIndicatorGroupMembersReceived( xmlObject ){       
+    
+	var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
+    setMessage(i18n_update_success + " : " + name);
+}
+
+/*==============================================================================
+ * Delete Indicator Group
+ *==============================================================================*/
+ 
+function deleteIndicatorGroup(){
+
+	if( window.confirm( i18n_confirm_delete ) ){
+		var indicatorGroupsSelect = document.getElementById( 'indicatorGroups' );
+	    var id = indicatorGroupsSelect.options[ indicatorGroupsSelect.selectedIndex ].value;	
+		
+		var request = new Request();
+	    request.setResponseTypeXML( 'xmlObject' );
+	    request.setCallbackSuccess( deleteIndicatorGroupReceived );
+		request.send( 'deleteIndicatorGroupEditor.action?id=' + id ); 	
+	}
+}
+
+function deleteIndicatorGroupReceived( xmlObject )
+{
+    var type = xmlObject.getAttribute( 'type' );    
+    
+    if(type=='success')
+    {
+		var indicatorGroupsSelect = document.getElementById( 'indicatorGroups' );
+        indicatorGroupsSelect.remove( indicatorGroupsSelect.selectedIndex );
+    }
+
+}
+ 
+ 
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu/MainMenu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu/MainMenu.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/menu/MainMenu.vm	2009-03-10 04:36:07 +0000
@@ -11,6 +11,7 @@
 	<li><a href="indicator.action">$i18n.getString( "indicator" )&nbsp;</a></li>
  	<li><a href="indicatorType.action">$i18n.getString( "indicator_type" )&nbsp;</a></li>	
 	<li><a href="indicatorGroup.action">$i18n.getString( "indicator_group" )&nbsp;</a></li>
+	<li><a href="indicatorGroupEditor.action">$i18n.getString( "indicator_group_editor" )&nbsp;</a></li>
   </ul>
  
 <h2><a href="dataDictionary.action">$i18n.getString( "data_dictionary" )&nbsp;</a></h2>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/responseIndicatorGroup.vm	2009-03-10 04:36:07 +0000
@@ -3,4 +3,12 @@
 	<id>$indicatorGroup.id</id>
 	<name>$encoder.xmlEncode( $indicatorGroup.name )</name>
 	<memberCount>$memberCount</memberCount>
+	<indicators>
+	#foreach( $member in $!indicatorGroup.members )
+		<indicator>
+			<id>$member.id</id>
+			<name>$encoder.xmlEncode( $member.name )</name>
+		</indicator>
+	#end	
+	</indicators>
 </indicatorGroup>



--

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.