dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #11176
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3154: Fixed BUG #741600: Redirect to correct page after cancel. Also added generic functionality in com...
------------------------------------------------------------
revno: 3154
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-03-24 14:32:53 +0100
message:
Fixed BUG #741600: Redirect to correct page after cancel. Also added generic functionality in commons.js to go back based on referrer.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.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/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-03-23 21:30:01 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-03-24 13:32:53 +0000
@@ -6,6 +6,22 @@
var headerMessageTimeout = -1;
/**
+ * Go back using the document.referrer.
+ *
+ * @param defaultUrl
+ * if there is not document.referrer, use this url
+ */
+function referrerBack( defaultUrl ) {
+ if(document.referrer != "") {
+ var splitReferrer = document.referrer.split("\/");
+ var referrer = splitReferrer[splitReferrer.length-1];
+ location.href = referrer;
+ } else {
+ location.href = defaultUrl;
+ }
+}
+
+/**
* Redirects to the translate GUI.
*
* @param className
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2011-03-14 21:10:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/addUserForm.vm 2011-03-24 13:32:53 +0000
@@ -78,7 +78,7 @@
<td></td>
<td valign="top">
<input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
- <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='user.action'" style="width:10em"/>
+ <input type="button" id="cancel" value="$i18n.getString( 'cancel' )" style="width:10em"/>
</td>
<td></td>
<td></td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js 2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/addUserForm.js 2011-03-24 13:32:53 +0000
@@ -60,4 +60,8 @@
/* remote validation */
checkValueIsExist( "username", "validateUser.action" );
+
+ jQuery("#cancel").click(function() {
+ referrerBack( "alluser.action" );
+ });
} );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserForm.js 2011-03-23 08:45:29 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/javascript/updateUserForm.js 2011-03-24 13:32:53 +0000
@@ -51,4 +51,7 @@
jQuery( "#email" ).attr( "maxlength", r.user.email.rangelength[1] );
jQuery( "#phoneNumber" ).attr( "maxlength", r.user.phone.rangelength[1] );
+ jQuery("#cancel").click(function() {
+ referrerBack( "alluser.action" );
+ });
} );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2011-03-22 09:35:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/webapp/dhis-web-maintenance-user/updateUserForm.vm 2011-03-24 13:32:53 +0000
@@ -84,7 +84,10 @@
</tr>
<tr>
<td></td>
- <td valign="top"><input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/><input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='user.action'" style="width:10em"/></td>
+ <td valign="top">
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" id="cancel" value="$i18n.getString( 'cancel' )" style="width:10em"/>
+ </td>
</tr>
</table>
</form>