Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F773231
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Feb 2, 5:39 AM
Size
3 KB
Mime Type
text/x-diff
Expires
Tue, Feb 4, 5:39 AM (1 d, 13 h)
Engine
blob
Format
Raw Data
Handle
556483
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/RC/core/units/themes/themes_eh.php
===================================================================
--- branches/RC/core/units/themes/themes_eh.php (revision 9835)
+++ branches/RC/core/units/themes/themes_eh.php (revision 9836)
@@ -1,101 +1,108 @@
<?php
class ThemesEventHandler extends kDBEventHandler {
-
+
/**
* Allows to override standart permission mapping
*
*/
function mapPermissions()
{
parent::mapPermissions();
$permissions = Array(
'OnItemBuild' => Array('self' => true),
'OnChangeTheme' => Array('self' => true),
);
-
+
$this->permMapping = array_merge($this->permMapping, $permissions);
}
-
+
/**
* Allows to set selected theme as primary
*
* @param kEvent $event
*/
function OnSetPrimary(&$event)
{
if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) {
return;
}
$ids = $this->StoreSelectedIDs($event);
if ($ids) {
$id = array_shift($ids);
$this->setPrimary($id);
}
-
+
$this->clearSelectedIDs($event);
}
-
+
function setPrimary($id)
{
$id_field = $this->Application->getUnitOption($this->Prefix, 'IDField');
$table_name = $this->Application->getUnitOption($this->Prefix, 'TableName');
-
+
$sql = 'UPDATE '.$table_name.'
SET PrimaryTheme = 0';
$this->Conn->Query($sql);
-
+
$sql = 'UPDATE '.$table_name.'
SET PrimaryTheme = 1, Enabled = 1
WHERE '.$id_field.' = '.$id;
$this->Conn->Query($sql);
}
-
+
/**
* Set correct parent path for newly created categories
*
* @param kEvent $event
*/
function OnAfterCopyToLive(&$event)
{
$object =& $this->Application->recallObject($event->Prefix.'.-item', null, Array('skip_autoload' => true, 'live_table' => true));
/* @var $object kDBItem */
-
+
$object->Load($event->getEventParam('id'));
-
+
if ($object->GetDBField('PrimaryTheme')) {
$this->setPrimary($event->getEventParam('id'));
}
}
-
+
/**
* Allows to change the theme
*
* @param kEvent $event
*/
function OnChangeTheme(&$event)
{
$this->Application->SetVar('t', 'index');
$this->Application->SetVar('m_cat_id', 0);
+
+ if (MOD_REWRITE) {
+ foreach ($this->Application->ModuleInfo as $module_name => $module_data) {
+ $this->Application->DeleteVar($module_data['Var'].'_Page');
+ }
+ }
+
$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');
+
+ $object->addFilter('enabled', '%1$s.Enabled = 1');
}
}
?>
\ No newline at end of file
Property changes on: branches/RC/core/units/themes/themes_eh.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.3.4.2
\ No newline at end of property
+1.3.4.3
\ No newline at end of property
Event Timeline
Log In to Comment