2019-07-15 20:00:46 +00:00
|
|
|
/**
|
|
|
|
* @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 - 2019 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Some Global Values
|
|
|
|
jform_vvvvwanvxd_required = false;
|
|
|
|
|
|
|
|
// Initial Script
|
|
|
|
jQuery(document).ready(function()
|
|
|
|
{
|
|
|
|
var extension_type_vvvvwan = jQuery("#jform_extension_type").val();
|
|
|
|
vvvvwan(extension_type_vvvvwan);
|
|
|
|
});
|
|
|
|
|
|
|
|
// the vvvvwan function
|
|
|
|
function vvvvwan(extension_type_vvvvwan)
|
|
|
|
{
|
|
|
|
if (isSet(extension_type_vvvvwan) && extension_type_vvvvwan.constructor !== Array)
|
|
|
|
{
|
|
|
|
var temp_vvvvwan = extension_type_vvvvwan;
|
|
|
|
var extension_type_vvvvwan = [];
|
|
|
|
extension_type_vvvvwan.push(temp_vvvvwan);
|
|
|
|
}
|
|
|
|
else if (!isSet(extension_type_vvvvwan))
|
|
|
|
{
|
|
|
|
var extension_type_vvvvwan = [];
|
|
|
|
}
|
|
|
|
var extension_type = extension_type_vvvvwan.some(extension_type_vvvvwan_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_vvvvwanvxd_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_vvvvwanvxd_required = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_joomla_plugin_group').closest('.control-group').hide();
|
|
|
|
// remove required attribute from joomla_plugin_group field
|
|
|
|
if (!jform_vvvvwanvxd_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_vvvvwanvxd_required = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// the vvvvwan Some function
|
|
|
|
function extension_type_vvvvwan_SomeFunc(extension_type_vvvvwan)
|
|
|
|
{
|
|
|
|
// set the function logic
|
|
|
|
if (extension_type_vvvvwan == 'plugins' || extension_type_vvvvwan == 'plugin')
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// update required fields
|
|
|
|
function updateFieldRequired(name,status)
|
|
|
|
{
|
|
|
|
var not_required = jQuery('#jform_not_required').val();
|
|
|
|
|
|
|
|
if(status == 1)
|
|
|
|
{
|
|
|
|
if (isSet(not_required) && not_required != 0)
|
|
|
|
{
|
|
|
|
not_required = not_required+','+name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
not_required = ','+name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isSet(not_required) && not_required != 0)
|
|
|
|
{
|
|
|
|
not_required = not_required.replace(','+name,'');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
jQuery('#jform_not_required').val(not_required);
|
|
|
|
}
|
|
|
|
|
|
|
|
// the isSet function
|
|
|
|
function isSet(val)
|
|
|
|
{
|
|
|
|
if ((val != undefined) && (val != null) && 0 !== val.length){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2019-07-16 23:15:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2019-07-15 20:00:46 +00:00
|
|
|
}
|