formatNumeric.xts 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  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="getContent" mode="interpret" processor="XSLT" type="exec" condition=".[/root/env/param[@name='listsLoaded']!='true']" mandatory="false">
  14. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  15. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/cm/1/" xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope">
  16. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  17. <xsl:template match="/">
  18. <xts:sequence>
  19. <xts:append>
  20. <currencyList>
  21. <xts:request asText="true" href="bus://dispatcher" protocol="BUS" soapAction="http://www.ibm.com/xmlns/prod/cognos/systemService/201404/">
  22. <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  23. <SOAP-ENV:Header>
  24. <xsl:copy-of select="/root/header/*"/>
  25. </SOAP-ENV:Header>
  26. <SOAP-ENV:Body>
  27. <bus:getConfiguration xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  28. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:configurationDataEnum[]">
  29. <item xsi:type="bus:configurationDataEnum">supportedCurrencies</item>
  30. </properties>
  31. </bus:getConfiguration>
  32. </SOAP-ENV:Body>
  33. </SOAP-ENV:Envelope>
  34. </xts:request>
  35. </currencyList>
  36. </xts:append>
  37. <xts:append>
  38. <negativesList>
  39. <xts:request asText="true" href="bus://dispatcher" protocol="BUS" soapAction="http://www.ibm.com/xmlns/prod/cognos/systemService/201404/">
  40. <SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
  41. <SOAP-ENV:Header>
  42. <xsl:copy-of select="/root/header/*"/>
  43. <ns1:biBusHeader href="#id0" xmlns:ns1="http://developer.cognos.com/schemas/bibus/3/"/>
  44. </SOAP-ENV:Header>
  45. <SOAP-ENV:Body>
  46. <ns2:getFormatSamples xmlns:ns2="http://developer.cognos.com/schemas/bibus/3/">
  47. <name xsi:type="xsd:string">qsnegatives</name>
  48. </ns2:getFormatSamples>
  49. <multiRef id="id0" SOAP-ENC:root="0" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns4:biBusHeader" xmlns:ns3="http://schemas.xmlsoap.org/soap/envelope/:encodingStyle" xmlns:ns4="http://developer.cognos.com/schemas/bibus/3/">
  50. <ns4:CAM href="#id1"/>
  51. <ns4:hdrSession xsi:nil="true"/>
  52. <ns4:providers xsi:nil="true"/>
  53. <ns4:userPreferenceVars xsi:nil="true"/>
  54. <ns4:tracking xsi:nil="true"/>
  55. <ns4:dispatcherTransportVars xsi:nil="true"/>
  56. <ns4:CAMProtect xsi:nil="true"/>
  57. </multiRef>
  58. <multiRef id="id1" SOAP-ENC:root="0" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xsi:type="ns5:CAM" xmlns:ns5="http://developer.cognos.com/schemas/bibus/3/">
  59. <ns5:action xsi:type="xsd:string">logon</ns5:action>
  60. <ns5:credential xsi:nil="true"/>
  61. <ns5:securityBlob xsi:nil="true"/>
  62. <ns5:CAMPassport xsi:nil="true"/>
  63. <ns5:CAMCredentialPath xsi:nil="true"/>
  64. <ns5:exception xsi:nil="true"/>
  65. <ns5:roles xsi:nil="true"/>
  66. </multiRef>
  67. </SOAP-ENV:Body>
  68. </SOAP-ENV:Envelope>
  69. </xts:request>
  70. </negativesList>
  71. </xts:append>
  72. </xts:sequence>
  73. </xsl:template>
  74. </xsl:stylesheet>
  75. </xts:block>
  76. <xts:block id="appendDocument" mode="interpret" processor="XSLT" type="exec" dependency="getContent" condition=".[/root/env/param[@name='listsLoaded']!='true']" mandatory="false">
  77. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  78. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  79. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  80. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  81. xmlns:cm="http://developer.cognos.com/schemas/cm/1/"
  82. xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope"
  83. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  84. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  85. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  86. <xsl:template match="/root">
  87. <xts:sequence>
  88. <xts:update select="/root/currencyList">
  89. <currencyList>
  90. <xsl:for-each select="./currencyList/bus:getConfigurationResponse/configuration/supportedCurrencies/item">
  91. <currencyFormat>
  92. <xsl:attribute name="currencyCode">
  93. <xsl:value-of select="./currency" disable-output-escaping="yes"/>
  94. </xsl:attribute>
  95. <xsl:value-of select="./description" disable-output-escaping="yes"/>
  96. </currencyFormat>
  97. </xsl:for-each>
  98. </currencyList>
  99. </xts:update>
  100. <xts:update select="/root/negativesList">
  101. <negativesList>
  102. <xsl:for-each select="./negativesList/bus:getFormatSamplesResponse/samples/item">
  103. <xsl:value-of select="." disable-output-escaping="yes"/>
  104. </xsl:for-each>
  105. </negativesList>
  106. </xts:update>
  107. </xts:sequence>
  108. </xsl:template>
  109. </xsl:stylesheet>
  110. </xts:block>
  111. <xts:block id="page" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="appendDocument">
  112. <!-- get the debug logic sheet -->
  113. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  114. <!-- get the new theme stuff -->
  115. <xts:logicsheet path="logicsheets/portal.xsl"/>
  116. <xts:logicsheet path="qs/logicsheets/dialogs.xsl"/>
  117. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  118. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  119. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  120. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  121. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  122. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  123. <!-- apply the form logic -->
  124. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  125. <xsl:stylesheet version="1.0"
  126. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  127. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  128. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  129. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  130. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  131. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  132. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  133. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  134. xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/"
  135. xmlns:qsdlg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/qs/dialog/"
  136. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  137. exclude-result-prefixes="xsl xts lyt pf dp df cp cf dbg qsdlg xtsext">
  138. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  139. <!-- add any theme variables -->
  140. <df:variables/>
  141. <pf:variables/>
  142. <xsl:key name="param-name" match="/root/env/param" use="@name"/>
  143. <!-- start the output -->
  144. <xsl:template match="/root">
  145. <xsl:variable name="dlgType" select="key('param-name','xxformatDlgType')"/>
  146. <xsl:variable name="listsLoaded" select="key('param-name','listsLoaded')"/>
  147. <dp:page>
  148. <dp:script>
  149. <script type="text/javascript">
  150. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/layout.js</xsl:attribute>
  151. <xsl:text/>//<xsl:text/>
  152. </script>
  153. <script type="text/javascript">
  154. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/classes/CDialogManager.js</xsl:attribute>
  155. <xsl:text/>//<xsl:text/>
  156. </script>
  157. <script type="text/javascript">
  158. var cf = getConfigFrame();
  159. var dlg = cf.dlgGlobalGetParm('xxformatDlgType');
  160. var goDialogManager = new CDialogManager();
  161. function removeInsert() {
  162. document.getElementById("formatOK").removeAttribute("href");
  163. }
  164. function callFormatDlg()
  165. {
  166. storeCurrentValues();
  167. if (cf)
  168. {
  169. var dlgSelected = document.f.formatDlgType.options[document.f.formatDlgType.selectedIndex].value;
  170. if (dlgSelected == "default")
  171. cf.cfgSet("formatDlgAdvanced", false);
  172. cf.cfgSet("formatDlgType", dlgSelected);
  173. removeInsert();
  174. cf.format();
  175. }
  176. }
  177. function execute()
  178. {
  179. if (cf)
  180. {
  181. var i;
  182. var cmd = "";
  183. var cmdArray = new Array();
  184. var selectedDlg = document.f.formatDlgType.options[document.f.formatDlgType.selectedIndex].value;
  185. if (selectedDlg == "mixed")
  186. {
  187. cf.hideDialogFrame();
  188. return;
  189. }
  190. if (selectedDlg == "default")
  191. cmdArray[0] = "default";
  192. else
  193. {
  194. var count = 0;
  195. var remCount = 4;
  196. var remListArray = new Array("pattern","whenNegative","whenZero","whenMissing");
  197. var attValue = document.f.numDecimals.options[document.f.numDecimals.selectedIndex].value;
  198. if (attValue != "mixed")
  199. {
  200. count++;
  201. cmdArray[cmdArray.length] = "decimalSize";
  202. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  203. }
  204. if (selectedDlg == "scientific")
  205. {
  206. remCount += 2;
  207. remListArray[remListArray.length] = "percentSymbol";
  208. remListArray[remListArray.length] = "scale";
  209. count += 3;
  210. cmdArray[cmdArray.length] = "exponentSymbol";
  211. cmdArray[cmdArray.length] = cf.escapeParam("E");
  212. cmdArray[cmdArray.length] = "exponentSize";
  213. cmdArray[cmdArray.length] = cf.escapeParam("2");
  214. cmdArray[cmdArray.length] = "useScientific";
  215. cmdArray[cmdArray.length] = cf.escapeParam("true");
  216. }
  217. else
  218. {
  219. remCount += 4;
  220. remListArray[remListArray.length] = "exponentSymbol";
  221. remListArray[remListArray.length] = "exponentSize";
  222. remListArray[remListArray.length] = "useScientific";
  223. remListArray[remListArray.length] = (selectedDlg != "percentage") ? "percentSymbol" : "scale";
  224. attValue = document.f.scale.options[document.f.scale.selectedIndex].value;
  225. if (attValue != "mixed")
  226. {
  227. count++;
  228. if (selectedDlg != "percentage")
  229. {
  230. cmdArray[cmdArray.length] = "scale";
  231. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  232. }
  233. else
  234. {
  235. cmdArray[cmdArray.length] = "percentSymbol";
  236. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  237. }
  238. }
  239. attValue = document.f.negativeSign.options[document.f.negativeSign.selectedIndex].value;
  240. if (attValue != "mixed")
  241. {
  242. var atts = cf.cfgGetAt("negativesList", attValue)
  243. count++;
  244. cmdArray[cmdArray.length] = "sign";
  245. cmdArray[cmdArray.length] = cf.escapeParam(atts[1]);
  246. if (cf.escapeParam(atts[2]) != "")
  247. {
  248. count++;
  249. cmdArray[cmdArray.length] = "useTrailingSign";
  250. cmdArray[cmdArray.length] = cf.escapeParam(atts[2]);
  251. }
  252. else
  253. {
  254. remCount++;
  255. remListArray[remListArray.length] = "useTrailingSign";
  256. }
  257. }
  258. attValue = document.f.thousandSeparator.options[document.f.thousandSeparator.selectedIndex].value;
  259. if (attValue != "mixed")
  260. {
  261. count++;
  262. cmdArray[cmdArray.length] = "useGrouping";
  263. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  264. }
  265. }
  266. if (selectedDlg == "currency")
  267. {
  268. attValue = document.f.curr.options[document.f.curr.selectedIndex].value;
  269. if (attValue == "defaultCurr")
  270. {
  271. remCount++;
  272. remListArray[remListArray.length] = "currencyCode";
  273. }
  274. else if (attValue != "mixed")
  275. {
  276. count++;
  277. cmdArray[cmdArray.length] = "currencyCode";
  278. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  279. }
  280. attValue = document.f.currdisp.options[document.f.currdisp.selectedIndex].value;
  281. if (attValue != "mixed")
  282. {
  283. count++;
  284. cmdArray[cmdArray.length] = "useIntlSymbol";
  285. cmdArray[cmdArray.length] = cf.escapeParam(attValue);
  286. }
  287. }
  288. else
  289. {
  290. remCount += 2;
  291. remListArray[remListArray.length] = "currencyCode";
  292. remListArray[remListArray.length] = "useIntlSymbol";
  293. }
  294. var preCmdArray = new Array(selectedDlg,"basic",count);
  295. cmdArray = preCmdArray.concat(cmdArray);
  296. cmdArray[cmdArray.length] = remCount;
  297. cmdArray = cmdArray.concat(remListArray);
  298. }
  299. for (var i = 0; i &lt; cf.dlgGlobalSize('xxformatSelCols'); i++)
  300. cmdArray[cmdArray.length] = cf.escapeParam(cf.dlgGlobalGetParmAt('xxformatSelCols', i));
  301. cf.addColumnsForReselection();
  302. cf.submitFormat(cmdArray);
  303. }
  304. }
  305. function init()
  306. {
  307. attachMouseEvents();
  308. var x = document.getElementById("formatDesc");
  309. if (dlg == 'mixed')
  310. x.appendChild(document.createTextNode("<xts:string id="FORMAT_BLANK_DESCRIPTION" encode="javascript"/>"));
  311. else
  312. {
  313. x.appendChild(document.createTextNode("<xts:string id="FORMAT_NUMBER_DESCRIPTION" encode="javascript"/>"));
  314. }
  315. if (document.getElementById("advLink") &amp;&amp; (dlg == 'default' || dlg == 'mixed'))
  316. document.getElementById("advLink").parentNode.removeChild(document.getElementById("advLink"));
  317. if (dlg == 'currency')
  318. document.getElementById("displayCurrency").style.display = "inline";
  319. if (dlg != 'default')
  320. {
  321. document.getElementById("displayNonDefault").style.display = "inline";
  322. if (dlg != 'mixed')
  323. {
  324. document.getElementById("displayNonMixed").style.display = "inline";
  325. if (dlg != 'scientific')
  326. document.getElementById("displayNonScientific").style.display = "inline";
  327. }
  328. }
  329. if (cf)
  330. {
  331. if (cf.showDialogFrame) cf.showDialogFrame(400);
  332. if ("<xsl:value-of select="xtsext:javascriptencode(string(key('param-name','listsLoaded')))"/>" != "true")
  333. {
  334. var i = 0;
  335. <xsl:for-each select="/root/currencyList/currencyFormat">
  336. cf.cfgSetAt("CurrencyList", i++, new Array("<xsl:value-of select="xtsext:javascriptencode(string(./.))"/>","<xsl:value-of select="xtsext:javascriptencode(string(./@currencyCode))"/>"));
  337. </xsl:for-each>
  338. i = 0;
  339. <xsl:for-each select="/root/negativesList/numberFormat">
  340. cf.cfgSetAt("negativesList", i++, new Array("<xsl:value-of select="xtsext:javascriptencode(string(./.))"/>","<xsl:value-of select="xtsext:javascriptencode(string(./@sign))"/>","<xsl:value-of select="xtsext:javascriptencode(string(./@useTrailingSign))"/>"));
  341. </xsl:for-each>
  342. if (i == 0)
  343. cf.cfgSetAt("negativesList", i++, new Array("-123","-",""));
  344. cf.cfgSet("formatListsLoaded", true);
  345. }
  346. var i = 0;
  347. if (dlg == "mixed")
  348. document.f.formatDlgType.options[i++] = new Option("<xts:string id="DIALOG_SELECT_ONE_OPTION" encode="javascript"/>","mixed", false, true);
  349. document.f.formatDlgType.options[i++] = new Option("<xts:string id="DIALOG_DEFAULT_OPTION" encode="javascript"/>","default", false, false);
  350. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_NUMBER_OPTION" encode="javascript"/>","number", false, false);
  351. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_CURRENCY_OPTION" encode="javascript"/>","currency", false, false);
  352. document.f.formatDlgType.options[i++] = new Option("<xts:string id="FORMAT_PERCENTAGE_OPTION" encode="javascript"/>","percentage", false, false);
  353. document.f.formatDlgType.options[i] = new Option("<xts:string id="FORMAT_SCIENTIFIC_OPTION" encode="javascript"/>","scientific", false, false);
  354. i = 0;
  355. while ( i &lt; document.f.formatDlgType.options.length)
  356. {
  357. if (document.f.formatDlgType.options[i].value == dlg)
  358. {
  359. document.f.formatDlgType.selectedIndex = i;
  360. break;
  361. }
  362. i++;
  363. }
  364. if (dlg == "default" || dlg == "mixed")
  365. {
  366. document.f.formatDlgType.focus();
  367. return;
  368. }
  369. var numDec = (dlg == "percentage") ? 0 : 2;
  370. var scale = "No scale";
  371. var thousandSep = "false";
  372. var negSign = "-";
  373. var useTrailing = "";
  374. var symbol = "";
  375. var percentSymbol = "%";
  376. var disp = "symbol";
  377. if (dlg == cf.cfgGet("formatDlgVars"))
  378. {
  379. if (cf.dlgGlobalGetParm('xxDecimalSize') != null)
  380. numDec = cf.dlgGlobalGetParm('xxDecimalSize');
  381. if (dlg != "scientific")
  382. {
  383. if (cf.dlgGlobalGetParm('xxScale') != null)
  384. scale = cf.dlgGlobalGetParm('xxScale');
  385. if (cf.dlgGlobalGetParm('xxGrouped') != null)
  386. thousandSep = cf.dlgGlobalGetParm('xxGrouped');
  387. if (cf.dlgGlobalGetParm('xxSign') != null)
  388. negSign = cf.dlgGlobalGetParm('xxSign');
  389. if (cf.dlgGlobalGetParm('xxTrailingSign') != null)
  390. useTrailing = cf.dlgGlobalGetParm('xxTrailingSign');
  391. if (cf.dlgGlobalGetParm('xxPercentSymbol') != null)
  392. percentSymbol = cf.dlgGlobalGetParm('xxPercentSymbol');
  393. if (dlg == "currency")
  394. {
  395. symbol = cf.dlgGlobalGetParm('xxCurrencyCode');
  396. disp = cf.dlgGlobalGetParm('xxIntlSymbol');
  397. }
  398. }
  399. }
  400. numDec = (cf.cfgGet("formatCurrentNumDecs") != null) ? cf.cfgGet("formatCurrentNumDecs") : numDec;
  401. scale = (cf.cfgGet("formatCurrentScale") != null) ? cf.cfgGet("formatCurrentScale") : scale;
  402. percentSymbol = (cf.cfgGet("formatCurrentPercentSymbol") != null) ? cf.cfgGet("formatCurrentPercentSymbol") : percentSymbol;
  403. thousandSep = (cf.cfgGet("formatCurrentThousandSep") != null) ? cf.cfgGet("formatCurrentThousandSep") : thousandSep;
  404. symbol = (cf.cfgGet("formatCurrentSymbol") != null) ? cf.cfgGet("formatCurrentSymbol") : symbol;
  405. disp = (cf.cfgGet("formatCurrentDisp") != null) ? cf.cfgGet("formatCurrentDisp") : disp;
  406. i = 0;
  407. if (document.f.numDecimals)
  408. {
  409. if (numDec == "mixed")
  410. document.f.numDecimals.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed", false, true);
  411. document.f.numDecimals.options[i++] = new Option("0","0",false,false);
  412. document.f.numDecimals.options[i++] = new Option("1","1",false,false);
  413. document.f.numDecimals.options[i++] = new Option("2","2",false,false);
  414. document.f.numDecimals.options[i++] = new Option("3","3",false,false);
  415. document.f.numDecimals.options[i++] = new Option("4","4",false,false);
  416. document.f.numDecimals.options[i++] = new Option("5","5",false,false);
  417. document.f.numDecimals.options[i] = new Option("6","6",false,false);
  418. i = 0;
  419. while ( i &lt; document.f.numDecimals.options.length)
  420. {
  421. if (document.f.numDecimals.options[i].value == numDec)
  422. {
  423. document.f.numDecimals.selectedIndex = i;
  424. break;
  425. }
  426. i++;
  427. }
  428. }
  429. if (dlg != "scientific")
  430. {
  431. i = 0;
  432. if (document.f.scale)
  433. {
  434. if (scale == "mixed" || percentSymbol == "mixed")
  435. document.f.scale.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false,true);
  436. if (dlg == 'number' || dlg == 'currency')
  437. {
  438. document.f.scale.options[i++] = new Option("<xts:string id="FORMAT_NO_SCALE_OPTION" encode="javascript"/>","0",false,false);
  439. document.f.scale.options[i++] = new Option("100","-2",false,false);
  440. document.f.scale.options[i++] = new Option("1000","-3",false,false);
  441. document.f.scale.options[i++] = new Option("1 000 000","-6",false,false);
  442. document.f.scale.options[i] = new Option("1 000 000 000","-9",false,false);
  443. }
  444. else if (dlg == 'percentage')
  445. {
  446. document.f.scale.options[i++] = new Option("<xts:string id="FORMAT_PERCENT_100_OPTION" encode="javascript"/>","%",false,false);
  447. document.f.scale.options[i] = new Option("<xts:string id="FORMAT_PER_THOUSAND_OPTION" encode="javascript"/>","&#8240;",false,false);
  448. }
  449. i = 0;
  450. while ( i &lt; document.f.scale.options.length)
  451. {
  452. if (document.f.scale.options[i].value == scale || document.f.scale.options[i].value == percentSymbol)
  453. {
  454. document.f.scale.selectedIndex = i;
  455. break;
  456. }
  457. i++;
  458. }
  459. }
  460. i = 0;
  461. if (document.f.thousandSeparator)
  462. {
  463. if (thousandSep == "mixed")
  464. document.f.thousandSeparator.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false,true);
  465. document.f.thousandSeparator.options[i++] = new Option("<xts:string id="DIALOG_YES_OPTION" encode="javascript"/>","true",false,false);
  466. document.f.thousandSeparator.options[i] = new Option("<xts:string id="DIALOG_NO_OPTION" encode="javascript"/>","false",false,false);
  467. i = 0;
  468. while (i &lt; document.f.thousandSeparator.options.length)
  469. {
  470. if (document.f.thousandSeparator.options[i].value == thousandSep)
  471. {
  472. document.f.thousandSeparator.selectedIndex = i;
  473. break;
  474. }
  475. i++;
  476. }
  477. }
  478. if (document.f.negativeSign)
  479. {
  480. var negList = cf.cfgGet("negativesList");
  481. var negListSize = cf.cfgSize("negativesList");
  482. i = 0;
  483. if (negSign == "mixed" || useTrailing == "mixed")
  484. document.f.negativeSign.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false,true);
  485. for (var j = 0; j &lt; negListSize; j++)
  486. document.f.negativeSign.options[i++] = new Option(negList[j][0],j,false,false);
  487. i = 0;
  488. while (i &lt; negListSize)
  489. {
  490. if (negSign == negList[i][1] &amp;&amp; useTrailing == negList[i][2])
  491. {
  492. document.f.negativeSign.selectedIndex = i;
  493. break;
  494. }
  495. i++;
  496. }
  497. var idx = cf.cfgGet("formatCurrentNegAtts");
  498. if (idx >= 0)
  499. document.f.negativeSign.options[idx].selected = true;
  500. }
  501. if (dlg == "currency")
  502. {
  503. var currList = cf.cfgGet("CurrencyList");
  504. var listSize = cf.cfgSize("CurrencyList");
  505. i = 0;
  506. if (document.f.curr)
  507. {
  508. if (symbol == "mixed")
  509. document.f.curr.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false,true);
  510. document.f.curr.options[i++] = new Option("<xts:string id="FORMAT_DEFAULT_CURRENCY_OPTION" encode="javascript"/>","defaultCurr",false,true);
  511. for (var j = 0; j &lt; listSize; j++)
  512. document.f.curr.options[i++] = new Option(currList[j][0],currList[j][1],false,false);
  513. i = 0;
  514. while (i &lt; listSize)
  515. {
  516. if (symbol == currList[i][1])
  517. {
  518. document.f.curr.selectedIndex = i + 1;
  519. break;
  520. }
  521. i++;
  522. }
  523. }
  524. if (document.f.currdisp)
  525. {
  526. i = 0;
  527. if (disp == "mixed")
  528. document.f.currdisp.options[i++] = new Option("<xts:string id="DIALOG_MULTIPLE_SELECTION" encode="javascript"/>","mixed",false, true);
  529. document.f.currdisp.options[i++] = new Option("<xts:string id="FORMAT_CURRENCY_SYMBOL_OPTION" encode="javascript"/>","false",false, false);
  530. document.f.currdisp.options[i] = new Option("<xts:string id="FORMAT_INTERNATIONAL_CODE_OPTION" encode="javascript"/>","true",false, false);
  531. i =0;
  532. while (i &lt; document.f.currdisp.options.length)
  533. {
  534. if (disp == document.f.currdisp.options[i].value)
  535. {
  536. document.f.currdisp.selectedIndex = i;
  537. break;
  538. }
  539. i++;
  540. }
  541. }
  542. }
  543. }
  544. }
  545. document.f.formatDlgType.focus();
  546. }
  547. function advancedDlg()
  548. {
  549. storeCurrentValues();
  550. if (cf)
  551. {
  552. cf.cfgSet("formatDlgAdvanced", "true");
  553. removeInsert();
  554. cf.format();
  555. }
  556. }
  557. function storeCurrentValues()
  558. {
  559. if (cf)
  560. {
  561. var oldType = cf.dlgGlobalGetParm('xxformatDlgType');
  562. if (oldType != "default" &amp;&amp; oldType != "mixed")
  563. {
  564. if (document.f.numDecimals)
  565. cf.cfgSet("formatCurrentNumDecs", document.f.numDecimals.options[document.f.numDecimals.selectedIndex].value);
  566. if (oldType != "scientific")
  567. {
  568. if (document.f.scale)
  569. {
  570. cf.cfgSet("formatCurrentScale", document.f.scale.options[document.f.scale.selectedIndex].value);
  571. if (oldType == "percentage")
  572. cf.cfgSet("formatCurrentPercentSymbol", document.f.scale.options[document.f.scale.selectedIndex].value);
  573. }
  574. if (document.f.thousandSeparator)
  575. cf.cfgSet("formatCurrentThousandSep", document.f.thousandSeparator.options[document.f.thousandSeparator.selectedIndex].value);
  576. if (document.f.negativeSign)
  577. cf.cfgSet("formatCurrentNegAtts", document.f.negativeSign.selectedIndex);
  578. if (oldType == "currency")
  579. {
  580. if (document.f.curr)
  581. cf.cfgSet("formatCurrentSymbol", document.f.curr.options[document.f.curr.selectedIndex].value);
  582. if (document.f.currdisp)
  583. cf.cfgSet("formatCurrentDisp", document.f.currdisp.options[document.f.currdisp.selectedIndex].value);
  584. }
  585. }
  586. }
  587. }
  588. }
  589. </script>
  590. <script type="text/javascript">
  591. <xsl:attribute name="src"><xsl:value-of select="$webRoot"/>/qs/dialogs/executeButton.js</xsl:attribute>
  592. <xsl:text/>//<xsl:text/>
  593. </script>
  594. </dp:script>
  595. <form style="margin:0px" name="f" method="POST" onsubmit="execute();return false;">
  596. <table border="0" cellspacing="0" cellpadding="0" height="100%" width="100%">
  597. <tr>
  598. <td width="100%" height="0%">
  599. <!-- dialog header -->
  600. <dp:header help="false">
  601. <!-- header titles -->
  602. <dp:title>
  603. <xts:string id="FORMAT_TITLE"/>
  604. </dp:title>
  605. <!-- close link for the header -->
  606. <dp:close>
  607. <a href="javascript:getConfigFrame().hideDialogFrame()">
  608. <dp:closeMarker/>
  609. </a>
  610. </dp:close>
  611. <!-- header links -->
  612. <xsl:if test="/root/system/param[@name='enableAdvNumFormat'] = 'true'">
  613. <dp:headerLinks>
  614. <dp:headerLink>
  615. <dp:hl_attribute name="href">javascript:advancedDlg()</dp:hl_attribute>
  616. <dp:hl_attribute name="label"><xts:string id="DIALOG_ADVANCED"/></dp:hl_attribute>
  617. <dp:hl_attribute name="id">advLink</dp:hl_attribute>
  618. </dp:headerLink>
  619. </dp:headerLinks>
  620. </xsl:if>
  621. <!-- description (hint text) -->
  622. <dp:description>
  623. <xsl:attribute name="id">formatDesc</xsl:attribute>
  624. </dp:description>
  625. </dp:header>
  626. </td>
  627. </tr>
  628. <tr>
  629. <td width="100%" height="100%" valign="top">
  630. <!-- layout -->
  631. <lyt:layout style="2" border="no">
  632. <lyt:section height="274">
  633. <dp:input>
  634. <dp:section1>
  635. <xts:string id="FORMAT_CATEGORY_LABEL"/>
  636. </dp:section1>
  637. <dp:section2>
  638. <select name="formatDlgType" onchange="callFormatDlg()"/>
  639. </dp:section2>
  640. </dp:input>
  641. <span id="spanhide" style="visibility:hidden">
  642. <dp:input>
  643. <dp:section1>
  644. <BR/>placeholder</dp:section1>
  645. <dp:section2>
  646. <select name="placeholder"/>
  647. </dp:section2>
  648. </dp:input>
  649. </span>
  650. <div id="displayCurrency" style="display:none">
  651. <dp:input>
  652. <dp:section1>
  653. <BR/>
  654. <xts:string id="FORMAT_CURRENCY_LABEL"/>
  655. </dp:section1>
  656. <dp:section2>
  657. <select name="curr"/>
  658. </dp:section2>
  659. </dp:input>
  660. <dp:input>
  661. <dp:section1>
  662. <BR/>
  663. <xts:string id="FORMAT_CURRENCY_DISPLAY_LABEL"/>
  664. </dp:section1>
  665. <dp:section2>
  666. <select name="currdisp"/>
  667. </dp:section2>
  668. </dp:input>
  669. </div>
  670. </lyt:section>
  671. <lyt:section>
  672. <div id="displayNonDefault" style="display:none">
  673. <div id="displayNonMixed" style="display:none">
  674. <dp:input>
  675. <dp:section1>
  676. <xts:string id="FORMAT_NUMBER_OF_DECIMALS_LABEL"/>
  677. </dp:section1>
  678. <dp:section2>
  679. <select name="numDecimals"/>
  680. </dp:section2>
  681. </dp:input>
  682. <div id="displayNonScientific" style="display:none">
  683. <dp:input>
  684. <dp:section1>
  685. <BR/>
  686. <xts:string id="FORMAT_SCALE_LABEL"/>
  687. </dp:section1>
  688. <dp:section2>
  689. <select name="scale"/>
  690. </dp:section2>
  691. </dp:input>
  692. <dp:input>
  693. <dp:section1>
  694. <BR/>
  695. <xts:string id="FORMAT_NEGATIVE_SIGN_LABEL"/>
  696. </dp:section1>
  697. <dp:section2>
  698. <select name="negativeSign"/>
  699. </dp:section2>
  700. </dp:input>
  701. <dp:input>
  702. <dp:section1>
  703. <BR/>
  704. <xts:string id="FORMAT_THOUSANDS_SEPARATOR"/>
  705. </dp:section1>
  706. <dp:section2>
  707. <select name="thousandSeparator"/>
  708. </dp:section2>
  709. </dp:input>
  710. </div>
  711. </div>
  712. </div>
  713. </lyt:section>
  714. </lyt:layout>
  715. </td>
  716. </tr>
  717. <tr>
  718. <td width="100%" height="0%">
  719. <qsdlg:defaultFormatNumButtons/>
  720. </td>
  721. </tr>
  722. <!--dbg:dumpxml select="/"/-->
  723. </table>
  724. </form>
  725. </dp:page>
  726. </xsl:template>
  727. </xsl:stylesheet>
  728. </xts:block>
  729. </xts:morphlet>