Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -r5006 -r5009 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5006) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5009) @@ -9,6 +9,7 @@ // get from cookie this.ActivePrefix = ''; + $ViewMenus = new Array('c'); } Catalog.prototype.Init = function () { @@ -81,14 +82,17 @@ // hide source tab document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-unselected'; document.getElementById(this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id') + '_div').style.display = 'none'; + this.HideDependentButtons(this.ActivePrefix); } // show destination tab this.ActivePrefix = $prefix; document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected'; - var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div'; // destination tab + var $div_id = this.queryTabRegistry('prefix', this.ActivePrefix, 'tab_id') + '_div'; // destination tab document.getElementById($div_id).style.display = 'block'; - + this.ShowDependentButtons(this.ActivePrefix); + $ViewMenus = new Array('c', this.ActivePrefix); + // this.TabRegistry.length == 1 var $cat_id = get_hidden_field('m_cat_id'); var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id'); @@ -110,6 +114,7 @@ this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix'); this.TabRegistry[$index]['module_path'] = $tab.getAttribute('edit_template').substring(0, $tab.getAttribute('edit_template').indexOf('/')); this.TabRegistry[$index]['edit_template'] = $tab.getAttribute('edit_template'); + this.TabRegistry[$index]['dep_buttons'] = $tab.getAttribute('dep_buttons').split(','); this.TabRegistry[$index]['index'] = $index; } @@ -124,4 +129,22 @@ $i++; } return false; +} + +Catalog.prototype.ShowDependentButtons = function($prefix) { + var $dep_buttons = this.queryTabRegistry('prefix', $prefix, 'dep_buttons'); + var $i = 0; + while ($i < $dep_buttons.length) { + a_toolbar.ShowButton($dep_buttons[$i]); + $i++; + } +} + +Catalog.prototype.HideDependentButtons = function($prefix) { + var $dep_buttons = this.queryTabRegistry('prefix', $prefix, 'dep_buttons'); + var $i = 0; + while ($i < $dep_buttons.length) { + a_toolbar.HideButton($dep_buttons[$i]); + $i++; + } } \ No newline at end of file