added interface of the new decoupled libraries concept gh-92

This commit is contained in:
2017-11-26 02:29:08 +02:00
parent 9760ac86a3
commit 82df61aa4a
174 changed files with 11626 additions and 1094 deletions

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelAdmin_fields extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelAdmin_fields_conditions extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -84,7 +84,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -211,6 +211,8 @@ class ComponentbuilderModelAjax extends JModelList
}
protected $buttonArray = array(
'library_config' => 'libraries_config',
'library_files_folders_urls' => 'libraries_files_folders_urls',
'admin_fields' => 'admins_fields',
'admin_fields_conditions' => 'admins_fields_conditions',
'field' => 'fields',
@ -338,6 +340,10 @@ class ComponentbuilderModelAjax extends JModelList
}
protected $functionArray = array(
// Library
'rename' => 'setYesNo',
'update' => 'setYesNo',
'type' => 'setURLType',
// Admin View
'field' => 'setItemNames',
'list' => 'setYesNo',
@ -379,6 +385,10 @@ class ComponentbuilderModelAjax extends JModelList
protected function getLanguage($key)
{
$language = array(
// Library (folder file url)
'rename' => JText::_('COM_COMPONENTBUILDER_RENAME'),
'path' => JText::_('COM_COMPONENTBUILDER_TARGET_PATH'),
'update' => JText::_('COM_COMPONENTBUILDER_UPDATE'),
// Admin View (fields)
'field' => JText::_('COM_COMPONENTBUILDER_FIELD'),
'list' => JText::_('COM_COMPONENTBUILDER_ADMIN_LIST'),
@ -546,11 +556,17 @@ class ComponentbuilderModelAjax extends JModelList
protected $ref;
protected $fieldsArray = array(
'library_config' => 'addconfig',
'library_files_folders_urls' => array('addurls','addfiles','addfolders'),
'admin_fields' => 'addfields',
'admin_fields_conditions' => 'addconditions',
'component_admin_views' => 'addadmin_views',
'component_site_views' => 'addsite_views',
'component_custom_admin_views' => 'addcustom_admin_views');
protected $allowedViewsArray = array(
'admin_view',
'joomla_component',
'library');
public function getAjaxDisplay($type)
{
@ -561,28 +577,39 @@ class ComponentbuilderModelAjax extends JModelList
// get the view name & id
$values = $this->getViewID();
// check if we are in the correct view.
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && ($values['a_view'] === 'admin_view' || $values['a_view'] === 'joomla_component'))
if (!is_null($values['a_id']) && $values['a_id'] > 0 && strlen($values['a_view']) && in_array($values['a_view'], $this->allowedViewsArray))
{
$this->ref = '&ref=' . $values['a_view'] . '&refid=' . $values['a_id'];
// get the field data
if ($fieldsData = ComponentbuilderHelper::getVar($type, (int) $values['a_id'], $values['a_view'], $this->fieldsArray[$type]))
// load the results
$result = array();
// return field table
if (ComponentbuilderHelper::checkArray($this->fieldsArray[$type]))
{
// check repeatable conversion
$this->checkRepeatableConversion($fieldsData, $type, $values['a_id'], $values['a_view']);
// get the table
$table = $this->getSubformTable($type, $fieldsData);
// set notice of bad practice
$notice = '';
if ($values['a_view'] === 'admin_view' && isset($this->rowNumber) && $this->rowNumber > 50)
foreach ($this->fieldsArray[$type] as $fieldName)
{
$notice = '<div class="alert alert-warning">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $typeName, $typeName, $typeName) . '</div>';
if ($table = $this->getFieldTable($type, $values['a_id'], $values['a_view'], $fieldName, $typeName))
{
$result[] = $table;
}
}
elseif ($values['a_view'] === 'admin_view' && isset($this->rowNumber))
}
elseif (ComponentbuilderHelper::checkString($this->fieldsArray[$type]))
{
if ($table = $this->getFieldTable($type, $values['a_id'], $values['a_view'], $this->fieldsArray[$type], $typeName))
{
$notice = '<div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $typeName) . '</div>';
$result[] = $table;
}
// return table
return $notice.$table;
}
// check if we have results
if (ComponentbuilderHelper::checkArray($result) && count($result) == 1)
{
// return the display
return implode('', $result);
}
elseif (ComponentbuilderHelper::checkArray($result))
{
// return the display
return '<div>' . implode('</div><div>', $result) . '</div>';
}
}
return '<div class="control-group"><div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_NO_S_HAVE_BEEN_LINKED_TO_THIS_VIEW_SOON_AS_THIS_IS_DONE_IT_WILL_BE_DISPLAYED_HERE', $typeName) . '</div></div>';
@ -590,6 +617,31 @@ class ComponentbuilderModelAjax extends JModelList
return '<div class="control-group"><div class="alert alert-error"><h4>' . JText::_('COM_COMPONENTBUILDER_TYPE_ERROR') . '</h4><p>' . JText::_('COM_COMPONENTBUILDER_THERE_HAS_BEEN_AN_ERROR_IF_THIS_CONTINUES_PLEASE_INFORM_YOUR_SYSTEM_ADMINISTRATOR_OF_A_TYPE_ERROR_IN_THE_FIELDS_DISPLAY_REQUEST') . '</p></div></div>';
}
protected function getFieldTable($type, $id, $idName, $fieldName, $typeName)
{
// get the field data
if ($fieldsData = ComponentbuilderHelper::getVar($type, (int) $id, $idName, $fieldName))
{
// check repeatable conversion
$this->checkRepeatableConversion($fieldsData, $fieldName, $id, $idName);
// get the table
$table = $this->getSubformTable($type, $fieldsData);
// set notice of bad practice
$notice = '';
if ($idName === 'admin_view' && isset($this->rowNumber) && $this->rowNumber > 50)
{
$notice = '<div class="alert alert-warning">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE_YOUR_S_PAGE_LOAD_IN_JCB_WILL_SLOWDOWN_YOU_SHOULD_CONSIDER_DECOUPLING_SOME_OF_THESE_S', $this->rowNumber, $typeName, $typeName, $typeName, $typeName) . '</div>';
}
elseif ($idName === 'admin_view' && isset($this->rowNumber))
{
$notice = '<div class="alert alert-info">' . JText::sprintf('COM_COMPONENTBUILDER_YOU_HAVE_S_S_ADDING_MORE_THEN_FIFTY_S_IS_CONSIDERED_BAD_PRACTICE', $this->rowNumber, $typeName, $typeName) . '</div>';
}
// return table
return $notice.$table;
}
return false;
}
protected $conversionCheck = array(
'addfields' => 'field',
'addconditions' => 'target_field',
@ -601,26 +653,26 @@ class ComponentbuilderModelAjax extends JModelList
'sql_tweak' => 'adminview',
'version_update' => 'version');
protected function checkRepeatableConversion(&$fieldsData, $type, $id, $linked_id_name)
protected function checkRepeatableConversion(&$fieldsData, $fieldsArrayType, $id, $linked_id_name)
{
if (ComponentbuilderHelper::checkJson($fieldsData))
if (ComponentbuilderHelper::checkJson($fieldsData) && isset($this->conversionCheck[$fieldsArrayType]))
{
$fieldsData = json_decode($fieldsData, true);
if (isset($fieldsData[$this->conversionCheck[$this->fieldsArray[$type]]]))
if (isset($fieldsData[$this->conversionCheck[$fieldsArrayType]]))
{
$bucket = array();
foreach($fieldsData as $option => $values)
{
foreach($values as $nr => $value)
{
$bucket[$this->fieldsArray[$type].$nr][$option] = $value;
$bucket[$fieldsArrayType.$nr][$option] = $value;
}
}
$fieldsData = json_encode($bucket);
// update the fields
$objectUpdate = new stdClass();
$objectUpdate->{$linked_id_name} = (int) $id;
$objectUpdate->{$this->fieldsArray[$type]} = $fieldsData;
$objectUpdate->{$fieldsArrayType} = $fieldsData;
JFactory::getDbo()->updateObject('#__componentbuilder_'.$type, $objectUpdate, 'admin_view');
}
}
@ -715,6 +767,23 @@ class ComponentbuilderModelAjax extends JModelList
return JText::_('COM_COMPONENTBUILDER_NO_ITEM_FOUND');
}
protected function setURLType($header, $value)
{
switch ($value)
{
case 1:
return JText::_('COM_COMPONENTBUILDER_DEFAULT_LINK');
break;
case 2:
return JText::_('COM_COMPONENTBUILDER_LOCAL_GET');
break;
case 3:
return JText::_('COM_COMPONENTBUILDER_LINK_LOCAL_DYNAMIC');
break;
}
return JText::_('COM_COMPONENTBUILDER_NOT_SET');
}
protected function setIcoMoon($header, $value)
{
if (ComponentbuilderHelper::checkString($value))
@ -1003,6 +1072,39 @@ class ComponentbuilderModelAjax extends JModelList
return false;
}
// Used in site_view
public function getSnippets($libraries)
{
if (ComponentbuilderHelper::checkJson($libraries))
{
$libraries = json_decode($libraries, true);
}
// check if we have an array
if (ComponentbuilderHelper::checkArray($libraries))
{
// insure we only have int values
$libraries = array_map( function($id){ return (int) $id; }, $libraries);
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
$query->select($db->quoteName( array('a.id') ));
$query->from($db->quoteName('#__componentbuilder_snippet', 'a'));
$query->where($db->quoteName('a.published') . ' = 1');
// check for country and region
$query->where($db->quoteName('a.library') . ' IN ('. implode(',',$libraries) .')');
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
return $db->loadColumn();
}
}
return false;
}
// Used in template
public function getTemplateDetails($id)
{

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_admin_views extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_config extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_custom_admin_menus extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_custom_admin_views extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_files_folders extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_mysql_tweaks extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_site_views extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelComponent_updates extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -43,7 +43,7 @@ class ComponentbuilderModelComponentbuilder extends JModelList
$icons = array();
// view groups array
$viewGroups = array(
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.ftps', 'png.help_document.add', 'png.help_documents')
'main' => array('png.compiler', 'png.joomla_component.add', 'png.joomla_components', 'png.admin_view.add', 'png.admin_views', 'png.custom_admin_view.add', 'png.custom_admin_views', 'png.site_view.add', 'png.site_views', 'png.template.add', 'png.templates', 'png.layout.add', 'png.layouts', 'png.dynamic_get.add', 'png.dynamic_gets', 'png.custom_codes', 'png.libraries', 'png.snippet.add', 'png.snippets', 'png.field.add', 'png.fields', 'png.fields.catid', 'png.fieldtype.add', 'png.fieldtypes', 'png.fieldtypes.catid', 'png.language_translations', 'png.ftps', 'png.help_document.add', 'png.help_documents')
);
// view access array
$viewAccess = array(
@ -92,6 +92,11 @@ class ComponentbuilderModelComponentbuilder extends JModelList
'custom_code.access' => 'custom_code.access',
'custom_codes.submenu' => 'custom_code.submenu',
'custom_codes.dashboard_list' => 'custom_code.dashboard_list',
'library.create' => 'library.create',
'libraries.access' => 'library.access',
'library.access' => 'library.access',
'libraries.submenu' => 'library.submenu',
'libraries.dashboard_list' => 'library.dashboard_list',
'snippets.access' => 'snippet.access',
'snippet.access' => 'snippet.access',
'snippets.submenu' => 'snippet.submenu',
@ -165,9 +170,12 @@ class ComponentbuilderModelComponentbuilder extends JModelList
'snippet_type.create' => 'snippet_type.create',
'snippet_types.access' => 'snippet_type.access',
'snippet_type.access' => 'snippet_type.access',
'library.create' => 'library.create',
'libraries.access' => 'library.access',
'library.access' => 'library.access');
'library_config.create' => 'library_config.create',
'libraries_config.access' => 'library_config.access',
'library_config.access' => 'library_config.access',
'library_files_folders_urls.create' => 'library_files_folders_urls.create',
'libraries_files_folders_urls.access' => 'library_files_folders_urls.access',
'library_files_folders_urls.access' => 'library_files_folders_urls.access');
foreach($viewGroups as $group => $views)
{
$i = 0;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -95,12 +95,12 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$item->metadata = $registry->toArray();
}
if (!empty($item->custom_get))
if (!empty($item->libraries))
{
// Convert the custom_get field to an array.
$custom_get = new Registry;
$custom_get->loadString($item->custom_get);
$item->custom_get = $custom_get->toArray();
// Convert the libraries field to an array.
$libraries = new Registry;
$libraries->loadString($item->libraries);
$item->libraries = $libraries->toArray();
}
if (!empty($item->custom_button))
@ -111,6 +111,14 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$item->custom_button = $custom_button->toArray();
}
if (!empty($item->custom_get))
{
// Convert the custom_get field to an array.
$custom_get = new Registry;
$custom_get->loadString($item->custom_get);
$item->custom_get = $custom_get->toArray();
}
if (!empty($item->php_controller))
{
// base64 Decode php_controller.
@ -915,17 +923,17 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the custom_get items to data.
if (isset($data['custom_get']) && is_array($data['custom_get']))
// Set the libraries items to data.
if (isset($data['libraries']) && is_array($data['libraries']))
{
$custom_get = new JRegistry;
$custom_get->loadArray($data['custom_get']);
$data['custom_get'] = (string) $custom_get;
$libraries = new JRegistry;
$libraries->loadArray($data['libraries']);
$data['libraries'] = (string) $libraries;
}
elseif (!isset($data['custom_get']))
elseif (!isset($data['libraries']))
{
// Set the empty custom_get to data
$data['custom_get'] = '';
// Set the empty libraries to data
$data['libraries'] = '';
}
// Set the custom_button items to data.
@ -941,6 +949,19 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
$data['custom_button'] = '';
}
// Set the custom_get items to data.
if (isset($data['custom_get']) && is_array($data['custom_get']))
{
$custom_get = new JRegistry;
$custom_get->loadArray($data['custom_get']);
$data['custom_get'] = (string) $custom_get;
}
elseif (!isset($data['custom_get']))
{
// Set the empty custom_get to data
$data['custom_get'] = '';
}
// Set the php_controller string to base64 string.
if (isset($data['php_controller']))
{

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelField extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -0,0 +1,170 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage adminviewsreadonly.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Adminviewsreadonly Form Field class for the Componentbuilder component
*/
class JFormFieldAdminviewsreadonly extends JFormFieldList
{
/**
* The adminviewsreadonly field type.
*
* @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 = '&amp;ref=' . $values['view'] . '&amp;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[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=admin_view&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// 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[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// 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 '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
public function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','admin_view_system_name')));
$query->from($db->quoteName('#__componentbuilder_admin_view', 'a'));
$query->order('a.system_name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->admin_view_system_name);
}
}
return $options;
}
}

View File

@ -153,7 +153,6 @@ class JFormFieldJoomlacomponents extends JFormFieldList
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.system_name'),array('id','joomla_component_system_name')));
$query->from($db->quoteName('#__componentbuilder_joomla_component', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.system_name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();

View File

@ -0,0 +1,206 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libconfigfield.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Libconfigfield Form Field class for the Componentbuilder component
*/
class JFormFieldLibconfigfield extends JFormFieldList
{
/**
* The libconfigfield field type.
*
* @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 = '&amp;ref=' . $values['view'] . '&amp;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[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=field&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// 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[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// 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 '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
public function getOptions()
{
// load the db opbject
$db = JFactory::getDBO();
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the id
$ID = $jinput->getInt('id', 0);
// rest the fields ids
$fieldIds = array();
if (is_numeric($ID) && $ID >= 1)
{
// get all the fields linked to the library config
if ($addconfig = ComponentbuilderHelper::getVar('library_config', (int) $ID, 'library', 'addconfig'))
{
if (ComponentbuilderHelper::checkJson($addconfig))
{
$addconfig = json_decode($addconfig, true);
if (ComponentbuilderHelper::checkArray($addconfig))
{
foreach($addconfig as $field)
{
if (isset($field['field']))
{
$fieldIds[] = (int) $field['field'];
}
}
}
}
}
}
// check if we have ids, since we should not show any fields that are not part of this config
if (ComponentbuilderHelper::checkArray($fieldIds))
{
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','name')));
$query->from($db->quoteName('#__componentbuilder_field', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
// only load these fields
$query->where($db->quoteName('a.id') . ' IN (' . implode(',', $fieldIds) . ')');
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->name);
}
return $options;
}
}
return array(JHtml::_('select.option', '', 'No config fields linked'));
}
}

View File

@ -0,0 +1,170 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libraries.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Libraries Form Field class for the Componentbuilder component
*/
class JFormFieldLibraries extends JFormFieldList
{
/**
* The libraries field type.
*
* @var string
*/
public $type = 'libraries';
/**
* 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 = '&amp;ref=' . $values['view'] . '&amp;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[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=library&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// 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[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// 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 '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
public function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','libraries_name')));
$query->from($db->quoteName('#__componentbuilder_library', 'a'));
$query->where($db->quoteName('a.published') . ' >= 1');
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->libraries_name);
}
}
return $options;
}
}

View File

@ -0,0 +1,171 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libraryfiles.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Libraryfiles Form Field class for the Componentbuilder component
*/
class JFormFieldLibraryfiles extends JFormFieldList
{
/**
* The libraryfiles field type.
*
* @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 = '&amp;ref=' . $values['view'] . '&amp;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[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// 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[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// 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 '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
public function getOptions()
{
// get the input from url
$jinput = JFactory::getApplication()->input;
// get the library id
$id = $jinput->getInt('id', 0);
// get custom the files
$files = ComponentbuilderHelper::getLibraryFiles($id);
// set the default
$options[] = JHtml::_('select.option', '', JText::_('COM_COMPONENTBUILDER_NO_FILES_LINKED'));
// now check if there are files in the folder
if (ComponentbuilderHelper::checkArray($files))
{
$options = array();
foreach ($files as $file => $name)
{
$options[] = JHtml::_('select.option', $file, $name);
}
}
return $options;
}
}

View File

@ -0,0 +1,170 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libraryreadonly.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the list field type
jimport('joomla.form.helper');
JFormHelper::loadFieldClass('list');
/**
* Libraryreadonly Form Field class for the Componentbuilder component
*/
class JFormFieldLibraryreadonly extends JFormFieldList
{
/**
* The libraryreadonly field type.
*
* @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 = '&amp;ref=' . $values['view'] . '&amp;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[] = '<a id="'.$buttonName.'Create" class="btn btn-small btn-success hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_CREATE_NEW_S', $buttonNamee).'" style="border-radius: 0px 4px 4px 0px; padding: 4px 4px 4px 7px;"
href="index.php?option=com_componentbuilder&amp;view=library&amp;layout=edit'.$ref.'" >
<span class="icon-new icon-white"></span></a>';
}
// 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[] = '<a id="'.$buttonName.'Edit" class="btn btn-small hasTooltip" title="'.JText::sprintf('COM_COMPONENTBUILDER_EDIT_S', $buttonNamee).'" style="display: none; padding: 4px 4px 4px 7px;" href="#" >
<span class="icon-edit"></span></a>';
// 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 '<div class="input-append">' .$html . implode('',$button).'</div>';
}
}
return $html;
}
/**
* Method to get a list of options for a list input.
*
* @return array An array of JHtml options.
*/
public function getOptions()
{
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select($db->quoteName(array('a.id','a.name'),array('id','library_name')));
$query->from($db->quoteName('#__componentbuilder_library', 'a'));
$query->order('a.name ASC');
$db->setQuery((string)$query);
$items = $db->loadObjectList();
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$options[] = JHtml::_('select.option', $item->id, $item->library_name);
}
}
return $options;
}
}

View File

@ -165,11 +165,11 @@ class JFormFieldSnippets extends JFormFieldList
$options = array();
if ($items)
{
$options[] = JHtml::_('select.option', '', 'Select an option');
foreach($items as $item)
{
$lib = (ComponentbuilderHelper::checkString($item->library)) ? ' (' . $item->library . ')' :'';
$options[] = JHtml::_('select.option', $item->id, $item->type . ' - ' . $item->snippet_name . $lib );
$lib = (isset($item->library) && ComponentbuilderHelper::checkString($item->library)) ? ' (' . $item->library . ')' :'';
$type = (isset($item->type) && ComponentbuilderHelper::checkString($item->type)) ? $item->type :JText::_('COM_COMPONENTBUILDER_NO_TYPE');
$options[] = JHtml::_('select.option', $item->id, $type . ' - ' . $item->snippet_name . $lib );
}
}
return $options;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -139,7 +139,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
public function getVzufields()
public function getVzwfields()
{
// Get the user object.
$user = JFactory::getUser();
@ -223,13 +223,13 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
foreach ($items as $nr => &$item)
{
// convert datatype
$item->datatype = $this->selectionTranslationVzufields($item->datatype, 'datatype');
$item->datatype = $this->selectionTranslationVzwfields($item->datatype, 'datatype');
// convert indexes
$item->indexes = $this->selectionTranslationVzufields($item->indexes, 'indexes');
$item->indexes = $this->selectionTranslationVzwfields($item->indexes, 'indexes');
// convert null_switch
$item->null_switch = $this->selectionTranslationVzufields($item->null_switch, 'null_switch');
$item->null_switch = $this->selectionTranslationVzwfields($item->null_switch, 'null_switch');
// convert store
$item->store = $this->selectionTranslationVzufields($item->store, 'store');
$item->store = $this->selectionTranslationVzwfields($item->store, 'store');
}
}
@ -243,7 +243,7 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
*
* @return translatable string
*/
public function selectionTranslationVzufields($value,$name)
public function selectionTranslationVzwfields($value,$name)
{
// Array of datatype language strings
if ($name === 'datatype')

View File

@ -90,9 +90,9 @@
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Admin_view Field. Type: Adminviews. (custom) -->
<!-- Admin_view Field. Type: Adminviewsreadonly. (custom) -->
<field
type="adminviews"
type="adminviewsreadonly"
name="admin_view"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_ADMIN_VIEW_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_ADMIN_VIEW_DESCRIPTION"

View File

@ -38,17 +38,17 @@ function getFieldSelectOptions_server(fieldId){
});
}
function getFieldSelectOptions(fieldKey, table_, nr_){
function getFieldSelectOptions(fieldKey){
// first check if the field is set
if(jQuery("#jform_addconditions"+table_+"_addconditions"+fieldKey+nr_+"_match_field").length) {
var fieldId = jQuery("#jform_addconditions"+table_+"_addconditions"+fieldKey+nr_+"_match_field option:selected").val();
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) {
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field option:selected").val();
getFieldSelectOptions_server(fieldId).done(function(result) {
if(result){
jQuery('textarea#jform_addconditions'+table_+'_addconditions'+fieldKey+nr_+'_match_options').val(result);
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val(result);
}
else
{
jQuery('textarea#jform_addconditions'+table_+'_addconditions'+fieldKey+nr_+'_match_options').val('');
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val('');
}
});
}

View File

@ -90,9 +90,9 @@
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Admin_view Field. Type: Adminviews. (custom) -->
<!-- Admin_view Field. Type: Adminviewsreadonly. (custom) -->
<field
type="adminviews"
type="adminviewsreadonly"
name="admin_view"
label="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADMIN_VIEW_LABEL"
description="COM_COMPONENTBUILDER_ADMIN_FIELDS_CONDITIONS_ADMIN_VIEW_DESCRIPTION"

View File

@ -146,7 +146,7 @@
label="COM_COMPONENTBUILDER_COMPONENT_CONFIG_TABNAME_LABEL"
size="40"
maxlength="150"
default="Global"
default="Library"
description="COM_COMPONENTBUILDER_COMPONENT_CONFIG_TABNAME_DESCRIPTION"
class="text_area"
readonly="false"

View File

@ -103,9 +103,9 @@
button="false"
/>
<!-- Note_add_folders Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_folders" label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_DESCRIPTION" heading="h4" class="alert alert-info note_add_folders" close="false" />
<field type="note" name="note_add_folders" label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FOLDERS_DESCRIPTION" heading="h4" class="alert alert-info note_add_folders" />
<!-- Note_add_files Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_files" label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_DESCRIPTION" heading="h4" class="alert alert-info note_add_files" close="false" />
<field type="note" name="note_add_files" label="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_LABEL" description="COM_COMPONENTBUILDER_COMPONENT_FILES_FOLDERS_NOTE_ADD_FILES_DESCRIPTION" heading="h4" class="alert alert-info note_add_files" />
<!-- Addfiles Field. Type: Subform. (joomla) -->
<field
type="subform"

View File

@ -493,4 +493,76 @@ function getTemplateDetails(id){
});
}
})
}
// set snippets that are on the page
var snippetIds = [];
var snippets = {};
var snippet = 0;
jQuery(document).ready(function($)
{
jQuery("#jform_snippet option").each(function()
{
var key = jQuery(this).val();
var text = jQuery(this).text();
snippets[key] = text;
snippetIds.push(key);
});
snippet = jQuery("#jform_snippet").val();
getSnippets();
});
function getSnippets_server(libraries){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json";
if(token.length > 0 && libraries.length > 0){
var request = 'token='+token+'&libraries='+JSON.stringify(libraries);
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getSnippets(){
jQuery("#loading").show();
// clear the selection
jQuery('#jform_snippet').find('option').remove().end();
jQuery('#jform_snippet').trigger('liszt:updated');
// get country value if set
var libraries = jQuery("#jform_libraries").val();
if (libraries) {
getSnippets_server(libraries).done(function(result) {
setSnippets(result);
jQuery("#loading").hide();
if (typeof snippetButton !== 'undefined') {
// ensure button is correct
var snippet = jQuery('#jform_snippet').val();
snippetButton(snippet);
}
});
}
else
{
// load all snippets in none is selected
setSnippets(snippetIds);
jQuery("#loading").hide();
}
}
function setSnippets(array){
if (array) {
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
jQuery.each( array, function( i, id ) {
if (id in snippets) {
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
}
if (id == snippet) {
jQuery('#jform_snippet').val(id);
}
});
} else {
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
}
jQuery('#jform_snippet').trigger('liszt:updated');
}

View File

@ -153,11 +153,24 @@
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
button="true"
/>
<!-- Note_libraries_selection Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_selection" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_selection" />
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Icon Field. Type: Media. (joomla) -->
<field
type="media"
name="icon"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ICON_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ICON_DESCRIPTION"
directory=""
/>
<!-- Add_php_jview Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -172,20 +185,6 @@
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Add_php_view Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_view"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_VIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Add_css_document Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -200,23 +199,11 @@
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Icon Field. Type: Media. (joomla) -->
<field
type="media"
name="icon"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ICON_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ICON_DESCRIPTION"
directory=""
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Add_php_jview_display Field. Type: Radio. (joomla) -->
<!-- Add_php_document Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_jview_display"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL"
name="add_php_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_DOCUMENT_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
@ -226,13 +213,23 @@
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Add_js_document Field. Type: Radio. (joomla) -->
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Add_php_jview_display Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_js_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JS_DOCUMENT_LABEL"
name="add_php_jview_display"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_JVIEW_DISPLAY_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
@ -255,6 +252,22 @@
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_CONTROLLER_HINT"
required="false"
/>
<!-- Add_js_document Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_js_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_JS_DOCUMENT_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Add_css Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -269,172 +282,8 @@
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Default Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="default"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_HINT"
required="true"
/>
<!-- Add_php_document Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_DOCUMENT_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Php_model Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_model"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_HINT"
required="false"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Php_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_HINT"
required="true"
/>
<!-- Custom_get Field. Type: Customgets. (custom) -->
<field
type="customgets"
name="custom_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_DESCRIPTION"
multiple="true"
/>
<!-- Php_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_view"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_HINT"
required="true"
/>
<!-- Main_get Field. Type: Maingets. (custom) -->
<field
type="maingets"
name="main_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_DESCRIPTION"
multiple="false"
required="true"
button="true"
/>
<!-- Php_jview_display Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview_display"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_HINT"
required="true"
/>
<!-- Dynamic_get Field. Type: Dynamicgets. (custom) -->
<field
type="dynamicgets"
name="dynamic_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_GET_DESCRIPTION"
multiple="false"
required="false"
/>
<!-- Php_jview Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_HINT"
required="true"
/>
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Js_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="js_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_HINT"
required="true"
/>
<!-- Add_custom_button Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_button"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Css_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_HINT"
required="true"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Custom_button Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -944,6 +793,172 @@
</field>
</form>
</field>
<!-- Default Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="default"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DEFAULT_HINT"
required="true"
/>
<!-- Php_model Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_model"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_MODEL_HINT"
required="false"
/>
<!-- Add_php_view Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_view"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_PHP_VIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Php_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_DOCUMENT_HINT"
required="true"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Php_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_view"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_VIEW_HINT"
required="true"
/>
<!-- Custom_get Field. Type: Customgets. (custom) -->
<field
type="customgets"
name="custom_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CUSTOM_GET_DESCRIPTION"
multiple="true"
/>
<!-- Php_jview_display Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview_display"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DISPLAY_HINT"
required="true"
/>
<!-- Main_get Field. Type: Maingets. (custom) -->
<field
type="maingets"
name="main_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_MAIN_GET_DESCRIPTION"
multiple="false"
required="true"
button="true"
/>
<!-- Php_jview Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_PHP_JVIEW_HINT"
required="true"
/>
<!-- Dynamic_get Field. Type: Dynamicgets. (custom) -->
<field
type="dynamicgets"
name="dynamic_get"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_GET_LABEL"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_GET_DESCRIPTION"
multiple="false"
required="false"
/>
<!-- Js_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="js_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_JS_DOCUMENT_HINT"
required="true"
/>
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Css_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_document"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_CSS_DOCUMENT_HINT"
required="true"
/>
<!-- Add_custom_button Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_button"
label="COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_ADD_CUSTOM_BUTTON_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_CUSTOM_ADMIN_VIEW_NO</option>
</field>
<!-- Css Field. Type: Textarea. (joomla) -->
<field
type="textarea"

View File

@ -23,171 +23,171 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_vvvvvzuvzm_required = false;
jform_vvvvvzvvzn_required = false;
jform_vvvvvzwvzo_required = false;
jform_vvvvvzxvzp_required = false;
jform_vvvvwaavzq_required = false;
jform_vvvvwabvzr_required = false;
jform_vvvvwacvzs_required = false;
jform_vvvvwadvzt_required = false;
jform_vvvvwaavzo_required = false;
jform_vvvvwabvzp_required = false;
jform_vvvvwacvzq_required = false;
jform_vvvvwadvzr_required = false;
jform_vvvvwagvzs_required = false;
jform_vvvvwahvzt_required = false;
jform_vvvvwaivzu_required = false;
jform_vvvvwajvzv_required = false;
// Initial Script
jQuery(document).ready(function()
{
var datalenght_vvvvvzu = jQuery("#jform_datalenght").val();
vvvvvzu(datalenght_vvvvvzu);
var datalenght_vvvvwaa = jQuery("#jform_datalenght").val();
vvvvwaa(datalenght_vvvvwaa);
var datadefault_vvvvvzv = jQuery("#jform_datadefault").val();
vvvvvzv(datadefault_vvvvvzv);
var datadefault_vvvvwab = jQuery("#jform_datadefault").val();
vvvvwab(datadefault_vvvvwab);
var datatype_vvvvvzw = jQuery("#jform_datatype").val();
vvvvvzw(datatype_vvvvvzw);
var datatype_vvvvwac = jQuery("#jform_datatype").val();
vvvvwac(datatype_vvvvwac);
var datatype_vvvvvzx = jQuery("#jform_datatype").val();
vvvvvzx(datatype_vvvvvzx);
var datatype_vvvvwad = jQuery("#jform_datatype").val();
vvvvwad(datatype_vvvvwad);
var store_vvvvvzy = jQuery("#jform_store").val();
var datatype_vvvvvzy = jQuery("#jform_datatype").val();
vvvvvzy(store_vvvvvzy,datatype_vvvvvzy);
var store_vvvvwae = jQuery("#jform_store").val();
var datatype_vvvvwae = jQuery("#jform_datatype").val();
vvvvwae(store_vvvvwae,datatype_vvvvwae);
var add_css_view_vvvvwaa = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwaa(add_css_view_vvvvwaa);
var add_css_view_vvvvwag = jQuery("#jform_add_css_view input[type='radio']:checked").val();
vvvvwag(add_css_view_vvvvwag);
var add_css_views_vvvvwab = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwab(add_css_views_vvvvwab);
var add_css_views_vvvvwah = jQuery("#jform_add_css_views input[type='radio']:checked").val();
vvvvwah(add_css_views_vvvvwah);
var add_javascript_view_footer_vvvvwac = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwac(add_javascript_view_footer_vvvvwac);
var add_javascript_view_footer_vvvvwai = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
vvvvwai(add_javascript_view_footer_vvvvwai);
var add_javascript_views_footer_vvvvwad = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwad(add_javascript_views_footer_vvvvwad);
var add_javascript_views_footer_vvvvwaj = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
vvvvwaj(add_javascript_views_footer_vvvvwaj);
});
// the vvvvvzu function
function vvvvvzu(datalenght_vvvvvzu)
// the vvvvwaa function
function vvvvwaa(datalenght_vvvvwaa)
{
if (isSet(datalenght_vvvvvzu) && datalenght_vvvvvzu.constructor !== Array)
if (isSet(datalenght_vvvvwaa) && datalenght_vvvvwaa.constructor !== Array)
{
var temp_vvvvvzu = datalenght_vvvvvzu;
var datalenght_vvvvvzu = [];
datalenght_vvvvvzu.push(temp_vvvvvzu);
var temp_vvvvwaa = datalenght_vvvvwaa;
var datalenght_vvvvwaa = [];
datalenght_vvvvwaa.push(temp_vvvvwaa);
}
else if (!isSet(datalenght_vvvvvzu))
else if (!isSet(datalenght_vvvvwaa))
{
var datalenght_vvvvvzu = [];
var datalenght_vvvvwaa = [];
}
var datalenght = datalenght_vvvvvzu.some(datalenght_vvvvvzu_SomeFunc);
var datalenght = datalenght_vvvvwaa.some(datalenght_vvvvwaa_SomeFunc);
// set this function logic
if (datalenght)
{
jQuery('#jform_datalenght_other').closest('.control-group').show();
if (jform_vvvvvzuvzm_required)
if (jform_vvvvwaavzo_required)
{
updateFieldRequired('datalenght_other',0);
jQuery('#jform_datalenght_other').prop('required','required');
jQuery('#jform_datalenght_other').attr('aria-required',true);
jQuery('#jform_datalenght_other').addClass('required');
jform_vvvvvzuvzm_required = false;
jform_vvvvwaavzo_required = false;
}
}
else
{
jQuery('#jform_datalenght_other').closest('.control-group').hide();
if (!jform_vvvvvzuvzm_required)
if (!jform_vvvvwaavzo_required)
{
updateFieldRequired('datalenght_other',1);
jQuery('#jform_datalenght_other').removeAttr('required');
jQuery('#jform_datalenght_other').removeAttr('aria-required');
jQuery('#jform_datalenght_other').removeClass('required');
jform_vvvvvzuvzm_required = true;
jform_vvvvwaavzo_required = true;
}
}
}
// the vvvvvzu Some function
function datalenght_vvvvvzu_SomeFunc(datalenght_vvvvvzu)
// the vvvvwaa Some function
function datalenght_vvvvwaa_SomeFunc(datalenght_vvvvwaa)
{
// set the function logic
if (datalenght_vvvvvzu == 'Other')
if (datalenght_vvvvwaa == 'Other')
{
return true;
}
return false;
}
// the vvvvvzv function
function vvvvvzv(datadefault_vvvvvzv)
// the vvvvwab function
function vvvvwab(datadefault_vvvvwab)
{
if (isSet(datadefault_vvvvvzv) && datadefault_vvvvvzv.constructor !== Array)
if (isSet(datadefault_vvvvwab) && datadefault_vvvvwab.constructor !== Array)
{
var temp_vvvvvzv = datadefault_vvvvvzv;
var datadefault_vvvvvzv = [];
datadefault_vvvvvzv.push(temp_vvvvvzv);
var temp_vvvvwab = datadefault_vvvvwab;
var datadefault_vvvvwab = [];
datadefault_vvvvwab.push(temp_vvvvwab);
}
else if (!isSet(datadefault_vvvvvzv))
else if (!isSet(datadefault_vvvvwab))
{
var datadefault_vvvvvzv = [];
var datadefault_vvvvwab = [];
}
var datadefault = datadefault_vvvvvzv.some(datadefault_vvvvvzv_SomeFunc);
var datadefault = datadefault_vvvvwab.some(datadefault_vvvvwab_SomeFunc);
// set this function logic
if (datadefault)
{
jQuery('#jform_datadefault_other').closest('.control-group').show();
if (jform_vvvvvzvvzn_required)
if (jform_vvvvwabvzp_required)
{
updateFieldRequired('datadefault_other',0);
jQuery('#jform_datadefault_other').prop('required','required');
jQuery('#jform_datadefault_other').attr('aria-required',true);
jQuery('#jform_datadefault_other').addClass('required');
jform_vvvvvzvvzn_required = false;
jform_vvvvwabvzp_required = false;
}
}
else
{
jQuery('#jform_datadefault_other').closest('.control-group').hide();
if (!jform_vvvvvzvvzn_required)
if (!jform_vvvvwabvzp_required)
{
updateFieldRequired('datadefault_other',1);
jQuery('#jform_datadefault_other').removeAttr('required');
jQuery('#jform_datadefault_other').removeAttr('aria-required');
jQuery('#jform_datadefault_other').removeClass('required');
jform_vvvvvzvvzn_required = true;
jform_vvvvwabvzp_required = true;
}
}
}
// the vvvvvzv Some function
function datadefault_vvvvvzv_SomeFunc(datadefault_vvvvvzv)
// the vvvvwab Some function
function datadefault_vvvvwab_SomeFunc(datadefault_vvvvwab)
{
// set the function logic
if (datadefault_vvvvvzv == 'Other')
if (datadefault_vvvvwab == 'Other')
{
return true;
}
return false;
}
// the vvvvvzw function
function vvvvvzw(datatype_vvvvvzw)
// the vvvvwac function
function vvvvwac(datatype_vvvvwac)
{
if (isSet(datatype_vvvvvzw) && datatype_vvvvvzw.constructor !== Array)
if (isSet(datatype_vvvvwac) && datatype_vvvvwac.constructor !== Array)
{
var temp_vvvvvzw = datatype_vvvvvzw;
var datatype_vvvvvzw = [];
datatype_vvvvvzw.push(temp_vvvvvzw);
var temp_vvvvwac = datatype_vvvvwac;
var datatype_vvvvwac = [];
datatype_vvvvwac.push(temp_vvvvwac);
}
else if (!isSet(datatype_vvvvvzw))
else if (!isSet(datatype_vvvvwac))
{
var datatype_vvvvvzw = [];
var datatype_vvvvwac = [];
}
var datatype = datatype_vvvvvzw.some(datatype_vvvvvzw_SomeFunc);
var datatype = datatype_vvvvwac.some(datatype_vvvvwac_SomeFunc);
// set this function logic
@ -196,13 +196,13 @@ function vvvvvzw(datatype_vvvvvzw)
jQuery('#jform_datadefault').closest('.control-group').show();
jQuery('#jform_datalenght').closest('.control-group').show();
jQuery('#jform_indexes').closest('.control-group').show();
if (jform_vvvvvzwvzo_required)
if (jform_vvvvwacvzq_required)
{
updateFieldRequired('indexes',0);
jQuery('#jform_indexes').prop('required','required');
jQuery('#jform_indexes').attr('aria-required',true);
jQuery('#jform_indexes').addClass('required');
jform_vvvvvzwvzo_required = false;
jform_vvvvwacvzq_required = false;
}
}
@ -211,109 +211,109 @@ function vvvvvzw(datatype_vvvvvzw)
jQuery('#jform_datadefault').closest('.control-group').hide();
jQuery('#jform_datalenght').closest('.control-group').hide();
jQuery('#jform_indexes').closest('.control-group').hide();
if (!jform_vvvvvzwvzo_required)
if (!jform_vvvvwacvzq_required)
{
updateFieldRequired('indexes',1);
jQuery('#jform_indexes').removeAttr('required');
jQuery('#jform_indexes').removeAttr('aria-required');
jQuery('#jform_indexes').removeClass('required');
jform_vvvvvzwvzo_required = true;
jform_vvvvwacvzq_required = true;
}
}
}
// the vvvvvzw Some function
function datatype_vvvvvzw_SomeFunc(datatype_vvvvvzw)
// the vvvvwac Some function
function datatype_vvvvwac_SomeFunc(datatype_vvvvwac)
{
// set the function logic
if (datatype_vvvvvzw == 'CHAR' || datatype_vvvvvzw == 'VARCHAR' || datatype_vvvvvzw == 'DATETIME' || datatype_vvvvvzw == 'DATE' || datatype_vvvvvzw == 'TIME' || datatype_vvvvvzw == 'INT' || datatype_vvvvvzw == 'TINYINT' || datatype_vvvvvzw == 'BIGINT' || datatype_vvvvvzw == 'FLOAT' || datatype_vvvvvzw == 'DECIMAL' || datatype_vvvvvzw == 'DOUBLE')
if (datatype_vvvvwac == 'CHAR' || datatype_vvvvwac == 'VARCHAR' || datatype_vvvvwac == 'DATETIME' || datatype_vvvvwac == 'DATE' || datatype_vvvvwac == 'TIME' || datatype_vvvvwac == 'INT' || datatype_vvvvwac == 'TINYINT' || datatype_vvvvwac == 'BIGINT' || datatype_vvvvwac == 'FLOAT' || datatype_vvvvwac == 'DECIMAL' || datatype_vvvvwac == 'DOUBLE')
{
return true;
}
return false;
}
// the vvvvvzx function
function vvvvvzx(datatype_vvvvvzx)
// the vvvvwad function
function vvvvwad(datatype_vvvvwad)
{
if (isSet(datatype_vvvvvzx) && datatype_vvvvvzx.constructor !== Array)
if (isSet(datatype_vvvvwad) && datatype_vvvvwad.constructor !== Array)
{
var temp_vvvvvzx = datatype_vvvvvzx;
var datatype_vvvvvzx = [];
datatype_vvvvvzx.push(temp_vvvvvzx);
var temp_vvvvwad = datatype_vvvvwad;
var datatype_vvvvwad = [];
datatype_vvvvwad.push(temp_vvvvwad);
}
else if (!isSet(datatype_vvvvvzx))
else if (!isSet(datatype_vvvvwad))
{
var datatype_vvvvvzx = [];
var datatype_vvvvwad = [];
}
var datatype = datatype_vvvvvzx.some(datatype_vvvvvzx_SomeFunc);
var datatype = datatype_vvvvwad.some(datatype_vvvvwad_SomeFunc);
// set this function logic
if (datatype)
{
jQuery('#jform_store').closest('.control-group').show();
if (jform_vvvvvzxvzp_required)
if (jform_vvvvwadvzr_required)
{
updateFieldRequired('store',0);
jQuery('#jform_store').prop('required','required');
jQuery('#jform_store').attr('aria-required',true);
jQuery('#jform_store').addClass('required');
jform_vvvvvzxvzp_required = false;
jform_vvvvwadvzr_required = false;
}
}
else
{
jQuery('#jform_store').closest('.control-group').hide();
if (!jform_vvvvvzxvzp_required)
if (!jform_vvvvwadvzr_required)
{
updateFieldRequired('store',1);
jQuery('#jform_store').removeAttr('required');
jQuery('#jform_store').removeAttr('aria-required');
jQuery('#jform_store').removeClass('required');
jform_vvvvvzxvzp_required = true;
jform_vvvvwadvzr_required = true;
}
}
}
// the vvvvvzx Some function
function datatype_vvvvvzx_SomeFunc(datatype_vvvvvzx)
// the vvvvwad Some function
function datatype_vvvvwad_SomeFunc(datatype_vvvvwad)
{
// set the function logic
if (datatype_vvvvvzx == 'CHAR' || datatype_vvvvvzx == 'VARCHAR' || datatype_vvvvvzx == 'TEXT' || datatype_vvvvvzx == 'MEDIUMTEXT' || datatype_vvvvvzx == 'LONGTEXT')
if (datatype_vvvvwad == 'CHAR' || datatype_vvvvwad == 'VARCHAR' || datatype_vvvvwad == 'TEXT' || datatype_vvvvwad == 'MEDIUMTEXT' || datatype_vvvvwad == 'LONGTEXT')
{
return true;
}
return false;
}
// the vvvvvzy function
function vvvvvzy(store_vvvvvzy,datatype_vvvvvzy)
// the vvvvwae function
function vvvvwae(store_vvvvwae,datatype_vvvvwae)
{
if (isSet(store_vvvvvzy) && store_vvvvvzy.constructor !== Array)
if (isSet(store_vvvvwae) && store_vvvvwae.constructor !== Array)
{
var temp_vvvvvzy = store_vvvvvzy;
var store_vvvvvzy = [];
store_vvvvvzy.push(temp_vvvvvzy);
var temp_vvvvwae = store_vvvvwae;
var store_vvvvwae = [];
store_vvvvwae.push(temp_vvvvwae);
}
else if (!isSet(store_vvvvvzy))
else if (!isSet(store_vvvvwae))
{
var store_vvvvvzy = [];
var store_vvvvwae = [];
}
var store = store_vvvvvzy.some(store_vvvvvzy_SomeFunc);
var store = store_vvvvwae.some(store_vvvvwae_SomeFunc);
if (isSet(datatype_vvvvvzy) && datatype_vvvvvzy.constructor !== Array)
if (isSet(datatype_vvvvwae) && datatype_vvvvwae.constructor !== Array)
{
var temp_vvvvvzy = datatype_vvvvvzy;
var datatype_vvvvvzy = [];
datatype_vvvvvzy.push(temp_vvvvvzy);
var temp_vvvvwae = datatype_vvvvwae;
var datatype_vvvvwae = [];
datatype_vvvvwae.push(temp_vvvvwae);
}
else if (!isSet(datatype_vvvvvzy))
else if (!isSet(datatype_vvvvwae))
{
var datatype_vvvvvzy = [];
var datatype_vvvvwae = [];
}
var datatype = datatype_vvvvvzy.some(datatype_vvvvvzy_SomeFunc);
var datatype = datatype_vvvvwae.some(datatype_vvvvwae_SomeFunc);
// set this function logic
@ -327,148 +327,148 @@ function vvvvvzy(store_vvvvvzy,datatype_vvvvvzy)
}
}
// the vvvvvzy Some function
function store_vvvvvzy_SomeFunc(store_vvvvvzy)
// the vvvvwae Some function
function store_vvvvwae_SomeFunc(store_vvvvwae)
{
// set the function logic
if (store_vvvvvzy == 4)
if (store_vvvvwae == 4)
{
return true;
}
return false;
}
// the vvvvvzy Some function
function datatype_vvvvvzy_SomeFunc(datatype_vvvvvzy)
// the vvvvwae Some function
function datatype_vvvvwae_SomeFunc(datatype_vvvvwae)
{
// set the function logic
if (datatype_vvvvvzy == 'CHAR' || datatype_vvvvvzy == 'VARCHAR' || datatype_vvvvvzy == 'TEXT' || datatype_vvvvvzy == 'MEDIUMTEXT' || datatype_vvvvvzy == 'LONGTEXT')
if (datatype_vvvvwae == 'CHAR' || datatype_vvvvwae == 'VARCHAR' || datatype_vvvvwae == 'TEXT' || datatype_vvvvwae == 'MEDIUMTEXT' || datatype_vvvvwae == 'LONGTEXT')
{
return true;
}
return false;
}
// the vvvvwaa function
function vvvvwaa(add_css_view_vvvvwaa)
// the vvvvwag function
function vvvvwag(add_css_view_vvvvwag)
{
// set the function logic
if (add_css_view_vvvvwaa == 1)
if (add_css_view_vvvvwag == 1)
{
jQuery('#jform_css_view').closest('.control-group').show();
if (jform_vvvvwaavzq_required)
if (jform_vvvvwagvzs_required)
{
updateFieldRequired('css_view',0);
jQuery('#jform_css_view').prop('required','required');
jQuery('#jform_css_view').attr('aria-required',true);
jQuery('#jform_css_view').addClass('required');
jform_vvvvwaavzq_required = false;
jform_vvvvwagvzs_required = false;
}
}
else
{
jQuery('#jform_css_view').closest('.control-group').hide();
if (!jform_vvvvwaavzq_required)
if (!jform_vvvvwagvzs_required)
{
updateFieldRequired('css_view',1);
jQuery('#jform_css_view').removeAttr('required');
jQuery('#jform_css_view').removeAttr('aria-required');
jQuery('#jform_css_view').removeClass('required');
jform_vvvvwaavzq_required = true;
jform_vvvvwagvzs_required = true;
}
}
}
// the vvvvwab function
function vvvvwab(add_css_views_vvvvwab)
// the vvvvwah function
function vvvvwah(add_css_views_vvvvwah)
{
// set the function logic
if (add_css_views_vvvvwab == 1)
if (add_css_views_vvvvwah == 1)
{
jQuery('#jform_css_views').closest('.control-group').show();
if (jform_vvvvwabvzr_required)
if (jform_vvvvwahvzt_required)
{
updateFieldRequired('css_views',0);
jQuery('#jform_css_views').prop('required','required');
jQuery('#jform_css_views').attr('aria-required',true);
jQuery('#jform_css_views').addClass('required');
jform_vvvvwabvzr_required = false;
jform_vvvvwahvzt_required = false;
}
}
else
{
jQuery('#jform_css_views').closest('.control-group').hide();
if (!jform_vvvvwabvzr_required)
if (!jform_vvvvwahvzt_required)
{
updateFieldRequired('css_views',1);
jQuery('#jform_css_views').removeAttr('required');
jQuery('#jform_css_views').removeAttr('aria-required');
jQuery('#jform_css_views').removeClass('required');
jform_vvvvwabvzr_required = true;
jform_vvvvwahvzt_required = true;
}
}
}
// the vvvvwac function
function vvvvwac(add_javascript_view_footer_vvvvwac)
// the vvvvwai function
function vvvvwai(add_javascript_view_footer_vvvvwai)
{
// set the function logic
if (add_javascript_view_footer_vvvvwac == 1)
if (add_javascript_view_footer_vvvvwai == 1)
{
jQuery('#jform_javascript_view_footer').closest('.control-group').show();
if (jform_vvvvwacvzs_required)
if (jform_vvvvwaivzu_required)
{
updateFieldRequired('javascript_view_footer',0);
jQuery('#jform_javascript_view_footer').prop('required','required');
jQuery('#jform_javascript_view_footer').attr('aria-required',true);
jQuery('#jform_javascript_view_footer').addClass('required');
jform_vvvvwacvzs_required = false;
jform_vvvvwaivzu_required = false;
}
}
else
{
jQuery('#jform_javascript_view_footer').closest('.control-group').hide();
if (!jform_vvvvwacvzs_required)
if (!jform_vvvvwaivzu_required)
{
updateFieldRequired('javascript_view_footer',1);
jQuery('#jform_javascript_view_footer').removeAttr('required');
jQuery('#jform_javascript_view_footer').removeAttr('aria-required');
jQuery('#jform_javascript_view_footer').removeClass('required');
jform_vvvvwacvzs_required = true;
jform_vvvvwaivzu_required = true;
}
}
}
// the vvvvwad function
function vvvvwad(add_javascript_views_footer_vvvvwad)
// the vvvvwaj function
function vvvvwaj(add_javascript_views_footer_vvvvwaj)
{
// set the function logic
if (add_javascript_views_footer_vvvvwad == 1)
if (add_javascript_views_footer_vvvvwaj == 1)
{
jQuery('#jform_javascript_views_footer').closest('.control-group').show();
if (jform_vvvvwadvzt_required)
if (jform_vvvvwajvzv_required)
{
updateFieldRequired('javascript_views_footer',0);
jQuery('#jform_javascript_views_footer').prop('required','required');
jQuery('#jform_javascript_views_footer').attr('aria-required',true);
jQuery('#jform_javascript_views_footer').addClass('required');
jform_vvvvwadvzt_required = false;
jform_vvvvwajvzv_required = false;
}
}
else
{
jQuery('#jform_javascript_views_footer').closest('.control-group').hide();
if (!jform_vvvvwadvzt_required)
if (!jform_vvvvwajvzv_required)
{
updateFieldRequired('javascript_views_footer',1);
jQuery('#jform_javascript_views_footer').removeAttr('required');
jQuery('#jform_javascript_views_footer').removeAttr('aria-required');
jQuery('#jform_javascript_views_footer').removeClass('required');
jform_vvvvwadvzt_required = true;
jform_vvvvwajvzv_required = true;
}
}
}

View File

@ -23,289 +23,289 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_vvvvwaevzw_required = false;
jform_vvvvwafvzx_required = false;
jform_vvvvwagvzy_required = false;
jform_vvvvwahvzz_required = false;
jform_vvvvwaiwaa_required = false;
jform_vvvvwajwab_required = false;
jform_vvvvwakvzy_required = false;
jform_vvvvwalvzz_required = false;
jform_vvvvwamwaa_required = false;
jform_vvvvwanwab_required = false;
jform_vvvvwaowac_required = false;
jform_vvvvwapwad_required = false;
// Initial Script
jQuery(document).ready(function()
{
var location_vvvvwae = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwae(location_vvvvwae);
var location_vvvvwak = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwak(location_vvvvwak);
var location_vvvvwaf = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwaf(location_vvvvwaf);
var location_vvvvwal = jQuery("#jform_location input[type='radio']:checked").val();
vvvvwal(location_vvvvwal);
var type_vvvvwag = jQuery("#jform_type").val();
vvvvwag(type_vvvvwag);
var type_vvvvwam = jQuery("#jform_type").val();
vvvvwam(type_vvvvwam);
var type_vvvvwah = jQuery("#jform_type").val();
vvvvwah(type_vvvvwah);
var type_vvvvwan = jQuery("#jform_type").val();
vvvvwan(type_vvvvwan);
var type_vvvvwai = jQuery("#jform_type").val();
vvvvwai(type_vvvvwai);
var type_vvvvwao = jQuery("#jform_type").val();
vvvvwao(type_vvvvwao);
var target_vvvvwaj = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwaj(target_vvvvwaj);
var target_vvvvwap = jQuery("#jform_target input[type='radio']:checked").val();
vvvvwap(target_vvvvwap);
});
// the vvvvwae function
function vvvvwae(location_vvvvwae)
// the vvvvwak function
function vvvvwak(location_vvvvwak)
{
// set the function logic
if (location_vvvvwae == 1)
if (location_vvvvwak == 1)
{
jQuery('#jform_admin_view').closest('.control-group').show();
if (jform_vvvvwaevzw_required)
if (jform_vvvvwakvzy_required)
{
updateFieldRequired('admin_view',0);
jQuery('#jform_admin_view').prop('required','required');
jQuery('#jform_admin_view').attr('aria-required',true);
jQuery('#jform_admin_view').addClass('required');
jform_vvvvwaevzw_required = false;
jform_vvvvwakvzy_required = false;
}
}
else
{
jQuery('#jform_admin_view').closest('.control-group').hide();
if (!jform_vvvvwaevzw_required)
if (!jform_vvvvwakvzy_required)
{
updateFieldRequired('admin_view',1);
jQuery('#jform_admin_view').removeAttr('required');
jQuery('#jform_admin_view').removeAttr('aria-required');
jQuery('#jform_admin_view').removeClass('required');
jform_vvvvwaevzw_required = true;
jform_vvvvwakvzy_required = true;
}
}
}
// the vvvvwaf function
function vvvvwaf(location_vvvvwaf)
// the vvvvwal function
function vvvvwal(location_vvvvwal)
{
// set the function logic
if (location_vvvvwaf == 2)
if (location_vvvvwal == 2)
{
jQuery('#jform_site_view').closest('.control-group').show();
if (jform_vvvvwafvzx_required)
if (jform_vvvvwalvzz_required)
{
updateFieldRequired('site_view',0);
jQuery('#jform_site_view').prop('required','required');
jQuery('#jform_site_view').attr('aria-required',true);
jQuery('#jform_site_view').addClass('required');
jform_vvvvwafvzx_required = false;
jform_vvvvwalvzz_required = false;
}
}
else
{
jQuery('#jform_site_view').closest('.control-group').hide();
if (!jform_vvvvwafvzx_required)
if (!jform_vvvvwalvzz_required)
{
updateFieldRequired('site_view',1);
jQuery('#jform_site_view').removeAttr('required');
jQuery('#jform_site_view').removeAttr('aria-required');
jQuery('#jform_site_view').removeClass('required');
jform_vvvvwafvzx_required = true;
jform_vvvvwalvzz_required = true;
}
}
}
// the vvvvwag function
function vvvvwag(type_vvvvwag)
// the vvvvwam function
function vvvvwam(type_vvvvwam)
{
if (isSet(type_vvvvwag) && type_vvvvwag.constructor !== Array)
if (isSet(type_vvvvwam) && type_vvvvwam.constructor !== Array)
{
var temp_vvvvwag = type_vvvvwag;
var type_vvvvwag = [];
type_vvvvwag.push(temp_vvvvwag);
var temp_vvvvwam = type_vvvvwam;
var type_vvvvwam = [];
type_vvvvwam.push(temp_vvvvwam);
}
else if (!isSet(type_vvvvwag))
else if (!isSet(type_vvvvwam))
{
var type_vvvvwag = [];
var type_vvvvwam = [];
}
var type = type_vvvvwag.some(type_vvvvwag_SomeFunc);
var type = type_vvvvwam.some(type_vvvvwam_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_vvvvwagvzy_required)
if (jform_vvvvwamwaa_required)
{
updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required');
jform_vvvvwagvzy_required = false;
jform_vvvvwamwaa_required = false;
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_vvvvwagvzy_required)
if (!jform_vvvvwamwaa_required)
{
updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required');
jform_vvvvwagvzy_required = true;
jform_vvvvwamwaa_required = true;
}
}
}
// the vvvvwag Some function
function type_vvvvwag_SomeFunc(type_vvvvwag)
// the vvvvwam Some function
function type_vvvvwam_SomeFunc(type_vvvvwam)
{
// set the function logic
if (type_vvvvwag == 3)
if (type_vvvvwam == 3)
{
return true;
}
return false;
}
// the vvvvwah function
function vvvvwah(type_vvvvwah)
// the vvvvwan function
function vvvvwan(type_vvvvwan)
{
if (isSet(type_vvvvwah) && type_vvvvwah.constructor !== Array)
if (isSet(type_vvvvwan) && type_vvvvwan.constructor !== Array)
{
var temp_vvvvwah = type_vvvvwah;
var type_vvvvwah = [];
type_vvvvwah.push(temp_vvvvwah);
var temp_vvvvwan = type_vvvvwan;
var type_vvvvwan = [];
type_vvvvwan.push(temp_vvvvwan);
}
else if (!isSet(type_vvvvwah))
else if (!isSet(type_vvvvwan))
{
var type_vvvvwah = [];
var type_vvvvwan = [];
}
var type = type_vvvvwah.some(type_vvvvwah_SomeFunc);
var type = type_vvvvwan.some(type_vvvvwan_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_vvvvwahvzz_required)
if (jform_vvvvwanwab_required)
{
updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required');
jform_vvvvwahvzz_required = false;
jform_vvvvwanwab_required = false;
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_vvvvwahvzz_required)
if (!jform_vvvvwanwab_required)
{
updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required');
jform_vvvvwahvzz_required = true;
jform_vvvvwanwab_required = true;
}
}
}
// the vvvvwah Some function
function type_vvvvwah_SomeFunc(type_vvvvwah)
// the vvvvwan Some function
function type_vvvvwan_SomeFunc(type_vvvvwan)
{
// set the function logic
if (type_vvvvwah == 1)
if (type_vvvvwan == 1)
{
return true;
}
return false;
}
// the vvvvwai function
function vvvvwai(type_vvvvwai)
// the vvvvwao function
function vvvvwao(type_vvvvwao)
{
if (isSet(type_vvvvwai) && type_vvvvwai.constructor !== Array)
if (isSet(type_vvvvwao) && type_vvvvwao.constructor !== Array)
{
var temp_vvvvwai = type_vvvvwai;
var type_vvvvwai = [];
type_vvvvwai.push(temp_vvvvwai);
var temp_vvvvwao = type_vvvvwao;
var type_vvvvwao = [];
type_vvvvwao.push(temp_vvvvwao);
}
else if (!isSet(type_vvvvwai))
else if (!isSet(type_vvvvwao))
{
var type_vvvvwai = [];
var type_vvvvwao = [];
}
var type = type_vvvvwai.some(type_vvvvwai_SomeFunc);
var type = type_vvvvwao.some(type_vvvvwao_SomeFunc);
// set this function logic
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_vvvvwaiwaa_required)
if (jform_vvvvwaowac_required)
{
updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required');
jform_vvvvwaiwaa_required = false;
jform_vvvvwaowac_required = false;
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_vvvvwaiwaa_required)
if (!jform_vvvvwaowac_required)
{
updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required');
jform_vvvvwaiwaa_required = true;
jform_vvvvwaowac_required = true;
}
}
}
// the vvvvwai Some function
function type_vvvvwai_SomeFunc(type_vvvvwai)
// the vvvvwao Some function
function type_vvvvwao_SomeFunc(type_vvvvwao)
{
// set the function logic
if (type_vvvvwai == 2)
if (type_vvvvwao == 2)
{
return true;
}
return false;
}
// the vvvvwaj function
function vvvvwaj(target_vvvvwaj)
// the vvvvwap function
function vvvvwap(target_vvvvwap)
{
// set the function logic
if (target_vvvvwaj == 1)
if (target_vvvvwap == 1)
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_vvvvwajwab_required)
if (jform_vvvvwapwad_required)
{
updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required');
jform_vvvvwajwab_required = false;
jform_vvvvwapwad_required = false;
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_vvvvwajwab_required)
if (!jform_vvvvwapwad_required)
{
updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required');
jform_vvvvwajwab_required = true;
jform_vvvvwapwad_required = true;
}
}
}

View File

@ -200,4 +200,76 @@ function getLayoutDetails(id){
});
}
})
}
// set snippets that are on the page
var snippetIds = [];
var snippets = {};
var snippet = 0;
jQuery(document).ready(function($)
{
jQuery("#jform_snippet option").each(function()
{
var key = jQuery(this).val();
var text = jQuery(this).text();
snippets[key] = text;
snippetIds.push(key);
});
snippet = jQuery("#jform_snippet").val();
getSnippets();
});
function getSnippets_server(libraries){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json";
if(token.length > 0 && libraries.length > 0){
var request = 'token='+token+'&libraries='+JSON.stringify(libraries);
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getSnippets(){
jQuery("#loading").show();
// clear the selection
jQuery('#jform_snippet').find('option').remove().end();
jQuery('#jform_snippet').trigger('liszt:updated');
// get country value if set
var libraries = jQuery("#jform_libraries").val();
if (libraries) {
getSnippets_server(libraries).done(function(result) {
setSnippets(result);
jQuery("#loading").hide();
if (typeof snippetButton !== 'undefined') {
// ensure button is correct
var snippet = jQuery('#jform_snippet').val();
snippetButton(snippet);
}
});
}
else
{
// load all snippets in none is selected
setSnippets(snippetIds);
jQuery("#loading").hide();
}
}
function setSnippets(array){
if (array) {
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
jQuery.each( array, function( i, id ) {
if (id in snippets) {
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
}
if (id == snippet) {
jQuery('#jform_snippet').val(id);
}
});
} else {
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
}
jQuery('#jform_snippet').trigger('liszt:updated');
}

View File

@ -150,11 +150,26 @@
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_LAYOUT_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_LAYOUT_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
button="true"
/>
<!-- Note_libraries_selection Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_selection" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_NOTE_LIBRARIES_SELECTION_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_selection" />
<!-- Layout Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="layout"
label="COM_COMPONENTBUILDER_LAYOUT_LAYOUT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_LAYOUT_LAYOUT_HINT"
required="true"
/>
<!-- Add_php_view Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -169,32 +184,32 @@
<option value="0">
COM_COMPONENTBUILDER_LAYOUT_NO</option>
</field>
<!-- Layout Field. Type: Textarea. (joomla) -->
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="textarea"
name="layout"
label="COM_COMPONENTBUILDER_LAYOUT_LAYOUT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_LAYOUT_LAYOUT_HINT"
required="true"
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_LAYOUT_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_LAYOUT_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_LAYOUT_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_LAYOUT_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Php_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"

View File

@ -22,4 +22,301 @@
/-----------------------------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_vvvvvzvvzm_required = false;
jform_vvvvvzvvzn_required = false;
// Initial Script
jQuery(document).ready(function()
{
var how_vvvvvzu = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzu(how_vvvvvzu);
var how_vvvvvzv = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzv(how_vvvvvzv);
var how_vvvvvzw = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzw(how_vvvvvzw);
var how_vvvvvzx = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzx(how_vvvvvzx);
var how_vvvvvzy = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzy(how_vvvvvzy);
var how_vvvvvzz = jQuery("#jform_how input[type='radio']:checked").val();
vvvvvzz(how_vvvvvzz);
});
// the vvvvvzu function
function vvvvvzu(how_vvvvvzu)
{
// set the function logic
if (how_vvvvvzu == 2)
{
jQuery('#jform_addconditions-lbl').closest('.control-group').show();
}
else
{
jQuery('#jform_addconditions-lbl').closest('.control-group').hide();
}
}
// the vvvvvzv function
function vvvvvzv(how_vvvvvzv)
{
// set the function logic
if (how_vvvvvzv == 3)
{
jQuery('#jform_php_setdocument').closest('.control-group').show();
if (jform_vvvvvzvvzm_required)
{
updateFieldRequired('php_setdocument',0);
jQuery('#jform_php_setdocument').prop('required','required');
jQuery('#jform_php_setdocument').attr('aria-required',true);
jQuery('#jform_php_setdocument').addClass('required');
jform_vvvvvzvvzm_required = false;
}
jQuery('#jform_php_preparedocument').closest('.control-group').show();
if (jform_vvvvvzvvzn_required)
{
updateFieldRequired('php_preparedocument',0);
jQuery('#jform_php_preparedocument').prop('required','required');
jQuery('#jform_php_preparedocument').attr('aria-required',true);
jQuery('#jform_php_preparedocument').addClass('required');
jform_vvvvvzvvzn_required = false;
}
}
else
{
jQuery('#jform_php_setdocument').closest('.control-group').hide();
if (!jform_vvvvvzvvzm_required)
{
updateFieldRequired('php_setdocument',1);
jQuery('#jform_php_setdocument').removeAttr('required');
jQuery('#jform_php_setdocument').removeAttr('aria-required');
jQuery('#jform_php_setdocument').removeClass('required');
jform_vvvvvzvvzm_required = true;
}
jQuery('#jform_php_preparedocument').closest('.control-group').hide();
if (!jform_vvvvvzvvzn_required)
{
updateFieldRequired('php_preparedocument',1);
jQuery('#jform_php_preparedocument').removeAttr('required');
jQuery('#jform_php_preparedocument').removeAttr('aria-required');
jQuery('#jform_php_preparedocument').removeClass('required');
jform_vvvvvzvvzn_required = true;
}
}
}
// the vvvvvzw function
function vvvvvzw(how_vvvvvzw)
{
// set the function logic
if (how_vvvvvzw == 2 || how_vvvvvzw == 3)
{
jQuery('.note_display_library_config').closest('.control-group').show();
}
else
{
jQuery('.note_display_library_config').closest('.control-group').hide();
}
}
// the vvvvvzx function
function vvvvvzx(how_vvvvvzx)
{
// set the function logic
if (how_vvvvvzx == 1 || how_vvvvvzx == 2 || how_vvvvvzx == 3)
{
jQuery('.note_display_library_files_folders_urls').closest('.control-group').show();
}
else
{
jQuery('.note_display_library_files_folders_urls').closest('.control-group').hide();
}
}
// the vvvvvzy function
function vvvvvzy(how_vvvvvzy)
{
// set the function logic
if (how_vvvvvzy == 0)
{
jQuery('.note_no_behaviour_one').closest('.control-group').show();
jQuery('.note_no_behaviour_three').closest('.control-group').show();
jQuery('.note_no_behaviour_two').closest('.control-group').show();
}
else
{
jQuery('.note_no_behaviour_one').closest('.control-group').hide();
jQuery('.note_no_behaviour_three').closest('.control-group').hide();
jQuery('.note_no_behaviour_two').closest('.control-group').hide();
}
}
// the vvvvvzz function
function vvvvvzz(how_vvvvvzz)
{
// set the function logic
if (how_vvvvvzz == 1)
{
jQuery('.note_yes_behaviour_one').closest('.control-group').show();
jQuery('.note_yes_behaviour_two').closest('.control-group').show();
}
else
{
jQuery('.note_yes_behaviour_one').closest('.control-group').hide();
jQuery('.note_yes_behaviour_two').closest('.control-group').hide();
}
}
// update required fields
function updateFieldRequired(name,status)
{
var not_required = jQuery('#jform_not_required').val();
if(status == 1)
{
if (isSet(not_required) && not_required != 0)
{
not_required = not_required+','+name;
}
else
{
not_required = ','+name;
}
}
else
{
if (isSet(not_required) && not_required != 0)
{
not_required = not_required.replace(','+name,'');
}
}
jQuery('#jform_not_required').val(not_required);
}
// the isSet function
function isSet(val)
{
if ((val != undefined) && (val != null) && 0 !== val.length){
return true;
}
return false;
}
jQuery(document).ready(function()
{
// now load the displays
getAjaxDisplay('library_config');
getAjaxDisplay('library_files_folders_urls');
});
function addData(result,where){
jQuery(result).insertAfter(jQuery(where).closest('.control-group'));
}
function addButtonID_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0 && size > 0){
var request = 'token='+token+'&type='+type+'&size='+size;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function addButtonID(type, where, size){
addButtonID_server(type, size).done(function(result) {
if(result){
if (2 == size) {
jQuery('#'+where).html(result);
} else {
addData(result, '#jform_'+where);
}
}
});
}
function addButton_server(type){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function addButton(type,where){
addButton_server(type).done(function(result) {
if(result){
addData(result,'#jform_'+where);
}
})
}
function getAjaxDisplay(type){
getAjaxDisplay_server(type).done(function(result) {
if(result){
jQuery('#display_'+type).html(result);
}
// set button
addButtonID(type,'header_'+type+'_buttons', 2); // <-- little edit button
});
}
function getAjaxDisplay_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&vdm="+vastDevMod;
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type=' + type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getFieldSelectOptions_server(fieldId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json";
if(token.length > 0 && fieldId > 0){
var request = 'token='+token+'&id='+fieldId;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getFieldSelectOptions(fieldKey){
// first check if the field is set
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field").length) {
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field option:selected").val();
getFieldSelectOptions_server(fieldId).done(function(result) {
if(result){
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__field_options').val(result);
}
else
{
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__field_options').val('');
}
});
}
}

View File

@ -122,6 +122,189 @@
message="COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_MESSAGE"
hint="COM_COMPONENTBUILDER_LIBRARY_DESCRIPTION_HINT"
/>
<!-- How Field. Type: Radio. (joomla) -->
<field
type="radio"
name="how"
label="COM_COMPONENTBUILDER_LIBRARY_HOW_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_HOW_DESCRIPTION"
class="btn-group btn-group-yesno"
default="2"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_LIBRARY_ALWAYS_ADD</option>
<option value="2">
COM_COMPONENTBUILDER_LIBRARY_CONDITIONS</option>
<option value="3">
COM_COMPONENTBUILDER_LIBRARY_CUSTOM_SCRIPT</option>
<option value="0">
COM_COMPONENTBUILDER_LIBRARY_DO_NOT_ADD</option>
</field>
<!-- Note_display_library_files_folders_urls Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_display_library_files_folders_urls" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_DISPLAY_LIBRARY_FILES_FOLDERS_URLS_DESCRIPTION" class="note_display_library_files_folders_urls" />
<!-- Php_setdocument Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_setdocument"
label="COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_LIBRARY_PHP_SETDOCUMENT_HINT"
required="true"
/>
<!-- Addconditions Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addconditions"
label="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_ADDCONDITIONS_DESCRIPTION"
icon="list"
maximum="500">
<form hidden="true" name="list_addconditions_modal" repeat="true">
<!-- File Field. Type: Libraryfiles. (custom) -->
<field
type="libraryfiles"
name="file"
label="COM_COMPONENTBUILDER_LIBRARY_FILE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILE_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="false"
/>
<!-- Target_behavior Field. Type: List. (joomla) -->
<field
type="list"
name="target_behavior"
label="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_TARGET_BEHAVIOR_DESCRIPTION"
class="list_class"
multiple="false"
filter="INT"
required="false"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_LIBRARY_INCLUDE</option>
<option value="2">
COM_COMPONENTBUILDER_LIBRARY_EXCLUDE</option>
</field>
<!-- Target_relation Field. Type: List. (joomla) -->
<field
type="list"
name="target_relation"
label="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_TARGET_RELATION_DESCRIPTION"
class="list_class"
multiple="false"
filter="INT"
required="false"
default="0">
<!-- Option Set. -->
<option value="0">
COM_COMPONENTBUILDER_LIBRARY_ISOLATE</option>
<option value="1">
COM_COMPONENTBUILDER_LIBRARY_CHAIN</option>
</field>
<!-- Option_field Field. Type: Libconfigfield. (custom) -->
<field
type="libconfigfield"
name="option_field"
label="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_OPTION_FIELD_DESCRIPTION"
multiple="false"
required="false"
button="false"
/>
<!-- Option_behaviour Field. Type: List. (joomla) -->
<field
type="list"
name="option_behaviour"
label="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_OPTION_BEHAVIOUR_DESCRIPTION"
class="list_class"
multiple="false"
filter="INT"
required="false"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_LIBRARY_IS_ONLY_FOUR_LISTRADIOCHECKBOXES</option>
<option value="2">
COM_COMPONENTBUILDER_LIBRARY_IS_NOT_ONLY_FOUR_LISTRADIOCHECKBOXES</option>
<option value="3">
COM_COMPONENTBUILDER_LIBRARY_ANY_SELECTION_ONLY_FOUR_LISTRADIOCHECKBOXESDYNAMIC_LIST</option>
<option value="4">
COM_COMPONENTBUILDER_LIBRARY_ACTIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="5">
COM_COMPONENTBUILDER_LIBRARY_UNACTIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="6">
COM_COMPONENTBUILDER_LIBRARY_KEY_WORD_ALL_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="7">
COM_COMPONENTBUILDER_LIBRARY_KEY_WORD_ANY_CASESENSITIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="8">
COM_COMPONENTBUILDER_LIBRARY_KEY_WORD_ALL_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="9">
COM_COMPONENTBUILDER_LIBRARY_KEY_WORD_ANY_CASEINSENSITIVE_ONLY_FOUR_TEXT_FIELD</option>
<option value="10">
COM_COMPONENTBUILDER_LIBRARY_MIN_LENGTH_ONLY_FOUR_TEXT_FIELD</option>
<option value="11">
COM_COMPONENTBUILDER_LIBRARY_MAX_LENGTH_ONLY_FOUR_TEXT_FIELD</option>
<option value="12">
COM_COMPONENTBUILDER_LIBRARY_EXACT_LENGTH_ONLY_FOUR_TEXT_FIELD</option>
</field>
<!-- Field_options Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="field_options"
label="COM_COMPONENTBUILDER_LIBRARY_FIELD_OPTIONS_LABEL"
rows="10"
cols="5"
class="text_area"
filter="STRING"
hint="COM_COMPONENTBUILDER_LIBRARY_FIELD_OPTIONS_HINT"
required="false"
/>
</form>
</field>
<!-- Php_preparedocument Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_preparedocument"
label="COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_LIBRARY_PHP_PREPAREDOCUMENT_HINT"
required="true"
/>
<!-- Note_yes_behaviour_two Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_yes_behaviour_two" label="COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_TWO_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_TWO_DESCRIPTION" heading="h4" class="alert alert-success note_yes_behaviour_two" />
<!-- Note_yes_behaviour_one Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_yes_behaviour_one" label="COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_YES_BEHAVIOUR_ONE_DESCRIPTION" heading="h4" class="alert alert-success note_yes_behaviour_one" />
<!-- Note_no_behaviour_three Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_no_behaviour_three" label="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_THREE_DESCRIPTION" heading="h4" class="alert alert-error note_no_behaviour_three" />
<!-- Note_no_behaviour_one Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_no_behaviour_one" label="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_ONE_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_ONE_DESCRIPTION" heading="h4" class="alert alert-error note_no_behaviour_one" />
<!-- Note_no_behaviour_two Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_no_behaviour_two" label="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_NO_BEHAVIOUR_TWO_DESCRIPTION" heading="h4" class="alert alert-error note_no_behaviour_two" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Note_display_library_config Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_display_library_config" description="COM_COMPONENTBUILDER_LIBRARY_NOTE_DISPLAY_LIBRARY_CONFIG_DESCRIPTION" class="note_display_library_config" />
</fieldset>
<!-- Access Control Fields. -->

View File

@ -0,0 +1,25 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage library_config.js
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/

View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
>
<fieldset name="details">
<!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CREATED_DATE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- User Created Field. Type: User (joomla) -->
<field
name="created_by"
type="user"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CREATED_BY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CREATED_BY_DESC"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_MODIFIED_BY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_VERSION_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Library Field. Type: Libraryreadonly. (custom) -->
<field
type="libraryreadonly"
name="library"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_LIBRARY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_LIBRARY_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="true"
readonly="true"
/>
<!-- Addconfig Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addconfig"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_ADDCONFIG_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_ADDCONFIG_DESCRIPTION"
icon="list"
maximum="500"
filter="ARRAY">
<form hidden="true" name="list_addconfig_modal" repeat="true">
<!-- Field Field. Type: Fields. (custom) -->
<field
type="fields"
name="field"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_FIELD_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_FIELD_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
button="false"
/>
<!-- Custom_value Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="custom_value"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CUSTOM_VALUE_LABEL"
rows="2"
cols="4"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CUSTOM_VALUE_DESCRIPTION"
class="text_area"
hint="COM_COMPONENTBUILDER_LIBRARY_CONFIG_CUSTOM_VALUE_HINT"
required="false"
readonly="false"
disabled="false"
/>
<!-- Tabname Field. Type: Text. (joomla) -->
<field
type="text"
name="tabname"
label="COM_COMPONENTBUILDER_LIBRARY_CONFIG_TABNAME_LABEL"
size="40"
maxlength="150"
default="Library"
description="COM_COMPONENTBUILDER_LIBRARY_CONFIG_TABNAME_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="STRING"
message="COM_COMPONENTBUILDER_LIBRARY_CONFIG_TABNAME_MESSAGE"
hint="COM_COMPONENTBUILDER_LIBRARY_CONFIG_TABNAME_HINT"
/>
</form>
</field>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this library_config"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_componentbuilder"
section="library_config"
/>
</fieldset>
</form>

View File

@ -0,0 +1,25 @@
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage library_files_folders_urls.js
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/

View File

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="utf-8"?>
<form
addrulepath="/administrator/components/com_componentbuilder/models/rules"
addfieldpath="/administrator/components/com_componentbuilder/models/fields"
>
<fieldset name="details">
<!-- Default Fields. -->
<!-- Id Field. Type: Text (joomla) -->
<field
name="id"
type="text" class="readonly" label="JGLOBAL_FIELD_ID_LABEL"
description ="JGLOBAL_FIELD_ID_DESC" size="10" default="0"
readonly="true"
/>
<!-- Date Created Field. Type: Calendar (joomla) -->
<field
name="created"
type="calendar"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_CREATED_DATE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_CREATED_DATE_DESC"
size="22"
format="%Y-%m-%d %H:%M:%S"
filter="user_utc"
/>
<!-- User Created Field. Type: User (joomla) -->
<field
name="created_by"
type="user"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_CREATED_BY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_CREATED_BY_DESC"
/>
<!-- Published Field. Type: List (joomla) -->
<field name="published" type="list" label="JSTATUS"
description="JFIELD_PUBLISHED_DESC" class="chzn-color-state"
filter="intval" size="1" default="1" >
<option value="1">
JPUBLISHED</option>
<option value="0">
JUNPUBLISHED</option>
<option value="2">
JARCHIVED</option>
<option value="-2">
JTRASHED</option>
</field>
<!-- Date Modified Field. Type: Calendar (joomla) -->
<field name="modified" type="calendar" class="readonly"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_DATE_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_DATE_DESC"
size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
<!-- User Modified Field. Type: User (joomla) -->
<field name="modified_by" type="user"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_BY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_MODIFIED_BY_DESC"
class="readonly"
readonly="true"
filter="unset"
/>
<!-- Access Field. Type: Accesslevel (joomla) -->
<field name="access"
type="accesslevel"
label="JFIELD_ACCESS_LABEL"
description="JFIELD_ACCESS_DESC"
default="1"
required="false"
/>
<!-- Ordering Field. Type: Numbers (joomla) -->
<field
name="ordering"
type="number"
class="inputbox validate-ordering"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ORDERING_LABEL"
description=""
default="0"
size="6"
required="false"
/>
<!-- Version Field. Type: Text (joomla) -->
<field
name="version"
type="text"
class="readonly"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_VERSION_DESC"
size="6"
readonly="true"
filter="unset"
/>
<!-- Dynamic Fields. -->
<!-- Library Field. Type: Libraryreadonly. (custom) -->
<field
type="libraryreadonly"
name="library"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_LIBRARY_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_LIBRARY_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="true"
readonly="true"
/>
<!-- Note_add_folders Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_folders" label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FOLDERS_DESCRIPTION" heading="h4" class="alert alert-info note_add_folders" />
<!-- Addurls Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addurls"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDURLS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDURLS_DESCRIPTION"
icon="list"
maximum="500">
<form hidden="true" name="list_addurls_modal" repeat="true">
<!-- Url Field. Type: Url. (joomla) -->
<field
type="url"
name="url"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_LABEL"
size="150"
maxlength="250"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_DESCRIPTION"
class="text_area"
required="false"
filter="url"
validated="url"
message="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_MESSAGE"
hint="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_URL_HINT"
/>
<!-- Type Field. Type: List. (joomla) -->
<field
type="list"
name="type"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_TYPE_DESCRIPTION"
class="list_class"
multiple="false"
filter="INT"
required="false"
default="1">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_DEFAULT_LINK</option>
<option value="2">
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_LOCAL_GET</option>
<option value="3">
COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_LINK_LOCAL_DYNAMIC</option>
</field>
</form>
</field>
<!-- Note_add_urls Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_urls" label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_URLS_DESCRIPTION" heading="h4" class="alert alert-info note_add_urls" />
<!-- Note_add_files Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_files" label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_LABEL" description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTE_ADD_FILES_DESCRIPTION" heading="h4" class="alert alert-info note_add_files" />
<!-- Addfolders Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addfolders"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFOLDERS_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFOLDERS_DESCRIPTION"
icon="list"
maximum="500">
<form hidden="true" name="list_addfolders_modal" repeat="true">
<!-- Folder Field. Type: Customfolderlist. (custom) -->
<field
type="customfolderlist"
name="folder"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FOLDER_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FOLDER_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="false"
button="false"
/>
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_LABEL"
size="40"
maxlength="150"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="PATH"
message="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_MESSAGE"
hint="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_HINT"
/>
<!-- Rename Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="rename"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_RENAME_LABEL"
value="1"
required="false"
class="inputbox"
/>
</form>
</field>
<!-- Addfiles Field. Type: Subform. (joomla) -->
<field
type="subform"
name="addfiles"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFILES_LABEL"
layout="joomla.form.field.subform.repeatable-table"
multiple="true"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_ADDFILES_DESCRIPTION"
icon="list"
maximum="500">
<form hidden="true" name="list_addfiles_modal" repeat="true">
<!-- File Field. Type: Customfilelist. (custom) -->
<field
type="customfilelist"
name="file"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FILE_LABEL"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_FILE_DESCRIPTION"
class="list_class"
multiple="false"
default="0"
required="false"
button="false"
/>
<!-- Path Field. Type: Text. (joomla) -->
<field
type="text"
name="path"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_LABEL"
size="40"
maxlength="150"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_DESCRIPTION"
class="text_area"
readonly="false"
disabled="false"
required="false"
filter="PATH"
message="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_MESSAGE"
hint="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_PATH_HINT"
/>
<!-- Notnew Field. Type: Checkbox. (joomla) -->
<field
type="checkbox"
name="notnew"
label="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_LABEL"
value="1"
required="false"
description="COM_COMPONENTBUILDER_LIBRARY_FILES_FOLDERS_URLS_NOTNEW_DESCRIPTION"
class="inputbox"
/>
</form>
</field>
</fieldset>
<!-- Access Control Fields. -->
<fieldset name="accesscontrol">
<!-- Asset Id Field. Type: Hidden (joomla) -->
<field
name="asset_id"
type="hidden"
filter="unset"
/>
<!-- Rules Field. Type: Rules (joomla) -->
<field
name="rules"
type="rules"
label="Permissions in relation to this library_files_folders_urls"
translate_label="false"
filter="rules"
validate="rules"
class="inputbox"
component="com_componentbuilder"
section="library_files_folders_urls"
/>
</fieldset>
</form>

View File

@ -571,4 +571,76 @@ function getTemplateDetails(id){
});
}
})
}
// set snippets that are on the page
var snippetIds = [];
var snippets = {};
var snippet = 0;
jQuery(document).ready(function($)
{
jQuery("#jform_snippet option").each(function()
{
var key = jQuery(this).val();
var text = jQuery(this).text();
snippets[key] = text;
snippetIds.push(key);
});
snippet = jQuery("#jform_snippet").val();
getSnippets();
});
function getSnippets_server(libraries){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json";
if(token.length > 0 && libraries.length > 0){
var request = 'token='+token+'&libraries='+JSON.stringify(libraries);
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getSnippets(){
jQuery("#loading").show();
// clear the selection
jQuery('#jform_snippet').find('option').remove().end();
jQuery('#jform_snippet').trigger('liszt:updated');
// get country value if set
var libraries = jQuery("#jform_libraries").val();
if (libraries) {
getSnippets_server(libraries).done(function(result) {
setSnippets(result);
jQuery("#loading").hide();
if (typeof snippetButton !== 'undefined') {
// ensure button is correct
var snippet = jQuery('#jform_snippet').val();
snippetButton(snippet);
}
});
}
else
{
// load all snippets in none is selected
setSnippets(snippetIds);
jQuery("#loading").hide();
}
}
function setSnippets(array){
if (array) {
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
jQuery.each( array, function( i, id ) {
if (id in snippets) {
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
}
if (id == snippet) {
jQuery('#jform_snippet').val(id);
}
});
} else {
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
}
jQuery('#jform_snippet').trigger('liszt:updated');
}

View File

@ -153,11 +153,37 @@
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_SITE_VIEW_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_SITE_VIEW_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
button="true"
/>
<!-- Js_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="js_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_HINT"
required="true"
/>
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_SITE_VIEW_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_SITE_VIEW_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Css Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -171,8 +197,8 @@
hint="COM_COMPONENTBUILDER_SITE_VIEW_CSS_HINT"
required="true"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Add_php_document Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -187,61 +213,8 @@
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Js_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="js_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_JS_DOCUMENT_HINT"
required="true"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Css_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_HINT"
required="true"
/>
<!-- Default Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="default"
label="COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_HINT"
required="true"
/>
<!-- Php_ajaxmethod Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_ajaxmethod"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_HINT"
required="true"
/>
<!-- Note_libraries_selection Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_selection" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_LIBRARIES_SELECTION_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_LIBRARIES_SELECTION_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_selection" />
<!-- Add_php_jview_display Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -256,6 +229,36 @@
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Css_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="css_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_CSS_DOCUMENT_HINT"
required="true"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Php_ajaxmethod Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_ajaxmethod"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_AJAXMETHOD_HINT"
required="true"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Add_php_view Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -270,6 +273,32 @@
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Default Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="default"
label="COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_LABEL"
rows="20"
cols="15"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_DEFAULT_HINT"
required="true"
/>
<!-- Add_php_jview Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_jview"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_SITE_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Php_model Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -283,11 +312,30 @@
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_MODEL_HINT"
required="false"
/>
<!-- Add_php_jview Field. Type: Radio. (joomla) -->
<!-- Php_controller Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_controller"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_HINT"
required="false"
/>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Add_js_document Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_php_jview"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_PHP_JVIEW_LABEL"
name="add_js_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_JS_DOCUMENT_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
@ -297,12 +345,6 @@
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Custom_get Field. Type: Customgets. (custom) -->
<field
type="customgets"
@ -311,11 +353,11 @@
description="COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM_GET_DESCRIPTION"
multiple="true"
/>
<!-- Add_js_document Field. Type: Radio. (joomla) -->
<!-- Add_css_document Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_js_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_JS_DOCUMENT_LABEL"
name="add_css_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_DOCUMENT_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
@ -335,11 +377,11 @@
required="true"
button="true"
/>
<!-- Add_css_document Field. Type: Radio. (joomla) -->
<!-- Add_css Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_DOCUMENT_LABEL"
name="add_css"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
@ -358,22 +400,6 @@
multiple="false"
required="false"
/>
<!-- Add_css Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_css"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CSS_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_SITE_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_SITE_VIEW_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Add_php_ajax Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -388,20 +414,8 @@
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Add_custom_button Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_button"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_SITE_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_SITE_VIEW_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_SITE_VIEW_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Ajax_input Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -534,6 +548,33 @@
/>
</form>
</field>
<!-- Add_custom_button Field. Type: Radio. (joomla) -->
<field
type="radio"
name="add_custom_button"
label="COM_COMPONENTBUILDER_SITE_VIEW_ADD_CUSTOM_BUTTON_LABEL"
class="btn-group btn-group-yesno"
default="0"
required="true">
<!-- Option Set. -->
<option value="1">
COM_COMPONENTBUILDER_SITE_VIEW_YES</option>
<option value="0">
COM_COMPONENTBUILDER_SITE_VIEW_NO</option>
</field>
<!-- Php_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_HINT"
required="true"
/>
<!-- Button_position Field. Type: List. (joomla) -->
<field
type="list"
@ -559,21 +600,6 @@
<option value="5">
COM_COMPONENTBUILDER_SITE_VIEW_CUSTOM</option>
</field>
<!-- Php_document Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_document"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_DOCUMENT_HINT"
required="true"
/>
<!-- Note_custom_toolbar_placeholder Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_custom_toolbar_placeholder" description="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_CUSTOM_TOOLBAR_PLACEHOLDER_DESCRIPTION" heading="h4" class="note_custom_toolbar_placeholder" showon="button_position:5" />
<!-- Php_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -587,6 +613,21 @@
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_VIEW_HINT"
required="true"
/>
<!-- Note_custom_toolbar_placeholder Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_custom_toolbar_placeholder" description="COM_COMPONENTBUILDER_SITE_VIEW_NOTE_CUSTOM_TOOLBAR_PLACEHOLDER_DESCRIPTION" heading="h4" class="note_custom_toolbar_placeholder" showon="button_position:5" />
<!-- Php_jview_display Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview_display"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_HINT"
required="true"
/>
<!-- Custom_button Field. Type: Subform. (joomla) -->
<field
type="subform"
@ -1096,32 +1137,6 @@
</field>
</form>
</field>
<!-- Php_jview_display Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_jview_display"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_LABEL"
rows="17"
cols="5"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_JVIEW_DISPLAY_HINT"
required="true"
/>
<!-- Php_controller Field. Type: Textarea. (joomla) -->
<field
type="textarea"
name="php_controller"
label="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_LABEL"
rows="30"
cols="15"
description="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_DESCRIPTION"
class="text_area span12"
filter="raw"
hint="COM_COMPONENTBUILDER_SITE_VIEW_PHP_CONTROLLER_HINT"
required="false"
/>
<!-- Php_jview Field. Type: Textarea. (joomla) -->
<field
type="textarea"

View File

@ -226,4 +226,76 @@ function getTemplateDetails(id){
});
}
})
}
// set snippets that are on the page
var snippetIds = [];
var snippets = {};
var snippet = 0;
jQuery(document).ready(function($)
{
jQuery("#jform_snippet option").each(function()
{
var key = jQuery(this).val();
var text = jQuery(this).text();
snippets[key] = text;
snippetIds.push(key);
});
snippet = jQuery("#jform_snippet").val();
getSnippets();
});
function getSnippets_server(libraries){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&format=json";
if(token.length > 0 && libraries.length > 0){
var request = 'token='+token+'&libraries='+JSON.stringify(libraries);
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'jsonp',
data: request,
jsonp: 'callback'
});
}
function getSnippets(){
jQuery("#loading").show();
// clear the selection
jQuery('#jform_snippet').find('option').remove().end();
jQuery('#jform_snippet').trigger('liszt:updated');
// get country value if set
var libraries = jQuery("#jform_libraries").val();
if (libraries) {
getSnippets_server(libraries).done(function(result) {
setSnippets(result);
jQuery("#loading").hide();
if (typeof snippetButton !== 'undefined') {
// ensure button is correct
var snippet = jQuery('#jform_snippet').val();
snippetButton(snippet);
}
});
}
else
{
// load all snippets in none is selected
setSnippets(snippetIds);
jQuery("#loading").hide();
}
}
function setSnippets(array){
if (array) {
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
jQuery.each( array, function( i, id ) {
if (id in snippets) {
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
}
if (id == snippet) {
jQuery('#jform_snippet').val(id);
}
});
} else {
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
}
jQuery('#jform_snippet').trigger('liszt:updated');
}

View File

@ -140,6 +140,7 @@
type="snippets"
name="snippet"
label="COM_COMPONENTBUILDER_TEMPLATE_SNIPPET_LABEL"
description="COM_COMPONENTBUILDER_TEMPLATE_SNIPPET_DESCRIPTION"
class="list_class"
multiple="false"
required="false"
@ -155,6 +156,22 @@
required="false"
button="true"
/>
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Libraries Field. Type: Libraries. (custom) -->
<field
type="libraries"
name="libraries"
label="COM_COMPONENTBUILDER_TEMPLATE_LIBRARIES_LABEL"
description="COM_COMPONENTBUILDER_TEMPLATE_LIBRARIES_DESCRIPTION"
class="list_class"
multiple="true"
default="0"
required="false"
button="true"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Add_php_view Field. Type: Radio. (joomla) -->
<field
type="radio"
@ -169,6 +186,18 @@
<option value="0">
COM_COMPONENTBUILDER_TEMPLATE_NO</option>
</field>
<!-- Note_libraries_selection Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_libraries_selection" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_NOTE_LIBRARIES_SELECTION_DESCRIPTION" heading="h4" class="alert alert-info note_libraries_selection" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Template Field. Type: Textarea. (joomla) -->
<field
type="textarea"
@ -181,20 +210,6 @@
hint="COM_COMPONENTBUILDER_TEMPLATE_TEMPLATE_HINT"
required="true"
/>
<!-- Note_snippet_usage Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_snippet_usage" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_SNIPPET_USAGE_LABEL" heading="h4" class="snippet-usage note_snippet_usage" />
<!-- Not_required Field. Type: Hidden. (joomla) -->
<field
type="hidden"
name="not_required"
default="[]"
/>
<!-- Note_uikit_snippet Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_uikit_snippet" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_UIKIT_SNIPPET_LABEL" heading="h4" class="snippet-code note_uikit_snippet" />
<!-- Dynamic_values Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="dynamic_values" label="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_VALUES_DESCRIPTION" heading="h4" class="dynamic_values" />
<!-- Note_add_language_string Field. Type: Note. A None Database Field. (joomla) -->
<field type="note" name="note_add_language_string" label="COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_LANGUAGE_STRING_LABEL" description="COM_COMPONENTBUILDER_TEMPLATE_NOTE_ADD_LANGUAGE_STRING_DESCRIPTION" heading="h4" class="note_add_language_string" />
<!-- Php_view Field. Type: Textarea. (joomla) -->
<field
type="textarea"

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -122,7 +122,7 @@ class ComponentbuilderModelFtp extends JModelAdmin
*
* @return mixed An array of data items on success, false on failure.
*/
public function getVzvlinked_components()
public function getVzxlinked_components()
{
// Get the user object.
$user = JFactory::getUser();

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelHelp_document extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -84,7 +84,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelLanguage extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -84,7 +84,7 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -95,6 +95,14 @@ class ComponentbuilderModelLayout extends JModelAdmin
$item->metadata = $registry->toArray();
}
if (!empty($item->libraries))
{
// Convert the libraries field to an array.
$libraries = new Registry;
$libraries->loadString($item->libraries);
$item->libraries = $libraries->toArray();
}
if (!empty($item->layout))
{
// base64 Decode layout.
@ -830,6 +838,19 @@ class ComponentbuilderModelLayout extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the libraries items to data.
if (isset($data['libraries']) && is_array($data['libraries']))
{
$libraries = new JRegistry;
$libraries->loadArray($data['libraries']);
$data['libraries'] = (string) $libraries;
}
elseif (!isset($data['libraries']))
{
// Set the empty libraries to data
$data['libraries'] = '';
}
// Set the layout string to base64 string.
if (isset($data['layout']))
{

View File

@ -122,10 +122,46 @@ class ComponentbuilderModelLibraries extends JModelList
}
}
}
}
// set selection value to a translatable value
if (ComponentbuilderHelper::checkArray($items))
{
foreach ($items as $nr => &$item)
{
// convert how
$item->how = $this->selectionTranslation($item->how, 'how');
}
}
// return items
return $items;
}
/**
* Method to convert selection values to translatable string.
*
* @return translatable string
*/
public function selectionTranslation($value,$name)
{
// Array of how language strings
if ($name === 'how')
{
$howArray = array(
1 => 'COM_COMPONENTBUILDER_LIBRARY_ALWAYS_ADD',
2 => 'COM_COMPONENTBUILDER_LIBRARY_CONDITIONS',
3 => 'COM_COMPONENTBUILDER_LIBRARY_CUSTOM_SCRIPT',
0 => 'COM_COMPONENTBUILDER_LIBRARY_DO_NOT_ADD'
);
// Now check if value is found in this array
if (isset($howArray[$value]) && ComponentbuilderHelper::checkString($howArray[$value]))
{
return $howArray[$value];
}
}
return $value;
}
/**

View File

@ -0,0 +1,256 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libraries_config.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/**
* Libraries_config Model
*/
class ComponentbuilderModelLibraries_config extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by'
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
$this->setState('filter.created_by', $created_by);
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
// check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('library_config.access', 'com_componentbuilder.library_config.' . (int) $item->id) && $user->authorise('library_config.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// return items
return $items;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_library_config', 'a'));
// From the componentbuilder_library table.
$query->select($db->quoteName('g.name','library_name'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'g') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('g.id') . ')');
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
return parent::getStoreId($id);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__componentbuilder_library_config'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__componentbuilder_library_config'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

View File

@ -0,0 +1,256 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage libraries_files_folders_urls.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import the Joomla modellist library
jimport('joomla.application.component.modellist');
/**
* Libraries_files_folders_urls Model
*/
class ComponentbuilderModelLibraries_files_folders_urls extends JModelList
{
public function __construct($config = array())
{
if (empty($config['filter_fields']))
{
$config['filter_fields'] = array(
'a.id','id',
'a.published','published',
'a.ordering','ordering',
'a.created_by','created_by',
'a.modified_by','modified_by'
);
}
parent::__construct($config);
}
/**
* Method to auto-populate the model state.
*
* @return void
*/
protected function populateState($ordering = null, $direction = null)
{
$app = JFactory::getApplication();
// Adjust the context to support modal layouts.
if ($layout = $app->input->get('layout'))
{
$this->context .= '.' . $layout;
}
$sorting = $this->getUserStateFromRequest($this->context . '.filter.sorting', 'filter_sorting', 0, 'int');
$this->setState('filter.sorting', $sorting);
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
$this->setState('filter.search', $search);
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$created_by = $this->getUserStateFromRequest($this->context . '.filter.created_by', 'filter_created_by', '');
$this->setState('filter.created_by', $created_by);
$created = $this->getUserStateFromRequest($this->context . '.filter.created', 'filter_created');
$this->setState('filter.created', $created);
// List state information.
parent::populateState($ordering, $direction);
}
/**
* Method to get an array of data items.
*
* @return mixed An array of data items on success, false on failure.
*/
public function getItems()
{
// check in items
$this->checkInNow();
// load parent items
$items = parent::getItems();
// set values to display correctly.
if (ComponentbuilderHelper::checkArray($items))
{
// get user object.
$user = JFactory::getUser();
foreach ($items as $nr => &$item)
{
$access = ($user->authorise('library_files_folders_urls.access', 'com_componentbuilder.library_files_folders_urls.' . (int) $item->id) && $user->authorise('library_files_folders_urls.access', 'com_componentbuilder'));
if (!$access)
{
unset($items[$nr]);
continue;
}
}
}
// return items
return $items;
}
/**
* Method to build an SQL query to load the list data.
*
* @return string An SQL query
*/
protected function getListQuery()
{
// Get the user object.
$user = JFactory::getUser();
// Create a new query object.
$db = JFactory::getDBO();
$query = $db->getQuery(true);
// Select some fields
$query->select('a.*');
// From the componentbuilder_item table
$query->from($db->quoteName('#__componentbuilder_library_files_folders_urls', 'a'));
// From the componentbuilder_library table.
$query->select($db->quoteName('g.name','library_name'));
$query->join('LEFT', $db->quoteName('#__componentbuilder_library', 'g') . ' ON (' . $db->quoteName('a.library') . ' = ' . $db->quoteName('g.id') . ')');
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published))
{
$query->where('a.published = ' . (int) $published);
}
elseif ($published === '')
{
$query->where('(a.published = 0 OR a.published = 1)');
}
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access'))
{
$query->where('a.access = ' . (int) $access);
}
// Implement View Level Access
if (!$user->authorise('core.options', 'com_componentbuilder'))
{
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('a.access IN (' . $groups . ')');
}
// Add the list ordering clause.
$orderCol = $this->state->get('list.ordering', 'a.id');
$orderDirn = $this->state->get('list.direction', 'asc');
if ($orderCol != '')
{
$query->order($db->escape($orderCol . ' ' . $orderDirn));
}
return $query;
}
/**
* Method to get a store id based on model configuration state.
*
* @return string A store id.
*
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':' . $this->getState('filter.id');
$id .= ':' . $this->getState('filter.search');
$id .= ':' . $this->getState('filter.published');
$id .= ':' . $this->getState('filter.ordering');
$id .= ':' . $this->getState('filter.created_by');
$id .= ':' . $this->getState('filter.modified_by');
return parent::getStoreId($id);
}
/**
* Build an SQL query to checkin all items left checked out longer then a set time.
*
* @return a bool
*
*/
protected function checkInNow()
{
// Get set check in time
$time = JComponentHelper::getParams('com_componentbuilder')->get('check_in');
if ($time)
{
// Get a db connection.
$db = JFactory::getDbo();
// reset query
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__componentbuilder_library_files_folders_urls'));
$db->setQuery($query);
$db->execute();
if ($db->getNumRows())
{
// Get Yesterdays date
$date = JFactory::getDate()->modify($time)->toSql();
// reset query
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
$db->quoteName('checked_out_time') . '=\'0000-00-00 00:00:00\'',
$db->quoteName('checked_out') . '=0'
);
// Conditions for which records should be updated.
$conditions = array(
$db->quoteName('checked_out') . '!=0',
$db->quoteName('checked_out_time') . '<\''.$date.'\''
);
// Check table
$query->update($db->quoteName('#__componentbuilder_library_files_folders_urls'))->set($fields)->where($conditions);
$db->setQuery($query);
$db->execute();
}
}
return false;
}
}

View File

@ -64,6 +64,11 @@ class ComponentbuilderModelLibrary extends JModelAdmin
public function getTable($type = 'library', $prefix = 'ComponentbuilderTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
public function getVDM()
{
return $this->vastDevMod;
}
/**
@ -79,7 +84,7 @@ class ComponentbuilderModelLibrary extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -93,7 +98,48 @@ class ComponentbuilderModelLibrary extends JModelAdmin
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->addconditions))
{
// Convert the addconditions field to an array.
$addconditions = new Registry;
$addconditions->loadString($item->addconditions);
$item->addconditions = $addconditions->toArray();
}
if (!empty($item->php_setdocument))
{
// base64 Decode php_setdocument.
$item->php_setdocument = base64_decode($item->php_setdocument);
}
if (!empty($item->php_preparedocument))
{
// base64 Decode php_preparedocument.
$item->php_preparedocument = base64_decode($item->php_preparedocument);
}
if (empty($item->id))
{
$id = 0;
}
else
{
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('library__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'library__'.$id);
ComponentbuilderHelper::set('library__'.$id, $this->vastDevMod);
}
if (!empty($item->id))
{
@ -348,6 +394,42 @@ class ComponentbuilderModelLibrary extends JModelAdmin
}
return $data;
}
/**
* Method to validate the form data.
*
* @param JForm $form The form to validate against.
* @param array $data The data to validate.
* @param string $group The name of the field group to validate.
*
* @return mixed Array of filtered data if valid, false otherwise.
*
* @see JFormRule
* @see JFilterInput
* @since 12.2
*/
public function validate($form, $data, $group = null)
{
// check if the not_required field is set
if (ComponentbuilderHelper::checkString($data['not_required']))
{
$requiredFields = (array) explode(',',(string) $data['not_required']);
$requiredFields = array_unique($requiredFields);
// now change the required field attributes value
foreach ($requiredFields as $requiredField)
{
// make sure there is a string value
if (ComponentbuilderHelper::checkString($requiredField))
{
// change to false
$form->setFieldAttribute($requiredField, 'required', 'false');
// also clear the data set
$data[$requiredField] = '';
}
}
}
return parent::validate($form, $data, $group);
}
/**
@ -372,10 +454,49 @@ class ComponentbuilderModelLibrary extends JModelAdmin
* @since 12.2
*/
public function delete(&$pks)
{
{
// insure the locked library are not deleted
$app = JFactory::getApplication();
foreach ($pks as $nr => $pk)
{
// remove if it is a locked library
if ($pk > 0 && isset(ComponentbuilderHelper::$libraryNames[$pk]))
{
// do not allow delete
unset($pks[$nr]);
// set a message to remind them not to delete these libraries (since they are locked)
$app->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_BSB_LIBRARY_CAN_NOT_BE_DELETED_OR_THINGS_WILL_BREAK', ComponentbuilderHelper::$libraryNames[$pk]), 'warning');
}
}
// check if we can still continue
if (!ComponentbuilderHelper::checkArray($pks))
{
return false;
}
if (!parent::delete($pks))
{
return false;
}
// we must also delete the linked tables found
if (ComponentbuilderHelper::checkArray($pks))
{
$_tablesArray = array(
'snippet',
'library_config',
'library_files_folders_urls'
);
foreach($_tablesArray as $_updateTable)
{
// get the linked IDs
if ($_pks = ComponentbuilderHelper::getVars($_updateTable, $pks, 'library', 'id'))
{
// load the model
$_Model = ComponentbuilderHelper::getModel($_updateTable);
// change publish state
$_Model->delete($_pks);
}
}
}
return true;
@ -396,6 +517,27 @@ class ComponentbuilderModelLibrary extends JModelAdmin
if (!parent::publish($pks, $value))
{
return false;
}
// we must also update all linked tables
if (ComponentbuilderHelper::checkArray($pks))
{
$_tablesArray = array(
'snippet',
'library_config',
'library_files_folders_urls'
);
foreach($_tablesArray as $_updateTable)
{
// get the linked IDs
if ($_pks = ComponentbuilderHelper::getVars($_updateTable, $pks, 'library', 'id'))
{
// load the model
$_Model = ComponentbuilderHelper::getModel($_updateTable);
// change publish state
$_Model->publish($_pks, $value);
}
}
}
return true;
@ -780,7 +922,47 @@ class ComponentbuilderModelLibrary extends JModelAdmin
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
}
// Set the addconditions items to data.
if (isset($data['addconditions']) && is_array($data['addconditions']))
{
$addconditions = new JRegistry;
$addconditions->loadArray($data['addconditions']);
$data['addconditions'] = (string) $addconditions;
}
elseif (!isset($data['addconditions']))
{
// Set the empty addconditions to data
$data['addconditions'] = '';
}
// Set the php_setdocument string to base64 string.
if (isset($data['php_setdocument']))
{
$data['php_setdocument'] = base64_encode($data['php_setdocument']);
}
// Set the php_preparedocument string to base64 string.
if (isset($data['php_preparedocument']))
{
$data['php_preparedocument'] = base64_encode($data['php_preparedocument']);
}
// insure the locked library names are not changed
if ($data['id'] > 0 && isset(ComponentbuilderHelper::$libraryNames[$data['id']]))
{
// check if it has or is being changed
if (ComponentbuilderHelper::$libraryNames[$data['id']] !== $data['name'])
{
// the wrong name
$name_ = $data['name'];
// change it back
$data['name'] = ComponentbuilderHelper::$libraryNames[$data['id']];
// give a notice that the name can not be changed
JFactory::getApplication()->enqueueMessage(JText::sprintf('COM_COMPONENTBUILDER_THE_NAME_OF_THIS_LIBRARY_BSB_CAN_NOT_BE_CHANGED_TO_BSB_OR_THINGS_WILL_BREAK', $data['name'], $name_), 'warning');
}
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))

View File

@ -0,0 +1,882 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage library_config.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/**
* Componentbuilder Library_config Model
*/
class ComponentbuilderModelLibrary_config extends JModelAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_COMPONENTBUILDER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_componentbuilder.library_config';
/**
* Returns a Table object, always creating it
*
* @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A database object
*
* @since 1.6
*/
public function getTable($type = 'library_config', $prefix = 'ComponentbuilderTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->addconfig))
{
// Convert the addconfig field to an array.
$addconfig = new Registry;
$addconfig->loadString($item->addconfig);
$item->addconfig = $addconfig->toArray();
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_componentbuilder.library_config');
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_componentbuilder.library_config', 'library_config', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('library_config.edit.state', 'com_componentbuilder.library_config.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_config.edit.state', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('library_config.edit.created_by', 'com_componentbuilder.library_config.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_config.edit.created_by', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('library_config.edit.created', 'com_componentbuilder.library_config.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_config.edit.created', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING');
// Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string script files
*/
public function getScript()
{
return 'administrator/components/com_componentbuilder/models/forms/library_config.js';
}
/**
* Method to test whether a record can be deleted.
*
* @param object $record A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canDelete($record)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
return $user->authorise('library_config.delete', 'com_componentbuilder.library_config.' . (int) $record->id);
}
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('library_config.edit.state', 'com_componentbuilder.library_config.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('library_config.edit.state', 'com_componentbuilder');
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
* @since 2.5
*/
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
$user = JFactory::getUser();
return $user->authorise('library_config.edit', 'com_componentbuilder.library_config.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('library_config.edit', 'com_componentbuilder');
}
/**
* Prepare and sanitise the table data prior to saving.
*
* @param JTable $table A JTable object.
*
* @return void
*
* @since 1.6
*/
protected function prepareTable($table)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if (isset($table->name))
{
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
}
if (isset($table->alias) && empty($table->alias))
{
$table->generateAlias();
}
if (empty($table->id))
{
$table->created = $date->toSql();
// set the user
if ($table->created_by == 0 || empty($table->created_by))
{
$table->created_by = $user->id;
}
// Set ordering to the last item if not set
if (empty($table->ordering))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('MAX(ordering)')
->from($db->quoteName('#__componentbuilder_library_config'));
$db->setQuery($query);
$max = $db->loadResult();
$table->ordering = $max + 1;
}
}
else
{
$table->modified = $date->toSql();
$table->modified_by = $user->id;
}
if (!empty($table->id))
{
// Increment the items version number.
$table->version++;
}
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.library_config.data', array());
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
protected function getUniqeFields()
{
return false;
}
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
{
if (!parent::delete($pks))
{
return false;
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
JArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_config');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_config');
}
if (!$this->canDo->get('library_config.create') && !$this->canDo->get('library_config.batch'))
{
return false;
}
// get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('library_config.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('library_config.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
$this->table->library = $this->generateUniqe('library',$this->table->library);
// insert all set values
if (ComponentbuilderHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all uniqe fields
if (ComponentbuilderHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
{
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_config');
}
if (!$this->canDo->get('library_config.edit') && !$this->canDo->get('library_config.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('library_config.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('library_config.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (ComponentbuilderHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$this->cleanCache();
return true;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
// Set the addconfig items to data.
if (isset($data['addconfig']) && is_array($data['addconfig']))
{
$addconfig = new JRegistry;
$addconfig->loadArray($data['addconfig']);
$data['addconfig'] = (string) $addconfig;
}
elseif (!isset($data['addconfig']))
{
// Set the empty addconfig to data
$data['addconfig'] = '';
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Alter the uniqe field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (ComponentbuilderHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
{
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
}
}
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a uniqe value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUniqe($field,$value)
{
// set field value uniqe
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = JString::increment($value);
}
return $value;
}
/**
* Method to change the title & alias.
*
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
*/
protected function _generateNewTitle($title)
{
// Alter the title
$table = $this->getTable();
while ($table->load(array('title' => $title)))
{
$title = JString::increment($title);
}
return $title;
}
}

View File

@ -0,0 +1,924 @@
<?php
/*--------------------------------------------------------------------------------------------------------| www.vdm.io |------/
__ __ _ _____ _ _ __ __ _ _ _
\ \ / / | | | __ \ | | | | | \/ | | | | | | |
\ \ / /_ _ ___| |_ | | | | _____ _____| | ___ _ __ _ __ ___ ___ _ __ | |_ | \ / | ___| |_| |__ ___ __| |
\ \/ / _` / __| __| | | | |/ _ \ \ / / _ \ |/ _ \| '_ \| '_ ` _ \ / _ \ '_ \| __| | |\/| |/ _ \ __| '_ \ / _ \ / _` |
\ / (_| \__ \ |_ | |__| | __/\ V / __/ | (_) | |_) | | | | | | __/ | | | |_ | | | | __/ |_| | | | (_) | (_| |
\/ \__,_|___/\__| |_____/ \___| \_/ \___|_|\___/| .__/|_| |_| |_|\___|_| |_|\__| |_| |_|\___|\__|_| |_|\___/ \__,_|
| |
|_|
/-------------------------------------------------------------------------------------------------------------------------------/
@version 2.6.x
@created 30th April, 2015
@package Component Builder
@subpackage library_files_folders_urls.php
@author Llewellyn van der Merwe <http://vdm.bz/component-builder>
@github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
Builds Complex Joomla Components
/-----------------------------------------------------------------------------------------------------------------------------*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\Registry\Registry;
// import Joomla modelform library
jimport('joomla.application.component.modeladmin');
/**
* Componentbuilder Library_files_folders_urls Model
*/
class ComponentbuilderModelLibrary_files_folders_urls extends JModelAdmin
{
/**
* @var string The prefix to use with controller messages.
* @since 1.6
*/
protected $text_prefix = 'COM_COMPONENTBUILDER';
/**
* The type alias for this content type.
*
* @var string
* @since 3.2
*/
public $typeAlias = 'com_componentbuilder.library_files_folders_urls';
/**
* Returns a Table object, always creating it
*
* @param type $type The table type to instantiate
* @param string $prefix A prefix for the table class name. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return JTable A database object
*
* @since 1.6
*/
public function getTable($type = 'library_files_folders_urls', $prefix = 'ComponentbuilderTable', $config = array())
{
return JTable::getInstance($type, $prefix, $config);
}
/**
* Method to get a single record.
*
* @param integer $pk The id of the primary key.
*
* @return mixed Object on success, false on failure.
*
* @since 1.6
*/
public function getItem($pk = null)
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
$registry->loadString($item->params);
$item->params = $registry->toArray();
}
if (!empty($item->metadata))
{
// Convert the metadata field to an array.
$registry = new Registry;
$registry->loadString($item->metadata);
$item->metadata = $registry->toArray();
}
if (!empty($item->addurls))
{
// Convert the addurls field to an array.
$addurls = new Registry;
$addurls->loadString($item->addurls);
$item->addurls = $addurls->toArray();
}
if (!empty($item->addfolders))
{
// Convert the addfolders field to an array.
$addfolders = new Registry;
$addfolders->loadString($item->addfolders);
$item->addfolders = $addfolders->toArray();
}
if (!empty($item->addfiles))
{
// Convert the addfiles field to an array.
$addfiles = new Registry;
$addfiles->loadString($item->addfiles);
$item->addfiles = $addfiles->toArray();
}
if (!empty($item->id))
{
$item->tags = new JHelperTags;
$item->tags->getTagIds($item->id, 'com_componentbuilder.library_files_folders_urls');
}
}
return $item;
}
/**
* Method to get the record form.
*
* @param array $data Data for the form.
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
*
* @return mixed A JForm object on success, false on failure
*
* @since 1.6
*/
public function getForm($data = array(), $loadData = true)
{
// Get the form.
$form = $this->loadForm('com_componentbuilder.library_files_folders_urls', 'library_files_folders_urls', array('control' => 'jform', 'load_data' => $loadData));
if (empty($form))
{
return false;
}
$jinput = JFactory::getApplication()->input;
// The front end calls this model and uses a_id to avoid id clashes so we need to check for that first.
if ($jinput->get('a_id'))
{
$id = $jinput->get('a_id', 0, 'INT');
}
// The back end uses id so we use that the rest of the time and set it to 0 by default.
else
{
$id = $jinput->get('id', 0, 'INT');
}
$user = JFactory::getUser();
// Check for existing item.
// Modify the form based on Edit State access controls.
if ($id != 0 && (!$user->authorise('library_files_folders_urls.edit.state', 'com_componentbuilder.library_files_folders_urls.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_files_folders_urls.edit.state', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('ordering', 'disabled', 'true');
$form->setFieldAttribute('published', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('ordering', 'filter', 'unset');
$form->setFieldAttribute('published', 'filter', 'unset');
}
// If this is a new item insure the greated by is set.
if (0 == $id)
{
// Set the created_by to this user
$form->setValue('created_by', null, $user->id);
}
// Modify the form based on Edit Creaded By access controls.
if ($id != 0 && (!$user->authorise('library_files_folders_urls.edit.created_by', 'com_componentbuilder.library_files_folders_urls.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_files_folders_urls.edit.created_by', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created_by', 'disabled', 'true');
// Disable fields for display.
$form->setFieldAttribute('created_by', 'readonly', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created_by', 'filter', 'unset');
}
// Modify the form based on Edit Creaded Date access controls.
if ($id != 0 && (!$user->authorise('library_files_folders_urls.edit.created', 'com_componentbuilder.library_files_folders_urls.' . (int) $id))
|| ($id == 0 && !$user->authorise('library_files_folders_urls.edit.created', 'com_componentbuilder')))
{
// Disable fields for display.
$form->setFieldAttribute('created', 'disabled', 'true');
// Disable fields while saving.
$form->setFieldAttribute('created', 'filter', 'unset');
}
// Only load these values if no id is found
if (0 == $id)
{
// Set redirected field name
$redirectedField = $jinput->get('ref', null, 'STRING');
// Set redirected field value
$redirectedValue = $jinput->get('refid', 0, 'INT');
if (0 != $redirectedValue && $redirectedField)
{
// Now set the local-redirected field default value
$form->setValue($redirectedField, null, $redirectedValue);
}
}
return $form;
}
/**
* Method to get the script that have to be included on the form
*
* @return string script files
*/
public function getScript()
{
return 'administrator/components/com_componentbuilder/models/forms/library_files_folders_urls.js';
}
/**
* Method to test whether a record can be deleted.
*
* @param object $record A record object.
*
* @return boolean True if allowed to delete the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canDelete($record)
{
if (!empty($record->id))
{
if ($record->published != -2)
{
return;
}
$user = JFactory::getUser();
// The record has been set. Check the record permissions.
return $user->authorise('library_files_folders_urls.delete', 'com_componentbuilder.library_files_folders_urls.' . (int) $record->id);
}
return false;
}
/**
* Method to test whether a record can have its state edited.
*
* @param object $record A record object.
*
* @return boolean True if allowed to change the state of the record. Defaults to the permission set in the component.
*
* @since 1.6
*/
protected function canEditState($record)
{
$user = JFactory::getUser();
$recordId = (!empty($record->id)) ? $record->id : 0;
if ($recordId)
{
// The record has been set. Check the record permissions.
$permission = $user->authorise('library_files_folders_urls.edit.state', 'com_componentbuilder.library_files_folders_urls.' . (int) $recordId);
if (!$permission && !is_null($permission))
{
return false;
}
}
// In the absense of better information, revert to the component permissions.
return $user->authorise('library_files_folders_urls.edit.state', 'com_componentbuilder');
}
/**
* Method override to check if you can edit an existing record.
*
* @param array $data An array of input data.
* @param string $key The name of the key for the primary key.
*
* @return boolean
* @since 2.5
*/
protected function allowEdit($data = array(), $key = 'id')
{
// Check specific edit permission then general edit permission.
$user = JFactory::getUser();
return $user->authorise('library_files_folders_urls.edit', 'com_componentbuilder.library_files_folders_urls.'. ((int) isset($data[$key]) ? $data[$key] : 0)) or $user->authorise('library_files_folders_urls.edit', 'com_componentbuilder');
}
/**
* Prepare and sanitise the table data prior to saving.
*
* @param JTable $table A JTable object.
*
* @return void
*
* @since 1.6
*/
protected function prepareTable($table)
{
$date = JFactory::getDate();
$user = JFactory::getUser();
if (isset($table->name))
{
$table->name = htmlspecialchars_decode($table->name, ENT_QUOTES);
}
if (isset($table->alias) && empty($table->alias))
{
$table->generateAlias();
}
if (empty($table->id))
{
$table->created = $date->toSql();
// set the user
if ($table->created_by == 0 || empty($table->created_by))
{
$table->created_by = $user->id;
}
// Set ordering to the last item if not set
if (empty($table->ordering))
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select('MAX(ordering)')
->from($db->quoteName('#__componentbuilder_library_files_folders_urls'));
$db->setQuery($query);
$max = $db->loadResult();
$table->ordering = $max + 1;
}
}
else
{
$table->modified = $date->toSql();
$table->modified_by = $user->id;
}
if (!empty($table->id))
{
// Increment the items version number.
$table->version++;
}
}
/**
* Method to get the data that should be injected in the form.
*
* @return mixed The data for the form.
*
* @since 1.6
*/
protected function loadFormData()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState('com_componentbuilder.edit.library_files_folders_urls.data', array());
if (empty($data))
{
$data = $this->getItem();
}
return $data;
}
/**
* Method to get the unique fields of this table.
*
* @return mixed An array of field names, boolean false if none is set.
*
* @since 3.0
*/
protected function getUniqeFields()
{
return false;
}
/**
* Method to delete one or more records.
*
* @param array &$pks An array of record primary keys.
*
* @return boolean True if successful, false if an error occurs.
*
* @since 12.2
*/
public function delete(&$pks)
{
if (!parent::delete($pks))
{
return false;
}
return true;
}
/**
* Method to change the published state of one or more records.
*
* @param array &$pks A list of the primary keys to change.
* @param integer $value The value of the published state.
*
* @return boolean True on success.
*
* @since 12.2
*/
public function publish(&$pks, $value = 1)
{
if (!parent::publish($pks, $value))
{
return false;
}
return true;
}
/**
* Method to perform batch operations on an item or a set of items.
*
* @param array $commands An array of commands to perform.
* @param array $pks An array of item ids.
* @param array $contexts An array of item contexts.
*
* @return boolean Returns true on success, false on failure.
*
* @since 12.2
*/
public function batch($commands, $pks, $contexts)
{
// Sanitize ids.
$pks = array_unique($pks);
JArrayHelper::toInteger($pks);
// Remove any values of zero.
if (array_search(0, $pks, true))
{
unset($pks[array_search(0, $pks, true)]);
}
if (empty($pks))
{
$this->setError(JText::_('JGLOBAL_NO_ITEM_SELECTED'));
return false;
}
$done = false;
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls');
$this->batchSet = true;
if (!$this->canDo->get('core.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
if ($this->type == false)
{
$type = new JUcmType;
$this->type = $type->getTypeByAlias($this->typeAlias);
}
$this->tagsObserver = $this->table->getObserverOfClass('JTableObserverTags');
if (!empty($commands['move_copy']))
{
$cmd = JArrayHelper::getValue($commands, 'move_copy', 'c');
if ($cmd == 'c')
{
$result = $this->batchCopy($commands, $pks, $contexts);
if (is_array($result))
{
foreach ($result as $old => $new)
{
$contexts[$new] = $contexts[$old];
}
$pks = array_values($result);
}
else
{
return false;
}
}
elseif ($cmd == 'm' && !$this->batchMove($commands, $pks, $contexts))
{
return false;
}
$done = true;
}
if (!$done)
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_INSUFFICIENT_BATCH_INFORMATION'));
return false;
}
// Clear the cache
$this->cleanCache();
return true;
}
/**
* Batch copy items to a new category or current.
*
* @param integer $values The new values.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return mixed An array of new IDs on success, boolean false on failure.
*
* @since 12.2
*/
protected function batchCopy($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls');
}
if (!$this->canDo->get('library_files_folders_urls.create') && !$this->canDo->get('library_files_folders_urls.batch'))
{
return false;
}
// get list of uniqe fields
$uniqeFields = $this->getUniqeFields();
// remove move_copy from array
unset($values['move_copy']);
// make sure published is set
if (!isset($values['published']))
{
$values['published'] = 0;
}
elseif (isset($values['published']) && !$this->canDo->get('library_files_folders_urls.edit.state'))
{
$values['published'] = 0;
}
$newIds = array();
// Parent exists so let's proceed
while (!empty($pks))
{
// Pop the first ID off the stack
$pk = array_shift($pks);
$this->table->reset();
// only allow copy if user may edit this item.
if (!$this->user->authorise('library_files_folders_urls.edit', $contexts[$pk]))
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
$this->table->library = $this->generateUniqe('library',$this->table->library);
// insert all set values
if (ComponentbuilderHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
if (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// update all uniqe fields
if (ComponentbuilderHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
{
$this->table->$uniqeField = $this->generateUniqe($uniqeField,$this->table->$uniqeField);
}
}
// Reset the ID because we are making a copy
$this->table->id = 0;
// TODO: Deal with ordering?
// $this->table->ordering = 1;
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
// Get the new item ID
$newId = $this->table->get('id');
// Add the new ID to the array
$newIds[$pk] = $newId;
}
// Clean the cache
$this->cleanCache();
return $newIds;
}
/**
* Batch move items to a new category
*
* @param integer $value The new category ID.
* @param array $pks An array of row IDs.
* @param array $contexts An array of item contexts.
*
* @return boolean True if successful, false otherwise and internal error is set.
*
* @since 12.2
*/
protected function batchMove($values, $pks, $contexts)
{
if (empty($this->batchSet))
{
// Set some needed variables.
$this->user = JFactory::getUser();
$this->table = $this->getTable();
$this->tableClassName = get_class($this->table);
$this->contentType = new JUcmType;
$this->type = $this->contentType->getTypeByTable($this->tableClassName);
$this->canDo = ComponentbuilderHelper::getActions('library_files_folders_urls');
}
if (!$this->canDo->get('library_files_folders_urls.edit') && !$this->canDo->get('library_files_folders_urls.batch'))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// make sure published only updates if user has the permission.
if (isset($values['published']) && !$this->canDo->get('library_files_folders_urls.edit.state'))
{
unset($values['published']);
}
// remove move_copy from array
unset($values['move_copy']);
// Parent exists so we proceed
foreach ($pks as $pk)
{
if (!$this->user->authorise('library_files_folders_urls.edit', $contexts[$pk]))
{
$this->setError(JText::_('JLIB_APPLICATION_ERROR_BATCH_CANNOT_EDIT'));
return false;
}
// Check that the row actually exists
if (!$this->table->load($pk))
{
if ($error = $this->table->getError())
{
// Fatal error
$this->setError($error);
return false;
}
else
{
// Not fatal error
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_BATCH_MOVE_ROW_NOT_FOUND', $pk));
continue;
}
}
// insert all set values.
if (ComponentbuilderHelper::checkArray($values))
{
foreach ($values as $key => $value)
{
// Do special action for access.
if ('access' === $key && strlen($value) > 0)
{
$this->table->$key = $value;
}
elseif (strlen($value) > 0 && isset($this->table->$key))
{
$this->table->$key = $value;
}
}
}
// Check the row.
if (!$this->table->check())
{
$this->setError($this->table->getError());
return false;
}
if (!empty($this->type))
{
$this->createTagsHelper($this->tagsObserver, $this->type, $pk, $this->typeAlias, $this->table);
}
// Store the row.
if (!$this->table->store())
{
$this->setError($this->table->getError());
return false;
}
}
// Clean the cache
$this->cleanCache();
return true;
}
/**
* Method to save the form data.
*
* @param array $data The form data.
*
* @return boolean True on success.
*
* @since 1.6
*/
public function save($data)
{
$input = JFactory::getApplication()->input;
$filter = JFilterInput::getInstance();
// set the metadata to the Item Data
if (isset($data['metadata']) && isset($data['metadata']['author']))
{
$data['metadata']['author'] = $filter->clean($data['metadata']['author'], 'TRIM');
$metadata = new JRegistry;
$metadata->loadArray($data['metadata']);
$data['metadata'] = (string) $metadata;
}
// Set the addurls items to data.
if (isset($data['addurls']) && is_array($data['addurls']))
{
$addurls = new JRegistry;
$addurls->loadArray($data['addurls']);
$data['addurls'] = (string) $addurls;
}
elseif (!isset($data['addurls']))
{
// Set the empty addurls to data
$data['addurls'] = '';
}
// Set the addfolders items to data.
if (isset($data['addfolders']) && is_array($data['addfolders']))
{
$addfolders = new JRegistry;
$addfolders->loadArray($data['addfolders']);
$data['addfolders'] = (string) $addfolders;
}
elseif (!isset($data['addfolders']))
{
// Set the empty addfolders to data
$data['addfolders'] = '';
}
// Set the addfiles items to data.
if (isset($data['addfiles']) && is_array($data['addfiles']))
{
$addfiles = new JRegistry;
$addfiles->loadArray($data['addfiles']);
$data['addfiles'] = (string) $addfiles;
}
elseif (!isset($data['addfiles']))
{
// Set the empty addfiles to data
$data['addfiles'] = '';
}
// Set the Params Items to data
if (isset($data['params']) && is_array($data['params']))
{
$params = new JRegistry;
$params->loadArray($data['params']);
$data['params'] = (string) $params;
}
// Alter the uniqe field for save as copy
if ($input->get('task') === 'save2copy')
{
// Automatic handling of other uniqe fields
$uniqeFields = $this->getUniqeFields();
if (ComponentbuilderHelper::checkArray($uniqeFields))
{
foreach ($uniqeFields as $uniqeField)
{
$data[$uniqeField] = $this->generateUniqe($uniqeField,$data[$uniqeField]);
}
}
}
if (parent::save($data))
{
return true;
}
return false;
}
/**
* Method to generate a uniqe value.
*
* @param string $field name.
* @param string $value data.
*
* @return string New value.
*
* @since 3.0
*/
protected function generateUniqe($field,$value)
{
// set field value uniqe
$table = $this->getTable();
while ($table->load(array($field => $value)))
{
$value = JString::increment($value);
}
return $value;
}
/**
* Method to change the title & alias.
*
* @param string $title The title.
*
* @return array Contains the modified title and alias.
*
*/
protected function _generateNewTitle($title)
{
// Alter the title
$table = $this->getTable();
while ($table->load(array('title' => $title)))
{
$title = JString::increment($title);
}
return $title;
}
}

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelSite_view extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -95,6 +95,14 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$item->metadata = $registry->toArray();
}
if (!empty($item->libraries))
{
// Convert the libraries field to an array.
$libraries = new Registry;
$libraries->loadString($item->libraries);
$item->libraries = $libraries->toArray();
}
if (!empty($item->custom_get))
{
// Convert the custom_get field to an array.
@ -119,42 +127,48 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$item->custom_button = $custom_button->toArray();
}
if (!empty($item->css))
{
// base64 Decode css.
$item->css = base64_decode($item->css);
}
if (!empty($item->js_document))
{
// base64 Decode js_document.
$item->js_document = base64_decode($item->js_document);
}
if (!empty($item->css))
{
// base64 Decode css.
$item->css = base64_decode($item->css);
}
if (!empty($item->css_document))
{
// base64 Decode css_document.
$item->css_document = base64_decode($item->css_document);
}
if (!empty($item->default))
{
// base64 Decode default.
$item->default = base64_decode($item->default);
}
if (!empty($item->php_ajaxmethod))
{
// base64 Decode php_ajaxmethod.
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
}
if (!empty($item->default))
{
// base64 Decode default.
$item->default = base64_decode($item->default);
}
if (!empty($item->php_model))
{
// base64 Decode php_model.
$item->php_model = base64_decode($item->php_model);
}
if (!empty($item->php_controller))
{
// base64 Decode php_controller.
$item->php_controller = base64_decode($item->php_controller);
}
if (!empty($item->php_document))
{
// base64 Decode php_document.
@ -173,12 +187,6 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$item->php_jview_display = base64_decode($item->php_jview_display);
}
if (!empty($item->php_controller))
{
// base64 Decode php_controller.
$item->php_controller = base64_decode($item->php_controller);
}
if (!empty($item->php_jview))
{
// base64 Decode php_jview.
@ -947,6 +955,19 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the libraries items to data.
if (isset($data['libraries']) && is_array($data['libraries']))
{
$libraries = new JRegistry;
$libraries->loadArray($data['libraries']);
$data['libraries'] = (string) $libraries;
}
elseif (!isset($data['libraries']))
{
// Set the empty libraries to data
$data['libraries'] = '';
}
// Set the custom_get items to data.
if (isset($data['custom_get']) && is_array($data['custom_get']))
{
@ -986,42 +1007,48 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$data['custom_button'] = '';
}
// Set the css string to base64 string.
if (isset($data['css']))
{
$data['css'] = base64_encode($data['css']);
}
// Set the js_document string to base64 string.
if (isset($data['js_document']))
{
$data['js_document'] = base64_encode($data['js_document']);
}
// Set the css string to base64 string.
if (isset($data['css']))
{
$data['css'] = base64_encode($data['css']);
}
// Set the css_document string to base64 string.
if (isset($data['css_document']))
{
$data['css_document'] = base64_encode($data['css_document']);
}
// Set the default string to base64 string.
if (isset($data['default']))
{
$data['default'] = base64_encode($data['default']);
}
// Set the php_ajaxmethod string to base64 string.
if (isset($data['php_ajaxmethod']))
{
$data['php_ajaxmethod'] = base64_encode($data['php_ajaxmethod']);
}
// Set the default string to base64 string.
if (isset($data['default']))
{
$data['default'] = base64_encode($data['default']);
}
// Set the php_model string to base64 string.
if (isset($data['php_model']))
{
$data['php_model'] = base64_encode($data['php_model']);
}
// Set the php_controller string to base64 string.
if (isset($data['php_controller']))
{
$data['php_controller'] = base64_encode($data['php_controller']);
}
// Set the php_document string to base64 string.
if (isset($data['php_document']))
{
@ -1040,12 +1067,6 @@ class ComponentbuilderModelSite_view extends JModelAdmin
$data['php_jview_display'] = base64_encode($data['php_jview_display']);
}
// Set the php_controller string to base64 string.
if (isset($data['php_controller']))
{
$data['php_controller'] = base64_encode($data['php_controller']);
}
// Set the php_jview string to base64 string.
if (isset($data['php_jview']))
{

View File

@ -266,26 +266,26 @@ class ComponentbuilderModelSite_views extends JModelList
continue;
}
// decode css
$item->css = base64_decode($item->css);
// decode js_document
$item->js_document = base64_decode($item->js_document);
// decode css
$item->css = base64_decode($item->css);
// decode css_document
$item->css_document = base64_decode($item->css_document);
// decode default
$item->default = base64_decode($item->default);
// decode php_ajaxmethod
$item->php_ajaxmethod = base64_decode($item->php_ajaxmethod);
// decode default
$item->default = base64_decode($item->default);
// decode php_model
$item->php_model = base64_decode($item->php_model);
// decode php_controller
$item->php_controller = base64_decode($item->php_controller);
// decode php_document
$item->php_document = base64_decode($item->php_document);
// decode php_view
$item->php_view = base64_decode($item->php_view);
// decode php_jview_display
$item->php_jview_display = base64_decode($item->php_jview_display);
// decode php_controller
$item->php_controller = base64_decode($item->php_controller);
// decode php_jview
$item->php_jview = base64_decode($item->php_jview);
// unset the values we don't want exported.

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelSnippet extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelSnippet_type extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;

View File

@ -79,7 +79,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin
{
if ($item = parent::getItem($pk))
{
if (!empty($item->params))
if (!empty($item->params) && !is_array($item->params))
{
// Convert the params field to an array.
$registry = new Registry;
@ -95,6 +95,14 @@ class ComponentbuilderModelTemplate extends JModelAdmin
$item->metadata = $registry->toArray();
}
if (!empty($item->libraries))
{
// Convert the libraries field to an array.
$libraries = new Registry;
$libraries->loadString($item->libraries);
$item->libraries = $libraries->toArray();
}
if (!empty($item->template))
{
// base64 Decode template.
@ -830,6 +838,19 @@ class ComponentbuilderModelTemplate extends JModelAdmin
$data['metadata'] = (string) $metadata;
}
// Set the libraries items to data.
if (isset($data['libraries']) && is_array($data['libraries']))
{
$libraries = new JRegistry;
$libraries->loadArray($data['libraries']);
$data['libraries'] = (string) $libraries;
}
elseif (!isset($data['libraries']))
{
// Set the empty libraries to data
$data['libraries'] = '';
}
// Set the template string to base64 string.
if (isset($data['template']))
{