From 88dbcee38069cb8483acaea4735f95c3f00f7eb4 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 2 May 2018 00:17:38 +0200 Subject: [PATCH 1/9] Added the community JCB package import option. Improved the jsonToString method to be more dynamic --- README.md | 4 +- admin/README.txt | 4 +- admin/compiler/joomla_3/Helper.php | 4 +- admin/compiler/joomla_3/Helper_site.php | 4 +- admin/controllers/ajax.json.php | 39 +++ admin/helpers/compiler/e_Interpretation.php | 2 +- admin/helpers/componentbuilder.php | 148 ++++++++- .../en-GB/en-GB.com_componentbuilder.ini | 7 +- admin/models/ajax.php | 23 ++ admin/models/import_joomla_components.php | 4 +- .../import_joomla_components/tmpl/default.php | 306 ++++++++++++------ .../import_joomla_components/view.html.php | 135 +++++++- componentbuilder.xml | 2 +- site/helpers/componentbuilder.php | 148 ++++++++- .../en-GB/en-GB.com_componentbuilder.ini | 9 + 15 files changed, 702 insertions(+), 137 deletions(-) diff --git a/README.md b/README.md index 1a69e03c2..76b3e8081 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 30th April, 2018 ++ *Last Build*: 1st May, 2018 + *Version*: 2.7.6 + *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*: **193305** ++ *Line count*: **193870** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 1a69e03c2..76b3e8081 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 30th April, 2018 ++ *Last Build*: 1st May, 2018 + *Version*: 2.7.6 + *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*: **193305** ++ *Line count*: **193870** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/compiler/joomla_3/Helper.php b/admin/compiler/joomla_3/Helper.php index 2d4f3b4cc..1f89e00d1 100644 --- a/admin/compiler/joomla_3/Helper.php +++ b/admin/compiler/joomla_3/Helper.php @@ -225,7 +225,7 @@ abstract class ###Component###Helper return false; } - public static function jsonToString($value, $sperator = ", ", $table = null) + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { // check if string is JSON $result = json_decode($value, true); @@ -239,7 +239,7 @@ abstract class ###Component###Helper $names = array(); foreach ($result as $val) { - if ($name = self::getVar($table, $val, 'id', 'name')) + if ($name = self::getVar($table, $val, $id, $name)) { $names[] = $name; } diff --git a/admin/compiler/joomla_3/Helper_site.php b/admin/compiler/joomla_3/Helper_site.php index ffdd00168..05cd0d8a8 100644 --- a/admin/compiler/joomla_3/Helper_site.php +++ b/admin/compiler/joomla_3/Helper_site.php @@ -35,7 +35,7 @@ defined('_JEXEC') or die('Restricted access'); abstract class ###Component###Helper {###SITE_GLOBAL_EVENT_HELPER### ###SITE_CUSTOM_HELPER_SCRIPT### ###BOTH_CUSTOM_HELPER_SCRIPT### - public static function jsonToString($value, $sperator = ", ", $table = null) + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { // check if string is JSON $result = json_decode($value, true); @@ -49,7 +49,7 @@ abstract class ###Component###Helper $names = array(); foreach ($result as $val) { - if ($name = self::getVar($table, $val, 'id', 'name')) + if ($name = self::getVar($table, $val, $id, $name)) { $names[] = $name; } diff --git a/admin/controllers/ajax.json.php b/admin/controllers/ajax.json.php index 67743dac7..179c4db57 100644 --- a/admin/controllers/ajax.json.php +++ b/admin/controllers/ajax.json.php @@ -46,6 +46,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy $this->registerTask('isRead', 'ajax'); $this->registerTask('getComponentDetails', 'ajax'); $this->registerTask('getCronPath', 'ajax'); + $this->registerTask('getJCBpackageInfo', 'ajax'); $this->registerTask('tableColumns', 'ajax'); $this->registerTask('fieldSelectOptions', 'ajax'); $this->registerTask('getDynamicScripts', 'ajax'); @@ -235,6 +236,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy } } break; + case 'getJCBpackageInfo': + try + { + $returnRaw = $jinput->get('raw', false, 'BOOLEAN'); + $urlValue = $jinput->get('url', NULL, 'STRING'); + if($urlValue && $user->id != 0) + { + $result = $this->getModel('ajax')->getJCBpackageInfo($urlValue); + } + else + { + $result = false; + } + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback . "(".json_encode($result).");"; + } + elseif($returnRaw) + { + echo json_encode($result); + } + else + { + echo "(".json_encode($result).");"; + } + } + catch(Exception $e) + { + if($callback = $jinput->get('callback', null, 'CMD')) + { + echo $callback."(".json_encode($e).");"; + } + else + { + echo "(".json_encode($e).");"; + } + } + break; case 'tableColumns': try { diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 90dfc205b..056b9be47 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -11851,7 +11851,7 @@ class Interpretation extends Fields if (isset($item['custom']['table'])) { $keyTableNAme = str_replace('#__' . $this->fileContentStatic['###component###'] . '_', '', $item['custom']['table']); - $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\$item->" . $item['name'] . " = " . $Component . "Helper::jsonToString(\$item->" . $item['name'] . ", ', ', '" . $keyTableNAme . "');"; + $fix .= PHP_EOL . "\t" . $tab . "\t\t\t\$item->" . $item['name'] . " = " . $Component . "Helper::jsonToString(\$item->" . $item['name'] . ", ', ', '" . $keyTableNAme . "', '".$item['custom']['id']."', '".$item['custom']['text']."');"; } else { diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index fac68f0dd..a889c2355 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -68,10 +68,16 @@ abstract class ComponentbuilderHelper public static $snippetsPath = 'https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master'; /** - * The packages paths + * The VDM packages paths **/ - public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; - public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/"; + public static $vdmGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; + public static $vdmGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/"; + + /** + * The JCB packages paths + **/ + public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; + public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Community-Packages/raw/master/"; // not needed at this time (maybe latter) public static $accessToken = ""; @@ -2035,6 +2041,138 @@ abstract class ComponentbuilderHelper } return false; } + + /** + * get the JCB package owner details display + **/ + public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) + { + $ownerDetails = ''; + $ownerDetails .= ''; + + // provide some details to how the user can get a key + if (isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link'])) + { + $ownerDetails .= '
'; + $ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $info['getKeyFrom']['buy_link'], $owner, $owner); + } + // add more custom links + elseif (isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links'])) + { + $buttons = array(); + foreach ($info['getKeyFrom']['buy_links'] as $keyName => $link) + { + $buttons[] = JText::sprintf('COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $owner, $link, $owner, $keyName); + } + $ownerDetails .= '
'; + $ownerDetails .= implode('
', $buttons); + } + + // return the owner details + if (!isset($owner) && !$trust) + { + $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; + $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; + } + elseif (!isset($owner) && $trust) + { + $ownerDetails = ''; + } + return $ownerDetails; + } + + /** + * get the JCB package component details display + **/ + public static function getPackageComponentsDetailsDisplay(&$info) + { + if (isset($info['name']) && self::checkArray($info['name'])) + { + $cAmount = count((array) $info['name']); + $class2 = ($cAmount == 1) ? 'span12' : 'span6'; + $counter = 1; + $display = array(); + foreach ($info['name'] as $key => $value) + { + if ($cAmount > 1 && $counter == 3) + { + $display[] = ''; + $counter = 1; + } + if ($cAmount > 1 && $counter == 1) + { + $display[] = '
'; + } + $display[] = '
'; + $display[] = '

'; + $display[] = $info['short_description'][$key]; + $display[] = '

  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANY_NAMEEM_BSB', $info['companyname'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMAUTHOREM_BSB', $info['author'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $info['email'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $info['website'][$key]); + $display[] = '
'; + $display[] = '

'; + $display[] = $info['license'][$key]; + $display[] = '

'; + $display[] = $info['copyright'][$key]; + $display[] = '

'; + + $counter++; + } + // close the div if needed + if ($cAmount > 1) + { + $display[] = '
'; + } + return implode("\n",$display); + } + return '
'.JText::_('COM_COMPONENTBUILDER_COPYRIGHT').'
'; + } /** * prepare base64 string for url @@ -3985,7 +4123,7 @@ abstract class ComponentbuilderHelper return false; } - public static function jsonToString($value, $sperator = ", ", $table = null) + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { // check if string is JSON $result = json_decode($value, true); @@ -3999,7 +4137,7 @@ abstract class ComponentbuilderHelper $names = array(); foreach ($result as $val) { - if ($name = self::getVar($table, $val, 'id', 'name')) + if ($name = self::getVar($table, $val, $id, $name)) { $names[] = $name; } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index fe0910bfe..3a0ba728c 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -957,6 +957,7 @@ COM_COMPONENTBUILDER_CLEAR_TMP="Clear tmp" COM_COMPONENTBUILDER_CLONE="Clone" COM_COMPONENTBUILDER_CLONE_FAILED="Clone failed!" COM_COMPONENTBUILDER_CLOSE_NEW="Close & New" +COM_COMPONENTBUILDER_COMMUNITY_PACKAGES="Community Packages" COM_COMPONENTBUILDER_COMPANY="Company" COM_COMPONENTBUILDER_COMPANY_NAME="Company Name" COM_COMPONENTBUILDER_COMPANY_S="Company: %s" @@ -4184,8 +4185,8 @@ COM_COMPONENTBUILDER_HELP_MANAGER="Help" COM_COMPONENTBUILDER_HI="Hi" COM_COMPONENTBUILDER_HIDE="Hide" COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="

Curl Not Found!

Please setup curl on your system, or componentbuilder will not function correctly!

" +COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE="

Data is corrupt!

This could be due to key error, or broken package!" COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE="

Data is corrupt!

This could be due to broken package!" -COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_KEY_ERROR_OR_BROKEN_PACKAGE="

Data is corrupt!

This could be due to key error, or broken package!" COM_COMPONENTBUILDER_ICON="Icon" COM_COMPONENTBUILDER_IMPORT_CONTINUE="Continue" COM_COMPONENTBUILDER_IMPORT_DATA="Import Data" @@ -4247,7 +4248,9 @@ COM_COMPONENTBUILDER_ISSUE="issue" COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)" COM_COMPONENTBUILDER_IS_ONLY_FOUR_LISTRADIOCHECKBOXES="Is (only 4 list/radio/checkboxes)" COM_COMPONENTBUILDER_JCB_COMMUNITY="JCB Community" +COM_COMPONENTBUILDER_JCB_COMMUNITY_PACKAGES="JCB Community Packages" COM_COMPONENTBUILDER_JCB_COMMUNITY_SNIPPETS="JCB Community Snippets" +COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE="JCB Package info path does not work, we advice you not to continue with the import of the selected package!" COM_COMPONENTBUILDER_JOOMLA_COMPONENT="Joomla Component" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS="Joomla Components" COM_COMPONENTBUILDER_JOOMLA_COMPONENTS_ACCESS="Joomla Components Access" @@ -5437,6 +5440,7 @@ COM_COMPONENTBUILDER_OUT_OF_DATE="Out of Date" COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set" COM_COMPONENTBUILDER_OWNER_S="Owner: %s" COM_COMPONENTBUILDER_PACKAGE="Package" +COM_COMPONENTBUILDER_PACKAGES_FROM_JCB_COMMUNITY="Packages from JCB Community" COM_COMPONENTBUILDER_PACKAGES_FROM_VAST_DEVELOPMENT_METHOD="Packages from Vast Development Method" COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS="Package Owner Details" COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND="Package owner details not found!" @@ -6462,6 +6466,7 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!" COM_COMPONENTBUILDER_THERE_WAS_AN_ERROR_GETTING_THE_PACKAGE_INFO="There was an error getting the package info." COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!" +COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_GET_PACKAGE_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
Some of these packages would require a key, since they are not free." COM_COMPONENTBUILDER_THESE_ARE_THE_SAME_PACKAGES_FOUND_ON_A_S_GITHUBA_AND_CAN_BE_IMPORTED_BY_SIMPLY_MAKING_A_SELECTION_AND_THEN_CLICKING_THE_GET_PACKAGE_BUTTONBR_SOME_OF_THESE_PACKAGES_WOULD_REQUIRE_A_KEY_SINCE_THEY_ARE_NOT_FREE_A_S_GET_A_KEY_TODAYA="These are the same packages found on gitHub and can be imported by simply making a selection and then clicking the [Get Package] button.
Some of these packages would require a key, since they are not free. Get a key today!." COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_NOT_AVAILABLE_TO_THE_FIELD_IF_BNONE_DBB_OPTION_IS_SELECTED="These options are not available to the field if None DB option is selected." COM_COMPONENTBUILDER_THESE_OPTIONS_ARE_ONLY_AVAILABLE_TO_THE_FIELD_IF_BSHOW_IN_LIST_VIEWB_OPTION_IS_SELECTED="These options are only available to the field if Show in list view option is selected." diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 9e70b7092..46e3d887c 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -116,6 +116,29 @@ class ComponentbuilderModelAjax extends JModelList return false; } + /** + * get the JCB package info (html) + **/ + public function getJCBpackageInfo($url) + { + // convert URL + $url = str_replace('.zip', '.info', $url); + // check if url exist + if ($info = ComponentbuilderHelper::getFileContents($url, false)) + { + // Get the encryption object. + $opener = new FOFEncryptAes('V4stD3vel0pmEntMethOd@YoUrS3rv!s', 128); + $info = rtrim($opener->decryptString($info), "\0"); + // check if we have json + if (ComponentbuilderHelper::checkJson($info)) + { + $info = json_decode($info, true); + return array('owner' => ComponentbuilderHelper::getPackageOwnerDetailsDisplay($info, true), 'packages' => ComponentbuilderHelper::getPackageComponentsDetailsDisplay($info)); + } + } + return array('error' => JText::_('COM_COMPONENTBUILDER_JCB_PACKAGE_INFO_PATH_DOES_NOT_WORK_WE_ADVICE_YOU_BNOT_TO_CONTINUEB_WITH_THE_IMPORT_OF_THE_SELECTED_PACKAGE')); + } + /** * set the component display **/ diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index 48a2c4b07..67d0ba28a 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -97,7 +97,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy protected $isMultiple = array(); protected $specialValue = false; protected $checksum = null; - protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/'); + protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/'); protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation'); /** @@ -682,7 +682,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy $this->data = $data; return true; } - $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_KEY_ERROR_OR_BROKEN_PACKAGE'), 'error'); + $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BKEY_ERRORB_OR_BROKEN_PACKAGE'), 'error'); return false; } $this->app->enqueueMessage(JText::_('COM_COMPONENTBUILDER_HTWODATA_IS_CORRUPTHTWOTHIS_COULD_BE_DUE_TO_BROKEN_PACKAGE'), 'error'); diff --git a/admin/views/import_joomla_components/tmpl/default.php b/admin/views/import_joomla_components/tmpl/default.php index af8eb6dc5..c4421d0d3 100644 --- a/admin/views/import_joomla_components/tmpl/default.php +++ b/admin/views/import_joomla_components/tmpl/default.php @@ -110,6 +110,24 @@ JHtml::_('behavior.keepalive'); form.submit(); } }; + Joomla.submitbuttonJCB = function() + { + var form = document.getElementById('adminForm'); + // do field validation + if (form.jcb_package.value == "" || form.jcb_package.value == "http://") + { + alert(""); + } + else + { + // set the url + form.import_url.value = form.jcb_package.value; + jQuery('#loading').css('display', 'block'); + form.checksum.value = 'jcb'; + form.gettype.value = 'url'; + form.submit(); + } + }; @@ -190,97 +208,14 @@ jQuery(document).ready(function($) {
- ' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS') . ''; - $ownerDetails .= ''; - - // provide some details to how the user can get a key - if (isset($this->packageInfo['getKeyFrom']['buy_link']) && componentbuilderHelper::checkString($this->packageInfo['getKeyFrom']['buy_link'])) - { - $ownerDetails .= '
'; - $ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $this->packageInfo['getKeyFrom']['buy_link'], $owner, $owner); - } - // add more custom links - elseif (isset($this->packageInfo['getKeyFrom']['buy_links']) && componentbuilderHelper::checkArray($this->packageInfo['getKeyFrom']['buy_links'])) - { - $buttons = array(); - foreach ($this->packageInfo['getKeyFrom']['buy_links'] as $keyName => $link) - { - $buttons[] = JText::sprintf('COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $owner, $link, $owner, $keyName); - } - $ownerDetails .= '
'; - $ownerDetails .= implode('
', $buttons); - } - - // return the owner details - if (!isset($owner)) - { - $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; - $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; - } - echo $ownerDetails; - ?> + packageInfo); ?>
packageInfo['name']) && ComponentbuilderHelper::checkArray($this->packageInfo['name'])) : ?> - - packageInfo['name'] as $key => $value): ?> - 1 && $counter == 3) { echo ''; $counter = 1;} ?> - 1 && $counter == 1) { echo '
'; } ?> -
- -

packageInfo['short_description'][$key]; ?>

-
    -
  • packageInfo['companyname'][$key]); ?>
  • -
  • packageInfo['author'][$key]); ?>
  • -
  • packageInfo['email'][$key]); ?>
  • -
  • packageInfo['website'][$key]); ?>
  • -
- -

packageInfo['license'][$key]; ?>

- -

packageInfo['copyright'][$key]; ?>

-
- - + packageInfo); ?> @@ -338,25 +273,73 @@ jQuery(document).ready(function($) { - vdmPackages): ?> + vdmPackages && ComponentbuilderHelper::checkArray($this->vdmPackages)): ?> -
- +

- vdmPackages as $field): ?> -
-
label;?>
-
input;?>
+
+ + vdmPackages as $field): ?> +
+
label;?>
+
input;?>
+
+ +
+     +
+
+
+
+
+
- -
-     +
+ +
.
+ +

+
-
-
+
+ + + + jcbPackages && ComponentbuilderHelper::checkArray($this->jcbPackages)) : ?> + +
+
+

+

+
+
+ + jcbPackages as $field): ?> +
+
label;?>
+
input;?>
+
+ +
+     +
+
+
+
+
+
+
+
+ +
.
+
<<ewe>>yn
+

+
+
+
@@ -369,6 +352,105 @@ jQuery(document).ready(function($) { diff --git a/admin/views/import_joomla_components/view.html.php b/admin/views/import_joomla_components/view.html.php index dadb90135..437a74ef6 100644 --- a/admin/views/import_joomla_components/view.html.php +++ b/admin/views/import_joomla_components/view.html.php @@ -42,7 +42,6 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy protected $packageInfo; protected $formPackage; protected $vdmPackages = false; - protected $freePackages = array('JCB_demo.zip', 'JCB_helloWorld.zip'); public function display($tpl = null) { @@ -51,6 +50,8 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy // Include helper submenu ComponentbuilderHelper::addSubmenu('import'); } + // get component params + $this->params = JComponentHelper::getParams('com_componentbuilder'); $paths = new stdClass; $paths->first = ''; @@ -87,6 +88,7 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy // load the forms $this->formPackage = $this->_getForm($this->dataType); $this->vdmPackages = $this->_getForm('vdm_package'); + $this->jcbPackages = $this->_getForm('jcb_package'); } // Check for errors. @@ -95,10 +97,73 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy throw new Exception(implode("\n", $errors), 500); } + // set the document + $this->setDocument(); + // Display the template parent::display($tpl); } + /** + * Prepares the document + */ + protected function setDocument() + { + // always make sure jquery is loaded. + JHtml::_('jquery.framework'); + + // Add the JavaScript for JStore + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jquery.json.min.js'); + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/jstorage.min.js'); + $this->document->addScript(JURI::root() .'media/com_componentbuilder/js/strtotime.js'); + // add marked library + $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/custom/marked.js"); + // check if we should use browser storage + $setBrowserStorage = $this->params->get('set_browser_storage', null); + if ($setBrowserStorage) + { + // check what (Time To Live) show we use + $storageTimeToLive = $this->params->get('storage_time_to_live', 'global'); + if ('global' == $storageTimeToLive) + { + // use the global session time + $session = JFactory::getSession(); + // must have itin milliseconds + $expire = ($session->getExpire()*60)* 1000; + } + else + { + // use the Componentbuilder Global setting + if (0 != $storageTimeToLive) + { + // this will convert the time into milliseconds + $storageTimeToLive = $storageTimeToLive * 1000; + } + $expire = $storageTimeToLive; + } + } + else + { + // set to use no storage + $expire = 30000; // only 30 seconds + } + + // Set the Time To Live To JavaScript + $this->document->addScriptDeclaration("var expire = ". (int) $expire.";"); + $this->document->addScriptDeclaration("var all_is_good = '".JText::_('COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IS_NO_NOTICE_AT_THIS_TIME')."';"); + // add a token on the page for javascript + $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); + + // add the Uikit v2 style sheets + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + $this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); + + // add Uikit v2 JavaScripts + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); + } + public function _getForm($type) { $form = array(); @@ -243,9 +308,9 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy $form[] = $sleutle; } } - elseif ('vdm_package' === $type && $listObjects = ComponentbuilderHelper::getGithubRepoFileList('jcbGithubPackages', ComponentbuilderHelper::$jcbGithubPackagesUrl.ComponentbuilderHelper::$accessToken)) + elseif ('vdm_package' === $type && $vdmListObjects = ComponentbuilderHelper::getGithubRepoFileList('vdmGithubPackages', ComponentbuilderHelper::$vdmGithubPackagesUrl.ComponentbuilderHelper::$accessToken)) { - if (ComponentbuilderHelper::checkArray($listObjects)) + if (ComponentbuilderHelper::checkArray($vdmListObjects)) { // get the vdm_package list field $vdm_package = JFormHelper::loadFieldType('list',true); @@ -257,7 +322,8 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy 'name' => 'vdm_package', 'label' => 'COM_COMPONENTBUILDER_PACKAGE', 'class' => 'list_class', - 'description' => 'COM_COMPONENTBUILDER_SELECT_THE_PACKAGE_TO_IMPORT'); + 'description' => 'COM_COMPONENTBUILDER_SELECT_THE_PACKAGE_TO_IMPORT', + 'onchange' => "getJCBpackageInfo('vdm')"); // load the list $load = false; // load the vdm_package attributes @@ -266,11 +332,11 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy $vdm_packageOptions = array(); $vdm_packageOptions[''] = 'COM_COMPONENTBUILDER__SELECT_PACKAGE_'; // load vdm_package options from array - foreach($listObjects as $listObject) + foreach($vdmListObjects as $vdmListObject) { - if (strpos($listObject->path, '.zip') !== false) + if (strpos($vdmListObject->path, '.zip') !== false) { - $vdm_packageOptions[ComponentbuilderHelper::$jcbGithubPackageUrl.$listObject->path] = $this->setPackageName($listObject->path); + $vdm_packageOptions[ComponentbuilderHelper::$vdmGithubPackageUrl.$vdmListObject->path] = $this->setPackageName($vdmListObject->path); $load = true; } } @@ -286,22 +352,57 @@ class ComponentbuilderViewImport_joomla_components extends JViewLegacy } } } + elseif ('jcb_package' === $type && $jcbListObjects = ComponentbuilderHelper::getGithubRepoFileList('jcbGithubPackages', ComponentbuilderHelper::$jcbGithubPackagesUrl.ComponentbuilderHelper::$accessToken)) + { + if (ComponentbuilderHelper::checkArray($jcbListObjects)) + { + // get the jcb_package list field + $jcb_package = JFormHelper::loadFieldType('list',true); + // start jcb_package xml + $jcb_packageXML = new SimpleXMLElement(''); + // jcb_package attributes + $jcb_packageAttributes = array( + 'type' => 'list', + 'name' => 'jcb_package', + 'label' => 'COM_COMPONENTBUILDER_PACKAGE', + 'class' => 'list_class', + 'description' => 'COM_COMPONENTBUILDER_SELECT_THE_PACKAGE_TO_IMPORT', + 'onchange' => "getJCBpackageInfo('jcb')"); + // load the list + $load = false; + // load the jcb_package attributes + ComponentbuilderHelper::xmlAddAttributes($jcb_packageXML, $jcb_packageAttributes); + // start the jcb_package options + $jcb_packageOptions = array(); + $jcb_packageOptions[''] = 'COM_COMPONENTBUILDER__SELECT_PACKAGE_'; + // load jcb_package options from array + foreach($jcbListObjects as $jcbListObject) + { + if (strpos($jcbListObject->path, '.zip') !== false) + { + $jcb_packageOptions[ComponentbuilderHelper::$jcbGithubPackageUrl.$jcbListObject->path] = $this->setPackageName($jcbListObject->path); + $load = true; + } + } + // only load if at least one item was found + if ($load) + { + // load the jcb_package options + ComponentbuilderHelper::xmlAddOptions($jcb_packageXML, $jcb_packageOptions); + // setup the jcb_package radio field + $jcb_package->setup($jcb_packageXML,''); + // add to form + $form[] = $jcb_package; + } + } + } return $form; } public function setPackageName($name) { - // the free switch - if (in_array($name, $this->freePackages)) - { - $type = ' - free'; - } - else - { - $type = ' - paid'; - } // return the name - return ComponentbuilderHelper::safeString( preg_replace('/(? COM_COMPONENTBUILDER - 30th April, 2018 + 1st May, 2018 Llewellyn van der Merwe llewellyn@joomlacomponentbuilder.com http://joomlacomponentbuilder.com diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 85534fe73..53f5e1789 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -68,10 +68,16 @@ abstract class ComponentbuilderHelper public static $snippetsPath = 'https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master'; /** - * The packages paths + * The VDM packages paths **/ - public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; - public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/"; + public static $vdmGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Packages/git/trees/master"; + public static $vdmGithubPackageUrl = "https://github.com/vdm-io/JCB-Packages/raw/master/"; + + /** + * The JCB packages paths + **/ + public static $jcbGithubPackagesUrl = "https://api.github.com/repos/vdm-io/JCB-Community-Packages/git/trees/master"; + public static $jcbGithubPackageUrl = "https://github.com/vdm-io/JCB-Community-Packages/raw/master/"; // not needed at this time (maybe latter) public static $accessToken = ""; @@ -2035,6 +2041,138 @@ abstract class ComponentbuilderHelper } return false; } + + /** + * get the JCB package owner details display + **/ + public static function getPackageOwnerDetailsDisplay(&$info, $trust = false) + { + $ownerDetails = ''; + $ownerDetails .= '
    '; + if (isset($info['getKeyFrom']['company']) && self::checkString($info['getKeyFrom']['company'])) + { + $owner = $info['getKeyFrom']['company']; + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANYEM_BSB', $info['getKeyFrom']['company']) . '
  • '; + } + // add value only if set + if (isset($info['getKeyFrom']['owner']) && self::checkString($info['getKeyFrom']['owner'])) + { + if (!isset($owner)) + { + $owner = $info['getKeyFrom']['owner']; + } + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMOWNEREM_BSB', $info['getKeyFrom']['owner']) . '
  • '; + } + // add value only if set + if (isset($info['getKeyFrom']['website']) && self::checkString($info['getKeyFrom']['website'])) + { + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $info['getKeyFrom']['website']) . '
  • '; + } + // add value only if set + if (isset($info['getKeyFrom']['email']) && self::checkString($info['getKeyFrom']['email'])) + { + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $info['getKeyFrom']['email']) . '
  • '; + } + // add value only if set + if (isset($info['getKeyFrom']['license']) && self::checkString($info['getKeyFrom']['license'])) + { + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMLICENSEEM_BSB', $info['getKeyFrom']['license']) . '
  • '; + } + // add value only if set + if (isset($info['getKeyFrom']['copyright']) && self::checkString($info['getKeyFrom']['copyright'])) + { + $ownerDetails .= '
  • ' . JText::sprintf('COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB', $info['getKeyFrom']['copyright']) . '
  • '; + } + $ownerDetails .= '
'; + + // provide some details to how the user can get a key + if (isset($info['getKeyFrom']['buy_link']) && self::checkString($info['getKeyFrom']['buy_link'])) + { + $ownerDetails .= '
'; + $ownerDetails .= JText::sprintf('COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $info['getKeyFrom']['buy_link'], $owner, $owner); + } + // add more custom links + elseif (isset($info['getKeyFrom']['buy_links']) && self::checkArray($info['getKeyFrom']['buy_links'])) + { + $buttons = array(); + foreach ($info['getKeyFrom']['buy_links'] as $keyName => $link) + { + $buttons[] = JText::sprintf('COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA', $owner, $link, $owner, $keyName); + } + $ownerDetails .= '
'; + $ownerDetails .= implode('
', $buttons); + } + + // return the owner details + if (!isset($owner) && !$trust) + { + $ownerDetails = '

' . JText::_('COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND') . '

'; + $ownerDetails .= '

' . JText::_('COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE') . '

'; + } + elseif (!isset($owner) && $trust) + { + $ownerDetails = ''; + } + return $ownerDetails; + } + + /** + * get the JCB package component details display + **/ + public static function getPackageComponentsDetailsDisplay(&$info) + { + if (isset($info['name']) && self::checkArray($info['name'])) + { + $cAmount = count((array) $info['name']); + $class2 = ($cAmount == 1) ? 'span12' : 'span6'; + $counter = 1; + $display = array(); + foreach ($info['name'] as $key => $value) + { + if ($cAmount > 1 && $counter == 3) + { + $display[] = ''; + $counter = 1; + } + if ($cAmount > 1 && $counter == 1) + { + $display[] = '
'; + } + $display[] = '
'; + $display[] = '

'; + $display[] = $info['short_description'][$key]; + $display[] = '

  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMCOMPANY_NAMEEM_BSB', $info['companyname'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMAUTHOREM_BSB', $info['author'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMEMAILEM_BSB', $info['email'][$key]); + $display[] = '
  • '; + $display[] = JText::sprintf('COM_COMPONENTBUILDER_EMWEBSITEEM_BSB', $info['website'][$key]); + $display[] = '
'; + $display[] = '

'; + $display[] = $info['license'][$key]; + $display[] = '

'; + $display[] = $info['copyright'][$key]; + $display[] = '

'; + + $counter++; + } + // close the div if needed + if ($cAmount > 1) + { + $display[] = '
'; + } + return implode("\n",$display); + } + return '
'.JText::_('COM_COMPONENTBUILDER_COPYRIGHT').'
'; + } /** * prepare base64 string for url @@ -3363,7 +3501,7 @@ abstract class ComponentbuilderHelper } - public static function jsonToString($value, $sperator = ", ", $table = null) + public static function jsonToString($value, $sperator = ", ", $table = null, $id = 'id', $name = 'name') { // check if string is JSON $result = json_decode($value, true); @@ -3377,7 +3515,7 @@ abstract class ComponentbuilderHelper $names = array(); foreach ($result as $val) { - if ($name = self::getVar($table, $val, 'id', 'name')) + if ($name = self::getVar($table, $val, $id, $name)) { $names[] = $name; } diff --git a/site/language/en-GB/en-GB.com_componentbuilder.ini b/site/language/en-GB/en-GB.com_componentbuilder.ini index b55082f73..340f1f5d3 100644 --- a/site/language/en-GB/en-GB.com_componentbuilder.ini +++ b/site/language/en-GB/en-GB.com_componentbuilder.ini @@ -4,18 +4,24 @@ COM_COMPONENTBUILDER_API="Api" COM_COMPONENTBUILDER_API_DESC="Sync Portal API" COM_COMPONENTBUILDER_BACKUP_FAILED_PLEASE_TRY_AGAIN_IF_THE_ERROR_CONTINUE_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR="Backup failed, please try again. If the error continue, please contact your system administrator." COM_COMPONENTBUILDER_BACKUP_WAS_DONE_SUCCESSFULLY="Backup was done successfully" +COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!" +COM_COMPONENTBUILDER_BGET_THE_KEY_FROMB_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from %s" +COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM="%s component details" COM_COMPONENTBUILDER_CHECK_YOUR_OWNER_DETAILS_IT_HAS_NOT_BEEN_SET_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="Check your owner details, it has not been set. Open the JCB Global Options, go to the Company tab and add the correct company details there." COM_COMPONENTBUILDER_COMPANY_S="Company: %s" COM_COMPONENTBUILDER_COMPONENT_DID_NOT_COMPILE="Component did not compile!" COM_COMPONENTBUILDER_COMPONENT_IS_NOT_PUBLISHED_OR_IS_CHECKED_OUT="Component is not published, or is checked out!" COM_COMPONENTBUILDER_COMPONENT_WAS_NOT_FOUND="Component was not found!" +COM_COMPONENTBUILDER_COPYRIGHT="Copyright" COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s" COM_COMPONENTBUILDER_CREATE_NEW_S="Create New %s" COM_COMPONENTBUILDER_DESCRIPTION="Description" COM_COMPONENTBUILDER_EDIT_S="Edit %s" COM_COMPONENTBUILDER_EMAIL_S="Email: %s" COM_COMPONENTBUILDER_EMAIL_WITH_THE_NEW_KEY_WAS_SEND="Email with the new key was send" +COM_COMPONENTBUILDER_EMAUTHOREM_BSB="Author: %s" COM_COMPONENTBUILDER_EMCOMPANYEM_BSB="Company: %s" +COM_COMPONENTBUILDER_EMCOMPANY_NAMEEM_BSB="Company Name: %s" COM_COMPONENTBUILDER_EMCOPYRIGHTEM_BSB="Copyright: %s" COM_COMPONENTBUILDER_EMEMAILEM_BSB="Email: %s" COM_COMPONENTBUILDER_EMLICENSEEM_BSB="License: %s" @@ -25,9 +31,11 @@ COM_COMPONENTBUILDER_ERROR="Error!" COM_COMPONENTBUILDER_EXAMPLE="Example" COM_COMPONENTBUILDER_FILE="File" COM_COMPONENTBUILDER_FOLDER="Folder" +COM_COMPONENTBUILDER_GET_THE_KEY_FROM_BSB_FOR_A_CLASSBTN_BTNPRIMARY_HREFS_TARGET_BLANK_TITLEGET_A_KEY_FROM_SSA="Get the key from %s for %s" COM_COMPONENTBUILDER_HTWOCURL_NOT_FOUNDHTWOPPLEASE_SETUP_CURL_ON_YOUR_SYSTEM_OR_BCOMPONENTBUILDERB_WILL_NOT_FUNCTION_CORRECTLYP="

Curl Not Found!

Please setup curl on your system, or componentbuilder will not function correctly!

" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_BUILDER_BACKUP_KEY="Joomla Component Builder - Backup Key" COM_COMPONENTBUILDER_KEY_HAS_NOT_CHANGED="Key has not changed" +COM_COMPONENTBUILDER_LICENSE="License" COM_COMPONENTBUILDER_LICENSE_S="License: %s" COM_COMPONENTBUILDER_LINK="Link" COM_COMPONENTBUILDER_LOCAL="Local" @@ -38,6 +46,7 @@ COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COM COM_COMPONENTBUILDER_OWNER_DETAILS_WAS_SET="Owner details was set" COM_COMPONENTBUILDER_OWNER_S="Owner: %s" COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS="Package Owner Details" +COM_COMPONENTBUILDER_PACKAGE_OWNER_DETAILS_NOT_FOUND="Package owner details not found!" COM_COMPONENTBUILDER_PACKAGE_OWNER_NOT_SET="Package Owner Not Set" COM_COMPONENTBUILDER_PROPERTY="Property" COM_COMPONENTBUILDER_SBR_YOU_CAN_ADD_AN_BACCESS_TOKENB_TO_GETBIBLE_GLOBAL_OPTIONS_TO_MAKE_AUTHENTICATED_REQUESTS_AN_ACCESS_TOKEN_WITH_ONLY_PUBLIC_ACCESS_WILL_DO="%s
You can add an access token to getBible global options to make authenticated requests. An access token with only public access will do." -- 2.40.1 From dfef0774f3024d188d6e7c33a9d93f72828f669c Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Wed, 2 May 2018 03:38:42 +0200 Subject: [PATCH 2/9] Improved the JCB package import area --- README.md | 4 +- admin/README.txt | 4 +- .../en-GB/en-GB.com_componentbuilder.ini | 2 +- admin/models/import_joomla_components.php | 2 +- .../import_joomla_components/tmpl/default.php | 51 ++++++++++++------- componentbuilder.xml | 2 +- 6 files changed, 39 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 76b3e8081..05b08ec07 100644 --- a/README.md +++ b/README.md @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 1st May, 2018 ++ *Last Build*: 2nd May, 2018 + *Version*: 2.7.6 + *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*: **193870** ++ *Line count*: **193883** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/README.txt b/admin/README.txt index 76b3e8081..05b08ec07 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -126,11 +126,11 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](http://joomlacomponentbuilder.com) + *First Build*: 30th April, 2015 -+ *Last Build*: 1st May, 2018 ++ *Last Build*: 2nd May, 2018 + *Version*: 2.7.6 + *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*: **193870** ++ *Line count*: **193883** + *Field count*: **1027** + *File count*: **1201** + *Folder count*: **193** diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 3a0ba728c..f2d4c64ea 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -6508,7 +6508,7 @@ COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Succ COM_COMPONENTBUILDER_THE_URL_S_SET_TO_RETRIEVE_THE_PACKAGES_DOES_NOT_EXIST="The url (%s) set to retrieve the packages does not exist!" COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading" COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_OTHER_AREAS_OF_JCB_AT_THIS_TIME="This %s is not linked to any other areas of JCB at this time!" -COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_CHECKSUM_VALIDATION_PLEASE_VALIDATE_THIS_CHECKSUM_BSB_TO_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA="This package PASSED checksum validation! Please validate this checksum: %s to be the same as the one found @ " +COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA="This package PASSED the checksum validation!

Manually also validate that the correct checksum was used.
This checksum: %s must be the same as the one found @
" COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key." COM_COMPONENTBUILDER_TITLE="Title" COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads" diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php index 67d0ba28a..7ad6e0357 100644 --- a/admin/models/import_joomla_components.php +++ b/admin/models/import_joomla_components.php @@ -304,7 +304,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy if ($checksums[$packageName] === sha1_file($package['dir'])) { $validator = $this->checksumURLs[$this->checksum].str_replace('.zip', '.sha', $packageName); - $checksumMessage = JText::sprintf('COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_CHECKSUM_VALIDATION_PLEASE_VALIDATE_THIS_CHECKSUM_BSB_TO_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA', $checksums[$packageName], 'href="'.$validator.'" target="_blank" title="verify checksum">', $validator); + $checksumMessage = JText::sprintf('COM_COMPONENTBUILDER_THIS_PACKAGE_BPASSEDB_THE_CHECKSUM_VALIDATIONBR_BR_SMALLMANUALLY_ALSO_VALIDATE_THAT_THE_CORRECT_CHECKSUM_WAS_USEDSMALLBR_THIS_CHECKSUM_BSB_MUST_BE_THE_SAME_AS_THE_ONE_FOUND_A_S_SA', $checksums[$packageName], 'href="'.$validator.'" target="_blank" title="verify checksum">', $validator); $checksumStatus = 'Success'; $checksum = true; } diff --git a/admin/views/import_joomla_components/tmpl/default.php b/admin/views/import_joomla_components/tmpl/default.php index c4421d0d3..fb34dae40 100644 --- a/admin/views/import_joomla_components/tmpl/default.php +++ b/admin/views/import_joomla_components/tmpl/default.php @@ -105,6 +105,8 @@ JHtml::_('behavior.keepalive'); // set the url form.import_url.value = form.vdm_package.value; jQuery('#loading').css('display', 'block'); + jQuery('#noticeboard').show(); + jQuery('#installer-import').hide(); form.checksum.value = 'vdm'; form.gettype.value = 'url'; form.submit(); @@ -123,6 +125,8 @@ JHtml::_('behavior.keepalive'); // set the url form.import_url.value = form.jcb_package.value; jQuery('#loading').css('display', 'block'); + jQuery('#noticeboard').show(); + jQuery('#installer-import').hide(); form.checksum.value = 'jcb'; form.gettype.value = 'url'; form.submit(); @@ -152,8 +156,7 @@ jQuery(document).ready(function($) { dataType === 'smart_package') ? '.zip' : 'none'; ?> - -
+
sidebar)) : ?> @@ -164,6 +167,12 @@ jQuery(document).ready(function($) {
+ +
hasPackage && $this->dataType === 'smart_package') : ?> packageInfo['name']) && ComponentbuilderHelper::checkArray($this->packageInfo['name'])) @@ -275,7 +284,7 @@ jQuery(document).ready(function($) { vdmPackages && ComponentbuilderHelper::checkArray($this->vdmPackages)): ?> -
+

@@ -294,13 +303,8 @@ jQuery(document).ready(function($) {
-
+
-
-
- -
.
-

@@ -310,7 +314,7 @@ jQuery(document).ready(function($) { jcbPackages && ComponentbuilderHelper::checkArray($this->jcbPackages)) : ?> -
+

@@ -329,13 +333,8 @@ jQuery(document).ready(function($) {
-
+
-
-
- -
.
-

@@ -349,13 +348,15 @@ jQuery(document).ready(function($) { +