2021-03-05 03:08:47 +00:00
|
|
|
/**
|
|
|
|
* @package Joomla.Component.Builder
|
|
|
|
*
|
|
|
|
* @created 30th April, 2015
|
2022-07-09 15:45:08 +00:00
|
|
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
|
|
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
2021-03-05 03:08:47 +00:00
|
|
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
|
|
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
|
|
|
*/
|
|
|
|
|
2016-01-30 20:28:43 +00:00
|
|
|
// Some Global Values
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwcvvv_required = false;
|
|
|
|
jform_vvvvvwdvvw_required = false;
|
|
|
|
jform_vvvvvwgvvx_required = false;
|
|
|
|
jform_vvvvvwgvvy_required = false;
|
|
|
|
jform_vvvvvwgvvz_required = false;
|
2016-01-30 20:28:43 +00:00
|
|
|
|
|
|
|
// Initial Script
|
2024-03-09 19:47:28 +00:00
|
|
|
document.addEventListener('DOMContentLoaded', function()
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2024-04-21 23:07:22 +00:00
|
|
|
var emptycontributors_vvvvvvv = jQuery("#jform_emptycontributors input[type='radio']:checked").val();
|
|
|
|
vvvvvvv(emptycontributors_vvvvvvv);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var update_server_target_vvvvvvw = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
|
|
|
var add_update_server_vvvvvvw = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
|
|
|
vvvvvvw(update_server_target_vvvvvvw,add_update_server_vvvvvvw);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var add_update_server_vvvvvvx = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
|
|
|
var update_server_target_vvvvvvx = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
|
|
|
vvvvvvx(add_update_server_vvvvvvx,update_server_target_vvvvvvx);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-21 23:07:22 +00:00
|
|
|
var update_server_target_vvvvvvy = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
|
|
|
var add_update_server_vvvvvvy = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
|
|
|
vvvvvvy(update_server_target_vvvvvvy,add_update_server_vvvvvvy);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-21 23:07:22 +00:00
|
|
|
var update_server_target_vvvvvwa = jQuery("#jform_update_server_target input[type='radio']:checked").val();
|
|
|
|
var add_update_server_vvvvvwa = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
|
|
|
vvvvvwa(update_server_target_vvvvvwa,add_update_server_vvvvvwa);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-21 23:07:22 +00:00
|
|
|
var add_update_server_vvvvvwc = jQuery("#jform_add_update_server input[type='radio']:checked").val();
|
2024-04-27 13:51:57 +00:00
|
|
|
vvvvvwc(add_update_server_vvvvvwc);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var buildcomp_vvvvvwd = jQuery("#jform_buildcomp input[type='radio']:checked").val();
|
|
|
|
vvvvvwd(buildcomp_vvvvvwd);
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var dashboard_type_vvvvvwe = jQuery("#jform_dashboard_type input[type='radio']:checked").val();
|
|
|
|
vvvvvwe(dashboard_type_vvvvvwe);
|
2016-02-19 09:21:44 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var dashboard_type_vvvvvwf = jQuery("#jform_dashboard_type input[type='radio']:checked").val();
|
|
|
|
vvvvvwf(dashboard_type_vvvvvwf);
|
2016-03-04 20:58:05 +00:00
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
var translation_tool_vvvvvwg = jQuery("#jform_translation_tool").val();
|
|
|
|
vvvvvwg(translation_tool_vvvvvwg);
|
2016-01-30 20:28:43 +00:00
|
|
|
});
|
|
|
|
|
2016-02-26 13:57:30 +00:00
|
|
|
// the vvvvvvv function
|
2024-04-21 23:07:22 +00:00
|
|
|
function vvvvvvv(emptycontributors_vvvvvvv)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-21 23:07:22 +00:00
|
|
|
if (emptycontributors_vvvvvvv == 1)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_number').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_number').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-21 23:07:22 +00:00
|
|
|
// the vvvvvvw function
|
2024-04-27 13:51:57 +00:00
|
|
|
function vvvvvvw(update_server_target_vvvvvvw,add_update_server_vvvvvvw)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (update_server_target_vvvvvvw == 1 && add_update_server_vvvvvvw == 1)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
2018-02-15 00:42:39 +00:00
|
|
|
jQuery('#jform_update_server').closest('.control-group').show();
|
2016-11-22 05:48:55 +00:00
|
|
|
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-15 00:42:39 +00:00
|
|
|
jQuery('#jform_update_server').closest('.control-group').hide();
|
2016-11-22 05:48:55 +00:00
|
|
|
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvvx function
|
|
|
|
function vvvvvvx(add_update_server_vvvvvvx,update_server_target_vvvvvvx)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (add_update_server_vvvvvvx == 1 && update_server_target_vvvvvvx == 1)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
2018-02-15 00:42:39 +00:00
|
|
|
jQuery('#jform_update_server').closest('.control-group').show();
|
2016-11-22 05:48:55 +00:00
|
|
|
jQuery('.note_update_server_note_ftp').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-02-15 00:42:39 +00:00
|
|
|
jQuery('#jform_update_server').closest('.control-group').hide();
|
2016-11-22 05:48:55 +00:00
|
|
|
jQuery('.note_update_server_note_ftp').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvvy function
|
|
|
|
function vvvvvvy(update_server_target_vvvvvvy,add_update_server_vvvvvvy)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (update_server_target_vvvvvvy == 2 && add_update_server_vvvvvvy == 1)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
jQuery('.note_update_server_note_zip').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('.note_update_server_note_zip').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwa function
|
|
|
|
function vvvvvwa(update_server_target_vvvvvwa,add_update_server_vvvvvwa)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (update_server_target_vvvvvwa == 3 && add_update_server_vvvvvwa == 1)
|
2016-11-22 05:48:55 +00:00
|
|
|
{
|
|
|
|
jQuery('.note_update_server_note_other').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('.note_update_server_note_other').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwc function
|
|
|
|
function vvvvvwc(add_update_server_vvvvvwc)
|
2016-11-22 17:08:17 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (add_update_server_vvvvvwc == 1)
|
2016-11-22 17:08:17 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_update_server_target').closest('.control-group').show();
|
2018-09-10 11:04:52 +00:00
|
|
|
// add required attribute to update_server_target field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (jform_vvvvvwcvvv_required)
|
2016-11-22 17:08:17 +00:00
|
|
|
{
|
|
|
|
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');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwcvvv_required = false;
|
2016-11-22 17:08:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_update_server_target').closest('.control-group').hide();
|
2018-09-10 11:04:52 +00:00
|
|
|
// remove required attribute from update_server_target field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (!jform_vvvvvwcvvv_required)
|
2016-11-22 17:08:17 +00:00
|
|
|
{
|
|
|
|
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');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwcvvv_required = true;
|
2016-11-22 17:08:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwd function
|
|
|
|
function vvvvvwd(buildcomp_vvvvvwd)
|
2016-12-30 10:47:19 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (buildcomp_vvvvvwd == 1)
|
2016-12-30 10:47:19 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_buildcompsql').closest('.control-group').show();
|
2018-09-10 11:04:52 +00:00
|
|
|
// add required attribute to buildcompsql field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (jform_vvvvvwdvvw_required)
|
2016-12-30 10:47:19 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('buildcompsql',0);
|
|
|
|
jQuery('#jform_buildcompsql').prop('required','required');
|
|
|
|
jQuery('#jform_buildcompsql').attr('aria-required',true);
|
|
|
|
jQuery('#jform_buildcompsql').addClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwdvvw_required = false;
|
2016-12-30 10:47:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_buildcompsql').closest('.control-group').hide();
|
2018-09-10 11:04:52 +00:00
|
|
|
// remove required attribute from buildcompsql field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (!jform_vvvvvwdvvw_required)
|
2016-12-30 10:47:19 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('buildcompsql',1);
|
|
|
|
jQuery('#jform_buildcompsql').removeAttr('required');
|
|
|
|
jQuery('#jform_buildcompsql').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_buildcompsql').removeClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwdvvw_required = true;
|
2016-12-30 10:47:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwe function
|
|
|
|
function vvvvvwe(dashboard_type_vvvvvwe)
|
2018-03-09 03:26:44 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (dashboard_type_vvvvvwe == 2)
|
2018-03-09 03:26:44 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_dashboard').closest('.control-group').show();
|
|
|
|
jQuery('.note_dynamic_dashboard').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_dashboard').closest('.control-group').hide();
|
|
|
|
jQuery('.note_dynamic_dashboard').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwf function
|
|
|
|
function vvvvvwf(dashboard_type_vvvvvwf)
|
2018-03-09 03:26:44 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (dashboard_type_vvvvvwf == 1)
|
2018-03-09 03:26:44 +00:00
|
|
|
{
|
|
|
|
jQuery('.note_botton_component_dashboard').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('.note_botton_component_dashboard').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwg function
|
|
|
|
function vvvvvwg(translation_tool_vvvvvwg)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
2024-04-27 13:51:57 +00:00
|
|
|
if (isSet(translation_tool_vvvvvwg) && translation_tool_vvvvvwg.constructor !== Array)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
2024-04-27 13:51:57 +00:00
|
|
|
var temp_vvvvvwg = translation_tool_vvvvvwg;
|
|
|
|
var translation_tool_vvvvvwg = [];
|
|
|
|
translation_tool_vvvvvwg.push(temp_vvvvvwg);
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
2024-04-27 13:51:57 +00:00
|
|
|
else if (!isSet(translation_tool_vvvvvwg))
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
2024-04-27 13:51:57 +00:00
|
|
|
var translation_tool_vvvvvwg = [];
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
2024-04-27 13:51:57 +00:00
|
|
|
var translation_tool = translation_tool_vvvvvwg.some(translation_tool_vvvvvwg_SomeFunc);
|
2019-05-15 17:39:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
// set this function logic
|
|
|
|
if (translation_tool)
|
|
|
|
{
|
|
|
|
jQuery('#jform_crowdin_account_api_key').closest('.control-group').show();
|
|
|
|
jQuery('.note_crowdin').closest('.control-group').show();
|
|
|
|
jQuery('#jform_crowdin_project_api_key').closest('.control-group').show();
|
|
|
|
// add required attribute to crowdin_project_api_key field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (jform_vvvvvwgvvx_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_project_api_key',0);
|
|
|
|
jQuery('#jform_crowdin_project_api_key').prop('required','required');
|
|
|
|
jQuery('#jform_crowdin_project_api_key').attr('aria-required',true);
|
|
|
|
jQuery('#jform_crowdin_project_api_key').addClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvx_required = false;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
jQuery('#jform_crowdin_project_identifier').closest('.control-group').show();
|
|
|
|
// add required attribute to crowdin_project_identifier field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (jform_vvvvvwgvvy_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_project_identifier',0);
|
|
|
|
jQuery('#jform_crowdin_project_identifier').prop('required','required');
|
|
|
|
jQuery('#jform_crowdin_project_identifier').attr('aria-required',true);
|
|
|
|
jQuery('#jform_crowdin_project_identifier').addClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvy_required = false;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
jQuery('#jform_crowdin_username').closest('.control-group').show();
|
|
|
|
// add required attribute to crowdin_username field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (jform_vvvvvwgvvz_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_username',0);
|
|
|
|
jQuery('#jform_crowdin_username').prop('required','required');
|
|
|
|
jQuery('#jform_crowdin_username').attr('aria-required',true);
|
|
|
|
jQuery('#jform_crowdin_username').addClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvz_required = false;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_crowdin_account_api_key').closest('.control-group').hide();
|
|
|
|
jQuery('.note_crowdin').closest('.control-group').hide();
|
|
|
|
jQuery('#jform_crowdin_project_api_key').closest('.control-group').hide();
|
|
|
|
// remove required attribute from crowdin_project_api_key field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (!jform_vvvvvwgvvx_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_project_api_key',1);
|
|
|
|
jQuery('#jform_crowdin_project_api_key').removeAttr('required');
|
|
|
|
jQuery('#jform_crowdin_project_api_key').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_crowdin_project_api_key').removeClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvx_required = true;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
jQuery('#jform_crowdin_project_identifier').closest('.control-group').hide();
|
|
|
|
// remove required attribute from crowdin_project_identifier field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (!jform_vvvvvwgvvy_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_project_identifier',1);
|
|
|
|
jQuery('#jform_crowdin_project_identifier').removeAttr('required');
|
|
|
|
jQuery('#jform_crowdin_project_identifier').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_crowdin_project_identifier').removeClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvy_required = true;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
jQuery('#jform_crowdin_username').closest('.control-group').hide();
|
|
|
|
// remove required attribute from crowdin_username field
|
2024-04-27 13:51:57 +00:00
|
|
|
if (!jform_vvvvvwgvvz_required)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('crowdin_username',1);
|
|
|
|
jQuery('#jform_crowdin_username').removeAttr('required');
|
|
|
|
jQuery('#jform_crowdin_username').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_crowdin_username').removeClass('required');
|
2024-04-27 13:51:57 +00:00
|
|
|
jform_vvvvvwgvvz_required = true;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-27 13:51:57 +00:00
|
|
|
// the vvvvvwg Some function
|
|
|
|
function translation_tool_vvvvvwg_SomeFunc(translation_tool_vvvvvwg)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
// set the function logic
|
2024-04-27 13:51:57 +00:00
|
|
|
if (translation_tool_vvvvvwg == 1)
|
2019-05-15 17:39:27 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-02-27 21:05:28 +00:00
|
|
|
// update fields required
|
|
|
|
function updateFieldRequired(name, status) {
|
|
|
|
// check if not_required exist
|
2024-03-09 19:47:28 +00:00
|
|
|
if (document.getElementById('jform_not_required')) {
|
2020-02-27 21:05:28 +00:00
|
|
|
var not_required = jQuery('#jform_not_required').val().split(",");
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2020-02-27 21:05:28 +00:00
|
|
|
if(status == 1)
|
2016-01-30 20:28:43 +00:00
|
|
|
{
|
2020-02-27 21:05:28 +00:00
|
|
|
not_required.push(name);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2020-02-27 21:05:28 +00:00
|
|
|
not_required = removeFieldFromNotRequired(not_required, name);
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2020-02-27 21:05:28 +00:00
|
|
|
|
|
|
|
jQuery('#jform_not_required').val(fixNotRequiredArray(not_required).toString());
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
2020-02-27 21:05:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
});
|
|
|
|
}
|
2016-01-30 20:28:43 +00:00
|
|
|
|
2020-02-27 21:05:28 +00:00
|
|
|
// remove empty from not_required array
|
|
|
|
function removeEmptyFromNotRequiredArray(array) {
|
|
|
|
return array.filter(function (el) {
|
|
|
|
// remove ( 一_一) as well - lol
|
|
|
|
return (el.length > 0 && '一_一' !== el);
|
|
|
|
});
|
2016-01-30 20:28:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// the isSet function
|
|
|
|
function isSet(val)
|
|
|
|
{
|
|
|
|
if ((val != undefined) && (val != null) && 0 !== val.length){
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
|
2018-03-11 02:44:43 +00:00
|
|
|
|
2017-10-26 16:43:51 +00:00
|
|
|
jQuery(document).ready(function()
|
|
|
|
{
|
2018-03-09 03:26:44 +00:00
|
|
|
// check what is the dashboard switch
|
|
|
|
var dasboard_type = jQuery("#jform_dashboard_type input[type='radio']:checked").val();
|
|
|
|
dasboardSwitch(dasboard_type);
|
2017-10-26 16:43:51 +00:00
|
|
|
// set buttons
|
|
|
|
function setButtons1() {
|
|
|
|
addButtonID('component_files_folders','button_component_files_folders', 1);
|
|
|
|
addButtonID('component_site_views','button_create_edit_views', 1);
|
|
|
|
}
|
|
|
|
function setButtons2() {
|
|
|
|
addButtonID('component_updates','component_version', 1);
|
|
|
|
addButtonID('component_mysql_tweaks','button_mysql_tweak_options', 1);
|
|
|
|
addButtonID('component_custom_admin_views','button_create_edit_views', 1);
|
|
|
|
}
|
|
|
|
function setButtons3() {
|
|
|
|
addButtonID('component_custom_admin_menus','button_add_custom_menus', 1);
|
|
|
|
addButtonID('component_config','button_add_config', 1);
|
|
|
|
addButtonID('component_admin_views','button_create_edit_views', 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
// use setTimeout() to execute
|
|
|
|
setTimeout(setButtons1, 1000);
|
|
|
|
setTimeout(setButtons2, 2000);
|
|
|
|
setTimeout(setButtons3, 3000);
|
|
|
|
|
|
|
|
// now load the displays
|
|
|
|
function setDisplays1() {
|
|
|
|
getAjaxDisplay('component_admin_views');
|
|
|
|
}
|
|
|
|
function setDisplays2() {
|
|
|
|
getAjaxDisplay('component_custom_admin_views');
|
|
|
|
}
|
|
|
|
function setDisplays3() {
|
|
|
|
getAjaxDisplay('component_site_views');
|
|
|
|
}
|
|
|
|
|
|
|
|
// use setTimeout() to execute
|
|
|
|
setTimeout(setDisplays1, 1500);
|
|
|
|
setTimeout(setDisplays2, 2500);
|
|
|
|
setTimeout(setDisplays3, 3500);
|
|
|
|
|
2019-01-31 21:44:21 +00:00
|
|
|
// check and load all the customcode edit buttons
|
|
|
|
setTimeout(getEditCustomCodeButtons, 400);
|
2019-05-15 17:39:27 +00:00
|
|
|
|
|
|
|
// get crowdin detail if set
|
|
|
|
setTimeout(getTranslationToolDetails, 600);
|
2017-10-26 16:43:51 +00:00
|
|
|
});
|
|
|
|
|
2019-05-15 17:39:27 +00:00
|
|
|
function getTranslationToolDetails(){
|
|
|
|
// get the translation tool selection
|
|
|
|
var tool = jQuery("#jform_translation_tool").val();
|
|
|
|
// trigger Crowdin
|
|
|
|
if (tool == 1) {
|
|
|
|
// get the identifier
|
|
|
|
var identifier = jQuery("#jform_crowdin_project_identifier").val();
|
|
|
|
// get the key
|
|
|
|
var key = jQuery("#jform_crowdin_project_api_key").val();
|
|
|
|
// query server for details
|
|
|
|
getCrowdinDetails_server(identifier, key).done(function(result) {
|
|
|
|
if (result.error){
|
|
|
|
jQuery('#crowdin_information_box').show();
|
|
|
|
jQuery('#crowdin_error_box').show();
|
|
|
|
jQuery('#crowdin_error_box').html(result.error);
|
|
|
|
jQuery('#crowdin_success_box').hide();
|
|
|
|
} else if(result.html) {
|
|
|
|
jQuery('#crowdin_success_box').show();
|
|
|
|
jQuery('#crowdin_success_box').html(result.html);
|
|
|
|
jQuery('#crowdin_error_box').hide();
|
|
|
|
jQuery('#crowdin_information_box').hide();
|
|
|
|
} else {
|
|
|
|
jQuery('#crowdin_information_box').show();
|
|
|
|
jQuery('#crowdin_success_box').hide();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCrowdinDetails_server(identifier, key){
|
2019-07-08 16:05:54 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getCrowdinDetails&format=json&raw=true&vdm="+vastDevMod);
|
2019-05-15 17:39:27 +00:00
|
|
|
if(token.length > 0 && identifier.length > 0 && key.length > 0){
|
2019-07-08 16:05:54 +00:00
|
|
|
var request = token+'=1&identifier='+identifier+'&key='+key;
|
2019-05-15 17:39:27 +00:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
|
|
|
dataType: 'json',
|
|
|
|
data: request,
|
|
|
|
jsonp: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-10-26 16:43:51 +00:00
|
|
|
function getAjaxDisplay(type){
|
|
|
|
getAjaxDisplay_server(type).done(function(result) {
|
|
|
|
if(result){
|
|
|
|
jQuery('#display_'+type).html(result);
|
|
|
|
}
|
|
|
|
// set button
|
|
|
|
addButtonID(type,'header_'+type+'_buttons', 2); // <-- little edit button
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function getAjaxDisplay_server(type){
|
2019-07-08 16:05:54 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getAjaxDisplay&format=json&raw=true&vdm="+vastDevMod);
|
2017-10-26 16:43:51 +00:00
|
|
|
if(token.length > 0 && type.length > 0){
|
2019-07-08 16:05:54 +00:00
|
|
|
var request = token+'=1&type=' + type;
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
2018-12-29 14:56:06 +00:00
|
|
|
dataType: 'json',
|
2017-10-26 16:43:51 +00:00
|
|
|
data: request,
|
2018-12-29 14:56:06 +00:00
|
|
|
jsonp: false
|
2017-10-26 16:43:51 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function addData(result, where){
|
|
|
|
jQuery(result).insertAfter(jQuery(where).closest('.control-group'));
|
|
|
|
}
|
|
|
|
|
2018-03-09 03:26:44 +00:00
|
|
|
function dasboardSwitch(value){
|
|
|
|
// hide if default
|
|
|
|
if (2 == value) {
|
|
|
|
jQuery('.control-group-componentdashboard-one').hide();
|
|
|
|
} else {
|
|
|
|
// default behaviour
|
|
|
|
if (jQuery('div.control-group-componentdashboard-one').length) {
|
|
|
|
jQuery('.control-group-componentdashboard-one').show();
|
|
|
|
} else {
|
|
|
|
addButtonID('component_dashboard','button_component_dashboard', 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-27 12:17:38 +00:00
|
|
|
|
2024-03-09 19:47:28 +00:00
|
|
|
function getEditCustomCodeButtons_server(id) {
|
2019-07-08 16:05:54 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getEditCustomCodeButtons&format=json&raw=true&vdm="+vastDevMod);
|
2024-03-09 19:47:28 +00:00
|
|
|
let requestParams = '';
|
|
|
|
if (token.length > 0 && id > 0) {
|
|
|
|
requestParams = token+'=1&id='+id+'&return_here='+return_here;
|
2019-01-31 21:44:21 +00:00
|
|
|
}
|
2024-03-09 19:47:28 +00:00
|
|
|
// Construct URL with parameters for GET request
|
|
|
|
const urlWithParams = getUrl + '&' + requestParams;
|
|
|
|
|
|
|
|
// Using the Fetch API for the GET request
|
|
|
|
return fetch(urlWithParams, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
}).then(response => {
|
|
|
|
if (!response.ok) {
|
|
|
|
throw new Error('Network response was not ok');
|
|
|
|
}
|
|
|
|
return response.json();
|
2019-01-31 21:44:21 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2024-03-09 19:47:28 +00:00
|
|
|
function getEditCustomCodeButtons() {
|
|
|
|
// Get the id using pure JavaScript
|
|
|
|
const id = document.querySelector("#jform_id").value;
|
|
|
|
getEditCustomCodeButtons_server(id).then(function(result) {
|
|
|
|
if (typeof result === 'object') {
|
|
|
|
Object.entries(result).forEach(([field, buttons]) => {
|
|
|
|
// Creating the div element for buttons
|
|
|
|
const div = document.createElement('div');
|
|
|
|
div.className = 'control-group';
|
|
|
|
div.innerHTML = '<div class="control-label"><label>Add/Edit Customcode</label></div><div class="controls control-customcode-buttons-'+field+'"></div>';
|
|
|
|
|
|
|
|
// Insert the div before .control-wrapper-{field}
|
|
|
|
const insertBeforeElement = document.querySelector(".control-wrapper-"+field);
|
2024-10-07 22:32:35 +00:00
|
|
|
if (insertBeforeElement) {
|
|
|
|
insertBeforeElement.parentNode.insertBefore(div, insertBeforeElement);
|
|
|
|
}
|
2024-03-09 19:47:28 +00:00
|
|
|
|
|
|
|
// Adding buttons to the div
|
|
|
|
Object.entries(buttons).forEach(([name, button]) => {
|
|
|
|
const controlsDiv = document.querySelector(".control-customcode-buttons-"+field);
|
2024-10-07 22:32:35 +00:00
|
|
|
if (controlsDiv) {
|
|
|
|
controlsDiv.innerHTML += button;
|
|
|
|
}
|
2019-01-31 21:44:21 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2024-03-09 19:47:28 +00:00
|
|
|
}).catch(error => {
|
|
|
|
console.error('Error:', error);
|
|
|
|
});
|
2019-01-31 21:44:21 +00:00
|
|
|
}
|
|
|
|
|
2017-10-26 16:43:51 +00:00
|
|
|
function addButtonID_server(type, size){
|
2018-12-29 14:56:06 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButtonID&format=json&raw=true&vdm="+vastDevMod);
|
2017-10-26 16:43:51 +00:00
|
|
|
if(token.length > 0 && type.length > 0 && size > 0){
|
2019-07-08 16:05:54 +00:00
|
|
|
var request = token+'=1&type='+type+'&size='+size;
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
2018-12-29 14:56:06 +00:00
|
|
|
dataType: 'json',
|
2017-10-26 16:43:51 +00:00
|
|
|
data: request,
|
2018-12-29 14:56:06 +00:00
|
|
|
jsonp: false
|
2017-10-26 16:43:51 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
function addButtonID(type, where, size){
|
|
|
|
addButtonID_server(type, size).done(function(result) {
|
|
|
|
if(result){
|
|
|
|
if (2 == size) {
|
|
|
|
jQuery('#'+where).html(result);
|
|
|
|
} else {
|
|
|
|
addData(result, '#jform_'+where);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2018-02-27 12:17:38 +00:00
|
|
|
}
|
|
|
|
|
2018-03-28 09:46:14 +00:00
|
|
|
function addButton_server(type, size){
|
2018-12-29 14:56:06 +00:00
|
|
|
var getUrl = JRouter("index.php?option=com_componentbuilder&task=ajax.getButton&format=json&raw=true&vdm="+vastDevMod);
|
2017-10-26 16:43:51 +00:00
|
|
|
if(token.length > 0 && type.length > 0){
|
2019-07-08 16:05:54 +00:00
|
|
|
var request = token+'=1&type='+type+'&size='+size;
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
return jQuery.ajax({
|
|
|
|
type: 'GET',
|
|
|
|
url: getUrl,
|
2018-12-29 14:56:06 +00:00
|
|
|
dataType: 'json',
|
2017-10-26 16:43:51 +00:00
|
|
|
data: request,
|
2018-12-29 14:56:06 +00:00
|
|
|
jsonp: false
|
2017-10-26 16:43:51 +00:00
|
|
|
});
|
|
|
|
}
|
2018-03-28 09:46:14 +00:00
|
|
|
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) {
|
2017-10-26 16:43:51 +00:00
|
|
|
if(result){
|
2018-03-28 09:46:14 +00:00
|
|
|
if (2 == size) {
|
|
|
|
jQuery('#'+where).html(result);
|
|
|
|
} else {
|
|
|
|
addData(result, '#jform_'+where);
|
|
|
|
}
|
2017-10-26 16:43:51 +00:00
|
|
|
}
|
|
|
|
})
|
2024-03-09 19:47:28 +00:00
|
|
|
}
|