diff --git a/README.md b/README.md index 29d05f09a..da9322ad1 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,11 @@ 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*: 15th December, 2017 ++ *Last Build*: 17th December, 2017 + *Version*: 2.6.7 + *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*: **178242** ++ *Line count*: **178375** + *File count*: **1145** + *Folder count*: **184** diff --git a/admin/README.txt b/admin/README.txt index 29d05f09a..da9322ad1 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -111,11 +111,11 @@ 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*: 15th December, 2017 ++ *Last Build*: 17th December, 2017 + *Version*: 2.6.7 + *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*: **178242** ++ *Line count*: **178375** + *File count*: **1145** + *Folder count*: **184** diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 325ef0723..c450534b3 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -3341,7 +3341,7 @@ class Interpretation extends Fields // add script to file $this->fileContentDynamic[$view['settings']->code]['###' . $TARGET . '_JAVASCRIPT_FILE###'] = $view['settings']->javascript_file; // add script to view - return PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add View JavaScript File" . PHP_EOL . "\t\t" . $this->setIncludeLibScript($path); + return PHP_EOL . PHP_EOL . "\t\t//" . $this->setLine(__LINE__) . " Add View JavaScript File" . PHP_EOL . "\t\t" . $this->setIncludeLibScript($path); } return ''; } @@ -3563,7 +3563,7 @@ class Interpretation extends Fields // Start script builder for library files if (!isset($this->libwarning[$id])) { - $this->app->enqueueMessage(JText::sprintf('The conditional script builder for %s is not ready, will only be ready in the next update to v2.6.7', $this->libraries[$id]->name), 'warning'); + $this->app->enqueueMessage(JText::sprintf('The conditional script builder for %s is not ready, sorry!', $this->libraries[$id]->name), 'warning'); // set the warning only once $this->libwarning[$id] = true; } diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php index b73a4c256..ed934fec1 100644 --- a/admin/helpers/componentbuilder.php +++ b/admin/helpers/componentbuilder.php @@ -391,8 +391,12 @@ abstract class ComponentbuilderHelper // load document script $files[md5($url['path'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LOCAL'); } - // load url also if not building document - $files[md5($url['url'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK'); + // check if link must be added + if (isset($url['url']) && ((isset($url['type']) && $url['type'] == 1) || (isset($url['type']) && $url['type'] == 3) || !isset($url['type']))) + { + // load url also if not building document + $files[md5($url['url'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK'); + } } } } @@ -475,7 +479,7 @@ abstract class ComponentbuilderHelper // load per path foreach($paths as $path) { - $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path); + $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path) . ' - ' . basename($root); } } } diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index 25c22f49a..45b58e1ff 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -898,6 +898,7 @@ COM_COMPONENTBUILDER_BASIC_TUTORIAL_ON_GIT_BSB="Basic Tutorial on git: %s COM_COMPONENTBUILDER_BCUSTOM_FILESB_NOT_MOVE_TO_CORRECT_LOCATION="Custom files not move to correct location!" COM_COMPONENTBUILDER_BEHIND="Behind" COM_COMPONENTBUILDER_BEHIND_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BOLDER_MODIFIED_DATEB_THEN_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE="Behind means your local snippet (with the same name, library and type) has a older modified date then the community snippet (with the same name, library and type)." +COM_COMPONENTBUILDER_BETA_RELEASE="Beta Release" COM_COMPONENTBUILDER_BE_CAUTIOUS_DO_NOT_CONTINUE_UNLESS_YOU_TRUST_THE_ORIGIN_OF_THIS_PACKAGE="Be cautious! Do not continue unless you trust the origin of this package!" COM_COMPONENTBUILDER_BFIELD_TYPEB_IDS_MISMATCH_IN_BSB="Field type id:%s mismatch in %s." COM_COMPONENTBUILDER_BFIELD_TYPEB_NOT_SET_FOR_BSB="Field type not set for %s." @@ -3418,6 +3419,7 @@ COM_COMPONENTBUILDER_EMOWNEREM_BSB="Owner: %s" COM_COMPONENTBUILDER_EMWEBSITEEM_BSB="Website: %s" COM_COMPONENTBUILDER_EQUAL="Equal" COM_COMPONENTBUILDER_EQUAL_MEANS_THAT_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_AND_YOUR_LOCAL_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_THE_SAME_BCREATIONB_AND_BMODIFIED_DATEB="Equal means that the community snippet (with the same name, library and type) and your local snippet (with the same name, library and type) has the same creation and modified date." +COM_COMPONENTBUILDER_ERROR="Error" COM_COMPONENTBUILDER_ERROR_THE_PATH_HAS_A_MISMATCH_AND_COULD_THEREFORE_NOT_RETRIEVE_THE_SNIPPET_FROM_GITHUB="Error! The path has a mismatch and could therefore not retrieve the snippet from gitHub!" COM_COMPONENTBUILDER_ERROR_THE_SNIPPET_IS_FAULTY_AND_COULD_NOT_BE_SAVED="Error! The snippet is faulty and could not be saved." COM_COMPONENTBUILDER_ERROR_YOU_DO_NOT_HAVE_ACCESS_TO_THE_SNIPPETS="Error! You do not have access to the snippets." @@ -5038,6 +5040,8 @@ COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_TWO_DESCRIPTION="This libra COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_TWO_LABEL="Build-in Behaviour" COM_COMPONENTBUILDER_LIBRARY_NOTE_DISPLAY_LIBRARY_CONFIG_DESCRIPTION="

Linked Config Fields

Display of the config fields will load here!
" COM_COMPONENTBUILDER_LIBRARY_NOTE_DISPLAY_LIBRARY_FILES_FOLDERS_URLS_DESCRIPTION="

Linked Files, Folders & URLs

Display of the files, folders & urls will load here!
" +COM_COMPONENTBUILDER_LIBRARY_NOTE_LIBRARY_INSTRUCTION_DESCRIPTION="Watch a tutorial overview of the new library manager concept." +COM_COMPONENTBUILDER_LIBRARY_NOTE_LIBRARY_INSTRUCTION_LABEL="Quick overview" COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_ONE_DESCRIPTION="There is no behaviour set for this library. This means JCB will not add any files unless you custom code it in somewhere." COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_ONE_LABEL="No Behaviour" COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_DESCRIPTION="There is no behaviour set for this library. This means JCB will not add any files unless you custom code it in somewhere." @@ -5840,6 +5844,7 @@ COM_COMPONENTBUILDER_SUBMENU_TEMPLATES="Templates" COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED="Success! The snippet was saved." COM_COMPONENTBUILDER_SUCCESS_THE_SNIPPET_WAS_SAVED_BUT_THE_MODIFIED_DATE_COULD_NOT_BE_ADJUSTED_BR_BR_BTHIS_MEANS_THE_SNIPPETS_WILL_CONTINUE_TO_APPEAR_OUT_OF_DATEB="Success! The snippet was saved. But the modified date could not be adjusted.

This means the snippets will continue to appear out of date." COM_COMPONENTBUILDER_S_BEING_IMPORTED="%s Being Imported" +COM_COMPONENTBUILDER_S_NOT_LINKED="%s Not Linked" COM_COMPONENTBUILDER_S_PLEASE_WAIT_THE_COMPONENT_IS_BEING_COMPILED="%s, please wait! The component is being compiled" COM_COMPONENTBUILDER_TAB="Tab" COM_COMPONENTBUILDER_TARGET_BEHAVIOR="Target Behavior" @@ -5968,6 +5973,7 @@ COM_COMPONENTBUILDER_THERE_ARE_NO_NEW_SNIPPETS_AT_THIS_TIME="There are no new sn COM_COMPONENTBUILDER_THERE_ARE_NO_OUT_OF_DATE_SNIPPETS_AT_THIS_TIME="There are no out of date snippets at this time" COM_COMPONENTBUILDER_THERE_ARE_NO_SNIPPETS_TO_UPDATE_AT_THIS_TIME="There are no snippets to update at this time" COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST="There has been an error, if this continues please inform your system administrator of a type error in the fields display request!" +COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR="There was a problem, no view or id found in session or view not allowed to access area, we could not load any linked to values. Please inform your system administrator!" COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK="The %s library can not be deleted, or things will break." COM_COMPONENTBUILDER_THE_COMPONENT_ADMIN_VIEWS="The component admin views" COM_COMPONENTBUILDER_THE_COMPONENT_CONFIG="The component config" @@ -5988,6 +5994,7 @@ COM_COMPONENTBUILDER_THE_SEARCH_FOR_THE_SNIPPETS_ARE_CASE_SENSITIVE_SO_IF_YOU_CH COM_COMPONENTBUILDER_THE_SNIPPETS_WERE_SUCCESSFULLY_EXPORTED="The Snippets Were Successfully Exported!" COM_COMPONENTBUILDER_THE_SNIPPET_WAS_SUCCESSFULLY_EXPORTED="The Snippet Was Successfully Exported!" COM_COMPONENTBUILDER_THE_WIKI_IS_LOADING="The wiki is loading" +COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_S="This %s is not linked to any (%s)!" COM_COMPONENTBUILDER_THIS_PACKAGE_HAS_NO_KEY="This package has no key." COM_COMPONENTBUILDER_TITLE="Title" COM_COMPONENTBUILDER_TOTAL_DOWNLOADS="total downloads" diff --git a/admin/layouts/library/behaviour_left.php b/admin/layouts/library/behaviour_left.php index c34288a0d..c4febc348 100644 --- a/admin/layouts/library/behaviour_left.php +++ b/admin/layouts/library/behaviour_left.php @@ -30,6 +30,7 @@ defined('_JEXEC') or die('Restricted access'); $form = $displayData->getForm(); $fields = $displayData->get('fields') ?: array( + 'note_library_instruction', 'libraries' ); diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 4f23a046f..68c2b6e1e 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -1070,6 +1070,103 @@ class ComponentbuilderModelAjax extends JModelList return implode("\n",$tableColumns); } return false; + } + + /** + * Get Linked to + * + * @param string $type Item Name + * @param int $id Item ID + * + * @return string The table of the linked to result + * + */ + protected function getLinked($to) + { + // get the view name & id + $values = $this->getViewID(); + // check if item is set + if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view'])) + { + // get linked to + $linkedToArray = (array) explode('__', $to); + // check if item is linked to component + if (in_array('component', $linkedToArray)) + { + if (!$components = getComponentLinked($values['a_view'], $values['a_id'])) + { + $linkedToString = implode(', ', array_map( function($name) { return ComponentbuilderHelper::safeString($name, 'w'); }, $linkedToArray)); + return '

' . JText::sprintf('COM_COMPONENTBUILDER_S_NOT_LINKED', ComponentbuilderHelper::safeString($values['a_view'], 'Ww')) . '

' . JText::sprintf('COM_COMPONENTBUILDER_THIS_BSB_IS_NOT_LINKED_TO_ANY_S', $values['a_view'], $linkedToString) . '

'; + } + } + // if fields and components found get admin views + + } + // no view or id found in session, or view not allowed to access area + return '

' . JText::_('COM_COMPONENTBUILDER_ERROR') . '

' . JText::_('COM_COMPONENTBUILDER_THERE_WAS_A_PROBLEM_BNO_VIEW_OR_ID_FOUND_IN_SESSION_OR_VIEW_NOT_ALLOWED_TO_ACCESS_AREAB_WE_COULD_NOT_LOAD_ANY_LINKED_TO_VALUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR') . '

'; + } + + /** + * Get Component Linked to Item + * + * @param string $type Item Name + * @param int $id Item ID + * + * @return array Components Id if found + * + */ + protected function getComponentLinked($type, $id) + { + // reset bucket + $componentsLinked = array(); + // Create a new query object. + $query = $this->db->getQuery(true); + // get all history values + $query->select('h.*'); + $query->from('#__ucm_history AS h'); + $query->where($this->db->quoteName('h.ucm_item_id') . ' = ' . (int) $id); + // Join over the content type for the type id + $query->join('LEFT', '#__content_types AS ct ON ct.type_id = h.ucm_type_id'); + $query->where('ct.type_alias = ' . $this->db->quote('com_componentbuilder.' . $type)); + $this->db->setQuery($query); + $this->db->execute(); + if ($this->db->getNumRows()) + { + // load all item history + $items = $db->loadObjectList(); + // load the components ids + foreach ($items as $item) + { + // only work with those who have notes + if (ComponentbuilderHelper::checkJson($item->version_note)) + { + $note = json_decode($item->version_note, true); + if (ComponentbuilderHelper::checkArray($note)) + { + foreach($note as $ids) + { + if (ComponentbuilderHelper::checkArray($ids)) + { + foreach ($ids as $_id) + { + $componentsLinked[(int) $_id] = array('component' => (int) $_id); + } + } + elseif (is_numeric($ids)) + { + $componentsLinked[(int) $ids] = array('component' => (int) $ids); + } + } + } + } + } + // check if we found any + if (ComponentbuilderHelper::checkArray($componentLinked)) + { + return $componentLinked; + } + } + return false; } // Used in site_view diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 243edcb6b..c620229e9 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -379,9 +379,21 @@ class ComponentbuilderModelComponentbuilder extends JModelList // set the update notice while we are at it var activeVersion = tagreleases[0].tag_name.substring(1); if (activeVersion === manifest.version) { + // local version is in sync with latest release jQuery(".update-notice").html("'.JText::_('COM_COMPONENTBUILDER_UP_TO_DATE').'"); } else { - jQuery(".update-notice").html("'.JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE').'"); + // split versions in to array + var activeVersionArray = activeVersion.split("."); + var localVersionArray = manifest.version.split("."); + if (localVersionArray[0] > activeVersionArray[0] || + (localVersionArray[0] == activeVersionArray[0] && localVersionArray[1] > activeVersionArray[1]) || + (localVersionArray[0] == activeVersionArray[0] && localVersionArray[1] == activeVersionArray[1] && localVersionArray[2] > activeVersionArray[2])) { + // local version head latest release + jQuery(".update-notice").html("'.JText::_('COM_COMPONENTBUILDER_BETA_RELEASE').'"); + } else { + // local version behind latest release + jQuery(".update-notice").html("'.JText::_('COM_COMPONENTBUILDER_OUT_OF_DATE').'"); + } } // set the taged releases jQuery("#tagreleases").html(""); diff --git a/admin/models/forms/library.xml b/admin/models/forms/library.xml index 48118df14..413a67a95 100644 --- a/admin/models/forms/library.xml +++ b/admin/models/forms/library.xml @@ -136,6 +136,13 @@ description="COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_DESCRIPTION" heading="h4" class="alert alert-success note_yes_behaviour_one" /> + + - + - - - - + class="alert alert-success note_build_in_behaviour_two" /> + + + + - + + class="alert alert-error note_no_behaviour_one" /> document->addScript(JURI::root(true) . "/administrator/components/com_componentbuilder/assets/js/get_snippets.js"); diff --git a/componentbuilder.xml b/componentbuilder.xml index 2371e11a3..86fdfa0e2 100644 --- a/componentbuilder.xml +++ b/componentbuilder.xml @@ -1,7 +1,7 @@ COM_COMPONENTBUILDER - 15th December, 2017 + 17th December, 2017 Llewellyn van der Merwe joomla@vdm.io http://vdm.bz/component-builder diff --git a/componentbuilder_update_server.xml b/componentbuilder_update_server.xml index 54f3e1d31..1f00029cc 100644 --- a/componentbuilder_update_server.xml +++ b/componentbuilder_update_server.xml @@ -279,7 +279,7 @@ 2.6.7 http://vdm.bz/component-builder - http://domain.com/demo.zip + https://github.com/vdm-io/Joomla-Component-Builder/releases/download/v2.6.7/JCB_v2.6.7.zip stable diff --git a/site/helpers/componentbuilder.php b/site/helpers/componentbuilder.php index 37788c66a..72005ce8a 100644 --- a/site/helpers/componentbuilder.php +++ b/site/helpers/componentbuilder.php @@ -178,8 +178,12 @@ abstract class ComponentbuilderHelper // load document script $files[md5($url['path'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LOCAL'); } - // load url also if not building document - $files[md5($url['url'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK'); + // check if link must be added + if (isset($url['url']) && ((isset($url['type']) && $url['type'] == 1) || (isset($url['type']) && $url['type'] == 3) || !isset($url['type']))) + { + // load url also if not building document + $files[md5($url['url'])] = '(' . JText::_('URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK'); + } } } } @@ -262,7 +266,7 @@ abstract class ComponentbuilderHelper // load per path foreach($paths as $path) { - $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path); + $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path) . ' - ' . basename($root); } } }