Added buttons to edit cutomcode directly from where it is added in other areas around the component. This will improve the customcode workflow in JCB.

This commit is contained in:
Llewellyn van der Merwe 2019-01-31 23:44:21 +02:00
parent 8cdf056ad4
commit 1a538e71d7
No known key found for this signature in database
GPG Key ID: CAD7B16D27AF28C5
52 changed files with 1407 additions and 236 deletions

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 30th January, 2019 + *Last Build*: 31st January, 2019
+ *Version*: 2.9.10 + *Version*: 2.9.10
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **194699** + *Line count*: **195869**
+ *Field count*: **1089** + *Field count*: **1089**
+ *File count*: **1277** + *File count*: **1277**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -144,11 +144,11 @@ TODO
+ *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com) + *Author*: [Llewellyn van der Merwe](mailto:llewellyn@joomlacomponentbuilder.com)
+ *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder) + *Name*: [Component Builder](https://github.com/vdm-io/Joomla-Component-Builder)
+ *First Build*: 30th April, 2015 + *First Build*: 30th April, 2015
+ *Last Build*: 30th January, 2019 + *Last Build*: 31st January, 2019
+ *Version*: 2.9.10 + *Version*: 2.9.10
+ *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved. + *Copyright*: Copyright (C) 2015 - 2018 Vast Development Method. All rights reserved.
+ *License*: GNU General Public License version 2 or later; see LICENSE.txt + *License*: GNU General Public License version 2 or later; see LICENSE.txt
+ *Line count*: **194699** + *Line count*: **195869**
+ *Field count*: **1089** + *Field count*: **1089**
+ *File count*: **1277** + *File count*: **1277**
+ *Folder count*: **201** + *Folder count*: **201**

View File

@ -45,6 +45,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
$this->registerTask('getDynamicValues', 'ajax'); $this->registerTask('getDynamicValues', 'ajax');
$this->registerTask('checkFunctionName', 'ajax'); $this->registerTask('checkFunctionName', 'ajax');
$this->registerTask('usedin', 'ajax'); $this->registerTask('usedin', 'ajax');
$this->registerTask('getEditCustomCodeButtons', 'ajax');
$this->registerTask('getExistingValidationRuleCode', 'ajax'); $this->registerTask('getExistingValidationRuleCode', 'ajax');
$this->registerTask('getValidationRulesTable', 'ajax'); $this->registerTask('getValidationRulesTable', 'ajax');
$this->registerTask('checkRuleName', 'ajax'); $this->registerTask('checkRuleName', 'ajax');
@ -838,6 +839,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
} }
} }
break; break;
case 'getEditCustomCodeButtons':
try
{
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
$idValue = $jinput->get('id', NULL, 'INT');
if($idValue && $user->id != 0)
{
$result = $this->getModel('ajax')->getEditCustomCodeButtons($idValue);
}
else
{
$result = false;
}
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback . "(".json_encode($result).");";
}
elseif($returnRaw)
{
echo json_encode($result);
}
else
{
echo "(".json_encode($result).");";
}
}
catch(Exception $e)
{
if($callback = $jinput->get('callback', null, 'CMD'))
{
echo $callback."(".json_encode($e).");";
}
else
{
echo "(".json_encode($e).");";
}
}
break;
case 'getExistingValidationRuleCode': case 'getExistingValidationRuleCode':
try try
{ {

View File

@ -4050,6 +4050,106 @@ abstract class ComponentbuilderHelper
return ''; return '';
} }
/**
* Get an edit text button
*
* @param string $text The button text
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditTextButton($text, &$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true, $class = 'uk-button', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// make sure we have text
if (!self::checkString($text))
{
return self::getEditButton($item, $view, $views, $ref, $component, $headsup);
}
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component, $jRoute);
// check if we found any
if (self::checkString($url))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_componentbuilder');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (self::checkObject($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
}
// set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');
// check that there is a check message
if (self::checkString($headsup))
{
if (3 == $uikit)
{
$href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"';
}
else
{
$href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return '';
}
/** /**
* Get the edit URL * Get the edit URL
* *

View File

@ -3718,6 +3718,7 @@ COM_COMPONENTBUILDER_CUSTOM_CODE_NOTE_PLACEHOLDERS_EXPLAINED_DESCRIPTION="<div c
<div id='usedin-k' style='display:none;'><h2>Layouts</h2><div id='area-k'></div></div> <div id='usedin-k' style='display:none;'><h2>Layouts</h2><div id='area-k'></div></div>
<div id='usedin-l' style='display:none;'><h2>Libraries</h2><div id='area-l'></div></div> <div id='usedin-l' style='display:none;'><h2>Libraries</h2><div id='area-l'></div></div>
<div id='usedin-m' style='display:none;'><h2>Custom Code</h2><div id='area-m'></div></div> <div id='usedin-m' style='display:none;'><h2>Custom Code</h2><div id='area-m'></div></div>
<div id='usedin-n' style='display:none;'><h2>Validation Rule</h2><div id='area-n'></div></div>
<div id='loading-usedin' style='display: none;'><h2>Scanning Database<span class='loading-dots'>..</span></h2></div> <div id='loading-usedin' style='display: none;'><h2>Scanning Database<span class='loading-dots'>..</span></h2></div>
<div id='note-usedin-found' style='display: none;'><small>You can edit the above areas where this code is used.</small></div> <div id='note-usedin-found' style='display: none;'><small>You can edit the above areas where this code is used.</small></div>
<div id='note-usedin-not' style='display: none;'><small>This code is not used in any area of the JCB custom code blocks at this time.</small></div> <div id='note-usedin-not' style='display: none;'><small>This code is not used in any area of the JCB custom code blocks at this time.</small></div>

View File

@ -52,6 +52,11 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
public function getVDM()
{
return $this->vastDevMod;
}
/** /**
* Method to get a single record. * Method to get a single record.
* *
@ -89,6 +94,32 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
$item->addrelations = $addrelations->toArray(); $item->addrelations = $addrelations->toArray();
} }
if (empty($item->id))
{
$id = 0;
}
else
{
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('admin_fields_relations__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'admin_fields_relations__'.$id);
ComponentbuilderHelper::set('admin_fields_relations__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
}
if (!empty($item->id)) if (!empty($item->id))
{ {
$item->tags = new JHelperTags; $item->tags = new JHelperTags;

View File

@ -1876,6 +1876,101 @@ class ComponentbuilderModelAjax extends JModelList
} }
// Used in custom_code // Used in custom_code
public function getEditCustomCodeButtons($id)
{
$view = $this->getViewID();
// only continue if this is a legitimate call
if (isset($view['a_id']) && $view['a_id'] == $id && isset($view['a_view']) && ($target = $this->getCodeSearchKeys($view['a_view'], 'query_')) !== false)
{
$db = JFactory::getDbo();
$query = $db->getQuery(true)
->select($db->quoteName($target['select']))
->from($db->quoteName('#__componentbuilder_' . $target['table'], 'a'))
->where('a.id = ' . (int) $id);
$db->setQuery($query);
$db->execute();
if ($db->loadRowList())
{
$data = $db->loadAssoc();
// some helper for some fields
$helper = array('xml' => 'note_select_field_type');
// reset the bucket
$bucket = array();
foreach ($data as $key => $value)
{
if ('id' !== $key && $target['name'] !== $key)
{
if (!isset($target['not_base64'][$key]))
{
$value = ComponentbuilderHelper::openValidBase64($value, null);
}
elseif ('json' === $target['not_base64'][$key] && 'xml' === $key) // just for field search
{
$value = json_decode($value);
}
// check if we should search for base64 string inside the text
if (isset($target['base64_search']) && isset($target['base64_search'][$key])
&& isset($target['base64_search'][$key]['start']) && strpos($value, $target['base64_search'][$key]['start']) !== false)
{
// search and open the base64 strings
$this->searchOpenBase64($value, $target['base64_search'][$key]);
}
// check if place holder set
if (strpos($value, '[CUSTOMC' . 'ODE=') !== false)
{
// get all custom codes in value
$bucket[$key] = ComponentbuilderHelper::getAllBetween($value, '[CUSTOMC' . 'ODE=', ']');
}
}
}
// check if any values found
if (ComponentbuilderHelper::checkArray($bucket))
{
// get input
$jinput = JFactory::getApplication()->input;
$return_here = $jinput->get('return_here', null, 'base64');
// set the return here value if not found
if (ComponentbuilderHelper::checkString($return_here))
{
$return_here = '&return=' . $return_here;
}
else
{
$return_here = '&ref=' . $view['a_view'] . '&refid=' . (int) $id;
}
// reset the buttons bucket
$buttons = array();
foreach ($bucket as $field => $customcodes)
{
$edit_icon = '<span class="icon-edit" aria-hidden="true"></span> ';
// see if the field needs some help :)
if (isset($helper[$field]))
{
$field = $helper[$field];
}
$buttons[$field] = array();
foreach ($customcodes as $customcode)
{
$key = (array) explode('+', $customcode);
if (!isset($buttons[$field][$key[0]]) && ($_id = ComponentbuilderHelper::getVar('custom_code', $key[0], 'function_name')) !== false
&& ($button = ComponentbuilderHelper::getEditTextButton($edit_icon . $key[0], $_id, 'custom_code', 'custom_codes', $return_here, 'com_componentbuilder', false, 'btn btn-small button-edit" style="margin: 0 0 5px 0;'))
&& ComponentbuilderHelper::checkString($button))
{
$buttons[$field][$key[0]] = $button;
}
}
}
// only continue if we have buttons in array
if (ComponentbuilderHelper::checkArray($buttons, true))
{
return $buttons;
}
}
}
}
return false;
}
public function checkFunctionName($name, $id) public function checkFunctionName($name, $id)
{ {
$nameArray = (array) $this->splitAtUpperCase($name); $nameArray = (array) $this->splitAtUpperCase($name);
@ -1970,10 +2065,26 @@ class ComponentbuilderModelAjax extends JModelList
// check if any values found // check if any values found
if (ComponentbuilderHelper::checkArray($bucket)) if (ComponentbuilderHelper::checkArray($bucket))
{ {
// get input
$jinput = JFactory::getApplication()->input;
$return_here = $jinput->get('return_here', null, 'base64');
// set the return here value if not found
if (ComponentbuilderHelper::checkString($return_here))
{
$return_here = '&return=' . $return_here;
}
else
{
$return_here = '&ref=custom_code&refid=' . (int) $id;
}
$usedin = array(); $usedin = array();
foreach ($bucket as $editId => $values) foreach ($bucket as $editId => $values)
{ {
$usedin[] = '<a href="index.php?option=com_componentbuilder&ref=custom_code&refid=' . (int) $id . '&view=' . $target['views'] . '&task=' . $target['table'] . '.edit&id=' . (int) $editId . '">' . $values['name'] . '</a> (' . implode(', ', $values['fields']) . ')'; if (($button = ComponentbuilderHelper::getEditTextButton($values['name'], $editId, $target['table'], $target['views'], $return_here, 'com_componentbuilder', false, ''))
&& ComponentbuilderHelper::checkString($button))
{
$usedin[] = $button. ' (' . implode(', ', $values['fields']) . ')';
}
} }
$html = '<ul><li>' . implode('</li><li>', $usedin) . '</li></ul>'; $html = '<ul><li>' . implode('</li><li>', $usedin) . '</li></ul>';
return array('in' => $html, 'id' => $targeting); return array('in' => $html, 'id' => $targeting);
@ -2156,6 +2267,13 @@ class ComponentbuilderModelAjax extends JModelList
'views' => 'custom_codes', 'views' => 'custom_codes',
'not_base64' => array(), 'not_base64' => array(),
'name' => 'system_name' 'name' => 'system_name'
),
// #__componentbuilder_validation_rule (n)
'validation_rule' => array(
'search' => array('id', 'name', 'php'),
'views' => 'validation_rules',
'not_base64' => array(),
'name' => 'name'
) )
); );
@ -2188,7 +2306,7 @@ class ComponentbuilderModelAjax extends JModelList
} }
} }
// return result ready for a.query // return result ready for a.query
if ('query' === $type && isset($this->codeSearchKeys[$target])) if (('query' === $type || 'query_' === $type) && isset($this->codeSearchKeys[$target]))
{ {
// set the targets // set the targets
$codeSearchTarget = $this->codeSearchKeys[$target]; $codeSearchTarget = $this->codeSearchKeys[$target];

View File

@ -52,6 +52,11 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
public function getVDM()
{
return $this->vastDevMod;
}
/** /**
* Method to get a single record. * Method to get a single record.
* *
@ -95,6 +100,31 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
$item->dashboard_tab = $dashboard_tab->toArray(); $item->dashboard_tab = $dashboard_tab->toArray();
} }
if (empty($item->id))
{
$id = 0;
}
else
{
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('components_dashboard__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'components_dashboard__'.$id);
ComponentbuilderHelper::set('components_dashboard__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
}
// update the fields // update the fields
$objectUpdate = new stdClass(); $objectUpdate = new stdClass();
$objectUpdate->id = (int) $item->id; $objectUpdate->id = (int) $item->id;

View File

@ -52,6 +52,11 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
public function getVDM()
{
return $this->vastDevMod;
}
/** /**
* Method to get a single record. * Method to get a single record.
* *
@ -87,6 +92,32 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
$item->code = base64_decode($item->code); $item->code = base64_decode($item->code);
} }
if (empty($item->id))
{
$id = 0;
}
else
{
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('custom_code__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'custom_code__'.$id);
ComponentbuilderHelper::set('custom_code__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
}
if (!empty($item->id)) if (!empty($item->id))
{ {
$item->tags = new JHelperTags; $item->tags = new JHelperTags;

View File

@ -52,6 +52,11 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
return JTable::getInstance($type, $prefix, $config); return JTable::getInstance($type, $prefix, $config);
} }
public function getVDM()
{
return $this->vastDevMod;
}
/** /**
* Method to get a single record. * Method to get a single record.
* *
@ -89,6 +94,31 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
$item->properties = $properties->toArray(); $item->properties = $properties->toArray();
} }
if (empty($item->id))
{
$id = 0;
}
else
{
$id = $item->id;
}
// set the id and view name to session
if ($vdm = ComponentbuilderHelper::get('fieldtype__'.$id))
{
$this->vastDevMod = $vdm;
}
else
{
// set the vast development method key
$this->vastDevMod = ComponentbuilderHelper::randomkey(50);
ComponentbuilderHelper::set($this->vastDevMod, 'fieldtype__'.$id);
ComponentbuilderHelper::set('fieldtype__'.$id, $this->vastDevMod);
// set a return value if found
$jinput = JFactory::getApplication()->input;
$return = $jinput->get('return', null, 'base64');
ComponentbuilderHelper::set($this->vastDevMod . '__return', $return);
}
// check what type of properties array we have here (should be subform... but just incase) // check what type of properties array we have here (should be subform... but just incase)
// This could happen due to huge data sets // This could happen due to huge data sets
if (isset($item->properties) && isset($item->properties['name'])) if (isset($item->properties) && isset($item->properties['name']))

View File

@ -11,6 +11,11 @@
jQuery(document).ready(function()
{
// check and load all the customcode edit buttons
getEditCustomCodeButtons();
});
// little script to set the value // little script to set the value
function getCodeGlueOptions(field) { function getCodeGlueOptions(field) {
// get the ID // get the ID
@ -68,3 +73,42 @@ function _isSet(val)
return false; return false;
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -1312,6 +1312,8 @@ jQuery(document).ready(function()
addButtonID('admin_fields_relations','create_edit_buttons', 1); // <-- forth addButtonID('admin_fields_relations','create_edit_buttons', 1); // <-- forth
// set button // set button
addButtonID('admin_custom_tabs','addtabs-lbl', 1); // <-- fifth addButtonID('admin_custom_tabs','addtabs-lbl', 1); // <-- fifth
// check and load all the customcode edit buttons
getEditCustomCodeButtons();
}); });
function checkAliasField() { function checkAliasField() {
@ -1371,80 +1373,6 @@ function addData(result,where){
jQuery(result).insertAfter(jQuery(where).closest('.control-group')); 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&raw=true&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: 'json',
data: request,
jsonp: false
});
}
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, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type='+type+'&size='+size;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function addButton(type, where, size){
// just to insure that default behaviour still works
size = typeof size !== 'undefined' ? size : 1;
addButton_server(type, size).done(function(result) {
if(result){
if (2 == size) {
jQuery('#'+where).html(result);
} else {
addData(result, '#jform_'+where);
}
}
})
}
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}
function getTableColumns_server(tableName){ function getTableColumns_server(tableName){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod; var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && tableName.length > 0){ if(token.length > 0 && tableName.length > 0){
@ -1558,3 +1486,116 @@ function getDynamicScripts(id){
} }
} }
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function addButtonID_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&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: 'json',
data: request,
jsonp: false
});
}
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, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type='+type+'&size='+size;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function addButton(type, where, size){
// just to insure that default behaviour still works
size = typeof size !== 'undefined' ? size : 1;
addButton_server(type, size).done(function(result) {
if(result){
if (2 == size) {
jQuery('#'+where).html(result);
} else {
addData(result, '#jform_'+where);
}
}
})
}
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}

View File

@ -9,3 +9,49 @@
*/ */
jQuery(document).ready(function()
{
// check and load all the customcode edit buttons
getEditCustomCodeButtons();
});
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -440,6 +440,8 @@ jQuery(document).ready(function()
{ {
// get the linked details // get the linked details
getLinked(); getLinked();
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
}); });
function getLinked_server(type){ function getLinked_server(type){
@ -663,3 +665,42 @@ function setSnippets(array){
} }
jQuery('#jform_snippet').trigger('liszt:updated'); jQuery('#jform_snippet').trigger('liszt:updated');
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -232,6 +232,8 @@ jQuery(document).ready(function()
jQuery('#html-comment-info').hide(); jQuery('#html-comment-info').hide();
jQuery('#phpjs-comment-info').show(); jQuery('#phpjs-comment-info').show();
} }
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
}); });
function setCustomCodePlaceholder() { function setCustomCodePlaceholder() {
var ide = jQuery('#jform_id').val(); var ide = jQuery('#jform_id').val();
@ -308,8 +310,8 @@ function usedin(functioName, ide) {
jQuery('#note-usedin-not').hide(); jQuery('#note-usedin-not').hide();
jQuery('#note-usedin-found').hide(); jQuery('#note-usedin-found').hide();
jQuery('#loading-usedin').show(); jQuery('#loading-usedin').show();
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m']; // if you update this, also update (below 11) & [customcode-codeUsedInHtmlNote]! var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n']; // if you update this, also update (below 13) & [customcode-codeUsedInHtmlNote]!
var targetNumber = 12; var targetNumber = 13;
var run = 0; var run = 0;
var usedinChecker = setInterval(function(){ var usedinChecker = setInterval(function(){
var target = targets[run]; var target = targets[run];
@ -340,7 +342,7 @@ function usedin(functioName, ide) {
function usedin_server(functioName, ide, target){ function usedin_server(functioName, ide, target){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.usedin&format=json"; var getUrl = "index.php?option=com_componentbuilder&task=ajax.usedin&format=json";
if(token.length > 0){ if(token.length > 0){
var request = 'token='+token+'&functioName='+functioName+'&id='+ide+'&target='+target; var request = 'token='+token+'&functioName='+functioName+'&id='+ide+'&target='+target+'&return_here='+return_here;
} }
return jQuery.ajax({ return jQuery.ajax({
type: 'GET', type: 'GET',
@ -350,3 +352,42 @@ function usedin_server(functioName, ide, target){
jsonp: 'callback' jsonp: 'callback'
}); });
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -1527,30 +1527,10 @@ jQuery(document).ready(function()
var select_all = jQuery("#jform_select_all input[type='radio']:checked").val(); var select_all = jQuery("#jform_select_all input[type='radio']:checked").val();
// make sure the selection is correct // make sure the selection is correct
setSelectAll(select_all); setSelectAll(select_all);
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
}); });
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}
function setSelectAll(select_all){ function setSelectAll(select_all){
// get source type // get source type
var main_source = jQuery("#jform_main_source").val(); var main_source = jQuery("#jform_main_source").val();
@ -1745,3 +1725,64 @@ function getDynamicScripts(id){
} }
} }
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}

View File

@ -519,57 +519,10 @@ jQuery(document).ready(function()
var fieldText = jQuery("#jform_fieldtype option:selected").text().toLowerCase(); var fieldText = jQuery("#jform_fieldtype option:selected").text().toLowerCase();
// now check if database input is needed // now check if database input is needed
dbChecker(fieldText); dbChecker(fieldText);
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
}); });
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}
function addButton_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type='+type+'&size='+size;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function addButton(type, where, size){
// just to insure that default behaviour still works
size = typeof size !== 'undefined' ? size : 1;
addButton_server(type, size).done(function(result) {
if(result){
if (2 == size) {
jQuery('#'+where).html(result);
} else {
addData(result, '#jform_'+where);
}
}
})
}
// the options row id key // the options row id key
var rowIdKey = 'properties'; var rowIdKey = 'properties';
@ -816,3 +769,91 @@ function dbChecker(type){
jQuery('.note_database_settings_needed').closest('.control-group').show(); jQuery('.note_database_settings_needed').closest('.control-group').show();
} }
} }
function getLinked_server(type){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && type > 0){
var request = 'token='+token+'&type='+type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getLinked(){
getLinked_server(1).done(function(result) {
if(result){
jQuery('#display_linked_to').html(result);
}
});
}
function addButton_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0){
var request = 'token='+token+'&type='+type+'&size='+size;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function addButton(type, where, size){
// just to insure that default behaviour still works
size = typeof size !== 'undefined' ? size : 1;
addButton_server(type, size).done(function(result) {
if(result){
if (2 == size) {
jQuery('#'+where).html(result);
} else {
addData(result, '#jform_'+where);
}
}
})
}
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -9,3 +9,49 @@
*/ */
jQuery(document).ready(function($)
{
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
});
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -965,7 +965,8 @@ jQuery(document).ready(function()
setTimeout(setDisplays2, 2500); setTimeout(setDisplays2, 2500);
setTimeout(setDisplays3, 3500); setTimeout(setDisplays3, 3500);
// very basic I know... but it will have to do for now. // check and load all the customcode edit buttons
setTimeout(getEditCustomCodeButtons, 400);
}); });
function getAjaxDisplay(type){ function getAjaxDisplay(type){
@ -1011,6 +1012,45 @@ function dasboardSwitch(value){
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function addButtonID_server(type, size){ function addButtonID_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod); var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0 && size > 0){ if(token.length > 0 && type.length > 0 && size > 0){

View File

@ -87,6 +87,50 @@ function isSet(val)
} }
jQuery(document).ready(function($)
{
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
});
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function getSnippetDetails_server(snippetId){ function getSnippetDetails_server(snippetId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json";

View File

@ -410,12 +410,106 @@ jQuery(document).ready(function()
// now load the displays // now load the displays
getAjaxDisplay('library_config'); getAjaxDisplay('library_config');
getAjaxDisplay('library_files_folders_urls'); getAjaxDisplay('library_files_folders_urls');
// check and load all the customcode edit buttons
setTimeout(getEditCustomCodeButtons, 300);
}); });
function addData(result,where){ function addData(result,where){
jQuery(result).insertAfter(jQuery(where).closest('.control-group')); jQuery(result).insertAfter(jQuery(where).closest('.control-group'));
} }
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&raw=true&vdm="+vastDevMod;
if (token.length > 0 && type.length > 0) {
var request = 'token='+token+'&type=' + type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getFieldSelectOptions_server(fieldId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true";
if (token.length > 0 && fieldId > 0) {
var request = 'token='+token+'&id='+fieldId;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
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('');
}
});
}
}
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function addButtonID_server(type, size){ function addButtonID_server(type, size){
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod); var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod);
if(token.length > 0 && type.length > 0 && size > 0){ if(token.length > 0 && type.length > 0 && size > 0){
@ -489,55 +583,3 @@ function getLinked(){
} }
}); });
} }
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&raw=true&vdm="+vastDevMod;
if (token.length > 0 && type.length > 0) {
var request = 'token='+token+'&type=' + type;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getFieldSelectOptions_server(fieldId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true";
if (token.length > 0 && fieldId > 0) {
var request = 'token='+token+'&id='+fieldId;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
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

@ -481,6 +481,8 @@ jQuery(document).ready(function()
{ {
// get the linked details // get the linked details
getLinked(); getLinked();
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
}); });
function getLinked_server(type){ function getLinked_server(type){
@ -704,3 +706,42 @@ function setSnippets(array){
} }
jQuery('#jform_snippet').trigger('liszt:updated'); jQuery('#jform_snippet').trigger('liszt:updated');
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -87,6 +87,50 @@ function isSet(val)
} }
jQuery(document).ready(function($)
{
// check and load all the custom code edit buttons
getEditCustomCodeButtons();
});
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}
function getSnippetDetails_server(snippetId){ function getSnippetDetails_server(snippetId){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json"; var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json";

View File

@ -26,6 +26,9 @@ jQuery(document).ready(function()
// load the used in div // load the used in div
// jQuery('#usedin').show(); // jQuery('#usedin').show();
// check and load all the customcode edit buttons
setTimeout(getEditCustomCodeButtons, 300);
}); });
function getExistingValidationRuleCode_server(rulefilename){ function getExistingValidationRuleCode_server(rulefilename){
@ -93,3 +96,42 @@ function checkRuleName_server(ruleName, ide){
jsonp: 'callback' jsonp: 'callback'
}); });
} }
function getEditCustomCodeButtons_server(id){
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod;
if(token.length > 0 && id > 0){
var request = 'token='+token+'&id='+id+'&return_here='+return_here;
}
return jQuery.ajax({
type: 'GET',
url: getUrl,
dataType: 'json',
data: request,
jsonp: false
});
}
function getEditCustomCodeButtons(){
// get the id
id = jQuery("#jform_id").val();
getEditCustomCodeButtons_server(id).done(function(result) {
if(isObject(result)){
jQuery.each(result, function( field, buttons ) {
jQuery('<div class="control-group"><div class="control-label"><label>Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div></div>').insertBefore(".control-wrapper-"+ field);
jQuery.each(buttons, function( name, button ) {
jQuery(".control-customcode-buttons-"+field).append(button);
});
});
}
})
}
// check object is not empty
function isObject(obj) {
for(var prop in obj) {
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
return true;
}
}
return false;
}

View File

@ -1747,6 +1747,13 @@ class ComponentbuilderModelJoomla_components extends JModelList
'views' => 'custom_codes', 'views' => 'custom_codes',
'not_base64' => array(), 'not_base64' => array(),
'name' => 'system_name' 'name' => 'system_name'
),
// #__componentbuilder_validation_rule (n)
'validation_rule' => array(
'search' => array('id', 'name', 'php'),
'views' => 'validation_rules',
'not_base64' => array(),
'name' => 'name'
) )
); );
@ -1779,7 +1786,7 @@ class ComponentbuilderModelJoomla_components extends JModelList
} }
} }
// return result ready for a.query // return result ready for a.query
if ('query' === $type && isset($this->codeSearchKeys[$target])) if (('query' === $type || 'query_' === $type) && isset($this->codeSearchKeys[$target]))
{ {
// set the targets // set the targets
$codeSearchTarget = $this->codeSearchKeys[$target]; $codeSearchTarget = $this->codeSearchKeys[$target];

View File

@ -192,6 +192,10 @@ class ComponentbuilderViewAdmin_fields_relations extends JViewLegacy
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';"); $this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/admin_fields_relations/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/admin_fields_relations/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewAdmin_view extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -188,8 +188,14 @@ class ComponentbuilderViewComponent_dashboard extends JViewLegacy
} }
$this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_EDIT')); $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_NEW' : 'COM_COMPONENTBUILDER_COMPONENT_DASHBOARD_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/component_dashboard.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/component_dashboard.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/component_dashboard/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/component_dashboard/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewCustom_admin_view extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -201,6 +201,10 @@ class ComponentbuilderViewCustom_code extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
// need to add some language strings // need to add some language strings
JText::script('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'); JText::script('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME'); JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME');

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewDynamic_get extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewField extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
// add the libs for subform (since not adding it via xml but ajax) // add the libs for subform (since not adding it via xml but ajax)
JHtml::_('jquery.ui', array('core', 'sortable')); JHtml::_('jquery.ui', array('core', 'sortable'));
JHtml::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true)); JHtml::_('script', 'system/subform-repeatable.js', array('version' => 'auto', 'relative' => true));

View File

@ -191,6 +191,8 @@ class ComponentbuilderViewFieldtype extends JViewLegacy
} }
$this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_FIELDTYPE_NEW' : 'COM_COMPONENTBUILDER_FIELDTYPE_EDIT')); $this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_FIELDTYPE_NEW' : 'COM_COMPONENTBUILDER_FIELDTYPE_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/fieldtype.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css'); $this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/fieldtype.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
// Add the CSS for Footable // Add the CSS for Footable
$this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'); $this->document->addStyleSheet('https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css');
@ -203,6 +205,60 @@ class ComponentbuilderViewFieldtype extends JViewLegacy
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/fieldtype/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript'); $this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/fieldtype/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// get Uikit Version
$this->uikitVersion = $this->params->get('uikit_version', 2);
// Load uikit options.
$uikit = $this->params->get('uikit_load');
$isAdmin = JFactory::getApplication()->isClient('administrator');
// Set script size.
$size = $this->params->get('uikit_min');
// Use Uikit Version 2
if (2 == $this->uikitVersion && ($isAdmin || $uikit != 2))
{
// Set css style.
$style = $this->params->get('uikit_style');
// only load if needed
if ($isAdmin || $uikit != 3)
{
// add the style sheets
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
}
// add the style sheets
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/accordion' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/tooltip' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/form-file' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/progress' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/placeholder' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2//css/components/upload' . $style . $size . '.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// only load if needed
if ($isAdmin || $uikit != 3)
{
// add JavaScripts
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
// add JavaScripts
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/accordion' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/tooltip' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/upload' . $size . '.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
// Use Uikit Version 3
elseif (3 == $this->uikitVersion && ($isAdmin || $uikit != 2))
{
// add the style sheets
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v3/css/uikit'.$size.'.css', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
// add JavaScripts
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v3/js/uikit'.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
// add icons
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v3/js/uikit-icons'.$size.'.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
}
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewJoomla_component extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewLayout extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewLibrary extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewSite_view extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewTemplate extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error'); JText::script('view not acceptable. Error');
} }
} }

View File

@ -203,6 +203,8 @@ class ComponentbuilderViewValidation_rule extends JViewLegacy
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true); $this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
// add var key // add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';"); $this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
// need to add some language strings // need to add some language strings
JText::script('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'); JText::script('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN');
JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME'); JText::script('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME');

View File

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

View File

@ -4050,6 +4050,106 @@ abstract class ComponentbuilderHelper
return ''; return '';
} }
/**
* Get an edit text button
*
* @param string $text The button text
* @param int $item The item to edit
* @param string $view The type of item to edit
* @param string $views The list view controller name
* @param string $ref The return path
* @param string $component The component these views belong to
* @param string $headsup The message to show on click of button
*
* @return string On success the full html link
*
*/
public static function getEditTextButton($text, &$item, $view, $views, $ref = '', $component = 'com_componentbuilder', $jRoute = true, $class = 'uk-button', $headsup = 'COM_COMPONENTBUILDER_ALL_UNSAVED_WORK_ON_THIS_PAGE_WILL_BE_LOST_ARE_YOU_SURE_YOU_WANT_TO_CONTINUE')
{
// make sure we have text
if (!self::checkString($text))
{
return self::getEditButton($item, $view, $views, $ref, $component, $headsup);
}
// get URL
$url = self::getEditURL($item, $view, $views, $ref, $component, $jRoute);
// check if we found any
if (self::checkString($url))
{
// get the global settings
if (!self::checkObject(self::$params))
{
self::$params = JComponentHelper::getParams('com_componentbuilder');
}
// get UIKIT version
$uikit = self::$params->get('uikit_version', 2);
// check that we have the ID
if (self::checkObject($item) && isset($item->id))
{
// check if the checked_out is available
if (isset($item->checked_out))
{
$checked_out = (int) $item->checked_out;
}
}
elseif (self::checkArray($item) && isset($item['id']))
{
// check if the checked_out is available
if (isset($item['checked_out']))
{
$checked_out = (int) $item['checked_out'];
}
}
// set the link title
$title = self::safeString(JText::_('COM_COMPONENTBUILDER_EDIT') . ' ' . $view, 'W');
// check that there is a check message
if (self::checkString($headsup))
{
if (3 == $uikit)
{
$href = 'onclick="UIkit.modal.confirm(\''.JText::_($headsup).'\').then( function(){ window.location.href = \'' . $url . '\' } )" href="javascript:void(0)"';
}
else
{
$href = 'onclick="UIkit2.modal.confirm(\''.JText::_($headsup).'\', function(){ window.location.href = \'' . $url . '\' })" href="javascript:void(0)"';
}
}
else
{
$href = 'href="' . $url . '"';
}
// return UIKIT version 3
if (3 == $uikit)
{
// check if it is checked out
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
// check if it is checked out (return UIKIT version 2)
if (isset($checked_out) && $checked_out > 0)
{
// is this user the one who checked it out
if ($checked_out == JFactory::getUser()->id)
{
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return ' <a class="' . $class . '" href="#" disabled title="' . JText::sprintf('COM_COMPONENTBUILDER__HAS_BEEN_CHECKED_OUT_BY_S', self::safeString($view, 'W'), JFactory::getUser($checked_out)->name) . '">' . $text . '</a>';
}
// return normal edit link
return ' <a class="' . $class . '" ' . $href . ' title="' . $title . '">' . $text . '</a>';
}
return '';
}
/** /**
* Get the edit URL * Get the edit URL
* *