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

306 lines
7.2 KiB
JavaScript
Raw Normal View History

2015-12-01 05:06:34 +00:00
/*----------------------------------------------------------------------------------| www.giz.de |----/
Deutsche Gesellschaft für International Zusammenarbeit (GIZ) Gmb
/-------------------------------------------------------------------------------------------------------/
@version 3.3.7
@build 26th February, 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
jform_uaucSuGNjV_required = false;
jform_zvCVyOsKKE_required = false;
jform_nfdzusQTGQ_required = false;
jform_vgRPkIjOvp_required = false;
2015-12-01 05:06:34 +00:00
// Initial Script
jQuery(document).ready(function()
{
var location_nXpzqtd = jQuery("#jform_location input[type='radio']:checked").val();
nXpzqtd(location_nXpzqtd);
2015-12-01 05:06:34 +00:00
var location_uktrraJ = jQuery("#jform_location input[type='radio']:checked").val();
uktrraJ(location_uktrraJ);
2015-12-01 05:06:34 +00:00
var type_uaucSuG = jQuery("#jform_type").val();
uaucSuG(type_uaucSuG);
2015-12-01 05:06:34 +00:00
var type_zvCVyOs = jQuery("#jform_type").val();
zvCVyOs(type_zvCVyOs);
2015-12-01 05:06:34 +00:00
var type_nfdzusQ = jQuery("#jform_type").val();
nfdzusQ(type_nfdzusQ);
2015-12-01 05:06:34 +00:00
var target_vgRPkIj = jQuery("#jform_target input[type='radio']:checked").val();
vgRPkIj(target_vgRPkIj);
2015-12-01 05:06:34 +00:00
});
// the nXpzqtd function
function nXpzqtd(location_nXpzqtd)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (location_nXpzqtd == 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();
}
}
// the uktrraJ function
function uktrraJ(location_uktrraJ)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (location_uktrraJ == 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();
}
}
// the uaucSuG function
function uaucSuG(type_uaucSuG)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_uaucSuG) && type_uaucSuG.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_uaucSuG = type_uaucSuG;
var type_uaucSuG = [];
type_uaucSuG.push(temp_uaucSuG);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_uaucSuG))
2015-12-01 05:06:34 +00:00
{
var type_uaucSuG = [];
2015-12-01 05:06:34 +00:00
}
var type = type_uaucSuG.some(type_uaucSuG_SomeFunc);
2015-12-01 05:06:34 +00:00
// set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_uaucSuGNjV_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');
jform_uaucSuGNjV_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_uaucSuGNjV_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');
jform_uaucSuGNjV_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the uaucSuG Some function
function type_uaucSuG_SomeFunc(type_uaucSuG)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (type_uaucSuG == 3)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the zvCVyOs function
function zvCVyOs(type_zvCVyOs)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_zvCVyOs) && type_zvCVyOs.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_zvCVyOs = type_zvCVyOs;
var type_zvCVyOs = [];
type_zvCVyOs.push(temp_zvCVyOs);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_zvCVyOs))
2015-12-01 05:06:34 +00:00
{
var type_zvCVyOs = [];
2015-12-01 05:06:34 +00:00
}
var type = type_zvCVyOs.some(type_zvCVyOs_SomeFunc);
2015-12-01 05:06:34 +00:00
// set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_zvCVyOsKKE_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');
jform_zvCVyOsKKE_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_zvCVyOsKKE_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');
jform_zvCVyOsKKE_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the zvCVyOs Some function
function type_zvCVyOs_SomeFunc(type_zvCVyOs)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (type_zvCVyOs == 1)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the nfdzusQ function
function nfdzusQ(type_nfdzusQ)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_nfdzusQ) && type_nfdzusQ.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_nfdzusQ = type_nfdzusQ;
var type_nfdzusQ = [];
type_nfdzusQ.push(temp_nfdzusQ);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_nfdzusQ))
2015-12-01 05:06:34 +00:00
{
var type_nfdzusQ = [];
2015-12-01 05:06:34 +00:00
}
var type = type_nfdzusQ.some(type_nfdzusQ_SomeFunc);
2015-12-01 05:06:34 +00:00
// set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_nfdzusQTGQ_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');
jform_nfdzusQTGQ_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_nfdzusQTGQ_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');
jform_nfdzusQTGQ_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the nfdzusQ Some function
function type_nfdzusQ_SomeFunc(type_nfdzusQ)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (type_nfdzusQ == 2)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the vgRPkIj function
function vgRPkIj(target_vgRPkIj)
2015-12-01 05:06:34 +00:00
{
// set the function logic
if (target_vgRPkIj == 1)
2015-12-01 05:06:34 +00:00
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_vgRPkIjOvp_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');
jform_vgRPkIjOvp_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_vgRPkIjOvp_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');
jform_vgRPkIjOvp_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;
}