Cost-Benefit-Projection/admin/models/forms/help_document.js

306 lines
7.3 KiB
JavaScript

/*----------------------------------------------------------------------------------| www.giz.de |----/
Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
/-------------------------------------------------------------------------------------------------------/
@version 3.2.0
@build 12th January, 2016
@created 15th June, 2012
@package Cost Benefit Projection
@subpackage help_document.js
@author Llewellyn van der Merwe <http://www.vdm.io>
@owner Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
@copyright Copyright (C) 2015. All Rights Reserved
@license GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html
/-------------------------------------------------------------------------------------------------------/
Cost Benefit Projection Tool.
/------------------------------------------------------------------------------------------------------*/
// Some Global Values
jform_RNOduIMMSo_required = false;
jform_siIJpxYVJK_required = false;
jform_lDlHEihFcs_required = false;
jform_UVjHXBtLuq_required = false;
// Initial Script
jQuery(document).ready(function()
{
var location_LpGwSIo = jQuery("#jform_location input[type='radio']:checked").val();
LpGwSIo(location_LpGwSIo);
var location_hUGVVqp = jQuery("#jform_location input[type='radio']:checked").val();
hUGVVqp(location_hUGVVqp);
var type_RNOduIM = jQuery("#jform_type").val();
RNOduIM(type_RNOduIM);
var type_siIJpxY = jQuery("#jform_type").val();
siIJpxY(type_siIJpxY);
var type_lDlHEih = jQuery("#jform_type").val();
lDlHEih(type_lDlHEih);
var target_UVjHXBt = jQuery("#jform_target input[type='radio']:checked").val();
UVjHXBt(target_UVjHXBt);
});
// the LpGwSIo function
function LpGwSIo(location_LpGwSIo)
{
// [8307] set the function logic
if (location_LpGwSIo == 1)
{
jQuery('#jform_admin_view').closest('.control-group').show();
}
else
{
jQuery('#jform_admin_view').closest('.control-group').hide();
}
}
// the hUGVVqp function
function hUGVVqp(location_hUGVVqp)
{
// [8307] set the function logic
if (location_hUGVVqp == 2)
{
jQuery('#jform_site_view').closest('.control-group').show();
}
else
{
jQuery('#jform_site_view').closest('.control-group').hide();
}
}
// the RNOduIM function
function RNOduIM(type_RNOduIM)
{
if (isSet(type_RNOduIM) && type_RNOduIM.constructor !== Array)
{
var temp_RNOduIM = type_RNOduIM;
var type_RNOduIM = [];
type_RNOduIM.push(temp_RNOduIM);
}
else if (!isSet(type_RNOduIM))
{
var type_RNOduIM = [];
}
var type = type_RNOduIM.some(type_RNOduIM_SomeFunc);
// [8285] set this function logic
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_RNOduIMMSo_required)
{
updateFieldRequired('url',0);
jQuery('#jform_url').prop('required','required');
jQuery('#jform_url').attr('aria-required',true);
jQuery('#jform_url').addClass('required');
jform_RNOduIMMSo_required = false;
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_RNOduIMMSo_required)
{
updateFieldRequired('url',1);
jQuery('#jform_url').removeAttr('required');
jQuery('#jform_url').removeAttr('aria-required');
jQuery('#jform_url').removeClass('required');
jform_RNOduIMMSo_required = true;
}
}
}
// the RNOduIM Some function
function type_RNOduIM_SomeFunc(type_RNOduIM)
{
// [8272] set the function logic
if (type_RNOduIM == 3)
{
return true;
}
return false;
}
// the siIJpxY function
function siIJpxY(type_siIJpxY)
{
if (isSet(type_siIJpxY) && type_siIJpxY.constructor !== Array)
{
var temp_siIJpxY = type_siIJpxY;
var type_siIJpxY = [];
type_siIJpxY.push(temp_siIJpxY);
}
else if (!isSet(type_siIJpxY))
{
var type_siIJpxY = [];
}
var type = type_siIJpxY.some(type_siIJpxY_SomeFunc);
// [8285] set this function logic
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_siIJpxYVJK_required)
{
updateFieldRequired('article',0);
jQuery('#jform_article').prop('required','required');
jQuery('#jform_article').attr('aria-required',true);
jQuery('#jform_article').addClass('required');
jform_siIJpxYVJK_required = false;
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_siIJpxYVJK_required)
{
updateFieldRequired('article',1);
jQuery('#jform_article').removeAttr('required');
jQuery('#jform_article').removeAttr('aria-required');
jQuery('#jform_article').removeClass('required');
jform_siIJpxYVJK_required = true;
}
}
}
// the siIJpxY Some function
function type_siIJpxY_SomeFunc(type_siIJpxY)
{
// [8272] set the function logic
if (type_siIJpxY == 1)
{
return true;
}
return false;
}
// the lDlHEih function
function lDlHEih(type_lDlHEih)
{
if (isSet(type_lDlHEih) && type_lDlHEih.constructor !== Array)
{
var temp_lDlHEih = type_lDlHEih;
var type_lDlHEih = [];
type_lDlHEih.push(temp_lDlHEih);
}
else if (!isSet(type_lDlHEih))
{
var type_lDlHEih = [];
}
var type = type_lDlHEih.some(type_lDlHEih_SomeFunc);
// [8285] set this function logic
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_lDlHEihFcs_required)
{
updateFieldRequired('content',0);
jQuery('#jform_content').prop('required','required');
jQuery('#jform_content').attr('aria-required',true);
jQuery('#jform_content').addClass('required');
jform_lDlHEihFcs_required = false;
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_lDlHEihFcs_required)
{
updateFieldRequired('content',1);
jQuery('#jform_content').removeAttr('required');
jQuery('#jform_content').removeAttr('aria-required');
jQuery('#jform_content').removeClass('required');
jform_lDlHEihFcs_required = true;
}
}
}
// the lDlHEih Some function
function type_lDlHEih_SomeFunc(type_lDlHEih)
{
// [8272] set the function logic
if (type_lDlHEih == 2)
{
return true;
}
return false;
}
// the UVjHXBt function
function UVjHXBt(target_UVjHXBt)
{
// [8307] set the function logic
if (target_UVjHXBt == 1)
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_UVjHXBtLuq_required)
{
updateFieldRequired('groups',0);
jQuery('#jform_groups').prop('required','required');
jQuery('#jform_groups').attr('aria-required',true);
jQuery('#jform_groups').addClass('required');
jform_UVjHXBtLuq_required = false;
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_UVjHXBtLuq_required)
{
updateFieldRequired('groups',1);
jQuery('#jform_groups').removeAttr('required');
jQuery('#jform_groups').removeAttr('aria-required');
jQuery('#jform_groups').removeClass('required');
jform_UVjHXBtLuq_required = true;
}
}
}
// 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;
}