dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00064
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12: update selectedList and availableList
------------------------------------------------------------
revno: 12
committer: TranThanhTri tranthanhtri84@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-03-09 15:43:25 +0530
message:
update selectedList and availableList
modified:
dhis-2/dhis-web/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties
dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/addLegendSet.vm
dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/editLegendSet.vm
dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/legends.js
dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/map.js
=== modified file 'dhis-2/dhis-web/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties 2009-03-09 08:28:19 +0000
+++ dhis-2/dhis-web/dhis-web-gis/src/main/resources/org/hisp/dhis/gis/i18n_module.properties 2009-03-09 10:13:25 +0000
@@ -88,6 +88,7 @@
name = Name
min = Min
max = Max
+cancel = Cancel
=== modified file 'dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/addLegendSet.vm'
--- dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/addLegendSet.vm 2009-03-09 08:28:19 +0000
+++ dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/addLegendSet.vm 2009-03-09 10:13:25 +0000
@@ -24,7 +24,7 @@
<tr>
<td>
<select id="indicatorGroupId" name="indicatorGroupId" style="min-width:20em"
- onchange="javascript:getIndicatorByIndicatorGroup( this.options[this.selectedIndex].value ,'add')">
+ onchange="javascript:getIndicatorByIndicatorGroup()" >
<option value="ALL" selected="selected">$i18n.getString( "[ ALL ]" )</option>
#foreach ( $indicatorGroup in $indicatorGroups )
<option value="$indicatorGroup.id">$encoder.htmlEncode( $indicatorGroup.name )</option>
=== modified file 'dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/editLegendSet.vm'
--- dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/editLegendSet.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/editLegendSet.vm 2009-03-09 10:13:25 +0000
@@ -16,48 +16,51 @@
<col> ## Available DataElements
<thead>
<tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th> </th>
+ <th> </th>
<th>$i18n.getString( "selected_indicators" )</th>
- <th> </th>
- <th> </th>
- <th>$i18n.getString( "available_indicators" )</th>
</tr>
</thead>
<tbody>
<tr>
- <td colspan=3 align="right"><label>$i18n.getString( "group_filter" )</label></td>
- <td>
- <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:20em"
- onchange="javascript:getIndicatorByIndicatorGroup( this.options[this.selectedIndex].value ,'update')">
- <option value="ALL" selected="selected">$i18n.getString( "all" )</option>
- #foreach ( $indicatorGroup in $indicatorGroups )
- <option value="$indicatorGroup.id">$encoder.htmlEncode( $indicatorGroup.name )</option>
- #end
- </select>
- </td>
- </tr>
- <tr>
+ <td>
+ <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:20em"
+ onchange="javascript:getIndicatorByIndicatorGroup()">
+ <option value="ALL" selected="selected">$i18n.getString( "[ ALL ]" )</option>
+ #foreach ( $indicatorGroup in $indicatorGroups )
+ <option value="$indicatorGroup.id">$encoder.htmlEncode( $indicatorGroup.name )</option>
+ #end
+ </select>
+ </td>
+ <td>
+ </td>
+ </tr>
+ <tr>
<td>
- <select id="selectedIndicatorList" name="selectedIndicatorList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveIndicator( 'selectedIndicatorList' )">
+ <!-- List of all available DataElements -->
+ <select size="15" id="availableIndicatorList" name="availableIndicatorList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveIndicator( 'availableIndicatorList' )">
+ <!-- Show all available DataElements -->
+ #foreach ( $indicator in $indicators )
+ <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
+ #end
+ </select>
+ </td>
+ <td valign="top">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="moveIndicator( 'availableIndicatorList' )">
+ <br>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="moveIndicator ( 'selectedIndicatorList' )">
+ </td>
+ <td></td>
+ <td>
+
+ <select id="selectedIndicatorList" name="selectedIndicatorList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveIndicator( 'selectedIndicatorList' )">
#foreach ( $indicator in $legendSet.indicators )
<option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
#end
</select>
- </td>
- <td valign="top">
- <input type="button" value="<" title="$i18n.getString('move_selected')" onclick="moveIndicator( 'availableIndicatorList' )">
- <br>
- <input type="button" value=">" title="$i18n.getString('remove_selected')" onclick="moveIndicator ( 'selectedIndicatorList' )">
- </td>
- <td></td>
- <td>
- <!-- List of all available DataElements -->
- <select size="15" id="availableIndicatorList" name="availableIndicatorList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveIndicator( 'availableIndicatorList' )">
- <!-- Show all available DataElements -->
- #foreach ( $indicator in $indicators )
- <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
- #end
- </select>
+
</td>
</tr>
</tbody>
@@ -69,10 +72,10 @@
<col> ## Available DataElements
<thead>
<tr>
+ <th>$i18n.getString( "available_legends" )</th>
+ <th> </th>
+ <th> </th>
<th>$i18n.getString( "selected_legends" )</th>
- <th> </th>
- <th> </th>
- <th>$i18n.getString( "available_legends" )</th>
</tr>
</thead>
<tbody>
@@ -84,20 +87,7 @@
</tr>
<tr>
<td>
- <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="move( 'selectedList' )">
- #foreach ( $legend in $legendSet.legends )
- <option value="$legend.id">$encoder.htmlEncode( $legend.name )</option>
- #end
- </select>
- </td>
- <td valign="top">
- <input type="button" value="<" title="$i18n.getString('move_selected')" onclick="move( 'availableList' )">
- <br>
- <input type="button" value=">" title="$i18n.getString('remove_selected')" onclick="move ( 'selectedList' )">
- </td>
- <td></td>
- <td>
- <!-- List of all available DataElements -->
+ <!-- List of all available DataElements -->
<select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="move( 'availableList' )">
<!-- Show all available DataElements -->
#foreach ( $legend in $legends )
@@ -105,6 +95,20 @@
#end
</select>
</td>
+ <td valign="top">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" onclick="move( 'availableList' )">
+ <br>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" onclick="move ( 'selectedList' )">
+ </td>
+ <td></td>
+ <td>
+ <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="move( 'selectedList' )">
+ #foreach ( $legend in $legendSet.legends )
+ <option value="$legend.id">$encoder.htmlEncode( $legend.name )</option>
+ #end
+ </select>
+
+ </td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/legends.js'
--- dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/legends.js 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/legends.js 2009-03-09 10:13:25 +0000
@@ -238,28 +238,49 @@
}
}
-function getIndicatorByIndicatorGroup(groupId, action){
- var request = new Request();
- request.setResponseTypeXML( 'indicators' );
- request.setCallbackSuccess( responseGetIndicatorByIndicatorGroup);
- if(action=='add'){
- request.send( "getIndicatorByIndicatorGroup.action?indicatorGroupId=" + groupId);
- }else{
- var id = document.getElementById( 'id' ).value;
- request.send( "getIndicatorByIndicatorGroup.action?indicatorGroupId=" + groupId + "&legendSetId=" + id);
- }
-
-
-}
-function responseGetIndicatorByIndicatorGroup(indicators){
- var indicatorList = indicators.getElementsByTagName("indicator");
- var indicatorId = document.getElementById("availableIndicatorList");
- var innerHTML="";
- for(var i=0;i<indicatorList.length;i++){
- var indicator = indicatorList.item(i);
- var id = indicator.getElementsByTagName('id')[0].firstChild.nodeValue;
- var name = indicator.getElementsByTagName('name')[0].firstChild.nodeValue;
- innerHTML += "<option value="+id+">"+name+"</option>";
- }
- indicatorId.innerHTML = innerHTML;
-}
\ No newline at end of file
+function getIndicatorByIndicatorGroup(){
+
+ var indicatorGroupList = document.getElementById( "indicatorGroupId" );
+ var indicatorGroupId = indicatorGroupList.options[ indicatorGroupList.selectedIndex ].value;
+
+ if ( indicatorGroupId != null )
+ {
+ var url = "../dhis-web-commons-ajax/getIndicators.action?id=" + indicatorGroupId;
+
+ var request = new Request();
+ request.setResponseTypeXML( 'indicator' );
+ request.setCallbackSuccess( responseGetIndicatorByIndicatorGroup );
+ request.send( url );
+ }
+
+
+}
+function responseGetIndicatorByIndicatorGroup( xmlObject ){
+
+ var indicatorList = document.getElementById( "availableIndicatorList" );
+ var indicators = xmlObject.getElementsByTagName( "indicator" );
+
+ var selectedList = document.getElementById( "selectedIndicatorList" ).options;
+
+ clearList( indicatorList );
+
+ for ( var i = 0; i < indicators.length; i++ )
+ {
+ var id = indicators[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+ var indicatorName = indicators[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+ indicatorList.add(new Option(indicatorName, id), null);
+ for(var j=0;j<selectedList.length;j++){
+ if(selectedList[j].value == id){
+ indicatorList.remove(i);
+ }
+ }
+
+
+ }
+
+
+
+
+
+}
+
=== modified file 'dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/map.js'
--- dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/map.js 2009-03-09 08:28:19 +0000
+++ dhis-2/dhis-web/dhis-web-gis/src/main/webapp/dhis-web-gis/javascript/map.js 2009-03-09 10:13:25 +0000
@@ -347,9 +347,6 @@
}
-
-
-
function addMapFile(){
var mapFileName = document.getElementById("mapFileName").value;
--
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.