Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1075543
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
Mon, Jul 28, 10:22 AM
Size
7 KB
Mime Type
text/x-diff
Expires
Wed, Jul 30, 10:22 AM (2 h, 4 m)
Engine
blob
Format
Raw Data
Handle
697629
Attached To
rINP In-Portal
in-portal
View Options
Index: trunk/core/units/themes/themes_config.php
===================================================================
--- trunk/core/units/themes/themes_config.php (revision 8074)
+++ trunk/core/units/themes/themes_config.php (revision 8075)
@@ -1,84 +1,85 @@
<?php
$config = Array(
'Prefix' => 'theme',
'ItemClass' => Array('class'=>'kDBItem','file'=>'','build_event'=>'OnItemBuild'),
'ListClass' => Array('class'=>'kDBList','file'=>'','build_event'=>'OnListBuild'),
'EventHandlerClass' => Array('class'=>'ThemesEventHandler','file'=>'themes_eh.php','build_event'=>'OnBuild'),
'TagProcessorClass' => Array('class'=>'ThemesTagProcessor','file'=>'themes_tag_processor.php','build_event'=>'OnBuild'),
'AutoLoad' => true,
'Hooks' => Array(),
'QueryString' => Array(
1 => 'id',
2 => 'page',
3 => 'event',
4 => 'mode',
),
'IDField' => 'ThemeId',
'StatusField' => Array('Enabled', 'PrimaryTheme'),
'TitleField' => 'Name',
'TitlePresets' => Array (
'default' => Array (
'new_status_labels' => Array('theme' => '!la_title_Adding_Theme!'),
'edit_status_labels' => Array('theme' => '!la_title_Editing_Theme!'),
'new_titlefield' => Array('theme' => ''),
),
'themes_list' => Array('prefixes' => Array('theme_List'), 'format' => "!la_title_Configuration! - !la_title_Themes! (#theme_recordcount#)"),
'themes_edit_general' => Array('prefixes' => Array('theme'), 'format' => "#theme_status# '#theme_titlefield#' - !la_title_General!"),
'themes_edit_files' => Array('prefixes' => Array('theme', 'theme-file_List'), 'format' => "#theme_status# '#theme_titlefield#' - !la_title_ThemeFiles! (#theme-file_recordcount#)"),
),
'TableName' => TABLE_PREFIX.'Theme',
'SubItems' => Array('theme-file'),
'FilterMenu' => Array(
'Groups' => Array(
Array('mode' => 'AND', 'filters' => Array(0,1), 'type' => WHERE_FILTER),
),
'Filters' => Array(
0 => Array('label' =>'la_Enabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 1' ),
1 => Array('label' => 'la_Disabled', 'on_sql' => '', 'off_sql' => '%1$s.Enabled != 0' ),
)
),
'AutoDelete' => true,
'AutoClone' => true,
'ListSQLs' => Array( '' => 'SELECT %1$s.* %2$s FROM %s'),
'ItemSQLs' => Array( '' => 'SELECT %1$s.* %2$s FROM %s'),
'ListSortings' => Array (
'' => Array(
'Sorting' => Array('Name' => 'asc'),
)
),
'Fields' => Array(
'ThemeId' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'Name' => Array('type' => 'string','not_null' => 1, 'required' => 1, 'default' => ''),
'Enabled' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array(1=>'la_Enabled', 0=>'la_Disabled'), 'use_phrases'=>1, 'not_null' => 1, 'default' => 1),
'Description' => Array('type' => 'string','default' => null),
- 'PrimaryTheme' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'PrimaryTheme' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options' => Array (1 => 'la_Yes', 0 => 'la_No'), 'use_phrases' => 1, 'not_null' => 1, 'default' => 0),
'CacheTimeout' => Array('type' => 'int', 'not_null' => 1, 'default' => 0),
'StylesheetId' => Array('type' => 'int', 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM '.TABLE_PREFIX.'Stylesheets', 'option_key_field' => 'StylesheetId', 'option_title_field' => 'Name', 'not_null' => 1, 'default' => 0),
),
'Grids' => Array(
'Default' => Array(
'Icons' => Array('default'=>'icon16_custom.gif', '1_1' => 'icon16_theme_primary.gif', '1_0' => 'icon16_theme.gif', '0_0' => 'icon16_theme_disabled.gif'),
'Fields' => Array(
'ThemeId' => Array ('title' => 'la_col_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter'),
'Name' => Array( 'title'=>'la_col_Name',),
'Description' => Array( 'title'=>'la_col_Description', ),
'Enabled' => Array( 'title'=>'la_col_Status', 'filter_block' => 'grid_options_filter'),
+// 'PrimaryTheme' => Array( 'title'=>'la_col_Primary', 'filter_block' => 'grid_options_filter'),
),
),
),
);
?>
\ No newline at end of file
Property changes on: trunk/core/units/themes/themes_config.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.13
\ No newline at end of property
+1.14
\ No newline at end of property
Index: trunk/core/units/themes/themes_eh.php
===================================================================
--- trunk/core/units/themes/themes_eh.php (revision 8074)
+++ trunk/core/units/themes/themes_eh.php (revision 8075)
@@ -1,38 +1,59 @@
<?php
class ThemesEventHandler extends kDBEventHandler {
/**
* 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);
-
- $id_field = $this->Application->getUnitOption($event->Prefix, 'IDField');
- $table_name = $this->Application->getUnitOption($event->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);
+ $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'));
+ }
+ }
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/themes/themes_eh.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.1
\ No newline at end of property
+1.2
\ No newline at end of property
Event Timeline
Log In to Comment