From e4d1917c1930c2a625b07a2afd2649f6b134f2f1 Mon Sep 17 00:00:00 2001 From: Llewellyn van der Merwe Date: Fri, 6 Dec 2019 07:31:32 +0200 Subject: [PATCH] Added Joomla Module builder - Compiler --- README.md | 14 +- admin/README.txt | 14 +- admin/access.xml | 21 + admin/controller.php | 1 + admin/controllers/compiler.php | 125 +++- admin/helpers/compiler.php | 135 +++- admin/helpers/compiler/a_Get.php | 630 +++++++++++++++++- admin/helpers/compiler/b_Structure.php | 380 +++++++++++ admin/helpers/compiler/e_Interpretation.php | 315 ++++++++- admin/helpers/compiler/f_Infusion.php | 72 +- .../en-GB/en-GB.com_componentbuilder.ini | 142 +++- .../en-GB/en-GB.com_componentbuilder.sys.ini | 20 + .../layouts/joomla_module/code_fullwidth.php | 3 +- admin/layouts/joomla_module/code_left.php | 3 +- admin/layouts/joomla_module/code_right.php | 2 +- admin/layouts/joomla_module/html_left.php | 2 +- .../server/linked_components_fullwidth.php | 5 + admin/models/ajax.php | 71 +- admin/models/componentbuilder.php | 3 + admin/models/forms/custom_code.js | 4 +- admin/models/forms/joomla_module.js | 135 +++- admin/models/forms/joomla_module.xml | 459 +++++++------ admin/models/forms/placeholder.js | 4 +- admin/models/joomla_components.php | 26 +- admin/models/joomla_module.php | 220 +++--- admin/sql/install.mysql.utf8.sql | 39 +- admin/sql/uninstall.mysql.utf8.sql | 1 + admin/views/compiler/tmpl/default.php | 4 +- .../joomla_components/tmpl/default_body.php | 5 + admin/views/joomla_module/tmpl/edit.php | 66 +- componentbuilder.xml | 7 +- componentbuilder_update_server.xml | 36 +- script.php | 213 +++++- 33 files changed, 2648 insertions(+), 529 deletions(-) diff --git a/README.md b/README.md index b259ba7da..278ffa496 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.8) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -144,14 +144,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 3rd December, 2019 -+ *Version*: 2.10.6 ++ *Last Build*: 6th December, 2019 ++ *Version*: 2.10.8 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **273117** -+ *Field count*: **1474** -+ *File count*: **1719** -+ *Folder count*: **274** ++ *Line count*: **277334** ++ *Field count*: **1491** ++ *File count*: **1766** ++ *Folder count*: **287** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/README.txt b/admin/README.txt index b259ba7da..278ffa496 100644 --- a/admin/README.txt +++ b/admin/README.txt @@ -12,7 +12,7 @@ The Component Builder for [Joomla](https://extensions.joomla.org/extension/compo Whether you're a seasoned [Joomla](https://extensions.joomla.org/extension/component-builder/) developer, or have just started, Component Builder will safe you lots of time and money. A real must have! -You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.6) with **ALL** its features and **ALL** concepts totally open-source and free! +You can install it quite easily and with no limitations. On [github](https://github.com/vdm-io/Joomla-Component-Builder/releases) is the latest release (2.10.8) with **ALL** its features and **ALL** concepts totally open-source and free! > Watch Quick Build of a Hello World component in [JCB on Youtube](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45) @@ -144,14 +144,14 @@ TODO + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *First Build*: 30th April, 2015 -+ *Last Build*: 3rd December, 2019 -+ *Version*: 2.10.6 ++ *Last Build*: 6th December, 2019 ++ *Version*: 2.10.8 + *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved. + *License*: GNU General Public License version 2 or later; see LICENSE.txt -+ *Line count*: **273117** -+ *Field count*: **1474** -+ *File count*: **1719** -+ *Folder count*: **274** ++ *Line count*: **277334** ++ *Field count*: **1491** ++ *File count*: **1766** ++ *Folder count*: **287** > This **component** was build with a [Joomla](https://extensions.joomla.org/extension/component-builder/) [Automated Component Builder](http://joomlacomponentbuilder.com). > Developed by [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) diff --git a/admin/access.xml b/admin/access.xml index 2a10e68fd..e5398db15 100644 --- a/admin/access.xml +++ b/admin/access.xml @@ -171,6 +171,16 @@ + + + + + + + + + + @@ -914,6 +924,17 @@ +
+ + + + + + + + + +
diff --git a/admin/controller.php b/admin/controller.php index 845a287ac..a1343cbce 100644 --- a/admin/controller.php +++ b/admin/controller.php @@ -127,6 +127,7 @@ class ComponentbuilderController extends JControllerLegacy 'component_files_folders' => 'components_files_folders', 'component_placeholders' => 'components_placeholders', 'component_plugins' => 'components_plugins', + 'component_modules' => 'components_modules', 'snippet_type' => 'snippet_types', 'library_config' => 'libraries_config', 'library_files_folders_urls' => 'libraries_files_folders_urls', diff --git a/admin/controllers/compiler.php b/admin/controllers/compiler.php index 6ab2fb822..01b02a95e 100644 --- a/admin/controllers/compiler.php +++ b/admin/controllers/compiler.php @@ -95,14 +95,30 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin } $message .= '

'; + // switch to set multi install button + $add_multi_install = true; + // check if we have modules + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['modules'])) + { + foreach ($model->compiler->filepath['modules-folder'] as $module_id => $module_folder) + { + $message .= '

'; + } + } // check if we have plugins if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) { + $add_multi_install = true; foreach ($model->compiler->filepath['plugins-folder'] as $plugin_id => $plugin_folder) { $message .= '

'; } + } + // set multi install button + if ($add_multi_install) + { $message .= '

You can install all compiled extensions!

'; $message .= '

'; @@ -122,31 +138,63 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $message .= '

'.$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

'; - // check if we have plugins - if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) + // check if we have modules or plugins + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins']) || ComponentbuilderHelper::checkArray($model->compiler->filepath['modules'])) { - $plugin_url = array(); $message .= '

Path to Zip Files

'; $message .= '

Component Path: ' . $model->compiler->filepath['component'] . '
'; $message .= 'Component URL: ' . $url . '

'; - // load the plugins path/url - foreach ($model->compiler->filepath['plugins'] as $plugin_id => $plugin_path) + // load plugins if found + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) { - // set plugin path - $message .= 'Plugin Path: ' . $plugin_path . '
'; - if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE) + $plugin_urls = array(); + // load the plugins path/url + foreach ($model->compiler->filepath['plugins'] as $plugin_id => $plugin_path) { - $plugin_urls[$plugin_id] = JURI::root() . substr($plugin_path, $pos + 1); - $message .= 'Plugin URL: ' . $plugin_urls[$plugin_id] . '
'; + // set plugin path + $message .= 'Plugin Path: ' . $plugin_path . '
'; + if (($pos = strpos($plugin_path, "/tmp/")) !== FALSE) + { + $plugin_urls[$plugin_id] = JURI::root() . substr($plugin_path, $pos + 1); + $message .= 'Plugin URL: ' . $plugin_urls[$plugin_id] . '
'; + } + } + } + // load modules if found + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['modules'])) + { + $module_urls = array(); + // load the modules path/url + foreach ($model->compiler->filepath['modules'] as $module_id => $module_path) + { + // set module path + $message .= 'Module Path: ' . $module_path . '
'; + if (($pos = strpos($module_path, "/tmp/")) !== FALSE) + { + $module_urls[$module_id] = JURI::root() . substr($module_path, $pos + 1); + $message .= 'Module URL: ' . $module_urls[$module_id] . '
'; + } } } $message .= '
Hey! you can also download these zip files right now!
'; $message .= 'Download Component  '; - // load the plugin download URL's - foreach ($plugin_urls as $plugin_id => $plugin_url) + // load the module download URL's + if (isset($module_urls) && ComponentbuilderHelper::checkArray($module_urls)) { - $message .= ' '; - $message .= 'Download ' . $model->compiler->filepath['plugins-folder'][$plugin_id] . '  '; + foreach ($module_urls as $module_id => $module_url) + { + $message .= ' '; + $message .= 'Download ' . $model->compiler->filepath['modules-folder'][$module_id] . '  '; + } + } + // load the plugin download URL's + if (isset($plugin_urls) && ComponentbuilderHelper::checkArray($plugin_urls)) + { + foreach ($plugin_urls as $plugin_id => $plugin_url) + { + $message .= ' '; + $message .= 'Download ' . $model->compiler->filepath['plugins-folder'][$plugin_id] . '  '; + } } $message .= '

'; $message .= '

Remember! These zip files are in your tmp folder and therefore publicly accessible until you click [Clear tmp]!

'; @@ -164,6 +212,11 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin // set redirect $this->setRedirect($redirect_url, $message, 'message'); $app->setUserState('com_componentbuilder.component_folder_name', $model->compiler->filepath['component-folder']); + // check if we have modules + if (ComponentbuilderHelper::checkArray($model->compiler->filepath['modules'])) + { + $app->setUserState('com_componentbuilder.modules_folder_name', $model->compiler->filepath['modules-folder']); + } // check if we have plugins if (ComponentbuilderHelper::checkArray($model->compiler->filepath['plugins'])) { @@ -177,6 +230,7 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $app->setUserState('com_componentbuilder.message', ''); $app->setUserState('com_componentbuilder.extension_message', ''); $app->setUserState('com_componentbuilder.component_folder_name', ''); + $app->setUserState('com_componentbuilder.modules_folder_name', ''); $app->setUserState('com_componentbuilder.plugins_folder_name', ''); // set redirect $this->setRedirect($redirect_url, $message); @@ -205,8 +259,14 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_EXTENTIONS'); $_message = array('success' => array(), 'error' => array()); $app = JFactory::getApplication(); - $fileNames = $app->getUserState('com_componentbuilder.plugins_folder_name', array()); + // start file name array + $fileNames = array(); $fileNames[] = $app->getUserState('com_componentbuilder.component_folder_name', null); + // check if we have modules + $fileNames = ComponentbuilderHelper::mergeArrays(array($fileNames, $app->getUserState('com_componentbuilder.modules_folder_name', array()) )); + // check if we have plugins + $fileNames = ComponentbuilderHelper::mergeArrays(array($fileNames, $app->getUserState('com_componentbuilder.plugins_folder_name', array()) )); + // loop and install all extensions found foreach ($fileNames as $fileName) { if ($this->installExtension($fileName)) @@ -263,6 +323,41 @@ class ComponentbuilderControllerCompiler extends JControllerAdmin return false; } + /** + * Install Compiled Module + * + * @return true on success + */ + public function installCompiledModule() + { + // 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_MODULE'); + if($user->authorise('core.admin')) + { + $message = JText::_('COM_COMPONENTBUILDER_COULD_NOT_INSTALL_MODULE'); + $app = JFactory::getApplication(); + $fileNames = $app->getUserState('com_componentbuilder.modules_folder_name'); + if (ComponentbuilderHelper::checkArray($fileNames)) + { + $jinput = JFactory::getApplication()->input; + $moduleId = $jinput->post->get('install_item_id', 0, 'INT'); + if ($moduleId > 0 && isset($fileNames[$moduleId]) && $this->installExtension($fileNames[$moduleId])) + { + $message = JText::sprintf('COM_COMPONENTBUILDER_ONLY_SZIP_FILE_WAS_REMOVED_THE_FROM_TMP_FOLDER_DURING_INSTALLATION', $fileNames[$moduleId]); + $this->setRedirect($redirect_url, $message, 'message'); + return true; + } + } + } + $this->setRedirect($redirect_url, $message, 'error'); + return false; + } + /** * Install Compiled Plugin * diff --git a/admin/helpers/compiler.php b/admin/helpers/compiler.php index a5d4d97aa..7928f0e45 100644 --- a/admin/helpers/compiler.php +++ b/admin/helpers/compiler.php @@ -157,6 +157,8 @@ class Compiler extends Infusion // done with error return false; } + // if there are modules zip them + $this->zipModules(); // if there are plugins zip them $this->zipPlugins(); // do lang mismatch check @@ -268,6 +270,62 @@ class Compiler extends Infusion } // free up some memory unset($this->newFiles['dynamic']); + // do modules if found + if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + { + foreach ($this->joomlaModules as $module) + { + if (ComponentbuilderHelper::checkObject($module) && isset($this->newFiles[$module->key]) && ComponentbuilderHelper::checkArray($this->newFiles[$module->key])) + { + // move field or rule if needed + if (isset($module->fields_rules_paths) && $module->fields_rules_paths == 2) + { + // check the config fields + if (isset($module->config_fields) && ComponentbuilderHelper::checkArray($module->config_fields)) + { + foreach ($module->config_fields as $field_name => $fieldsets) + { + foreach ($fieldsets as $fieldset => $fields) + { + foreach ($fields as $field) + { + $this->moveFieldsRules($field, $module->folder_path); + } + } + } + } + // check the fieldsets + if (isset($module->form_files) && ComponentbuilderHelper::checkArray($module->form_files)) + { + foreach($module->form_files as $file => $files) + { + foreach ($files as $field_name => $fieldsets) + { + foreach ($fieldsets as $fieldset => $fields) + { + foreach ($fields as $field) + { + $this->moveFieldsRules($field, $module->folder_path); + } + } + } + } + } + } + // update the module files + foreach ($this->newFiles[$module->key] as $module_file) + { + if (JFile::exists($module_file['path'])) + { + $this->setFileContent($module_file['name'], $module_file['path'], $bom, $module->key); + } + } + // free up some memory + unset($this->newFiles[$module->key]); + unset($this->fileContentDynamic[$module->key]); + } + } + } // do plugins if found if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) { @@ -310,7 +368,7 @@ class Compiler extends Infusion } } } - // now move the files + // update the plugin files foreach ($this->newFiles[$plugin->key] as $plugin_file) { if (JFile::exists($plugin_file['path'])) @@ -572,6 +630,27 @@ class Compiler extends Infusion // Trigger Event: jcb_ce_onAfterUpdateRepo $this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$this->componentContext, &$this->componentPath, &$repoFullPath, &$this->componentData)); + // move the modules to local folder repos + if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + { + foreach ($this->joomlaModules as $module) + { + if (ComponentbuilderHelper::checkObject($module) && isset($module->file_name)) + { + $module_context = 'module.' . $module->file_name . '.' . $module->id; + // set the repo path + $repoFullPath = $this->repoPath . '/' . $module->folder_name . '__joomla_' . $this->joomlaVersion; + // Trigger Event: jcb_ce_onBeforeUpdateRepo + $this->triggerEvent('jcb_ce_onBeforeUpdateRepo', array(&$module_context, &$module->folder_path, &$repoFullPath, &$module)); + // remove old data + $this->removeFolder($repoFullPath, $this->componentData->toignore); + // set the new data + JFolder::copy($module->folder_path, $repoFullPath, '', true); + // Trigger Event: jcb_ce_onAfterUpdateRepo + $this->triggerEvent('jcb_ce_onAfterUpdateRepo', array(&$module_context, &$module->folder_path, &$repoFullPath, &$module)); + } + } + } // move the plugins to local folder repos if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) { @@ -639,6 +718,60 @@ class Compiler extends Infusion return false; } + private function zipModules() + { + if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + { + foreach ($this->joomlaModules as $module) + { + if (ComponentbuilderHelper::checkObject($module) && isset($module->zip_name) + && ComponentbuilderHelper::checkString($module->zip_name) + && isset($module->folder_path) + && ComponentbuilderHelper::checkString($module->folder_path)) + { + // set module context + $module_context = $module->file_name . '.' . $module->id; + // Component Folder Name + $this->filepath['modules-folder'][$module->id] = $module->zip_name; + // the name of the zip file to create + $this->filepath['modules'][$module->id] = $this->tempPath . '/' . $module->zip_name . '.zip'; + // Trigger Event: jcb_ce_onBeforeZipModule + $this->triggerEvent('jcb_ce_onBeforeZipModule', array(&$module_context, &$module->folder_path, &$this->filepath['modules'][$module->id], &$this->tempPath, &$module->zip_name, &$module)); + //create the zip file + if (ComponentbuilderHelper::zip($module->folder_path, $this->filepath['modules'][$module->id])) + { + // now move to backup if zip was made and backup is required + if ($this->backupPath) + { + $__module_context = 'module.' . $module_context; + // Trigger Event: jcb_ce_onBeforeBackupZip + $this->triggerEvent('jcb_ce_onBeforeBackupZip', array(&$__module_context, &$this->filepath['modules'][$module->id], &$this->tempPath, &$this->backupPath, &$module)); + // copy the zip to backup path + JFile::copy($this->filepath['modules'][$module->id], $this->backupPath . '/' . $module->zip_name . '.zip'); + } + + // move to sales server host + if ($module->add_sales_server == 1) + { + // make sure we have the correct file + if (isset($module->sales_server)) + { + // Trigger Event: jcb_ce_onBeforeMoveToServer + $this->triggerEvent('jcb_ce_onBeforeMoveToServer', array(&$__module_context, &$this->filepath['modules'][$module->id], &$this->tempPath, &$module->zip_name, &$module)); + // move to server + ComponentbuilderHelper::moveToServer($this->filepath['modules'][$module->id], $module->zip_name . '.zip', (int) $module->sales_server, $module->sales_server_protocol); + } + } + // Trigger Event: jcb_ce_onAfterZipModule + $this->triggerEvent('jcb_ce_onAfterZipModule', array(&$module_context, &$this->filepath['modules'][$module->id], &$this->tempPath, &$module->zip_name, &$module)); + // remove the module folder since we are done + $this->removeFolder($module->folder_path); + } + } + } + } + } + private function zipPlugins() { if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) diff --git a/admin/helpers/compiler/a_Get.php b/admin/helpers/compiler/a_Get.php index f2c632566..f7dc8ed6f 100644 --- a/admin/helpers/compiler/a_Get.php +++ b/admin/helpers/compiler/a_Get.php @@ -129,6 +129,13 @@ class Get */ public $joomlaPlugins = array(); + /** + * The Modules data + * + * @var array + */ + public $joomlaModules = array(); + /** * The custom script placeholders - we use the (xxx) to avoid detection it should be (***) * ##################################---> PHP/JS <---#################################### @@ -1036,6 +1043,7 @@ class Get 'j.addfoldersfullpath' => 'addfoldersfullpath', 'c.addsite_views' => 'addsite_views', 'l.addjoomla_plugins' => 'addjoomla_plugins', + 'k.addjoomla_modules' => 'addjoomla_modules', 'i.dashboard_tab' => 'dashboard_tab', 'i.php_dashboard_methods' => 'php_dashboard_methods', 'i.id' => 'component_dashboard_id', @@ -1062,7 +1070,8 @@ class Get 'h' => 'component_config', 'i' => 'component_dashboard', 'j' => 'component_files_folders', - 'l' => 'component_plugins' + 'l' => 'component_plugins', + 'k' => 'component_modules' ); // load the joins foreach($joiners as $as => $join) @@ -1683,12 +1692,26 @@ class Get // the default is to ignore the repo folder $component->toignore = array('.git'); } + // get all modules + $component->addjoomla_modules = (isset($component->addjoomla_modules) && ComponentbuilderHelper::checkJson($component->addjoomla_modules)) ? json_decode($component->addjoomla_modules, true) : null; + if (ComponentbuilderHelper::checkArray($component->addjoomla_modules)) + { + $joomla_modules = array_map(function($array) use(&$component) { + // only load the modules whose target association calls for it + if (!isset($array['target']) || $array['target'] != 2) + { + return $this->setJoomlaModule($array['module'], $component); + } + return null; + }, array_values($component->addjoomla_modules)); + } + unset($component->addjoomla_modules); // get all plugins $component->addjoomla_plugins = (isset($component->addjoomla_plugins) && ComponentbuilderHelper::checkJson($component->addjoomla_plugins)) ? json_decode($component->addjoomla_plugins, true) : null; if (ComponentbuilderHelper::checkArray($component->addjoomla_plugins)) { $joomla_plugins = array_map(function($array) use(&$component) { - // only load the plugins whose target association calles for it + // only load the plugins whose target association calls for it if (!isset($array['target']) || $array['target'] != 2) { return $this->setJoomlaPlugin($array['plugin'], $component); @@ -4523,7 +4546,7 @@ class Get // check if the lib has already been set if (!isset($this->libraries[$id])) { - // make sure we should continue and that the lib is not already bein loaded + // make sure we should continue and that the lib is not already being loaded switch ($id) { case 1: // No Library @@ -6218,6 +6241,576 @@ class Get return false; } + /** + * get the Joomla Modules IDs + * + * @return array of IDs on success + * + */ + protected function getModuleIDs() + { + if (($addjoomla_modules = ComponentbuilderHelper::getVar('component_modules', $this->componentID, 'joomla_component', 'addjoomla_modules')) !== false) + { + $addjoomla_modules = (ComponentbuilderHelper::checkJson($addjoomla_modules)) ? json_decode($addjoomla_modules, true) : null; + if (ComponentbuilderHelper::checkArray($addjoomla_modules)) + { + $joomla_modules = array_filter( + array_values($addjoomla_modules), + function($array){ + // only load the modules whose target association call for it + if (!isset($array['target']) || $array['target'] != 2) + { + return true; + } + return false; + }); + // if we have values we return IDs + if (ComponentbuilderHelper::checkArray($joomla_modules)) + { + return array_map(function($array){ + return (int) $array['module']; + }, $joomla_modules); + } + } + } + return false; + } + + /** + * set the Joomla modules + * + * @return true + * + */ + public function setJoomlaModule($id, &$component) + { + if (isset($this->joomlaModules[$id])) + { + return true; + } + else + { + // Create a new query object. + $query = $this->db->getQuery(true); + + $query->select('a.*'); + $query->select( + $this->db->quoteName( + array( + 'f.addfiles', + 'f.addfolders', + 'f.addfilesfullpath', + 'f.addfoldersfullpath', + 'f.addurls', + 'u.version_update', + 'u.id' + ), array( + 'addfiles', + 'addfolders', + 'addfilesfullpath', + 'addfoldersfullpath', + 'addurls', + 'version_update', + 'version_update_id' + ) + ) + ); + // from these tables + $query->from('#__componentbuilder_joomla_module AS a'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_module_updates', 'u') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('u.joomla_module') . ')'); + $query->join('LEFT', $this->db->quoteName('#__componentbuilder_joomla_module_files_folders_urls', 'f') . ' ON (' . $this->db->quoteName('a.id') . ' = ' . $this->db->quoteName('f.joomla_module') . ')'); + $query->where($this->db->quoteName('a.id') . ' = ' . (int) $id); + $query->where($this->db->quoteName('a.published') . ' >= 1'); + $this->db->setQuery($query); + $this->db->execute(); + if ($this->db->getNumRows()) + { + // get the module data + $module = $this->db->loadObject(); + // tweak system to set stuff to the module domain + $_backup_target = $this->target; + $_backup_lang = $this->lang; + $_backup_langPrefix = $this->langPrefix; + // set some keys + $module->target_type = 'M0dU|3'; + $module->key = $module->id . '_' . $module->target_type; + // update to point to module + $this->target = $module->key; + $this->lang = $module->key; + // set version if not set + if (empty($module->module_version)) + { + $module->module_version = '1.0.0'; + } + // set GUI mapper + $guiMapper = array( 'table' => 'joomla_module', 'id' => (int) $id, 'type' => 'php'); + // update the name if it has dynamic values + $module->name = $this->setPlaceholders($this->setDynamicValues($module->name), $this->placeholders); + // update the name if it has dynamic values + $module->code_name = ComponentbuilderHelper::safeClassFunctionName($module->name); + // set official name + $module->official_name = ucwords($module->name); + // set langPrefix + $this->langPrefix = 'MOD_' . strtoupper($module->code_name); + // set lang prefix + $module->lang_prefix = $this->langPrefix; + // set module class name + $module->class_helper_name = 'Mod' . ucfirst($module->code_name) . 'Helper'; + $module->class_data_name = 'Mod' . ucfirst($module->code_name) . 'Data'; + // set module install class name + $module->installer_class_name = 'mod_' . ucfirst($module->code_name) . 'InstallerScript'; + // set module folder name + $module->folder_name = 'mod_' . strtolower($module->code_name); + // set the zip name + $module->zip_name = $module->folder_name . '_v' . str_replace('.', '_', $module->module_version). '__J' . $this->joomlaVersion; + // set module file name + $module->file_name = $module->folder_name; + // set official_name lang strings + $this->setLangContent($module->key, $this->langPrefix, $module->official_name); + // set some placeholder for this module + $this->placeholders[$this->bbb . 'Module_name' . $this->ddd] = $module->official_name; + $this->placeholders[$this->bbb . 'Module' . $this->ddd] = ucfirst($module->code_name); + $this->placeholders[$this->bbb . 'module' . $this->ddd] = strtolower($module->code_name); + $this->placeholders[$this->bbb . 'module.version' . $this->ddd] = $module->module_version; + $this->placeholders[$this->bbb . 'module_version' . $this->ddd] = str_replace('.', '_', $module->module_version); + // set description (TODO) add description field to module + if (!isset($module->description) || !ComponentbuilderHelper::checkString($module->description)) + { + $module->description = ''; + } + else + { + $module->description = $this->setPlaceholders($this->setDynamicValues($module->description), $this->placeholders); + $this->setLangContent($module->key, $module->lang_prefix . '_DESCRIPTION', $module->description); + $module->description = '

' . $module->description . '

'; + } + $module->xml_description = "

" . $module->official_name . " (v." . $module->module_version . ")

" . $module->description . "

Created by " . trim(JFilterOutput::cleanText($component->author)) . "
Development started " . JFactory::getDate($module->created)->format("jS F, Y") . "

"; + // set xml description + $this->setLangContent($module->key, $module->lang_prefix . '_XML_DESCRIPTION', $module->xml_description); + // update the readme if set + if ($module->addreadme == 1 && !empty($module->readme)) + { + $module->readme = $this->setPlaceholders($this->setDynamicValues(base64_decode($module->readme)), $this->placeholders); + } + else + { + $module->addreadme = 0; + unset($module->readme); + } + // get the custom_get + $module->custom_get = (isset($module->custom_get) && ComponentbuilderHelper::checkJson($module->custom_get)) ? json_decode($module->custom_get, true) : null; + if (ComponentbuilderHelper::checkArray($module->custom_get)) + { + $module->custom_get = $this->setGetData($module->custom_get, $module->key, $module->key); + } + else + { + $module->custom_get = false; + } + // set helper class details + if ($module->add_class_helper >= 1 && ComponentbuilderHelper::checkString($module->class_helper_code)) + { + if ($module->add_class_helper_header == 1 && ComponentbuilderHelper::checkString($module->class_helper_header)) + { + // set GUI mapper field + $guiMapper['field'] = 'class_helper_header'; + // base64 Decode code + $module->class_helper_header = PHP_EOL . $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->class_helper_header)), $this->placeholders), + $guiMapper + ) . PHP_EOL; + } + else + { + $module->add_class_helper_header = 0; + $module->class_helper_header = ''; + } + // set GUI mapper field + $guiMapper['field'] = 'class_helper_code'; + // base64 Decode code + $module->class_helper_code = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->class_helper_code)), $this->placeholders), + $guiMapper + ); + // set class type + if ($module->add_class_helper == 2) + { + $module->class_helper_type = 'abstract class '; + } + else + { + $module->class_helper_type = 'class '; + } + } + else + { + $module->add_class_helper = 0; + $module->class_helper_code = ''; + $module->class_helper_header = ''; + } + // base64 Decode mod_code + if (isset($module->mod_code) && ComponentbuilderHelper::checkString($module->mod_code)) + { + // set GUI mapper field + $guiMapper['field'] = 'mod_code'; + $module->mod_code = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->mod_code)), $this->placeholders), + $guiMapper + ); + } + else + { + $module->mod_code = "// get the module class sfx"; + $module->mod_code .= PHP_EOL . "\$moduleclass_sfx = htmlspecialchars(\$params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');"; + $module->mod_code .= PHP_EOL . "// load the default Tmpl"; + $module->mod_code .= PHP_EOL . "require JModuleHelper::getLayoutPath('mod_" . strtolower($module->code_name) . "', \$params->get('layout', 'default'));"; + } + // base64 Decode default header + if (isset($module->default_header) && ComponentbuilderHelper::checkString($module->default_header)) + { + // set GUI mapper field + $guiMapper['field'] = 'default_header'; + $module->default_header = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->default_header)), $this->placeholders), + $guiMapper + ); + } + else + { + $module->default_header = ''; + } + // base64 Decode default + if (isset($module->default) && ComponentbuilderHelper::checkString($module->default)) + { + // set GUI mapper field + $guiMapper['field'] = 'default'; + $module->default = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->default)), $this->placeholders), + $guiMapper + ); + } + else + { + $module->default = '

No Tmpl set

'; + } + // start the config array + $module->config_fields = array(); + // create the form arrays + $module->form_files = array(); + $module->fieldsets_label = array(); + $module->fieldsets_paths = array(); + // set global fields rule to default component path + $module->fields_rules_paths = 1; + // set the fields data + $module->fields = (isset($module->fields) && ComponentbuilderHelper::checkJson($module->fields)) ? json_decode($module->fields, true) : null; + if (ComponentbuilderHelper::checkArray($module->fields)) + { + // ket global key + $key = $module->key; + $dynamic_fields = array('fieldset' => 'basic', 'fields_name' => 'params', 'file' => 'config'); + foreach ($module->fields as $n => &$form) + { + if (isset($form['fields']) && ComponentbuilderHelper::checkArray($form['fields'])) + { + // make sure the dynamic_field is set to dynamic_value by default + foreach ($dynamic_fields as $dynamic_field => $dynamic_value) + { + if (!isset($form[$dynamic_field]) || !ComponentbuilderHelper::checkString($form[$dynamic_field])) + { + $form[$dynamic_field] = $dynamic_value; + } + else + { + if ('fields_name' === $dynamic_field && strpos($form[$dynamic_field], '.') !== false) + { + $form[$dynamic_field] = $form[$dynamic_field]; + } + else + { + $form[$dynamic_field] = ComponentbuilderHelper::safeString($form[$dynamic_field]); + } + } + } + // check if field is external form file + if (!isset($form['module']) || $form['module'] != 1) + { + // now build the form key + $unique = $form['file'] . $form['fields_name'] . $form['fieldset']; + } + else + { + // now build the form key + $unique = $form['fields_name'] . $form['fieldset']; + } + // set global fields rule path switchs + if ($module->fields_rules_paths == 1 && isset($form['fields_rules_paths']) && $form['fields_rules_paths'] == 2) + { + $module->fields_rules_paths = 2; + } + // set where to path is pointing + $module->fieldsets_paths[$unique] = $form['fields_rules_paths']; + // add the label if set to lang + if (isset($form['label']) && ComponentbuilderHelper::checkString($form['label'])) + { + $module->fieldsets_label[$unique] = $this->setLang($form['label']); + } + // build the fields + $form['fields'] = array_map(function($field) use ($key, $unique){ + // make sure the alias and title is 0 + $field['alias'] = 0; + $field['title'] = 0; + // set the field details + $this->setFieldDetails($field, $key, $key, $unique); + // update the default if set + if (ComponentbuilderHelper::checkString($field['custom_value']) && isset($field['settings'])) + { + if (($old_default = ComponentbuilderHelper::getBetween($field['settings']->xml, 'default="', '"', false)) !== false) + { + // replace old default + $field['settings']->xml = str_replace('default="' . $old_default . '"', 'default="' . $field['custom_value'] . '"', $field['settings']->xml); + } + else + { + // add the default (hmmm not ideal but okay it should work) + $field['settings']->xml = 'default="' . $field['custom_value'] . '" ' . $field['settings']->xml; + } + } + unset($field['custom_value']); + // return field + return $field; + }, array_values($form['fields'])); + // check if field is external form file + if (!isset($form['module']) || $form['module'] != 1) + { + // load the form file + if (!isset($module->form_files[$form['file']])) + { + $module->form_files[$form['file']] = array(); + } + if (!isset($module->form_files[$form['file']][$form['fields_name']])) + { + $module->form_files[$form['file']][$form['fields_name']] = array(); + } + if (!isset($module->form_files[$form['file']][$form['fields_name']][$form['fieldset']])) + { + $module->form_files[$form['file']][$form['fields_name']][$form['fieldset']] = array(); + } + // do some house cleaning (for fields) + foreach ($form['fields'] as $field) + { + // so first we lock the field name in + $this->getFieldName($field, $module->key, $unique); + // add the fields to the global form file builder + $module->form_files[$form['file']][$form['fields_name']][$form['fieldset']][] = $field; + } + // remove form + unset($module->fields[$n]); + } + else + { + // load the config form + if (!isset($module->config_fields[$form['fields_name']])) + { + $module->config_fields[$form['fields_name']] = array(); + } + if (!isset($module->config_fields[$form['fields_name']][$form['fieldset']])) + { + $module->config_fields[$form['fields_name']][$form['fieldset']] = array(); + } + // do some house cleaning (for fields) + foreach ($form['fields'] as $field) + { + // so first we lock the field name in + $this->getFieldName($field, $module->key, $unique); + // add the fields to the config builder + $module->config_fields[$form['fields_name']][$form['fieldset']][] = $field; + } + // remove form + unset($module->fields[$n]); + } + } + else + { + unset($module->fields[$n]); + } + } + } + unset($module->fields); + // set the add targets + $addArray = array('files' => 'files', 'folders' => 'folders', 'urls' => 'urls', 'filesfullpath' => 'files', 'foldersfullpath' => 'folders'); + foreach ($addArray as $addTarget => $targetHere) + { + // set the add target data + $module->{'add' . $addTarget} = (isset($module->{'add' . $addTarget}) && ComponentbuilderHelper::checkJson($module->{'add' . $addTarget})) ? json_decode($module->{'add' . $addTarget}, true) : null; + if (ComponentbuilderHelper::checkArray($module->{'add' . $addTarget})) + { + if (isset($module->{$targetHere}) && ComponentbuilderHelper::checkArray($module->{$targetHere})) + { + foreach ($module->{'add' . $addTarget} as $taget) + { + $module->{$targetHere}[] = $taget; + } + } + else + { + $module->{$targetHere} = array_values($module->{'add' . $addTarget}); + } + } + unset($module->{'add' . $addTarget}); + } + // load the library + if (!isset($this->libManager[$this->target])) + { + $this->libManager[$this->target] = array(); + } + if (!isset($this->libManager[$this->target][$module->code_name])) + { + $this->libManager[$this->target][$module->code_name] = array(); + } + // make sure json become array + if (ComponentbuilderHelper::checkJson($module->libraries)) + { + $module->libraries = json_decode($module->libraries, true); + } + // if we have an array add it + if (ComponentbuilderHelper::checkArray($module->libraries)) + { + foreach ($module->libraries as $library) + { + if (!isset($this->libManager[$this->target][$module->code_name][$library])) + { + if ($this->getMediaLibrary((int) $library)) + { + $this->libManager[$this->target][$module->code_name][(int) $library] = true; + } + } + } + } + elseif (is_numeric($module->libraries) && !isset($this->libManager[$this->target][$module->code_name][(int) $module->libraries])) + { + if ($this->getMediaLibrary((int) $module->libraries)) + { + $this->libManager[$this->target][$module->code_name][(int) $module->libraries] = true; + } + } + // add PHP in module install + $module->add_install_script = false; + $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); + $addScriptTypes = array('install', 'update', 'uninstall'); + foreach ($addScriptMethods as $scriptMethod) + { + foreach ($addScriptTypes as $scriptType) + { + if (isset($module->{'add_' . $scriptMethod . '_' . $scriptType}) && $module->{'add_' . $scriptMethod . '_' . $scriptType} == 1 && ComponentbuilderHelper::checkString($module->{$scriptMethod . '_' . $scriptType})) + { + // set GUI mapper field + $guiMapper['field'] = $scriptMethod . '_' . $scriptType; + $module->{$scriptMethod . '_' . $scriptType} = $this->setGuiCodePlaceholder( + $this->setPlaceholders($this->setDynamicValues(base64_decode($module->{$scriptMethod . '_' . $scriptType})), $this->placeholders), + $guiMapper + ); + $module->add_install_script = true; + } + else + { + unset($module->{$scriptMethod . '_' . $scriptType}); + $module->{'add_' . $scriptMethod . '_' . $scriptType} = 0; + } + } + } + // add_sql + if ($module->add_sql == 1 && ComponentbuilderHelper::checkString($module->sql)) + { + $module->sql = $this->setPlaceholders($this->setDynamicValues(base64_decode($module->sql)), $this->placeholders); + } + else + { + unset($module->sql); + $module->add_sql = 0; + } + // add_sql_uninstall + if ($module->add_sql_uninstall == 1 && ComponentbuilderHelper::checkString($module->sql_uninstall)) + { + $module->sql_uninstall = $this->setPlaceholders($this->setDynamicValues(base64_decode($module->sql_uninstall)), $this->placeholders); + } + else + { + unset($module->sql_uninstall); + $module->add_sql_uninstall = 0; + } + // update the URL of the update_server if set + if ($module->add_update_server == 1 && ComponentbuilderHelper::checkString($module->update_server_url)) + { + $module->update_server_url = $this->setPlaceholders($this->setDynamicValues($module->update_server_url), $this->placeholders); + } + // add the update/sales server FTP details if that is the expected protocol + $serverArray = array('update_server', 'sales_server'); + foreach ($serverArray as $server) + { + if ($module->{'add_' . $server} == 1 && is_numeric($module->{$server}) && $module->{$server} > 0) + { + // get the server protocol + $module->{$server . '_protocol'} = ComponentbuilderHelper::getVar('server', (int) $module->{$server}, 'id', 'protocol'); + } + else + { + $module->{$server} = 0; + // only change this for sales server (update server can be added loacaly to the zip file) + if ('sales_server' === $server) + { + $module->{'add_' . $server} = 0; + } + $module->{$server . '_protocol'} = 0; + } + } + // set the update server stuff (TODO) + // update_server_xml_path + // update_server_xml_file_name + + // rest globals + $this->target = $_backup_target; + $this->lang = $_backup_lang; + $this->langPrefix = $_backup_langPrefix; + + unset($this->placeholders[$this->bbb . 'Module_name' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'Module' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'module' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'module.version' . $this->ddd]); + unset($this->placeholders[$this->bbb . 'module_version' . $this->ddd]); + + $this->joomlaModules[$id] = $module; + + return true; + } + } + return false; + } + + /** + * get the module xml template + * + * @return string + * + */ + public function getModuleXMLTemplate(&$module) + { + $xml = ''; + $xml .= PHP_EOL . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $module->lang_prefix . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'BUILDDATE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHOR' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHOREMAIL' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'AUTHORWEBSITE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'COPYRIGHT' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $this->hhh . 'LICENSE' . $this->hhh . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $module->module_version . ''; + $xml .= PHP_EOL . $this->_t(1) . '' . $module->lang_prefix . '_XML_DESCRIPTION'; + $xml .= $this->hhh . 'MAINXML' . $this->hhh; + $xml .= PHP_EOL . ''; + + return $xml; + } + /** * get the Joomla plugins IDs * @@ -7512,7 +8105,23 @@ class Get // set the lang for both since we don't know what area is being targeted $_tmp = $this->lang; // set the lang based on target - if (strpos($target, 'plugin') !== false) + if (strpos($target, 'module') !== false) + { + // backup lang prefix + $_tmp_lang_prefix = $this->langPrefix; + // set the new lang prefix + $this->langPrefix = strtoupper(str_replace('module', 'mod', $target)); + // now set the lang + if (isset($this->langKeys[$this->langPrefix])) + { + $this->lang = $this->langKeys[$this->langPrefix]; + } + else + { + $this->lang = 'module'; + } + } + elseif (strpos($target, 'plugin') !== false) { // backup lang prefix $_tmp_lang_prefix = $this->langPrefix; @@ -7739,6 +8348,19 @@ 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; + // Painfull but we need to folder paths for the linked modules + if (($module_ids = $this->getModuleIDs()) !== false) + { + foreach ($module_ids as $module_id) + { + // get the module group and folder name +// if (($path = $this->getModulePath($module_id)) !== false) +// { +// // set the path +// $localPaths['module_' . str_replace('/', '_', $path)] = JPATH_ROOT . '/modules/' . $path; +// } + } + } // Painfull but we need to folder paths for the linked plugins if (($plugin_ids = $this->getPluginIDs()) !== false) { diff --git a/admin/helpers/compiler/b_Structure.php b/admin/helpers/compiler/b_Structure.php index 5e3a914a1..fb96cd8ce 100644 --- a/admin/helpers/compiler/b_Structure.php +++ b/admin/helpers/compiler/b_Structure.php @@ -371,6 +371,8 @@ class Structure extends Get $this->removeFolder($this->componentPath); // load the libraries files/folders and url's $this->setLibraries(); + // load the module files/folders and url's + $this->buildModules(); // load the plugin files/folders and url's $this->buildPlugins(); // set the Joomla Version Data @@ -416,6 +418,384 @@ class Structure extends Get return ''; } + /** + * Build the Modules files, folders, url's and config + * + * @return void + * + */ + private function buildModules() + { + if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + { + // Trigger Event: jcb_ce_onBeforeSetModules + $this->triggerEvent('jcb_ce_onBeforeBuildModules', array(&$this->componentContext, &$this->joomlaModules)); + foreach ($this->joomlaModules as $module) + { + if (ComponentbuilderHelper::checkObject($module) && isset($module->folder_name) + && ComponentbuilderHelper::checkString($module->folder_name)) + { + // module path + $module->folder_path = $this->compilerPath . '/' . $module->folder_name; + // set the module paths + $this->dynamicPaths[$module->key] = $module->folder_path; + // make sure there is no old build + $this->removeFolder($module->folder_path); + // creat the main component folder + if (!JFolder::exists($module->folder_path)) + { + JFolder::create($module->folder_path); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name, $this->compilerPath); + } + // set main mod file + $fileDetails = array('path' => $module->folder_path . '/' . $module->file_name . '.php', + 'name' => $module->file_name . '.php', 'zip' => $module->file_name . '.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'MODCODE' . $this->hhh); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // set custom_get + if ($module->custom_get) + { + $fileDetails = array('path' => $module->folder_path . '/data.php', + 'name' => 'data.php', 'zip' => 'data.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . PHP_EOL . + '/**' . PHP_EOL . + ' * Module ' . $module->official_name . ' Data' . PHP_EOL . + ' */' . PHP_EOL . + "class " . $module->class_data_name . ' extends \JObject' . PHP_EOL . + "{" . $this->hhh . 'DYNAMICGETS' . $this->hhh . "}" . PHP_EOL); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set helper file + if ($module->add_class_helper >= 1) + { + $fileDetails = array('path' => $module->folder_path . '/helper.php', + 'name' => 'helper.php', 'zip' => 'helper.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'HELPERCODE' . $this->hhh); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set main xml file + $fileDetails = array('path' => $module->folder_path . '/' . $module->file_name . '.xml', + 'name' => $module->file_name . '.xml', 'zip' => $module->file_name . '.xml'); + $this->writeFile($fileDetails['path'], $this->getModuleXMLTemplate($module)); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // set tmpl folder + if (!JFolder::exists($module->folder_path . '/tmpl')) + { + JFolder::create($module->folder_path . '/tmpl'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/tmpl', $this->compilerPath); + } + // set default file + $fileDetails = array('path' => $module->folder_path . '/tmpl/default.php', + 'name' => 'default.php', 'zip' => 'tmpl/default.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'MODDEFAULT' . $this->hhh); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + // set install script if needed + if ($module->add_install_script) + { + $fileDetails = array('path' => $module->folder_path . '/script.php', + 'name' => 'script.php', 'zip' => 'script.php'); + $this->writeFile($fileDetails['path'], + 'hhh . 'BOM' . $this->hhh . PHP_EOL . + PHP_EOL . '// No direct access to this file' . PHP_EOL . + "defined('_JEXEC') or die('Restricted access');" . PHP_EOL . + $this->hhh . 'INSTALLCLASS' . $this->hhh); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set readme if found + if ($module->addreadme) + { + $fileDetails = array('path' => $module->folder_path . '/README.md', + 'name' => 'README.md', 'zip' => 'README.md'); + $this->writeFile($fileDetails['path'], $module->readme); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + // set fields & rules folders if needed + if (isset($module->fields_rules_paths) && $module->fields_rules_paths == 2) + { + // create fields folder + if (!JFolder::exists($module->folder_path . '/fields')) + { + JFolder::create($module->folder_path . '/fields'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/fields', $this->compilerPath); + } + // create rules folder + if (!JFolder::exists($module->folder_path . '/rules')) + { + JFolder::create($module->folder_path . '/rules'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/rules', $this->compilerPath); + } + } + // set forms folder if needed + if (isset($module->form_files) && ComponentbuilderHelper::checkArray($module->form_files)) + { + // create forms folder + if (!JFolder::exists($module->folder_path . '/forms')) + { + JFolder::create($module->folder_path . '/forms'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/forms', $this->compilerPath); + } + // set the template files + foreach($module->form_files as $file => $fields) + { + // set file details + $fileDetails = array('path' => $module->folder_path . '/forms/' . $file . '.xml', + 'name' => $file . '.xml', 'zip' => 'forms/' . $file . '.xml'); + // biuld basic XML + $xml = ''; + $xml .= PHP_EOL . ''; + // search if we must add the component path + $add_component_path = false; + foreach ($fields as $field_name => $fieldsets) + { + if (!$add_component_path) + { + foreach ($fieldsets as $fieldset => $field) + { + if (!$add_component_path && isset($module->fieldsets_paths[$file . $field_name . $fieldset]) && $module->fieldsets_paths[$file . $field_name . $fieldset] == 1) + { + $add_component_path = true; + } + } + } + } + // only add if part of the component field types path is required + if ($add_component_path) + { + $xml .= PHP_EOL . '_t(1) . 'addrulepath="/administrator/components/com_' . $this->componentCodeName . '/models/rules"'; + $xml .= PHP_EOL . $this->_t(1) . 'addfieldpath="/administrator/components/com_' . $this->componentCodeName . '/models/fields"'; + $xml .= PHP_EOL . '>'; + } + else + { + $xml .= PHP_EOL . '
'; + } + // add the fields + foreach ($fields as $field_name => $fieldsets) + { + // check if we have an double fields naming set + $field_name_inner = ''; + $field_name_outer = $field_name; + if (strpos($field_name, '.') !== false) + { + $field_names = explode('.', $field_name); + if (count((array) $field_names) == 2) + { + $field_name_outer = $field_names[0]; + $field_name_inner = $field_names[1]; + } + } + $xml .= PHP_EOL . $this->_t(1) . ''; + foreach ($fieldsets as $fieldset => $field) + { + // default to the field set name + $label = $fieldset; + if (isset($module->fieldsets_label[$file.$field_name.$fieldset])) + { + $label = $module->fieldsets_label[$file.$field_name.$fieldset]; + } + // add path to module rules and custom fields + if (isset($module->fieldsets_paths[$file.$field_name.$fieldset]) && $module->fieldsets_paths[$file.$field_name.$fieldset] == 2) + { + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . '
_t(2) . 'addrulepath="/modules/' . strtolower($module->code_name) . '/rules"'; + $xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/modules/' . strtolower($module->code_name) . '/fields"'; + $xml .= PHP_EOL . $this->_t(1) . '>'; + } + else + { + $xml .= PHP_EOL . $this->_t(1) . '
'; + } + // check if we have an inner field set + if (ComponentbuilderHelper::checkString($field_name_inner)) + { + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // add the placeholder of the fields + $xml .= $this->hhh . 'FIELDSET_' . $file.$field_name.$fieldset . $this->hhh; + // check if we have an inner field set + if (ComponentbuilderHelper::checkString($field_name_inner)) + { + $xml .= PHP_EOL . $this->_t(1) . ''; + } + $xml .= PHP_EOL . $this->_t(1) . '
'; + } + $xml .= PHP_EOL . $this->_t(1) . ''; + } + $xml .= PHP_EOL . ''; + // add xml to file + $this->writeFile($fileDetails['path'], $xml); + $this->newFiles[$module->key][] = $fileDetails; + // count the file created + $this->fileCount++; + } + } + // set SQL stuff if needed + if ($module->add_sql || $module->add_sql_uninstall) + { + // create SQL folder + if (!JFolder::exists($module->folder_path . '/sql')) + { + JFolder::create($module->folder_path . '/sql'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/sql', $this->compilerPath); + } + // create mysql folder + if (!JFolder::exists($module->folder_path . '/sql/mysql')) + { + JFolder::create($module->folder_path . '/sql/mysql'); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . '/sql/mysql', $this->compilerPath); + } + // now set the install file + if ($module->add_sql) + { + $this->writeFile($module->folder_path . '/sql/mysql/install.sql', $module->sql); + // count the file created + $this->fileCount++; + } + // now set the uninstall file + if ($module->add_sql_uninstall) + { + $this->writeFile($module->folder_path . '/sql/mysql/uninstall.sql', $module->sql_uninstall); + // count the file created + $this->fileCount++; + } + } + // creat the language folder + if (!JFolder::exists($module->folder_path . '/language')) + { + JFolder::create($module->folder_path . '/language'); + // count the folder created + $this->folderCount++; + // also the lang tag + if (!JFolder::exists($module->folder_path . '/language/' . $this->langTag)) + { + JFolder::create($module->folder_path . '/language/' . $this->langTag); + // count the folder created + $this->folderCount++; + } + } + // check if this lib has files + if (isset($module->files) && ComponentbuilderHelper::checkArray($module->files)) + { + // add to component files + foreach ($module->files as $file) + { + // set the path finder + $file['target_type'] = $module->target_type; + $file['target_id'] = $module->id; + $this->componentData->files[] = $file; + } + } + // check if this lib has folders + if (isset($module->folders) && ComponentbuilderHelper::checkArray($module->folders)) + { + // add to component folders + foreach ($module->folders as $folder) + { + // set the path finder + $folder['target_type'] = $module->target_type; + $folder['target_id'] = $module->id; + $this->componentData->folders[] = $folder; + } + } + // check if this module has urls + if (isset($module->urls) && ComponentbuilderHelper::checkArray($module->urls)) + { + // add to component urls + foreach ($module->urls as $n => &$url) + { + // should we add the local folder + if (isset($url['type']) && $url['type'] > 1 && isset($url['url']) + && ComponentbuilderHelper::checkString($url['url'])) + { + // set file name + $fileName = basename($url['url']); + // get the file contents + $data = ComponentbuilderHelper::getFileContents($url['url']); + // build sub path + if (strpos($fileName, '.js') !== false) + { + $path = '/js'; + } + elseif (strpos($fileName, '.css') !== false) + { + $path = '/css'; + } + else + { + $path = ''; + } + // create sub media path if not set + if (!JFolder::exists($module->folder_path .$path)) + { + JFolder::create($module->folder_path . $path); + // count the folder created + $this->folderCount++; + $this->indexHTML($module->folder_name . $path, $this->compilerPath); + } + // set the path to module file + $url['path'] = $module->folder_path . $path . '/' . $fileName; // we need this for later + // write data to path + $this->writeFile($url['path'], $data); + // count the file created + $this->fileCount++; + } + } + } + } + } + } + } + /** * Build the Plugins files, folders, url's and config * diff --git a/admin/helpers/compiler/e_Interpretation.php b/admin/helpers/compiler/e_Interpretation.php index 80fc8e4de..b985d45a7 100644 --- a/admin/helpers/compiler/e_Interpretation.php +++ b/admin/helpers/compiler/e_Interpretation.php @@ -2586,16 +2586,25 @@ class Interpretation extends Fields { $methods = ''; // then set the needed custom methods - if (ComponentbuilderHelper::checkArray($main_view['settings']->custom_get)) + if (ComponentbuilderHelper::checkArray($main_view) && isset($main_view['settings']) && ComponentbuilderHelper::checkObject($main_view['settings']) && isset($main_view['settings']->custom_get)) + { + $_dynamic_get = $main_view['settings']->custom_get; + } + elseif (ComponentbuilderHelper::checkObject($main_view) && isset($main_view->custom_get)) + { + $_dynamic_get = $main_view->custom_get; + } + // check if we have an array + if (isset($_dynamic_get) && ComponentbuilderHelper::checkArray($_dynamic_get)) { // start dynamic build - foreach ($main_view['settings']->custom_get as $view) + foreach ($_dynamic_get as $view) { // fix alias to use in code $view->code = ComponentbuilderHelper::safeString($code); $view->Code = ComponentbuilderHelper::safeString($view->code, 'F'); $view->CODE = ComponentbuilderHelper::safeString($view->code, 'U'); - $main = ''; + $main = ''; if ($view->gettype == 3) { // SITE_GET_ITEM <<>> @@ -2664,7 +2673,10 @@ class Interpretation extends Fields } } // load uikit get method - $methods .= $this->setUikitGetMethod(); + if (ComponentbuilderHelper::checkArray($main_view) && isset($main_view['settings'])) + { + $methods .= $this->setUikitGetMethod(); + } return $methods; } @@ -4001,26 +4013,40 @@ class Interpretation extends Fields public function setLibrariesLoader($view) { + // check call sig + if (isset($view['settings']) && isset($view['settings']->code)) + { + $code = $view['settings']->code; + $view_active = true; + } + elseif (isset($view->code_name)) + { + $code = $view->code_name; + $view_active = false; + } // reset bucket $setter = ''; // allways load these in - $setter .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " always make sure jquery is loaded."; - $setter .= PHP_EOL . $this->_t(2) . "JHtml::_('jquery.framework');"; - $setter .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the header checker class."; - if ($this->target === 'site') + if ($view_active) { - $setter .= PHP_EOL . $this->_t(2) . "require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );"; + $setter .= PHP_EOL . PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " always make sure jquery is loaded."; + $setter .= PHP_EOL . $this->_t(2) . "JHtml::_('jquery.framework');"; + $setter .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Load the header checker class."; + if ($this->target === 'site') + { + $setter .= PHP_EOL . $this->_t(2) . "require_once( JPATH_COMPONENT_SITE.'/helpers/headercheck.php' );"; + } + else + { + $setter .= PHP_EOL . $this->_t(2) . "require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );"; + } + $setter .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Initialize the header checker."; + $setter .= PHP_EOL . $this->_t(2) . "\$HeaderCheck = new " . $this->componentCodeName . "HeaderCheck;"; } - else - { - $setter .= PHP_EOL . $this->_t(2) . "require_once( JPATH_COMPONENT_ADMINISTRATOR.'/helpers/headercheck.php' );"; - } - $setter .= PHP_EOL . $this->_t(2) . "//" . $this->setLine(__LINE__) . " Initialize the header checker."; - $setter .= PHP_EOL . $this->_t(2) . "\$HeaderCheck = new " . $this->componentCodeName . "HeaderCheck;"; // check if this view should get libraries - if (isset($this->libManager[$this->target][$view['settings']->code]) && ComponentbuilderHelper::checkArray($this->libManager[$this->target][$view['settings']->code])) + if (isset($this->libManager[$this->target][$code]) && ComponentbuilderHelper::checkArray($this->libManager[$this->target][$code])) { - foreach ($this->libManager[$this->target][$view['settings']->code] as $id => $true) + foreach ($this->libManager[$this->target][$code] as $id => $true) { if (isset($this->libraries[$id]) && ComponentbuilderHelper::checkObject($this->libraries[$id]) && isset($this->libraries[$id]->document) && ComponentbuilderHelper::checkString($this->libraries[$id]->document)) { @@ -4033,6 +4059,11 @@ class Interpretation extends Fields } } } + // convert back to $document if module call (oops :) + if (!$view_active) + { + return str_replace('$this->document->', '$document->', $setter); + } return $setter; } @@ -16641,6 +16672,220 @@ function vdm_dkim() { return $matches[1]; } + public function getModCode(&$module) + { + return PHP_EOL . $module->mod_code . PHP_EOL; + } + + public function getModDefault(&$module) + { + return PHP_EOL . $module->default_header . PHP_EOL . '?>' . PHP_EOL . $module->default . PHP_EOL; + } + + public function getModHelperCode(&$module) + { + return + $module->class_helper_header . PHP_EOL . + $module->class_helper_type . $module->class_helper_name . PHP_EOL . '{' . PHP_EOL . + $module->class_helper_code . PHP_EOL . + "}" . PHP_EOL; + } + + public function getModuleMainXML(&$module) + { + // set the custom table key + $dbkey = 'yyy'; + // build the xml + $xml = ''; + // search if we must add the component path + $add_component_path = false; + // build the config fields + $config_fields = array(); + if (isset($module->config_fields) && ComponentbuilderHelper::checkArray($module->config_fields)) + { + foreach ($module->config_fields as $field_name => $fieldsets) + { + foreach ($fieldsets as $fieldset => $fields) + { + // get the field set + $xmlFields = $this->getExtensionFieldsetXML($module, $fields, $dbkey); + // make sure the xml is set and a string + if (isset($xmlFields) && ComponentbuilderHelper::checkString($xmlFields)) + { + $config_fields[$field_name . $fieldset] = $xmlFields; + } + $dbkey++; + // check if the fieldset path requiers component paths + if (!$add_component_path && isset($module->fieldsets_paths[$field_name . $fieldset]) && $module->fieldsets_paths[$field_name . $fieldset] == 1) + { + $add_component_path = true; + } + } + } + } + // switch to add the xml + $addLang = false; + // now build the language files + if (isset($this->langContent[$module->key])) + { + $lang = array_map(function ($langstring, $placeholder) + { + return $placeholder . '="' . $langstring . '"'; + }, $this->langContent[$module->key], array_keys($this->langContent[$module->key])); + // add to language file + $this->writeFile($module->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.' . $module->file_name . '.ini', implode(PHP_EOL, $lang)); + $this->writeFile($module->folder_path . '/language/' . $this->langTag . '/' . $this->langTag . '.' . $module->file_name . '.sys.ini', implode(PHP_EOL, $lang)); + // set the line counter + $this->lineCount = $this->lineCount + count((array) $lang); + unset($lang); + // trigger the xml + $addLang = true; + } + // get all files and folders in module folder + $files = JFolder::files($module->folder_path); + $folders = JFolder::folders($module->folder_path); + // the files/folders to ignore + $ignore = array('sql', 'language', 'script.php', $module->file_name . '.xml', $module->file_name . '.php'); + // should the scriptfile be added + if ($module->add_install_script) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . 'script.php'; + } + // should the sql install be added + if ($module->add_sql) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/install.sql'; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // should the sql uninstall be added + if ($module->add_sql_uninstall) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(3) . 'sql/mysql/uninstall.sql'; + $xml .= PHP_EOL . $this->_t(2) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // should the language xml be added + if ($addLang) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.' . $module->file_name . '.ini'; + $xml .= PHP_EOL . $this->_t(2) . '' . $this->langTag . '/' . $this->langTag . '.' . $module->file_name . '.sys.ini'; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // add the module files + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $module->file_name . '.php'; + // add other files found + if (ComponentbuilderHelper::checkArray($files)) + { + foreach ($files as $file) + { + // only add what is not ignored + if (!in_array($file, $ignore)) + { + $xml .= PHP_EOL . $this->_t(2) . '' . $file . ''; + } + } + } + // add language folder + if ($addLang) + { + $xml .= PHP_EOL . $this->_t(2) . 'language'; + } + // add sql folder + if ($module->add_sql || $module->add_sql_uninstall) + { + $xml .= PHP_EOL . $this->_t(2) . 'sql'; + } + // add other files found + if (ComponentbuilderHelper::checkArray($folders)) + { + foreach ($folders as $folder) + { + // only add what is not ignored + if (!in_array($folder, $ignore)) + { + $xml .= PHP_EOL . $this->_t(2) . '' . $folder . ''; + } + } + } + $xml .= PHP_EOL . $this->_t(1) . ''; + // now add the Config Params if needed + if (ComponentbuilderHelper::checkArray($config_fields)) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + // only add if part of the component field types path is required + if ($add_component_path) + { + // add path to module rules and custom fields + $xml .= PHP_EOL . $this->_t(1) . '_t(2) . 'addrulepath="/administrator/components/com_' . $this->componentCodeName . '/modules/rules"'; + $xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/administrator/components/com_' . $this->componentCodeName . '/modules/fields"'; + $xml .= PHP_EOL . $this->_t(1) . '>'; + } + else + { + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // add the fields + foreach ($module->config_fields as $field_name => $fieldsets) + { + $xml .= PHP_EOL . $this->_t(1) . ''; + foreach ($fieldsets as $fieldset => $fields) + { + // default to the field set name + $label = $fieldset; + if (isset($module->fieldsets_label[$field_name.$fieldset])) + { + $label = $module->fieldsets_label[$field_name.$fieldset]; + } + // add path to module rules and custom fields + if (isset($module->fieldsets_paths[$field_name . $fieldset]) && $module->fieldsets_paths[$field_name . $fieldset] == 2) + { + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . '
_t(2) . 'addrulepath="/modules/' . $module->file_name . '/rules"'; + $xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/modules/' . $module->file_name . '/fields"'; + $xml .= PHP_EOL . $this->_t(1) . '>'; + } + else + { + $xml .= PHP_EOL . $this->_t(1) . '
'; + } + // load the fields + if (isset($config_fields[$field_name.$fieldset])) + { + $xml .= $config_fields[$field_name.$fieldset]; + unset($config_fields[$field_name.$fieldset]); + } + $xml .= PHP_EOL . $this->_t(1) . '
'; + } + $xml .= PHP_EOL . $this->_t(1) . ''; + } + $xml .= PHP_EOL . $this->_t(1) . ''; + } + // set update server if found + if ($module->add_update_server) + { + $xml .= PHP_EOL . PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + $xml .= PHP_EOL . $this->_t(2) . '' . $module->update_server_url . ''; + $xml .= PHP_EOL . $this->_t(1) . ''; + } + + return $xml; + } + public function getPluginMainClass(&$plugin) { return @@ -16672,7 +16917,7 @@ function vdm_dkim() { foreach ($fieldsets as $fieldset => $fields) { // get the field set - $xmlFields = $this->getPluginFieldsetXML($plugin, $fields, $dbkey); + $xmlFields = $this->getExtensionFieldsetXML($plugin, $fields, $dbkey); // make sure the xml is set and a string if (isset($xmlFields) && ComponentbuilderHelper::checkString($xmlFields)) { @@ -16850,7 +17095,7 @@ function vdm_dkim() { return $xml; } - public function getPluginFieldsetXML(&$plugin, &$fields, $dbkey = 'zz') + public function getExtensionFieldsetXML(&$extension, &$fields, $dbkey = 'zz') { // set some defaults $view = ''; @@ -16866,12 +17111,12 @@ function vdm_dkim() { if ($this->fieldBuilderType == 1) { // string manipulation - $xmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false); + $xmlField = $this->setDynamicField($field, $view, $viewType, $extension->lang_prefix, $extension->key, $extension->key, $this->globalPlaceholders, $dbkey, false); } else { // simpleXMLElement class - $newxmlField = $this->setDynamicField($field, $view, $viewType, $plugin->lang_prefix, $plugin->key, $plugin->key, $this->globalPlaceholders, $dbkey, false); + $newxmlField = $this->setDynamicField($field, $view, $viewType, $extension->lang_prefix, $extension->key, $extension->key, $this->globalPlaceholders, $dbkey, false); if (isset($newxmlField->fieldXML)) { $xmlField = dom_import_simplexml($newxmlField->fieldXML); @@ -16888,24 +17133,24 @@ function vdm_dkim() { return $fieldset; } - public function getPluginInstallClass(&$plugin) + public function getExtensionInstallClass(&$extension) { // yes we are adding it $script = PHP_EOL . '/**'; - $script .= PHP_EOL . ' * ' . $plugin->official_name . ' script file.'; + $script .= PHP_EOL . ' * ' . $extension->official_name . ' script file.'; $script .= PHP_EOL . ' *'; - $script .= PHP_EOL . ' * @package ' . $plugin->class_name; + $script .= PHP_EOL . ' * @package ' . $extension->class_name; $script .= PHP_EOL . ' */'; - $script .= PHP_EOL . 'class ' . $plugin->installer_class_name; + $script .= PHP_EOL . 'class ' . $extension->installer_class_name; $script .= PHP_EOL . '{'; // set constructor - if (isset($plugin->add_php_script_construct) - && $plugin->add_php_script_construct == 1 - && ComponentbuilderHelper::checkString($plugin->php_script_construct)) + if (isset($extension->add_php_script_construct) + && $extension->add_php_script_construct == 1 + && ComponentbuilderHelper::checkString($extension->php_script_construct)) { - $script .= $this->setInstallMethodScript('construct', $plugin->php_script_construct); + $script .= $this->setInstallMethodScript('construct', $extension->php_script_construct); } - // add PHP in plugin install + // add PHP in extension install $addScriptMethods = array('php_preflight', 'php_postflight', 'php_method'); $addScriptTypes = array('install', 'update', 'uninstall', 'discover_install'); // set some buckets for sorting @@ -16921,18 +17166,18 @@ function vdm_dkim() { { foreach ($addScriptTypes as $scriptType) { - if (isset($plugin->{'add_' . $scriptMethod . '_' . $scriptType}) - && $plugin->{'add_' . $scriptMethod . '_' . $scriptType} == 1 - && ComponentbuilderHelper::checkString($plugin->{$scriptMethod . '_' . $scriptType})) + if (isset($extension->{'add_' . $scriptMethod . '_' . $scriptType}) + && $extension->{'add_' . $scriptMethod . '_' . $scriptType} == 1 + && ComponentbuilderHelper::checkString($extension->{$scriptMethod . '_' . $scriptType})) { // add to the main methods if ('php_method' === $scriptMethod) { - ${'function_' . $scriptType}[] = $plugin->{$scriptMethod . '_' . $scriptType}; + ${'function_' . $scriptType}[] = $extension->{$scriptMethod . '_' . $scriptType}; } else { - ${'function_' . $scriptMethod}[$scriptType][] = $plugin->{$scriptMethod . '_' . $scriptType}; + ${'function_' . $scriptMethod}[$scriptType][] = $extension->{$scriptMethod . '_' . $scriptType}; ${'has_' . $scriptMethod} = true; } } diff --git a/admin/helpers/compiler/f_Infusion.php b/admin/helpers/compiler/f_Infusion.php index 918829a8c..52ffc40b3 100644 --- a/admin/helpers/compiler/f_Infusion.php +++ b/admin/helpers/compiler/f_Infusion.php @@ -1029,17 +1029,65 @@ class Infusion extends Interpretation $this->fileContentStatic[$this->hhh . 'README' . $this->hhh] = $this->componentData->readme; } - // infuze plugin data if set + // tweak system to set stuff to the module domain + $_backup_target = $this->target; + $_backup_lang = $this->lang; + $_backup_langPrefix = $this->langPrefix; + // infuse module data if set + if (ComponentbuilderHelper::checkArray($this->joomlaModules)) + { + foreach ($this->joomlaModules as $module) + { + if (ComponentbuilderHelper::checkObject($module)) + { + $this->target = $module->key; + $this->lang = $module->key; + $this->langPrefix = $module->lang_prefix; + // MODCODE + $this->fileContentDynamic[$module->key][$this->hhh . 'MODCODE' . $this->hhh] = $this->getModCode($module); + // DYNAMICGET + $this->fileContentDynamic[$module->key][$this->hhh . 'DYNAMICGETS' . $this->hhh] = $this->setCustomViewCustomMethods($module, $module->key); + // HELPERCODE + if ($module->add_class_helper >= 1) + { + $this->fileContentDynamic[$module->key][$this->hhh . 'HELPERCODE' . $this->hhh] = $this->getModHelperCode($module); + } + // MODDEFAULT + $this->fileContentDynamic[$module->key][$this->hhh . 'MODDEFAULT' . $this->hhh] = $this->getModDefault($module); + // only add install script if needed + if ($module->add_install_script) + { + // INSTALLCLASS + $this->fileContentDynamic[$module->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getExtensionInstallClass($module); + } + // FIELDSET + if (isset($module->form_files) && ComponentbuilderHelper::checkArray($module->form_files)) + { + foreach($module->form_files as $file => $files) + { + foreach ($files as $field_name => $fieldsets) + { + foreach ($fieldsets as $fieldset => $fields) + { + // FIELDSET_ . $file.$field_name.$fieldset + $this->fileContentDynamic[$module->key][$this->hhh . 'FIELDSET_' . $file.$field_name.$fieldset . $this->hhh] = + $this->getExtensionFieldsetXML($module, $fields); + } + } + } + } + // MAINXML + $this->fileContentDynamic[$module->key][$this->hhh . 'MAINXML' . $this->hhh] = $this->getModuleMainXML($module); + } + } + } + // infuse plugin data if set if (ComponentbuilderHelper::checkArray($this->joomlaPlugins)) { foreach ($this->joomlaPlugins as $plugin) { if (ComponentbuilderHelper::checkObject($plugin)) { - // tweak system to set stuff to the plugin domain - $_backup_target = $this->target; - $_backup_lang = $this->lang; - $_backup_langPrefix = $this->langPrefix; $this->target = $plugin->key; $this->lang = $plugin->key; $this->langPrefix = $plugin->lang_prefix; @@ -1049,7 +1097,7 @@ class Infusion extends Interpretation if ($plugin->add_install_script) { // INSTALLCLASS - $this->fileContentDynamic[$plugin->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getPluginInstallClass($plugin); + $this->fileContentDynamic[$plugin->key][$this->hhh . 'INSTALLCLASS' . $this->hhh] = $this->getExtensionInstallClass($plugin); } // FIELDSET if (isset($plugin->form_files) && ComponentbuilderHelper::checkArray($plugin->form_files)) @@ -1061,21 +1109,21 @@ class Infusion extends Interpretation foreach ($fieldsets as $fieldset => $fields) { // FIELDSET_ . $file.$field_name.$fieldset - $this->fileContentDynamic[$plugin->key][$this->hhh . 'FIELDSET_' . $file.$field_name.$fieldset . $this->hhh] = - $this->getPluginFieldsetXML($plugin, $fields); + $this->fileContentDynamic[$plugin->key][$this->hhh . 'FIELDSET_' . $file.$field_name.$fieldset . $this->hhh] = + $this->getExtensionFieldsetXML($plugin, $fields); } } } } // MAINXML $this->fileContentDynamic[$plugin->key][$this->hhh . 'MAINXML' . $this->hhh] = $this->getPluginMainXML($plugin); - // rest globals - $this->target = $_backup_target; - $this->lang = $_backup_lang; - $this->langPrefix = $_backup_langPrefix; } } } + // rest globals + $this->target = $_backup_target; + $this->lang = $_backup_lang; + $this->langPrefix = $_backup_langPrefix; // Trigger Event: jcb_ce_onAfterBuildFilesContent $this->triggerEvent('jcb_ce_onAfterBuildFilesContent', array(&$this->componentContext, &$this->componentData, &$this->fileContentStatic, &$this->fileContentDynamic, &$this->placeholders, &$this->hhh)); diff --git a/admin/language/en-GB/en-GB.com_componentbuilder.ini b/admin/language/en-GB/en-GB.com_componentbuilder.ini index b9f955b50..39d7633f8 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.ini @@ -1981,6 +1981,46 @@ COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_UNFEATURED="%s Components COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_UNFEATURED_1="%s Component Files & Folders unfeatured." COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_UNPUBLISHED="%s Components Files & Folders unpublished." COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_N_ITEMS_UNPUBLISHED_1="%s Component Files & Folders unpublished." +COM_COMPONENTBUILDER_COMPONENTS_MODULES="Components Modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS="Components Modules Access" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS_DESC="Allows the users in this group to access access components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_OPTIONS="Batch process the selected Components Modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_TIP="All changes will be applied to all selected Components Modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE="Components Modules Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE="Components Modules Create" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE_DESC="Allows the users in this group to create create components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE="Components Modules Delete" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE_DESC="Allows the users in this group to delete delete components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT="Components Modules Edit" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_BY="Components Modules Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_DATE="Components Modules Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_DESC="Allows the users in this group to edit the component modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN="Components Modules Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN_DESC="Allows the users in this group to edit edit own components modules created by them" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE="Components Modules Edit State" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION="Components Modules Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_ARCHIVED="%s Components Modules archived." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_ARCHIVED_1="%s Component Modules archived." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_CHECKED_IN_0="No Component Modules successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_CHECKED_IN_1="%d Component Modules successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_CHECKED_IN_MORE="%d Components Modules successfully checked in." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_DELETED="%s Components Modules deleted." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_DELETED_1="%s Component Modules deleted." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_FEATURED="%s Components Modules featured." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_FEATURED_1="%s Component Modules featured." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_PUBLISHED="%s Components Modules published." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_PUBLISHED_1="%s Component Modules published." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_TRASHED="%s Components Modules trashed." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_TRASHED_1="%s Component Modules trashed." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_UNFEATURED="%s Components Modules unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_UNFEATURED_1="%s Component Modules unfeatured." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_UNPUBLISHED="%s Components Modules unpublished." +COM_COMPONENTBUILDER_COMPONENTS_MODULES_N_ITEMS_UNPUBLISHED_1="%s Component Modules unpublished." COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS="Components mysql Tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS="Components Mysql Tweaks Access" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS_DESC="Allows the users in this group to access access components mysql tweaks" @@ -2946,6 +2986,42 @@ COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_STATUS="Status" COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_VERSION_DESC="A count of the number of times this Component Files & Folders has been revised." COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_VERSION_LABEL="Version" COM_COMPONENTBUILDER_COMPONENT_GLOBAL_SETTINGS="Component Global Settings" +COM_COMPONENTBUILDER_COMPONENT_MODULES="Component Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_ADDJOOMLA_MODULES="Addjoomla Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_ADDJOOMLA_MODULES_DESCRIPTION="Setup the Joomla modules for this component." +COM_COMPONENTBUILDER_COMPONENT_MODULES_ADDJOOMLA_MODULES_LABEL="Joomla Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_COMPILE_AMP_EXPORT="Compile & Export" +COM_COMPONENTBUILDER_COMPONENT_MODULES_COMPILE_ONLY="Compile (only)" +COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_BY_DESC="The user that created this Component Modules." +COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_BY_LABEL="Created By" +COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_DATE_DESC="The date this Component Modules was created." +COM_COMPONENTBUILDER_COMPONENT_MODULES_CREATED_DATE_LABEL="Created Date" +COM_COMPONENTBUILDER_COMPONENT_MODULES_EDIT="Editing the Component Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_ERROR_UNIQUE_ALIAS="Another Component Modules has the same alias." +COM_COMPONENTBUILDER_COMPONENT_MODULES_EXPORT_ONLY="Export (only)" +COM_COMPONENTBUILDER_COMPONENT_MODULES_ID="Id" +COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT="Joomla Component" +COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_DESCRIPTION="Select a Joomla Component" +COM_COMPONENTBUILDER_COMPONENT_MODULES_JOOMLA_COMPONENT_LABEL="Component" +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODIFIED_BY_DESC="The last user that modified this Component Modules." +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODIFIED_BY_LABEL="Modified By" +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODIFIED_DATE_DESC="The date this Component Modules was modified." +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODIFIED_DATE_LABEL="Modified Date" +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODULE="Module" +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODULES="Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_MODULE_LABEL="Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_NEW="A New Component Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_NOTE_ON_JOOMLA_MODULES_DESCRIPTION="Do not add the same Joomla modules twice it will not work." +COM_COMPONENTBUILDER_COMPONENT_MODULES_NOTE_ON_JOOMLA_MODULES_LABEL="Setting Joomla Modules" +COM_COMPONENTBUILDER_COMPONENT_MODULES_ORDERING_LABEL="Ordering" +COM_COMPONENTBUILDER_COMPONENT_MODULES_PERMISSION="Permissions" +COM_COMPONENTBUILDER_COMPONENT_MODULES_PUBLISHING="Publishing" +COM_COMPONENTBUILDER_COMPONENT_MODULES_SAVE_WARNING="Alias already existed so a number was added at the end. You can re-edit the Component Modules to customise the alias." +COM_COMPONENTBUILDER_COMPONENT_MODULES_STATUS="Status" +COM_COMPONENTBUILDER_COMPONENT_MODULES_TARGET_DESCRIPTION="Association" +COM_COMPONENTBUILDER_COMPONENT_MODULES_TARGET_LABEL="Target" +COM_COMPONENTBUILDER_COMPONENT_MODULES_VERSION_DESC="A count of the number of times this Component Modules has been revised." +COM_COMPONENTBUILDER_COMPONENT_MODULES_VERSION_LABEL="Version" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS="Component mysql Tweaks" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ADD_SQL_DESCRIPTION="if set in view" COM_COMPONENTBUILDER_COMPONENT_MYSQL_TWEAKS_ADD_SQL_LABEL="Add MySQL" @@ -3536,6 +3612,7 @@ 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_MODULE="Could not install module!" COM_COMPONENTBUILDER_COULD_NOT_INSTALL_PLUGIN="Could not install plugin!" COM_COMPONENTBUILDER_CREATE="Create" COM_COMPONENTBUILDER_CREATE_A_SNIPPET="create a snippet" @@ -3709,7 +3786,7 @@ COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DASHBOARD="Dashboard" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DATABASE="Database" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT="Default" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_DESCRIPTION="Add the code here." -COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_LABEL="Default View" +COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_LABEL="Default Tmpl" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DELETE="Delete" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DESCRIPTION="Description" COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DESCRIPTION_DESCRIPTION="Enter some description" @@ -4200,10 +4277,11 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION=" - - - - + + + + + @@ -6025,20 +6103,15 @@ COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNFEATURED="%s Joomla Module COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNFEATURED_1="%s Joomla Module Updates unfeatured." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED="%s Joomla Modules Updates unpublished." COM_COMPONENTBUILDER_JOOMLA_MODULES_UPDATES_N_ITEMS_UNPUBLISHED_1="%s Joomla Module Updates unpublished." -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_CODE="Abstract Class Helper Code" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_CODE_DESCRIPTION="Add the class properties & methods here." -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_CODE_LABEL="Abstract Class Helper Properties & Methods" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_HEADER="Abstract Class Helper Header" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_HEADER_DESCRIPTION="The class header, where JLoader, namespace and use is added." -COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS_HELPER_HEADER_LABEL="Abstract Class Helper Header" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ABSTRACT_CLASS="abstract class" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME="Addreadme" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADDREADME_LABEL="Add README" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_ABSTRACT_CLASS_HELPER="Add Abstract Class Helper" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_ABSTRACT_CLASS_HELPER_DESCRIPTION="You can add an abstract helper class to your module." -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_ABSTRACT_CLASS_HELPER_LABEL="Add Abstract Class Helper" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CUSTOM_ABSTRACT_CLASS_HELPER_HEADER="Add Custom Abstract Class Helper Header" -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CUSTOM_ABSTRACT_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom abstract helper header script." -COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CUSTOM_ABSTRACT_CLASS_HELPER_HEADER_LABEL="Add Custom Abstract Class Helper Header" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER="Add Class Helper" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION="You can add a helper class to your module." +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER="Add Class Helper Header" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION="You can add your own custom helper header script." +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL="Add Class Helper Header" +COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_LABEL="Add Class Helper" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL="Add Php Method Uninstall" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_METHOD_UNINSTALL_LABEL="Add PHP Method (uninstall)" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_PHP_POSTFLIGHT_INSTALL="Add Php Postflight Install" @@ -6061,6 +6134,13 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_UNINSTALL="Add Sql Uninstall" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_SQL_UNINSTALL_LABEL="Add MySQL - (Uninstall)" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_UPDATE_SERVER="Add Update Server" COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_UPDATE_SERVER_LABEL="Add Update Server" +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS="class" +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_CODE="Class Helper Code" +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_CODE_DESCRIPTION="Add the class properties & methods here." +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_CODE_LABEL="Class Helper Properties & Methods" +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_HEADER="Class Helper Header" +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_HEADER_DESCRIPTION="The class header, where JLoader, namespace and use is added." +COM_COMPONENTBUILDER_JOOMLA_MODULE_CLASS_HELPER_HEADER_LABEL="Class Helper Header" COM_COMPONENTBUILDER_JOOMLA_MODULE_CODE="Code" COM_COMPONENTBUILDER_JOOMLA_MODULE_COMPONENT="Component" COM_COMPONENTBUILDER_JOOMLA_MODULE_CREATED_BY_DESC="The user that created this Joomla Module." @@ -6075,7 +6155,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_CUSTOM_VALUE_HINT="Custom Value Here" COM_COMPONENTBUILDER_JOOMLA_MODULE_CUSTOM_VALUE_LABEL="Custom Value" COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT="Default" COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_DESCRIPTION="Add the code here." -COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_LABEL="Default View" +COM_COMPONENTBUILDER_JOOMLA_MODULE_DEFAULT_LABEL="Default Tmpl" COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION="Description" COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_DESCRIPTION="Add Description Here" COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_HINT="Add Description Here" @@ -6219,6 +6299,7 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_FILE_LABEL="File Name" COM_COMPONENTBUILDER_JOOMLA_MODULE_FORMS_FIELDS="Forms & Fields" COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS="Joomla Module Get Snippets Button Access" COM_COMPONENTBUILDER_JOOMLA_MODULE_GET_SNIPPETS_BUTTON_ACCESS_DESC="Allows the users in this group to access the get snippets button." +COM_COMPONENTBUILDER_JOOMLA_MODULE_HELPER="Helper" COM_COMPONENTBUILDER_JOOMLA_MODULE_HTML="HTML" COM_COMPONENTBUILDER_JOOMLA_MODULE_ID="Id" COM_COMPONENTBUILDER_JOOMLA_MODULE_LABEL_DESCRIPTION="Not mandatory, used to Label the Fieldset" @@ -6239,6 +6320,9 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_MODULE_VERSION_DESCRIPTION="Add Version Numbe COM_COMPONENTBUILDER_JOOMLA_MODULE_MODULE_VERSION_HINT="1.0.0" COM_COMPONENTBUILDER_JOOMLA_MODULE_MODULE_VERSION_LABEL="Version" COM_COMPONENTBUILDER_JOOMLA_MODULE_MODULE_VERSION_MESSAGE="Error! Please add version here." +COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE="Mod Code" +COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE_DESCRIPTION="The code that is added to the main mod_name.php file" +COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE_LABEL="Module Code" COM_COMPONENTBUILDER_JOOMLA_MODULE_MYSQL="MySQL" COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME="Name" COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_DESCRIPTION="Enter Name Here" @@ -6247,12 +6331,16 @@ COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_LABEL="Name" COM_COMPONENTBUILDER_JOOMLA_MODULE_NAME_MESSAGE="Error! Please add name here." COM_COMPONENTBUILDER_JOOMLA_MODULE_NEW="A New Joomla Module" COM_COMPONENTBUILDER_JOOMLA_MODULE_NO="No" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NONE="None" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION="<?php echo JText::_('Text'); ?>" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_ADD_LANGUAGE_STRING_LABEL="Add Language String" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_DESCRIPTION="

All libraries added to modules are added to the component media folder for now

+

So over here you are able to manually add HTML code to your model default tmpl.

" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LIBRARIES_OPTIONS_LABEL="Libraries Options" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_DESCRIPTION="
Searching the database.
" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_LINKED_TO_NOTICE_LABEL="Linked To" -COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_MODEL_DESCRIPTION="

So over here you are able to manually code your model.

We have also added some code via the boilerplate repo that can serve as a starting point, simple select them and it will be added to your code.

If you have added any fields in the Config/Params tab, these fields will be available to you in the $this->params object, and can be accessed via the field name $this->params->get('fieldname'); with the get method.

" -COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_MODEL_LABEL="Easy Model Build Options" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_MOD_FILE_OPTIONS_DESCRIPTION="

If you have added any fields in the Config/Params tab, these fields will be available to you in the $params object, and can be accessed via the field name $params->get('fieldname'); with the get method.

" +COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_MOD_FILE_OPTIONS_LABEL="Mod File Options" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_SNIPPET_USAGE_LABEL="Snippet Usage" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UIKIT_SNIPPET_LABEL="Snippet Details" COM_COMPONENTBUILDER_JOOMLA_MODULE_NOTE_UPDATE_SERVER_NOTE_FTP_DESCRIPTION="During compilation the file will be moved to the server. You still need to point the above update server url to the xml file location on your server for it to work correctly." @@ -7717,10 +7805,11 @@ COM_COMPONENTBUILDER_PLACEHOLDER_NOTE_PLACEHOLDERS_PLACEDIN_DESCRIPTION=" - - - - + + + + + @@ -8123,7 +8212,7 @@ COM_COMPONENTBUILDER_SITE_VIEW_DASHBOARD="Dashboard" COM_COMPONENTBUILDER_SITE_VIEW_DATABASE="Database" COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT="Default" COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_DESCRIPTION="Add the code here." -COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_LABEL="Default View" +COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_LABEL="Default Tmpl" COM_COMPONENTBUILDER_SITE_VIEW_DELETE="Delete" COM_COMPONENTBUILDER_SITE_VIEW_DESCRIPTION="Description" COM_COMPONENTBUILDER_SITE_VIEW_DESCRIPTION_DESCRIPTION="Enter some description" @@ -8797,6 +8886,7 @@ COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_MENUS="The component custom admi COM_COMPONENTBUILDER_THE_COMPONENT_CUSTOM_ADMIN_VIEWS="The component custom admin views" COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD="The component dashboard" COM_COMPONENTBUILDER_THE_COMPONENT_FILES_FOLDERS="The component files & folders" +COM_COMPONENTBUILDER_THE_COMPONENT_MODULES="The component modules" COM_COMPONENTBUILDER_THE_COMPONENT_MYSQL_TWEAKS="The component mysql tweaks" COM_COMPONENTBUILDER_THE_COMPONENT_PLACEHOLDERS="The component placeholders" COM_COMPONENTBUILDER_THE_COMPONENT_PLUGINS="The component plugins" @@ -8862,6 +8952,7 @@ COM_COMPONENTBUILDER_TYPE_COMPONENT_CUSTOM_ADMIN_MENUS="Component Custom Admin M COM_COMPONENTBUILDER_TYPE_COMPONENT_CUSTOM_ADMIN_VIEWS="Component Custom Admin Views" COM_COMPONENTBUILDER_TYPE_COMPONENT_DASHBOARD="Component Dashboard" COM_COMPONENTBUILDER_TYPE_COMPONENT_FILES_FOLDERS="Component Files & Folders" +COM_COMPONENTBUILDER_TYPE_COMPONENT_MODULES="Component Modules" COM_COMPONENTBUILDER_TYPE_COMPONENT_MYSQL_TWEAKS="Component mysql Tweaks" COM_COMPONENTBUILDER_TYPE_COMPONENT_PLACEHOLDERS="Component Placeholders" COM_COMPONENTBUILDER_TYPE_COMPONENT_PLUGINS="Component Plugins" @@ -9028,6 +9119,7 @@ COM_COMPONENTBUILDER_YOU_DO_NOT_HAVE_PERMISSION_TO_CLONE_A_COMPONENT_PLEASE_CONT 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_MODULE="You do not have permission to install the module!" 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!" 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 f98d81f9c..e978432da 100644 --- a/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini +++ b/admin/language/en-GB/en-GB.com_componentbuilder.sys.ini @@ -311,6 +311,26 @@ COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE="Components Files Fold COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_STATE_DESC="Allows the users in this group to update the state of the component files folders" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION="Components Files Folders Edit Version" COM_COMPONENTBUILDER_COMPONENTS_FILES_FOLDERS_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components files folders" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS="Components Modules Access" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_ACCESS_DESC="Allows the users in this group to access access components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE="Components Modules Batch Use" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_BATCH_USE_DESC="Allows users in this group to use batch copy/update method of batch components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE="Components Modules Create" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_CREATE_DESC="Allows the users in this group to create create components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE="Components Modules Delete" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_DELETE_DESC="Allows the users in this group to delete delete components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT="Components Modules Edit" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_BY="Components Modules Edit Created By" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_BY_DESC="Allows the users in this group to update the created by of the edit created by components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_DATE="Components Modules Edit Created Date" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_CREATED_DATE_DESC="Allows the users in this group to update the created date of the edit created components modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_DESC="Allows the users in this group to edit the component modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN="Components Modules Edit Own" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_OWN_DESC="Allows the users in this group to edit edit own components modules created by them" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE="Components Modules Edit State" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_STATE_DESC="Allows the users in this group to update the state of the component modules" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION="Components Modules Edit Version" +COM_COMPONENTBUILDER_COMPONENTS_MODULES_EDIT_VERSION_DESC="Allows users in this group to edit versions of version components modules" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS="Components Mysql Tweaks Access" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_ACCESS_DESC="Allows the users in this group to access access components mysql tweaks" COM_COMPONENTBUILDER_COMPONENTS_MYSQL_TWEAKS_BATCH_USE="Components Mysql Tweaks Batch Use" diff --git a/admin/layouts/joomla_module/code_fullwidth.php b/admin/layouts/joomla_module/code_fullwidth.php index f8e931724..b6309c1fc 100644 --- a/admin/layouts/joomla_module/code_fullwidth.php +++ b/admin/layouts/joomla_module/code_fullwidth.php @@ -26,8 +26,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( - 'abstract_class_helper_header', - 'abstract_class_helper_code' + 'mod_code' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/joomla_module/code_left.php b/admin/layouts/joomla_module/code_left.php index 868647ae8..f876161b2 100644 --- a/admin/layouts/joomla_module/code_left.php +++ b/admin/layouts/joomla_module/code_left.php @@ -26,8 +26,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( - 'add_abstract_class_helper', - 'add_custom_abstract_class_helper_header' + 'custom_get' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/joomla_module/code_right.php b/admin/layouts/joomla_module/code_right.php index f876161b2..570fd9f79 100644 --- a/admin/layouts/joomla_module/code_right.php +++ b/admin/layouts/joomla_module/code_right.php @@ -26,7 +26,7 @@ $fields_tab_layout = 'fields_' . $layout_path_array[1]; // get the fields $fields = $displayData->get($fields_tab_layout) ?: array( - 'custom_get' + 'note_mod_file_options' ); $hiddenFields = $displayData->get('hidden_fields') ?: array(); diff --git a/admin/layouts/joomla_module/html_left.php b/admin/layouts/joomla_module/html_left.php index 720aebaaf..a85487f62 100644 --- a/admin/layouts/joomla_module/html_left.php +++ b/admin/layouts/joomla_module/html_left.php @@ -29,7 +29,7 @@ $fields = $displayData->get($fields_tab_layout) ?: array( 'name', 'description', 'libraries', - 'note_model', + 'note_libraries_options', 'note_add_language_string' ); diff --git a/admin/layouts/server/linked_components_fullwidth.php b/admin/layouts/server/linked_components_fullwidth.php index 0adb7539a..97ac46d71 100644 --- a/admin/layouts/server/linked_components_fullwidth.php +++ b/admin/layouts/server/linked_components_fullwidth.php @@ -148,6 +148,11 @@ else 'views' => 'components_dashboard', 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'), 'icon' => 'dashboard'), + array( + 'view' => 'component_modules', + 'views' => 'components_modules', + 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_MODULES'), + 'icon' => 'cube'), array( 'view' => 'component_plugins', 'views' => 'components_plugins', diff --git a/admin/models/ajax.php b/admin/models/ajax.php index 8f4da0c54..3acc54869 100644 --- a/admin/models/ajax.php +++ b/admin/models/ajax.php @@ -926,9 +926,11 @@ class ComponentbuilderModelAjax extends JModelList protected $linkedKeys = array( 'field' => array( array('table' => 'component_config', 'tables' => 'components_config', 'fields' => array('addconfig' => 'field', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT', 'linked_name' => 'system_name'), + array('table' => 'library_config', 'tables' => 'libraries_config', 'fields' => array('addconfig' => 'field', 'library' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_LIBRARY', 'linked_name' => 'name'), array('table' => 'admin_fields', 'tables' => 'admins_fields', 'fields' => array('addfields' => 'field', 'admin_view' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_ADMIN_VIEW', 'linked_name' => 'system_name'), array('table' => 'field', 'tables' => 'fields', 'fields' => array('xml' => 'fields', 'name' => 'NAME', 'fieldtype' => 'TYPE'), 'linked' => 'COM_COMPONENTBUILDER_FIELD', 'type_name' => 'name'), - array('table' => 'joomla_plugin', 'tables' => 'joomla_plugins', 'fields' => array('fields' => 'field', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN') + array('table' => 'joomla_module', 'tables' => 'joomla_modules', 'fields' => array('fields' => 'fields.fields.field', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_MODULE'), + array('table' => 'joomla_plugin', 'tables' => 'joomla_plugins', 'fields' => array('fields' => 'fields.fields.field', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_PLUGIN') ), 'admin_view' => array( array('table' => 'component_admin_views', 'tables' => 'components_admin_views', 'fields' => array('addadmin_views' => 'adminview', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT', 'linked_name' => 'system_name') @@ -949,6 +951,9 @@ class ComponentbuilderModelAjax extends JModelList array('table' => 'site_view', 'tables' => 'site_views', 'fields' => array('custom_get' => 'ARRAY', 'main_get' => 'INT', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_SITE_VIEW'), array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'fields' => array('custom_get' => 'ARRAY', 'main_get' => 'INT', 'system_name' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW') ), + 'joomla_module' => array( + array('table' => 'component_modules', 'tables' => 'components_modules', 'fields' => array('addjoomla_modules' => 'module', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT', 'linked_name' => 'system_name') + ), 'joomla_plugin' => array( array('table' => 'component_plugins', 'tables' => 'components_plugins', 'fields' => array('addjoomla_plugins' => 'plugin', 'joomla_component' => 'NAME'), 'linked' => 'COM_COMPONENTBUILDER_JOOMLA_COMPONENT', 'linked_name' => 'system_name') ) @@ -1082,11 +1087,43 @@ class ComponentbuilderModelAjax extends JModelList } else { - foreach ($item->{$key} as $row) + // check if this is a sub sub form target + if (strpos($target, '.') !== false) { - if (isset($row[$target]) && $row[$target] == $id) + $_target = (array) explode('.', $target); + // check that we have an array and get the size + if (($_size = ComponentbuilderHelper::checkArray($_target)) !== false) { - $found = true; + foreach ($item->{$key} as $row) + { + if ($_size == 2) + { + if (isset($row[$_target[0]]) && isset($row[$_target[0]][$_target[1]]) && $row[$_target[0]][$_target[1]] == $id) + { + $found = true; + } + } + elseif ($_size == 3 && isset($row[$_target[0]]) && ComponentbuilderHelper::checkArray($row[$_target[0]])) + { + foreach ($row[$_target[0]] as $_row) + { + if (!$found && isset($_row[$_target[2]]) && $_row[$_target[2]] == $id) + { + $found = true; + } + } + } + } + } + } + else + { + foreach ($item->{$key} as $row) + { + if (!$found && isset($row[$target]) && $row[$target] == $id) + { + $found = true; + } } } } @@ -2488,29 +2525,37 @@ class ComponentbuilderModelAjax extends JModelList 'not_base64' => array(), 'name' => 'name' ), - // #__componentbuilder_joomla_plugin (q) - 'joomla_plugin' => array( - 'search' => array('id', 'system_name', 'name', 'main_class_code', 'head', '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('description' => 'string'), + // #__componentbuilder_joomla_module (q) + 'joomla_module' => array( + 'search' => array('id', 'system_name', 'name', 'default', 'description', 'mod_code', 'class_helper_header', 'class_helper_code', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall', 'sql', 'sql_uninstall', 'readme'), + 'views' => 'joomla_modules', + 'not_base64' => array('description' => 'string', 'readme' => 'string'), 'name' => 'system_name' ), - // #__componentbuilder_class_extends (r) + // #__componentbuilder_joomla_plugin (r) + 'joomla_plugin' => array( + 'search' => array('id', 'system_name', 'name', 'main_class_code', 'head', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall', 'sql', 'sql_uninstall', 'readme'), + 'views' => 'joomla_plugins', + 'not_base64' => array('description' => 'string', 'readme' => 'string'), + 'name' => 'system_name' + ), + // #__componentbuilder_class_extends (s) 'class_extends' => array( 'search' => array('id', 'name', 'head', 'comment'), 'views' => 'class_extendings', 'not_base64' => array(), 'name' => 'name' ), - // #__componentbuilder_class_property (s) + // #__componentbuilder_class_property (t) 'class_property' => array( 'search' => array('id', 'name', 'default', 'comment'), 'views' => 'class_properties', 'not_base64' => array(), 'name' => 'name' ), - // #__componentbuilder_class_method (t) + // #__componentbuilder_class_method (u) 'class_method' => array( 'search' => array('id', 'name', 'code', 'comment'), 'views' => 'class_methods', diff --git a/admin/models/componentbuilder.php b/admin/models/componentbuilder.php index 0e7f8719a..ebb896add 100644 --- a/admin/models/componentbuilder.php +++ b/admin/models/componentbuilder.php @@ -184,6 +184,9 @@ class ComponentbuilderModelComponentbuilder extends JModelList 'component_plugins.create' => 'component_plugins.create', 'components_plugins.access' => 'component_plugins.access', 'component_plugins.access' => 'component_plugins.access', + 'component_modules.create' => 'component_modules.create', + 'components_modules.access' => 'component_modules.access', + 'component_modules.access' => 'component_modules.access', 'snippet_type.create' => 'snippet_type.create', 'snippet_types.access' => 'snippet_type.access', 'snippet_type.access' => 'snippet_type.access', diff --git a/admin/models/forms/custom_code.js b/admin/models/forms/custom_code.js index b4fbfccdc..b37797509 100644 --- a/admin/models/forms/custom_code.js +++ b/admin/models/forms/custom_code.js @@ -313,8 +313,8 @@ function usedin(functioName, ide) { jQuery('#note-usedin-not').hide(); jQuery('#note-usedin-found').hide(); jQuery('#loading-usedin').show(); - var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t']; // if you update this, also update (below 19) & [customcode-codeUsedInHtmlNote]! - var targetNumber = 19; + var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u']; // if you update this, also update (below 20) & [customcode-codeUsedInHtmlNote]! + var targetNumber = 20; var run = 0; var usedinChecker = setInterval(function(){ var target = targets[run]; diff --git a/admin/models/forms/joomla_module.js b/admin/models/forms/joomla_module.js index 43d0655be..0742f5050 100644 --- a/admin/models/forms/joomla_module.js +++ b/admin/models/forms/joomla_module.js @@ -9,7 +9,7 @@ */ // Some Global Values -jform_vvvvvxbvwd_required = false; +jform_vvvvvxcvwd_required = false; jform_vvvvvxrvwe_required = false; jform_vvvvvxsvwf_required = false; jform_vvvvvxtvwg_required = false; @@ -17,12 +17,12 @@ jform_vvvvvxtvwg_required = false; // Initial Script jQuery(document).ready(function() { - var add_custom_abstract_class_helper_header_vvvvvxb = jQuery("#jform_add_custom_abstract_class_helper_header input[type='radio']:checked").val(); - var add_abstract_class_helper_vvvvvxb = jQuery("#jform_add_abstract_class_helper input[type='radio']:checked").val(); - vvvvvxb(add_custom_abstract_class_helper_header_vvvvvxb,add_abstract_class_helper_vvvvvxb); + var add_class_helper_vvvvvxb = jQuery("#jform_add_class_helper").val(); + vvvvvxb(add_class_helper_vvvvvxb); - var add_abstract_class_helper_vvvvvxd = jQuery("#jform_add_abstract_class_helper input[type='radio']:checked").val(); - vvvvvxd(add_abstract_class_helper_vvvvvxd); + var add_class_helper_header_vvvvvxc = jQuery("#jform_add_class_helper_header input[type='radio']:checked").val(); + var add_class_helper_vvvvvxc = jQuery("#jform_add_class_helper").val(); + vvvvvxc(add_class_helper_header_vvvvvxc,add_class_helper_vvvvvxc); var add_php_script_construct_vvvvvxe = jQuery("#jform_add_php_script_construct input[type='radio']:checked").val(); vvvvvxe(add_php_script_construct_vvvvvxe); @@ -81,51 +81,122 @@ jQuery(document).ready(function() }); // the vvvvvxb function -function vvvvvxb(add_custom_abstract_class_helper_header_vvvvvxb,add_abstract_class_helper_vvvvvxb) +function vvvvvxb(add_class_helper_vvvvvxb) +{ + if (isSet(add_class_helper_vvvvvxb) && add_class_helper_vvvvvxb.constructor !== Array) + { + var temp_vvvvvxb = add_class_helper_vvvvvxb; + var add_class_helper_vvvvvxb = []; + add_class_helper_vvvvvxb.push(temp_vvvvvxb); + } + else if (!isSet(add_class_helper_vvvvvxb)) + { + var add_class_helper_vvvvvxb = []; + } + var add_class_helper = add_class_helper_vvvvvxb.some(add_class_helper_vvvvvxb_SomeFunc); + + + // set this function logic + if (add_class_helper) + { + jQuery('#jform_add_class_helper_header').closest('.control-group').show(); + jQuery('#jform_class_helper_code-lbl').closest('.control-group').show(); + } + else + { + jQuery('#jform_add_class_helper_header').closest('.control-group').hide(); + jQuery('#jform_class_helper_code-lbl').closest('.control-group').hide(); + } +} + +// the vvvvvxb Some function +function add_class_helper_vvvvvxb_SomeFunc(add_class_helper_vvvvvxb) { // set the function logic - if (add_custom_abstract_class_helper_header_vvvvvxb == 1 && add_abstract_class_helper_vvvvvxb == 1) + if (add_class_helper_vvvvvxb == 1 || add_class_helper_vvvvvxb == 2) { - jQuery('#jform_abstract_class_helper_header-lbl').closest('.control-group').show(); - // add required attribute to abstract_class_helper_header field - if (jform_vvvvvxbvwd_required) + return true; + } + return false; +} + +// the vvvvvxc function +function vvvvvxc(add_class_helper_header_vvvvvxc,add_class_helper_vvvvvxc) +{ + if (isSet(add_class_helper_header_vvvvvxc) && add_class_helper_header_vvvvvxc.constructor !== Array) + { + var temp_vvvvvxc = add_class_helper_header_vvvvvxc; + var add_class_helper_header_vvvvvxc = []; + add_class_helper_header_vvvvvxc.push(temp_vvvvvxc); + } + else if (!isSet(add_class_helper_header_vvvvvxc)) + { + var add_class_helper_header_vvvvvxc = []; + } + var add_class_helper_header = add_class_helper_header_vvvvvxc.some(add_class_helper_header_vvvvvxc_SomeFunc); + + if (isSet(add_class_helper_vvvvvxc) && add_class_helper_vvvvvxc.constructor !== Array) + { + var temp_vvvvvxc = add_class_helper_vvvvvxc; + var add_class_helper_vvvvvxc = []; + add_class_helper_vvvvvxc.push(temp_vvvvvxc); + } + else if (!isSet(add_class_helper_vvvvvxc)) + { + var add_class_helper_vvvvvxc = []; + } + var add_class_helper = add_class_helper_vvvvvxc.some(add_class_helper_vvvvvxc_SomeFunc); + + + // set this function logic + if (add_class_helper_header && add_class_helper) + { + jQuery('#jform_class_helper_header-lbl').closest('.control-group').show(); + // add required attribute to class_helper_header field + if (jform_vvvvvxcvwd_required) { - updateFieldRequired('abstract_class_helper_header',0); - jQuery('#jform_abstract_class_helper_header').prop('required','required'); - jQuery('#jform_abstract_class_helper_header').attr('aria-required',true); - jQuery('#jform_abstract_class_helper_header').addClass('required'); - jform_vvvvvxbvwd_required = false; + updateFieldRequired('class_helper_header',0); + jQuery('#jform_class_helper_header').prop('required','required'); + jQuery('#jform_class_helper_header').attr('aria-required',true); + jQuery('#jform_class_helper_header').addClass('required'); + jform_vvvvvxcvwd_required = false; } } else { - jQuery('#jform_abstract_class_helper_header-lbl').closest('.control-group').hide(); - // remove required attribute from abstract_class_helper_header field - if (!jform_vvvvvxbvwd_required) + jQuery('#jform_class_helper_header-lbl').closest('.control-group').hide(); + // remove required attribute from class_helper_header field + if (!jform_vvvvvxcvwd_required) { - updateFieldRequired('abstract_class_helper_header',1); - jQuery('#jform_abstract_class_helper_header').removeAttr('required'); - jQuery('#jform_abstract_class_helper_header').removeAttr('aria-required'); - jQuery('#jform_abstract_class_helper_header').removeClass('required'); - jform_vvvvvxbvwd_required = true; + updateFieldRequired('class_helper_header',1); + jQuery('#jform_class_helper_header').removeAttr('required'); + jQuery('#jform_class_helper_header').removeAttr('aria-required'); + jQuery('#jform_class_helper_header').removeClass('required'); + jform_vvvvvxcvwd_required = true; } } } -// the vvvvvxd function -function vvvvvxd(add_abstract_class_helper_vvvvvxd) +// the vvvvvxc Some function +function add_class_helper_header_vvvvvxc_SomeFunc(add_class_helper_header_vvvvvxc) { // set the function logic - if (add_abstract_class_helper_vvvvvxd == 1) + if (add_class_helper_header_vvvvvxc == 1) { - jQuery('#jform_abstract_class_helper_code-lbl').closest('.control-group').show(); - jQuery('#jform_add_custom_abstract_class_helper_header').closest('.control-group').show(); + return true; } - else + return false; +} + +// the vvvvvxc Some function +function add_class_helper_vvvvvxc_SomeFunc(add_class_helper_vvvvvxc) +{ + // set the function logic + if (add_class_helper_vvvvvxc == 1 || add_class_helper_vvvvvxc == 2) { - jQuery('#jform_abstract_class_helper_code-lbl').closest('.control-group').hide(); - jQuery('#jform_add_custom_abstract_class_helper_header').closest('.control-group').hide(); + return true; } + return false; } // the vvvvvxe function diff --git a/admin/models/forms/joomla_module.xml b/admin/models/forms/joomla_module.xml index bae2c9df6..b51fa6e48 100644 --- a/admin/models/forms/joomla_module.xml +++ b/admin/models/forms/joomla_module.xml @@ -111,12 +111,12 @@ filter="HTML" hint="COM_COMPONENTBUILDER_JOOMLA_MODULE_DESCRIPTION_HINT" /> - + + + + + - - - + - - + + + + + + + + - - @@ -222,36 +246,6 @@ /> - - - - - - - - - - - - - + COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - + - - - - + type="url" + name="update_server_url" + label="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_URL_LABEL" + size="60" + maxlength="150" + default="" + description="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_URL_DESCRIPTION" + class="text_area span12" + filter="url" + validated="url" + message="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_URL_MESSAGE" + hint="COM_COMPONENTBUILDER_JOOMLA_MODULE_UPDATE_SERVER_URL_HINT" + /> + + + + + + + + + + COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - + - - - - + type="editor" + name="mod_code" + label="COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_MODULE_MOD_CODE_DESCRIPTION" + width="100%" + height="500px" + cols="15" + rows="10" + buttons="no" + syntax="php" + editor="codemirror|none" + filter="raw" + required="true" + validate="code" + /> COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - + + type="list" + name="add_class_helper" + label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_DESCRIPTION" + class="list_class" + multiple="false" + required="true" + default="0"> + + + + + COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - + + type="radio" + name="add_class_helper_header" + label="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_LABEL" + description="COM_COMPONENTBUILDER_JOOMLA_MODULE_ADD_CLASS_HELPER_HEADER_DESCRIPTION" + class="btn-group btn-group-yesno" + default="0"> + + + + COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - + + + + + + + + + - + @@ -590,14 +643,13 @@ - + + default="0"> @@ -618,13 +670,14 @@ - + + default="0" + required="true"> @@ -647,34 +700,6 @@ filter="raw" validate="code" /> - - - - - - - - - - - - COM_COMPONENTBUILDER_JOOMLA_MODULE_OTHER + + + + + + + + - - + + COM_COMPONENTBUILDER_JOOMLA_MODULE_NO - - - - array(), 'name' => 'name' ), - // #__componentbuilder_joomla_plugin (q) - 'joomla_plugin' => array( - 'search' => array('id', 'system_name', 'name', 'main_class_code', 'head', '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('description' => 'string'), + // #__componentbuilder_joomla_module (q) + 'joomla_module' => array( + 'search' => array('id', 'system_name', 'name', 'default', 'description', 'mod_code', 'class_helper_header', 'class_helper_code', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall', 'sql', 'sql_uninstall', 'readme'), + 'views' => 'joomla_modules', + 'not_base64' => array('description' => 'string', 'readme' => 'string'), 'name' => 'system_name' ), - // #__componentbuilder_class_extends (r) + // #__componentbuilder_joomla_plugin (r) + 'joomla_plugin' => array( + 'search' => array('id', 'system_name', 'name', 'main_class_code', 'head', 'description', 'php_script_construct', 'php_preflight_install', 'php_preflight_update', + 'php_preflight_uninstall', 'php_postflight_install', 'php_postflight_update', 'php_method_uninstall', 'sql', 'sql_uninstall', 'readme'), + 'views' => 'joomla_plugins', + 'not_base64' => array('description' => 'string', 'readme' => 'string'), + 'name' => 'system_name' + ), + // #__componentbuilder_class_extends (s) 'class_extends' => array( 'search' => array('id', 'name', 'head', 'comment'), 'views' => 'class_extendings', 'not_base64' => array(), 'name' => 'name' ), - // #__componentbuilder_class_property (s) + // #__componentbuilder_class_property (t) 'class_property' => array( 'search' => array('id', 'name', 'default', 'comment'), 'views' => 'class_properties', 'not_base64' => array(), 'name' => 'name' ), - // #__componentbuilder_class_method (t) + // #__componentbuilder_class_method (u) 'class_method' => array( 'search' => array('id', 'name', 'code', 'comment'), 'views' => 'class_methods', diff --git a/admin/models/joomla_module.php b/admin/models/joomla_module.php index ec5e1a39d..609b797b5 100644 --- a/admin/models/joomla_module.php +++ b/admin/models/joomla_module.php @@ -30,7 +30,7 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin 'name', 'description', 'libraries', - 'note_model', + 'note_libraries_options', 'note_add_language_string' ), 'right' => array( @@ -66,6 +66,20 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin 'php_method_uninstall' ) ), + 'readme' => array( + 'left' => array( + 'addreadme', + 'readme' + ) + ), + 'mysql' => array( + 'fullwidth' => array( + 'add_sql', + 'sql', + 'add_sql_uninstall', + 'sql_uninstall' + ) + ), 'dynamic_integration' => array( 'left' => array( 'add_update_server', @@ -79,31 +93,27 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin 'sales_server' ) ), - 'mysql' => array( - 'fullwidth' => array( - 'add_sql', - 'sql', - 'add_sql_uninstall', - 'sql_uninstall' - ) - ), - 'readme' => array( - 'left' => array( - 'addreadme', - 'readme' - ) - ), 'code' => array( 'left' => array( - 'add_abstract_class_helper', - 'add_custom_abstract_class_helper_header' - ), - 'right' => array( 'custom_get' ), + 'right' => array( + 'note_mod_file_options' + ), 'fullwidth' => array( - 'abstract_class_helper_header', - 'abstract_class_helper_code' + 'mod_code' + ) + ), + 'helper' => array( + 'left' => array( + 'add_class_helper' + ), + 'right' => array( + 'add_class_helper_header' + ), + 'fullwidth' => array( + 'class_helper_header', + 'class_helper_code' ) ), 'forms_fields' => array( @@ -224,10 +234,10 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin $item->metadata = $registry->toArray(); } - if (!empty($item->php_postflight_update)) + if (!empty($item->php_method_uninstall)) { - // base64 Decode php_postflight_update. - $item->php_postflight_update = base64_decode($item->php_postflight_update); + // base64 Decode php_method_uninstall. + $item->php_method_uninstall = base64_decode($item->php_method_uninstall); } if (!empty($item->php_postflight_install)) @@ -236,52 +246,64 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin $item->php_postflight_install = base64_decode($item->php_postflight_install); } + if (!empty($item->php_postflight_update)) + { + // base64 Decode php_postflight_update. + $item->php_postflight_update = base64_decode($item->php_postflight_update); + } + + if (!empty($item->php_preflight_update)) + { + // base64 Decode php_preflight_update. + $item->php_preflight_update = base64_decode($item->php_preflight_update); + } + if (!empty($item->php_preflight_uninstall)) { // base64 Decode php_preflight_uninstall. $item->php_preflight_uninstall = base64_decode($item->php_preflight_uninstall); } - if (!empty($item->sql_uninstall)) - { - // base64 Decode sql_uninstall. - $item->sql_uninstall = base64_decode($item->sql_uninstall); - } - - if (!empty($item->default)) - { - // base64 Decode default. - $item->default = base64_decode($item->default); - } - - if (!empty($item->php_method_uninstall)) - { - // base64 Decode php_method_uninstall. - $item->php_method_uninstall = base64_decode($item->php_method_uninstall); - } - - if (!empty($item->sql)) - { - // base64 Decode sql. - $item->sql = base64_decode($item->sql); - } - if (!empty($item->readme)) { // base64 Decode readme. $item->readme = base64_decode($item->readme); } - if (!empty($item->abstract_class_helper_header)) + if (!empty($item->default)) { - // base64 Decode abstract_class_helper_header. - $item->abstract_class_helper_header = base64_decode($item->abstract_class_helper_header); + // base64 Decode default. + $item->default = base64_decode($item->default); } - if (!empty($item->abstract_class_helper_code)) + if (!empty($item->sql)) { - // base64 Decode abstract_class_helper_code. - $item->abstract_class_helper_code = base64_decode($item->abstract_class_helper_code); + // base64 Decode sql. + $item->sql = base64_decode($item->sql); + } + + if (!empty($item->sql_uninstall)) + { + // base64 Decode sql_uninstall. + $item->sql_uninstall = base64_decode($item->sql_uninstall); + } + + if (!empty($item->mod_code)) + { + // base64 Decode mod_code. + $item->mod_code = base64_decode($item->mod_code); + } + + if (!empty($item->class_helper_header)) + { + // base64 Decode class_helper_header. + $item->class_helper_header = base64_decode($item->class_helper_header); + } + + if (!empty($item->class_helper_code)) + { + // base64 Decode class_helper_code. + $item->class_helper_code = base64_decode($item->class_helper_code); } if (!empty($item->php_script_construct)) @@ -296,12 +318,6 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin $item->php_preflight_install = base64_decode($item->php_preflight_install); } - if (!empty($item->php_preflight_update)) - { - // base64 Decode php_preflight_update. - $item->php_preflight_update = base64_decode($item->php_preflight_update); - } - if (!empty($item->libraries)) { // Convert the libraries field to an array. @@ -1211,10 +1227,10 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin $data['fields'] = ''; } - // Set the php_postflight_update string to base64 string. - if (isset($data['php_postflight_update'])) + // Set the php_method_uninstall string to base64 string. + if (isset($data['php_method_uninstall'])) { - $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); + $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); } // Set the php_postflight_install string to base64 string. @@ -1223,52 +1239,64 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin $data['php_postflight_install'] = base64_encode($data['php_postflight_install']); } + // Set the php_postflight_update string to base64 string. + if (isset($data['php_postflight_update'])) + { + $data['php_postflight_update'] = base64_encode($data['php_postflight_update']); + } + + // Set the php_preflight_update string to base64 string. + if (isset($data['php_preflight_update'])) + { + $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); + } + // Set the php_preflight_uninstall string to base64 string. if (isset($data['php_preflight_uninstall'])) { $data['php_preflight_uninstall'] = base64_encode($data['php_preflight_uninstall']); } - // Set the sql_uninstall string to base64 string. - if (isset($data['sql_uninstall'])) - { - $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); - } - - // Set the default string to base64 string. - if (isset($data['default'])) - { - $data['default'] = base64_encode($data['default']); - } - - // Set the php_method_uninstall string to base64 string. - if (isset($data['php_method_uninstall'])) - { - $data['php_method_uninstall'] = base64_encode($data['php_method_uninstall']); - } - - // Set the sql string to base64 string. - if (isset($data['sql'])) - { - $data['sql'] = base64_encode($data['sql']); - } - // Set the readme string to base64 string. if (isset($data['readme'])) { $data['readme'] = base64_encode($data['readme']); } - // Set the abstract_class_helper_header string to base64 string. - if (isset($data['abstract_class_helper_header'])) + // Set the default string to base64 string. + if (isset($data['default'])) { - $data['abstract_class_helper_header'] = base64_encode($data['abstract_class_helper_header']); + $data['default'] = base64_encode($data['default']); } - // Set the abstract_class_helper_code string to base64 string. - if (isset($data['abstract_class_helper_code'])) + // Set the sql string to base64 string. + if (isset($data['sql'])) { - $data['abstract_class_helper_code'] = base64_encode($data['abstract_class_helper_code']); + $data['sql'] = base64_encode($data['sql']); + } + + // Set the sql_uninstall string to base64 string. + if (isset($data['sql_uninstall'])) + { + $data['sql_uninstall'] = base64_encode($data['sql_uninstall']); + } + + // Set the mod_code string to base64 string. + if (isset($data['mod_code'])) + { + $data['mod_code'] = base64_encode($data['mod_code']); + } + + // Set the class_helper_header string to base64 string. + if (isset($data['class_helper_header'])) + { + $data['class_helper_header'] = base64_encode($data['class_helper_header']); + } + + // Set the class_helper_code string to base64 string. + if (isset($data['class_helper_code'])) + { + $data['class_helper_code'] = base64_encode($data['class_helper_code']); } // Set the php_script_construct string to base64 string. @@ -1281,12 +1309,6 @@ class ComponentbuilderModelJoomla_module extends JModelAdmin if (isset($data['php_preflight_install'])) { $data['php_preflight_install'] = base64_encode($data['php_preflight_install']); - } - - // Set the php_preflight_update string to base64 string. - if (isset($data['php_preflight_update'])) - { - $data['php_preflight_update'] = base64_encode($data['php_preflight_update']); } // Set the Params Items to data diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql index 64c6a6080..5a8f2a61f 100644 --- a/admin/sql/install.mysql.utf8.sql +++ b/admin/sql/install.mysql.utf8.sql @@ -144,10 +144,8 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_component` ( CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', - `abstract_class_helper_code` MEDIUMTEXT NOT NULL, - `abstract_class_helper_header` TEXT NOT NULL, - `add_abstract_class_helper` TINYINT(1) NOT NULL DEFAULT 0, - `add_custom_abstract_class_helper_header` TINYINT(1) NOT NULL DEFAULT 0, + `add_class_helper` TINYINT(1) NOT NULL DEFAULT 0, + `add_class_helper_header` TINYINT(1) NOT NULL DEFAULT 0, `add_php_method_uninstall` TINYINT(1) NOT NULL DEFAULT 0, `add_php_postflight_install` TINYINT(1) NOT NULL DEFAULT 0, `add_php_postflight_update` TINYINT(1) NOT NULL DEFAULT 0, @@ -160,11 +158,14 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( `add_sql_uninstall` TINYINT(1) NOT NULL DEFAULT 0, `add_update_server` TINYINT(1) NOT NULL DEFAULT 0, `addreadme` TINYINT(1) NOT NULL DEFAULT 0, + `class_helper_code` MEDIUMTEXT NOT NULL, + `class_helper_header` TEXT NOT NULL, `custom_get` TEXT NOT NULL, `default` TEXT NOT NULL, `description` TEXT NOT NULL, `fields` TEXT NOT NULL, `libraries` TEXT NOT NULL, + `mod_code` TEXT NOT NULL, `module_version` CHAR(64) NOT NULL DEFAULT '', `name` VARCHAR(255) NOT NULL DEFAULT '', `php_method_uninstall` MEDIUMTEXT NOT NULL, @@ -204,11 +205,11 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_joomla_module` ( KEY `idx_add_php_method_uninstall` (`add_php_method_uninstall`), KEY `idx_add_sql` (`add_sql`), KEY `idx_add_sql_uninstall` (`add_sql_uninstall`), - KEY `idx_add_php_script_construct` (`add_php_script_construct`), KEY `idx_addreadme` (`addreadme`), + KEY `idx_add_php_script_construct` (`add_php_script_construct`), KEY `idx_add_update_server` (`add_update_server`), - KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), KEY `idx_update_server_target` (`update_server_target`), + KEY `idx_add_php_preflight_install` (`add_php_preflight_install`), KEY `idx_add_php_preflight_update` (`add_php_preflight_update`), KEY `idx_name` (`name`), KEY `idx_access` (`access`), @@ -1601,6 +1602,32 @@ CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_plugins` ( KEY `idx_state` (`published`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; +CREATE TABLE IF NOT EXISTS `#__componentbuilder_component_modules` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', + `addjoomla_modules` TEXT NOT NULL, + `joomla_component` INT(11) NOT NULL DEFAULT 0, + `params` text NOT NULL, + `published` TINYINT(3) NOT NULL DEFAULT 1, + `created_by` INT(10) unsigned NOT NULL DEFAULT 0, + `modified_by` INT(10) unsigned NOT NULL DEFAULT 0, + `created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `modified` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `checked_out` int(11) unsigned NOT NULL DEFAULT 0, + `checked_out_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', + `version` INT(10) unsigned NOT NULL DEFAULT 1, + `hits` INT(10) unsigned NOT NULL DEFAULT 0, + `access` INT(10) unsigned NOT NULL DEFAULT 0, + `ordering` INT(11) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `idx_joomla_component` (`joomla_component`), + KEY `idx_access` (`access`), + KEY `idx_checkout` (`checked_out`), + KEY `idx_createdby` (`created_by`), + KEY `idx_modifiedby` (`modified_by`), + KEY `idx_state` (`published`) +) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC; + CREATE TABLE IF NOT EXISTS `#__componentbuilder_snippet_type` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `asset_id` INT(10) unsigned NOT NULL DEFAULT 0 COMMENT 'FK to the #__assets table.', diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql index 0d177dc9c..a18ba7d43 100644 --- a/admin/sql/uninstall.mysql.utf8.sql +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -35,6 +35,7 @@ DROP TABLE IF EXISTS `#__componentbuilder_component_dashboard`; DROP TABLE IF EXISTS `#__componentbuilder_component_files_folders`; DROP TABLE IF EXISTS `#__componentbuilder_component_placeholders`; DROP TABLE IF EXISTS `#__componentbuilder_component_plugins`; +DROP TABLE IF EXISTS `#__componentbuilder_component_modules`; DROP TABLE IF EXISTS `#__componentbuilder_snippet_type`; DROP TABLE IF EXISTS `#__componentbuilder_library_config`; DROP TABLE IF EXISTS `#__componentbuilder_library_files_folders_urls`; diff --git a/admin/views/compiler/tmpl/default.php b/admin/views/compiler/tmpl/default.php index dba67492f..08b1162a2 100644 --- a/admin/views/compiler/tmpl/default.php +++ b/admin/views/compiler/tmpl/default.php @@ -54,13 +54,13 @@ Joomla.submitbutton = function(task, key) if (isValid){ jQuery('#form').hide(); // get correct form based on task - if (task == 'compiler.compiler' || task == 'compiler.installCompiledPlugin') { + if (task == 'compiler.compiler' || task == 'compiler.installCompiledModule' || task == 'compiler.installCompiledPlugin') { var form = document.getElementById('compilerForm'); } else { var form = document.getElementById('adminForm'); } // set the plugin id - if (task == 'compiler.installCompiledPlugin') { + if (task == 'compiler.installCompiledModule' || task == 'compiler.installCompiledPlugin') { form.install_item_id.value = key; } // set the task value diff --git a/admin/views/joomla_components/tmpl/default_body.php b/admin/views/joomla_components/tmpl/default_body.php index 07baaa81e..b1fab5b32 100644 --- a/admin/views/joomla_components/tmpl/default_body.php +++ b/admin/views/joomla_components/tmpl/default_body.php @@ -137,6 +137,11 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml 'views' => 'components_dashboard', 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_DASHBOARD'), 'icon' => 'dashboard'), + array( + 'view' => 'component_modules', + 'views' => 'components_modules', + 'title' => JText::_('COM_COMPONENTBUILDER_THE_COMPONENT_MODULES'), + 'icon' => 'cube'), array( 'view' => 'component_plugins', 'views' => 'components_plugins', diff --git a/admin/views/joomla_module/tmpl/edit.php b/admin/views/joomla_module/tmpl/edit.php index 0d91fc3cb..37453c895 100644 --- a/admin/views/joomla_module/tmpl/edit.php +++ b/admin/views/joomla_module/tmpl/edit.php @@ -81,6 +81,22 @@ $componentParams = $this->params; // will be removed just use $this->params inst + +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
@@ -175,52 +191,52 @@ $componentParams = $this->params; // will be removed just use $this->params inst