2015-12-01 05:06:34 +00:00
|
|
|
/*----------------------------------------------------------------------------------| www.giz.de |----/
|
|
|
|
Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
|
|
|
|
/-------------------------------------------------------------------------------------------------------/
|
|
|
|
|
2015-12-17 14:38:15 +00:00
|
|
|
@version 3.1.0
|
2015-12-23 20:51:24 +00:00
|
|
|
@build 23rd December, 2015
|
2015-12-01 05:06:34 +00:00
|
|
|
@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
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_dzQOnAtTIF_required = false;
|
|
|
|
jform_HWQwlmmxDJ_required = false;
|
|
|
|
jform_fWSNxVStqV_required = false;
|
|
|
|
jform_vpCnhLJvww_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
// Initial Script
|
|
|
|
jQuery(document).ready(function()
|
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var location_rjBFAdG = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
rjBFAdG(location_rjBFAdG);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
var location_tedcpcc = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
tedcpcc(location_tedcpcc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_dzQOnAt = jQuery("#jform_type").val();
|
|
|
|
dzQOnAt(type_dzQOnAt);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_HWQwlmm = jQuery("#jform_type").val();
|
|
|
|
HWQwlmm(type_HWQwlmm);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_fWSNxVS = jQuery("#jform_type").val();
|
|
|
|
fWSNxVS(type_fWSNxVS);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
var target_vpCnhLJ = jQuery("#jform_target input[type='radio']:checked").val();
|
|
|
|
vpCnhLJ(target_vpCnhLJ);
|
2015-12-01 05:06:34 +00:00
|
|
|
});
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the rjBFAdG function
|
|
|
|
function rjBFAdG(location_rjBFAdG)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8260] set the function logic
|
|
|
|
if (location_rjBFAdG == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_admin_view').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_admin_view').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the tedcpcc function
|
|
|
|
function tedcpcc(location_tedcpcc)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8260] set the function logic
|
|
|
|
if (location_tedcpcc == 2)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_site_view').closest('.control-group').show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_site_view').closest('.control-group').hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the dzQOnAt function
|
|
|
|
function dzQOnAt(type_dzQOnAt)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
if (isSet(type_dzQOnAt) && type_dzQOnAt.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var temp_dzQOnAt = type_dzQOnAt;
|
|
|
|
var type_dzQOnAt = [];
|
|
|
|
type_dzQOnAt.push(temp_dzQOnAt);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
else if (!isSet(type_dzQOnAt))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_dzQOnAt = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
var type = type_dzQOnAt.some(type_dzQOnAt_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8238] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').show();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (jform_dzQOnAtTIF_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('url',0);
|
|
|
|
jQuery('#jform_url').prop('required','required');
|
|
|
|
jQuery('#jform_url').attr('aria-required',true);
|
|
|
|
jQuery('#jform_url').addClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_dzQOnAtTIF_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').hide();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (!jform_dzQOnAtTIF_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('url',1);
|
|
|
|
jQuery('#jform_url').removeAttr('required');
|
|
|
|
jQuery('#jform_url').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_url').removeClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_dzQOnAtTIF_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the dzQOnAt Some function
|
|
|
|
function type_dzQOnAt_SomeFunc(type_dzQOnAt)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8225] set the function logic
|
|
|
|
if (type_dzQOnAt == 3)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the HWQwlmm function
|
|
|
|
function HWQwlmm(type_HWQwlmm)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
if (isSet(type_HWQwlmm) && type_HWQwlmm.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var temp_HWQwlmm = type_HWQwlmm;
|
|
|
|
var type_HWQwlmm = [];
|
|
|
|
type_HWQwlmm.push(temp_HWQwlmm);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
else if (!isSet(type_HWQwlmm))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_HWQwlmm = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
var type = type_HWQwlmm.some(type_HWQwlmm_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8238] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').show();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (jform_HWQwlmmxDJ_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('article',0);
|
|
|
|
jQuery('#jform_article').prop('required','required');
|
|
|
|
jQuery('#jform_article').attr('aria-required',true);
|
|
|
|
jQuery('#jform_article').addClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_HWQwlmmxDJ_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').hide();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (!jform_HWQwlmmxDJ_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('article',1);
|
|
|
|
jQuery('#jform_article').removeAttr('required');
|
|
|
|
jQuery('#jform_article').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_article').removeClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_HWQwlmmxDJ_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the HWQwlmm Some function
|
|
|
|
function type_HWQwlmm_SomeFunc(type_HWQwlmm)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8225] set the function logic
|
|
|
|
if (type_HWQwlmm == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the fWSNxVS function
|
|
|
|
function fWSNxVS(type_fWSNxVS)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
if (isSet(type_fWSNxVS) && type_fWSNxVS.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var temp_fWSNxVS = type_fWSNxVS;
|
|
|
|
var type_fWSNxVS = [];
|
|
|
|
type_fWSNxVS.push(temp_fWSNxVS);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
else if (!isSet(type_fWSNxVS))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
var type_fWSNxVS = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2015-12-23 20:51:24 +00:00
|
|
|
var type = type_fWSNxVS.some(type_fWSNxVS_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8238] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').show();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (jform_fWSNxVStqV_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('content',0);
|
|
|
|
jQuery('#jform_content').prop('required','required');
|
|
|
|
jQuery('#jform_content').attr('aria-required',true);
|
|
|
|
jQuery('#jform_content').addClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_fWSNxVStqV_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (!jform_fWSNxVStqV_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('content',1);
|
|
|
|
jQuery('#jform_content').removeAttr('required');
|
|
|
|
jQuery('#jform_content').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_content').removeClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_fWSNxVStqV_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the fWSNxVS Some function
|
|
|
|
function type_fWSNxVS_SomeFunc(type_fWSNxVS)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8225] set the function logic
|
|
|
|
if (type_fWSNxVS == 2)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-23 20:51:24 +00:00
|
|
|
// the vpCnhLJ function
|
|
|
|
function vpCnhLJ(target_vpCnhLJ)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2015-12-23 20:51:24 +00:00
|
|
|
// [8260] set the function logic
|
|
|
|
if (target_vpCnhLJ == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').show();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (jform_vpCnhLJvww_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('groups',0);
|
|
|
|
jQuery('#jform_groups').prop('required','required');
|
|
|
|
jQuery('#jform_groups').attr('aria-required',true);
|
|
|
|
jQuery('#jform_groups').addClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_vpCnhLJvww_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').hide();
|
2015-12-23 20:51:24 +00:00
|
|
|
if (!jform_vpCnhLJvww_required)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
updateFieldRequired('groups',1);
|
|
|
|
jQuery('#jform_groups').removeAttr('required');
|
|
|
|
jQuery('#jform_groups').removeAttr('aria-required');
|
|
|
|
jQuery('#jform_groups').removeClass('required');
|
2015-12-23 20:51:24 +00:00
|
|
|
jform_vpCnhLJvww_required = true;
|
2015-12-01 05:06:34 +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;
|
|
|
|
}
|