From 51d13b75f00264e1cbb0374d213508485f3a2261 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 11 Apr 2018 23:04:10 +0200 Subject: [PATCH] Fixed the css missing fields from field area --- README.md | 4 +- admin/README.txt | 4 +- admin/layouts/field/data_base_left.php | 8 +- admin/layouts/field/scripts_left.php | 57 +++++ admin/layouts/fieldtype/fields_fullwidth.php | 10 +- admin/models/field.php | 24 +- admin/models/fields.php | 22 +- admin/models/forms/field.xml | 248 +++++++++---------- admin/sql/install.mysql.utf8.sql | 14 +- admin/views/field/tmpl/edit.php | 5 +- admin/views/fields/tmpl/default_body.php | 6 +- admin/views/fields/tmpl/default_head.php | 6 +- admin/views/fields/view.html.php | 2 +- script.php | 8 +- 14 files changed, 237 insertions(+), 181 deletions(-) create mode 100644 admin/layouts/field/scripts_left.php diff --git a/README.md b/README.md index 0f419c3d5..88d0891d3 100644 --- a/README.md +++ b/README.md @@ -130,9 +130,9 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.2 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **189480** ++ *Line count*: **189536** + *Field count*: **1012** -+ *File count*: **1199** ++ *File count*: **1200** + *Folder count*: **193** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/README.txt b/admin/README.txt index 0f419c3d5..88d0891d3 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -130,9 +130,9 @@ Component Builder is mapped as a component in itself on my local development env + *Version*: 2.7.2 + *Copyright*: Copyright (C) 2015. All Rights Reserved + *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html -+ *Line count*: **189480** ++ *Line count*: **189536** + *Field count*: **1012** -+ *File count*: **1199** ++ *File count*: **1200** + *Folder count*: **193** > This **component** was build with a Joomla [Automated Component Builder](http://joomlacomponentbuilder.com). diff --git a/admin/layouts/field/data_base_left.php b/admin/layouts/field/data_base_left.php index 0cb0fc003..549915605 100644 --- a/admin/layouts/field/data_base_left.php +++ b/admin/layouts/field/data_base_left.php @@ -33,12 +33,8 @@ $fields = $displayData->get('fields') ?: array( 'datatype', 'datalenght', 'datalenght_other', - 'css_views', - 'datadefault_other', - 'add_css_view', - 'css_view', - 'add_css_views', - 'datadefault' + 'datadefault', + 'datadefault_other' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/field/scripts_left.php b/admin/layouts/field/scripts_left.php new file mode 100644 index 000000000..6ea8283f7 --- /dev/null +++ b/admin/layouts/field/scripts_left.php @@ -0,0 +1,57 @@ + + @github Joomla Component Builder + @copyright Copyright (C) 2015. All Rights Reserved + @license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html + + Builds Complex Joomla Components + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +// No direct access to this file + +defined('_JEXEC') or die('Restricted access'); + +$form = $displayData->getForm(); + +$fields = $displayData->get('fields') ?: array( + 'add_css_view', + 'css_view', + 'add_css_views', + 'css_views' +); + +$hiddenFields = $displayData->get('hidden_fields') ?: array(); + +foreach ($fields as $field) +{ + $field = is_array($field) ? $field : array($field); + foreach ($field as $f) + { + if ($form->getField($f)) + { + if (in_array($f, $hiddenFields)) + { + $form->setFieldAttribute($f, 'type', 'hidden'); + } + + echo $form->renderField($f); + break; + } + } +} diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php index 756a78bda..1f0b6321e 100644 --- a/admin/layouts/fieldtype/fields_fullwidth.php +++ b/admin/layouts/fieldtype/fields_fullwidth.php @@ -61,10 +61,10 @@ $can = ComponentbuilderHelper::getActions('field'); - + - + @@ -104,9 +104,6 @@ $can = ComponentbuilderHelper::getActions('field'); null_switch); ?> - - store); ?> - authorise('core.edit', 'com_componentbuilder.fields.category.' . (int)$item->catid)): ?> escape($item->category_title); ?> @@ -114,6 +111,9 @@ $can = ComponentbuilderHelper::getActions('field'); escape($item->category_title); ?> + + store); ?> + published == 1):?> diff --git a/admin/models/field.php b/admin/models/field.php index 5415d14e7..6a4521eb0 100644 --- a/admin/models/field.php +++ b/admin/models/field.php @@ -106,6 +106,12 @@ class ComponentbuilderModelField extends JModelAdmin $item->xml = json_decode($item->xml); } + if (!empty($item->javascript_view_footer)) + { + // base64 Decode javascript_view_footer. + $item->javascript_view_footer = base64_decode($item->javascript_view_footer); + } + if (!empty($item->css_views)) { // base64 Decode css_views. @@ -118,12 +124,6 @@ class ComponentbuilderModelField extends JModelAdmin $item->css_view = base64_decode($item->css_view); } - if (!empty($item->javascript_view_footer)) - { - // base64 Decode javascript_view_footer. - $item->javascript_view_footer = base64_decode($item->javascript_view_footer); - } - if (!empty($item->javascript_views_footer)) { // base64 Decode javascript_views_footer. @@ -931,6 +931,12 @@ class ComponentbuilderModelField extends JModelAdmin $data['xml'] = (string) json_encode($data['xml']); } + // Set the javascript_view_footer string to base64 string. + if (isset($data['javascript_view_footer'])) + { + $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); + } + // Set the css_views string to base64 string. if (isset($data['css_views'])) { @@ -943,12 +949,6 @@ class ComponentbuilderModelField extends JModelAdmin $data['css_view'] = base64_encode($data['css_view']); } - // Set the javascript_view_footer string to base64 string. - if (isset($data['javascript_view_footer'])) - { - $data['javascript_view_footer'] = base64_encode($data['javascript_view_footer']); - } - // Set the javascript_views_footer string to base64 string. if (isset($data['javascript_views_footer'])) { diff --git a/admin/models/fields.php b/admin/models/fields.php index cd2d51d07..bf0e4ca0d 100644 --- a/admin/models/fields.php +++ b/admin/models/fields.php @@ -49,10 +49,10 @@ class ComponentbuilderModelFields extends JModelList 'a.datatype','datatype', 'a.indexes','indexes', 'a.null_switch','null_switch', - 'a.store','store', 'c.title','category_title', 'c.id', 'category_id', - 'a.catid', 'catid' + 'a.catid', 'catid', + 'a.store','store' ); } @@ -88,9 +88,6 @@ class ComponentbuilderModelFields extends JModelList $null_switch = $this->getUserStateFromRequest($this->context . '.filter.null_switch', 'filter_null_switch'); $this->setState('filter.null_switch', $null_switch); - $store = $this->getUserStateFromRequest($this->context . '.filter.store', 'filter_store'); - $this->setState('filter.store', $store); - $category = $app->getUserStateFromRequest($this->context . '.filter.category', 'filter_category'); $this->setState('filter.category', $category); @@ -98,7 +95,10 @@ class ComponentbuilderModelFields extends JModelList $this->setState('filter.category_id', $categoryId); $catid = $app->getUserStateFromRequest($this->context . '.filter.catid', 'filter_catid'); - $this->setState('filter.catid', $catid); + $this->setState('filter.catid', $catid); + + $store = $this->getUserStateFromRequest($this->context . '.filter.store', 'filter_store'); + $this->setState('filter.store', $store); $sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int'); $this->setState('filter.sorting', $sorting); @@ -313,7 +313,7 @@ class ComponentbuilderModelFields extends JModelList else { $search = $db->quote('%' . $db->escape($search) . '%'); - $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.store LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.xml LIKE '.$search.')'); + $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.store LIKE '.$search.' OR a.xml LIKE '.$search.')'); } } @@ -431,12 +431,12 @@ class ComponentbuilderModelFields extends JModelList continue; } + // decode javascript_view_footer + $item->javascript_view_footer = base64_decode($item->javascript_view_footer); // decode css_views $item->css_views = base64_decode($item->css_views); // decode css_view $item->css_view = base64_decode($item->css_view); - // decode javascript_view_footer - $item->javascript_view_footer = base64_decode($item->javascript_view_footer); // decode javascript_views_footer $item->javascript_views_footer = base64_decode($item->javascript_views_footer); // unset the values we don't want exported. @@ -504,10 +504,10 @@ class ComponentbuilderModelFields extends JModelList $id .= ':' . $this->getState('filter.datatype'); $id .= ':' . $this->getState('filter.indexes'); $id .= ':' . $this->getState('filter.null_switch'); - $id .= ':' . $this->getState('filter.store'); $id .= ':' . $this->getState('filter.category'); $id .= ':' . $this->getState('filter.category_id'); - $id .= ':' . $this->getState('filter.catid'); + $id .= ':' . $this->getState('filter.catid'); + $id .= ':' . $this->getState('filter.store'); return parent::getStoreId($id); } diff --git a/admin/models/forms/field.xml b/admin/models/forms/field.xml index 9866736ad..1723954be 100644 --- a/admin/models/forms/field.xml +++ b/admin/models/forms/field.xml @@ -183,21 +183,18 @@ - + - - - - - - - - - - COM_COMPONENTBUILDER_FIELD_NO + + + + + + + + + + + + + + + + + + COM_COMPONENTBUILDER_FIELD_WHMCSKEY_ENCRYPTION - + - - - - - - - + + + + + + + + + + + + + COM_COMPONENTBUILDER_FIELD_OTHER - - - - - - - - - + @@ -390,6 +404,8 @@ + + - + - - - - - - - - + type="hidden" + name="not_required" + default="[]" + />
-
+
+ +
+
diff --git a/admin/views/fields/tmpl/default_body.php b/admin/views/fields/tmpl/default_body.php index 03e04eb0e..b5d7ec0e9 100644 --- a/admin/views/fields/tmpl/default_body.php +++ b/admin/views/fields/tmpl/default_body.php @@ -104,9 +104,6 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; null_switch); ?> - - store); ?> - user->authorise('core.edit', 'com_componentbuilder.fields.category.' . (int)$item->catid)): ?> escape($item->category_title); ?> @@ -114,6 +111,9 @@ $edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit"; escape($item->category_title); ?> + + store); ?> + get('field.edit.state')) : ?> checked_out) : ?> diff --git a/admin/views/fields/tmpl/default_head.php b/admin/views/fields/tmpl/default_head.php index b45a9b76e..f6f19daa6 100644 --- a/admin/views/fields/tmpl/default_head.php +++ b/admin/views/fields/tmpl/default_head.php @@ -58,12 +58,12 @@ defined('_JEXEC') or die('Restricted access'); listDirn, $this->listOrder); ?> - - listDirn, $this->listOrder); ?> - listDirn, $this->listOrder); ?> + + listDirn, $this->listOrder); ?> + canState): ?> listDirn, $this->listOrder); ?> diff --git a/admin/views/fields/view.html.php b/admin/views/fields/view.html.php index 7b6fc7d3b..71fcbd988 100644 --- a/admin/views/fields/view.html.php +++ b/admin/views/fields/view.html.php @@ -377,8 +377,8 @@ class ComponentbuilderViewFields extends JViewLegacy 'a.datatype' => JText::_('COM_COMPONENTBUILDER_FIELD_DATATYPE_LABEL'), 'a.indexes' => JText::_('COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL'), 'a.null_switch' => JText::_('COM_COMPONENTBUILDER_FIELD_NULL_SWITCH_LABEL'), - 'a.store' => JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'), 'c.category_title' => JText::_('COM_COMPONENTBUILDER_FIELD_FIELD_CATEGORY'), + 'a.store' => JText::_('COM_COMPONENTBUILDER_FIELD_STORE_LABEL'), 'a.id' => JText::_('JGRID_HEADING_ID') ); } diff --git a/script.php b/script.php index 0483f1743..424a3058a 100644 --- a/script.php +++ b/script.php @@ -3428,9 +3428,9 @@ class com_componentbuilderInstallerScript $field->type_title = 'Componentbuilder Field'; $field->type_alias = 'com_componentbuilder.field'; $field->table = '{"special": {"dbtable": "#__componentbuilder_field","key": "id","type": "Field","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $field->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","datadefault_other":"datadefault_other","css_views":"css_views","add_javascript_views_footer":"add_javascript_views_footer","add_javascript_view_footer":"add_javascript_view_footer","store":"store","add_css_view":"add_css_view","not_required":"not_required","datalenght":"datalenght","css_view":"css_view","datalenght_other":"datalenght_other","javascript_view_footer":"javascript_view_footer","add_css_views":"add_css_views","javascript_views_footer":"javascript_views_footer","datadefault":"datadefault","xml":"xml"}}'; + $field->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","javascript_view_footer":"javascript_view_footer","css_views":"css_views","add_javascript_view_footer":"add_javascript_view_footer","css_view":"css_view","add_css_views":"add_css_views","add_css_view":"add_css_view","store":"store","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","datalenght":"datalenght","add_javascript_views_footer":"add_javascript_views_footer","javascript_views_footer":"javascript_views_footer","not_required":"not_required","xml":"xml"}}'; $field->router = 'ComponentbuilderHelperRoute::getFieldRoute'; - $field->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/field.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required","xml"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","fieldtype","add_javascript_views_footer","add_javascript_view_footer","store","add_css_view","not_required","catid","add_css_views"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "fieldtype","targetTable": "#__componentbuilder_fieldtype","targetColumn": "id","displayColumn": "name"}]}'; + $field->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/field.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required","xml"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","fieldtype","add_javascript_view_footer","add_css_views","catid","add_css_view","store","add_javascript_views_footer","not_required"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "fieldtype","targetTable": "#__componentbuilder_fieldtype","targetColumn": "id","displayColumn": "name"}]}'; // Set the object into the content types table. $field_Inserted = $db->insertObject('#__content_types', $field); @@ -4037,9 +4037,9 @@ class com_componentbuilderInstallerScript $field->type_title = 'Componentbuilder Field'; $field->type_alias = 'com_componentbuilder.field'; $field->table = '{"special": {"dbtable": "#__componentbuilder_field","key": "id","type": "Field","prefix": "componentbuilderTable","config": "array()"},"common": {"dbtable": "#__ucm_content","key": "ucm_id","type": "Corecontent","prefix": "JTable","config": "array()"}}'; - $field->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","datadefault_other":"datadefault_other","css_views":"css_views","add_javascript_views_footer":"add_javascript_views_footer","add_javascript_view_footer":"add_javascript_view_footer","store":"store","add_css_view":"add_css_view","not_required":"not_required","datalenght":"datalenght","css_view":"css_view","datalenght_other":"datalenght_other","javascript_view_footer":"javascript_view_footer","add_css_views":"add_css_views","javascript_views_footer":"javascript_views_footer","datadefault":"datadefault","xml":"xml"}}'; + $field->field_mappings = '{"common": {"core_content_item_id": "id","core_title": "name","core_state": "published","core_alias": "null","core_created_time": "created","core_modified_time": "modified","core_body": "null","core_hits": "hits","core_publish_up": "null","core_publish_down": "null","core_access": "access","core_params": "params","core_featured": "null","core_metadata": "null","core_language": "null","core_images": "null","core_urls": "null","core_version": "version","core_ordering": "ordering","core_metakey": "null","core_metadesc": "null","core_catid": "catid","core_xreference": "null","asset_id": "asset_id"},"special": {"name":"name","fieldtype":"fieldtype","datatype":"datatype","indexes":"indexes","null_switch":"null_switch","javascript_view_footer":"javascript_view_footer","css_views":"css_views","add_javascript_view_footer":"add_javascript_view_footer","css_view":"css_view","add_css_views":"add_css_views","add_css_view":"add_css_view","store":"store","datadefault_other":"datadefault_other","datadefault":"datadefault","datalenght_other":"datalenght_other","datalenght":"datalenght","add_javascript_views_footer":"add_javascript_views_footer","javascript_views_footer":"javascript_views_footer","not_required":"not_required","xml":"xml"}}'; $field->router = 'ComponentbuilderHelperRoute::getFieldRoute'; - $field->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/field.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required","xml"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","fieldtype","add_javascript_views_footer","add_javascript_view_footer","store","add_css_view","not_required","catid","add_css_views"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "fieldtype","targetTable": "#__componentbuilder_fieldtype","targetColumn": "id","displayColumn": "name"}]}'; + $field->content_history_options = '{"formFile": "administrator/components/com_componentbuilder/models/forms/field.xml","hideFields": ["asset_id","checked_out","checked_out_time","version","not_required","xml"],"ignoreChanges": ["modified_by","modified","checked_out","checked_out_time","version","hits"],"convertToInt": ["published","ordering","fieldtype","add_javascript_view_footer","add_css_views","catid","add_css_view","store","add_javascript_views_footer","not_required"],"displayLookup": [{"sourceColumn": "catid","targetTable": "#__categories","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "created_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "access","targetTable": "#__viewlevels","targetColumn": "id","displayColumn": "title"},{"sourceColumn": "modified_by","targetTable": "#__users","targetColumn": "id","displayColumn": "name"},{"sourceColumn": "fieldtype","targetTable": "#__componentbuilder_fieldtype","targetColumn": "id","displayColumn": "name"}]}'; // Check if field type is already in content_type DB. $field_id = null;