Added some helper script to the new Joomla Module Builder. Consolidated some ajax calls.
This commit is contained in:
@ -868,7 +868,7 @@ function addData(result,where){
|
||||
}
|
||||
|
||||
function getAjaxDisplay(type){
|
||||
getAjaxDisplay_server(type).done(function(result) {
|
||||
getCodeFrom_server(1, type, 'type', 'getAjaxDisplay').done(function(result) {
|
||||
if (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){
|
||||
// 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) {
|
||||
getCodeFrom_server(fieldId, 'type', 'type', 'fieldSelectOptions').done(function(result) {
|
||||
if(result) {
|
||||
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__field_options').val(result);
|
||||
} 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){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
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(){
|
||||
getLinked_server(1).done(function(result) {
|
||||
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#display_linked_to').html(result);
|
||||
}
|
||||
|
Reference in New Issue
Block a user