drill.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2018
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. // This JavaScript file is used for conducting drill through
  13. // It delegates drill functionality to the parent (normaly the RV)
  14. // Otherwise it does nothing.
  15. function sXmlEncode(sInputString)
  16. {
  17. var sOutputString = "" + sInputString;
  18. if ((sOutputString == '0') || ((sInputString != null) && (sInputString != false)))
  19. {
  20. //&
  21. sOutputString = sOutputString.replace(/&/g, "&");
  22. //<
  23. sOutputString = sOutputString.replace(/</g, "&lt;");
  24. //&gt;
  25. sOutputString = sOutputString.replace(/>/g, "&gt;");
  26. //&quot;
  27. sOutputString = sOutputString.replace(/"/g, "&quot;");
  28. //&apos;
  29. sOutputString = sOutputString.replace(/'/g, "&apos;");
  30. }
  31. else if (sInputString == null)
  32. {
  33. //return empty string if the value is null or false
  34. sOutputString = "";
  35. }
  36. return sOutputString;
  37. }
  38. function createFormField(name, value)
  39. {
  40. var formField = document.createElement("input");
  41. formField.setAttribute("type", "hidden");
  42. formField.setAttribute("name", name);
  43. formField.setAttribute("value", value);
  44. return(formField);
  45. }
  46. function setBackURLToCloseWindow(oForm)
  47. {
  48. var aInputNodes = oForm.childNodes;
  49. if(aInputNodes)
  50. {
  51. for(var iChildIdx = 0; iChildIdx < aInputNodes.length; ++iChildIdx)
  52. {
  53. var oInput = aInputNodes[iChildIdx];
  54. var sName = oInput.getAttribute("name");
  55. if(sName && sName == "ui.backURL")
  56. {
  57. oForm.removeChild(oInput);
  58. }
  59. }
  60. }
  61. oForm.appendChild(createFormField("ui.backURL", "javascript:window.close();"));
  62. }
  63. //
  64. // There are multiple drill targets, the XTS page will take care of it
  65. //
  66. function doMultipleDrills(drillTargets,cvId)
  67. {
  68. if (parent != this && parent.doMultipleDrills)
  69. {
  70. if (getCVId() != "" && getCVId() != cvId) {
  71. cvId = getCVId();
  72. }
  73. return parent.doMultipleDrills(drillTargets, cvId);
  74. }
  75. else
  76. {
  77. if (window.gViewerLogger)
  78. {
  79. window.gViewerLogger.log('Drill Targets', drillTargets, "text");
  80. }
  81. var oCV = null;
  82. try
  83. {
  84. oCV = getCognosViewerObjectRef(cvId);
  85. }
  86. catch(exception){}
  87. var drillForm = buildDrillForm(oCV);
  88. addDrillEnvironmentFormFields(drillForm, oCV);
  89. if(typeof oCV != "undefined" && oCV != null)
  90. {
  91. var modelPath = oCV.getModelPath();
  92. drillForm.appendChild(createFormField("modelPath", modelPath));
  93. var selectionController = oCV.getSelectionController();
  94. var sSelectionContext = "";
  95. if(typeof getViewerSelectionContext != "undefined" && typeof CSelectionContext != "undefined")
  96. {
  97. sSelectionContext = getViewerSelectionContext(selectionController, new CSelectionContext(modelPath));
  98. }
  99. drillForm.appendChild(createFormField("drillContext", sSelectionContext));
  100. drillForm.appendChild(createFormField("modelDrillEnabled", selectionController.getModelDrillThroughEnabled()));
  101. if(typeof document.forms["formWarpRequest" + oCV.getId()]["ui.object"] != "undefined" && document.forms["formWarpRequest" + oCV.getId()]["ui.object"].value != "")
  102. {
  103. drillForm.appendChild(createFormField("drillSource", document.forms["formWarpRequest" + oCV.getId()]["ui.object"].value));
  104. }
  105. else if(typeof oCV.envParams["ui.spec"] != "undefined")
  106. {
  107. drillForm.appendChild(createFormField("sourceSpecification", oCV.envParams["ui.spec"]));
  108. }
  109. }
  110. drillForm.setAttribute("launchGotoPage", "true");
  111. drillForm.appendChild(createFormField("drillTargets", drillTargets));
  112. drillForm.appendChild(createFormField("invokeGotoPage", "true"));
  113. drillForm.appendChild(createFormField("m", "portal/drillthrough.xts"));
  114. drillForm.appendChild(createFormField("b_action", "xts.run"));
  115. var target = "winNAT_" + ( new Date() ).getTime();
  116. var sWebContentRoot = "..";
  117. if (oCV != null)
  118. {
  119. sWebContentRoot = oCV.getWebContentRoot();
  120. var sExecutionParameters = oCV.getExecutionParameters();
  121. if(sExecutionParameters != "")
  122. {
  123. drillForm.appendChild(createFormField("encExecutionParameters", sExecutionParameters));
  124. }
  125. }
  126. // Used to override the default behavior when we're in mobile so that we
  127. // call their proxy
  128. if (!oCV || !oCV.launchGotoPageForIWidgetMobile(drillForm)) {
  129. if (oCV && typeof oCV.launchGotoPage === "function") {
  130. oCV.launchGotoPage(drillForm);
  131. }
  132. else {
  133. var sPath = sWebContentRoot + "/rv/blankDrillWin.html";
  134. drillForm.target = target;
  135. window.open( sPath, target );
  136. }
  137. }
  138. }
  139. }
  140. function buildDrillForm(oCV)
  141. {
  142. var drillForm = document.getElementById("drillForm");
  143. if(drillForm)
  144. {
  145. document.body.removeChild(drillForm);
  146. }
  147. drillForm = document.createElement("form");
  148. if(typeof oCV != "undefined" && oCV != null)
  149. {
  150. var mainForm = document.getElementById("formWarpRequest" + oCV.getId());
  151. drillForm.setAttribute("target", mainForm.getAttribute("target"));
  152. drillForm.setAttribute("action", mainForm.getAttribute("action"));
  153. }
  154. else
  155. {
  156. drillForm.setAttribute("action", location.pathname);
  157. }
  158. drillForm.setAttribute("id", "drillForm");
  159. drillForm.setAttribute("name", "drillForm");
  160. drillForm.setAttribute("method", "post");
  161. drillForm.style.display = "none";
  162. document.body.appendChild(drillForm);
  163. return drillForm;
  164. }
  165. function addDrillEnvironmentFormFields(drillForm, oCV)
  166. {
  167. if (window.g_dfEmail) {
  168. drillForm.appendChild(createFormField("dfemail", window.g_dfEmail));
  169. }
  170. if(oCV != null)
  171. {
  172. drillForm.appendChild(createFormField("cv.id", oCV.getId()));
  173. if(typeof oCV.envParams["ui.sh"] != "undefined")
  174. {
  175. drillForm.appendChild(createFormField("ui.sh", oCV.envParams["ui.sh"]));
  176. }
  177. if(oCV.getViewerWidget() == null)
  178. {
  179. if(typeof oCV.envParams["cv.header"] != "undefined")
  180. {
  181. drillForm.appendChild(createFormField("cv.header", oCV.envParams["cv.header"]));
  182. }
  183. if(typeof oCV.envParams["cv.toolbar"] != "undefined")
  184. {
  185. drillForm.appendChild(createFormField("cv.toolbar", oCV.envParams["cv.toolbar"]));
  186. } else {
  187. var passPortletToolbarStateOnDrillThrough = oCV.getAdvancedServerProperty("VIEWER_PASS_PORTLET_TOOLBAR_STATE_ON_DRILLTHROUGH");
  188. if(oCV.m_viewerFragment && passPortletToolbarStateOnDrillThrough != null && passPortletToolbarStateOnDrillThrough === true ) {
  189. var showToolbar = oCV.m_viewerFragment.canShowToolbar() ? "true" : "false";
  190. drillForm.appendChild(createFormField("cv.toolbar", showToolbar));
  191. }
  192. }
  193. }
  194. if(typeof oCV.envParams["ui.backURL"] != "undefined")
  195. {
  196. drillForm.appendChild(createFormField("ui.backURL", oCV.envParams["ui.backURL"]));
  197. }
  198. if(typeof oCV.envParams["ui.postBack"] != "undefined")
  199. {
  200. drillForm.appendChild(createFormField("ui.postBack", oCV.envParams["ui.postBack"]));
  201. }
  202. if(typeof oCV.envParams["savedEnv"] != "undefined")
  203. {
  204. drillForm.appendChild(createFormField("savedEnv", oCV.envParams["savedEnv"]));
  205. }
  206. if(typeof oCV.envParams["ui.navlinks"] != "undefined")
  207. {
  208. drillForm.appendChild(createFormField("ui.navlinks", oCV.envParams["ui.navlinks"]));
  209. }
  210. if(typeof oCV.envParams["lang"] != "undefined")
  211. {
  212. drillForm.appendChild(createFormField("lang", oCV.envParams["lang"]));
  213. }
  214. if(typeof oCV.envParams["ui.errURL"] != "undefined")
  215. {
  216. drillForm.appendChild(createFormField("ui.errURL", oCV.envParams["ui.errURL"]));
  217. }
  218. var routingServerGroup = "";
  219. if(oCV.envParams["ui.routingServerGroup"])
  220. {
  221. routingServerGroup = oCV.envParams["ui.routingServerGroup"];
  222. }
  223. drillForm.appendChild(createHiddenFormField("ui.routingServerGroup", routingServerGroup));
  224. }
  225. else
  226. {
  227. drillForm.appendChild(createFormField("cv.header", "false"));
  228. drillForm.appendChild(createFormField("cv.toolbar", "false"));
  229. }
  230. }
  231. function appendReportHistoryObjects(oCV,drillForm)
  232. {
  233. if(oCV != null && typeof oCV.rvMainWnd != "undefined" && drillForm != null)
  234. {
  235. oCV.rvMainWnd.addCurrentReportToReportHistory();
  236. var reportHistorySpecification = oCV.rvMainWnd.saveReportHistoryAsXML();
  237. drillForm.appendChild(createFormField("cv.previousReports", reportHistorySpecification));
  238. }
  239. }
  240. function doSingleDrill(target,args,method,format,locale,bookmark,sourceContext,objectPaths,cvId,sPrompt,dynamicDrill)
  241. {
  242. var sCVId = "";
  243. if (typeof cvId == "string") {
  244. sCVId = cvId;
  245. }
  246. var oCV = null;
  247. try
  248. {
  249. oCV = getCognosViewerObjectRef(cvId);
  250. }
  251. catch(exception){}
  252. if (!oCV && parent != this && parent.doSingleDrill)
  253. {
  254. // if we're currently in an iframe, try and get the correct cvId from the iframe
  255. if (getCVId() != "" && getCVId() != cvId) {
  256. cvId = getCVId();
  257. }
  258. // Call the method in the parent which is most likely the RV
  259. return parent.doSingleDrill(target, args, method, format, locale, bookmark, sourceContext, objectPaths,cvId,sPrompt,dynamicDrill);
  260. }
  261. else
  262. {
  263. if(typeof method == "undefined")
  264. {
  265. method = "default";
  266. }
  267. else if(method == "execute")
  268. {
  269. method = "run";
  270. }
  271. // always open a new window if the drill through is set to edit and we're in a portlet
  272. if (method == "edit" && oCV != null && typeof oCV.m_viewerFragment) {
  273. target = "_blank";
  274. }
  275. var drillForm = buildDrillForm(oCV);
  276. var sDrillSpecification = "<authoredDrillRequest>";
  277. sDrillSpecification += "<param name=\"action\">" + sXmlEncode(method) + "</param>";
  278. sDrillSpecification += "<param name=\"target\">" + sXmlEncode(args[0][1]) + "</param>";
  279. sDrillSpecification += "<param name=\"format\">" + sXmlEncode(format) + "</param>";
  280. sDrillSpecification += "<param name=\"locale\">" + sXmlEncode(locale) + "</param>";
  281. sDrillSpecification += "<param name=\"prompt\">" + sXmlEncode(sPrompt) + "</param>";
  282. sDrillSpecification += "<param name=\"dynamicDrill\">" + sXmlEncode(dynamicDrill) + "</param>";
  283. if(typeof oCV != "undefined" && oCV != null)
  284. {
  285. sDrillSpecification += "<param name=\"sourceTracking\">" + oCV.getTracking() + "</param>";
  286. if(typeof document.forms["formWarpRequest" + oCV.getId()]["ui.object"] != "undefined")
  287. {
  288. sDrillSpecification += "<param name=\"source\">" + sXmlEncode(document.forms["formWarpRequest" + oCV.getId()]["ui.object"].value) + "</param>";
  289. }
  290. var modelPath = oCV.getModelPath();
  291. sDrillSpecification += "<param name=\"metadataModel\">" + sXmlEncode(modelPath) + "</param>";
  292. sDrillSpecification += "<param name=\"selectionContext\">" + sXmlEncode(getViewerSelectionContext(oCV.getSelectionController(), new CSelectionContext(modelPath))) + "</param>";
  293. if(typeof document.forms["formWarpRequest" + oCV.getId()]["ui.object"] != "undefined" && document.forms["formWarpRequest" + oCV.getId()]["ui.object"].value != "")
  294. {
  295. sDrillSpecification += "<param name=\"source\">" + sXmlEncode(document.forms["formWarpRequest" + oCV.getId()]["ui.object"].value) + "</param>";
  296. }
  297. else if(typeof oCV.envParams["ui.spec"] != "undefined")
  298. {
  299. sDrillSpecification += "<param name=\"sourceSpecification\">" + sXmlEncode(oCV.envParams["ui.spec"]) + "</param>";
  300. }
  301. }
  302. if (bookmark != "")
  303. {
  304. sDrillSpecification += "<param name=\"bookmark\">" + bookmark + "</param>";
  305. }
  306. if(method != "view")
  307. {
  308. if(typeof sourceContext != "undefined")
  309. {
  310. sDrillSpecification += "<param name=\"sourceContext\">" + sXmlEncode(sourceContext) + "</param>";
  311. }
  312. if(typeof objectPaths != "undefined")
  313. {
  314. sDrillSpecification += "<param name=\"objectPaths\">" + sXmlEncode(objectPaths) + "</param>";
  315. }
  316. }
  317. var idxArg = 0;
  318. sDrillSpecification += "<drillParameters>";
  319. var aDrillSpecParams = [];
  320. for (idxArg = 1; idxArg < args.length; idxArg++)
  321. {
  322. // HS 622739 : RSVP currently inconsistent about substituting MUN for useValue. This code can be
  323. // reverted once a clear contract is designed between RSVP and Viewer.
  324. var sSel = args[idxArg][1];
  325. if ( format == 'HTML' && (sSel.indexOf("<selectChoices") == 0) )
  326. {
  327. var selectionChoicesSpecification = XMLHelper_GetFirstChildElement( XMLHelper_GetFirstChildElement( XMLBuilderLoadXMLFromString (args[idxArg][1]) ));
  328. if (selectionChoicesSpecification)
  329. {
  330. var sMun = selectionChoicesSpecification.getAttribute("mun");
  331. if(sMun != null && sMun != "")
  332. {
  333. selectionChoicesSpecification.setAttribute("useValue", sMun);
  334. sSel = "<selectChoices>" + XMLBuilderSerializeNode(selectionChoicesSpecification) + "</selectChoices>";
  335. }
  336. }
  337. }
  338. // End HS 622739.
  339. var paramName = args[idxArg][0];
  340. var bFound = false;
  341. for (var i = 0; i < aDrillSpecParams.length; i++) {
  342. var param = aDrillSpecParams[i];
  343. if (param.name === paramName && param.value === sSel) {
  344. bFound = true;
  345. break;
  346. }
  347. }
  348. if (!bFound) {
  349. aDrillSpecParams.push({"name" : paramName, "value" : sSel});
  350. sDrillSpecification += "<param name=\"" + sXmlEncode(paramName) + "\">" + sXmlEncode(sSel) + "</param>";
  351. }
  352. }
  353. sDrillSpecification += "</drillParameters>";
  354. sDrillSpecification += getExecutionParamNode(oCV);
  355. sDrillSpecification += "</authoredDrillRequest>";
  356. drillForm.appendChild(createFormField("authoredDrill.request", sDrillSpecification));
  357. drillForm.appendChild(createFormField("ui.action", "authoredDrillThrough2"));
  358. drillForm.appendChild(createFormField("b_action", "cognosViewer"));
  359. addDrillEnvironmentFormFields(drillForm, oCV);
  360. // executeDrillThroughForIWidgetMobile will return true if it executed the drill through
  361. if (!oCV || !oCV.executeDrillThroughForIWidgetMobile(drillForm)) {
  362. // Used to override the default drill of submitting a form
  363. if (oCV && typeof oCV.sendDrillThroughRequest === "function") {
  364. oCV.sendDrillThroughRequest(drillForm);
  365. }
  366. // <!-- if drill through format isXLS or CSV or we're in a fragment then ALWAYS open a new window -->
  367. else if(target == "" && oCV != null && typeof oCV.m_viewerFragment != "undefined")
  368. {
  369. oCV.m_viewerFragment.raiseAuthoredDrillEvent(sDrillSpecification);
  370. }
  371. else if( (oCV != null && oCV.getViewerWidget() != null) || target != "" )
  372. {
  373. setBackURLToCloseWindow(drillForm);
  374. var sTarget = "winNAT_" + ( new Date() ).getTime();
  375. var sWebContentRoot = "..";
  376. if (oCV != null)
  377. {
  378. sWebContentRoot = oCV.getWebContentRoot();
  379. }
  380. var sPath = sWebContentRoot + "/rv/blankDrillWin.html";
  381. if (sCVId)
  382. {
  383. sPath += "?cv.id=" + sCVId;
  384. }
  385. // if there is no classic viewer (oCV) we should be able to
  386. // assume that there is no glass either
  387. // in that case we should call the classicviewer perspective
  388. // and pass in the drillForm.
  389. if (oCV == null)
  390. {
  391. // window.location.hrefwould look similar to the following
  392. // http://localhost/ibmcognos/bidev/v1/disp/repository/sid/cm/oid/id68a0f47a5a24cfd98a120bdba15882b/content
  393. // we want to get everything from the beginning of the string to /v1
  394. sPath = window.location.href.substring(0,window.location.href.indexOf("/v1"));
  395. // sPath now equals
  396. // http://localhost/ibmcognos/bidev
  397. sPath += "/?perspective=classicviewer";
  398. // sPath now equals
  399. // http://localhost/ibmcognos/bidev/?perspective=classicviewer
  400. // we want to use the alternative drill path
  401. sPath += "&altDrillFlag=true";
  402. // add the format (really for PDF so the perspective can react accordingly)
  403. sPath += "&format=" + sXmlEncode(format);
  404. // Give the form a unique name
  405. var v_sLabel = drillForm.getAttribute("name") + Date.now().toString();
  406. drillForm.setAttribute("name", v_sLabel);
  407. // store the form (in string form) into the browser storage
  408. if (typeof(Storage) !== "undefined") {
  409. localStorage.setItem(v_sLabel, drillForm.outerHTML);
  410. // put this unique identifer into the parameters to pass
  411. sPath += "&drillFormLabel=" + v_sLabel;
  412. // sPath now equals
  413. // http://localhost/ibmcognos/bidev/?perspective=classicviewer&drillFormLabel=<some unique label>
  414. }
  415. else
  416. {
  417. console.log("Sorry! No Web Storage support...");
  418. }
  419. }
  420. if (window.gViewerLogger)
  421. {
  422. window.gViewerLogger.log('Drill Specification', sDrillSpecification, "xml");
  423. }
  424. drillForm.target = sTarget;
  425. newWindow = window.open( sPath, sTarget );
  426. }
  427. else
  428. {
  429. appendReportHistoryObjects(oCV, drillForm);
  430. if (window.gViewerLogger)
  431. {
  432. window.gViewerLogger.log('Drill Specification', sDrillSpecification, "xml");
  433. }
  434. drillForm.target = (oCV && oCV.getDrillFormTarget) ? oCV.getDrillFormTarget() : "_self";
  435. drillForm.submit();
  436. if (oCV != null && !oCV.getDrillFormTarget)
  437. {
  438. setTimeout(getCognosViewerObjectRefAsString(oCV.getId())+".getRequestIndicator().show()",10);
  439. }
  440. }
  441. }
  442. }
  443. }
  444. function getExecutionParamNode(oCV)
  445. {
  446. var sExecutionParamNode = "";
  447. if(typeof oCV != "undefined" && oCV != null)
  448. {
  449. var sExecutionParameters = oCV.getExecutionParameters();
  450. if(sExecutionParameters != "")
  451. {
  452. sExecutionParamNode += "<param name=\"executionParameters\">";
  453. sExecutionParamNode += sXmlEncode(sExecutionParameters);
  454. sExecutionParamNode += "</param>";
  455. }
  456. }
  457. return sExecutionParamNode;
  458. }
  459. function doSingleDrillThrough(drillThroughContext, bookmarkRef, cvId)
  460. {
  461. // handle a single drill
  462. var drillTargetRefIdx = drillThroughContext[0][0];
  463. if(typeof drillTargetRefIdx == "undefined" || drillTargetRefIdx == null) {
  464. return;
  465. }
  466. var drillTargetRef = cvId && window[cvId + "drillTargets"] ? window[cvId + "drillTargets"][drillTargetRefIdx] : drillTargets[drillTargetRefIdx];
  467. if(typeof drillTargetRef == "undefined") {
  468. return;
  469. }
  470. // check for the case of a local bookmark
  471. if(bookmarkRef != '' && drillTargetRef.getPath() == '') {
  472. document.location = "#" + bookmarkRef;
  473. } else {
  474. var args = [];
  475. args[args.length] = ["ui.object", drillTargetRef.getPath()];
  476. for(var drillParmIdx = 1; drillParmIdx < drillThroughContext.length; ++drillParmIdx) {
  477. args[args.length] = drillThroughContext[drillParmIdx];
  478. }
  479. var target="";
  480. if(drillTargetRef.getShowInNewWindow()=='true') {
  481. target = "_blank";
  482. }
  483. var parametersString = drillTargetRef.getParameters();
  484. var objectPaths = drillTargetRef.getObjectPaths();
  485. var oCVId = cvId;
  486. if (!cvId)
  487. {
  488. oCVId = getCVId();
  489. }
  490. doSingleDrill(target, args, drillTargetRef.getMethod(), drillTargetRef.getOutputFormat(), drillTargetRef.getOutputLocale(), bookmarkRef, parametersString, objectPaths, oCVId, drillTargetRef.getPrompt(), false);
  491. }
  492. }
  493. function getCVId()
  494. {
  495. var sCVId = "";
  496. try
  497. {
  498. sCVId = this.frameElement.id.substring("CVIFrame".length);
  499. }
  500. catch(exception){}
  501. return sCVId;
  502. }
  503. function doMultipleDrillThrough(drillThroughContext, cvId)
  504. {
  505. // handle multiple drills
  506. var drillThroughTargetStr = '<rvDrillTargets>';
  507. for(var drillTargetIdx = 0; drillTargetIdx < drillThroughContext.length; ++drillTargetIdx) {
  508. var currentDrillThroughContext = drillThroughContext[drillTargetIdx];
  509. if(currentDrillThroughContext.length < 3) {
  510. // there must be three or more parameters (drill idx, drill label and the drill parameters)
  511. continue;
  512. }
  513. var drillTargetRefIdx = currentDrillThroughContext[0];
  514. if(typeof drillTargetRefIdx == "undefined" || drillTargetRefIdx == null) {
  515. continue;
  516. }
  517. var drillTargetLabel = currentDrillThroughContext[1];
  518. if (typeof drillTargetLabel == "undefined" || drillTargetLabel == null) {
  519. continue;
  520. }
  521. var drillTargetRef = cvId && window[cvId + "drillTargets"] ? window[cvId + "drillTargets"][drillTargetRefIdx] : drillTargets[drillTargetRefIdx];
  522. if(typeof drillTargetRef == "undefined" || drillTargetRef == null) {
  523. continue;
  524. }
  525. if(drillTargetLabel === null || drillTargetLabel === "")
  526. {
  527. drillTargetLabel = drillTargetRef.getLabel();
  528. }
  529. drillThroughTargetStr += '<drillTarget ';
  530. drillThroughTargetStr += 'outputFormat="'; drillThroughTargetStr += drillTargetRef.getOutputFormat(); drillThroughTargetStr += '" ';
  531. drillThroughTargetStr += 'outputLocale="'; drillThroughTargetStr += drillTargetRef.getOutputLocale(); drillThroughTargetStr += '" ';
  532. drillThroughTargetStr += 'label="'; drillThroughTargetStr += sXmlEncode(drillTargetLabel); drillThroughTargetStr += '" ';
  533. drillThroughTargetStr += 'path="'; drillThroughTargetStr += sXmlEncode(drillTargetRef.getPath()); drillThroughTargetStr += '" ';
  534. drillThroughTargetStr += 'showInNewWindow="'; drillThroughTargetStr += drillTargetRef.getShowInNewWindow(); drillThroughTargetStr += '" ';
  535. drillThroughTargetStr += 'method="'; drillThroughTargetStr += drillTargetRef.getMethod(); drillThroughTargetStr += '" ';
  536. drillThroughTargetStr += 'prompt="'; drillThroughTargetStr += drillTargetRef.getPrompt(); drillThroughTargetStr += '" ';
  537. drillThroughTargetStr += 'dynamicDrill="'; drillThroughTargetStr += drillTargetRef.isDynamicDrillThrough(); drillThroughTargetStr += '">';
  538. for(var drillParmIdx = 2; drillParmIdx < currentDrillThroughContext.length; ++drillParmIdx) {
  539. drillThroughTargetStr += currentDrillThroughContext[drillParmIdx];
  540. }
  541. drillThroughTargetStr += drillTargetRef.getParameters();
  542. drillThroughTargetStr += drillTargetRef.getObjectPaths();
  543. drillThroughTargetStr += '</drillTarget>';
  544. }
  545. drillThroughTargetStr += '</rvDrillTargets>';
  546. if (!cvId) {
  547. cvId = getCVId();
  548. }
  549. doMultipleDrills(drillThroughTargetStr, cvId);
  550. }