dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07764
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2277: Fix bug: The message "Values Generated successfully" remains on selecting other dataset and after...
------------------------------------------------------------
revno: 2277
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-09-30 12:37:41 +0700
message:
Fix bug: The message "Values Generated successfully" remains on selecting other dataset and after going back.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/minMaxValidation.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java 2010-09-06 13:06:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GenerateMinMaxValuesAction.java 2010-09-30 05:37:41 +0000
@@ -130,11 +130,11 @@
public String execute()
throws Exception
{
- if ( dataSetIds == null )
- {
- selectionTreeManager.clearSelectedOrganisationUnits();
- return INPUT;
- }
+// if ( dataSetIds == null )
+// {
+// selectionTreeManager.clearSelectedOrganisationUnits();
+// return INPUT;
+// }
Collection<OrganisationUnit> orgUnits = selectionTreeManager.getReloadedSelectedOrganisationUnits();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java 2010-09-21 12:42:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/GetMinMaxValidationParamsAction.java 2010-09-30 05:37:41 +0000
@@ -28,12 +28,9 @@
*/
import java.util.Collection;
-import java.util.List;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import com.opensymphony.xwork2.Action;
@@ -68,32 +65,6 @@
return dataSets;
}
- private List<OrganisationUnitLevel> levels;
-
- public List<OrganisationUnitLevel> getLevels()
- {
- return levels;
- }
-
- private String message;
-
- public String getMessage()
- {
- return message;
- }
-
- public void setMessage( String message )
- {
- this.message = message;
- }
-
- private Collection<OrganisationUnitGroup> orgunitGroups;
-
- public Collection<OrganisationUnitGroup> getOrgunitGroups()
- {
- return orgunitGroups;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java 2010-08-28 12:24:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/minmaxvalidation/RemoveMinMaxValueAction.java 2010-09-30 05:37:41 +0000
@@ -128,14 +128,7 @@
@Override
public String execute()
throws Exception
- {
- if ( dataSetIds == null )
- {
- message = i18n.getString( "not_choose_dataset" );
- organisationUnitSelectionManager.clearSelectedOrganisationUnits();
- return INPUT;
- }
-
+ {
Collection<OrganisationUnit> orgUnits = organisationUnitSelectionManager.getSelectedOrganisationUnits();
if ( orgUnits == null || orgUnits.size() ==0 )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2010-09-23 07:35:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2010-09-30 05:37:41 +0000
@@ -274,23 +274,23 @@
<!-- Min/Max validation -->
- <action name="getMinMaxValidationParams"
+ <action name="generateMinMaxValue"
class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GenerateMinMaxValuesAction">
- <result name="success" type="chain">
- getMinMaxValidationParamsChain</result>
- <result name="input" type="chain">
- getMinMaxValidationParamsChain</result>
+ <result name="success" type="velocity-xml">
+ /dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+ <result name="input" type="velocity-xml">
+ /dhis-web-maintenance-dataadmin/responseError.vm</result>
</action>
<action name="removeMinMaxValue"
class="org.hisp.dhis.dataadmin.action.minmaxvalidation.RemoveMinMaxValueAction">
- <result name="success" type="chain">
- getMinMaxValidationParamsChain</result>
- <result name="input" type="chain">
- getMinMaxValidationParamsChain</result>
+ <result name="success" type="velocity-xml">
+ /dhis-web-maintenance-dataadmin/responseSuccess.vm</result>
+ <result name="input" type="velocity-xml">
+ /dhis-web-maintenance-dataadmin/responseError.vm</result>
</action>
- <action name="getMinMaxValidationParamsChain"
+ <action name="getMinMaxValidationParams"
class="org.hisp.dhis.dataadmin.action.minmaxvalidation.GetMinMaxValidationParamsAction">
<!-- <interceptor-ref name="organisationUnitTreeStack"/> -->
<result name="success" type="velocity">/main.vm</result>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js 2010-09-21 12:42:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/minMaxValidation.js 2010-09-30 05:37:41 +0000
@@ -1,3 +1,15 @@
+function generateMinMaxValue(){
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( minMaxValueCompleted );
+ request.sendAsPost(getParamString('dataSetIds'));
+ request.send( 'generateMinMaxValue.action' );
+}
+
+function minMaxValueCompleted( xmlObject ) {
+ setMessage( xmlObject.firstChild.nodeValue );
+ return false;
+}
//-----------------------------------------------------------------------------------
// Default Min/Max values
//-----------------------------------------------------------------------------------
@@ -15,16 +27,6 @@
setMessage(xmlObject.firstChild.nodeValue);
}
-function validateForm(){
- if(byId('dataSetIds').value=='')
- {
- setMessage(i18n_not_choose_dataset);
- return false;
- }
-
- document.getElementById( 'minMaxGeneratingForm' ).submit();
-}
-
//------------------------------------------------------------------------------
// Save factor
//------------------------------------------------------------------------------
@@ -45,7 +47,11 @@
//-----------------------------------------------------------------------------------
function removeMinMaxValue(){
- var form = byId("minMaxGeneratingForm");
- form.action = "removeMinMaxValue.action"
- form.submit();
+
+ var request = new Request();
+ request.setResponseTypeXML( 'xmlObject' );
+ request.setCallbackSuccess( minMaxValueCompleted );
+ request.sendAsPost(getParamString('dataSetIds'));
+ request.send( 'removeMinMaxValue.action' );
+
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/minMaxValidation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/minMaxValidation.vm 2010-09-21 12:42:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/minMaxValidation.vm 2010-09-30 05:37:41 +0000
@@ -1,5 +1,5 @@
<script>
-
+var isGenerate = true;
//-----------------------------------------------------------------------
//init jQuery validation for reportAssociation
//-----------------------------------------------------------------------
@@ -9,14 +9,14 @@
jQuery("#minMaxGeneratingForm").validate({
meta:"validate"
,errorElement:"td"
- ,beforeValidateHandler : function()
- {
-
- }
,submitHandler: function(form)
- {
- validateForm();
- }
+ {
+ if(isGenerate){
+ generateMinMaxValue();
+ }else{
+ removeMinMaxValue();
+ }
+ }
});
}
);
@@ -25,27 +25,25 @@
<h3>$i18n.getString( "min_max_value_generation" )</h3>
-<input type="hidden" id="curLocaleCode" value="$locale.getLanguage()_$locale.getCountry()"/>
-
-<form id="minMaxGeneratingForm" action="getMinMaxValidationParams.action" method="POST">
+<form id="minMaxGeneratingForm" method="POST">
<table>
<tr>
<th colspan="2">$i18n.getString('available_dataset')</th>
<td rowspan="2">#organisationUnitSelectionTree( false, true, false ) </td>
</tr>
<tr>
- <td colspan="2" rowspan="2"> <select size="26px" multiple style="width:30em" id='dataSetIds' name='dataSetIds'>
-
- #foreach( $dataSet in $dataSets )
- <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.name )</option>
- #end
-
- </select></td>
+ <td colspan="2" rowspan="2">
+ <select size="26px" multiple style="width:30em" id='dataSetIds' name='dataSetIds' class="{validate:{required:true}}">
+ #foreach( $dataSet in $dataSets )
+ <option value="$dataSet.id">$encoder.htmlEncode( $dataSet.name )</option>
+ #end
+ </select>
+ </td>
</td>
</tr>
<tr>
- <td><input type="submit" id="submitButton" style="width:10em" value="$i18n.getString( 'generate' )">
- <input type="button" onclick="removeMinMaxValue()" id="" style="width:10em" value="$i18n.getString( 'remove' )"/>
+ <td><input type="submit" id="saveButton" onclick="javascipt: isGenerate = true;" style="width:10em" value="$i18n.getString( 'generate' )">
+ <input type="submit" id="removeButton" onclick="javascipt: isGenerate = false;" style="width:10em" value="$i18n.getString( 'remove' )"/>
<input type="button"" style="width:10em" onClick="window.location.href='index.action'" value="$i18n.getString( 'cancel' )"/></td>
</tr>
</table>