Index: branches/RC/core/install/install_schema.sql =================================================================== diff -u -N -r9071 -r9279 --- branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 9071) +++ branches/RC/core/install/install_schema.sql (.../install_schema.sql) (revision 9279) @@ -321,6 +321,7 @@ CREATE TABLE Category ( CategoryId int(11) NOT NULL auto_increment, `Type` int(11) NOT NULL default '0', + SymLinkCategoryId int(10) unsigned default NULL, ParentId int(11) NOT NULL default '0', Name varchar(255) NOT NULL default '', l1_Name varchar(255) NOT NULL default '', @@ -380,7 +381,8 @@ KEY l4_Description (l4_Description(5)), KEY l5_Description (l5_Description(5)), KEY TreeLeft (TreeLeft), - KEY TreeRight (TreeRight) + KEY TreeRight (TreeRight), + KEY SymLinkCategoryId (SymLinkCategoryId) ); CREATE TABLE CategoryCustomData ( Index: branches/RC/core/units/categories/categories_tag_processor.php =================================================================== diff -u -N -r9132 -r9279 --- branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9132) +++ branches/RC/core/units/categories/categories_tag_processor.php (.../categories_tag_processor.php) (revision 9279) @@ -125,6 +125,23 @@ return $category_helper->NavigationBar($params); } + /** + * Allows to show category path of selected module + * + * @param Array $params + * @return string + */ + function FieldCategoryPath($params) + { + $object =& $this->getObject(); + /* @var $object kDBItem */ + + $field = $this->SelectParam($params, 'name,field'); + $params['cat_id'] = $object->GetDBField($field); + + return $this->CategoryPath($params); + } + function CurrentCategoryName($params) { $cat_object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix.'_List'); @@ -140,26 +157,45 @@ return $ml_formatter->LangFieldName('Name'); } - function CategoryLink($params) + function getCategorySymLink($category_id) { - $params = array_merge(Array('pass' => 'm'), $params); - $cat_id = getArrayValue($params, 'cat_id'); - if ($cat_id === false) { - $cat_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + static $cache = null; + + if (!isset($cache)) { + $id_field = $this->Application->getUnitOption($this->Prefix, 'IDField'); + $table_name = $this->Application->getUnitOption($this->Prefix, 'TableName'); + + $sql = 'SELECT SymLinkCategoryId, '.$id_field.' + FROM '.$table_name.' + WHERE SymLinkCategoryId IS NOT NULL'; + $cache = $this->Conn->GetCol($sql, $id_field); } - if ("$cat_id" == 'Root') { - $params['m_cat_id'] = $this->Application->findModule('Name', $params['module'], 'RootCat'); - unset($params['module']); - } - else { - $params['m_cat_id'] = $cat_id; - } - unset($params['cat_id']); - $params['pass_category'] = 1; + return isset($cache[$category_id]) ? $cache[$category_id] : $category_id; + } - $main_processor =& $this->Application->recallObject('m_TagProcessor'); - return $main_processor->T($params); + function CategoryLink($params) + { + $category_id = getArrayValue($params, 'cat_id'); + if ($category_id === false) { + $category_id = $this->Application->GetVar($this->getPrefixSpecial().'_id'); + } + + if ("$category_id" == 'Root') { + $category_id = $this->Application->findModule('Name', $params['module'], 'RootCat'); + } + elseif ("$category_id" == 'current') { + $category_id = $this->Application->GetVar('m_cat_id'); + } + + unset($params['cat_id'], $params['module']); + + $category_id = $this->getCategorySymLink($category_id); + + $new_params = Array ('pass' => 'm', 'm_cat_id' => $category_id, 'pass_category' => 1); + $params = array_merge_recursive2($params, $new_params); + + return $this->Application->ProcessParsedTag('m', 't', $params); } function CategoryList($params) Index: branches/RC/core/units/general/helpers/category_helper.php =================================================================== diff -u -N -r8929 -r9279 --- branches/RC/core/units/general/helpers/category_helper.php (.../category_helper.php) (revision 8929) +++ branches/RC/core/units/general/helpers/category_helper.php (.../category_helper.php) (revision 9279) @@ -102,6 +102,7 @@ $block_params['separator'] = $params['separator']; $no_current = isset($params['no_current']) && $params['no_current']; + $backup_category_id = $this->Application->GetVar('c_id'); foreach ($category_path as $category_id => $category_name) { $block_params['cat_id'] = $category_id; $block_params['cat_name'] = $block_params['title'] = $category_name; @@ -129,6 +130,7 @@ $this->Application->SetVar('c_id', $category_id); $ret .= $this->Application->ParseBlock($block_params, 1); } + $this->Application->SetVar('c_id', $backup_category_id); return $ret; } Index: branches/RC/core/install/upgrades.sql =================================================================== diff -u -N -r9237 -r9279 --- branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 9237) +++ branches/RC/core/install/upgrades.sql (.../upgrades.sql) (revision 9279) @@ -124,4 +124,5 @@ # ===== v 4.2.1 ===== INSERT INTO ConfigurationAdmin VALUES ('UseSmallHeader', 'la_Text_Website', 'la_config_UseSmallHeader', 'checkbox', '', '', 10.21, 0, 0); -INSERT INTO ConfigurationValues VALUES (DEFAULT, 'UseSmallHeader', '0', 'In-Portal', 'in-portal:configure_general'); \ No newline at end of file +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'UseSmallHeader', '0', 'In-Portal', 'in-portal:configure_general'); +ALTER TABLE Category ADD SymLinkCategoryId INT UNSIGNED NULL DEFAULT NULL AFTER `Type`, ADD INDEX (SymLinkCategoryId); Index: branches/RC/core/units/categories/categories_config.php =================================================================== diff -u -N -r8929 -r9279 --- branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 8929) +++ branches/RC/core/units/categories/categories_config.php (.../categories_config.php) (revision 9279) @@ -236,6 +236,7 @@ ( 'CategoryId' => Array('type' => 'int','not_null' => 1,'default' => 0), 'Type' => Array('type' => 'int','not_null' => 1,'default' => 0), + 'SymLinkCategoryId' => Array('type' => 'int', 'default' => NULL), 'ParentId' => Array('type' => 'int','not_null' => 1,'default' => 0), 'Name' => Array('type' => 'string', 'formatter' => 'kMultiLanguage', 'not_null' => 1, 'required' => 1, 'default' => ''), 'Filename' => Array('type' => 'string', 'not_null' => 1, 'default' => ''), Index: branches/RC/core/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r9268 -r9279 --- branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 9268) +++ branches/RC/core/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 9279) @@ -326,7 +326,36 @@ + + "> + + + + + + + +
+ + + + + + + + + + + ', '', '');"> + + +
+ +   + +
+ Index: branches/RC/core/units/categories/categories_event_handler.php =================================================================== diff -u -N -r9043 -r9279 --- branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 9043) +++ branches/RC/core/units/categories/categories_event_handler.php (.../categories_event_handler.php) (revision 9279) @@ -101,6 +101,25 @@ } /** + * Adds selected link to listing + * + * @param kEvent $event + */ + function OnProcessSelected(&$event) + { + $object =& $event->getObject(); + /* @var $object kDBItem */ + + $selected_ids = $this->Application->GetVar('selected_ids'); + + $this->RemoveRequiredFields($object); + $object->SetDBField($this->Application->RecallVar('dst_field'), $selected_ids['c']); + $object->Update(); + + $this->finalizePopup($event); + } + + /** * Apply system filter to categories list * * @param kEvent $event Index: branches/RC/core/admin_templates/categories/categories_edit.tpl =================================================================== diff -u -N -r9064 -r9279 --- branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 9064) +++ branches/RC/core/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 9279) @@ -64,6 +64,9 @@ + + + Index: branches/RC/kernel/admin_templates/categories/categories_edit.tpl =================================================================== diff -u -N -r9064 -r9279 --- branches/RC/kernel/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 9064) +++ branches/RC/kernel/admin_templates/categories/categories_edit.tpl (.../categories_edit.tpl) (revision 9279) @@ -64,6 +64,9 @@ + + + Index: branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql =================================================================== diff -u -N -r9237 -r9279 --- branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql (.../inportal_upgrade_v4.2.1.sql) (revision 9237) +++ branches/RC/admin/install/upgrades/inportal_upgrade_v4.2.1.sql (.../inportal_upgrade_v4.2.1.sql) (revision 9279) @@ -1,5 +1,7 @@ INSERT INTO ConfigurationAdmin VALUES ('UseSmallHeader', 'la_Text_Website', 'la_config_UseSmallHeader', 'checkbox', '', '', 10.21, 0, 0); INSERT INTO ConfigurationValues VALUES (DEFAULT, 'UseSmallHeader', '0', 'In-Portal', 'in-portal:configure_general'); +ALTER TABLE Category ADD SymLinkCategoryId INT UNSIGNED NULL DEFAULT NULL AFTER `Type`, ADD INDEX (SymLinkCategoryId); + 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