Index: branches/5.2.x/core/admin_templates/js/toolbar.js =================================================================== diff -u -N -r14856 -r15284 --- branches/5.2.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 14856) +++ branches/5.2.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 15284) @@ -55,29 +55,44 @@ } } -ToolBarButton.prototype.IconsPath = function() +ToolBarButton.prototype.IconsPath = function($module_path) { - var $module_path = this.Module; + if ( $module_path === undefined ) { + $module_path = this.Module; + } - if (this.Module != 'core') { + if ( $module_path != 'core' ) { $module_path = 'modules/' + $module_path; } return this.ToolBar.IconPath.replace('#MODULE#', $module_path) + 'toolbar/'; } ToolBarButton.prototype.GetHTML = function() { - var add_style = this.ToolBar.ButtonStyle ? 'style="'+this.ToolBar.ButtonStyle+'"' : ''; - var o = '
' - o += ''; - if (this.ToolBar.UseLabels) o += '
'+this.Label; + var add_style = this.ToolBar.ButtonStyle ? 'style="' + this.ToolBar.ButtonStyle + '"' : '', + o = '
'; + + o += ''; + + if ( this.ToolBar.UseLabels ) { + o += '
' + this.Label; + } + o += '
' + return o; } ToolBarButton.prototype.GetToolID = function(item) { - if (!item) item = 'tool' - return this.Prefix == '' ? item+'_' + this.Title : item+'_['+this.Prefix+'][' + this.Title+']' + if ( item === undefined ) { + item = 'tool'; + } + + if ( this.Prefix == '' ) { + return item == 'tool' ? this.Module + '-tb-' + this.Title : item + '_' + this.Title; + } + + return item + '_[' + this.Prefix + '][' + this.Title + ']' } ToolBarButton.prototype.Init = function() { @@ -88,11 +103,6 @@ this.Container.btn = this; img.btn = this; - this.MouseOverImg = new Image(); - this.MouseOverImg.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '_f2.gif'; - this.MouseOutImg = new Image(); - this.MouseOutImg.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '.gif'; - this.SetOnMouseOver(); this.SetOnMouseOut(); this.SetOnClick(); @@ -132,14 +142,14 @@ ToolBarButton.prototype.SetOnMouseOver = function() { this.Container.onmouseover = function() { - this.btn.imgObject.src = this.btn.MouseOverImg.src; + $(this.btn.imgObject).addClass('hover'); this.className = 'toolbar-button-over'; }; } ToolBarButton.prototype.SetOnMouseOut = function() { this.Container.onmouseout = function() { - this.btn.imgObject.src = this.btn.MouseOutImg.src; + $(this.btn.imgObject).removeClass('hover'); this.className = 'toolbar-button'; }; } @@ -197,11 +207,7 @@ ToolBarButton.prototype.Disable = function() { if ( !this.Enabled ) return; - if (typeof(this.DisabledImg) == 'undefined') { - this.DisabledImg = new Image(); - this.DisabledImg.src = this.IconsPath() + this.ToolBar.IconPrefix + this.Title + '_f3.gif'; - } - this.imgObject.src = this.DisabledImg.src; + $(this.imgObject).addClass('disabled'); this.Container.onmouseover = null; this.Container.onmouseout = null; this.Container.onclick = null; @@ -212,7 +218,7 @@ ToolBarButton.prototype.Enable = function() { if (this.Enabled) return; - this.imgObject.src = this.MouseOutImg.src; + $(this.imgObject).removeClass('hover disabled'); this.SetOnMouseOver(); this.SetOnMouseOut(); this.SetOnClick(); @@ -241,16 +247,14 @@ ToolBarSeparator.prototype = new ToolBarButton; ToolBarSeparator.prototype.GetHTML = function() { - var add_style = this.ToolBar.ButtonStyle ? 'style="'+this.ToolBar.ButtonStyle+'"' : ''; + var add_style = this.ToolBar.ButtonStyle ? 'style="' + this.ToolBar.ButtonStyle + '"' : ''; var padding = this.ToolBar.UseLabels ? '12px' : '2px' - return '
'; - var add_style = this.ToolBar.ButtonStyle ? 'style="'+this.ToolBar.ButtonStyle+'"' : ''; - return '
'; + return '
'; } ToolBarSeparator.prototype.Init = function() { - img = document.getElementById(this.ToolBar.IconPrefix + this.Title); + img = document.getElementById(this.Module + '-tb-' + this.Title); this.Container = document.getElementById(this.GetToolID('div')) ? document.getElementById(this.GetToolID('div')) : false; this.imgObject = img; img.btn = this;