Moves all JavaScript files that where placed in the model/form folder out of the admin area, into the media folder.
This commit is contained in:
11
media/js/admin_custom_tabs.js
Normal file
11
media/js/admin_custom_tabs.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/admin_fields.js
Normal file
11
media/js/admin_fields.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
43
media/js/admin_fields_conditions.js
Normal file
43
media/js/admin_fields_conditions.js
Normal file
@ -0,0 +1,43 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
function getFieldSelectOptions_server(fieldId){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.fieldSelectOptions&format=json");
|
||||
if(token.length > 0 && fieldId > 0){
|
||||
var request = token+'=1&id='+fieldId;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
function getFieldSelectOptions(fieldKey){
|
||||
// first check if the field is set
|
||||
if(jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field").length) {
|
||||
var fieldId = jQuery("#jform_addconditions__addconditions"+fieldKey+"__match_field option:selected").val();
|
||||
getFieldSelectOptions_server(fieldId).done(function(result) {
|
||||
if(result){
|
||||
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('textarea#jform_addconditions__addconditions'+fieldKey+'__match_options').val('');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
114
media/js/admin_fields_relations.js
Normal file
114
media/js/admin_fields_relations.js
Normal file
@ -0,0 +1,114 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @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();
|
||||
});
|
||||
// little script to set the value
|
||||
function getCodeGlueOptions(field) {
|
||||
// get the ID
|
||||
var id = jQuery(field).attr('id');
|
||||
var target = id.split('__');
|
||||
//set the subID
|
||||
var subID = target[0]+'__'+target[1];
|
||||
// get listfield value
|
||||
var listfield = jQuery('#'+subID+'__listfield').val();
|
||||
// get type value
|
||||
var type = jQuery('#'+subID+'__join_type').val();
|
||||
// get area value
|
||||
var area = jQuery('#'+subID+'__area').val();
|
||||
// check that values are set
|
||||
if (_isSet(listfield) && _isSet(type) && _isSet(area)) {
|
||||
// get joinfields values
|
||||
var joinfields = jQuery('#'+subID+'__joinfields').val();
|
||||
// get codeGlueOptions
|
||||
getCodeGlueOptions_server(listfield, joinfields, type, area).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#'+subID+'__set').val(result);
|
||||
} else {
|
||||
jQuery('#'+subID+'__set').val('');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#'+subID+'__set').val('');
|
||||
}
|
||||
}
|
||||
|
||||
function getCodeGlueOptions_server(listfield, joinfields, type, area){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getCodeGlueOptions&format=json");
|
||||
// make sure the joinfields are set
|
||||
if (!_isSet(joinfields)) {
|
||||
joinfields = 'none';
|
||||
}
|
||||
if(token.length > 0 && listfield > 0 && type > 0 && area > 0) {
|
||||
var request = token+'=1&listfield='+listfield+'&type='+type+'&area='+area+'&joinfields='+joinfields;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function _isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return 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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
||||
|
1076
media/js/admin_view.js
Normal file
1076
media/js/admin_view.js
Normal file
File diff suppressed because it is too large
Load Diff
59
media/js/class_extends.js
Normal file
59
media/js/class_extends.js
Normal file
@ -0,0 +1,59 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// load the used in div
|
||||
// jQuery('#usedin').show();
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
174
media/js/class_method.js
Normal file
174
media/js/class_method.js
Normal file
@ -0,0 +1,174 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwcgvxk_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var extension_type_vvvvwcg = jQuery("#jform_extension_type").val();
|
||||
vvvvwcg(extension_type_vvvvwcg);
|
||||
});
|
||||
|
||||
// the vvvvwcg function
|
||||
function vvvvwcg(extension_type_vvvvwcg)
|
||||
{
|
||||
if (isSet(extension_type_vvvvwcg) && extension_type_vvvvwcg.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwcg = extension_type_vvvvwcg;
|
||||
var extension_type_vvvvwcg = [];
|
||||
extension_type_vvvvwcg.push(temp_vvvvwcg);
|
||||
}
|
||||
else if (!isSet(extension_type_vvvvwcg))
|
||||
{
|
||||
var extension_type_vvvvwcg = [];
|
||||
}
|
||||
var extension_type = extension_type_vvvvwcg.some(extension_type_vvvvwcg_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (extension_type)
|
||||
{
|
||||
jQuery('#jform_joomla_plugin_group').closest('.control-group').show();
|
||||
// add required attribute to joomla_plugin_group field
|
||||
if (jform_vvvvwcgvxk_required)
|
||||
{
|
||||
updateFieldRequired('joomla_plugin_group',0);
|
||||
jQuery('#jform_joomla_plugin_group').prop('required','required');
|
||||
jQuery('#jform_joomla_plugin_group').attr('aria-required',true);
|
||||
jQuery('#jform_joomla_plugin_group').addClass('required');
|
||||
jform_vvvvwcgvxk_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_joomla_plugin_group').closest('.control-group').hide();
|
||||
// remove required attribute from joomla_plugin_group field
|
||||
if (!jform_vvvvwcgvxk_required)
|
||||
{
|
||||
updateFieldRequired('joomla_plugin_group',1);
|
||||
jQuery('#jform_joomla_plugin_group').removeAttr('required');
|
||||
jQuery('#jform_joomla_plugin_group').removeAttr('aria-required');
|
||||
jQuery('#jform_joomla_plugin_group').removeClass('required');
|
||||
jform_vvvvwcgvxk_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwcg Some function
|
||||
function extension_type_vvvvwcg_SomeFunc(extension_type_vvvvwcg)
|
||||
{
|
||||
// set the function logic
|
||||
if (extension_type_vvvvwcg == 'plugins' || extension_type_vvvvwcg == 'plugin')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// load the used in div
|
||||
// jQuery('#usedin').show();
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
174
media/js/class_property.js
Normal file
174
media/js/class_property.js
Normal file
@ -0,0 +1,174 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwcfvxj_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var extension_type_vvvvwcf = jQuery("#jform_extension_type").val();
|
||||
vvvvwcf(extension_type_vvvvwcf);
|
||||
});
|
||||
|
||||
// the vvvvwcf function
|
||||
function vvvvwcf(extension_type_vvvvwcf)
|
||||
{
|
||||
if (isSet(extension_type_vvvvwcf) && extension_type_vvvvwcf.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwcf = extension_type_vvvvwcf;
|
||||
var extension_type_vvvvwcf = [];
|
||||
extension_type_vvvvwcf.push(temp_vvvvwcf);
|
||||
}
|
||||
else if (!isSet(extension_type_vvvvwcf))
|
||||
{
|
||||
var extension_type_vvvvwcf = [];
|
||||
}
|
||||
var extension_type = extension_type_vvvvwcf.some(extension_type_vvvvwcf_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (extension_type)
|
||||
{
|
||||
jQuery('#jform_joomla_plugin_group').closest('.control-group').show();
|
||||
// add required attribute to joomla_plugin_group field
|
||||
if (jform_vvvvwcfvxj_required)
|
||||
{
|
||||
updateFieldRequired('joomla_plugin_group',0);
|
||||
jQuery('#jform_joomla_plugin_group').prop('required','required');
|
||||
jQuery('#jform_joomla_plugin_group').attr('aria-required',true);
|
||||
jQuery('#jform_joomla_plugin_group').addClass('required');
|
||||
jform_vvvvwcfvxj_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_joomla_plugin_group').closest('.control-group').hide();
|
||||
// remove required attribute from joomla_plugin_group field
|
||||
if (!jform_vvvvwcfvxj_required)
|
||||
{
|
||||
updateFieldRequired('joomla_plugin_group',1);
|
||||
jQuery('#jform_joomla_plugin_group').removeAttr('required');
|
||||
jQuery('#jform_joomla_plugin_group').removeAttr('aria-required');
|
||||
jQuery('#jform_joomla_plugin_group').removeClass('required');
|
||||
jform_vvvvwcfvxj_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwcf Some function
|
||||
function extension_type_vvvvwcf_SomeFunc(extension_type_vvvvwcf)
|
||||
{
|
||||
// set the function logic
|
||||
if (extension_type_vvvvwcf == 'plugins' || extension_type_vvvvwcf == 'plugin')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// load the used in div
|
||||
// jQuery('#usedin').show();
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
11
media/js/component_admin_views.js
Normal file
11
media/js/component_admin_views.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_config.js
Normal file
11
media/js/component_config.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_custom_admin_menus.js
Normal file
11
media/js/component_custom_admin_menus.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_custom_admin_views.js
Normal file
11
media/js/component_custom_admin_views.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
57
media/js/component_dashboard.js
Normal file
57
media/js/component_dashboard.js
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @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 = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
11
media/js/component_files_folders.js
Normal file
11
media/js/component_files_folders.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_modules.js
Normal file
11
media/js/component_modules.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_mysql_tweaks.js
Normal file
11
media/js/component_mysql_tweaks.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_placeholders.js
Normal file
11
media/js/component_placeholders.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_plugins.js
Normal file
11
media/js/component_plugins.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_site_views.js
Normal file
11
media/js/component_site_views.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/component_updates.js
Normal file
11
media/js/component_updates.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
428
media/js/custom_admin_view.js
Normal file
428
media/js/custom_admin_view.js
Normal file
@ -0,0 +1,428 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var add_php_view_vvvvwad = jQuery("#jform_add_php_view input[type='radio']:checked").val();
|
||||
vvvvwad(add_php_view_vvvvwad);
|
||||
|
||||
var add_php_jview_display_vvvvwae = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val();
|
||||
vvvvwae(add_php_jview_display_vvvvwae);
|
||||
|
||||
var add_php_jview_vvvvwaf = jQuery("#jform_add_php_jview input[type='radio']:checked").val();
|
||||
vvvvwaf(add_php_jview_vvvvwaf);
|
||||
|
||||
var add_php_document_vvvvwag = jQuery("#jform_add_php_document input[type='radio']:checked").val();
|
||||
vvvvwag(add_php_document_vvvvwag);
|
||||
|
||||
var add_css_document_vvvvwah = jQuery("#jform_add_css_document input[type='radio']:checked").val();
|
||||
vvvvwah(add_css_document_vvvvwah);
|
||||
|
||||
var add_javascript_file_vvvvwai = jQuery("#jform_add_javascript_file input[type='radio']:checked").val();
|
||||
vvvvwai(add_javascript_file_vvvvwai);
|
||||
|
||||
var add_js_document_vvvvwaj = jQuery("#jform_add_js_document input[type='radio']:checked").val();
|
||||
vvvvwaj(add_js_document_vvvvwaj);
|
||||
|
||||
var add_custom_button_vvvvwak = jQuery("#jform_add_custom_button input[type='radio']:checked").val();
|
||||
vvvvwak(add_custom_button_vvvvwak);
|
||||
|
||||
var add_css_vvvvwal = jQuery("#jform_add_css input[type='radio']:checked").val();
|
||||
vvvvwal(add_css_vvvvwal);
|
||||
|
||||
var add_php_ajax_vvvvwam = jQuery("#jform_add_php_ajax input[type='radio']:checked").val();
|
||||
vvvvwam(add_php_ajax_vvvvwam);
|
||||
});
|
||||
|
||||
// the vvvvwad function
|
||||
function vvvvwad(add_php_view_vvvvwad)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_view_vvvvwad == 1)
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwae function
|
||||
function vvvvwae(add_php_jview_display_vvvvwae)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_jview_display_vvvvwae == 1)
|
||||
{
|
||||
jQuery('#jform_php_jview_display-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_jview_display-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaf function
|
||||
function vvvvwaf(add_php_jview_vvvvwaf)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_jview_vvvvwaf == 1)
|
||||
{
|
||||
jQuery('#jform_php_jview-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_jview-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwag function
|
||||
function vvvvwag(add_php_document_vvvvwag)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_document_vvvvwag == 1)
|
||||
{
|
||||
jQuery('#jform_php_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwah function
|
||||
function vvvvwah(add_css_document_vvvvwah)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_document_vvvvwah == 1)
|
||||
{
|
||||
jQuery('#jform_css_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwai function
|
||||
function vvvvwai(add_javascript_file_vvvvwai)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_file_vvvvwai == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_file-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_file-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaj function
|
||||
function vvvvwaj(add_js_document_vvvvwaj)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_js_document_vvvvwaj == 1)
|
||||
{
|
||||
jQuery('#jform_js_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_js_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwak function
|
||||
function vvvvwak(add_custom_button_vvvvwak)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_custom_button_vvvvwak == 1)
|
||||
{
|
||||
jQuery('#jform_custom_button-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_controller-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_model-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_custom_button-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_controller-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_model-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwal function
|
||||
function vvvvwal(add_css_vvvvwal)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_vvvvwal == 1)
|
||||
{
|
||||
jQuery('#jform_css-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwam function
|
||||
function vvvvwam(add_php_ajax_vvvvwam)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_ajax_vvvvwam == 1)
|
||||
{
|
||||
jQuery('#jform_ajax_input-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_ajax_input-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// check and load all the custom code edit buttons
|
||||
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 getLinked(){
|
||||
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#display_linked_to').html(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSnippetDetails(id){
|
||||
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
jQuery("#snippet").focus(function() {
|
||||
var jQuerythis = jQuery(this);
|
||||
jQuerythis.select();
|
||||
|
||||
// Work around Chrome's little problem
|
||||
jQuerythis.mouseup(function() {
|
||||
// Prevent further mouseup intervention
|
||||
jQuerythis.unbind("mouseup");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
if(result.usage){
|
||||
var usage = '<div id="snippet-usage"><p>'+result.usage+'</p></div>';
|
||||
jQuery('#snippet-usage').remove();
|
||||
jQuery('.snippet-usage').append(usage);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getDynamicValues_server(dynamicId){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json");
|
||||
if(token.length > 0 && dynamicId > 0){
|
||||
var request = token+'=1&view=custom_admin_view&id='+dynamicId;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
|
||||
function getDynamicValues(id){
|
||||
getDynamicValues_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#dynamic_values').remove();
|
||||
jQuery('.dynamic_values').append('<div id="dynamic_values">'+result+'</div>');
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getLayoutDetails_server(id){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&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 getLayoutDetails(id){
|
||||
getLayoutDetails_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getTemplateDetails(id){
|
||||
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// set snippets that are on the page
|
||||
var snippetIds = [];
|
||||
var snippets = {};
|
||||
var snippet = 0;
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
jQuery("#jform_snippet option").each(function()
|
||||
{
|
||||
var key = jQuery(this).val();
|
||||
var text = jQuery(this).text();
|
||||
snippets[key] = text;
|
||||
snippetIds.push(key);
|
||||
});
|
||||
snippet = jQuery("#jform_snippet").val();
|
||||
getSnippets();
|
||||
});
|
||||
|
||||
function getSnippets(){
|
||||
jQuery("#loading").show();
|
||||
// clear the selection
|
||||
jQuery('#jform_snippet').find('option').remove().end();
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
// get libraries value if set
|
||||
var libraries = jQuery("#jform_libraries").val();
|
||||
if (libraries) {
|
||||
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||
setSnippets(result);
|
||||
jQuery("#loading").hide();
|
||||
if (typeof snippetButton !== 'undefined') {
|
||||
// ensure button is correct
|
||||
var snippet = jQuery('#jform_snippet').val();
|
||||
snippetButton(snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// load all snippets in none is selected
|
||||
setSnippets(snippetIds);
|
||||
jQuery("#loading").hide();
|
||||
}
|
||||
}
|
||||
function setSnippets(array){
|
||||
if (array) {
|
||||
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
|
||||
jQuery.each( array, function( i, id ) {
|
||||
if (id in snippets) {
|
||||
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
|
||||
}
|
||||
if (id == snippet) {
|
||||
jQuery('#jform_snippet').val(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
}
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
412
media/js/custom_code.js
Normal file
412
media/js/custom_code.js
Normal file
@ -0,0 +1,412 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwcbvxf_required = false;
|
||||
jform_vvvvwccvxg_required = false;
|
||||
jform_vvvvwccvxh_required = false;
|
||||
jform_vvvvwccvxi_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var target_vvvvwcb = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwcb(target_vvvvwcb);
|
||||
|
||||
var target_vvvvwcc = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwcc(target_vvvvwcc);
|
||||
|
||||
var target_vvvvwcd = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
var type_vvvvwcd = jQuery("#jform_type input[type='radio']:checked").val();
|
||||
vvvvwcd(target_vvvvwcd,type_vvvvwcd);
|
||||
|
||||
var type_vvvvwce = jQuery("#jform_type input[type='radio']:checked").val();
|
||||
var target_vvvvwce = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwce(type_vvvvwce,target_vvvvwce);
|
||||
});
|
||||
|
||||
// the vvvvwcb function
|
||||
function vvvvwcb(target_vvvvwcb)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwcb == 2)
|
||||
{
|
||||
jQuery('#jform_function_name').closest('.control-group').show();
|
||||
// add required attribute to function_name field
|
||||
if (jform_vvvvwcbvxf_required)
|
||||
{
|
||||
updateFieldRequired('function_name',0);
|
||||
jQuery('#jform_function_name').prop('required','required');
|
||||
jQuery('#jform_function_name').attr('aria-required',true);
|
||||
jQuery('#jform_function_name').addClass('required');
|
||||
jform_vvvvwcbvxf_required = false;
|
||||
}
|
||||
jQuery('.note_jcb_placeholder').closest('.control-group').show();
|
||||
jQuery('#jform_system_name').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_function_name').closest('.control-group').hide();
|
||||
// remove required attribute from function_name field
|
||||
if (!jform_vvvvwcbvxf_required)
|
||||
{
|
||||
updateFieldRequired('function_name',1);
|
||||
jQuery('#jform_function_name').removeAttr('required');
|
||||
jQuery('#jform_function_name').removeAttr('aria-required');
|
||||
jQuery('#jform_function_name').removeClass('required');
|
||||
jform_vvvvwcbvxf_required = true;
|
||||
}
|
||||
jQuery('.note_jcb_placeholder').closest('.control-group').hide();
|
||||
jQuery('#jform_system_name').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwcc function
|
||||
function vvvvwcc(target_vvvvwcc)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwcc == 1)
|
||||
{
|
||||
jQuery('#jform_component').closest('.control-group').show();
|
||||
// add required attribute to component field
|
||||
if (jform_vvvvwccvxg_required)
|
||||
{
|
||||
updateFieldRequired('component',0);
|
||||
jQuery('#jform_component').prop('required','required');
|
||||
jQuery('#jform_component').attr('aria-required',true);
|
||||
jQuery('#jform_component').addClass('required');
|
||||
jform_vvvvwccvxg_required = false;
|
||||
}
|
||||
jQuery('#jform_path').closest('.control-group').show();
|
||||
// add required attribute to path field
|
||||
if (jform_vvvvwccvxh_required)
|
||||
{
|
||||
updateFieldRequired('path',0);
|
||||
jQuery('#jform_path').prop('required','required');
|
||||
jQuery('#jform_path').attr('aria-required',true);
|
||||
jQuery('#jform_path').addClass('required');
|
||||
jform_vvvvwccvxh_required = false;
|
||||
}
|
||||
jQuery('#jform_from_line').closest('.control-group').show();
|
||||
jQuery('#jform_hashtarget').closest('.control-group').show();
|
||||
jQuery('#jform_to_line').closest('.control-group').show();
|
||||
jQuery('#jform_type').closest('.control-group').show();
|
||||
// add required attribute to type field
|
||||
if (jform_vvvvwccvxi_required)
|
||||
{
|
||||
updateFieldRequired('type',0);
|
||||
jQuery('#jform_type').prop('required','required');
|
||||
jQuery('#jform_type').attr('aria-required',true);
|
||||
jQuery('#jform_type').addClass('required');
|
||||
jform_vvvvwccvxi_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_component').closest('.control-group').hide();
|
||||
// remove required attribute from component field
|
||||
if (!jform_vvvvwccvxg_required)
|
||||
{
|
||||
updateFieldRequired('component',1);
|
||||
jQuery('#jform_component').removeAttr('required');
|
||||
jQuery('#jform_component').removeAttr('aria-required');
|
||||
jQuery('#jform_component').removeClass('required');
|
||||
jform_vvvvwccvxg_required = true;
|
||||
}
|
||||
jQuery('#jform_path').closest('.control-group').hide();
|
||||
// remove required attribute from path field
|
||||
if (!jform_vvvvwccvxh_required)
|
||||
{
|
||||
updateFieldRequired('path',1);
|
||||
jQuery('#jform_path').removeAttr('required');
|
||||
jQuery('#jform_path').removeAttr('aria-required');
|
||||
jQuery('#jform_path').removeClass('required');
|
||||
jform_vvvvwccvxh_required = true;
|
||||
}
|
||||
jQuery('#jform_from_line').closest('.control-group').hide();
|
||||
jQuery('#jform_hashtarget').closest('.control-group').hide();
|
||||
jQuery('#jform_to_line').closest('.control-group').hide();
|
||||
jQuery('#jform_type').closest('.control-group').hide();
|
||||
// remove required attribute from type field
|
||||
if (!jform_vvvvwccvxi_required)
|
||||
{
|
||||
updateFieldRequired('type',1);
|
||||
jQuery('#jform_type').removeAttr('required');
|
||||
jQuery('#jform_type').removeAttr('aria-required');
|
||||
jQuery('#jform_type').removeClass('required');
|
||||
jform_vvvvwccvxi_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwcd function
|
||||
function vvvvwcd(target_vvvvwcd,type_vvvvwcd)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwcd == 1 && type_vvvvwcd == 1)
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').show();
|
||||
jQuery('#jform_to_line').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').hide();
|
||||
jQuery('#jform_to_line').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwce function
|
||||
function vvvvwce(type_vvvvwce,target_vvvvwce)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwce == 1 && target_vvvvwce == 1)
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').show();
|
||||
jQuery('#jform_to_line').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_hashendtarget').closest('.control-group').hide();
|
||||
jQuery('#jform_to_line').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var target = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
if (target == 2) {
|
||||
jQuery('#usedin').show();
|
||||
var functioName = jQuery('#jform_function_name').val();
|
||||
// check if this function name is taken
|
||||
checkFunctionName(functioName);
|
||||
}
|
||||
var type = jQuery("#jform_comment_type input[type='radio']:checked").val();
|
||||
if (type == 2) {
|
||||
jQuery('#html-comment-info').show();
|
||||
jQuery('#phpjs-comment-info').hide();
|
||||
} else {
|
||||
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();
|
||||
var functioName = jQuery('#jform_function_name').val();
|
||||
if (ide > 0 && functioName.length > 2) {
|
||||
jQuery('#jcb-placeholder').html('<code>[CUSTO'+'MCODE='+functioName+']</code>');
|
||||
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+functioName+'+value1,value2]</code>');
|
||||
} else if (ide > 0){
|
||||
jQuery('#jcb-placeholder').html('<code>[not ready]</code>');
|
||||
jQuery('#jcb-placeholder-arg').html('<code>[not ready]</code>');
|
||||
} else if (functioName.length > 2) {
|
||||
jQuery('#jcb-placeholder').html('<code>[CUSTO'+'MCODE='+functioName+']</code>');
|
||||
jQuery('#jcb-placeholder-arg').html('<code>[CUSTO'+'MCODE='+functioName+'+value1,value2]</code>');
|
||||
} else {
|
||||
jQuery('#jcb-placeholder').html('<code>[save to see]</code>');
|
||||
jQuery('#jcb-placeholder-arg').html('<code>[save to see]</code>');
|
||||
}
|
||||
// update the notes
|
||||
if (ide > 0) {
|
||||
jQuery('.placeholder-key-id').text(ide);
|
||||
}
|
||||
}
|
||||
|
||||
function checkFunctionName(functioName) {
|
||||
if (functioName.length > 2) {
|
||||
var ide = jQuery('#jform_id').val();
|
||||
if (ide == 0) {
|
||||
ide = -1;
|
||||
}
|
||||
checkFunctionName_server(functioName, ide).done(function(result) {
|
||||
if(result.name && result.message){
|
||||
// show notice that functioName is okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_function_name').val(result.name);
|
||||
// now start search for where the function is used
|
||||
usedin(result.name, ide);
|
||||
} else if(result.message){
|
||||
// show notice that functioName is not okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_function_name').val('');
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_FUNCTION_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'), timeout: 5000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_function_name').val('');
|
||||
}
|
||||
// set custom code placeholder
|
||||
setCustomCodePlaceholder();
|
||||
});
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_FUNCTION_NAME'), timeout: 5000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_function_name').val('');
|
||||
// set custom code placeholder
|
||||
setCustomCodePlaceholder();
|
||||
}
|
||||
}
|
||||
// check Function name
|
||||
function checkFunctionName_server(functioName, ide){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkFunctionName&raw=true&format=json";
|
||||
if(token.length > 0){
|
||||
var request = 'token='+token+'&functioName='+functioName+'&id='+ide;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// check where this Function is used
|
||||
function usedin(functioName, ide) {
|
||||
var found = false;
|
||||
jQuery('#before-usedin').hide();
|
||||
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','n','o','p','q','r','s','t','u']; // if you update this, also update (below 20) & [customcode-codeUsedInHtmlNote]!
|
||||
var targetNumber = 20;
|
||||
var run = 0;
|
||||
var usedinChecker = setInterval(function(){
|
||||
var target = targets[run];
|
||||
usedin_server(functioName, ide, target).done(function(used) {
|
||||
if (used.in) {
|
||||
jQuery('#usedin-'+used.id).show();
|
||||
jQuery('#area-'+used.id).html(used.in);
|
||||
jQuery.UIkit.notify({message: used.in, timeout: 5000, status: 'success', pos: 'top-right'});
|
||||
found = true;
|
||||
} else {
|
||||
jQuery('#usedin-'+target).hide();
|
||||
}
|
||||
if (run == targetNumber) {
|
||||
jQuery('#loading-usedin').hide();
|
||||
if (found) {
|
||||
jQuery('#note-usedin-found').show();
|
||||
} else {
|
||||
jQuery('#note-usedin-not').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (run == targetNumber) {
|
||||
clearInterval(usedinChecker);
|
||||
}
|
||||
run++;
|
||||
}, 800);
|
||||
}
|
||||
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+'=1&functioName='+functioName+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
|
||||
}
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
1648
media/js/dynamic_get.js
Normal file
1648
media/js/dynamic_get.js
Normal file
File diff suppressed because it is too large
Load Diff
898
media/js/field.js
Normal file
898
media/js/field.js
Normal file
@ -0,0 +1,898 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwczvxo_required = false;
|
||||
jform_vvvvwdavxp_required = false;
|
||||
jform_vvvvwdbvxq_required = false;
|
||||
jform_vvvvwdcvxr_required = false;
|
||||
jform_vvvvwdfvxs_required = false;
|
||||
jform_vvvvwdfvxt_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var datalenght_vvvvwcz = jQuery("#jform_datalenght").val();
|
||||
vvvvwcz(datalenght_vvvvwcz);
|
||||
|
||||
var datadefault_vvvvwda = jQuery("#jform_datadefault").val();
|
||||
vvvvwda(datadefault_vvvvwda);
|
||||
|
||||
var datatype_vvvvwdb = jQuery("#jform_datatype").val();
|
||||
vvvvwdb(datatype_vvvvwdb);
|
||||
|
||||
var datatype_vvvvwdc = jQuery("#jform_datatype").val();
|
||||
vvvvwdc(datatype_vvvvwdc);
|
||||
|
||||
var store_vvvvwdd = jQuery("#jform_store").val();
|
||||
var datatype_vvvvwdd = jQuery("#jform_datatype").val();
|
||||
vvvvwdd(store_vvvvwdd,datatype_vvvvwdd);
|
||||
|
||||
var store_vvvvwdf = jQuery("#jform_store").val();
|
||||
vvvvwdf(store_vvvvwdf);
|
||||
|
||||
var add_css_view_vvvvwdg = jQuery("#jform_add_css_view input[type='radio']:checked").val();
|
||||
vvvvwdg(add_css_view_vvvvwdg);
|
||||
|
||||
var add_css_views_vvvvwdh = jQuery("#jform_add_css_views input[type='radio']:checked").val();
|
||||
vvvvwdh(add_css_views_vvvvwdh);
|
||||
|
||||
var add_javascript_view_footer_vvvvwdi = jQuery("#jform_add_javascript_view_footer input[type='radio']:checked").val();
|
||||
vvvvwdi(add_javascript_view_footer_vvvvwdi);
|
||||
|
||||
var add_javascript_views_footer_vvvvwdj = jQuery("#jform_add_javascript_views_footer input[type='radio']:checked").val();
|
||||
vvvvwdj(add_javascript_views_footer_vvvvwdj);
|
||||
});
|
||||
|
||||
// the vvvvwcz function
|
||||
function vvvvwcz(datalenght_vvvvwcz)
|
||||
{
|
||||
if (isSet(datalenght_vvvvwcz) && datalenght_vvvvwcz.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwcz = datalenght_vvvvwcz;
|
||||
var datalenght_vvvvwcz = [];
|
||||
datalenght_vvvvwcz.push(temp_vvvvwcz);
|
||||
}
|
||||
else if (!isSet(datalenght_vvvvwcz))
|
||||
{
|
||||
var datalenght_vvvvwcz = [];
|
||||
}
|
||||
var datalenght = datalenght_vvvvwcz.some(datalenght_vvvvwcz_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datalenght)
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').show();
|
||||
// add required attribute to datalenght_other field
|
||||
if (jform_vvvvwczvxo_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',0);
|
||||
jQuery('#jform_datalenght_other').prop('required','required');
|
||||
jQuery('#jform_datalenght_other').attr('aria-required',true);
|
||||
jQuery('#jform_datalenght_other').addClass('required');
|
||||
jform_vvvvwczvxo_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').hide();
|
||||
// remove required attribute from datalenght_other field
|
||||
if (!jform_vvvvwczvxo_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',1);
|
||||
jQuery('#jform_datalenght_other').removeAttr('required');
|
||||
jQuery('#jform_datalenght_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datalenght_other').removeClass('required');
|
||||
jform_vvvvwczvxo_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwcz Some function
|
||||
function datalenght_vvvvwcz_SomeFunc(datalenght_vvvvwcz)
|
||||
{
|
||||
// set the function logic
|
||||
if (datalenght_vvvvwcz == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwda function
|
||||
function vvvvwda(datadefault_vvvvwda)
|
||||
{
|
||||
if (isSet(datadefault_vvvvwda) && datadefault_vvvvwda.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwda = datadefault_vvvvwda;
|
||||
var datadefault_vvvvwda = [];
|
||||
datadefault_vvvvwda.push(temp_vvvvwda);
|
||||
}
|
||||
else if (!isSet(datadefault_vvvvwda))
|
||||
{
|
||||
var datadefault_vvvvwda = [];
|
||||
}
|
||||
var datadefault = datadefault_vvvvwda.some(datadefault_vvvvwda_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datadefault)
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').show();
|
||||
// add required attribute to datadefault_other field
|
||||
if (jform_vvvvwdavxp_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',0);
|
||||
jQuery('#jform_datadefault_other').prop('required','required');
|
||||
jQuery('#jform_datadefault_other').attr('aria-required',true);
|
||||
jQuery('#jform_datadefault_other').addClass('required');
|
||||
jform_vvvvwdavxp_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').hide();
|
||||
// remove required attribute from datadefault_other field
|
||||
if (!jform_vvvvwdavxp_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',1);
|
||||
jQuery('#jform_datadefault_other').removeAttr('required');
|
||||
jQuery('#jform_datadefault_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datadefault_other').removeClass('required');
|
||||
jform_vvvvwdavxp_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwda Some function
|
||||
function datadefault_vvvvwda_SomeFunc(datadefault_vvvvwda)
|
||||
{
|
||||
// set the function logic
|
||||
if (datadefault_vvvvwda == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdb function
|
||||
function vvvvwdb(datatype_vvvvwdb)
|
||||
{
|
||||
if (isSet(datatype_vvvvwdb) && datatype_vvvvwdb.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdb = datatype_vvvvwdb;
|
||||
var datatype_vvvvwdb = [];
|
||||
datatype_vvvvwdb.push(temp_vvvvwdb);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdb))
|
||||
{
|
||||
var datatype_vvvvwdb = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdb.some(datatype_vvvvwdb_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype)
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').show();
|
||||
jQuery('#jform_indexes').closest('.control-group').show();
|
||||
// add required attribute to indexes field
|
||||
if (jform_vvvvwdbvxq_required)
|
||||
{
|
||||
updateFieldRequired('indexes',0);
|
||||
jQuery('#jform_indexes').prop('required','required');
|
||||
jQuery('#jform_indexes').attr('aria-required',true);
|
||||
jQuery('#jform_indexes').addClass('required');
|
||||
jform_vvvvwdbvxq_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').hide();
|
||||
jQuery('#jform_indexes').closest('.control-group').hide();
|
||||
// remove required attribute from indexes field
|
||||
if (!jform_vvvvwdbvxq_required)
|
||||
{
|
||||
updateFieldRequired('indexes',1);
|
||||
jQuery('#jform_indexes').removeAttr('required');
|
||||
jQuery('#jform_indexes').removeAttr('aria-required');
|
||||
jQuery('#jform_indexes').removeClass('required');
|
||||
jform_vvvvwdbvxq_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdb Some function
|
||||
function datatype_vvvvwdb_SomeFunc(datatype_vvvvwdb)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdb == 'CHAR' || datatype_vvvvwdb == 'VARCHAR' || datatype_vvvvwdb == 'DATETIME' || datatype_vvvvwdb == 'DATE' || datatype_vvvvwdb == 'TIME' || datatype_vvvvwdb == 'INT' || datatype_vvvvwdb == 'TINYINT' || datatype_vvvvwdb == 'BIGINT' || datatype_vvvvwdb == 'FLOAT' || datatype_vvvvwdb == 'DECIMAL' || datatype_vvvvwdb == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdc function
|
||||
function vvvvwdc(datatype_vvvvwdc)
|
||||
{
|
||||
if (isSet(datatype_vvvvwdc) && datatype_vvvvwdc.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdc = datatype_vvvvwdc;
|
||||
var datatype_vvvvwdc = [];
|
||||
datatype_vvvvwdc.push(temp_vvvvwdc);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdc))
|
||||
{
|
||||
var datatype_vvvvwdc = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdc.some(datatype_vvvvwdc_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype)
|
||||
{
|
||||
jQuery('#jform_datalenght').closest('.control-group').show();
|
||||
// add required attribute to datalenght field
|
||||
if (jform_vvvvwdcvxr_required)
|
||||
{
|
||||
updateFieldRequired('datalenght',0);
|
||||
jQuery('#jform_datalenght').prop('required','required');
|
||||
jQuery('#jform_datalenght').attr('aria-required',true);
|
||||
jQuery('#jform_datalenght').addClass('required');
|
||||
jform_vvvvwdcvxr_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datalenght').closest('.control-group').hide();
|
||||
// remove required attribute from datalenght field
|
||||
if (!jform_vvvvwdcvxr_required)
|
||||
{
|
||||
updateFieldRequired('datalenght',1);
|
||||
jQuery('#jform_datalenght').removeAttr('required');
|
||||
jQuery('#jform_datalenght').removeAttr('aria-required');
|
||||
jQuery('#jform_datalenght').removeClass('required');
|
||||
jform_vvvvwdcvxr_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdc Some function
|
||||
function datatype_vvvvwdc_SomeFunc(datatype_vvvvwdc)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdc == 'CHAR' || datatype_vvvvwdc == 'VARCHAR' || datatype_vvvvwdc == 'INT' || datatype_vvvvwdc == 'TINYINT' || datatype_vvvvwdc == 'BIGINT' || datatype_vvvvwdc == 'FLOAT' || datatype_vvvvwdc == 'DECIMAL' || datatype_vvvvwdc == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdd function
|
||||
function vvvvwdd(store_vvvvwdd,datatype_vvvvwdd)
|
||||
{
|
||||
if (isSet(store_vvvvwdd) && store_vvvvwdd.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdd = store_vvvvwdd;
|
||||
var store_vvvvwdd = [];
|
||||
store_vvvvwdd.push(temp_vvvvwdd);
|
||||
}
|
||||
else if (!isSet(store_vvvvwdd))
|
||||
{
|
||||
var store_vvvvwdd = [];
|
||||
}
|
||||
var store = store_vvvvwdd.some(store_vvvvwdd_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvwdd) && datatype_vvvvwdd.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdd = datatype_vvvvwdd;
|
||||
var datatype_vvvvwdd = [];
|
||||
datatype_vvvvwdd.push(temp_vvvvwdd);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdd))
|
||||
{
|
||||
var datatype_vvvvwdd = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdd.some(datatype_vvvvwdd_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (store && datatype)
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdd Some function
|
||||
function store_vvvvwdd_SomeFunc(store_vvvvwdd)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvwdd == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdd Some function
|
||||
function datatype_vvvvwdd_SomeFunc(datatype_vvvvwdd)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdd == 'CHAR' || datatype_vvvvwdd == 'VARCHAR' || datatype_vvvvwdd == 'TEXT' || datatype_vvvvwdd == 'MEDIUMTEXT' || datatype_vvvvwdd == 'LONGTEXT' || datatype_vvvvwdd == 'BLOB' || datatype_vvvvwdd == 'TINYBLOB' || datatype_vvvvwdd == 'MEDIUMBLOB' || datatype_vvvvwdd == 'LONGBLOB')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdf function
|
||||
function vvvvwdf(store_vvvvwdf)
|
||||
{
|
||||
if (isSet(store_vvvvwdf) && store_vvvvwdf.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdf = store_vvvvwdf;
|
||||
var store_vvvvwdf = [];
|
||||
store_vvvvwdf.push(temp_vvvvwdf);
|
||||
}
|
||||
else if (!isSet(store_vvvvwdf))
|
||||
{
|
||||
var store_vvvvwdf = [];
|
||||
}
|
||||
var store = store_vvvvwdf.some(store_vvvvwdf_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (store)
|
||||
{
|
||||
jQuery('#jform_initiator_on_get_model').closest('.control-group').show();
|
||||
jQuery('#jform_initiator_on_save_model').closest('.control-group').show();
|
||||
jQuery('.note_expert_field_save_mode').closest('.control-group').show();
|
||||
jQuery('#jform_on_get_model_field').closest('.control-group').show();
|
||||
// add required attribute to on_get_model_field field
|
||||
if (jform_vvvvwdfvxs_required)
|
||||
{
|
||||
updateFieldRequired('on_get_model_field',0);
|
||||
jQuery('#jform_on_get_model_field').prop('required','required');
|
||||
jQuery('#jform_on_get_model_field').attr('aria-required',true);
|
||||
jQuery('#jform_on_get_model_field').addClass('required');
|
||||
jform_vvvvwdfvxs_required = false;
|
||||
}
|
||||
jQuery('#jform_on_save_model_field').closest('.control-group').show();
|
||||
// add required attribute to on_save_model_field field
|
||||
if (jform_vvvvwdfvxt_required)
|
||||
{
|
||||
updateFieldRequired('on_save_model_field',0);
|
||||
jQuery('#jform_on_save_model_field').prop('required','required');
|
||||
jQuery('#jform_on_save_model_field').attr('aria-required',true);
|
||||
jQuery('#jform_on_save_model_field').addClass('required');
|
||||
jform_vvvvwdfvxt_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_initiator_on_get_model').closest('.control-group').hide();
|
||||
jQuery('#jform_initiator_on_save_model').closest('.control-group').hide();
|
||||
jQuery('.note_expert_field_save_mode').closest('.control-group').hide();
|
||||
jQuery('#jform_on_get_model_field').closest('.control-group').hide();
|
||||
// remove required attribute from on_get_model_field field
|
||||
if (!jform_vvvvwdfvxs_required)
|
||||
{
|
||||
updateFieldRequired('on_get_model_field',1);
|
||||
jQuery('#jform_on_get_model_field').removeAttr('required');
|
||||
jQuery('#jform_on_get_model_field').removeAttr('aria-required');
|
||||
jQuery('#jform_on_get_model_field').removeClass('required');
|
||||
jform_vvvvwdfvxs_required = true;
|
||||
}
|
||||
jQuery('#jform_on_save_model_field').closest('.control-group').hide();
|
||||
// remove required attribute from on_save_model_field field
|
||||
if (!jform_vvvvwdfvxt_required)
|
||||
{
|
||||
updateFieldRequired('on_save_model_field',1);
|
||||
jQuery('#jform_on_save_model_field').removeAttr('required');
|
||||
jQuery('#jform_on_save_model_field').removeAttr('aria-required');
|
||||
jQuery('#jform_on_save_model_field').removeClass('required');
|
||||
jform_vvvvwdfvxt_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdf Some function
|
||||
function store_vvvvwdf_SomeFunc(store_vvvvwdf)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvwdf == 6)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdg function
|
||||
function vvvvwdg(add_css_view_vvvvwdg)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_view_vvvvwdg == 1)
|
||||
{
|
||||
jQuery('#jform_css_view-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_view-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdh function
|
||||
function vvvvwdh(add_css_views_vvvvwdh)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_views_vvvvwdh == 1)
|
||||
{
|
||||
jQuery('#jform_css_views-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_views-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdi function
|
||||
function vvvvwdi(add_javascript_view_footer_vvvvwdi)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_view_footer_vvvvwdi == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_view_footer-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdj function
|
||||
function vvvvwdj(add_javascript_views_footer_vvvvwdj)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_views_footer_vvvvwdj == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_views_footer-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// get type value
|
||||
var fieldtype = jQuery("#jform_fieldtype option:selected").val();
|
||||
getFieldTypeProperties(fieldtype, false);
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// get the validation rules
|
||||
getValidationRulesTable();
|
||||
// set button to create more fields
|
||||
addButton('validation_rule', 'validation_rules_header', 2);
|
||||
// get the field type text
|
||||
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();
|
||||
});
|
||||
|
||||
// the options row id key
|
||||
var rowIdKey = 'properties';
|
||||
|
||||
function getFieldTypeProperties(fieldtype, db){
|
||||
getCodeFrom_server(fieldtype, 'type', 'type', 'fieldTypeProperties').done(function(result) {
|
||||
if(result.subform){
|
||||
// load the list of properties
|
||||
propertiesArray = result.nameListOptions;
|
||||
// remove previous forms of exist
|
||||
jQuery('.prop_removal').remove();
|
||||
// hide notice
|
||||
jQuery('.note_select_field_type').closest('.control-group').remove();
|
||||
// append to note_filter_information class
|
||||
jQuery('.note_filter_information').closest('.control-group').prepend(result.extra);
|
||||
// append to note_filter_information class
|
||||
if(result.textarea){
|
||||
jQuery.each( result.textarea, function( i, tField ) {
|
||||
// append to note_filter_information class
|
||||
jQuery('.note_filter_information').closest('.control-group').prepend(tField);
|
||||
});
|
||||
}
|
||||
// append to note_filter_information class
|
||||
jQuery('.note_filter_information').closest('.control-group').prepend(result.subform);
|
||||
// add the watcher
|
||||
rowWatcher();
|
||||
// initialize the new form
|
||||
jQuery('div.subform-repeatable').subformRepeatable();
|
||||
// update all the list fields to only show items not selected already
|
||||
propertyDynamicSet();
|
||||
// set the field type info
|
||||
jQuery('#help').remove();
|
||||
jQuery('.helpNote').append('<div id="help">'+result.description+'<br />'+result.values_description+'</div>');
|
||||
// load the database properties if not set and defaults were found
|
||||
if (db && result.database){
|
||||
// update datatype
|
||||
jQuery('#jform_datatype').val(result.database.datatype);
|
||||
jQuery('#jform_datatype').trigger("liszt:updated");
|
||||
jQuery('#jform_datatype').trigger("change");
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('datatype', 0);
|
||||
// update datalenght
|
||||
jQuery('#jform_datalenght').val(result.database.datalenght);
|
||||
jQuery('#jform_datalenght').trigger("liszt:updated");
|
||||
jQuery('#jform_datalenght').trigger("change");
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('datalenght', 0);
|
||||
// load the datalenght_other if needed
|
||||
if ('Other' === result.database.datalenght){
|
||||
jQuery('#jform_datalenght_other').val(result.database.datalenght_other);
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('datalenght_other', 0);
|
||||
}
|
||||
// update datadefault
|
||||
jQuery('#jform_datadefault').val(result.database.datadefault);
|
||||
jQuery('#jform_datadefault').trigger("liszt:updated");
|
||||
jQuery('#jform_datadefault').trigger("change");
|
||||
// load the datadefault_other if needed
|
||||
if ('Other' === result.database.datadefault){
|
||||
jQuery('#jform_datadefault_other').val(result.database.datadefault_other);
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('datadefault_other', 0);
|
||||
}
|
||||
// update indexes
|
||||
jQuery('#jform_indexes').val(result.database.indexes);
|
||||
jQuery('#jform_indexes').trigger("liszt:updated");
|
||||
jQuery('#jform_indexes').trigger("change");
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('indexes', 0);
|
||||
// update store
|
||||
jQuery('#jform_store').val(result.database.store);
|
||||
jQuery('#jform_store').trigger("liszt:updated");
|
||||
jQuery('#jform_store').trigger("change");
|
||||
// be sure to remove from no required
|
||||
updateFieldRequired('store', 0);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getFieldPropertyDesc(field, targetForm){
|
||||
// get the ID
|
||||
var id = jQuery(field).attr('id');
|
||||
// build the target array
|
||||
var target = id.split('__');
|
||||
// get property value
|
||||
var property = jQuery(field).val();
|
||||
// first check that there isn't any of this property type already set
|
||||
if (propertyIsSet(property, id, targetForm)) {
|
||||
// reset the selection
|
||||
jQuery('#'+id).val('');
|
||||
jQuery('#'+id).trigger("liszt:updated");
|
||||
// give out a notice
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_PROPERTY_ALREADY_SELECTED_TRY_ANOTHER'), timeout: 5000, status: 'warning', pos: 'top-center'});
|
||||
// update the values
|
||||
jQuery('#'+target[0]+'__desc').val('');
|
||||
jQuery('#'+target[0]+'__value').val('');
|
||||
} else {
|
||||
// do a dynamic update
|
||||
propertyDynamicSet();
|
||||
// get type value
|
||||
if (targetForm === 'properties') {
|
||||
var fieldtype = jQuery("#jform_fieldtype option:selected").val();
|
||||
} else {
|
||||
var fieldtype = 'extra';
|
||||
}
|
||||
getFieldPropertyDesc_server(fieldtype, property).done(function(result) {
|
||||
if(result.desc || result.value){
|
||||
// update the values
|
||||
jQuery('#'+target[0]+'__desc').val(result.desc);
|
||||
jQuery('#'+target[0]+'__value').val(result.value);
|
||||
} else {
|
||||
// update the values
|
||||
jQuery('#'+target[0]+'__desc').val(Joomla.JText._('COM_COMPONENTBUILDER_NO_DESCRIPTION_FOUND'));
|
||||
jQuery('#'+target[0]+'__value').val('');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// set properties the options
|
||||
propertiesArray = {};
|
||||
var propertyIdRemoved;
|
||||
|
||||
function propertyDynamicSet() {
|
||||
propertiesAvailable = {};
|
||||
propertiesSelectedArray = {};
|
||||
propertiesTrackerArray = {};
|
||||
var i;
|
||||
for (i = 0; i < 70; i++) { // for now this is the number of field we should check
|
||||
// build ID
|
||||
var id_check = rowIdKey+'_'+rowIdKey+i+'__name';
|
||||
// first check if Id is on page as that not the same as the one currently calling
|
||||
if (jQuery("#"+id_check).length && propertyIdRemoved !== id_check) {
|
||||
// build the selected array
|
||||
var key = jQuery("#"+id_check+" option:selected").val();
|
||||
var text = jQuery("#"+id_check+" option:selected").text();
|
||||
propertiesSelectedArray[key] = text;
|
||||
// keep track of the value set
|
||||
propertiesTrackerArray[id_check] = key;
|
||||
// clear the options out
|
||||
jQuery("#"+id_check).find('option').remove().end();
|
||||
}
|
||||
}
|
||||
// trigger chosen on the list fields
|
||||
jQuery('.field_list_name_options').chosen({"disable_search_threshold":10,"search_contains":true,"allow_single_deselect":true,"placeholder_text_multiple":Joomla.JText._("COM_COMPONENTBUILDER_TYPE_OR_SELECT_SOME_OPTIONS"),"placeholder_text_single":Joomla.JText._("COM_COMPONENTBUILDER_SELECT_A_PROPERTY"),"no_results_text":Joomla.JText._("COM_COMPONENTBUILDER_NO_RESULTS_MATCH")});
|
||||
// now build the list to keep
|
||||
jQuery.each( propertiesArray, function( prop, name ) {
|
||||
if (!propertiesSelectedArray.hasOwnProperty(prop)) {
|
||||
propertiesAvailable[prop] = name;
|
||||
}
|
||||
});
|
||||
// now add the lists back
|
||||
jQuery.each( propertiesTrackerArray, function( tId, tKey ) {
|
||||
if (jQuery('#'+tId).length) {
|
||||
jQuery('#'+tId).append('<option value="'+tKey+'">'+propertiesSelectedArray[tKey]+'</option>');
|
||||
jQuery.each( propertiesAvailable, function( aKey, aValue ) {
|
||||
jQuery('#'+tId).append('<option value="'+aKey+'">'+aValue+'</option>');
|
||||
});
|
||||
jQuery('#'+tId).val(tKey);
|
||||
jQuery('#'+tId).trigger('liszt:updated');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function rowWatcher() {
|
||||
jQuery(document).on('subform-row-remove', function(event, row){
|
||||
propertyIdRemoved = jQuery(row.innerHTML).find('.field_list_name_options').attr('id');
|
||||
propertyDynamicSet();
|
||||
});
|
||||
jQuery(document).on('subform-row-add', function(event, row){
|
||||
propertyDynamicSet();
|
||||
});
|
||||
}
|
||||
|
||||
function propertyIsSet(prop, id, targetForm) {
|
||||
var i;
|
||||
for (i = 0; i < 70; i++) { // for now this is the number of field we should check
|
||||
// build ID
|
||||
var id_check = targetForm+'_'+targetForm+i+'__name';
|
||||
// first check if Id is on page as that not the same as the one currently calling
|
||||
if (jQuery("#"+id_check).length && id_check != id) {
|
||||
// get the property value
|
||||
var tmp = jQuery("#"+id_check+" option:selected").val();
|
||||
// now validate
|
||||
if (tmp === prop) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function getFieldPropertyDesc_server(fieldtype, property){
|
||||
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){
|
||||
var request = token+'=1&fieldtype='+fieldtype+'&property='+property;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
function getValidationRulesTable(){
|
||||
getCodeFrom_server(1,'type','type', 'getValidationRulesTable').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#display_validation_rules').html(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function dbChecker(type){
|
||||
if ('note' === type || 'spacer' === type) {
|
||||
// update the datatype selection
|
||||
jQuery('#jform_datatype').val('').trigger('liszt:updated').change();
|
||||
jQuery('#jform_datalenght').val('').trigger('liszt:updated').change();
|
||||
jQuery('#jform_datadefault').val('').trigger('liszt:updated').change();
|
||||
jQuery('#jform_datadefault').val('').trigger('liszt:updated').change();
|
||||
jQuery('#jform_indexes').val(0).trigger('liszt:updated').change();
|
||||
jQuery('#jform_store').val(0).trigger('liszt:updated').change();
|
||||
// remove the datatype
|
||||
jQuery('#jform_datatype-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_datatype').closest('.control-group').hide();
|
||||
updateFieldRequired('datatype',1);
|
||||
jQuery('#jform_datatype').removeAttr('required');
|
||||
jQuery('#jform_datatype').removeAttr('aria-required');
|
||||
jQuery('#jform_datatype').removeClass('required');
|
||||
// remove the null selection
|
||||
jQuery('#jform_null_switch-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_null_switch').closest('.control-group').hide();
|
||||
updateFieldRequired('null_switch',1);
|
||||
jQuery('#jform_null_switch').removeAttr('required');
|
||||
jQuery('#jform_null_switch').removeAttr('aria-required');
|
||||
jQuery('#jform_null_switch').removeClass('required');
|
||||
// show notice
|
||||
jQuery('.note_no_database_settings_needed').closest('.control-group').show();
|
||||
jQuery('.note_database_settings_needed').closest('.control-group').hide();
|
||||
} else {
|
||||
// add the datatype
|
||||
jQuery('#jform_datatype-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_datatype').closest('.control-group').show();
|
||||
updateFieldRequired('datatype',0);
|
||||
jQuery('#jform_datatype').prop('required','required');
|
||||
jQuery('#jform_datatype').attr('aria-required',true);
|
||||
jQuery('#jform_datatype').addClass('required');
|
||||
// add the null selection
|
||||
jQuery('#jform_null_switch-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_null_switch').closest('.control-group').show();
|
||||
updateFieldRequired('null_switch',0);
|
||||
jQuery('#jform_null_switch').prop('required','required');
|
||||
jQuery('#jform_null_switch').attr('aria-required',true);
|
||||
jQuery('#jform_null_switch').addClass('required');
|
||||
// remove notice
|
||||
jQuery('.note_no_database_settings_needed').closest('.control-group').hide();
|
||||
jQuery('.note_database_settings_needed').closest('.control-group').show();
|
||||
}
|
||||
}
|
||||
|
||||
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 getLinked(){
|
||||
getCodeFrom_server(1, 'type', 'type', 'getLinked').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+'=1&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 = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
944
media/js/fieldtype.js
Normal file
944
media/js/fieldtype.js
Normal file
@ -0,0 +1,944 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwdkvxu_required = false;
|
||||
jform_vvvvwdmvxv_required = false;
|
||||
jform_vvvvwdovxw_required = false;
|
||||
jform_vvvvwdqvxx_required = false;
|
||||
jform_vvvvwdrvxy_required = false;
|
||||
jform_vvvvwdsvxz_required = false;
|
||||
jform_vvvvwdxvya_required = false;
|
||||
jform_vvvvwdxvyb_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var datalenght_vvvvwdk = jQuery("#jform_datalenght").val();
|
||||
var has_defaults_vvvvwdk = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdk(datalenght_vvvvwdk,has_defaults_vvvvwdk);
|
||||
|
||||
var datadefault_vvvvwdm = jQuery("#jform_datadefault").val();
|
||||
var has_defaults_vvvvwdm = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdm(datadefault_vvvvwdm,has_defaults_vvvvwdm);
|
||||
|
||||
var datatype_vvvvwdo = jQuery("#jform_datatype").val();
|
||||
var has_defaults_vvvvwdo = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdo(datatype_vvvvwdo,has_defaults_vvvvwdo);
|
||||
|
||||
var datatype_vvvvwdq = jQuery("#jform_datatype").val();
|
||||
var has_defaults_vvvvwdq = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdq(datatype_vvvvwdq,has_defaults_vvvvwdq);
|
||||
|
||||
var has_defaults_vvvvwdr = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
var datatype_vvvvwdr = jQuery("#jform_datatype").val();
|
||||
vvvvwdr(has_defaults_vvvvwdr,datatype_vvvvwdr);
|
||||
|
||||
var datatype_vvvvwds = jQuery("#jform_datatype").val();
|
||||
var has_defaults_vvvvwds = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwds(datatype_vvvvwds,has_defaults_vvvvwds);
|
||||
|
||||
var store_vvvvwdu = jQuery("#jform_store").val();
|
||||
var datatype_vvvvwdu = jQuery("#jform_datatype").val();
|
||||
var has_defaults_vvvvwdu = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdu(store_vvvvwdu,datatype_vvvvwdu,has_defaults_vvvvwdu);
|
||||
|
||||
var datatype_vvvvwdv = jQuery("#jform_datatype").val();
|
||||
var store_vvvvwdv = jQuery("#jform_store").val();
|
||||
var has_defaults_vvvvwdv = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdv(datatype_vvvvwdv,store_vvvvwdv,has_defaults_vvvvwdv);
|
||||
|
||||
var has_defaults_vvvvwdw = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
var store_vvvvwdw = jQuery("#jform_store").val();
|
||||
var datatype_vvvvwdw = jQuery("#jform_datatype").val();
|
||||
vvvvwdw(has_defaults_vvvvwdw,store_vvvvwdw,datatype_vvvvwdw);
|
||||
|
||||
var has_defaults_vvvvwdx = jQuery("#jform_has_defaults input[type='radio']:checked").val();
|
||||
vvvvwdx(has_defaults_vvvvwdx);
|
||||
});
|
||||
|
||||
// the vvvvwdk function
|
||||
function vvvvwdk(datalenght_vvvvwdk,has_defaults_vvvvwdk)
|
||||
{
|
||||
if (isSet(datalenght_vvvvwdk) && datalenght_vvvvwdk.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdk = datalenght_vvvvwdk;
|
||||
var datalenght_vvvvwdk = [];
|
||||
datalenght_vvvvwdk.push(temp_vvvvwdk);
|
||||
}
|
||||
else if (!isSet(datalenght_vvvvwdk))
|
||||
{
|
||||
var datalenght_vvvvwdk = [];
|
||||
}
|
||||
var datalenght = datalenght_vvvvwdk.some(datalenght_vvvvwdk_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdk) && has_defaults_vvvvwdk.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdk = has_defaults_vvvvwdk;
|
||||
var has_defaults_vvvvwdk = [];
|
||||
has_defaults_vvvvwdk.push(temp_vvvvwdk);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdk))
|
||||
{
|
||||
var has_defaults_vvvvwdk = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdk.some(has_defaults_vvvvwdk_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datalenght && has_defaults)
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').show();
|
||||
// add required attribute to datalenght_other field
|
||||
if (jform_vvvvwdkvxu_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',0);
|
||||
jQuery('#jform_datalenght_other').prop('required','required');
|
||||
jQuery('#jform_datalenght_other').attr('aria-required',true);
|
||||
jQuery('#jform_datalenght_other').addClass('required');
|
||||
jform_vvvvwdkvxu_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datalenght_other').closest('.control-group').hide();
|
||||
// remove required attribute from datalenght_other field
|
||||
if (!jform_vvvvwdkvxu_required)
|
||||
{
|
||||
updateFieldRequired('datalenght_other',1);
|
||||
jQuery('#jform_datalenght_other').removeAttr('required');
|
||||
jQuery('#jform_datalenght_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datalenght_other').removeClass('required');
|
||||
jform_vvvvwdkvxu_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdk Some function
|
||||
function datalenght_vvvvwdk_SomeFunc(datalenght_vvvvwdk)
|
||||
{
|
||||
// set the function logic
|
||||
if (datalenght_vvvvwdk == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdk Some function
|
||||
function has_defaults_vvvvwdk_SomeFunc(has_defaults_vvvvwdk)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdk == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdm function
|
||||
function vvvvwdm(datadefault_vvvvwdm,has_defaults_vvvvwdm)
|
||||
{
|
||||
if (isSet(datadefault_vvvvwdm) && datadefault_vvvvwdm.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdm = datadefault_vvvvwdm;
|
||||
var datadefault_vvvvwdm = [];
|
||||
datadefault_vvvvwdm.push(temp_vvvvwdm);
|
||||
}
|
||||
else if (!isSet(datadefault_vvvvwdm))
|
||||
{
|
||||
var datadefault_vvvvwdm = [];
|
||||
}
|
||||
var datadefault = datadefault_vvvvwdm.some(datadefault_vvvvwdm_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdm) && has_defaults_vvvvwdm.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdm = has_defaults_vvvvwdm;
|
||||
var has_defaults_vvvvwdm = [];
|
||||
has_defaults_vvvvwdm.push(temp_vvvvwdm);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdm))
|
||||
{
|
||||
var has_defaults_vvvvwdm = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdm.some(has_defaults_vvvvwdm_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datadefault && has_defaults)
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').show();
|
||||
// add required attribute to datadefault_other field
|
||||
if (jform_vvvvwdmvxv_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',0);
|
||||
jQuery('#jform_datadefault_other').prop('required','required');
|
||||
jQuery('#jform_datadefault_other').attr('aria-required',true);
|
||||
jQuery('#jform_datadefault_other').addClass('required');
|
||||
jform_vvvvwdmvxv_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault_other').closest('.control-group').hide();
|
||||
// remove required attribute from datadefault_other field
|
||||
if (!jform_vvvvwdmvxv_required)
|
||||
{
|
||||
updateFieldRequired('datadefault_other',1);
|
||||
jQuery('#jform_datadefault_other').removeAttr('required');
|
||||
jQuery('#jform_datadefault_other').removeAttr('aria-required');
|
||||
jQuery('#jform_datadefault_other').removeClass('required');
|
||||
jform_vvvvwdmvxv_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdm Some function
|
||||
function datadefault_vvvvwdm_SomeFunc(datadefault_vvvvwdm)
|
||||
{
|
||||
// set the function logic
|
||||
if (datadefault_vvvvwdm == 'Other')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdm Some function
|
||||
function has_defaults_vvvvwdm_SomeFunc(has_defaults_vvvvwdm)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdm == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdo function
|
||||
function vvvvwdo(datatype_vvvvwdo,has_defaults_vvvvwdo)
|
||||
{
|
||||
if (isSet(datatype_vvvvwdo) && datatype_vvvvwdo.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdo = datatype_vvvvwdo;
|
||||
var datatype_vvvvwdo = [];
|
||||
datatype_vvvvwdo.push(temp_vvvvwdo);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdo))
|
||||
{
|
||||
var datatype_vvvvwdo = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdo.some(datatype_vvvvwdo_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdo) && has_defaults_vvvvwdo.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdo = has_defaults_vvvvwdo;
|
||||
var has_defaults_vvvvwdo = [];
|
||||
has_defaults_vvvvwdo.push(temp_vvvvwdo);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdo))
|
||||
{
|
||||
var has_defaults_vvvvwdo = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdo.some(has_defaults_vvvvwdo_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype && has_defaults)
|
||||
{
|
||||
jQuery('#jform_datalenght').closest('.control-group').show();
|
||||
// add required attribute to datalenght field
|
||||
if (jform_vvvvwdovxw_required)
|
||||
{
|
||||
updateFieldRequired('datalenght',0);
|
||||
jQuery('#jform_datalenght').prop('required','required');
|
||||
jQuery('#jform_datalenght').attr('aria-required',true);
|
||||
jQuery('#jform_datalenght').addClass('required');
|
||||
jform_vvvvwdovxw_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datalenght').closest('.control-group').hide();
|
||||
// remove required attribute from datalenght field
|
||||
if (!jform_vvvvwdovxw_required)
|
||||
{
|
||||
updateFieldRequired('datalenght',1);
|
||||
jQuery('#jform_datalenght').removeAttr('required');
|
||||
jQuery('#jform_datalenght').removeAttr('aria-required');
|
||||
jQuery('#jform_datalenght').removeClass('required');
|
||||
jform_vvvvwdovxw_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdo Some function
|
||||
function datatype_vvvvwdo_SomeFunc(datatype_vvvvwdo)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdo == 'CHAR' || datatype_vvvvwdo == 'VARCHAR' || datatype_vvvvwdo == 'INT' || datatype_vvvvwdo == 'TINYINT' || datatype_vvvvwdo == 'BIGINT' || datatype_vvvvwdo == 'FLOAT' || datatype_vvvvwdo == 'DECIMAL' || datatype_vvvvwdo == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdo Some function
|
||||
function has_defaults_vvvvwdo_SomeFunc(has_defaults_vvvvwdo)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdo == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdq function
|
||||
function vvvvwdq(datatype_vvvvwdq,has_defaults_vvvvwdq)
|
||||
{
|
||||
if (isSet(datatype_vvvvwdq) && datatype_vvvvwdq.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdq = datatype_vvvvwdq;
|
||||
var datatype_vvvvwdq = [];
|
||||
datatype_vvvvwdq.push(temp_vvvvwdq);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdq))
|
||||
{
|
||||
var datatype_vvvvwdq = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdq.some(datatype_vvvvwdq_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdq) && has_defaults_vvvvwdq.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdq = has_defaults_vvvvwdq;
|
||||
var has_defaults_vvvvwdq = [];
|
||||
has_defaults_vvvvwdq.push(temp_vvvvwdq);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdq))
|
||||
{
|
||||
var has_defaults_vvvvwdq = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdq.some(has_defaults_vvvvwdq_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype && has_defaults)
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').show();
|
||||
jQuery('#jform_indexes').closest('.control-group').show();
|
||||
// add required attribute to indexes field
|
||||
if (jform_vvvvwdqvxx_required)
|
||||
{
|
||||
updateFieldRequired('indexes',0);
|
||||
jQuery('#jform_indexes').prop('required','required');
|
||||
jQuery('#jform_indexes').attr('aria-required',true);
|
||||
jQuery('#jform_indexes').addClass('required');
|
||||
jform_vvvvwdqvxx_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').hide();
|
||||
jQuery('#jform_indexes').closest('.control-group').hide();
|
||||
// remove required attribute from indexes field
|
||||
if (!jform_vvvvwdqvxx_required)
|
||||
{
|
||||
updateFieldRequired('indexes',1);
|
||||
jQuery('#jform_indexes').removeAttr('required');
|
||||
jQuery('#jform_indexes').removeAttr('aria-required');
|
||||
jQuery('#jform_indexes').removeClass('required');
|
||||
jform_vvvvwdqvxx_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdq Some function
|
||||
function datatype_vvvvwdq_SomeFunc(datatype_vvvvwdq)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdq == 'CHAR' || datatype_vvvvwdq == 'VARCHAR' || datatype_vvvvwdq == 'DATETIME' || datatype_vvvvwdq == 'DATE' || datatype_vvvvwdq == 'TIME' || datatype_vvvvwdq == 'INT' || datatype_vvvvwdq == 'TINYINT' || datatype_vvvvwdq == 'BIGINT' || datatype_vvvvwdq == 'FLOAT' || datatype_vvvvwdq == 'DECIMAL' || datatype_vvvvwdq == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdq Some function
|
||||
function has_defaults_vvvvwdq_SomeFunc(has_defaults_vvvvwdq)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdq == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdr function
|
||||
function vvvvwdr(has_defaults_vvvvwdr,datatype_vvvvwdr)
|
||||
{
|
||||
if (isSet(has_defaults_vvvvwdr) && has_defaults_vvvvwdr.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdr = has_defaults_vvvvwdr;
|
||||
var has_defaults_vvvvwdr = [];
|
||||
has_defaults_vvvvwdr.push(temp_vvvvwdr);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdr))
|
||||
{
|
||||
var has_defaults_vvvvwdr = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdr.some(has_defaults_vvvvwdr_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvwdr) && datatype_vvvvwdr.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdr = datatype_vvvvwdr;
|
||||
var datatype_vvvvwdr = [];
|
||||
datatype_vvvvwdr.push(temp_vvvvwdr);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdr))
|
||||
{
|
||||
var datatype_vvvvwdr = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdr.some(datatype_vvvvwdr_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (has_defaults && datatype)
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').show();
|
||||
jQuery('#jform_indexes').closest('.control-group').show();
|
||||
// add required attribute to indexes field
|
||||
if (jform_vvvvwdrvxy_required)
|
||||
{
|
||||
updateFieldRequired('indexes',0);
|
||||
jQuery('#jform_indexes').prop('required','required');
|
||||
jQuery('#jform_indexes').attr('aria-required',true);
|
||||
jQuery('#jform_indexes').addClass('required');
|
||||
jform_vvvvwdrvxy_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datadefault').closest('.control-group').hide();
|
||||
jQuery('#jform_indexes').closest('.control-group').hide();
|
||||
// remove required attribute from indexes field
|
||||
if (!jform_vvvvwdrvxy_required)
|
||||
{
|
||||
updateFieldRequired('indexes',1);
|
||||
jQuery('#jform_indexes').removeAttr('required');
|
||||
jQuery('#jform_indexes').removeAttr('aria-required');
|
||||
jQuery('#jform_indexes').removeClass('required');
|
||||
jform_vvvvwdrvxy_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdr Some function
|
||||
function has_defaults_vvvvwdr_SomeFunc(has_defaults_vvvvwdr)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdr == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdr Some function
|
||||
function datatype_vvvvwdr_SomeFunc(datatype_vvvvwdr)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdr == 'CHAR' || datatype_vvvvwdr == 'VARCHAR' || datatype_vvvvwdr == 'DATETIME' || datatype_vvvvwdr == 'DATE' || datatype_vvvvwdr == 'TIME' || datatype_vvvvwdr == 'INT' || datatype_vvvvwdr == 'TINYINT' || datatype_vvvvwdr == 'BIGINT' || datatype_vvvvwdr == 'FLOAT' || datatype_vvvvwdr == 'DECIMAL' || datatype_vvvvwdr == 'DOUBLE')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwds function
|
||||
function vvvvwds(datatype_vvvvwds,has_defaults_vvvvwds)
|
||||
{
|
||||
if (isSet(datatype_vvvvwds) && datatype_vvvvwds.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwds = datatype_vvvvwds;
|
||||
var datatype_vvvvwds = [];
|
||||
datatype_vvvvwds.push(temp_vvvvwds);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwds))
|
||||
{
|
||||
var datatype_vvvvwds = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwds.some(datatype_vvvvwds_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwds) && has_defaults_vvvvwds.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwds = has_defaults_vvvvwds;
|
||||
var has_defaults_vvvvwds = [];
|
||||
has_defaults_vvvvwds.push(temp_vvvvwds);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwds))
|
||||
{
|
||||
var has_defaults_vvvvwds = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwds.some(has_defaults_vvvvwds_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype && has_defaults)
|
||||
{
|
||||
jQuery('#jform_store').closest('.control-group').show();
|
||||
// add required attribute to store field
|
||||
if (jform_vvvvwdsvxz_required)
|
||||
{
|
||||
updateFieldRequired('store',0);
|
||||
jQuery('#jform_store').prop('required','required');
|
||||
jQuery('#jform_store').attr('aria-required',true);
|
||||
jQuery('#jform_store').addClass('required');
|
||||
jform_vvvvwdsvxz_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_store').closest('.control-group').hide();
|
||||
// remove required attribute from store field
|
||||
if (!jform_vvvvwdsvxz_required)
|
||||
{
|
||||
updateFieldRequired('store',1);
|
||||
jQuery('#jform_store').removeAttr('required');
|
||||
jQuery('#jform_store').removeAttr('aria-required');
|
||||
jQuery('#jform_store').removeClass('required');
|
||||
jform_vvvvwdsvxz_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwds Some function
|
||||
function datatype_vvvvwds_SomeFunc(datatype_vvvvwds)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwds == 'CHAR' || datatype_vvvvwds == 'VARCHAR' || datatype_vvvvwds == 'TEXT' || datatype_vvvvwds == 'MEDIUMTEXT' || datatype_vvvvwds == 'LONGTEXT' || datatype_vvvvwds == 'BLOB' || datatype_vvvvwds == 'TINYBLOB' || datatype_vvvvwds == 'MEDIUMBLOB' || datatype_vvvvwds == 'LONGBLOB')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwds Some function
|
||||
function has_defaults_vvvvwds_SomeFunc(has_defaults_vvvvwds)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwds == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdu function
|
||||
function vvvvwdu(store_vvvvwdu,datatype_vvvvwdu,has_defaults_vvvvwdu)
|
||||
{
|
||||
if (isSet(store_vvvvwdu) && store_vvvvwdu.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdu = store_vvvvwdu;
|
||||
var store_vvvvwdu = [];
|
||||
store_vvvvwdu.push(temp_vvvvwdu);
|
||||
}
|
||||
else if (!isSet(store_vvvvwdu))
|
||||
{
|
||||
var store_vvvvwdu = [];
|
||||
}
|
||||
var store = store_vvvvwdu.some(store_vvvvwdu_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvwdu) && datatype_vvvvwdu.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdu = datatype_vvvvwdu;
|
||||
var datatype_vvvvwdu = [];
|
||||
datatype_vvvvwdu.push(temp_vvvvwdu);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdu))
|
||||
{
|
||||
var datatype_vvvvwdu = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdu.some(datatype_vvvvwdu_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdu) && has_defaults_vvvvwdu.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdu = has_defaults_vvvvwdu;
|
||||
var has_defaults_vvvvwdu = [];
|
||||
has_defaults_vvvvwdu.push(temp_vvvvwdu);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdu))
|
||||
{
|
||||
var has_defaults_vvvvwdu = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdu.some(has_defaults_vvvvwdu_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (store && datatype && has_defaults)
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdu Some function
|
||||
function store_vvvvwdu_SomeFunc(store_vvvvwdu)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvwdu == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdu Some function
|
||||
function datatype_vvvvwdu_SomeFunc(datatype_vvvvwdu)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdu == 'CHAR' || datatype_vvvvwdu == 'VARCHAR' || datatype_vvvvwdu == 'TEXT' || datatype_vvvvwdu == 'MEDIUMTEXT' || datatype_vvvvwdu == 'LONGTEXT' || datatype_vvvvwdu == 'BLOB' || datatype_vvvvwdu == 'TINYBLOB' || datatype_vvvvwdu == 'MEDIUMBLOB' || datatype_vvvvwdu == 'LONGBLOB')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdu Some function
|
||||
function has_defaults_vvvvwdu_SomeFunc(has_defaults_vvvvwdu)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdu == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdv function
|
||||
function vvvvwdv(datatype_vvvvwdv,store_vvvvwdv,has_defaults_vvvvwdv)
|
||||
{
|
||||
if (isSet(datatype_vvvvwdv) && datatype_vvvvwdv.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdv = datatype_vvvvwdv;
|
||||
var datatype_vvvvwdv = [];
|
||||
datatype_vvvvwdv.push(temp_vvvvwdv);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdv))
|
||||
{
|
||||
var datatype_vvvvwdv = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdv.some(datatype_vvvvwdv_SomeFunc);
|
||||
|
||||
if (isSet(store_vvvvwdv) && store_vvvvwdv.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdv = store_vvvvwdv;
|
||||
var store_vvvvwdv = [];
|
||||
store_vvvvwdv.push(temp_vvvvwdv);
|
||||
}
|
||||
else if (!isSet(store_vvvvwdv))
|
||||
{
|
||||
var store_vvvvwdv = [];
|
||||
}
|
||||
var store = store_vvvvwdv.some(store_vvvvwdv_SomeFunc);
|
||||
|
||||
if (isSet(has_defaults_vvvvwdv) && has_defaults_vvvvwdv.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdv = has_defaults_vvvvwdv;
|
||||
var has_defaults_vvvvwdv = [];
|
||||
has_defaults_vvvvwdv.push(temp_vvvvwdv);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdv))
|
||||
{
|
||||
var has_defaults_vvvvwdv = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdv.some(has_defaults_vvvvwdv_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (datatype && store && has_defaults)
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdv Some function
|
||||
function datatype_vvvvwdv_SomeFunc(datatype_vvvvwdv)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdv == 'CHAR' || datatype_vvvvwdv == 'VARCHAR' || datatype_vvvvwdv == 'TEXT' || datatype_vvvvwdv == 'MEDIUMTEXT' || datatype_vvvvwdv == 'LONGTEXT' || datatype_vvvvwdv == 'BLOB' || datatype_vvvvwdv == 'TINYBLOB' || datatype_vvvvwdv == 'MEDIUMBLOB' || datatype_vvvvwdv == 'LONGBLOB')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdv Some function
|
||||
function store_vvvvwdv_SomeFunc(store_vvvvwdv)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvwdv == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdv Some function
|
||||
function has_defaults_vvvvwdv_SomeFunc(has_defaults_vvvvwdv)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdv == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdw function
|
||||
function vvvvwdw(has_defaults_vvvvwdw,store_vvvvwdw,datatype_vvvvwdw)
|
||||
{
|
||||
if (isSet(has_defaults_vvvvwdw) && has_defaults_vvvvwdw.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdw = has_defaults_vvvvwdw;
|
||||
var has_defaults_vvvvwdw = [];
|
||||
has_defaults_vvvvwdw.push(temp_vvvvwdw);
|
||||
}
|
||||
else if (!isSet(has_defaults_vvvvwdw))
|
||||
{
|
||||
var has_defaults_vvvvwdw = [];
|
||||
}
|
||||
var has_defaults = has_defaults_vvvvwdw.some(has_defaults_vvvvwdw_SomeFunc);
|
||||
|
||||
if (isSet(store_vvvvwdw) && store_vvvvwdw.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdw = store_vvvvwdw;
|
||||
var store_vvvvwdw = [];
|
||||
store_vvvvwdw.push(temp_vvvvwdw);
|
||||
}
|
||||
else if (!isSet(store_vvvvwdw))
|
||||
{
|
||||
var store_vvvvwdw = [];
|
||||
}
|
||||
var store = store_vvvvwdw.some(store_vvvvwdw_SomeFunc);
|
||||
|
||||
if (isSet(datatype_vvvvwdw) && datatype_vvvvwdw.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdw = datatype_vvvvwdw;
|
||||
var datatype_vvvvwdw = [];
|
||||
datatype_vvvvwdw.push(temp_vvvvwdw);
|
||||
}
|
||||
else if (!isSet(datatype_vvvvwdw))
|
||||
{
|
||||
var datatype_vvvvwdw = [];
|
||||
}
|
||||
var datatype = datatype_vvvvwdw.some(datatype_vvvvwdw_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (has_defaults && store && datatype)
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_whmcs_encryption').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdw Some function
|
||||
function has_defaults_vvvvwdw_SomeFunc(has_defaults_vvvvwdw)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdw == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdw Some function
|
||||
function store_vvvvwdw_SomeFunc(store_vvvvwdw)
|
||||
{
|
||||
// set the function logic
|
||||
if (store_vvvvwdw == 4)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdw Some function
|
||||
function datatype_vvvvwdw_SomeFunc(datatype_vvvvwdw)
|
||||
{
|
||||
// set the function logic
|
||||
if (datatype_vvvvwdw == 'CHAR' || datatype_vvvvwdw == 'VARCHAR' || datatype_vvvvwdw == 'TEXT' || datatype_vvvvwdw == 'MEDIUMTEXT' || datatype_vvvvwdw == 'LONGTEXT' || datatype_vvvvwdw == 'BLOB' || datatype_vvvvwdw == 'TINYBLOB' || datatype_vvvvwdw == 'MEDIUMBLOB' || datatype_vvvvwdw == 'LONGBLOB')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdx function
|
||||
function vvvvwdx(has_defaults_vvvvwdx)
|
||||
{
|
||||
// set the function logic
|
||||
if (has_defaults_vvvvwdx == 1)
|
||||
{
|
||||
jQuery('#jform_datatype').closest('.control-group').show();
|
||||
// add required attribute to datatype field
|
||||
if (jform_vvvvwdxvya_required)
|
||||
{
|
||||
updateFieldRequired('datatype',0);
|
||||
jQuery('#jform_datatype').prop('required','required');
|
||||
jQuery('#jform_datatype').attr('aria-required',true);
|
||||
jQuery('#jform_datatype').addClass('required');
|
||||
jform_vvvvwdxvya_required = false;
|
||||
}
|
||||
jQuery('#jform_null_switch').closest('.control-group').show();
|
||||
// add required attribute to null_switch field
|
||||
if (jform_vvvvwdxvyb_required)
|
||||
{
|
||||
updateFieldRequired('null_switch',0);
|
||||
jQuery('#jform_null_switch').prop('required','required');
|
||||
jQuery('#jform_null_switch').attr('aria-required',true);
|
||||
jQuery('#jform_null_switch').addClass('required');
|
||||
jform_vvvvwdxvyb_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_datatype').closest('.control-group').hide();
|
||||
// remove required attribute from datatype field
|
||||
if (!jform_vvvvwdxvya_required)
|
||||
{
|
||||
updateFieldRequired('datatype',1);
|
||||
jQuery('#jform_datatype').removeAttr('required');
|
||||
jQuery('#jform_datatype').removeAttr('aria-required');
|
||||
jQuery('#jform_datatype').removeClass('required');
|
||||
jform_vvvvwdxvya_required = true;
|
||||
}
|
||||
jQuery('#jform_null_switch').closest('.control-group').hide();
|
||||
// remove required attribute from null_switch field
|
||||
if (!jform_vvvvwdxvyb_required)
|
||||
{
|
||||
updateFieldRequired('null_switch',1);
|
||||
jQuery('#jform_null_switch').removeAttr('required');
|
||||
jQuery('#jform_null_switch').removeAttr('aria-required');
|
||||
jQuery('#jform_null_switch').removeClass('required');
|
||||
jform_vvvvwdxvyb_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
// check and load all the custom code edit buttons
|
||||
getEditCustomCodeButtons();
|
||||
});
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
335
media/js/help_document.js
Normal file
335
media/js/help_document.js
Normal file
@ -0,0 +1,335 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvweivyn_required = false;
|
||||
jform_vvvvwejvyo_required = false;
|
||||
jform_vvvvwekvyp_required = false;
|
||||
jform_vvvvwelvyq_required = false;
|
||||
jform_vvvvwenvyr_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var location_vvvvwei = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwei(location_vvvvwei);
|
||||
|
||||
var location_vvvvwej = jQuery("#jform_location input[type='radio']:checked").val();
|
||||
vvvvwej(location_vvvvwej);
|
||||
|
||||
var type_vvvvwek = jQuery("#jform_type").val();
|
||||
vvvvwek(type_vvvvwek);
|
||||
|
||||
var type_vvvvwel = jQuery("#jform_type").val();
|
||||
vvvvwel(type_vvvvwel);
|
||||
|
||||
var type_vvvvwem = jQuery("#jform_type").val();
|
||||
vvvvwem(type_vvvvwem);
|
||||
|
||||
var target_vvvvwen = jQuery("#jform_target input[type='radio']:checked").val();
|
||||
vvvvwen(target_vvvvwen);
|
||||
});
|
||||
|
||||
// the vvvvwei function
|
||||
function vvvvwei(location_vvvvwei)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvwei == 1)
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').show();
|
||||
// add required attribute to admin_view field
|
||||
if (jform_vvvvweivyn_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',0);
|
||||
jQuery('#jform_admin_view').prop('required','required');
|
||||
jQuery('#jform_admin_view').attr('aria-required',true);
|
||||
jQuery('#jform_admin_view').addClass('required');
|
||||
jform_vvvvweivyn_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_admin_view').closest('.control-group').hide();
|
||||
// remove required attribute from admin_view field
|
||||
if (!jform_vvvvweivyn_required)
|
||||
{
|
||||
updateFieldRequired('admin_view',1);
|
||||
jQuery('#jform_admin_view').removeAttr('required');
|
||||
jQuery('#jform_admin_view').removeAttr('aria-required');
|
||||
jQuery('#jform_admin_view').removeClass('required');
|
||||
jform_vvvvweivyn_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwej function
|
||||
function vvvvwej(location_vvvvwej)
|
||||
{
|
||||
// set the function logic
|
||||
if (location_vvvvwej == 2)
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').show();
|
||||
// add required attribute to site_view field
|
||||
if (jform_vvvvwejvyo_required)
|
||||
{
|
||||
updateFieldRequired('site_view',0);
|
||||
jQuery('#jform_site_view').prop('required','required');
|
||||
jQuery('#jform_site_view').attr('aria-required',true);
|
||||
jQuery('#jform_site_view').addClass('required');
|
||||
jform_vvvvwejvyo_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_site_view').closest('.control-group').hide();
|
||||
// remove required attribute from site_view field
|
||||
if (!jform_vvvvwejvyo_required)
|
||||
{
|
||||
updateFieldRequired('site_view',1);
|
||||
jQuery('#jform_site_view').removeAttr('required');
|
||||
jQuery('#jform_site_view').removeAttr('aria-required');
|
||||
jQuery('#jform_site_view').removeClass('required');
|
||||
jform_vvvvwejvyo_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwek function
|
||||
function vvvvwek(type_vvvvwek)
|
||||
{
|
||||
if (isSet(type_vvvvwek) && type_vvvvwek.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwek = type_vvvvwek;
|
||||
var type_vvvvwek = [];
|
||||
type_vvvvwek.push(temp_vvvvwek);
|
||||
}
|
||||
else if (!isSet(type_vvvvwek))
|
||||
{
|
||||
var type_vvvvwek = [];
|
||||
}
|
||||
var type = type_vvvvwek.some(type_vvvvwek_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').show();
|
||||
// add required attribute to url field
|
||||
if (jform_vvvvwekvyp_required)
|
||||
{
|
||||
updateFieldRequired('url',0);
|
||||
jQuery('#jform_url').prop('required','required');
|
||||
jQuery('#jform_url').attr('aria-required',true);
|
||||
jQuery('#jform_url').addClass('required');
|
||||
jform_vvvvwekvyp_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_url').closest('.control-group').hide();
|
||||
// remove required attribute from url field
|
||||
if (!jform_vvvvwekvyp_required)
|
||||
{
|
||||
updateFieldRequired('url',1);
|
||||
jQuery('#jform_url').removeAttr('required');
|
||||
jQuery('#jform_url').removeAttr('aria-required');
|
||||
jQuery('#jform_url').removeClass('required');
|
||||
jform_vvvvwekvyp_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwek Some function
|
||||
function type_vvvvwek_SomeFunc(type_vvvvwek)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwek == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwel function
|
||||
function vvvvwel(type_vvvvwel)
|
||||
{
|
||||
if (isSet(type_vvvvwel) && type_vvvvwel.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwel = type_vvvvwel;
|
||||
var type_vvvvwel = [];
|
||||
type_vvvvwel.push(temp_vvvvwel);
|
||||
}
|
||||
else if (!isSet(type_vvvvwel))
|
||||
{
|
||||
var type_vvvvwel = [];
|
||||
}
|
||||
var type = type_vvvvwel.some(type_vvvvwel_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').show();
|
||||
// add required attribute to article field
|
||||
if (jform_vvvvwelvyq_required)
|
||||
{
|
||||
updateFieldRequired('article',0);
|
||||
jQuery('#jform_article').prop('required','required');
|
||||
jQuery('#jform_article').attr('aria-required',true);
|
||||
jQuery('#jform_article').addClass('required');
|
||||
jform_vvvvwelvyq_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_article').closest('.control-group').hide();
|
||||
// remove required attribute from article field
|
||||
if (!jform_vvvvwelvyq_required)
|
||||
{
|
||||
updateFieldRequired('article',1);
|
||||
jQuery('#jform_article').removeAttr('required');
|
||||
jQuery('#jform_article').removeAttr('aria-required');
|
||||
jQuery('#jform_article').removeClass('required');
|
||||
jform_vvvvwelvyq_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwel Some function
|
||||
function type_vvvvwel_SomeFunc(type_vvvvwel)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwel == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwem function
|
||||
function vvvvwem(type_vvvvwem)
|
||||
{
|
||||
if (isSet(type_vvvvwem) && type_vvvvwem.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwem = type_vvvvwem;
|
||||
var type_vvvvwem = [];
|
||||
type_vvvvwem.push(temp_vvvvwem);
|
||||
}
|
||||
else if (!isSet(type_vvvvwem))
|
||||
{
|
||||
var type_vvvvwem = [];
|
||||
}
|
||||
var type = type_vvvvwem.some(type_vvvvwem_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (type)
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwem Some function
|
||||
function type_vvvvwem_SomeFunc(type_vvvvwem)
|
||||
{
|
||||
// set the function logic
|
||||
if (type_vvvvwem == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwen function
|
||||
function vvvvwen(target_vvvvwen)
|
||||
{
|
||||
// set the function logic
|
||||
if (target_vvvvwen == 1)
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').show();
|
||||
// add required attribute to groups field
|
||||
if (jform_vvvvwenvyr_required)
|
||||
{
|
||||
updateFieldRequired('groups',0);
|
||||
jQuery('#jform_groups').prop('required','required');
|
||||
jQuery('#jform_groups').attr('aria-required',true);
|
||||
jQuery('#jform_groups').addClass('required');
|
||||
jform_vvvvwenvyr_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_groups').closest('.control-group').hide();
|
||||
// remove required attribute from groups field
|
||||
if (!jform_vvvvwenvyr_required)
|
||||
{
|
||||
updateFieldRequired('groups',1);
|
||||
jQuery('#jform_groups').removeAttr('required');
|
||||
jQuery('#jform_groups').removeAttr('aria-required');
|
||||
jQuery('#jform_groups').removeClass('required');
|
||||
jform_vvvvwenvyr_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
1005
media/js/joomla_component.js
Normal file
1005
media/js/joomla_component.js
Normal file
File diff suppressed because it is too large
Load Diff
797
media/js/joomla_module.js
Normal file
797
media/js/joomla_module.js
Normal file
@ -0,0 +1,797 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvvxrvwd_required = false;
|
||||
jform_vvvvvxsvwe_required = false;
|
||||
jform_vvvvvxtvwf_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var add_class_helper_vvvvvxb = jQuery("#jform_add_class_helper").val();
|
||||
vvvvvxb(add_class_helper_vvvvvxb);
|
||||
|
||||
var add_class_helper_header_vvvvvxc = jQuery("#jform_add_class_helper_header input[type='radio']:checked").val();
|
||||
var add_class_helper_vvvvvxc = jQuery("#jform_add_class_helper").val();
|
||||
vvvvvxc(add_class_helper_header_vvvvvxc,add_class_helper_vvvvvxc);
|
||||
|
||||
var add_php_script_construct_vvvvvxe = jQuery("#jform_add_php_script_construct input[type='radio']:checked").val();
|
||||
vvvvvxe(add_php_script_construct_vvvvvxe);
|
||||
|
||||
var add_php_preflight_install_vvvvvxf = jQuery("#jform_add_php_preflight_install input[type='radio']:checked").val();
|
||||
vvvvvxf(add_php_preflight_install_vvvvvxf);
|
||||
|
||||
var add_php_preflight_update_vvvvvxg = jQuery("#jform_add_php_preflight_update input[type='radio']:checked").val();
|
||||
vvvvvxg(add_php_preflight_update_vvvvvxg);
|
||||
|
||||
var add_php_preflight_uninstall_vvvvvxh = jQuery("#jform_add_php_preflight_uninstall input[type='radio']:checked").val();
|
||||
vvvvvxh(add_php_preflight_uninstall_vvvvvxh);
|
||||
|
||||
var add_php_postflight_install_vvvvvxi = jQuery("#jform_add_php_postflight_install input[type='radio']:checked").val();
|
||||
vvvvvxi(add_php_postflight_install_vvvvvxi);
|
||||
|
||||
var add_php_postflight_update_vvvvvxj = jQuery("#jform_add_php_postflight_update input[type='radio']:checked").val();
|
||||
vvvvvxj(add_php_postflight_update_vvvvvxj);
|
||||
|
||||
var add_php_method_uninstall_vvvvvxk = jQuery("#jform_add_php_method_uninstall input[type='radio']:checked").val();
|
||||
vvvvvxk(add_php_method_uninstall_vvvvvxk);
|
||||
|
||||
var update_server_target_vvvvvxl = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
||||
var add_update_server_vvvvvxl = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
vvvvvxl(update_server_target_vvvvvxl,add_update_server_vvvvvxl);
|
||||
|
||||
var add_update_server_vvvvvxm = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
var update_server_target_vvvvvxm = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
||||
vvvvvxm(add_update_server_vvvvvxm,update_server_target_vvvvvxm);
|
||||
|
||||
var update_server_target_vvvvvxn = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
||||
var add_update_server_vvvvvxn = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
vvvvvxn(update_server_target_vvvvvxn,add_update_server_vvvvvxn);
|
||||
|
||||
var update_server_target_vvvvvxp = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
||||
var add_update_server_vvvvvxp = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
vvvvvxp(update_server_target_vvvvvxp,add_update_server_vvvvvxp);
|
||||
|
||||
var add_update_server_vvvvvxr = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
vvvvvxr(add_update_server_vvvvvxr);
|
||||
|
||||
var add_sql_vvvvvxs = jQuery("#jform_add_sql input[type='radio']:checked").val();
|
||||
vvvvvxs(add_sql_vvvvvxs);
|
||||
|
||||
var add_sql_uninstall_vvvvvxt = jQuery("#jform_add_sql_uninstall input[type='radio']:checked").val();
|
||||
vvvvvxt(add_sql_uninstall_vvvvvxt);
|
||||
|
||||
var add_update_server_vvvvvxu = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
||||
vvvvvxu(add_update_server_vvvvvxu);
|
||||
|
||||
var add_sales_server_vvvvvxv = jQuery("#jform_add_sales_server input[type='radio']:checked").val();
|
||||
vvvvvxv(add_sales_server_vvvvvxv);
|
||||
|
||||
var addreadme_vvvvvxw = jQuery("#jform_addreadme input[type='radio']:checked").val();
|
||||
vvvvvxw(addreadme_vvvvvxw);
|
||||
});
|
||||
|
||||
// the vvvvvxb function
|
||||
function vvvvvxb(add_class_helper_vvvvvxb)
|
||||
{
|
||||
if (isSet(add_class_helper_vvvvvxb) && add_class_helper_vvvvvxb.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvxb = add_class_helper_vvvvvxb;
|
||||
var add_class_helper_vvvvvxb = [];
|
||||
add_class_helper_vvvvvxb.push(temp_vvvvvxb);
|
||||
}
|
||||
else if (!isSet(add_class_helper_vvvvvxb))
|
||||
{
|
||||
var add_class_helper_vvvvvxb = [];
|
||||
}
|
||||
var add_class_helper = add_class_helper_vvvvvxb.some(add_class_helper_vvvvvxb_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (add_class_helper)
|
||||
{
|
||||
jQuery('#jform_add_class_helper_header').closest('.control-group').show();
|
||||
jQuery('#jform_class_helper_code-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_add_class_helper_header').closest('.control-group').hide();
|
||||
jQuery('#jform_class_helper_code-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxb Some function
|
||||
function add_class_helper_vvvvvxb_SomeFunc(add_class_helper_vvvvvxb)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_class_helper_vvvvvxb == 1 || add_class_helper_vvvvvxb == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvxc function
|
||||
function vvvvvxc(add_class_helper_header_vvvvvxc,add_class_helper_vvvvvxc)
|
||||
{
|
||||
if (isSet(add_class_helper_header_vvvvvxc) && add_class_helper_header_vvvvvxc.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvxc = add_class_helper_header_vvvvvxc;
|
||||
var add_class_helper_header_vvvvvxc = [];
|
||||
add_class_helper_header_vvvvvxc.push(temp_vvvvvxc);
|
||||
}
|
||||
else if (!isSet(add_class_helper_header_vvvvvxc))
|
||||
{
|
||||
var add_class_helper_header_vvvvvxc = [];
|
||||
}
|
||||
var add_class_helper_header = add_class_helper_header_vvvvvxc.some(add_class_helper_header_vvvvvxc_SomeFunc);
|
||||
|
||||
if (isSet(add_class_helper_vvvvvxc) && add_class_helper_vvvvvxc.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvvxc = add_class_helper_vvvvvxc;
|
||||
var add_class_helper_vvvvvxc = [];
|
||||
add_class_helper_vvvvvxc.push(temp_vvvvvxc);
|
||||
}
|
||||
else if (!isSet(add_class_helper_vvvvvxc))
|
||||
{
|
||||
var add_class_helper_vvvvvxc = [];
|
||||
}
|
||||
var add_class_helper = add_class_helper_vvvvvxc.some(add_class_helper_vvvvvxc_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (add_class_helper_header && add_class_helper)
|
||||
{
|
||||
jQuery('#jform_class_helper_header-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_class_helper_header-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxc Some function
|
||||
function add_class_helper_header_vvvvvxc_SomeFunc(add_class_helper_header_vvvvvxc)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_class_helper_header_vvvvvxc == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvxc Some function
|
||||
function add_class_helper_vvvvvxc_SomeFunc(add_class_helper_vvvvvxc)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_class_helper_vvvvvxc == 1 || add_class_helper_vvvvvxc == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvvxe function
|
||||
function vvvvvxe(add_php_script_construct_vvvvvxe)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_script_construct_vvvvvxe == 1)
|
||||
{
|
||||
jQuery('#jform_php_script_construct-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_script_construct-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxf function
|
||||
function vvvvvxf(add_php_preflight_install_vvvvvxf)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_preflight_install_vvvvvxf == 1)
|
||||
{
|
||||
jQuery('#jform_php_preflight_install-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_preflight_install-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxg function
|
||||
function vvvvvxg(add_php_preflight_update_vvvvvxg)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_preflight_update_vvvvvxg == 1)
|
||||
{
|
||||
jQuery('#jform_php_preflight_update-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_preflight_update-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxh function
|
||||
function vvvvvxh(add_php_preflight_uninstall_vvvvvxh)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_preflight_uninstall_vvvvvxh == 1)
|
||||
{
|
||||
jQuery('#jform_php_preflight_uninstall-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_preflight_uninstall-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxi function
|
||||
function vvvvvxi(add_php_postflight_install_vvvvvxi)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_postflight_install_vvvvvxi == 1)
|
||||
{
|
||||
jQuery('#jform_php_postflight_install-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_postflight_install-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxj function
|
||||
function vvvvvxj(add_php_postflight_update_vvvvvxj)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_postflight_update_vvvvvxj == 1)
|
||||
{
|
||||
jQuery('#jform_php_postflight_update-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_postflight_update-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxk function
|
||||
function vvvvvxk(add_php_method_uninstall_vvvvvxk)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_method_uninstall_vvvvvxk == 1)
|
||||
{
|
||||
jQuery('#jform_php_method_uninstall-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_method_uninstall-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxl function
|
||||
function vvvvvxl(update_server_target_vvvvvxl,add_update_server_vvvvvxl)
|
||||
{
|
||||
// set the function logic
|
||||
if (update_server_target_vvvvvxl == 1 && add_update_server_vvvvvxl == 1)
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').show();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').hide();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxm function
|
||||
function vvvvvxm(add_update_server_vvvvvxm,update_server_target_vvvvvxm)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_update_server_vvvvvxm == 1 && update_server_target_vvvvvxm == 1)
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').show();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server').closest('.control-group').hide();
|
||||
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxn function
|
||||
function vvvvvxn(update_server_target_vvvvvxn,add_update_server_vvvvvxn)
|
||||
{
|
||||
// set the function logic
|
||||
if (update_server_target_vvvvvxn == 2 && add_update_server_vvvvvxn == 1)
|
||||
{
|
||||
jQuery('.note_update_server_note_zip').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_update_server_note_zip').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxp function
|
||||
function vvvvvxp(update_server_target_vvvvvxp,add_update_server_vvvvvxp)
|
||||
{
|
||||
// set the function logic
|
||||
if (update_server_target_vvvvvxp == 3 && add_update_server_vvvvvxp == 1)
|
||||
{
|
||||
jQuery('.note_update_server_note_other').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_update_server_note_other').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxr function
|
||||
function vvvvvxr(add_update_server_vvvvvxr)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_update_server_vvvvvxr == 1)
|
||||
{
|
||||
jQuery('#jform_update_server_target').closest('.control-group').show();
|
||||
// add required attribute to update_server_target field
|
||||
if (jform_vvvvvxrvwd_required)
|
||||
{
|
||||
updateFieldRequired('update_server_target',0);
|
||||
jQuery('#jform_update_server_target').prop('required','required');
|
||||
jQuery('#jform_update_server_target').attr('aria-required',true);
|
||||
jQuery('#jform_update_server_target').addClass('required');
|
||||
jform_vvvvvxrvwd_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server_target').closest('.control-group').hide();
|
||||
// remove required attribute from update_server_target field
|
||||
if (!jform_vvvvvxrvwd_required)
|
||||
{
|
||||
updateFieldRequired('update_server_target',1);
|
||||
jQuery('#jform_update_server_target').removeAttr('required');
|
||||
jQuery('#jform_update_server_target').removeAttr('aria-required');
|
||||
jQuery('#jform_update_server_target').removeClass('required');
|
||||
jform_vvvvvxrvwd_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxs function
|
||||
function vvvvvxs(add_sql_vvvvvxs)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_sql_vvvvvxs == 1)
|
||||
{
|
||||
jQuery('#jform_sql').closest('.control-group').show();
|
||||
// add required attribute to sql field
|
||||
if (jform_vvvvvxsvwe_required)
|
||||
{
|
||||
updateFieldRequired('sql',0);
|
||||
jQuery('#jform_sql').prop('required','required');
|
||||
jQuery('#jform_sql').attr('aria-required',true);
|
||||
jQuery('#jform_sql').addClass('required');
|
||||
jform_vvvvvxsvwe_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_sql').closest('.control-group').hide();
|
||||
// remove required attribute from sql field
|
||||
if (!jform_vvvvvxsvwe_required)
|
||||
{
|
||||
updateFieldRequired('sql',1);
|
||||
jQuery('#jform_sql').removeAttr('required');
|
||||
jQuery('#jform_sql').removeAttr('aria-required');
|
||||
jQuery('#jform_sql').removeClass('required');
|
||||
jform_vvvvvxsvwe_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxt function
|
||||
function vvvvvxt(add_sql_uninstall_vvvvvxt)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_sql_uninstall_vvvvvxt == 1)
|
||||
{
|
||||
jQuery('#jform_sql_uninstall').closest('.control-group').show();
|
||||
// add required attribute to sql_uninstall field
|
||||
if (jform_vvvvvxtvwf_required)
|
||||
{
|
||||
updateFieldRequired('sql_uninstall',0);
|
||||
jQuery('#jform_sql_uninstall').prop('required','required');
|
||||
jQuery('#jform_sql_uninstall').attr('aria-required',true);
|
||||
jQuery('#jform_sql_uninstall').addClass('required');
|
||||
jform_vvvvvxtvwf_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_sql_uninstall').closest('.control-group').hide();
|
||||
// remove required attribute from sql_uninstall field
|
||||
if (!jform_vvvvvxtvwf_required)
|
||||
{
|
||||
updateFieldRequired('sql_uninstall',1);
|
||||
jQuery('#jform_sql_uninstall').removeAttr('required');
|
||||
jQuery('#jform_sql_uninstall').removeAttr('aria-required');
|
||||
jQuery('#jform_sql_uninstall').removeClass('required');
|
||||
jform_vvvvvxtvwf_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxu function
|
||||
function vvvvvxu(add_update_server_vvvvvxu)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_update_server_vvvvvxu == 1)
|
||||
{
|
||||
jQuery('#jform_update_server_url').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_update_server_url').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxv function
|
||||
function vvvvvxv(add_sales_server_vvvvvxv)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_sales_server_vvvvvxv == 1)
|
||||
{
|
||||
jQuery('#jform_sales_server').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_sales_server').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvvxw function
|
||||
function vvvvvxw(addreadme_vvvvvxw)
|
||||
{
|
||||
// set the function logic
|
||||
if (addreadme_vvvvvxw == 1)
|
||||
{
|
||||
jQuery('#jform_readme-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_readme-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function() {
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
function setModuleCode() {
|
||||
var selected_get = jQuery("#jform_add_class_helper option:selected").val();
|
||||
var custom_gets = jQuery("#jform_custom_get").val();
|
||||
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({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function addCodeToEditor(code_string, editor_id, merge, merge_target){
|
||||
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) {
|
||||
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){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&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>Add/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(id){
|
||||
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
jQuery("#snippet").focus(function() {
|
||||
var jQuerythis = jQuery(this);
|
||||
jQuerythis.select();
|
||||
|
||||
// Work around Chrome's little problem
|
||||
jQuerythis.mouseup(function() {
|
||||
// Prevent further mouseup intervention
|
||||
jQuerythis.unbind("mouseup");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
if(result.usage){
|
||||
var usage = '<div id="snippet-usage"><p>'+result.usage+'</p></div>';
|
||||
jQuery('#snippet-usage').remove();
|
||||
jQuery('.snippet-usage').append(usage);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// set snippets that are on the page
|
||||
var snippetIds = [];
|
||||
var snippets = {};
|
||||
var snippet = 0;
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
jQuery("#jform_snippet option").each(function()
|
||||
{
|
||||
var key = jQuery(this).val();
|
||||
var text = jQuery(this).text();
|
||||
snippets[key] = text;
|
||||
snippetIds.push(key);
|
||||
});
|
||||
snippet = jQuery("#jform_snippet").val();
|
||||
getSnippets();
|
||||
});
|
||||
|
||||
function getSnippets(){
|
||||
jQuery("#loading").show();
|
||||
// clear the selection
|
||||
jQuery('#jform_snippet').find('option').remove().end();
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
// get libraries value if set
|
||||
var libraries = jQuery("#jform_libraries").val();
|
||||
if (libraries) {
|
||||
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||
setSnippets(result);
|
||||
jQuery("#loading").hide();
|
||||
if (typeof snippetButton !== 'undefined') {
|
||||
// ensure button is correct
|
||||
var snippet = jQuery('#jform_snippet').val();
|
||||
snippetButton(snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// load all snippets in none is selected
|
||||
setSnippets(snippetIds);
|
||||
jQuery("#loading").hide();
|
||||
}
|
||||
}
|
||||
function setSnippets(array){
|
||||
if (array) {
|
||||
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
|
||||
jQuery.each( array, function( i, id ) {
|
||||
if (id in snippets) {
|
||||
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
|
||||
}
|
||||
if (id == snippet) {
|
||||
jQuery('#jform_snippet').val(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
}
|
11
media/js/joomla_module_files_folders_urls.js
Normal file
11
media/js/joomla_module_files_folders_urls.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/joomla_module_updates.js
Normal file
11
media/js/joomla_module_updates.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
1131
media/js/joomla_plugin.js
Normal file
1131
media/js/joomla_plugin.js
Normal file
File diff suppressed because it is too large
Load Diff
11
media/js/joomla_plugin_files_folders_urls.js
Normal file
11
media/js/joomla_plugin_files_folders_urls.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/joomla_plugin_group.js
Normal file
11
media/js/joomla_plugin_group.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/joomla_plugin_updates.js
Normal file
11
media/js/joomla_plugin_updates.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/language.js
Normal file
11
media/js/language.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
48
media/js/language_translation.js
Normal file
48
media/js/language_translation.js
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
// set button to add more languages
|
||||
addButton('language','entranslation');
|
||||
});
|
||||
function addData(result,where){
|
||||
jQuery(result).insertAfter(jQuery(where).closest('.control-group'));
|
||||
}
|
||||
|
||||
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+'=1&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);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
247
media/js/layout.js
Normal file
247
media/js/layout.js
Normal file
@ -0,0 +1,247 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var add_php_view_vvvvwaz = jQuery("#jform_add_php_view input[type='radio']:checked").val();
|
||||
vvvvwaz(add_php_view_vvvvwaz);
|
||||
});
|
||||
|
||||
// the vvvvwaz function
|
||||
function vvvvwaz(add_php_view_vvvvwaz)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_view_vvvvwaz == 1)
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
// check and load all the custom code edit buttons
|
||||
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){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&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>Add/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(id){
|
||||
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
jQuery("#snippet").focus(function() {
|
||||
var jQuerythis = jQuery(this);
|
||||
jQuerythis.select();
|
||||
|
||||
// Work around Chrome's little problem
|
||||
jQuerythis.mouseup(function() {
|
||||
// Prevent further mouseup intervention
|
||||
jQuerythis.unbind("mouseup");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
if(result.usage){
|
||||
var usage = '<div id="snippet-usage"><p>'+result.usage+'</p></div>';
|
||||
jQuery('#snippet-usage').remove();
|
||||
jQuery('.snippet-usage').append(usage);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getDynamicValues_server(dynamicId){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json");
|
||||
if(token.length > 0 && dynamicId > 0){
|
||||
var request = token+'=1&view=layout&id='+dynamicId;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
|
||||
function getDynamicValues(id){
|
||||
getDynamicValues_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#dynamic_values').remove();
|
||||
jQuery('.dynamic_values').append('<div id="dynamic_values">'+result+'</div>');
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getLayoutDetails_server(id){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&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 getLayoutDetails(id){
|
||||
getLayoutDetails_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// set snippets that are on the page
|
||||
var snippetIds = [];
|
||||
var snippets = {};
|
||||
var snippet = 0;
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
jQuery("#jform_snippet option").each(function()
|
||||
{
|
||||
var key = jQuery(this).val();
|
||||
var text = jQuery(this).text();
|
||||
snippets[key] = text;
|
||||
snippetIds.push(key);
|
||||
});
|
||||
snippet = jQuery("#jform_snippet").val();
|
||||
getSnippets();
|
||||
});
|
||||
|
||||
function getSnippets(){
|
||||
jQuery("#loading").show();
|
||||
// clear the selection
|
||||
jQuery('#jform_snippet').find('option').remove().end();
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
// get libraries value if set
|
||||
var libraries = jQuery("#jform_libraries").val();
|
||||
if (libraries) {
|
||||
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||
setSnippets(result);
|
||||
jQuery("#loading").hide();
|
||||
if (typeof snippetButton !== 'undefined') {
|
||||
// ensure button is correct
|
||||
var snippet = jQuery('#jform_snippet').val();
|
||||
snippetButton(snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// load all snippets in none is selected
|
||||
setSnippets(snippetIds);
|
||||
jQuery("#loading").hide();
|
||||
}
|
||||
}
|
||||
function setSnippets(array){
|
||||
if (array) {
|
||||
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
|
||||
jQuery.each( array, function( i, id ) {
|
||||
if (id in snippets) {
|
||||
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
|
||||
}
|
||||
if (id == snippet) {
|
||||
jQuery('#jform_snippet').val(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
}
|
1002
media/js/library.js
Normal file
1002
media/js/library.js
Normal file
File diff suppressed because it is too large
Load Diff
11
media/js/library_config.js
Normal file
11
media/js/library_config.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/library_files_folders_urls.js
Normal file
11
media/js/library_files_folders_urls.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
123
media/js/placeholder.js
Normal file
123
media/js/placeholder.js
Normal file
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
jQuery('#placedin').show();
|
||||
var placeholderName = jQuery('#jform_target').val();
|
||||
// check if this function name is taken
|
||||
checkPlaceholderName(placeholderName);
|
||||
});
|
||||
function setPlaceholderName(){
|
||||
// noting for now (we may add more functionality later)
|
||||
}
|
||||
|
||||
function checkPlaceholderName(placeholderName) {
|
||||
if (placeholderName.length > 2) {
|
||||
var ide = jQuery('#jform_id').val();
|
||||
if (ide == 0) {
|
||||
ide = -1;
|
||||
}
|
||||
checkPlaceholderName_server(placeholderName, ide).done(function(result) {
|
||||
if(result.name && result.message){
|
||||
// show notice that placeholderName is okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_target').val(result.name);
|
||||
// now start search for where the function is used
|
||||
placedin(result.name, ide);
|
||||
} else if(result.message){
|
||||
// show notice that placeholderName is not okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: 5000, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_target').val('');
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_PLACEHOLDER_ALREADY_TAKEN_PLEASE_TRY_AGAIN'), timeout: 5000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_target').val('');
|
||||
}
|
||||
// set custom code placeholder
|
||||
setPlaceholderName();
|
||||
});
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_PLACEHOLDER'), timeout: 5000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_target').val('');
|
||||
// set custom code placeholder
|
||||
setPlaceholderName();
|
||||
}
|
||||
}
|
||||
// check Placeholder
|
||||
function checkPlaceholderName_server(placeholderName, ide){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.checkPlaceholderName&raw=true&format=json";
|
||||
if(token.length > 0){
|
||||
var request = 'token='+token+'&placeholderName='+placeholderName+'&id='+ide;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'POST',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// check where this Function is used
|
||||
function placedin(placeholder, ide) {
|
||||
var found = false;
|
||||
jQuery('#before-placedin').hide();
|
||||
jQuery('#note-placedin-not').hide();
|
||||
jQuery('#note-placedin-found').hide();
|
||||
jQuery('#loading-placedin').show();
|
||||
var targets = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u']; // if you update this, also update (below 20) & [customcode-codeUsedInHtmlNote]!
|
||||
var targetNumber = 20;
|
||||
var run = 0;
|
||||
var placedinChecker = setInterval(function(){
|
||||
var target = targets[run];
|
||||
placedin_server(placeholder, ide, target).done(function(used) {
|
||||
if (used.in) {
|
||||
jQuery('#placedin-'+used.id).show();
|
||||
jQuery('#area-'+used.id).html(used.in);
|
||||
jQuery.UIkit.notify({message: used.in, timeout: 5000, status: 'success', pos: 'top-right'});
|
||||
found = true;
|
||||
} else {
|
||||
jQuery('#placedin-'+target).hide();
|
||||
}
|
||||
if (run == targetNumber) {
|
||||
jQuery('#loading-placedin').hide();
|
||||
if (found) {
|
||||
jQuery('#note-placedin-found').show();
|
||||
} else {
|
||||
jQuery('#note-placedin-not').show();
|
||||
}
|
||||
}
|
||||
});
|
||||
if (run == targetNumber) {
|
||||
clearInterval(placedinChecker);
|
||||
}
|
||||
run++;
|
||||
}, 800);
|
||||
}
|
||||
function placedin_server(placeholder, ide, target){
|
||||
var getUrl = "index.php?option=com_componentbuilder&task=ajax.placedin&format=json";
|
||||
if(token.length > 0){
|
||||
var request = token+'=1&placeholder='+placeholder+'&id='+ide+'&target='+target+'&raw=true&return_here='+return_here;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
591
media/js/server.js
Normal file
591
media/js/server.js
Normal file
@ -0,0 +1,591 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Some Global Values
|
||||
jform_vvvvwdyvyd_required = false;
|
||||
jform_vvvvwdyvye_required = false;
|
||||
jform_vvvvwdyvyf_required = false;
|
||||
jform_vvvvwdyvyg_required = false;
|
||||
jform_vvvvwdyvyh_required = false;
|
||||
jform_vvvvwdzvyi_required = false;
|
||||
jform_vvvvweavyj_required = false;
|
||||
jform_vvvvwecvyk_required = false;
|
||||
jform_vvvvweevyl_required = false;
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var protocol_vvvvwdy = jQuery("#jform_protocol").val();
|
||||
vvvvwdy(protocol_vvvvwdy);
|
||||
|
||||
var protocol_vvvvwdz = jQuery("#jform_protocol").val();
|
||||
vvvvwdz(protocol_vvvvwdz);
|
||||
|
||||
var protocol_vvvvwea = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvwea = jQuery("#jform_authentication").val();
|
||||
vvvvwea(protocol_vvvvwea,authentication_vvvvwea);
|
||||
|
||||
var protocol_vvvvwec = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvwec = jQuery("#jform_authentication").val();
|
||||
vvvvwec(protocol_vvvvwec,authentication_vvvvwec);
|
||||
|
||||
var protocol_vvvvwee = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvwee = jQuery("#jform_authentication").val();
|
||||
vvvvwee(protocol_vvvvwee,authentication_vvvvwee);
|
||||
|
||||
var protocol_vvvvweg = jQuery("#jform_protocol").val();
|
||||
var authentication_vvvvweg = jQuery("#jform_authentication").val();
|
||||
vvvvweg(protocol_vvvvweg,authentication_vvvvweg);
|
||||
});
|
||||
|
||||
// the vvvvwdy function
|
||||
function vvvvwdy(protocol_vvvvwdy)
|
||||
{
|
||||
if (isSet(protocol_vvvvwdy) && protocol_vvvvwdy.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdy = protocol_vvvvwdy;
|
||||
var protocol_vvvvwdy = [];
|
||||
protocol_vvvvwdy.push(temp_vvvvwdy);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwdy))
|
||||
{
|
||||
var protocol_vvvvwdy = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwdy.some(protocol_vvvvwdy_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol)
|
||||
{
|
||||
jQuery('#jform_authentication').closest('.control-group').show();
|
||||
// add required attribute to authentication field
|
||||
if (jform_vvvvwdyvyd_required)
|
||||
{
|
||||
updateFieldRequired('authentication',0);
|
||||
jQuery('#jform_authentication').prop('required','required');
|
||||
jQuery('#jform_authentication').attr('aria-required',true);
|
||||
jQuery('#jform_authentication').addClass('required');
|
||||
jform_vvvvwdyvyd_required = false;
|
||||
}
|
||||
jQuery('#jform_host').closest('.control-group').show();
|
||||
// add required attribute to host field
|
||||
if (jform_vvvvwdyvye_required)
|
||||
{
|
||||
updateFieldRequired('host',0);
|
||||
jQuery('#jform_host').prop('required','required');
|
||||
jQuery('#jform_host').attr('aria-required',true);
|
||||
jQuery('#jform_host').addClass('required');
|
||||
jform_vvvvwdyvye_required = false;
|
||||
}
|
||||
jQuery('#jform_port').closest('.control-group').show();
|
||||
// add required attribute to port field
|
||||
if (jform_vvvvwdyvyf_required)
|
||||
{
|
||||
updateFieldRequired('port',0);
|
||||
jQuery('#jform_port').prop('required','required');
|
||||
jQuery('#jform_port').attr('aria-required',true);
|
||||
jQuery('#jform_port').addClass('required');
|
||||
jform_vvvvwdyvyf_required = false;
|
||||
}
|
||||
jQuery('#jform_path').closest('.control-group').show();
|
||||
// add required attribute to path field
|
||||
if (jform_vvvvwdyvyg_required)
|
||||
{
|
||||
updateFieldRequired('path',0);
|
||||
jQuery('#jform_path').prop('required','required');
|
||||
jQuery('#jform_path').attr('aria-required',true);
|
||||
jQuery('#jform_path').addClass('required');
|
||||
jform_vvvvwdyvyg_required = false;
|
||||
}
|
||||
jQuery('.note_ssh_security').closest('.control-group').show();
|
||||
jQuery('#jform_username').closest('.control-group').show();
|
||||
// add required attribute to username field
|
||||
if (jform_vvvvwdyvyh_required)
|
||||
{
|
||||
updateFieldRequired('username',0);
|
||||
jQuery('#jform_username').prop('required','required');
|
||||
jQuery('#jform_username').attr('aria-required',true);
|
||||
jQuery('#jform_username').addClass('required');
|
||||
jform_vvvvwdyvyh_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_authentication').closest('.control-group').hide();
|
||||
// remove required attribute from authentication field
|
||||
if (!jform_vvvvwdyvyd_required)
|
||||
{
|
||||
updateFieldRequired('authentication',1);
|
||||
jQuery('#jform_authentication').removeAttr('required');
|
||||
jQuery('#jform_authentication').removeAttr('aria-required');
|
||||
jQuery('#jform_authentication').removeClass('required');
|
||||
jform_vvvvwdyvyd_required = true;
|
||||
}
|
||||
jQuery('#jform_host').closest('.control-group').hide();
|
||||
// remove required attribute from host field
|
||||
if (!jform_vvvvwdyvye_required)
|
||||
{
|
||||
updateFieldRequired('host',1);
|
||||
jQuery('#jform_host').removeAttr('required');
|
||||
jQuery('#jform_host').removeAttr('aria-required');
|
||||
jQuery('#jform_host').removeClass('required');
|
||||
jform_vvvvwdyvye_required = true;
|
||||
}
|
||||
jQuery('#jform_port').closest('.control-group').hide();
|
||||
// remove required attribute from port field
|
||||
if (!jform_vvvvwdyvyf_required)
|
||||
{
|
||||
updateFieldRequired('port',1);
|
||||
jQuery('#jform_port').removeAttr('required');
|
||||
jQuery('#jform_port').removeAttr('aria-required');
|
||||
jQuery('#jform_port').removeClass('required');
|
||||
jform_vvvvwdyvyf_required = true;
|
||||
}
|
||||
jQuery('#jform_path').closest('.control-group').hide();
|
||||
// remove required attribute from path field
|
||||
if (!jform_vvvvwdyvyg_required)
|
||||
{
|
||||
updateFieldRequired('path',1);
|
||||
jQuery('#jform_path').removeAttr('required');
|
||||
jQuery('#jform_path').removeAttr('aria-required');
|
||||
jQuery('#jform_path').removeClass('required');
|
||||
jform_vvvvwdyvyg_required = true;
|
||||
}
|
||||
jQuery('.note_ssh_security').closest('.control-group').hide();
|
||||
jQuery('#jform_username').closest('.control-group').hide();
|
||||
// remove required attribute from username field
|
||||
if (!jform_vvvvwdyvyh_required)
|
||||
{
|
||||
updateFieldRequired('username',1);
|
||||
jQuery('#jform_username').removeAttr('required');
|
||||
jQuery('#jform_username').removeAttr('aria-required');
|
||||
jQuery('#jform_username').removeClass('required');
|
||||
jform_vvvvwdyvyh_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdy Some function
|
||||
function protocol_vvvvwdy_SomeFunc(protocol_vvvvwdy)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwdy == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwdz function
|
||||
function vvvvwdz(protocol_vvvvwdz)
|
||||
{
|
||||
if (isSet(protocol_vvvvwdz) && protocol_vvvvwdz.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwdz = protocol_vvvvwdz;
|
||||
var protocol_vvvvwdz = [];
|
||||
protocol_vvvvwdz.push(temp_vvvvwdz);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwdz))
|
||||
{
|
||||
var protocol_vvvvwdz = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwdz.some(protocol_vvvvwdz_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol)
|
||||
{
|
||||
jQuery('.note_ftp_signature').closest('.control-group').show();
|
||||
jQuery('#jform_signature').closest('.control-group').show();
|
||||
// add required attribute to signature field
|
||||
if (jform_vvvvwdzvyi_required)
|
||||
{
|
||||
updateFieldRequired('signature',0);
|
||||
jQuery('#jform_signature').prop('required','required');
|
||||
jQuery('#jform_signature').attr('aria-required',true);
|
||||
jQuery('#jform_signature').addClass('required');
|
||||
jform_vvvvwdzvyi_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_ftp_signature').closest('.control-group').hide();
|
||||
jQuery('#jform_signature').closest('.control-group').hide();
|
||||
// remove required attribute from signature field
|
||||
if (!jform_vvvvwdzvyi_required)
|
||||
{
|
||||
updateFieldRequired('signature',1);
|
||||
jQuery('#jform_signature').removeAttr('required');
|
||||
jQuery('#jform_signature').removeAttr('aria-required');
|
||||
jQuery('#jform_signature').removeClass('required');
|
||||
jform_vvvvwdzvyi_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwdz Some function
|
||||
function protocol_vvvvwdz_SomeFunc(protocol_vvvvwdz)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwdz == 1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwea function
|
||||
function vvvvwea(protocol_vvvvwea,authentication_vvvvwea)
|
||||
{
|
||||
if (isSet(protocol_vvvvwea) && protocol_vvvvwea.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwea = protocol_vvvvwea;
|
||||
var protocol_vvvvwea = [];
|
||||
protocol_vvvvwea.push(temp_vvvvwea);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwea))
|
||||
{
|
||||
var protocol_vvvvwea = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwea.some(protocol_vvvvwea_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvwea) && authentication_vvvvwea.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwea = authentication_vvvvwea;
|
||||
var authentication_vvvvwea = [];
|
||||
authentication_vvvvwea.push(temp_vvvvwea);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvwea))
|
||||
{
|
||||
var authentication_vvvvwea = [];
|
||||
}
|
||||
var authentication = authentication_vvvvwea.some(authentication_vvvvwea_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_password').closest('.control-group').show();
|
||||
// add required attribute to password field
|
||||
if (jform_vvvvweavyj_required)
|
||||
{
|
||||
updateFieldRequired('password',0);
|
||||
jQuery('#jform_password').prop('required','required');
|
||||
jQuery('#jform_password').attr('aria-required',true);
|
||||
jQuery('#jform_password').addClass('required');
|
||||
jform_vvvvweavyj_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_password').closest('.control-group').hide();
|
||||
// remove required attribute from password field
|
||||
if (!jform_vvvvweavyj_required)
|
||||
{
|
||||
updateFieldRequired('password',1);
|
||||
jQuery('#jform_password').removeAttr('required');
|
||||
jQuery('#jform_password').removeAttr('aria-required');
|
||||
jQuery('#jform_password').removeClass('required');
|
||||
jform_vvvvweavyj_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwea Some function
|
||||
function protocol_vvvvwea_SomeFunc(protocol_vvvvwea)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwea == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwea Some function
|
||||
function authentication_vvvvwea_SomeFunc(authentication_vvvvwea)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvwea == 1 || authentication_vvvvwea == 3 || authentication_vvvvwea == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwec function
|
||||
function vvvvwec(protocol_vvvvwec,authentication_vvvvwec)
|
||||
{
|
||||
if (isSet(protocol_vvvvwec) && protocol_vvvvwec.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwec = protocol_vvvvwec;
|
||||
var protocol_vvvvwec = [];
|
||||
protocol_vvvvwec.push(temp_vvvvwec);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwec))
|
||||
{
|
||||
var protocol_vvvvwec = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwec.some(protocol_vvvvwec_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvwec) && authentication_vvvvwec.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwec = authentication_vvvvwec;
|
||||
var authentication_vvvvwec = [];
|
||||
authentication_vvvvwec.push(temp_vvvvwec);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvwec))
|
||||
{
|
||||
var authentication_vvvvwec = [];
|
||||
}
|
||||
var authentication = authentication_vvvvwec.some(authentication_vvvvwec_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').show();
|
||||
// add required attribute to private field
|
||||
if (jform_vvvvwecvyk_required)
|
||||
{
|
||||
updateFieldRequired('private',0);
|
||||
jQuery('#jform_private').prop('required','required');
|
||||
jQuery('#jform_private').attr('aria-required',true);
|
||||
jQuery('#jform_private').addClass('required');
|
||||
jform_vvvvwecvyk_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_private').closest('.control-group').hide();
|
||||
// remove required attribute from private field
|
||||
if (!jform_vvvvwecvyk_required)
|
||||
{
|
||||
updateFieldRequired('private',1);
|
||||
jQuery('#jform_private').removeAttr('required');
|
||||
jQuery('#jform_private').removeAttr('aria-required');
|
||||
jQuery('#jform_private').removeClass('required');
|
||||
jform_vvvvwecvyk_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwec Some function
|
||||
function protocol_vvvvwec_SomeFunc(protocol_vvvvwec)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwec == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwec Some function
|
||||
function authentication_vvvvwec_SomeFunc(authentication_vvvvwec)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvwec == 2 || authentication_vvvvwec == 3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwee function
|
||||
function vvvvwee(protocol_vvvvwee,authentication_vvvvwee)
|
||||
{
|
||||
if (isSet(protocol_vvvvwee) && protocol_vvvvwee.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwee = protocol_vvvvwee;
|
||||
var protocol_vvvvwee = [];
|
||||
protocol_vvvvwee.push(temp_vvvvwee);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvwee))
|
||||
{
|
||||
var protocol_vvvvwee = [];
|
||||
}
|
||||
var protocol = protocol_vvvvwee.some(protocol_vvvvwee_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvwee) && authentication_vvvvwee.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwee = authentication_vvvvwee;
|
||||
var authentication_vvvvwee = [];
|
||||
authentication_vvvvwee.push(temp_vvvvwee);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvwee))
|
||||
{
|
||||
var authentication_vvvvwee = [];
|
||||
}
|
||||
var authentication = authentication_vvvvwee.some(authentication_vvvvwee_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_private_key').closest('.control-group').show();
|
||||
// add required attribute to private_key field
|
||||
if (jform_vvvvweevyl_required)
|
||||
{
|
||||
updateFieldRequired('private_key',0);
|
||||
jQuery('#jform_private_key').prop('required','required');
|
||||
jQuery('#jform_private_key').attr('aria-required',true);
|
||||
jQuery('#jform_private_key').addClass('required');
|
||||
jform_vvvvweevyl_required = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_private_key').closest('.control-group').hide();
|
||||
// remove required attribute from private_key field
|
||||
if (!jform_vvvvweevyl_required)
|
||||
{
|
||||
updateFieldRequired('private_key',1);
|
||||
jQuery('#jform_private_key').removeAttr('required');
|
||||
jQuery('#jform_private_key').removeAttr('aria-required');
|
||||
jQuery('#jform_private_key').removeClass('required');
|
||||
jform_vvvvweevyl_required = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwee Some function
|
||||
function protocol_vvvvwee_SomeFunc(protocol_vvvvwee)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvwee == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvwee Some function
|
||||
function authentication_vvvvwee_SomeFunc(authentication_vvvvwee)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvwee == 4 || authentication_vvvvwee == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvweg function
|
||||
function vvvvweg(protocol_vvvvweg,authentication_vvvvweg)
|
||||
{
|
||||
if (isSet(protocol_vvvvweg) && protocol_vvvvweg.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvweg = protocol_vvvvweg;
|
||||
var protocol_vvvvweg = [];
|
||||
protocol_vvvvweg.push(temp_vvvvweg);
|
||||
}
|
||||
else if (!isSet(protocol_vvvvweg))
|
||||
{
|
||||
var protocol_vvvvweg = [];
|
||||
}
|
||||
var protocol = protocol_vvvvweg.some(protocol_vvvvweg_SomeFunc);
|
||||
|
||||
if (isSet(authentication_vvvvweg) && authentication_vvvvweg.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvweg = authentication_vvvvweg;
|
||||
var authentication_vvvvweg = [];
|
||||
authentication_vvvvweg.push(temp_vvvvweg);
|
||||
}
|
||||
else if (!isSet(authentication_vvvvweg))
|
||||
{
|
||||
var authentication_vvvvweg = [];
|
||||
}
|
||||
var authentication = authentication_vvvvweg.some(authentication_vvvvweg_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (protocol && authentication)
|
||||
{
|
||||
jQuery('#jform_secret').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_secret').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvweg Some function
|
||||
function protocol_vvvvweg_SomeFunc(protocol_vvvvweg)
|
||||
{
|
||||
// set the function logic
|
||||
if (protocol_vvvvweg == 2)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the vvvvweg Some function
|
||||
function authentication_vvvvweg_SomeFunc(authentication_vvvvweg)
|
||||
{
|
||||
// set the function logic
|
||||
if (authentication_vvvvweg == 2 || authentication_vvvvweg == 3 || authentication_vvvvweg == 4 || authentication_vvvvweg == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// update fields required
|
||||
function updateFieldRequired(name, status) {
|
||||
// check if not_required exist
|
||||
if (jQuery('#jform_not_required').length > 0) {
|
||||
var not_required = jQuery('#jform_not_required').val().split(",");
|
||||
|
||||
if(status == 1)
|
||||
{
|
||||
not_required.push(name);
|
||||
}
|
||||
else
|
||||
{
|
||||
not_required = removeFieldFromNotRequired(not_required, name);
|
||||
}
|
||||
|
||||
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
||||
}
|
||||
}
|
||||
|
||||
// remove field from not_required
|
||||
function removeFieldFromNotRequired(array, what) {
|
||||
return array.filter(function(element){
|
||||
return element !== what;
|
||||
});
|
||||
}
|
||||
|
||||
// fix not required array
|
||||
function fixNotRequiredArray(array) {
|
||||
var seen = {};
|
||||
return removeEmptyFromNotRequiredArray(array).filter(function(item) {
|
||||
return seen.hasOwnProperty(item) ? false : (seen[item] = true);
|
||||
});
|
||||
}
|
||||
|
||||
// remove empty from not_required array
|
||||
function removeEmptyFromNotRequiredArray(array) {
|
||||
return array.filter(function (el) {
|
||||
// remove ( 一_一) as well - lol
|
||||
return (el.length > 0 && '一_一' !== el);
|
||||
});
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
469
media/js/site_view.js
Normal file
469
media/js/site_view.js
Normal file
@ -0,0 +1,469 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var add_php_view_vvvvwan = jQuery("#jform_add_php_view input[type='radio']:checked").val();
|
||||
vvvvwan(add_php_view_vvvvwan);
|
||||
|
||||
var add_php_jview_display_vvvvwao = jQuery("#jform_add_php_jview_display input[type='radio']:checked").val();
|
||||
vvvvwao(add_php_jview_display_vvvvwao);
|
||||
|
||||
var add_php_jview_vvvvwap = jQuery("#jform_add_php_jview input[type='radio']:checked").val();
|
||||
vvvvwap(add_php_jview_vvvvwap);
|
||||
|
||||
var add_php_document_vvvvwaq = jQuery("#jform_add_php_document input[type='radio']:checked").val();
|
||||
vvvvwaq(add_php_document_vvvvwaq);
|
||||
|
||||
var add_css_document_vvvvwar = jQuery("#jform_add_css_document input[type='radio']:checked").val();
|
||||
vvvvwar(add_css_document_vvvvwar);
|
||||
|
||||
var add_javascript_file_vvvvwas = jQuery("#jform_add_javascript_file input[type='radio']:checked").val();
|
||||
vvvvwas(add_javascript_file_vvvvwas);
|
||||
|
||||
var add_js_document_vvvvwat = jQuery("#jform_add_js_document input[type='radio']:checked").val();
|
||||
vvvvwat(add_js_document_vvvvwat);
|
||||
|
||||
var add_css_vvvvwau = jQuery("#jform_add_css input[type='radio']:checked").val();
|
||||
vvvvwau(add_css_vvvvwau);
|
||||
|
||||
var add_php_ajax_vvvvwav = jQuery("#jform_add_php_ajax input[type='radio']:checked").val();
|
||||
vvvvwav(add_php_ajax_vvvvwav);
|
||||
|
||||
var add_custom_button_vvvvwaw = jQuery("#jform_add_custom_button input[type='radio']:checked").val();
|
||||
vvvvwaw(add_custom_button_vvvvwaw);
|
||||
|
||||
var button_position_vvvvwax = jQuery("#jform_button_position").val();
|
||||
vvvvwax(button_position_vvvvwax);
|
||||
});
|
||||
|
||||
// the vvvvwan function
|
||||
function vvvvwan(add_php_view_vvvvwan)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_view_vvvvwan == 1)
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwao function
|
||||
function vvvvwao(add_php_jview_display_vvvvwao)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_jview_display_vvvvwao == 1)
|
||||
{
|
||||
jQuery('#jform_php_jview_display-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_jview_display-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwap function
|
||||
function vvvvwap(add_php_jview_vvvvwap)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_jview_vvvvwap == 1)
|
||||
{
|
||||
jQuery('#jform_php_jview-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_jview-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaq function
|
||||
function vvvvwaq(add_php_document_vvvvwaq)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_document_vvvvwaq == 1)
|
||||
{
|
||||
jQuery('#jform_php_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwar function
|
||||
function vvvvwar(add_css_document_vvvvwar)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_document_vvvvwar == 1)
|
||||
{
|
||||
jQuery('#jform_css_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwas function
|
||||
function vvvvwas(add_javascript_file_vvvvwas)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_javascript_file_vvvvwas == 1)
|
||||
{
|
||||
jQuery('#jform_javascript_file-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_javascript_file-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwat function
|
||||
function vvvvwat(add_js_document_vvvvwat)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_js_document_vvvvwat == 1)
|
||||
{
|
||||
jQuery('#jform_js_document-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_js_document-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwau function
|
||||
function vvvvwau(add_css_vvvvwau)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_css_vvvvwau == 1)
|
||||
{
|
||||
jQuery('#jform_css-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_css-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwav function
|
||||
function vvvvwav(add_php_ajax_vvvvwav)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_ajax_vvvvwav == 1)
|
||||
{
|
||||
jQuery('#jform_ajax_input-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_ajax_input-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_ajaxmethod-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwaw function
|
||||
function vvvvwaw(add_custom_button_vvvvwaw)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_custom_button_vvvvwaw == 1)
|
||||
{
|
||||
jQuery('#jform_custom_button-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_controller-lbl').closest('.control-group').show();
|
||||
jQuery('#jform_php_model-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_custom_button-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_controller-lbl').closest('.control-group').hide();
|
||||
jQuery('#jform_php_model-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwax function
|
||||
function vvvvwax(button_position_vvvvwax)
|
||||
{
|
||||
if (isSet(button_position_vvvvwax) && button_position_vvvvwax.constructor !== Array)
|
||||
{
|
||||
var temp_vvvvwax = button_position_vvvvwax;
|
||||
var button_position_vvvvwax = [];
|
||||
button_position_vvvvwax.push(temp_vvvvwax);
|
||||
}
|
||||
else if (!isSet(button_position_vvvvwax))
|
||||
{
|
||||
var button_position_vvvvwax = [];
|
||||
}
|
||||
var button_position = button_position_vvvvwax.some(button_position_vvvvwax_SomeFunc);
|
||||
|
||||
|
||||
// set this function logic
|
||||
if (button_position)
|
||||
{
|
||||
jQuery('.note_custom_toolbar_placeholder').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('.note_custom_toolbar_placeholder').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the vvvvwax Some function
|
||||
function button_position_vvvvwax_SomeFunc(button_position_vvvvwax)
|
||||
{
|
||||
// set the function logic
|
||||
if (button_position_vvvvwax == 5)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// get the linked details
|
||||
getLinked();
|
||||
// check and load all the custom code edit buttons
|
||||
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 getLinked(){
|
||||
getCodeFrom_server(1, 'type', 'type', 'getLinked').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#display_linked_to').html(result);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getSnippetDetails(id){
|
||||
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
jQuery("#snippet").focus(function() {
|
||||
var jQuerythis = jQuery(this);
|
||||
jQuerythis.select();
|
||||
|
||||
// Work around Chrome's little problem
|
||||
jQuerythis.mouseup(function() {
|
||||
// Prevent further mouseup intervention
|
||||
jQuerythis.unbind("mouseup");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
if(result.usage){
|
||||
var usage = '<div id="snippet-usage"><p>'+result.usage+'</p></div>';
|
||||
jQuery('#snippet-usage').remove();
|
||||
jQuery('.snippet-usage').append(usage);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getDynamicValues_server(dynamicId){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json");
|
||||
if(token.length > 0 && dynamicId > 0){
|
||||
var request = token+'=1&view=site_view&id='+dynamicId;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
|
||||
function getDynamicValues(id){
|
||||
getDynamicValues_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#dynamic_values').remove();
|
||||
jQuery('.dynamic_values').append('<div id="dynamic_values">'+result+'</div>');
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getLayoutDetails_server(id){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&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 getLayoutDetails(id){
|
||||
getLayoutDetails_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getTemplateDetails(id){
|
||||
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// set snippets that are on the page
|
||||
var snippetIds = [];
|
||||
var snippets = {};
|
||||
var snippet = 0;
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
jQuery("#jform_snippet option").each(function()
|
||||
{
|
||||
var key = jQuery(this).val();
|
||||
var text = jQuery(this).text();
|
||||
snippets[key] = text;
|
||||
snippetIds.push(key);
|
||||
});
|
||||
snippet = jQuery("#jform_snippet").val();
|
||||
getSnippets();
|
||||
});
|
||||
|
||||
function getSnippets(){
|
||||
jQuery("#loading").show();
|
||||
// clear the selection
|
||||
jQuery('#jform_snippet').find('option').remove().end();
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
// get libraries value if set
|
||||
var libraries = jQuery("#jform_libraries").val();
|
||||
if (libraries) {
|
||||
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||
setSnippets(result);
|
||||
jQuery("#loading").hide();
|
||||
if (typeof snippetButton !== 'undefined') {
|
||||
// ensure button is correct
|
||||
var snippet = jQuery('#jform_snippet').val();
|
||||
snippetButton(snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// load all snippets in none is selected
|
||||
setSnippets(snippetIds);
|
||||
jQuery("#loading").hide();
|
||||
}
|
||||
}
|
||||
function setSnippets(array){
|
||||
if (array) {
|
||||
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
|
||||
jQuery.each( array, function( i, id ) {
|
||||
if (id in snippets) {
|
||||
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
|
||||
}
|
||||
if (id == snippet) {
|
||||
jQuery('#jform_snippet').val(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
}
|
||||
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
11
media/js/snippet.js
Normal file
11
media/js/snippet.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
11
media/js/snippet_type.js
Normal file
11
media/js/snippet_type.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
259
media/js/template.js
Normal file
259
media/js/template.js
Normal file
@ -0,0 +1,259 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
// Initial Script
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
var add_php_view_vvvvway = jQuery("#jform_add_php_view input[type='radio']:checked").val();
|
||||
vvvvway(add_php_view_vvvvway);
|
||||
});
|
||||
|
||||
// the vvvvway function
|
||||
function vvvvway(add_php_view_vvvvway)
|
||||
{
|
||||
// set the function logic
|
||||
if (add_php_view_vvvvway == 1)
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').show();
|
||||
}
|
||||
else
|
||||
{
|
||||
jQuery('#jform_php_view-lbl').closest('.control-group').hide();
|
||||
}
|
||||
}
|
||||
|
||||
// the isSet function
|
||||
function isSet(val)
|
||||
{
|
||||
if ((val != undefined) && (val != null) && 0 !== val.length){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
// check and load all the custom code edit buttons
|
||||
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){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
||||
if(token.length > 0 && id > 0){
|
||||
var request = token+'=1&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>Add/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(id){
|
||||
getCodeFrom_server(id, '_type', '_type', 'snippetDetails').done(function(result) {
|
||||
if(result.snippet){
|
||||
var description = '';
|
||||
if (result.description.length > 0) {
|
||||
description = '<p>'+result.description+'</p>';
|
||||
}
|
||||
var library = '';
|
||||
if (result.library.length > 0) {
|
||||
library = ' <b>('+result.library+')</b>';
|
||||
}
|
||||
var code = '<div id="snippet-code"><b>'+result.name+' ('+result.type+')</b> <a href="'+result.url+'" target="_blank" >see more details'+library+'</a><br /><em>'+result.heading+'</em><br /><textarea id="snippet" class="span12" rows="11">'+result.snippet+'</textarea></div>';
|
||||
jQuery('#snippet-code').remove();
|
||||
jQuery('.snippet-code').append(code);
|
||||
// make sure the code block is active
|
||||
jQuery("#snippet").focus(function() {
|
||||
var jQuerythis = jQuery(this);
|
||||
jQuerythis.select();
|
||||
|
||||
// Work around Chrome's little problem
|
||||
jQuerythis.mouseup(function() {
|
||||
// Prevent further mouseup intervention
|
||||
jQuerythis.unbind("mouseup");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
if(result.usage){
|
||||
var usage = '<div id="snippet-usage"><p>'+result.usage+'</p></div>';
|
||||
jQuery('#snippet-usage').remove();
|
||||
jQuery('.snippet-usage').append(usage);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getDynamicValues_server(dynamicId){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getDynamicValues&format=json");
|
||||
if(token.length > 0 && dynamicId > 0){
|
||||
var request = token+'=1&view=template&id='+dynamicId;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'jsonp',
|
||||
data: request,
|
||||
jsonp: 'callback'
|
||||
});
|
||||
}
|
||||
|
||||
function getDynamicValues(id){
|
||||
getDynamicValues_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#dynamic_values').remove();
|
||||
jQuery('.dynamic_values').append('<div id="dynamic_values">'+result+'</div>');
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getLayoutDetails_server(id){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getLayoutDetails&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 getLayoutDetails(id){
|
||||
getLayoutDetails_server(id).done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getTemplateDetails(id){
|
||||
getCodeFrom_server(id, 'type', 'type', 'templateDetails').done(function(result) {
|
||||
if(result){
|
||||
jQuery('#details').append(result);
|
||||
// make sure the code bocks are active
|
||||
jQuery("code").click(function() {
|
||||
jQuery(this).selText().addClass("selected");
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// set snippets that are on the page
|
||||
var snippetIds = [];
|
||||
var snippets = {};
|
||||
var snippet = 0;
|
||||
jQuery(document).ready(function($)
|
||||
{
|
||||
jQuery("#jform_snippet option").each(function()
|
||||
{
|
||||
var key = jQuery(this).val();
|
||||
var text = jQuery(this).text();
|
||||
snippets[key] = text;
|
||||
snippetIds.push(key);
|
||||
});
|
||||
snippet = jQuery("#jform_snippet").val();
|
||||
getSnippets();
|
||||
});
|
||||
|
||||
function getSnippets(){
|
||||
jQuery("#loading").show();
|
||||
// clear the selection
|
||||
jQuery('#jform_snippet').find('option').remove().end();
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
// get libraries value if set
|
||||
var libraries = jQuery("#jform_libraries").val();
|
||||
if (libraries) {
|
||||
getCodeFrom_server(1, JSON.stringify(libraries), 'libraries', 'getSnippets').done(function(result) {
|
||||
setSnippets(result);
|
||||
jQuery("#loading").hide();
|
||||
if (typeof snippetButton !== 'undefined') {
|
||||
// ensure button is correct
|
||||
var snippet = jQuery('#jform_snippet').val();
|
||||
snippetButton(snippet);
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// load all snippets in none is selected
|
||||
setSnippets(snippetIds);
|
||||
jQuery("#loading").hide();
|
||||
}
|
||||
}
|
||||
function setSnippets(array){
|
||||
if (array) {
|
||||
jQuery('#jform_snippet').append('<option value="">'+select_a_snippet+'</option>');
|
||||
jQuery.each( array, function( i, id ) {
|
||||
if (id in snippets) {
|
||||
jQuery('#jform_snippet').append('<option value="'+id+'">'+snippets[id]+'</option>');
|
||||
}
|
||||
if (id == snippet) {
|
||||
jQuery('#jform_snippet').val(id);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
jQuery('#jform_snippet').append('<option value="">'+create_a_snippet+'</option>');
|
||||
}
|
||||
jQuery('#jform_snippet').trigger('liszt:updated');
|
||||
}
|
137
media/js/validation_rule.js
Normal file
137
media/js/validation_rule.js
Normal file
@ -0,0 +1,137 @@
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 30th April, 2015
|
||||
* @author Llewellyn van der Merwe <http://www.joomlacomponentbuilder.com>
|
||||
* @github Joomla Component Builder <https://github.com/vdm-io/Joomla-Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
jQuery(document).ready(function()
|
||||
{
|
||||
// get the rule name
|
||||
var ruleName = jQuery('#jform_name').val();
|
||||
// check if this rule name is taken
|
||||
checkRuleName(ruleName);
|
||||
|
||||
// get type value
|
||||
var rulefilename = jQuery("#jform_inherit option:selected").val();
|
||||
if(jQuery('#jform_php').length == 0) {
|
||||
getExistingValidationRuleCode(rulefilename);
|
||||
}
|
||||
|
||||
// load the used in div
|
||||
// jQuery('#usedin').show();
|
||||
|
||||
// check and load all the customcode edit buttons
|
||||
setTimeout(getEditCustomCodeButtons, 300);
|
||||
});
|
||||
|
||||
function getExistingValidationRuleCode_server(rulefilename){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getExistingValidationRuleCode&format=json&raw=true");
|
||||
if(token.length > 0 && rulefilename.length > 0){
|
||||
var request = token+'=1&name='+rulefilename;
|
||||
}
|
||||
return jQuery.ajax({
|
||||
type: 'GET',
|
||||
url: getUrl,
|
||||
dataType: 'json',
|
||||
data: request,
|
||||
jsonp: false
|
||||
});
|
||||
}
|
||||
|
||||
function getExistingValidationRuleCode(rulefilename,setValue){
|
||||
getExistingValidationRuleCode_server(rulefilename).done(function(result) {
|
||||
if(result.values){
|
||||
jQuery('textarea#jform_php').val(result.values);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function checkRuleName(ruleName) {
|
||||
if (ruleName.length > 2) {
|
||||
var ide = jQuery('#jform_id').val();
|
||||
if (ide == 0) {
|
||||
ide = -1;
|
||||
}
|
||||
checkRuleName_server(ruleName, ide).done(function(result) {
|
||||
if(result.name && result.message){
|
||||
// show notice that functioName is okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: result.timeout, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_name').val(result.name);
|
||||
// now start search for where the function is used
|
||||
usedin(result.name, ide);
|
||||
} else if(result.message){
|
||||
// show notice that ruleName is not okay
|
||||
jQuery.UIkit.notify({message: result.message, timeout: result.timeout, status: result.status, pos: 'top-right'});
|
||||
jQuery('#jform_name').val('');
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_VALIDATION_RULE_NAME_ALREADY_TAKEN_PLEASE_TRY_AGAIN'), timeout: 7000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_name').val('');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// set an error that message was not send
|
||||
jQuery.UIkit.notify({message: Joomla.JText._('COM_COMPONENTBUILDER_YOU_MUST_ADD_AN_UNIQUE_VALIDATION_RULE_NAME'), timeout: 5000, status: 'danger', pos: 'top-right'});
|
||||
jQuery('#jform_name').val('');
|
||||
}
|
||||
}
|
||||
// check Function Name
|
||||
function checkRuleName_server(ruleName, ide){
|
||||
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.checkRuleName&format=json&raw=true");
|
||||
if(token.length > 0){
|
||||
var request = token+'=1&name='+ruleName+'&id='+ide;
|
||||
}
|
||||
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){
|
||||
var request = token+'=1&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>Add/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;
|
||||
}
|
Reference in New Issue
Block a user