Index: trunk/kernel/units/general/helpers/permissions_helper.php
===================================================================
diff -u -r4842 -r5005
--- trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 4842)
+++ trunk/kernel/units/general/helpers/permissions_helper.php (.../permissions_helper.php) (revision 5005)
@@ -186,7 +186,7 @@
continue;
}
$perm_name = $item_prefix.'.'.$perm_mapping[$perm_name];
- $this->showDebug('Event '.$event->Name.' permission(-s): '.$perm_name.'');
+ $this->showDebug('Event '.$event->Name.' permission(-s): '.$perm_name.'', Array());
$perm_status = $this->CheckPermission($perm_name, 0, $category_id);
if ($perm_status) {
@@ -208,9 +208,10 @@
return $perm_status;
}
- function showDebug($text)
+ function showDebug($text, $params)
{
- if (!$this->Application->isDebugMode()) return true;
+ $is_ajax = isset($params['ajax']) && $params['ajax'];
+ if (!$this->Application->isDebugMode() || $is_ajax) return true;
echo $text.'
';
}
@@ -220,7 +221,7 @@
$permission_groups = getArrayValue($params, 'permissions');
if ($permission_groups) {
- $this->showDebug('Tag '.$tag_name.' permission(-s): '.$permission_groups.'');
+ $this->showDebug('Tag '.$tag_name.' permission(-s): '.$permission_groups.'', $params);
$permission_groups = explode('|', $permission_groups);
$group_has_permission = false;
foreach ($permission_groups as $permission_group) {
@@ -238,7 +239,7 @@
return false;
}
elseif ($perm_event) {
- $this->showDebug('Tag '.$tag_name.' permission_event: '.$perm_event.'');
+ $this->showDebug('Tag '.$tag_name.' permission_event: '.$perm_event.'', $params);
list($prefix, $event) = explode(':', $perm_event);
$event_handler =& $this->Application->recallObject($prefix.'_EventHandler');
return $event_handler->CheckPermission( new kEvent($perm_event) );
Index: trunk/kernel/admin_templates/img/toolbar/tool_new_link.gif
===================================================================
diff -u
Binary files differ
Index: trunk/core/admin_templates/js/catalog.js
===================================================================
diff -u -r5002 -r5005
--- trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5002)
+++ trunk/core/admin_templates/js/catalog.js (.../catalog.js) (revision 5005)
@@ -75,31 +75,30 @@
Catalog.prototype.switchTab = function($prefix) {
- alert('switch tab called ['+$prefix+'/'+this.ActivePrefix+']');
if (!isset($prefix)) $prefix = this.ActivePrefix;
-
- var $cat_id = get_hidden_field('m_cat_id');
- var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div';
- var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
- if ((this.ActivePrefix == $prefix && $cat_id == $tab_cat_id) || (this.TabRegistry.length == 1)) {
- // clicked on current tab + same category || no item tabs = do nothing
- alert('problems in switchtab, prefix: '+$prefix+'; cat_id: '+$cat_id+'; tab_cat_id:'+$tab_cat_id);
- return true;
- }
-
- // switch tab
- if (this.ActivePrefix) {
+ if (this.ActivePrefix != $prefix) {
+ // 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';
}
+
+ // show destination tab
this.ActivePrefix = $prefix;
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected';
-
- // query tab content
- var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab');
- $url = $url.replace('#CATEGORY_ID#', $cat_id);
-
- Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
+ var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div'; // destination tab
+ document.getElementById($div_id).style.display = 'block';
+
+ // 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);
+
+ Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
+ }
}
// adds information about tab to tab_registry
@@ -111,6 +110,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]['index'] = $index;
}
// allows to get any information about tab
@@ -124,4 +124,24 @@
$i++;
}
return false;
+}
+
+Catalog.prototype.HideTab = function($prefix) {
+
+ var $tab = document.getElementById($prefix + '_tab_container');
+ if ($tab) {
+ $tab.style.display = 'none';
+ var $index = this.queryTabRegistry('prefix', $prefix, 'index'); // index of hidden tab
+ if ($index + 1 < this.TabRegistry.length) {
+ // some tabs exists after hidden tab
+ this.ShowTab(this.queryTabRegistry('index', $index + 1, 'prefix'));
+ }
+ }
+}
+
+Catalog.prototype.ShowTab = function($prefix) {
+ var $tab = document.getElementById($prefix + '_tab_container');
+ if ($tab) {
+ $tab.style.display = 'block';
+ }
}
\ No newline at end of file
Index: trunk/kernel/admin_templates/incs/toolbar.js
===================================================================
diff -u -r3664 -r5005
--- trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 3664)
+++ trunk/kernel/admin_templates/incs/toolbar.js (.../toolbar.js) (revision 5005)
@@ -143,6 +143,8 @@
img.btn = this;
}
+ToolBarSeparator.prototype.Enable = function() { }
+ToolBarSeparator.prototype.Disable = function() { }
/* ----------- */
@@ -188,6 +190,14 @@
if(this.ButtonExists(button_id)) this.Buttons[button_id].Show();
}
+ToolBar.prototype.SetEnabled = function(button_id, $enabled) {
+ var $ret = $enabled ? this.EnableButton(button_id) : this.DisableButton(button_id);
+}
+
+ToolBar.prototype.SetVisible = function(button_id, $visible) {
+ var $ret = $visible ? this.ShowButton(button_id) : this.HideButton(button_id);
+}
+
ToolBar.prototype.GetButtonImage = function(button_id) {
if( this.ButtonExists(button_id) ) return this.Buttons[button_id].imgObject;
}
Index: trunk/core/admin_templates/catalog/catalog.tpl
===================================================================
diff -u -r5002 -r5005
--- trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5002)
+++ trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 5005)
@@ -41,6 +41,10 @@
a_toolbar.AddButton( new ToolBarButton('editcat', '', edit) );
+
+
+
+
a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '',
@@ -166,7 +170,7 @@
-
+ | | _tab_container" nowrap="nowrap" width="200">
_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('');">
@@ -177,20 +181,21 @@
|
+ |
+
+
|
+
-
-
- |
-
+
Index: trunk/kernel/admin_templates/img/toolbar/tool_new_link_f2.gif
===================================================================
diff -u
Binary files differ
Index: trunk/kernel/admin_templates/img/toolbar/tool_new_link_f3.gif
===================================================================
diff -u
Binary files differ
Index: trunk/kernel/admin_templates/incs/catalog.js
===================================================================
diff -u -r5002 -r5005
--- trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5002)
+++ trunk/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 5005)
@@ -75,31 +75,30 @@
Catalog.prototype.switchTab = function($prefix) {
- alert('switch tab called ['+$prefix+'/'+this.ActivePrefix+']');
if (!isset($prefix)) $prefix = this.ActivePrefix;
-
- var $cat_id = get_hidden_field('m_cat_id');
- var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div';
- var $tab_cat_id = document.getElementById($div_id).getAttribute('category_id');
- if ((this.ActivePrefix == $prefix && $cat_id == $tab_cat_id) || (this.TabRegistry.length == 1)) {
- // clicked on current tab + same category || no item tabs = do nothing
- alert('problems in switchtab, prefix: '+$prefix+'; cat_id: '+$cat_id+'; tab_cat_id:'+$tab_cat_id);
- return true;
- }
-
- // switch tab
- if (this.ActivePrefix) {
+ if (this.ActivePrefix != $prefix) {
+ // 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';
}
+
+ // show destination tab
this.ActivePrefix = $prefix;
document.getElementById(this.ActivePrefix + '_tab').className = 'catalog-tab-selected';
-
- // query tab content
- var $url = this.URLMask.replace('#TEMPLATE_NAME#', this.queryTabRegistry('prefix', $prefix, 'module_path') + '/catalog_tab');
- $url = $url.replace('#CATEGORY_ID#', $cat_id);
-
- Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
+ var $div_id = this.queryTabRegistry('prefix', $prefix, 'tab_id') + '_div'; // destination tab
+ document.getElementById($div_id).style.display = 'block';
+
+ // 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);
+
+ Request.makeRequest($url, this.BusyRequest, $div_id, this.successCallback, this.errorCallback, $div_id);
+ }
}
// adds information about tab to tab_registry
@@ -111,6 +110,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]['index'] = $index;
}
// allows to get any information about tab
@@ -124,4 +124,24 @@
$i++;
}
return false;
+}
+
+Catalog.prototype.HideTab = function($prefix) {
+
+ var $tab = document.getElementById($prefix + '_tab_container');
+ if ($tab) {
+ $tab.style.display = 'none';
+ var $index = this.queryTabRegistry('prefix', $prefix, 'index'); // index of hidden tab
+ if ($index + 1 < this.TabRegistry.length) {
+ // some tabs exists after hidden tab
+ this.ShowTab(this.queryTabRegistry('index', $index + 1, 'prefix'));
+ }
+ }
+}
+
+Catalog.prototype.ShowTab = function($prefix) {
+ var $tab = document.getElementById($prefix + '_tab_container');
+ if ($tab) {
+ $tab.style.display = 'block';
+ }
}
\ No newline at end of file
Index: trunk/kernel/admin_templates/catalog.tpl
===================================================================
diff -u -r5002 -r5005
--- trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5002)
+++ trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 5005)
@@ -41,6 +41,10 @@
a_toolbar.AddButton( new ToolBarButton('editcat', '', edit) );
+
+
+
+
a_toolbar.AddButton( new ToolBarButton('edit', '', edit) );
a_toolbar.AddButton( new ToolBarButton('delete', '',
@@ -166,7 +170,7 @@
-
+ | | _tab_container" nowrap="nowrap" width="200">
_tab" cellpadding="0" cellspacing="0" width="100%" class="catalog-tab-unselected" onclick="$Catalog.switchTab('');">
@@ -177,20 +181,21 @@
|
+ |
+
+
|
+
-
-
- |
-
+
Index: trunk/kernel/admin_templates/incs/grid.js
===================================================================
diff -u -r4596 -r5005
--- trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 4596)
+++ trunk/kernel/admin_templates/incs/grid.js (.../grid.js) (revision 5005)
@@ -194,6 +194,7 @@
}
Grid.prototype.ClearSelection = function( force, called_from ) {
+// alert('selection clear. force: '+force+'; called_from: '+called_from);
if (typeof(force) == 'undefined') force = false;
if (this.CountSelected() == 0 && !force) return;
for (var i in this.Items) {
@@ -255,19 +256,19 @@
this.DblClick();
}
-Grid.prototype.SetDependantToolbarButtons = function( buttons, mode )
-{
- if (typeof(mode) == 'undefined') mode = 1; //direct (use 0 for invert mode)
- for (var i in buttons) {
- this.DependantButtons.push(new Array(buttons[i], mode));
+Grid.prototype.SetDependantToolbarButtons = function($buttons, $direct, $mode) {
+ if (!isset($direct)) $direct = true; // direct (use false for invert mode)
+ if (!isset($mode)) $mode = 1; // enable/disable (use 2 for show/hide mode)
+ for (var i in $buttons) {
+ this.DependantButtons.push(new Array($buttons[i], $direct, $mode));
}
//this.DependantButtons = buttons;
this.CheckDependencies();
}
Grid.prototype.CheckDependencies = function()
{
- var enabling = (this.CountSelected() > 0)
+ var enabling = (this.CountSelected() > 0);
for (var i in this.DependantButtons) {
if (this.DependantButtons[i][0].match("portal:(.*)")) {
button_name = RegExp.$1;
@@ -282,12 +283,12 @@
}
}
else {
- if (enabling == this.DependantButtons[i][1]) {
- this.ToolBar.EnableButton(this.DependantButtons[i][0]);
+ if (this.DependantButtons[i][2] == 1) {
+ this.ToolBar.SetEnabled(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
}
else {
- this.ToolBar.DisableButton(this.DependantButtons[i][0]);
- }
+ this.ToolBar.SetVisible(this.DependantButtons[i][0], enabling == this.DependantButtons[i][1]);
+ }
}
}
//if (enabling) this.ClearAlternativeGridsSelection();
Index: trunk/kernel/admin_templates/incs/grid_blocks.tpl
===================================================================
diff -u -r5002 -r5005
--- trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5002)
+++ trunk/kernel/admin_templates/incs/grid_blocks.tpl (.../grid_blocks.tpl) (revision 5005)
@@ -252,7 +252,7 @@
-
+