dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12147
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3664: WIP: added paging to addDataSetForm, only dblclick for adding works currently
------------------------------------------------------------
revno: 3664
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-05-19 13:57:47 +0200
message:
WIP: added paging to addDataSetForm, only dblclick for adding works currently
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java
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/javascript/addDataSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js 2011-05-18 08:36:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js 2011-05-19 11:57:47 +0000
@@ -32,11 +32,12 @@
(function($) {
var templates = {
wrapper: "<div id='${id}' style='padding: 0; margin: 0; background-color: #eee; border: 1px solid #666;' />",
- button: "<button id='${id}' style='width: 70px; margin: 4px;'>${text}</button>",
+ button: "<button id='${id}' type='button' style='width: 70px; margin: 4px;'>${text}</button>",
option: "<option>${text}</option>",
option_selected: "<option selected='selected'>${text}</option>",
pagesize_input: "Page size <input id='${id}' type='text' style='width: 50px;'/>",
filter_input: "<input id='${id}' placeholder='Filter' type='text' style='width: 100%; height: 18px; border: 1px inset #888;' />",
+ filter_select: "<select id='${id}' style='width: 100%; margin-bottom: 4px; margin-top: 0;'></select>",
select_page: "Page <select id='${id}' style='width: 50px;'></select>"
}
@@ -57,10 +58,11 @@
var $previous_button = $("#" + previous_button_id);
var filter_input_id = id + "_filter_input";
var $filter_input = $("#" + filter_input_id);
+ var filter_select_id = id + "_filter_select";
var pagesize_input_id = id + "_pagesize_input";
var $pagesize_input = $("#" + pagesize_input_id);
- $.getJSON(settings.url, $.param( settings.params ), function(json) {
+ $.getJSON(settings.source, $.param( settings.params ), function(json) {
$select.empty();
$select_page.empty();
@@ -69,7 +71,10 @@
params.pageSize = json.paging.pageSize;
params.startPage = json.paging.startPage;
- settings.handler($select, json);
+ $.each(json[settings.iterator], function(i, item) {
+ var option = jQuery(settings.handler(item));
+ $select.append( option );
+ });
for(var j=1; j<=params.numberOfPages; j++) {
if(params.currentPage == j) {
@@ -113,11 +118,59 @@
var previous_button_id = id + "_previous_button";
var filter_input_id = id + "_filter_input";
var filter_button_id = id + "_filter_button";
+ var filter_select_id = id + "_filter_select";
var pagesize_input_id = id + "_pagesize_input";
$select.wrap( $.tmpl(templates.wrapper, { "id": wrapper_id }) );
var $wrapper = $("#" + wrapper_id);
+ if(settings.filter !== undefined) {
+ $wrapper.prepend( $.tmpl(templates.filter_select, { "id": filter_select_id } ) );
+
+ if( settings.filter.label !== undefined ) {
+ $wrapper.prepend( "<div style='width: 100%; padding-left: 4px;'>Filter by " + settings.filter.label + ":</div>" );
+ } else {
+ $wrapper.prepend( "<div style='width: 100%; padding-left: 4px;'>Filter by:</div>" );
+ }
+
+ var $filter_select = $("#" + filter_select_id);
+
+ $.getJSON(settings.filter.source, function(json) {
+ $filter_select.empty();
+ $filter_select.append( "<option>All</option>");
+
+ $.each(json[settings.filter.iterator], function(i, item) {
+ var option = jQuery(settings.filter.handler(item));
+ $filter_select.append( option );
+ });
+ });
+
+ $filter_select.bind("change", {"id": id}, function(event) {
+ var $option = $(this).find(":selected");
+ var key = $option.data("key");
+ var value = $option.data("value");
+
+ key = !! key ? key : "";
+ value = !! value ? value : "";
+
+ var settings = $("#" + event.data.id).data("settings");
+
+ if(key !== "") {
+ settings.params[key] = value;
+ settings.filter_select_key = key;
+ } else {
+ if(settings.filter_select_key !== undefined) {
+ delete settings.params[settings.filter_select_key];
+ delete settings.filter_select_key;
+ }
+ }
+
+ settings.params.currentPage = 1;
+ $select.data("settings", settings);
+ methods.load(event.data.id);
+ });
+ }
+
var $filter_table = $("<table/>");
$filter_table.css({
"padding": "1px",
@@ -214,4 +267,4 @@
$.error('Method ' + method + ' does not exist on jQuery.dhisPaging' );
}
};
-})(jQuery);
+})(jQuery, undefined);
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2011-05-18 04:42:29 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2011-05-19 11:57:47 +0000
@@ -25,6 +25,7 @@
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.metadata.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.upload-1.0.2.min.js"></script>
+ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui-1.8.12.custom.min.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery.block.js"></script>
<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/ui.thickbox.min.js"></script>
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java 2011-05-06 10:49:36 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetDataElementsAction.java 2011-05-19 11:57:47 +0000
@@ -28,6 +28,7 @@
*/
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
@@ -54,20 +55,20 @@
extends ActionPagingSupport<DataElement>
{
private final static int ALL = 0;
-
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
-
+
private DataElementService dataElementService;
-
+
public void setDataElementService( DataElementService dataElementService )
{
this.dataElementService = dataElementService;
- }
+ }
private DataElementCategoryService categoryService;
-
+
public void setCategoryService( DataElementCategoryService categoryService )
{
this.categoryService = categoryService;
@@ -79,13 +80,13 @@
{
this.dataSetService = dataSetService;
}
-
+
private PeriodService periodService;
public void setPeriodService( PeriodService periodService )
{
this.periodService = periodService;
- }
+ }
// -------------------------------------------------------------------------
// Comparator
@@ -107,33 +108,33 @@
public void setDisplayPropertyHandler( DisplayPropertyHandler displayPropertyHandler )
{
this.displayPropertyHandler = displayPropertyHandler;
- }
-
+ }
+
// -------------------------------------------------------------------------
// Input & output
// -------------------------------------------------------------------------
-
+
private Integer id;
public void setId( Integer id )
{
this.id = id;
}
-
+
private Integer categoryComboId;
public void setCategoryComboId( Integer categoryComboId )
{
this.categoryComboId = categoryComboId;
}
-
+
private Integer dataSetId;
-
+
public void setDataSetId( Integer dataSetId )
{
this.dataSetId = dataSetId;
}
-
+
private String periodTypeName;
public void setPeriodTypeName( String periodTypeName )
@@ -141,13 +142,43 @@
this.periodTypeName = periodTypeName;
}
+ private List<Integer> removeDataSets = new ArrayList<Integer>();
+
+ public void setRemoveDataSets( String removeDataSets )
+ {
+ if ( removeDataSets.length() > 0 )
+ {
+ List<String> stringList = Arrays.asList( removeDataSets.split( "," ) );
+
+ for ( String s : stringList )
+ {
+ this.removeDataSets.add( Integer.parseInt( s ) );
+ }
+ }
+ }
+
+ private List<Integer> removeDataElements = new ArrayList<Integer>();
+
+ public void setRemoveDataElements( String removeDataElements )
+ {
+ if ( removeDataElements.length() > 0 )
+ {
+ List<String> stringList = Arrays.asList( removeDataElements.split( "," ) );
+
+ for ( String s : stringList )
+ {
+ this.removeDataElements.add( Integer.parseInt( s ) );
+ }
+ }
+ }
+
private boolean aggregate = false;
public void setAggregate( boolean aggregate )
{
this.aggregate = aggregate;
}
-
+
private List<DataElement> dataElements;
public List<DataElement> getDataElements()
@@ -159,12 +190,13 @@
// Action implementation
// -------------------------------------------------------------------------
- public String execute() throws Exception
+ public String execute()
+ throws Exception
{
if ( id != null && id != ALL )
{
DataElementGroup dataElementGroup = dataElementService.getDataElementGroup( id );
-
+
if ( dataElementGroup != null )
{
dataElements = new ArrayList<DataElement>( dataElementGroup.getMembers() );
@@ -173,16 +205,17 @@
else if ( categoryComboId != null && categoryComboId != ALL )
{
DataElementCategoryCombo categoryCombo = categoryService.getDataElementCategoryCombo( categoryComboId );
-
+
if ( categoryCombo != null )
{
- dataElements = new ArrayList<DataElement>( dataElementService.getDataElementByCategoryCombo( categoryCombo ) );
+ dataElements = new ArrayList<DataElement>(
+ dataElementService.getDataElementByCategoryCombo( categoryCombo ) );
}
}
else if ( dataSetId != null )
{
DataSet dataset = dataSetService.getDataSet( dataSetId );
-
+
if ( dataset != null )
{
dataElements = new ArrayList<DataElement>( dataset.getDataElements() );
@@ -191,7 +224,7 @@
else if ( periodTypeName != null )
{
PeriodType periodType = periodService.getPeriodTypeByName( periodTypeName );
-
+
if ( periodType != null )
{
dataElements = new ArrayList<DataElement>( dataElementService.getDataElementsByPeriodType( periodType ) );
@@ -201,12 +234,30 @@
{
dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
}
-
+
if ( dataElements == null )
{
dataElements = new ArrayList<DataElement>();
}
-
+
+ if ( removeDataSets.size() > 0 )
+ {
+ for ( Integer id : removeDataSets )
+ {
+ DataSet dataSet = dataSetService.getDataSet( id );
+ dataElements.removeAll( dataSet.getDataElements() );
+ }
+ }
+
+ if ( removeDataElements.size() > 0 )
+ {
+ for ( Integer id : removeDataElements )
+ {
+ DataElement dataElement = dataElementService.getDataElement( id );
+ dataElements.remove( dataElement );
+ }
+ }
+
Collections.sort( dataElements, dataElementComparator );
if ( aggregate )
@@ -220,7 +271,7 @@
dataElements = dataElements.subList( paging.getStartPos(), paging.getEndPos() );
}
-
+
displayPropertyHandler.handle( dataElements );
return SUCCESS;
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java 2011-05-16 16:14:26 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/commons/action/GetIndicatorsAction.java 2011-05-19 11:57:47 +0000
@@ -28,10 +28,12 @@
*/
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.indicator.Indicator;
@@ -113,7 +115,37 @@
{
this.key = key;
}
-
+
+ private List<Integer> removeDataSets = new ArrayList<Integer>();
+
+ public void setRemoveDataSets( String removeDataSets )
+ {
+ if ( removeDataSets.length() > 0 )
+ {
+ List<String> stringList = Arrays.asList( removeDataSets.split( "," ) );
+
+ for ( String s : stringList )
+ {
+ this.removeDataSets.add( Integer.parseInt( s ) );
+ }
+ }
+ }
+
+ private List<Integer> removeIndicators = new ArrayList<Integer>();
+
+ public void setRemoveIndicators( String removeIndicators )
+ {
+ if ( removeIndicators.length() > 0 )
+ {
+ List<String> stringList = Arrays.asList( removeIndicators.split( "," ) );
+
+ for ( String s : stringList )
+ {
+ this.removeIndicators.add( Integer.parseInt( s ) );
+ }
+ }
+ }
+
private List<Indicator> indicators;
public List<Indicator> getIndicators()
@@ -156,6 +188,24 @@
indicators = new ArrayList<Indicator>();
}
+ if ( removeDataSets.size() > 0 )
+ {
+ for ( Integer id : removeDataSets )
+ {
+ DataSet dataSet = dataSetService.getDataSet( id );
+ indicators.removeAll( dataSet.getDataElements() );
+ }
+ }
+
+ if ( removeIndicators.size() > 0 )
+ {
+ for ( Integer id : removeIndicators )
+ {
+ Indicator indicator = indicatorService.getIndicator( id );
+ indicators.remove( indicator );
+ }
+ }
+
Collections.sort( indicators, indicatorComparator );
if ( usePaging )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/AddDataSetAction.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/AddDataSetAction.java 2011-05-19 11:57:47 +0000
@@ -132,18 +132,18 @@
this.frequencySelect = frequencySelect;
}
- 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;
}
private boolean mobile;
@@ -177,26 +177,26 @@
PeriodType periodType = periodService.getPeriodTypeByName( frequencySelect );
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 ) ) );
}
DataSet dataSet = new DataSet( name, shortName, code, periodType );
-
+
dataSet.setMobile( mobile );
dataSet.setVersion( 1 );
dataSet.setDataElements( dataElements );
dataSet.setIndicators( indicators );
-
+
dataSetService.addDataSet( dataSet );
assignDataSetToUserRole( dataSet );
=== 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-10 08:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/addDataSet.vm 2011-05-19 11:57:47 +0000
@@ -1,5 +1,142 @@
<script type="text/javascript" src="javascript/addDataSet.js"></script>
<script type="text/javascript">
+ var jqDataElementsSelectedList, jqIndicatorsSelectedList;
+
+ jQuery(function() {
+ jqDataElementsSelectedList = jQuery("#dataElementsSelectedList");
+ jqIndicatorsSelectedList = jQuery("#indicatorsSelectedList");
+
+ jqDataElementsSelectedList.dblclick(function(e) {
+ var option = jQuery(this).find(":selected");
+ var option_id = +option.attr("value");
+ option.remove();
+
+ var settings = jQuery("#availableDataElementsList").data("settings");
+
+ 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.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");
+ });
+
+ jqIndicatorsSelectedList.dblclick(function(e) {
+ var option = jQuery(this).find(":selected");
+ var option_id = +option.attr("value");
+ option.remove();
+
+ var settings = jQuery("#availableIndicatorsList").data("settings");
+
+ 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.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("#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 );
+
+ option.dblclick(function(e) {
+ var jqThis = jQuery(this);
+ jqThis.unbind();
+ var option_id = jqThis.attr("value");
+
+ jqDataElementsSelectedList.append( this );
+
+ var settings = jQuery("#availableDataElementsList").data("settings");
+
+ if( jQuery.isArray(settings.removeDataElements) ) {
+ settings.removeDataElements.push(+option_id);
+ } else {
+ settings.removeDataElements = [+option_id];
+ }
+
+ settings.params.removeDataElements = settings.removeDataElements.join(",");
+
+ jQuery("#availableDataElementsList").data("settings", settings);
+ jQuery("#availableDataElementsList").dhisPaging("load", "availableDataElementsList");
+ });
+
+ 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>";
+ }
+ }
+ });
+
+ 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 );
+
+ option.dblclick(function(e) {
+ var jqThis = jQuery(this);
+ jqThis.unbind();
+ var option_id = jqThis.attr("value");
+
+ jqIndicatorsSelectedList.append( this );
+
+ var settings = jQuery("#availableIndicatorsList").data("settings");
+
+ if( jQuery.isArray(settings.removeIndicators) ) {
+ settings.removeIndicators.push(+option_id);
+ } else {
+ settings.removeIndicators = [+option_id];
+ }
+
+ settings.params.removeIndicators = settings.removeIndicators.join(",");
+
+ jQuery("#availableIndicatorsList").data("settings", settings);
+ jQuery("#availableIndicatorsList").dhisPaging("load", "availableIndicatorsList");
+ });
+
+ 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>";
+ }
+ }
+ });
+ });
+
var previousName = '';
</script>
@@ -50,7 +187,7 @@
</table>
<br/>
<table id="dataElementSelectionArea">
- <col/> ## Available DataElements
+ <col style="width: 450px"/> ## Available DataElements
<col/> ## Filter
<col/> ## Selected DataElements
<thead>
@@ -63,31 +200,20 @@
<tbody>
<tr>
<td>
- <select id="dataElementGroupSelect" name="dataElementGroupSelect" style="min-width:25em"
- 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>[$i18n.getString( "group" )]</td>
<td></td>
</tr>
<tr>
- <td><input type="text" id="availableDataElementsFilter" onkeyup="filterList( this.value, 'availableList' )" style="min-width:25em"/></td>
+ <td><!-- <input type="text" id="availableDataElementsFilter" onkeyup="filterList( this.value, 'availableList' )" style="min-width:25em"/> --> </td>
<td>[$i18n.getString( "name" )]</td>
<td></td>
</tr>
<tr>
<td>
- <select size="15" id="availableList" name="availableList" multiple="multiple" style="min-width:25em;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/>
@@ -96,8 +222,7 @@
<input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'selectedList', 'availableList' );"/>
</td>
<td>
- <select id="selectedList" name="selectedList" multiple="multiple" style="min-width:25em;height:20em" ondblclick="moveSelectedById( 'selectedList', 'availableList' ); disabledSelectedList();">
- </select>
+ <select id="dataElementsSelectedList" name="dataElementsSelectedList" multiple="multiple" style="min-width:25em;height:20em"></select>
</td>
</tr>
</tbody>
@@ -106,7 +231,7 @@
<br/>
<table id="indicatorSelectionArea">
- <col/> ## Available Indicators
+ <col style="width: 450px"/> ## Available Indicators
<col/> ## Filter
<col/> ## Selected Indicators
<thead>
@@ -119,31 +244,20 @@
<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><!-- <input type="text" id="availableIndicatorsFilter" onkeyup="filterList( this.value, 'indicatorAvailableList' )" style="min-width:20em"> --></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>
+ <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="moveSelectedById( 'indicatorAvailableList', 'indicatorSelectedList');"/><br/>
@@ -152,11 +266,7 @@
<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' );">
- #foreach ( $availableIndicator in $dataSetIndicators )
- <option value="$availableIndicator.id">$encoder.htmlEncode( $availableIndicator.name )</option>
- #end
- </select>
+ <select id="indicatorsSelectedList" name="indicatorsSelectedList" multiple="multiple" style="min-width:20em;height:20em"></select>
</td>
</tr>
=== 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-10 08:42:26 +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 11:57:47 +0000
@@ -3,7 +3,7 @@
form.submit()
}, {
'beforeValidateHandler' : function() {
- selectAllById('selectedList');
+ selectAllById('dataElementsSelectedList');
selectAllById('indicatorSelectedList');
},
'rules' : getValidationRules("dataSet")
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2011-05-16 19:39:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm 2011-05-19 11:57:47 +0000
@@ -1,4 +1,3 @@
-<script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.dhisPaging.js"></script>
<script type="text/javascript" src="javascript/viewDataEntryForm.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
@@ -14,21 +13,19 @@
jQuery("#designTextarea").ckeditorGet().setData('$encoder.jsEscape( $dataEntryValue, "'" )');
jQuery("#dataElementSelector").dhisPaging({
- url: "../dhis-web-commons-ajax-json/getDataElementOperands.action",
- handler: function(element, json) {
- jQuery.each(json.operands, function(i, item) {
- var option = jQuery("<option />");
- option.addClass("dataElementSelectorOption");
- option.text( item.operandName );
- option.data( "dataelement-id", item.dataElement.id );
- option.data( "dataelement-name", item.dataElement.name );
- option.data( "dataelement-type", item.dataElement.type );
- option.data( "optioncombo-id", item.categoryOptionCombo.id );
- option.data( "optioncombo-name", item.categoryOptionCombo.name );
- option.dblclick(insertDataElement);
+ source: "../dhis-web-commons-ajax-json/getDataElementOperands.action",
+ iterator: "operands",
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.operandName );
+ option.data( "dataelement-id", item.dataElement.id );
+ option.data( "dataelement-name", item.dataElement.name );
+ option.data( "dataelement-type", item.dataElement.type );
+ option.data( "optioncombo-id", item.categoryOptionCombo.id );
+ option.data( "optioncombo-name", item.categoryOptionCombo.name );
+ option.dblclick(insertDataElement);
- element.append( option );
- });
+ return option;
},
params: {
dataSetId: $dataSet.id
@@ -36,17 +33,15 @@
});
jQuery("#indicatorSelector").dhisPaging({
- url: "../dhis-web-commons-ajax-json/getIndicators.action",
- handler: function(element, json) {
- jQuery.each(json.indicators, function(i, item) {
- var option = jQuery("<option />");
- option.addClass("indicatorSelectorOption");
- option.text( item.name );
- option.data("id", item.id);
- option.dblclick(insertIndicator);
+ source: "../dhis-web-commons-ajax-json/getIndicators.action",
+ iterator: "indicators",
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.data("id", item.id);
+ option.dblclick(insertIndicator);
- element.append( option );
- });
+ return option;
},
params: {
dataSetId: $dataSet.id