Index: branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl
===================================================================
diff -u -N -r5610 -r5613
--- branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5610)
+++ branches/unlabeled/unlabeled-1.23.2/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5613)
@@ -104,12 +104,17 @@
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event('c', 'OnPasteClipboard');
+ $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
+ $object.resetTabs(true);
+ $object.switchTab();
+ } );
}
) );
a_toolbar.AddButton( new ToolBarButton('clear', '', function() {
- $Catalog.submit_event('c', 'OnClearClipboard');
+ $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
+ $GridManager.CheckDependencies($object.ActivePrefix);
+ } );
}
) );
Index: branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js
===================================================================
diff -u -N -r5609 -r5613
--- branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5609)
+++ branches/unlabeled/unlabeled-1.27.2/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5613)
@@ -6,6 +6,8 @@
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.TabRegistry = new Array();
this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix');
@@ -15,20 +17,20 @@
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
- if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 1) {
+ if ($prefix !== this.ActivePrefix && this.TabRegistry.length > this.TabShift) {
// ActivePrefix not set or has non-existing prefix value
- this.ActivePrefix = this.TabRegistry[1]['prefix'];
+ this.ActivePrefix = this.TabRegistry[this.TabShift]['prefix'];
}
this.SetAlternativeTabs();
this.go_to_cat();
}
Catalog.prototype.SetAlternativeTabs = function () {
// set alternative grids between all items (catalog is set when tab is loaded via AJAX first time)
- var $i = 1;
+ var $i = this.TabShift;
while ($i < this.TabRegistry.length) {
// run through all prefixes
- var $j = 1;
+ var $j = this.TabShift;
while ($j < this.TabRegistry.length) {
if (this.TabRegistry[$i]['prefix'] == this.TabRegistry[$j]['prefix']) {
$j++;
@@ -92,6 +94,10 @@
document.getElementById($params[0]).innerHTML = $text;
}
+ if (typeof($object.OnResponceMethod) == 'function') {
+ $object.OnResponceMethod($object);
+ $object.OnResponceMethod = null;
+ }
if (typeof($Debugger) != 'undefined') {
$Debugger.Clear();
@@ -102,7 +108,11 @@
alert('AJAX ERROR: ' + Request.getErrorHtml($request));
}
-Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
+Catalog.prototype.submit_event = function($prefix_special, $event, $t, $OnResponceMethod) {
+ if (typeof($OnResponceMethod) == 'function') {
+ this.OnResponceMethod = $OnResponceMethod;
+ }
+
var $prev_template = get_hidden_field('t');
if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix();
var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id');
@@ -133,12 +143,7 @@
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++;
- }
+ this.resetTabs(false);
// query sub categories of $cat_id
var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id);
@@ -150,8 +155,25 @@
this.switchTab(); // refresh current item tab
}
+// set all item tabs counters to "?" before quering catagories
+Catalog.prototype.resetTabs = function($reset_content) {
+ var $i = this.TabShift;
+ while ($i < this.TabRegistry.length) {
+ this.setItemCount(this.TabRegistry[$i]['prefix'], '?');
+ $i++;
+ }
+
+ if ($reset_content) {
+ // set category for all tabs to -1 (forces reload next time)
+ $i = this.TabShift;
+ while ($i < this.TabRegistry.length) {
+ document.getElementById(this.TabRegistry[$i]['tab_id'] + '_div').setAttribute('category_id', -1);
+ $i++;
+ }
+ }
+}
-Catalog.prototype.switchTab = function($prefix) {
+Catalog.prototype.switchTab = function($prefix, $force) {
if (this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix') != this.ActivePrefix) {
// active prefix is not registred -> cookie left, but not modules installed/enabled at the moment
return false;
@@ -180,13 +202,13 @@
this.setViewMenu(this.ActivePrefix);
setCookie(this.CookiePrefix + 'active_prefix', this.ActivePrefix);
- this.refreshTab($prefix, $div_id);
+ this.refreshTab($prefix, $div_id, $force);
}
-Catalog.prototype.refreshTab = function($prefix, $div_id) {
+Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
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) {
+ if ($cat_id != $tab_cat_id || $force) {
// 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);
Index: branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
diff -u -N -r5563 -r5613
--- branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5563)
+++ branches/unlabeled/unlabeled-1.8.2/core/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5613)
@@ -38,11 +38,11 @@
this.switchTab(); // refresh current item tab
}
- Catalog.prototype.refreshTab = function($prefix, $div_id) {
+ Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
var $group_id = get_hidden_field('current_group_id');
// alert('refreshTab. GroupID: '+$group_id);
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
- if ($group_id != $tab_group_id) {
+ if ($group_id != $tab_group_id || $force) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
this.BusyRequest[$prefix] = false;
Index: branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl
===================================================================
diff -u -N -r5563 -r5613
--- branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5563)
+++ branches/unlabeled/unlabeled-1.8.2/kernel/admin_templates/categories/categories_edit_permissions.tpl (.../categories_edit_permissions.tpl) (revision 5613)
@@ -38,11 +38,11 @@
this.switchTab(); // refresh current item tab
}
- Catalog.prototype.refreshTab = function($prefix, $div_id) {
+ Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
var $group_id = get_hidden_field('current_group_id');
// alert('refreshTab. GroupID: '+$group_id);
var $tab_group_id = document.getElementById($div_id).getAttribute('group_id');
- if ($group_id != $tab_group_id) {
+ if ($group_id != $tab_group_id || $force) {
// query tab content only in case if not queried or category don't match
var $url = this.URLMask.replace('#ITEM_PREFIX#', $prefix).replace('#GROUP_ID#', $group_id);
this.BusyRequest[$prefix] = false;
Index: branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js
===================================================================
diff -u -N -r5609 -r5613
--- branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5609)
+++ branches/unlabeled/unlabeled-1.27.2/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5613)
@@ -6,6 +6,8 @@
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.TabRegistry = new Array();
this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix');
@@ -15,20 +17,20 @@
Catalog.prototype.Init = function () {
var $prefix = this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix');
- if ($prefix !== this.ActivePrefix && this.TabRegistry.length > 1) {
+ if ($prefix !== this.ActivePrefix && this.TabRegistry.length > this.TabShift) {
// ActivePrefix not set or has non-existing prefix value
- this.ActivePrefix = this.TabRegistry[1]['prefix'];
+ this.ActivePrefix = this.TabRegistry[this.TabShift]['prefix'];
}
this.SetAlternativeTabs();
this.go_to_cat();
}
Catalog.prototype.SetAlternativeTabs = function () {
// set alternative grids between all items (catalog is set when tab is loaded via AJAX first time)
- var $i = 1;
+ var $i = this.TabShift;
while ($i < this.TabRegistry.length) {
// run through all prefixes
- var $j = 1;
+ var $j = this.TabShift;
while ($j < this.TabRegistry.length) {
if (this.TabRegistry[$i]['prefix'] == this.TabRegistry[$j]['prefix']) {
$j++;
@@ -92,6 +94,10 @@
document.getElementById($params[0]).innerHTML = $text;
}
+ if (typeof($object.OnResponceMethod) == 'function') {
+ $object.OnResponceMethod($object);
+ $object.OnResponceMethod = null;
+ }
if (typeof($Debugger) != 'undefined') {
$Debugger.Clear();
@@ -102,7 +108,11 @@
alert('AJAX ERROR: ' + Request.getErrorHtml($request));
}
-Catalog.prototype.submit_event = function($prefix_special, $event, $t) {
+Catalog.prototype.submit_event = function($prefix_special, $event, $t, $OnResponceMethod) {
+ if (typeof($OnResponceMethod) == 'function') {
+ this.OnResponceMethod = $OnResponceMethod;
+ }
+
var $prev_template = get_hidden_field('t');
if (!isset($prefix_special)) $prefix_special = this.getCurrentPrefix();
var $tab_id = this.queryTabRegistry('prefix', $prefix_special, 'tab_id');
@@ -133,12 +143,7 @@
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++;
- }
+ this.resetTabs(false);
// query sub categories of $cat_id
var $url = this.URLMask.replace('#TEMPLATE_NAME#', 'xml/categories_list').replace('#CATEGORY_ID#', $cat_id);
@@ -150,8 +155,25 @@
this.switchTab(); // refresh current item tab
}
+// set all item tabs counters to "?" before quering catagories
+Catalog.prototype.resetTabs = function($reset_content) {
+ var $i = this.TabShift;
+ while ($i < this.TabRegistry.length) {
+ this.setItemCount(this.TabRegistry[$i]['prefix'], '?');
+ $i++;
+ }
+
+ if ($reset_content) {
+ // set category for all tabs to -1 (forces reload next time)
+ $i = this.TabShift;
+ while ($i < this.TabRegistry.length) {
+ document.getElementById(this.TabRegistry[$i]['tab_id'] + '_div').setAttribute('category_id', -1);
+ $i++;
+ }
+ }
+}
-Catalog.prototype.switchTab = function($prefix) {
+Catalog.prototype.switchTab = function($prefix, $force) {
if (this.queryTabRegistry('prefix', this.ActivePrefix, 'prefix') != this.ActivePrefix) {
// active prefix is not registred -> cookie left, but not modules installed/enabled at the moment
return false;
@@ -180,13 +202,13 @@
this.setViewMenu(this.ActivePrefix);
setCookie(this.CookiePrefix + 'active_prefix', this.ActivePrefix);
- this.refreshTab($prefix, $div_id);
+ this.refreshTab($prefix, $div_id, $force);
}
-Catalog.prototype.refreshTab = function($prefix, $div_id) {
+Catalog.prototype.refreshTab = function($prefix, $div_id, $force) {
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) {
+ if ($cat_id != $tab_cat_id || $force) {
// 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);
Index: branches/unlabeled/unlabeled-1.11.2/kernel/admin_templates/incs/grid.js
===================================================================
diff -u -N -r5303 -r5613
--- branches/unlabeled/unlabeled-1.11.2/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5303)
+++ branches/unlabeled/unlabeled-1.11.2/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5613)
@@ -42,6 +42,12 @@
}
}
+GridManager.prototype.CheckDependencies = function ($prefix) {
+ if (typeof(this.Grids[$prefix]) != 'undefined') {
+ this.Grids[$prefix].CheckDependencies('GridManager.CheckDependencies');
+ }
+}
+
function GridItem(grid, an_element, cb, item_id, class_on, class_off)
{
this.Grid = grid;
@@ -162,7 +168,7 @@
}
}
}
- this.Grid.CheckDependencies();
+ this.Grid.CheckDependencies('GridItem.Click');
e.cancelBubble = true;
}
@@ -172,7 +178,7 @@
if (this.Grid.RadioMode) this.Grid.ClearSelection(null,'GridItem.cbClick');
this.Grid.ClearAlternativeGridsSelection('GridItem.cbClick');
this.Toggle();
- this.Grid.CheckDependencies();
+ this.Grid.CheckDependencies('GridItem.cbClick');
e.cancelBubble = true;
}
@@ -260,7 +266,7 @@
this.Items[i].UnSelect(force);
}
this.SelectedCount = 0;
- this.CheckDependencies();
+ this.CheckDependencies('Grid.ClearSelection');
}
Grid.prototype.GetSelected = function() {
@@ -286,14 +292,14 @@
this.Items[i].Select();
}
}
- this.CheckDependencies();
+ this.CheckDependencies('Grid.InvertSelection');
}
Grid.prototype.SelectAll = function() {
for (var i in this.Items) {
this.Items[i].Select();
}
- this.CheckDependencies();
+ this.CheckDependencies('Grid.SelectAll');
this.ClearAlternativeGridsSelection('Grid.SelectAll');
}
@@ -322,11 +328,12 @@
this.DependantButtons.push(new Array($buttons[i], $direct, $mode));
}
//this.DependantButtons = buttons;
- this.CheckDependencies();
+ this.CheckDependencies('Grid.SetDependantToolbarButtons');
}
-Grid.prototype.CheckDependencies = function()
+Grid.prototype.CheckDependencies = function($called_from)
{
+// alert('prefix: ' + this.prefix + '; ' + $called_from + ' -> Grid.CheckDependencies');
var enabling = (this.CountSelected() > 0);
for (var i in this.DependantButtons) {
if (this.DependantButtons[i][0].match("portal:(.*)")) {
Index: branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl
===================================================================
diff -u -N -r5610 -r5613
--- branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5610)
+++ branches/unlabeled/unlabeled-1.23.2/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5613)
@@ -104,12 +104,17 @@
a_toolbar.AddButton( new ToolBarButton('paste', '', function() {
- $Catalog.submit_event('c', 'OnPasteClipboard');
+ $Catalog.submit_event('c', 'OnPasteClipboard', null, function($object) {
+ $object.resetTabs(true);
+ $object.switchTab();
+ } );
}
) );
a_toolbar.AddButton( new ToolBarButton('clear', '', function() {
- $Catalog.submit_event('c', 'OnClearClipboard');
+ $Catalog.submit_event('c', 'OnClearClipboard', null, function($object) {
+ $GridManager.CheckDependencies($object.ActivePrefix);
+ } );
}
) );