Index: trunk/kernel/units/configuration/configuration_tag_processor.php =================================================================== diff -u -N -r4446 -r4653 --- trunk/kernel/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4446) +++ trunk/kernel/units/configuration/configuration_tag_processor.php (.../configuration_tag_processor.php) (revision 4653) @@ -58,7 +58,8 @@ $prev_heading = $list->GetDBField('heading'); $list->GoNext(); } - + + $this->Application->RemoveVar('ModuleRootCategory'); $this->Application->SetVar( $this->getPrefixSpecial().'_id', ''); return $o; } @@ -127,6 +128,68 @@ return $msg; } + + /** + * Allows to show category path of selected module + * + * @param Array $params + * @return string + */ + function CategoryPath($params) + { + if (!isset($params['cat_id'])) { + $params['cat_id'] = $this->ModuleRootCategory( Array() ); + } + + $block_params['current'] = 1; + $block_params['separator'] = $params['separator']; + if ($params['cat_id'] == 0) { + $block_params['name'] = $params['rootcatblock']; + return $this->Application->ParseBlock($block_params); + } + else { + $cat_object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix.'_List' ); + $sql = 'SELECT CategoryId, ParentId, Name FROM '.TABLE_PREFIX.'Category WHERE CategoryId='.$params['cat_id']; + $res = $this->Conn->GetRow($sql); + if ($res === false) { + // in case if category is deleted + return ''; + } + $block_params['name'] = $params['block']; + $block_params['cat_name'] = $res['Name']; + $block_params['separator'] = $params['separator']; + $block_params['cat_id'] = $res['CategoryId']; + $next_params['separator'] = $params['separator']; + $next_params['rootcatblock'] = $params['rootcatblock']; + $next_params['block'] = $params['block']; + $next_params['cat_id'] = $res['ParentId']; + return $this->CategoryPath($next_params).$this->Application->ParseBlock($block_params); + } + } + + /** + * Shows edit warning in case if module root category changed but not saved + * + * @param Array $params + * @return string + */ + function SaveWarning($params) + { + $temp_category_id = $this->Application->RecallVar('ModuleRootCategory'); + if ($temp_category_id !== false) { + return $this->Application->ParseBlock($params); + } + return ''; + } + + function ModuleRootCategory($params) + { + $category_id = $this->Application->RecallVar('ModuleRootCategory'); + if ($category_id === false) { + $category_id = $this->Application->findModule('Name', $this->Application->GetVar('module'), 'RootCat'); + } + return $category_id; + } } ?> \ No newline at end of file