Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -r9375 -r9524 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9375) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9524) @@ -175,20 +175,20 @@ WHERE SymLinkCategoryId IS NOT NULL'; $cache = $this->Conn->GetCol($sql, $id_field); } - + if (isset($cache[$category_id])) { - - //check if sym. link category is valid + + //check if sym. link category is valid $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - + $sql = 'SELECT '.$id_field.' FROM '.$table_name.' WHERE '.$id_field.' = '.$cache[$category_id]; - + $category_id = $this->Conn->GetOne($sql)? $cache[$category_id] : $category_id; - } - + } + return $category_id; } @@ -205,11 +205,11 @@ elseif ("$category_id" == 'current') { $category_id = $this->Application->GetVar('m_cat_id'); } - + $category_id = $this->getCategorySymLink($category_id); unset($params['cat_id'], $params['module']); - + $new_params = Array ('pass' => 'm', 'm_cat_id' => $category_id, 'pass_category' => 1); $params = array_merge_recursive2($params, $new_params); @@ -655,34 +655,54 @@ { return $this->Prefix.'_'.$params['type']; } - + /** * Checks if current category is valid symbolic link to another category * * @param Array $params * @return string */ function IsCategorySymLink($params) - { + { $object =& $this->getObject($params); /* @var $object kDBList */ - $sym_category_id = $object->GetDBField('SymLinkCategoryId'); - + $sym_category_id = $object->GetDBField('SymLinkCategoryId'); + if (is_null($sym_category_id)) { return false; } - + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); - + $sql = 'SELECT '.$id_field.' - FROM '.$table_name.' - WHERE '.$id_field.' = '.$sym_category_id; - + FROM '.$table_name.' + WHERE '.$id_field.' = '.$sym_category_id; + return $this->Conn->GetOne($sql)? true : false; - } + } + + /** + * Returns module prefix based on root category for given + * + * @param Array $params + * @return string + */ + function GetModulePrefix($params) + { + $object =& $this->getObject($params); + /* @var $object kDBItem */ + + $parent_path = explode('|', substr($object->GetDBField('ParentPath'), 1, -1)); + + $category_helper =& $this->Application->recallObject('CategoryHelper'); + /* @var $category_helper CategoryHelper */ + + $module_info = $category_helper->getCategoryModule($params, $parent_path); + return $module_info['Var']; + } } ?> \ No newline at end of file Index: branches/RC/core/admin_templates/categories/xml/tree_categories.tpl =================================================================== diff -u -r8929 -r9524 --- branches/RC/core/admin_templates/categories/xml/tree_categories.tpl (.../tree_categories.tpl) (revision 8929) +++ branches/RC/core/admin_templates/categories/xml/tree_categories.tpl (.../tree_categories.tpl) (revision 9524) @@ -1,6 +1,6 @@ - " icon="img/icons/icon24_catalog.gif" href="" onclick="checkCatalog()" load_url=""> + " icon="img/icons/icon24_catalog.gif" href="" onclick="checkCatalog(, '')" load_url=""> Index: branches/RC/core/admin_templates/categories/xml/categories_list.tpl =================================================================== diff -u -r9385 -r9524 --- branches/RC/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 9385) +++ branches/RC/core/admin_templates/categories/xml/categories_list.tpl (.../categories_list.tpl) (revision 9524) @@ -55,7 +55,7 @@ _" width="50%"> radiocheckbox" name="" id=""> img/itemicons/">  - );">: + , '');">: ( / )
Index: branches/RC/core/admin_templates/js/catalog.js =================================================================== diff -u -r8929 -r9524 --- branches/RC/core/admin_templates/js/catalog.js (.../catalog.js) (revision 8929) +++ branches/RC/core/admin_templates/js/catalog.js (.../catalog.js) (revision 9524) @@ -10,6 +10,7 @@ this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); this.PreviousPrefix = this.ActivePrefix; + this.TabByCategory = false; // preselect tab by category (used in catalog only) $ViewMenus = new Array('c'); } @@ -68,9 +69,9 @@ }; Catalog.prototype.successCallback = function($request, $params, $object) { - + var $text = $request.responseText; - + var $match_redirect = new RegExp('^#redirect#(.*)').exec($text); if ($match_redirect != null) { // redirect to external template requested @@ -79,14 +80,14 @@ } $params = $params.split(','); - + var $js_end = $text.indexOf($object.Separator); if ($js_end != -1) { - + // allow to detect if output is permitted by ajax request parameters var $request_visible = '$request_visible = ' + ($params[0].length ? 'true' : 'false') + "\n"; - + if ($params[0].length) { document.getElementById($params[0]).innerHTML = $text.substring($js_end + $object.Separator.length); eval($request_visible + $text.substring(0, $js_end)); @@ -138,7 +139,7 @@ } -Catalog.prototype.go_to_cat = function($cat_id) { +Catalog.prototype.go_to_cat = function($cat_id, $module_prefix) { if (!isset($cat_id)) { // gets current category $cat_id = get_hidden_field('m_cat_id'); @@ -164,7 +165,7 @@ var $tab_id = this.TabRegistry[0]['tab_id']; this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div', this); - this.switchTab(); // refresh current item tab + this.switchTab(this.TabByCategory ? $module_prefix : null); // refresh current item tab } // set all item tabs counters to "?" before quering catagories Index: branches/RC/kernel/admin_templates/xml/tree_categories.tpl =================================================================== diff -u -r8929 -r9524 --- branches/RC/kernel/admin_templates/xml/tree_categories.tpl (.../tree_categories.tpl) (revision 8929) +++ branches/RC/kernel/admin_templates/xml/tree_categories.tpl (.../tree_categories.tpl) (revision 9524) @@ -1,6 +1,6 @@ - " icon="img/icons/icon24_catalog.gif" href="" onclick="checkCatalog()" load_url=""> + " icon="img/icons/icon24_catalog.gif" href="" onclick="checkCatalog(, '')" load_url=""> Index: branches/RC/core/admin_templates/catalog/catalog.tpl =================================================================== diff -u -r9079 -r9524 --- branches/RC/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 9079) +++ branches/RC/core/admin_templates/catalog/catalog.tpl (.../catalog.tpl) (revision 9524) @@ -29,6 +29,7 @@ Request.progressText = ''; var $is_catalog = true; var $Catalog = new Catalog('', 'catalog_'); + $Catalog.TabByCategory = truefalse; var a_toolbar = new ToolBar(); Index: branches/RC/kernel/admin_templates/incs/catalog.js =================================================================== diff -u -r8929 -r9524 --- branches/RC/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 8929) +++ branches/RC/kernel/admin_templates/incs/catalog.js (.../catalog.js) (revision 9524) @@ -10,6 +10,7 @@ this.TabRegistry = new Array(); this.ActivePrefix = getCookie(this.CookiePrefix + 'active_prefix'); this.PreviousPrefix = this.ActivePrefix; + this.TabByCategory = false; // preselect tab by category (used in catalog only) $ViewMenus = new Array('c'); } @@ -68,9 +69,9 @@ }; Catalog.prototype.successCallback = function($request, $params, $object) { - + var $text = $request.responseText; - + var $match_redirect = new RegExp('^#redirect#(.*)').exec($text); if ($match_redirect != null) { // redirect to external template requested @@ -79,14 +80,14 @@ } $params = $params.split(','); - + var $js_end = $text.indexOf($object.Separator); if ($js_end != -1) { - + // allow to detect if output is permitted by ajax request parameters var $request_visible = '$request_visible = ' + ($params[0].length ? 'true' : 'false') + "\n"; - + if ($params[0].length) { document.getElementById($params[0]).innerHTML = $text.substring($js_end + $object.Separator.length); eval($request_visible + $text.substring(0, $js_end)); @@ -138,7 +139,7 @@ } -Catalog.prototype.go_to_cat = function($cat_id) { +Catalog.prototype.go_to_cat = function($cat_id, $module_prefix) { if (!isset($cat_id)) { // gets current category $cat_id = get_hidden_field('m_cat_id'); @@ -164,7 +165,7 @@ var $tab_id = this.TabRegistry[0]['tab_id']; this.BusyRequest[$prefix] = false; Request.makeRequest($url, this.BusyRequest[$prefix], $tab_id + '_div', this.successCallback, this.errorCallback, $tab_id + '_div', this); - this.switchTab(); // refresh current item tab + this.switchTab(this.TabByCategory ? $module_prefix : null); // refresh current item tab } // set all item tabs counters to "?" before quering catagories Index: branches/RC/admin/install/inportal_data.sql =================================================================== diff -u -r9237 -r9524 --- branches/RC/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 9237) +++ branches/RC/admin/install/inportal_data.sql (.../inportal_data.sql) (revision 9524) @@ -1,5 +1,8 @@ INSERT INTO ConfigurationAdmin VALUES ('AllowDeleteRootCats', 'la_Text_General', 'la_AllowDeleteRootCats', 'checkbox', NULL , NULL , 10.08, 0, 0); +INSERT INTO ConfigurationAdmin VALUES ('Catalog_PreselectModuleTab', 'la_Text_General', 'la_config_CatalogPreselectModuleTab', 'checkbox', NULL, NULL, 10.09, 0, 0); + INSERT INTO ConfigurationValues VALUES (DEFAULT, 'AllowDeleteRootCats', '0', 'In-Portal', 'in-portal:configure_categories'); +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Catalog_PreselectModuleTab', 1, 'In-Portal', 'in-portal:configure_categories'); INSERT INTO ItemTypes VALUES (1, 'In-Portal', 'c', 'Category', 'Name', 'CreatedById', NULL, NULL, 'la_ItemTab_Categories', 1, 'admin/category/addcategory.php', 'clsCategory', 'Category'); INSERT INTO ItemTypes VALUES (6, 'In-Portal', 'u', 'PortalUser', 'Login', 'PortalUserId', NULL, NULL, '', 0, '', 'clsPortalUser', 'User'); Index: branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql =================================================================== diff -u -r9419 -r9524 --- branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql (.../inportal_upgrade_v4.2.1.sql) (revision 9419) +++ branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql (.../inportal_upgrade_v4.2.1.sql) (revision 9524) @@ -14,5 +14,8 @@ INSERT INTO ConfigurationAdmin VALUES ('User_Default_Registration_Country', 'la_Text_General', 'la_config_DefaultRegistrationCountry', 'select', NULL , '=+,SELECT DestName AS OptionName, DestId AS OptionValue FROM StdDestinations WHERE DestParentId IS NULL Order BY OptionName', 10.111, 0, 1); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'User_Default_Registration_Country', '', 'In-Portal:Users', 'in-portal:configure_users'); +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'Catalog_PreselectModuleTab', 1, 'In-Portal', 'in-portal:configure_categories'); +INSERT INTO ConfigurationAdmin VALUES ('Catalog_PreselectModuleTab', 'la_Text_General', 'la_config_CatalogPreselectModuleTab', 'checkbox', NULL, NULL, 10.09, 0, 0); + UPDATE Modules SET Version = '4.2.1' WHERE Name = 'Core'; UPDATE Modules SET Version = '4.2.1' WHERE Name = 'In-Portal'; \ No newline at end of file Index: branches/RC/kernel/admin_templates/xml/categories_list.tpl =================================================================== diff -u -r9385 -r9524 --- branches/RC/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 9385) +++ branches/RC/kernel/admin_templates/xml/categories_list.tpl (.../categories_list.tpl) (revision 9524) @@ -55,7 +55,7 @@ _" width="50%"> radiocheckbox" name="" id=""> img/itemicons/">  - );">: + , '');">: ( / )
Index: branches/RC/kernel/admin_templates/catalog.tpl =================================================================== diff -u -r9079 -r9524 --- branches/RC/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 9079) +++ branches/RC/kernel/admin_templates/catalog.tpl (.../catalog.tpl) (revision 9524) @@ -29,6 +29,7 @@ Request.progressText = ''; var $is_catalog = true; var $Catalog = new Catalog('', 'catalog_'); + $Catalog.TabByCategory = truefalse; var a_toolbar = new ToolBar(); Index: branches/RC/core/admin_templates/tree.tpl =================================================================== diff -u -r9258 -r9524 --- branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 9258) +++ branches/RC/core/admin_templates/tree.tpl (.../tree.tpl) (revision 9524) @@ -103,11 +103,11 @@ var $kf = document.getElementById($form_name); $kf.target = 'main_frame'; - function checkCatalog($cat_id) { + function checkCatalog($cat_id, $module_prefix) { var $ret = checkEditMode(); var $right_frame = getFrame('main'); if ($ret && $right_frame.$is_catalog) { - $right_frame.$Catalog.go_to_cat($cat_id); + $right_frame.$Catalog.go_to_cat($cat_id, $module_prefix); return 1; // this opens folder, but disables click } return $ret;