From ba477f83c2b2148f802e81e1b9462babba91b0a7 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 5 May 2017 14:20:57 -0400 Subject: [PATCH 1/5] Update for Symphony 4.x Update release version. Update styles to fit in with new Symphony 4.x layout. --- assets/publish_tabs.publish.css | 98 ++++++++++++++++++++++----------- extension.meta.xml | 3 + 2 files changed, 70 insertions(+), 31 deletions(-) diff --git a/assets/publish_tabs.publish.css b/assets/publish_tabs.publish.css index 55fe87f..6e77036 100644 --- a/assets/publish_tabs.publish.css +++ b/assets/publish_tabs.publish.css @@ -1,42 +1,78 @@ -.tab-group { +/*----------------------------------------------------------------------------- + Tabs +-----------------------------------------------------------------------------*/ + +#context > .tabs { + order: 2; + box-sizing: border-box; + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; position: absolute; - top: -99999em; - left: -99999em; - width: 100%; + left: 0; + right: 0; + top: 100%; + margin: 1px 0 0; + padding: 0 3rem; + border-bottom: 1px solid #d3dce2; + background: #fff; + height: 6rem; + z-index: 10; + white-space: nowrap; + list-style-type: none; +} + +#context > .tabs li { + box-sizing: border-box; + position: relative; + color: #3B3D40; + font-size: 1.2rem; + font-weight: 300; + text-transform: uppercase; + line-height: 6rem; + margin-right: 3rem; + margin-bottom: -1px; + border-bottom: 2px solid transparent; + height: 6rem; + cursor: pointer; +} + +#context > .tabs li + li { + margin-left: 1rem; } -.tab-group-selected { - position: static; +#context > .tabs li:hover, +#context > .tabs li.selected, +#context > .tabs li.active { + color: #2f77eb!important; + border-bottom-color: #2f77eb; + z-index: 10; } -ul.tabs li.invalid .icon { - background: #f4f4f4; - color: rgba(255, 255, 255, 0.7); - -webkit-box-shadow: none; - box-shadow: none; - display: inline-block; - vertical-align: top; - text-align: center; - width: 16px; - height: 16px; - line-height: 16px; - margin: 0 0 0 5px; - border-radius: 8px; - font-weight: lighter; +#context > .tabs li.invalid { + color: #ee494e!important; } -ul.tabs li.invalid.selected .icon { - background: #dd4422; - color: #f4f4f4; +#context > .tabs li.invalid:hover, +#context > .tabs li.invalid.selected, +#context > .tabs li.invalid.selected:hover { + color: #ee494e!important; + border-bottom-color: #ee494e; + z-index: 10; } -ul.tabs li.invalid:hover, -ul.tabs li.invalid .icon { - text-shadow: none; - color: #dd4422; +/*----------------------------------------------------------------------------- + Tab Groups +-----------------------------------------------------------------------------*/ + +body.publish-tabs #contents { + padding-top: 12rem; } -ul.tabs li.invalid:hover .icon { - background: #dd4422; - color: rgba(255, 255, 255, 0.7); -} \ No newline at end of file +.tab-group:not(.tab-group-selected) { + position: absolute; + top: -99999em; + left: -99999em; + width: 100%; +} diff --git a/extension.meta.xml b/extension.meta.xml index 4ee728d..c8b02d0 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -24,6 +24,9 @@ Publish Tabs: Add tab groups to entry create/edit forms + + - Update for Symphony 4.x + - Marked as compatible with Symphony 2.6.x - Removed the field from the Data Source editor since it outputs nothing. From db994d7646a4b0edb0b7c77a58f1b00b3ab1e85b Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Wed, 17 May 2017 11:00:53 -0400 Subject: [PATCH 2/5] Update php-min/php-max info --- extension.meta.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension.meta.xml b/extension.meta.xml index c8b02d0..6a81a90 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -24,7 +24,7 @@ Publish Tabs: Add tab groups to entry create/edit forms - + - Update for Symphony 4.x From aa4dd4b72960e7693d1cf3122d3181779f26fdfd Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Fri, 26 May 2017 15:09:05 -0400 Subject: [PATCH 3/5] Style fixes --- assets/publish_tabs.publish.css | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/publish_tabs.publish.css b/assets/publish_tabs.publish.css index 6e77036..3b32999 100644 --- a/assets/publish_tabs.publish.css +++ b/assets/publish_tabs.publish.css @@ -28,7 +28,6 @@ position: relative; color: #3B3D40; font-size: 1.2rem; - font-weight: 300; text-transform: uppercase; line-height: 6rem; margin-right: 3rem; From 76308ef5f9f7e537b300ae5d8b79f76088201285 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Thu, 24 Aug 2017 15:57:01 -0400 Subject: [PATCH 4/5] SQL and PHP cases PHP true,false,null in lowercase SQL keywords uppercase --- extension.driver.php | 4 ++-- fields/field.publish_tabs.php | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/extension.driver.php b/extension.driver.php index eae324d..66d3d7a 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -9,8 +9,8 @@ public function uninstall() { public function install() { Symphony::Database()->query( "CREATE TABLE IF NOT EXISTS `tbl_fields_publish_tabs` ( - `id` int(11) NOT NULL auto_increment, - `field_id` int(11) NOT NULL, + `id` INT(11) NOT NULL AUTO_INCREMENT, + `field_id` INT(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;" ); diff --git a/fields/field.publish_tabs.php b/fields/field.publish_tabs.php index 170cfde..1ebd266 100644 --- a/fields/field.publish_tabs.php +++ b/fields/field.publish_tabs.php @@ -22,9 +22,9 @@ public function __construct(){ public function createTable(){ return Symphony::Database()->query( "CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` ( - `id` int(11) unsigned NOT NULL auto_increment, - `entry_id` int(11) unsigned NOT NULL, - `value` double default NULL, + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `entry_id` INT(11) UNSIGNED NOT NULL, + `value` DOUBLE DEFAULT NULL, PRIMARY KEY (`id`), KEY `entry_id` (`entry_id`), KEY `value` (`value`) @@ -53,11 +53,11 @@ public function commit(){ Publish: -------------------------------------------------------------------------*/ - public function displayPublishPanel(XMLElement &$wrapper, $data = NULL, $flagWithError = NULL, $fieldnamePrefix = NULL, $fieldnamePostfix = NULL, $entry_id = NULL){ + public function displayPublishPanel(XMLElement &$wrapper, $data = null, $flagWithError = null, $fieldnamePrefix = null, $fieldnamePostfix = null, $entry_id = null){ $wrapper->setValue($this->get('label')); } - public function processRawFieldData($data, &$status, &$message = NULL, $simulate = false, $entry_id = NULL) { + public function processRawFieldData($data, &$status, &$message = null, $simulate = false, $entry_id = null) { $status = self::__OK__; return array( @@ -73,26 +73,26 @@ public function fetchIncludableElements() { return null; } - public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = NULL, $entry_id = NULL) { + public function appendFormattedElement(XMLElement &$wrapper, $data, $encode = false, $mode = null, $entry_id = null) { } - public function prepareReadableValue($data, $entry_id = NULL, $truncate = false, $defaultValue = NULL) { + public function prepareReadableValue($data, $entry_id = null, $truncate = false, $defaultValue = null) { return $this->prepareTableValue($data, null, $entry_id); } - public function prepareTableValue($data, XMLElement $link=NULL, $entry_id=NULL) { + public function prepareTableValue($data, XMLElement $link = null, $entry_id = null) { // build this entry fully $entries = EntryManager::fetch($entry_id); - if ($entries === false) return parent::prepareTableValue(NULL, $link, $entry_id); + if ($entries === false) return parent::prepareTableValue(null, $link, $entry_id); $entry = reset(EntryManager::fetch($entry_id)); // get the first field inside this tab $field_id = Symphony::Database()->fetchVar('id', 0, "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '".$this->get('parent_section')."' AND `sortorder` = ".($this->get('sortorder') + 1)." ORDER BY `sortorder` LIMIT 1"); - if ($field_id === NULL) return parent::prepareTableValue(NULL, $link, $entry_id); + if ($field_id === null) return parent::prepareTableValue(null, $link, $entry_id); $field = FieldManager::fetch($field_id); From ef80fabeb9357050987274e63dc93ac3c950e7e4 Mon Sep 17 00:00:00 2001 From: Alexandra Nantel Date: Wed, 6 Jun 2018 10:30:13 -0400 Subject: [PATCH 5/5] Code refactoring for Database and EQFA --- extension.driver.php | 31 +++++++++++++++++-------- extension.meta.xml | 1 + fields/field.publish_tabs.php | 43 ++++++++++++++++++++++++++--------- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/extension.driver.php b/extension.driver.php index 66d3d7a..ff4433a 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -3,18 +3,31 @@ class extension_publish_tabs extends Extension { public function uninstall() { - Symphony::Database()->query("DROP TABLE `tbl_fields_publish_tabs`"); + return Symphony::Database() + ->drop('tbl_fields_publish_tabs') + ->ifExists() + ->execute() + ->success(); } public function install() { - Symphony::Database()->query( - "CREATE TABLE IF NOT EXISTS `tbl_fields_publish_tabs` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `field_id` INT(11) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;" - ); - return true; + return Symphony::Database() + ->create('tbl_fields_publish_tabs') + ->ifNotExists() + ->charset('utf8') + ->collate('utf8_unicode_ci') + ->fields([ + 'id' => [ + 'type' => 'int(11)', + 'auto' => true, + ], + 'field_id' => 'int(11)', + ]) + ->keys([ + 'id' => 'primary', + ]) + ->execute() + ->success(); } public function getSubscribedDelegates() { diff --git a/extension.meta.xml b/extension.meta.xml index 6a81a90..fb4037f 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -26,6 +26,7 @@ - Update for Symphony 4.x + - Code refactoring for Database and EQFA - Marked as compatible with Symphony 2.6.x diff --git a/fields/field.publish_tabs.php b/fields/field.publish_tabs.php index 1ebd266..2dacec8 100644 --- a/fields/field.publish_tabs.php +++ b/fields/field.publish_tabs.php @@ -20,16 +20,29 @@ public function __construct(){ -------------------------------------------------------------------------*/ public function createTable(){ - return Symphony::Database()->query( - "CREATE TABLE IF NOT EXISTS `tbl_entries_data_" . $this->get('id') . "` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `entry_id` INT(11) UNSIGNED NOT NULL, - `value` DOUBLE DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `entry_id` (`entry_id`), - KEY `value` (`value`) - ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;" - ); + return Symphony::Database() + ->create('tbl_entries_data_' . $this->get('id')) + ->ifNotExists() + ->charset('utf8') + ->collate('utf8_unicode_ci') + ->fields([ + 'id' => [ + 'type' => 'int(11)', + 'auto' => true, + ], + 'entry_id' => 'int(11)', + 'value' => [ + 'type' => 'double', + 'null' => true, + ], + ]) + ->keys([ + 'id' => 'primary', + 'entry_id' => 'key', + 'value' => 'key', + ]) + ->execute() + ->success(); } /*------------------------------------------------------------------------- @@ -90,7 +103,15 @@ public function prepareTableValue($data, XMLElement $link = null, $entry_id = nu $entry = reset(EntryManager::fetch($entry_id)); // get the first field inside this tab - $field_id = Symphony::Database()->fetchVar('id', 0, "SELECT `id` FROM `tbl_fields` WHERE `parent_section` = '".$this->get('parent_section')."' AND `sortorder` = ".($this->get('sortorder') + 1)." ORDER BY `sortorder` LIMIT 1"); + $field_id = Symphony::Database() + ->select(['id']) + ->from('tbl_fields') + ->where(['parent_section' => $this->get('parent_section')]) + ->where(['sortorder' => ($this->get('sortorder') + 1)]) + ->orderBy('sortorder') + ->limit(1) + ->execute() + ->variable('id'); if ($field_id === null) return parent::prepareTableValue(null, $link, $entry_id);