[CLEANUP] Cleanup jumpToUrl() and unused JS in Backend 80/28180/4
authorBenjamin Mack <benni@typo3.org>
Sat, 8 Mar 2014 10:43:06 +0000 (11:43 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 8 Mar 2014 12:35:19 +0000 (13:35 +0100)
The jumpToUrl() is defined in every
second module as inline JS. As the
duplicated code is erroneous and
can be shimmed completely, the
function is added to every doc-template
code by default, but can be overriden and
removed completely - which is still the case
in some existing modules.

Additionally the variable "script_ended"
is not used at all anymore, and was removed
as well.

Releases: 6.2
Resolves: #56667
Change-Id: I716611bffce402c5f423c3d64c763d6675a79d14
Reviewed-on: https://review.typo3.org/28180
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
27 files changed:
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/PageLayoutController.php
typo3/sysext/backend/Classes/Controller/Wizard/FormsController.php
typo3/sysext/backend/Classes/Controller/Wizard/RteController.php
typo3/sysext/backend/Classes/Controller/Wizard/TableController.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/dbal/Classes/Controller/ModuleController.php
typo3/sysext/filelist/Classes/Controller/FileListController.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/form/Classes/View/Wizard/WizardView.php
typo3/sysext/func/Classes/Controller/PageFunctionsController.php
typo3/sysext/impexp/Classes/Controller/ImportExportController.php
typo3/sysext/indexed_search/Classes/Controller/ModuleController.php
typo3/sysext/info/Classes/Controller/InfoModuleController.php
typo3/sysext/install/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/lowlevel/Classes/View/ConfigurationView.php
typo3/sysext/lowlevel/Classes/View/DatabaseIntegrityView.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/RecordList.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php
typo3/sysext/rtehtmlarea/Classes/SelectImage.php
typo3/sysext/rtehtmlarea/Classes/User.php
typo3/sysext/scheduler/Classes/Controller/SchedulerModuleController.php
typo3/sysext/sys_action/Classes/ActionTask.php
typo3/sysext/taskcenter/Classes/Controller/TaskModuleController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateModuleController.php
typo3/sysext/version/Classes/Controller/VersionModuleController.php

index 1cab17b..667b7f2 100644 (file)
@@ -622,14 +622,17 @@ class EditDocumentController {
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_doc.html');
                $this->doc->form = '<form action="' . htmlspecialchars($this->R_URI) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editform" onsubmit="document.editform._scrollPosition.value=(document.documentElement.scrollTop || document.body.scrollTop); return TBE_EDITOR.checkSubmit(1);">';
                $this->doc->getPageRenderer()->loadPrototype();
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       function jumpToUrl(URL,formEl) {        //
+               // override the default jumpToUrl
+               $this->doc->JScodeArray['jumpToUrl'] = '
+                       function jumpToUrl(URL,formEl) {
                                if (!TBE_EDITOR.isFormChanged()) {
                                        window.location.href = URL;
                                } else if (formEl && formEl.type=="checkbox") {
                                        formEl.checked = formEl.checked ? 0 : 1;
                                }
                        }
+';
+               $this->doc->JScode = $this->doc->wrapScriptTags('
                                // Object: TS:
                                // passwordDummy and decimalSign are used by tbe_editor.js and have to be declared here as
                                // TS object overwrites the object declared in tbe_editor.js
index 64a0374..d8afa37 100644 (file)
@@ -424,18 +424,25 @@ class PageLayoutController {
                        $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/db_layout.html');
                        // JavaScript:
                        $this->doc->JScode = '<script type="text/javascript" ' . 'src="' . GeneralUtility::createVersionNumberedFilename(($GLOBALS['BACK_PATH'] . 'js/jsfunc.updateform.js')) . '">' . '</script>';
-                       $this->doc->JScode .= $this->doc->wrapScriptTags('
-                               if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
-                               if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int)$this->id . '_"+top.fsMod.currentBank; ' . (int)$this->id . ';
-                               function jumpToUrl(URL,formEl) {        //
+
+                       // override the default jumpToUrl
+                       $this->doc->JScodeArray['jumpToUrl'] = '
+                               function jumpToUrl(URL,formEl) {
                                        if (document.editform && TBE_EDITOR.isFormChanged)      {       // Check if the function exists... (works in all browsers?)
-                                               if (!TBE_EDITOR.isFormChanged())        {       //
+                                               if (!TBE_EDITOR.isFormChanged()) {
                                                        window.location.href = URL;
                                                } else if (formEl) {
                                                        if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
                                                }
-                                       } else window.location.href = URL;
+                                       } else {
+                                               window.location.href = URL;
+                                       }
                                }
+';
+
+                       $this->doc->JScode .= $this->doc->wrapScriptTags('
+                               if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
+                               if (top.fsMod) top.fsMod.navFrameHighlightedID["web"] = "pages' . (int)$this->id . '_"+top.fsMod.currentBank; ' . (int)$this->id . ';
                        ' . ($this->popView ? BackendUtility::viewOnClick($this->id, $GLOBALS['BACK_PATH'], BackendUtility::BEgetRootLine($this->id)) : '') . '
 
                                function deleteRecord(table,id,url) {   //
index 796d2a5..7aa100a 100644 (file)
@@ -197,11 +197,6 @@ class FormsController {
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/wizard_forms.html');
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       function jumpToUrl(URL,formEl) {        //
-                               window.location.href = URL;
-                       }
-               ');
                // Setting form tag:
                list($rUri) = explode('#', GeneralUtility::getIndpEnv('REQUEST_URI'));
                $this->doc->form = '<form action="' . htmlspecialchars($rUri) . '" method="post" name="wizardForm">';
index 087b980..e94deb5 100644 (file)
@@ -119,19 +119,26 @@ class RteController {
                        // Getting the raw record (we need only the pid-value from here...)
                        $rawRec = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
                        BackendUtility::fixVersioningPid($this->P['table'], $rawRec);
-                       // Setting JavaScript, including the pid value for viewing:
-                       $this->doc->JScode = $this->doc->wrapScriptTags('
-                                       function jumpToUrl(URL,formEl) {        //
-                                               if (document.editform) {
-                                                       if (!TBE_EDITOR.isFormChanged()) {
-                                                               window.location.href = URL;
-                                                       } else if (formEl) {
-                                                               if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
-                                                       }
-                                               } else window.location.href = URL;
-                                       }
-                               ' . ($this->popView ? BackendUtility::viewOnClick($rawRec['pid'], '', BackendUtility::BEgetRootLine($rawRec['pid'])) : '') . '
-                       ');
+
+                       // override the default jumpToUrl
+                       $this->doc->JScodeArray['jumpToUrl'] = '
+               function jumpToUrl(URL,formEl) {
+                       if (document.editform) {
+                               if (!TBE_EDITOR.isFormChanged()) {
+                                       window.location.href = URL;
+                               } else if (formEl) {
+                                       if (formEl.type=="checkbox") formEl.checked = formEl.checked ? 0 : 1;
+                               }
+                       } else {
+                               window.location.href = URL;
+                       }
+               }
+';
+
+                       // Setting JavaScript of the pid value for viewing:
+                       if ($this->popView) {
+                               $this->doc->JScode = $this->doc->wrapScriptTags(BackendUtility::viewOnClick($rawRec['pid'], '', BackendUtility::BEgetRootLine($rawRec['pid'])));
+                       }
                        // Initialize TCeforms - for rendering the field:
                        $tceforms = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Form\\FormEngine');
                        // Init...
index 1e8be0e..4ba8027 100644 (file)
@@ -136,11 +136,6 @@ class TableController {
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/wizard_table.html');
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       function jumpToUrl(URL,formEl) {        //
-                               window.location.href = URL;
-                       }
-               ');
                // Setting form tag:
                list($rUri) = explode('#', GeneralUtility::getIndpEnv('REQUEST_URI'));
                $this->doc->form = '<form action="' . htmlspecialchars($rUri) . '" method="post" name="wizardForm">';
index ee9185b..509779f 100644 (file)
@@ -88,7 +88,12 @@ class DocumentTemplate {
        /**
         * @todo Define visibility
         */
-       public $JScodeArray = array();
+       public $JScodeArray = array('jumpToUrl' => '
+function jumpToUrl(URL) {
+       window.location.href = URL;
+       return false;
+}
+       ');
 
        // Additional 'page-end' code could be accumulated in this var. It will be outputted at the end of page before </body> and some other internal page-end code.
        /**
index 99cf58c..1cc66e6 100644 (file)
@@ -69,13 +69,6 @@ class ModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->form = '<form action="" method="post">';
-               // JavaScript
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                               script_ended = 0;
-                               function jumpToUrl(URL) {       //
-                                       window.location.href = URL;
-                               }
-                       ');
                // DBAL page title:
                $this->content .= $this->doc->startPage($GLOBALS['LANG']->getLL('title'));
                $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
index a355b1b..53411e0 100644 (file)
@@ -311,14 +311,7 @@ class FileListController {
                        // Generate the list
                        $this->filelist->generateList();
                        // Set top JavaScript:
-                       $this->doc->JScode = $this->doc->wrapScriptTags('
-
-                       if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";
-                       function jumpToUrl(URL) {       //
-                               window.location.href = URL;
-                       }
-
-                       ' . $this->filelist->CBfunctions());
+                       $this->doc->JScode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["file"] = "' . rawurlencode($this->id) . '";' . $this->filelist->CBfunctions());
                        // This will return content necessary for the context sensitive clickmenus to work: bodytag events, JavaScript functions and DIV-layers.
                        $this->doc->getContextMenuCode();
                        // Setting up the buttons and markers for docheader
index 0f7cc15..306ab6b 100644 (file)
@@ -52,7 +52,7 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
         * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
         *
         * @param string  $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
-        * @param boolean $enableJumpToUrl If TRUE, includes "jumpTpUrl" javascript function required by ActionMenu. Defaults to TRUE
+        * @param boolean $enableJumpToUrl If TRUE, includes "jumpTpUrl" javascript function required by ActionMenu. Defaults to TRUE, deprecated, as not needed anymore
         * @param boolean $enableClickMenu If TRUE, loads clickmenu.js required by BE context menus. Defaults to TRUE
         * @param boolean $loadPrototype specifies whether to load prototype library. Defaults to TRUE
         * @param boolean $loadScriptaculous specifies whether to load scriptaculous libraries. Defaults to FALSE
@@ -74,17 +74,8 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
        public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFile = NULL, $addJsFile = NULL, $loadJQuery = FALSE, $includeCssFiles = NULL, $includeJsFiles = NULL, $addJsInlineLabels = NULL) {
                $doc = $this->getDocInstance();
                $pageRenderer = $doc->getPageRenderer();
-               if ($enableJumpToUrl) {
-                       $doc->JScode .= '
-                               <script language="javascript" type="text/javascript">
-                                       script_ended = 0;
-                                       function jumpToUrl(URL) {
-                                               document.location = URL;
-                                       }
-                                       ' . $doc->redirectUrls() . '
-                               </script>
-                       ';
-               }
+               $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
+
                // Load various standard libraries
                if ($enableClickMenu) {
                        $doc->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/clickmenu.js');
index 0ed444e..cc45aa5 100644 (file)
@@ -67,11 +67,6 @@ class WizardView extends \TYPO3\CMS\Form\View\Wizard\AbstractWizardView {
                $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate('EXT:form/Resources/Private/Templates/Wizard.html');
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       function jumpToUrl(URL,formEl) {
-                               window.location.href = URL;
-                       }
-               ');
                $this->pageRenderer = $this->doc->getPageRenderer();
                $this->pageRenderer->enableConcatenateFiles();
                $this->pageRenderer->enableCompressCss();
index 7b99eb0..4bc82da 100644 (file)
@@ -86,16 +86,7 @@ class PageFunctionsController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                // Main
                if ($this->id && $access) {
                        // JavaScript
-                       $this->doc->JScode = $this->doc->wrapScriptTags('
-                               script_ended = 0;
-                               function jumpToUrl(URL) {
-                                       window.location.href = URL;
-                               }
-                       ');
-                       $this->doc->postCode = $this->doc->wrapScriptTags('
-                               script_ended = 1;
-                               if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
-                       ');
+                       $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
                        // Setting up the context sensitive menu:
                        $this->doc->getContextMenuCode();
                        $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_func')) . '" method="post"><input type="hidden" name="id" value="' . htmlspecialchars($this->id) . '" />';
index 14ace2b..985eefb 100644 (file)
@@ -68,19 +68,9 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                $this->doc->bodyTagId = 'imp-exp-mod';
                $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('impexp') . '/app/template.html');
                $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
-               // JavaScript
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-                       script_ended = 0;
-                       function jumpToUrl(URL) {       //
-                               window.location.href = URL;
-                       }
-               ');
                // Setting up the context sensitive menu:
                $this->doc->getContextMenuCode();
-               $this->doc->postCode = $this->doc->wrapScriptTags('
-                       script_ended = 1;
-                       if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
-               ');
+               $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
                $this->doc->form = '<form action="' . htmlspecialchars($GLOBALS['MCONF']['_']) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '"><input type="hidden" name="id" value="' . $this->id . '" />';
                $this->content .= $this->doc->header($GLOBALS['LANG']->getLL('title'));
                $this->content .= $this->doc->spacer(5);
index dd77b19..5affbdc 100644 (file)
@@ -82,12 +82,6 @@ class ModuleController {
                $this->doc->form = '<form action="" method="post">';
                $this->doc->backPath = $GLOBALS['BACK_PATH'];
                $this->doc->setModuleTemplate(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('indexed_search') . '/mod/mod_template.html');
-               // JavaScript
-               $this->doc->JScodeArray['indexed_search'] = '
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               window.location.href = URL;
-                       }';
                $this->doc->tableLayout = array(
                        'defRow' => array(
                                '0' => array('<td valign="top" nowrap>', '</td>'),
index f2f9329..f40a936 100644 (file)
@@ -97,16 +97,7 @@ class InfoModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
                                )
                        );
                        // JavaScript
-                       $this->doc->JScode = $this->doc->wrapScriptTags('
-                               script_ended = 0;
-                               function jumpToUrl(URL) {       //
-                                       window.location.href = URL;
-                               }
-                       ');
-                       $this->doc->postCode = $this->doc->wrapScriptTags('
-                               script_ended = 1;
-                               if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';
-                       ');
+                       $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) top.fsMod.recentIds["web"] = ' . (int)$this->id . ';');
                        // Setting up the context sensitive menu:
                        $this->doc->getContextMenuCode();
                        $this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('web_info')) . '" method="post" name="webinfoForm">';
index 895c3d0..b047909 100644 (file)
@@ -55,7 +55,7 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
         * Render start page with \TYPO3\CMS\Backend\Template\DocumentTemplate and pageTitle
         *
         * @param string  $pageTitle title tag of the module. Not required by default, as BE modules are shown in a frame
-        * @param boolean $enableJumpToUrl If TRUE, includes "jumpTpUrl" javascript function required by ActionMenu. Defaults to TRUE
+        * @param boolean $enableJumpToUrl If TRUE, includes "jumpTpUrl" javascript function required by ActionMenu. Defaults to TRUE, not needed anymore, as it is included all the time
         * @param boolean $enableClickMenu If TRUE, loads clickmenu.js required by BE context menus. Defaults to TRUE
         * @param boolean $loadPrototype specifies whether to load prototype library. Defaults to TRUE
         * @param boolean $loadScriptaculous specifies whether to load scriptaculous libraries. Defaults to FALSE
@@ -74,17 +74,8 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
        public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFiles = array(), $addJsFiles = array(), $triggers = array()) {
                $doc = $this->getDocInstance();
                $pageRenderer = $doc->getPageRenderer();
-               if ($enableJumpToUrl) {
-                       $doc->JScode .= '
-                               <script language="javascript" type="text/javascript">
-                                       script_ended = 0;
-                                       function jumpToUrl(URL) {
-                                               document.location = URL;
-                                       }
-                                       ' . $doc->redirectUrls() . '
-                               </script>
-                       ';
-               }
+
+               $doc->JScode .= $doc->wrapScriptTags($doc->redirectUrls());
                if ($enableClickMenu) {
                        $doc->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/clickmenu.js');
                }
index fa365ae..0907640 100644 (file)
@@ -91,15 +91,6 @@ class ConfigurationView {
                $this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
                $this->doc->backPath = $BACK_PATH;
                $this->doc->setModuleTemplate('EXT:lowlevel/Resources/Private/Templates/config.html');
-               // JavaScript
-               $this->doc->JScode = '
-               <script language="javascript" type="text/javascript">
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               window.location.href = URL;
-                       }
-               </script>
-               ';
                $this->doc->form = '<form action="" method="post">';
        }
 
index 7e7cd24..ab88091 100644 (file)
@@ -94,15 +94,6 @@ class DatabaseIntegrityView {
                $this->doc->backPath = $BACK_PATH;
                $this->doc->setModuleTemplate('EXT:lowlevel/Resources/Private/Templates/dbint.html');
                $this->doc->form = '<form action="" method="post" name="' . $this->formName . '">';
-               // JavaScript
-               $this->doc->JScode = '
-               <script language="javascript" type="text/javascript">
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               window.location.href = URL;
-                       }
-               </script>
-               ';
                $this->doc->table_TABLE = '<table class="t3-table">
                        <colgroup><col width="24"><col><col width="150"></colgroup>';
                $this->doc->tableLayout = array(
index f214029..e9ef294 100644 (file)
@@ -306,6 +306,8 @@ class ElementBrowser {
                $this->setParams = $this->curUrlArray['params'] != '-' ? rawurlencode($this->curUrlArray['params']) : '';
 
                // Finally, add the accumulated JavaScript to the template object:
+               // also unset the default jumpToUrl() function before
+               unset($this->doc->JScodeArray['jumpToUrl']);
                $this->doc->JScode .= $this->doc->wrapScriptTags($this->getJSCode());
        }
 
index a62eb4e..464f2af 100644 (file)
@@ -352,10 +352,6 @@ class RecordList {
                        $listUrl = substr($dblist->listURL(), strlen($GLOBALS['BACK_PATH']));
                        // Add JavaScript functions to the page:
                        $this->doc->JScode = $this->doc->wrapScriptTags('
-                               function jumpToUrl(URL) {       //
-                                       window.location.href = URL;
-                                       return false;
-                               }
                                function jumpExt(URL,anchor) {  //
                                        var anc = anchor?anchor:"";
                                        window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
index e8465fa..8b658ad 100644 (file)
@@ -121,6 +121,8 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                // Add attributes to body tag. Note: getBodyTagAdditions will invoke the hooks
                $this->doc->bodyTagAdditions = $this->getBodyTagAdditions();
                // Adding RTE JS code
+               // also unset the default jumpToUrl() function before
+               unset($this->doc->JScodeArray['jumpToUrl']);
                $this->doc->JScodeArray['rtehtmlarea'] = $this->getJSCode();
        }
 
index a43170b..af9622e 100644 (file)
@@ -823,6 +823,10 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                }
                }
                $this->content .= $this->doc->endPage();
+
+               // unset the default jumpToUrl() function
+               unset($this->doc->JScodeArray['jumpToUrl']);
+
                $this->doc->JScodeArray['rtehtmlarea'] = $this->getJSCode($this->act, $this->editorNo, $this->sys_language_content);
                $this->content = $this->doc->insertStylesAndJS($this->content);
                return $this->content;
index 2e64558..97eb553 100644 (file)
@@ -114,6 +114,10 @@ class User {
                                window.location.href = theLocation;
                        }
                ';
+
+               // unset the default jumpToUrl() function
+               unset($this->doc->JScodeArray['jumpToUrl']);
+
                $this->doc->JScode = $this->doc->wrapScriptTags($JScode);
                $this->modData = $GLOBALS['BE_USER']->getModuleData('user.php', 'ses');
                if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('OC_key')) {
index 83717b6..3e12092 100644 (file)
@@ -133,15 +133,6 @@ class SchedulerModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClas
                if ($GLOBALS['BE_USER']->user['admin']) {
                        // Set the form
                        $this->doc->form = '<form name="tx_scheduler_form" id="tx_scheduler_form" method="post" action="">';
-                       // JavaScript for main function menu
-                       $this->doc->JScode = '
-                               <script language="javascript" type="text/javascript">
-                                       script_ended = 0;
-                                       function jumpToUrl(URL) {
-                                               document.location = URL;
-                                       }
-                               </script>
-                       ';
                        $this->pageRenderer->addInlineSetting('scheduler', 'runningIcon', ExtensionManagementUtility::extRelPath('scheduler') . 'res/gfx/status_running.png');
                        // Prepare main content
                        $this->content = $this->doc->header($GLOBALS['LANG']->getLL('function.' . $this->MOD_SETTINGS['function']));
index 9770de1..2bfac5d 100644 (file)
@@ -798,10 +798,6 @@ class ActionTask implements \TYPO3\CMS\Taskcenter\TaskInterface {
                        // Add JavaScript functions to the page:
                        $this->taskObject->doc->JScode = $this->taskObject->doc->wrapScriptTags('
 
-                               function jumpToUrl(URL) {
-                                       window.location.href = URL;
-                                       return false;
-                               }
                                function jumpExt(URL,anchor) {
                                        var anc = anchor?anchor:"";
                                        window.location.href = URL+(T3_THIS_LOCATION?"&returnUrl="+T3_THIS_LOCATION:"")+anc;
index edc07ce..41c7b93 100644 (file)
@@ -72,20 +72,8 @@ class TaskModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass {
        public function main() {
                $docHeaderButtons = $this->getButtons();
                $markers = array();
-               $this->doc->JScodeArray[] = '
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               document.location = URL;
-                       }
-               ';
-               $this->doc->postCode = '
-                       <script language="javascript" type="text/javascript">
-                               script_ended = 1;
-                               if (top.fsMod) {
-                                       top.fsMod.recentIds["web"] = 0;
-                               }
-                       </script>
-               ';
+               $this->doc->postCode = $this->doc->wrapScriptTags('if (top.fsMod) { top.fsMod.recentIds["web"] = 0; }');
+
                // Render content depending on the mode
                $mode = (string) $this->MOD_SETTINGS['mode'];
                if ($mode == 'information') {
index ffb81b4..bae7453 100644 (file)
@@ -152,10 +152,6 @@ class TypoScriptTemplateModuleController extends \TYPO3\CMS\Backend\Module\BaseS
                        // JavaScript
                        $this->doc->JScode = '
                <script language="javascript" type="text/javascript">
-                       script_ended = 0;
-                       function jumpToUrl(URL) {
-                               window.location.href = URL;
-                       }
                        function uFormUrl(aname) {
                                document.forms[0].action = ' . GeneralUtility::quoteJSvalue(($aHref . '#'), TRUE) . '+aname;
                        }
@@ -167,7 +163,6 @@ class TypoScriptTemplateModuleController extends \TYPO3\CMS\Backend\Module\BaseS
                ';
                        $this->doc->postCode = '
                <script language="javascript" type="text/javascript">
-                       script_ended = 1;
                        if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
                </script>
                ';
index c3b8bf4..bf5dcdd 100644 (file)
@@ -194,12 +194,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                        $access = is_array($this->pageinfo) ? 1 : 0;
                        if ($pidValue && $access || $GLOBALS['BE_USER']->user['admin'] && !$pidValue) {
                                // JavaScript
-                               $this->doc->JScode .= '
-                                       <script language="javascript" type="text/javascript">
-                                               script_ended = 0;
-                                               function jumpToUrl(URL) {
-                                                       window.location.href = URL;
-                                               }
+                               $this->doc->JScode .= $this->doc->wrapScriptTags('
 
                                                function hlSubelements(origId, verId, over, diffLayer)  {       //
                                                        if (over) {
@@ -216,8 +211,7 @@ class VersionModuleController extends \TYPO3\CMS\Backend\Module\BaseScriptClass
                                                                }
                                                        }
                                                }
-                                       </script>
-                               ';
+                               ');
                                // If another page module was specified, replace the default Page module with the new one
                                $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
                                $this->pageModule = BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';