Index: branches/RC/core/units/themes/themes_tag_processor.php =================================================================== diff -u -r8929 -r9236 --- branches/RC/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 8929) +++ branches/RC/core/units/themes/themes_tag_processor.php (.../themes_tag_processor.php) (revision 9236) @@ -51,6 +51,11 @@ return ''; } + + function SelectedTheme($params) + { + $object =& $this->getObject($params); + return $object->GetDBField('ThemeId') == $this->Application->GetVar('m_theme'); + } } - ?> \ No newline at end of file Index: branches/RC/core/units/themes/themes_eh.php =================================================================== diff -u -r8929 -r9236 --- branches/RC/core/units/themes/themes_eh.php (.../themes_eh.php) (revision 8929) +++ branches/RC/core/units/themes/themes_eh.php (.../themes_eh.php) (revision 9236) @@ -11,6 +11,7 @@ parent::mapPermissions(); $permissions = Array( 'OnItemBuild' => Array('self' => true), + 'OnChangeTheme' => Array('self' => true), ); $this->permMapping = array_merge($this->permMapping, $permissions); @@ -68,6 +69,31 @@ $this->setPrimary($event->getEventParam('id')); } } + + /** + * Allows to change the theme + * + * @param kEvent $event + */ + function OnChangeTheme(&$event) + { + $this->Application->SetVar('m_theme', $this->Application->GetVar('theme')); + } + + /** + * Apply system filter to themes list + * + * @param kEvent $event + */ + function SetCustomQuery(&$event) + { + parent::SetCustomQuery($event); + + $object =& $event->getObject(); + /* @var $object kDBList */ + + $object->addFilter('enabled', '%1$s.Enabled = 1'); + } } ?> \ No newline at end of file