123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- // 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<d.forms.length;i++) x=d.forms[i][n];
- for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
- if(!x && document.getElementById) x=document.getElementById(n); return x;
- }
- function invalidateResults() {
- if (parent.isXtabStillLoading())
- {
- setTimeout("invalidateResults()", 50);
- return;
- }
- if (document.searchForm.FindIn.value == "R" && !blockInvalidate)
- {
- submitSearch(false);
- }
- }
- function initFind() {
- if (parent.isXtabStillLoading())
- {
- setTimeout("initFind()", 50);
- return;
- }
- document.searchForm.searchPattern.value = lastSearchPattern;
- if(lastSearchTarget >= 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 += "<INPUT TYPE='hidden' NAME='UI'>";
-
- 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 = '<table><tr><td valign="middle"><img src="../ppwb/Graphics/error.gif" height=18 width=18 alt=""></td><td class="CustomExceptionError" valign="middle">' + msg + '</td></tr></table><br><br>';
- } 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('<html><body><table><tr><td><img src="../ppwb/Graphics/error.gif" height=18 width=18 alt=""></td><td class="CustomExceptionError" valign="middle">' + msg + '</td></tr></table></body></html>');
- 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);
- }
|