123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267 |
- /****************************************************************
- ** Licensed Materials - Property of IBM
- **
- ** IBM Cognos Products: drill
- **
- ** (C) Copyright IBM Corp. 2001, 2010
- **
- ** US Government Users Restricted Rights - Use, duplication or
- ** disclosure restricted by GSA ADP Schedule Contract with
- ** IBM Corp.
- *****************************************************************/
- // Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- // Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- //
- // the variable "cfgValues" must have been defined in one the files including this script file.
- // It is done this way to ensure we have only one valid definition of "cfgValues"
- //
- var cfgValues = new Array();
- //
- // --- Configuration management functions ---
- //
- function cfgSet(n, v) { cfgValues[n] = v; }
- function cfgGet(n) { return cfgValues[n]; }
- function cfgRemove(n) { delete cfgValues[n]; }
- function cfgIsArray(a) {
- return isArray(cfgValues[a]);
- }
- function cfgPush(a, v) {
- if (!cfgIsArray(a)) cfgValues[a] = cfgMakeArray(a);
- addToArray(cfgValues[a], v);
- }
- function cfgAddParm(n, v) {
- if (!isArray(cfgValues[n]))
- cfgValues[n] = makeArray(cfgValues[n]);
- addToArray(cfgValues[n], v);
- }
- function cfgSetDefaultAt(i) {
- cfgSetAt("ColFormat", i, new Array("none"));
- cfgSetAt("IsHidden",i, false);
- cfgSetAt("OriginalLabels",i,"");
- cfgSetAt("calcOp",i,"");
- cfgSetAt("SummaryAgg",i,"none");
- cfgSetAt("DetailAgg",i,"none");
- cfgSetAt("RegularAgg",i,"none");
- cfgSetAt("sortOnRef",i,"none");
- cfgSetAt("promptCascadeOnRef",i,"none");
- cfgSetAt("promptFilterItemRef",i,"none");
- cfgSetAt("PromptType",i,"0");
- cfgSetAt("ColFilterIdx",i,new Array());
- cfgSetAt("ColLabels",i,"");
- cfgSetAt("IsFakeMeasure",i,false);
- cfgSetAt("IsMeasure",i,false);
- cfgSetAt("IsCollapsed",i,false);
- cfgSetAt("ColRole",i,"Ungrouped");
- cfgSetAt("HasSummaries",i,false);
- cfgSetAt("displayType",i,"");
- }
- function cfgSetColAt(i, v1, v2, v3, v4, v5, v6, v7) {
- cfgSetAt("QueryIDs",i,v1);
- cfgSetAt("ColType",i,v2);
- cfgSetAt("ColUsage",i,v3);
- cfgSetAt("ColSort",i,v4);
- cfgSetAt("ColSortBy",i,v5);
- cfgSetAt("ColIDs",i,v6);
- cfgSetAt("ColOldType",i,v7);
- }
- function cfgSetAt(a, i, v) {
- if (!cfgIsArray(a)) cfgValues[a] = cfgMakeArray(a);
- insertInArrayAt(cfgValues[a], i, v);
- }
- function cfgGetAt(a, i) {
- if (!cfgIsArray(a)) return null;
- return cfgValues[a][i];
- }
- function cfgPop(a, v) {
- if (!cfgIsArray(a)) return;
- var bRemoved=false;
- var size=cfgValues[a].length;
- for (var i=0;i<size;i++) {
- if (!bRemoved && cfgValues[a][i]==v) bRemoved=true;
- if (bRemoved && i+1<size) cfgValues[a][i]=cfgValues[a][i+1];
- }
- if (bRemoved) cfgValues[a].length=size-1;
- }
- function cfgSize(a) {
- if (cfgIsArray(a)) return cfgValues[a].length;
- return 0;
- }
- function cfgCountEntriesWithValue(a, v) {
- var count=0;
- if(cfgIsArray(a)) {
- var size=cfgValues[a].length;
- for (var i=0;i<size;i++) {
- if(cfgValues[a][i] == v)
- ++count;
- }
- }
- return count;
- }
- function cfgIndexOf(a, v) {
- if (!cfgIsArray(a)) return -1;
- for (var i=0; i<cfgValues[a].length; i++)
- if (cfgValues[a][i]==v) return i;
- return -1;
- }
- function cfgMakeArray(a) {
- return makeArray(cfgValues[a]);
- }
- //
- // --- Array management functions ---
- //
- function addToArray(a, v) { if (!contains(a, v)) a[a.length] = v;}
- function insertInArrayAt(a, i, v) { a[i] = v; }
- function makeArray(a) {
- if (a == null || typeof a == "undefined")
- a = new Array();
- else if (typeof a != "object") {
- var tmp = a; a = new Array(); a[0] = tmp;
- }
- return a;
- }
- function containsByIndice(a, v) {
- for (var i in a)
- if (i == v) return true;
- return false;
- }
- function contains(a, v) {
- for (var i in a)
- if (a[i] == v) return true;
- return false;
- }
- function isArray(a) {
- if (a != null && typeof a == "object") return true;
- return false;
- }
- // -----------------------------------------------------------------------------
- //
- // --- Configuration utilities functions ---
- //
- // -----------------------------------------------------------------------------
- function reinitConfigValues() {
- cfgValues = new Array();
- cfgSet("productLocale", "en");
- cfgSet("contentLocale", "en-US");
- cfgSet("numRows", "20");
- cfgSet("NewReport", false);
- }
- function loadCfgArray(type) {
- cfgSet("doMetadataTree",false);
- cfgSet("BROWSER", browserType);
- cfgSet("SELECT_NODE_AT", selectedNode);
- cfgSet("SERVER_URL", serverURL);
- cfgSet("SCRIPT_ENGINE", scriptEngine);
- cfgSet("cmLastModel", model);
- cfgSet("START_AT", startAt);
- cfgSet("RPT_SVC_PARAM", rptSvcParam);
- cfgSet("FALSE",false);
- cfgSet("TRUE",true);
- if (type)
- {
- cfgSet("activeTree",true);
- cfgSet("SELECT_TYPE",type);
- cfgSet("selectNamespace",false);
- cfgSet("selectPackage",false);
- /* cfgSet("selectFolder",false); */
- cfgSet("selectDimension",true);
- cfgSet("selectHierarchy",true);
- cfgSet("selectLevel",true);
- /* cfgSet("selectQItemFldr",false); */
- cfgSet("selectQItem",true); /* equivalents : level */
- cfgSet("selectMeasureFldr",false);
-
- // These are the setting that are used when we select from meta data tree either for scope or param
- if (type=="scope" || type=="param")
- {
- //Since we don't want the mesaure to be selected when we define the parameters we don't enable these
- //If in future we want to enable measure for parameters as well we have to enable these.
- //cfgSet("selectMeasureDimn",true);
- //cfgSet("selectMeasure",true);
- //cfgSet("rollupMeasure",true);
- }
- else
- {
- cfgSet("selectMeasureDimn",false);
- cfgSet("selectMeasure",false);
- cfgSet("rollupMeasure",false);
- }
- // These are the settings that are used when we select the scope
- // settings that are specific to scope should go here.
- if (type=="scope")
- {
- cfgSet("selectMeasureDimn",true); // To allow Measure to be selected
- cfgSet("selectMeasure",true); // To allow Measure to be selected
- cfgSet("selectHierarchyMesr",true);
- cfgSet("selectNamedSet",false);
- cfgSet("selectQSubject",true); /* equivalents : dimension; hierarchy */
- cfgSet("selectAttributes",false);
- cfgSet("selectModelFact",false);
- cfgSet("selectModelAttr",false);
- cfgSet("selectModelIdent",false);
- }
- else
- {
- cfgSet("selectHierarchyMesr",false);
- cfgSet("selectNamedSet",true);
- cfgSet("selectQSubject",false); /* equivalents : dimension; hierarchy */
- cfgSet("selectAttributes",true);
- cfgSet("selectModelFact",true);
- cfgSet("selectModelAttr",true);
- cfgSet("selectModelIdent",true);
- }
- }
- else
- {
- cfgSet("activeTree",false);
- cfgSet("selectNamespace",false);
- cfgSet("selectPackage",false);
- /* cfgSet("selectFolder",true); */
- cfgSet("selectMeasureDimn",false);
- cfgSet("selectMeasureFldr",false);
- cfgSet("selectHierarchyMesr",false);
- cfgSet("selectMeasure",false);
- /* cfgSet("selectDimension",true); */
- /* cfgSet("selectHierarchy",true); */
- /* cfgSet("selectLevel",true); */
- cfgSet("selectNamedSet",false);
- cfgSet("selectQSubject",false); /* equivalents : dimension; hierarchy */
- cfgSet("selectQItem",false); /* equivalents : level */
- /* cfgSet("selectQItemFldr",false); */
- cfgSet("selectAttributes",false);
- cfgSet("selectModelFact",false);
- cfgSet("selectModelAttr",false);
- cfgSet("selectModelIdent",false);
- }
- //<xsl:if test="key('env-param','debug')='true'">cf.cfgSet("__DBG__", true);</xsl:if>
- // cfgSet("queryLoaded",true);
- }
|