Index: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -r5711 -r5715 --- branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5711) +++ branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5715) @@ -1,13 +1,11 @@ -var $is_catalog = true; - -function Catalog($url_mask, $cookie_prefix) { +function Catalog($url_mask, $cookie_prefix, $tab_shift) { this.CookiePrefix = $cookie_prefix ? $cookie_prefix : ''; this.BusyRequest = new Array(); this.URLMask = $url_mask; this.Separator = '#separator#'; this.ParentCategoryID = 0; this.OnResponceMethod = null; - this.TabShift = 1; // start from 2nd tab (index starting from 0) + this.TabShift = isset($tab_shift) ? $tab_shift : 1; // start from 2nd tab (index starting from 0) this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); @@ -22,6 +20,10 @@ this.ActivePrefix = this.TabRegistry[this.TabShift]['prefix']; } this.SetAlternativeTabs(); + this.AfterInit(); +} + +Catalog.prototype.AfterInit = function () { this.go_to_cat(); } @@ -105,6 +107,7 @@ } Catalog.prototype.errorCallback = function($request, $params, $object) { +// $Debugger.ShowProps($request, 'req'); alert('AJAX Error; class: Catalog; ' + Request.getErrorHtml($request)); } @@ -212,6 +215,7 @@ // query tab content only in case if not queried or category don't match var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab'); $url = $url.replace('#CATEGORY_ID#', $cat_id); + $url = $url.replace('#PREFIX#', $prefix); this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id, this); @@ -228,15 +232,27 @@ this.TabRegistry[$index] = new Array(); this.TabRegistry[$index]['tab_id'] = $tab_id; this.TabRegistry[$index]['prefix'] = $tab.getAttribute('prefix'); - this.TabRegistry[$index]['module_path'] = $tab.getAttribute('edit_template').substring(0, $tab.getAttribute('edit_template').indexOf('/')); + if ($tab_id == 'categories') { + this.TabRegistry[$index]['module_path'] = ''; + } + else { + this.TabRegistry[$index]['module_path'] = $tab.getAttribute('edit_template').substring(0, $tab.getAttribute('edit_template').indexOf('/')); + } this.TabRegistry[$index]['view_template'] = $tab.getAttribute('view_template'); this.TabRegistry[$index]['edit_template'] = $tab.getAttribute('edit_template'); - this.TabRegistry[$index]['dep_buttons'] = $tab.getAttribute('dep_buttons').split(','); + this.TabRegistry[$index]['dep_buttons'] = $tab.getAttribute('dep_buttons').length > 0 ? $tab.getAttribute('dep_buttons').split(',') : new Array(); this.TabRegistry[$index]['index'] = $index; } // allows to get any information about tab Catalog.prototype.queryTabRegistry = function($search_key, $search_value, $return_key) { + if ($search_key == 'prefix') { + // remove special here (lists with specials, but tabs have no special) + if ($search_value.indexOf('.') != -1) { + $search_value = $search_value.substring(0, $search_value.indexOf('.')); + } + } + var $i = 0; while ($i < this.TabRegistry.length) { if (this.TabRegistry[$i][$search_key] == $search_value) {