[BUGFIX] Blank page after Save+Close in page settings
authorStefan Galinski <stefan.galinski@gmail.com>
Thu, 23 Feb 2012 22:16:56 +0000 (23:16 +0100)
committerTolleiv Nietsch <info@tolleiv.de>
Sat, 24 Mar 2012 09:38:52 +0000 (10:38 +0100)
Change-Id: Idd7647e0e1aaee607203f64c421d6ca235920268
Fixes: #33791
Releases: 4.8, 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/9830
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
t3lib/js/extjs/components/pagetree/javascript/actions.js
t3lib/js/extjs/util.js

index 1dbb5b0..df9875b 100644 (file)
@@ -327,8 +327,15 @@ TYPO3.Components.PageTree.Actions = {
         */
        editPageProperties: function(node) {
                node.select();
+               var returnUrl = TYPO3.Backend.ContentContainer.src;
+               if (returnUrl.indexOf('returnUrl') !== -1) {
+                       returnUrl = TYPO3.Utility.getParameterFromUrl(returnUrl, 'returnUrl');
+               } else {
+                       returnUrl = encodeURIComponent(returnUrl);
+               }
+
                TYPO3.Backend.ContentContainer.setUrl(
-                       'alt_doc.php?edit[pages][' + node.attributes.nodeData.id + ']=edit'
+                       'alt_doc.php?edit[pages][' + node.attributes.nodeData.id + ']=edit&returnUrl=' + returnUrl
                );
        },
 
index 3c7b3f2..b6f8470 100644 (file)
@@ -45,5 +45,33 @@ TYPO3.Utility = {
         */
        isNumber: function(number) {
                return !isNaN(parseFloat(number)) && isFinite(number);
+       },
+
+       /**
+        * Gets a parameter from a given url
+        *
+        * @param {string} url
+        * @param {string} parameter
+        * @return {string}
+        */
+       getParameterFromUrl: function(url, parameter) {
+         var parts = url.split('?'),
+                 value = '';
+
+         if (parts.length >= 2) {
+                 var urlBase = parts.shift();
+                 var queryString = parts.join('?');
+
+                 var prefix = encodeURIComponent(parameter) + '=';
+                 var parameters = queryString.split(/[&;]/g);
+                 for (var i = parameters.length; i-- > 0;) {
+                         if (parameters[i].lastIndexOf(prefix, 0) !== -1) {
+                                 value = parameters[i].split('=')[1];
+                                 break;
+                         }
+                 }
+         }
+
+         return value;
        }
 };