@@ -9,6 +9,7 @@ import highlightSql from './sql-highlight.js';
99import { ajaxRemoveMessage , ajaxShowMessage } from './ajax-message.js' ;
1010import handleCreateViewModal from './functions/handleCreateViewModal.js' ;
1111import { escapeHtml } from './functions/escape.js' ;
12+ import getImageTag from './functions/getImageTag.js' ;
1213
1314/* global DatabaseStructure */ // js/database/structure.js
1415/* global firstDayOfCalendar, maxInputVars, themeImagePath */ // templates/javascript/variables.twig
@@ -1019,7 +1020,7 @@ Functions.getForeignKeyCheckboxLoader = function () {
10191020 var html = '' ;
10201021 html += '<div class="mt-1 mb-2">' ;
10211022 html += '<div class="load-default-fk-check-value">' ;
1022- html += Functions . getImage ( 'ajax_clock_small' ) ;
1023+ html += getImageTag ( 'ajax_clock_small' ) ;
10231024 html += '</div>' ;
10241025 html += '</div>' ;
10251026 return html ;
@@ -2360,7 +2361,7 @@ Functions.onloadEnumSetEditor = function () {
23602361 values . push ( '' , '' , '' , '' ) ;
23612362 }
23622363 // Add the parsed values to the editor
2363- var dropIcon = Functions . getImage ( 'b_drop' ) ;
2364+ var dropIcon = getImageTag ( 'b_drop' ) ;
23642365 for ( i = 0 ; i < values . length ; i ++ ) {
23652366 fields += '<tr><td>' +
23662367 '<input type=\'text\' value=\'' + values [ i ] + '\'>' +
@@ -2374,7 +2375,7 @@ Functions.onloadEnumSetEditor = function () {
23742375 var dialog = '<div id=\'enum_editor\'>' +
23752376 '<fieldset class="pma-fieldset">' +
23762377 '<legend>' + title + '</legend>' +
2377- '<p>' + Functions . getImage ( 's_notice' ) +
2378+ '<p>' + getImageTag ( 's_notice' ) +
23782379 window . Messages . enum_hint + '</p>' +
23792380 '<table class="table table-borderless values">' + fields + '</table>' +
23802381 '</fieldset><fieldset class="pma-fieldset tblFooters">' +
@@ -2576,7 +2577,7 @@ Functions.onloadEnumSetEditor = function () {
25762577 '<tr class=\'hide\'><td>' +
25772578 '<input type=\'text\'>' +
25782579 '</td><td class=\'drop\'>' +
2579- Functions . getImage ( 'b_drop' ) +
2580+ getImageTag ( 'b_drop' ) +
25802581 '</td></tr>'
25812582 )
25822583 . find ( 'tr' ) . last ( )
@@ -3677,86 +3678,6 @@ Functions.onloadSortLinkMouseEvent = function () {
36773678 } ) ;
36783679} ;
36793680
3680- /**
3681- * Returns an HTML IMG tag for a particular image from a theme,
3682- * which may be an actual file or an icon from a sprite
3683- *
3684- * @param {string } image The name of the file to get
3685- * @param {string } alternate Used to set 'alt' and 'title' attributes of the image
3686- * @param {object } attributes An associative array of other attributes
3687- *
3688- * @return {object } The requested image, this object has two methods:
3689- * .toString() - Returns the IMG tag for the requested image
3690- * .attr(name) - Returns a particular attribute of the IMG
3691- * tag given it's name
3692- * .attr(name, value) - Sets a particular attribute of the IMG
3693- * tag to the given value
3694- */
3695- Functions . getImage = function ( image , alternate , attributes ) {
3696- var alt = alternate ;
3697- var attr = attributes ;
3698- // custom image object, it will eventually be returned by this functions
3699- var retval = {
3700- data : {
3701- // this is private
3702- alt : '' ,
3703- title : '' ,
3704- src : 'themes/dot.gif' ,
3705- } ,
3706- attr : function ( name , value ) {
3707- if ( value === undefined ) {
3708- if ( this . data [ name ] === undefined ) {
3709- return '' ;
3710- } else {
3711- return this . data [ name ] ;
3712- }
3713- } else {
3714- this . data [ name ] = value ;
3715- }
3716- } ,
3717- toString : function ( ) {
3718- var retval = '<' + 'img' ;
3719- for ( var i in this . data ) {
3720- retval += ' ' + i + '="' + this . data [ i ] + '"' ;
3721- }
3722- retval += ' /' + '>' ;
3723- return retval ;
3724- }
3725- } ;
3726- // initialise missing parameters
3727- if ( attr === undefined ) {
3728- attr = { } ;
3729- }
3730- if ( alt === undefined ) {
3731- alt = '' ;
3732- }
3733- // set alt
3734- if ( attr . alt !== undefined ) {
3735- retval . attr ( 'alt' , escapeHtml ( attr . alt ) ) ;
3736- } else {
3737- retval . attr ( 'alt' , escapeHtml ( alt ) ) ;
3738- }
3739- // set title
3740- if ( attr . title !== undefined ) {
3741- retval . attr ( 'title' , escapeHtml ( attr . title ) ) ;
3742- } else {
3743- retval . attr ( 'title' , escapeHtml ( alt ) ) ;
3744- }
3745- // set css classes
3746- retval . attr ( 'class' , 'icon ic_' + image ) ;
3747- // set all other attributes
3748- for ( var i in attr ) {
3749- if ( i === 'src' ) {
3750- // do not allow to override the 'src' attribute
3751- continue ;
3752- }
3753-
3754- retval . attr ( i , attr [ i ] ) ;
3755- }
3756-
3757- return retval ;
3758- } ;
3759-
37603681/**
37613682 * Return POST data as stored by Generator::linkOrButton
37623683 *
0 commit comments