← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5945: Impl solution for returning back to the same page in the list after updating an object

 

------------------------------------------------------------
revno: 5945
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-13 21:04:18 +0100
message:
  Impl solution for returning back to the same page in the list after updating an object
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ContextInterceptor.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml
  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-organisationunit/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml


--
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/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2012-02-13 20:04:18 +0000
@@ -1516,8 +1516,11 @@
 
 function pagingList( currentPage, pageSize )
 {
+	jQuery.cookie( "currentPage", currentPage );
+	
 	var baseLink = jQuery( "#baseLink" ).val();	
 	var url = baseLink + 'currentPage=' + currentPage + '&pageSize=' + pageSize;
+	
 	window.location.href = url;
 }
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ContextInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ContextInterceptor.java	2012-02-08 16:08:43 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/ContextInterceptor.java	2012-02-13 20:04:18 +0000
@@ -27,9 +27,12 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import static org.hisp.dhis.util.ContextUtils.getCookieValue;
+
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.struts2.ServletActionContext;
 import org.hisp.dhis.system.database.DatabaseInfoProvider;
 import org.hisp.dhis.system.util.TextUtils;
 
@@ -44,6 +47,7 @@
 {
     private static final String KEY_IN_MEMORY_DATABASE = "inMemoryDatabase";
     private static final String KEY_TEXT_UTILS = "dhisTextUtils";
+    private static final String KEY_CURRENT_PAGE = "keyCurrentPage";
     
     private DatabaseInfoProvider databaseInfoProvider;
 
@@ -70,6 +74,7 @@
         
         map.put( KEY_IN_MEMORY_DATABASE, databaseInfoProvider.isInMemory() );
         map.put( KEY_TEXT_UTILS, TextUtils.INSTANCE );
+        map.put( KEY_CURRENT_PAGE, getCookieValue( ServletActionContext.getRequest(), "currentPage" ) );
         
         invocation.getStack().push( map );
         

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml	2012-02-13 20:04:18 +0000
@@ -71,7 +71,7 @@
     </action>
 
     <action name="updateDataElement" class="org.hisp.dhis.dd.action.dataelement.UpdateDataElementAction">
-      <result name="success" type="redirect">dataElement.action</result>
+      <result name="success" type="redirect">dataElement.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
     </action>
 
@@ -160,7 +160,7 @@
     </action>
 
     <action name="updateDataElementGroup" class="org.hisp.dhis.dd.action.dataelementgroup.UpdateDataElementGroupAction">
-      <result name="success" type="redirect">dataElementGroup.action</result>
+      <result name="success" type="redirect">dataElementGroup.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATAELEMENTGROUP_UPDATE</param>
     </action>
 
@@ -205,7 +205,7 @@
     </action>
 
     <action name="updateDataElementGroupSet" class="org.hisp.dhis.dd.action.dataelementgroupset.UpdateDataElementGroupSetAction">
-      <result name="success" type="redirect">dataElementGroupSet.action</result>
+      <result name="success" type="redirect">dataElementGroupSet.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATAELEMENTGROUPSET_UPDATE</param>
     </action>
 
@@ -280,7 +280,7 @@
     </action>
 
     <action name="updateIndicator" class="org.hisp.dhis.dd.action.indicator.UpdateIndicatorAction">
-      <result name="success" type="redirect">indicator.action</result>
+      <result name="success" type="redirect">indicator.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_INDICATOR_UPDATE</param>
     </action>
 
@@ -373,7 +373,7 @@
     </action>
 
     <action name="updateIndicatorGroup" class="org.hisp.dhis.dd.action.indicatorgroup.UpdateIndicatorGroupAction">
-      <result name="success" type="redirect">indicatorGroup.action</result>
+      <result name="success" type="redirect">indicatorGroup.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_INDICATORGROUP_UPDATE</param>
     </action>
 
@@ -413,7 +413,7 @@
     </action>
 
     <action name="updateIndicatorGroupSet" class="org.hisp.dhis.dd.action.indicatorgroupset.UpdateIndicatorGroupSetAction">
-      <result name="success" type="redirect">indicatorGroupSet.action</result>
+      <result name="success" type="redirect">indicatorGroupSet.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_INDICATORGROUPSET_UPDATE</param>
     </action>
 
@@ -480,7 +480,7 @@
     </action>
 
     <action name="updateIndicatorType" class="org.hisp.dhis.dd.action.indicatortype.UpdateIndicatorTypeAction">
-      <result name="success" type="redirect">indicatorType.action</result>
+      <result name="success" type="redirect">indicatorType.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_INDICATORTYPE_UPDATE</param>
     </action>
 
@@ -541,7 +541,7 @@
     </action>
 
     <action name="updateDataDictionary" class="org.hisp.dhis.dd.action.datadictionary.UpdateDataDictionaryAction">
-      <result name="success" type="redirect">dataDictionary.action</result>
+      <result name="success" type="redirect">dataDictionary.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATADICTIONARY_UPDATE</param>
     </action>
 
@@ -589,7 +589,7 @@
     </action>
 
     <action name="updateDataElementCategory" class="org.hisp.dhis.dd.action.category.UpdateDataElementCategoryAction">
-      <result name="success" type="redirect">category.action</result>
+      <result name="success" type="redirect">category.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
     </action>
 
@@ -611,14 +611,6 @@
       <param name="requiredAuthorities">F_DATAELEMENT_DELETE</param>
     </action>
 
-    <!--
-    <action name="showCategoryEditor" class="org.hisp.dhis.dd.action.category.ShowCategoryEditorAction">
-      <result name="success" type="velocity">/main.vm</result>
-      <param name="page">/dhis-web-maintenance-datadictionary/multidimensional/showCategoryEditor.vm</param>
-	  <param name="javascripts">javascript/category.js</param>
-      <param name="requiredAuthorities">F_DATAELEMENT_ADD</param>
-    </action> -->
-
     <!-- CategoryOption -->
 
     <action name="addDataElementCategoryOption" class="org.hisp.dhis.dd.action.category.AddDataElementCategoryOptionAction">
@@ -681,7 +673,7 @@
     </action>
 
     <action name="updateDataElementCategoryCombo" class="org.hisp.dhis.dd.action.categorycombo.UpdateDataElementCategoryComboAction">
-      <result name="success" type="redirect">categoryCombo.action</result>
+      <result name="success" type="redirect">categoryCombo.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATAELEMENT_UPDATE</param>
     </action>
 
@@ -778,7 +770,7 @@
     </action>
 
     <action name="updateConceptInstance" class="org.hisp.dhis.dd.action.concept.UpdateConceptAction">
-      <result name="success" type="redirect">concept.action</result>
+      <result name="success" type="redirect">concept.action?currentPage=${keyCurrentPage}</result>
       <result name="error" type="redirect">index.action</result>
       <param name="requiredAuthorities">F_CONCEPT_UPDATE</param>
     </action>

=== 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	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml	2012-02-13 20:04:18 +0000
@@ -111,7 +111,7 @@
       <result name="success" type="redirect">dataSet.action</result>
     </action>
 
-		<!-- Show add DataSet form -->
+	<!-- Show add DataSet form -->
 
     <action name="addDataSetForm" class="org.hisp.dhis.dataset.action.PeriodTypeListAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -143,7 +143,7 @@
     </action>
 
     <action name="updateDataSet" class="org.hisp.dhis.dataset.action.UpdateDataSetAction">
-      <result name="success" type="redirect">dataSet.action</result>
+      <result name="success" type="redirect">dataSet.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_DATASET_UPDATE</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml	2012-02-13 20:04:18 +0000
@@ -67,8 +67,7 @@
     </action>
 
     <action name="updateOrganisationUnit" class="org.hisp.dhis.oum.action.organisationunit.UpdateOrganisationUnitAction">
-      <result name="success" type="redirect">organisationUnit.action
-      </result>
+      <result name="success" type="redirect">organisationUnit.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_ORGANISATIONUNIT_UPDATE</param>
     </action>
 
@@ -137,8 +136,7 @@
     </action>
 
     <action name="updateOrganisationUnitGroup" class="org.hisp.dhis.oum.action.organisationunitgroup.UpdateOrganisationUnitGroupAction">
-      <result name="success" type="redirect">organisationUnitGroup.action
-      </result>
+      <result name="success" type="redirect">organisationUnitGroup.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_ORGUNITGROUP_UPDATE</param>
     </action>
 
@@ -211,8 +209,7 @@
     </action>
 
     <action name="updateOrganisationUnitGroupSet" class="org.hisp.dhis.oum.action.organisationunitgroupset.UpdateGroupSetAction">
-      <result name="success" type="redirect">organisationUnitGroupSet.action
-      </result>
+      <result name="success" type="redirect">organisationUnitGroupSet.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_ORGUNITGROUPSET_UPDATE</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/struts.xml	2012-02-13 20:04:18 +0000
@@ -67,7 +67,7 @@
 
     <action name="updateUser" class="org.hisp.dhis.user.action.UpdateUserAction">
       <result name="success" type="redirect">alluser.action</result>
-      <result name="error" type="redirect">showUpdateUserForm.action</result>
+      <result name="error" type="redirect">showUpdateUserForm.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_USER_UPDATE</param>
     </action>
 
@@ -145,7 +145,7 @@
 
     <action name="updateRole" class="org.hisp.dhis.user.action.UpdateRoleAction">
       <result name="success" type="redirect">allRole.action</result>
-      <result name="error" type="redirect">showUpdateRoleForm.action</result>
+      <result name="error" type="redirect">showUpdateRoleForm.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_USERROLE_UPDATE</param>
     </action>
 
@@ -165,7 +165,7 @@
       <result name="logout" type="redirect">/dhis-web-commons-security/logout.action</result>
     </action>
 
-  <!-- User Group -->
+	<!-- User Group -->
 
     <action name="getAllUserGroups" class="org.hisp.dhis.user.action.GetUserGroupListAction">
       <result name="success" type="velocity">/main.vm</result>
@@ -202,7 +202,8 @@
     </action>
 
     <action name="updateUserGroup" class="org.hisp.dhis.user.action.UpdateUserGroupAction">
-      <result name="success" type="redirect">getAllUserGroups.action</result>
+      <result name="success" type="redirect">getAllUserGroups.action?currentPage=${keyCurrentPage}</result>
+      <param name="requiredAuthorities">F_USER_GRUP_UPDATE</param>
     </action>
 
     <action name="removeUserGroup" class="org.hisp.dhis.user.action.RemoveUserGroupAction">
@@ -218,6 +219,7 @@
     </action>
 
     <!-- Json Actions -->
+	
     <action name="getSystemAuthorities" class="org.hisp.dhis.user.action.GetSystemAuthoritiesAction">
       <result name="success" type="velocity-json">
         /dhis-web-maintenance-user/ajax/jsonSystemAuthorities.vm</result>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2012-02-13 19:27:46 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml	2012-02-13 20:04:18 +0000
@@ -68,7 +68,7 @@
     </action>
 
     <action name="updateValidationRule" class="org.hisp.dhis.validationrule.action.UpdateValidationRuleAction">
-      <result name="success" type="redirect">validationRule.action</result>
+      <result name="success" type="redirect">validationRule.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_VALIDATIONRULE_UPDATE</param>
     </action>
 
@@ -118,7 +118,7 @@
     </action>
 
     <action name="updateValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.UpdateValidationRuleGroupAction">
-      <result name="success" type="redirect">showValidationRuleGroupForm.action</result>
+      <result name="success" type="redirect">showValidationRuleGroupForm.action?currentPage=${keyCurrentPage}</result>
       <param name="requiredAuthorities">F_VALIDATIONRULEGROUP_UPDATE</param>
     </action>