Index: trunk/core/admin_templates/js/catalog.js =================================================================== diff -u -N -r5018 -r5022 --- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5018) +++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5022) @@ -42,11 +42,6 @@ document.getElementById($params[0]).innerHTML = $text; } - if ($params[0] == 'categories_div') { - // category has been changed -> refresh current item tab - $Catalog.switchTab(); - } - if (isset($Debugger)) $Debugger.Clear(); } @@ -66,9 +61,16 @@ 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 + set_hidden_field('m_cat_id', $cat_id); + } // set all item tabs counters to "?" before quering catagories var $i = 1; @@ -79,7 +81,8 @@ // query sub categories of $cat_id var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id); - Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div'); + Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div'); + this.switchTab(); // refresh current item tab } @@ -111,6 +114,9 @@ Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id); } + /*else { + alert('refresh disabled = {tab: '+this.ActivePrefix+'; cat_id: '+$cat_id+'}'); + }*/ } // adds information about tab to tab_registry Index: trunk/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -N -r5018 -r5022 --- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5018) +++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5022) @@ -42,11 +42,6 @@ document.getElementById($params[0]).innerHTML = $text; } - if ($params[0] == 'categories_div') { - // category has been changed -> refresh current item tab - $Catalog.switchTab(); - } - if (isset($Debugger)) $Debugger.Clear(); } @@ -66,9 +61,16 @@ 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 + set_hidden_field('m_cat_id', $cat_id); + } // set all item tabs counters to "?" before quering catagories var $i = 1; @@ -79,7 +81,8 @@ // query sub categories of $cat_id var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id); - Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div'); + Request.makeRequest($url, this.BusyRequest, 'categories_div', this.successCallback, this.errorCallback, 'categories_div'); + this.switchTab(); // refresh current item tab } @@ -111,6 +114,9 @@ Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id); } + /*else { + alert('refresh disabled = {tab: '+this.ActivePrefix+'; cat_id: '+$cat_id+'}'); + }*/ } // adds information about tab to tab_registry Index: trunk/core/units/categories/categories_config.php =================================================================== diff -u -N -r5015 -r5022 --- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5015) +++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 5022) @@ -48,7 +48,7 @@ ), 'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), + 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), 'category_items'=> Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Items!"), Index: trunk/kernel/admin_templates/xml/categories_list.tpl =================================================================== diff -u -N -r5018 -r5022 --- trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5018) +++ trunk/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 5022) @@ -1,13 +1,12 @@ -Grids['c'] = new Grid('table_white_selected', ':original', edit, a_toolbar); +Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar); Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]'); Grids['c'].InitItems(); Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6')); -setInnerHTML('category_count', ); -set_hidden_field('m_cat_id', ); +$Catalog.setItemCount('c', ''); @@ -29,15 +28,13 @@ setInnerHTML('category_path', ''); -set_hidden_field('m_cat_id', ); a_toolbar.DisableButton('upcat'); a_toolbar.DisableButton('homecat'); a_toolbar.EnableButton('upcat'); a_toolbar.EnableButton('homecat'); - #separator# Index: trunk/core/admin_templates/categories/xml/categories_list.tpl =================================================================== diff -u -N -r5018 -r5022 --- trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5018) +++ trunk/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 5022) @@ -1,13 +1,12 @@ -Grids['c'] = new Grid('table_white_selected', ':original', edit, a_toolbar); +Grids['c'] = new Grid('c', 'table_white_selected', ':original', edit, a_toolbar); Grids['c'].AddItemsByIdMask('td', /^c_([0-9-]+)/, 'c[$$ID$$][CategoryId]'); Grids['c'].InitItems(); Grids['c'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline','sep3','cut','copy','move_up','move_down','sep6')); -setInnerHTML('category_count', ); -set_hidden_field('m_cat_id', ); +$Catalog.setItemCount('c', ''); @@ -29,15 +28,13 @@ setInnerHTML('category_path', ''); -set_hidden_field('m_cat_id', ); a_toolbar.DisableButton('upcat'); a_toolbar.DisableButton('homecat'); a_toolbar.EnableButton('upcat'); a_toolbar.EnableButton('homecat'); - #separator#
Index: trunk/kernel/units/categories/categories_config.php =================================================================== diff -u -N -r5015 -r5022 --- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5015) +++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 5022) @@ -48,7 +48,7 @@ ), 'category_list' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), - 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), + 'catalog' => Array('prefixes' => Array('c_List'), 'format' => "!la_title_Categories! (#c_recordcount#)"), 'category_items'=> Array('prefixes' => Array('c'), 'format' => "#c_status# '#c_titlefield#' - !la_title_Items!"), Index: trunk/admin/include/style.css =================================================================== diff -u -N -r842 -r5022 --- trunk/admin/include/style.css (.../style.css) (revision 842) +++ trunk/admin/include/style.css (.../style.css) (revision 5022) @@ -320,12 +320,6 @@ .action1:link { FONT-SIZE: 12px; COLOR: #006600; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } -.action1:unknown { - FONT-SIZE: 12px; COLOR: #006600; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} -.action1:unknown { - FONT-SIZE: 12px; COLOR: #006600; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} .action1:hover { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } @@ -335,12 +329,6 @@ .action2:link { FONT-SIZE: 12px; COLOR: #990000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } -.action2:unknown { - FONT-SIZE: 12px; COLOR: #990000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} -.action2:unknown { - FONT-SIZE: 12px; COLOR: #990000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} .action2:hover { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } @@ -350,12 +338,6 @@ .action3:link { FONT-SIZE: 12px; COLOR: #a27900; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } -.action3:unknown { - FONT-SIZE: 12px; COLOR: #a27900; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} -.action3:unknown { - FONT-SIZE: 12px; COLOR: #a27900; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} .action3:hover { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } @@ -365,12 +347,6 @@ .action4:link { FONT-SIZE: 12px; COLOR: #800080; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } -.action4:unknown { - FONT-SIZE: 12px; COLOR: #800080; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} -.action4:unknown { - FONT-SIZE: 12px; COLOR: #800080; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} .action4:hover { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } @@ -380,12 +356,6 @@ .action5:link { FONT-SIZE: 12px; COLOR: #0079a2; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } -.action5:unknown { - FONT-SIZE: 12px; COLOR: #0079a2; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} -.action5:unknown { - FONT-SIZE: 12px; COLOR: #0079a2; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none -} .action5:hover { FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none } Index: trunk/kernel/admin_templates/incs/grid.js =================================================================== diff -u -N -r5006 -r5022 --- trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5006) +++ trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5022) @@ -1,3 +1,32 @@ +var $GridManager = new GridManager(); + +function GridManager () { + this.Grids = Grids; // get all from global variable, in future replace all references to it with $GridManager.Grids + this.AlternativeGrids = new Array(); +} + +GridManager.prototype.AddAlternativeGrid = function ($source_grid, $destination_grid, $reciprocal) +{ + if (typeof(this.AlternativeGrids[$source_grid]) == 'undefined') { + // create array if it is first alternative grid to this one + this.AlternativeGrids[$source_grid] = new Array(); + } + this.AlternativeGrids[$source_grid].push($destination_grid); + + if ($reciprocal) { + this.AddAlternativeGrid($destination_grid, $source_grid); + } +} + +GridManager.prototype.ClearAlternativeGridsSelection = function ($source_prefix) +{ + var $i = 0; + while ($i < this.AlternativeGrids[$source_prefix].length) { + this.Grids[ this.AlternativeGrids[$source_prefix][$i] ].ClearSelection(); + $i++; + } +} + function GridItem(grid, an_element, cb, item_id, class_on, class_off) { this.Grid = grid; @@ -141,8 +170,9 @@ } -function Grid(class_on, class_off, dbl_click, toolbar) +function Grid(prefix, class_on, class_off, dbl_click, toolbar) { + this.prefix = prefix; this.class_on = class_on; this.class_off = class_off; this.Items = new Array(); @@ -297,17 +327,13 @@ Grid.prototype.ClearAlternativeGridsSelection = function (called_from) { - for (var i in this.AlternativeGrids) { - this.AlternativeGrids[i].ClearSelection(null, called_from + ' -> Grid.ClearAlternativeGridsSelection'); - } + $GridManager.ClearAlternativeGridsSelection(this.prefix); } Grid.prototype.AddAlternativeGrid = function (alt_grid, reciprocal) { - this.AlternativeGrids.push(alt_grid); - if (typeof(reciprocal) != 'undefined' && reciprocal) { - alt_grid.AddAlternativeGrid(this); - } + var $dst_prefix = typeof('alt_grid') == 'string' ? alt_grid : alt_grid.prefix; + $GridManager.AddAlternativeGrid(this.prefix, $dst_prefix, reciprocal); } Grid.prototype.FirstSelected = function () Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl =================================================================== diff -u -N -r5005 -r5022 --- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5005) +++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5022) @@ -312,7 +312,7 @@ - Grids[''] = new Grid('', ':original', edit, a_toolbar); + Grids[''] = new Grid('', '', ':original', edit, a_toolbar); Grids[''].AddItemsByIdMask('', /^_([\d\w-]+)/, '[$$ID$$][]'); Grids[''].InitItems(); Index: trunk/kernel/admin_templates/category_selector.tpl =================================================================== diff -u -N -r4834 -r5022 --- trunk/kernel/admin_templates/category_selector.tpl (.../category_selector.tpl) (revision 4834) +++ trunk/kernel/admin_templates/category_selector.tpl (.../category_selector.tpl) (revision 5022) @@ -136,7 +136,7 @@