dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14264
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4787: Applied the dhisAjaxSelect plugin into Datamart module.
------------------------------------------------------------
revno: 4787
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2011-10-01 16:05:47 +0700
message:
Applied the dhisAjaxSelect plugin into Datamart module.
Changed Request to jQuery and code style fixed.
removed:
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseExportStatus.vm
added:
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonExportStatus.vm
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/GetOptionsAction.java
dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/viewExportForm.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/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-09-16 15:55:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-10-01 09:05:47 +0000
@@ -410,5 +410,10 @@
"rangelength" : [ 2, 230 ],
"alphanumericwithbasicpuncspaces" : true
}
- }
+ },
+ "dataMart" : {
+ "name" : {
+ "required": true
+ }
+ }
};
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/GetOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/GetOptionsAction.java 2011-05-05 21:15:45 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/java/org/hisp/dhis/datamart/action/GetOptionsAction.java 2011-10-01 09:05:47 +0000
@@ -35,15 +35,9 @@
import java.util.List;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
import org.hisp.dhis.datamart.DataMartExport;
import org.hisp.dhis.datamart.DataMartService;
import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.indicator.comparator.IndicatorGroupNameComparator;
import org.hisp.dhis.options.displayproperty.DisplayPropertyHandler;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
@@ -53,7 +47,6 @@
import org.hisp.dhis.period.PeriodService;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.comparator.PeriodComparator;
-import org.hisp.dhis.system.filter.AggregatableDataElementFilter;
import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter;
import org.hisp.dhis.system.util.FilterUtils;
@@ -70,20 +63,6 @@
// Dependencies
// -------------------------------------------------------------------------
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
private PeriodService periodService;
public void setPeriodService( PeriodService periodService )
@@ -150,34 +129,6 @@
// Output
// -------------------------------------------------------------------------
- private List<DataElement> dataElements;
-
- public List<DataElement> getDataElements()
- {
- return dataElements;
- }
-
- private List<DataElementGroup> dataElementGroups;
-
- public List<DataElementGroup> getDataElementGroups()
- {
- return dataElementGroups;
- }
-
- private List<Indicator> indicators;
-
- public List<Indicator> getIndicators()
- {
- return indicators;
- }
-
- private List<IndicatorGroup> indicatorGroups;
-
- public List<IndicatorGroup> getIndicatorGroups()
- {
- return indicatorGroups;
- }
-
private List<OrganisationUnit> organisationUnits;
public List<OrganisationUnit> getOrganisationUnits()
@@ -284,53 +235,6 @@
public String execute()
throws Exception
{
- // ---------------------------------------------------------------------
- // Data element
- // ---------------------------------------------------------------------
-
- dataElements = new ArrayList<DataElement>( dataElementService.getAllDataElements() );
-
- Collections.sort( dataElements, dataElementComparator );
-
- displayPropertyHandler.handle( dataElements );
-
- FilterUtils.filter( dataElements, new AggregatableDataElementFilter() );
-
- // ---------------------------------------------------------------------
- // Data element group
- // ---------------------------------------------------------------------
-
- dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
-
- Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
-
- // ---------------------------------------------------------------------
- // Indicator
- // ---------------------------------------------------------------------
-
- indicators = new ArrayList<Indicator>( indicatorService.getAllIndicators() );
-
- Collections.sort( indicators, indicatorComparator );
-
- displayPropertyHandler.handle( indicators );
-
- // ---------------------------------------------------------------------
- // Indicator group
- // ---------------------------------------------------------------------
-
- indicatorGroups = new ArrayList<IndicatorGroup>(indicatorService.getAllIndicatorGroups());
-
- Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() );
-
- // ---------------------------------------------------------------------
- // Organisation unit
- // ---------------------------------------------------------------------
-
- organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitService.getOrganisationUnitsAtLevel( 1 ) );
-
- Collections.sort( organisationUnits, organisationUnitComparator );
-
- displayPropertyHandler.handle( organisationUnits );
// ---------------------------------------------------------------------
// Level
@@ -364,7 +268,6 @@
selectedDataElements = new ArrayList<DataElement>( export.getDataElements() );
displayPropertyHandler.handle( selectedDataElements );
Collections.sort( selectedDataElements, dataElementComparator );
- dataElements.removeAll( selectedDataElements );
// ---------------------------------------------------------------------
// Indicator
@@ -373,7 +276,6 @@
selectedIndicators = new ArrayList<Indicator>( export.getIndicators() );
displayPropertyHandler.handle( selectedIndicators );
Collections.sort( selectedIndicators, indicatorComparator );
- indicators.removeAll( selectedIndicators );
// ---------------------------------------------------------------------
// Organisation unit
@@ -382,7 +284,6 @@
selectedOrganisationUnits = new ArrayList<OrganisationUnit>( export.getOrganisationUnits() );
displayPropertyHandler.handle( selectedOrganisationUnits );
Collections.sort( selectedOrganisationUnits, organisationUnitComparator );
- organisationUnits.removeAll( selectedOrganisationUnits );
// ---------------------------------------------------------------------
// Period
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml 2011-06-23 14:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/META-INF/dhis/beans.xml 2011-10-01 09:05:47 +0000
@@ -23,8 +23,6 @@
<bean id="org.hisp.dhis.datamart.action.GetOptionsAction" class="org.hisp.dhis.datamart.action.GetOptionsAction"
scope="prototype">
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
<property name="dataMartService" ref="org.hisp.dhis.datamart.DataMartService" />
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-09-29 06:40:09 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-10-01 09:05:47 +0000
@@ -33,7 +33,7 @@
</action>
<action name="getExportStatus" class="org.hisp.dhis.datamart.action.GetExportStatusAction">
- <result name="success" type="velocity-xml">/dhis-web-datamart/responseExportStatus.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-datamart/jsonExportStatus.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -45,8 +45,9 @@
<!-- DataMartExports -->
<action name="removeDataMartExport" class="org.hisp.dhis.datamart.action.RemoveDataMartExportAction">
- <result name="success" type="redirect">getDataMartExports.action</result>
- <param name="requiredAuthorities">F_DATAMART_ADMIN</param>
+ <result name="success" type="velocity-json">
+ ../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="getDataMartExports" class="org.hisp.dhis.datamart.action.GetAllDataMartExportsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm 2011-09-16 07:53:59 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/exportForm.vm 2011-10-01 09:05:47 +0000
@@ -1,4 +1,5 @@
-<script type="text/javascript">
+<script type="text/javascript" src="javascript/addUpdateDatamart.js"></script>
+<script type="text/javascript">
var i18n_select_min_datatype = '$encoder.jsEscape( $i18n.getString( "select_min_datatype" ), "'" )';
var i18n_select_min_level = '$encoder.jsEscape( $i18n.getString( "select_min_level" ), "'" )';
var i18n_select_min_period = '$encoder.jsEscape( $i18n.getString( "select_min_period" ), "'" )';
@@ -15,14 +16,14 @@
<form id="exportForm" name="exportForm" method="post" action="saveDataMartExport.action">
-<input type="hidden" id="id" name="id" value="$!id">
+<input type="hidden" id="id" name="id" value="$!id"/>
<table width="730">
<colgroup>
- <col style="width:325px">
- <col style="width:80px">
- <col style="width:325px">
+ <col style="width:325px"/>
+ <col style="width:80px"/>
+ <col style="width:325px"/>
</colgroup>
<!-- Name -->
@@ -32,7 +33,7 @@
<td colspan="2"></td>
</tr>
<tr>
- <td><input type="text" id="name" name="name" style="min-width:325px" value="$!export.name"></td>
+ <td><input type="text" id="name" name="name" style="min-width:325px" value="$!export.name"/></td>
<td colspan="2"></td>
</tr>
<tr>
@@ -44,27 +45,19 @@
<tr>
<th>$i18n.getString( "available_dataelements" )</th>
<td></td>
- <th>$i18n.getString( "selected_dataelements" )</th>
+ <th>$i18n.getString( "selected_dataelements" )
+ <select id="dataelementsValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
</tr>
<tr>
<td>
- <select id="dataElementGroupId" name="dataElementGroupId" style="min-width:325px" onchange="getDataElements()">
- <option value="$ALL">[ $i18n.getString( "select_dataelementgroup_all" ) ]</option>
- #foreach ( $group in $dataElementGroups )
- <option value="$group.id">$group.name</option>
- #end
- </select><br>
- <select multiple size="6" id="availableDataElements" name="availableDataElements" style="min-width:325px" ondblclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )">
- #foreach ( $element in $dataElements )
- <option value="$element.id">$element.name</option>
- #end
- </select>
+ <select multiple size="6" id="availableDataElements" name="availableDataElements" style="min-width:325px"></select>
</td>
<td align="center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="moveSelectedById( 'availableDataElements', 'selectedDataElements' )"><br>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )"><br>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="moveAllById( 'availableDataElements', 'selectedDataElements' )"><br>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="moveAllById( 'selectedDataElements', 'availableDataElements' )">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataElements', 'selectedDataElements' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedDataElements', 'availableDataElements' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'availableDataElements', 'selectedDataElements' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'selectedDataElements', 'availableDataElements' )"/>
</td>
<td>
<select multiple id="selectedDataElements" name="selectedDataElements" style="min-width:325px; height:96px" ondblclick="moveSelectedById( 'selectedDataElements', 'availableDataElements' )">
@@ -83,27 +76,19 @@
<tr>
<th>$i18n.getString( "available_indicators" )</th>
<td></td>
- <th>$i18n.getString( "selected_indicators" )</th>
+ <th>$i18n.getString( "selected_indicators" )
+ <select id="indicatorsValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
</tr>
<tr>
<td>
- <select id="indicatorGroupId" name="indicatorGroupId" style="min-width:325px" onchange="getIndicators()">
- <option value="$ALL">[ $i18n.getString( "select_indicatorgroup_all" ) ]</option>
- #foreach ( $group in $indicatorGroups )
- <option value="$group.id">$group.name</option>
- #end
- </select><br>
- <select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:325px" ondblclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )">
- #foreach ( $indicator in $indicators )
- <option value="$indicator.id">$indicator.name</option>
- #end
- </select>
+ <select multiple size="6" id="availableIndicators" name="availableIndicators" style="min-width:325px"></select>
</td>
<td align="center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="moveSelectedById( 'availableIndicators', 'selectedIndicators' )"><br>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )"><br>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="moveAllById( 'availableIndicators', 'selectedIndicators' )"><br>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="moveAllById( 'selectedIndicators', 'availableIndicators' )">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'availableIndicators', 'selectedIndicators' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedIndicators', 'availableIndicators' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'availableIndicators', 'selectedIndicators' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'selectedIndicators', 'availableIndicators' )"/>
</td>
<td>
<select multiple id="selectedIndicators" name="selectedIndicators" style="min-width:325px; height:96px" ondblclick="moveSelectedById( 'selectedIndicators', 'availableIndicators' )">
@@ -122,7 +107,9 @@
<tr>
<th>$i18n.getString( "available_organisationunits" )</th>
<td></td>
- <th>$i18n.getString( "selected_organisationunits" )</th>
+ <th>$i18n.getString( "selected_organisationunits" )
+ <select id="organisationunitsValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
</tr>
<tr>
<td>
@@ -131,19 +118,15 @@
#foreach ( $level in $levels )
<option value="$level.level">$level.name</option>
#end
- </select><br>
- <select multiple size="6" id="availableOrganisationUnits" name="availableOrganisationUnits" style="min-width:325px" ondblclick="moveSelectedById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )">
- #foreach ( $unit in $organisationUnits )
- <option value="$unit.id">$encoder.htmlEncode( $unit.name )</option>
- #end
- </select>
+ </select><br/>
+ <select multiple size="6" id="availableOrganisationUnits" name="availableOrganisationUnits" style="min-width:325px"></select>
</td>
<td align="center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="moveSelectedById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"><br>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="moveSelectedById( 'selectedOrganisationUnits', 'availableOrganisationUnits' )"><br>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="moveAllById( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"><br>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="moveAllById( 'selectedOrganisationUnits', 'availableOrganisationUnits' )"><br>
- <input type="button" value=">>>" title="$i18n.getString('move_children')" style="width:40px" onclick="getOrganisationUnitChildren()">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedOrganisationUnits', 'availableOrganisationUnits' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'availableOrganisationUnits', 'selectedOrganisationUnits' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'selectedOrganisationUnits', 'availableOrganisationUnits' )"/><br/>
+ <input type="button" value=">>>" title="$i18n.getString('move_children')" style="width:40px" onclick="getOrganisationUnitChildren()"/>
</td>
<td>
<select multiple id="selectedOrganisationUnits" name="selectedOrganisationUnits" style="min-width:325px; height:96px" ondblclick="moveSelectedById( 'selectedOrganisationUnits', 'availableOrganisationUnits' )">
@@ -162,18 +145,20 @@
<tr>
<th>$i18n.getString( "available_periods" )</th>
<td></td>
- <th>$i18n.getString( "selected_periods" )</th>
+ <th>$i18n.getString( "selected_periods" )
+ <select id="periodsValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
</tr>
<tr>
<td>
- <input type="button" style="width:50px" value="$i18n.getString( 'prev' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '-1' )"><input
- type="button" style="width:50px" value="$i18n.getString( 'next' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '1' )">
+ <input type="button" style="width:50px" value="$i18n.getString( 'prev' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '-1' )"/><input
+ type="button" style="width:50px" value="$i18n.getString( 'next' )" onclick="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '1' )"/>
<select id="periodType" name="periodType" style="min-width:224px" onchange="getAvailablePeriods( 'periodType', 'availablePeriods', 'selectedPeriods', '0' )">
<option value="">[ $i18n.getString( "select_period_type_all" ) ]</option>
#foreach ( $type in $periodTypes )
<option value="$type.name">$i18n.getString( $type.name )</option>
#end
- </select><br>
+ </select><br/>
<select multiple size="6" id="availablePeriods" name="availablePeriods" style="min-width:325px" ondblclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )">
#foreach ( $period in $periods )
<option value="$period.externalId">$format.formatPeriod( $period )</option>
@@ -181,10 +166,10 @@
</select>
</td>
<td align="center">
- <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="moveSelectedById( 'availablePeriods', 'selectedPeriods' )"><br>
- <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )"><br>
- <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="moveAllById( 'availablePeriods', 'selectedPeriods' )"><br>
- <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="moveAllById( 'selectedPeriods', 'availablePeriods' )">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'availablePeriods', 'selectedPeriods' )"/><br/>
+ <input type="button" value="<" title="$i18n.getString('remove_selected')" style="width:40px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedPeriods', 'availablePeriods' )"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'availablePeriods', 'selectedPeriods' )"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:40px" onclick="dhisAjaxSelect_moveAll( 'selectedPeriods', 'availablePeriods' )"/>
</td>
<td>
<select multiple id="selectedPeriods" name="selectedPeriods" style="min-width:325px; height:96px" ondblclick="moveSelectedById( 'selectedPeriods', 'availablePeriods' )">
@@ -206,20 +191,20 @@
<tr>
<td colspan="3">
<label for="reportingMonth">$i18n.getString( "reporting_month" )</label>
- <input type="checkbox" id="reportingMonth" name="reportingMonth" value="true"#if( $!export.relatives.isReportingMonth() ) checked#end>
+ <input type="checkbox" id="reportingMonth" name="reportingMonth" value="true"#if( $!export.relatives.isReportingMonth() ) checked#end/>
<label for="monthsThisYear">$i18n.getString( "months_this_year" )</label>
- <input type="checkbox" id="monthsThisYear" name="monthsThisYear" value="true""#if( $!export.relatives.isMonthsThisYear() ) checked#end>
+ <input type="checkbox" id="monthsThisYear" name="monthsThisYear" value="true"#if( $!export.relatives.isMonthsThisYear() ) checked#end/>
<label for="quartersThisYear">$i18n.getString( "quarters_this_year" )</label>
- <input type="checkbox" id="quartersThisYear" name="quartersThisYear" value="true"#if( $!export.relatives.isQuartersThisYear() ) checked#end>
+ <input type="checkbox" id="quartersThisYear" name="quartersThisYear" value="true"#if( $!export.relatives.isQuartersThisYear() ) checked#end/>
<label for="thisYear">$i18n.getString( "this_year" )</label>
- <input type="checkbox" id="thisYear" name="thisYear" value="true"#if( $!export.relatives.isThisYear() ) checked#end><br><br>
+ <input type="checkbox" id="thisYear" name="thisYear" value="true"#if( $!export.relatives.isThisYear() ) checked#end/><br/><br/>
<label for="monthsLastYear">$i18n.getString( "months_last_year" )</label>
- <input type="checkbox" id="monthsLastYear" name="monthsLastYear" value="true""#if( $!export.relatives.isMonthsLastYear() ) checked#end>
+ <input type="checkbox" id="monthsLastYear" name="monthsLastYear" value="true"#if( $!export.relatives.isMonthsLastYear() ) checked#end/>
<label for="quartersLastYear">$i18n.getString( "quarters_last_year" )</label>
- <input type="checkbox" id="quartersLastYear" name="quartersLastYear" value="true"#if( $!export.relatives.isQuartersLastYear() ) checked#end>
+ <input type="checkbox" id="quartersLastYear" name="quartersLastYear" value="true"#if( $!export.relatives.isQuartersLastYear() ) checked#end/>
<label for="lastYear">$i18n.getString( "last_year" )</label>
- <input type="checkbox" id="lastYear" name="lastYear" value="true"#if( $!export.relatives.isLastYear() ) checked#end>
+ <input type="checkbox" id="lastYear" name="lastYear" value="true"#if( $!export.relatives.isLastYear() ) checked#end/>
</td>
</tr>
<tr>
@@ -229,8 +214,8 @@
<!-- Submit -->
<tr>
- <td><input type="button" value='$i18n.getString( "save" )' onclick="saveExport()" style="width:120px"><input
- type="button" value='$i18n.getString( "back" )' onclick="javascript:window.location.href='getDataMartExports.action'" style="width:120px"></ttd>
+ <td><input type="submit" value='$i18n.getString( "save" )' style="width:120px"/><input
+ type="button" value='$i18n.getString( "back" )' onclick="javascript:window.location.href='getDataMartExports.action'" style="width:120px"/></td>
<td></td>
<td></td>
</tr>
=== added file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/addUpdateDatamart.js 2011-10-01 09:05:47 +0000
@@ -0,0 +1,157 @@
+// -----------------------------------------------------------------------------
+// After the page loaded completely
+// -----------------------------------------------------------------------------
+
+jQuery( document ).ready( function() {
+
+ /* Validates the required fields */
+ validation2( 'exportForm', function ( form )
+ {
+ form.submit();
+ }, {
+ 'beforeValidateHandler': function()
+ {
+ listValidator( 'dataelementsValidator', 'selectedDataElements' );
+ listValidator( 'indicatorsValidator', 'selectedIndicators' );
+ listValidator( 'organisationunitsValidator', 'selectedOrganisationUnits' );
+ listValidator( 'periodsValidator', 'selectedPeriods' );
+ },
+ 'rules': getValidationRules( 'dataMart' )
+ } );
+
+ checkValueIsExist( "name", "validateDataMartExport.action", {
+ id: getFieldValue( "id" )
+ } );
+
+ /* Loads the available data elements */
+ jQuery("#availableDataElements").dhisAjaxSelect({
+ source: "../dhis-web-commons-ajax-json/getDataElements.action",
+ iterator: "dataElements",
+ connectedTo: "selectedDataElements",
+ handler: function(item) {
+ var option = jQuery("<option data-id='" + item.groups + "'/>");
+ 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>";
+ }
+ }
+ });
+
+ /* Loads the available indicators */
+ jQuery("#availableIndicators").dhisAjaxSelect({
+ source: "../dhis-web-commons-ajax-json/getIndicators.action",
+ iterator: "indicators",
+ connectedTo: "selectedIndicators",
+ handler: function(item) {
+ var option = jQuery("<option data-id='" + item.groups + "'/>");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ },
+ filter: {
+ source: "../dhis-web-commons-ajax-json/getIndicatorGroups.action",
+ label: 'indicator group',
+ iterator: 'indicatorGroups',
+ handler: function(item) {
+ return "<option data-key='id' data-value='"+ item.id +"'>" + item.name + "</option>";
+ }
+ }
+ });
+
+ /* Loads the available organisation units */
+ jQuery("#availableOrganisationUnits").dhisAjaxSelect({
+ source: "../dhis-web-commons-ajax-json/getOrganisationUnits.action",
+ iterator: "organisationUnits",
+ connectedTo: "selectedOrganisationUnits",
+ handler: function(item) {
+ var option = jQuery("<option/>");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+});
+
+// -----------------------------------------------------------------------------
+// Data retrieval methods
+// -----------------------------------------------------------------------------
+
+function getOrganisationUnits()
+{
+ var organisationUnitLevel = getFieldValue( 'organisationUnitLevel' );
+ var filterInput = jQuery( "#availableOrganisationUnits_filter_input" );
+
+ if ( organisationUnitLevel != null )
+ {
+ if ( organisationUnitLevel != 0 ) {
+ filterInput.attr( 'disabled', 'disabled' );
+ } else {
+ filterInput.removeAttr( 'disabled' );
+ }
+
+ jQuery.postJSON( '../dhis-web-commons-ajax-json/getOrganisationUnits.action',
+ { level: organisationUnitLevel }, function ( json ) {
+
+ var availableOrganisationUnits = byId( "availableOrganisationUnits" );
+ var selectedOrganisationUnits = byId( "selectedOrganisationUnits" );
+
+ clearList( availableOrganisationUnits );
+
+ var units = json.organisationUnits;
+
+ for ( var i = 0; i < units.length; i++ )
+ {
+ var id = units[ i ].id;
+ var name = units[ i ].name;
+
+ if ( listContains( selectedOrganisationUnits, id ) == false )
+ {
+ var option = document.createElement( "option" );
+ option.value = id;
+ option.text = name;
+ availableOrganisationUnits.add( option, null );
+ }
+ }
+ });
+ }
+}
+
+function getOrganisationUnitChildren()
+{
+ var organisationUnitId = getFieldValue( 'availableOrganisationUnits' );
+
+ if ( organisationUnitId != null )
+ {
+ jQuery.postJSON( '../dhis-web-commons-ajax-json/getOrganisationUnitChildren.action',
+ { id: organisationUnitId }, function ( json ) {
+
+ var selectedOrganisationUnits = byId( "selectedOrganisationUnits" );
+ var units = json.organisationUnits;
+
+ for ( var i = 0; i < units.length; i++ )
+ {
+ var id = units[ i ].id;
+ var name = units[ i ].name;
+
+ if ( listContains( selectedOrganisationUnits, id ) == false )
+ {
+ var option = document.createElement( "option" );
+ option.value = id;
+ option.text = name;
+ selectedOrganisationUnits.add( option, null );
+ }
+ }
+ });
+ }
+}
+
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2011-09-29 06:40:09 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2011-10-01 09:05:47 +0000
@@ -1,166 +1,3 @@
-
-// -----------------------------------------------------------------------------
-// Data retrieval methods
-// -----------------------------------------------------------------------------
-
-function getDataElements()
-{
- var dataElementGroupList = document.getElementById( "dataElementGroupId" );
- var dataElementGroupId = dataElementGroupList.options[ dataElementGroupList.selectedIndex ].value;
-
- if ( dataElementGroupId != null )
- {
- var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + dataElementGroupId + "&aggregate=true";
-
- var request = new Request();
- request.setResponseTypeXML( 'dataElement' );
- request.setCallbackSuccess( getDataElementsReceived );
- request.send( url );
- }
-}
-
-function getIndicators()
-{
- 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( getIndicatorsReceived );
- request.send( url );
- }
-}
-
-function getOrganisationUnits()
-{
- var organisationUnitLevelList = document.getElementById( "organisationUnitLevel" );
- var organisationUnitLevel = organisationUnitLevelList.options[ organisationUnitLevelList.selectedIndex ].value;
-
- if ( organisationUnitLevel != null )
- {
- var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
-
- var request = new Request();
- request.setResponseTypeXML( 'organisationUnit' );
- request.setCallbackSuccess( getOrganisationUnitsReceived );
- request.send( url );
- }
-}
-
-function getOrganisationUnitChildren()
-{
- var organisationUnitList = document.getElementById( "availableOrganisationUnits" );
- var organisationUnitId = organisationUnitList.options[ organisationUnitList.selectedIndex ].value;
-
- if ( organisationUnitId != null )
- {
- var url = "../dhis-web-commons-ajax/getOrganisationUnitChildren.action?id=" + organisationUnitId;
-
- var request = new Request();
- request.setResponseTypeXML( 'organisationUnit' );
- request.setCallbackSuccess( getOrganisationUnitChildrenReceived );
- request.send( url );
- }
-}
-
-function getDataElementsReceived( xmlObject )
-{
- var availableDataElements = document.getElementById( "availableDataElements" );
- var selectedDataElements = document.getElementById( "selectedDataElements" );
-
- clearList( availableDataElements );
-
- var dataElements = xmlObject.getElementsByTagName( "dataElement" );
-
- for ( var i = 0; i < dataElements.length; i++ )
- {
- var id = dataElements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
- var dataElementName = dataElements[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-
- if ( listContains( selectedDataElements, id ) == false )
- {
- var option = document.createElement( "option" );
- option.value = id;
- option.text = dataElementName;
- availableDataElements.add( option, null );
- }
- }
-}
-
-function getIndicatorsReceived( xmlObject )
-{
- var availableIndicators = document.getElementById( "availableIndicators" );
- var selectedIndicators = document.getElementById( "selectedIndicators" );
-
- clearList( availableIndicators );
-
- var indicators = xmlObject.getElementsByTagName( "indicator" );
-
- 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;
-
- if ( listContains( selectedIndicators, id ) == false )
- {
- var option = document.createElement( "option" );
- option.value = id;
- option.text = indicatorName;
- availableIndicators.add( option, null );
- }
- }
-}
-
-function getOrganisationUnitsReceived( xmlObject )
-{
- var availableOrganisationUnits = document.getElementById( "availableOrganisationUnits" );
- var selectedOrganisationUnits = document.getElementById( "selectedOrganisationUnits" );
-
- clearList( availableOrganisationUnits );
-
- var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-
- for ( var i = 0; i < organisationUnits.length; i++ )
- {
- var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
- var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-
- if ( listContains( selectedOrganisationUnits, id ) == false )
- {
- var option = document.createElement( "option" );
- option.value = id;
- option.text = organisationUnitName;
- availableOrganisationUnits.add( option, null );
- }
- }
-}
-
-function getOrganisationUnitChildrenReceived( xmlObject )
-{
- var selectedOrganisationUnits = document.getElementById( "selectedOrganisationUnits" );
-
- var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-
- for ( var i = 0; i < organisationUnits.length; i++ )
- {
- var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-
- var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-
- if ( listContains( selectedOrganisationUnits, id ) == false )
- {
- var option = document.createElement( "option" );
- option.value = id;
- option.text = organisationUnitName;
- selectedOrganisationUnits.add( option, null );
- }
- }
-}
-
// -----------------------------------------------------------------------------
// DataMartExport details
// -----------------------------------------------------------------------------
@@ -179,62 +16,22 @@
}
// -----------------------------------------------------------------------------
-// DatmartExport
-// -----------------------------------------------------------------------------
-
-function saveExport()
-{
- if ( validateCollections() )
- {
- jQuery.postJSON( 'validateDataMartExport.action', {
- id: getFieldValue( "id" ),
- name: getFieldValue( "name" )
- }, function ( json ) {
- if ( json.response == "input" )
- {
- setMessage( json.message );
- }
- else if ( json.response == "success" )
- {
- selectAllById( "selectedDataElements" );
- selectAllById( "selectedIndicators" );
- selectAllById( "selectedOrganisationUnits" );
- selectAllById( "selectedPeriods" );
-
- byId( "exportForm" ).submit();
- }
- });
- }
-}
-
-// -----------------------------------------------------------------------------
// Export
// -----------------------------------------------------------------------------
function getExportStatus()
{
- var url = "getExportStatus.action";
+ jQuery.get( 'getExportStatus.action', {}, function ( json ) {
- var request = new Request();
- request.setResponseTypeXML( 'status' );
- request.setCallbackSuccess( exportStatusReceived );
- request.send( url );
-}
-
-function exportStatusReceived( xmlObject )
-{
- var message = getElementValue( xmlObject, "message" );
- var running = getElementValue( xmlObject, "running" );
-
- if ( running == "true" )
- {
- setWaitMessage( message );
- waitAndGetExportStatus( 2000 );
- }
- else
- {
- setMessage( message );
- }
+ var message = json.status.message;
+
+ if ( json.status.running == "true" )
+ {
+ setWaitMessage( message );
+ waitAndGetExportStatus( 2000 );
+ }
+ else setMessage( message );
+ });
}
function waitAndGetExportStatus( millis )
@@ -252,40 +49,5 @@
function removeDatamartExport( exportId, exportName )
{
- var result = window.confirm( i18n_confirm_delete + '\n\n' + exportName );
-
- if ( result )
- {
- window.location.href = 'removeDataMartExport.action?id=' + exportId;
- }
-}
-
-// -----------------------------------------------------------------------------
-// Validation
-// -----------------------------------------------------------------------------
-
-function validateCollections()
-{
- if ( !hasElements( "selectedDataElements" ) && !hasElements( "selectedIndicators" ) )
- {
- setMessage( i18n_must_select_at_least_one_dataelement_or_indicator );
-
- return false;
- }
-
- if ( !hasElements( "selectedOrganisationUnits" ) )
- {
- setMessage( i18n_must_select_at_least_one_organisation_unit );
-
- return false;
- }
-
- if ( !hasElements( "selectedPeriods" ) && relativePeriodsChecked() == false )
- {
- setMessage( i18n_must_select_at_least_one_period );
-
- return false;
- }
-
- return true;
-}
+ removeItem( exportId, exportName, i18n_confirm_delete, 'removeDataMartExport.action' );
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonExportStatus.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonExportStatus.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonExportStatus.vm 2011-10-01 09:05:47 +0000
@@ -0,0 +1,6 @@
+{ "status":
+ {
+ "message": "$!{encoder.htmlEncode( ${message} )}",
+ "running": "$!{running}"
+ }
+}
=== removed file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseExportStatus.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseExportStatus.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseExportStatus.vm 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<status>
- <message>$encoder.htmlEncode( $message )</message>
- <running>$running</running>
-</status>
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/viewExportForm.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/viewExportForm.vm 2011-03-18 12:48:40 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/viewExportForm.vm 2011-10-01 09:05:47 +0000
@@ -29,7 +29,7 @@
</thead>
<tbody id="list">
#foreach( $export in $exports )
- <tr>
+ <tr id="tr${export.id}">
<td onclick="showDataMartExportDetails( $export.id )">$encoder.htmlEncode( $export.name )</td>
<td style="text-align:center">
<a href="exportDataMartExport.action?id=$export.id" title="$i18n.getString( 'export' )"><img src="../images/start_process.png" alt="$i18n.getString( 'export' )"/></a>