Page MenuHomeIn-Portal Phabricator

D12.id201.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 9:01 AM

D12.id201.diff

Index: core/admin_templates/themes/themes_edit.tpl
===================================================================
--- core/admin_templates/themes/themes_edit.tpl
+++ core/admin_templates/themes/themes_edit.tpl
@@ -55,11 +55,11 @@
<div id="scroll_container">
<table class="edit-form">
- <inp2:m_RenderElement name="subsection" prefix="theme" fields="ThemeId,Name,Description,Enabled,CacheTimeout,StylesheetId,PrimaryTheme" title="la_section_General"/>
+ <inp2:m_RenderElement name="subsection" prefix="theme" fields="ThemeId,Name,Description,Status,CacheTimeout,StylesheetId,PrimaryTheme" title="la_section_General"/>
<inp2:m_RenderElement name="inp_id_label" prefix="theme" field="ThemeId" title="la_fld_Id"/>
- <inp2:m_RenderElement name="inp_edit_box" prefix="theme" field="Name" title="la_fld_Name"/>
+ <inp2:m_RenderElement name="inp_label" prefix="theme" field="Name" title="la_fld_Name"/>
<inp2:m_RenderElement name="inp_edit_textarea" prefix="theme" field="Description" title="la_fld_Description" cols="25" rows="3"/>
- <inp2:m_RenderElement name="inp_edit_checkbox" prefix="theme" field="Enabled" title="la_fld_Enabled"/>
+ <inp2:m_RenderElement name="inp_edit_radio" prefix="theme" field="Status"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="theme" field="CacheTimeout" title="la_prompt_lang_cache_timeout"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="theme" field="StylesheetFile"/>
@@ -69,6 +69,8 @@
</inp2:m_if>
##-->
<inp2:m_RenderElement name="inp_edit_checkbox" prefix="theme" field="PrimaryTheme" title="la_fld_Primary"/>
+ <inp2:m_RenderElement name="inp_label" prefix="theme" field="AddedOn"/>
+ <inp2:m_RenderElement name="inp_label" prefix="theme" field="DeletedOn"/>
<inp2:m_RenderElement name="inp_edit_filler"/>
</table>
</div>
Index: core/admin_templates/themes/themes_list.tpl
===================================================================
--- core/admin_templates/themes/themes_list.tpl
+++ core/admin_templates/themes/themes_list.tpl
@@ -20,11 +20,6 @@
} ) );
a_toolbar.AddButton( new ToolBarButton('edit', '<inp2:m_phrase label="la_ToolTip_Edit" escape="1"/>::<inp2:m_phrase label="la_ShortToolTip_Edit" escape="1"/>', edit) );
- a_toolbar.AddButton( new ToolBarButton('delete', '<inp2:m_phrase label="la_ToolTip_Delete" escape="1"/>',
- function() {
- std_delete_items('theme')
- } ) );
-
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
@@ -56,7 +51,7 @@
<inp2:m_RenderElement name="grid" PrefixSpecial="theme" IdField="ThemeId" grid="Default"/>
<script type="text/javascript">
- Grids['theme'].SetDependantToolbarButtons( new Array('edit', 'delete', 'setprimary') );
+ Grids['theme'].SetDependantToolbarButtons( new Array('edit', 'setprimary') );
</script>
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: core/install.php
===================================================================
--- core/install.php
+++ core/install.php
@@ -909,7 +909,7 @@
$theme_id_field = $theme_config->getIDField();
$sql = 'UPDATE ' . $theme_table . '
- SET Enabled = 1, PrimaryTheme = 1
+ SET Status = 1, PrimaryTheme = 1
WHERE ' . $theme_id_field . ' = ' . $theme_id;
$this->Conn->Query($sql);
Index: core/install/cache/class_structure.php
===================================================================
--- core/install/cache/class_structure.php
+++ core/install/cache/class_structure.php
@@ -36,6 +36,7 @@
'ConfigurationItem' => '/core/units/configuration/configuration.php',
'ConfigurationTagProcessor' => '/core/units/configuration/configuration_tag_processor.php',
'ConfigurationValidator' => '/core/units/configuration/configuration_validator.php',
+ 'ContentBlockCopier' => '/core/units/helpers/content_block_copier.php',
'ContentEventHandler' => '/core/units/content/content_eh.php',
'ContentTagProcessor' => '/core/units/content/content_tp.php',
'CoreUpgrades' => '/core/install/upgrades.php',
@@ -186,6 +187,7 @@
'TemplatesCache' => '/core/kernel/nparser/template_cache.php',
'ThemeFileEventHandler' => '/core/units/theme_files/theme_file_eh.php',
'ThemeItem' => '/core/units/themes/theme_item.php',
+ 'ThemeStatus' => '/core/kernel/constants.php',
'ThemesEventHandler' => '/core/units/themes/themes_eh.php',
'ThemesTagProcessor' => '/core/units/themes/themes_tag_processor.php',
'ThesaurusEventHandler' => '/core/units/thesaurus/thesaurus_eh.php',
@@ -546,6 +548,13 @@
0 => 'kValidator',
),
),
+ 'ContentBlockCopier' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ 'extends' => array(
+ 0 => 'kBase',
+ ),
+ ),
'ContentEventHandler' => array(
'type' => 1,
'modifiers' => 0,
@@ -1533,6 +1542,10 @@
0 => 'kDBItem',
),
),
+ 'ThemeStatus' => array(
+ 'type' => 1,
+ 'modifiers' => 0,
+ ),
'ThemesEventHandler' => array(
'type' => 1,
'modifiers' => 0,
Index: core/install/english.lang
===================================================================
--- core/install/english.lang
+++ core/install/english.lang
@@ -243,6 +243,7 @@
<PHRASE Label="la_DataGrid1" Module="Core" Type="1">RGF0YSBHcmlkcw==</PHRASE>
<PHRASE Label="la_DataGrid2" Module="Core" Type="1">RGF0YSBHcmlkcyAy</PHRASE>
<PHRASE Label="la_days" Module="Core" Type="1">ZGF5cw==</PHRASE>
+ <PHRASE Label="la_Deleted" Module="Core" Type="1">RGVsZXRlZA==</PHRASE>
<PHRASE Label="la_Delete_Confirm" Module="Core" Type="1">QXJlIHlvdSBzdXJlIHlvdSB3YW50IHRvIGRlbGV0ZSB0aGUgaXRlbShzKT8gVGhpcyBhY3Rpb24gY2Fubm90IGJlIHVuZG9uZS4=</PHRASE>
<PHRASE Label="la_Description_in-portal:advanced_view" Module="Core" Type="1">VGhpcyBzZWN0aW9uIGFsbG93cyB5b3UgdG8gbWFuYWdlIHNlY3Rpb25zIGFuZCBpdGVtcyBhY3Jvc3MgYWxsIHNlY3Rpb25z</PHRASE>
<PHRASE Label="la_Description_in-portal:browse" Module="Core" Type="1">VGhpcyBzZWN0aW9uIGFsbG93cyB5b3UgdG8gYnJvd3NlIHRoZSBjYXRhbG9nIGFuZCBtYW5hZ2Ugc2VjdGlvbnMgYW5kIGl0ZW1z</PHRASE>
@@ -393,6 +394,7 @@
<PHRASE Label="la_fld_CustomTemplate" Module="Core" Type="1">DQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KRGV0YWlscyBUZW1wbGF0ZQ==</PHRASE>
<PHRASE Label="la_fld_DateFormat" Module="Core" Type="1">RGF0ZSBGb3JtYXQ=</PHRASE>
<PHRASE Label="la_fld_DecimalPoint" Module="Core" Type="1">RGVjaW1hbCBQb2ludA==</PHRASE>
+ <PHRASE Label="la_fld_DeletedOn" Module="Core" Type="1" Column="RGVsZXRlZCBPbg==">RGVsZXRlZCBPbg==</PHRASE>
<PHRASE Label="la_fld_Description" Module="Core" Type="1" Column="RGVzY3JpcHRpb24=">RGVzY3JpcHRpb24=</PHRASE>
<PHRASE Label="la_fld_DirectLinkEnabled" Module="Core" Type="1">QWNjZXNzIHdpdGggTGluaw==</PHRASE>
<PHRASE Label="la_fld_Display" Module="Core" Type="1">RGlzcGxheQ==</PHRASE>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql
+++ core/install/install_data.sql
@@ -680,7 +680,6 @@
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.edit', 11, 1, 1, 0);
-INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_themes.delete', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.view', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.add', 11, 1, 1, 0);
INSERT INTO Permissions VALUES (DEFAULT, 'in-portal:configure_styles.edit', 11, 1, 1, 0);
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql
+++ core/install/install_schema.sql
@@ -373,7 +373,7 @@
CREATE TABLE Themes (
ThemeId int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(40) NOT NULL DEFAULT '',
- Enabled int(11) NOT NULL DEFAULT '1',
+ Status int(11) NOT NULL DEFAULT '1',
Description varchar(255) DEFAULT NULL,
PrimaryTheme int(11) NOT NULL DEFAULT '0',
CacheTimeout int(11) NOT NULL DEFAULT '0',
@@ -382,8 +382,10 @@
TemplateAliases text,
StylesheetFile varchar(255) NOT NULL DEFAULT '',
ImageResizeRules text,
+ AddedOn int(11) DEFAULT NULL,
+ DeletedOn int(11) DEFAULT NULL,
PRIMARY KEY (ThemeId),
- KEY Enabled (Enabled),
+ KEY Status (Status),
KEY StylesheetId (StylesheetId),
KEY PrimaryTheme (PrimaryTheme),
KEY LanguagePackInstalled (LanguagePackInstalled)
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -3021,4 +3021,11 @@
ALTER TABLE SiteDomains
CHANGE SSLUrl SSLDomainName VARCHAR(255) NOT NULL DEFAULT '',
CHANGE SSLUrlUsesRegExp SSLDomainNameUsesRegExp TINYINT(4) NOT NULL DEFAULT '0';
-DELETE FROM UserPersistentSessionData WHERE VariableName = 'site-domain[Default]columns_.';
\ No newline at end of file
+DELETE FROM UserPersistentSessionData WHERE VariableName = 'site-domain[Default]columns_.';
+
+ALTER TABLE Themes
+ CHANGE Enabled Status INT(11) NOT NULL DEFAULT 1,
+ ADD AddedOn int(11) DEFAULT NULL,
+ ADD DeletedOn int(11) DEFAULT NULL;
+
+DELETE FROM Permissions WHERE Permission = 'in-portal:configure_themes.delete';
Index: core/kernel/application.php
===================================================================
--- core/kernel/application.php
+++ core/kernel/application.php
@@ -523,7 +523,7 @@
/** @var ThemeItem $theme */
$theme = $this->recallObject('theme.current');
- if ( !$theme->isLoaded() || !$theme->GetDBField('Enabled') ) {
+ if ( !$theme->isLoaded() || !$theme->GetDBField('Status') ) {
return false;
}
@@ -610,7 +610,7 @@
$sql = 'SELECT ' . $theme_config->getIDField() . '
FROM ' . $theme_config->getTableName() . '
- WHERE (PrimaryTheme = 1) AND (Enabled = 1)';
+ WHERE (PrimaryTheme = 1) AND (Status = ' . ThemeStatus::ACTIVE . ')';
$theme_id = $this->Conn->GetOne($sql);
if ( $theme_id !== false ) {
Index: core/kernel/constants.php
===================================================================
--- core/kernel/constants.php
+++ core/kernel/constants.php
@@ -233,3 +233,10 @@
const STATUS_SKIPPED = 3;
}
+
+ class ThemeStatus
+ {
+ const ACTIVE = 1;
+ const DISABLED = 0;
+ const DELETED = 2;
+ }
Index: core/kernel/managers/rewrite_url_processor.php
===================================================================
--- core/kernel/managers/rewrite_url_processor.php
+++ core/kernel/managers/rewrite_url_processor.php
@@ -625,7 +625,7 @@
$sql = 'SELECT ThemeId, IF(LOWER(Name) = ' . $this->Conn->qstr($url_part) . ', 2, PrimaryTheme) AS SortKey, TemplateAliases
FROM ' . TABLE_PREFIX . 'Themes
- WHERE Enabled = 1
+ WHERE Status = ' . ThemeStatus::ACTIVE . '
ORDER BY SortKey DESC';
$theme_info = $this->Conn->GetRow($sql);
Index: core/kernel/nparser/compiler.php
===================================================================
--- core/kernel/nparser/compiler.php
+++ core/kernel/nparser/compiler.php
@@ -92,7 +92,7 @@
// find Front-End templates (from enabled themes only)
$sql = 'SELECT Name
FROM ' . $this->Application->getUnitConfig('theme')->getTableName() . '
- WHERE Enabled = 1';
+ WHERE Status = ' . ThemeStatus::ACTIVE;
$themes = $this->Conn->GetCol($sql);
$options = Array ();
@@ -139,4 +139,4 @@
}
}
-}
\ No newline at end of file
+}
Index: core/units/admin/admin_events_handler.php
===================================================================
--- core/units/admin/admin_events_handler.php
+++ core/units/admin/admin_events_handler.php
@@ -1160,7 +1160,7 @@
// rules from all enabled themes
$sql = 'SELECT ImageResizeRules
FROM ' . $this->Application->getUnitConfig('theme')->getTableName() . '
- WHERE Enabled = 1';
+ WHERE Status = ' . ThemeStatus::ACTIVE;
$mass_resizer->addRules($this->Conn->GetCol($sql));
$mass_resizer->run();
Index: core/units/categories/categories_config.php
===================================================================
--- core/units/categories/categories_config.php
+++ core/units/categories/categories_config.php
@@ -352,7 +352,7 @@
IF(tf.TemplateAlias <> "", tf.TemplateAlias, CONCAT(FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName))) AS Value
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId
- WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")
+ WHERE (t.Status = ' . ThemeStatus::ACTIVE . ') AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")
ORDER BY tf.Description ASC, tf.FileName ASC',
'option_key_field' => 'Value', 'option_title_field' => 'Title',
'error_msgs' => Array (
@@ -540,4 +540,4 @@
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
-);
\ No newline at end of file
+);
Index: core/units/categories/categories_event_handler.php
===================================================================
--- core/units/categories/categories_event_handler.php
+++ core/units/categories/categories_event_handler.php
@@ -2127,7 +2127,7 @@
$sql = 'SELECT Name, ' . $id_field . '
FROM ' . $table_name . '
- WHERE Enabled = 1';
+ WHERE Status = ' . ThemeStatus::ACTIVE;
$themes = $this->Conn->GetCol($sql, $id_field);
}
@@ -2365,7 +2365,7 @@
$sql = 'SELECT t.ThemeId, CONCAT( tf.FilePath, \'/\', tf.FileName ) AS Path, tf.FileMetaInfo
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId
- WHERE t.Enabled = 1 AND tf.FileType = 1
+ WHERE t.Status = ' . ThemeStatus::ACTIVE . ' AND tf.FileType = 1
AND (
SELECT COUNT(CategoryId)
FROM ' . TABLE_PREFIX . 'Categories c
Index: core/units/helpers/themes_helper.php
===================================================================
--- core/units/helpers/themes_helper.php
+++ core/units/helpers/themes_helper.php
@@ -69,18 +69,32 @@
if ($theme_info) {
$theme_id = $theme_info[$id_field];
- $theme_enabled = $theme_info['Enabled'];
+
+ if ( $theme_info['Status'] == ThemeStatus::DELETED ) {
+ $theme_info['Status'] = ThemeStatus::DISABLED;
+
+ $fields_hash = array(
+ 'Status' => ThemeStatus::DISABLED,
+ 'DeletedOn' => null,
+ 'AddedOn' => mktime(),
+ );
+
+ $this->Conn->doUpdate($fields_hash, $table_name, $id_field . '=' . $theme_id);
+ }
+
+ $theme_disabled = $theme_info['Status'] == ThemeStatus::DISABLED;
}
else {
- $theme_id = $theme_enabled = false;
+ $theme_id = false;
+ $theme_disabled = true;
}
$this->themeFiles = Array ();
$theme_path = $this->themesFolder . '/' . $theme_name;
- if ($theme_id) {
- if (!$theme_enabled) {
- // don't process existing theme files, that are disabled
+ if ( $theme_id ) {
+ if ( $theme_disabled ) {
+ // Don't process existing theme files, that are disabled.
return $theme_id;
}
@@ -102,7 +116,8 @@
$theme_info = Array (
'Name' => $theme_name,
- 'Enabled' => 0,
+ 'Status' => ThemeStatus::DISABLED,
+ 'AddedOn' => mktime(),
'Description' => $theme_name,
'PrimaryTheme' => 0,
'CacheTimeout' => 3600, // not in use right now
@@ -114,8 +129,8 @@
$this->Conn->doInsert($theme_info, $table_name);
$theme_id = $this->Conn->getInsertID();
- if (!$theme_enabled) {
- // don't process newly created theme files, because they are disabled
+ if ( $theme_disabled ) {
+ // Don't process newly created theme files, because they are disabled.
return $theme_id;
}
}
@@ -554,7 +569,7 @@
// 1. only one theme found -> enable it and make primary
/*if (count($themes_found) == 1) {
$sql = 'UPDATE ' . $table_name . '
- SET Enabled = 1, PrimaryTheme = 1
+ SET Status = 1, PrimaryTheme = 1
WHERE ' . $id_field . ' = ' . current($themes_found);
$this->Conn->Query($sql);
}*/
@@ -596,13 +611,16 @@
$config = $this->Application->getUnitConfig('theme');
$id_field = $config->getIDField();
- $sql = 'DELETE FROM '. $config->getTableName() .'
- WHERE '.$id_field.' IN ('.implode(',', $theme_ids).')';
- $this->Conn->Query($sql);
+ $fields_hash = array(
+ 'Status' => ThemeStatus::DELETED,
+ 'DeletedOn' => mktime(),
+ );
- $sql = 'DELETE FROM '.TABLE_PREFIX.'ThemeFiles
- WHERE '.$id_field.' IN ('.implode(',', $theme_ids).')';
- $this->Conn->Query($sql);
+ $this->Conn->doUpdate(
+ $fields_hash,
+ $config->getTableName(),
+ $id_field . ' IN (' . implode(',', $theme_ids) . ')'
+ );
}
/**
@@ -628,7 +646,7 @@
$sql = 'SELECT ' . $config->getIDField() . '
FROM ' . $config->getTableName() . '
- WHERE (PrimaryTheme = 1) AND (Enabled = 1)';
+ WHERE (PrimaryTheme = 1) AND (Status = ' . ThemeStatus::ACTIVE . ')';
$theme_id = $this->Conn->GetOne($sql);
}
Index: core/units/site_domains/site_domains_config.php
===================================================================
--- core/units/site_domains/site_domains_config.php
+++ core/units/site_domains/site_domains_config.php
@@ -122,12 +122,12 @@
),
'PrimaryThemeId' => Array (
'type' => 'int',
- 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Themes WHERE Enabled = 1 ORDER BY Name ASC', 'option_key_field' => 'ThemeId', 'option_title_field' => 'Name',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Themes WHERE Status = ' . ThemeStatus::ACTIVE . ' ORDER BY Name ASC', 'option_key_field' => 'ThemeId', 'option_title_field' => 'Name',
'not_null' => 1, 'default' => 0
),
'Themes' => Array (
'type' => 'string', 'max_len' => 255,
- 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Themes WHERE Enabled = 1 ORDER BY Name ASC', 'option_key_field' => 'ThemeId', 'option_title_field' => 'Name',
+ 'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %s FROM ' . TABLE_PREFIX . 'Themes WHERE Status = ' . ThemeStatus::ACTIVE . ' ORDER BY Name ASC', 'option_key_field' => 'ThemeId', 'option_title_field' => 'Name',
'not_null' => 1, 'default' => ''
),
'DomainIPRange' => Array ('type' => 'string', 'default' => NULL),
@@ -154,4 +154,4 @@
),
),
),
-);
\ No newline at end of file
+);
Index: core/units/structure/structure_config.php
===================================================================
--- core/units/structure/structure_config.php
+++ core/units/structure/structure_config.php
@@ -166,7 +166,7 @@
CONCAT(FilePath, "/", TRIM(TRAILING ".tpl" FROM FileName)) AS Value
FROM ' . TABLE_PREFIX . 'ThemeFiles AS tf
LEFT JOIN ' . TABLE_PREFIX . 'Themes AS t ON t.ThemeId = tf.ThemeId
- WHERE (t.Enabled = 1) AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")',
+ WHERE (t.Status = ' . ThemeStatus::ACTIVE . ') AND (tf.FileName NOT LIKE "%%.elm.tpl") AND (tf.FileName NOT LIKE "%%.des.tpl") AND (tf.FilePath = "/designs")',
'option_key_field' => 'Value', 'option_title_field' => 'Title',
'not_null' => 1, 'default' => CATEGORY_TEMPLATE_INHERIT
),
@@ -274,4 +274,4 @@
'DefaultSorting1Dir' => 'Category_Sortorder',
'DefaultSorting2Dir' => 'Category_Sortorder2',
),
-);
\ No newline at end of file
+);
Index: core/units/themes/themes_config.php
===================================================================
--- core/units/themes/themes_config.php
+++ core/units/themes/themes_config.php
@@ -32,7 +32,7 @@
),
'IDField' => 'ThemeId',
- 'StatusField' => Array ('Enabled', 'PrimaryTheme'),
+ 'StatusField' => array('Status', 'PrimaryTheme'),
'PermSection' => Array ('main' => 'in-portal:configure_themes'),
@@ -42,7 +42,7 @@
'icon' => 'conf_themes',
'label' => 'la_tab_Themes',
'url' => Array ('t' => 'themes/themes_list', 'pass' => 'm'),
- 'permissions' => Array ('view', 'add', 'edit', 'delete'),
+ 'permissions' => array('view', 'add', 'edit'),
'priority' => 5,
'type' => stTREE,
),
@@ -59,7 +59,7 @@
'themes_list' => Array (
'prefixes' => Array ('theme_List'), 'format' => "!la_tab_Themes!",
- 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'setprimary', 'refresh', 'view', 'dbl-click'),
+ 'toolbar_buttons' => array('new_item', 'edit', 'setprimary', 'refresh', 'view', 'dbl-click'),
),
'themes_edit_general' => Array (
@@ -111,11 +111,11 @@
'Fields' => Array (
'ThemeId' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
'Name' => Array ('type' => 'string', 'not_null' => 1, 'required' => 1, 'default' => ''),
- 'Enabled' => Array (
+ 'Status' => array(
'type' => 'int',
'formatter' => 'kOptionsFormatter',
- 'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'),
- 'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
+ 'options' => array(ThemeStatus::DISABLED => 'la_Disabled', ThemeStatus::ACTIVE => 'la_Enabled', ThemeStatus::DELETED => 'la_Deleted'),
+ 'use_phrases' => 1, 'not_null' => 1, 'default' => ThemeStatus::ACTIVE,
),
'Description' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
'PrimaryTheme' => Array (
@@ -139,6 +139,8 @@
'not_null' => 1, 'default' => ''
),
'ImageResizeRules' => Array ('type' => 'string', 'default' => NULL),
+ 'AddedOn' => array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
+ 'DeletedOn' => array('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null),
),
'Grids' => Array (
@@ -154,11 +156,13 @@
'ThemeId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 50, ),
'Name' => Array ('filter_block' => 'grid_like_filter', 'width' => 200, ),
'Description' => Array ('filter_block' => 'grid_like_filter', 'width' => 250, ),
- 'Enabled' => Array ( 'title' => 'column:la_fld_Status', 'filter_block' => 'grid_options_filter', 'width' => 200, ),
+ 'Status' => array('filter_block' => 'grid_options_filter', 'width' => 200),
// 'PrimaryTheme' => Array ( 'title' => 'column:la_fld_Primary', 'filter_block' => 'grid_options_filter'),
'LanguagePackInstalled' => Array ('title' => 'la_col_LanguagePackInstalled', 'filter_block' => 'grid_options_filter', 'width' => 200,),
'StylesheetFile' => array('filter_block' => 'grid_like_filter', 'width' => 150, 'hidden' => 1),
+ 'AddedOn' => array('filter_block' => 'grid_date_range_filter'),
+ 'DeletedOn' => array('filter_block' => 'grid_date_range_filter'),
),
),
),
-);
\ No newline at end of file
+);
Index: core/units/themes/themes_eh.php
===================================================================
--- core/units/themes/themes_eh.php
+++ core/units/themes/themes_eh.php
@@ -126,7 +126,7 @@
$sql = 'UPDATE '.$table_name.'
- SET PrimaryTheme = 1, Enabled = 1
+ SET PrimaryTheme = 1, Status = ' . ThemeStatus::ACTIVE . '
WHERE '. $config->getIDField() .' = '.$id;
$this->Conn->Query($sql);
}
@@ -191,7 +191,7 @@
$sql = 'SELECT COUNT(*)
FROM ' . $config->getTableName() . '
- WHERE ' . $config->getIDField() . ' IN (' . $ids . ') AND (Enabled = 1)';
+ WHERE ' . $config->getIDField() . ' IN (' . $ids . ') AND (Status = ' . ThemeStatus::ACTIVE . ')';
$enabled_themes = $this->Conn->GetOne($sql);
if ( $enabled_themes ) {
@@ -236,7 +236,7 @@
if ( in_array($event->Special, Array ('enabled', 'selected', 'available')) || !$this->Application->isAdminUser ) {
// "enabled" special or Front-End
- $object->addFilter('enabled_filter', '%1$s.Enabled = ' . STATUS_ACTIVE);
+ $object->addFilter('status_filter', '%1$s.Status = ' . ThemeStatus::ACTIVE);
}
// site domain theme picker

Event Timeline