forked from joomla/Component-Builder
Added some helper script to the new Joomla Module Builder. Consolidated some ajax calls.
This commit is contained in:
parent
8c284aaed4
commit
b9729c49af
@ -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*: 7th December, 2019
|
+ *Last Build*: 10th December, 2019
|
||||||
+ *Version*: 2.10.8
|
+ *Version*: 2.10.8
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2019 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*: **277493**
|
+ *Line count*: **277467**
|
||||||
+ *Field count*: **1491**
|
+ *Field count*: **1491**
|
||||||
+ *File count*: **1766**
|
+ *File count*: **1766**
|
||||||
+ *Folder count*: **287**
|
+ *Folder count*: **287**
|
||||||
|
@ -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*: 7th December, 2019
|
+ *Last Build*: 10th December, 2019
|
||||||
+ *Version*: 2.10.8
|
+ *Version*: 2.10.8
|
||||||
+ *Copyright*: Copyright (C) 2015 - 2019 Vast Development Method. All rights reserved.
|
+ *Copyright*: Copyright (C) 2015 - 2019 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*: **277493**
|
+ *Line count*: **277467**
|
||||||
+ *Field count*: **1491**
|
+ *Field count*: **1491**
|
||||||
+ *File count*: **1766**
|
+ *File count*: **1766**
|
||||||
+ *Folder count*: **287**
|
+ *Folder count*: **287**
|
||||||
|
@ -31,6 +31,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
|||||||
$this->registerTask('getCronPath', 'ajax');
|
$this->registerTask('getCronPath', 'ajax');
|
||||||
$this->registerTask('getJCBpackageInfo', 'ajax');
|
$this->registerTask('getJCBpackageInfo', 'ajax');
|
||||||
$this->registerTask('getCrowdinDetails', 'ajax');
|
$this->registerTask('getCrowdinDetails', 'ajax');
|
||||||
|
$this->registerTask('getModuleCode', 'ajax');
|
||||||
$this->registerTask('getClassCode', 'ajax');
|
$this->registerTask('getClassCode', 'ajax');
|
||||||
$this->registerTask('getClassCodeIds', 'ajax');
|
$this->registerTask('getClassCodeIds', 'ajax');
|
||||||
$this->registerTask('getClassHeaderCode', 'ajax');
|
$this->registerTask('getClassHeaderCode', 'ajax');
|
||||||
@ -304,6 +305,44 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'getModuleCode':
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||||
|
$dataValue = $jinput->get('data', NULL, 'STRING');
|
||||||
|
if($dataValue && $user->id != 0)
|
||||||
|
{
|
||||||
|
$result = $this->getModel('ajax')->getModuleCode($dataValue);
|
||||||
|
}
|
||||||
|
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 'getClassCode':
|
case 'getClassCode':
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -655,7 +694,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||||
$typeValue = $jinput->get('type', NULL, 'INT');
|
$typeValue = $jinput->get('type', NULL, 'ALNUM');
|
||||||
if($typeValue && $user->id != 0)
|
if($typeValue && $user->id != 0)
|
||||||
{
|
{
|
||||||
$result = $this->getModel('ajax')->getLinked($typeValue);
|
$result = $this->getModel('ajax')->getLinked($typeValue);
|
||||||
@ -693,7 +732,7 @@ class ComponentbuilderControllerAjax extends JControllerLegacy
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
$returnRaw = $jinput->get('raw', false, 'BOOLEAN');
|
||||||
$typeValue = $jinput->get('type', NULL, 'INT');
|
$typeValue = $jinput->get('type', NULL, 'ALNUM');
|
||||||
if($typeValue && $user->id != 0)
|
if($typeValue && $user->id != 0)
|
||||||
{
|
{
|
||||||
$result = $this->getModel('ajax')->checkAliasField($typeValue);
|
$result = $this->getModel('ajax')->checkAliasField($typeValue);
|
||||||
|
@ -249,6 +249,66 @@ class ComponentbuilderModelAjax extends JModelList
|
|||||||
return function_exists('curl_version');
|
return function_exists('curl_version');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used in joomla_module
|
||||||
|
public function getModuleCode($data)
|
||||||
|
{
|
||||||
|
// reset the return array
|
||||||
|
$code = array();
|
||||||
|
if (ComponentbuilderHelper::checkJson($data))
|
||||||
|
{
|
||||||
|
// convert the data to object
|
||||||
|
$data = json_decode($data);
|
||||||
|
// set class
|
||||||
|
if (isset($data->class) && is_numeric($data->class) && ((int) $data->class == 2 || (int) $data->class == 1))
|
||||||
|
{
|
||||||
|
$code['class'] = array();
|
||||||
|
// add the code
|
||||||
|
$code['class']['code'] = '// Include the helper functions only once';
|
||||||
|
$code['class']['code'] .= PHP_EOL . "JLoader::register('Mod[[[Module]]]Helper', __DIR__ . '/helper.php');";
|
||||||
|
// set placement
|
||||||
|
$code['class']['merge'] = 1;
|
||||||
|
$code['class']['merge_target'] = 'prepend';
|
||||||
|
}
|
||||||
|
// get data
|
||||||
|
if (isset($data->get) && ComponentbuilderHelper::checkArray($data->get))
|
||||||
|
{
|
||||||
|
$code['get'] = array();
|
||||||
|
// add the code
|
||||||
|
$code['get']['code'] = '// Include the data functions only once';
|
||||||
|
$code['get']['code'] .= PHP_EOL . "JLoader::register('Mod[[[Module]]]Data', __DIR__ . '/data.php');";
|
||||||
|
// set placement
|
||||||
|
$code['get']['merge'] = 1;
|
||||||
|
$code['get']['merge_target'] = 'prepend';
|
||||||
|
}
|
||||||
|
// get libraries
|
||||||
|
if (isset($data->lib) && ComponentbuilderHelper::checkArray($data->lib))
|
||||||
|
{
|
||||||
|
$code['lib'] = array();
|
||||||
|
// add the code
|
||||||
|
$code['lib']['code'] = '[[[MOD_LIBRARIES]]]';
|
||||||
|
// set placement
|
||||||
|
$code['lib']['merge'] = 1;
|
||||||
|
$code['lib']['merge_target'] = '// get the module class sfx (local)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// set the defaults
|
||||||
|
$code['css'] = array();
|
||||||
|
$code['tmpl'] = array();
|
||||||
|
// add the code
|
||||||
|
$code['css']['code'] = '// get the module class sfx (local)';
|
||||||
|
$code['css']['code'] .= PHP_EOL . "\$moduleclass_sfx = htmlspecialchars(\$params->get('moduleclass_sfx'), ENT_COMPAT, 'UTF-8');";
|
||||||
|
$code['tmpl']['code'] = '// load the default Tmpl';
|
||||||
|
$code['tmpl']['code'] .= PHP_EOL . "require JModuleHelper::getLayoutPath('mod_[[[module]]]', \$params->get('layout', 'default'));";
|
||||||
|
// set placement
|
||||||
|
$code['css']['merge'] = 1;
|
||||||
|
$code['css']['merge_target'] = '// load the default Tmpl';
|
||||||
|
$code['tmpl']['merge'] = 1;
|
||||||
|
$code['tmpl']['merge_target'] = 'append';
|
||||||
|
|
||||||
|
return $code;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Used in joomla_plugin
|
// Used in joomla_plugin
|
||||||
public function getClassCode($id, $type)
|
public function getClassCode($id, $type)
|
||||||
{
|
{
|
||||||
|
@ -819,7 +819,7 @@ jQuery(document).ready(function()
|
|||||||
});
|
});
|
||||||
|
|
||||||
function checkAliasField() {
|
function checkAliasField() {
|
||||||
checkAliasField_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'checkAliasField').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
// remove the notice
|
// remove the notice
|
||||||
jQuery('.note_create_edit_notice_p').remove();
|
jQuery('.note_create_edit_notice_p').remove();
|
||||||
@ -848,7 +848,7 @@ function checkAliasField_server(type){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAjaxDisplay(type){
|
function getAjaxDisplay(type){
|
||||||
getAjaxDisplay_server(type).done(function(result) {
|
getCodeFrom_server(1, type, 'type', 'getAjaxDisplay').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_'+type).html(result);
|
jQuery('#display_'+type).html(result);
|
||||||
}
|
}
|
||||||
@ -857,69 +857,25 @@ function getAjaxDisplay(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAjaxDisplay_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && type.length > 0){
|
|
||||||
var request = token+'=1&type=' + type;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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 getTableColumns_server(tableName){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.tableColumns&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && tableName.length > 0){
|
|
||||||
var request = token+'=1&table='+tableName;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTableColumns(fieldKey, table_, nr_){
|
function getTableColumns(fieldKey, table_, nr_){
|
||||||
// first check if the field is set
|
// first check if the field is set
|
||||||
if(jQuery("#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_table").length) {
|
if(jQuery("#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_table").length) {
|
||||||
// get options
|
// get options
|
||||||
var tableName = jQuery("#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_table option:selected").val();
|
var tableName = jQuery("#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_table option:selected").val();
|
||||||
getTableColumns_server(tableName).done(function(result) {
|
getCodeFrom_server(1, tableName, 'table', 'tableColumns').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery("textarea#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_sourcemap").val(result);
|
jQuery("textarea#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_sourcemap").val(result);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
jQuery("textarea#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_sourcemap").val('');
|
jQuery("textarea#jform_addtables_"+table_+"addtables"+fieldKey+nr_+"_sourcemap").val('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDynamicScripts_server(typpe){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && typpe.length > 0){
|
|
||||||
var request = token+'=1&type='+typpe;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDynamicScripts(id){
|
function getDynamicScripts(id){
|
||||||
if (1 == id) {
|
if (1 == id) {
|
||||||
// get the current values
|
// get the current values
|
||||||
@ -932,7 +888,7 @@ function getDynamicScripts(id){
|
|||||||
var current_ext = jQuery('textarea#jform_php_import_ext').val();
|
var current_ext = jQuery('textarea#jform_php_import_ext').val();
|
||||||
// set the display method script
|
// set the display method script
|
||||||
if(current_import_display.length == 0){
|
if(current_import_display.length == 0){
|
||||||
getDynamicScripts_server('display').done(function(result) {
|
getCodeFrom_server(1, 'display', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import_display').val(result);
|
jQuery('textarea#jform_php_import_display').val(result);
|
||||||
}
|
}
|
||||||
@ -940,7 +896,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the import method script
|
// set the import method script
|
||||||
if(current_import.length == 0){
|
if(current_import.length == 0){
|
||||||
getDynamicScripts_server('import').done(function(result) {
|
getCodeFrom_server(1, 'import', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import').val(result);
|
jQuery('textarea#jform_php_import').val(result);
|
||||||
}
|
}
|
||||||
@ -948,7 +904,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the headers method script
|
// set the headers method script
|
||||||
if(current_headers.length == 0){
|
if(current_headers.length == 0){
|
||||||
getDynamicScripts_server('headers').done(function(result) {
|
getCodeFrom_server(1, 'headers', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import_headers').val(result);
|
jQuery('textarea#jform_php_import_headers').val(result);
|
||||||
}
|
}
|
||||||
@ -956,7 +912,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the setData method script
|
// set the setData method script
|
||||||
if(current_setdata.length == 0){
|
if(current_setdata.length == 0){
|
||||||
getDynamicScripts_server('setdata').done(function(result) {
|
getCodeFrom_server(1, 'setdata', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import_setdata').val(result);
|
jQuery('textarea#jform_php_import_setdata').val(result);
|
||||||
}
|
}
|
||||||
@ -964,7 +920,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the save method script
|
// set the save method script
|
||||||
if(current_save.length == 0){
|
if(current_save.length == 0){
|
||||||
getDynamicScripts_server('save').done(function(result) {
|
getCodeFrom_server(1, 'save', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import_save').val(result);
|
jQuery('textarea#jform_php_import_save').val(result);
|
||||||
}
|
}
|
||||||
@ -972,7 +928,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the view script
|
// set the view script
|
||||||
if(current_view.length == 0){
|
if(current_view.length == 0){
|
||||||
getDynamicScripts_server('view').done(function(result) {
|
getCodeFrom_server(1, 'view', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_html_import_view').val(result);
|
jQuery('textarea#jform_html_import_view').val(result);
|
||||||
}
|
}
|
||||||
@ -980,7 +936,7 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
// set the import ext script
|
// set the import ext script
|
||||||
if(current_ext.length == 0){
|
if(current_ext.length == 0){
|
||||||
getDynamicScripts_server('ext').done(function(result) {
|
getCodeFrom_server(1, 'ext', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('textarea#jform_php_import_ext').val(result);
|
jQuery('textarea#jform_php_import_ext').val(result);
|
||||||
}
|
}
|
||||||
@ -989,6 +945,21 @@ function getDynamicScripts(id){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
|
}
|
||||||
|
return jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: getUrl,
|
||||||
|
dataType: 'json',
|
||||||
|
data: request,
|
||||||
|
jsonp: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && id > 0){
|
if(token.length > 0 && id > 0){
|
||||||
@ -1080,22 +1051,8 @@ function addButton(type, where, size){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && type > 0){
|
|
||||||
var request = token+'=1&type='+type;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
|
@ -206,10 +206,10 @@ jQuery(document).ready(function()
|
|||||||
getEditCustomCodeButtons();
|
getEditCustomCodeButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getLinked_server(type){
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && type > 0){
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
var request = token+'=1&type='+type;
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@ -220,30 +220,17 @@ function getLinked_server(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSnippetDetails_server(snippetId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json");
|
|
||||||
if(token.length > 0 && snippetId > 0){
|
|
||||||
var request = token+'=1&id='+snippetId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSnippetDetails(id){
|
function getSnippetDetails(id){
|
||||||
getSnippetDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||||
if(result.snippet){
|
if(result.snippet){
|
||||||
var description = '';
|
var description = '';
|
||||||
if (result.description.length > 0) {
|
if (result.description.length > 0) {
|
||||||
@ -330,22 +317,8 @@ function getLayoutDetails(id){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemplateDetails_server(id){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && id > 0){
|
|
||||||
var request = token+'=1&id='+id;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTemplateDetails(id){
|
function getTemplateDetails(id){
|
||||||
getTemplateDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#details').append(result);
|
jQuery('#details').append(result);
|
||||||
// make sure the code bocks are active
|
// make sure the code bocks are active
|
||||||
@ -373,28 +346,15 @@ jQuery(document).ready(function($)
|
|||||||
getSnippets();
|
getSnippets();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSnippets_server(libraries){
|
|
||||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json";
|
|
||||||
if(token.length > 0 && libraries.length > 0){
|
|
||||||
var request = token+'=1&libraries='+JSON.stringify(libraries);
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getSnippets(){
|
function getSnippets(){
|
||||||
jQuery("#loading").show();
|
jQuery("#loading").show();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
jQuery('#jform_snippet').find('option').remove().end();
|
jQuery('#jform_snippet').find('option').remove().end();
|
||||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||||
// get country value if set
|
// get libraries value if set
|
||||||
var libraries = jQuery("#jform_libraries").val();
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
if (libraries) {
|
if (libraries) {
|
||||||
getSnippets_server(libraries).done(function(result) {
|
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||||
setSnippets(result);
|
setSnippets(result);
|
||||||
jQuery("#loading").hide();
|
jQuery("#loading").hide();
|
||||||
if (typeof snippetButton !== 'undefined') {
|
if (typeof snippetButton !== 'undefined') {
|
||||||
|
@ -1451,13 +1451,10 @@ function getViewTableColumns(id, asKey, key, rowType, main, table_, nr_){
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getViewTableColumns_server(id,asKey,rowType).done(function(result) {
|
getViewTableColumns_server(id, asKey, rowType).done(function(result) {
|
||||||
if (result)
|
if (result) {
|
||||||
{
|
|
||||||
loadSelectionData(result, 'view', key, main, table_, nr_);
|
loadSelectionData(result, 'view', key, main, table_, nr_);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
loadSelectionData(false, 'view', key, main, table_, nr_);
|
loadSelectionData(false, 'view', key, main, table_, nr_);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1466,8 +1463,7 @@ function getViewTableColumns(id, asKey, key, rowType, main, table_, nr_){
|
|||||||
function getDbTableColumns_server(name,asKey,rowType)
|
function getDbTableColumns_server(name,asKey,rowType)
|
||||||
{
|
{
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.dbTableColumns&format=json&raw=true");
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.dbTableColumns&format=json&raw=true");
|
||||||
if (token.length > 0 && name.length > 0 && asKey.length > 0)
|
if (token.length > 0 && name.length > 0 && asKey.length > 0) {
|
||||||
{
|
|
||||||
var request = token+'=1&as='+asKey+'&type='+rowType+'&name='+name;
|
var request = token+'=1&as='+asKey+'&type='+rowType+'&name='+name;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
@ -1490,12 +1486,9 @@ function getDbTableColumns(name, asKey, key, rowType, main, table_, nr_){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
getDbTableColumns_server(name,asKey,rowType).done(function(result) {
|
getDbTableColumns_server(name,asKey,rowType).done(function(result) {
|
||||||
if (result)
|
if (result) {
|
||||||
{
|
|
||||||
loadSelectionData(result, 'db', key, main, table_, nr_);
|
loadSelectionData(result, 'db', key, main, table_, nr_);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
loadSelectionData(false, 'db', key, main, table_, nr_);
|
loadSelectionData(false, 'db', key, main, table_, nr_);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1562,10 +1555,25 @@ function updateSubItems(fieldName, fieldNr, table_, nr_) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDynamicScripts_server(typpe){
|
function getDynamicScripts(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicScripts&format=json&raw=true&vdm="+vastDevMod);
|
if (1 == id) {
|
||||||
if(token.length > 0 && typpe.length > 0){
|
// get the current values
|
||||||
var request = token+'=1&type='+typpe;
|
var current_router_parse = jQuery('textarea#jform_php_router_parse').val();
|
||||||
|
// set the router parse method script
|
||||||
|
if(current_router_parse.length == 0){
|
||||||
|
getCodeFrom_server(1, 'routerparse', 'type', 'getDynamicScripts').done(function(result) {
|
||||||
|
if(result){
|
||||||
|
jQuery('textarea#jform_php_router_parse').val(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@ -1576,20 +1584,6 @@ function getDynamicScripts_server(typpe){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDynamicScripts(id){
|
|
||||||
if (1 == id) {
|
|
||||||
// get the current values
|
|
||||||
var current_router_parse = jQuery('textarea#jform_php_router_parse').val();
|
|
||||||
// set the router parse method script
|
|
||||||
if(current_router_parse.length == 0){
|
|
||||||
getDynamicScripts_server('routerparse').done(function(result) {
|
|
||||||
if(result){
|
|
||||||
jQuery('textarea#jform_php_router_parse').val(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
@ -1630,22 +1624,8 @@ function isObject(obj) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && type > 0){
|
|
||||||
var request = token+'=1&type='+type;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
|
@ -806,22 +806,8 @@ jQuery(document).ready(function()
|
|||||||
// the options row id key
|
// the options row id key
|
||||||
var rowIdKey = 'properties';
|
var rowIdKey = 'properties';
|
||||||
|
|
||||||
function getFieldOptions_server(fieldtype){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldOptions&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && fieldtype > 0){
|
|
||||||
var request = token+'=1&id='+fieldtype;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFieldOptions(fieldtype, db){
|
function getFieldOptions(fieldtype, db){
|
||||||
getFieldOptions_server(fieldtype).done(function(result) {
|
getCodeFrom_server(fieldtype, 'type', 'type', 'fieldOptions').done(function(result) {
|
||||||
if(result.subform){
|
if(result.subform){
|
||||||
// load the list of properties
|
// load the list of properties
|
||||||
propertiesArray = result.nameListOptions;
|
propertiesArray = result.nameListOptions;
|
||||||
@ -1011,7 +997,7 @@ function propertyIsSet(prop, id, targetForm) {
|
|||||||
|
|
||||||
function getFieldPropertyDesc_server(fieldtype, property){
|
function getFieldPropertyDesc_server(fieldtype, property){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getFieldPropertyDesc&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && (fieldtype > 0 || fieldtype.length > 0)&& property.length > 0){
|
if(token.length > 0 && (fieldtype > 0 || fieldtype.length > 0) && property.length > 0){
|
||||||
var request = token+'=1&fieldtype='+fieldtype+'&property='+property;
|
var request = token+'=1&fieldtype='+fieldtype+'&property='+property;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
@ -1023,23 +1009,8 @@ function getFieldPropertyDesc_server(fieldtype, property){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getValidationRulesTable_server(){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getValidationRulesTable&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0){
|
|
||||||
var request = token+'=1&id=1';
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getValidationRulesTable(){
|
function getValidationRulesTable(){
|
||||||
getValidationRulesTable_server().done(function(result) {
|
getCodeFrom_server(1,'type','type', 'getValidationRulesTable').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_validation_rules').html(result);
|
jQuery('#display_validation_rules').html(result);
|
||||||
}
|
}
|
||||||
@ -1093,10 +1064,10 @@ function dbChecker(type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked_server(type){
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && type > 0){
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
var request = token+'=1&type='+type;
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@ -1107,8 +1078,9 @@ function getLinked_server(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
|
@ -532,18 +532,50 @@ function isSet(val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
jQuery(document).ready(function()
|
jQuery(document).ready(function() {
|
||||||
{
|
|
||||||
// get the linked details
|
// get the linked details
|
||||||
getLinked();
|
getLinked();
|
||||||
// check and load all the customcode edit buttons
|
// check and load all the customcode edit buttons
|
||||||
setTimeout(getEditCustomCodeButtons, 300);
|
setTimeout(getEditCustomCodeButtons, 300);
|
||||||
});
|
});
|
||||||
|
|
||||||
function getLinked_server(type){
|
function setModuleCode() {
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
var selected_get = jQuery("#jform_add_class_helper option:selected").val();
|
||||||
if(token.length > 0 && type > 0){
|
var custom_gets = jQuery("#jform_custom_get").val();
|
||||||
var request = token+'=1&type='+type;
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
|
var values = {'class': selected_get, 'get': custom_gets, 'lib': libraries};
|
||||||
|
var editor_id = 'jform_mod_code';
|
||||||
|
getCodeFrom_server(1, JSON.stringify(values), 'data', 'getModuleCode').done(function(result) {
|
||||||
|
if(result.tmpl){
|
||||||
|
addCodeToEditor(result.tmpl.code, editor_id, result.tmpl.merge, result.tmpl.merge_target);
|
||||||
|
}
|
||||||
|
if(result.css){
|
||||||
|
addCodeToEditor(result.css.code, editor_id, result.css.merge, result.css.merge_target);
|
||||||
|
}
|
||||||
|
if(result.class){
|
||||||
|
addCodeToEditor(result.class.code, editor_id, result.class.merge, result.class.merge_target);
|
||||||
|
}
|
||||||
|
if(result.get){
|
||||||
|
addCodeToEditor(result.get.code, editor_id, result.get.merge, result.get.merge_target);
|
||||||
|
}
|
||||||
|
if(result.lib){
|
||||||
|
addCodeToEditor(result.lib.code, editor_id, result.lib.merge, result.lib.merge_target);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getLinked(){
|
||||||
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
|
if(result){
|
||||||
|
jQuery('#display_linked_to').html(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@ -554,14 +586,87 @@ function getLinked_server(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked(){
|
|
||||||
getLinked_server(1).done(function(result) {
|
function addCodeToEditor(code_string, editor_id, merge, merge_target){
|
||||||
if(result){
|
if (Joomla.editors.instances.hasOwnProperty(editor_id)) {
|
||||||
jQuery('#display_linked_to').html(result);
|
var old_code_string = Joomla.editors.instances[editor_id].getValue();
|
||||||
|
if (merge && old_code_string.length > 0) {
|
||||||
|
// make sure not to load the same string twice
|
||||||
|
if (old_code_string.indexOf(code_string) == -1) {
|
||||||
|
if ('prepend' === merge_target) {
|
||||||
|
var _string = code_string + "\n\n" + old_code_string;
|
||||||
|
} else if (merge_target && 'append' !== merge_target) {
|
||||||
|
var old_code_array = old_code_string.split(merge_target);
|
||||||
|
if (old_code_array.length > 1) {
|
||||||
|
var _string = old_code_array.shift() + "\n\n" + code_string + "\n\n" + merge_target + old_code_array.join(merge_target);
|
||||||
|
} else {
|
||||||
|
var _string = code_string + "\n\n" + merge_target + old_code_array.join('');
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
var _string = old_code_string + "\n\n" + code_string;
|
||||||
|
}
|
||||||
|
Joomla.editors.instances[editor_id].setValue(_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Joomla.editors.instances[editor_id].setValue(code_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var old_code_string = jQuery('textarea#'+editor_id).val();
|
||||||
|
if (merge && old_code_string.length > 0) {
|
||||||
|
// make sure not to load the same string twice
|
||||||
|
if (old_code_string.indexOf(code_string) == -1) {
|
||||||
|
if ('prepend' === merge_target) {
|
||||||
|
var _string = code_string + "\n\n" + old_code_string;
|
||||||
|
} else if (merge_target && 'append' !== merge_target) {
|
||||||
|
var old_code_array = old_code_string.split(merge_target);
|
||||||
|
if (old_code_array.length > 1) {
|
||||||
|
var _string = old_code_array.shift() + "\n\n" + code_string + "\n\n" + merge_target + old_code_array.join(merge_target);
|
||||||
|
} else {
|
||||||
|
var _string = code_string + "\n\n" + merge_target + old_code_array.join('');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var _string = old_code_string + "\n\n" + code_string;
|
||||||
|
}
|
||||||
|
jQuery('textarea#'+editor_id).val(_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jQuery('textarea#'+editor_id).val(code_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function removeCodeFromEditor(code_string, editor_id){
|
||||||
|
if (Joomla.editors.instances.hasOwnProperty(editor_id)) {
|
||||||
|
var old_code_string = Joomla.editors.instances[editor_id].getValue();
|
||||||
|
if (old_code_string.length > 0) {
|
||||||
|
// make sure string is found
|
||||||
|
if (old_code_string.indexOf(code_string) !== -1) {
|
||||||
|
// remove the code
|
||||||
|
Joomla.editors.instances[editor_id].setValue(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var old_code_string = jQuery('textarea#'+editor_id).val();
|
||||||
|
if (old_code_string.length > 0) {
|
||||||
|
// make sure string is found
|
||||||
|
if (old_code_string.indexOf(code_string) !== -1) {
|
||||||
|
// remove the code
|
||||||
|
jQuery('textarea#'+editor_id).val(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && id > 0){
|
if(token.length > 0 && id > 0){
|
||||||
@ -601,22 +706,8 @@ function isObject(obj) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSnippetDetails_server(snippetId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json");
|
|
||||||
if(token.length > 0 && snippetId > 0){
|
|
||||||
var request = token+'=1&id='+snippetId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSnippetDetails(id){
|
function getSnippetDetails(id){
|
||||||
getSnippetDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||||
if(result.snippet){
|
if(result.snippet){
|
||||||
var description = '';
|
var description = '';
|
||||||
if (result.description.length > 0) {
|
if (result.description.length > 0) {
|
||||||
@ -667,28 +758,15 @@ jQuery(document).ready(function($)
|
|||||||
getSnippets();
|
getSnippets();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSnippets_server(libraries){
|
|
||||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json";
|
|
||||||
if(token.length > 0 && libraries.length > 0){
|
|
||||||
var request = token+'=1&libraries='+JSON.stringify(libraries);
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getSnippets(){
|
function getSnippets(){
|
||||||
jQuery("#loading").show();
|
jQuery("#loading").show();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
jQuery('#jform_snippet').find('option').remove().end();
|
jQuery('#jform_snippet').find('option').remove().end();
|
||||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||||
// get country value if set
|
// get libraries value if set
|
||||||
var libraries = jQuery("#jform_libraries").val();
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
if (libraries) {
|
if (libraries) {
|
||||||
getSnippets_server(libraries).done(function(result) {
|
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||||
setSnippets(result);
|
setSnippets(result);
|
||||||
jQuery("#loading").hide();
|
jQuery("#loading").hide();
|
||||||
if (typeof snippetButton !== 'undefined') {
|
if (typeof snippetButton !== 'undefined') {
|
||||||
|
@ -685,6 +685,21 @@ jQuery(document).ready(function()
|
|||||||
rowWatcher();
|
rowWatcher();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
|
}
|
||||||
|
return jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: getUrl,
|
||||||
|
dataType: 'json',
|
||||||
|
data: request,
|
||||||
|
jsonp: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// set selection the options
|
// set selection the options
|
||||||
selectionMemory = {'property':{},'method':{}};
|
selectionMemory = {'property':{},'method':{}};
|
||||||
selectionActiveArray = {'property':{},'method':{}};
|
selectionActiveArray = {'property':{},'method':{}};
|
||||||
@ -702,20 +717,6 @@ function buildSelectionMemory(type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getClassStuff_server(id, type, callingName){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax."+callingName+"&format=json&raw=true");
|
|
||||||
if(token.length > 0 && id > 0 && type.length > 0){
|
|
||||||
var request = token+'=1&type=' + type + '&id=' + id;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getClassHeaderCode(){
|
function getClassHeaderCode(){
|
||||||
// now get the values
|
// now get the values
|
||||||
var value = jQuery("#jform_class_extends option:selected").val();
|
var value = jQuery("#jform_class_extends option:selected").val();
|
||||||
@ -725,13 +726,13 @@ function getClassHeaderCode(){
|
|||||||
var _result = jQuery.jStorage.get('extends_header_'+value, null);
|
var _result = jQuery.jStorage.get('extends_header_'+value, null);
|
||||||
if (_result) {
|
if (_result) {
|
||||||
// now set the code
|
// now set the code
|
||||||
addCodeToEditor(_result, "jform_head", false);
|
addCodeToEditor(_result, "jform_head", false, null);
|
||||||
} else {
|
} else {
|
||||||
// now get the code
|
// now get the code
|
||||||
getClassStuff_server(value, 'extends', 'getClassHeaderCode').done(function(result) {
|
getCodeFrom_server(value, 'extends', 'type', 'getClassHeaderCode').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
// now set the code
|
// now set the code
|
||||||
addCodeToEditor(result, "jform_head", false);
|
addCodeToEditor(result, "jform_head", false, null);
|
||||||
// add result to local memory
|
// add result to local memory
|
||||||
jQuery.jStorage.set('extends_header_'+value, result, {TTL: expire});
|
jQuery.jStorage.set('extends_header_'+value, result, {TTL: expire});
|
||||||
}
|
}
|
||||||
@ -744,7 +745,7 @@ function getClassCodeIds(type, target_field, reset_all){
|
|||||||
// now get the value
|
// now get the value
|
||||||
var value = jQuery('#'+target_field).val();
|
var value = jQuery('#'+target_field).val();
|
||||||
// now get the code
|
// now get the code
|
||||||
getClassStuff_server(value, type, 'getClassCodeIds').done(function(result) {
|
getCodeFrom_server(value, type, 'type', 'getClassCodeIds').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
// reset the selection
|
// reset the selection
|
||||||
selectionActiveArray[type] = {};
|
selectionActiveArray[type] = {};
|
||||||
@ -834,15 +835,15 @@ function getClassCode(field, type){
|
|||||||
var _result = jQuery.jStorage.get('code_4_'+type+'_'+old_value, null);
|
var _result = jQuery.jStorage.get('code_4_'+type+'_'+old_value, null);
|
||||||
if (_result) {
|
if (_result) {
|
||||||
// now remove the code
|
// now remove the code
|
||||||
if (removeCodeFromEditor(_result)) {
|
if (removeCodeFromEditor(_result, 'jform_main_class_code')) {
|
||||||
selectionMemory[type][id] = 0;
|
selectionMemory[type][id] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// now get the code
|
// now get the code
|
||||||
getClassStuff_server(old_value, type, 'getClassCode').done(function(result) {
|
getCodeFrom_server(old_value, type, 'type', 'getClassCode').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
// now remove the code
|
// now remove the code
|
||||||
if (removeCodeFromEditor(result)) {
|
if (removeCodeFromEditor(result, 'jform_main_class_code')) {
|
||||||
selectionMemory[type][id] = 0;
|
selectionMemory[type][id] = 0;
|
||||||
}
|
}
|
||||||
// add result to local memory
|
// add result to local memory
|
||||||
@ -862,19 +863,25 @@ function getClassCode(field, type){
|
|||||||
selectedIdRemoved[type] = id;
|
selectedIdRemoved[type] = id;
|
||||||
// do a dynamic update (to remove what was already used)
|
// do a dynamic update (to remove what was already used)
|
||||||
selectionDynamicUpdate(type);
|
selectionDynamicUpdate(type);
|
||||||
|
// set the add action
|
||||||
|
if (type === 'property') {
|
||||||
|
var _action_add = 'prepend';
|
||||||
|
} else {
|
||||||
|
var _action_add = 'append';
|
||||||
|
}
|
||||||
// we first check local memory
|
// we first check local memory
|
||||||
var _result = jQuery.jStorage.get('code_4_'+type+'_'+value, null);
|
var _result = jQuery.jStorage.get('code_4_'+type+'_'+value, null);
|
||||||
if (_result) {
|
if (_result) {
|
||||||
// now set the code
|
// now set the code
|
||||||
if (addCodeToEditor(_result, "jform_main_class_code", true)) {
|
if (addCodeToEditor(_result, "jform_main_class_code", true, _action_add)) {
|
||||||
selectionMemory[type][id] = value;
|
selectionMemory[type][id] = value;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// now get the code
|
// now get the code
|
||||||
getClassStuff_server(value, type, 'getClassCode').done(function(result) {
|
getCodeFrom_server(value, type, 'type', 'getClassCode').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
// now set the code
|
// now set the code
|
||||||
if (addCodeToEditor(result, "jform_main_class_code", true)) {
|
if (addCodeToEditor(result, "jform_main_class_code", true, _action_add)) {
|
||||||
selectionMemory[type][id] = value;
|
selectionMemory[type][id] = value;
|
||||||
}
|
}
|
||||||
// add result to local memory
|
// add result to local memory
|
||||||
@ -885,60 +892,6 @@ function getClassCode(field, type){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addCodeToEditor(code_string, editor_id, merge){
|
|
||||||
if (Joomla.editors.instances.hasOwnProperty(editor_id)) {
|
|
||||||
var old_code_string = Joomla.editors.instances[editor_id].getValue();
|
|
||||||
if (merge && old_code_string.length > 0) {
|
|
||||||
// make sure not to load the same string twice
|
|
||||||
if (old_code_string.indexOf(code_string) == -1) {
|
|
||||||
Joomla.editors.instances[editor_id].setValue(old_code_string + "\n\n" + code_string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Joomla.editors.instances[editor_id].setValue(code_string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var old_code_string = jQuery('textarea#'+editor_id).val();
|
|
||||||
if (merge && old_code_string.length > 0) {
|
|
||||||
// make sure not to load the same string twice
|
|
||||||
if (old_code_string.indexOf(code_string) == -1) {
|
|
||||||
jQuery('textarea#'+editor_id).val(old_code_string + "\n\n" + code_string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
jQuery('textarea#'+editor_id).val(code_string);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeCodeFromEditor(code_string){
|
|
||||||
if (Joomla.editors.instances.hasOwnProperty("jform_main_class_code")) {
|
|
||||||
var old_code_string = Joomla.editors.instances['jform_main_class_code'].getValue();
|
|
||||||
if (old_code_string.length > 0) {
|
|
||||||
// make sure not to load the same string twice
|
|
||||||
if (old_code_string.indexOf(code_string) !== -1) {
|
|
||||||
// remove the code
|
|
||||||
Joomla.editors.instances['jform_main_class_code'].setValue(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var old_code_string = jQuery('textarea#jform_main_class_code').val();
|
|
||||||
if (old_code_string.length > 0) {
|
|
||||||
// make sure not to load the same string twice
|
|
||||||
if (old_code_string.indexOf(code_string) !== -1) {
|
|
||||||
// remove the code
|
|
||||||
jQuery('textarea#jform_main_class_code').val(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectionDynamicUpdate(type) {
|
function selectionDynamicUpdate(type) {
|
||||||
selectionAvailable = {};
|
selectionAvailable = {};
|
||||||
selectionSelectedArray = {};
|
selectionSelectedArray = {};
|
||||||
@ -1001,14 +954,14 @@ function rowWatcher() {
|
|||||||
var _result = jQuery.jStorage.get('code_4_'+type_call+'_'+valid_value, null);
|
var _result = jQuery.jStorage.get('code_4_'+type_call+'_'+valid_value, null);
|
||||||
if (_result) {
|
if (_result) {
|
||||||
// now remove the code
|
// now remove the code
|
||||||
if (removeCodeFromEditor(_result)) {
|
if (removeCodeFromEditor(_result, 'jform_main_class_code')) {
|
||||||
selectionMemory[type_call][valid_call] = 0;
|
selectionMemory[type_call][valid_call] = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// now get the code
|
// now get the code
|
||||||
getClassStuff_server(valid_value, type_call, 'getClassCode').done(function(result) {
|
getCodeFrom_server(valid_value, type_call, 'type', 'getClassCode').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
if (removeCodeFromEditor(result)) {
|
if (removeCodeFromEditor(result, 'jform_main_class_code')) {
|
||||||
selectionMemory[type_call][valid_call] = 0;;
|
selectionMemory[type_call][valid_call] = 0;;
|
||||||
}
|
}
|
||||||
// add result to local memory
|
// add result to local memory
|
||||||
@ -1053,22 +1006,89 @@ function propertyIsSet(prop, id, type) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
function addCodeToEditor(code_string, editor_id, merge, merge_target){
|
||||||
if(token.length > 0 && type > 0){
|
if (Joomla.editors.instances.hasOwnProperty(editor_id)) {
|
||||||
var request = token+'=1&type='+type;
|
var old_code_string = Joomla.editors.instances[editor_id].getValue();
|
||||||
|
if (merge && old_code_string.length > 0) {
|
||||||
|
// make sure not to load the same string twice
|
||||||
|
if (old_code_string.indexOf(code_string) == -1) {
|
||||||
|
if ('prepend' === merge_target) {
|
||||||
|
var _string = code_string + "\n\n" + old_code_string;
|
||||||
|
} else if (merge_target && 'append' !== merge_target) {
|
||||||
|
var old_code_array = old_code_string.split(merge_target);
|
||||||
|
if (old_code_array.length > 1) {
|
||||||
|
var _string = old_code_array.shift() + "\n\n" + code_string + "\n\n" + merge_target + old_code_array.join(merge_target);
|
||||||
|
} else {
|
||||||
|
var _string = code_string + "\n\n" + merge_target + old_code_array.join('');
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
} else {
|
||||||
type: 'GET',
|
var _string = old_code_string + "\n\n" + code_string;
|
||||||
url: getUrl,
|
}
|
||||||
dataType: 'json',
|
Joomla.editors.instances[editor_id].setValue(_string.trim());
|
||||||
data: request,
|
return true;
|
||||||
jsonp: false
|
}
|
||||||
});
|
} else {
|
||||||
|
Joomla.editors.instances[editor_id].setValue(code_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var old_code_string = jQuery('textarea#'+editor_id).val();
|
||||||
|
if (merge && old_code_string.length > 0) {
|
||||||
|
// make sure not to load the same string twice
|
||||||
|
if (old_code_string.indexOf(code_string) == -1) {
|
||||||
|
if ('prepend' === merge_target) {
|
||||||
|
var _string = code_string + "\n\n" + old_code_string;
|
||||||
|
} else if (merge_target && 'append' !== merge_target) {
|
||||||
|
var old_code_array = old_code_string.split(merge_target);
|
||||||
|
if (old_code_array.length > 1) {
|
||||||
|
var _string = old_code_array.shift() + "\n\n" + code_string + "\n\n" + merge_target + old_code_array.join(merge_target);
|
||||||
|
} else {
|
||||||
|
var _string = code_string + "\n\n" + merge_target + old_code_array.join('');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var _string = old_code_string + "\n\n" + code_string;
|
||||||
|
}
|
||||||
|
jQuery('textarea#'+editor_id).val(_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
jQuery('textarea#'+editor_id).val(code_string.trim());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function removeCodeFromEditor(code_string, editor_id){
|
||||||
|
if (Joomla.editors.instances.hasOwnProperty(editor_id)) {
|
||||||
|
var old_code_string = Joomla.editors.instances[editor_id].getValue();
|
||||||
|
if (old_code_string.length > 0) {
|
||||||
|
// make sure string is found
|
||||||
|
if (old_code_string.indexOf(code_string) !== -1) {
|
||||||
|
// remove the code
|
||||||
|
Joomla.editors.instances[editor_id].setValue(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var old_code_string = jQuery('textarea#'+editor_id).val();
|
||||||
|
if (old_code_string.length > 0) {
|
||||||
|
// make sure string is found
|
||||||
|
if (old_code_string.indexOf(code_string) !== -1) {
|
||||||
|
// remove the code
|
||||||
|
jQuery('textarea#'+editor_id).val(old_code_string.replace(code_string+"\n\n",'').replace("\n\n"+code_string,'').replace(code_string,''));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,21 @@ jQuery(document).ready(function($)
|
|||||||
getEditCustomCodeButtons();
|
getEditCustomCodeButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
|
}
|
||||||
|
return jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: getUrl,
|
||||||
|
dataType: 'json',
|
||||||
|
data: request,
|
||||||
|
jsonp: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && id > 0){
|
if(token.length > 0 && id > 0){
|
||||||
@ -84,22 +99,8 @@ function isObject(obj) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSnippetDetails_server(snippetId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json");
|
|
||||||
if(token.length > 0 && snippetId > 0){
|
|
||||||
var request = token+'=1&id='+snippetId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSnippetDetails(id){
|
function getSnippetDetails(id){
|
||||||
getSnippetDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||||
if(result.snippet){
|
if(result.snippet){
|
||||||
var description = '';
|
var description = '';
|
||||||
if (result.description.length > 0) {
|
if (result.description.length > 0) {
|
||||||
@ -203,28 +204,15 @@ jQuery(document).ready(function($)
|
|||||||
getSnippets();
|
getSnippets();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSnippets_server(libraries){
|
|
||||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json";
|
|
||||||
if(token.length > 0 && libraries.length > 0){
|
|
||||||
var request = token+'=1&libraries='+JSON.stringify(libraries);
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getSnippets(){
|
function getSnippets(){
|
||||||
jQuery("#loading").show();
|
jQuery("#loading").show();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
jQuery('#jform_snippet').find('option').remove().end();
|
jQuery('#jform_snippet').find('option').remove().end();
|
||||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||||
// get country value if set
|
// get libraries value if set
|
||||||
var libraries = jQuery("#jform_libraries").val();
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
if (libraries) {
|
if (libraries) {
|
||||||
getSnippets_server(libraries).done(function(result) {
|
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||||
setSnippets(result);
|
setSnippets(result);
|
||||||
jQuery("#loading").hide();
|
jQuery("#loading").hide();
|
||||||
if (typeof snippetButton !== 'undefined') {
|
if (typeof snippetButton !== 'undefined') {
|
||||||
|
@ -868,7 +868,7 @@ function addData(result,where){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAjaxDisplay(type){
|
function getAjaxDisplay(type){
|
||||||
getAjaxDisplay_server(type).done(function(result) {
|
getCodeFrom_server(1, type, 'type', 'getAjaxDisplay').done(function(result) {
|
||||||
if (result) {
|
if (result) {
|
||||||
jQuery('#display_'+type).html(result);
|
jQuery('#display_'+type).html(result);
|
||||||
}
|
}
|
||||||
@ -877,39 +877,11 @@ function getAjaxDisplay(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAjaxDisplay_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if (token.length > 0 && type.length > 0) {
|
|
||||||
var request = token+'=1&type=' + type;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFieldSelectOptions_server(fieldId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json&raw=true");
|
|
||||||
if (token.length > 0 && fieldId > 0) {
|
|
||||||
var request = token+'=1&id='+fieldId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFieldSelectOptions(fieldKey){
|
function getFieldSelectOptions(fieldKey){
|
||||||
// first check if the field is set
|
// first check if the field is set
|
||||||
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field").length) {
|
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field").length) {
|
||||||
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field option:selected").val();
|
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__option_field option:selected").val();
|
||||||
getFieldSelectOptions_server(fieldId).done(function(result) {
|
getCodeFrom_server(fieldId, 'type', 'type', 'fieldSelectOptions').done(function(result) {
|
||||||
if(result) {
|
if(result) {
|
||||||
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__field_options').val(result);
|
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__field_options').val(result);
|
||||||
} else {
|
} else {
|
||||||
@ -919,6 +891,21 @@ function getFieldSelectOptions(fieldKey){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
|
}
|
||||||
|
return jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: getUrl,
|
||||||
|
dataType: 'json',
|
||||||
|
data: request,
|
||||||
|
jsonp: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && id > 0){
|
if(token.length > 0 && id > 0){
|
||||||
@ -1010,22 +997,8 @@ function addButton(type, where, size){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLinked_server(type){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && type > 0){
|
|
||||||
var request = token+'=1&type='+type;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
|
@ -247,10 +247,10 @@ jQuery(document).ready(function()
|
|||||||
getEditCustomCodeButtons();
|
getEditCustomCodeButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getLinked_server(type){
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLinked&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && type > 0){
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
var request = token+'=1&type='+type;
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
}
|
}
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
@ -261,30 +261,17 @@ function getLinked_server(type){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getLinked(){
|
function getLinked(){
|
||||||
getLinked_server(1).done(function(result) {
|
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#display_linked_to').html(result);
|
jQuery('#display_linked_to').html(result);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSnippetDetails_server(snippetId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json");
|
|
||||||
if(token.length > 0 && snippetId > 0){
|
|
||||||
var request = token+'=1&id='+snippetId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSnippetDetails(id){
|
function getSnippetDetails(id){
|
||||||
getSnippetDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||||
if(result.snippet){
|
if(result.snippet){
|
||||||
var description = '';
|
var description = '';
|
||||||
if (result.description.length > 0) {
|
if (result.description.length > 0) {
|
||||||
@ -371,22 +358,8 @@ function getLayoutDetails(id){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemplateDetails_server(id){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && id > 0){
|
|
||||||
var request = token+'=1&id='+id;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTemplateDetails(id){
|
function getTemplateDetails(id){
|
||||||
getTemplateDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#details').append(result);
|
jQuery('#details').append(result);
|
||||||
// make sure the code bocks are active
|
// make sure the code bocks are active
|
||||||
@ -414,28 +387,15 @@ jQuery(document).ready(function($)
|
|||||||
getSnippets();
|
getSnippets();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSnippets_server(libraries){
|
|
||||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json";
|
|
||||||
if(token.length > 0 && libraries.length > 0){
|
|
||||||
var request = token+'=1&libraries='+JSON.stringify(libraries);
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getSnippets(){
|
function getSnippets(){
|
||||||
jQuery("#loading").show();
|
jQuery("#loading").show();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
jQuery('#jform_snippet').find('option').remove().end();
|
jQuery('#jform_snippet').find('option').remove().end();
|
||||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||||
// get country value if set
|
// get libraries value if set
|
||||||
var libraries = jQuery("#jform_libraries").val();
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
if (libraries) {
|
if (libraries) {
|
||||||
getSnippets_server(libraries).done(function(result) {
|
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||||
setSnippets(result);
|
setSnippets(result);
|
||||||
jQuery("#loading").hide();
|
jQuery("#loading").hide();
|
||||||
if (typeof snippetButton !== 'undefined') {
|
if (typeof snippetButton !== 'undefined') {
|
||||||
|
@ -45,6 +45,21 @@ jQuery(document).ready(function($)
|
|||||||
getEditCustomCodeButtons();
|
getEditCustomCodeButtons();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getCodeFrom_server(id, type, type_name, callingName){
|
||||||
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax." + callingName + "&format=json&raw=true&vdm="+vastDevMod);
|
||||||
|
if(token.length > 0 && id > 0 && type.length > 0) {
|
||||||
|
var request = token + '=1&' + type_name + '=' + type + '&id=' + id;
|
||||||
|
}
|
||||||
|
return jQuery.ajax({
|
||||||
|
type: 'GET',
|
||||||
|
url: getUrl,
|
||||||
|
dataType: 'json',
|
||||||
|
data: request,
|
||||||
|
jsonp: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getEditCustomCodeButtons_server(id){
|
function getEditCustomCodeButtons_server(id){
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||||
if(token.length > 0 && id > 0){
|
if(token.length > 0 && id > 0){
|
||||||
@ -84,22 +99,8 @@ function isObject(obj) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSnippetDetails_server(snippetId){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.snippetDetails&format=json");
|
|
||||||
if(token.length > 0 && snippetId > 0){
|
|
||||||
var request = token+'=1&id='+snippetId;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getSnippetDetails(id){
|
function getSnippetDetails(id){
|
||||||
getSnippetDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||||
if(result.snippet){
|
if(result.snippet){
|
||||||
var description = '';
|
var description = '';
|
||||||
if (result.description.length > 0) {
|
if (result.description.length > 0) {
|
||||||
@ -186,22 +187,8 @@ function getLayoutDetails(id){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTemplateDetails_server(id){
|
|
||||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.templateDetails&format=json&vdm="+vastDevMod);
|
|
||||||
if(token.length > 0 && id > 0){
|
|
||||||
var request = token+'=1&id='+id;
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'jsonp',
|
|
||||||
data: request,
|
|
||||||
jsonp: 'callback'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTemplateDetails(id){
|
function getTemplateDetails(id){
|
||||||
getTemplateDetails_server(id).done(function(result) {
|
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||||
if(result){
|
if(result){
|
||||||
jQuery('#details').append(result);
|
jQuery('#details').append(result);
|
||||||
// make sure the code bocks are active
|
// make sure the code bocks are active
|
||||||
@ -229,28 +216,15 @@ jQuery(document).ready(function($)
|
|||||||
getSnippets();
|
getSnippets();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getSnippets_server(libraries){
|
|
||||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.getSnippets&raw=true&format=json";
|
|
||||||
if(token.length > 0 && libraries.length > 0){
|
|
||||||
var request = token+'=1&libraries='+JSON.stringify(libraries);
|
|
||||||
}
|
|
||||||
return jQuery.ajax({
|
|
||||||
type: 'GET',
|
|
||||||
url: getUrl,
|
|
||||||
dataType: 'json',
|
|
||||||
data: request,
|
|
||||||
jsonp: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function getSnippets(){
|
function getSnippets(){
|
||||||
jQuery("#loading").show();
|
jQuery("#loading").show();
|
||||||
// clear the selection
|
// clear the selection
|
||||||
jQuery('#jform_snippet').find('option').remove().end();
|
jQuery('#jform_snippet').find('option').remove().end();
|
||||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||||
// get country value if set
|
// get libraries value if set
|
||||||
var libraries = jQuery("#jform_libraries").val();
|
var libraries = jQuery("#jform_libraries").val();
|
||||||
if (libraries) {
|
if (libraries) {
|
||||||
getSnippets_server(libraries).done(function(result) {
|
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||||
setSnippets(result);
|
setSnippets(result);
|
||||||
jQuery("#loading").hide();
|
jQuery("#loading").hide();
|
||||||
if (typeof snippetButton !== 'undefined') {
|
if (typeof snippetButton !== 'undefined') {
|
||||||
|
@ -579,9 +579,22 @@ jQuery(function() {
|
|||||||
jQuery(this).selText().addClass("selected");
|
jQuery(this).selText().addClass("selected");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
jQuery('#adminForm').on('change', '#jform_custom_get',function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// load the dynamic get include with the needed initiation
|
||||||
|
setModuleCode();
|
||||||
|
});
|
||||||
|
jQuery('#adminForm').on('change', '#jform_add_class_helper',function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
// load the dynamic helper include with the needed initiation
|
||||||
|
setModuleCode();
|
||||||
|
});
|
||||||
jQuery('#adminForm').on('change', '#jform_libraries',function (e) {
|
jQuery('#adminForm').on('change', '#jform_libraries',function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
// get the snippets of the selected libraries
|
||||||
getSnippets();
|
getSnippets();
|
||||||
|
// load the dynamic media placeholders if needed
|
||||||
|
setModuleCode();
|
||||||
});
|
});
|
||||||
|
|
||||||
jQuery.fn.selText = function() {
|
jQuery.fn.selText = function() {
|
||||||
|
@ -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>7th December, 2019</creationDate>
|
<creationDate>10th December, 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>
|
||||||
|
Loading…
Reference in New Issue
Block a user