Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -r5054 -r5057 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5054) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5057) @@ -6,7 +6,7 @@ this.URLMask = $url_mask; this.Separator = '#separator#'; this.ParentCategoryID = 0; - + this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); this.PreviousPrefix = this.ActivePrefix; @@ -28,7 +28,7 @@ var $i = 1; while ($i < this.TabRegistry.length) { // run through all prefixes - var $j = 1; + var $j = 1; while ($j < this.TabRegistry.length) { if (this.TabRegistry[$i]['prefix'] == this.TabRegistry[$j]['prefix']) { $j++; @@ -45,13 +45,13 @@ Catalog.prototype.submit_kernel_form = function($tab_id) { var $prefix = this.queryTabRegistry('tab_id', $tab_id, 'prefix'); var $kf = document.getElementById($form_name); - + Request.params = Request.serializeForm($kf); Request.method = $kf.method.toUpperCase(); - + this.BusyRequest[$prefix] = false; - Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); - + Request.makeRequest($kf.action, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div'); + $form_name = 'kernel_form'; // restore back to main form with current category id of catalog }; @@ -62,7 +62,7 @@ window.location.href = RegExp.$1; return false; } - + $params = $params.split(','); var $js_end = $text.indexOf($Catalog.Separator); if ($js_end != -1) { @@ -72,7 +72,7 @@ else { document.getElementById($params[0]).innerHTML = $text; } - + if (isset($Debugger)) $Debugger.Clear(); } @@ -83,42 +83,42 @@ Catalog.prototype.submit_event = function($prefix_special, $event, $t) { if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix(); var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id'); - + $form_name = $tab_id + '_form'; // set firstly, because set_hidden_field uses it if (isset($event)) set_hidden_field('events[' + $prefix_special + ']', $event); if (isset($t)) set_hidden_field('t', $t); - + this.submit_kernel_form($tab_id); } Catalog.prototype.go_to_cat = function($cat_id) { - if (!isset($cat_id)) { + if (!isset($cat_id)) { // gets current category $cat_id = get_hidden_field('m_cat_id'); } else { // sets new category to kernel_form in case if item tab // loads faster and will check if it's category is same // as parent category of categories list - + if (get_hidden_field('m_cat_id') == $cat_id) { // it's the same category, then don't reload category list return true; } set_hidden_field('m_cat_id', $cat_id); } - + // set all item tabs counters to "?" before quering catagories var $i = 1; while ($i < this.TabRegistry.length) { this.setItemCount(this.TabRegistry[$i]['prefix'], '?'); $i++; } - + // query sub categories of $cat_id var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id); - + var $prefix = this.TabRegistry[0]['prefix']; var $tab_id = this.TabRegistry[0]['tab_id']; this.BusyRequest[$prefix] = false; @@ -129,19 +129,19 @@ Catalog.prototype.switchTab = function($prefix) { if (!isset($prefix)) $prefix = this.ActivePrefix; - + if (this.BusyRequest[$prefix]) { alert('prefix: ['+$prefix+']; request busy: ['+this.BusyRequest[$prefix]+']'); } - + if (this.ActivePrefix != $prefix) { // hide source tab this.PreviousPrefix = this.ActivePrefix; document.getElementById(this.PreviousPrefix + '_tab').className = 'catalog-tab-unselected'; document.getElementById(this.queryTabRegistry('prefix', this.PreviousPrefix, 'tab_id') + '_div').style.display = 'none'; this.HideDependentButtons(this.PreviousPrefix); } - + // show destination tab this.ActivePrefix = $prefix; document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected'; @@ -150,15 +150,15 @@ this.ShowDependentButtons(this.ActivePrefix); this.setViewMenu(this.ActivePrefix); setCookie(this.CookiePrefix + 'active_prefix', 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'); if ($cat_id != $tab_cat_id) { // 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); - + this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $div_id, this.successCallback, this.errorCallback, $div_id); // $Debugger.ShowProps(this.BusyRequest); @@ -187,7 +187,7 @@ while ($i < this.TabRegistry.length) { if (this.TabRegistry[$i][$search_key] == $search_value) { return this.TabRegistry[$i][$return_key]; - break; + break; } $i++; }