dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12164
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3672: added paging to editDataSetForm
------------------------------------------------------------
revno: 3672
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-19 18:03:22 +0200
message:
added paging to editDataSetForm
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.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-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2011-05-10 08:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/UpdateDataSetAction.java 2011-05-19 16:03:22 +0000
@@ -120,18 +120,18 @@
this.dataSetId = dataSetId;
}
- private Collection<String> selectedList = new HashSet<String>();
+ private Collection<String> dataElementsSelectedList = new HashSet<String>();
- public void setSelectedList( Collection<String> selectedList )
+ public void setDataElementsSelectedList( Collection<String> dataElementsSelectedList )
{
- this.selectedList = selectedList;
+ this.dataElementsSelectedList = dataElementsSelectedList;
}
- private Collection<String> indicatorSelectedList = new HashSet<String>();
+ private Collection<String> indicatorsSelectedList = new HashSet<String>();
- public void setIndicatorSelectedList( Collection<String> indicatorSelectedList )
+ public void setIndicatorsSelectedList( Collection<String> indicatorsSelectedList )
{
- this.indicatorSelectedList = indicatorSelectedList;
+ this.indicatorsSelectedList = indicatorsSelectedList;
}
// -------------------------------------------------------------------------
@@ -157,14 +157,14 @@
Collection<DataElement> dataElements = new HashSet<DataElement>();
- for ( String id : selectedList )
+ for ( String id : dataElementsSelectedList )
{
dataElements.add( dataElementService.getDataElement( Integer.parseInt( id ) ) );
}
Set<Indicator> indicators = new HashSet<Indicator>();
- for ( String id : indicatorSelectedList )
+ for ( String id : indicatorsSelectedList )
{
indicators.add( indicatorService.getIndicator( Integer.parseInt( id ) ) );
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-19 12:30:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2011-05-19 16:03:22 +0000
@@ -137,7 +137,7 @@
</action>
<!-- Show edit DataSet form chain -->
-
+
<action name="editDataSetForm"
class="org.hisp.dhis.dataset.action.DataElementListFilteredByGroup">
<result name="success" type="chain">indicatorListFilteredByGroup</result>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-05-19 15:01:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-05-19 16:03:22 +0000
@@ -1,125 +1,5 @@
<script type="text/javascript" src="javascript/addDataSet.js"></script>
<script type="text/javascript">
- var jqDataElementsSelectedList, jqIndicatorsSelectedList;
-
- function dhisPaging_moveAllSelected(sourceId)
- {
- jQuery("#" + sourceId).dblclick();
- }
-
- function dhisPaging_moveAll(sourceId)
- {
- var jqSource = jQuery("#" + sourceId);
- jqSource.find("option").attr("selected", "selected");
- jqSource.dblclick();
- }
-
- function dataElementsSelectedList_dblclick(e) {
- var settings = jQuery("#availableDataElementsList").data("settings");
-
- jQuery(this).find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
- jqThis.remove();
-
- if( jQuery.isArray(settings.removeDataElements) )
- {
- var remove_idx = jQuery.inArray(option_id, settings.removeDataElements);
- settings.removeDataElements.splice(remove_idx, remove_idx+1);
- }
- });
-
- if(settings.removeDataElements && settings.removeDataElements.length > 0) {
- settings.params.removeDataElements = settings.removeDataElements.join(",");
- } else {
- delete settings.removeDataElements;
- delete settings.params.removeDataElements;
- }
-
- jQuery("#availableDataElementsList").data("settings", settings);
- jQuery("#availableDataElementsList").dhisPaging("load", "availableDataElementsList");
- }
-
- function availableDataElementsList_dblclick(e) {
- var settings = jQuery("#availableDataElementsList").data("settings");
-
- jQuery("#availableDataElementsList").find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
-
- jqDataElementsSelectedList.append( this );
-
- if( jQuery.isArray(settings.removeDataElements) ) {
- settings.removeDataElements.push(option_id);
- } else {
- settings.removeDataElements = [option_id];
- }
- });
-
- if(settings.removeDataElements && settings.removeDataElements.length > 0) {
- settings.params.removeDataElements = settings.removeDataElements.join(",");
- } else {
- delete settings.removeDataElements;
- delete settings.params.removeDataElements;
- }
-
- jQuery("#availableDataElementsList").data("settings", settings);
- jQuery("#availableDataElementsList").dhisPaging("load", "availableDataElementsList");
- }
-
- function indicatorsSelectedList_dblclick(e) {
- var settings = jQuery("#availableIndicatorsList").data("settings");
-
- jQuery(this).find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
- jqThis.remove();
-
- if( jQuery.isArray(settings.removeIndicators) )
- {
- var remove_idx = jQuery.inArray(option_id, settings.removeIndicators);
- settings.removeIndicators.splice(remove_idx, remove_idx+1);
- }
- });
-
- if(settings.removeIndicators && settings.removeIndicators.length > 0) {
- settings.params.removeIndicators = settings.removeIndicators.join(",");
- } else {
- delete settings.removeIndicators;
- delete settings.params.removeIndicators;
- }
-
- jQuery("#availableIndicatorsList").data("settings", settings);
- jQuery("#availableIndicatorsList").dhisPaging("load", "availableIndicatorsList");
- }
-
- function availableIndicatorsList_dblclick(e) {
- var settings = jQuery("#availableIndicatorsList").data("settings");
-
- jQuery("#availableIndicatorsList").find(":selected").each(function(i) {
- var jqThis = jQuery(this);
- var option_id = +jqThis.attr("value");
-
- jqIndicatorsSelectedList.append( this );
-
- if( jQuery.isArray(settings.removeIndicators) ) {
- settings.removeIndicators.push(option_id);
- } else {
- settings.removeIndicators = [option_id];
- }
- });
-
- if(settings.removeIndicators && settings.removeIndicators.length > 0) {
- settings.params.removeIndicators = settings.removeIndicators.join(",");
- } else {
- delete settings.removeIndicators;
- delete settings.params.removeIndicators;
- }
-
- jQuery("#availableIndicatorsList").data("settings", settings);
- jQuery("#availableIndicatorsList").dhisPaging("load", "availableIndicatorsList");
- }
-
jQuery(function() {
jqDataElementsSelectedList = jQuery("#dataElementsSelectedList");
jqIndicatorsSelectedList = jQuery("#indicatorsSelectedList");
@@ -239,7 +119,7 @@
</tr>
<tr>
- <td><!-- <input type="text" id="availableDataElementsFilter" onkeyup="filterList( this.value, 'availableList' )" style="min-width:25em"/> --> </td>
+ <td></td>
<td>[$i18n.getString( "name" )]</td>
<td></td>
</tr>
@@ -283,7 +163,7 @@
</tr>
<tr>
- <td><!-- <input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'indicatorAvailableList' )" style="min-width:20em"> --></td>
+ <td></td>
<td>$i18n.getString( "name" )</td>
<td></td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-05-10 08:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/editDataSet.vm 2011-05-19 16:03:22 +0000
@@ -1,5 +1,84 @@
<script type="text/javascript" src="javascript/editDataSet.js"></script>
<script type="text/javascript">
+ function getRemoveDataElementsList() {
+ var list = [];
+ jQuery("#dataElementsSelectedList").find("option").each(function() {
+ list.push( +jQuery(this).attr("value") );
+ });
+
+ return list;
+ }
+
+ function getRemoveIndicatorsList() {
+ var list = [];
+ jQuery("#indicatorsSelectedList").find("option").each(function() {
+ list.push( +jQuery(this).attr("value") );
+ });
+
+ return list;
+ }
+
+ jQuery(function() {
+ jqDataElementsSelectedList = jQuery("#dataElementsSelectedList");
+ jqIndicatorsSelectedList = jQuery("#indicatorsSelectedList");
+
+ jqDataElementsSelectedList.dblclick(dataElementsSelectedList_dblclick);
+ jqIndicatorsSelectedList.dblclick(indicatorsSelectedList_dblclick);
+ jQuery("#availableDataElementsList").dblclick(availableDataElementsList_dblclick);
+ jQuery("#availableIndicatorsList").dblclick(availableIndicatorsList_dblclick);
+
+ removeDataElementsList = getRemoveDataElementsList();
+ removeIndicatorsList = getRemoveIndicatorsList();
+
+ jQuery("#availableDataElementsList").dhisPaging({
+ source: "../dhis-web-commons-ajax-json/getDataElements.action",
+ iterator: "dataElements",
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ },
+ filter: {
+ source: "../dhis-web-commons-ajax-json/getDataElementGroups.action",
+ label: 'dataelement group',
+ iterator: "dataElementGroups",
+ handler: function(item) {
+ return "<option data-key='id' data-value='" + item.id + "'>" + item.name + "</option>";
+ }
+ },
+ removeDataElements: removeDataElementsList,
+ params: {
+ removeDataElements: removeDataElementsList.join(",")
+ }
+ });
+
+ 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;
+ },
+ filter: {
+ source: "../dhis-web-commons-ajax-json/getIndicatorGroups.action",
+ iterator: "indicatorGroups",
+ label: 'indicator group',
+ handler: function(item) {
+ return "<option data-key='id' data-value='" + item.id + "'>" + item.name + "</option>";
+ }
+ },
+ removeIndicators: removeIndicatorsList,
+ params: {
+ removeIndicators: removeIndicatorsList.join(",")
+ }
+ });
+ });
+
var previousName = '';
</script>
@@ -42,7 +121,7 @@
</table>
<table id="dataElementSelectionArea">
- <col/> ## Available DataElements
+ <col style="width: 450px"/> ## Available DataElements
<col/> ## Filter
<col/> ## Selected DataElements
<thead>
@@ -55,41 +134,29 @@
<tbody>
<tr>
- <td>
- <select id="dataElementGroupSelect" name="dataElementGroupSelect" style="min-width:20em"
- onchange="javascript:filterByDataElementGroup( this.options[this.selectedIndex].value )">
- <option value="ALL" selected="selected">$i18n.getString( "all" )</option>
- #foreach ( $dataElementGroup in $dataElementGroups )
- <option value="$dataElementGroup.id">$encoder.htmlEncode( $dataElementGroup.name )</option>
- #end
- </select>
- </td>
+ <td></td>
<td>$i18n.getString( "group" )</td>
<td></td>
</tr>
<tr>
- <td><input type="text" id="availableDataElementsFilter" onkeyup="filterList( this.value, 'availableList' )" style="min-width:20em"></td>
+ <td></td>
<td>$i18n.getString( "name" )</td>
<td></td>
</tr>
<tr>
<td>
- <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'availableList', 'selectedList');">
- #foreach ( $availableDataElement in $dataElements )
- <option value="$availableDataElement.id">$encoder.htmlEncode( $availableDataElement.name )</option>
- #end
- </select>
+ <select id="availableDataElementsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
</td>
<td>
- <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="moveSelectedById( 'availableList', 'selectedList');"/><br/>
- <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="moveSelectedById( 'selectedList', 'availableList');"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'availableList', 'selectedList' );"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'selectedList', 'availableList' );"/>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'availableDataElementsList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisPaging_moveAllSelected( 'dataElementsSelectedList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisPaging_moveAll( 'availableDataElementsList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisPaging_moveAll( 'dataElementsSelectedList' );"/>
</td>
<td>
- <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'selectedList', 'availableList' );">
+ <select id="dataElementsSelectedList" name="dataElementsSelectedList" multiple="multiple" style="min-width:20em;height:20em">
#foreach ( $availableDataElement in $dataSetDataElements )
<option value="$availableDataElement.id">$encoder.htmlEncode( $availableDataElement.name )</option>
#end
@@ -103,7 +170,7 @@
<br/>
<table id="indicatorSelectionArea">
- <col/> ## Available Indicators
+ <col style="width: 450px"/> ## Available Indicators
<col/> ## Filter
<col/> ## Selected Indicators
<thead>
@@ -116,40 +183,29 @@
<tbody>
<tr>
<td>
- <select id="indicatorGroupSelect" name="indicatorGroupSelect" style="min-width:20em"
- onchange="javascript:filterByIndicatorGroup( this.options[this.selectedIndex].value )">
- <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>$i18n.getString( "group" )</td>
<td></td>
</tr>
<tr>
- <td><input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'indicatorAvailableList' )" style="min-width:20em"></td>
+ <td></td>
<td>$i18n.getString( "name" )</td>
<td></td>
</tr>
<tr>
<td>
- <select size="15" id="indicatorAvailableList" name="indicatorAvailableList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'indicatorAvailableList', 'indicatorSelectedList');">
- #foreach ( $availableIndicator in $indicators )
- <option value="$availableIndicator.id">$encoder.htmlEncode( $availableIndicator.name )</option>
- #end
- </select>
- </td>
- <td>
- <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="moveSelectedById( 'indicatorAvailableList', 'indicatorSelectedList');"/><br/>
- <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="moveSelectedById( 'indicatorSelectedList', 'indicatorAvailableList');"/><br/>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="moveAllById( 'indicatorAvailableList', 'indicatorSelectedList' );"/><br/>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'indicatorSelectedList', 'indicatorAvailableList' );"/>
- </td>
- <td>
- <select id="indicatorSelectedList" name="indicatorSelectedList" multiple="multiple" style="min-width:20em;height:20em" ondblclick="moveSelectedById( 'indicatorSelectedList', 'indicatorAvailableList' );">
+ <select id="availableIndicatorsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+ <td>
+ <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( 'indicatorsSelectedList' );"/><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( 'indicatorsSelectedList' );"/>
+ </td>
+ <td>
+ <select id="indicatorsSelectedList" name="indicatorsSelectedList" multiple="multiple" style="min-width:20em;height:20em">
#foreach ( $availableIndicator in $dataSetIndicators )
<option value="$availableIndicator.id">$encoder.htmlEncode( $availableIndicator.name )</option>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js 2011-05-19 11:57:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/addDataSet.js 2011-05-19 16:03:22 +0000
@@ -3,8 +3,8 @@
form.submit()
}, {
'beforeValidateHandler' : function() {
- selectAllById('dataElementsSelectedList');
- selectAllById('indicatorSelectedList');
+ $("#dataElementsSelectedList").find("option").attr("selected", "selected");
+ $("#indicatorsSelectedList").find("option").attr("selected", "selected");
},
'rules' : getValidationRules("dataSet")
});
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js 2011-05-09 10:51:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/dataSet.js 2011-05-19 16:03:22 +0000
@@ -1,3 +1,127 @@
+
+// --------------------------------------------------------------------------------------------------------------------
+// Methods for moving between two selection boxes
+// --------------------------------------------------------------------------------------------------------------------
+var jqDataElementsSelectedList, jqIndicatorsSelectedList;
+
+function dhisPaging_moveAllSelected(sourceId)
+{
+ jQuery("#" + sourceId).dblclick();
+}
+
+function dhisPaging_moveAll(sourceId)
+{
+ var jqSource = jQuery("#" + sourceId);
+ jqSource.find("option").attr("selected", "selected");
+ jqSource.dblclick();
+}
+
+function dataElementsSelectedList_dblclick(e) {
+ var settings = jQuery("#availableDataElementsList").data("settings");
+
+ jQuery(this).find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+ jqThis.remove();
+
+ if( jQuery.isArray(settings.removeDataElements) )
+ {
+ var remove_idx = jQuery.inArray(option_id, settings.removeDataElements);
+ settings.removeDataElements.splice(remove_idx, remove_idx+1);
+ }
+ });
+
+ if(settings.removeDataElements && settings.removeDataElements.length > 0) {
+ settings.params.removeDataElements = settings.removeDataElements.join(",");
+ } else {
+ delete settings.removeDataElements;
+ delete settings.params.removeDataElements;
+ }
+
+ jQuery("#availableDataElementsList").data("settings", settings);
+ jQuery("#availableDataElementsList").dhisPaging("load", "availableDataElementsList");
+}
+
+function availableDataElementsList_dblclick(e) {
+ var settings = jQuery("#availableDataElementsList").data("settings");
+
+ jQuery("#availableDataElementsList").find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+
+ jqDataElementsSelectedList.append( this );
+
+ if( jQuery.isArray(settings.removeDataElements) ) {
+ settings.removeDataElements.push(option_id);
+ } else {
+ settings.removeDataElements = [option_id];
+ }
+ });
+
+ if(settings.removeDataElements && settings.removeDataElements.length > 0) {
+ settings.params.removeDataElements = settings.removeDataElements.join(",");
+ } else {
+ delete settings.removeDataElements;
+ delete settings.params.removeDataElements;
+ }
+
+ jQuery("#availableDataElementsList").data("settings", settings);
+ jQuery("#availableDataElementsList").dhisPaging("load", "availableDataElementsList");
+}
+
+function indicatorsSelectedList_dblclick(e) {
+ var settings = jQuery("#availableIndicatorsList").data("settings");
+
+ jQuery(this).find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+ jqThis.remove();
+
+ if( jQuery.isArray(settings.removeIndicators) )
+ {
+ var remove_idx = jQuery.inArray(option_id, settings.removeIndicators);
+ settings.removeIndicators.splice(remove_idx, remove_idx+1);
+ }
+ });
+
+ if(settings.removeIndicators && settings.removeIndicators.length > 0) {
+ settings.params.removeIndicators = settings.removeIndicators.join(",");
+ } else {
+ delete settings.removeIndicators;
+ delete settings.params.removeIndicators;
+ }
+
+ jQuery("#availableIndicatorsList").data("settings", settings);
+ jQuery("#availableIndicatorsList").dhisPaging("load", "availableIndicatorsList");
+}
+
+function availableIndicatorsList_dblclick(e) {
+ var settings = jQuery("#availableIndicatorsList").data("settings");
+
+ jQuery("#availableIndicatorsList").find(":selected").each(function(i) {
+ var jqThis = jQuery(this);
+ var option_id = +jqThis.attr("value");
+
+ jqIndicatorsSelectedList.append( this );
+
+ if( jQuery.isArray(settings.removeIndicators) ) {
+ settings.removeIndicators.push(option_id);
+ } else {
+ settings.removeIndicators = [option_id];
+ }
+ });
+
+ if(settings.removeIndicators && settings.removeIndicators.length > 0) {
+ settings.params.removeIndicators = settings.removeIndicators.join(",");
+ } else {
+ delete settings.removeIndicators;
+ delete settings.params.removeIndicators;
+ }
+
+ jQuery("#availableIndicatorsList").data("settings", settings);
+ jQuery("#availableIndicatorsList").dhisPaging("load", "availableIndicatorsList");
+}
+
// -----------------------------------------------------------------------------
// DataSet details form
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js 2011-05-10 08:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/editDataSet.js 2011-05-19 16:03:22 +0000
@@ -3,8 +3,8 @@
form.submit()
}, {
'beforeValidateHandler' : function() {
- selectAllById('selectedList');
- selectAllById('indicatorSelectedList');
+ $("#dataElementsSelectedList").find("option").attr("selected", "selected");
+ $("#indicatorsSelectedList").find("option").attr("selected", "selected");
},
'rules' : getValidationRules("dataSet")
});