From f34e1b19f8e4529ddfd650f47fb1a4939e072411 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Thu, 16 Nov 2017 06:37:32 +0200 Subject: [PATCH] Added sharing of snippets option and started adding get snippets custom admin view gh-92. Fixed gh-153 published settings for categories. --- README.md | 8 +- admin/README.txt | 8 +- admin/access.xml | 4 + admin/assets/css/get_snippets.css | 27 ++ admin/config.xml | 51 +++ admin/controllers/get_snippets.php | 63 +++ admin/controllers/joomla_components.php | 4 +- admin/controllers/snippets.php | 49 +++ admin/helpers/compiler.php | 10 +- admin/helpers/compiler/a_Get.php | 8 +- admin/helpers/compiler/b_Structure.php | 2 +- admin/helpers/compiler/e_Interpretation.php | 4 +- admin/helpers/compiler/f_Infusion.php | 2 +- admin/helpers/componentbuilder.php | 151 +++++-- .../en-GB/en-GB.com_componentbuilder.ini | 55 ++- .../en-GB/en-GB.com_componentbuilder.sys.ini | 8 + admin/models/ajax.php | 16 +- admin/models/fields/snippets.php | 18 +- admin/models/forms/custom_admin_view.js | 9 +- admin/models/forms/joomla_component.xml | 8 +- admin/models/forms/layout.js | 9 +- admin/models/forms/site_view.js | 9 +- admin/models/forms/template.js | 9 +- admin/models/get_snippets.php | 150 +++++++ admin/models/snippets.php | 114 +++++ admin/sql/install.mysql.utf8.sql | 2 +- admin/views/dynamic_get/tmpl/edit.php | 2 +- admin/views/get_snippets/index.html | 1 + admin/views/get_snippets/tmpl/default.php | 107 +++++ admin/views/get_snippets/tmpl/index.html | 1 + admin/views/get_snippets/view.html.php | 400 ++++++++++++++++++ admin/views/snippets/view.html.php | 14 +- componentbuilder.xml | 2 +- media/js/jquery.json.min.js | 2 + media/js/jstorage.min.js | 16 + script.php | 2 +- site/helpers/componentbuilder.php | 151 +++++-- 37 files changed, 1372 insertions(+), 124 deletions(-) create mode 100644 admin/assets/css/get_snippets.css create mode 100644 admin/controllers/get_snippets.php create mode 100644 admin/models/get_snippets.php create mode 100644 admin/views/get_snippets/index.html create mode 100644 admin/views/get_snippets/tmpl/default.php create mode 100644 admin/views/get_snippets/tmpl/index.html create mode 100644 admin/views/get_snippets/view.html.php create mode 100644 media/js/jquery.json.min.js create mode 100644 media/js/jstorage.min.js diff --git a/README.md b/README.md index 64cbd9b64..fc19512cc 100644 --- a/README.md +++ b/README.md @@ -111,13 +111,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 12th November, 2017 ++ *Last Build*: 16th November, 2017 + *Version*: 2.6.4 + *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*: **166252** -+ *File count*: **1061** -+ *Folder count*: **174** ++ *Line count*: **167476** ++ *File count*: **1070** ++ *Folder count*: **176** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/README.txt b/admin/README.txt index 64cbd9b64..fc19512cc 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -111,13 +111,13 @@ Component Builder is mapped as a component in itself on my local development env + *Author*: [Llewellyn van der Merwe](mailto:joomla@vdm.io) + *Name*: [Component Builder](http://vdm.bz/component-builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 12th November, 2017 ++ *Last Build*: 16th November, 2017 + *Version*: 2.6.4 + *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*: **166252** -+ *File count*: **1061** -+ *Folder count*: **174** ++ *Line count*: **167476** ++ *File count*: **1070** ++ *Folder count*: **176** > This **component** was build with a Joomla [Automated Component Builder](http://vdm.bz/component-builder). > Developed by [Llewellyn van der Merwe](mailto:joomla@vdm.io) diff --git a/admin/access.xml b/admin/access.xml index c859067df..c4a5fe7de 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -225,6 +225,8 @@ + + @@ -303,6 +305,8 @@ + + diff --git a/admin/assets/css/get_snippets.css b/admin/assets/css/get_snippets.css new file mode 100644 index 000000000..415d6d8eb --- /dev/null +++ b/admin/assets/css/get_snippets.css @@ -0,0 +1,27 @@ +/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/ + __ __ _ _____ _ _ __ __ _ _ _ + \ \ / / | | | __ \ | | | | | \/ | | | | | | | + \ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| | + \ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` | + \ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| | + \/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_| + | | + |_| +/-------------------------------------------------------------------------------------------------------------------------------/ + + @version 2.6.x + @created 30th April, 2015 + @package Component Builder + @subpackage get_snippets.css + @author Llewellyn van der Merwe + @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 + +/-----------------------------------------------------------------------------------------------------------------------------*/ + +/* CSS Document */ + + diff --git a/admin/config.xml b/admin/config.xml index 280e44972..119c3cf2f 100644 --- a/admin/config.xml +++ b/admin/config.xml @@ -83,6 +83,57 @@ label="COM_COMPONENTBUILDER_CONFIG_API_LABEL" description="COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION" /> + + + + + + + + + + + + + + + + + + + + + + + @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'); + +// import Joomla controlleradmin library +jimport('joomla.application.component.controlleradmin'); + +/** + * Get_snippets Controller + */ +class ComponentbuilderControllerGet_snippets extends JControllerAdmin +{ + protected $text_prefix = 'COM_COMPONENTBUILDER_GET_SNIPPETS'; + /** + * Proxy for getModel. + * @since 2.5 + */ + public function getModel($name = 'Get_snippets', $prefix = 'ComponentbuilderModel', $config = array()) + { + $model = parent::getModel($name, $prefix, array('ignore_request' => true)); + + return $model; + } + + public function dashboard() + { + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder', false)); + return; + } + + public function openSnippets() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // redirect to the snippets admin view + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false)); + return; + } +} diff --git a/admin/controllers/joomla_components.php b/admin/controllers/joomla_components.php index 75ddefe88..9fd350d65 100644 --- a/admin/controllers/joomla_components.php +++ b/admin/controllers/joomla_components.php @@ -114,8 +114,8 @@ class ComponentbuilderControllerJoomla_components extends JControllerAdmin // Check for request forgeries JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); // check if import is allowed for this user. - $model->user = JFactory::getUser(); - if ($model->user->authorise('joomla_component.import', 'com_componentbuilder') && $model->user->authorise('core.import', 'com_componentbuilder')) + $user = JFactory::getUser(); + if ($user->authorise('joomla_component.import', 'com_componentbuilder') && $user->authorise('core.import', 'com_componentbuilder')) { $session = JFactory::getSession(); $session->set('backto_VDM_IMPORT', 'joomla_components'); diff --git a/admin/controllers/snippets.php b/admin/controllers/snippets.php index bd5126cb4..53aad1f60 100644 --- a/admin/controllers/snippets.php +++ b/admin/controllers/snippets.php @@ -107,5 +107,54 @@ class ComponentbuilderControllerSnippets extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_IMPORT_FAILED'); $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); return; + } + + public function getSnippets() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // redirect to the import snippets custom admin view + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=get_snippets', false)); + return; + } + + public function shareSnippets() + { + // Check for request forgeries + JSession::checkToken() or die(JText::_('JINVALID_TOKEN')); + // Get the model + $model = $this->getModel('snippets'); + // check if import is allowed for this user. + $model->user = JFactory::getUser(); + if ($model->user->authorise('snippet.import', 'com_componentbuilder') && $model->user->authorise('core.export', 'com_componentbuilder')) + { + // Get the input + $input = JFactory::getApplication()->input; + $pks = $input->post->get('cid', array(), 'array'); + // Sanitize the input + JArrayHelper::toInteger($pks); + // check if there is any selections + if (!ComponentbuilderHelper::checkArray($pks)) + { + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + return; + } + // set auto loader + ComponentbuilderHelper::autoLoader('smart'); + // get the data to export + if ($model->shareSnippets($pks)) + { + // Redirect to the list screen with success + $message = JText::_('COM_COMPONENTBUILDER_SNIPPETS_HAVE_BEEN_EXPORTED_AND_ZIPPED_READY_TO_SHARE_PLEASE_WATCH_THE_FOLLOWING_A_HREF_TARGET_BLANKVIDEO_TUTORIALA_THAT_SHOWS_YOU_HOW_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message); + return; + } + } + // Redirect to the list screen with error. + $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP'); + $this->setRedirect(JRoute::_('index.php?option=com_componentbuilder&view=snippets', false), $message, 'error'); + return; } } diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index 5814dab94..5f5127bf9 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -87,7 +87,7 @@ class Compiler extends Infusion $this->removeFolder($this->componentPath . '/site'); // clear form component xml $xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml'; - $componentXML = file_get_contents($xmlPath); + $componentXML = ComponentbuilderHelper::getFileContents($xmlPath); $textToSite = ComponentbuilderHelper::getBetween($componentXML,'',''); $textToSiteLang = ComponentbuilderHelper::getBetween($componentXML,'',''); $componentXML = str_replace(array(''.$textToSite."", ''.$textToSiteLang.""), array('',''), $componentXML); @@ -183,7 +183,7 @@ class Compiler extends Infusion if (isset($this->newFiles['static']) && ComponentbuilderHelper::checkArray($this->newFiles['static']) && isset($this->newFiles['dynamic']) && ComponentbuilderHelper::checkArray($this->newFiles['dynamic'])) { // get the bom file - $bom = file_get_contents($this->bomPath); + $bom = ComponentbuilderHelper::getFileContents($this->bomPath); // first we do the static files foreach ($this->newFiles['static'] as $static) { @@ -195,7 +195,7 @@ class Compiler extends Infusion { $php = "buildReadMeData(); } // get the file - $string = file_get_contents($path); + $string = ComponentbuilderHelper::getFileContents($path); // update the file $answer = $this->setPlaceholders($string, $this->fileContentStatic); // add to zip array diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index cbf483262..881a9bf6c 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -2881,6 +2881,7 @@ class Get } $gets = array(); $keys = array(); + // first load all options foreach ($lines as $line) { if (strpos($line,'AS') !== false) @@ -2896,13 +2897,16 @@ class Get $get = $line; $key = null; } + // set the get and key $get = trim($get); $key = trim($key); - // only add the view - if ('a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false) + // only add the view (we must adapt this) + if (isset($this->getAsLookup[$method_key][$get]) && 'a' != $as && 1 == $row_type && 'view' === $type && strpos('#'.$key,'#'.$view.'_') === false) { + // this is a problem (TODO) since we may want to not add the view name. $key = $view.'_'.trim($key); } + // continue only if we have get if (ComponentbuilderHelper::checkString($get)) { $gets[] = $this->db->quote($get); diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 4c17266dc..66d48de71 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -910,7 +910,7 @@ class Structure extends Get private function setJoomlaVersionData() { // set the version data - $versionData = json_decode(file_get_contents($this->templatePath.'/settings.json')); + $versionData = json_decode(ComponentbuilderHelper::getFileContents($this->templatePath.'/settings.json')); // add custom folders if ((isset($this->componentData->folders) && ComponentbuilderHelper::checkArray($this->componentData->folders)) || $this->addEximport || $this->uikit || $this->footable) { diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index e51bba2d6..9374bc27e 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -3742,7 +3742,7 @@ class Interpretation extends Fields { if (JFile::exists($file['path'])) { - $string = file_get_contents($file['path']); + $string = ComponentbuilderHelper::getFileContents($file['path']); $buket['static'][] = $this->getInbetweenStrings($string); } } @@ -3754,7 +3754,7 @@ class Interpretation extends Fields { if (JFile::exists($doc['path'])) { - $string = file_get_contents($doc['path']); + $string = ComponentbuilderHelper::getFileContents($doc['path']); $buket[$view][] = $this->getInbetweenStrings($string); } } diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 8149e9423..2ea8127ac 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -1305,7 +1305,7 @@ class Infusion extends Interpretation // build xml path $xmlPath = $this->componentPath . '/'. $this->fileContentStatic['###component###']. '.xml'; // get the content in xml - $componentXML = file_get_contents($xmlPath); + $componentXML = ComponentbuilderHelper::getFileContents($xmlPath); // update the xml content $componentXML = $this->setPlaceholders($componentXML, $replace); // store the values back to xml diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index 8c7deb3d5..105ebc28a 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -250,7 +250,7 @@ abstract class ComponentbuilderHelper **/ protected static $params = false; - /* + /** * get all component IDs */ public static function getComponentIDs() @@ -271,7 +271,7 @@ abstract class ComponentbuilderHelper return false; } - /* + /** * Autoloader */ public static function autoLoader($type = 'compiler') @@ -384,14 +384,14 @@ abstract class ComponentbuilderHelper } /** - * The zipper method - * - * @param string $workingDIR The directory where the items must be zipped - * @param string $filepath The path to where the zip file must be placed - * - * @return bool true On success - * - */ + * The zipper method + * + * @param string $workingDIR The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + */ public static function zip($workingDIR, &$filepath) { // store the current joomla working directory @@ -435,14 +435,14 @@ abstract class ComponentbuilderHelper /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + */ public static function writeFile($path, $data) { $klaar = false; @@ -1398,7 +1398,7 @@ abstract class ComponentbuilderHelper // first get the file path $path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set - if (($content = @file_get_contents($path_filename)) !== FALSE) + if ($content = self::getFileContents($path_filename, false)) { if ($hash == $content) { @@ -1412,18 +1412,18 @@ abstract class ComponentbuilderHelper } /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + */ public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true) { // get the global settings @@ -1480,7 +1480,94 @@ abstract class ComponentbuilderHelper // sanitize the path return '/' . trim( $filePath, '/' ) . '/' . $fileName; } - + + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + */ + public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_componentbuilder'); + } + $folderPath = self::$params->get($target, $default); + jimport('joomla.filesystem.folder'); + // create the folder if it does not exist + if ($createIfNotSet && !JFolder::exists($folderPath)) + { + JFolder::create($folderPath); + } + // return the url + if ('url' === $type) + { + if (strpos($folderPath, JPATH_SITE) !== false) + { + $folderPath = trim( str_replace( JPATH_SITE, '', $folderPath), '/'); + return JURI::root() . $folderPath . '/'; + } + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return JURI::root(); + } + // sanitize the path + return '/' . trim( $folderPath, '/' ) . '/'; + } + + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param string/bool $none The return value if no content was found + * + * @return string On success + * + */ + public static function getFileContents($path, $none = '') + { + if (self::checkString($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = array(); + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + // return if found + if (self::checkString($content)) + { + return $content; + } + } + } + return $none; + } + /** * Load the Component xml manifest. **/ diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index aa2ba95ca..9447297eb 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -855,13 +855,16 @@ COM_COMPONENTBUILDER_ADMIN_VIEW_YES="Yes" COM_COMPONENTBUILDER_ADMIN_VIEW_YOUTUBE="Youtube" COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_IN="Zoom In" COM_COMPONENTBUILDER_ADMIN_VIEW_ZOOM_OUT="Zoom Out" +COM_COMPONENTBUILDER_AHEAD="Ahead" COM_COMPONENTBUILDER_ALIAS="Alias" COM_COMPONENTBUILDER_ALIGNMENT="Alignment" +COM_COMPONENTBUILDER_ALL="All" COM_COMPONENTBUILDER_ALL_IS_GOOD_PLEASE_CHECK_AGAIN_LATTER="All is good, please check again latter." COM_COMPONENTBUILDER_ALL_IS_GOOD_THERE_IN_NO_NOTICE_AT_THIS_TIME="All is good, there in no notice at this time." COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE="All unsaved work on this page will be lost, are you sure you want to continue?" COM_COMPONENTBUILDER_ALWAYS_INSURE_THAT_YOU_HAVE_YOUR_LOCAL_COMPONENTS_BACKED_UP_BY_MAKING_AN_EXPORT_OF_ALL_YOUR_LOCAL_COMPONENTS_BEFORE_IMPORTING_ANY_NEW_COMPONENTS_SMALLMAKE_BSUREB_TO_MOVE_THIS_ZIPPED_BACKUP_PACKAGE_OUT_OF_THE_TMP_FOLDER_BEFORE_DOING_AN_IMPORTSMALLBR_IF_YOU_ARE_IMPORTING_A_PACKAGE_OF_A_THREERD_PARTY_JCB_PACKAGE_DEVELOPER_BMAKE_SURE_IT_IS_A_REPUTABLE_JCB_PACKAGE_DEVELOPERSB="Always insure that you have your local components backed up, by making an export of all your local components before importing any new components. (Make SURE to move this zipped backup package out of the tmp folder before doing an import)
If you are importing a package of a 3rd party JCB package developer, make sure it is a reputable JCB package developers!" COM_COMPONENTBUILDER_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)" +COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED="An error has occurred" COM_COMPONENTBUILDER_ARCHIVED="Archived" COM_COMPONENTBUILDER_AUTHOR="Author" COM_COMPONENTBUILDER_AUTO_CHECKIN="Auto Check-in" @@ -2083,6 +2086,7 @@ COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_MESSAGE="Error! Please add some t COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE="Version Update" COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE_DESCRIPTION="Add Version Updates Here!" COM_COMPONENTBUILDER_COMPONENT_UPDATES_VERSION_UPDATE_LABEL="Version Updates" +COM_COMPONENTBUILDER_CONFIG_ACTIVE="Active" COM_COMPONENTBUILDER_CONFIG_ALMOST_FLAT_LOAD="Almost Flat" COM_COMPONENTBUILDER_CONFIG_API_DESCRIPTION="This User will be used to log the API call." COM_COMPONENTBUILDER_CONFIG_API_LABEL="API User" @@ -2216,6 +2220,17 @@ COM_COMPONENTBUILDER_CONFIG_EMAILREPLY_HINT="Email Address Here" COM_COMPONENTBUILDER_CONFIG_EMAILREPLY_LABEL=" Reply to Email" COM_COMPONENTBUILDER_CONFIG_ENCRYPTION_DESC="The encryption key for the field encryption is set here." COM_COMPONENTBUILDER_CONFIG_ENCRYPTION_LABEL="Encryption Settings" +COM_COMPONENTBUILDER_CONFIG_EVERY_DAY="Every Day" +COM_COMPONENTBUILDER_CONFIG_EVERY_FIFTEEN_MINUTES="Every 15 Minutes" +COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_HOURS="Every 5 Hours" +COM_COMPONENTBUILDER_CONFIG_EVERY_FIVE_MINUTES="Every 5 Minutes" +COM_COMPONENTBUILDER_CONFIG_EVERY_HOUR="Every Hour" +COM_COMPONENTBUILDER_CONFIG_EVERY_MINUTE="Every Minute" +COM_COMPONENTBUILDER_CONFIG_EVERY_SESSION="Every Session" +COM_COMPONENTBUILDER_CONFIG_EVERY_TEN_HOURS="Every 10 Hours" +COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_MINUTES="Every 30 Minutes" +COM_COMPONENTBUILDER_CONFIG_EVERY_THIRTY_SECONDS="Every 30 Seconds" +COM_COMPONENTBUILDER_CONFIG_EVERY_WEEK="Every Week" COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_DESCRIPTION="Enter link where your JCB package key can be bought." COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_HINT="http://www.example.com/buy-keys" COM_COMPONENTBUILDER_CONFIG_EXPORT_BUY_LINK_LABEL="Buy Link
(to get key)" @@ -2256,6 +2271,7 @@ COM_COMPONENTBUILDER_CONFIG_GLOBAL="Global" COM_COMPONENTBUILDER_CONFIG_GLOBAL_DESC="The Global Parameters" COM_COMPONENTBUILDER_CONFIG_GLOBAL_LABEL="Global" COM_COMPONENTBUILDER_CONFIG_GRADIANT_LOAD="Gradient" +COM_COMPONENTBUILDER_CONFIG_INACTIVE="Inactive" COM_COMPONENTBUILDER_CONFIG_MAILER_DESCRIPTION="Select what mailer you would like to use to send emails." COM_COMPONENTBUILDER_CONFIG_MAILER_LABEL="Mailer" COM_COMPONENTBUILDER_CONFIG_MAILONLINE_DESCRIPTION="Warning this will stop all emails from going out." @@ -2263,6 +2279,7 @@ COM_COMPONENTBUILDER_CONFIG_MAILONLINE_LABEL="Mailer Status" COM_COMPONENTBUILDER_CONFIG_MAIL_CONFIGURATION="Mail Configuration" COM_COMPONENTBUILDER_CONFIG_MINIFY_DESCRIPTION="Should the JavaScript be minified when compiled." COM_COMPONENTBUILDER_CONFIG_MINIFY_LABEL="Minify JS" +COM_COMPONENTBUILDER_CONFIG_NEVER_UPDATE="Never update" COM_COMPONENTBUILDER_CONFIG_NO="No" COM_COMPONENTBUILDER_CONFIG_NONE="None" COM_COMPONENTBUILDER_CONFIG_NOTE_BACKUP_FOLDER_PATH_DESCRIPTION="You components will be placed as zip files inside this folder." @@ -2316,6 +2333,8 @@ COM_COMPONENTBUILDER_CONFIG_SENDMAIL="Sendmail" COM_COMPONENTBUILDER_CONFIG_SENDMAIL_DESCRIPTION="Enter the path to the sendmail program directory on your host server." COM_COMPONENTBUILDER_CONFIG_SENDMAIL_HINT="/usr/sbin/sendmail" COM_COMPONENTBUILDER_CONFIG_SENDMAIL_LABEL="Sendmail Path" +COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_DESCRIPTION="Select if browser storage should be used to save on Ajax calls and speed up this components site pages." +COM_COMPONENTBUILDER_CONFIG_SET_BROWSER_STORAGE_LABEL="Browser Storage" COM_COMPONENTBUILDER_CONFIG_SMTP="SMTP" COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_DESCRIPTION="Select yes if your SMTP host requires SMTP Authentication." COM_COMPONENTBUILDER_CONFIG_SMTPAUTH_LABEL="SMTP Authentication" @@ -2333,6 +2352,8 @@ COM_COMPONENTBUILDER_CONFIG_SMTPUSER_DESCRIPTION="Enter the username for access COM_COMPONENTBUILDER_CONFIG_SMTPUSER_HINT="email@demo.com" COM_COMPONENTBUILDER_CONFIG_SMTPUSER_LABEL="SMTP Username" COM_COMPONENTBUILDER_CONFIG_SSL="SSL" +COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_DESCRIPTION="How long should the data that is stored in the browser memory remain unchanged before it is removed and updated." +COM_COMPONENTBUILDER_CONFIG_STORAGE_TIME_TO_LIVE_LABEL="Update Cycle" COM_COMPONENTBUILDER_CONFIG_TLS="TLS" COM_COMPONENTBUILDER_CONFIG_UIKIT_DESC="The Parameters for the uikit are set here.
Uikit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. For more info visit https://getuikit.com/v2/" @@ -3013,6 +3034,7 @@ COM_COMPONENTBUILDER_DATE="Date" COM_COMPONENTBUILDER_DEBUG_LINE_NUMBERS="Debug (line numbers)" COM_COMPONENTBUILDER_DEFAULT_VIEW="Default View" COM_COMPONENTBUILDER_DETAILS="Details" +COM_COMPONENTBUILDER_DIVERGED="Diverged" COM_COMPONENTBUILDER_DOES_THIS_PACKAGE_REQUIRE_A_KEY_TO_INSTALL="Does this package require a key to install" COM_COMPONENTBUILDER_DOWNLOAD="download" COM_COMPONENTBUILDER_DYNAMIC_GET="Dynamic Get" @@ -3739,6 +3761,12 @@ COM_COMPONENTBUILDER_FTP_STATUS="Status" COM_COMPONENTBUILDER_FTP_VERSION_DESC="A count of the number of times this FTP has been revised." COM_COMPONENTBUILDER_FTP_VERSION_LABEL="Revision" COM_COMPONENTBUILDER_FULL_WIDTH_IN_TAB="Full Width in Tab" +COM_COMPONENTBUILDER_GET_SNIPPETS="Get Snippets" +COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access" +COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets." +COM_COMPONENTBUILDER_GET_SNIPPETS_DESC="The compiler" +COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access" +COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button." 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_GLOBAL="Global" COM_COMPONENTBUILDER_GREAT_THIS_FUNCTION_NAME_WILL_WORK="Great, this function name will work!" @@ -3912,6 +3940,7 @@ COM_COMPONENTBUILDER_IMPORT_UNABLE_TO_FIND_IMPORT_PACKAGE="Package to import not COM_COMPONENTBUILDER_IMPORT_UPDATE_DATA="Import Data" COM_COMPONENTBUILDER_IMPORT_UPLOAD_BOTTON="Upload File" COM_COMPONENTBUILDER_INACTIVE="Inactive" +COM_COMPONENTBUILDER_IN_SYNC="In Sync" COM_COMPONENTBUILDER_ISOLATE="Isolate" COM_COMPONENTBUILDER_ISSUE="issue" COM_COMPONENTBUILDER_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES="Is Not (only 4 list/radio/checkboxes)" @@ -3979,6 +4008,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_DESCRIPTION="Select the version o COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADDUIKIT_LABEL="Add Uikit" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT="Add Admin Event" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_ADMIN_EVENT_LABEL="Add Global Admin Event" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BOTH_VTWO_AMP_VTHREE="Add Both v2 & v3" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS="Add Css" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_LABEL="Add CSS" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER="Add Email Helper" @@ -4014,6 +4044,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SITE_EVENT="Add Site Event" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SITE_EVENT_LABEL="Add Global Site Event" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL="Add Sql" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_SQL_LABEL="Add MySQL (to view table)" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTHREE="Add Uikit v3" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO="Add Uikit v2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UPDATE_SERVER_LABEL="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADMIN_VIEWS="Admin Views" @@ -4072,6 +4104,7 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_DESCRIPTION="Add Description H COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_HINT="Add Description Here" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DETAILS="Details" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD="Do not add" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_BUILD_BETA="Dynamic Build (beta)" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DYNAMIC_INTEGRATION="Dynamic Integration" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_EDIT="Editing the Joomla Component" @@ -4341,8 +4374,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_USE_ONLY_FIRST_TWO_NUMBER_OF_GLOBAL_VERSIO COM_COMPONENTBUILDER_JOOMLA_COMPONENT_USE_VIEW_VERSION_DATE="Use View Version & Date" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_DESC="A count of the number of times this Joomla Component has been revised." COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VERSION_LABEL="Revision" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTHREE="v3" -COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTWO="v2" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTHREE="V3" +COM_COMPONENTBUILDER_JOOMLA_COMPONENT_VTWO="V2" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE="Website" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_DESCRIPTION="Enter website address" COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT="http://www.example.com" @@ -4668,10 +4701,12 @@ COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNFEATURED_1="%s Library unfeatured." COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNPUBLISHED="%s Libraries unpublished." COM_COMPONENTBUILDER_LIBRARIES_N_ITEMS_UNPUBLISHED_1="%s Library unpublished." COM_COMPONENTBUILDER_LIBRARY="Library" +COM_COMPONENTBUILDER_LIBRARY_ASC="Library (Asc)" COM_COMPONENTBUILDER_LIBRARY_CREATED_BY_DESC="The user that created this Library." COM_COMPONENTBUILDER_LIBRARY_CREATED_BY_LABEL="Created By" COM_COMPONENTBUILDER_LIBRARY_CREATED_DATE_DESC="The date this Library was created." COM_COMPONENTBUILDER_LIBRARY_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_LIBRARY_DESC="Library (Desc)" COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION="Description" COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_DESCRIPTION="Enter some description" COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_HINT="Description Here" @@ -4707,6 +4742,8 @@ COM_COMPONENTBUILDER_MATCH_FIELD="Match Field" COM_COMPONENTBUILDER_MATCH_OPTIONS="Match Options" COM_COMPONENTBUILDER_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD="Max Length (only 4 text_field)" COM_COMPONENTBUILDER_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD="Min Length (only 4 text_field)" +COM_COMPONENTBUILDER_NAME_ASC="Name (Asc)" +COM_COMPONENTBUILDER_NAME_DESC="Name (Desc)" COM_COMPONENTBUILDER_NEW="New" COM_COMPONENTBUILDER_NEW_ISSUE="New Issue" COM_COMPONENTBUILDER_NEW_NOTICE="New Notice" @@ -4720,6 +4757,7 @@ COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_FOR_S="No cronjob path found for (%s) COM_COMPONENTBUILDER_NO_CRONJOB_PATH_FOUND_SINCE_INCORRECT_TYPE_REQUESTED="No cronjob path found since incorrect type requested." COM_COMPONENTBUILDER_NO_ITEM_FOUND="No Item Found" COM_COMPONENTBUILDER_NO_KEYS_WERE_FOUND_TO_ADD_AN_EXPORT_KEY_SIMPLY_OPEN_THE_COMPONENT_GO_TO_THE_TAB_CALLED_SETTINGS_BOTTOM_RIGHT_THERE_IS_A_FIELD_CALLED_EXPORT_KEY="No keys were found. To add an export key simply open the component, go to the tab called settings, bottom right there is a field called Export Key." +COM_COMPONENTBUILDER_NO_SNIPPETS_WERE_SELECTED_PLEASE_MAKE_A_SELECTION_AND_TRY_AGAIN="No snippets were selected, please make a selection and try again!" COM_COMPONENTBUILDER_NO_S_FOUND="No %s Found" COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE="No %s have been linked to this view. Soon as this is done it will be displayed here." COM_COMPONENTBUILDER_ON_GITHUB="on Github" @@ -4730,7 +4768,7 @@ COM_COMPONENTBUILDER_OPEN_ON_GITHUB="Open on Github" COM_COMPONENTBUILDER_ORDER_BEFORE="Order Before" COM_COMPONENTBUILDER_ORDER_IN_EDIT="Order in Edit" COM_COMPONENTBUILDER_ORDER_IN_LIST_VIEWS="Order in list views" -COM_COMPONENTBUILDER_OUT_OF_DATE="Out of date" +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_OWNER_DETAILS="Package Owner Details" @@ -4742,6 +4780,7 @@ COM_COMPONENTBUILDER_PLEASE_ADD_FILES_TO_S="Please add files to (%s)" COM_COMPONENTBUILDER_PLEASE_ADD_FOLDERS_TO_S="Please add folders to (%s)" COM_COMPONENTBUILDER_PLEASE_CHECK_AGAIN_LATTER="Please check again latter." COM_COMPONENTBUILDER_PLEASE_SELECT_A_COMPONENT_THAT_YOU_WOULD_LIKE_TO_COMPILE="Please select a component that you would like to compile." +COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER="Please try again later" COM_COMPONENTBUILDER_PLEASE_WAIT_CLEARING_THE_TMP_FOLDER="Please wait! Clearing the tmp folder" COM_COMPONENTBUILDER_PUBLIC_ACCESS="Public Access" COM_COMPONENTBUILDER_PUBLISHED="Published" @@ -4756,6 +4795,7 @@ COM_COMPONENTBUILDER_SAVE_SUCCESS="Great! Item successfully saved." COM_COMPONENTBUILDER_SAVE_WARNING="The value already existed so please select another." COM_COMPONENTBUILDER_SEARCHABLE="Searchable" COM_COMPONENTBUILDER_SELECT_THE_COMPONENT_TO_COMPILE="Select the component to compile" +COM_COMPONENTBUILDER_SHARE_SNIPPETS="Share Snippets" COM_COMPONENTBUILDER_SHOULD_JCB_INSERT_THE_CUSTOM_CODE_PLACEHOLDERS_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_CUSTOM_CODE="Should JCB insert the custom code placeholders? This is only applicable if this component has custom code." COM_COMPONENTBUILDER_SHOULD_THE_COMPONENT_BE_MOVED_TO_YOUR_LOCAL_REPOSITORY_FOLDER="Should the component be moved to your local repository folder?" COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_LOCAL_BACKUP_AND_REMOTE_SALES_SERVER_THIS_IS_ONLY_APPLICABLE_IF_THIS_COMPONENT_HAS_THOSE_VALUES_SET="Should the zipped package of the component be moved to the local backup and remote sales server? This is only applicable if this component has those values set." @@ -5235,6 +5275,7 @@ COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION="Snippets Edit Version" COM_COMPONENTBUILDER_SNIPPETS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version snippets" COM_COMPONENTBUILDER_SNIPPETS_EXPORT="Snippets Export" COM_COMPONENTBUILDER_SNIPPETS_EXPORT_DESC="Allows the users in this group to export export snippets" +COM_COMPONENTBUILDER_SNIPPETS_HAVE_BEEN_EXPORTED_AND_ZIPPED_READY_TO_SHARE_PLEASE_WATCH_THE_FOLLOWING_A_HREF_TARGET_BLANKVIDEO_TUTORIALA_THAT_SHOWS_YOU_HOW_TO_SHARE_THESE_SNIPPETS_WITH_THE_REST_OF_THE_JCB_COMMUNITY="Snippets have been exported and zipped ready to share! Please watch the following video tutorial that shows you how to share these snippets with the rest of the JCB community." COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import" COM_COMPONENTBUILDER_SNIPPETS_IMPORT_DESC="Allows the users in this group to import import snippets" COM_COMPONENTBUILDER_SNIPPETS_N_ITEMS_ARCHIVED="%s Snippets archived." @@ -5267,6 +5308,8 @@ COM_COMPONENTBUILDER_SNIPPET_DESCRIPTION_LABEL="Description" COM_COMPONENTBUILDER_SNIPPET_DETAILS="Details" COM_COMPONENTBUILDER_SNIPPET_EDIT="Editing the Snippet" COM_COMPONENTBUILDER_SNIPPET_ERROR_UNIQUE_ALIAS="Another Snippet has the same alias." +COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access" +COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button." COM_COMPONENTBUILDER_SNIPPET_HEADING="Heading" COM_COMPONENTBUILDER_SNIPPET_HEADING_DESCRIPTION="Enter short heading" COM_COMPONENTBUILDER_SNIPPET_HEADING_HINT="Your Heading Here" @@ -5290,6 +5333,8 @@ COM_COMPONENTBUILDER_SNIPPET_ORDERING_LABEL="Ordering" COM_COMPONENTBUILDER_SNIPPET_PERMISSION="Permissions" COM_COMPONENTBUILDER_SNIPPET_PUBLISHING="Publishing" COM_COMPONENTBUILDER_SNIPPET_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Snippet to customise the alias." +COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS="Snippet Share Snippets Button Access" +COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the share snippets button." COM_COMPONENTBUILDER_SNIPPET_SNIPPET="Snippet" COM_COMPONENTBUILDER_SNIPPET_SNIPPET_HINT="// Add the snippets code here" COM_COMPONENTBUILDER_SNIPPET_SNIPPET_LABEL="Snippet" @@ -5522,6 +5567,7 @@ COM_COMPONENTBUILDER_THE_NOTICE_BOARD_IS_LOADING="The notice board is loading" COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_CODESCODE="The package key is: %s" COM_COMPONENTBUILDER_THE_PACKAGE_KEY_IS_S="The package key is: %s" COM_COMPONENTBUILDER_THE_README_IS_LOADING="The readme is loading" +COM_COMPONENTBUILDER_THE_SNIPPETS_IS_LOADING="The snippets is loading" COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading" COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key." COM_COMPONENTBUILDER_TITLE="Title" @@ -5529,6 +5575,8 @@ COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads" COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_BJCB_GLOBAL_OPTIONSB_GO_TO_THE_BCOMPANYB_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there." COM_COMPONENTBUILDER_TO_CHANGE_THE_PACKAGE_OWNER_DEFAULTS_OPEN_THE_JCB_GLOBAL_OPTIONS_GO_TO_THE_COMPANY_TAB_AND_ADD_THE_CORRECT_COMPANY_DETAILS_THERE="To change the package owner defaults. Open the JCB Global Options, go to the Company tab and add the correct company details there." COM_COMPONENTBUILDER_TRASHED="Trashed" +COM_COMPONENTBUILDER_TYPE_ASC="Type (Asc)" +COM_COMPONENTBUILDER_TYPE_DESC="Type (Desc)" COM_COMPONENTBUILDER_TYPE_ERROR="Type Error" COM_COMPONENTBUILDER_UNACTIVE_ONLY_FOUR_TEXT_FIELD="Unactive (only 4 text_field)" COM_COMPONENTBUILDER_UNDERNEATH_TABS="Underneath Tabs" @@ -5551,6 +5599,7 @@ COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EI COM_COMPONENTBUILDER_YOUR_DATA_IS_ENCRYPTED_WITH_A_AES_ONE_HUNDRED_AND_TWENTY_EIGHT_BIT_ENCRYPTION_USING_THE_ABOVE_THIRTY_TWO_CHARACTER_KEY_WITHOUT_THIS_KEY_IT_WILL_TAKE_THE_CURRENT_TECHNOLOGY_WITH_A_BRUTE_FORCE_ATTACK_METHOD_MORE_THEN_A_HREFHTTPRANDOMIZECOMHOWLONGTOHACKPASS_TARGET_BLANK_TITLEHOW_LONG_TO_HACK_PASSSEVEN_HUNDRED_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZERO_ZEROA_YEARS_TO_CRACK_THEORETICALLY_UNLESS_THEY_HAVE_THIS_KEY_ABOVE_SO_DO_KEEP_IT_SAFE="Your data is encrypted with a AES 128 bit encryption using the above 32 character key. Without this key it will take the current technology with a brute force attack method more then 700 000 000 000 000 000 000 000 000 000 000 years to crack theoretically. Unless they have this key above, so do keep it safe." COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LIKE_TO_IMPORTBR_SMALLPLEASE_NOTE_THAT_SMART_COMPONENT_IMPORT_ONLY_WORKS_WITH_THE_FOLLOWING_FORMAT_BZIPBSMALL="You can now select the component zip package you would like to import.
Please note that smart component import only works with the following format: (.zip)" COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_IMPORT_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to import a component, please contact your system administrator for more help." +COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_SHARE_THE_SNIPPETS_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to share the snippets, please contact your system administrator for more help." COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE="You have %s %s. Adding more then 50 %s is considered bad practice." COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S="You have %s %s. Adding more then 50 %s is considered bad practice. Your %s page load in JCB will slowdown. You should consider decoupling some of these %s." COM_COMPONENTBUILDER_YOU_MUST_SELECT_A_COMPONENT="You must select a component!" diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini index 59db3c860..6397cc754 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini @@ -438,6 +438,10 @@ COM_COMPONENTBUILDER_FTPS_IMPORT="Ftps Import" COM_COMPONENTBUILDER_FTPS_IMPORT_DESC="Allows the users in this group to import import ftps" COM_COMPONENTBUILDER_FTPS_SUBMENU="Ftps Submenu" COM_COMPONENTBUILDER_FTPS_SUBMENU_DESC="Allows the users in this group to update the submenu of the ftp" +COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS="Get Snippets Access" +COM_COMPONENTBUILDER_GET_SNIPPETS_ACCESS_DESC=" Allows the users in this group to access get snippets." +COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS="Get Snippets Snippets Button Access" +COM_COMPONENTBUILDER_GET_SNIPPETS_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the snippets button." COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS="Help Documents Access" COM_COMPONENTBUILDER_HELP_DOCUMENTS_ACCESS_DESC="Allows the users in this group to access access help documents" COM_COMPONENTBUILDER_HELP_DOCUMENTS_BATCH_USE="Help Documents Batch Use" @@ -657,6 +661,10 @@ COM_COMPONENTBUILDER_SNIPPETS_IMPORT="Snippets Import" COM_COMPONENTBUILDER_SNIPPETS_IMPORT_DESC="Allows the users in this group to import import snippets" COM_COMPONENTBUILDER_SNIPPETS_SUBMENU="Snippets Submenu" COM_COMPONENTBUILDER_SNIPPETS_SUBMENU_DESC="Allows the users in this group to update the submenu of the snippet" +COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS="Snippet Get Snippets Button Access" +COM_COMPONENTBUILDER_SNIPPET_GET_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the get snippets button." +COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS="Snippet Share Snippets Button Access" +COM_COMPONENTBUILDER_SNIPPET_SHARE_SNIPPETS_BUTTON_ACCESS_DESC=" Allows the users in this group to access the share snippets button." COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS="Snippet Types Access" COM_COMPONENTBUILDER_SNIPPET_TYPES_ACCESS_DESC="Allows the users in this group to access access snippet types" COM_COMPONENTBUILDER_SNIPPET_TYPES_BATCH_USE="Snippet Types Batch Use" diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 8411fad7a..54e23575a 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1711,20 +1711,22 @@ class ComponentbuilderModelAjax extends JModelList // Create a new query object. $query = $db->getQuery(true); - $query->select($db->quoteName(array('name', 'heading', 'usage', 'description', 'type', 'snippet', 'url'))); - $query->from($db->quoteName('#__componentbuilder_snippet')); - $query->where($db->quoteName('published') . ' = 1'); - $query->where($db->quoteName('id') . ' = '. (int) $id); + $query->select($db->quoteName(array('a.name', 'a.heading', 'a.usage', 'a.description', 'b.name', 'a.snippet', 'a.url', 'c.name'), array('name', 'heading', 'usage', 'description', 'type', 'snippet', 'url', 'library'))); + $query->from($db->quoteName('#__componentbuilder_snippet', 'a')); + // From the componentbuilder_snippet_type table. + $query->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')'); + // From the componentbuilder_library table. + $query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')'); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->where($db->quoteName('a.id') . ' = '. (int) $id); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); if ($db->getNumRows()) { - $model = ComponentbuilderHelper::getModel('snippets'); $snippet = $db->loadObject(); - $snippet->type = JText::_($model->selectionTranslation($snippet->type,'type')); - $snippet->snippet = base64_decode($snippet->snippet); + $snippet->snippet = base64_decode($snippet->snippet); // return found snippet settings return $snippet; } diff --git a/admin/models/fields/snippets.php b/admin/models/fields/snippets.php index 83e5ba4a1..e0495c20d 100644 --- a/admin/models/fields/snippets.php +++ b/admin/models/fields/snippets.php @@ -151,21 +151,25 @@ class JFormFieldSnippets extends JFormFieldList { $db = JFactory::getDBO(); $query = $db->getQuery(true); - $query->select($db->quoteName(array('a.id','a.name','a.type'),array('id','snippet_name','type'))); - $query->from($db->quoteName('#__componentbuilder_snippet', 'a')); - $query->where($db->quoteName('a.published') . ' = 1'); -$query->order('a.name ASC'); + $query->select($db->quoteName(array('a.id','a.name','b.name','c.name'),array('id','snippet_name','type','library'))); + $query->from($db->quoteName('#__componentbuilder_snippet', 'a')); + // From the componentbuilder_snippet_type table. + $query->join('LEFT', $db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')'); + // From the componentbuilder_library table. + $query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')'); + $query->where($db->quoteName('a.published') . ' >= 1'); + $query->order('c.ordering ASC'); + $query->order('b.name ASC'); $db->setQuery((string)$query); $items = $db->loadObjectList(); $options = array(); if ($items) { $options[] = JHtml::_('select.option', '', 'Select an option'); - $model = ComponentbuilderHelper::getModel('snippets'); foreach($items as $item) { - $type = $model->selectionTranslation($item->type,'type'); - $options[] = JHtml::_('select.option', $item->id, $item->snippet_name . ' (' . JText::_($type) . ')' ); + $lib = (ComponentbuilderHelper::checkString($item->library)) ? ' (' . $item->library . ')' :''; + $options[] = JHtml::_('select.option', $item->id, $item->type . ' - ' . $item->snippet_name . $lib ); } } return $options; diff --git a/admin/models/forms/custom_admin_view.js b/admin/models/forms/custom_admin_view.js index ce22acbfd..336263547 100644 --- a/admin/models/forms/custom_admin_view.js +++ b/admin/models/forms/custom_admin_view.js @@ -385,11 +385,14 @@ function getSnippetDetails(id){ getSnippetDetails_server(id).done(function(result) { if(result.snippet){ var description = ''; - if (result.description.length > 0) - { + if (result.description.length > 0) { description = '

'+result.description+'

'; } - var code = '
'+result.name+' ('+result.type+') see more details
'+result.heading+'
'; + var library = ''; + if (result.library.length > 0) { + library = ' ('+result.library+')'; + } + var code = '
'+result.name+' ('+result.type+') see more details'+library+'
'+result.heading+'
'; jQuery('#snippet-code').remove(); jQuery('.snippet-code').append(code); // make sure the code block is active diff --git a/admin/models/forms/joomla_component.xml b/admin/models/forms/joomla_component.xml index 7e4facbc5..7b16b3087 100644 --- a/admin/models/forms/joomla_component.xml +++ b/admin/models/forms/joomla_component.xml @@ -739,13 +739,13 @@ default="0"> + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_DO_NOT_ADD + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_BOTH_VTWO_AMP_VTHREE + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTWO + COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_UIKIT_VTHREE
diff --git a/admin/models/forms/layout.js b/admin/models/forms/layout.js index 076b9630a..8a7604d6e 100644 --- a/admin/models/forms/layout.js +++ b/admin/models/forms/layout.js @@ -118,11 +118,14 @@ function getSnippetDetails(id){ getSnippetDetails_server(id).done(function(result) { if(result.snippet){ var description = ''; - if (result.description.length > 0) - { + if (result.description.length > 0) { description = '

'+result.description+'

'; } - var code = '
'+result.name+' ('+result.type+') see more details
'+result.heading+'
'; + var library = ''; + if (result.library.length > 0) { + library = ' ('+result.library+')'; + } + var code = '
'+result.name+' ('+result.type+') see more details'+library+'
'+result.heading+'
'; jQuery('#snippet-code').remove(); jQuery('.snippet-code').append(code); // make sure the code block is active diff --git a/admin/models/forms/site_view.js b/admin/models/forms/site_view.js index d4a11baed..7bb7893ca 100644 --- a/admin/models/forms/site_view.js +++ b/admin/models/forms/site_view.js @@ -463,11 +463,14 @@ function getSnippetDetails(id){ getSnippetDetails_server(id).done(function(result) { if(result.snippet){ var description = ''; - if (result.description.length > 0) - { + if (result.description.length > 0) { description = '

'+result.description+'

'; } - var code = '
'+result.name+' ('+result.type+') see more details
'+result.heading+'
'; + var library = ''; + if (result.library.length > 0) { + library = ' ('+result.library+')'; + } + var code = '
'+result.name+' ('+result.type+') see more details'+library+'
'+result.heading+'
'; jQuery('#snippet-code').remove(); jQuery('.snippet-code').append(code); // make sure the code block is active diff --git a/admin/models/forms/template.js b/admin/models/forms/template.js index ef677b547..be8159832 100644 --- a/admin/models/forms/template.js +++ b/admin/models/forms/template.js @@ -118,11 +118,14 @@ function getSnippetDetails(id){ getSnippetDetails_server(id).done(function(result) { if(result.snippet){ var description = ''; - if (result.description.length > 0) - { + if (result.description.length > 0) { description = '

'+result.description+'

'; } - var code = '
'+result.name+' ('+result.type+') see more details
'+result.heading+'
'; + var library = ''; + if (result.library.length > 0) { + library = ' ('+result.library+')'; + } + var code = '
'+result.name+' ('+result.type+') see more details'+library+'
'+result.heading+'
'; jQuery('#snippet-code').remove(); jQuery('.snippet-code').append(code); // make sure the code block is active diff --git a/admin/models/get_snippets.php b/admin/models/get_snippets.php new file mode 100644 index 000000000..94c43d24e --- /dev/null +++ b/admin/models/get_snippets.php @@ -0,0 +1,150 @@ + + @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'); + +// import the Joomla modellist library +jimport('joomla.application.component.modellist'); + +/** + * Componentbuilder Model for Get_snippets + */ +class ComponentbuilderModelGet_snippets extends JModelList +{ + /** + * Model user data. + * + * @var strings + */ + protected $user; + protected $userId; + protected $guest; + protected $groups; + protected $levels; + protected $app; + protected $input; + protected $uikitComp; + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Get the current user for authorisation checks + $this->user = JFactory::getUser(); + $this->userId = $this->user->get('id'); + $this->guest = $this->user->get('guest'); + $this->groups = $this->user->get('groups'); + $this->authorisedGroups = $this->user->getAuthorisedGroups(); + $this->levels = $this->user->getAuthorisedViewLevels(); + $this->app = JFactory::getApplication(); + $this->input = $this->app->input; + $this->initSet = true; + // Make sure all records load, since no pagination allowed. + $this->setState('list.limit', 0); + // Get a db connection. + $db = JFactory::getDbo(); + + // Create a new query object. + $query = $db->getQuery(true); + + // Get from #__componentbuilder_snippet as a + $query->select($db->quoteName( + array('a.id','a.heading','a.name','a.url','a.created','a.modified'), + array('id','heading','name','url','created','modified'))); + $query->from($db->quoteName('#__componentbuilder_snippet', 'a')); + + // Get from #__componentbuilder_snippet_type as b + $query->select($db->quoteName( + array('b.name'), + array('type'))); + $query->join('LEFT', ($db->quoteName('#__componentbuilder_snippet_type', 'b')) . ' ON (' . $db->quoteName('a.type') . ' = ' . $db->quoteName('b.id') . ')'); + + // Get from #__componentbuilder_library as c + $query->select($db->quoteName( + array('c.name'), + array('library'))); + $query->join('LEFT', ($db->quoteName('#__componentbuilder_library', 'c')) . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('c.id') . ')'); + + // return the query object + return $query; + } + + /** + * Method to get an array of data items. + * + * @return mixed An array of data items on success, false on failure. + */ + public function getItems() + { + $user = JFactory::getUser(); + // check if this user has permission to access items + if (!$user->authorise('get_snippets.access', 'com_componentbuilder')) + { + $app = JFactory::getApplication(); + $app->enqueueMessage(JText::_('Not authorised!'), 'error'); + // redirect away if not a correct (TODO for now we go to default view) + $app->redirect('index.php?option=com_componentbuilder'); + return false; + } + // load parent items + $items = parent::getItems(); + + // Get the global params + $globalParams = JComponentHelper::getParams('com_componentbuilder', true); + + // Convert the parameter fields into objects. + if (ComponentbuilderHelper::checkArray($items)) + { + foreach ($items as $nr => &$item) + { + // Always create a slug for sef URL's + $item->slug = (isset($item->alias) && isset($item->id)) ? $item->id.':'.$item->alias : $item->id; + } + } + + // return items + return $items; + } + + + /** + * Get the uikit needed components + * + * @return mixed An array of objects on success. + * + */ + public function getUikitComp() + { + if (isset($this->uikitComp) && ComponentbuilderHelper::checkArray($this->uikitComp)) + { + return $this->uikitComp; + } + return false; + } +} diff --git a/admin/models/snippets.php b/admin/models/snippets.php index 8c2b8ff11..f69019804 100644 --- a/admin/models/snippets.php +++ b/admin/models/snippets.php @@ -53,6 +53,120 @@ class ComponentbuilderModelSnippets extends JModelList } parent::__construct($config); + } + + public $user; + + /** + * Method to build the export package + * + * @return bool on success. + */ + public function shareSnippets($pks) + { + // setup the query + if (ComponentbuilderHelper::checkArray($pks)) + { + // Get the user object. + if (!ComponentbuilderHelper::checkObject($this->user)) + { + $this->user = JFactory::getUser(); + } + // Create a new query object. + if (!ComponentbuilderHelper::checkObject($this->_db)) + { + $this->_db = JFactory::getDBO(); + } + $query = $this->_db->getQuery(true); + + // Select some fields + $query->select($this->_db->quoteName( + array('a.name','a.heading','a.description','a.usage','a.snippet','a.url','b.name','c.name','a.created','a.modified'), + array('name','heading','description','usage','snippet','url','type','library','created','modified') + )); + + // From the componentbuilder_snippet table + $query->from($this->_db->quoteName('#__componentbuilder_snippet', 'a')); + // From the componentbuilder_snippet_type table. + $query->join('LEFT', $this->_db->quoteName('#__componentbuilder_snippet_type', 'b') . ' ON (' . $this->_db->quoteName('a.type') . ' = ' . $this->_db->quoteName('b.id') . ')'); + // From the componentbuilder_library table. + $query->join('LEFT', $this->_db->quoteName('#__componentbuilder_library', 'c') . ' ON (' . $this->_db->quoteName('a.library') . ' = ' . $this->_db->quoteName('c.id') . ')'); + $query->where('a.id IN (' . implode(',',$pks) . ')'); + + // Implement View Level Access + if (!$this->user->authorise('core.options', 'com_componentbuilder')) + { + $groups = implode(',', $this->user->getAuthorisedViewLevels()); + $query->where('a.access IN (' . $groups . ')'); + } + + // Order the results by ordering + $query->order('a.ordering ASC'); + + // Load the items + $this->_db->setQuery($query); + $this->_db->execute(); + if ($this->_db->getNumRows()) + { + // load the items from db + $items = $this->_db->loadObjectList(); + // check if we have items + if (ComponentbuilderHelper::checkArray($items)) + { + // get the shared paths + $this->fullPath = rtrim(ComponentbuilderHelper::getFolderPath('path', 'sharepath', JFactory::getConfig()->get('tmp_path')), '/') . '/snippets'; + // remove old folder with the same name + if (JFolder::exists($this->fullPath)) + { + // remove if old folder is found + ComponentbuilderHelper::removeFolder($this->fullPath); + } + // create the full path + JFolder::create($this->fullPath); + // set zip path + $this->zipPath = $this->fullPath .'.zip'; + // remove old zip files with the same name + if (JFile::exists($this->zipPath)) + { + // remove file if found + JFile::delete($this->zipPath); + } + // set params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // Set the person sharing information (default VDM ;) + $info = array(); + $info['company'] = $this->params->get('export_company', 'Vast Development Method'); + $info['owner'] = $this->params->get('export_owner', 'Llewellyn van der Merwe'); + $info['email'] = $this->params->get('export_email', 'joomla@vdm.io'); + $info['website'] = $this->params->get('export_website', 'https://www.vdm.io/'); + // prep the item + foreach($items as $item) + { + // just unlock the snippet + $item->snippet = base64_decode($item->snippet); + // load the company detail to each snippet + $item->contributor_company = $info['company']; + $item->contributor_name = $info['owner']; + $item->contributor_email = $info['email']; + $item->contributor_website = $info['website']; + // now store the snippet info + ComponentbuilderHelper::writeFile($this->fullPath . '/' .ComponentbuilderHelper::safeString($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json', json_encode($item, JSON_PRETTY_PRINT)); + } + // zip the folder + if (!ComponentbuilderHelper::zip($this->fullPath, $this->zipPath)) + { + return false; + } + // remove the folder + if (!ComponentbuilderHelper::removeFolder($this->fullPath)) + { + return false; + } + return true; + } + } + } + return false; } /** diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 31017c7e6..1fe60c526 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -1299,7 +1299,7 @@ INSERT INTO `#__componentbuilder_field` (`id`, `add_css_view`, `add_css_views`, INSERT INTO `#__componentbuilder_fieldtype` (`id`, `catid`, `description`, `name`, `properties`, `short_description`, `params`, `published`, `version`, `hits`, `ordering`) VALUES (1, '', 'The calendar form field type provides a text box for entry of a date. An icon next to the text box provides a link to a pop-up calendar, which can also be used to enter the date value. If the field has a saved value this is shown in the text box. Otherwis', 'Calendar', '{\"properties0\":{\"name\":\"type\",\"example\":\"calendar\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be calendar.\"},\"properties1\":{\"name\":\"name\",\"example\":\"date\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the field.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a date\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"default\",\"example\":\"NOW\",\"adjustable\":\"1\",\"description\":\"(optional) is the default date. This must be given in the same format as specified by the format argument. You can put \\\"NOW\\\" to have current time.\"},\"properties4\":{\"name\":\"description\",\"example\":\"\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the text box.\"},\"properties5\":{\"name\":\"readonly\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is whether the text box is read-only (true or false). If the text box is read-only, the date cannot be changed, but can be selected and copied. No calendar icon will be shown.\"},\"properties6\":{\"name\":\"disabled\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is whether the text box is disabled (true or false). If the text box is disabled, the date cannot be changed, selected or copied.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field.\"},\"properties8\":{\"name\":\"format\",\"example\":\"%d-%m-%Y\",\"adjustable\":\"1\",\"description\":\"(optional) is the date format to be used. This is in the format used by PHP to specify date string formats (see below). If no format argument is given, \'%Y-%m-%d\' is assumed (giving dates like \'2008-04-16\').\"},\"properties9\":{\"name\":\"filter\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is time zone to be used. There are two values; server_utc and user_utc. The first one is server time zone and the later is user time zone as configured in global configuration and user information respectively.\"},\"properties10\":{\"name\":\"size\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional)\"},\"properties11\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"},\"properties22\":{\"name\":\"translateformat\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): If set to true, the calendar will use a language string to determine the format. The `format` attribute is ignored. If false, the `format` attribute is used (same behaviour as today). (starting with 3.7.0)\"},\"properties13\":{\"name\":\"showtime\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): If set to true and translateformat is true, the language key DATE_FORMAT_CALENDAR_DATETIME is used, otherwise DATE_FORMAT_CALENDAR_DATE. (starting with 3.7.0)\"},\"properties14\":{\"name\":\"timeformat\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): can be set to 12 (and specify AM or PM) or 24 (starting with 3.7.0)\"},\"properties15\":{\"name\":\"singleheader\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): if set to false, the year and the month selection will be set on two separates lines, with independant selection (starting with 3.7.0)\"},\"properties16\":{\"name\":\"todaybutton\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): if set to true, a button is added at the bottom of the datePicker to select the date of the current day (starting with 3.7.0)\"},\"properties17\":{\"name\":\"weeknumbers\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): if set to true, a column is added at the left of the datePicker to display the number of the week in the current year (starting with 3.7.0)\"},\"properties18\":{\"name\":\"filltable\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): if set to true, dates of the previous and next month is added at the top and the bottom of the current month to fill the grid (starting with 3.7.0)\"},\"properties19\":{\"name\":\"minyear\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative lower limit for the year selection. The user could not select a year before your limit (starting with 3.7.0)\"},\"properties20\":{\"name\":\"maxyear\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional): set a signed integer for a number of years (-10, -2, 0, 7, 12, ...) to define the relative upper limit for the year selection. The user could not select a year after your limit (starting with 3.7.0)\"}}', 'provides a text box for entry of a date. An icon next to the text box provides a link to a pop-up calendar, which can also be used to enter the date value.', '', 1, 5, '', ''), -(2, '', 'The category form field type provides a drop down list of all published categories for a certain extension. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. If the show_root', 'Category', '{\"properties0\":{\"name\":\"type\",\"example\":\"category\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be category.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mycategory\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a category\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"extension\",\"example\":\"com_content\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the name of the extension for which the categories will be retrieved. For example, to list content categories, use the value \'com_content\'. You can add also target one view, use the value \'com_component.view\'.\"},\"properties4\":{\"name\":\"scope\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is an alias for extension.\"},\"properties5\":{\"name\":\"required\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"show_root\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether a choice representing the root category will be shown.\"},\"properties7\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default category ID number.\"},\"properties8\":{\"name\":\"description\",\"example\":\"select one of the following categories\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties9\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties10\":{\"name\":\"published\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) (true\\/false) is whether the drop down will show only published or unpublished categories.\"},\"properties11\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a drop down list of categories for an extension.', '', 1, 5, '', ''), +(2, '', 'The category form field type provides a drop down list of all published categories for a certain extension. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected. If the show_root', 'Category', '{\"properties0\":{\"name\":\"type\",\"example\":\"category\",\"mandatory\":\"1\",\"description\":\"(mandatory) must be category.\"},\"properties1\":{\"name\":\"name\",\"example\":\"mycategory\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select a category\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"extension\",\"example\":\"com_content\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"description\":\"(mandatory) is the name of the extension for which the categories will be retrieved. For example, to list content categories, use the value \'com_content\'. You can add also target one view, use the value \'com_component.view\'.\"},\"properties4\":{\"name\":\"scope\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is an alias for extension.\"},\"properties5\":{\"name\":\"required\",\"example\":\"true\",\"adjustable\":\"1\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"show_root\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether a choice representing the root category will be shown.\"},\"properties7\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) is the default category ID number.\"},\"properties8\":{\"name\":\"description\",\"example\":\"select one of the following categories\",\"adjustable\":\"1\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.\"},\"properties9\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties10\":{\"name\":\"published\",\"example\":\"1\",\"adjustable\":\"1\",\"description\":\"(optional) (1\\/0\\/2\\/-2) is whether the drop down will show only published (1), unpublished (0), archived (2) or trashed (-2) categories. It is possible to combine different publishing status by entering the list of the corresponding numbers separated by comma (e.g. \\\"0,2,-2\\\" will display only unpublished, archived and trashed categories in the drop-down).\"},\"properties11\":{\"name\":\"multiple\",\"example\":\"false\",\"adjustable\":\"1\",\"description\":\"(optional) is whether multiple items can be selected at the same time (true or false).\"},\"properties12\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a drop down list of categories for an extension.', '', 1, 6, '', ''), (3, '', 'The checkbox form field type provides a single checkbox. If the parameter has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.', 'Checkbox', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkbox\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be checkbox\"},\"properties1\":{\"name\":\"name\",\"example\":\"show_title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Show title\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"value\",\"example\":\"1\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the value of the parameter if this checkbox is set (usually 1).\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default value (usually 0 or 1).\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"description\",\"example\":\"Show the title of the item\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties7\":{\"name\":\"class\",\"example\":\"inputbox\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a single checkbox to be checked or unchecked', '', 1, 2, '', ''), (4, '', 'The checkboxes form field type provides a set of checkboxes. Note: unlike most standard form field types, such as textfield or checkbox, this field is not an \"out of the box\" solution. It will create checkboxes for you, and submit their values in form of ', 'Checkboxes', '{\"properties0\":{\"name\":\"type\",\"example\":\"checkboxes\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be checkboxs\"},\"properties1\":{\"name\":\"name\",\"example\":\"toppings\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"label\",\"example\":\"Select Toppings\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is the descriptive title of the field.\"},\"properties3\":{\"name\":\"option\",\"example\":\"anch|Anchovies,chor|Chorizo,on|Onions,mush|Mushrooms\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) set the options of this radio. Separate options with commas and use the pipe symbol to separate value from text.\"},\"properties4\":{\"name\":\"default\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is the default value.\"},\"properties5\":{\"name\":\"description\",\"example\":\"Select the topping of your choice\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the label.\"},\"properties6\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties7\":{\"name\":\"class\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) is a CSS class name for the HTML form field. If omitted this will default to \'inputbox\'.\"},\"properties8\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides unlimited checkboxes that can be used for multi-select.', '', 1, 2, '', ''), (5, '', 'Provides a color picker. Enter the color as #ff00ff or pick it from the palet.', 'Color', '{\"properties0\":{\"name\":\"type\",\"example\":\"color\",\"adjustable\":\"0\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) must be color.\"},\"properties1\":{\"name\":\"name\",\"example\":\"backgroundcolor\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"0\",\"description\":\"(mandatory) is the unique name of the parameter.\"},\"properties2\":{\"name\":\"default\",\"example\":\"#FFFFFF\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) provides a color when not set.\"},\"properties3\":{\"name\":\"label\",\"example\":\"Background\",\"adjustable\":\"1\",\"mandatory\":\"1\",\"translatable\":\"1\",\"description\":\"(mandatory) (translatable) is the descriptive title of the field.\"},\"properties4\":{\"name\":\"description\",\"example\":\"Select the background color here.\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"1\",\"description\":\"(optional) (translatable) tooltip for the form field.\"},\"properties5\":{\"name\":\"required\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) The field must be filled before submitting the form.\"},\"properties6\":{\"name\":\"showon\",\"example\":\"\",\"adjustable\":\"1\",\"mandatory\":\"0\",\"translatable\":\"0\",\"description\":\"(optional) show this field on the bases of the value in another field.\"}}', 'provides a color picker when clicking the input box.', '', 1, 2, '', ''), diff --git a/admin/views/dynamic_get/tmpl/edit.php b/admin/views/dynamic_get/tmpl/edit.php index 420f5d2e5..5b55889e4 100644 --- a/admin/views/dynamic_get/tmpl/edit.php +++ b/admin/views/dynamic_get/tmpl/edit.php @@ -587,7 +587,7 @@ jQuery(document).ready(function(){ var groupName = jQuery(row).data('group'); var fieldName = groupName.replace('join_', '').replace('_table', '').replace(/([0-9])/g, ''); var fieldNr = groupName.replace(/([A-z_])/g, ''); - updateSubItems(fieldName, fieldNr, '', ''); + updateSubItems(fieldName, fieldNr, '_', '_'); }); }); diff --git a/admin/views/get_snippets/index.html b/admin/views/get_snippets/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/get_snippets/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/get_snippets/tmpl/default.php b/admin/views/get_snippets/tmpl/default.php new file mode 100644 index 000000000..19f5ddd98 --- /dev/null +++ b/admin/views/get_snippets/tmpl/default.php @@ -0,0 +1,107 @@ + + @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'); + +JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html'); +JHtml::_('behavior.tooltip'); +JHtml::_('behavior.formvalidation'); +JHtml::_('formbehavior.chosen', 'select'); +JHtml::_('behavior.keepalive'); +?> +canDo->get('get_snippets.access')): ?> + +
+ + +
+
+


+

..

+
+ +
+
+
    +
  • +
  • +
  • +
  • +
  • +
  • +
+
+
+ + +

+ diff --git a/admin/views/get_snippets/tmpl/index.html b/admin/views/get_snippets/tmpl/index.html new file mode 100644 index 000000000..fa6d84e80 --- /dev/null +++ b/admin/views/get_snippets/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/admin/views/get_snippets/view.html.php b/admin/views/get_snippets/view.html.php new file mode 100644 index 000000000..ac8eb5b2a --- /dev/null +++ b/admin/views/get_snippets/view.html.php @@ -0,0 +1,400 @@ + + @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'); + +// import Joomla view library +jimport('joomla.application.component.view'); + +/** + * Componentbuilder View class for the Get_snippets + */ +class ComponentbuilderViewGet_snippets extends JViewLegacy +{ + // Overwriting JView display method + function display($tpl = null) + { + // get component params + $this->params = JComponentHelper::getParams('com_componentbuilder'); + // get the application + $this->app = JFactory::getApplication(); + // get the user object + $this->user = JFactory::getUser(); + // get global action permissions + $this->canDo = ComponentbuilderHelper::getActions('get_snippets'); + // Initialise variables. + $this->items = $this->get('Items'); + + // We don't need toolbar in the modal window. + if ($this->getLayout() !== 'modal') + { + // add the tool bar + $this->addToolBar(); + } + + // set the document + $this->setDocument(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new Exception(implode("\n", $errors), 500); + } + + parent::display($tpl); + } + + /** + * Prepares the document + */ + protected function setDocument() + { + + // always make sure jquery is loaded. + JHtml::_('jquery.framework'); + // Load the header checker class. + require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' ); + // Initialize the header checker. + $HeaderCheck = new componentbuilderHeaderCheck; + + // Load uikit options. + $uikit = $this->params->get('uikit_load'); + // Set script size. + $size = $this->params->get('uikit_min'); + // Set css style. + $style = $this->params->get('uikit_style'); + + // The uikit css. + if ((!$HeaderCheck->css_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) + { + $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit/css/uikit'.$style.$size.'.css'); + } + // The uikit js. + if ((!$HeaderCheck->js_loaded('uikit.min') || $uikit == 1) && $uikit != 2 && $uikit != 3) + { + $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit/js/uikit'.$size.'.js'); + } + + // Load the script to find all uikit components needed. + if ($uikit != 2) + { + // Set the default uikit components in this view. + $uikitComp = array(); + $uikitComp[] = 'data-uk-grid'; + } + + // Load the needed uikit components in this view. + if ($uikit != 2 && isset($uikitComp) && ComponentbuilderHelper::checkArray($uikitComp)) + { + // load just in case. + jimport('joomla.filesystem.file'); + // loading... + foreach ($uikitComp as $class) + { + foreach (ComponentbuilderHelper::$uk_components[$class] as $name) + { + // check if the CSS file exists. + if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit/css/components/'.$name.$style.$size.'.css')) + { + // load the css. + $this->document->addStyleSheet(JURI::root(true) .'/media/com_componentbuilder/uikit/css/components/'.$name.$style.$size.'.css'); + } + // check if the JavaScript file exists. + if (JFile::exists(JPATH_ROOT.'/media/com_componentbuilder/uikit/js/components/'.$name.$size.'.js')) + { + // load the js. + $this->document->addScript(JURI::root(true) .'/media/com_componentbuilder/uikit/js/components/'.$name.$size.'.js', 'text/javascript', true); + } + } + } + } + // load the local snippets + if (ComponentbuilderHelper::checkArray($this->items)) + { + $local_snippets = array(); + foreach ($this->items as $item) + { + $path = ComponentbuilderHelper::safeString($item->library . ' - (' . $item->type . ') ' . $item->name, 'filename', '', false). '.json'; + $local_snippets[$path] = $item; + } + } + // 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'); + // 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; + } + // token + $this->document->addScriptDeclaration("var token = '". JSession::getFormToken() ."';"); + // set an error message if needed + $this->document->addScriptDeclaration("var returnError = '

".JText::_('COM_COMPONENTBUILDER_AN_ERROR_HAS_OCCURRED')."!

".JText::_('COM_COMPONENTBUILDER_PLEASE_TRY_AGAIN_LATER').".

';"); + // Set the Time To Live To JavaScript + $this->document->addScriptDeclaration("var expire = ". (int) $expire.";"); + // load the local snippets + if (ComponentbuilderHelper::checkArray($this->items)) + { + // Set the local snippets array + $this->document->addScriptDeclaration("var local_snippets = ". json_encode($local_snippets).";"); + } + // add the document default css file + $this->document->addStyleSheet(JURI::root(true) .'/administrator/components/com_componentbuilder/assets/css/get_snippets.css'); + // Set the Custom JS script to view + $this->document->addScriptDeclaration(" + // start the moment the document is ready + jQuery(document).ready(function () { + getSnippets('https://api.github.com/repos/vdm-io/Joomla-Component-Builder-Snippets/git/trees/master'); + }); + jQuery(document).ready(function(){ + jQuery('body').on('click','.getmodal',function(){ + // Ajax request + var btn = jQuery(this); + btn.prop('disabled', true); + setTimeout(function(){ + btn.prop('disabled', false); + }, 3000); + var path = btn.data('path'); + var type = btn.data('type'); + getSnippetModal(path, type); + }); + }); + // load every thing once ready + jQuery(document).ajaxStop(function () { + if (0 === jQuery.active) { + setTimeout( function() { + //do something special + jQuery('#snippets-github').html('

Snippets

'); + jQuery('#snippets-display').show(); + jQuery('#snippets-grid').trigger('display.uk.check'); + }, 1000); + } + }); + + // get unix time stamp + function unixTimeStamp(_theDate) { + // check if JCB already has this snippet + var aDate = new Date(_theDate); + return Math.round(aDate.getTime()/1000); + } + + // set the snippet status + function getSnippetStatus(snippet, key) { + // check if JCB already has this snippet + if(local_snippets.hasOwnProperty(key)){ + // first get local time stamp + var local_created = unixTimeStamp(local_snippets[key].created); + var local_modified = unixTimeStamp(local_snippets[key].modified); + // now get github time stamps + var created = unixTimeStamp(snippet.created); + var modified = unixTimeStamp(snippet.modified); + // work out the status + if (local_created == created) { + if (local_modified == modified) { + return 'equal'; + } else if (local_modified > modified) { + return 'behind'; + } else if (local_modified < modified) { + return 'ahead'; + } + } + return 'diverged'; + } + return 'new'; + } + + // get the snippets + function getSnippets(path) { + var _paths = jQuery.jStorage.get('JCB-Snippets-Paths', null); + if (_paths) { + setSnippets(_paths); + jQuery('#snippets-github').html('

Snippets

'); + jQuery('#snippets-display').show(); + } else { + jQuery.get(path) + .success(function(paths) { + jQuery.jStorage.set('JCB-Snippets-Paths', paths, {TTL: expire}); + setSnippets(paths); + }) + .error(function(jqXHR, textStatus, errorThrown) { + jQuery('#snippets-github').html(returnError); + }); + } + } + + // set the snippets + function setSnippets(paths) { + jQuery.each(paths.tree, function(key,value){ + if (value.path.indexOf('.json') >= 0) { + var _snippet = jQuery.jStorage.get(value.path, null); + if (_snippet) { + setSnippet(_snippet, value.path); + jQuery('#snippets-grid').trigger('display.uk.check'); + } else { + jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+value.path) + .success(function(snippet) { + // convert the string to json.object + snippet = jQuery.parseJSON(snippet); + jQuery.jStorage.set(value.path, snippet, {TTL: expire}); + setSnippet(snippet, value.path); + }) + .error(function(jqXHR, textStatus, errorThrown) { + // we could do more + }); + } + } + }); + } + + // set the snippets + function setSnippet(snippet, key) { + // get the status + var status = getSnippetStatus(snippet, key); + // build the snippet display + var html = '
'; + html += '
'; + html += '
'+status+'

'; + html += '

' + snippet.library+ ' - (' + snippet.type + ') ' + snippet.name + '

'; + html += snippet.heading + '
'; + html += '
'; + html += ''; + html += ''; + html += ''; + html += '
'; + html += ''; + html += '
'; + html += '
'; + // now we have the snippet + jQuery('#snippets-grid').append(html); + } + + // set the modal + function getSnippetModal(key, type) { + var _snippet = jQuery.jStorage.get(key, null); + if (_snippet) { + // show modal + showSnippetModal(_snippet, type); + } else { + jQuery.get('https://raw.githubusercontent.com/vdm-io/Joomla-Component-Builder-Snippets/master/'+key) + .success(function(snippet) { + // convert the string to json.object + snippet = jQuery.parseJSON(snippet); + jQuery.jStorage.set(key, snippet, {TTL: expire}); + // show modal + showSnippetModal(snippet, type); + }) + .error(function(jqXHR, textStatus, errorThrown) { + // we could do more + }); + } + } + + // show the modal + function showSnippetModal(snippet, type) { + var html = '
'; + html += ''; + html += '

' + snippet.library + ' - (' + snippet.type + ') ' + snippet.name + '

'; + html += '
'; + html += '
C: ' + snippet.created + ' | M: ' + snippet.modified + ''; + html += '
'; + // add html to modal + var modal = UIkit.modal.blockUI(html); + // show modal + modal.show(); + } + "); + } + + /** + * Setting the toolbar + */ + protected function addToolBar() + { + // hide the main menu + $this->app->input->set('hidemainmenu', true); + // add title to the page + JToolbarHelper::title(JText::_('COM_COMPONENTBUILDER_GET_SNIPPETS'),'search'); + // add the back button + // JToolBarHelper::custom('get_snippets.back', 'undo-2', '', 'COM_COMPONENTBUILDER_BACK', false); + // add cpanel button + JToolBarHelper::custom('get_snippets.dashboard', 'grid-2', '', 'COM_COMPONENTBUILDER_DASH', false); + if ($this->canDo->get('get_snippets.snippets')) + { + // add Snippets button. + JToolBarHelper::custom('get_snippets.openSnippets', 'pin', '', 'COM_COMPONENTBUILDER_SNIPPETS', false); + } + + // set help url for this view if found + $help_url = ComponentbuilderHelper::getHelpUrl('get_snippets'); + if (ComponentbuilderHelper::checkString($help_url)) + { + JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url); + } + + // add the options comp button + if ($this->canDo->get('core.admin') || $this->canDo->get('core.options')) + { + JToolBarHelper::preferences('com_componentbuilder'); + } + } + + /** + * Escapes a value for output in a view script. + * + * @param mixed $var The output to escape. + * + * @return mixed The escaped value. + */ + public function escape($var) + { + // use the helper htmlEscape method instead. + return ComponentbuilderHelper::htmlEscape($var, $this->_charset); + } +} diff --git a/admin/views/snippets/view.html.php b/admin/views/snippets/view.html.php index ddab29ad0..f1ac7ab98 100644 --- a/admin/views/snippets/view.html.php +++ b/admin/views/snippets/view.html.php @@ -133,7 +133,12 @@ class ComponentbuilderViewSnippets extends JViewLegacy // add the button to the page $dhtml = $layout->render(array('title' => $title)); $bar->appendButton('Custom', $dhtml, 'batch'); - } + } + if ($this->user->authorise('snippet.share_snippets', 'com_componentbuilder')) + { + // add Share Snippets button. + JToolBarHelper::custom('snippets.shareSnippets', 'share', '', 'COM_COMPONENTBUILDER_SHARE_SNIPPETS', false); + } if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete)) { @@ -148,7 +153,12 @@ class ComponentbuilderViewSnippets extends JViewLegacy { JToolBarHelper::custom('snippets.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true); } - } + } + if ($this->user->authorise('snippet.get_snippets', 'com_componentbuilder')) + { + // add Get Snippets button. + JToolBarHelper::custom('snippets.getSnippets', 'search', '', 'COM_COMPONENTBUILDER_GET_SNIPPETS', false); + } if ($this->canDo->get('core.import') && $this->canDo->get('snippet.import')) { diff --git a/componentbuilder.xml b/componentbuilder.xml index f14da502d..aac434d2e 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 12th November, 2017 + 16th November, 2017 Llewellyn van der Merwe joomla@vdm.io http://vdm.bz/component-builder diff --git a/media/js/jquery.json.min.js b/media/js/jquery.json.min.js new file mode 100644 index 000000000..74e44f74e --- /dev/null +++ b/media/js/jquery.json.min.js @@ -0,0 +1,2 @@ +/*! jQuery JSON plugin v2.5.1 */ +!function($){"use strict";var escape=/["\\\x00-\x1f\x7f-\x9f]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},hasOwn=Object.prototype.hasOwnProperty;$.toJSON="object"==typeof JSON&&JSON.stringify?JSON.stringify:function(a){if(null===a)return"null";var b,c,d,e,f=$.type(a);if("undefined"===f)return void 0;if("number"===f||"boolean"===f)return String(a);if("string"===f)return $.quoteString(a);if("function"==typeof a.toJSON)return $.toJSON(a.toJSON());if("date"===f){var g=a.getUTCMonth()+1,h=a.getUTCDate(),i=a.getUTCFullYear(),j=a.getUTCHours(),k=a.getUTCMinutes(),l=a.getUTCSeconds(),m=a.getUTCMilliseconds();return 10>g&&(g="0"+g),10>h&&(h="0"+h),10>j&&(j="0"+j),10>k&&(k="0"+k),10>l&&(l="0"+l),100>m&&(m="0"+m),10>m&&(m="0"+m),'"'+i+"-"+g+"-"+h+"T"+j+":"+k+":"+l+"."+m+'Z"'}if(b=[],$.isArray(a)){for(c=0;cA&&(l=b[0],k.unshift(b));for(a=k.length-1;0<=a;a--){b=k[a][1];var d=k[a][2];if(t[b])for(var n=0,e=t[b].length;n>>16)&65535)<<16),f^=f>>>24,f=1540483477*(f&65535)+((1540483477*(f>>>16)&65535)<<16),e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)^f,g-=4,++h;switch(g){case 3:e^=(d.charCodeAt(h+2)&255)<<16;case 2:e^= +(d.charCodeAt(h+1)&255)<<8;case 1:e^=d.charCodeAt(h)&255,e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16)}e^=e>>>13;e=1540483477*(e&65535)+((1540483477*(e>>>16)&65535)<<16);k[a]="2."+((e^e>>>15)>>>0);this.setTTL(a,l.TTL||0);s(a,"updated");return b},get:function(a,b){q(a);return a in c?c[a]&&"object"==typeof c[a]&&c[a]._is_xml?B.decode(c[a].xml):c[a]:"undefined"==typeof b?null:b},deleteKey:function(a){q(a);return a in c?(delete c[a],"object"==typeof c.__jstorage_meta.TTL&&a in c.__jstorage_meta.TTL&& +delete c.__jstorage_meta.TTL[a],delete c.__jstorage_meta.CRC32[a],w(),v(),s(a,"deleted"),!0):!1},setTTL:function(a,b){var l=+new Date;q(a);b=Number(b)||0;return a in c?(c.__jstorage_meta.TTL||(c.__jstorage_meta.TTL={}),0getQuery(true); // Field to update. $fields = array( - $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","minify":"0","percentagelanguageadd":"50","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), + $db->quoteName('params') . ' = ' . $db->quote('{"autorName":"Llewellyn van der Merwe","autorEmail":"joomla@vdm.io","minify":"0","percentagelanguageadd":"50","set_browser_storage":"1","storage_time_to_live":"global","backup_package_name":"JCB_Backup_[YEAR]_[MONTH]_[DAY]","export_license":"GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html","export_copyright":"Copyright (C) 2015. All Rights Reserved","check_in":"-1 day","save_history":"1","history_limit":"10","uikit_load":"1","uikit_min":"","uikit_style":""}'), ); // Condition. $conditions = array( diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 6c316304c..a3eaa7fbf 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -37,7 +37,7 @@ abstract class ComponentbuilderHelper **/ protected static $params = false; - /* + /** * get all component IDs */ public static function getComponentIDs() @@ -58,7 +58,7 @@ abstract class ComponentbuilderHelper return false; } - /* + /** * Autoloader */ public static function autoLoader($type = 'compiler') @@ -171,14 +171,14 @@ abstract class ComponentbuilderHelper } /** - * The zipper method - * - * @param string $workingDIR The directory where the items must be zipped - * @param string $filepath The path to where the zip file must be placed - * - * @return bool true On success - * - */ + * The zipper method + * + * @param string $workingDIR The directory where the items must be zipped + * @param string $filepath The path to where the zip file must be placed + * + * @return bool true On success + * + */ public static function zip($workingDIR, &$filepath) { // store the current joomla working directory @@ -222,14 +222,14 @@ abstract class ComponentbuilderHelper /** - * Write a file to the server - * - * @param string $path The path and file name where to safe the data - * @param string $data The data to safe - * - * @return bool true On success - * - */ + * Write a file to the server + * + * @param string $path The path and file name where to safe the data + * @param string $data The data to safe + * + * @return bool true On success + * + */ public static function writeFile($path, $data) { $klaar = false; @@ -1185,7 +1185,7 @@ abstract class ComponentbuilderHelper // first get the file path $path_filename = self::getFilePath('path', $name.$type, $fileType, $key, JPATH_COMPONENT_ADMINISTRATOR); // set as read if not already set - if (($content = @file_get_contents($path_filename)) !== FALSE) + if ($content = self::getFileContents($path_filename, false)) { if ($hash == $content) { @@ -1199,18 +1199,18 @@ abstract class ComponentbuilderHelper } /** - * Get the file path or url - * - * @param string $type The (url/path) type to return - * @param string $target The Params Target name (if set) - * @param string $fileType The kind of filename to generate (if not set no file name is generated) - * @param string $key The key to adjust the filename (if not set ignored) - * @param string $default The default path if not set in Params (fallback path) - * @param bool $createIfNotSet The switch to create the folder if not found - * - * @return string On success the path or url is returned based on the type requested - * - */ + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $fileType The kind of filename to generate (if not set no file name is generated) + * @param string $key The key to adjust the filename (if not set ignored) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + */ public static function getFilePath($type = 'path', $target = 'filepath', $fileType = null, $key = '', $default = JPATH_SITE . '/images/', $createIfNotSet = true) { // get the global settings @@ -1267,7 +1267,94 @@ abstract class ComponentbuilderHelper // sanitize the path return '/' . trim( $filePath, '/' ) . '/' . $fileName; } - + + + /** + * Get the file path or url + * + * @param string $type The (url/path) type to return + * @param string $target The Params Target name (if set) + * @param string $default The default path if not set in Params (fallback path) + * @param bool $createIfNotSet The switch to create the folder if not found + * + * @return string On success the path or url is returned based on the type requested + * + */ + public static function getFolderPath($type = 'path', $target = 'folderpath', $default = JPATH_SITE . '/images/', $createIfNotSet = true) + { + // get the global settings + if (!self::checkObject(self::$params)) + { + self::$params = JComponentHelper::getParams('com_componentbuilder'); + } + $folderPath = self::$params->get($target, $default); + jimport('joomla.filesystem.folder'); + // create the folder if it does not exist + if ($createIfNotSet && !JFolder::exists($folderPath)) + { + JFolder::create($folderPath); + } + // return the url + if ('url' === $type) + { + if (strpos($folderPath, JPATH_SITE) !== false) + { + $folderPath = trim( str_replace( JPATH_SITE, '', $folderPath), '/'); + return JURI::root() . $folderPath . '/'; + } + // since the path is behind the root folder of the site, return only the root url (may be used to build the link) + return JURI::root(); + } + // sanitize the path + return '/' . trim( $folderPath, '/' ) . '/'; + } + + + /** + * get the content of a file + * + * @param string $path The path to the file + * @param string/bool $none The return value if no content was found + * + * @return string On success + * + */ + public static function getFileContents($path, $none = '') + { + if (self::checkString($path)) + { + // use basic file get content for now + if (($content = @file_get_contents($path)) !== FALSE) + { + return $content; + } + // use curl if available + elseif (function_exists('curl_version')) + { + // start curl + $ch = curl_init(); + // set the options + $options = array(); + $options[CURLOPT_URL] = $path; + $options[CURLOPT_USERAGENT] = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12'; + $options[CURLOPT_RETURNTRANSFER] = TRUE; + $options[CURLOPT_SSL_VERIFYPEER] = FALSE; + // load the options + curl_setopt_array($ch, $options); + // get the content + $content = curl_exec($ch); + // close the connection + curl_close($ch); + // return if found + if (self::checkString($content)) + { + return $content; + } + } + } + return $none; + } + public static function jsonToString($value, $sperator = ", ", $table = null) {