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:
@ -50,6 +50,11 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getVDM()
|
||||
{
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,6 +92,32 @@ class ComponentbuilderModelAdmin_fields_relations extends JModelAdmin
|
||||
$addrelations = new Registry;
|
||||
$addrelations->loadString($item->addrelations);
|
||||
$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))
|
||||
|
@ -366,7 +366,7 @@ class ComponentbuilderModelAdmin_view extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('admin_view__'.$id))
|
||||
{
|
||||
|
@ -1876,6 +1876,101 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
$nameArray = (array) $this->splitAtUpperCase($name);
|
||||
@ -1970,10 +2065,26 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
// 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=custom_code&refid=' . (int) $id;
|
||||
}
|
||||
$usedin = array();
|
||||
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>';
|
||||
return array('in' => $html, 'id' => $targeting);
|
||||
@ -2156,6 +2267,13 @@ class ComponentbuilderModelAjax extends JModelList
|
||||
'views' => 'custom_codes',
|
||||
'not_base64' => array(),
|
||||
'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
|
||||
if ('query' === $type && isset($this->codeSearchKeys[$target]))
|
||||
if (('query' === $type || 'query_' === $type) && isset($this->codeSearchKeys[$target]))
|
||||
{
|
||||
// set the targets
|
||||
$codeSearchTarget = $this->codeSearchKeys[$target];
|
||||
|
@ -50,6 +50,11 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getVDM()
|
||||
{
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -95,6 +100,31 @@ class ComponentbuilderModelComponent_dashboard extends JModelAdmin
|
||||
$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
|
||||
$objectUpdate = new stdClass();
|
||||
$objectUpdate->id = (int) $item->id;
|
||||
|
@ -198,7 +198,7 @@ class ComponentbuilderModelCustom_admin_view extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('custom_admin_view__'.$id))
|
||||
{
|
||||
|
@ -50,6 +50,11 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getVDM()
|
||||
{
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,6 +90,32 @@ class ComponentbuilderModelCustom_code extends JModelAdmin
|
||||
{
|
||||
// base64 Decode 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))
|
||||
|
@ -196,7 +196,7 @@ class ComponentbuilderModelDynamic_get extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('dynamic_get__'.$id))
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ class ComponentbuilderModelField extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('field__'.$id))
|
||||
{
|
||||
|
@ -50,6 +50,11 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
$this->addTablePath(JPATH_ADMINISTRATOR . '/components/com_componentbuilder/tables');
|
||||
// get instance of the table
|
||||
return JTable::getInstance($type, $prefix, $config);
|
||||
}
|
||||
|
||||
public function getVDM()
|
||||
{
|
||||
return $this->vastDevMod;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,6 +94,31 @@ class ComponentbuilderModelFieldtype extends JModelAdmin
|
||||
$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)
|
||||
// This could happen due to huge data sets
|
||||
if (isset($item->properties) && isset($item->properties['name']))
|
||||
|
@ -11,6 +11,11 @@
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// check and load all the customcode edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
// little script to set the value
|
||||
function getCodeGlueOptions(field) {
|
||||
// get the ID
|
||||
@ -67,4 +72,43 @@ function _isSet(val)
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1312,6 +1312,8 @@ jQuery(document).ready(function()
|
||||
addButtonID('admin_fields_relations','create_edit_buttons', 1); // <-- forth
|
||||
// set button
|
||||
addButtonID('admin_custom_tabs','addtabs-lbl', 1); // <-- fifth
|
||||
// check and load all the customcode edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
|
||||
function checkAliasField() {
|
||||
@ -1370,80 +1372,6 @@ function getAjaxDisplay_server(type){
|
||||
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&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){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod;
|
||||
@ -1557,4 +1485,117 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -8,4 +8,50 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -440,6 +440,8 @@ jQuery(document).ready(function()
|
||||
{
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// check and load all the custom code edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
|
||||
function getLinked_server(type){
|
||||
@ -662,4 +664,43 @@ function setSnippets(array){
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -232,6 +232,8 @@ jQuery(document).ready(function()
|
||||
jQuery('#html-comment-info').hide();
|
||||
jQuery('#phpjs-comment-info').show();
|
||||
}
|
||||
// check and load all the custom code edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
function setCustomCodePlaceholder() {
|
||||
var ide = jQuery('#jform_id').val();
|
||||
@ -308,8 +310,8 @@ function usedin(functioName, ide) {
|
||||
jQuery('#note-usedin-not').hide();
|
||||
jQuery('#note-usedin-found').hide();
|
||||
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 targetNumber = 12;
|
||||
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 = 13;
|
||||
var run = 0;
|
||||
var usedinChecker = setInterval(function(){
|
||||
var target = targets[run];
|
||||
@ -340,7 +342,7 @@ function usedin(functioName, ide) {
|
||||
function usedin_server(functioName, ide, target){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.usedin&format=json";
|
||||
if(token.length > 0){
|
||||
var request = 'token='+token+'&functioName='+functioName+'&id='+ide+'&target='+target;
|
||||
var request = 'token='+token+'&functioName='+functioName+'&id='+ide+'&target='+target+'&return_here='+return_here;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
@ -349,4 +351,43 @@ function usedin_server(functioName, ide, target){
|
||||
data: request,
|
||||
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;
|
||||
}
|
||||
|
@ -1527,29 +1527,9 @@ jQuery(document).ready(function()
|
||||
var select_all = jQuery("#jform_select_all input[type='radio']:checked").val();
|
||||
// make sure the selection is correct
|
||||
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){
|
||||
// get source type
|
||||
@ -1744,4 +1724,65 @@ 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);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -519,56 +519,9 @@ jQuery(document).ready(function()
|
||||
var fieldText = jQuery("#jform_fieldtype option:selected").text().toLowerCase();
|
||||
// now check if database input is needed
|
||||
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
|
||||
var rowIdKey = 'properties';
|
||||
@ -815,4 +768,92 @@ function dbChecker(type){
|
||||
jQuery('.note_no_database_settings_needed').closest('.control-group').hide();
|
||||
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;
|
||||
}
|
||||
|
@ -8,4 +8,50 @@
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -965,7 +965,8 @@ jQuery(document).ready(function()
|
||||
setTimeout(setDisplays2, 2500);
|
||||
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){
|
||||
@ -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){
|
||||
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){
|
||||
|
@ -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){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json";
|
||||
|
@ -410,11 +410,105 @@ jQuery(document).ready(function()
|
||||
// now load the displays
|
||||
getAjaxDisplay('library_config');
|
||||
getAjaxDisplay('library_files_folders_urls');
|
||||
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
function addData(result,where){
|
||||
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){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod);
|
||||
@ -488,56 +582,4 @@ function getLinked(){
|
||||
jQuery('#display_linked_to').html(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
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('');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -481,6 +481,8 @@ jQuery(document).ready(function()
|
||||
{
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// check and load all the custom code edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
|
||||
function getLinked_server(type){
|
||||
@ -703,4 +705,43 @@ function setSnippets(array){
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -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){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json";
|
||||
|
@ -26,6 +26,9 @@ jQuery(document).ready(function()
|
||||
|
||||
// load the used in div
|
||||
// jQuery('#usedin').show();
|
||||
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
function getExistingValidationRuleCode_server(rulefilename){
|
||||
@ -92,4 +95,43 @@ function checkRuleName_server(ruleName, ide){
|
||||
data: request,
|
||||
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;
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ class ComponentbuilderModelJoomla_component extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('joomla_component__'.$id))
|
||||
{
|
||||
|
@ -1747,6 +1747,13 @@ class ComponentbuilderModelJoomla_components extends JModelList
|
||||
'views' => 'custom_codes',
|
||||
'not_base64' => array(),
|
||||
'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
|
||||
if ('query' === $type && isset($this->codeSearchKeys[$target]))
|
||||
if (('query' === $type || 'query_' === $type) && isset($this->codeSearchKeys[$target]))
|
||||
{
|
||||
// set the targets
|
||||
$codeSearchTarget = $this->codeSearchKeys[$target];
|
||||
|
@ -108,7 +108,7 @@ class ComponentbuilderModelLanguage_translation extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('language_translation__'.$id))
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ class ComponentbuilderModelLayout extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('layout__'.$id))
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ class ComponentbuilderModelLibrary extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('library__'.$id))
|
||||
{
|
||||
|
@ -198,7 +198,7 @@ class ComponentbuilderModelSite_view extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('site_view__'.$id))
|
||||
{
|
||||
|
@ -114,7 +114,7 @@ class ComponentbuilderModelTemplate extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('template__'.$id))
|
||||
{
|
||||
|
@ -100,7 +100,7 @@ class ComponentbuilderModelValidation_rule extends JModelAdmin
|
||||
else
|
||||
{
|
||||
$id = $item->id;
|
||||
}
|
||||
}
|
||||
// set the id and view name to session
|
||||
if ($vdm = ComponentbuilderHelper::get('validation_rule__'.$id))
|
||||
{
|
||||
|
Reference in New Issue
Block a user