Index: branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.js =================================================================== diff -u -N -r12117 -r13373 --- branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 12117) +++ branches/5.0.x/core/admin_templates/js/jquery/thickbox/thickbox.js (.../thickbox.js) (revision 13373) @@ -64,6 +64,15 @@ TB.show = function (params) { TB.lastParams = params; // caption, url, imageGroup, onDataReceived, onAfterShow, postParams + + if (TB.imgLoader === undefined) { + // loader image is set from $(document).ready(...) and when some slow javascript + // makes page busy and user clicks on something, that opens window, then there will + // be an error + + return ; + } + try { if (TB.useStack) { // increment window counter Index: branches/5.0.x/core/admin_templates/js/grid.js =================================================================== diff -u -N -r12117 -r13373 --- branches/5.0.x/core/admin_templates/js/grid.js (.../grid.js) (revision 12117) +++ branches/5.0.x/core/admin_templates/js/grid.js (.../grid.js) (revision 13373) @@ -481,34 +481,31 @@ this.CheckDependencies('Grid.SetDependantToolbarButtons'); } -Grid.prototype.CheckDependencies = function($called_from) -{ -// alert('prefix: ' + this.prefix + '; ' + $called_from + ' -> Grid.CheckDependencies'); +Grid.prototype.CheckDependencies = function($called_from, $run_now) { + if (!$run_now || $run_now === undefined) { + // schedule run via document.ready, so we manage to disable + // toolbar buttons after ToolBar class mass-enables them + var $me = this; + + $(document).ready( + function () { + $me.CheckDependencies($called_from, true); + } + ); + + return ; + } + var enabling = (this.CountSelected() > 0); + for (var i = 0; i < this.DependantButtons.length; i++) { - if (this.DependantButtons[i][0].match("portal:(.*)")) { - button_name = RegExp.$1; - if (toolbar) { - if (enabling == this.DependantButtons[i][1]) { - toolbar.enableButton(button_name, true); - } - else - { - toolbar.disableButton(button_name, true); - } - } + if (this.DependantButtons[i][2] == 1) { + this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); } else { - if (this.DependantButtons[i][2] == 1) { - this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); - } - else { - this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); - } + this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]); } } - //if (enabling) this.ClearAlternativeGridsSelection('Grid.CheckDependencies'); - } Grid.prototype.ClearAlternativeGridsSelection = function (called_from) Index: branches/5.0.x/core/admin_templates/js/toolbar.js =================================================================== diff -u -N -r13246 -r13373 --- branches/5.0.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 13246) +++ branches/5.0.x/core/admin_templates/js/toolbar.js (.../toolbar.js) (revision 13373) @@ -94,6 +94,9 @@ this.SetOnRightClick() if (this.Hidden) this.Hide(); + // all buttons are disabled until page is fully loaded! + this.Disable(); + if (!img.complete) { var real_path = img_path.replace('#MODULE#', this.Module) + 'toolbar/'; var old_path = img_path.replace('#MODULE#', 'kernel') + 'toolbar/'+this.ToolBar.IconPrefix + this.Title+'.gif'; @@ -343,6 +346,16 @@ btn.Init(); } } + + var $me = this; + + $(document).ready( + function () { + for (var $button_name in $me.Buttons) { + $me.Buttons[$button_name].Enable(); + } + } + ); } ToolBar.prototype.EnableButton = function(button_id) {