>>
+ $this->customScriptBuilder['php_document'][$viewName_single] = str_replace('$document->', '$this->document->', $this->customScriptBuilder['php_document'][$viewName_single]);
$this->fileContentDynamic[$viewName_single]['###DOCUMENT_CUSTOM_PHP###']
= PHP_EOL.$this->setPlaceholders(
$this->customScriptBuilder['php_document'][$viewName_single],
diff --git a/admin/helpers/componentbuilder.php b/admin/helpers/componentbuilder.php
index c098bc194..ee9060e1c 100644
--- a/admin/helpers/componentbuilder.php
+++ b/admin/helpers/componentbuilder.php
@@ -329,7 +329,7 @@ abstract class ComponentbuilderHelper
*
* @param int $id The library id to target
*
- * @return array On success the contributor details
+ * @return array On success the array of files that belong to this library
*
*/
public static function getLibraryFiles($id)
@@ -340,9 +340,10 @@ abstract class ComponentbuilderHelper
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
- $query->select($db->quoteName(array('addurls','addfolders','addfiles')));
- $query->from($db->quoteName('#__componentbuilder_library_files_folders_urls'));
- $query->where($db->quoteName('library') . ' = ' . (int) $id);
+ $query->select($db->quoteName(array('b.name','a.addurls','a.addfolders','a.addfiles')));
+ $query->from($db->quoteName('#__componentbuilder_library_files_folders_urls','a'));
+ $query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'b') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('b.id') . ')');
+ $query->where($db->quoteName('a.library') . ' = ' . (int) $id);
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
@@ -357,31 +358,46 @@ abstract class ComponentbuilderHelper
// set urls
if (self::checkArray($result->addurls))
{
+ // build media folder path
+ $mediaPath = '/media/' . strtolower( preg_replace('/\s+/', '-', self::safeString($result->name, 'filename', ' ', false)));
+ // load the urls
foreach($result->addurls as $url)
{
- if (isset($url['url']) && isset($url['type']))
+ if (isset($url['url']) && self::checkString($url['url']))
{
- switch ($url['type'])
+ // set the path if needed
+ if (isset($url['type']) && $url['type'] > 1)
{
- case 1:
- // link only
- $files['1'.$url['url']] = '(' . JText::_('COM_COMPONENTBUILDER_URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK');
- break;
- case 2:
- // local
- $files['2'.$url['url']] = '(' . JText::_('COM_COMPONENTBUILDER_URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LOCAL');
- break;
- case 3:
- // link and local
- $files['1'.$url['url']] = '(' . JText::_('COM_COMPONENTBUILDER_URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LINK');
- $files['2'.$url['url']] = '(' . JText::_('COM_COMPONENTBUILDER_URL') . ') ' . basename($url['url']) . ' - ' . JText::_('COM_COMPONENTBUILDER_LOCAL');
- break;
+ $fileName = basename($url['url']);
+ // build sub path
+ if (strpos($fileName, '.js') !== false)
+ {
+ $path = '/js';
+ }
+ elseif (strpos($fileName, '.css') !== false)
+ {
+ $path = '/css';
+ }
+ else
+ {
+ $path = '';
+ }
+ // set the path to library file
+ $url['path'] = $mediaPath . $path . '/' . $fileName; // we need this for later
}
+ // if local path is set, then use it first
+ if (isset($url['path']))
+ {
+ // 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');
}
}
}
}
- // load the local files
+ // load the local files
if (self::checkJson($result->addfiles))
{
// convert to array
@@ -393,7 +409,19 @@ abstract class ComponentbuilderHelper
{
if (isset($file['file']) && isset($file['path']))
{
- $files['3'.$file['path'].$file['file']] = '(' . JText::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file'];
+ $path = '/'.trim($file['path'], '/');
+ // check if path has new file name (has extetion)
+ $pathInfo = pathinfo($path);
+ if (isset($pathInfo['extension']) && $pathInfo['extension'])
+ {
+ // load document script
+ $files[md5($path)] = '(' . JText::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file'];
+ }
+ else
+ {
+ // load document script
+ $files[md5($path.'/'.trim($file['file'],'/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FILE') . ') ' . $file['file'];
+ }
}
}
}
@@ -406,11 +434,51 @@ abstract class ComponentbuilderHelper
// set folder
if (self::checkArray($result->addfolders))
{
- foreach($result->addfolders as $folder)
+ // get the global settings
+ if (!self::checkObject(self::$params))
{
- // not yet set
+ self::$params = JComponentHelper::getParams('com_componentbuilder');
+ }
+ // reset bucket
+ $bucket = array();
+ // get custom folder path
+ $customPath = '/'.trim(self::$params->get('custom_folder_path', JPATH_COMPONENT_ADMINISTRATOR.'/custom'), '/');
+ // get all the file paths
+ foreach ($result->addfolders as $folder)
+ {
+ if (isset($folder['path']) && isset($folder['folder']))
+ {
+ $_path = '/'.trim($folder['path'], '/');
+ $customFolder = '/'.trim($folder['folder'], '/');
+ if (isset($folder['rename']) && 1 == $folder['rename'])
+ {
+ if ($_paths = self::getAllFilePaths($customPath.$customFolder))
+ {
+ $bucket[$_path] = $_paths;
+ }
+ }
+ else
+ {
+ $path = $_path.$customFolder;
+ if ($_paths = self::getAllFilePaths($customPath.$customFolder))
+ {
+ $bucket[$path] = $_paths;
+ }
+ }
+ }
+ }
+ // now load the script
+ if (self::checkArray($bucket))
+ {
+ foreach ($bucket as $root => $paths)
+ {
+ // load per path
+ foreach($paths as $path)
+ {
+ $files[md5($root.'/'.trim($path, '/'))] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDER') . ') ' . basename($path);
+ }
+ }
}
- $files['4folders'] = '(' . JText::_('COM_COMPONENTBUILDER_FOLDERS') . ') not yet able to deal with folders';
}
}
// return files if found
@@ -421,6 +489,37 @@ abstract class ComponentbuilderHelper
}
return false;
}
+
+ /**
+ * get all the file paths in folder and sub folders
+ *
+ * @param string $folder The local path to parse
+ * @param array $fileTypes The type of files to get
+ *
+ * @return void
+ *
+ */
+ public static function getAllFilePaths($folder, $fileTypes = array('\.php', '\.js', '\.css', '\.less'))
+ {
+ if (JFolder::exists($folder))
+ {
+ // we must first store the current woking directory
+ $joomla = getcwd();
+ // we are changing the working directory to the componet path
+ chdir($folder);
+ // get the files
+ foreach ($fileTypes as $type)
+ {
+ // get a list of files in the current directory tree
+ $files[] = JFolder::files('.', $type, true, true);
+ }
+ // change back to Joomla working directory
+ chdir($joomla);
+ // return array of files
+ return array_map( function($file) { return str_replace('./', '/', $file); }, (array) self::mergeArrays($files));
+ }
+ return false;
+ }
/**
* get all component IDs
@@ -2778,6 +2877,31 @@ abstract class ComponentbuilderHelper
}
return false;
}
+
+ /**
+ * Check if we are connected
+ * Thanks https://stackoverflow.com/a/4860432/1429677
+ *
+ * @returns bool true on success
+ **/
+ public static function isConnected()
+ {
+ // If example.com is down, then probably the whole internet is down, since IANA maintains the domain. Right?
+ $connected = @fsockopen("www.example.com", 80);
+ // website, port (try 80 or 443)
+ if ($connected)
+ {
+ //action when connected
+ $is_conn = true;
+ fclose($connected);
+ }
+ else
+ {
+ //action in connection failure
+ $is_conn = false;
+ }
+ return $is_conn;
+ }
public static function mergeArrays($arrays)
{
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
index b96d3898f..a4298a9d9 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
@@ -864,6 +864,7 @@ 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_ADD="Always Add"
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"
@@ -903,6 +904,7 @@ COM_COMPONENTBUILDER_BSB_COULD_NOT_BE_IMPORTEDS="%s could not be imported
COM_COMPONENTBUILDER_BSB_EMCOMPONENT_DETAILSEM="%s component details"
COM_COMPONENTBUILDER_BSB_HAS_BEEN_IMPORTED="%s has been imported!"
COM_COMPONENTBUILDER_BSB_HAS_BEEN_UPDATED="%s has been updated!"
+COM_COMPONENTBUILDER_BUILDIN="Build-in"
COM_COMPONENTBUILDER_BULK="Bulk"
COM_COMPONENTBUILDER_BULK_GET_ALL_NEW_SNIPPETS="Bulk Get All New Snippets"
COM_COMPONENTBUILDER_BULK_TOOLS="Bulk Tools"
@@ -2109,6 +2111,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_CONDITIONS="Conditions"
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."
@@ -2993,6 +2996,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION="
+
Scanning Database..
You can edit the above areas where this code is used.
This code is not used in any area of the JCB custom code blocks at this time.
@@ -3029,6 +3033,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_DESCRIPTION="How To Add the Code to the fi
COM_COMPONENTBUILDER_CUSTOM_CODE_TYPE_LABEL="Add Type"
COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_DESC="A count of the number of times this Custom Code has been revised."
COM_COMPONENTBUILDER_CUSTOM_CODE_VERSION_LABEL="Revision"
+COM_COMPONENTBUILDER_CUSTOM_SCRIPT="Custom Script"
COM_COMPONENTBUILDER_DASH="Dashboard"
COM_COMPONENTBUILDER_DASHBOARD="Component Builder Dashboard"
COM_COMPONENTBUILDER_DASHBOARD_ADD_RECORD="Dashboard (add record)"
@@ -3072,6 +3077,7 @@ COM_COMPONENTBUILDER_DIVERGED="Diverged"
COM_COMPONENTBUILDER_DIVERGED_MEANS_YOUR_BLOCAL_SNIPPETB_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_HAS_A_BDIVERGEDB_FROM_THE_COMMUNITY_SNIPPET_WITH_THE_SAME_NAME_LIBRARY_AND_TYPE_IN_THAT_IT_DOES_NOT_HAVE_THE_SAME_BCREATIONB_OR_BMODIFIED_DATEB="Diverged means your local snippet (with the same name, library and type) has a diverged from the community snippet (with the same name, library and type) in that it does not have the same creation or modified date."
COM_COMPONENTBUILDER_DOES_THIS_PACKAGE_REQUIRE_A_KEY_TO_INSTALL="Does this package require a key to install"
COM_COMPONENTBUILDER_DOWNLOAD="download"
+COM_COMPONENTBUILDER_DO_NOT_ADD="Do not add"
COM_COMPONENTBUILDER_DYNAMIC_GET="Dynamic Get"
COM_COMPONENTBUILDER_DYNAMIC_GETS="Dynamic Gets"
COM_COMPONENTBUILDER_DYNAMIC_GETS_ACCESS="Dynamic Gets Access"
@@ -3715,7 +3721,7 @@ COM_COMPONENTBUILDER_FIELD_YES="Yes"
COM_COMPONENTBUILDER_FIELD_ZERO="0"
COM_COMPONENTBUILDER_FILE="File"
COM_COMPONENTBUILDER_FILTER="Filter"
-COM_COMPONENTBUILDER_FOLDERS="Folders"
+COM_COMPONENTBUILDER_FOLDER="Folder"
COM_COMPONENTBUILDER_FORCE_LOCAL_UPDATE="Force Local Update"
COM_COMPONENTBUILDER_FTP="FTP"
COM_COMPONENTBUILDER_FTPS="FTP's"
@@ -4076,6 +4082,8 @@ COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_CSS_LABEL="Add CSS"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER="Add Email Helper"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_DESCRIPTION="Adding the email helper class, that can be used to send emails."
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_EMAIL_HELPER_LABEL="Add Email Helper"
+COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_FOOTABLE_VTHREE="Add FooTable V3"
+COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_FOOTABLE_VTWO="Add FooTable V2"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT="Add Javascript"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_JAVASCRIPT_LABEL="Add Javascript"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_ADD_LICENSE="Add License"
@@ -4166,7 +4174,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="Dynamic"
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"
@@ -4436,8 +4444,6 @@ 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_WEBSITE="Website"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_DESCRIPTION="Enter website address"
COM_COMPONENTBUILDER_JOOMLA_COMPONENT_WEBSITE_HINT="http://www.example.com"
@@ -4860,12 +4866,10 @@ COM_COMPONENTBUILDER_LIBRARY_ACTIVE_ONLY_FOUR_TEXT_FIELD="Active (only 4 text_fi
COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS="Addconditions"
COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_DESCRIPTION="Conditional setup for the the library behaviour."
COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_LABEL="Conditions"
-COM_COMPONENTBUILDER_LIBRARY_ALWAYS_ADD="Always Add"
COM_COMPONENTBUILDER_LIBRARY_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST="Any Selection (only 4 list/radio/checkboxes/dynamic_list)"
COM_COMPONENTBUILDER_LIBRARY_BEHAVIOUR="Behaviour"
COM_COMPONENTBUILDER_LIBRARY_BUNDLE="Bundle"
COM_COMPONENTBUILDER_LIBRARY_CHAIN="Chain"
-COM_COMPONENTBUILDER_LIBRARY_CONDITIONS="Conditions"
COM_COMPONENTBUILDER_LIBRARY_CONFIG="Library Config"
COM_COMPONENTBUILDER_LIBRARY_CONFIG_ADDCONFIG="Addconfig"
COM_COMPONENTBUILDER_LIBRARY_CONFIG_ADDCONFIG_DESCRIPTION="Setup config fields."
@@ -4907,13 +4911,11 @@ 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_CUSTOM_SCRIPT="Custom Script"
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION="Description"
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_DESCRIPTION="Enter some description"
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_HINT="Description Here"
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_LABEL="Description"
COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_MESSAGE="Error! Please add description here."
-COM_COMPONENTBUILDER_LIBRARY_DO_NOT_ADD="Do not add"
COM_COMPONENTBUILDER_LIBRARY_EDIT="Editing the Library"
COM_COMPONENTBUILDER_LIBRARY_ERROR_UNIQUE_ALIAS="Another Library has the same alias."
COM_COMPONENTBUILDER_LIBRARY_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD="Exact Length (only 4 text_field)"
@@ -5014,6 +5016,12 @@ COM_COMPONENTBUILDER_LIBRARY_NAME_HINT="Name Here"
COM_COMPONENTBUILDER_LIBRARY_NAME_LABEL="Name"
COM_COMPONENTBUILDER_LIBRARY_NAME_MESSAGE="Error! Please add name here."
COM_COMPONENTBUILDER_LIBRARY_NEW="A New Library"
+COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_ONE_DESCRIPTION="This library will be loaded based on the JCB build-in behaviour."
+COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_ONE_LABEL="Build-in Behaviour"
+COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_THREE_DESCRIPTION="This library will be loaded based on the JCB build-in behaviour."
+COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_THREE_LABEL="Build-in Behaviour"
+COM_COMPONENTBUILDER_LIBRARY_NOTE_BUILD_IN_BEHAVIOUR_TWO_DESCRIPTION="This library will be loaded based on the JCB build-in behaviour."
+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_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."
@@ -5034,13 +5042,9 @@ COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_DESCRIPTION="Select the global option
COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_LABEL="Option Field"
COM_COMPONENTBUILDER_LIBRARY_ORDERING_LABEL="Ordering"
COM_COMPONENTBUILDER_LIBRARY_PERMISSION="Permissions"
-COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT="Php Preparedocument"
-COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_DESCRIPTION="Add your PHP here! [Do not add the php tags]"
-COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_HINT="// PHP Here that should run in the _prepareDocument() Method. The document is accessed via $this->document-> like $this->document->addScript();"
-COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_LABEL="PHP - _prepareDocument()"
COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT="Php Setdocument"
COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_DESCRIPTION="Add your PHP here! [Do not add the php tags]"
-COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_HINT="// PHP Here that should run in the setDocument() Method. The document is accessed via $document-> like $document->addScript();"
+COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_HINT="// PHP Here that should run in the setDocument() & _prepareDocument() Method (to load the lib files). The document is accessed via $this->document-> like $this->document->addScript();"
COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_LABEL="PHP - setDocument()"
COM_COMPONENTBUILDER_LIBRARY_PUBLISHING="Publishing"
COM_COMPONENTBUILDER_LIBRARY_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Library to customise the alias."
@@ -5057,11 +5061,11 @@ COM_COMPONENTBUILDER_LIBRARY_VERSION_DESC="A count of the number of times this L
COM_COMPONENTBUILDER_LIBRARY_VERSION_LABEL="Revision"
COM_COMPONENTBUILDER_LICENSE="License"
COM_COMPONENTBUILDER_LICENSE_S="License: %s"
-COM_COMPONENTBUILDER_LINK="link"
+COM_COMPONENTBUILDER_LINK="Link"
COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC="Link & Local (dynamic)"
COM_COMPONENTBUILDER_LINK_TO_THE_CONTRIBUTOR="Link to the contributor"
COM_COMPONENTBUILDER_LOADING="loading"
-COM_COMPONENTBUILDER_LOCAL="local"
+COM_COMPONENTBUILDER_LOCAL="Local"
COM_COMPONENTBUILDER_LOCAL_GET="Local (get)"
COM_COMPONENTBUILDER_LOCAL_SNIPPET="Local snippet"
COM_COMPONENTBUILDER_MAIN_MENU="Main Menu"
@@ -5983,7 +5987,6 @@ COM_COMPONENTBUILDER_UPDATE="Update"
COM_COMPONENTBUILDER_UPDATE_ALL_DIVERGED_SNIPPETS="Update All Diverged Snippets"
COM_COMPONENTBUILDER_UPDATE_ALL_OUT_DATED_SNIPPETS="Update All Out Dated Snippets"
COM_COMPONENTBUILDER_UP_TO_DATE="Up to date"
-COM_COMPONENTBUILDER_URL="Url"
COM_COMPONENTBUILDER_USAGE="Usage"
COM_COMPONENTBUILDER_USED_IN="used in"
COM_COMPONENTBUILDER_USE_BATCH="Use Batch"
diff --git a/admin/layouts/fieldtype/fields_fullwidth.php b/admin/layouts/fieldtype/fields_fullwidth.php
index e107a5bfe..b57918936 100644
--- a/admin/layouts/fieldtype/fields_fullwidth.php
+++ b/admin/layouts/fieldtype/fields_fullwidth.php
@@ -28,7 +28,7 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
-$items = $displayData->vzxfields;
+$items = $displayData->vzwfields;
$user = JFactory::getUser();
$id = $displayData->item->id;
$edit = "index.php?option=com_componentbuilder&view=fields&task=field.edit";
diff --git a/admin/layouts/ftp/linked_components_fullwidth.php b/admin/layouts/ftp/linked_components_fullwidth.php
index a6afd46b0..a437256a6 100644
--- a/admin/layouts/ftp/linked_components_fullwidth.php
+++ b/admin/layouts/ftp/linked_components_fullwidth.php
@@ -28,7 +28,7 @@
defined('_JEXEC') or die('Restricted access');
// set the defaults
-$items = $displayData->vzylinked_components;
+$items = $displayData->vzxlinked_components;
$user = JFactory::getUser();
$id = $displayData->item->id;
$edit = "index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit";
diff --git a/admin/layouts/library/behaviour_fullwidth.php b/admin/layouts/library/behaviour_fullwidth.php
index 0530f76ae..f4bf449d0 100644
--- a/admin/layouts/library/behaviour_fullwidth.php
+++ b/admin/layouts/library/behaviour_fullwidth.php
@@ -32,9 +32,9 @@ $form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'note_no_behaviour_one',
'note_yes_behaviour_one',
+ 'note_build_in_behaviour_one',
'addconditions',
- 'php_setdocument',
- 'php_preparedocument'
+ 'php_setdocument'
);
?>
diff --git a/admin/layouts/library/config_fullwidth.php b/admin/layouts/library/config_fullwidth.php
index f78b33db2..5bc068efe 100644
--- a/admin/layouts/library/config_fullwidth.php
+++ b/admin/layouts/library/config_fullwidth.php
@@ -32,6 +32,7 @@ $form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'note_no_behaviour_two',
'note_yes_behaviour_two',
+ 'note_build_in_behaviour_two',
'note_display_library_config'
);
diff --git a/admin/layouts/library/files_folders_urls_fullwidth.php b/admin/layouts/library/files_folders_urls_fullwidth.php
index 9b00b61e2..d4d23f6a6 100644
--- a/admin/layouts/library/files_folders_urls_fullwidth.php
+++ b/admin/layouts/library/files_folders_urls_fullwidth.php
@@ -31,6 +31,7 @@ $form = $displayData->getForm();
$fields = $displayData->get('fields') ?: array(
'note_no_behaviour_three',
+ 'note_build_in_behaviour_three',
'note_display_library_files_folders_urls'
);
diff --git a/admin/models/ajax.php b/admin/models/ajax.php
index 6d06cd9a3..4f23a046f 100644
--- a/admin/models/ajax.php
+++ b/admin/models/ajax.php
@@ -1847,6 +1847,14 @@ class ComponentbuilderModelAjax extends JModelList
$query['i']['not_base64'] = array('dashboard_tab' => 'json');
$query['i']['name'] = 'joomla_component->id:joomla_component.system_name';
+ // #__componentbuilder_library as j
+ $query['j'] = array();
+ $query['j']['table'] = 'library';
+ $query['j']['view'] = 'libraries';
+ $query['j']['select'] = array('id', 'name', 'php_setdocument');
+ $query['j']['not_base64'] = array();
+ $query['j']['name'] = 'name';
+
// return the query string to search
if (isset($query[$target]))
{
diff --git a/admin/models/compiler.php b/admin/models/compiler.php
index b6611e5c2..ab7ce803c 100644
--- a/admin/models/compiler.php
+++ b/admin/models/compiler.php
@@ -110,15 +110,21 @@ class ComponentbuilderModelCompiler extends JModelList
// Get the global params
$globalParams = JComponentHelper::getParams('com_componentbuilder', true);
- // Convert the parameter fields into objects.
+ // Insure all item fields are adapted where needed.
if (ComponentbuilderHelper::checkArray($items))
{
+ // Load the JEvent Dispatcher
+ JPluginHelper::importPlugin('content');
+ $this->_dispatcher = JEventDispatcher::getInstance();
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;
- // Make sure the content prepare plugins fire on copyright (TODO)
- $item->copyright = JHtml::_('content.prepare',$item->copyright);
+ // Make sure the content prepare plugins fire on copyright
+ $_copyright = new stdClass();
+ $_copyright->text =& $item->copyright; // value must be in text
+ // Since all values are now in text (Joomla Limitation), we also add the field name (copyright) to context
+ $this->_dispatcher->trigger("onContentPrepare",array('com_componentbuilder.compiler.copyright',&$_copyright,&$this->params));
// Checking if copyright has uikit components that must be loaded.
$this->uikitComp = ComponentbuilderHelper::getUikitComp($item->copyright,$this->uikitComp);
}
diff --git a/admin/models/custom_codes.php b/admin/models/custom_codes.php
index 641a322f7..4a127f876 100644
--- a/admin/models/custom_codes.php
+++ b/admin/models/custom_codes.php
@@ -280,7 +280,7 @@ class ComponentbuilderModelCustom_codes extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
- $query->where('(a.component LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.function_name LIKE '.$search.' OR a.system_name LIKE '.$search.')');
+ $query->where('(a.component LIKE '.$search.' OR g.system_name LIKE '.$search.' OR a.path LIKE '.$search.' OR a.comment_type LIKE '.$search.' OR a.function_name LIKE '.$search.' OR a.system_name LIKE '.$search.')');
}
}
diff --git a/admin/models/fields.php b/admin/models/fields.php
index a76b382ad..eee123dd6 100644
--- a/admin/models/fields.php
+++ b/admin/models/fields.php
@@ -312,7 +312,7 @@ class ComponentbuilderModelFields extends JModelList
else
{
$search = $db->quote('%' . $db->escape($search) . '%');
- $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.store LIKE '.$search.')');
+ $query->where('(a.name LIKE '.$search.' OR a.fieldtype LIKE '.$search.' OR g.name LIKE '.$search.' OR a.datatype LIKE '.$search.' OR a.indexes LIKE '.$search.' OR a.null_switch LIKE '.$search.' OR a.xml LIKE '.$search.' OR a.catid LIKE '.$search.' OR a.store LIKE '.$search.')');
}
}
diff --git a/admin/models/fields/filebehaviour.php b/admin/models/fields/filebehaviour.php
new file mode 100644
index 000000000..7c5732a18
--- /dev/null
+++ b/admin/models/fields/filebehaviour.php
@@ -0,0 +1,168 @@
+
+ @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 list field type
+jimport('joomla.form.helper');
+JFormHelper::loadFieldClass('list');
+
+/**
+ * Filebehaviour Form Field class for the Componentbuilder component
+ */
+class JFormFieldFilebehaviour extends JFormFieldList
+{
+ /**
+ * The filebehaviour field type.
+ *
+ * @var string
+ */
+ public $type = 'filebehaviour';
+ /**
+ * Override to add new button
+ *
+ * @return string The field input markup.
+ *
+ * @since 3.2
+ */
+ protected function getInput()
+ {
+ // see if we should add buttons
+ $setButton = $this->getAttribute('button');
+ // get html
+ $html = parent::getInput();
+ // if true set button
+ if ($setButton === 'true')
+ {
+ $button = array();
+ $script = array();
+ $buttonName = $this->getAttribute('name');
+ // get the input from url
+ $app = JFactory::getApplication();
+ $jinput = $app->input;
+ // get the view name & id
+ $values = $jinput->getArray(array(
+ 'id' => 'int',
+ 'view' => 'word'
+ ));
+ // check if new item
+ $ref = '';
+ $refJ = '';
+ if (!is_null($values['id']) && strlen($values['view']))
+ {
+ // only load referal if not new item.
+ $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
+ }
+ $user = JFactory::getUser();
+ // only add if user allowed to create
+ if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build Create button
+ $buttonNamee = trim($buttonName);
+ $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
+ $buttonNamee = ucfirst(strtolower($buttonNamee));
+ $button[] = '
+ ';
+ }
+ // only add if user allowed to edit
+ if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
+ {
+ // build edit button
+ $buttonNamee = trim($buttonName);
+ $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
+ $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
+ $buttonNamee = ucfirst(strtolower($buttonNamee));
+ $button[] = '
+ ';
+ // build script
+ $script[] = "
+ jQuery(document).ready(function() {
+ jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
+ e.preventDefault();
+ var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
+ ".$buttonName."Button(".$buttonName."Value);
+ });
+ var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
+ ".$buttonName."Button(".$buttonName."Value);
+ });
+ function ".$buttonName."Button(value) {
+ if (value > 0) {
+ // hide the create button
+ jQuery('#".$buttonName."Create').hide();
+ // show edit button
+ jQuery('#".$buttonName."Edit').show();
+ var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
+ jQuery('#".$buttonName."Edit').attr('href', url);
+ } else {
+ // show the create button
+ jQuery('#".$buttonName."Create').show();
+ // hide edit button
+ jQuery('#".$buttonName."Edit').hide();
+ }
+ }";
+ }
+ // check if button was created for field.
+ if (is_array($button) && count($button) > 0)
+ {
+ // Load the needed script.
+ $document = JFactory::getDocument();
+ $document->addScriptDeclaration(implode(' ',$script));
+ // return the button attached to input field.
+ return '' .$html . implode('',$button).'
';
+ }
+ }
+ return $html;
+ }
+
+ /**
+ * Method to get a list of options for a list input.
+ *
+ * @return array An array of JHtml options.
+ */
+ public function getOptions()
+ {
+ // get the input from url
+ $jinput = JFactory::getApplication()->input;
+ // get the library id
+ $libID = $jinput->getInt('id', 0);
+ $options[] = JHtml::_('select.option', '1', JText::_('COM_COMPONENTBUILDER_ALWAYS_ADD'));
+ // add build in option for some libraries
+ $buildin = array(3 => 'Uikit v3', 4 => 'Uikit v2', 5 => 'FooTable v2', 6 => 'FooTable v3');
+ if (isset($buildin[$libID]))
+ {
+ $options[] = JHtml::_('select.option', '4', JText::_('COM_COMPONENTBUILDER_BUILDIN'));
+ }
+ $options[] = JHtml::_('select.option', '2', JText::_('COM_COMPONENTBUILDER_CONDITIONS'));
+ $options[] = JHtml::_('select.option', '3', JText::_('COM_COMPONENTBUILDER_CUSTOM_SCRIPT'));
+ $options[] = JHtml::_('select.option', '0', JText::_('COM_COMPONENTBUILDER_DO_NOT_ADD'));
+ return $options;
+ }
+}
diff --git a/admin/models/fieldtype.php b/admin/models/fieldtype.php
index 9168d46f8..b7a7378e4 100644
--- a/admin/models/fieldtype.php
+++ b/admin/models/fieldtype.php
@@ -139,7 +139,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
- public function getVzxfields()
+ public function getVzwfields()
{
// Get the user object.
$user = JFactory::getUser();
@@ -223,13 +223,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
foreach ($items as $nr => &$item)
{
// convert datatype
- $item->datatype = $this->selectionTranslationVzxfields($item->datatype, 'datatype');
+ $item->datatype = $this->selectionTranslationVzwfields($item->datatype, 'datatype');
// convert indexes
- $item->indexes = $this->selectionTranslationVzxfields($item->indexes, 'indexes');
+ $item->indexes = $this->selectionTranslationVzwfields($item->indexes, 'indexes');
// convert null_switch
- $item->null_switch = $this->selectionTranslationVzxfields($item->null_switch, 'null_switch');
+ $item->null_switch = $this->selectionTranslationVzwfields($item->null_switch, 'null_switch');
// convert store
- $item->store = $this->selectionTranslationVzxfields($item->store, 'store');
+ $item->store = $this->selectionTranslationVzwfields($item->store, 'store');
}
}
@@ -243,7 +243,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return translatable string
*/
- public function selectionTranslationVzxfields($value,$name)
+ public function selectionTranslationVzwfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')
diff --git a/admin/models/forms/admin_fields.xml b/admin/models/forms/admin_fields.xml
index 248a5bd94..1b4cb4744 100644
--- a/admin/models/forms/admin_fields.xml
+++ b/admin/models/forms/admin_fields.xml
@@ -4,282 +4,242 @@
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+