function getCheckedPrsCount(name) {
var prNumbers = document.getElementsByName(name);
var chkdPrCount = 0;
for ( var index = 0; index < prNumbers.length; index++) {
if (prNumbers[index].checked) {
chkdPrCount++;
}
}
return chkdPrCount;
}
function resetPage(){
resetPagination();
var pageCountObj = document.getElementById("pageCount");
pageCountObj.value = 10;
document.getElementById("prStatus").value = '';
document.getElementById("gnatsConfidential").value = '';
document.getElementById("pbnStateFilter").value = '';
document.getElementById("bcfProduct").value = '';
document.getElementById("bcfPlatform").value = '';
document.getElementById("gnatsProduct").value = '';
document.getElementById("gnatsPlatform").value = '';
document.getElementById("bcfOsProduct").value = '';
document.getElementById("gnatsWorkaroundProvided").value = '';
document.getElementById("gnatsClass").value = '';
document.getElementById("submitterId").value = '';
document.getElementById("gnatsCategory").value = '';
document.getElementById("gnatsCategoryText").value = '';
document.getElementById("submitterIdText").value = '';
document.getElementById("gnatsProblemLevelText").value = '';
document.getElementById("gnatsClassText").value = '';
document.getElementById("synopsisHeadline").value = '';
document.getElementById("rootCause").value = '';
document.getElementById("resolvedIn").value = '';
document.getElementById("releaseNote").value = '';
document.getElementById("externalTitle").value = '';
document.getElementById("externalDescription").value = '';
document.getElementById("externalTrigger").value = '';
document.getElementById("gnatsWorkaround").value = '';
document.getElementById("engineeringFixDetails").value = '';
document.getElementById("serviceRestoration").value = '';
document.getElementById("comments").value = '';
document.getElementById("prNumber").value = '';
document.getElementById("bcfOwner").value = '';
document.getElementById("pbnOwner").value = '';
document.getElementById("customerRecommendation").value = '';
document.getElementById("internalNotes").value = '';
document.getElementById("excludeReason").value = '';
document.getElementById("customerImpact").value = '';
document.getElementById("impactProbability").value = '';
document.getElementById("gnatsCustomer").value = '';
document.getElementById("gnatsProblemLevel").value = '';
document.getElementById("bcfScore").value = '';
document.getElementById("scoreSign").value = '';
document.getElementById("gnatsArrivalDate").value = '';
document.getElementById('gnatsState').value='';
document.getElementById('gnatsRelease').value='';
if(document.getElementById("analysis")) {
document.getElementById("analysis").value = '';
}
if(document.getElementById("sirtState")) {
document.getElementById("sirtState").value = '';
}
if(document.getElementById("sirtStateText")) {
document.getElementById("sirtStateText").value = '';
}
if(document.getElementById("prStateText")) {
document.getElementById("prStateText").value = '';
}
if(document.getElementById("gnatsAttributesFilter")) {
document.getElementById("gnatsAttributesFilter").value = '';
}
}
function clearAllFilters() {
resetPage();
submitForm();
}
function handleFilter(key, obj){
//changes for copy paste functionality
if (key == 'prNumber') {
var prNumber = obj.value;
if(prNumber != ""){
var numberValidation = new RegExp("^[0-9]+$");
var result = numberValidation.test(prNumber);
if (!result) {
alert('Please Enter Numbers Only');
return false;
}
}
}
if(key == 'scoreSign'){
var bcfScore = document.getElementById('bcfScore').value;
if(bcfScore == ''){
document.getElementById(key).value = trim(obj.value);
return false;
}
}
if(key == 'analysis') {
var pagecount = Number(new String(document.getElementById("pageCount").value));
var totalRows = Number(new String(document.getElementById("page.totalRowCnt").value));
if( (pagecount==totalRows) && totalRows > 999) {
alert("Filtering on the basis of 'Analysis' coulmn is restricted when the no of recods in the PIIR report exceeds 999 and 'View All' action is active");
return false;
}
}
if(key == 'gnatsCategoryText') {
document.getElementById('gnatsCategory').value = '';
} else if(key == 'gnatsClassText') {
document.getElementById('gnatsClass').value = '';
} else if(key == 'submitterIdText') {
document.getElementById('submitterId').value = '';
} else if(key == 'sirtStateText') {
document.getElementById('sirtState').value = '';
} else if(key == 'gnatsProblemLevelText') {
document.getElementById('gnatsProblemLevel').value = '';
}
document.getElementById(key).value = trim(obj.value);
resetPagination();
submitForm();
}
// On click of PR number , it opens the detailed view
// On click of PR number , it opens the detailed view
function openDetailedView(gnatsNumber,currentScreen) {
var currentPage ;
if(currentScreen != null && currentScreen != 'undefined' && (currentScreen == 'Piir' || currentScreen == 'piir_refresh' || currentScreen == 'piir_wip')) {
currentPage = 'Piir';
} else {
currentPage = document.getElementById("currPageTemp").value;
}
var selectedPiirOrg = -999;
var orgObj = document.getElementById("org");
if(null != orgObj) {
selectedPiirOrg = orgObj.value;
}
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var targetUrl = "pr-detail?prKey="+gnatsNumber+"&CURRENT_PAGE="+currentPage+"&SELECTED_PIIR_ORG="+selectedPiirOrg;
var piirReportIdObj = document.getElementById("piirReportId");
if(null != piirReportIdObj && piirReportIdObj.value != '' && piirReportIdObj.value != -999) {
targetUrl = targetUrl + "&PIIR_REPORT_ID="+piirReportIdObj.value;
}
if($.browser.msie) {
window1 = window.open (targetUrl,gnatsNumber,"status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes");
window1.moveTo(0,0);
window1.resizeTo(screen.availWidth, screen.availHeight);
} else {
var newwindow = window.open(targetUrl,'_blank'+gnatsNumber);
}
}
function prDetailPopupClosePreHandler(){
var flag = document.getElementById("prDetailChangeFlagId").value;
var status = true;
if(flag == 'true') {
status = confirm("Unsaved changes are there. Do you want to continue without saving? Click 'Ok' to continue or Click 'Cancel' to stay on the same page");
}
if(status) {
document.getElementById("prDetailChangeFlagId").value ='false';
var gnatsRefreshObj =document.getElementById("prDetailGnatsRefreshFlagId");
if(null != gnatsRefreshObj) {
var refresh = gnatsRefreshObj.value;
if(null != refresh && refresh == 'true') {
gnatsRefreshObj.value = 'false';
refreshParentBase();
}
}
}
return status;
}
function refreshParentBase() {
parent.jumpScroll();
var filterfrm = null;
var currentNav = document.getElementById("currPageTemp").value;
if(currentNav !=null && currentNav != '' && currentNav =='screen') {
filterfrm = parent.document.getElementById("screenPrPage");
} else if(currentNav !=null && currentNav != '' && currentNav =='clean') {
filterfrm = parent.document.getElementById("cleanPrPage");
} else if(currentNav !=null && currentNav != '' && currentNav =='approve') {
filterfrm = parent.document.getElementById("approvePrPage");
} else if(currentNav !=null && currentNav != '' && currentNav =='watch') {
filterfrm = parent.document.getElementById("watchListPage");
} else if (currentNav !=null && currentNav != '' && currentNav =='pbn') {
filterfrm = parent.document.getElementById("PBNPage");
} else {
filterfrm = parent.document.getElementById("PIRPage");
}
if(filterfrm != null) {
var prDetailChangeFlagIdObj = document.getElementById("prDetailGnatsRefreshFlagId");
if(prDetailChangeFlagIdObj){
prDetailChangeFlagIdObj.value ='false';
filterfrm.contentWindow.refreshTable();
}
}
parent.tb_remove();
}
function fetchAllRecommendations(recIssueId) {
parent.tb_show('Recommendation History', 'recommHistory?issueID='+recIssueId+'&KeepThis=true&TB_iframe=true&height=500&width=750', null);
}
//hide the 'page loading' splash screen.
function hideSplashScreen() {
document.getElementById("splashscreenBCF").style.visibility = "hidden";
}
//show the 'page loading' splash screen.
function showSplashScreen() {
document.getElementById("splashscreenBCF").style.visibility = "visible";
}
//Validates whether PR's are selected for updation, before submission.
function checkPRSelection(formObj) {
var noMore = false;
var checked = false;
var gnatNum = document.getElementById("gnatsNumber");
if (gnatNum == null) {
checked = false;
alert("Please select one or more PR's.");
} else {
if (gnatNum.checked == true) {
checked = true;
}
for (var cnt=0; noMore==false && checked==false; cnt++) {
if (formObj.gnatsNumber[cnt] == undefined) {
noMore = true;
} else {
if (formObj.gnatsNumber[cnt].checked) {
checked = true;
}
}
}
if (!checked) {
alert("Please select one or more PR's.");
}
}
return checked;
}
function IssueData () {
this.addSprcificPr = null;
this.workflowAction = null;
this.gnatsNumber= null;
this.offSet= 0;
this.limit= 10;
this.pageCount= 0;
this.issuesCount= 0;
this.currentNav= null;
this.sortBy= null;
this.sortDirection= null;
this.currentIssueCount= 0;
this.deleteRows= null;
this.gnatsUrl= null;
this.crmCaseUrl = null;
this.watchProblem = false;
this.currentTabIndex = 0;
this.page = new Page();
this.piirReportId = -999;
this.piirReportEnumType = null;
this.piirReportType = "I";
this.excludeHsScreen = false;
this.prStatus = '';
this.gnatsConfidential = '';
this.pbnStateFilter = '';
this.bcfProduct ='';
this.bcfPlatform ='';
this.gnatsProduct ='';
this.gnatsPlatform ='';
this.bcfOsProduct ='';
this.gnatsWorkaroundProvided ='';
this.gnatsClass = '';
this.gnatsClassText = '';
this.submitterId = '';
this.submitterIdText = '';
this.sirtState = '';
this.sirtStateText = '';
this.prStateText = '';
this.gnatsAttributesFilter = '';
this.gnatsCategory = '';
this.gnatsCategoryText = '';
this.synopsisHeadline = '';
this.rootCause = '';
this.resolvedIn = '';
this.releaseNote = '';
this.externalTitle = '';
this.externalDescription = '';
this.externalTrigger = '';
this.gnatsWorkaround = '';
this.engineeringFixDetails = '';
this.serviceRestoration = '';
this.comments = '';
this.prNumber = '';
this.bcfOwner = '';
this.pbnOwner = '';
this.customerRecommendation = '';
this.excludeReason = '';
this.internalNotes = '';
this.customerImpact = '';
this.impactProbability = '';
this.gnatsCustomer = '';
this.gnatsProblemLevel = '';
this.gnatsProblemLevelText = '';
this.bcfScore = '';
this.scoreSign = '';
this.filterId=-999;
this.gnatsArrivalDate = '';
this.analysis = '';
this.gnatsRelease='';
this.gnatsState='';
}
function Page () {
this.startIdx = 0;
this.displayIdxStr = "";
this.endDisplayIdx =0;
this.startDisplayIdx = 0;
this.next = false;
this.previous= false;
this.samePage = false;
this.maxRow = 10;
}
function dwrUpdateWatchList(checked,gnatsNumber){
var issueData = getProblemReportIssueData();
issueData.gnatsNumber = gnatsNumber;
issueData.deleteRows= true;
issueData.watchProblem = checked;
watchListController.updateWatchStatusDwr(issueData,{callback: updateWatchStatusCallBack});
}
function getProblemReportIssueData() {
var issueData = new IssueData();
issueData.offSet = document.getElementById("page.startIdx").value;
issueData.limit = document.getElementById("page.maxRow").value;
issueData.sortBy= document.getElementById("currentSortBy").value;;
issueData.sortDirection= document.getElementById("currentSortDirection").value;
issueData.currentNav = document.getElementById("currPageTemp").value;
issueData.currentTabIndex = document.getElementById("currentTabIndex").value;
issueData.gnatsUrl= document.getElementById("gnatsUrl").value;
issueData.crmCaseUrl= document.getElementById("crmCaseUrl").value;
issueData.currentIssueCount= document.getElementById("currentListSize").value;
issueData.pageCount = document.getElementById("pageCount").value;
issueData.prStatus = document.getElementById("prStatus").value;
issueData.gnatsConfidential = document.getElementById("gnatsConfidential").value;
issueData.pbnStateFilter = document.getElementById("pbnStateFilter").value;
issueData.bcfProduct = document.getElementById("bcfProduct").value;
issueData.bcfPlatform = document.getElementById("bcfPlatform").value;
issueData.gnatsProduct = document.getElementById("gnatsProduct").value;
issueData.gnatsPlatform = document.getElementById("gnatsPlatform").value;
issueData.bcfOsProduct = document.getElementById("bcfOsProduct").value;
issueData.gnatsWorkaroundProvided = document.getElementById("gnatsWorkaroundProvided").value;
issueData.gnatsClass = document.getElementById("gnatsClass").value;
issueData.submitterId = document.getElementById("submitterId").value;
issueData.gnatsCategory = document.getElementById("gnatsCategory").value;
issueData.gnatsCategoryText = document.getElementById("gnatsCategoryText").value;
issueData.submitterIdText = document.getElementById("submitterIdText").value;
issueData.gnatsProblemLevelText = document.getElementById("gnatsProblemLevelText").value;
issueData.gnatsClassText = document.getElementById("gnatsClassText").value;
issueData.synopsisHeadline = document.getElementById("synopsisHeadline").value;
issueData.rootCause = document.getElementById("rootCause").value;
issueData.resolvedIn = document.getElementById("resolvedIn").value;
issueData.releaseNote = document.getElementById("releaseNote").value;
issueData.externalTitle = document.getElementById("externalTitle").value;
issueData.externalDescription = document.getElementById("externalDescription").value;
issueData.externalTrigger = document.getElementById("externalTrigger").value;
issueData.gnatsWorkaround = document.getElementById("gnatsWorkaround").value;
issueData.engineeringFixDetails = document.getElementById("engineeringFixDetails").value;
issueData.serviceRestoration = document.getElementById("serviceRestoration").value;
issueData.comments = document.getElementById("comments").value;
issueData.prNumber = document.getElementById("prNumber").value;
issueData.bcfOwner = document.getElementById("bcfOwner").value;
issueData.pbnOwner = document.getElementById("pbnOwner").value;
issueData.customerRecommendation = document.getElementById("customerRecommendation").value;
issueData.internalNotes = document.getElementById("internalNotes").value;
issueData.excludeReason = document.getElementById("excludeReason").value;
issueData.impactProbability = document.getElementById("impactProbability").value;
issueData.customerImpact = document.getElementById("customerImpact").value;
issueData.gnatsCustomer = document.getElementById("gnatsCustomer").value;
issueData.gnatsProblemLevel = document.getElementById("gnatsProblemLevel").value;
issueData.bcfScore = document.getElementById("bcfScore").value;
issueData.scoreSign = document.getElementById("scoreSign").value;
issueData.gnatsArrivalDate = document.getElementById("gnatsArrivalDate").value;
issueData.gnatsState=document.getElementById('gnatsState').value;
issueData.gnatsRelease=document.getElementById('gnatsRelease').value;
if(document.getElementById("analysis")) {
issueData.analysis = document.getElementById("analysis").value;
}
if(document.getElementById("sirtState")) {
issueData.sirtState = document.getElementById("sirtState").value;
}
if(document.getElementById("sirtStateText")) {
issueData.sirtStateText = document.getElementById("sirtStateText").value;
}
if(document.getElementById("prStateText")) {
issueData.prStateText = document.getElementById("prStateText").value;
}
if(document.getElementById("gnatsAttributesFilter")) {
issueData.gnatsAttributesFilter = document.getElementById("gnatsAttributesFilter").value;
}
return issueData;
}
/**
*Call back method for dwrUpdateWatchList method
*
* @param issueData
* @return
*/
function updateWatchStatusCallBack (issueData) {
hideSplashScreen();
var rowList = issueData.issueList;
if(null != rowList && rowList.length > 0){
appendNewRow(rowList);
}
/*remove the successfully updated rows from the table*/
deleteUpdatedTableRows(issueData);
updatePaginationData(issueData);
updatePaginationControls(issueData);
reSizeFrame();
}
function updatePaginationControls(issueData){
var pageCount = document.getElementById("pageCount").value;
if(null != pageCount && -1 != pageCount) {
var totalCount = issueData.issuesCount;
var newDisplayIdStr = issueData.page.displayIdxStr;
var newNext = issueData.page.next;
var newPrev = issueData.page.previous;
var span1 = document.getElementById("displayIdStringInnerSpanID1");
var span2 = document.getElementById("displayIdStringInnerSpanID2");
var outerSpan = document.getElementById("displayIdxStrSpan");
var outerSpanFooter = document.getElementById("displayIdxStrSpanFooter");
if(null != span1 && null != span2) {
span1.innerHTML=newDisplayIdStr;
span2.innerHTML=totalCount;
} else if(null != outerSpan){
var pageIdx = issueData.page.pageIdx;
if(pageIdx == 0){
outerSpan.innerHTML="";
} else {
outerSpan.innerHTML="<b>Page "+issueData.page.pageIdx+" of "+issueData.page.totalPageCnt+"</b>";
}
if(null != outerSpanFooter){
if(pageIdx == 0){
outerSpanFooter.innerHTML="";
} else {
outerSpanFooter.innerHTML="<b>Page "+issueData.page.pageIdx+" of "+issueData.page.totalPageCnt+"</b>";
}
}
}
var viewAllStrSpan = document.getElementById("viewAllStrSpan");
if(null != viewAllStrSpan){
var totalPRCnt = issueData.page.totalRowCnt;
if(totalPRCnt == 0){
viewAllStrSpan.innerHTML="";
} else {
viewAllStrSpan.innerHTML="View All (" + issueData.page.totalRowCnt + ") PRs";
}
}
var viewAllStrSpanFooter = document.getElementById("viewAllStrSpanFooter");
if(null != viewAllStrSpanFooter){
var totalPRCnt = issueData.page.totalRowCnt;
if(totalPRCnt == 0){
viewAllStrSpanFooter.innerHTML="";
} else {
viewAllStrSpanFooter.innerHTML="View All (" + issueData.page.totalRowCnt + ") PRs";
}
}
}
}
function updatePaginationData(issueData){
var prsToDelete = issueData.prsToDelete;
var retrievedIssueCount = parseInt(issueData.retrievedIssueCount);
var pageIssuecount = parseInt(document.getElementById("currentListSize").value);
var countDeletedPrs = 0;
if(null != prsToDelete){
countDeletedPrs = prsToDelete.length;
}
var totalIssueCount = (pageIssuecount-countDeletedPrs)+retrievedIssueCount;
if(totalIssueCount <= 0){
var prevButton = document.getElementById("previousButton");
if(null != prevButton) {
var vis = prevButton.style.visibility;
if(null != vis && vis != 'hidden') {
$("#previousButton").click();
} else {
$('#lastBorderId').remove();
document.getElementById("displayIdxStrSpan").style.visibility = "hidden";
/*document.getElementById("previousButton").style.visibility = "hidden";
document.getElementById("nextButton").style.visibility = "hidden";*/
document.getElementById("pageCountText").value = 0;
document.getElementById("noRecordsRowId").style.display='';
}
}
} else {
document.getElementById("currentListSize").value = totalIssueCount;
var pageCount = document.getElementById("pageCount").value;
if(null != pageCount && -1 == pageCount) {
document.getElementById("pageCountText").value = totalIssueCount;
}
}
if(issueData.page.next) {
document.getElementById("nextButton").disabled = false;
document.getElementById("lastButton").disabled = false;
document.getElementById("nextButtonFooter").disabled = false;
document.getElementById("lastButtonFooter").disabled = false;
} else {
document.getElementById("nextButton").disabled = true;
document.getElementById("lastButton").disabled = true;
document.getElementById("nextButtonFooter").disabled = true;
document.getElementById("lastButtonFooter").disabled = true;
}
if(issueData.page.previous) {
document.getElementById("previousButton").disabled = false;
document.getElementById("firstButton").disabled = false;
document.getElementById("previousButtonFooter").disabled = false;
document.getElementById("firstButtonFooter").disabled = false;
} else {
document.getElementById("previousButton").disabled = true;
document.getElementById("firstButton").disabled = true;
document.getElementById("previousButtonFooter").disabled = true;
document.getElementById("firstButtonFooter").disabled = true;
}
var displayIdxStrSpanFooter = document.getElementById("displayIdxStrSpanFooter");
var paginationArrStr = "";
var pageNumArr = issueData.page.pageNumArr;
var pageNumId = "";
for (var pageNum = 0; pageNum < pageNumArr.length; pageNum++) {
pageNumId = eval(pageNumArr[pageNum]);
if(pageNumId != 0){
if(pageNumId != issueData.page.pageIdx) {
paginationArrStr = paginationArrStr + "<a href='javascript:noOperation()' onclick='gotoPage(" + pageNumId + ");'></a> ";
} else {
paginationArrStr = paginationArrStr + pageNumId + " ";
}
}
}
//alert(paginationArrStr);
displayIdxStrSpanFooter.innerHTML = paginationArrStr;
}
/**
*
* @param issueList
* @return
*/
function appendNewRow(issueList){
var currentTabIndex = document.getElementById("currentTabIndex").value;
for ( var index = 0; index < issueList.length; index++) {
var issue = issueList[index];
buildAndAppendNewRow(issue,currentTabIndex);
}
}
/**
* Method which will delete the PRs which successfully updated in the DB.
*
* @param issueData
* @return
*/
function deleteUpdatedTableRows(issueData){
var prsToDeleteFromTable = issueData.prsToDelete;
if(null != prsToDeleteFromTable && prsToDeleteFromTable.length > 0) {
for ( var index = 0; index < prsToDeleteFromTable.length; index++) {
$('#'+prsToDeleteFromTable[index]).remove();
}
}
}
/**
*
* @return
*/
function reSizeFrame() {
var currentTabIndex = document.getElementById("currentTabIndex").value;
if(0 == currentTabIndex){
reSizeIFrameHeight('stateTableId');
} else if(1 == currentTabIndex) {
reSizeIFrameHeight('originalInfoTableId');
} else if(2 == currentTabIndex) {
reSizeIFrameHeight('categoryTableId');
} else if(3 == currentTabIndex) {
reSizeIFrameHeight('versionTableId');
} else if(4 == currentTabIndex) {
reSizeIFrameHeight('advSvcsFieldsTableId');
} else if(5 == currentTabIndex) {
reSizeIFrameHeight('customerSpecificTableId');
}else if(6 == currentTabIndex) {
reSizeIFrameHeight('overviewPiirTableId');
}else if(7 == currentTabIndex) {
reSizeIFrameHeight('hackSlashTableId');
}
}
var pbnCalledFlag = 0;
// validates and submits the PR to be updated.
function updatePRStateReload(formObj) {
var action = $('#workflowAction').val();
if(action == 0){
alert('Please select a valid workflow action.');
return;
}
if('CreatePbn' == action){
var prNumber;
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
var selectedCount = 0;
var selectedObj = null;
for ( var index = 0; index < natschecks.length; index++) {
if(natschecks[index].checked){
selectedCount++;
selectedObj = natschecks[index];
}
}
}
if(selectedCount != 1){
alert('Please select one PR for creating PBN.')
return
} else {
var prObjs = document.getElementsByName("gnatsNumber");
for ( var vindex = 0; vindex < prObjs.length; vindex++) {
if(prObjs[vindex].checked) {
prNumber = prObjs[vindex].value;
}
}
}
var params = {gnatsNumber : prNumber,method : 'checkUserPBNPermissions'};
$.post(url, params, function(data){
if(data == 'false'){
if(confirm("You do not have the necessary permissions to 'Create a PBN'")) {
return;
}
} else if (data == 'PBNStateError') {
alert("PBN can be created only for 'Debating' or 'Published' PRs.")
return;
}else {
createPBN();
}
});
} else {
if(checkPRSelection(formObj)){
var currentTabIndex = document.getElementById("currentTabIndex").value;
/** Added after removing the scrollable table start */
reSizeIframeToNormal(currentTabIndex)
/** Added after removing the scrollable table end */
showSplashScreen();
resetForRowDelete();
formObj.action=url + '?method=updateProblemReportStatus';
formObj.submit();
}
}
}
function createPBN() {
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
var selectedCount = 0;
var selectedObj = null;
for ( var index = 0; index < natschecks.length; index++) {
if(natschecks[index].checked){
selectedCount++;
selectedObj = natschecks[index];
}
}
if(selectedCount != 1){
alert('Please select one PR for creating PBN.')
return
}
var filterfrm = parent.document.getElementById("PBNPage");
if(filterfrm){
filterfrm.src = 'search-pbn?originalBugID='+selectedObj.value;
}
}
}
function updatePiirPRState(formObj){
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
var selectedCount = 0;
for ( var index = 0; index < natschecks.length; index++) {
if(natschecks[index].checked){
selectedCount++;
break;
}
}
if(selectedCount == 0){
alert('Atlease one PR selection is required to do this action.')
return;
}
document.getElementById("selectedProblemId").value ='';
}
showSplashScreen();
resetForRowDelete();
formObj.action=url + '?method=updatePIIRStatus';
formObj.submit();
}
function openPrsDetailedView(currentPage,action,gnatsUrl){
var prObjs = document.getElementsByName("gnatsNumber");
var gnatsNumber;
var selectedCount = 0;
var selectedPiirOrg = -999;
var orgObj = document.getElementById("org");
var piirReportIdObj = document.getElementById("piirReportId");
if(null != orgObj) {
selectedPiirOrg = orgObj.value;
}
for ( var vindex = 0; vindex < prObjs.length; vindex++) {
if(prObjs[vindex].checked) {
selectedCount++;
gnatsNumber = prObjs[vindex].value;
if(action == 'BCF'){
var targetUrl = "pr-detail?prKey="+gnatsNumber+"&CURRENT_PAGE="+currentPage+"&SELECTED_PIIR_ORG="+selectedPiirOrg;
if(null != piirReportIdObj && piirReportIdObj.value != '' && piirReportIdObj.value != -999) {
targetUrl = targetUrl + "&PIIR_REPORT_ID="+piirReportIdObj.value;
}
if($.browser.msie) {
window1 = window.open (targetUrl,gnatsNumber,"status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes");
window1.moveTo(0,0);
window1.resizeTo(screen.availWidth, screen.availHeight);
} else {
var newwindow = window.open(targetUrl,'_blank'+gnatsNumber);
}
}else{
var newUrl = gnatsUrl+gnatsNumber+"";
var newwindow = window.open(newUrl,'_blank'+"gnatsMain"+gnatsNumber);
}
}
}
if(selectedCount == 0){
alert('Atlease one PR selection is required to do this action.')
return;
}
}
function bulkPRUpdateAction(formObj,bulkChoice){
var orgId = -999;
var orgObj = document.getElementById("org");
if(null != orgObj) {
orgId = orgObj.value;
}
var gnatsNumber = document.getElementsByName("gnatsNumber");
var selectedProblemId = document.getElementById("selectedProblemId").value;
if(gnatsNumber.length > 0){
if(null == selectedProblemId || trim(selectedProblemId).length == 0){
formObj.action=url + "?method=getAllPrsBulkUpdateAction&removeSession="+"Y"+"&orgId="+orgId+"&selectAllPrs="+"Y"+"&bulkChoice="+bulkChoice;
}else{
formObj.action=url + "?method=getAllPrsBulkUpdateAction&removeSession="+"Y"+"&orgId="+orgId+"&selectAllPrs="+"N"+"&bulkChoice="+bulkChoice;
}
}else{
alert('Atlease one PR is required to do this action.')
return;
}
resetPagination();
formObj.submit();
}
function unSelectFlagForAllPrs(formObj){
formObj.action=url + "?method=updateFlagForAllPrs";
resetPagination();
formObj.submit();
}
function getCheckedPrNumber(gnatsNumber){
var prNumbers='';
for ( var index = 0; index < gnatsNumber.length; index++) {
if(gnatsNumber[index].checked){
prNumbers = prNumbers +gnatsNumber[index].value+",";
}
}
var finalPr=prNumbers.substring(0, prNumbers.length-1);
return finalPr;
}
function updatePBNState(formObj){
var action = $('#workflowAction').val();
if(action == 0){
alert('Please select a valid pbn workflow action.');
return;
}
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
var selectedCount = 0;
for ( var index = 0; index < natschecks.length; index++) {
if(natschecks[index].checked){
selectedCount++;
break;
}
}
if(selectedCount == 0){
alert('Please select a PR for changing the PBN state.')
return
}
document.getElementById("selectedProblemId").value ='';
}
showSplashScreen();
resetForRowDelete();
formObj.action=url + '?method=updatePBNStatus';
formObj.submit();
}
function updatePRState(formObj) {
var action = $('#workflowAction').val();
if(action == 0){
alert('Please select a valid workflow action.');
return;
}
if('CreatePbn' == action){
var prNumber;
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
var selectedCount = 0;
var selectedObj = null;
for ( var index = 0; index < natschecks.length; index++) {
if(natschecks[index].checked){
selectedCount++;
selectedObj = natschecks[index];
}
}
}
if(selectedCount != 1){
alert('Please select one PR for creating PBN.')
return
} else {
var prObjs = document.getElementsByName("gnatsNumber");
for ( var vindex = 0; vindex < prObjs.length; vindex++) {
if(prObjs[vindex].checked) {
prNumber = prObjs[vindex].value;
}
}
}
var params = {gnatsNumber : prNumber,method : 'checkUserPBNPermissions'};
$.post(url, params, function(data){
if(data == 'false'){
if(confirm("You do not have the necessary permissions to 'Create a PBN'")) {
return;
}
} else if (data == 'PBNStateError') {
alert("PBN can be created only for 'Debating' or 'Published' PRs.")
return;
}else {
createPBN();
}
});
} else {
var currentNav = document.getElementById("currPageTemp").value;
if(checkPRSelection(formObj)){
showSplashScreen();
document.getElementById("selectedProblemId").value ='';
/* DWR */
var issueData = getProblemReportIssueData();
issueData.workflowAction = action;
/* DWR */
var prNos = "";
var addSprcificPr= new Array();
var prObjs = document.getElementsByName("gnatsNumber");
for ( var vindex = 0; vindex < prObjs.length; vindex++) {
if(prObjs[vindex].checked) {
var prValue = prObjs[vindex].value;
var manualPr = document.getElementById("star_"+prValue).value;
if(null != manualPr && jQuery.trim(manualPr)!= '' && jQuery.trim(manualPr)== 'true') {
addSprcificPr.push(prValue);
} else {
prNos = prNos+","+prValue;
}
}
}
var deleteRows = true;
if(null!= currentNav && ('piir_hs' == currentNav)) {
deleteRows = false;
issueData.piirReportId = document.getElementById("piirReportId").value;
issueData.piirReportType = document.getElementById("piirReportType").value;
var reportType = document.getElementById("piirReportEnumType")
if(reportType) {
issueData.piirReportEnumType = reportType.value;
}
} else if(null!= currentNav && ('watch' == currentNav)) {
deleteRows = false;
} else if(null!= currentNav && ('pbn' == currentNav)) {
deleteRows = false;
} else if(null!= currentNav && ('pr_filter' == currentNav)) {
deleteRows = false;
issueData.filterId=document.getElementById("filterId").value;
} else {
// #TODO 1128 recheck this
if (currentNav == 'clean') {
if(action == 'NEW' || action == 'UPDATED' || action == 'PENDING' || action == 'RECLEANSE') {
deleteRows = false;
}
} else if (currentNav == 'approve') {
if(action == 'CLEANED' || action == 'UPDATED_CLEAN' || action == 'UPDATED_APPROVE') {
deleteRows = false;
}
}
if(prNos =='' && addSprcificPr.length > 0) {
deleteRows = false;
}
}
/*DWR*/
issueData.deleteRows= deleteRows;
issueData.gnatsNumber = prNos;
issueData.addSprcificPr = addSprcificPr.toString();;
changeCiatStatusDwr(issueData);
/* DWR */
}
//}
}
}
function unCheckAllCheckBoxes(){
var natschecks = document.getElementsByName("gnatsNumber");
if(natschecks){
for ( var index = 0; index < natschecks.length; index++) {
natschecks[index].checked = false;
}
}
}
/**
*
* @param issueData
* @return
*/
function changeCiatStatusDwr(issueData){
var currentNav = issueData.currentNav;
if(currentNav == 'clean'){
cleanPrController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
} else if(currentNav == 'approve'){
approvePrController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
} else if(currentNav == 'watch'){
watchListController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
} else if(currentNav == 'pbn'){
pbnPrController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
} else if(currentNav == 'piir_hs'){
PIIRHSReportController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
} else if(currentNav == 'pr_filter'){
viewPRFilterController.updatePrStateDwr(issueData,{callback: updateCiatStatusCallBack});
}
}
function updateCiatStatusCallBack(issueData) {
hideSplashScreen();
unCheckAllCheckBoxes();
var rowList = issueData.issueList;
if(null != rowList && rowList.length > 0){
appendNewRow(rowList);
}
var deleteRows = issueData.deleteRows;
var currentTabIndex = document.getElementById("currentTabIndex").value;
var addSpecificPrNumbers = issueData.addSpecificPrNumbers;
if(deleteRows == 'false' && currentTabIndex == 0) {
changeCiatStatusPagination(issueData);
if(null != addSpecificPrNumbers && addSpecificPrNumbers.length > 0) {
updateManualPrDataDwr(addSpecificPrNumbers,issueData);
}
}
var pageCount = document.getElementById("pageCount").value;
if(null != pageCount && -1 != pageCount && deleteRows == 'true') {
if(0 == currentTabIndex){
if(null != addSpecificPrNumbers && addSpecificPrNumbers.length > 0) {
updateManualPrDataDwr(addSpecificPrNumbers,issueData);
}
}
/*remove the successfully updated rows from the table*/
deleteUpdatedTableRows(issueData);
updatePaginationData(issueData);
updatePaginationControls(issueData);
} else if (null != pageCount && -1 == pageCount && deleteRows == 'true'){
/**This section is getting executed in the case of view all*/
if(0 == currentTabIndex){
if(null != addSpecificPrNumbers && addSpecificPrNumbers.length > 0) {
updateManualPrDataDwr(addSpecificPrNumbers,issueData);
}
}
document.getElementById("currentIssueCount").value = issueData.currentListSize;
document.getElementById("pageCountText").value = issueData.currentListSize;
deleteUpdatedTableRows(issueData);
}
reSizeFrame();
var failedPrMessage = issueData.failedPrMessage;
if(null != failedPrMessage) {
var message = jQuery.trim(failedPrMessage) ;
if(message != '' ) {
alert(message);
}
}
if("pr_filter" == issueData.currentNav) {
var filterForm = document.getElementById("pr_filterPrForm");
filterForm.action="pr-filter-result";
resetPagination();
filterForm.submit();
}
}
function updateManualPrDataDwr(addSprcificPr,issueData) {
var action = issueData.workflowAction;
var currentUserName = issueData.modifiedUserName;
var todaysDate = issueData.modifiedDate;
var status = '';
if(action == 'NEW') {
status = 'New';
} else if (action == 'PENDING') {
status = 'Pending';
} else if(action == 'RECLEANSE') {
status = "Recleanse";
} else if(action == 'CLEANED') {
status = "Cleaned";
} else if(action == 'APPROVED') {
status = "Approved";
}
if(addSprcificPr.length > 0) {
var failedPrs = issueData.failedAddSpecificPrs;
for(var index = 0; index<addSprcificPr.length;index++) {
var key = addSprcificPr[index];
if(jQuery.inArray(key, failedPrs)== -1) {
var anchor= '<a href="javascript:noOperation();" onclick="fnShowPrStateTransition('+key+');">';
document.getElementById("status_"+key).innerHTML = anchor+status+'</a>';
document.getElementById("lastUpdatedBy"+key).innerHTML = currentUserName;
document.getElementById("lastUpdatedOn_"+key).innerHTML = todaysDate;
}
}
}
}
function changeCiatStatusPagination(issueData) {
var currentNav =document.getElementById("currPageTemp").value;
var action = issueData.workflowAction;
var prs = issueData.gnatsNumber;
var currentUserName = issueData.modifiedUserName;
var todaysDate = issueData.modifiedDate;
var failedPrArray = issueData.failedPrList;
var status = '';
if(action == 'NEW') {
status = 'New';
} else if (action == 'PENDING') {
status = 'Pending';
} else if(action == 'RECLEANSE') {
status = "Recleanse";
} else if(action == 'CLEANED') {
status = "Cleaned";
} else if(action == 'APPROVED') {
status = "Approved";
}
if(null != prs) {
for ( var index = 0; index < prs.length; index++) {
var key = prs[index];
if(key != '') {
if(!failedPrArray.contains(key)) {
var anchor= '<a href="javascript:noOperation();" onclick="fnShowPrStateTransition('+key+');">';
document.getElementById("status_"+key).innerHTML = anchor+status+'</a>';
document.getElementById("lastUpdatedBy"+key).innerHTML = currentUserName;
document.getElementById("lastUpdatedOn_"+key).innerHTML = todaysDate;
}
if(!failedPrArray.contains(key) && currentNav == 'piir_hs' && issueData.excludeHsScreen == true) {
var colorChangeRow = document.getElementById(key);
if(colorChangeRow) {
colorChangeRow.removeAttribute('class');
colorChangeRow.style.backgroundColor='#FFF68F';
colorChangeRow.title = 'BCF/GNATS fields for this PR has been updated post the exclusion from this PIIR report.';
}
}
}
}
}
}
function trim(s) {
while (s.substring(0,1) == ' ') {
s = s.substring(1,s.length);
}
while (s.substring(s.length-1,s.length) == ' ') {
s = s.substring(0,s.length-1);
}
return s;
}
// checks numeric.
function isNumeric(sText) {
if(trim(sText)=='') {
alert("Please enter a number greater than zero.");
return false;
}
var pageCount = parseInt(sText, 10)
if(0 == pageCount){
alert("Please enter a number greater than zero.");
return false;
}
return true;
}
function clearBCFTab(){
var currentTabIndex = document.getElementById("currentTabIndex").value;
var currentDiv = null;
if(0 == currentTabIndex){
currentDiv = document.getElementById("stateDiv");
}else if(1 == currentTabIndex){
currentDiv = document.getElementById("originalInfoDiv");
}else if(2 == currentTabIndex){
currentDiv = document.getElementById("categoryDiv");
}else if(3 == currentTabIndex){
currentDiv = document.getElementById("versionDiv");
}else if(4 == currentTabIndex){
currentDiv = document.getElementById("advSvcsFieldsDiv");
}else if(5 == currentTabIndex){
currentDiv = document.getElementById("customerSpecificDiv");
}else if(6 == currentTabIndex){
currentDiv = document.getElementById("overviewPiirDiv");
}else if(7 == currentTabIndex){
currentDiv = document.getElementById("hackSlashDiv");
}
if(null != currentDiv){
if(currentDiv.childNodes){
while (currentDiv.childNodes[0]){
currentDiv.removeChild(currentDiv.childNodes[0]);
}
}
}
}
// on document ready this function will be called to prepare the page.
function prepareBCFTables() {
var currentTabIndex = document.getElementById("currentTabIndex").value;
prepareJQueryTab(currentTabIndex);
hideSplashScreen();
/*
* Commented for removing the scrollable table if(0 == currentTabIndex){
* prepareScrollableTable('stateTableId'); }else if(1 == currentTabIndex){
* prepareScrollableTable('originalInfoTableId'); }else if(2 ==
* currentTabIndex){ prepareScrollableTable('categoryTableId'); }else if(3 ==
* currentTabIndex){ prepareScrollableTable('versionTableId'); }else if(4 ==
* currentTabIndex){ prepareScrollableTable('advSvcsFieldsTableId'); }else
* if(5 == currentTabIndex){
* prepareScrollableTable('customerSpecificTableId'); }
*/
/** Added after removing the scrollable table */
if(0 == currentTabIndex){
reSizeIFrameHeight('stateTableId');
}else if(1 == currentTabIndex){
reSizeIFrameHeight('originalInfoTableId');
}else if(2 == currentTabIndex){
reSizeIFrameHeight('categoryTableId');
}else if(3 == currentTabIndex){
reSizeIFrameHeight('versionTableId');
}else if(4 == currentTabIndex){
reSizeIFrameHeight('advSvcsFieldsTableId');
}else if(5 == currentTabIndex){
reSizeIFrameHeight('customerSpecificTableId');
}else if(6 == currentTabIndex){
reSizeIFrameHeight('overviewPiirTableId');
}else if(7 == currentTabIndex){
reSizeIFrameHeight('hackSlashTableId');
}
if(null != document.pirPiirResultForm && document.pirPiirResultForm != 'undefined') {
selectProblemReport();
}
}
/**Added after removing the scrollable table start*/
function reSizeIframeToNormal(currentTabIndex){
if(0 == currentTabIndex){
setDefaultIFrameHeight('stateTableId');
}else if(1 == currentTabIndex){
setDefaultIFrameHeight('originalInfoTableId');
}else if(2 == currentTabIndex){
setDefaultIFrameHeight('categoryTableId');
}else if(3 == currentTabIndex){
setDefaultIFrameHeight('versionTableId');
}else if(4 == currentTabIndex){
setDefaultIFrameHeight('advSvcsFieldsTableId');
}else if(5 == currentTabIndex){
setDefaultIFrameHeight('customerSpecificTableId');
}else if(6 == currentTabIndex){
setDefaultIFrameHeight('overviewPiirTableId');
}else if(7 == currentTabIndex){
setDefaultIFrameHeight('hackSlashTableId');
}
}
function setDefaultIFrameHeight() {
var currentNav = document.getElementById("currPageTemp").value;
var frameId ;
if(currentNav == 'screen') {
frameId = parent.document.getElementById("screenPrPage");
} else if(currentNav == 'clean') {
frameId = parent.document.getElementById("cleanPrPage");
} else if(currentNav == 'approve') {
frameId = parent.document.getElementById("approvePrPage");
} else if(currentNav == 'watch') {
frameId = parent.document.getElementById("watchListPage");
} else if(currentNav == 'Piir' || currentNav == 'piir_refresh' || currentNav == 'piir_wip') {
frameId = parent.document.getElementById("PIRPage");
} else if(currentNav == 'pbn') {
frameId = parent.document.getElementById("PBNPage");
} else if (currentNav == 'piir_hs') {
frameId = parent.document.getElementById("CreatePIRPage");
}
if(null != frameId) {
frameId.height = 1260+'px';
}
}
function reSizeIFrameHeight(tableId) {
var tableHeight = document.getElementById(tableId).offsetHeight;
var currentNav = document.getElementById("currPageTemp").value;
var frameId ;
if(currentNav == 'screen') {
frameId = parent.document.getElementById("screenPrPage");
} else if(currentNav == 'clean') {
frameId = parent.document.getElementById("cleanPrPage");
} else if(currentNav == 'approve') {
frameId = parent.document.getElementById("approvePrPage");
} else if(currentNav == 'watch') {
frameId = parent.document.getElementById("watchListPage");
} else if(currentNav == 'Piir' || currentNav == 'piir_refresh' || currentNav == 'piir_wip') {
frameId = parent.document.getElementById("PIRPage");
} else if(currentNav == 'pbn') {
frameId = parent.document.getElementById("PBNPage");
} else if (currentNav == 'piir_hs') {
frameId = parent.document.getElementById("CreatePIRPage");
}
var newHeight = parseInt(tableHeight)+300;
if(newHeight < 1260){
newHeight = 1260;
}
if(null != frameId) {
frameId.height = newHeight+'px';
}
}
/**Added after removing the scrollable table end*/
function prepareJQueryTab(currentTabIndex){
$.ajaxSetup({ cache: false });// This Fix is for IE
// prepares the jquery tab.
$("#container-1 > ul").tabs({
cookie: null,
select: function(event) {
processSelectedTab(event.options.selected);
},
selected : currentTabIndex,
cache: false
});
}
function processSelectedTab(index){
/** Added after removing the scrollable table start*/
reSizeIframeToNormal(index);
/** Added after removing the scrollable table end */
if(0 == index){
processStateTab();
}else if(1 == index){
processOrgInfoTab();
}else if(2 == index){
processCategoryTab();
}else if(3== index){
processVersionTab();
}else if(4 == index){
processAdvSvcsFieldsTab();
}else if(5 == index){
processCustomerSpecificTab();
}else if(6 == index){
processOverviewPiirTab();
}else if(7 == index){
processHackSlashTab();
}
}
function getProblemReportParams(actionName, currentTabIndex){
/*var gnatsNumber = document.getElementsByName("gnatsNumber");
var selectedCount =0;
var chkdPrNumberList=getCheckedPrNumber(gnatsNumber);*/
var previousPage = document.getElementById("currentPreviousPage").value;
var nextPage = document.getElementById("currentNextPage").value;
var maxRow = document.getElementById("currentMaxRow").value;
var startIdx = document.getElementById("currentStartIdx").value;
var sortBy = document.getElementById("currentSortBy").value;
var sortDirection = document.getElementById("currentSortDirection").value;
var pageCount = $("#pageCount").val();
var params = {pageCount: pageCount, method: actionName,
sortBy : sortBy, sortDirection : sortDirection,
currentTabIndex : currentTabIndex,
previousPage : previousPage, startIdx : startIdx,
nextPage : nextPage, maxRow : maxRow};
var currentNav=document.getElementById("currPageTemp");
if(null != currentNav && currentNav.value == 'pbn'){
params.publishedChecked = document.getElementById("publishedChecked").value;
params.debatingChecked = document.getElementById("debatingChecked").value;
params.pendingChecked = document.getElementById("pendingChecked").value;
params.rejectedChecked = document.getElementById("rejectedChecked").value;
params.candidateChecked = document.getElementById("candidateChecked").value;
params.searchPbnState = document.getElementById("searchPbnState").value;
}
if(null != currentNav && currentNav.value == 'piir_hs'){
params.piirReportId = document.getElementById("piirReportId").value;
params.piirReportType = document.getElementById("piirReportType").value;
var reportType = document.getElementById("piirReportEnumType")
if(reportType) {
params.piirReportEnumType = reportType.value;
}
}
if(null != currentNav && currentNav.value == 'pr_filter'){
params.filterId = document.getElementById("filterId").value;
}
if(null != document.pirPiirResultForm && document.pirPiirResultForm != 'undefined') {
params.fromDate = document.getElementById("fromDate").value;
params.endDate = document.getElementById("endDate").value;
params.org = document.getElementById("org").value;
params.deviceOption = document.getElementById("deviceOption").value;
params.siteId = document.getElementById("siteId").value;
params.specificPRs = document.getElementById("specificPRs").value;
params.savedSearchId = document.getElementById("savedSearchId").value;
params.displayUpdatedPrs = document.getElementById("displayUpdatedPrs").value;
params.excludedPrs = document.getElementById("excludedPrs").value;
params.searchName = document.getElementById("savedSearchName").value;
params.showAllChecked = document.getElementById("showAllChecked").value;
}
params.prStatus = document.getElementById("prStatus").value;
params.gnatsConfidential = document.getElementById("gnatsConfidential").value;
params.pbnStateFilter = document.getElementById("pbnStateFilter").value;
params.bcfProduct = document.getElementById("bcfProduct").value;
params.bcfPlatform = document.getElementById("bcfPlatform").value;
params.gnatsProduct = document.getElementById("gnatsProduct").value;
params.gnatsPlatform = document.getElementById("gnatsPlatform").value;
params.bcfOsProduct = document.getElementById("bcfOsProduct").value;
params.gnatsWorkaroundProvided = document.getElementById("gnatsWorkaroundProvided").value;
params.gnatsClass = document.getElementById("gnatsClass").value;
params.submitterId = document.getElementById("submitterId").value;
params.gnatsCategory = document.getElementById("gnatsCategory").value;
params.gnatsCategoryText = document.getElementById("gnatsCategoryText").value;
params.submitterIdText = document.getElementById("submitterIdText").value;
params.gnatsProblemLevelText = document.getElementById("gnatsProblemLevelText").value;
params.gnatsClassText = document.getElementById("gnatsClassText").value;
params.synopsisHeadline = document.getElementById("synopsisHeadline").value;
params.rootCause = document.getElementById("rootCause").value;
params.resolvedIn = document.getElementById("resolvedIn").value;
params.releaseNote = document.getElementById("releaseNote").value;
params.externalTitle = document.getElementById("externalTitle").value;
params.externalDescription = document.getElementById("externalDescription").value;
params.externalTrigger = document.getElementById("externalTrigger").value;
params.gnatsWorkaround = document.getElementById("gnatsWorkaround").value;
params.engineeringFixDetails = document.getElementById("engineeringFixDetails").value;
params.serviceRestoration = document.getElementById("serviceRestoration").value;
params.comments = document.getElementById("comments").value;
params.prNumber = document.getElementById("prNumber").value;
params.bcfOwner = document.getElementById("bcfOwner").value;
params.pbnOwner = document.getElementById("pbnOwner").value;
params.customerRecommendation = document.getElementById("customerRecommendation").value;
params.excludeReason = document.getElementById("excludeReason").value;
params.internalNotes = document.getElementById("internalNotes").value;
params.customerImpact = document.getElementById("customerImpact").value;
params.impactProbability = document.getElementById("impactProbability").value;
params.gnatsCustomer = document.getElementById("gnatsCustomer").value;
params.selectedProblemId = document.getElementById("selectedProblemId").value;
params.gnatsUrl = document.getElementById("gnatsUrl").value;
params.crmCaseUrl = document.getElementById("crmCaseUrl").value;
params.gnatsProblemLevel = document.getElementById("gnatsProblemLevel").value;
params.bcfScore = document.getElementById("bcfScore").value;
params.scoreSign = document.getElementById("scoreSign").value;
params.gnatsArrivalDate = document.getElementById("gnatsArrivalDate").value;
params.filterQuery = document.getElementById("filterQuery").value;
if(document.getElementById("analysis")){
params.analysis = document.getElementById("analysis").value;
}
if(document.getElementById("sirtState")){
params.sirtState = document.getElementById("sirtState").value;
}
if(document.getElementById("sirtStateText")){
params.sirtStateText = document.getElementById("sirtStateText").value;
}
if(document.getElementById("prStateText")){
params.prStateText = document.getElementById("prStateText").value;
}
if(document.getElementById("gnatsAttributesFilter")){
params.gnatsAttributesFilter = document.getElementById("gnatsAttributesFilter").value;
}
params.gnatsState=document.getElementById('gnatsState').value;
params.gnatsRelease=document.getElementById('gnatsRelease').value;
return params;
}
function getPaginationUrl(){
var startIdx = document.getElementById("currentStartIdx").value;
var nextPage = document.getElementById("currentNextPage").value;
var previousPage = document.getElementById("currentPreviousPage").value;
return url+"?page.startIdx="+startIdx+"&page.next="+nextPage+"&page.previous="+previousPage;
}
function processStateTab(){
var params = getProblemReportParams('viewState', 0);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 0;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processOrgInfoTab(){
var params = getProblemReportParams('viewOriginalInformation', 1);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 1;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processCategoryTab(){
var params = getProblemReportParams('viewCategory', 2);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 2;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processVersionTab(){
var params = getProblemReportParams('viewVersion', 3);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 3;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processAdvSvcsFieldsTab() {
var params = getProblemReportParams('viewAdvSvcsFields', 4);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 4;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processCustomerSpecificTab(){
var params = getProblemReportParams('viewCustomerSpecific', 5);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 5;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processOverviewPiirTab(){
var params = getProblemReportParams('viewOverviewPiir', 6);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 6;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
function processHackSlashTab(){
var params = getProblemReportParams('viewHackSlash', 7);
params.samePage = true;
showSplashScreen();
clearBCFTab();
document.getElementById("currentTabIndex").value = 7;
$('#fragmentInfo').load(getPaginationUrl(), params, function(){
prepareBCFTables();
});
}
//creates the scrollable table.
function prepareScrollableTable(tbid) {
var ua = $.browser;
var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
var geckoVer = parseInt(ua.version,10);
if((is_chrome == true )||(ua.mozilla && geckoVer >= 2)) {
//if it is ie or mozilla which is less than versioon for, then dot do any thing
} else {
var tableObj = document.getElementById(tbid);
var tableDiv = tableObj.parentNode;
tableDiv.style.height = '650px';
if(ua.mozilla && geckoVer < 2){
tableDiv.style.overflow = 'hidden';
var tbodyObj = tableObj.tBodies[0];
tbodyObj.style.height = '600px';
// to improve the performance of page loading scrollHeight and
// clientHeight comparison will happen if the row count is more than
// 100
var currentListSizeObj = document.getElementById("currentListSize");
if(currentListSizeObj){
var currentListSize = currentListSizeObj.value;
if(currentListSize < 100){
if(tbodyObj.scrollHeight <= tbodyObj.clientHeight){
tbodyObj.style.removeProperty("height");
}
}
} else{
if(tbodyObj.scrollHeight <= tbodyObj.clientHeight){
tbodyObj.style.removeProperty("height");
}
}
}
//ScrollableTable(document.getElementById(tbid), 45,2);
}
}
function displayAllProblems(){
//showSplashScreen();
document.getElementById("pageCount").value = -1;
var currentTabIndex = document.getElementById("currentTabIndex").value;
var params = getProblemReportParams('displayAllProblems', currentTabIndex);
showSplashScreen();
$('#fragmentInfo').load(url, params, function(){
prepareBCFTables();
var currentListSize = document.getElementById("currentListSize").value
document.getElementById("pageCountText").value = currentListSize;
hidePaginationInfo();
});
clearBCFTab();
}
function hidePaginationInfo(){
/*document.getElementById("previousButton").style.visibility = "hidden";
document.getElementById("nextButton").style.visibility = "hidden";
document.getElementById("displayIdxStrSpan").style.visibility = "hidden";*/
}
function fnResetPbnStateSearch() {
var publishedChecked = document.getElementById("publishedChecked").value;
var debatingChecked = document.getElementById("debatingChecked").value;
var pendingChecked = document.getElementById("pendingChecked").value;
var rejectedChecked = document.getElementById("rejectedChecked").value;
var candidateChecked = document.getElementById("candidateChecked").value;
if(candidateChecked == 'CANDIDATE'){
$('#candidateCheck').attr('checked',true);
checkUncheckPbnStateSearch('candidateCheck');
}
if(rejectedChecked == 'REJECTED'){
$('#rejectedCheck').attr('checked',true);
checkUncheckPbnStateSearch('rejectedCheck');
}
if(debatingChecked == 'DEBATING'){
$('#debatingCheck').attr('checked',true);
checkUncheckPbnStateSearch('debatingCheck');
}
if(pendingChecked == 'PENDING'){
$('#pendingCheck').attr('checked',true);
checkUncheckPbnStateSearch('pendingCheck');
}
if(publishedChecked == 'PUBLISHED'){
$('#publishedCheck').attr('checked',true);
checkUncheckPbnStateSearch('publishedCheck');
}
}
function updatePageSize() {
var sText=document.getElementById("pageCountText");
var pageCount = sText.value;
if(isNumeric(pageCount)){
showSplashScreen();
var obj = document.getElementById("currPageTemp");
if(null != obj ){
if(obj.value=='pbn'){
fnResetPbnStateSearch();
}
}
document.getElementById("pageCount").value = parseInt(pageCount, 10);
resetPagination();
var currentTabIndex = document.getElementById("currentTabIndex").value;
/** Added after removing the scrollable table start */
reSizeIframeToNormal(currentTabIndex)
/** Added after removing the scrollable table end */
var params = getProblemReportParams('updatePageSize', currentTabIndex);
$('#fragmentInfo').load(url, params, function(){
prepareBCFTables();
setPaginationInfo();
setPaginationSpan();
});
clearBCFTab();
}
}
function processKey(e) {
if (null == e) {
e = window.event ;
}
if (e.keyCode == 13) {
document.getElementById("update").click();
return false;
}
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode;
if(charCode == 13){
return true;
}
if (charCode > 31 && (charCode < 48 || charCode > 57)){
return false;
}
return true;
}
function setPaginationSpan(){
var displayIdxStr = document.getElementById("currentDisplayIdxStr").value;
var issueCount = document.getElementById("currentIssueCount").value;
var paginationStr = '<b> '+displayIdxStr+' of '+ issueCount+'</b>';
var displayIdxStrSpan = document.getElementById("displayIdxStrSpan");
displayIdxStrSpan.innerHTML = paginationStr;
if('' == displayIdxStr){
displayIdxStrSpan.style.visibility = "hidden";
}else{
displayIdxStrSpan.style.visibility = "visible";
}
/*var previousPage = document.getElementById("currentPreviousPage").value;
if('true' == previousPage){
document.getElementById("previousButton").style.visibility = "visible";
}else{
document.getElementById("previousButton").style.visibility = "hidden";
}
var nextPage = document.getElementById("currentNextPage").value;
if('true' == nextPage){
document.getElementById("nextButton").style.visibility = "visible";
}else{
document.getElementById("nextButton").style.visibility = "hidden";
}*/
}
function setPaginationInfo(){
var previousPage = document.getElementById("currentPreviousPage").value;
var nextPage = document.getElementById("currentNextPage").value;
var displayIdxStr = document.getElementById("currentDisplayIdxStr").value;
setValue("page.startIdx", 0);
setValue("page.displayIdxStr", displayIdxStr);
setValue("page.next", nextPage);
setValue("page.previous", previousPage);
}
function sortProblemReports(sortDir, column){
if(column == 'undefined') {
return false;
}
//Added to block the analysis sorting after view all is clicked start
if(column == 'pi.analysis' ) {
var pagecount = Number(new String(document.getElementById("pageCount").value));
var totalRows = Number(new String(document.getElementById("page.totalRowCnt").value));
if( (pagecount==totalRows) && totalRows > 999) {
alert("Sorting on the basis of 'Analysis' coulmn is restricted when the no of recods in the PIIR report exceeds 999 and 'View All' action is active");
return false;
}
}
//Added to block the analysis sorting after view all is clicked end
// if the current direction is asc, then next is desc and vice versa.
if(sortDir == 'ASC') {
sortDir = 'DESC';
} else if(sortDir == 'DESC') {
sortDir = 'ASC';
} else {
sortDir = 'ASC';
}
showSplashScreen();
document.getElementById("currentSortDirection").value = sortDir;
document.getElementById("currentSortBy").value = column;
var currentTabIndex = document.getElementById("currentTabIndex").value;
var params = getProblemReportParams('sortProblemReports', currentTabIndex);
$('#fragmentInfo').load(url, params, function(){
prepareBCFTables();
});
clearBCFTab();
}
function watchProblemReport(sChkId, gnatsNumber) {
var checked = false;
if(sChkId == 'on') {
checked = false;
} else {
checked = true;
}
showSplashScreen();
var currentTabIndex = document.getElementById("currentTabIndex").value;
if(url=='watchlist') {
var prNumberObj = document.getElementById("prNumber");
if(prNumberObj){
var prNumber = jQuery.trim(prNumberObj.value);
if(prNumber.length != 0){
//formObj.prNumber.value = prNumber;
var params = getProblemReportParams('watchProblemReport', currentTabIndex);
params.watchProblem = checked;
params.gnatsNumber = gnatsNumber;
$('#fragmentInfo').load(url, params, function(){
prepareBCFTables();
setPaginationSpan();
var pageCount = document.getElementById("pageCount");
if(-1 == pageCount.value){
document.getElementById("pageCountText").value = document.getElementById("currentListSize").value;
}
});
clearBCFTab();
} else {
//updateWatchList(checked,gnatsNumber);
dwrUpdateWatchList(checked,gnatsNumber);
}
}
} else {
var params = {watchProblem : checked, gnatsNumber : gnatsNumber,
method : 'watchProblemReport'};
$.post(url, params, function(data){
var currentTabIndex = document.getElementById("currentTabIndex").value;
var tabsArray = ['state', 'originalInfo', 'category', 'version','advSvcsFields','customerSpecific','overviewPiir','hackSlash'];
var onFlag = document.getElementById(tabsArray[currentTabIndex]+"_watch_on_"+gnatsNumber);
var offFlag = document.getElementById(tabsArray[currentTabIndex]+"_watch_off_"+gnatsNumber);
if('true' == data){
onFlag.style.display = 'block';
offFlag.style.display = 'none';
}else{
onFlag.style.display = 'none';
offFlag.style.display = 'block';
}
hideSplashScreen();
});
}
}
function checkUncheckFlag(sChkId, gnatsNumber) {
var checked = false;
if(sChkId == 'on') {
checked = false;
} else {
checked = true;
}
var currentTabIndex = document.getElementById("currentTabIndex").value;
showSplashScreen();
var params = {flagProblem : checked, gnatsNumber : gnatsNumber,
method : 'flagProblemReport'};
$.post(url, params, function(data) {
var tabsArray = ['state', 'originalInfo', 'category', 'version','advSvcsFields','customerSpecific','overviewPiir','hackSlash'];
var onFlag = document.getElementById(tabsArray[currentTabIndex]+"_flag_on_"+gnatsNumber);
var offFlag = document.getElementById(tabsArray[currentTabIndex]+"_flag_off_"+gnatsNumber);
if('true' == data){
onFlag.style.display = 'block';
offFlag.style.display = 'none';
}else{
onFlag.style.display = 'none';
offFlag.style.display = 'block';
}
hideSplashScreen();
});
}
function markPbnOwner(gnatsNumber, loginUser) {
var currentTabIndex = document.getElementById("currentTabIndex").value;
showSplashScreen();
var params = {pbnOwnProblem : true, gnatsNumber : gnatsNumber,
method : 'updateProblemReportPBNOwner'};
$.post(url, params, function(data) {
var tabsArray = ['state', 'originalInfo', 'category', 'version','advSvcsFields', 'customerSpecific','overviewPiir','hackSlash'];
var onFlag = document.getElementById(tabsArray[currentTabIndex]+"_pbn_own_on_"+gnatsNumber);
var offFlag = document.getElementById(tabsArray[currentTabIndex]+"_pbn_own_off_"+gnatsNumber);
if('true' == data){
var pbnOwnerSpan = document.getElementById('pbnOwner'+gnatsNumber);
if(pbnOwnerSpan){
pbnOwnerSpan.innerHTML=loginUser;
}
onFlag.style.display = 'block';
offFlag.style.display = 'none';
}else{
onFlag.style.display = 'none';
offFlag.style.display = 'block';
}
hideSplashScreen();
});
}
function updatePbnStatus(gnatsNum, id) {
var checkboxId = "pbn"+gnatsNum;
var pbnStatus;
if($('#'+checkboxId+'').is(':checked')) {
pbnStatus = "Y";
} else {
pbnStatus = "N";
}
var params = {pbnStatus : pbnStatus, gnatsNumber : gnatsNum,
method : 'updatePbnStatus'};
$.post(url, params, function(data) {
if('success' != data){
alert("Updating the PBN status failed");
}
});
}
function checkUncheckTick(gnatsNumber) {
var currentTabIndex = document.getElementById("currentTabIndex").value;
showSplashScreen();
var params = {ownProblem : true, gnatsNumber : gnatsNumber,
method : 'updateProblemReportOwner'};
$.post(url, params, function(data) {
var tabsArray = ['state', 'originalInfo', 'category', 'version','advSvcsFields', 'customerSpecific','overviewPiir','hackSlash'];
var onFlag = document.getElementById(tabsArray[currentTabIndex]+"_own_on_"+gnatsNumber);
var offFlag = document.getElementById(tabsArray[currentTabIndex]+"_own_off_"+gnatsNumber);
if('true' == data){
onFlag.style.display = 'block';
offFlag.style.display = 'none';
}else{
onFlag.style.display = 'none';
offFlag.style.display = 'block';
}
hideSplashScreen();
});
}
function submitPrDetailForm() {
var currentNav = document.getElementById("currentPageId").value;
var editableComboboxes = ['gnatsProductsSelectField','gnatsPlatformSelectField','ciatProductFieldId','ciatPlatformFieldId','bcfStatusSelectField','pbnStatusSelectField'];
for(var index1 = 0; index1 < editableComboboxes.length; index1++) {
$("#"+editableComboboxes[index1]+"").removeAttr('disabled');
}
if(null != currentNav && currentNav != 'Piir') {
document.getElementById("editableCustRec").style.display = 'none';
document.getElementById("editableInternalNotes").style.display = 'none';
document.getElementById("editableExcludeReason").style.display = 'none';
}
document.prDetailForm.submit();
}
function openCustRecommendation(key) {
document.getElementById("customerRecommendationDiv").style.display = 'block';
document.getElementById("record").style.display = 'none';
var customerRecoUrl = '${contextPath}/app/ajaxBCFShowCustomerRecommendations.html?prId='+key;
$('#customerRecomendationTblDiv').load(customerRecoUrl, function(){
});
// parent.tb_show('View Customer Recommendations',
// 'ajaxBCFShowCustomerRecommendations.html?prId='+key+'&KeepThis=true&TB_iframe=true&height='+500+'&width='+1000,
// null);
}
function disableSelectBox() {
$('.inactiveSelectField').attr('disabled', 'true');
}
function enableCategoryCondition(conditionName){
var elements = document.getElementsByName(conditionName);
if(elements){
for ( var index = 0; index < elements.length; index++) {
elements[index].disabled = '';
}
}
}
function showBcfEditable() {
var editableFields = ['editableSymptom', 'editableTrigger', 'editableConfigCtgry','editableCustRec','editableBcfFixedInDiv',
'editablefixedInAdd','editableComments', 'editableInternalNotes', 'editableExcludeReason',
'editableBcfAffVersionAdd', 'editableVerCategory', 'editableFruCategory', 'editableVerCategoryAdd',
'editableFruCategoryAdd', 'editableBcfSynopsisHeadline','editableBcfAffectedVersion','saveBtnNew',
'editableBcfRootCauseAnalysis','editableBcfEngineeringFixDetails','editableBcfWorkAround','ciatReferPriorRecommHidden','editableReleaseNotes'];
for ( var index = 0; index < editableFields.length; index++) {
var docObj = document.getElementById(editableFields[index]);
if(null != docObj) {
docObj.style.display = 'block';
}
}
enableCategoryCondition('hardwareCondition');
enableCategoryCondition('versionCondition');
enableCategoryCondition('productCondition');
enableCategoryCondition('platformCondition');
enableCategoryCondition('configCatOperation');
// make bcf product/platform editable.
fnEnableForEditingProductPlatform('editableBCFPlatformAdd','bcfPlatCatTd','BCF');
fnEnableForEditingProductPlatform('editableBCFProductAdd','bcfProdCatTd','BCF');
fnEnableForEditingSelBx('bugType','bcfBugtypeEditTd','BCF');
fnHideResultTable('BCFPlatformCategoryResultTableId','ciatPlatformFieldId');
fnHideResultTable('BCFProductCategoryResultTableId','ciatProductFieldId');
// fnEnableForEditingProductPlatform('editableGnatsPlatformAdd','gnatsPlatTd');
// fnEnableForEditingProductPlatform('editableGnatsProductAdd','gnatsProdTd');
// var editableComboboxes =
// ['confidential','bcfFixedInSelectField','osPlatformSelectFieldId'];
var editableComboboxes = ['osPlatformSelectFieldId'];
for(var index1 = 0; index1 < editableComboboxes.length; index1++) {
$("#"+editableComboboxes[index1]+"").removeAttr('disabled');
$('#'+editableComboboxes[index1]+' option').css('background','none');
}
/** This is for BCF Owner*/
var prOwnerEditId = document.getElementById("prOwnerEditTd");
if(prOwnerEditId != null) {
document.getElementById('editablePrOwner').style.display = 'block';
document.getElementById('nonEditablePrOwner').style.display = 'none';
document.getElementById('prOwnerEditTd').style.display = 'none';
var ownerId = document.getElementById('prOwnerText');
if(ownerId.value != null && ownerId.value == 'Enter a name here ...') {
ownerId.value = "";
}
}
/** This is for BCF Status*/
var bcfStatusEditTdId = document.getElementById("bcfStatusEditTd");
if(bcfStatusEditTdId != null) {
$("#bcfStatusSelectField").removeAttr('disabled');
$('#bcfStatusSelectField option').css('background','none');
bcfStatusEditTdId.style.display = 'none';
}
/** This is for PBN Status*/
var bcfStatusEditTdId = document.getElementById("pbnStatusEditTd");
if(bcfStatusEditTdId != null) {
$("#pbnStatusSelectField").removeAttr('disabled');
$('#pbnStatusSelectField option').css('background','none');
bcfStatusEditTdId.style.display = 'none';
}
var editablePiirFields = ['editableCustRec','editableExcludeReason','editableInternalNotes'];
var currentNav = document.getElementById("currentPageId").value;
if(null != currentNav && currentNav != 'Piir') {
for ( var index1 = 0; index1 < editablePiirFields.length; index1++) {
document.getElementById(editablePiirFields[index1]).style.display = 'none';
}
}
if(null != currentNav && currentNav == 'Piir') {
$("#ciatCustImpactSelectField").removeAttr('disabled');
$('#ciatCustImpactSelectField option').css('background','none');
$("#ciatImpactProbSelectField").removeAttr('disabled');
$('#ciatImpactProbSelectField option').css('background','none');
}
}
function hideBcfNonEditable() {
var nonEditableFields = ['nonEditableSymptom', 'nonEditableTrigger', 'nonEditableConfigCtgry', 'nonEditableCustRec','bcfAffectedVersionTd',
'nonEditableComments', 'nonEditableInternalNotes', 'nonEditableExcludeReason',
'nonEditableVerCategory', 'nonEditableFruCategory', 'editBtn',
'nonEditableBcfSynopsisHeadline','nonEditableBcfAffectedVersion','nonEditableBcfRootCauseAnalysis',
'nonEditableBcfEngineeringFixDetails','nonEditableBcfWorkAround','bcfInternalNoteEditTd','bcfCustMpctEditTd',
'bcfOccuProbEditTd','bcfExcludeResEditTd','bcfCustRecEditTd','bcfCommEditTd','bcfRootCauseAnaTd','bcfEngiFixDetaTd',
'bcfTriggerTd','bcfSynHeadTd','bcfSymptTd','bcfWorkAroundTd','bcfPlatCatTd',
'bcfProdCatTd','bcfVersioncatTd','bcfFruCatTd','bcfConfigCatTd',
'bcffixInTd','nonEditableBcfFixedInDiv','osPlatformEditTd','bcfBugtypeEditTd','nonEditableReleaseNotes','bcfReleaseNotTd'];
for ( var index = 0; index < nonEditableFields.length; index++) {
var docObj = document.getElementById(nonEditableFields[index]);
if(null != docObj) {
docObj.style.display = 'none';
}
}
var currentNav = document.getElementById("currentPageId").value;
if(null != currentNav && currentNav != 'Piir') {
document.getElementById("nonEditableCustRec").style.display = 'block';
document.getElementById("bcfCustRecEditTd").style.display = 'none';
document.getElementById("nonEditableExcludeReason").style.display = 'block';
document.getElementById("bcfExcludeResEditTd").style.display = 'none';
document.getElementById("nonEditableInternalNotes").style.display = 'block';
document.getElementById("bcfInternalNoteEditTd").style.display = 'none';
}
}
function setChangeFlag() {
temp = document.getElementById("searchPrTrackChangesFlag");
/*
* var filterfrm = null; var currentNav =
* document.getElementById("currentPageId").value; if(currentNav !=null &&
* currentNav != '' && currentNav =='screen') { filterfrm =
* parent.document.getElementById("screenPrPage"); } else if(currentNav
* !=null && currentNav != '' && currentNav =='clean') { filterfrm =
* parent.document.getElementById("cleanPrPage"); } else if(currentNav
* !=null && currentNav != '' && currentNav =='approve') { filterfrm =
* parent.document.getElementById("approvePrPage"); } else if(currentNav
* !=null && currentNav != '' && currentNav =='watch') { filterfrm =
* parent.document.getElementById("watchListPage"); } else if (currentNav
* !=null && currentNav != '' && currentNav =='Piir') { filterfrm =
* parent.document.getElementById("PIRPage"); } else if (currentNav !=null &&
* currentNav != '' && currentNav =='pbn') { filterfrm =
* parent.document.getElementById("PBNPage"); }
*
*
* var temp; if (currentNav !=null && currentNav != '' && currentNav
* =='searchByPr') { temp =
* document.getElementById("searchPrTrackChangesFlag"); } else { //temp =
* filterfrm.contentWindow.document.getElementById("prDetailChangeFlagId"); }
*/
if(temp){
temp.value = true;
}
}
/* Method which will be called on click of "EDIT ALL BCF FIELDS" button in prdetail screen */
function prepareBcfEditView() {
setChangeFlag();
showBcfEditable();
hideBcfNonEditable();
document.getElementById("editBcf").value = "BCF";
}
/* Method which will be called on click of "EDIT GNATS FIELDS" button in pr detail screen */
function prepareGnatsEditView() {
setChangeFlag();
showGnatsEditable();
hideGnatsNonEditable();
document.getElementById("editGnats").value = "GNATS";
}
function fnShowGnatsWindow(prKey,gnatsUrl,categorization){
//prepareGnatsEditView();
var url;
var flag;
if(categorization == 'Y'){
url = gnatsUrl+prKey+"";
flag = "gnatsMain";
var newwindow = window.open(url,'_blank'+flag+prKey);
}else{
url = gnatsUrl+prKey+"/edit"
flag = "gnatsEdit";
var newwindow = window.open(url,'_blank'+flag+prKey);
newwindow.location.href=url+'#external';
}
}
function fnShowSeeInGnatsWindow(gnatsUrl,key) {
var newUrl = gnatsUrl+key+"";
var newwindow = window.open(newUrl,'_blank'+"gnatsMain"+key);
}
function fnShowCrmCaseId(crmUrl,caseId) {
var newUrl = crmUrl+caseId+"";
var newwindow = window.open(newUrl,'_blank');
}
function showGnatsEditable() {
var editableFields = ['editableReleaseNotes', 'editableWorkaround', 'editableGnatsPlatformAdd','editableGnatsProductAdd','saveBtnNew'];
for ( var index = 0; index < editableFields.length; index++) {
document.getElementById(editableFields[index]).style.display = 'block';
}
/*This code will enable the product and platform multiple select boxes for editing start*/
fnEnableForEditingProductPlatform('editableGnatsProductAdd','gnatsProdTd','GNATS');
fnEnableForEditingProductPlatform('editableGnatsPlatformAdd','gnatsPlatTd','GNATS');
fnHideResultTable('GNATSPlatformResultTableId','gnatsPlatformSelectField');
fnHideResultTable('GNATSProductResultTableId','gnatsProductsSelectField');
/*
* This code will enable the confidential select box for editing start
* $("#confidential").removeAttr('disabled'); $("#confidential
* option").css('background','none');
*
*/
}
function hideGnatsNonEditable() {
var nonEditableFields = ['nonEditableWorkaround', 'bcfGnatsWorkArndTd', 'nonEditableReleaseNotes',
'bcfReleaseNotTd','bcfConfidenTd','gnatsProdTd','gnatsPlatTd','editGnatsFieldsBtn'];
for ( var index = 0; index < nonEditableFields.length; index++) {
document.getElementById(nonEditableFields[index]).style.display = 'none';
}
}
function changeBg(id) {
$('#'+id+' option').css('background','none');
}
function fnShowHideScopeTable(totalScopes,nextPrev) {
var tempTotal = totalScopes;
var totalScoperows = Math.ceil(totalScopes/3);
if(nextPrev == 'next') {
document.getElementById(scopeRowIdArray[currentScopePage]).style.display="none";
currentScopePage = currentScopePage+1;
document.getElementById("scopePrevButtonId").style.display="block";
if(currentScopePage+1==totalScoperows) {
document.getElementById("scopeNextButtonId").style.display="none";
}
document.getElementById(scopeRowIdArray[currentScopePage]).style.display="block";
} else {
document.getElementById(scopeRowIdArray[currentScopePage]).style.display="none";
currentScopePage = currentScopePage-1;
if(currentScopePage ==0) {
document.getElementById("scopePrevButtonId").style.display="none";
if(totalScoperows > 1) {
document.getElementById("scopeNextButtonId").style.display="block";
}
}
document.getElementById(scopeRowIdArray[currentScopePage]).style.display="block";
}
}
function setEditTypeHiddenVariable(typeOfEdit) {
if(null != typeOfEdit && typeOfEdit == 'BCF') {
document.getElementById("editBcf").value = "BCF";
} else {
document.getElementById("editGnats").value = "GNATS";
}
}
function fnEnableForEditingProductPlatform(fieldToBeEnabled,fieldToBeDisabled,typeOfEdit) {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
setChangeFlag();
document.getElementById(fieldToBeEnabled).style.display = 'block';
document.getElementById('saveBtnNew').style.display = 'block';
if(fieldToBeDisabled!=''){
document.getElementById(fieldToBeDisabled).style.display = 'none';
}
setEditTypeHiddenVariable(typeOfEdit);
}
function displayProductPlatforms(type) {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var osPlatform = document.getElementById("hiddenOsPlatFormId").value;
if((osPlatform == null || osPlatform =='' || osPlatform =='select' ) && ('ciat-product' == type || 'ciat-platform' == type || 'ciat-platform-Radio' == type || 'ciat-product-Radio' == type)) {
alert("You must first select an OS Platform before editing this field");
return;
} else {
if(type =='ciat-platform-Radio' || type =='ciat-product-Radio' ){
if(type =='ciat-platform-Radio'){
enableCategoryCondition('platformCondition');
document.getElementById('saveBtnNew').style.display = 'block';
}else if(type =='ciat-product-Radio'){
enableCategoryCondition('productCondition');
document.getElementById('saveBtnNew').style.display = 'block';
}
}else{
if(type =='ciat-platform'){
fnDisplayMainDiv('platformCategoryDiv','platformCategoryMainDivId','platformCategoryClearDiv');
}else if(type =='ciat-product'){
fnDisplayMainDiv('productCategoryDiv','productCategoryMainDivId','productCategoryClearDiv');
}
var myWindowWidth = 0, myWindowHeight = 0;
myWindowWidth = $(window).width();
myWindowHeight = $(window).height();
if(myWindowWidth > 650 ) {
myWindowWidth = 650;
}
if(myWindowHeight > 450) {
myWindowHeight = 450;
}
var title = '';
if('gnats-product' == type) {
title = 'GNATS Products';
}else if('gnats-platform' == type) {
title = 'GNATS Platforms';
}else if('ciat-product' == type) {
title = 'CIAT Products';
}else if('ciat-platform' == type) {
title = 'CIAT Platforms';
}
tb_show(title,'searchPrProductPlatform?productPlatformType='+type+'&KeepThis=true&TB_iframe=true&height='+myWindowHeight+'&width='+myWindowWidth, null);
}
}
}
function fnEnableForEditing(fieldToBeEnabled,fieldToBeDisabled,editTd,typeOfEdit) {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
setChangeFlag();
setEditTypeHiddenVariable(typeOfEdit);
if(null != document.getElementById(fieldToBeEnabled)) {
document.getElementById(fieldToBeEnabled).style.display = 'block';
}
document.getElementById('saveBtnNew').style.display = 'block';
if(fieldToBeDisabled!='' && document.getElementById(fieldToBeDisabled) != null){
document.getElementById(fieldToBeDisabled).style.display = 'none';
}
if(editTd !='' && document.getElementById(editTd) != null){
document.getElementById(editTd).style.display = 'none';
}
if(fieldToBeEnabled =='editableCustRec' && document.getElementById('ciatReferPriorRecommHidden') != null) {
document.getElementById('ciatReferPriorRecommHidden').style.display = 'block';
}
if(fieldToBeEnabled =='editableVerCategory' && document.getElementById('editableVerCategoryAdd') != null) {
document.getElementById('editableVerCategoryAdd').style.display = 'block';
}
if(fieldToBeEnabled =='editableFruCategory' && document.getElementById('editableFruCategoryAdd') != null) {
document.getElementById('editableFruCategoryAdd').style.display = 'block';
}
if(fieldToBeEnabled =='editableBcfFixedInDiv') {
var fixedInObj = document.getElementById('editablefixedInAdd') ;
if(null != fixedInObj) {
fixedInObj.style.display = 'block';
}
}
if(fieldToBeEnabled =='editableBcfAffectedVersion') {
var docObj = document.getElementById('editableBcfAffVersionAdd');
if(null != docObj) {
docObj.style.display = 'block';
}
}
}
function fnEnableForEditingSelBx(SelectField,editTdId,typeOfEdit) {
setChangeFlag();
$("#"+SelectField+"").removeAttr('disabled');
$('#'+SelectField+' option').css('background','none');
document.getElementById(editTdId).style.display = 'none';
document.getElementById('saveBtnNew').style.display = 'block';
setEditTypeHiddenVariable(typeOfEdit);
}
function enableEditableFieldsForSaving() {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var currentPage=document.getElementById("currentPage").value;
var editableFields;
setChangeFlag();
if(currentPage == 'searchByPr' && document.getElementById("getCustomRecomId").value =='Y' ){
editableFields = ['editableSymptom', 'editableTrigger', 'editableConfigCtgry','editableCustRecSearchPr',
'editableComments', 'editableInternalNotesSearchPr', 'editableExcludeReasonSearchPr', 'editableReleaseNotes',
'editableWorkaround', 'editableVerCategory', 'editableFruCategory','editableBcfFixedInDiv',
'editableBcfSynopsisHeadline','editableBcfAffectedVersion','editableBcfRootCauseAnalysis',
'editableBcfEngineeringFixDetails','editableBcfWorkAround','bcfFixedInSelectField'];
}else{
editableFields = ['editableSymptom', 'editableTrigger', 'editableConfigCtgry','editableCustRec',
'editableComments', 'editableInternalNotes', 'editableExcludeReason', 'editableReleaseNotes',
'editableWorkaround', 'editableVerCategory', 'editableFruCategory','editableBcfFixedInDiv',
'editableBcfSynopsisHeadline','editableBcfAffectedVersion','editableBcfRootCauseAnalysis',
'editableBcfEngineeringFixDetails','editableBcfWorkAround','bcfFixedInSelectField'];
}
for ( var index = 0; index < editableFields.length; index++) {
var editableDocObj = document.getElementById(editableFields[index]);
if(null != editableDocObj) {
editableDocObj.style.display = 'block';
}
}
var editableComboboxes;
if(currentPage == 'searchByPr' && document.getElementById("getCustomRecomId").value =='Y' ){
editableComboboxes = ['gnatsProductsSelectField','gnatsPlatformSelectField','bugType','bcfAffectedVersionTxtArea',
'ciatProductFieldId','ciatPlatformFieldId','ciatCustImpactSelectFieldSearchPr','ciatImpactProbSelectFieldSearchPr','bcfStatusSelectField','pbnStatusSelectField'];
}else{
editableComboboxes = ['gnatsProductsSelectField','gnatsPlatformSelectField','bugType','bcfAffectedVersionTxtArea',
'ciatProductFieldId','ciatPlatformFieldId','ciatCustImpactSelectField','ciatImpactProbSelectField','bcfStatusSelectField','pbnStatusSelectField'];
}
for(var index1 = 0; index1 < editableComboboxes.length; index1++) {
$("#"+editableComboboxes[index1]+"").removeAttr('disabled');
}
document.getElementById("nonEditableBcfFixedInDiv").style.display = 'none';
var docObj = document.getElementById("nonEditableBcfAffectedVersion");
if(null != docObj) {
docObj.style.display = 'none';
}
var prOwnerEditId = document.getElementById("prOwnerEditTd");
if(prOwnerEditId != null) {
//
document.getElementById('editablePrOwner').style.display = 'block';
document.getElementById('nonEditablePrOwner').style.display = 'none';
document.getElementById('prOwnerEditTd').style.display = 'none';
var ownerId = document.getElementById('prOwnerText');
if(ownerId.value != null && ownerId.value == 'Enter a name here ...') {
ownerId.value = "";
}
}
enableCategoryCondition('hardwareCondition');
enableCategoryCondition('versionCondition');
enableCategoryCondition('productCondition');
enableCategoryCondition('platformCondition');
enableCategoryCondition('configCatOperation');
}
function displayPriorRecomm(key) {
var myWindowWidth = 0, myWindowHeight = 0;
myWindowWidth = $(window).width();
myWindowHeight = $(window).height();
if(myWindowWidth > 650 ) {
myWindowWidth = 950;
}
if(myWindowHeight > 450) {
myWindowHeight = 450;
}
var toEnableSelect="true";
if($('#isEditButtonClicked')){
if($('#isEditButtonClicked').val()=="true"){
}else{
toEnableSelect='false';
}
}
tb_show('View Prior Customer Recommendations','priorRecomm?source=piir&prId='+key+'&toEnableSelect='+toEnableSelect+'&KeepThis=true&TB_iframe=true&height='+myWindowHeight+'&width='+myWindowWidth, null);
}
function fnShowPrStateTransition(prNumber) {
parent.tb_show('PR State Transition','prStateTransition?prNumber='+prNumber+'&fileKeepThis=true&TB_iframe=true&height=200&width=400', null);
}
function fnShowPBNStateTransition(prNumber) {
parent.tb_show('PBN State Transition','pbnStateTransition?prNumber='+prNumber+'&fileKeepThis=true&TB_iframe=true&height=200&width=400', null);
}
function displaySoftwareVersion(type){
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var parentSoftwareVersions = document.getElementById("softwareVersions").value;
var osPlatform = document.getElementById("hiddenOsPlatFormId").value;
if(osPlatform == null || osPlatform =='' || osPlatform =='select') {
alert("You must first select an OS Platform before editing this field");
} else {
if(type =='softwareVersion-radio'){
enableCategoryCondition('versionCondition');
document.getElementById('saveBtnNew').style.display = 'block';
}else{
fnDisplayMainDiv('versionCategoryDiv','versionCategoryMainDivId','versionCategoryClearDiv');
tb_show('Software Tree', 'softwareTree?&method=post&KeepThis=true&TB_iframe=true&osPlatform='+osPlatform+'&softwareVersions='+parentSoftwareVersions+'&height=400&width=500', null);
}
}
}
function displayBcfVersions(value) {
tb_show('Software Tree', 'softwareTree?&action='+value+'&KeepThis=true&TB_iframe=true&height=400&width=500', null);
}
function displayHardwareVersion(type){
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var osPlatform = document.getElementById("hiddenOsPlatFormId").value;
if(osPlatform == null || osPlatform =='' || osPlatform =='select') {
alert("You must first select an OS Platform before editing this field");
} else {
if(type =='hardwareCondition-radio'){
enableCategoryCondition('hardwareCondition');
document.getElementById('saveBtnNew').style.display = 'block';
}else{
fnDisplayMainDiv('fruCategoryDiv','fruCategoryMainDivId','fruCategoryClearDiv');
var fruCatgory=document.getElementById("fruCategory").value;
tb_show('Hardware Selection', 'hardware?&checkedValues='+fruCatgory+'&osPlatform='+osPlatform+'&KeepThis=true&TB_iframe=true&height=450&width=750', null);
}
}
}
function processConfigCategory() {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var osPlatform = document.getElementById("hiddenOsPlatFormId").value;
if(osPlatform == null || osPlatform =='' || osPlatform =='select') {
alert("You must first select an OS Platform before editing this field");
return false;
} else {
fnDisplayMainDiv('catConfDivId','confCategoryMainDivId','catConfClearDivId');
fnEnableForEditing('editableConfigCtgry','nonEditableConfigCtgry','bcfConfigCatTd','','BCF');
enableCategoryCondition('configCatOperation');
}
return true;
}
function removeRow(id, name){
var tbl = document.getElementById('selectedConfiguration');
var rows = tbl.rows;
for ( var index = 0; index < rows.length; index++) {
if(rows[index].cells[0].innerHTML == name){
tbl.deleteRow(index);
var configurationCategoryObj = document.getElementById('configurationCategory');
var configurationCategory = configurationCategoryObj.value;
var configArray = configurationCategory.split(',');
for ( var index = 0; index < configArray.length; index++) {
if(configArray[index] == id){
configArray.splice(index,1);
}
}
configurationCategoryObj.value = configArray.toString();
var rowsAfterDeletion = tbl.rows;
if(rowsAfterDeletion.length == 0) {
if(null != document.getElementById("editableConfigOperationTableId")) {
document.getElementById("editableConfigOperationTableId").style.display='none';
}
}
return;
}
}
}
function removeAllRows() {
var tbl = document.getElementById('selectedConfiguration');
$("#selectedConfiguration tr").remove();
document.getElementById('configurationCategory').value='';
}
function isNumber(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
function saveSelection() {
var prevSelection = document.getElementById("prevSelection");
var currSelection = document.getElementById("configurationCategoryText");
if (prevSelection && currSelection)
prevSelection.value = currSelection.value;
}
function validateGnatsEdit(currentFields) {
if(currentFields.indexOf('shareWithCustomerEdited') != -1) {
var shareWithCustomerEditedReason = document.getElementById("shareWithCustomerEditedReason").value;
if(!shareWithCustomerEditedReason || shareWithCustomerEditedReason.length < 1) {
alert('Share-With-Customers: Edit of field Share-With-Customers requires a change reason.');
return false
}
}
if(currentFields.indexOf('customerRiskEdited') != -1) {
var customerRiskEditedReason = document.getElementById("customerRiskEditedReason").value;
if(!customerRiskEditedReason || customerRiskEditedReason.length < 1) {
alert('Customer-Risk: Edit of field Customer-Risk requires a change reason.');
return false
}
}
if(currentFields.indexOf('workaroundProvidedEdited') != -1 || currentFields.indexOf('workaroundEdited') != -1) {
var workaroundProvided = $('#workaroundProvided').val();
var workaround = $('#workaround').val();
if(workaroundProvided && 'true'== workaroundProvided) {
if(!workaround || workaround.length < 1) {
alert('Workaround field needs a value based on the following condition: Workaround-Provided == "true"');
return false
}
}
if(workaroundProvided && 'false'== workaroundProvided) {
if(workaround) {
alert('Workaround must be blank if Workaround-Provided is "false"');
return false
}
}
}
return true;
}
function submitPrDetailFormNew(saveAndClose,saveAndCloseCiat) {
var currentBcfOwner = document.getElementById('prOwnerText').value;
var currentPbnOwner = document.getElementById('pbnOwnerText').value;
var resolvedInValue=$('#helperFixedIn').val();
var fixedInNewValue=$('#bcfFixedInSelectField').val();
//if fixedin not same as gnats resolved in
//there are two chances
//1)either its the value in db 2) newly entered value by user (in both cases we need to persist))
if((fixedInNewValue.length != 0 || fixedInNewValue != '')){
if($.trim(resolvedInValue)!=$.trim(fixedInNewValue)){
document.getElementById("bcfFixedIn").value = $.trim(fixedInNewValue);
}
}
if((fixedInNewValue.length == 0 || fixedInNewValue == '')){
document.getElementById("bcfFixedIn").value=' ';
}
if('' == currentBcfOwner) {
//hiddenPbnOwnerBackup
document.getElementById('prOwnerText').value = document.getElementById('hiddenBcfOwnerBackup').value;
}
if('' == currentPbnOwner) {
document.getElementById('pbnOwnerText').value = document.getElementById('hiddenPbnOwnerBackup').value;
}
if( ! validateScoreMultiplier()){
return;
}
var currentFields = document.getElementById('gnatsEditedFields').value;
/*if(currentFields && currentFields.length > 0) {
if(!validateGnatsEdit(currentFields)) {
return;
}
}*/
var masterDup = $("#masterDuplicateSelectFieldId").val();
var bcfMasterDupChangeFlag = document.getElementById('bcfMasterDupChangeFlag');
var bcfMasterDupChangeFlagVal = null;
if(null != bcfMasterDupChangeFlag) {
bcfMasterDupChangeFlagVal = bcfMasterDupChangeFlag.value;
}
var duplicateOf = $("#bcfDuplicateOfTxtArea").val();
if('set' == bcfMasterDupChangeFlagVal) {
if('duplicate' == masterDup && !isNumber(duplicateOf)){
alert('Please enter a valid value for BCF Duplicate Of field.');
return;
}
}
var bcfDupOfChangeFlag = document.getElementById('bcfDupOfChangeFlag');
var bcfDupOfChangeFlagVal = null;
if(null != bcfDupOfChangeFlag) {
bcfDupOfChangeFlagVal = bcfDupOfChangeFlag.value;
}
if('duplicate' == masterDup && 'set' == bcfDupOfChangeFlagVal && !isNumber(duplicateOf)) {
alert('Please enter a valid value for BCF Duplicate Of field.');
return;
}
var prKeyObj = document.getElementById("hiddenPrKey");
if(null != prKeyObj) {
prKey = prKeyObj.value;
if(prKey==duplicateOf) {
alert("A PR can't be made the duplicate of itself.");
return;
}
}
if(document.getElementById("getCustomRecomId").value =='Y'){
var addressId=document.getElementById("addressID").value;
var ind=document.getElementById("reportIdsSel").selectedIndex;
var reportSelected=document.getElementById("reportIdsSel").options[ind].value;
document.getElementById("customerOrg").value=addressId;
document.getElementById("piirReport").value=reportSelected;
}
$("#collapseAllId").click();
var errorTables = ['errorTableId1', 'errorTableId2', 'errorTableId3'];
for ( var index = 0; index < errorTables.length; index++) {
var editableDocObj = document.getElementById(errorTables[index]);
if(null != editableDocObj) {
editableDocObj.style.display = 'none';
}
}
enableEditableFieldsForSaving();
$("#ciatProductFieldId option").attr("selected","selected");
$("#ciatPlatformFieldId option").attr("selected","selected");
$("#gnatsPlatformSelectField option").attr("selected","selected");
$("#gnatsProductsSelectField option").attr("selected","selected");
var bcfEditFlag = document.getElementById("editBcf").value;
var gnatsEditFlag = document.getElementById("editGnats").value;
var editType = "";
if(null != bcfEditFlag && bcfEditFlag =='BCF' && null != gnatsEditFlag && gnatsEditFlag =='GNATS') {
editType ='BOTH';
} else if(null != bcfEditFlag && bcfEditFlag =='BCF') {
editType ='BCF';
} else {
editType ='GNATS';
}
document.getElementById("editType").value = editType;
document.getElementById("saveAndClose").value = saveAndClose;
if(saveAndCloseCiat == 'Y'){
if(document.getElementById("saveCiatOnly")) {
document.getElementById("saveCiatOnly").value ="Y";
}
}
document.prDetailForm.submit();
}
function fnEnableDropDown(divToBeDisabled,divToBeDisabledMouseOver,divToBeEnabled,spanToBeDisabled,saveToBeEnabled) {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
if(divToBeDisabled!='' && document.getElementById(divToBeDisabled) != null){
document.getElementById(divToBeDisabled).style.display = 'none';
}
if(divToBeDisabledMouseOver!='' && document.getElementById(divToBeDisabledMouseOver) != null){
document.getElementById(divToBeDisabledMouseOver).onmouseover = null;
}
if(divToBeEnabled!='' && document.getElementById(divToBeEnabled) != null){
document.getElementById(divToBeEnabled).style.display = 'block';
}
if(spanToBeDisabled!='' && document.getElementById(spanToBeDisabled)!=null){
document.getElementById(spanToBeDisabled).style.display = 'none';
}
if(saveToBeEnabled!='' && document.getElementById(saveToBeEnabled) != null){
document.getElementById(saveToBeEnabled).style.display = 'block';
}
setChangeFlag();
}
function fnDisplayCommaSepValues(spanToBeEnabledWithValue){
var Vals = jQuery.trim(document.getElementById(spanToBeEnabledWithValue).innerHTML);
var strLength=Vals.length
Vals = Vals.slice(0,strLength-1);
document.getElementById(spanToBeEnabledWithValue).innerHTML=Vals;
}
function fnClearValues(innerHtmlToBeDisabled,selectToBeRemoved,idToBeDisabled){
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
alert('Please click EDIT button first to clear the values');
return;
}
if(innerHtmlToBeDisabled!=''){
document.getElementById(innerHtmlToBeDisabled).innerHTML='';
}
if(selectToBeRemoved!=''){
if(innerHtmlToBeDisabled == 'platformCategorySpanId' || innerHtmlToBeDisabled == 'productCategorySpanId' ){
$(selectToBeRemoved).remove()
}else{
$(selectToBeRemoved).val('');
}
}
if(idToBeDisabled!=''){
document.getElementById(idToBeDisabled).value='';
}
if(innerHtmlToBeDisabled == 'nonEditableConfigCtgry'){
removeAllRows();
}
}
function fnDisplayMainDiv(divToBeDisabled,divToBeEnabled,clearDivToBeDisabled){
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
document.getElementById(divToBeDisabled).style.display = 'none';
document.getElementById(divToBeEnabled).style.display = 'block';
document.getElementById(clearDivToBeDisabled).style.display = 'none';
}
function fnHideMouseOver(divToBeDisabledMouseOver,clearDivToBeDisabled,isLengthValidation,divToBeDisabled){
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
document.getElementById(divToBeDisabledMouseOver).onmouseover = null;
if(clearDivToBeDisabled!=''){
document.getElementById(clearDivToBeDisabled).style.display = 'none';
}
if(isLengthValidation == 'true'){
document.getElementById(divToBeDisabled).style.display = 'none';
}
}
function validateBugType(gnatsNumber, resolvedIn, devIntroducedRliOrPr, gnatsAffectedVersions) {
// OS Platform is a mandatory field
var osPlatform = document.getElementById("hiddenOsPlatFormId").value;
if(osPlatform == null || osPlatform =='') {
alert("You must first select an OS Platform before editing this field.");
$("#bugType").val('');
return;
}
// If the current PR doesn't have resolved in, still user should be able to save bug type.
if(!resolvedIn || ''==resolvedIn || null == resolvedIn) {
return;
}
var bugType = $("#bugType").val();
// If user toggles between select and someother value , handle that
if(!bugType || '' == bugType || null == bugType) {
return;
}
var bcfAffectedVersions = jQuery.trim(document.getElementById('versionCategorySpanId').innerHTML);
prDetailController.getPossibleAffectedVersionsDwr(gnatsNumber,bugType,resolvedIn, devIntroducedRliOrPr,gnatsAffectedVersions,
bcfAffectedVersions,{callback: getPossibleAffectedVersionsCallback});
}
function getPossibleAffectedVersionsCallback(matchVersions) {
if(null == matchVersions) {
alert('Failed identifying the \'BCF Affected Version Category\' for the chosen Bug Type.');
return;
}
var error = matchVersions["ERROR"];
if(error) {
alert('Failed identifying the \'BCF Affected Version Category\' for the chosen Bug Type.\nError : '+error);
return;
}
var versions = matchVersions["VERSIONS"];
var warning = matchVersions["WARNING"];
if(warning) {
alert(warning);
}
fnEnableForEditing('editableVerCategory','nonEditableVerCategory','','BCF');
$("#softwareVersionsStr").val(versions);
var swVersions = versions.replace(/\n/g, ",");
var swVersionWithoutLastComma=swVersions.substring(0, swVersions.length-1);
document.getElementById('versionCategorySpanId').innerHTML=swVersionWithoutLastComma;
$("#softwareVersions").val(swVersionWithoutLastComma);
if(swVersionWithoutLastComma && null != swVersionWithoutLastComma && '' != swVersionWithoutLastComma) {
document.getElementById("versionSpanClear").style.display = 'block';
}
}
function validateScoreMultiplier(){
var scoreMultiplierTxt = document.getElementById("scoreMultiplierTextDiv").value;
if(isNaN(scoreMultiplierTxt) || scoreMultiplierTxt < 0)
{
alert("Please enter the valid Score Multiplier value.");
return false;
}
return true;
}
function updateGnatsFieldIdentifier(fieldId) {
var isEditButtonClicked = $('#isEditButtonClicked').val();
if(isEditButtonClicked == 'false') {
return;
}
var currentFields = document.getElementById('gnatsEditedFields').value;
if(currentFields) {
var index = currentFields.indexOf(fieldId);
if(-1 == index) {
currentFields = currentFields + ',' + fieldId;
}
} else {
currentFields = fieldId;
}
document.getElementById('gnatsEditedFields').value = currentFields;
if('customerRiskEdited' == fieldId) {
document.getElementById("customerRiskEditedDiv").style.display='';
}
if('shareWithCustomerEdited' == fieldId) {
document.getElementById("shareWithCustomersEditedDiv").style.display='';
}
}
function toggle(divClass){
$header = $(divClass);
$content = $header.next();
$content.slideToggle(100, function () {
var text=$content.is(":visible") ? "- Collapse" : "+ Expand";
$header.text(text);});
}