Page MenuHomeIn-Portal Phabricator

D12.id17.diff
No OneTemporary

File Metadata

Created
Wed, Aug 13, 12:46 PM

D12.id17.diff

Index: core/admin_templates/themes/themes_edit.tpl
===================================================================
--- core/admin_templates/themes/themes_edit.tpl
+++ core/admin_templates/themes/themes_edit.tpl
@@ -57,9 +57,9 @@
<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="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="Enabled" title="la_fld_Status"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="theme" field="CacheTimeout" title="la_prompt_lang_cache_timeout"/>
<!--##
<inp2:m_if check="m_ModuleEnabled" module="In-Portal">
@@ -67,6 +67,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>
\ No newline at end of file
Index: core/admin_templates/themes/themes_list.tpl
===================================================================
--- core/admin_templates/themes/themes_list.tpl
+++ core/admin_templates/themes/themes_list.tpl
@@ -20,12 +20,7 @@
} ) );
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') );
a_toolbar.AddButton( new ToolBarButton('setprimary', '<inp2:m_phrase label="la_ToolTip_SetPrimary" escape="1"/>', function() {
@@ -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/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>
@@ -392,6 +393,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);
\ No newline at end of file
Index: core/install/install_schema.sql
===================================================================
--- core/install/install_schema.sql
+++ core/install/install_schema.sql
@@ -381,6 +381,8 @@
LanguagePackInstalled tinyint(3) unsigned NOT NULL DEFAULT '0',
TemplateAliases text,
ImageResizeRules text,
+ AddedOn int(11) DEFAULT NULL,
+ DeletedOn int(11) DEFAULT NULL,
PRIMARY KEY (ThemeId),
KEY Enabled (Enabled),
KEY StylesheetId (StylesheetId),
\ No newline at end of file
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql
+++ core/install/upgrades.sql
@@ -2989,3 +2989,10 @@
l<%PRIMARY_LANGUAGE%>_PlainTextBody = REPLACE(l<%PRIMARY_LANGUAGE%>_PlainTextBody, '<inp2:u_Field name="Email"/>', '<inp2:Field name="Email"/>'),
l<%PRIMARY_LANGUAGE%>_HtmlBody = REPLACE(l<%PRIMARY_LANGUAGE%>_HtmlBody, '<inp2:u_Field name="Email"/>', '<inp2:Field name="Email"/>')
WHERE TemplateName IN ('USER.SUBSCRIBE', 'USER.UNSUBSCRIBE');
+
+ALTER TABLE Themes
+ADD AddedOn int(11) DEFAULT NULL,
+ADD DeletedOn int(11) DEFAULT NULL;
+
+DELETE FROM Permissions WHERE Permission = 'in-portal:configure_themes.delete';
+
Index: core/units/helpers/themes_helper.php
===================================================================
--- core/units/helpers/themes_helper.php
+++ core/units/helpers/themes_helper.php
@@ -69,6 +69,19 @@
if ($theme_info) {
$theme_id = $theme_info[$id_field];
+
+ if ( $theme_info['Enabled'] == 2 ) {
+ $theme_info['Enabled'] = 0;
+
+ $fields_hash = Array (
+ 'Enabled' => 0,
+ 'DeletedOn' => NULL,
+ 'AddedOn' => mktime()
+ );
+
+ $this->Conn->doUpdate($fields_hash, $table_name, $id_field . '=' . $theme_id);
+ }
+
$theme_enabled = $theme_info['Enabled'];
}
else {
@@ -561,13 +574,12 @@
$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 (
+ 'Enabled' => 2,
+ '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).')');
}
/**
\ 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
@@ -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 (
@@ -114,7 +114,7 @@
'Enabled' => Array (
'type' => 'int',
'formatter' => 'kOptionsFormatter',
- 'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled'),
+ 'options' => Array (0 => 'la_Disabled', 1 => 'la_Enabled', 2 => 'la_Deleted'),
'use_phrases' => 1, 'not_null' => 1, 'default' => 1,
),
'Description' => Array ('type' => 'string', 'formatter' => 'kFormatter', 'using_fck' => 1, 'default' => null),
@@ -134,6 +134,8 @@
),
'TemplateAliases' => Array ('type' => 'string', 'formatter' => 'kSerializedFormatter', 'default' => 'a:0:{}'),
'ImageResizeRules' => Array ('type' => 'string', 'default' => NULL),
+ 'AddedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => '#NOW#'),
+ 'DeletedOn' => Array ('type' => 'int', 'formatter' => 'kDateFormatter', 'default' => null),
),
'Grids' => Array (
@@ -152,6 +154,8 @@
'Enabled' => Array ( 'title' => 'column:la_fld_Status', '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,),
+ 'AddedOn' => Array ('filter_block' => 'grid_date_range_filter'),
+ 'DeletedOn' => Array ('filter_block' => 'grid_date_range_filter'),
),
),
),
\ No newline at end of file

Event Timeline