diff --git a/js/src/consts/files.js b/js/src/consts/files.js index d2606443bd..9ab3ef010a 100644 --- a/js/src/consts/files.js +++ b/js/src/consts/files.js @@ -17,7 +17,8 @@ const PhpToJsFileMapping = { 'indexes', 'key_handler', 'cross_framing_protection', - 'drag_drop_import' + 'drag_drop_import', + 'rte' ], server_privileges: ['server_privileges'], server_databases: ['server_databases'], @@ -100,7 +101,8 @@ const JsFileList = [ 'key_handler', 'cross_framing_protection', 'drag_drop_import', - 'normalization' + 'normalization', + 'rte' ]; export { diff --git a/js/src/navigation.js b/js/src/navigation.js index c09292075b..bfb990e5c9 100644 --- a/js/src/navigation.js +++ b/js/src/navigation.js @@ -1,10 +1,13 @@ /* vim: set expandtab sw=4 ts=4 sts=4: */ + +/* Module import */ import * as Navigation from './functions/navigation'; import { PMA_Messages as PMA_messages } from './variables/export_variables'; import CommonParams from './variables/common_params'; import { PMA_ajaxShowMessage, PMA_ajaxRemoveMessage, PMA_tooltip } from './utils/show_ajax_messages'; import { isStorageSupported } from './functions/config'; import { indexEditorDialog } from './functions/Indexes'; +import RTE from './classes/RTE'; /** * function used in or for navigation panel diff --git a/js/src/utils/show_ajax_messages.js b/js/src/utils/show_ajax_messages.js index b8be628bd9..5aa74b313b 100644 --- a/js/src/utils/show_ajax_messages.js +++ b/js/src/utils/show_ajax_messages.js @@ -220,11 +220,99 @@ function PMA_ajaxRemoveMessage ($thisMsgbox) { } } +/** + * Creates a message inside an object with a sliding effect + * + * @param msg A string containing the text to display + * @param $obj a jQuery object containing the reference + * to the element where to put the message + * This is optional, if no element is + * provided, one will be created below the + * navigation links at the top of the page + * + * @return bool True on success, false on failure + */ +function PMA_slidingMessage (msg, $obj) { + if (msg === undefined || msg.length === 0) { + // Don't show an empty message + return false; + } + if ($obj === undefined || !($obj instanceof jQuery) || $obj.length === 0) { + // If the second argument was not supplied, + // we might have to create a new DOM node. + if ($('#PMA_slidingMessage').length === 0) { + $('#page_content').prepend( + '' + ); + } + $obj = $('#PMA_slidingMessage'); + } + if ($obj.has('div').length > 0) { + // If there already is a message inside the + // target object, we must get rid of it + $obj + .find('div') + .first() + .fadeOut(function () { + $obj + .children() + .remove(); + $obj + .append('
' + msg + '
'); + // highlight any sql before taking height; + PMA_highlightSQL($obj); + $obj.find('div') + .first() + .hide(); + $obj + .animate({ + height: $obj.find('div').first().height() + }) + .find('div') + .first() + .fadeIn(); + }); + } else { + // Object does not already have a message + // inside it, so we simply slide it down + $obj.width('100%') + .html('
' + msg + '
'); + // highlight any sql before taking height; + PMA_highlightSQL($obj); + var h = $obj + .find('div') + .first() + .hide() + .height(); + $obj + .find('div') + .first() + .css('height', 0) + .show() + .animate({ + height: h + }, function () { + // Set the height of the parent + // to the height of the child + $obj + .height( + $obj + .find('div') + .first() + .height() + ); + }); + } + return true; +} // end PMA_slidingMessage() + /** * Module export */ export { PMA_ajaxRemoveMessage, PMA_ajaxShowMessage, - PMA_tooltip + PMA_tooltip, + PMA_slidingMessage }; diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index c771be2bbc..4d7bdfb6db 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -189,7 +189,7 @@ class Header if ($GLOBALS['cfg']['AllowThirdPartyFraming'] === false) { $this->_scripts->addFile('cross_framing_protection'); } - $this->_scripts->addFile('rte.js'); + $this->_scripts->addFile('rte'); if ($GLOBALS['cfg']['SendErrorReports'] !== 'never') { $this->_scripts->addFile('vendor/tracekit.js'); $this->_scripts->addFile('error_report.js');