'.$model->compiler->actualTotalHours.' Hours or '.$model->compiler->actualTotalDays.' Eight Hour Days(a total of the realistic time frame for this project) ';
$message .= '(if creating a folder and file took 5 seconds and writing one line of code took 10 seconds, with the normal everyday realities at the office, that includes the component planning, mapping & debugging.)
';
$message .= '
Project duration: '.$model->compiler->projectWeekTime. ' weeks or '.$model->compiler->projectMonthTime.' months
';
+ $message .= 'Hey! you can also download the zip file right now! ';
+ $message .= 'Download
';
+ $message .= '
Remember! This zip file is in your tmp folder and therefore publicly accessible until you click [Clear tmp]!
';
+ }
$message .= '
Compilation took '.$model->compiler->secondsCompiled.' seconds to complete.
';
// set redirect
- $this->setRedirect($redirect_url,$message,'message');
- $app->setUserState('com_componentbuilder.extension_name', $model->compiler->componentFolderName);
+ $this->setRedirect($redirect_url, $message, 'message');
+ $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']);
+ // check if we have plugins
+ if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']))
+ {
+ $app->setUserState('com_componentbuilder.plugins_folder_name', $model->compiler->filepath['plugins-folder']);
+ }
}
else
{
@@ -116,9 +176,10 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$app->setUserState('com_componentbuilder.redirect_url', '');
$app->setUserState('com_componentbuilder.message', '');
$app->setUserState('com_componentbuilder.extension_message', '');
- $app->setUserState('com_componentbuilder.extension_name', '');
+ $app->setUserState('com_componentbuilder.component_folder_name', '');
+ $app->setUserState('com_componentbuilder.plugins_folder_name', '');
// set redirect
- $this->setRedirect($redirect_url,$message);
+ $this->setRedirect($redirect_url, $message);
}
return true;
}
@@ -126,11 +187,11 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
}
/**
- * Install Compiled Extension
+ * Install All Compiled Extensions
*
* @return true on success
*/
- public function installExtention()
+ public function installCompiledExtensions()
{
// Check for request forgeries
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
@@ -138,27 +199,133 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin
$user = JFactory::getUser();
// set page redirect
$redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
- $message = 'Could not install component!';
+ $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THESE_EXTENSIONS');
if($user->authorise('core.admin'))
{
- // get the model
- $model = $this->getModel('compiler');
+ $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS');
+ $_message = array('success' => array(), 'error' => array());
$app = JFactory::getApplication();
- $fileName = $app->getUserState('com_componentbuilder.extension_name');
- if (ComponentbuilderHelper::checkString($fileName))
+ $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name', array());
+ $fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null);
+ foreach ($fileNames as $fileName)
{
- $lang = JFactory::getLanguage();
- $extension = 'com_installer';
- $base_dir = JPATH_ADMINISTRATOR;
- $language_tag = 'en-GB';
- $reload = true;
- $lang->load($extension, $base_dir, $language_tag, $reload);
- $message = '('.$fileName.'.zip) file was also removed from tmp!';
- $this->setRedirect($redirect_url,$message,'message');
- return $model->install($fileName.'.zip');
+ if ($this->installExtension($fileName))
+ {
+ $_message['success'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
+ }
+ else
+ {
+ $_message['error'][] = JText::sprintf('COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED', $fileName);
+ }
+ }
+ // catch errors
+ if (ComponentbuilderHelper::checkArray($_message['error']))
+ {
+ $app->enqueueMessage(implode(' ', $_message['error']), 'Error');
+ }
+ // build success message
+ if (ComponentbuilderHelper::checkArray($_message['success']))
+ {
+ $this->setRedirect($redirect_url, implode(' ', $_message['success']), 'message');
+ return true;
}
}
- $this->setRedirect($redirect_url,$message,'error');
+ $this->setRedirect($redirect_url, $message, 'error');
+ return false;
+ }
+
+ /**
+ * Install Compiled Component
+ *
+ * @return true on success
+ */
+ public function installCompiledComponent()
+ {
+ // Check for request forgeries
+ JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
+ // check if user has the right
+ $user = JFactory::getUser();
+ // set page redirect
+ $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
+ $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT');
+ if($user->authorise('core.admin'))
+ {
+ $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT');
+ $fileName = JFactory::getApplication()->getUserState('com_componentbuilder.component_folder_name');
+ if ($this->installExtension($fileName))
+ {
+ $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
+ $this->setRedirect($redirect_url, $message, 'message');
+ return true;
+ }
+ }
+ $this->setRedirect($redirect_url, $message, 'error');
+ return false;
+ }
+
+ /**
+ * Install Compiled Plugin
+ *
+ * @return true on success
+ */
+ public function installCompiledPlugin()
+ {
+ // Check for request forgeries
+ JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
+ // check if user has the right
+ $user = JFactory::getUser();
+ // set page redirect
+ $redirect_url = JRoute::_('index.php?option=com_componentbuilder&view=compiler', false);
+ $message = JText::_('COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN');
+ if($user->authorise('core.admin'))
+ {
+ $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN');
+ $app = JFactory::getApplication();
+ $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name');
+ if (ComponentbuilderHelper::checkArray($fileNames))
+ {
+ $jinput = JFactory::getApplication()->input;
+ $pluginId = $jinput->post->get('install_item_id', 0, 'INT');
+ if ($pluginId > 0 && isset($fileNames[$pluginId]) && $this->installExtension($fileNames[$pluginId]))
+ {
+ $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileName);
+ $this->setRedirect($redirect_url, $message, 'message');
+ return true;
+ }
+ }
+ }
+ $this->setRedirect($redirect_url, $message, 'error');
+ return false;
+ }
+
+ /**
+ * Install Extension
+ *
+ * @return true on success
+ */
+ protected function installExtension($fileName)
+ {
+ // check that the model is set
+ if (!isset($this->_compiler_model))
+ {
+ // get the compiler model
+ $this->_compiler_model = $this->getModel('compiler');
+ }
+ // set the language if not set
+ if (!isset($this->_installer_lang))
+ {
+ $this->_installer_lang = JFactory::getLanguage();
+ $extension = 'com_installer';
+ $base_dir = JPATH_ADMINISTRATOR;
+ $language_tag = 'en-GB';
+ $reload = true;
+ $this->_installer_lang->load($extension, $base_dir, $language_tag, $reload);
+ }
+ // make sure we have a string
+ if (ComponentbuilderHelper::checkString($fileName))
+ {
+ return $this->_compiler_model->install($fileName.'.zip');
+ }
return false;
}
diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php
index 59af27f51..7726a86b7 100644
--- a/admin/helpers/compiler.php
+++ b/admin/helpers/compiler.php
@@ -35,7 +35,21 @@ class Compiler extends Infusion
private $time_start;
private $time_end;
public $secondsCompiled;
- public $filepath = array('component' => '', 'package' => '', 'plugins' => array(), 'modules' => array());
+
+ /*
+ * The file path array
+ *
+ * @var string
+ */
+ public $filepath = array(
+ 'component' => '',
+ 'component-folder' => '',
+ 'package' => '',
+ 'plugins' => array(),
+ 'plugins-folders' => array(),
+ 'modules' => array()
+ );
+
// fixed pathes
protected $dynamicIntegration = false;
protected $backupPath = false;
@@ -58,7 +72,7 @@ class Compiler extends Infusion
// set some folder paths in relation to distribution
if ($config['backup'])
{
- $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath) . '/' . $this->componentBackupName . '.zip';
+ $this->backupPath = $this->params->get('backup_folder_path', $this->tempPath);
$this->dynamicIntegration = true;
}
// set local repos switch
@@ -539,8 +553,10 @@ class Compiler extends Infusion
private function zipComponent()
{
+ // Component Folder Name
+ $this->filepath['component-folder'] = $this->componentFolderName;
// the name of the zip file to create
- $this->filepath['component'] = $this->tempPath . '/' . $this->componentFolderName . '.zip';
+ $this->filepath['component'] = $this->tempPath . '/' . $this->filepath['component-folder'] . '.zip';
// Trigger Event: jcb_ce_onBeforeZipComponent
$this->triggerEvent('jcb_ce_onBeforeZipComponent', array(&$this->componentContext, &$this->componentPath, &$this->filepath['component'], &$this->tempPath, &$this->componentFolderName, &$this->componentData));
//create the zip file
@@ -552,7 +568,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$this->componentContext, &$this->filepath['component'], &$this->tempPath, &$this->backupPath, &$this->componentData));
// copy the zip to backup path
- JFile::copy($this->filepath['component'], $this->backupPath);
+ JFile::copy($this->filepath['component'], $this->backupPath . '/' . $this->componentBackupName . '.zip');
}
// move to sales server host
@@ -591,6 +607,8 @@ class Compiler extends Infusion
{
// set plugin context
$plugin_context = $plugin->file_name . '.' . $plugin->id;
+ // Component Folder Name
+ $this->filepath['plugins-folder'][$plugin->id] = $plugin->zip_name;
// the name of the zip file to create
$this->filepath['plugins'][$plugin->id] = $this->tempPath . '/' . $plugin->zip_name . '.zip';
// Trigger Event: jcb_ce_onBeforeZipPlugin
@@ -605,7 +623,7 @@ class Compiler extends Infusion
// Trigger Event: jcb_ce_onBeforeBackupZip
$this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__plugin_context, &$this->filepath['plugins'][$plugin->id], &$this->tempPath, &$this->backupPath, &$plugin));
// copy the zip to backup path
- JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath);
+ JFile::copy($this->filepath['plugins'][$plugin->id], $this->backupPath . '/' . $plugin->zip_name . '.zip');
}
// move to sales server host
diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php
index a2e07ff5c..fd043bcc5 100644
--- a/admin/helpers/compiler/a_Get.php
+++ b/admin/helpers/compiler/a_Get.php
@@ -6199,7 +6199,6 @@ class Get
'addurls',
'version_update',
'version_update_id'
-
)
)
);
@@ -6237,7 +6236,7 @@ class Get
// update the name if it has dynamic values
$plugin->name = $this->setPlaceholders($this->setDynamicValues($plugin->name), $this->placeholders);
// set official name
- $plugin->official_name = $plugin->name . ' ' . $plugin->group;
+ $plugin->official_name = ucwords($plugin->group . ' - ' . $plugin->name);
// set langPrefix
$this->langPrefix = 'PLG_' . strtoupper($plugin->group) . '_' . strtoupper($plugin->name);
// set lang prefix
@@ -6261,6 +6260,7 @@ class Get
}
else
{
+ $plugin->description = $this->setPlaceholders($this->setDynamicValues($plugin->description), $this->placeholders);
$this->setLangContent($plugin->key, $plugin->lang_prefix . '_DESCRIPTION', $plugin->description);
$plugin->description = '
' . $plugin->description . '
';
}
@@ -7410,6 +7410,8 @@ class Get
$localPaths['site'] = JPATH_ROOT . '/components/com_' . $this->componentCodeName;
// TODO later to include the JS and CSS
$localPaths['media'] = JPATH_ROOT . '/media/com_' . $this->componentCodeName;
+ // TODO plugin paths (just those linked to this component)
+ // $localPaths['plugin'] = JPATH_ROOT . '/plugins';
// check if the local install is found
foreach ($localPaths as $key => $localPath)
{
diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php
index c23fc8152..7519a0d6d 100644
--- a/admin/helpers/compiler/b_Structure.php
+++ b/admin/helpers/compiler/b_Structure.php
@@ -1140,12 +1140,9 @@ class Structure extends Get
if ($details->type === 'folder')
{
// only folders outside the standard folder are added
- if (!in_array($checker[0], $this->stdFolders))
- {
- $eNAME = 'FOLDERS';
- $ename = 'folder';
- $add_to_extra = true;
- }
+ $eNAME = 'FOLDERS';
+ $ename = 'folder';
+ $add_to_extra = true;
}
// if this is a file, it can only be added to the admin/site/media folders
// all other folders are moved as a whole so their files do not need to be declared
diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini
index 557aa45a1..85911efec 100644
--- a/admin/language/en-GB/en-GB.com_componentbuilder.ini
+++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini
@@ -3529,6 +3529,9 @@ COM_COMPONENTBUILDER_CONTRIBUTORS="Contributors"
COM_COMPONENTBUILDER_COPYRIGHT="Copyright"
COM_COMPONENTBUILDER_COPYRIGHT_S="Copyright: %s"
COM_COMPONENTBUILDER_COULD_NOT_CLEAR_THE_TMP_FOLDER="Could not clear the tmp folder!"
+COM_COMPONENTBUILDER_COULD_NOT_INSTALL_COMPONENT="Could not install component!"
+COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS="Could not install extentions!"
+COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN="Could not install plugin!"
COM_COMPONENTBUILDER_CREATE="Create"
COM_COMPONENTBUILDER_CREATE_A_SNIPPET="create a snippet"
COM_COMPONENTBUILDER_CREATE_NEW_S="Create new %s"
@@ -7080,6 +7083,7 @@ COM_COMPONENTBUILDER_NO_TYPE="No Type"
COM_COMPONENTBUILDER_NO_VALIDATION_RULES_FOUND="No validation rules found."
COM_COMPONENTBUILDER_OFFICIAL_VDM_PACKAGES="Official VDM Packages"
COM_COMPONENTBUILDER_ONLY_ONE_COMPONENT_CAN_BE_CLONED_AT_A_TIME_PLEASE_SELECT_ONE_AND_TRY_AGAIN="Only one component can be cloned at a time, please select one and try again!"
+COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="Only (%s.zip) file was removed the from tmp folder during installation!"
COM_COMPONENTBUILDER_ONLY_USE_THE_BNONE_DBB_OPTION_IF_YOU_ARE_PLANNING_ON_TARGETING_THIS_FIELD_WITH_JAVASCRIPTCUSTOM_PHP_TO_MOVE_ITS_VALUE_INTO_ANOTHER_FIELD_THAT_DOES_GET_SAVED_TO_THE_DATABASE="Only use the None DB option if you are planning on targeting this field with JavaScript/Custom PHP to move its value into another field that does get saved to the database."
COM_COMPONENTBUILDER_ON_GITHUB="on Github"
COM_COMPONENTBUILDER_OPEN="Open"
@@ -7410,7 +7414,7 @@ COM_COMPONENTBUILDER_SHOULD_THE_ZIPPED_PACKAGE_OF_THE_COMPONENT_BE_MOVED_TO_THE_
COM_COMPONENTBUILDER_SHOULD_THIS_FIELD_BE_ESCAPED_IN_THE_LIST_VIEW="Should this field be escaped in the list view."
COM_COMPONENTBUILDER_SHOULD_WE_BE_SHOWING_MORE_ELABORATE_INFORMATION_DURING_IMPORT="Should we be showing more elaborate information during import."
COM_COMPONENTBUILDER_SHOULD_WE_FORCE_THE_UPDATE_OF_ALL_LOCAL_DATA_EVEN_IF_IT_IS_NEWER_THEN_THE_DATA_BEING_IMPORTED="Should we force the update of all local data, even if it is newer then the data being imported."
-COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation) must and will still merge even of your selection is No, because of the singular nature of those areas."
+COM_COMPONENTBUILDER_SHOULD_WE_MERGE_THE_COMPONENTS_WITH_SIMILAR_LOCAL_COMPONENTS_MERGING_THE_COMPONENTS_USE_TO_BE_THE_DEFAULT_BEHAVIOUR_BUT_NOW_YOU_CAN_IMPORT_THE_COMPONENTS_AND_FORCE_IT_NOT_TO_MERGE_THE_FOLLOWING_AREAS_VALIDATION_RULE_FIELDTYPE_SNIPPET_LANGUAGE_LANGUAGE_TRANSLATION_JOOMLA_PLUGIN_GROUP_CLASS_EXTENDS_CLASS_PROPERTY_CLASS_METHOD_BMUST_AND_WILL_STILLB_MERGE_EVEN_OF_YOUR_SELECTION_IS_BNOB_BECAUSE_OF_THE_SINGULAR_NATURE_OF_THOSE_AREAS="Should we merge the component/s with similar local component/s. Merging the component/s use to be the default behaviour, but now you can import the component/s and force it not to merge. The following areas (validation_rule, fieldtype, snippet, language, language_translation, joomla_plugin_group, class_extends, class_property, class_method) must and will still merge even of your selection is No, because of the singular nature of those areas."
COM_COMPONENTBUILDER_SHOW_IN_LIST_VIEW="Show in list view"
COM_COMPONENTBUILDER_SHOW_ONLY="Show Only"
COM_COMPONENTBUILDER_SHOW_TOGGLE="Show Toggle"
@@ -8102,6 +8106,8 @@ COM_COMPONENTBUILDER_SUBMENU_VALIDATION_RULES="Validation Rules"
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_SZDEQZDMVSMHBTRWFIFTYTSQFLVVXJTMTHREEJTWOIXM="%szdEQzdmVsMHBtRW50T%sQFlvVXJTM3J2IXM="
+COM_COMPONENTBUILDER_SZIP_COULD_NOT_BE_INSTALLED="%s.zip could not be installed!"
+COM_COMPONENTBUILDER_SZIP_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION="%s.zip was removed the from tmp folder during installation!"
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"
@@ -8437,6 +8443,9 @@ COM_COMPONENTBUILDER_YOU_CAN_NOW_SELECT_THE_COMPONENT_BZIPB_PACKAGE_YOU_WOULD_LI
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THE_SERVER_DETAILS_BS_DENIEDB_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_INFO="You do not have permission to access the server details (%s - denied), please contact your system administrator for more info."
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONTACT_YOUR_SYSTEM_ADMINISTRATOR_FOR_MORE_HELP="You do not have permission to clone a component, please contact your system administrator for more help."
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_INSTALL_THESE_EXTENSIONS="You do not have permission to install these extensions!"
+COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_COMPONENT="You do not have permission to install the component!"
+COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_INSTALL_THE_PLUGIN="You do not have permission to install the plugin!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_EXPANSION_MODULE="You do not have permission to run the expansion module!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_GET_BOILERPLATE_MODULE="You do not have permission to run the get boilerplate module!"
COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_RUN_THE_TRANSLATOR_MODULE="You do not have permission to run the translator module!"
diff --git a/admin/models/ajax.php b/admin/models/ajax.php
index 68d1351af..55b7fc60f 100644
--- a/admin/models/ajax.php
+++ b/admin/models/ajax.php
@@ -2413,10 +2413,11 @@ class ComponentbuilderModelAjax extends JModelList
),
// #__componentbuilder_joomla_plugin (q)
'joomla_plugin' => array(
- 'search' => array('id', 'name', 'main_class_code'),
+ 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update',
+ 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'),
'views' => 'joomla_plugins',
- 'not_base64' => array(),
- 'name' => 'name'
+ 'not_base64' => array('description' => 'string'),
+ 'name' => 'system_name'
),
// #__componentbuilder_class_extends (r)
'class_extends' => array(
diff --git a/admin/models/compiler.php b/admin/models/compiler.php
index 8de83b0e5..ee5f739b5 100644
--- a/admin/models/compiler.php
+++ b/admin/models/compiler.php
@@ -163,15 +163,15 @@ class ComponentbuilderModelCompiler extends JModelList
$set['placeholders'] = $addPlaceholders;
$set['debuglinenr'] = $debugLinenr;
$set['minify'] = $minify;
- // start up Compiler
- $this->compiler = new Compiler($set);
+ // run compiler
+ $this->compiler = new Compiler($set);
if($this->compiler)
{
return true;
}
return false;
}
-
+
public function emptyFolder($dir, $removeDir = false)
{
jimport('joomla.filesystem.folder');
@@ -210,7 +210,7 @@ class ComponentbuilderModelCompiler extends JModelList
}
return false;
}
-
+
public function install($p_file)
{
$this->setState('action', 'install');
@@ -238,7 +238,7 @@ class ComponentbuilderModelCompiler extends JModelList
{
return false;
}
-
+
$config = JFactory::getConfig();
$tmp_dest = $config->get('tmp_path');
@@ -259,7 +259,7 @@ class ComponentbuilderModelCompiler extends JModelList
{
return false;
}
-
+
// Was the package unpacked?
if (!$package || !$package['type'])
{
@@ -280,7 +280,7 @@ class ComponentbuilderModelCompiler extends JModelList
}
else
{
- // Package installed sucessfully.
+ // Package installed successfully.
$msg = JText::sprintf('COM_INSTALLER_INSTALL_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type'])));
$result = true;
$msgType = 'message';
diff --git a/admin/models/import_joomla_components.php b/admin/models/import_joomla_components.php
index 6b3d2ab63..bb41bc50e 100644
--- a/admin/models/import_joomla_components.php
+++ b/admin/models/import_joomla_components.php
@@ -86,7 +86,7 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
protected $specialValue = false;
protected $checksum = null;
protected $checksumURLs = array('vdm' => 'https://raw.githubusercontent.com/vdm-io/JCB-Packages/master/', 'jcb' => 'https://raw.githubusercontent.com/vdm-io/JCB-Community-Packages/master/');
- protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation');
+ protected $mustMerge = array('validation_rule', 'fieldtype', 'snippet', 'language', 'language_translation', 'class_extends', 'class_property', 'class_method', 'joomla_plugin_group');
/**
* Import an spreadsheet from either folder, url or upload.
@@ -698,12 +698,13 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
// the array of tables to store
$tables = array(
- 'validation_rule','class_extends', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view','joomla_plugin_group',
- 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder','class_property','class_method','joomla_plugin',
+ 'validation_rule', 'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
+ 'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder', 'class_extends',
+ 'joomla_plugin_group', 'class_property', 'class_method', 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
- 'component_placeholders','component_plugins'
+ 'component_placeholders', 'component_plugins'
);
// get prefix
$prefix = $this->_db->getPrefix();
@@ -2096,6 +2097,56 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
// update the repeatable fields
$item = ComponentbuilderHelper::convertRepeatableFields($item, $updaterR);
break;
+ case 'joomla_plugin_group':
+ // diverged id already updated
+ if (!$diverged)
+ {
+ // update the class_extends ID where needed
+ $item = $this->setNewID($item, 'class_extends', 'class_extends', $type);
+ }
+ break;
+ case 'class_method':
+ case 'class_property':
+ // diverged id already updated
+ if (!$diverged)
+ {
+ // update the joomla_plugin_group ID where needed
+ $item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type);
+ }
+ break;
+ case 'joomla_plugin':
+ // diverged id already updated
+ if (!$diverged)
+ {
+ // update the class_extends ID where needed
+ $item = $this->setNewID($item, 'class_extends', 'class_extends', $type);
+ // update the joomla_plugin_group ID where needed
+ $item = $this->setNewID($item, 'joomla_plugin_group', 'joomla_plugin_group', $type);
+ }
+ // if we can't merge add postfix to name
+ if ($this->postfix)
+ {
+ $item->system_name = $item->system_name.$this->postfix;
+ }
+ // subform fields to target
+ $updaterT = array(
+ // subformfield => array( field => type_value )
+ 'fields' => array('field' => 'field'),
+ 'property_selection' => array('property' => 'class_property'),
+ 'method_selection' => array('method' => 'class_method')
+ );
+ // update the subform ids
+ $this->updateSubformsIDs($item, 'joomla_plugin', $updaterT);
+ break;
+ case 'joomla_plugin_files_folders_urls':
+ case 'joomla_plugin_updates':
+ // diverged id already updated
+ if (!$diverged)
+ {
+ // update the joomla_plugin ID where needed
+ $item = $this->setNewID($item, 'joomla_plugin', 'joomla_plugin', $type);
+ }
+ break;
case 'custom_code':
// update the component ID where needed
$item = $this->setNewID($item, 'component', 'joomla_component', $type);
@@ -2874,8 +2925,8 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
case 'component_config':
case 'component_dashboard':
case 'component_placeholders':
- case 'component_plugins':
case 'component_files_folders':
+ case 'component_plugins':
// get by joomla_component (since there should only be one of each component)
$getter = array('joomla_component');
$this->specialValue = array();
@@ -2903,8 +2954,109 @@ class ComponentbuilderModelImport_joomla_components extends JModelLegacy
}
break;
case 'language':
- // get by language tag since there should just be one
- $getter = 'langtag';
+ // get by language tag since there should just be one
+ $getter = 'langtag';
+ break;
+ case 'joomla_plugin':
+ // get
+ if ($retry == 3)
+ {
+ // get by names, exteneded and group only
+ $getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group');
+ }
+ elseif ($retry == 2)
+ {
+ // get by description
+ $getter = array('name', 'system_name', 'class_extends', 'joomla_plugin_group', 'description');
+ $retryAgain = 3;
+ }
+ else
+ {
+ // get by id
+ $getter = array('id', 'name', 'system_name', 'class_extends', 'joomla_plugin_group');
+ $retryAgain = 2;
+ }
+ $this->specialValue = array();
+ // Yet if diverged it makes sense that the ID is updated.
+ if ($diverged)
+ {
+ $this->specialValue['class_extends'] = (int) $item->class_extends;
+ $this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group;
+ }
+ elseif (isset($this->newID['class_extends'][(int) $item->class_extends]) && isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]))
+ {
+ $this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends];
+ $this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group];
+ }
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
+ break;
+ case 'joomla_plugin_files_folders_urls':
+ case 'joomla_plugin_updates':
+ // get by admin_view (since there should only be one of each name)
+ $getter = array('joomla_plugin');
+ $this->specialValue = array();
+ // Yet if diverged it makes sense that the ID is updated.
+ if ($diverged)
+ {
+ $this->specialValue['joomla_plugin'] = (int) $item->joomla_plugin;
+ }
+ elseif (isset($this->newID['joomla_plugin'][(int) $item->joomla_plugin]))
+ {
+ $this->specialValue['joomla_plugin'] = $this->newID['joomla_plugin'][(int) $item->joomla_plugin];
+ }
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
+ break;
+ case 'joomla_plugin_group':
+ // get by name since there should just be one
+ $getter = array('name', 'class_extends');
+ $this->specialValue = array();
+ // Yet if diverged it makes sense that the ID is updated.
+ if ($diverged)
+ {
+ $this->specialValue['class_extends'] = (int) $item->class_extends;
+ }
+ elseif (isset($this->newID['class_extends'][(int) $item->class_extends]))
+ {
+ $this->specialValue['class_extends'] = $this->newID['class_extends'][(int) $item->class_extends];
+ }
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
+ break;
+ case 'class_extends':
+ case 'class_method':
+ case 'class_property':
+ // get by name since there should just be one
+ $getter = array('name', 'extension_type');
+ // Yet if diverged it makes sense that the ID is updated.
+ if ('plugins' === $item->extension_type && isset($item->joomla_plugin_group))
+ {
+ $getter[] = 'joomla_plugin_group';
+ $this->specialValue = array();
+ if ($diverged)
+ {
+ $this->specialValue['joomla_plugin_group'] = (int) $item->joomla_plugin_group;
+ }
+ elseif (isset($this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group]))
+ {
+ $this->specialValue['joomla_plugin_group'] = $this->newID['joomla_plugin_group'][(int) $item->joomla_plugin_group];
+ }
+ // (TODO) I have seen this happen, seems dangerous!
+ else
+ {
+ return false;
+ }
+ }
break;
default:
// can't be found so return false
diff --git a/admin/models/joomla_components.php b/admin/models/joomla_components.php
index 59fed7542..b47b82d63 100644
--- a/admin/models/joomla_components.php
+++ b/admin/models/joomla_components.php
@@ -303,7 +303,8 @@ class ComponentbuilderModelJoomla_components extends JModelList
'component_mysql_tweaks' => 'joomla_component',
'component_custom_admin_menus' => 'joomla_component',
'component_dashboard' => 'joomla_component',
- 'component_placeholders' => 'joomla_component' );
+ 'component_placeholders' => 'joomla_component',
+ 'component_plugins' => 'joomla_component');
// load all tables linked to joomla_component
foreach($linkedTables as $table => $field)
{
@@ -317,6 +318,13 @@ class ComponentbuilderModelJoomla_components extends JModelList
$this->setData('admin_fields_relations', array_values($this->smartIDs['admin_view']), 'admin_view');
$this->setData('admin_custom_tabs', array_values($this->smartIDs['admin_view']), 'admin_view');
}
+ // add joomla plugin
+ if (isset($this->smartIDs['joomla_plugin']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin']))
+ {
+ $this->setData('joomla_plugin', array_values($this->smartIDs['joomla_plugin']), 'id');
+ $this->setData('joomla_plugin_updates', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
+ $this->setData('joomla_plugin_files_folders_urls', array_values($this->smartIDs['joomla_plugin']), 'joomla_plugin');
+ }
// add validation rules
if (isset($this->smartIDs['validation_rule']) && ComponentbuilderHelper::checkArray($this->smartIDs['validation_rule']))
{
@@ -345,6 +353,26 @@ class ComponentbuilderModelJoomla_components extends JModelList
// only if exporting
if ('clone' !== $this->activeType)
{
+ // add class_property
+ if (isset($this->smartIDs['class_property']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_property']))
+ {
+ $this->setData('class_property', array_values($this->smartIDs['class_property']), 'id');
+ }
+ // add class_method
+ if (isset($this->smartIDs['class_method']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_method']))
+ {
+ $this->setData('class_method', array_values($this->smartIDs['class_method']), 'id');
+ }
+ // add joomla_plugin_group
+ if (isset($this->smartIDs['joomla_plugin_group']) && ComponentbuilderHelper::checkArray($this->smartIDs['joomla_plugin_group']))
+ {
+ $this->setData('joomla_plugin_group', array_values($this->smartIDs['joomla_plugin_group']), 'id');
+ }
+ // add class_extends
+ if (isset($this->smartIDs['class_extends']) && ComponentbuilderHelper::checkArray($this->smartIDs['class_extends']))
+ {
+ $this->setData('class_extends', array_values($this->smartIDs['class_extends']), 'id');
+ }
// add snippets
if (isset($this->smartIDs['snippet']) && ComponentbuilderHelper::checkArray($this->smartIDs['snippet']))
{
@@ -612,7 +640,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set search array
if ('site_view' === $table || 'custom_admin_view' === $table)
{
- $searchArray = array('php_view','php_jview','php_jview_display','php_document','js_document','css_document','css');
+ $searchArray = array('php_view', 'php_jview', 'php_jview_display', 'php_document', 'js_document', 'css_document', 'css');
}
// reset the global array
if ('template' === $table)
@@ -683,7 +711,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
// set the placeholder ID's
$this->setCodePlaceholdersIds($item, $table, 'placeholder');
// actions to take if table is component_files_folders
- if ('component_files_folders' === $table && 'clone' !== $this->activeType)
+ if (('component_files_folders' === $table || 'joomla_plugin_files_folders_urls' === $table) && 'clone' !== $this->activeType)
{
// build files
$this->moveIt($this->getValues($item->addfiles, 'subform', 'file', null), 'file');
@@ -718,6 +746,12 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add custom admin views
$this->setData('custom_admin_view', $this->getValues($item->addcustom_admin_views, 'subform', 'customadminview'), 'id');
}
+ // actions to take if table is component_plugins
+ if ('component_plugins' === $table)
+ {
+ // add custom admin views
+ $this->setData('joomla_plugin', $this->getValues($item->addjoomla_plugins, 'subform', 'plugin'), 'id');
+ }
// actions to take if table is admin_view
if ('admin_view' === $table)
{
@@ -845,6 +879,34 @@ class ComponentbuilderModelJoomla_components extends JModelList
// add dynamic gets
$this->setSmartIDs((int) $item->dynamic_get, 'dynamic_get');
}
+ // actions to take if table is joomla_plugin
+ if ('joomla_plugin' === $table)
+ {
+ // add the updates and folder stuff
+ $this->setSmartIDs($item->id, 'joomla_plugin');
+ // add class_extends
+ $this->setSmartIDs((int) $item->class_extends, 'class_extends');
+ // add joomla_plugin_group
+ $this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group');
+ // add fields
+ $this->setData('field', $this->getValues($item->fields, 'subform', 'field'), 'id');
+ // add property_selection
+ $this->setData('class_property', $this->getValues($item->property_selection, 'subform', 'property'), 'id');
+ // add class_method
+ $this->setData('class_method', $this->getValues($item->method_selection, 'subform', 'method'), 'id');
+ }
+ // actions to take if table is joomla_plugin_group
+ if ('joomla_plugin_group' === $table)
+ {
+ // add class_extends
+ $this->setSmartIDs((int) $item->class_extends, 'class_extends');
+ }
+ // actions to take if table is class_method or
+ if ('class_method' === $table || 'class_property' === $table )
+ {
+ // add joomla_plugin_group
+ $this->setSmartIDs((int) $item->joomla_plugin_group, 'joomla_plugin_group');
+ }
}
}
}
@@ -882,10 +944,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
$tables = array(
'fieldtype', 'field', 'admin_view', 'snippet', 'dynamic_get', 'custom_admin_view', 'site_view',
'template', 'layout', 'joomla_component', 'language', 'language_translation', 'custom_code', 'placeholder',
+ 'joomla_plugin', 'joomla_plugin_files_folders_urls', 'joomla_plugin_updates',
'admin_fields', 'admin_fields_conditions', 'admin_fields_relations', 'admin_custom_tabs', 'component_admin_views',
'component_site_views', 'component_custom_admin_views', 'component_updates', 'component_mysql_tweaks',
'component_custom_admin_menus', 'component_config', 'component_dashboard', 'component_files_folders',
- 'component_placeholders'
+ 'component_placeholders', 'component_plugins'
);
// smart table loop
foreach ($tables as $table)
@@ -1824,10 +1887,11 @@ class ComponentbuilderModelJoomla_components extends JModelList
),
// #__componentbuilder_joomla_plugin (q)
'joomla_plugin' => array(
- 'search' => array('id', 'name', 'main_class_code'),
+ 'search' => array('id', 'system_name', 'name', 'main_class_code', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update',
+ 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall'),
'views' => 'joomla_plugins',
- 'not_base64' => array(),
- 'name' => 'name'
+ 'not_base64' => array('description' => 'string'),
+ 'name' => 'system_name'
),
// #__componentbuilder_class_extends (r)
'class_extends' => array(
diff --git a/admin/models/joomla_plugins.php b/admin/models/joomla_plugins.php
index ebf02fcdc..86d9d6107 100644
--- a/admin/models/joomla_plugins.php
+++ b/admin/models/joomla_plugins.php
@@ -136,17 +136,13 @@ class ComponentbuilderModelJoomla_plugins extends JModelList
// extract the boilerplate class property and methods
if (($classProperiesMethods = ComponentbuilderHelper::extractBoilerplateClassPropertiesMethods($fooClass, $classExtends, 'plugins', $pluginGroupID)) !== false)
{
- // create the properties found (TODO just create for now but we could later add a force update)
+ // create the properties found
if (isset($classProperiesMethods['property']) && ComponentbuilderHelper::checkArray($classProperiesMethods['property']))
{
foreach ($classProperiesMethods['property'] as $_property)
{
- // does not exist, so create
- if ($_property['id'] == 0)
- {
- // store the property
- $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app);
- }
+ // force update by default
+ $this->storePluginBoilerplate($tables['p'], $models['p'], $_property, $app);
}
}
// create the method found (TODO just create for now but we could later add a force update)
@@ -154,12 +150,8 @@ class ComponentbuilderModelJoomla_plugins extends JModelList
{
foreach ($classProperiesMethods['method'] as $_method)
{
- // does not exist, so create
- if ($_method['id'] == 0)
- {
- // store the method
- $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app);
- }
+ // force update by default
+ $this->storePluginBoilerplate($tables['m'], $models['m'], $_method, $app);
}
}
}
diff --git a/admin/views/compiler/tmpl/default.php b/admin/views/compiler/tmpl/default.php
index 2da0f0f65..040f84dcb 100644
--- a/admin/views/compiler/tmpl/default.php
+++ b/admin/views/compiler/tmpl/default.php
@@ -22,13 +22,25 @@ JHtml::_('behavior.formvalidation');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
?>
-canDo->get('compiler.access')): ?>
+canDo->get('compiler.access')): ?>
+