/**
* prevent double-submits
*/
function helper_disableSubmitForm(id, form_id)
{
try
{
//console.log(id);
//console.log(form_id);
if (form_id == 'member_update_form' || form_id == 'add_subitem_update_form')
{
ecm_calculateTimeSpent(null);
}
var okay = true;//submitReviewDialog();
if (okay)
{
var button = $('#' + id);
button.attr('disabled',true);
}
$('#' + form_id).submit();
return okay;
}
catch (err)
{
alert(err);
console.log(err);
return false;
}
}
function helper_getSpinner(id)
{
var html = '';
html += '
';
html += '';
html += '';
html += ' ';
html += ' | ';
html += '
';
html += '
';
return html;
}
function helper_showMemberInfoHeader(cin, item_id, element_id)
{
var uri = 'https://dev.oversightcloud.com/app/ui/ecm/member/header/' + cin + '/' + item_id;
$('#' + element_id).replaceWith(helper_getSpinner(element_id));
//console.log(uri);
//return;
$.ajax({
url: uri,
cache: false,
success: function(response) {
//console.log(response);
//response = response + response + response;
// var r = $(response);
//console.log(r);
// var contents = r.find(".member_info_table");
//console.log(contents);
$('#' + element_id).replaceWith(response);
if (element_id == 'member_info_table')
{
$('#subitem_name').focus();
}
}
});
}
function helper_getWorkitemCounts()
{
var counts = $.ajax({
url: 'https://dev.oversightcloud.com/app/ui/ecm/workitems/count'
,cache: false
,success: function(response) {
//console.log(response);
if (!response.hasOwnProperty('counts')) { return; }
var counts = response.counts;
var owner = 0;
var blocking = 0;
if (counts.hasOwnProperty('blocking')) { blocking = counts.blocking; }
if (counts.hasOwnProperty('owner')) {
owner_counts = counts.owner;
if (owner_counts.hasOwnProperty('IN PROGRESS')) {
owner = owner_counts['IN PROGRESS'];
}
}
if (blocking > 0) {
$('.workitem_count_blocking').html(blocking);
$('.workitem_count_blocking').show();
$('.navinator').css('display','inline');
$('.user_name_anchor').css('top','-9px');
$('.simulated_user').css('top','-9px');
$('.user_name_anchor_view').css('top','-8px');
} else {
//$('.workitem_count_blocking').hide();
}
if (owner > 0) {
$('.workitem_count_mywork').html(owner);
if (owner > 20) { $('.workitem_count_mywork').addClass('review_red'); }
else if (owner > 12) { $('.workitem_count_mywork').addClass('review_yellow'); }
else { $('.workitem_count_mywork').addClass('review_green'); }
$('.workitem_count_mywork').show();
$('.navinator').css('display','inline');
$('.user_name_anchor').css('top','-9px');
$('.simulated_user').css('top','-9px');
$('.user_name_anchor_view').css('top','-8px');
} else {
$('.workitem_count_mywork').hide();
}
}
});
}