@@ -2,6 +2,7 @@ import $ from 'jquery';
22import { AJAX } from '../modules/ajax.js' ;
33import { Functions } from '../modules/functions.js' ;
44import { Navigation } from '../modules/navigation.js' ;
5+ import { ajaxRemoveMessage , ajaxShowMessage } from '../modules/ajax-message.js' ;
56
67AJAX . registerTeardown ( 'database/events.js' , function ( ) {
78 $ ( document ) . off ( 'click' , 'a.ajax.add_anchor, a.ajax.edit_anchor' ) ;
@@ -57,7 +58,7 @@ const DatabaseEvents = {
5758 } ,
5859
5960 exportDialog : function ( $this ) {
60- var $msg = Functions . ajaxShowMessage ( ) ;
61+ var $msg = ajaxShowMessage ( ) ;
6162 if ( $this . attr ( 'id' ) === 'bulkActionExportButton' ) {
6263 var combined = {
6364 success : true ,
@@ -94,11 +95,11 @@ const DatabaseEvents = {
9495 } else {
9596 $ . get ( $this . attr ( 'href' ) , { 'ajax_request' : true } , showExport ) ;
9697 }
97- Functions . ajaxRemoveMessage ( $msg ) ;
98+ ajaxRemoveMessage ( $msg ) ;
9899
99100 function showExport ( data ) {
100101 if ( data . success === true ) {
101- Functions . ajaxRemoveMessage ( $msg ) ;
102+ ajaxRemoveMessage ( $msg ) ;
102103 /**
103104 * @var buttonOptions Object containing options
104105 * for jQueryUI dialog buttons
@@ -132,7 +133,7 @@ const DatabaseEvents = {
132133 var $elm = $ajaxDialog . find ( 'textarea' ) ;
133134 Functions . getSqlEditor ( $elm ) ;
134135 } else {
135- Functions . ajaxShowMessage ( data . error , false ) ;
136+ ajaxShowMessage ( data . error , false ) ;
136137 }
137138 } // end showExport()
138139 } , // end exportDialog()
@@ -154,11 +155,11 @@ const DatabaseEvents = {
154155 * @var $msg jQuery object containing the reference to
155156 * the AJAX message shown to the user
156157 */
157- var $msg = Functions . ajaxShowMessage ( ) ;
158+ var $msg = ajaxShowMessage ( ) ;
158159 $ . get ( $this . attr ( 'href' ) , { 'ajax_request' : true } , function ( data ) {
159160 if ( data . success === true ) {
160161 // We have successfully fetched the editor form
161- Functions . ajaxRemoveMessage ( $msg ) ;
162+ ajaxRemoveMessage ( $msg ) ;
162163 /**
163164 * @var buttonOptions Object containing options
164165 * for jQueryUI dialog buttons
@@ -187,14 +188,14 @@ const DatabaseEvents = {
187188 * @var data Form data to be sent in the AJAX request
188189 */
189190 var data = $ ( 'form.rte_form' ) . last ( ) . serialize ( ) ;
190- $msg = Functions . ajaxShowMessage (
191+ $msg = ajaxShowMessage (
191192 window . Messages . strProcessingRequest
192193 ) ;
193194 var url = $ ( 'form.rte_form' ) . last ( ) . attr ( 'action' ) ;
194195 $ . post ( url , data , function ( data ) {
195196 if ( data . success === true ) {
196197 // Item created successfully
197- Functions . ajaxRemoveMessage ( $msg ) ;
198+ ajaxRemoveMessage ( $msg ) ;
198199 Functions . slidingMessage ( data . message ) ;
199200 that . $ajaxDialog . dialog ( 'close' ) ;
200201 // If we are in 'edit' mode, we must
@@ -285,7 +286,7 @@ const DatabaseEvents = {
285286 }
286287 Navigation . reload ( ) ;
287288 } else {
288- Functions . ajaxShowMessage ( data . error , false ) ;
289+ ajaxShowMessage ( data . error , false ) ;
289290 }
290291 } ) ; // end $.post()
291292 } // end "if (that.validate())"
@@ -343,7 +344,7 @@ const DatabaseEvents = {
343344 linterOptions . eventEditor = true ;
344345 that . syntaxHiglighter = Functions . getSqlEditor ( $elm , { } , 'both' , linterOptions ) ;
345346 } else {
346- Functions . ajaxShowMessage ( data . error , false ) ;
347+ ajaxShowMessage ( data . error , false ) ;
347348 }
348349 } ) ; // end $.get()
349350 } ,
@@ -365,7 +366,7 @@ const DatabaseEvents = {
365366 * @var msg jQuery object containing the reference to
366367 * the AJAX message shown to the user
367368 */
368- var $msg = Functions . ajaxShowMessage ( window . Messages . strProcessingRequest ) ;
369+ var $msg = ajaxShowMessage ( window . Messages . strProcessingRequest ) ;
369370 var params = Functions . getJsConfirmCommonParam ( this , $this . getPostData ( ) ) ;
370371 $ . post ( url , params , function ( data ) {
371372 if ( data . success === true ) {
@@ -409,12 +410,12 @@ const DatabaseEvents = {
409410 } ) ;
410411 }
411412 // Get rid of the "Loading" message
412- Functions . ajaxRemoveMessage ( $msg ) ;
413+ ajaxRemoveMessage ( $msg ) ;
413414 // Show the query that we just executed
414415 Functions . slidingMessage ( data . sql_query ) ;
415416 Navigation . reload ( ) ;
416417 } else {
417- Functions . ajaxShowMessage ( data . error , false ) ;
418+ ajaxShowMessage ( data . error , false ) ;
418419 }
419420 } ) ; // end $.post()
420421 } ) ;
@@ -427,7 +428,7 @@ const DatabaseEvents = {
427428 * @var msg jQuery object containing the reference to
428429 * the AJAX message shown to the user
429430 */
430- var $msg = Functions . ajaxShowMessage ( window . Messages . strProcessingRequest ) ;
431+ var $msg = ajaxShowMessage ( window . Messages . strProcessingRequest ) ;
431432
432433 // drop anchors of all selected rows
433434 var dropAnchors = $ ( 'input.checkall:checked' ) . parents ( 'tr' ) . find ( '.drop_anchor' ) ;
@@ -486,13 +487,13 @@ const DatabaseEvents = {
486487 if ( returnCount === count ) {
487488 if ( success ) {
488489 // Get rid of the "Loading" message
489- Functions . ajaxRemoveMessage ( $msg ) ;
490+ ajaxRemoveMessage ( $msg ) ;
490491 $ ( '#rteListForm_checkall' ) . prop ( { checked : false , indeterminate : false } ) ;
491492 }
492493 Navigation . reload ( ) ;
493494 }
494495 } else {
495- Functions . ajaxShowMessage ( data . error , false ) ;
496+ ajaxShowMessage ( data . error , false ) ;
496497 success = false ;
497498 if ( returnCount === count ) {
498499 Navigation . reload ( ) ;
0 commit comments