// Licensed Materials - Property of IBM // // IBM Cognos Products: pps // // (C) Copyright IBM Corp. 2005, 2017 // // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. // This forms the javascript functions used for the Find pane of // PowerPlay Studio. // The functions handle any minor browser differences. var isNSBrowser = navigator.appName.indexOf("Netscape")>=0; if( navigator.appVersion == "" ) isNSBrowser = false; var isNSMac = isNSBrowser && navigator.platform.indexOf("Mac") >= 0; var Results; var selectedControlIdx = -1; var displayLimit = 10; var currentPosition = 0; var rowsDisplayed = 0; var blockInvalidate = false; var nIndex=0; // initially we should ensure that we do infact begin from index 0 (vector search) var DisplayLimit = 10; var searchDirection = 1; //(1=up (next) 0=down (prev)) var isError = 0; var isNextSearch = 0; var isPrevSearch = 0; var url = ""; var restrict = ""; var pattern = ""; var cmd = ""; var sellIndex = ""; function findObj(n, d) { var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i= 0) document.searchForm.searchTarget.selectedIndex = lastSearchTarget; if(lastSearchRestriction >= 0) document.searchForm.searchRestriction.selectedIndex= lastSearchRestriction; } function submitSearch(bChangeTarget) { if (!bChangeTarget && stateChanging) return; currentPosition = 0; rowsDisplayed = 0; var sellIndex = 0; buildURLSections(); // a bit of logic to ensure if (isNextSearch | isPrevSearch ) // use the previous search pattern pattern = lastSearchPattern; else{ // new search, re-intialize indecies nBeginSearchAtIndex = 0; nEndSearchAtIndex = 0; } var findform = winFX.document.fhidden; var target = findform.target; findform.CNCT.value = 12; if (!findform.UI) findform.innerHTML += ""; findform.UI.value = 0; var appendUrl = 'F' + cmd + ':"' + CEncodingUtil.EncodeStrOperand(pattern) + '"' + '\t' + restrict; if (!bChangeTarget) { var targetSellIndex = document.searchForm.searchTarget.selectedIndex; appendUrl += '\t' + document.searchForm.searchTarget.options[targetSellIndex].value; appendUrl += '\t' + nBeginSearchAtIndex + '\t' + nEndSearchAtIndex + '\t' + DisplayLimit + '\t' + searchDirection; } findform.CO.value = appendUrl; findform.target = window.name; findform.submit(); findform.target = target; } function SetRadiobuttonIndex(){ nIndex = 0; var flag = 0; while(flag==0){ var result = document.result.ResultSet[nIndex]; var checked = (typeof result != "undefined") ? result.checked : document.result.ResultSet.checked; if (checked){ flag = 1; } nIndex++; } nIndex = nIndex-1; } function filterOnFindResult(){ SetRadiobuttonIndex(); var category = FindResults[nIndex]; var command = ''; if (document.searchForm.FindIn.value == "R") { if(category._tempInfo == "") command = 'DG' + ':' + category._axis + category._group + '\t' + category._id + "," + category._dim + ';' + category._code; } else { command = 'DC' + ':' + category._id + "," + category._dim + ';' + category._code; } if (command != '') { winFX.doit(command); } } function GoToCategory(){ SetRadiobuttonIndex(); var category = FindResults[nIndex]; var rowPage = 0; var colPage = 0; var isOnCurrentPage = true; var hasPagination = typeof winFX.document.fhidden.J != "undefined" && typeof winFX.document.fhidden.K != "undefined"; if (hasPagination) { rowPage = winFX.document.fhidden.J.value; colPage = winFX.document.fhidden.K.value; if(category._axis == 'R') isOnCurrentPage = rowPage == category._pageNo; else isOnCurrentPage = colPage == category._pageNo; } if (isOnCurrentPage) { writeErrorMessage(currSelection); return; } if(category._axis == 'R') command = 'PG' + ':' + category._pageNo + '\t' + colPage; else if(category._axis == 'C') command = 'PG' + ':' + rowPage + '\t' + category._pageNo; blockInvalidate = true; winFX.doit(command); blockInvalidate = false; } function writeErrorMessage(msg) { var err = findObj("errorMessage"); if (err) { if (document.getElementById) { //IE 5.5+ , Netscape 6.0+ err.innerHTML = '
' + msg + '


'; } else if (isNSBrowser) { // Other Netscape browsers err.visibility = "visible"; err.moveTo(11, document.layers["referenceLayer"].top + document.layers["referenceLayer"].clip.bottom); err.resizeTo(parent.FE.innerWidth - 25, 50); err.document.open(); err.document.write('
' + msg + '
'); err.document.close(); } else alert (msg); } } function replaceRows(){ SetRadiobuttonIndex(); var category = FindResults[nIndex]; var command = 'ER' + ':' + 'R-1' + '\t' + 'D' + category._dim + '\t' + category._id + "," + category._dim + ';' + category._code; winFX.doit(command); } function replaceColumns(){ SetRadiobuttonIndex(); var category = FindResults[nIndex]; var command = 'ER' + ':' + 'C-1' + '\t' + 'D' + category._dim + '\t' + category._id + "," + category._dim + ';' + category._code; winFX.doit(command); } function changeTarget (value) { currentPosition = 0; rowsDisplayed = 0; buildURLSections(); stateChanging = true; submitSearch(true); } //this of this as a class 'FindRecord' these are the member variables ... ".display" is a method (this needs to be changed to work with js1.3) function FindRecord (ppds_id, dim_index, code, label, path, axis, group, tempInfo, pageNo) { this._id = ppds_id; this._dim = dim_index; this._code = code; this._label = label; this._path = path; this._axis = axis; this._group = group; this._tempInfo = tempInfo; this._pageNo = pageNo; } function displayFindResults() { displayTitles(false); displayResults(); displayActions(); document.all.resultsDisplay.style.visibility = "visible"; } function buildURLSections() { sellIndex = 0; pattern = document.searchForm.searchPattern.value; selIndex = document.searchForm.FindIn.selectedIndex; cmd = document.searchForm.FindIn.options[selIndex].value; selIndex = document.searchForm.searchRestriction.selectedIndex; restrict = document.searchForm.searchRestriction.options[selIndex].value; } function next() { isNextSearch = 1; searchDirection = 1; submitSearch(false); } function prev() { isPrevSearch = 1; searchDirection = 0; submitSearch(false); }