Added Joomla Module builder - GUI
This commit is contained in:
@@ -1602,7 +1602,7 @@ class Get
|
||||
// README
|
||||
if ($component->addreadme)
|
||||
{
|
||||
$component->readme = base64_decode($component->readme);
|
||||
$component->readme = $this->setDynamicValues(base64_decode($component->readme));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6530,7 +6530,7 @@ class Get
|
||||
if (!isset($form['plugin']) || $form['plugin'] != 1)
|
||||
{
|
||||
// now build the form key
|
||||
$unique = $form['file'] . $form['fields_name'] . $form['fieldset'];
|
||||
$unique = $form['file'] . $form['fields_name'] . $form['fieldset'];
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -6603,7 +6603,7 @@ class Get
|
||||
}
|
||||
else
|
||||
{
|
||||
// load the cofig form
|
||||
// load the config form
|
||||
if (!isset($plugin->config_fields[$form['fields_name']]))
|
||||
{
|
||||
$plugin->config_fields[$form['fields_name']] = array();
|
||||
@@ -7228,7 +7228,7 @@ class Get
|
||||
* @param string $string The code string
|
||||
* @param array $config The placeholder config values
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
public function setGuiCodePlaceholder($string, $config)
|
||||
@@ -7343,16 +7343,26 @@ class Get
|
||||
$first_line = strtok($code, PHP_EOL);
|
||||
// get the GUI target details
|
||||
$query = explode('.', trim($first_line, '.'));
|
||||
// cleanup the newlines around the code
|
||||
$code = trim(str_replace($first_line, '', $code), PHP_EOL) . PHP_EOL;
|
||||
// reverse placeholder as much as we can
|
||||
$code = $this->reversePlaceholders($code, $placeholders, $target, $query[2], $query[1], $query[0]);
|
||||
// update the GUI/Tables/Database
|
||||
$object = new stdClass();
|
||||
$object->id = (int) $query[2];
|
||||
$object->{$query[1]} = base64_encode($code); // (TODO) this may not always work...
|
||||
// update the value in GUI
|
||||
$this->db->updateObject('#__componentbuilder_' . (string) $query[0], $object, 'id');
|
||||
// only continue if we have 3 values in the query
|
||||
if (is_array($query) && count($query) == 3)
|
||||
{
|
||||
// cleanup the newlines around the code
|
||||
$code = trim(str_replace($first_line, '', $code), PHP_EOL) . PHP_EOL;
|
||||
// set the ID
|
||||
$id = (int) $query[2];
|
||||
// make the field name save
|
||||
$field = ComponentbuilderHelper::safeFieldName($query[1]);
|
||||
// make the table name save
|
||||
$table = ComponentbuilderHelper::safeString($query[0]);
|
||||
// reverse placeholder as much as we can
|
||||
$code = $this->reversePlaceholders($code, $placeholders, $target, $id, $field, $table);
|
||||
// update the GUI/Tables/Database
|
||||
$object = new stdClass();
|
||||
$object->id = $id;
|
||||
$object->{$field} = base64_encode($code); // (TODO) this may not always work...
|
||||
// update the value in GUI
|
||||
$this->db->updateObject('#__componentbuilder_' . (string) $table, $object, 'id');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -404,7 +404,7 @@ class Structure extends Get
|
||||
*
|
||||
* @param int $nr The line number
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*
|
||||
*/
|
||||
private function setLine($nr)
|
||||
@@ -531,10 +531,34 @@ class Structure extends Get
|
||||
// biuld basic XML
|
||||
$xml = '<?xml version="1.0" encoding="utf-8"?>';
|
||||
$xml .= PHP_EOL . '<!--' . $this->setLine(__LINE__) . ' default paths of ' . $file . ' form points to ' . $this->componentCodeName . ' -->';
|
||||
$xml .= PHP_EOL . '<form';
|
||||
$xml .= PHP_EOL . $this->_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 . '>';
|
||||
// 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($plugin->fieldsets_paths[$file . $field_name . $fieldset]) && $plugin->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 . '<form';
|
||||
$xml .= PHP_EOL . $this->_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 . '<form>';
|
||||
}
|
||||
// add the fields
|
||||
foreach ($fields as $field_name => $fieldsets)
|
||||
{
|
||||
// check if we have an double fields naming set
|
||||
|
@@ -18,6 +18,20 @@ defined('_JEXEC') or die('Restricted access');
|
||||
class Interpretation extends Fields
|
||||
{
|
||||
|
||||
/**
|
||||
* The global config Field Sets
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $configFieldSets = array();
|
||||
|
||||
/**
|
||||
* The global config Field Sets Custom Fields
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $configFieldSetsCustomField = array();
|
||||
|
||||
/**
|
||||
* The contributors
|
||||
*
|
||||
@@ -16647,6 +16661,8 @@ function vdm_dkim() {
|
||||
$dbkey = 'yy';
|
||||
// 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($plugin->config_fields) && ComponentbuilderHelper::checkArray($plugin->config_fields))
|
||||
@@ -16660,9 +16676,14 @@ function vdm_dkim() {
|
||||
// make sure the xml is set and a string
|
||||
if (isset($xmlFields) && ComponentbuilderHelper::checkString($xmlFields))
|
||||
{
|
||||
$config_fields[$field_name.$fieldset] = $xmlFields;
|
||||
$config_fields[$field_name . $fieldset] = $xmlFields;
|
||||
}
|
||||
$dbkey++;
|
||||
// check if the fieldset path requiers component paths
|
||||
if (!$add_component_path && isset($plugin->fieldsets_paths[$field_name . $fieldset]) && $plugin->fieldsets_paths[$field_name . $fieldset] == 1)
|
||||
{
|
||||
$add_component_path = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16767,12 +16788,20 @@ function vdm_dkim() {
|
||||
if (ComponentbuilderHelper::checkArray($config_fields))
|
||||
{
|
||||
$xml .= PHP_EOL . PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' Config parameter -->';
|
||||
// add path to plugin rules and custom fields
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<config';
|
||||
$xml .= PHP_EOL . $this->_t(2) . 'addrulepath="/administrator/components/com_' . $this->componentCodeName . '/models/rules"';
|
||||
$xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/administrator/components/com_' . $this->componentCodeName . '/models/fields"';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '>';
|
||||
|
||||
// only add if part of the component field types path is required
|
||||
if ($add_component_path)
|
||||
{
|
||||
// add path to plugin rules and custom fields
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<config';
|
||||
$xml .= PHP_EOL . $this->_t(2) . 'addrulepath="/administrator/components/com_' . $this->componentCodeName . '/models/rules"';
|
||||
$xml .= PHP_EOL . $this->_t(2) . 'addfieldpath="/administrator/components/com_' . $this->componentCodeName . '/models/fields"';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<config>';
|
||||
}
|
||||
// add the fields
|
||||
foreach ($plugin->config_fields as $field_name => $fieldsets)
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<fields name="' . $field_name . '">';
|
||||
@@ -16785,7 +16814,7 @@ function vdm_dkim() {
|
||||
$label = $plugin->fieldsets_label[$field_name.$fieldset];
|
||||
}
|
||||
// add path to plugin rules and custom fields
|
||||
if (isset($plugin->fieldsets_paths[$field_name.$fieldset]) && $plugin->fieldsets_paths[$field_name.$fieldset] == 2)
|
||||
if (isset($plugin->fieldsets_paths[$field_name . $fieldset]) && $plugin->fieldsets_paths[$field_name . $fieldset] == 2)
|
||||
{
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<!--' . $this->setLine(__LINE__) . ' default paths of ' . $fieldset . ' fieldset points to the plugin -->';
|
||||
$xml .= PHP_EOL . $this->_t(1) . '<fieldset name="' . $fieldset . '" label="' . $label . '"';
|
||||
|
@@ -37,6 +37,7 @@ abstract class ComponentbuilderHelper
|
||||
self::loadSession();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locked Libraries (we can not have these change)
|
||||
**/
|
||||
@@ -4420,6 +4421,7 @@ abstract class ComponentbuilderHelper
|
||||
// fall back on array sum
|
||||
return array_sum($array);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* the locker
|
||||
@@ -5642,6 +5644,10 @@ abstract class ComponentbuilderHelper
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_COMPONENTS'), 'index.php?option=com_componentbuilder&view=joomla_components', $submenu === 'joomla_components');
|
||||
}
|
||||
if ($user->authorise('joomla_module.access', 'com_componentbuilder') && $user->authorise('joomla_module.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_MODULES'), 'index.php?option=com_componentbuilder&view=joomla_modules', $submenu === 'joomla_modules');
|
||||
}
|
||||
if ($user->authorise('joomla_plugin.access', 'com_componentbuilder') && $user->authorise('joomla_plugin.submenu', 'com_componentbuilder'))
|
||||
{
|
||||
JHtmlSidebar::addEntry(JText::_('COM_COMPONENTBUILDER_SUBMENU_JOOMLA_PLUGINS'), 'index.php?option=com_componentbuilder&view=joomla_plugins', $submenu === 'joomla_plugins');
|
||||
|
Reference in New Issue
Block a user