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
|
2016-01-06 09:58:15 +00:00
|
|
|
@build 6th January, 2016
|
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
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_GScdMmesxu_required = false;
|
|
|
|
jform_qxrBrKuaVU_required = false;
|
|
|
|
jform_hLJJtZdZWj_required = false;
|
|
|
|
jform_fBbhMNsOcX_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
// Initial Script
|
|
|
|
jQuery(document).ready(function()
|
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var location_IrzgNQC = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
IrzgNQC(location_IrzgNQC);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
var location_NqpFWgf = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
NqpFWgf(location_NqpFWgf);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_GScdMme = jQuery("#jform_type").val();
|
|
|
|
GScdMme(type_GScdMme);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_qxrBrKu = jQuery("#jform_type").val();
|
|
|
|
qxrBrKu(type_qxrBrKu);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_hLJJtZd = jQuery("#jform_type").val();
|
|
|
|
hLJJtZd(type_hLJJtZd);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
var target_fBbhMNs = jQuery("#jform_target input[type='radio']:checked").val();
|
|
|
|
fBbhMNs(target_fBbhMNs);
|
2015-12-01 05:06:34 +00:00
|
|
|
});
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the IrzgNQC function
|
|
|
|
function IrzgNQC(location_IrzgNQC)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8269] set the function logic
|
|
|
|
if (location_IrzgNQC == 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the NqpFWgf function
|
|
|
|
function NqpFWgf(location_NqpFWgf)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8269] set the function logic
|
|
|
|
if (location_NqpFWgf == 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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the GScdMme function
|
|
|
|
function GScdMme(type_GScdMme)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
if (isSet(type_GScdMme) && type_GScdMme.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var temp_GScdMme = type_GScdMme;
|
|
|
|
var type_GScdMme = [];
|
|
|
|
type_GScdMme.push(temp_GScdMme);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
else if (!isSet(type_GScdMme))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_GScdMme = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
var type = type_GScdMme.some(type_GScdMme_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8247] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').show();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (jform_GScdMmesxu_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_GScdMmesxu_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').hide();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (!jform_GScdMmesxu_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_GScdMmesxu_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the GScdMme Some function
|
|
|
|
function type_GScdMme_SomeFunc(type_GScdMme)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8234] set the function logic
|
|
|
|
if (type_GScdMme == 3)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the qxrBrKu function
|
|
|
|
function qxrBrKu(type_qxrBrKu)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
if (isSet(type_qxrBrKu) && type_qxrBrKu.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var temp_qxrBrKu = type_qxrBrKu;
|
|
|
|
var type_qxrBrKu = [];
|
|
|
|
type_qxrBrKu.push(temp_qxrBrKu);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
else if (!isSet(type_qxrBrKu))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_qxrBrKu = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
var type = type_qxrBrKu.some(type_qxrBrKu_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8247] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').show();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (jform_qxrBrKuaVU_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_qxrBrKuaVU_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').hide();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (!jform_qxrBrKuaVU_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_qxrBrKuaVU_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the qxrBrKu Some function
|
|
|
|
function type_qxrBrKu_SomeFunc(type_qxrBrKu)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8234] set the function logic
|
|
|
|
if (type_qxrBrKu == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the hLJJtZd function
|
|
|
|
function hLJJtZd(type_hLJJtZd)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
if (isSet(type_hLJJtZd) && type_hLJJtZd.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var temp_hLJJtZd = type_hLJJtZd;
|
|
|
|
var type_hLJJtZd = [];
|
|
|
|
type_hLJJtZd.push(temp_hLJJtZd);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
else if (!isSet(type_hLJJtZd))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
var type_hLJJtZd = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-06 09:58:15 +00:00
|
|
|
var type = type_hLJJtZd.some(type_hLJJtZd_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8247] set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').show();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (jform_hLJJtZdZWj_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_hLJJtZdZWj_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (!jform_hLJJtZdZWj_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_hLJJtZdZWj_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the hLJJtZd Some function
|
|
|
|
function type_hLJJtZd_SomeFunc(type_hLJJtZd)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8234] set the function logic
|
|
|
|
if (type_hLJJtZd == 2)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-06 09:58:15 +00:00
|
|
|
// the fBbhMNs function
|
|
|
|
function fBbhMNs(target_fBbhMNs)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-06 09:58:15 +00:00
|
|
|
// [8269] set the function logic
|
|
|
|
if (target_fBbhMNs == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').show();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (jform_fBbhMNsOcX_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_fBbhMNsOcX_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').hide();
|
2016-01-06 09:58:15 +00:00
|
|
|
if (!jform_fBbhMNsOcX_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');
|
2016-01-06 09:58:15 +00:00
|
|
|
jform_fBbhMNsOcX_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;
|
|
|
|
}
|