Index: trunk/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -N -r4996 -r4997 --- trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 4996) +++ trunk/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 4997) @@ -1,13 +1,13 @@ - + - + - + @@ -117,8 +117,8 @@ } _progressText = ''; - var $separator = '#separator#'; + var $tab_registry = new Array(); function go_to_cat($cat_id) { var $url = ''; @@ -128,19 +128,48 @@ Request.makeRequest($url.replace('#REPLACE#', $cat_id), Catalog.BusyRequest, 'categories_div', Catalog.successCallback, Catalog.errorCallback, 'categories_div'); } + + function switchTab($prefix) { + alert('switching to ['+$prefix+']'); + } + + // adds information about tab to tab_registry + function registerTab($tab_id) { + var $tab = document.getElementById($tab_id + '_div'); + var $index = $tab_registry.length; + $tab_registry[$index] = new Array(); + $tab_registry[$index]['tab_id'] = $tab_id; + $tab_registry[$index]['prefix'] = $tab.getAttribute('prefix'); + $tab_registry[$index]['edit_template'] = $tab.getAttribute('edit_template'); + } + + + // allows to get any information about tab + function queryTabRegistry($search_key, $search_value, $return_key) + { + var $i = 0; + while ($i < $tab_registry.length) { + if ($tab_registry[$i][$search_key] == $search_value) { + return $tab_registry[$i][$return_key]; + break; + } + $i++; + } + return '<' + $search_key + '=' + $search_value + '>'; + }
+ - + - - - + +
+ + -
- - + @@ -165,48 +194,45 @@

-
+ - -
- - - - - - -
- - - - - - -
-
- -
- - - - - + + + + + +
+ ');"> + + + + + +
+ + + + + +
+
+ +
+ -
- @@ -222,5 +248,4 @@ \ No newline at end of file Index: trunk/kernel/admin_templates/catalog.tpl =================================================================== diff -u -N -r4996 -r4997 --- trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 4996) +++ trunk/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 4997) @@ -1,13 +1,13 @@ - + - + - + @@ -117,8 +117,8 @@ } _progressText = ''; - var $separator = '#separator#'; + var $tab_registry = new Array(); function go_to_cat($cat_id) { var $url = ''; @@ -128,19 +128,48 @@ Request.makeRequest($url.replace('#REPLACE#', $cat_id), Catalog.BusyRequest, 'categories_div', Catalog.successCallback, Catalog.errorCallback, 'categories_div'); } + + function switchTab($prefix) { + alert('switching to ['+$prefix+']'); + } + + // adds information about tab to tab_registry + function registerTab($tab_id) { + var $tab = document.getElementById($tab_id + '_div'); + var $index = $tab_registry.length; + $tab_registry[$index] = new Array(); + $tab_registry[$index]['tab_id'] = $tab_id; + $tab_registry[$index]['prefix'] = $tab.getAttribute('prefix'); + $tab_registry[$index]['edit_template'] = $tab.getAttribute('edit_template'); + } + + + // allows to get any information about tab + function queryTabRegistry($search_key, $search_value, $return_key) + { + var $i = 0; + while ($i < $tab_registry.length) { + if ($tab_registry[$i][$search_key] == $search_value) { + return $tab_registry[$i][$return_key]; + break; + } + $i++; + } + return '<' + $search_key + '=' + $search_value + '>'; + }
+ - + - - - + +
+ + -
- - + @@ -165,48 +194,45 @@

-
+ - -
- - - - - - -
- - - - - - -
-
- -
- - - - - + + + + + +
+ ');"> + + + + + +
+ + + + + +
+
+ +
+ -
- @@ -222,5 +248,4 @@ \ No newline at end of file Index: trunk/kernel/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r4996 -r4997 --- trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4996) +++ trunk/kernel/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4997) @@ -221,15 +221,18 @@ } } - if(isset($params['block'])) - { + if (isset($params['block'])) { return $this->PrintList($params); } - else - { + else { $params['block'] = $params['block_main']; - $params['row_start_block'] = $params['block_row_start']; - $params['row_end_block'] = $params['block_row_end']; + if (isset($params['block_row_start'])) { + $params['row_start_block'] = $params['block_row_start']; + } + + if (isset($params['block_row_end'])) { + $params['row_end_block'] = $params['block_row_end']; + } return $this->PrintList2($params); } } Index: trunk/kernel/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r4842 -r4997 --- trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4842) +++ trunk/kernel/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4997) @@ -330,6 +330,26 @@ return $ret; } + + /** + * Returns list of module item tabs that have view permission in current category + * + * @param Array $params + */ + function ListCatalogTabs($params) + { + $ret = ''; + $block_params = Array('name' => $params['render_as']); + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { + $prefix = $module_info['Var']; + $view_perm = $this->Application->getUnitOption($prefix, 'PermItemPrefix'); + if (!$this->Application->CheckPermission($view_perm, 0) || ($prefix == 'm')) continue; + $block_params['title'] = '['.$prefix.'] Items'; + $block_params['prefix'] = $prefix; + $ret .= $this->Application->ParseBlock($block_params); + } + return $ret; + } } ?> \ No newline at end of file Index: trunk/core/units/admin/admin_tag_processor.php =================================================================== diff -u -N -r4842 -r4997 --- trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4842) +++ trunk/core/units/admin/admin_tag_processor.php (.../admin_tag_processor.php) (revision 4997) @@ -330,6 +330,26 @@ return $ret; } + + /** + * Returns list of module item tabs that have view permission in current category + * + * @param Array $params + */ + function ListCatalogTabs($params) + { + $ret = ''; + $block_params = Array('name' => $params['render_as']); + foreach ($this->Application->ModuleInfo as $module_name => $module_info) { + $prefix = $module_info['Var']; + $view_perm = $this->Application->getUnitOption($prefix, 'PermItemPrefix'); + if (!$this->Application->CheckPermission($view_perm, 0) || ($prefix == 'm')) continue; + $block_params['title'] = '['.$prefix.'] Items'; + $block_params['prefix'] = $prefix; + $ret .= $this->Application->ParseBlock($block_params); + } + return $ret; + } } ?> \ No newline at end of file Index: trunk/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r4996 -r4997 --- trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4996) +++ trunk/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 4997) @@ -221,15 +221,18 @@ } } - if(isset($params['block'])) - { + if (isset($params['block'])) { return $this->PrintList($params); } - else - { + else { $params['block'] = $params['block_main']; - $params['row_start_block'] = $params['block_row_start']; - $params['row_end_block'] = $params['block_row_end']; + if (isset($params['block_row_start'])) { + $params['row_start_block'] = $params['block_row_start']; + } + + if (isset($params['block_row_end'])) { + $params['row_end_block'] = $params['block_row_end']; + } return $this->PrintList2($params); } } Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r4971 -r4997 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4971) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4997) @@ -520,7 +520,7 @@ function ModuleInclude($params) { $ret = ''; - $block_params = Array('is_silent' => 2); // don't make fatal errors in case if template is missing + $block_params = array_merge($params, Array('is_silent' => 2)); // don't make fatal errors in case if template is missing $current_template = $this->Application->GetVar('t'); foreach ($this->Application->ModuleInfo as $module_name => $module_data) { $module_key = strtolower($module_name);