2015-12-01 05:06:34 +00:00
|
|
|
/*----------------------------------------------------------------------------------| www.giz.de |----/
|
|
|
|
Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
|
|
|
|
/-------------------------------------------------------------------------------------------------------/
|
|
|
|
|
2016-01-14 07:44:50 +00:00
|
|
|
@version 3.3.0
|
2016-01-31 20:24:19 +00:00
|
|
|
@build 31st 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-31 20:28:30 +00:00
|
|
|
jform_cxrSpAJsEA_required = false;
|
|
|
|
jform_agEZjiCoqY_required = false;
|
|
|
|
jform_qIpBDXfuLw_required = false;
|
|
|
|
jform_RMTlzlGmyo_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
// Initial Script
|
|
|
|
jQuery(document).ready(function()
|
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var location_ihDVuyo = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
ihDVuyo(location_ihDVuyo);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
var location_QHxQMlw = jQuery("#jform_location input[type='radio']:checked").val();
|
|
|
|
QHxQMlw(location_QHxQMlw);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_cxrSpAJ = jQuery("#jform_type").val();
|
|
|
|
cxrSpAJ(type_cxrSpAJ);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_agEZjiC = jQuery("#jform_type").val();
|
|
|
|
agEZjiC(type_agEZjiC);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_qIpBDXf = jQuery("#jform_type").val();
|
|
|
|
qIpBDXf(type_qIpBDXf);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
var target_RMTlzlG = jQuery("#jform_target input[type='radio']:checked").val();
|
|
|
|
RMTlzlG(target_RMTlzlG);
|
2015-12-01 05:06:34 +00:00
|
|
|
});
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the ihDVuyo function
|
|
|
|
function ihDVuyo(location_ihDVuyo)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (location_ihDVuyo == 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-31 20:28:30 +00:00
|
|
|
// the QHxQMlw function
|
|
|
|
function QHxQMlw(location_QHxQMlw)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (location_QHxQMlw == 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-31 20:28:30 +00:00
|
|
|
// the cxrSpAJ function
|
|
|
|
function cxrSpAJ(type_cxrSpAJ)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
if (isSet(type_cxrSpAJ) && type_cxrSpAJ.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var temp_cxrSpAJ = type_cxrSpAJ;
|
|
|
|
var type_cxrSpAJ = [];
|
|
|
|
type_cxrSpAJ.push(temp_cxrSpAJ);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
else if (!isSet(type_cxrSpAJ))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_cxrSpAJ = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
var type = type_cxrSpAJ.some(type_cxrSpAJ_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-14 07:44:50 +00:00
|
|
|
// set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').show();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (jform_cxrSpAJsEA_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-31 20:28:30 +00:00
|
|
|
jform_cxrSpAJsEA_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_url').closest('.control-group').hide();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (!jform_cxrSpAJsEA_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-31 20:28:30 +00:00
|
|
|
jform_cxrSpAJsEA_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the cxrSpAJ Some function
|
|
|
|
function type_cxrSpAJ_SomeFunc(type_cxrSpAJ)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (type_cxrSpAJ == 3)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the agEZjiC function
|
|
|
|
function agEZjiC(type_agEZjiC)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
if (isSet(type_agEZjiC) && type_agEZjiC.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var temp_agEZjiC = type_agEZjiC;
|
|
|
|
var type_agEZjiC = [];
|
|
|
|
type_agEZjiC.push(temp_agEZjiC);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
else if (!isSet(type_agEZjiC))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_agEZjiC = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
var type = type_agEZjiC.some(type_agEZjiC_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-14 07:44:50 +00:00
|
|
|
// set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').show();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (jform_agEZjiCoqY_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-31 20:28:30 +00:00
|
|
|
jform_agEZjiCoqY_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_article').closest('.control-group').hide();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (!jform_agEZjiCoqY_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-31 20:28:30 +00:00
|
|
|
jform_agEZjiCoqY_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the agEZjiC Some function
|
|
|
|
function type_agEZjiC_SomeFunc(type_agEZjiC)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (type_agEZjiC == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the qIpBDXf function
|
|
|
|
function qIpBDXf(type_qIpBDXf)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
if (isSet(type_qIpBDXf) && type_qIpBDXf.constructor !== Array)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var temp_qIpBDXf = type_qIpBDXf;
|
|
|
|
var type_qIpBDXf = [];
|
|
|
|
type_qIpBDXf.push(temp_qIpBDXf);
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
else if (!isSet(type_qIpBDXf))
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-31 20:28:30 +00:00
|
|
|
var type_qIpBDXf = [];
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
2016-01-31 20:28:30 +00:00
|
|
|
var type = type_qIpBDXf.some(type_qIpBDXf_SomeFunc);
|
2015-12-01 05:06:34 +00:00
|
|
|
|
|
|
|
|
2016-01-14 07:44:50 +00:00
|
|
|
// set this function logic
|
2015-12-01 05:06:34 +00:00
|
|
|
if (type)
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').show();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (jform_qIpBDXfuLw_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-31 20:28:30 +00:00
|
|
|
jform_qIpBDXfuLw_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_content-lbl').closest('.control-group').hide();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (!jform_qIpBDXfuLw_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-31 20:28:30 +00:00
|
|
|
jform_qIpBDXfuLw_required = true;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the qIpBDXf Some function
|
|
|
|
function type_qIpBDXf_SomeFunc(type_qIpBDXf)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (type_qIpBDXf == 2)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-01-31 20:28:30 +00:00
|
|
|
// the RMTlzlG function
|
|
|
|
function RMTlzlG(target_RMTlzlG)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
2016-01-14 07:44:50 +00:00
|
|
|
// set the function logic
|
2016-01-31 20:28:30 +00:00
|
|
|
if (target_RMTlzlG == 1)
|
2015-12-01 05:06:34 +00:00
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').show();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (jform_RMTlzlGmyo_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-31 20:28:30 +00:00
|
|
|
jform_RMTlzlGmyo_required = false;
|
2015-12-01 05:06:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
jQuery('#jform_groups').closest('.control-group').hide();
|
2016-01-31 20:28:30 +00:00
|
|
|
if (!jform_RMTlzlGmyo_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-31 20:28:30 +00:00
|
|
|
jform_RMTlzlGmyo_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;
|
|
|
|
}
|