Demo-Component/admin/models/forms/help_document.js

307 lines
7.3 KiB
JavaScript
Raw Normal View History

2015-08-24 20:22:07 +00:00
/*----------------------------------------------------------------------------------| www.vdm.io |----/
Vast Development Method
/-------------------------------------------------------------------------------------------------------/
@version 1.0.5
@build 6th January, 2016
@created 5th August, 2015
2015-08-24 20:22:07 +00:00
@package Demo
@subpackage help_document.js
@author Llewellyn van der Merwe <https://www.vdm.io/>
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
____ _____ _____ __ __ __ __ ___ _____ __ __ ____ _____ _ _ ____ _ _ ____
(_ _)( _ )( _ )( \/ )( ) /__\ / __)( _ )( \/ )( _ \( _ )( \( )( ___)( \( )(_ _)
.-_)( )(_)( )(_)( ) ( )(__ /(__)\ ( (__ )(_)( ) ( )___/ )(_)( ) ( )__) ) ( )(
\____) (_____)(_____)(_/\/\_)(____)(__)(__) \___)(_____)(_/\/\_)(__) (_____)(_)\_)(____)(_)\_) (__)
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_UwWDUibNSG_required = false;
jform_OhjWnCSlYt_required = false;
jform_TfDWyOuWhA_required = false;
jform_vceyFYEzKq_required = false;
2015-08-24 20:22:07 +00:00
// Initial Script
jQuery(document).ready(function()
{
var location_doyJedc = jQuery("#jform_location input[type='radio']:checked").val();
doyJedc(location_doyJedc);
2015-08-24 20:22:07 +00:00
var location_smDxuix = jQuery("#jform_location input[type='radio']:checked").val();
smDxuix(location_smDxuix);
2015-08-24 20:22:07 +00:00
var type_UwWDUib = jQuery("#jform_type").val();
UwWDUib(type_UwWDUib);
2015-08-24 20:22:07 +00:00
var type_OhjWnCS = jQuery("#jform_type").val();
OhjWnCS(type_OhjWnCS);
2015-08-24 20:22:07 +00:00
var type_TfDWyOu = jQuery("#jform_type").val();
TfDWyOu(type_TfDWyOu);
2015-08-24 20:22:07 +00:00
var target_vceyFYE = jQuery("#jform_target input[type='radio']:checked").val();
vceyFYE(target_vceyFYE);
2015-08-24 20:22:07 +00:00
});
// the doyJedc function
function doyJedc(location_doyJedc)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (location_doyJedc == 1)
2015-08-24 20:22:07 +00:00
{
jQuery('#jform_admin_view').closest('.control-group').show();
}
else
{
jQuery('#jform_admin_view').closest('.control-group').hide();
}
}
// the smDxuix function
function smDxuix(location_smDxuix)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (location_smDxuix == 2)
2015-08-24 20:22:07 +00:00
{
jQuery('#jform_site_view').closest('.control-group').show();
}
else
{
jQuery('#jform_site_view').closest('.control-group').hide();
}
}
// the UwWDUib function
function UwWDUib(type_UwWDUib)
2015-08-24 20:22:07 +00:00
{
if (isSet(type_UwWDUib) && type_UwWDUib.constructor !== Array)
2015-08-24 20:22:07 +00:00
{
var temp_UwWDUib = type_UwWDUib;
var type_UwWDUib = [];
type_UwWDUib.push(temp_UwWDUib);
2015-08-24 20:22:07 +00:00
}
else if (!isSet(type_UwWDUib))
2015-08-24 20:22:07 +00:00
{
var type_UwWDUib = [];
2015-08-24 20:22:07 +00:00
}
var type = type_UwWDUib.some(type_UwWDUib_SomeFunc);
2015-08-24 20:22:07 +00:00
// set this function logic
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_UwWDUibNSG_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required');
jform_UwWDUibNSG_required = false;
2015-08-24 20:22:07 +00:00
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_UwWDUibNSG_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required');
jform_UwWDUibNSG_required = true;
2015-08-24 20:22:07 +00:00
}
}
}
// the UwWDUib Some function
function type_UwWDUib_SomeFunc(type_UwWDUib)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (type_UwWDUib == 3)
2015-08-24 20:22:07 +00:00
{
return true;
}
return false;
}
// the OhjWnCS function
function OhjWnCS(type_OhjWnCS)
2015-08-24 20:22:07 +00:00
{
if (isSet(type_OhjWnCS) && type_OhjWnCS.constructor !== Array)
2015-08-24 20:22:07 +00:00
{
var temp_OhjWnCS = type_OhjWnCS;
var type_OhjWnCS = [];
type_OhjWnCS.push(temp_OhjWnCS);
2015-08-24 20:22:07 +00:00
}
else if (!isSet(type_OhjWnCS))
2015-08-24 20:22:07 +00:00
{
var type_OhjWnCS = [];
2015-08-24 20:22:07 +00:00
}
var type = type_OhjWnCS.some(type_OhjWnCS_SomeFunc);
2015-08-24 20:22:07 +00:00
// set this function logic
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_OhjWnCSlYt_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required');
jform_OhjWnCSlYt_required = false;
2015-08-24 20:22:07 +00:00
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_OhjWnCSlYt_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required');
jform_OhjWnCSlYt_required = true;
2015-08-24 20:22:07 +00:00
}
}
}
// the OhjWnCS Some function
function type_OhjWnCS_SomeFunc(type_OhjWnCS)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (type_OhjWnCS == 1)
2015-08-24 20:22:07 +00:00
{
return true;
}
return false;
}
// the TfDWyOu function
function TfDWyOu(type_TfDWyOu)
2015-08-24 20:22:07 +00:00
{
if (isSet(type_TfDWyOu) && type_TfDWyOu.constructor !== Array)
2015-08-24 20:22:07 +00:00
{
var temp_TfDWyOu = type_TfDWyOu;
var type_TfDWyOu = [];
type_TfDWyOu.push(temp_TfDWyOu);
2015-08-24 20:22:07 +00:00
}
else if (!isSet(type_TfDWyOu))
2015-08-24 20:22:07 +00:00
{
var type_TfDWyOu = [];
2015-08-24 20:22:07 +00:00
}
var type = type_TfDWyOu.some(type_TfDWyOu_SomeFunc);
2015-08-24 20:22:07 +00:00
// set this function logic
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_TfDWyOuWhA_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required');
jform_TfDWyOuWhA_required = false;
2015-08-24 20:22:07 +00:00
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_TfDWyOuWhA_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required');
jform_TfDWyOuWhA_required = true;
2015-08-24 20:22:07 +00:00
}
}
}
// the TfDWyOu Some function
function type_TfDWyOu_SomeFunc(type_TfDWyOu)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (type_TfDWyOu == 2)
2015-08-24 20:22:07 +00:00
{
return true;
}
return false;
}
// the vceyFYE function
function vceyFYE(target_vceyFYE)
2015-08-24 20:22:07 +00:00
{
// set the function logic
if (target_vceyFYE == 1)
2015-08-24 20:22:07 +00:00
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_vceyFYEzKq_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required');
jform_vceyFYEzKq_required = false;
2015-08-24 20:22:07 +00:00
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_vceyFYEzKq_required)
2015-08-24 20:22:07 +00:00
{
updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required');
jform_vceyFYEzKq_required = true;
2015-08-24 20:22:07 +00:00
}
}
}
// 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;
}