dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12268
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3736: added paging to add/update indicator group
------------------------------------------------------------
revno: 3736
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-05-25 09:59:31 +0200
message:
added paging to add/update indicator group
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.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-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addIndicatorGroupForm.vm 2011-05-25 07:59:31 +0000
@@ -1,5 +1,22 @@
<script type="text/javascript" src="javascript/addIndicatorGroupForm.js"></script>
-
+<script>
+ jQuery(function() {
+ jQuery("#availableIndicatorsList").dblclick(dhisPaging_availableList_dblclick("availableIndicatorsList", "groupMembers", "removeIndicators"));
+ jQuery("#groupMembers").dblclick(dhisPaging_selectedList_dblclick("groupMembers", "availableIndicatorsList", "removeIndicators"));
+
+ jQuery("#availableIndicatorsList").dhisPaging({
+ source: "../dhis-web-commons-ajax-json/getIndicators.action",
+ iterator: "indicators",
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+ });
+</script>
<h3>$i18n.getString( "create_new_indicator_group" )</h3>
<form id="addIndicatorGroupForm" action="addIndicatorGroup.action" method="post" >
@@ -18,40 +35,40 @@
</table>
<table>
+ <col style="width: 450px"/>
+ <col/>
+ <col/>
+
<tr>
- <th>$i18n.getString( "available_indicators" )</th><td></td><th>$i18n.getString( "group_members" )
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )
<select id="memberValidator" class="{validate:{required:true}}" style="display:none"/>
</th>
</tr>
- <tr>
- <td><input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'availableIndicators' )" style="width:100%"/></td>
- <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
- <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:100%"/></td>
- </tr>
+
<tr>
<td>
- <select id="availableIndicators" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableIndicators', 'groupMembers' )">
- #foreach( $indicator in $availableIndicators )
- <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
- #end
- </select>
+ <select id="availableIndicatorsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
</td>
<td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableIndicators', 'groupMembers' )"/><br/>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableIndicators' )"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableIndicators', 'groupMembers' )"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableIndicators' )"/>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'availableIndicatorsList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisPaging_moveAll( 'availableIndicatorsList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisPaging_moveAll( 'groupMembers' );"/>
</td>
<td>
- <select id="groupMembers" name="groupMembers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableIndicators' )">
- </select>
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 100%; width: 100%;"></select>
</td>
</tr>
</table>
-<p><input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorGroup.action'" style="width:10em"/></p>
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorGroup.action'" style="width:10em"/>
+</p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm 2011-03-31 12:05:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm 2011-05-25 07:59:31 +0000
@@ -1,6 +1,37 @@
<script type="text/javascript" src="javascript/updateIndicatorGroupForm.js"></script>
<script type="text/javascript">
+ function getRemoveIndicators() {
+ var list = [
+ #foreach( $indicator in $groupMembers )
+ ${indicator.id},
+ #end
+ ];
+
+ return list;
+ }
+
jQuery(document).ready( function(){
+ jQuery("#availableIndicatorsList").dblclick(dhisPaging_availableList_dblclick("availableIndicatorsList", "groupMembers", "removeIndicators"));
+ jQuery("#groupMembers").dblclick(dhisPaging_selectedList_dblclick("groupMembers", "availableIndicatorsList", "removeIndicators"));
+
+ var removeIndicatorsList = getRemoveIndicators();
+
+ jQuery("#availableIndicatorsList").dhisPaging({
+ source: "../dhis-web-commons-ajax-json/getIndicators.action",
+ iterator: "indicators",
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ },
+ removeIndicators: removeIndicatorsList,
+ params: {
+ removeIndicators: removeIndicatorsList.join(",")
+ }
+ });
+
checkValueIsExist( "name", "validateIndicatorGroup.action", {id: $indicatorGroup.id});
});
</script>
@@ -27,33 +58,32 @@
</table>
<table>
- <tr>
- <th>$i18n.getString( "available_indicators" )</th><td></td><th>$i18n.getString( "group_members" )
- <select id="memberValidator" class="{validate:{required:true}}" style="display:none"/></th>
- </tr>
- <tr>
- <td><input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'availableIndicators' )" style="width:100%"/></td>
- <td style="text-align:center">< $i18n.getString( "filters" ) ></td>
- <td><input type="text" id="groupMembersFilter" onkeyup="filterList( this.value, 'groupMembers' )" style="width:100%"/></td>
- </tr>
+ <col style="width: 450px"/>
+ <col/>
+ <col/>
+
+ <tr>
+ <th>$i18n.getString( "available_indicators" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )
+ <select id="memberValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
+ </tr>
+
<tr>
<td>
- <select id="availableIndicators" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'availableIndicators', 'groupMembers' )">
- #foreach( $indicator in $availableIndicators )
- <option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
- #end
- </select>
+ <select id="availableIndicatorsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
</td>
<td style="text-align:center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableIndicators', 'groupMembers' )"/><br/>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveSelectedById( 'groupMembers', 'availableIndicators' )"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableIndicators', 'groupMembers' )"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'groupMembers', 'availableIndicators' )"/>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'availableIndicatorsList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisPaging_moveAll( 'availableIndicatorsList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisPaging_moveAll( 'groupMembers' );"/>
</td>
<td>
- <select id="groupMembers" name="groupMembers" size="2" multiple="multiple" style="min-width:25em; height:25em" ondblclick="moveSelectedById( 'groupMembers', 'availableIndicators' )">
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 100%; width: 100%;">
#foreach( $indicator in $groupMembers )
<option value="$indicator.id">$encoder.htmlEncode( $indicator.name )</option>
#end
@@ -63,6 +93,9 @@
</tr>
</table>
-<p><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorGroup.action'" style="width:10em"/></p>
+<p>
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='indicatorGroup.action'" style="width:10em"/>
+</p>
</form>