diff --git a/README.md b/README.md
index 3b660f628..ab4431ce6 100644
--- a/README.md
+++ b/README.md
@@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.7.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
-+ *Line count*: **191473**
++ *Line count*: **188511**
+ *Field count*: **1011**
+ *File count*: **1197**
+ *Folder count*: **193**
diff --git a/admin/README.txt b/admin/README.txt
index 3b660f628..ab4431ce6 100644
--- a/admin/README.txt
+++ b/admin/README.txt
@@ -130,7 +130,7 @@ Component Builder is mapped as a component in itself on my local development env
+ *Version*: 2.7.1
+ *Copyright*: Copyright (C) 2015. All Rights Reserved
+ *License*: GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
-+ *Line count*: **191473**
++ *Line count*: **188511**
+ *Field count*: **1011**
+ *File count*: **1197**
+ *Folder count*: **193**
diff --git a/admin/helpers/compiler/c_Fields.php b/admin/helpers/compiler/c_Fields.php
index 6bf4ca040..afcf89141 100644
--- a/admin/helpers/compiler/c_Fields.php
+++ b/admin/helpers/compiler/c_Fields.php
@@ -2160,6 +2160,15 @@ class Fields extends Structure
{
// dont load the button to repeatable
$xmlValue = 'false';
+ // do not add button
+ $fieldAttributes['custom']['add_button'] = 'false';
+ }
+ elseif ($property['name'] === 'button' && $setCustom)
+ {
+ // dont load the button to repeatable
+ $xmlValue = (string) ComponentbuilderHelper::safeString(ComponentbuilderHelper::getBetween($field['settings']->xml, 'button="', '"'));
+ // add to custom values
+ $fieldAttributes['custom']['add_button'] = (ComponentbuilderHelper::checkString($xmlValue) || 1 == $xmlValue) ? $xmlValue: 'false';
}
elseif ($property['name'] === 'required' && $repeatable)
{
@@ -2787,7 +2796,9 @@ class Fields extends Structure
protected function setAddButtonToListField($fieldData)
{
// make sure hte view values are set
- if (isset($fieldData['view']) && isset($fieldData['views']))
+ if (isset($fieldData['add_button']) && ($fieldData['add_button'] === 'true' || 1 == $fieldData['add_button']) &&
+ isset($fieldData['view']) && isset($fieldData['views']) &&
+ ComponentbuilderHelper::checkString($fieldData['view']) && ComponentbuilderHelper::checkString($fieldData['views']))
{
$addButton = array();
$addButton[] = PHP_EOL . PHP_EOL . "\t/**";
@@ -2834,7 +2845,7 @@ class Fields extends Structure
$fieldData['component'] = "com_" . $this->fileContentStatic['###component###'];
}
// check that the componet has the com_ value in it
- if (strpos($fieldData['component'], 'com_') === false)
+ if (strpos($fieldData['component'], 'com_') === false || strpos($fieldData['component'], '=') !== false)
{
$fieldData['component'] = "com_" . $fieldData['component'];
}
diff --git a/admin/models/fields/adminsviews.php b/admin/models/fields/adminsviews.php
index daa214f98..70d69593b 100644
--- a/admin/models/fields/adminsviews.php
+++ b/admin/models/fields/adminsviews.php
@@ -40,108 +40,7 @@ class JFormFieldAdminsviews extends JFormFieldList
*
* @var string
*/
- public $type = 'adminsviews';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '
' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'adminsviews';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/adminviewfolderlist.php b/admin/models/fields/adminviewfolderlist.php
index 875b592ee..2bf772574 100644
--- a/admin/models/fields/adminviewfolderlist.php
+++ b/admin/models/fields/adminviewfolderlist.php
@@ -40,108 +40,7 @@ class JFormFieldAdminviewfolderlist extends JFormFieldList
*
* @var string
*/
- public $type = 'adminviewfolderlist';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'adminviewfolderlist';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/adminviews.php b/admin/models/fields/adminviews.php
index 9063e5992..92549aadc 100644
--- a/admin/models/fields/adminviews.php
+++ b/admin/models/fields/adminviews.php
@@ -40,108 +40,7 @@ class JFormFieldAdminviews extends JFormFieldList
*
* @var string
*/
- public $type = 'adminviews';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'adminviews';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/adminviewsreadonly.php b/admin/models/fields/adminviewsreadonly.php
index d9728690d..e76c84fa1 100644
--- a/admin/models/fields/adminviewsreadonly.php
+++ b/admin/models/fields/adminviewsreadonly.php
@@ -40,108 +40,7 @@ class JFormFieldAdminviewsreadonly extends JFormFieldList
*
* @var string
*/
- public $type = 'adminviewsreadonly';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'adminviewsreadonly';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/aliasbuilder.php b/admin/models/fields/aliasbuilder.php
index 8041c9b71..64b2d5428 100644
--- a/admin/models/fields/aliasbuilder.php
+++ b/admin/models/fields/aliasbuilder.php
@@ -40,108 +40,7 @@ class JFormFieldAliasbuilder extends JFormFieldList
*
* @var string
*/
- public $type = 'aliasbuilder';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create field
- if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit field
- if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'aliasbuilder';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/articles.php b/admin/models/fields/articles.php
index b28093840..b94150bfc 100644
--- a/admin/models/fields/articles.php
+++ b/admin/models/fields/articles.php
@@ -40,108 +40,7 @@ class JFormFieldArticles extends JFormFieldList
*
* @var string
*/
- public $type = 'articles';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create article
- if ($user->authorise('core.create', 'com_content') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit article
- if (($buttonName === 'article' || $buttonName === 'articles') && $user->authorise('core.edit', 'com_content') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_content&view=articles&task=article.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for article field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'articles';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/componentadminmenus.php b/admin/models/fields/componentadminmenus.php
index edba094d1..dabeac02d 100644
--- a/admin/models/fields/componentadminmenus.php
+++ b/admin/models/fields/componentadminmenus.php
@@ -40,108 +40,7 @@ class JFormFieldComponentadminmenus extends JFormFieldList
*
* @var string
*/
- public $type = 'componentadminmenus';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'componentadminmenus';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/componentadminviews.php b/admin/models/fields/componentadminviews.php
index 6d5762dae..044eb5a10 100644
--- a/admin/models/fields/componentadminviews.php
+++ b/admin/models/fields/componentadminviews.php
@@ -40,108 +40,7 @@ class JFormFieldComponentadminviews extends JFormFieldList
*
* @var string
*/
- public $type = 'componentadminviews';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'componentadminviews';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/components.php b/admin/models/fields/components.php
index a683562db..6afb0fc1a 100644
--- a/admin/models/fields/components.php
+++ b/admin/models/fields/components.php
@@ -40,108 +40,7 @@ class JFormFieldComponents extends JFormFieldList
*
* @var string
*/
- public $type = 'components';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create joomla_component
- if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit joomla_component
- if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for joomla_component field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'components';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/customadminviews.php b/admin/models/fields/customadminviews.php
index 4d82180c9..f7174e7aa 100644
--- a/admin/models/fields/customadminviews.php
+++ b/admin/models/fields/customadminviews.php
@@ -40,108 +40,7 @@ class JFormFieldCustomadminviews extends JFormFieldList
*
* @var string
*/
- public $type = 'customadminviews';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create custom_admin_view
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit custom_admin_view
- if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=custom_admin_views&task=custom_admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for custom_admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'customadminviews';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/customfilelist.php b/admin/models/fields/customfilelist.php
index 140725bff..535ecc877 100644
--- a/admin/models/fields/customfilelist.php
+++ b/admin/models/fields/customfilelist.php
@@ -40,108 +40,7 @@ class JFormFieldCustomfilelist extends JFormFieldList
*
* @var string
*/
- public $type = 'customfilelist';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'customfilelist';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/customfolderlist.php b/admin/models/fields/customfolderlist.php
index 5352032d3..ff6610944 100644
--- a/admin/models/fields/customfolderlist.php
+++ b/admin/models/fields/customfolderlist.php
@@ -40,108 +40,7 @@ class JFormFieldCustomfolderlist extends JFormFieldList
*
* @var string
*/
- public $type = 'customfolderlist';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'customfolderlist';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/customgets.php b/admin/models/fields/customgets.php
index 418243cf9..ea8384857 100644
--- a/admin/models/fields/customgets.php
+++ b/admin/models/fields/customgets.php
@@ -40,108 +40,7 @@ class JFormFieldCustomgets extends JFormFieldList
*
* @var string
*/
- public $type = 'customgets';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create dynamic_get
- if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit dynamic_get
- if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for dynamic_get field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'customgets';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/dbtables.php b/admin/models/fields/dbtables.php
index 1c3725cb6..04a20ee57 100644
--- a/admin/models/fields/dbtables.php
+++ b/admin/models/fields/dbtables.php
@@ -40,112 +40,7 @@ class JFormFieldDbtables extends JFormFieldList
*
* @var string
*/
- public $type = 'dbtables';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_
- view=') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_
- view=') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_
- view=&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'dbtables';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/dynamicdashboard.php b/admin/models/fields/dynamicdashboard.php
index 1459bf7b3..7d56767f2 100644
--- a/admin/models/fields/dynamicdashboard.php
+++ b/admin/models/fields/dynamicdashboard.php
@@ -40,108 +40,7 @@ class JFormFieldDynamicdashboard extends JFormFieldList
*
* @var string
*/
- public $type = 'dynamicdashboard';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create custom_admin_view
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit custom_admin_view
- if (($buttonName === 'custom_admin_view' || $buttonName === 'custom_admin_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=custom_admin_views&task=custom_admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for custom_admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'dynamicdashboard';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/dynamicgets.php b/admin/models/fields/dynamicgets.php
index 5b60340d1..bb2773134 100644
--- a/admin/models/fields/dynamicgets.php
+++ b/admin/models/fields/dynamicgets.php
@@ -40,108 +40,7 @@ class JFormFieldDynamicgets extends JFormFieldList
*
* @var string
*/
- public $type = 'dynamicgets';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create dynamic_get
- if ($user->authorise('dynamic_get.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit dynamic_get
- if (($buttonName === 'dynamic_get' || $buttonName === 'dynamic_gets') && $user->authorise('dynamic_get.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for dynamic_get field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'dynamicgets';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/existingvalidationrules.php b/admin/models/fields/existingvalidationrules.php
index fcbe83265..a5fd0bf48 100644
--- a/admin/models/fields/existingvalidationrules.php
+++ b/admin/models/fields/existingvalidationrules.php
@@ -40,108 +40,7 @@ class JFormFieldExistingvalidationrules extends JFormFieldList
*
* @var string
*/
- public $type = 'existingvalidationrules';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create validation_rule
- if ($user->authorise('validation_rule.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit validation_rule
- if (($buttonName === 'validation_rule' || $buttonName === 'validation_rules') && $user->authorise('validation_rule.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=validation_rules&task=validation_rule.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for validation_rule field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'existingvalidationrules';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/fields.php b/admin/models/fields/fields.php
index 42f8267bd..0d0efa568 100644
--- a/admin/models/fields/fields.php
+++ b/admin/models/fields/fields.php
@@ -40,108 +40,7 @@ class JFormFieldFields extends JFormFieldList
*
* @var string
*/
- public $type = 'fields';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create field
- if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit field
- if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'fields';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/filebehaviour.php b/admin/models/fields/filebehaviour.php
index ae3fdfde2..aef4a4814 100644
--- a/admin/models/fields/filebehaviour.php
+++ b/admin/models/fields/filebehaviour.php
@@ -40,108 +40,7 @@ class JFormFieldFilebehaviour extends JFormFieldList
*
* @var string
*/
- public $type = 'filebehaviour';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'filebehaviour';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/joomlacomponents.php b/admin/models/fields/joomlacomponents.php
index 3970acf1a..4a0ccdaee 100644
--- a/admin/models/fields/joomlacomponents.php
+++ b/admin/models/fields/joomlacomponents.php
@@ -40,108 +40,7 @@ class JFormFieldJoomlacomponents extends JFormFieldList
*
* @var string
*/
- public $type = 'joomlacomponents';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create joomla_component
- if ($user->authorise('joomla_component.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit joomla_component
- if (($buttonName === 'joomla_component' || $buttonName === 'joomla_components') && $user->authorise('joomla_component.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=joomla_components&task=joomla_component.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for joomla_component field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'joomlacomponents';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/lang.php b/admin/models/fields/lang.php
index f5a88c21a..139a445bd 100644
--- a/admin/models/fields/lang.php
+++ b/admin/models/fields/lang.php
@@ -40,108 +40,7 @@ class JFormFieldLang extends JFormFieldList
*
* @var string
*/
- public $type = 'lang';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create language
- if ($user->authorise('language.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit language
- if (($buttonName === 'language' || $buttonName === 'languages') && $user->authorise('language.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=languages&task=language.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for language field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'lang';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/libconfigfield.php b/admin/models/fields/libconfigfield.php
index d29c37d11..b315e68b8 100644
--- a/admin/models/fields/libconfigfield.php
+++ b/admin/models/fields/libconfigfield.php
@@ -40,108 +40,7 @@ class JFormFieldLibconfigfield extends JFormFieldList
*
* @var string
*/
- public $type = 'libconfigfield';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create field
- if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit field
- if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'libconfigfield';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/libraryfiles.php b/admin/models/fields/libraryfiles.php
index 745500545..d6abc5990 100644
--- a/admin/models/fields/libraryfiles.php
+++ b/admin/models/fields/libraryfiles.php
@@ -40,108 +40,7 @@ class JFormFieldLibraryfiles extends JFormFieldList
*
* @var string
*/
- public $type = 'libraryfiles';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'libraryfiles';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/libraryreadonly.php b/admin/models/fields/libraryreadonly.php
index 49e4df9ea..2eeaee8ee 100644
--- a/admin/models/fields/libraryreadonly.php
+++ b/admin/models/fields/libraryreadonly.php
@@ -40,108 +40,7 @@ class JFormFieldLibraryreadonly extends JFormFieldList
*
* @var string
*/
- public $type = 'libraryreadonly';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create library
- if ($user->authorise('library.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit library
- if (($buttonName === 'library' || $buttonName === 'libraries') && $user->authorise('library.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=libraries&task=library.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for library field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'libraryreadonly';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/matchfield.php b/admin/models/fields/matchfield.php
index b8164080a..434953c5e 100644
--- a/admin/models/fields/matchfield.php
+++ b/admin/models/fields/matchfield.php
@@ -40,108 +40,7 @@ class JFormFieldMatchfield extends JFormFieldList
*
* @var string
*/
- public $type = 'matchfield';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create field
- if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit field
- if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'matchfield';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/siteviewfolderlist.php b/admin/models/fields/siteviewfolderlist.php
index 6fd382439..782c9e00f 100644
--- a/admin/models/fields/siteviewfolderlist.php
+++ b/admin/models/fields/siteviewfolderlist.php
@@ -40,108 +40,7 @@ class JFormFieldSiteviewfolderlist extends JFormFieldList
*
* @var string
*/
- public $type = 'siteviewfolderlist';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit
- if (($buttonName === '' || $buttonName === '') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=&task=.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'siteviewfolderlist';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/siteviews.php b/admin/models/fields/siteviews.php
index 5f4f4dd83..9c4083809 100644
--- a/admin/models/fields/siteviews.php
+++ b/admin/models/fields/siteviews.php
@@ -40,108 +40,7 @@ class JFormFieldSiteviews extends JFormFieldList
*
* @var string
*/
- public $type = 'siteviews';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create site_view
- if ($user->authorise('core.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit site_view
- if (($buttonName === 'site_view' || $buttonName === 'site_views') && $user->authorise('core.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=site_views&task=site_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for site_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'siteviews';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/snippettype.php b/admin/models/fields/snippettype.php
index 2dcbdc9e1..251f62589 100644
--- a/admin/models/fields/snippettype.php
+++ b/admin/models/fields/snippettype.php
@@ -40,108 +40,7 @@ class JFormFieldSnippettype extends JFormFieldList
*
* @var string
*/
- public $type = 'snippettype';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create snippet_type
- if ($user->authorise('snippet_type.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit snippet_type
- if (($buttonName === 'snippet_type' || $buttonName === 'snippet_types') && $user->authorise('snippet_type.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=snippet_types&task=snippet_type.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for snippet_type field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'snippettype';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/targetfields.php b/admin/models/fields/targetfields.php
index cfb43da25..6c725b40c 100644
--- a/admin/models/fields/targetfields.php
+++ b/admin/models/fields/targetfields.php
@@ -40,108 +40,7 @@ class JFormFieldTargetfields extends JFormFieldList
*
* @var string
*/
- public $type = 'targetfields';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create field
- if ($user->authorise('field.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit field
- if (($buttonName === 'field' || $buttonName === 'fields') && $user->authorise('field.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=fields&task=field.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for field field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'targetfields';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/fields/viewtabs.php b/admin/models/fields/viewtabs.php
index 1d28cd454..416559590 100644
--- a/admin/models/fields/viewtabs.php
+++ b/admin/models/fields/viewtabs.php
@@ -40,108 +40,7 @@ class JFormFieldViewtabs extends JFormFieldList
*
* @var string
*/
- public $type = 'viewtabs';
-
- /**
- * Override to add new button
- *
- * @return string The field input markup.
- *
- * @since 3.2
- */
- protected function getInput()
- {
- // see if we should add buttons
- $setButton = $this->getAttribute('button');
- // get html
- $html = parent::getInput();
- // if true set button
- if ($setButton === 'true')
- {
- $button = array();
- $script = array();
- $buttonName = $this->getAttribute('name');
- // get the input from url
- $app = JFactory::getApplication();
- $jinput = $app->input;
- // get the view name & id
- $values = $jinput->getArray(array(
- 'id' => 'int',
- 'view' => 'word'
- ));
- // check if new item
- $ref = '';
- $refJ = '';
- if (!is_null($values['id']) && strlen($values['view']))
- {
- // only load referal if not new item.
- $ref = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- $refJ = '&ref=' . $values['view'] . '&refid=' . $values['id'];
- }
- $user = JFactory::getUser();
- // only add if user allowed to create admin_view
- if ($user->authorise('admin_view.create', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build Create button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- }
- // only add if user allowed to edit admin_view
- if (($buttonName === 'admin_view' || $buttonName === 'admin_views') && $user->authorise('admin_view.edit', 'com_componentbuilder') && $app->isAdmin()) // TODO for now only in admin area.
- {
- // build edit button
- $buttonNamee = trim($buttonName);
- $buttonNamee = preg_replace('/_+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace('/\s+/', ' ', $buttonNamee);
- $buttonNamee = preg_replace("/[^A-Za-z ]/", '', $buttonNamee);
- $buttonNamee = ucfirst(strtolower($buttonNamee));
- $button[] = '
- ';
- // build script
- $script[] = "
- jQuery(document).ready(function() {
- jQuery('#adminForm').on('change', '#jform_".$buttonName."',function (e) {
- e.preventDefault();
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- var ".$buttonName."Value = jQuery('#jform_".$buttonName."').val();
- ".$buttonName."Button(".$buttonName."Value);
- });
- function ".$buttonName."Button(value) {
- if (value > 0) {
- // hide the create button
- jQuery('#".$buttonName."Create').hide();
- // show edit button
- jQuery('#".$buttonName."Edit').show();
- var url = 'index.php?option=com_componentbuilder&view=admin_views&task=admin_view.edit&id='+value+'".$refJ."';
- jQuery('#".$buttonName."Edit').attr('href', url);
- } else {
- // show the create button
- jQuery('#".$buttonName."Create').show();
- // hide edit button
- jQuery('#".$buttonName."Edit').hide();
- }
- }";
- }
- // check if button was created for admin_view field.
- if (is_array($button) && count($button) > 0)
- {
- // Load the needed script.
- $document = JFactory::getDocument();
- $document->addScriptDeclaration(implode(' ',$script));
- // return the button attached to input field.
- return '' .$html . implode('',$button).'
';
- }
- }
- return $html;
- }
+ public $type = 'viewtabs';
/**
* Method to get a list of options for a list input.
diff --git a/admin/models/forms/dynamic_get.xml b/admin/models/forms/dynamic_get.xml
index 2660fa1f3..0313f8160 100644
--- a/admin/models/forms/dynamic_get.xml
+++ b/admin/models/forms/dynamic_get.xml
@@ -279,6 +279,7 @@
class="list_class"
multiple="false"
required="true"
+ button="false"
/>