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

306 lines
7.3 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.0.9
@build 2nd 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
jform_CiLvGkzvad_required = false;
jform_TBqocUAltU_required = false;
jform_dQlZimNoYJ_required = false;
jform_BBVrdICKeD_required = false;
2015-12-01 05:06:34 +00:00
// Initial Script
jQuery(document).ready(function()
{
var location_jxuQynV = jQuery("#jform_location input[type='radio']:checked").val();
jxuQynV(location_jxuQynV);
2015-12-01 05:06:34 +00:00
var location_tcNfMZq = jQuery("#jform_location input[type='radio']:checked").val();
tcNfMZq(location_tcNfMZq);
2015-12-01 05:06:34 +00:00
var type_CiLvGkz = jQuery("#jform_type").val();
CiLvGkz(type_CiLvGkz);
2015-12-01 05:06:34 +00:00
var type_TBqocUA = jQuery("#jform_type").val();
TBqocUA(type_TBqocUA);
2015-12-01 05:06:34 +00:00
var type_dQlZimN = jQuery("#jform_type").val();
dQlZimN(type_dQlZimN);
2015-12-01 05:06:34 +00:00
var target_BBVrdIC = jQuery("#jform_target input[type='radio']:checked").val();
BBVrdIC(target_BBVrdIC);
2015-12-01 05:06:34 +00:00
});
// the jxuQynV function
function jxuQynV(location_jxuQynV)
2015-12-01 05:06:34 +00:00
{
// [8017] set the function logic
if (location_jxuQynV == 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 tcNfMZq function
function tcNfMZq(location_tcNfMZq)
2015-12-01 05:06:34 +00:00
{
// [8017] set the function logic
if (location_tcNfMZq == 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 CiLvGkz function
function CiLvGkz(type_CiLvGkz)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_CiLvGkz) && type_CiLvGkz.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_CiLvGkz = type_CiLvGkz;
var type_CiLvGkz = [];
type_CiLvGkz.push(temp_CiLvGkz);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_CiLvGkz))
2015-12-01 05:06:34 +00:00
{
var type_CiLvGkz = [];
2015-12-01 05:06:34 +00:00
}
var type = type_CiLvGkz.some(type_CiLvGkz_SomeFunc);
2015-12-01 05:06:34 +00:00
// [7995] set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_url').closest('.control-group').show();
if (jform_CiLvGkzvad_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_CiLvGkzvad_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_url').closest('.control-group').hide();
if (!jform_CiLvGkzvad_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_CiLvGkzvad_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the CiLvGkz Some function
function type_CiLvGkz_SomeFunc(type_CiLvGkz)
2015-12-01 05:06:34 +00:00
{
// [7982] set the function logic
if (type_CiLvGkz == 3)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the TBqocUA function
function TBqocUA(type_TBqocUA)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_TBqocUA) && type_TBqocUA.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_TBqocUA = type_TBqocUA;
var type_TBqocUA = [];
type_TBqocUA.push(temp_TBqocUA);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_TBqocUA))
2015-12-01 05:06:34 +00:00
{
var type_TBqocUA = [];
2015-12-01 05:06:34 +00:00
}
var type = type_TBqocUA.some(type_TBqocUA_SomeFunc);
2015-12-01 05:06:34 +00:00
// [7995] set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_article').closest('.control-group').show();
if (jform_TBqocUAltU_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_TBqocUAltU_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_article').closest('.control-group').hide();
if (!jform_TBqocUAltU_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_TBqocUAltU_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the TBqocUA Some function
function type_TBqocUA_SomeFunc(type_TBqocUA)
2015-12-01 05:06:34 +00:00
{
// [7982] set the function logic
if (type_TBqocUA == 1)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the dQlZimN function
function dQlZimN(type_dQlZimN)
2015-12-01 05:06:34 +00:00
{
if (isSet(type_dQlZimN) && type_dQlZimN.constructor !== Array)
2015-12-01 05:06:34 +00:00
{
var temp_dQlZimN = type_dQlZimN;
var type_dQlZimN = [];
type_dQlZimN.push(temp_dQlZimN);
2015-12-01 05:06:34 +00:00
}
else if (!isSet(type_dQlZimN))
2015-12-01 05:06:34 +00:00
{
var type_dQlZimN = [];
2015-12-01 05:06:34 +00:00
}
var type = type_dQlZimN.some(type_dQlZimN_SomeFunc);
2015-12-01 05:06:34 +00:00
// [7995] set this function logic
2015-12-01 05:06:34 +00:00
if (type)
{
jQuery('#jform_content-lbl').closest('.control-group').show();
if (jform_dQlZimNoYJ_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_dQlZimNoYJ_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_content-lbl').closest('.control-group').hide();
if (!jform_dQlZimNoYJ_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_dQlZimNoYJ_required = true;
2015-12-01 05:06:34 +00:00
}
}
}
// the dQlZimN Some function
function type_dQlZimN_SomeFunc(type_dQlZimN)
2015-12-01 05:06:34 +00:00
{
// [7982] set the function logic
if (type_dQlZimN == 2)
2015-12-01 05:06:34 +00:00
{
return true;
}
return false;
}
// the BBVrdIC function
function BBVrdIC(target_BBVrdIC)
2015-12-01 05:06:34 +00:00
{
// [8017] set the function logic
if (target_BBVrdIC == 1)
2015-12-01 05:06:34 +00:00
{
jQuery('#jform_groups').closest('.control-group').show();
if (jform_BBVrdICKeD_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_BBVrdICKeD_required = false;
2015-12-01 05:06:34 +00:00
}
}
else
{
jQuery('#jform_groups').closest('.control-group').hide();
if (!jform_BBVrdICKeD_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_BBVrdICKeD_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;
}