Improved the internal session handel of JCB. Fixed gh-487 that removed the data size when creating a new field.

This commit is contained in:
Llewellyn van der Merwe 2019-11-08 18:07:08 +02:00
parent 010a134e1a
commit 6539862534
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
38 changed files with 1582 additions and 564 deletions

View File

@ -1,8 +1,7 @@
# Joomla Component Builder ([JCB](http://joomlacomponentbuilder.com))
[![GitHub release](https://img.shields.io/github/release/vdm-io/Joomla-Component-Builder.svg)](https://github.com/vdm-io/Joomla-Component-Builder/releases)
[![Total Downloads](https://img.shields.io/github/downloads/vdm-io/Joomla-Component-Builder/total.svg)](https://github.com/vdm-io/Joomla-Component-Builder/releases)
[![Backers on Open Collective](https://opencollective.com/Joomla-Component-Builder/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/Joomla-Component-Builder/sponsors/badge.svg)](#sponsors)
[![JCB Pro Members](https://opencollective.com/joomla-component-builder/tiers/jcb-pro/badge.svg?label=JCB Pro&color=brightgreen)](#sponsors)
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -110,8 +109,6 @@ Where can you get support and help?
+ [Report a Security Issue](http://joomlacomponentbuilder.com/report-security-issues)
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Github](https://github.com/vdm-io/Joomla-Component-Builder/issues) ^^
+ [Telegram Group](https://t.me/jcb_group)
+ [JCB IRC Channel](https://vdm.bz/jcb-irc)
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
@ -146,14 +143,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*: 16th October, 2019
+ *Last Build*: 8th November, 2019
+ *Version*: 2.10.4
+ *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*: **255312**
+ *Field count*: **1353**
+ *File count*: **1620**
+ *Folder count*: **261**
+ *Line count*: **255756**
+ *Field count*: **1350**
+ *File count*: **1614**
+ *Folder count*: **256**
> 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)

View File

@ -1,8 +1,7 @@
# Joomla Component Builder ([JCB](http://joomlacomponentbuilder.com))
[![GitHub release](https://img.shields.io/github/release/vdm-io/Joomla-Component-Builder.svg)](https://github.com/vdm-io/Joomla-Component-Builder/releases)
[![Total Downloads](https://img.shields.io/github/downloads/vdm-io/Joomla-Component-Builder/total.svg)](https://github.com/vdm-io/Joomla-Component-Builder/releases)
[![Backers on Open Collective](https://opencollective.com/Joomla-Component-Builder/backers/badge.svg)](#backers)
[![Sponsors on Open Collective](https://opencollective.com/Joomla-Component-Builder/sponsors/badge.svg)](#sponsors)
[![JCB Pro Members](https://opencollective.com/joomla-component-builder/tiers/jcb-pro/badge.svg?label=JCB Pro&color=brightgreen)](#sponsors)
This is a [Joomla 3.x](https://extensions.joomla.org/extension/component-builder/) component. [__See In Action__](https://www.youtube.com/watch?v=IQfsLYIeblk&list=PLQRGFI8XZ_wtGvPQZWBfDzzlERLQgpMRE&index=45)
@ -110,8 +109,6 @@ Where can you get support and help?
+ [Report a Security Issue](http://joomlacomponentbuilder.com/report-security-issues)
+ [Community Complaint](http://joomlacomponentbuilder.com/community-complaint)
+ [Open Issue On Github](https://github.com/vdm-io/Joomla-Component-Builder/issues) ^^
+ [Telegram Group](https://t.me/jcb_group)
+ [JCB IRC Channel](https://vdm.bz/jcb-irc)
Since [JCB](http://joomlacomponentbuilder.com) has [become a community](https://github.com/vdm-io/Joomla-Component-Builder/blob/staging/.github/SUPPORT.md) project [VDM.io](https://www.vdm.io/) is **no longer solely responsible** for support.
@ -146,14 +143,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*: 16th October, 2019
+ *Last Build*: 8th November, 2019
+ *Version*: 2.10.4
+ *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*: **255312**
+ *Field count*: **1353**
+ *File count*: **1620**
+ *Folder count*: **261**
+ *Line count*: **255756**
+ *Field count*: **1350**
+ *File count*: **1614**
+ *Folder count*: **256**
> 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)

View File

@ -209,7 +209,15 @@ abstract class ###Component###Helper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())

View File

@ -602,7 +602,15 @@ abstract class ###Component###Helper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())

View File

@ -212,6 +212,12 @@
"path": "c0mp0n3nt/site/helpers",
"rename": false,
"type": "file"
},
"import.gif": {
"naam": "import.gif",
"path": "c0mp0n3nt/admin/assets/images",
"rename": false,
"type": "file"
}
},
"dynamic": {
@ -461,11 +467,6 @@
"newName": "default.php",
"type": "import"
},
"import.gif": {
"path": "c0mp0n3nt/admin/assets/images",
"rename": false,
"type": "import"
},
"JControllerLegacy_import_custom.php": {
"path": "c0mp0n3nt/admin/controllers",
"rename": "JControllerLegacy_import_custom",

View File

@ -7001,7 +7001,7 @@ class Get
(trim($lineContent) === $endHTML || strpos($lineContent, $endHTML) !== false)))
{
// trim the placeholder and if there is still data then load it
if ($_line = $this->addLineChecker($endReplace, 2, $lineContent))
if (isset($endReplace) && ($_line = $this->addLineChecker($endReplace, 2, $lineContent)) !== false)
{
$codeBucket[$pointer[$targetKey]][] = $_line;
}
@ -7360,7 +7360,7 @@ class Get
/**
* Check if this line should be added
*
* @param strin $replaceKey The key to remove from line
* @param string $replaceKey The key to remove from line
* @param int $type The line type
* @param string $lineContent The line to check
*

View File

@ -1829,7 +1829,7 @@ class Fields extends Structure
// add to lang array
$this->setLangContent($this->lang, $langValue, $option);
// now add to option set
$grouped_['option'][$option] = array('value' => $valueKeyArray[0], 'text' => $langValue);
$grouped_['option'][$option] = array('value' => $option, 'text' => $langValue);
$optionArray[$option] = $langValue;
// set order
$order_['option' . $option] = $option;
@ -2357,7 +2357,7 @@ class Fields extends Structure
}
else
{
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => array($set), 'type' => $type);
$this->siteFieldData['decode'][$array['site']][$code][$array['as']][$array['key']] = array('decode' => array($set), 'type' => $type, 'admin_view' => $view);
}
}
// set the uikit checker
@ -3052,8 +3052,8 @@ class Fields extends Structure
$this->buildSiteFieldData($view_name_single, $name, 'json', $typeName);
}
// load the json list display fix
if (($listSwitch || $listJoin) && $typeName != 'repeatable' && $typeName != 'subform')
// load the model list display fix
if (($listSwitch || $listJoin) && (($typeName != 'repeatable' && $typeName != 'subform') || $field['settings']->store == 6))
{
if (ComponentbuilderHelper::checkArray($options))
{

View File

@ -1835,11 +1835,11 @@ class Interpretation extends Fields
// base64_decode
$decoder = $string . "->" . $field . " = base64_decode(" . $string . "->" . $field . ");";
}
elseif (strpos($decode, '_encryption') !== false)
elseif (strpos($decode, '_encryption') !== false || 'expert_mode' === $decode)
{
foreach ($this->cryptionTypes as $cryptionType)
{
if ($cryptionType . '_encryption' === $decode)
if ($cryptionType . '_encryption' === $decode || $cryptionType . '_mode' === $decode)
{
if ('expert' !== $cryptionType)
{
@ -1847,10 +1847,10 @@ class Interpretation extends Fields
// set decryption
$decoder = $string . "->" . $field . " = rtrim(\$" . $cryptionType . "->decryptString(" . $string . "->" . $field . "), " . '"\0"' . ");";
}
elseif (isset($this->{$cryptionType . 'FieldModeling'}[$code][$field]))
elseif (isset($this->{$cryptionType . 'FieldModeling'}[$array['admin_view']][$field]))
{
$_placeholder_for_field = array('[[[field]]]' => $string . "->" . $field);
$fieldDecode .= $this->setPlaceholders(PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . implode(PHP_EOL . $this->_t(1) . $tab . $this->_t(1), $this->{$cryptionType . 'FieldModeling'}[$code][$field]['get']), $_placeholder_for_field);
$fieldDecode .= $this->setPlaceholders(PHP_EOL . $this->_t(1) . $tab . $this->_t(1) . implode(PHP_EOL . $this->_t(1) . $tab . $this->_t(1), $this->{$cryptionType . 'FieldModeling'}[$array['admin_view']][$field]['get']), $_placeholder_for_field);
}
// activate site decryption
$this->siteDecrypt[$cryptionType][$code] = true;
@ -12955,9 +12955,7 @@ class Interpretation extends Fields
break;
case 6:
// EXPERT_ENCRYPTION
$decode = '///////////////////////////////////////////';
$expertCrypt = true;
$suffix_decode = '';
break;
default:
// JSON_ARRAY_ENCODE
@ -12968,7 +12966,7 @@ class Interpretation extends Fields
break;
}
if ($item['type'] === 'usergroup' && !$export)
if ($item['type'] === 'usergroup' && !$export && $item['method'] != 6)
{
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " decode " . $item['name'];
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$" . $item['name'] . "Array = " . $decode . "(\$item->" . $item['name'] . $suffix_decode . ");";
@ -12991,7 +12989,7 @@ class Interpretation extends Fields
$fix .= PHP_EOL.$this->_t(1).$tab.$this->_t(4) . "\$item->".$item['name']." = implode('|',\$".$item['name']."Array);";
$fix .= PHP_EOL.$this->_t(1).$tab.$this->_t(3) . "}";
} */
elseif ($item['translation'] && !$export)
elseif ($item['translation'] && !$export && $item['method'] != 6)
{
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "//" . $this->setLine(__LINE__) . " decode " . $item['name'];
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "\$" . $item['name'] . "Array = " . $decode . "(\$item->" . $item['name'] . $suffix_decode . ");";
@ -13007,7 +13005,15 @@ class Interpretation extends Fields
}
else
{
if ($item['method'] == 2 || $item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5)
if ($item['method'] == 2 || $item['method'] == 3 || $item['method'] == 4 || $item['method'] == 5 || $item['method'] == 6)
{
// expert mode (dev must do it all)
if ($item['method'] == 6)
{
$_placeholder_for_field = array('[[[field]]]' => "\$item->" . $item['name']);
$fix .= $this->setPlaceholders(PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . implode(PHP_EOL . $this->_t(1) . $tab . $this->_t(3), $this->expertFieldModeling[$viewName_single][$item['name']]['get']), $_placeholder_for_field);
}
else
{
$taber = '';
if ($item['method'] == 3)
@ -13043,6 +13049,7 @@ class Interpretation extends Fields
$fix .= PHP_EOL . $this->_t(1) . $tab . $this->_t(3) . "}";
}
}
}
else
{
if ($export && $item['type'] === 'repeatable')

View File

@ -834,13 +834,13 @@ abstract class ComponentbuilderHelper
*/
public static function getContributorDetails($filename, $type = 'snippet')
{
// start loading he contributor details
// start loading the contributor details
$contributor = array();
// get the path & content
switch ($type)
{
case 'snippet':
$path = $snippetPath.$filename;
$path = self::$snippetPath.$filename;
// get the file if available
$content = self::getFileContents($path);
if (self::checkJson($content))
@ -4338,6 +4338,8 @@ abstract class ComponentbuilderHelper
require_once JPATH_SITE . '/libraries/phpseclib/vendor/autoload.php';
// do not load again
self::$composer['phpseclib'] = true;
return true;
}
@ -6101,7 +6103,15 @@ abstract class ComponentbuilderHelper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())

View File

@ -4953,14 +4953,14 @@ COM_COMPONENTBUILDER_FIELD_INDEXES_LABEL="Indexes Type"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL="Initiator On Get Model"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_DESCRIPTION="The initiator to on get model this field. If JCB finds that there is more then one field with the same initiator code in one view it will only load it once. You could also leave this blank if you already have the on get model initiator set in another field of the same admin_view."
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_HINT="// Get the medium decryption.
$mediumkey = [[[Component]]]Helper::getCryptKey('medium');
$mediumkey = ComponentbuilderHelper::getCryptKey('medium');
// Get the encryption object.
$medium = new FOFEncryptAes($mediumkey);"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_GET_MODEL_LABEL="Initiator<br /><small>on get model</small>"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL="Initiator On Save Model"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_DESCRIPTION="The initiator to on save model this field. If JCB finds that there is more then one field with the same initiator code in one view it will only load it once. You could also leave this blank if you already have the on save model initiator set in another field of the same admin_view."
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_HINT="// Get the medium encryption.
$mediumkey = &#91;&#91;&#91;Component&#93;&#93;&#93;Helper::getCryptKey('medium');
$mediumkey = ComponentbuilderHelper::getCryptKey('medium');
// Get the encryption object.
$medium = new FOFEncryptAes($mediumkey);"
COM_COMPONENTBUILDER_FIELD_INITIATOR_ON_SAVE_MODEL_LABEL="Initiator<br /><small>on save model</small>"

View File

@ -84,6 +84,11 @@ else
- <?php echo $this->escape($item->component_version); ?>
</div>
<?php
// always make sure the $this->return_here is set
if (!isset($this->return_here))
{
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
}
// setup the buttons
if (!isset($_buttons) || !ComponentbuilderHelper::checkArray($_buttons))
{

View File

@ -69,11 +69,55 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
/**
* Method to get a single record.
*
@ -135,6 +179,13 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -215,14 +215,51 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_view__'.$id);
ComponentbuilderHelper::set('admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -540,6 +577,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
$item->ajax_input = $ajax_input->toArray();
}
if (empty($item->id))
{
$id = 0;
@ -563,8 +601,14 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields
$objectUpdate = new stdClass();
$objectUpdate->id = (int) $item->id;

View File

@ -279,48 +279,6 @@ class ComponentbuilderModelAjax extends JModelList
// Used in admin_view
protected $viewid = array();
protected function getViewID($call = 'table')
{
if (!isset($this->viewid[$call]))
{
// get the vdm key
$jinput = JFactory::getApplication()->input;
$vdm = $jinput->get('vdm', null, 'WORD');
if ($vdm)
{
// set view and id
if ($view = ComponentbuilderHelper::get($vdm))
{
$current = (array) explode('__', $view);
if (ComponentbuilderHelper::checkString($current[0]) && isset($current[1]) && is_numeric($current[1]))
{
// get the view name & id
$this->viewid[$call] = array(
'a_id' => (int) $current[1],
'a_view' => $current[0]
);
}
}
// set return if found
if ($return = ComponentbuilderHelper::get($vdm . '__return'))
{
if (ComponentbuilderHelper::checkString($return))
{
$this->viewid[$call]['a_return'] = $return;
}
}
}
}
if (isset($this->viewid[$call]))
{
return $this->viewid[$call];
}
return false;
}
protected $rowNumbers = array(
'admin_fields_conditions' => 80,
'admin_fields' => 50
@ -347,140 +305,6 @@ class ComponentbuilderModelAjax extends JModelList
'custom_code' => 'custom_codes',
'language' => true);
public function getButton($type, $size)
{
if (isset($this->buttonArray[$type]))
{
$user = JFactory::getUser();
// only add if user allowed to create
if ($user->authorise($type.'.create', 'com_componentbuilder'))
{
// get the view name & id
$values = $this->getViewID();
// check if new item
$ref = '';
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
{
// check if we have a return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// only load referral if not new item.
$ref = '&amp;ref=' . $values['a_view'] . '&amp;refid=' . $values['a_id'] . '&amp;return=' . urlencode(base64_encode($return_url));
}
// build url (A tag)
$startAtag = 'onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&amp;view=' . $type . '&amp;layout=edit' . $ref . '\' })" href="javascript:void(0)" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', ComponentbuilderHelper::safeString($type, 'W')).'">';
// build the smallest button
if (3 == $size)
{
$button = '<a class="btn btn-small btn-success" style="margin: 0 0 5px 0;" ' . $startAtag.'<span class="icon-new icon-white"></span></a>';
}
// build the smaller button
elseif (2 == $size)
{
$button = '<a class="btn btn-success vdm-button-new" ' . $startAtag . '<span class="icon-new icon-white"></span> ' . JText::_('COM_COMPONENTBUILDER_CREATE') . '</a>';
}
else
// build the big button
{
$button = '<div class="control-group">
<div class="control-label">
<label>' . ucwords($type) . '</label>
</div>
<div class="controls"><a class="btn btn-success vdm-button-new" ' . $startAtag . '
<span class="icon-new icon-white"></span>
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
</a>
</div>
</div>';
}
// return the button attached to input field
return $button;
}
return '';
}
return false;
}
public function getButtonID($type, $size)
{
if (isset($this->buttonArray[$type]))
{
$user = JFactory::getUser();
// only add if user allowed to create
if ($user->authorise($type.'.create', 'com_componentbuilder'))
{
// get the view name & id
$values = $this->getViewID();
// set the button ID
$css_class = 'control-group-'.ComponentbuilderHelper::safeString($type. '-' . $size, 'L', '-');
// check if new item
$ref = '';
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
{
// set the return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// only load referral if not new item.
$ref = '&amp;ref=' . $values['a_view'] . '&amp;refid=' . $values['a_id'] . '&amp;return=' . urlencode(base64_encode($return_url));
// get item id
if (($id = ComponentbuilderHelper::getVar($type, $values['a_id'], $values['a_view'], 'id')) !== false && $id > 0)
{
$buttonText = JText::sprintf('COM_COMPONENTBUILDER_EDIT_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w'));
$buttonTextSmall = JText::_('COM_COMPONENTBUILDER_EDIT');
$editThis = 'index.php?option=com_componentbuilder&amp;view='.$this->buttonArray[$type].'&amp;task='.$type.'.edit&amp;id='.$id;
$icon = 'icon-apply';
}
else
{
$buttonText = JText::sprintf('COM_COMPONENTBUILDER_CREATE_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w'));
$buttonTextSmall = JText::_('COM_COMPONENTBUILDER_CREATE');
$editThis = 'index.php?option=com_componentbuilder&amp;view='.$type.'&amp;layout=edit';
$icon = 'icon-new';
}
// build the button
$button = array();
if (1 == $size)
{
$button[] = '<div class="control-group '.$css_class.'">';
$button[] = '<div class="control-label">';
$button[] = '<label>' . ComponentbuilderHelper::safeString($type, 'Ww') . '</label>';
$button[] = '</div>';
$button[] = '<div class="controls">';
}
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" title="'.$buttonText.'">';
if (1 == $size)
{
$button[] = '<span class="'.$icon.' icon-white"></span>';
$button[] = $buttonText;
$button[] = '</a>';
$button[] = '</div>';
$button[] = '</div>';
}
elseif (2 == $size)
{
$button[] = '<span class="'.$icon.' icon-white"></span>';
$button[] = $buttonTextSmall;
$button[] = '</a>';
}
// return the button attached to input field
return implode("\n", $button);
}
// only return notice if big button
if (1 == $size)
{
return '<div class="control-group '.$css_class.'"><div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')) . '</div></div>';
}
}
}
return '';
}
public function checkAliasField($type)
{
// get the view name & id
@ -626,97 +450,19 @@ class ComponentbuilderModelAjax extends JModelList
return $language[$key];
}
// check a shared value is available
if (strpos($key, '|=VDM=|') !== false)
{
$keys = explode('|=VDM=|', $key);
if (isset($language[$keys[1]]))
{
return $language[$keys[1]];
}
}
return ComponentbuilderHelper::safeString($keys[1], 'Ww');
}
protected function getSubformTable($idName, $data)
{
// make sure we convert the json to array
if (ComponentbuilderHelper::checkJson($data))
{
$data = json_decode($data, true);
}
// make sure we have an array
if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkString($idName))
{
// Build heading
$head = array();
foreach ($data as $headers)
{
foreach ($headers as $header => $value)
{
if (!isset($head[$header]))
{
$head[$header] = $this->getLanguage($idName . '|=VDM=|' . $header);
}
}
}
// build the rows
$rows = array();
if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkArray($head))
{
foreach ($data as $nr => $values)
{
foreach ($head as $key => $_header)
{
// set the value for the row
if (isset($values[$key]))
{
$this->setSubformRows($nr, $this->setSubformValue($key, $values[$key]), $rows, $_header);
}
else
{
$this->setSubformRows($nr, $this->setSubformValue($key, ''), $rows, $_header);
}
}
}
}
// build table
if (ComponentbuilderHelper::checkArray($rows) && ComponentbuilderHelper::checkArray($head))
{
// set the number of rows
$this->rowNumber = count($rows);
// return the table
return ComponentbuilderHelper::setSubformTable($head, $rows, $idName);
}
}
return false;
}
protected function setSubformValue($header, $value)
{
if (array_key_exists($header, $this->functionArray) && method_exists($this, $this->functionArray[$header]))
{
$value = $this->{$this->functionArray[$header]}($header, $value);
}
// if no value are set
if (!ComponentbuilderHelper::checkString($value))
{
$value = '-';
}
return $value;
}
protected function setSubformRows($nr, $value, &$rows, $_header)
{
// build rows
if (!isset($rows[$nr]))
{
$rows[$nr] = '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
else
{
$rows[$nr] .= '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
}
protected $ref;
protected $fieldsArray = array(
'library_config' => 'addconfig',
'library_files_folders_urls' => array('addurls', 'addfiles', 'addfolders', 'addfoldersfullpath', 'addfilesfullpath'),
@ -726,94 +472,12 @@ class ComponentbuilderModelAjax extends JModelList
'component_admin_views' => 'addadmin_views',
'component_site_views' => 'addsite_views',
'component_custom_admin_views' => 'addcustom_admin_views');
protected $allowedViewsArray = array(
'admin_view',
'joomla_component',
'library');
public function getAjaxDisplay($type)
{
if (isset($this->fieldsArray[$type]))
{
// set type name
$typeName = ComponentbuilderHelper::safeString($type, 'w');
// get the view name & id
$values = $this->getViewID();
// check if we are in the correct view.
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray))
{
// set a return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// set the ref
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url));
// load the results
$result = array();
// return field table
if (ComponentbuilderHelper::checkArray($this->fieldsArray[$type]))
{
foreach ($this->fieldsArray[$type] as $fieldName)
{
if ($table = $this->getFieldTable($type, $values['a_id'], $values['a_view'], $fieldName, $typeName))
{
$result[] = $table;
}
}
}
elseif (ComponentbuilderHelper::checkString($this->fieldsArray[$type]))
{
if ($table = $this->getFieldTable($type, $values['a_id'], $values['a_view'], $this->fieldsArray[$type], $typeName))
{
$result[] = $table;
}
}
// check if we have results
if (ComponentbuilderHelper::checkArray($result) && count($result) == 1)
{
// return the display
return implode('', $result);
}
elseif (ComponentbuilderHelper::checkArray($result))
{
// return the display
return '<div>' . implode('</div><div>', $result) . '</div>';
}
}
return '<div class="control-group"><div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE', $typeName) . '</div></div>';
}
return '<div class="control-group"><div class="alert alert-error"><h4>' . JText::_('COM_COMPONENTBUILDER_TYPE_ERROR') . '</h4><p>' . JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST') . '</p></div></div>';
}
protected function getFieldTable($type, $id, $idName, $fieldName, $typeName)
{
// get the field data
if ($fieldsData = ComponentbuilderHelper::getVar($type, (int) $id, $idName, $fieldName))
{
// check repeatable conversion
$this->checkRepeatableConversion($fieldsData, $fieldName, $id, $idName);
// get the table
$table = $this->getSubformTable($type, $fieldsData);
// get row number
$number = (isset($this->rowNumbers[$type]) && $this->rowNumbers[$type]) ? $this->rowNumbers[$type] : false;
// set notice of bad practice
$notice = '';
if ($number && isset($this->rowNumber) && $this->rowNumber > $number)
{
$notice = '<div class="alert alert-warning">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $number, $typeName, $typeName, $typeName) . '</div>';
}
elseif ($number && isset($this->rowNumber))
{
$notice = '<div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $number, $typeName) . '</div>';
}
// return table
return $notice.$table;
}
return false;
}
protected $conversionCheck = array(
'addfields' => 'field',
'addconditions' => 'target_field',
@ -825,6 +489,28 @@ class ComponentbuilderModelAjax extends JModelList
'sql_tweak' => 'adminview',
'version_update' => 'version');
protected $itemNames = array(
'field' => array(),
'admin_view' => array(),
'site_view' => array(),
'custom_admin_view' => array()
);
protected $itemKeys = array(
// admin view
'field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'target_field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'match_field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'listfield' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'joinfields' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
// joomla component view
'siteview' => array('table' => 'site_view', 'tables' => 'site_views', 'id' => 'id', 'name' => 'name', 'text' => 'Site View'),
'customadminview' => array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Custom Admin View'),
'adminviews' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View'),
'adminview' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View'),
'before' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View')
);
protected function checkRepeatableConversion(&$fieldsData, $fieldsArrayType, $id, $linked_id_name)
{
if (ComponentbuilderHelper::checkJson($fieldsData) && isset($this->conversionCheck[$fieldsArrayType]))
@ -850,97 +536,6 @@ class ComponentbuilderModelAjax extends JModelList
}
}
protected $itemNames = array(
'field' => array(),
'admin_view' => array(),
'site_view' => array(),
'custom_admin_view' => array()
);
protected $itemKeys = array(
// admin view
'field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'target_field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'match_field' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'listfield' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
'joinfields' => array('table' => 'field', 'tables' => 'fields', 'id' => 'id', 'name' => 'name', 'text' => 'Field', 'type' => array('table' => 'fieldtype', 'field' => 'id', 'key' => 'fieldtype', 'get' => 'name')),
// joomla component view
'siteview' => array('table' => 'site_view', 'tables' => 'site_views', 'id' => 'id', 'name' => 'name', 'text' => 'Site View'),
'customadminview' => array('table' => 'custom_admin_view', 'tables' => 'custom_admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Custom Admin View'),
'adminviews' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View'),
'adminview' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View'),
'before' => array('table' => 'admin_view', 'tables' => 'admin_views', 'id' => 'id', 'name' => 'system_name', 'text' => 'Admin View')
);
protected function setItemNames($header, $value)
{
if (isset($this->itemKeys[$header]) && isset($this->itemKeys[$header]['table']) && isset($this->itemNames[$this->itemKeys[$header]['table']]))
{
// reset bucket
$bucket = array();
if (ComponentbuilderHelper::checkArray($value))
{
foreach ($value as $item)
{
$edit = true;
if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$item]))
{
if (!$this->itemNames[$this->itemKeys[$header]['table']][$item] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], (int) $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name']))
{
$this->itemNames[$this->itemKeys[$header]['table']][$item] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
$edit = false;
}
// check if we should load a type
if ($edit && isset($this->itemKeys[$header]['type']) && ComponentbuilderHelper::checkArray($this->itemKeys[$header]['type']) && isset($this->itemKeys[$header]['type']['table']))
{
// get the linked value
if ($_key = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], (int) $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['type']['key']))
{
$this->itemNames[$this->itemKeys[$header]['table']][$item] .= ' [' . ComponentbuilderHelper::getVar($this->itemKeys[$header]['type']['table'], (int) $_key, $this->itemKeys[$header]['type']['field'], $this->itemKeys[$header]['type']['get']) .']';
}
}
}
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButton($item, $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
// load item
$bucket[] = $this->itemNames[$this->itemKeys[$header]['table']][$item] . $link;
}
}
elseif (is_numeric($value))
{
$edit = true;
if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$value]))
{
if (!$this->itemNames[$this->itemKeys[$header]['table']][$value] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], (int) $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name']))
{
$this->itemNames[$this->itemKeys[$header]['table']][$value] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
$edit = false;
}
// check if we should load a type
if ($edit && isset($this->itemKeys[$header]['type']) && ComponentbuilderHelper::checkArray($this->itemKeys[$header]['type']) && isset($this->itemKeys[$header]['type']['table']))
{
// get the linked value
if ($_key = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], (int) $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['type']['key']))
{
$this->itemNames[$this->itemKeys[$header]['table']][$value] .= ' [' . ComponentbuilderHelper::getVar($this->itemKeys[$header]['type']['table'], (int) $_key, $this->itemKeys[$header]['type']['field'], $this->itemKeys[$header]['type']['get']) .']';
}
}
}
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButton($value, $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
// load item
$bucket[] = $this->itemNames[$this->itemKeys[$header]['table']][$value] . $link;
}
// return found items
if (ComponentbuilderHelper::checkArray($bucket))
{
return implode('<br />', $bucket);
}
return JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
}
return JText::_('COM_COMPONENTBUILDER_NO_ITEM_FOUND');
}
protected function setPermissions($header, $values)
{
// check if value is array
@ -1297,7 +892,6 @@ class ComponentbuilderModelAjax extends JModelList
{
return 'dynamic_list';
}
}
return false;
}
@ -1559,6 +1153,472 @@ class ComponentbuilderModelAjax extends JModelList
return false;
}
protected $viewid = array();
protected function getViewID($call = 'table')
{
if (!isset($this->viewid[$call]))
{
// get the vdm key
$jinput = JFactory::getApplication()->input;
$vdm = $jinput->get('vdm', null, 'WORD');
if ($vdm)
{
// set view and id
if ($view = ComponentbuilderHelper::get($vdm))
{
$current = (array) explode('__', $view);
if (ComponentbuilderHelper::checkString($current[0]) && isset($current[1]) && is_numeric($current[1]))
{
// get the view name & id
$this->viewid[$call] = array(
'a_id' => (int) $current[1],
'a_view' => $current[0]
);
}
}
// set GUID if found
if (($guid = ComponentbuilderHelper::get($vdm . '__guid')) !== false && method_exists('ComponentbuilderHelper', 'validGUID'))
{
if (ComponentbuilderHelper::validGUID($guid))
{
$this->viewid[$call]['a_guid'] = $guid;
}
}
// set return if found
if (($return = ComponentbuilderHelper::get($vdm . '__return')) !== false)
{
if (ComponentbuilderHelper::checkString($return))
{
$this->viewid[$call]['a_return'] = $return;
}
}
}
}
if (isset($this->viewid[$call]))
{
return $this->viewid[$call];
}
return false;
}
public function getButton($type, $size)
{
if (isset($this->buttonArray[$type]))
{
$user = JFactory::getUser();
// only add if user allowed to create
if ($user->authorise($type.'.create', 'com_componentbuilder'))
{
// get the view name & id
$values = $this->getViewID();
// check if new item
$ref = '';
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
{
// check if we have a return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// only load referral if not new item.
$ref = '&amp;ref=' . $values['a_view'] . '&amp;refid=' . $values['a_id'] . '&amp;return=' . urlencode(base64_encode($return_url));
}
// build url (A tag)
$startAtag = 'onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \'index.php?option=com_componentbuilder&amp;view=' . $type . '&amp;layout=edit' . $ref . '\' })" href="javascript:void(0)" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', ComponentbuilderHelper::safeString($type, 'W')).'">';
// build the smallest button
if (3 == $size)
{
$button = '<a class="btn btn-small btn-success" style="margin: 0 0 5px 0;" ' . $startAtag.'<span class="icon-new icon-white"></span></a>';
}
// build the smaller button
elseif (2 == $size)
{
$button = '<a class="btn btn-success vdm-button-new" ' . $startAtag . '<span class="icon-new icon-white"></span> ' . JText::_('COM_COMPONENTBUILDER_CREATE') . '</a>';
}
else
// build the big button
{
$button = '<div class="control-group">
<div class="control-label">
<label>' . ucwords($type) . '</label>
</div>
<div class="controls"><a class="btn btn-success vdm-button-new" ' . $startAtag . '
<span class="icon-new icon-white"></span>
' . JText::_('COM_COMPONENTBUILDER_NEW') . '
</a>
</div>
</div>';
}
// return the button attached to input field
return $button;
}
return '';
}
return false;
}
public function getButtonID($type, $size)
{
if (isset($this->buttonArray[$type]))
{
$user = JFactory::getUser();
// only add if user allowed to create
if ($user->authorise($type.'.create', 'com_componentbuilder'))
{
// get the view name & id
$values = $this->getViewID();
// set the button ID
$css_class = 'control-group-'.ComponentbuilderHelper::safeString($type. '-' . $size, 'L', '-');
// check if new item
$ref = '';
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']))
{
// set the return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// only load referral if not new item.
$ref = '&amp;ref=' . $values['a_view'] . '&amp;refid=' . $values['a_id'] . '&amp;return=' . urlencode(base64_encode($return_url));
// set the key get value
$key_get_value = $values['a_id'];
// check if we have a GUID
if (isset($values['a_guid']))
{
$ref .= '&guid=' . (string) $values['a_guid'];
$key_get_value = $values['a_guid'];
}
// get item id
if (($id = ComponentbuilderHelper::getVar($type, $key_get_value, $values['a_view'], 'id')) !== false && $id > 0)
{
$buttonText = JText::sprintf('COM_COMPONENTBUILDER_EDIT_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w'));
$buttonTextSmall = JText::_('COM_COMPONENTBUILDER_EDIT');
$editThis = 'index.php?option=com_componentbuilder&amp;view='.$this->buttonArray[$type].'&amp;task='.$type.'.edit&amp;id='.$id;
$icon = 'icon-apply';
}
else
{
$buttonText = JText::sprintf('COM_COMPONENTBUILDER_CREATE_S_FOR_THIS_S', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w'));
$buttonTextSmall = JText::_('COM_COMPONENTBUILDER_CREATE');
$editThis = 'index.php?option=com_componentbuilder&amp;view='.$type.'&amp;layout=edit';
$icon = 'icon-new';
}
// build the button
$button = array();
if (1 == $size)
{
$button[] = '<div class="control-group '.$css_class.'">';
$button[] = '<div class="control-label">';
$button[] = '<label>' . ComponentbuilderHelper::safeString($type, 'Ww') . '</label>';
$button[] = '</div>';
$button[] = '<div class="controls">';
}
$button[] = '<a class="btn btn-success vdm-button-new" onclick="UIkit2.modal.confirm(\''.JText::_('COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE').'\', function(){ window.location.href = \''.$editThis.$ref.'\' })" href="javascript:void(0)" title="'.$buttonText.'">';
if (1 == $size)
{
$button[] = '<span class="'.$icon.' icon-white"></span>';
$button[] = $buttonText;
$button[] = '</a>';
$button[] = '</div>';
$button[] = '</div>';
}
elseif (2 == $size)
{
$button[] = '<span class="'.$icon.' icon-white"></span>';
$button[] = $buttonTextSmall;
$button[] = '</a>';
}
// return the button attached to input field
return implode("\n", $button);
}
// only return notice if big button
if (1 == $size)
{
return '<div class="control-group '.$css_class.'"><div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_BUTTON_TO_CREATE_S_WILL_SHOW_ONCE_S_IS_SAVED_FOR_THE_FIRST_TIME', ComponentbuilderHelper::safeString($type, 'w'), ComponentbuilderHelper::safeString($values['a_view'], 'w')) . '</div></div>';
}
}
}
return '';
}
protected function getSubformTable($idName, $data)
{
// make sure we convert the json to array
if (ComponentbuilderHelper::checkJson($data))
{
$data = json_decode($data, true);
}
// make sure we have an array
if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkString($idName))
{
// Build heading
$head = array();
foreach ($data as $headers)
{
foreach ($headers as $header => $value)
{
if (!isset($head[$header]))
{
$head[$header] = $this->getLanguage($idName . '|=VDM=|' . $header);
}
}
}
// build the rows
$rows = array();
if (ComponentbuilderHelper::checkArray($data) && ComponentbuilderHelper::checkArray($head))
{
foreach ($data as $nr => $values)
{
foreach ($head as $key => $_header)
{
// set the value for the row
if (isset($values[$key]))
{
$this->setSubformRows($nr, $this->setSubformValue($key, $values[$key]), $rows, $_header);
}
else
{
$this->setSubformRows($nr, $this->setSubformValue($key, ''), $rows, $_header);
}
}
}
}
// build table
if (ComponentbuilderHelper::checkArray($rows) && ComponentbuilderHelper::checkArray($head))
{
// set the number of rows
$this->rowNumber = count($rows);
// return the table
return ComponentbuilderHelper::setSubformTable($head, $rows, $idName);
}
}
return false;
}
protected function setSubformValue($header, $value)
{
if (array_key_exists($header, $this->functionArray) && method_exists($this, $this->functionArray[$header]))
{
$value = $this->{$this->functionArray[$header]}($header, $value);
}
// if no value are set
if (!ComponentbuilderHelper::checkString($value))
{
$value = '-';
}
return $value;
}
protected function setSubformRows($nr, $value, &$rows, $_header)
{
// build rows
if (!isset($rows[$nr]))
{
$rows[$nr] = '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
else
{
$rows[$nr] .= '<td data-column=" '.$_header.' ">'.$value.'</td>';
}
}
public function getAjaxDisplay($type)
{
if (isset($this->fieldsArray[$type]))
{
// set type name
$typeName = ComponentbuilderHelper::safeString($type, 'w');
// get the view name & id
$values = $this->getViewID();
// check if we are in the correct view.
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray))
{
// set a return value
$return_url = 'index.php?option=com_componentbuilder&view=' . (string) $values['a_view'] . '&layout=edit&id=' . (int) $values['a_id'];
// set a global return value
if (isset($values['a_return']))
{
$return_url .= '&return=' . (string) $values['a_return'];
}
// set the ref
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'] . '&return=' . urlencode(base64_encode($return_url));
// set the key get value
$key_get_value = $values['a_id'];
// check if we have a GUID
if (isset($values['a_guid']))
{
$this->ref .= '&guid=' . (string) $values['a_guid'];
$key_get_value = $values['a_guid'];
}
// load the results
$result = array();
// return field table
if (ComponentbuilderHelper::checkArray($this->fieldsArray[$type]))
{
foreach ($this->fieldsArray[$type] as $fieldName)
{
if ($table = $this->getFieldTable($type, $key_get_value, $values['a_view'], $fieldName, $typeName))
{
$result[] = $table;
}
}
}
elseif (ComponentbuilderHelper::checkString($this->fieldsArray[$type]))
{
if ($table = $this->getFieldTable($type, $key_get_value, $values['a_view'], $this->fieldsArray[$type], $typeName))
{
$result[] = $table;
}
}
// check if we have results
if (ComponentbuilderHelper::checkArray($result) && count($result) == 1)
{
// return the display
return implode('', $result);
}
elseif (ComponentbuilderHelper::checkArray($result))
{
// return the display
return '<div>' . implode('</div><div>', $result) . '</div>';
}
}
return '<div class="control-group"><div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE', $typeName) . '</div></div>';
}
return '<div class="control-group"><div class="alert alert-error"><h4>' . JText::_('COM_COMPONENTBUILDER_TYPE_ERROR') . '</h4><p>' . JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST') . '</p></div></div>';
}
protected function setItemNames($header, $value)
{
if (isset($this->itemKeys[$header]) && isset($this->itemKeys[$header]['table']) && isset($this->itemNames[$this->itemKeys[$header]['table']]))
{
// check if we have GUID setup
$validGUID = function ($guid) {
if (method_exists('ComponentbuilderHelper', 'validGUID') && ComponentbuilderHelper::validGUID($guid))
{
return true;
}
return false;
};
// reset bucket
$bucket = array();
if (ComponentbuilderHelper::checkArray($value))
{
foreach ($value as $item)
{
$edit = true;
if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$item]))
{
if (($this->itemNames[$this->itemKeys[$header]['table']][$item] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false)
{
$this->itemNames[$this->itemKeys[$header]['table']][$item] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
$edit = false;
}
// check if we should load a type
if ($edit && isset($this->itemKeys[$header]['type']) && ComponentbuilderHelper::checkArray($this->itemKeys[$header]['type']) && isset($this->itemKeys[$header]['type']['table']))
{
// get the linked value
if (($_key = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['type']['key'])) !== false)
{
$this->itemNames[$this->itemKeys[$header]['table']][$item] .= ' [' . ComponentbuilderHelper::getVar($this->itemKeys[$header]['type']['table'], $_key, $this->itemKeys[$header]['type']['field'], $this->itemKeys[$header]['type']['get']) .']';
}
}
}
// check if we are working with GUID
if ($validGUID($item) && method_exists('ComponentbuilderHelper', 'getEditButtonGUID'))
{
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButtonGUID($item, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
}
else
{
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButton($item, $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
}
// load item
$bucket[] = $this->itemNames[$this->itemKeys[$header]['table']][$item] . $link;
}
}
elseif (is_numeric($value) || $validGUID($value))
{
$edit = true;
if (!isset($this->itemNames[$this->itemKeys[$header]['table']][$value]))
{
if (($this->itemNames[$this->itemKeys[$header]['table']][$value] = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['name'])) === false)
{
$this->itemNames[$this->itemKeys[$header]['table']][$value] = JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
$edit = false;
}
// check if we should load a type
if ($edit && isset($this->itemKeys[$header]['type']) && ComponentbuilderHelper::checkArray($this->itemKeys[$header]['type']) && isset($this->itemKeys[$header]['type']['table']))
{
// get the linked value
if (($_key = ComponentbuilderHelper::getVar($this->itemKeys[$header]['table'], $value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['type']['key'])) !== false)
{
$this->itemNames[$this->itemKeys[$header]['table']][$value] .= ' [' . ComponentbuilderHelper::getVar($this->itemKeys[$header]['type']['table'], $_key, $this->itemKeys[$header]['type']['field'], $this->itemKeys[$header]['type']['get']) .']';
}
}
}
// check if we are working with GUID
if ($validGUID($value) && method_exists('ComponentbuilderHelper', 'getEditButtonGUID'))
{
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButtonGUID($value, $this->itemKeys[$header]['id'], $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
}
else
{
// set edit link
$link = ($edit) ? ComponentbuilderHelper::getEditButton($value, $this->itemKeys[$header]['table'], $this->itemKeys[$header]['tables'], $this->ref) : '';
}
// load item
$bucket[] = $this->itemNames[$this->itemKeys[$header]['table']][$value] . $link;
}
// return found items
if (ComponentbuilderHelper::checkArray($bucket))
{
return implode('<br />', $bucket);
}
return JText::sprintf('COM_COMPONENTBUILDER_NO_S_FOUND', $this->itemKeys[$header]['text']);
}
return JText::_('COM_COMPONENTBUILDER_NO_ITEM_FOUND');
}
protected function getFieldTable($type, $id, $idName, $fieldName, $typeName)
{
// get the field data
if (($fieldsData = ComponentbuilderHelper::getVar($type, $id, $idName, $fieldName)) !== false)
{
// check repeatable conversion
if (method_exists(__CLASS__, 'checkRepeatableConversion'))
{
$this->checkRepeatableConversion($fieldsData, $fieldName, $id, $idName);
}
// get the table
$table = $this->getSubformTable($type, $fieldsData);
// get row number
$number = (isset($this->rowNumbers) && isset($this->rowNumbers[$type]) && $this->rowNumbers[$type]) ? $this->rowNumbers[$type] : false;
// set notice of bad practice
$notice = '';
if ($number && isset($this->rowNumber) && $this->rowNumber > $number)
{
$notice = '<div class="alert alert-warning">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $number, $typeName, $typeName, $typeName) . '</div>';
}
elseif ($number && isset($this->rowNumber))
{
$notice = '<div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_S_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $number, $typeName) . '</div>';
}
// return table
return $notice . $table;
}
return false;
}
// Used in template
public function getTemplateDetails($id)
{

View File

@ -72,14 +72,51 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_extends__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_extends__'.$id);
ComponentbuilderHelper::set('class_extends__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -149,6 +186,13 @@ class ComponentbuilderModelClass_extends extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -75,14 +75,51 @@ class ComponentbuilderModelClass_method extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_method__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_method__'.$id);
ComponentbuilderHelper::set('class_method__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -158,6 +195,13 @@ class ComponentbuilderModelClass_method extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -72,14 +72,51 @@ class ComponentbuilderModelClass_property extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('class_property__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'class_property__'.$id);
ComponentbuilderHelper::set('class_property__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -149,6 +186,13 @@ class ComponentbuilderModelClass_property extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -70,11 +70,55 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('component_dashboard__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'component_dashboard__'.$id);
ComponentbuilderHelper::set('component_dashboard__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
/**
* Method to get a single record.
*
@ -142,6 +186,13 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields
$objectUpdate = new stdClass();

View File

@ -134,14 +134,51 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_admin_view__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_admin_view__'.$id);
ComponentbuilderHelper::set('custom_admin_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -303,6 +340,13 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// check what type of custom_button array we have here (should be subform... but just incase)

View File

@ -87,14 +87,51 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_code__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id);
ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -158,6 +195,13 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -127,14 +127,51 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('dynamic_get__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'dynamic_get__'.$id);
ComponentbuilderHelper::set('dynamic_get__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -302,6 +339,13 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields

View File

@ -118,14 +118,51 @@ class ComponentbuilderModelField extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('field__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'field__'.$id);
ComponentbuilderHelper::set('field__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -237,6 +274,13 @@ class ComponentbuilderModelField extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -93,14 +93,51 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('fieldtype__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id);
ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -166,6 +203,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// check what type of properties array we have here (should be subform... but just incase)
// This could happen due to huge data sets

View File

@ -345,7 +345,7 @@ function usedin(functioName, ide) {
function usedin_server(functioName, ide, target){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.usedin&format=json";
if(token.length > 0){
var request = 'token='+token+'&functioName='+functioName+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
var request = token+'=1&functioName='+functioName+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',

View File

@ -855,33 +855,42 @@ function getFieldOptions(fieldtype, db){
jQuery('#jform_datatype').val(result.database.datatype);
jQuery('#jform_datatype').trigger("liszt:updated");
jQuery('#jform_datatype').trigger("change");
// be sure to remove from no required
updateFieldRequired('datatype', 0);
// update datalenght
jQuery('#jform_datalenght').val(result.database.datalenght);
jQuery('#jform_datalenght').trigger("liszt:updated");
jQuery('#jform_datalenght').trigger("change");
// be sure to remove from no required
updateFieldRequired('datalenght', 0);
// load the datalenght_other if needed
if ('Other' == result.database.datalenght){
if ('Other' === result.database.datalenght){
jQuery('#jform_datalenght_other').val(result.database.datalenght_other);
// be sure to remove from no required
updateFieldRequired('datalenght_other', 0);
}
// update datadefault
jQuery('#jform_datadefault').val(result.database.datadefault);
jQuery('#jform_datadefault').trigger("liszt:updated");
jQuery('#jform_datadefault').trigger("change");
// load the datadefault_other if needed
if ('Other' == result.database.datadefault){
if ('Other' === result.database.datadefault){
jQuery('#jform_datadefault_other').val(result.database.datadefault_other);
// be sure to remove from no required
updateFieldRequired('datadefault_other', 0);
}
// update indexes
jQuery('#jform_indexes').val(result.database.indexes);
jQuery('#jform_indexes').trigger("liszt:updated");
jQuery('#jform_indexes').trigger("change");
// be sure to remove from no required
updateFieldRequired('indexes', 0);
// update store
jQuery('#jform_store').val(result.database.store);
jQuery('#jform_store').trigger("liszt:updated");
jQuery('#jform_store').trigger("change");
// update null_switch (hmmm)
// jQuery('#jform_null_switch').val(result.database.null_switch);
// jQuery('#jform_null_switch').trigger("change");
// be sure to remove from no required
updateFieldRequired('store', 0);
}
}
})

View File

@ -110,7 +110,7 @@ function placedin(placeholder, ide) {
function placedin_server(placeholder, ide, target){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.placedin&format=json";
if(token.length > 0){
var request = 'token='+token+'&placeholder='+placeholder+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
var request = token+'=1&placeholder='+placeholder+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',

View File

@ -238,14 +238,51 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_component__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_component__'.$id);
ComponentbuilderHelper::set('joomla_component__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -448,6 +485,13 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields

View File

@ -134,14 +134,51 @@ class ComponentbuilderModelJoomla_plugin extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('joomla_plugin__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'joomla_plugin__'.$id);
ComponentbuilderHelper::set('joomla_plugin__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -295,6 +332,13 @@ class ComponentbuilderModelJoomla_plugin extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -67,11 +67,55 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('language_translation__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'language_translation__'.$id);
ComponentbuilderHelper::set('language_translation__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
/**
* Method to get a single record.
*
@ -139,6 +183,13 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -91,14 +91,51 @@ class ComponentbuilderModelLayout extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('layout__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'layout__'.$id);
ComponentbuilderHelper::set('layout__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -176,6 +213,13 @@ class ComponentbuilderModelLayout extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -105,14 +105,51 @@ class ComponentbuilderModelLibrary extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('library__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id);
ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -192,6 +229,13 @@ class ComponentbuilderModelLibrary extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -71,14 +71,51 @@ class ComponentbuilderModelPlaceholder extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('placeholder__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'placeholder__'.$id);
ComponentbuilderHelper::set('placeholder__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -142,6 +179,13 @@ class ComponentbuilderModelPlaceholder extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -137,14 +137,51 @@ class ComponentbuilderModelSite_view extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('site_view__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'site_view__'.$id);
ComponentbuilderHelper::set('site_view__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -306,6 +343,13 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
// update the fields

View File

@ -91,14 +91,51 @@ class ComponentbuilderModelTemplate extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('template__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'template__'.$id);
ComponentbuilderHelper::set('template__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -176,6 +213,13 @@ class ComponentbuilderModelTemplate extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -74,14 +74,51 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin
return JTable::getInstance($type, $prefix, $config);
}
/**
* get VDM session key
* get VDM internal session key
*
* @return string the session key
*
*/
public function getVDM()
{
if (!isset($this->vastDevMod))
{
$_id = 0; // new item probably (since it was not set in the getItem method)
if (empty($_id))
{
$id = 0;
}
else
{
$id = $_id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('validation_rule__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'validation_rule__'.$id);
ComponentbuilderHelper::set('validation_rule__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
}
return $this->vastDevMod;
}
@ -145,6 +182,13 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
// set a GUID value if found
if (isset($item) && ComponentbuilderHelper::checkObject($item) && isset($item->guid)
&& method_exists('ComponentbuilderHelper', 'validGUID')
&& ComponentbuilderHelper::validGUID($item->guid))
{
ComponentbuilderHelper::set($this->vastDevMod . '__guid', $item->guid);
}
}
if (!empty($item->id))

View File

@ -73,6 +73,11 @@ $edit = "index.php?option=com_componentbuilder&view=joomla_components&task=jooml
- <?php echo $this->escape($item->component_version); ?>
</div>
<?php
// always make sure the $this->return_here is set
if (!isset($this->return_here))
{
$this->return_here = urlencode(base64_encode((string) JUri::getInstance()));
}
// setup the buttons
if (!isset($_buttons) || !ComponentbuilderHelper::checkArray($_buttons))
{

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<extension type="component" version="3.2" method="upgrade">
<name>COM_COMPONENTBUILDER</name>
<creationDate>16th October, 2019</creationDate>
<creationDate>8th November, 2019</creationDate>
<author>Llewellyn van der Merwe</author>
<authorEmail>llewellyn@joomlacomponentbuilder.com</authorEmail>
<authorUrl>http://www.joomlacomponentbuilder.com</authorUrl>

View File

@ -834,13 +834,13 @@ abstract class ComponentbuilderHelper
*/
public static function getContributorDetails($filename, $type = 'snippet')
{
// start loading he contributor details
// start loading the contributor details
$contributor = array();
// get the path & content
switch ($type)
{
case 'snippet':
$path = $snippetPath.$filename;
$path = self::$snippetPath.$filename;
// get the file if available
$content = self::getFileContents($path);
if (self::checkJson($content))
@ -4338,6 +4338,8 @@ abstract class ComponentbuilderHelper
require_once JPATH_SITE . '/libraries/phpseclib/vendor/autoload.php';
// do not load again
self::$composer['phpseclib'] = true;
return true;
}
@ -6228,7 +6230,15 @@ abstract class ComponentbuilderHelper
{
$query->from($db->quoteName('#_'.$main.'_'.$table));
}
// add strings to array search
if ('IN_STRINGS' === $operator || 'NOT IN_STRINGS' === $operator)
{
$query->where($db->quoteName($whereString) . ' ' . str_replace('_STRINGS', '', $operator) . ' ("' . implode('","',$where) . '")');
}
else
{
$query->where($db->quoteName($whereString) . ' ' . $operator . ' (' . implode(',',$where) . ')');
}
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())