Index: trunk/core/units/config_search/config_search_event_handler.php =================================================================== diff -u -N -r4084 -r4216 --- trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4084) +++ trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4216) @@ -14,9 +14,8 @@ $object =& $event->getObject(); // show only items that belong to selected module - $module_owner = $this->Application->GetLinkedVar('module'); - $this->Application->LinkVar('section'); - $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module_owner)); + $module = $this->Application->GetVar('module'); + $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module)); // don't show disabled search items $object->addFilter('active_filter', '%1$s.SimpleSearch <> -1'); Index: trunk/core/kernel/db/db_tag_processor.php =================================================================== diff -u -N -r4201 -r4216 --- trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 4201) +++ trunk/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 4216) @@ -1121,8 +1121,13 @@ */ function SectionTitle($params) { + // save theese variables to session, because they are useful for most configuration templates + $this->Application->LinkVar('module'); + $this->Application->LinkVar('section'); + + $preset_name = replaceModuleSection($params['title_preset']); $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); - $title_info = getArrayValue($title_presets, $params['title_preset'] ); + $title_info = getArrayValue($title_presets, $preset_name); if($title_info === false) return $params['title']; if( getArrayValue($title_presets,'default') ) Index: trunk/kernel/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4207) +++ trunk/kernel/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4216) @@ -13,10 +13,10 @@ { $object =& $event->getObject(); - $module_owner = $this->Application->GetLinkedVar('module'); - $section = $this->Application->GetLinkedVar('section'); + $module = $this->Application->GetVar('module'); + $section = $this->Application->GetVar('section'); - $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module_owner)); + $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module)); $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section)); } Index: trunk/core/units/configuration/configuration_event_handler.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4207) +++ trunk/core/units/configuration/configuration_event_handler.php (.../configuration_event_handler.php) (revision 4216) @@ -13,10 +13,10 @@ { $object =& $event->getObject(); - $module_owner = $this->Application->GetLinkedVar('module'); - $section = $this->Application->GetLinkedVar('section'); + $module = $this->Application->GetVar('module'); + $section = $this->Application->GetVar('section'); - $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module_owner)); + $object->addFilter('module_filter', '%1$s.ModuleOwner = '.$this->Conn->qstr($module)); $object->addFilter('section_filter', '%1$s.Section = '.$this->Conn->qstr($section)); } Index: trunk/kernel/units/general/cat_event_handler.php =================================================================== diff -u -N -r4052 -r4216 --- trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4052) +++ trunk/kernel/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4216) @@ -1288,7 +1288,6 @@ $this->Application->StoreVar($event->getPrefixSpecial().'_Page', $page); } -// $page = $this->Application->GetLinkedVar($event->getPrefixSpecial(true).'_Page', $event->getPrefixSpecial().'_Page'); if( !$event->getEventParam('skip_counting') ) { $pages = $object->GetTotalPages(); Index: trunk/kernel/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4207) +++ trunk/kernel/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4216) @@ -14,8 +14,8 @@ { if ($event->Special == 'module') { $object =& $event->getObject(); - $module_owner = $this->Application->GetLinkedVar('module'); - $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner)); + $module = $this->Application->GetVar('module'); + $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module)); } } Index: trunk/core/kernel/application.php =================================================================== diff -u -N -r4135 -r4216 --- trunk/core/kernel/application.php (.../application.php) (revision 4135) +++ trunk/core/kernel/application.php (.../application.php) (revision 4216) @@ -746,12 +746,10 @@ function LinkVar($var, $ses_var = null, $default = '') { if (!isset($ses_var)) $ses_var = $var; - if ($this->GetVar($var) !== false) - { + if ($this->GetVar($var) !== false) { $this->StoreVar($ses_var, $this->GetVar($var)); } - else - { + else { $this->SetVar($var, $this->RecallVar($ses_var, $default)); } } @@ -1000,7 +998,9 @@ } $ret .= preg_replace('/^'.$join_string.'(.*)/', '?\\1', $params_str); - if ($encode) $ret = str_replace('\\', '%5C', $ret); + if ($encode) { + $ret = str_replace('\\', '%5C', $ret); + } return $ret; } @@ -1116,7 +1116,9 @@ } $ret .= $params_str; - if ($encode) $ret = str_replace('\\', '%5C', $ret); + if ($encode) { + $ret = str_replace('\\', '%5C', $ret); + } return $ret; } Index: trunk/core/kernel/globals.php =================================================================== diff -u -N -r3863 -r4216 --- trunk/core/kernel/globals.php (.../globals.php) (revision 3863) +++ trunk/core/kernel/globals.php (.../globals.php) (revision 4216) @@ -449,5 +449,23 @@ $line = $enclosure.implode($enclosure.$delimiter.$enclosure, $data).$enclosure.$recordSeparator; fwrite($filePointer, $line); } + + /** + * Allows to replace #section# within any string with current section + * + * @param string $string + * @return string + */ + function replaceModuleSection($string) + { + $application =& kApplication::Instance(); + $module_section = $application->RecallVar('section'); + if ($module_section) { + // substitute section instead of #section# parameter in title preset name + $module_section = explode(':', $module_section); + $string = str_replace('#section#', strtolower($module_section[1]), $string); + } + return $string; + } ?> \ No newline at end of file Index: trunk/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r4052 -r4216 --- trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4052) +++ trunk/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 4216) @@ -1288,7 +1288,6 @@ $this->Application->StoreVar($event->getPrefixSpecial().'_Page', $page); } -// $page = $this->Application->GetLinkedVar($event->getPrefixSpecial(true).'_Page', $event->getPrefixSpecial().'_Page'); if( !$event->getEventParam('skip_counting') ) { $pages = $object->GetTotalPages(); Index: trunk/core/units/email_events/email_events_event_handler.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4207) +++ trunk/core/units/email_events/email_events_event_handler.php (.../email_events_event_handler.php) (revision 4216) @@ -14,8 +14,8 @@ { if ($event->Special == 'module') { $object =& $event->getObject(); - $module_owner = $this->Application->GetLinkedVar('module'); - $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module_owner)); + $module = $this->Application->GetVar('module'); + $object->addFilter('module_filter', '%1$s.Module = '.$this->Conn->qstr($module)); } } Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r4169 -r4216 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4169) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4216) @@ -70,8 +70,6 @@ */ function getPassedID(&$event) { - //$ret = $this->Application->GetLinkedVar($event->getPrefixSpecial(true).'_id', $event->getPrefixSpecial().'_id'); - // ?? We don't need to store selected id in session, as long as we have pass=all by default, which // means that main item id will be passed to all sub-item screens by default // another prove of that is that sub-items relay on main item '_mode' = 't' for switching to temp tables @@ -406,7 +404,6 @@ $this->Application->StoreVar($event->getPrefixSpecial().'_Page', $page); } -// $page = $this->Application->GetLinkedVar($event->getPrefixSpecial(true).'_Page', $event->getPrefixSpecial().'_Page'); if( !$event->getEventParam('skip_counting') ) { $pages = $object->GetTotalPages(); Index: trunk/kernel/units/help/help_tag_processor.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/kernel/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4207) +++ trunk/kernel/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4216) @@ -9,8 +9,9 @@ $this->Prefix = $rets[0]; $this->Special = isset($rets[1]) ? $rets[1] : ''; //$this->Prefix = $this->Application->GetVar('h_prefix'); - $title_preset_name = $this->Application->GetVar('h_title_preset'); + $title_preset_name = replaceModuleSection($this->Application->GetVar('h_title_preset')); + $this->Application->SetVar('h_title_preset', $title_preset_name); $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); $format = $title_presets[$title_preset_name]['format']; @@ -19,12 +20,7 @@ $this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets); $params['title_preset'] = $title_preset_name; - - $ret = parent::SectionTitle($params); - - - - return $ret; + return parent::SectionTitle($params); } function ShowHelp($params) @@ -80,7 +76,8 @@ function GetIcon($params) { $icon_var = getArrayValue($params,'var_name'); - $icon = $this->Application->GetVar($icon_var); + $icon = replaceModuleSection($this->Application->GetVar($icon_var)); + if(!$icon) $icon = getArrayValue($params,'default_icon'); return $icon; } Index: trunk/core/units/help/help_tag_processor.php =================================================================== diff -u -N -r4207 -r4216 --- trunk/core/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4207) +++ trunk/core/units/help/help_tag_processor.php (.../help_tag_processor.php) (revision 4216) @@ -9,8 +9,9 @@ $this->Prefix = $rets[0]; $this->Special = isset($rets[1]) ? $rets[1] : ''; //$this->Prefix = $this->Application->GetVar('h_prefix'); - $title_preset_name = $this->Application->GetVar('h_title_preset'); + $title_preset_name = replaceModuleSection($this->Application->GetVar('h_title_preset')); + $this->Application->SetVar('h_title_preset', $title_preset_name); $title_presets = $this->Application->getUnitOption($this->Prefix,'TitlePresets'); $format = $title_presets[$title_preset_name]['format']; @@ -19,12 +20,7 @@ $this->Application->setUnitOption($this->Prefix,'TitlePresets',$title_presets); $params['title_preset'] = $title_preset_name; - - $ret = parent::SectionTitle($params); - - - - return $ret; + return parent::SectionTitle($params); } function ShowHelp($params) @@ -80,7 +76,8 @@ function GetIcon($params) { $icon_var = getArrayValue($params,'var_name'); - $icon = $this->Application->GetVar($icon_var); + $icon = replaceModuleSection($this->Application->GetVar($icon_var)); + if(!$icon) $icon = getArrayValue($params,'default_icon'); return $icon; } Index: trunk/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -N -r4201 -r4216 --- trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4201) +++ trunk/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 4216) @@ -3,7 +3,7 @@ @@ -18,8 +18,9 @@
- img/icons/.gif" align="absmiddle" title="">  + img/icons/.gif" align="absmiddle" title=""> 
Index: trunk/core/kernel/processors/main_processor.php =================================================================== diff -u -N -r4135 -r4216 --- trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4135) +++ trunk/core/kernel/processors/main_processor.php (.../main_processor.php) (revision 4216) @@ -841,38 +841,16 @@ } } -/* - function Login($params) + function GetSectionTitle($params) { - $user_prefix = 'users'; - $this->parser->registerprefix($user_prefix); - $user_class = $this->parser->processors[$user_prefix]->item_class; - - $candidate = new $user_class(NULL, $this->parser->processors[$user_prefix]); - //print_pre($this->Session->Property); - - $special = array_shift($params); - //echo"$special
"; - $candidate_id = $candidate->Login($this->Session->GetProperty('username'), $this->Session->GetProperty('password'), $special); - - if ($candidate_id !== false) { - $this->Session->SetField('user_id', $candidate_id); - $this->Session->Update(); - $this->Session->AfterLogin(); - - $this->parser->register_prefix('m'); - $template = array_shift($params); - if ($template == '') $template = 'index'; - $location = $this->parser->do_process_tag('m', 't', Array($template)); - header("Location: $location"); - exit; - } - elseif ($this->Session->GetProperty('username') != '') { - $this->Session->SetProperty('login_error', 'Incorrect username or password'); - } + $params['name'] = replaceModuleSection($params['phrase']); + return $this->Phrase($params); } - */ + function GetSectionIcon($params) + { + return replaceModuleSection($params['icon']); + } } Index: trunk/kernel/units/config_search/config_search_event_handler.php =================================================================== diff -u -N -r4084 -r4216 --- trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4084) +++ trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4216) @@ -14,9 +14,8 @@ $object =& $event->getObject(); // show only items that belong to selected module - $module_owner = $this->Application->GetLinkedVar('module'); - $this->Application->LinkVar('section'); - $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module_owner)); + $module = $this->Application->GetVar('module'); + $object->addFilter('module_filter', '%1$s.ModuleName = '.$this->Conn->qstr($module)); // don't show disabled search items $object->addFilter('active_filter', '%1$s.SimpleSearch <> -1');