From d4997abd3751d4b1ccf394ea973cd2da5195e740 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 6 Nov 2020 07:06:38 +0200 Subject: [PATCH 01/25] Fixed gh-609 so that JS and CSS from fields are added to module. Also formated the class with auto code reformat in phpstorm. --- README.md | 2 +- admin/README.txt | 2 +- admin/helpers/compiler/e_Interpretation.php | 243 +++++++++++++------- admin/helpers/compiler/f_Infusion.php | 2 +- componentbuilder.xml | 2 +- 5 files changed, 169 insertions(+), 82 deletions(-) diff --git a/README.md b/README.md index 191c05c05..76c3fa154 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 29th October, 2020 ++ *Last Build*: 6th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/README.txt b/admin/README.txt index 191c05c05..76c3fa154 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,7 +144,7 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 29th October, 2020 ++ *Last Build*: 6th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index d5b22de90..3da1fbf5d 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -1178,11 +1178,11 @@ class Interpretation extends Fields $updateXML[] = ''; // UPDATE_SERVER_XML $name = substr( - $this->componentData->update_server_url, - strrpos($this->componentData->update_server_url, '/') - + 1 - ); - $name = explode('.xml', $name)[0]; + $this->componentData->update_server_url, + strrpos($this->componentData->update_server_url, '/') + + 1 + ); + $name = explode('.xml', $name)[0]; $target = array('admin' => $name); $this->buildDynamique($target, 'update_server'); $this->fileContentDynamic[$name][$this->hhh @@ -1685,7 +1685,8 @@ class Interpretation extends Fields $exel[] = $this->_t(2) . "));"; $exel[] = PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Add some data"; - $exel[] = $this->_t(2) . "if ((\$size = self::checkArray(\$rows)) !== false)"; + $exel[] = $this->_t(2) + . "if ((\$size = self::checkArray(\$rows)) !== false)"; $exel[] = $this->_t(2) . "{"; $exel[] = $this->_t(3) . "\$i = 1;"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1702,7 +1703,8 @@ class Interpretation extends Fields $exel[] = $this->_t(3) . "}"; $exel[] = PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set active sheet and get it."; - $exel[] = $this->_t(3) . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; + $exel[] = $this->_t(3) + . "\$active_sheet = \$spreadsheet->setActiveSheetIndex(0);"; $exel[] = $this->_t(3) . "foreach (\$rows as \$array)"; $exel[] = $this->_t(3) . "{"; $exel[] = $this->_t(4) . "\$a = 'A';"; @@ -1712,7 +1714,7 @@ class Interpretation extends Fields . "\$active_sheet->setCellValue(\$a.\$i, \$value);"; $exel[] = $this->_t(5) . "if (\$xls_mode != 3)"; $exel[] = $this->_t(5) . "{"; - $exel[] = $this->_t(6) . "if (\$i == 1)"; + $exel[] = $this->_t(6) . "if (\$i == 1)"; $exel[] = $this->_t(6) . "{"; $exel[] = $this->_t(7) . "\$active_sheet->getColumnDimension(\$a)->setAutoSize(true);"; @@ -1878,30 +1880,37 @@ class Interpretation extends Fields $method[] = PHP_EOL . PHP_EOL . $this->_t(1) . "/**"; $method[] = $this->_t(1) . " * Greate user and update given table"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; + $method[] = $this->_t(1) + . " * @param array \$credentials Array('name' => string, 'username' => string, 'email' => string, 'password' => string, 'password2' => string)"; $method[] = $this->_t(1) . " * @param int \$autologin"; - $method[] = $this->_t(1) . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; - $method[] = $this->_t(1) . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; + $method[] = $this->_t(1) + . " * @param array \$params Array('useractivation' => int, 'sendpassword' => int, 'allowUserRegistration' => int)"; + $method[] = $this->_t(1) + . " * @param array \$mode 1 = Site Registrations; 0 = Admin Registration; 2 = Custom Helper Method Called registerUser"; $method[] = $this->_t(1) . " *"; - $method[] = $this->_t(1) . " * @return int|Error User ID on success, or an error."; + $method[] = $this->_t(1) + . " * @return int|Error User ID on success, or an error."; $method[] = $this->_t(1) . " */"; $method[] = $this->_t(1) . "public static function createUser(\$credentials, \$autologin = 0,"; $method[] = $this->_t(2) . "\$params = array("; - $method[] = $this->_t(3) . "'useractivation' => 0, 'sendpassword' => 1"; + $method[] = $this->_t(3) + . "'useractivation' => 0, 'sendpassword' => 1"; $method[] = $this->_t(2) . "), \$mode = 1"; $method[] = $this->_t(1) . ")"; $method[] = $this->_t(1) . "{"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Override mode"; - $method[] = $this->_t(2) . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; + $method[] = $this->_t(2) + . "if (\$mode == 2 && method_exists(__CLASS__, 'registerUser'))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Update params"; $method[] = $this->_t(3) . "\$params['autologin'] = \$autologin;"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Now Register User"; - $method[] = $this->_t(3) . "return self::registerUser(\$credentials, \$params);"; + $method[] = $this->_t(3) + . "return self::registerUser(\$credentials, \$params);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "elseif (\$mode == 2)"; $method[] = $this->_t(2) . "{"; @@ -1921,7 +1930,9 @@ class Interpretation extends Fields . "\$lang->load(\$extension, \$base_dir, \$language_tag, \$reload);"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the correct user model."; - $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site Registrations"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) @@ -1942,14 +1953,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (self::checkArray(\$params))"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) - . " Make changes to user config"; + . " Make changes to user config"; $method[] = $this->_t(3) . "foreach (\$params as \$param => \$set)"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; + . "\$params[\$param] = self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1963,25 +1974,31 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Lineup new user data array"; $method[] = $this->_t(2) . "\$data = array("; - $method[] = $this->_t(3) . "'username' => \$credentials['username'],"; + $method[] = $this->_t(3) + . "'username' => \$credentials['username'],"; $method[] = $this->_t(3) . "'name' => \$credentials['name'],"; $method[] = $this->_t(3) . "'block' => 0 );"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Added details based on mode"; - $method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email1'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['email1'] = \$credentials['email'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "\$data['email'] = \$credentials['email'];"; - $method[] = $this->_t(3) . "\$data['registerDate'] = JFactory::getDate()->toSql();"; + $method[] = $this->_t(3) + . "\$data['email'] = \$credentials['email'];"; + $method[] = $this->_t(3) + . "\$data['registerDate'] = JFactory::getDate()->toSql();"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) - . " Check if password was set"; + . " Check if password was set"; $method[] = $this->_t(2) . "if (\$mode == 1 && (!isset(\$credentials['password']) || !isset(\$credentials['password2']) || !self::checkString(\$credentials['password']) || !self::checkString(\$credentials['password2'])))"; $method[] = $this->_t(2) . "{"; @@ -1989,8 +2006,10 @@ class Interpretation extends Fields . " Set random password when empty password was submitted,"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " when using the 1 = site-registration mode"; - $method[] = $this->_t(3) . "\$credentials['password'] = self::randomkey(8);"; - $method[] = $this->_t(3) . "\$credentials['password2'] = \$credentials['password'];"; + $method[] = $this->_t(3) + . "\$credentials['password'] = self::randomkey(8);"; + $method[] = $this->_t(3) + . "\$credentials['password2'] = \$credentials['password'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -1998,17 +2017,22 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "if (isset(\$credentials['password']) && isset(\$credentials['password2']) && self::checkString(\$credentials['password']) && self::checkString(\$credentials['password2']))"; $method[] = $this->_t(2) . "{"; - $method[] = $this->_t(3) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(3) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password1'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password1'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(3) . "else //" . $this->setLine(__LINE__) . " 0 = Admin-registration mode"; $method[] = $this->_t(3) . "{"; - $method[] = $this->_t(4) . "\$data['password'] = \$credentials['password'];"; + $method[] = $this->_t(4) + . "\$data['password'] = \$credentials['password'];"; $method[] = $this->_t(3) . "}"; - $method[] = $this->_t(3) . "\$data['password2'] = \$credentials['password2'];"; + $method[] = $this->_t(3) + . "\$data['password2'] = \$credentials['password2'];"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the group/s value if set, only for Admin Registration (\$mode == 0)"; @@ -2020,7 +2044,9 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) . " Create the new user"; - $method[] = $this->_t(2) . "if (\$mode == 1) //". $this->setLine(__LINE__) + $method[] = $this->_t(2) . "if (\$mode == 1) //" . $this->setLine( + __LINE__ + ) . " 1 = Site-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$userId = \$model->register(\$data);"; @@ -2029,7 +2055,8 @@ class Interpretation extends Fields . " 0 = Admin-registration mode"; $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "\$model->save(\$data);"; - $method[] = $this->_t(3) . "\$userId = \$model->getState('user.id', 0);"; + $method[] = $this->_t(3) + . "\$userId = \$model->getState('user.id', 0);"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2044,7 +2071,7 @@ class Interpretation extends Fields $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " If you know of a better path, let me know"; $method[] = $this->_t(4) - ."self::setParams(\$extension, \$param, \$set);"; + . "self::setParams(\$extension, \$param, \$set);"; $method[] = $this->_t(3) . "}"; $method[] = $this->_t(2) . "}"; $method[] = $this->_t(2) . "//" . $this->setLine(__LINE__) @@ -2053,12 +2080,14 @@ class Interpretation extends Fields $method[] = $this->_t(2) . "{"; $method[] = $this->_t(3) . "//" . $this->setLine(__LINE__) . " Auto Login if Needed"; - $method[] = $this->_t(3) . "if (\$autologin && isset(\$credentials['password']))"; + $method[] = $this->_t(3) + . "if (\$autologin && isset(\$credentials['password']))"; $method[] = $this->_t(3) . "{"; $method[] = $this->_t(4) . "//" . $this->setLine(__LINE__) . " Try to login"; $method[] = $this->_t(4) . "try{"; - $method[] = $this->_t(5) . "JFactory::getApplication()->login(\$credentials);"; + $method[] = $this->_t(5) + . "JFactory::getApplication()->login(\$credentials);"; $method[] = $this->_t(4) . "} catch (Exception \$exception){"; $method[] = $this->_t(5) . "//" . $this->setLine(__LINE__) . " Do noting for now, may want to set redirect."; @@ -5078,19 +5107,21 @@ class Interpretation extends Fields as $order_field ) { - if ($order_first && ($order_field_name = $this->getFieldDatabaseName( + if ($order_first + && ($order_field_name = $this->getFieldDatabaseName( $viewName_list, $order_field['field'] )) !== false) { // just the first field is based on state $order_first = false; - $script .= PHP_EOL . $this->_t(2) . "//" . $this->setLine( + $script .= PHP_EOL . $this->_t(2) . "//" + . $this->setLine( __LINE__ ) . " Add the list ordering clause."; - $script .= PHP_EOL . $this->_t(2) + $script .= PHP_EOL . $this->_t(2) . "\$this->listOrder = \$this->escape(\$this->state->get('list.ordering', '" . $order_field_name . "'));"; - $script .= PHP_EOL . $this->_t(2) + $script .= PHP_EOL . $this->_t(2) . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', '" . $order_field['direction'] . "'));"; } @@ -5107,6 +5138,7 @@ class Interpretation extends Fields $script .= PHP_EOL . $this->_t(2) . "\$this->listDirn = \$this->escape(\$this->state->get('list.direction', 'asc'));"; } + return $script; } @@ -5670,7 +5702,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" . $keyLang + . strtolower($custom_button['method']) . "', '', '" + . $keyLang . "', false);"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) . "}"; } @@ -5705,7 +5738,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', false);"; $this->onlyFunctionButton[$viewsName][] = $this->_t( 1 @@ -5726,7 +5760,8 @@ class Interpretation extends Fields . "JToolBarHelper::custom('" . $viewsName . "." . $custom_button['method'] . "', '" . $custom_button['icomoon'] . " custom-button-" - . strtolower($custom_button['method']) . "', '', '" + . strtolower($custom_button['method']) + . "', '', '" . $keyLang . "', '" . $validateSelection . "');"; $buttons[] = $this->_t(1) . $tab . $this->_t(1) @@ -5812,9 +5847,11 @@ class Interpretation extends Fields if (ComponentbuilderHelper::checkArray($buttons)) { // just to check if the submission script is manually added - if (!isset($view['settings']->php_document) || - strpos(implode(' ', $view['settings']->php_document), - '/submitbutton.js') === false) + if (!isset($view['settings']->php_document) + || strpos( + implode(' ', $view['settings']->php_document), + '/submitbutton.js' + ) === false) { // set the custom get form method JAVASCRIPT_FOR_BUTTONS $this->fileContentDynamic[$view['settings']->code][$this->hhh @@ -6956,7 +6993,8 @@ class Interpretation extends Fields // add pagination start if (!$has_pagination_start) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd]; } if (!$has_limitbox && !$has_pagescounter) @@ -6977,14 +7015,28 @@ class Interpretation extends Fields // add pagination end if (!$has_pagination_end) { - $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]; + $body[] = $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd]; } // lets clear the placeholders just in case - unset($this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESCOUNTER' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONSTART' . $this->ddd]); - unset($this->placeholders[$this->bbb . 'PAGINATIONEND' . $this->ddd]); + unset( + $this->placeholders[$this->bbb . 'LIMITBOX' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESCOUNTER' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGESLINKS' . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONSTART' + . $this->ddd] + ); + unset( + $this->placeholders[$this->bbb . 'PAGINATIONEND' + . $this->ddd] + ); // insure the form is added (only if no form exist) if (strpos($view['settings']->default, 'catCodeBuilder[$viewName_single]['view']; + // return the authority to category return $user . "->authorise('core.edit', 'com_" . $this->componentCodeName . "." . $otherView @@ -12866,7 +12921,8 @@ class Interpretation extends Fields else { // set permissions. - $publishingPerOR[] = "\$this->canDo->get('" . $core_permission + $publishingPerOR[] = "\$this->canDo->get('" + . $core_permission . "')"; } } @@ -12891,7 +12947,8 @@ class Interpretation extends Fields else { // set permissions. - $publishingPerAND[] = "\$this->canDo->get('" . $core_permission + $publishingPerAND[] = "\$this->canDo->get('" + . $core_permission . "')"; } } @@ -13519,7 +13576,7 @@ class Interpretation extends Fields } } $data_value = (3 == $this->footableVersion) ? 'data-sort-value' - : 'data-value'; + : 'data-value'; // add the defaults if (!isset($this->fieldsNames[$viewName_single]['published'])) @@ -13807,13 +13864,16 @@ class Interpretation extends Fields // add the defaults if (!isset($this->fieldsNames[$viewName_single]['id'])) { - $data_type = (2 == $this->footableVersion) ? 'data-type="numeric"' + $data_type = (2 == $this->footableVersion) + ? 'data-type="numeric"' : 'data-type="number"'; - $head .= PHP_EOL . $this->_t(2) . '_t(2) . ''; - $head .= PHP_EOL . $this->_t(3) . "_t(3) . ""; - $head .= PHP_EOL . $this->_t(2) . ""; + $head .= PHP_EOL . $this->_t(2) . ""; } $head .= PHP_EOL . $this->_t(1) . ""; $head .= PHP_EOL . ""; @@ -14032,8 +14092,8 @@ class Interpretation extends Fields { if (($order_field_name = $this->getFieldDatabaseName( $viewName_list, $order_field['field'] - // We Removed This 'listJoinBuilder' as targetArea - // we will keep an eye on this + // We Removed This 'listJoinBuilder' as targetArea + // we will keep an eye on this )) !== false) { // default ordering is by publish and ordering @@ -14043,7 +14103,8 @@ class Interpretation extends Fields ) . " Order the results by ordering"; $query .= PHP_EOL . $this->_t(2) . "\$query->order('" - . $order_field_name . " " . $order_field['direction'] . "');"; + . $order_field_name . " " . $order_field['direction'] + . "');"; } } } @@ -14500,7 +14561,8 @@ class Interpretation extends Fields . " setup the query"; $query .= PHP_EOL . $this->_t(2) . "if ((\$pks_size = " . $this->fileContentStatic[$this->hhh . 'Component' - . $this->hhh] . "Helper::checkArray(\$pks)) !== false || 'bulk' === \$pks)"; + . $this->hhh] + . "Helper::checkArray(\$pks)) !== false || 'bulk' === \$pks)"; $query .= PHP_EOL . $this->_t(2) . "{"; $query .= PHP_EOL . $this->_t(3) . "//" . $this->setLine(__LINE__) . " Set a value to know this is " . $config['type'] @@ -15241,13 +15303,14 @@ class Interpretation extends Fields * @return string * */ - protected function getFieldDatabaseName($viewName_list, int $fieldId, $targetArea = 'listBuilder') - { + protected function getFieldDatabaseName($viewName_list, int $fieldId, + $targetArea = 'listBuilder' + ) { if (isset($this->{$targetArea}[$viewName_list])) { if ($fieldId < 0) { - switch($fieldId) + switch ($fieldId) { case -1: return 'a.id'; @@ -15281,6 +15344,7 @@ class Interpretation extends Fields } } } + return false; } @@ -16932,7 +16996,8 @@ class Interpretation extends Fields $fix .= PHP_EOL . $this->_t(1) . "{"; $fix .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " check if the not_required field is set"; - $fix .= PHP_EOL . $this->_t(2) . "if (isset(\$data['not_required']) && " . $Component + $fix .= PHP_EOL . $this->_t(2) + . "if (isset(\$data['not_required']) && " . $Component . "Helper::checkString(\$data['not_required']))"; $fix .= PHP_EOL . $this->_t(2) . "{"; $fix .= PHP_EOL . $this->_t(3) @@ -20939,7 +21004,7 @@ class Interpretation extends Fields { // set the defaults $headers = array(); - switch($context) + switch ($context) { case 'admin.view.model': case 'site.admin.view.model': @@ -20957,6 +21022,7 @@ class Interpretation extends Fields array(&$this->componentContext, &$context, &$viewName, &$headers) ); + // return the headers return implode(PHP_EOL, $headers); } @@ -21317,8 +21383,10 @@ class Interpretation extends Fields if (!in_array($otherViews, $catArray)) { // set the extension key string, new convention (more stable) - $_key_extension = str_replace('.', '_po0O0oq_', - $this->categoryBuilder[$name_list]['extension']); + $_key_extension = str_replace( + '.', '_po0O0oq_', + $this->categoryBuilder[$name_list]['extension'] + ); // add to lang $langKey = $this->langPrefix . '_DASHBOARD_' @@ -21352,7 +21420,8 @@ class Interpretation extends Fields else { $icons .= ", '" . $type . $otherViews . "." - . $catCode . '_qpo0O0oqp_' . $_key_extension . "'"; + . $catCode . '_qpo0O0oqp_' . $_key_extension + . "'"; } $counter++; // make sure we add a category only once @@ -26378,10 +26447,26 @@ function vdm_dkim() { return $_helper . PHP_EOL . $code . PHP_EOL; } - public function getModDefault(&$module) + public function getModDefault(&$module, &$key) { - return PHP_EOL . $module->default_header . PHP_EOL . '?>' . PHP_EOL - . $module->default . PHP_EOL; + // first add the header + $default = PHP_EOL . $module->default_header . PHP_EOL . '?>'; + // add any css from the fields + $default .= $this->getCustomScriptBuilder( + 'css_view', $key, PHP_EOL . '' . PHP_EOL + ); + // now add the body + $default .= PHP_EOL . $module->default . PHP_EOL; + // add any JavaScript from the fields + $default .= $this->getCustomScriptBuilder( + 'view_footer', $key, + PHP_EOL . '' . PHP_EOL + ); + + // return the default content for the model default area + return $default; } public function getModHelperCode(&$module) @@ -26744,10 +26829,12 @@ function vdm_dkim() { if ($module->target == 2) { $xml .= PHP_EOL . $this->_t(2) - . 'addrulepath="/administrator/modules/' . $module->file_name + . 'addrulepath="/administrator/modules/' + . $module->file_name . '/rules"'; $xml .= PHP_EOL . $this->_t(2) - . 'addfieldpath="/administrator/modules/' . $module->file_name + . 'addfieldpath="/administrator/modules/' + . $module->file_name . '/fields"'; } else diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index c2afe4063..4f44aed65 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -2076,7 +2076,7 @@ class Infusion extends Interpretation // MODDEFAULT $this->fileContentDynamic[$module->key][$this->hhh . 'MODDEFAULT' . $this->hhh] - = $this->getModDefault($module); + = $this->getModDefault($module, $module->key); // only add install script if needed if ($module->add_install_script) { diff --git a/componentbuilder.xml b/componentbuilder.xml index b9a632a5e..70fcc691f 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 29th October, 2020 + 6th November, 2020 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://www.joomlacomponentbuilder.com -- 2.40.1 From e7104d9c1c1ad9f594f02fa7bae8ce5ee082f263 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Sat, 14 Nov 2020 07:03:48 +0200 Subject: [PATCH 02/25] Added the new field changes for the new filter implementation. gh-378 --- README.md | 6 +++--- admin/README.txt | 6 +++--- admin/helpers/compiler/a_Get.php | 1 - admin/helpers/compiler/e_Interpretation.php | 4 ++-- .../en-GB/en-GB.com_componentbuilder.ini | 11 +++++++++- admin/models/forms/admin_fields.xml | 20 +++++++++++++------ admin/models/forms/component_admin_views.xml | 19 ++++++++++++++++-- admin/sql/install.mysql.utf8.sql | 2 +- admin/views/admin_fields/tmpl/edit.php | 19 ++++++++++++++++-- admin/views/admin_fields/view.html.php | 2 ++ componentbuilder.xml | 2 +- 11 files changed, 70 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 76c3fa154..125b619a0 100644 --- a/README.md +++ b/README.md @@ -144,12 +144,12 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 6th November, 2020 ++ *Last Build*: 14th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **283847** -+ *Field count*: **1536** ++ *Line count*: **283896** ++ *Field count*: **1537** + *File count*: **1799** + *Folder count*: **304** diff --git a/admin/README.txt b/admin/README.txt index 76c3fa154..125b619a0 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -144,12 +144,12 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 6th November, 2020 ++ *Last Build*: 14th November, 2020 + *Version*: 2.11.7 + *Copyright*: Copyright (C) 2015 - 2020 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **283847** -+ *Field count*: **1536** ++ *Line count*: **283896** ++ *Field count*: **1537** + *File count*: **1799** + *Folder count*: **304** diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index 17ae26cbe..58c55d00a 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -6420,7 +6420,6 @@ class Get } } } - return false; } diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 3da1fbf5d..e1fb7fb79 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -26453,14 +26453,14 @@ function vdm_dkim() { $default = PHP_EOL . $module->default_header . PHP_EOL . '?>'; // add any css from the fields $default .= $this->getCustomScriptBuilder( - 'css_view', $key, PHP_EOL . '' . PHP_EOL ); // now add the body $default .= PHP_EOL . $module->default . PHP_EOL; // add any JavaScript from the fields $default .= $this->getCustomScriptBuilder( - 'view_footer', $key, + 'views_footer', $key, PHP_EOL . '' . PHP_EOL ); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 94e03abf5..c6a7fc1f5 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -313,7 +313,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD="Field" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELDS="Fields" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_DESCRIPTION="Select a field" COM_COMPONENTBUILDER_ADMIN_FIELDS_FIELD_LABEL="Field" -COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_DESCRIPTION="Select if the field is to be used as a filter in list view, if shown." +COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_DESCRIPTION="Should this field be used as a filter in list view, if shown." COM_COMPONENTBUILDER_ADMIN_FIELDS_FILTER_LABEL="Filter" COM_COMPONENTBUILDER_ADMIN_FIELDS_FULL_WIDTH_IN_TAB="Full Width in Tab" COM_COMPONENTBUILDER_ADMIN_FIELDS_ID="Id" @@ -328,6 +328,7 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_BY_LABEL="Modified By" COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_DATE_DESC="The date this Admin Fields was modified." COM_COMPONENTBUILDER_ADMIN_FIELDS_MODIFIED_DATE_LABEL="Modified Date" COM_COMPONENTBUILDER_ADMIN_FIELDS_NEW="A New Admin Fields" +COM_COMPONENTBUILDER_ADMIN_FIELDS_NO="No" COM_COMPONENTBUILDER_ADMIN_FIELDS_NONE_DB="None DB" COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_DESCRIPTION="id, asset_id, state, access, ordering, created_by, created, modified_by, modified, checked_out, checked_out_time, version, hits, metakey, metadesc, metadata (you don't need to add them again)
For more help please watch this tutorial." COM_COMPONENTBUILDER_ADMIN_FIELDS_NOTE_ON_VIEWS_LABEL="The following fields are added by default to all views." @@ -409,6 +410,8 @@ COM_COMPONENTBUILDER_ADMIN_FIELDS_UNDERNEATH_TABS="Underneath Tabs" COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_DESC="A count of the number of times this Admin Fields has been revised." COM_COMPONENTBUILDER_ADMIN_FIELDS_VERSION_LABEL="Version" COM_COMPONENTBUILDER_ADMIN_FIELDS_VIEW="View" +COM_COMPONENTBUILDER_ADMIN_FIELDS_YES_MULTI="Yes (multi)" +COM_COMPONENTBUILDER_ADMIN_FIELDS_YES_SINGLE="Yes (single)" COM_COMPONENTBUILDER_ADMIN_VIEW="Admin View" COM_COMPONENTBUILDER_ADMIN_VIEWS="Admin Views" COM_COMPONENTBUILDER_ADMIN_VIEWS_ACCESS="Admin Views Access" @@ -2277,6 +2280,7 @@ COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNFEATURED_1="%s Component Updat COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED="%s Components Updates unpublished." COM_COMPONENTBUILDER_COMPONENTS_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Component Updates unpublished." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS="Component Admin Views" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ABOVE_NEW="Above (new)" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_DESCRIPTION="Select if this view
should use access." COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ACCESS_LABEL="Add Access" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_ADD="Add" @@ -2382,6 +2386,8 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_MINUS="File Minus" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_REMOVE="File Remove" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILE_TWO="File 2" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER="Filter" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_DESCRIPTION="Select the type of filter to use in this list view." +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FILTER_LABEL="Filter Type" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FIRST="First" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FLAG="Flag" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_FLAG_THREE="Flag 3" @@ -2499,6 +2505,7 @@ COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHARE="Share" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHARE_ALT="Share Alt" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHIELD="Shield" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SHUFFLE="Shuffle" +COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIDE_OLD="Side (old)" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SIGNUP="Signup" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SMILEY="Smiley" COM_COMPONENTBUILDER_COMPONENT_ADMIN_VIEWS_SMILEY_NEUTRAL="Smiley Neutral" @@ -9057,6 +9064,7 @@ COM_COMPONENTBUILDER_THE_ADMIN_FIELDS="The admin fields" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_CONDITIONS="The admin fields conditions" COM_COMPONENTBUILDER_THE_ADMIN_FIELDS_RELATIONS="The admin fields relations" COM_COMPONENTBUILDER_THE_AVAILABLE_VALIDATION_RULES_FOR_THE_VALIDATE_ATTRIBUTE_ARE="The available validation rules for the validate attribute are:" +COM_COMPONENTBUILDER_THE_BMULTI_FILTERB_SELECTION_OPTION_ALLOWS_THE_USER_TO_SELECT_MORE_THEN_ONE_VALUE_IN_THIS_FILTERFIELD_PLEASE_NOTE_THAT_THIS_OPTION_BONLY_WORKSB_WITH_THE_BNEWB_FILTERS_THAT_LOAD_ABOVE_THE_ADMIN_LIST_VIEW_YOU_CAN_SELECT_THE_NEW_FILTER_OPTION_WHENWHERE_YOU_ADD_THE_VIEW_TO_THE_COMPONENT="The multi filter selection option allows the user to select more then one value in this filter/field. Please note that this option only works with the new filters that load above the admin list view. You can select the new filter option when/where you add the view to the component." COM_COMPONENTBUILDER_THE_BNONE_DBB_OPTION_WILL_REMOVE_THIS_FIELD_FROM_BEING_SAVED_IN_THE_DATABASE="The None DB option will remove this field from being saved in the database." COM_COMPONENTBUILDER_THE_BONLY_IN_ADMIN_LIST_VIEWB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_ADMIN_LIST_VIEW_NOT_TO_ANY_LINKED_VIEWS="The Only in Admin List View option will only Add this field to the admin list view, not to any linked views." COM_COMPONENTBUILDER_THE_BONLY_IN_LINKED_LIST_VIEWSB_OPTION_WILL_ONLY_ADD_THIS_FIELD_TO_THE_LINKED_LIST_VIEW_IF_THIS_VIEW_GETS_LINKED_TO_OTHER_VIEW_NOT_TO_THIS_ADMIN_LIST_VIEW="The Only in Linked List Views option will only Add this field to the linked list view, if this view gets linked to other view, not to this admin list view." @@ -9066,6 +9074,7 @@ COM_COMPONENTBUILDER_THE_BSB_FILE_COULD_NOT_BE_MOVED_TO_BSB_SERVER="The %s - + + class="fieldSmall" + multiple="false" + default="" + onchange="explainFilterBehaviour(this)"> + + + + +