Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F727158
D168.diff
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, Jan 6, 8:07 AM
Size
9 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 8:07 AM (2 d, 23 h ago)
Engine
blob
Format
Raw Data
Handle
537211
Attached To
D168: INP-1515 - Allow to enable/disable the Site Domain
D168.diff
View Options
Index: branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php
===================================================================
--- branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php
+++ branches/5.3.x/admin/system_presets/simple/site_domains_site-domain.php
@@ -15,7 +15,7 @@
// toolbar buttons
$remove_buttons = Array (
// list of site_domain_list;
-// 'site_domain_list' => Array ('new_item', 'edit', 'delete', 'dbl-click'),
+// 'site_domain_list' => Array ('new_item', 'edit', 'delete', 'approve', 'decline', 'view', 'dbl-click'),
// General" tab during adding/editing
// 'site_domain_edit' => Array ('select', 'cancel', 'reset_edit', 'prev', 'next'),
@@ -23,7 +23,7 @@
// fields to hide
$hidden_fields = Array (
- /*'DomainId', 'DomainName', 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */
+ /*'DomainId', 'DomainName', 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', 'Status', */
);
// virtual fields to hide
@@ -33,7 +33,7 @@
// fields to make required
$required_fields = Array (
- /*'DomainId',*/ 'DomainName', /* 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', */
+ /*'DomainId',*/ 'DomainName', /* 'SSLDomainName', 'AdminEmail', 'Country', 'PrimaryLanguageId', 'Languages', 'PrimaryThemeId', 'PrimaryThemeId', 'Themes', 'DomainIPRange', 'ExternalUrl', 'RedirectOnIPMatch', 'Priority', 'Status', */
);
// virtual fields to make required
@@ -48,5 +48,5 @@
// hide columns in grids
$hide_columns = Array (
-// 'Default' => Array ('DomainId', 'DomainName', 'SSLDomainName', 'Country', 'PrimaryLanguageId', 'PrimaryThemeId', 'Priority', ),
+// 'Default' => Array ('DomainId', 'DomainName', 'SSLDomainName', 'Country', 'PrimaryLanguageId', 'PrimaryThemeId', 'Priority', 'Status'),
);
Index: branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl
+++ branches/5.3.x/core/admin_templates/site_domains/site_domain_edit.tpl
@@ -89,6 +89,7 @@
<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="ExternalUrl" title="la_fld_ExternalUrl"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="site-domain" field="Priority" title="la_fld_Priority" style="width: 50px;"/>
+ <inp2:m_RenderElement name="inp_edit_radio" prefix="site-domain" field="Status"/>
<inp2:m_RenderElement name="subsection" title="la_section_RecipientsInfo"/>
<inp2:m_RenderElement name="inp_edit_radio" prefix="email-template.site-domain" field="RecipientType" title="la_fld_RecipientType"/>
Index: branches/5.3.x/core/admin_templates/site_domains/site_domain_list.tpl
===================================================================
--- branches/5.3.x/core/admin_templates/site_domains/site_domain_list.tpl
+++ branches/5.3.x/core/admin_templates/site_domains/site_domain_list.tpl
@@ -28,6 +28,18 @@
a_toolbar.AddButton( new ToolBarSeparator('sep1') );
+ a_toolbar.AddButton( new ToolBarButton('approve', '<inp2:m_phrase label="la_ToolTip_Enable" escape="1"/>', function() {
+ submit_event('site-domain','OnMassApprove');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarButton('decline', '<inp2:m_phrase label="la_ToolTip_Disable" escape="1"/>', function() {
+ submit_event('site-domain','OnMassDecline');
+ }
+ ) );
+
+ a_toolbar.AddButton( new ToolBarSeparator('sep2') );
+
a_toolbar.AddButton( new ToolBarButton('view', '<inp2:m_phrase label="la_ToolTip_View" escape="1"/>', function() {
show_viewmenu(a_toolbar,'view');
}
@@ -41,8 +53,24 @@
</tbody>
</table>
-<inp2:m_RenderElement name="grid" PrefixSpecial="site-domain" IdField="DomainId" grid="Default"/>
+<style type="text/css">
+ tr.row-disabled td {
+ background-color: #FFDFE0;
+ }
+
+ tr.grid-data-row-even.row-disabled td {
+ background-color: #F4D4D5;
+ }
+</style>
+
+<inp2:m_DefineElement name="row_class">
+ <inp2:m_ifnot check="Field" field="Status" db="db">
+ row-disabled
+ </inp2:m_ifnot>
+</inp2:m_DefineElement>
+
+<inp2:m_RenderElement name="grid" PrefixSpecial="site-domain" IdField="DomainId" grid="Default" row_class_render_as="row_class"/>
<script type="text/javascript">
- Grids['site-domain'].SetDependantToolbarButtons( new Array('edit','delete') );
+ Grids['site-domain'].SetDependantToolbarButtons( new Array('edit','delete','approve','decline') );
</script>
<inp2:m_include t="incs/footer"/>
Index: branches/5.3.x/core/install/install_schema.sql
===================================================================
--- branches/5.3.x/core/install/install_schema.sql
+++ branches/5.3.x/core/install/install_schema.sql
@@ -1360,6 +1360,7 @@
ExternalUrl varchar(255) NOT NULL DEFAULT '',
RedirectOnIPMatch tinyint(4) NOT NULL DEFAULT '0',
Priority int(11) NOT NULL DEFAULT '0',
+ `Status` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (DomainId),
KEY DomainName (DomainName),
KEY DomainNameUsesRegExp (DomainNameUsesRegExp),
@@ -1373,7 +1374,8 @@
KEY Themes (Themes),
KEY ExternalUrl (ExternalUrl),
KEY RedirectOnIPMatch (RedirectOnIPMatch),
- KEY Priority (Priority)
+ KEY Priority (Priority),
+ KEY `Status` (`Status`)
);
CREATE TABLE CurlLog (
Index: branches/5.3.x/core/install/upgrades.sql
===================================================================
--- branches/5.3.x/core/install/upgrades.sql
+++ branches/5.3.x/core/install/upgrades.sql
@@ -3033,3 +3033,7 @@
l1_HtmlBody = REPLACE(l1_HtmlBody, '<inp2:u_', '<inp2:'),
l1_PlainTextBody = REPLACE(l1_PlainTextBody, '<inp2:u_', '<inp2:')
WHERE TemplateName LIKE 'USER.MEMBERSHIP%';
+
+ALTER TABLE SiteDomains
+ ADD `Status` TINYINT NOT NULL DEFAULT '1' AFTER Priority,
+ ADD INDEX (`Status`);
Index: branches/5.3.x/core/units/helpers/site_helper.php
===================================================================
--- branches/5.3.x/core/units/helpers/site_helper.php
+++ branches/5.3.x/core/units/helpers/site_helper.php
@@ -81,6 +81,7 @@
else {
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'SiteDomains
+ WHERE Status = ' . STATUS_ACTIVE . '
ORDER BY Priority DESC';
$cache = $this->Conn->Query($sql, 'DomainId');
Index: branches/5.3.x/core/units/site_domains/site_domain_eh.php
===================================================================
--- branches/5.3.x/core/units/site_domains/site_domain_eh.php
+++ branches/5.3.x/core/units/site_domains/site_domain_eh.php
@@ -259,6 +259,25 @@
}
/**
+ * Deletes site domain cache.
+ *
+ * @param kEvent $event Event.
+ *
+ * @return void
+ */
+ protected function OnAfterItemUpdate(kEvent $event)
+ {
+ parent::OnAfterItemUpdate($event);
+
+ /** @var kDBItem $object */
+ $object = $event->getObject();
+
+ if ( !$object->IsTempTable() ) {
+ $this->_deleteCache();
+ }
+ }
+
+ /**
* Deletes site domain cache
*
* @param kEvent $event
Index: branches/5.3.x/core/units/site_domains/site_domains_config.php
===================================================================
--- branches/5.3.x/core/units/site_domains/site_domains_config.php
+++ branches/5.3.x/core/units/site_domains/site_domains_config.php
@@ -31,6 +31,7 @@
),
'IDField' => 'DomainId',
+ 'StatusField' => array('Status'),
'TableName' => TABLE_PREFIX . 'SiteDomains',
@@ -44,7 +45,7 @@
'site_domain_list' => Array (
'prefixes' => Array ('site-domain_List'), 'format' => "!la_title_SiteDomains!",
- 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'view', 'dbl-click'),
+ 'toolbar_buttons' => Array ('new_item', 'edit', 'delete', 'approve', 'decline', 'view', 'dbl-click'),
),
'site_domain_edit' => Array (
@@ -138,11 +139,23 @@
'not_null' => 1, 'default' => 0
),
'Priority' => Array ('type' => 'int', 'not_null' => 1, 'default' => 0),
+ 'Status' => array(
+ 'type' => 'int',
+ 'formatter' => 'kOptionsFormatter', 'options' => array(
+ STATUS_ACTIVE => 'la_Enabled',
+ STATUS_DISABLED => 'la_Disabled',
+ ), 'use_phrases' => 1,
+ 'not_null' => 1, 'required' => 1, 'default' => STATUS_ACTIVE,
+ ),
),
'Grids' => Array (
'Default' => Array (
- 'Icons' => Array ('default' => 'icon16_item.png'),
+ 'Icons' => Array(
+ 'default' => 'icon16_item.png',
+ STATUS_DISABLED => 'icon16_disabled.png',
+ STATUS_ACTIVE => 'icon16_item.png',
+ ),
'Fields' => Array (
'DomainId' => Array ('title' => 'column:la_fld_Id', 'data_block' => 'grid_checkbox_td', 'filter_block' => 'grid_range_filter', 'width' => 70, ),
'DomainName' => Array ('filter_block' => 'grid_like_filter', 'width' => 250, ),
@@ -151,7 +164,8 @@
'PrimaryLanguageId' => Array ('title' => 'column:la_fld_Language', 'filter_block' => 'grid_options_filter', 'width' => 250, ),
'PrimaryThemeId' => Array ('title' => 'column:la_fld_Theme', 'filter_block' => 'grid_options_filter', 'width' => 250, ),
'Priority' => Array ('filter_block' => 'grid_range_filter', 'width' => 70, ),
+ 'Status' => array('filter_block' => 'grid_options_filter'),
),
),
),
-);
\ No newline at end of file
+);
Event Timeline
Log In to Comment