/******************************************************************************************************************************** * Licensed Materials - Property of IBM * * * * IBM Cognos Products: AGS * * * * (C) Copyright IBM Corp. 2005, 2008 * * * * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * *********************************************************************************************************************************/ var K_sQUERYSUBJECT = "querySubject"; var K_sHIERARCHY = "hierarchy"; var K_sDIMENSION = "dimension"; var K_sFILTER = "filter"; var K_sMEASURE_FOLDER = "measureFolder"; var K_sMEASUREDIMENSION = "measureDimension"; var K_sHIERARCHY_FOLDER = "hierarchyFolder"; var K_sQUERYITEMFOLDER = "queryItemFolder"; var K_sFOLDER = "folder"; var K_sNAMESPACE = "namespace"; var K_sCALCULATION = "calculation"; var K_sCALCULATIONCONSTANT = "calculationConstant"; var K_sMEASURE = "measure"; var K_sROLLUPMEASURE = "rollupMeasure"; var K_sNAMEDSET = "namedSet"; var K_sLEVEL = "level"; var K_sQUERYITEM = "queryItem"; var K_sMEMBER = "member"; var K_sMEMBER_FOLDER = "memberFolder"; var K_sMEMBER_SEARCH = "memberSearch"; function mdQuerySubject(name, path, ref, parent, type) { this.name = name; this.ref = ref; this.path = path; this.parent = parent; this.type = type; } function mdFilter(name, path, ref, parent, type) { this.name = name; this.ref = ref; this.path = path; this.parent = parent; this.type = type; } function mdQueryItemFolder(name, path, ref, parent, type) { this.name = name; this.ref = ref; this.path = path; this.parent = parent; this.type = type; } function mdFolder(name, path, ref, parent, type) { this.name = name; this.ref = ref; this.path = path; this.parent = parent; this.type = type; } function mdCalculation(name, path, ref, datatype, usage, regularAggregate, semiAggregate, promptType, displayType, sortOnRef, promptCascadeOnRef, promptFilterItemRef, parent, type) { this.name = name; this.ref = ref; this.path = path; this.datatype = datatype; this.usage = usage; this.regularAggregate = regularAggregate; this.semiAggregate = semiAggregate; this.promptType = promptType; this.displayType = displayType; this.sortOnRef = sortOnRef; this.promptCascadeOnRef = promptCascadeOnRef; this.promptFilterItemRef = promptFilterItemRef; this.parent = parent; this.type = type; } function mdQueryItem(name, path, ref, datatype, usage, regularAggregate, semiAggregate, promptType, displayType, sortOnRef, promptCascadeOnRef, promptFilterItemRef, parent, type) { this.name = name; this.ref = ref; this.path = path; this.datatype = datatype; this.usage = usage; this.regularAggregate = regularAggregate; this.semiAggregate = semiAggregate; this.promptType = promptType; this.displayType = displayType; this.sortOnRef = sortOnRef; this.promptCascadeOnRef = promptCascadeOnRef; this.promptFilterItemRef = promptFilterItemRef; this.parent = parent; this.type = type; } function mdMember(path, ref, levelLabel, levelNumber, levelUniqueName, memberCaption, memberUniqueName, parentUniqueName, type) { this.path = path; this.ref = ref; this.levelLabel = levelLabel; this.levelNumber = levelNumber; this.levelUniqueName = levelUniqueName; this.memberCaption = memberCaption; this.memberUniqueName = memberUniqueName; this.parentUniqueName = parentUniqueName; this.type = type; // put these in to get OLAP Reports working this.name = memberCaption; this.datatype = ""; this.usage = ""; this.regularAggregate = "none"; this.semiAggregate = "none"; this.promptType = ""; this.displayType = ""; this.sortOnRef = ""; this.promptCascadeOnRef = ""; this.promptFilterItemRef = ""; this.parent = ""; } // we create an item - but there's nothing in there function mdSearch(path, type) { this.path = path; this.type = type; } // define all the metadata object functions var dropValueFunction = function() { return this.ref; } var replaceFunction = function() { return this; } // set this into all the prototypes mdQuerySubject.prototype.getDropValue = dropValueFunction; mdFilter.prototype.getDropValue = dropValueFunction; mdQueryItemFolder.prototype.getDropValue = dropValueFunction; mdFolder.prototype.getDropValue = dropValueFunction; mdCalculation.prototype.getDropValue = dropValueFunction; mdQueryItem.prototype.getDropValue = dropValueFunction; mdMember.prototype.getDropValue = dropValueFunction; // this is a hack - Tree assumes we're passing strings but we pass objects instead. // tree calls replace function - so we have to define a replace function for the object // we're adding. mdQuerySubject.prototype.replace = replaceFunction; mdFilter.prototype.replace = replaceFunction; mdQueryItemFolder.prototype.replace = replaceFunction; mdFolder.prototype.replace = replaceFunction; mdCalculation.prototype.replace = replaceFunction; mdQueryItem.prototype.replace = replaceFunction; mdMember.prototype.replace = replaceFunction; mdSearch.prototype.replace = replaceFunction; function fnGroup(name, qosLevel) { this.name = name; this.qosLevel = qosLevel; } fnGroup.prototype.getDropValue = function() { return this.name; } fnGroup.prototype.replace = replaceFunction; function fnFunction(dropText, name, syntax, tip, type, qosLevel) { this.dropText = dropText; this.name = name; this.syntax = syntax; this.tip = tip; this.type = type; this.qosLevel = qosLevel; } fnFunction.prototype.getDropValue = function() { var dropValue = null; if (this.dropText.localeCompare("@listSeparator") == 0) { dropValue = cf.cfgGet("META_ListSeparator"); } else if (this.dropText.localeCompare("@date") == 0) { dropValue = getDateString(); } else if (this.dropText.localeCompare("@dateTime") == 0) { dropValue = getDateTimeString(); } else if (this.dropText.localeCompare("@time") == 0) { dropValue = getTimeString(); } else { dropValue = this.dropText; } // make sure we have a drop value if (dropValue == "") { dropValue = this.name + "("; } // otherwise return the drop text return dropValue; } fnFunction.prototype.replace = replaceFunction; function getDateString() { var ret_value = ""; var date = new Date(); var year = date.getFullYear(); var month = date.getMonth()+1; var date = date.getDate(); ret_value = pad(year,4) + "-" + pad(month,2) + "-" + pad(date,2); return ret_value; } function getTimeString() { var ret_value = ""; var date = new Date(); var hours = date.getHours(); var minutes = date.getMinutes(); var seconds = date.getSeconds(); var millis = date.getMilliseconds(); ret_value = pad(hours,2) + ":" + pad(minutes,2) + ":" + pad(seconds,2) + "." + pad(millis,3); return ret_value; } function getDateTimeString() { return getDateString() + " " + getTimeString(); } function pad(val, size) { var ret_value = ""; var val_str = new String("" + val); for (var i = 0; i < size-val_str.length; ++i) { ret_value += "0"; } ret_value += val_str; // return it return ret_value; } function aiDataItem(name, ref, regularAggregate, displayType) { this.name = name; this.ref = ref; this.regularAggregate = regularAggregate; this.displayType = displayType; this.bIsIndicator = false; this.indicatorPath = "../ags/images/tree/qualifier_key.gif"; } function aiCalculation(name, path, ref, datatype, usage, regularAggregate, semiAggregate, promptType, displayType, sortOnRef, promptCascadeOnRef, promptFilterItemRef) { this.name = name; this.ref = ref; this.path = path; this.datatype = datatype; this.usage = usage; this.regularAggregate = regularAggregate; this.semiAggregate = semiAggregate; this.promptType = promptType; this.displayType = displayType; this.sortOnRef = sortOnRef; this.promptCascadeOnRef = promptCascadeOnRef; this.promptFilterItemRef = promptFilterItemRef; } function aiParameter(name, acceptRange) { this.name = name; this.acceptRange = acceptRange; } function aiHistory(name) { this.name = name; } var calcDropValueFunction = function() { // want to drop the name return "[" + this.name + "]"; } var paramDropValueFunction = function() { // want to drop the name again return "?" + this.name + "?"; } var historyDropValueFunction = function() { // want to drop the name again return "\\[" + this.name + "\\]"; } var dataItemValueFunction = function() { // want just the name var copyName = this.name; // the ']' characters shold be escaped, using another ']' // for the report server to understand them copyName = copyName.replace(/]/g, "]]"); return "[" + copyName + "]"; } // define the dropValue functions aiDataItem.prototype.getDropValue = dataItemValueFunction; aiCalculation.prototype.getDropValue = calcDropValueFunction; aiParameter.prototype.getDropValue = paramDropValueFunction; aiHistory.prototype.getDropValue = historyDropValueFunction; aiDataItem.prototype.isIndicator = function () {return this.bIsIndicator;} aiDataItem.prototype.getIndicator = function () {return this.indicatorPath;} aiDataItem.prototype.replace = replaceFunction; aiCalculation.prototype.replace = replaceFunction; aiParameter.prototype.replace = replaceFunction; aiHistory.prototype.replace = replaceFunction;