formatNumericAdvanced.xts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/QSRVUITextPL.xml,messages/portal.xml,messages/portalRL.xml" requiredCapability="canUseQueryStudio">
  13. <xts:block id="page" type="exec" mode="output" processor="XSLT" mimeType="text/html">
  14. <!-- get the debug logic sheet -->
  15. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  16. <!-- get the new theme stuff -->
  17. <xts:logicsheet path="logicsheets/portal.xsl"/>
  18. <xts:logicsheet path="qs/logicsheets/dialogs.xsl"/>
  19. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  20. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  21. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  22. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  23. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  24. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  25. <!-- apply the form logic -->
  26. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  27. <xsl:stylesheet version="1.0"
  28. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  29. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  30. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  31. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  32. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  33. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  34. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  35. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  36. xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/"
  37. xmlns:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/"
  38. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  39. exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg qsdlg xtsext">
  40. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  41. <!-- add any theme variables -->
  42. <df:variables/>
  43. <pf:variables/>
  44. <!-- start the output -->
  45. <xsl:template match="/root">
  46. <dp:page>
  47. <dp:script>
  48. <script type="text/javascript">
  49. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  50. <xsl:text/>//<xsl:text/>
  51. </script>
  52. <script type="text/javascript">
  53. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  54. <xsl:text/>//<xsl:text/>
  55. </script>
  56. <script type="text/javascript">
  57. var cf = getConfigFrame();
  58. var dlg = cf.dlgGlobalGetParm('xxformatDlgType');
  59. var goDialogManager = new CDialogManager();
  60. function removeInsert() {
  61. document.getElementById("formatOK").removeAttribute("href");
  62. }
  63. function callFormatDlg()
  64. {
  65. if (cf)
  66. {
  67. storeCurrentValues();
  68. var dlg = document.f.formatDlgType.options[document.f.formatDlgType.selectedIndex].value;
  69. if (dlg == "default")
  70. cf.cfgSet("formatDlgAdvanced", false);
  71. cf.cfgSet("formatDlgType", dlg);
  72. removeInsert();
  73. cf.format();
  74. }
  75. }
  76. function execute()
  77. {
  78. if (cf)
  79. {
  80. var addCount = 0;
  81. var addListArray = new Array();
  82. var remCount = 6;
  83. var remListArray = new Array("decimalSize","sign","useTrailingSign","useGrouping","currencyCode","useIntlSymbol");
  84. var dlg = document.f.formatDlgType.options[document.f.formatDlgType.selectedIndex].value;
  85. if (!(document.f.positivecb.indeterminate))
  86. {
  87. if ((document.f.positivecb.checked &amp;&amp; document.f.positive.value == "") || !(document.f.positivecb.checked))
  88. {
  89. remCount++;
  90. remListArray[remListArray.length] = "pattern";
  91. }
  92. else
  93. {
  94. addCount++;
  95. addListArray[addListArray.length]= "pattern";
  96. addListArray[addListArray.length]= cf.escapeParam(document.f.positive.value);
  97. }
  98. }
  99. if (!(document.f.negativecb.indeterminate))
  100. {
  101. if ((document.f.negativecb.checked &amp;&amp; document.f.negative.value == "") || !(document.f.negativecb.checked))
  102. {
  103. remCount++;
  104. remListArray[remListArray.length]= "whenNegative";
  105. }
  106. else
  107. {
  108. addCount++;
  109. addListArray[addListArray.length]= "whenNegative";
  110. addListArray[addListArray.length]= cf.escapeParam(document.f.negative.value);
  111. }
  112. }
  113. if (!(document.f.zeroscb.indeterminate))
  114. {
  115. if ((document.f.zeroscb.checked &amp;&amp; document.f.zeros.value == "") || !(document.f.zeroscb.checked))
  116. {
  117. remCount++;
  118. remListArray[remListArray.length]= "whenZero";
  119. }
  120. else
  121. {
  122. addCount++;
  123. remListArray[remListArray.length]= "whenZero";
  124. remListArray[remListArray.length]= cf.escapeParam(document.f.zeros.value);
  125. }
  126. }
  127. if (!(document.f.missingcb.indeterminate))
  128. {
  129. if ((document.f.missingcb.checked &amp;&amp; document.f.missing.value == "") || !(document.f.missingcb.checked))
  130. {
  131. remCount++;
  132. remListArray[remListArray.length]= "whenMissing";
  133. }
  134. else
  135. {
  136. addCount++;
  137. addListArray[addListArray.length]= "whenMissing";
  138. addListArray[addListArray.length]= cf.escapeParam(document.f.missing.value);
  139. }
  140. }
  141. if (dlg != "scientific")
  142. {
  143. remCount+= 4;
  144. remListArray[remListArray.length]= "exponentSymbol";
  145. remListArray[remListArray.length]= "exponentSize";
  146. remListArray[remListArray.length]= "useScientific";
  147. remListArray[remListArray.length]= (dlg != "percentage") ? "percentSymbol" : "scale";
  148. var attValue = document.f.scale.options[document.f.scale.selectedIndex].value;
  149. if (attValue != "mixed")
  150. {
  151. addCount++;
  152. if (dlg != "percentage")
  153. {
  154. addListArray[addListArray.length]= "scale";
  155. addListArray[addListArray.length]= cf.escapeParam(attValue);
  156. }
  157. else
  158. {
  159. addListArray[addListArray.length]= "percentSymbol";
  160. addListArray[addListArray.length]= cf.escapeParam(attValue);
  161. }
  162. }
  163. }
  164. else
  165. {
  166. remCount += 2;
  167. remListArray[remListArray.length]= "percentSymbol";
  168. remListArray[remListArray.length]= "scale";
  169. addCount += 3;
  170. addListArray[addListArray.length]= "exponentSymbol";
  171. addListArray[addListArray.length]= cf.escapeParam("E");
  172. addListArray[addListArray.length]= "exponentSize";
  173. addListArray[addListArray.length]= cf.escapeParam("2");
  174. addListArray[addListArray.length]= "useScientific";
  175. addListArray[addListArray.length]= cf.escapeParam("true");
  176. }
  177. var cmdArray = new Array(dlg, "advanced", addCount);
  178. cmdArray = cmdArray.concat(addListArray);
  179. cmdArray[cmdArray.length] = remCount;
  180. cmdArray = cmdArray.concat(remListArray);
  181. for (var i = 0; i &lt; cf.dlgGlobalSize('xxformatSelCols'); i++)
  182. cmdArray[cmdArray.length] = cf.escapeParam(cf.dlgGlobalGetParmAt('xxformatSelCols', i));
  183. cf.addColumnsForReselection();
  184. cf.submitFormat(cmdArray);
  185. }
  186. }
  187. function init()
  188. {
  189. attachMouseEvents();
  190. with (document)
  191. {
  192. if (cf)
  193. {
  194. if (cf.showDialogFrame) cf.showDialogFrame(410);
  195. var i = 0;
  196. document.f.formatDlgType.options[i++] = new Option("<xts:string id="DIALOG_DEFAULT_OPTION" encode="javascript"/>","default", false, false);
  197. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_NUMBER_OPTION" encode="javascript"/>","number", false, false);
  198. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_CURRENCY_OPTION" encode="javascript"/>","currency", false, false);
  199. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_PERCENTAGE_OPTION" encode="javascript"/>","percentage", false, false);
  200. document.f.formatDlgType.options[i] = new Option("<xts:string id="FORMAT_SCIENTIFIC_OPTION" encode="javascript"/>","scientific", false, false);
  201. i = 0;
  202. while ( i &lt; document.f.formatDlgType.options.length)
  203. {
  204. if (document.f.formatDlgType.options[i].value == dlg)
  205. {
  206. document.f.formatDlgType.selectedIndex = i;
  207. break;
  208. }
  209. i++;
  210. }
  211. if (dlg == "default")
  212. {
  213. document.f.formatDlgType.focus();
  214. return;
  215. }
  216. var scale = "No scale";
  217. var percentSymbol = "%";
  218. var dlgVars = cf.cfgGet("formatDlgVars");
  219. if (dlgVars == dlg + "A")
  220. {
  221. if (cf.dlgGlobalGetParm('xxScale') != null)
  222. scale = cf.dlgGlobalGetParm('xxScale');
  223. if (cf.dlgGlobalGetParm('xxPercentSymbol') != null)
  224. percentSymbol = cf.dlgGlobalGetParm('xxPercentSymbol');
  225. if (cf.dlgGlobalGetParm('xxPattern') != "mixed")
  226. document.f.positive.value = cf.dlgGlobalGetParm('xxPattern');
  227. else
  228. document.f.positivecb.indeterminate = true;
  229. if (cf.dlgGlobalGetParm('xxNegative') != "mixed")
  230. document.f.negative.value = cf.dlgGlobalGetParm('xxNegative');
  231. else
  232. document.f.negativecb.indeterminate = true;
  233. if (cf.dlgGlobalGetParm('xxZero') != "mixed")
  234. document.f.zeros.value = cf.dlgGlobalGetParm('xxZero');
  235. else
  236. document.f.zeroscb.indeterminate = true;
  237. if (cf.dlgGlobalGetParm('xxMissing') != "mixed")
  238. document.f.missing.value = cf.dlgGlobalGetParm('xxMissing');
  239. else
  240. document.f.missingcb.indeterminate = true;
  241. }
  242. scale = (cf.cfgGet("formatCurrentScale") != null) ? cf.cfgGet("formatCurrentScale") : scale;
  243. percentSymbol = (cf.cfgGet("formatCurrentPercentSymbol") != null) ? cf.cfgGet("formatCurrentPercentSymbol") : percentSymbol;
  244. if (dlg != "scientific")
  245. {
  246. document.getElementById("displayNonScientific").style.display = "inline";
  247. i = 0;
  248. if (scale == "mixed" || percentSymbol == "mixed")
  249. document.f.scale.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false,true);
  250. if (dlg == 'number' || dlg == 'currency')
  251. {
  252. document.f.scale.options[i++] = new Option("<xts:string id="FORMAT_NO_SCALE_OPTION" encode="javascript"/>","0",false,false);
  253. document.f.scale.options[i++] = new Option("100","-2",false,false);
  254. document.f.scale.options[i++] = new Option("1000","-3",false,false);
  255. document.f.scale.options[i++] = new Option("1 000 000","-6",false,false);
  256. document.f.scale.options[i] = new Option("1 000 000 000","-9",false,false);
  257. }
  258. else if (dlg == 'percentage')
  259. {
  260. document.f.scale.options[i++] = new Option("<xts:string id="FORMAT_PERCENT_100_OPTION" encode="javascript"/>","%",false,false);
  261. document.f.scale.options[i] = new Option("<xts:string id="FORMAT_PER_THOUSAND_OPTION" encode="javascript"/>","&#8240;",false,false);
  262. }
  263. for (var i = 0; i &lt; document.f.scale.options.length; i++)
  264. {
  265. if (document.f.scale.options[i].value == scale || document.f.scale.options[i].value == percentSymbol)
  266. {
  267. document.f.scale.selectedIndex = i;
  268. break;
  269. }
  270. }
  271. }
  272. }
  273. document.f.formatDlgType.focus();
  274. }
  275. }
  276. function onChangeEdit()
  277. {
  278. if (document.f.positive.value != "")
  279. document.f.positivecb.indeterminate = false;
  280. if (document.f.negative.value != "")
  281. document.f.negativecb.indeterminate = false;
  282. if (document.f.zeros.value != "")
  283. document.f.zeroscb.indeterminate = false;
  284. if (document.f.missing.value != "")
  285. document.f.missingcb.indeterminate = false;
  286. }
  287. function basicDlg()
  288. {
  289. storeCurrentValues();
  290. if (cf)
  291. {
  292. cf.cfgSet("formatDlgAdvanced", "false");
  293. removeInsert();
  294. cf.format();
  295. }
  296. }
  297. function storeCurrentValues()
  298. {
  299. if (cf)
  300. {
  301. var oldType = cf.dlgGlobalGetParm('xxformatDlgType');
  302. if (oldType != "default" &amp;&amp; oldType != "mixed" &amp;&amp; oldType != "scientific")
  303. {
  304. cf.cfgSet("formatCurrentScale", document.f.scale.options[document.f.scale.selectedIndex].value);
  305. if (oldType == "percentage")
  306. cf.cfgSet("formatCurrentPercentSymbol", document.f.scale.options[document.f.scale.selectedIndex].value);
  307. }
  308. }
  309. }
  310. </script>
  311. <script type="text/javascript">
  312. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/dialogs/executeButton.js</xsl:attribute>
  313. <xsl:text/>//<xsl:text/>
  314. </script>
  315. </dp:script>
  316. <form style="margin:0px" name="f" method="POST" onsubmit="execute();return false;">
  317. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  318. <tr>
  319. <td width="100%" height="0%">
  320. <!-- dialog header -->
  321. <dp:header help="false">
  322. <!-- header titles -->
  323. <dp:title>
  324. <xts:string id="FORMAT_ADVANCED_TITLE"/>
  325. </dp:title>
  326. <!-- close link for the header -->
  327. <dp:close>
  328. <a href="javascript:getConfigFrame().hideDialogFrame()">
  329. <dp:closeMarker/>
  330. </a>
  331. </dp:close>
  332. <!-- header links -->
  333. <dp:headerLinks>
  334. <dp:headerLink>
  335. <dp:hl_attribute name="href">javascript:basicDlg()</dp:hl_attribute>
  336. <dp:hl_attribute name="label"><xts:string id="FORMAT_BACK_TO_BASIC_LINK"/></dp:hl_attribute>
  337. </dp:headerLink>
  338. </dp:headerLinks>
  339. <!-- description (hint text) -->
  340. <dp:description>
  341. <xts:string id="FORMAT_ADV_NUM_DESCRIPTION"/>
  342. </dp:description>
  343. </dp:header>
  344. </td>
  345. </tr>
  346. <tr>
  347. <td width="100%" height="100%" valign="top">
  348. <!-- layout -->
  349. <lyt:layout style="2" border="no">
  350. <lyt:section height="264">
  351. <dp:input>
  352. <dp:section1>
  353. <xts:string id="FORMAT_CATEGORY_LABEL"/>
  354. </dp:section1>
  355. <dp:section2>
  356. <select name="formatDlgType" onchange="callFormatDlg()"/>
  357. </dp:section2>
  358. </dp:input>
  359. <dp:choice>
  360. <dp:section1>
  361. <input name="positivecb" type="checkbox" checked=""/>
  362. </dp:section1>
  363. <dp:section2 type="label">
  364. <xts:string id="FORMAT_POSITIVE_NUMBERS_LABEL"/>
  365. </dp:section2>
  366. <dp:section3>
  367. <input type="text" name="positive" size="16" onKeyDown="javascript:setTimeout(onChangeEdit, 10);" onKeyUp="javascript:if (event.keyCode == 13) execute();"/>
  368. </dp:section3>
  369. </dp:choice>
  370. <dp:choice>
  371. <dp:section1>
  372. <input name="negativecb" type="checkbox" checked=""/>
  373. </dp:section1>
  374. <dp:section2 type="label">
  375. <xts:string id="FORMAT_NEGATIVE_NUMBERS_LABEL"/>
  376. </dp:section2>
  377. <dp:section3>
  378. <input type="text" name="negative" size="16" onKeyDown="javascript:setTimeout(onChangeEdit, 10);" onKeyUp="javascript:if (event.keyCode == 13) execute();"/>
  379. </dp:section3>
  380. </dp:choice>
  381. <dp:choice>
  382. <dp:section1>
  383. <input name="zeroscb" type="checkbox" checked=""/>
  384. </dp:section1>
  385. <dp:section2 type="label">
  386. <xts:string id="FORMAT_ZEROS_LABEL"/>
  387. </dp:section2>
  388. <dp:section3>
  389. <input type="text" name="zeros" size="16" onKeyDown="javascript:setTimeout(onChangeEdit, 10);" onKeyUp="javascript:if (event.keyCode == 13) execute();"/>
  390. </dp:section3>
  391. </dp:choice>
  392. <dp:choice>
  393. <dp:section1>
  394. <input name="missingcb" type="checkbox" checked=""/>
  395. </dp:section1>
  396. <dp:section2 type="label">
  397. <xts:string id="FORMAT_MISSING_VALUES_LABEL"/>
  398. </dp:section2>
  399. <dp:section3>
  400. <input type="text" name="missing" size="16" onKeyDown="javascript:setTimeout(onChangeEdit, 10);" onKeyUp="javascript:if (event.keyCode == 13) execute();"/>
  401. </dp:section3>
  402. </dp:choice>
  403. </lyt:section>
  404. <lyt:section>
  405. <div id="displayNonScientific" style="display:none">
  406. <dp:input>
  407. <dp:section1>
  408. <BR/>
  409. <BR/>
  410. <BR/>
  411. <BR/>
  412. <xts:string id="FORMAT_SCALE_LABEL"/>
  413. </dp:section1>
  414. <dp:section2>
  415. <select name="scale"/>
  416. </dp:section2>
  417. </dp:input>
  418. </div>
  419. </lyt:section>
  420. </lyt:layout>
  421. </td>
  422. </tr>
  423. <tr>
  424. <td width="100%" height="0%">
  425. <qsdlg:defaultFormatNumButtons/>
  426. </td>
  427. </tr>
  428. <!--dbg:dumpxml select="/"/-->
  429. </table>
  430. </form>
  431. </dp:page>
  432. </xsl:template>
  433. </xsl:stylesheet>
  434. </xts:block>
  435. </xts:morphlet>