customizeGroupsDialog.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802
  1. /****************************************************************
  2. ** Licensed Materials - Property of IBM
  3. **
  4. ** BI and PM: qs
  5. **
  6. ** (C) Copyright IBM Corp. 2001, 2015
  7. **
  8. ** US Government Users Restricted Rights - Use, duplication or
  9. ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  10. *****************************************************************/
  11. // Copyright (C) 2008 Cognos ULC, an IBM Company. All Rights Reserved.
  12. // Cognos and the Cognos logo are trademarks of Cognos ULC (formerly Cognos Incorporated) in the United States and/or other countries. IBM and the IBM logo are trademarks of International Business Machines Corporation in the United States, or other countries, or both. Other company, product, or service names may be trademarks or service marks of others.
  13. function init()
  14. {
  15. attachMouseEvents();
  16. if (cf.dlgGlobalGetParm('xxCVColumnName') != null)
  17. document.f.calc_label_text.value = cf.dlgGlobalGetParm('xxCVColumnName');
  18. if (WO1076_flag) {
  19. var MQ = cf.cfgGet('MiniQueryObj');
  20. var columns = MQ.getElementsByTagName('Column');
  21. var columnIdx = parseInt(cf.dlgGlobalGetParm('xxColumnIndex'),10);
  22. var c = columns[columnIdx];
  23. var ge = c.getElementsByTagName('GroupExpression');
  24. if (ge && ge.length) {
  25. MQge = ge[0];
  26. var ce = cf.sXmlDecode(MQge.getAttribute('columnExpr'));
  27. cf.dlgGlobalSetParm('xxColumnExpression',ce);
  28. var cn = ce.replace(/.*\[/gi,'').replace(/\]\s*$/,'');
  29. cf.dlgGlobalSetParm('xxColumnName',cn);
  30. var FEs = MQge.getElementsByTagName('FE');
  31. for (var i=0;i<FEs.length;i++) {
  32. if (FEs[i].getAttribute('dataType')=='MUN') {
  33. cf.dlgGlobalSetParm('xxUseMUN',true);
  34. break;
  35. }
  36. }
  37. }
  38. }
  39. sendRequestForList();
  40. if (cf && cf.showDialogFrame)
  41. cf.showDialogFrame(470);
  42. textBoxgroup_name.m_oForm.focus();
  43. if (MQge){
  44. var FEs = MQge.getElementsByTagName('FE');
  45. document.f.remaining_values_options[0].checked = true;
  46. for (var i=FEs.length-1;i>0;i--) {
  47. if (FEs[i].getAttribute('default')=='true') {
  48. if (FEs[i].getAttribute('label')) {
  49. document.f.range_name_text.value = cf.sXmlDecode(FEs[i].getAttribute('label'));
  50. document.f.remaining_values_options[2].checked = true;
  51. }
  52. else if (FEs[i].getAttribute('nullOption')=='include'){
  53. document.f.remaining_values_options[1].checked = true;
  54. }
  55. break;
  56. }
  57. }
  58. }
  59. else {
  60. if (cf.dlgGlobalGetParm('xxExistingRemainingGroup') == false)
  61. document.f.remaining_values_options[1].checked = true
  62. else
  63. {
  64. if (cf.dlgGlobalGetParm('xxExistingRemainingGroup') == null)
  65. document.f.remaining_values_options[0].checked = true;
  66. else
  67. {
  68. document.f.range_name_text.value = cf.dlgGlobalGetParm('xxExistingRemainingGroup');
  69. document.f.remaining_values_options[2].checked = true;
  70. }
  71. }
  72. }
  73. showHideApplyRemaining(false);
  74. };
  75. function execute()
  76. {
  77. var usingXMLFilter = false;
  78. var before_col_id = cf.dlgGlobalGetParm('xxInsBeforeColId');
  79. var calcExpr = "";
  80. var calcFormat = "none";
  81. var calcOp = "none";
  82. var colName = cf.dlgGlobalGetParm('xxColumnName');
  83. var colExp = cf.dlgGlobalGetParm('xxColumnExpression');
  84. if (cf.dlgGlobalGetParm('xxCustomType') == '0')
  85. calcOp = "groupString";
  86. else if (cf.dlgGlobalGetParm('xxCustomType') == '1')
  87. calcOp = "groupNumber";
  88. var isFirst = true;
  89. var ifOutput = false;
  90. var XMLFilters = new Array();
  91. for (var i = 0; i < customGroupValues.length; i++)
  92. {
  93. var thisCalcExpr = "";
  94. if (typeof customGroupValues[i] == "object")
  95. {
  96. var arrayName = getCustomGroupValues(i);
  97. if (arrayName.length > 0)
  98. {
  99. if (arrayName[0] instanceof cf.CFilterValue)
  100. {
  101. usingXMLFilter = true;
  102. var fe = new cf.CFilterExpression();
  103. fe.setLabel(customGroupNames[i].replace(/''/g, "'"));
  104. if (cf.dlgGlobalGetParm('xxUseMUN') == true)
  105. {
  106. if (cf.determineDataType(dataType) == 0)
  107. fe.setDataType('number');
  108. else
  109. fe.setDataType('MUN');
  110. }
  111. else if (cf.dlgGlobalGetParm('xxCustomType') == '0')
  112. fe.setDataType('string');
  113. for (var j = 0; j < arrayName.length; j++)
  114. fe.addValue(arrayName[j]);
  115. XMLFilters[XMLFilters.length] = fe;
  116. }
  117. else {
  118. if (isFirst)
  119. {
  120. thisCalcExpr = "if (";
  121. isFirst = false;
  122. }
  123. else
  124. thisCalcExpr += " else if (";
  125. if (calcOp != "groupString")
  126. {
  127. if(gsCustomGroups == "TRUE")
  128. thisCalcExpr += "CAST(" + colExp + " as varchar(30)) in (";
  129. else
  130. thisCalcExpr += "CAST(" + colExp + " as nvarchar(30)) in (";
  131. }
  132. else
  133. thisCalcExpr += colExp + " in (";
  134. var isFirstVal = true;
  135. for (var j = 0; j < arrayName.length; j++)
  136. {
  137. if (isFirstVal)
  138. isFirstVal = false;
  139. else
  140. thisCalcExpr += ",";
  141. thisCalcExpr += "'" + arrayName[j] + "'";
  142. ifOutput = true;
  143. }
  144. if(gsCustomGroups == "TRUE")
  145. thisCalcExpr += ")) then (CAST('" + customGroupNames[i] + "' as varchar(30)))";
  146. else
  147. thisCalcExpr += ")) then (CAST('" + customGroupNames[i] + "' as nvarchar(30)))";
  148. }
  149. }
  150. calcExpr += thisCalcExpr;
  151. }
  152. }
  153. if (usingXMLFilter) {
  154. if (document.f.remaining_values_options[1].checked == true) {
  155. var fe = new cf.CFilterExpression();
  156. fe.setNullOption('include');
  157. fe.setDefault(true);
  158. if (cf.dlgGlobalGetParm('xxUseMUN') == true)
  159. {
  160. if (cf.determineDataType(dataType) == 0)
  161. fe.setDataType('number');
  162. else
  163. fe.setDataType('MUN');
  164. }
  165. else if (cf.dlgGlobalGetParm('xxCustomType') == '0')
  166. fe.setDataType('string');
  167. XMLFilters[XMLFilters.length] = fe;
  168. }
  169. else if (document.f.remaining_values_options[2].checked == true) {
  170. var fe = new cf.CFilterExpression();
  171. fe.setLabel(document.f.range_name_text.value);
  172. fe.setDefault(true);
  173. if (cf.dlgGlobalGetParm('xxUseMUN') == true)
  174. {
  175. if (cf.determineDataType(dataType) == 0)
  176. fe.setDataType('number');
  177. else
  178. fe.setDataType('MUN');
  179. }
  180. else if (cf.dlgGlobalGetParm('xxCustomType') == '0')
  181. fe.setDataType('string');
  182. XMLFilters[XMLFilters.length] = fe;
  183. }
  184. calcExpr = '<GroupExpression columnExpr="' + sXmlEncode(colExp) + '">';
  185. for (var i = 0; i < XMLFilters.length; i++)
  186. calcExpr += XMLFilters[i].getXML();
  187. calcExpr += '</GroupExpression>';
  188. }
  189. else {
  190. if (ifOutput)
  191. calcExpr += " else (";
  192. else if (document.f.group_names.options.length == 0)
  193. {
  194. var oMQMgr = goDialogManager.getMiniQueryManager();
  195. var oMQCols = oMQMgr.getElementsByAttribute("expression", colExp);
  196. if (oMQCols.length > 0 && oMQMgr.isNumeric(oMQCols[0]))
  197. {
  198. calcExpr = "if (" + colExp + " in_range {1:0}) then (null) else (";
  199. }
  200. else
  201. {
  202. calcExpr = "if (" + colExp + " in ('')) then (null) else (";
  203. }
  204. }
  205. if (calcExpr != "")
  206. {
  207. if (document.f.remaining_values_options[0].checked == true)
  208. {
  209. if (cf.dlgGlobalGetParm('xxCustomType') == 0)
  210. calcExpr += colExp;
  211. else
  212. {
  213. if(gsCustomGroups == "TRUE")
  214. calcExpr += "CAST(" + colExp + " as varchar(30))";
  215. else
  216. calcExpr += "CAST(" + colExp + " as nvarchar(30))";
  217. }
  218. }
  219. else if ((document.f.remaining_values_options[1].checked == true) || (document.f.remaining_values_options[2].checked == true && document.f.range_name_text.value == ""))
  220. calcExpr += "null";
  221. else
  222. {
  223. if(gsCustomGroups == "TRUE")
  224. calcExpr += "CAST('" + document.f.range_name_text.value.replace(/'/g, "''") + "' as varchar(30))";
  225. else
  226. calcExpr += "CAST('" + document.f.range_name_text.value.replace(/'/g, "''") + "' as nvarchar(30))";
  227. }
  228. calcExpr += ")";
  229. }
  230. }
  231. if (calcExpr != "")
  232. {
  233. if (document.f.calc_label_text.value != "")
  234. sCalcName = document.f.calc_label_text.value;
  235. else
  236. sCalcName = stringReplace (sCalcName, "\\^0", colName);
  237. if (cf.dlgGlobalGetParm('xxExistingCol') != null)
  238. {
  239. var cmd = cf.generateReplaceExpressionCmd(calcExpr, calcExpr, calcOp);
  240. cmd += ";" + cf.generateNcCmd(cf.dlgGlobalGetParm('xxColumnIndex'), sCalcName)
  241. var oMQMgr = goDialogManager.getMiniQueryManager();
  242. if(oMQMgr && oMQMgr.getPageBreak())
  243. cmd+=";OP:";
  244. cf.sendCmd(cmd, "", true);
  245. }
  246. else
  247. cf.addCalcColumn(before_col_id, calcExpr, calcExpr, sCalcName, "none", calcOp, "none", "none", dataType, 7, "none", -1, "none");
  248. }
  249. else
  250. cf.hideDialogFrame();
  251. };
  252. function stringReplace (origString, valToReplace, newString)
  253. {
  254. var strRegExp = new RegExp();
  255. strRegExp.compile(valToReplace, "g");
  256. return origString.replace(strRegExp, newString);
  257. };
  258. function setupDataType(newDataType)
  259. {
  260. var iDataType = cf.getDataTypeFromString(newDataType);
  261. if (iDataType != -1)
  262. dataType = iDataType;
  263. };
  264. function removeFromAvailableValues(incommingValue)
  265. {
  266. var u = incommingValue;
  267. if (u instanceof cf.CFilterValue){u=u.getUse();}
  268. for (var i = 0; i < document.f.available_values.options.length; i++)
  269. {
  270. if (document.f.available_values.options[i].value == u)
  271. {
  272. document.f.available_values.options[i] = null;
  273. return;
  274. }
  275. }
  276. };
  277. function createOrAddToCustomGroupWithValue(grpName, grpVal)
  278. {
  279. var newGroupSlot = -1;
  280. var i;
  281. for (i = 0; i < customGroupNames.length; i++)
  282. {
  283. if (customGroupNames[i] == grpName)
  284. {
  285. newGroupSlot = i;
  286. break;
  287. }
  288. }
  289. if (newGroupSlot == -1)
  290. {
  291. newGroupSlot = customGroupNames.length
  292. customGroupNames[newGroupSlot] = grpName;
  293. document.f.group_names.options[document.f.group_names.options.length] = new Option(grpName.replace(/''/g, "'"), grpName.replace(/''/g, "'"));
  294. }
  295. if (grpVal != "")
  296. {
  297. if (typeof customGroupValues[newGroupSlot] != "object")
  298. customGroupValues[newGroupSlot] = new Array();
  299. customGroupValues[newGroupSlot][customGroupValues[newGroupSlot].length] = grpVal;
  300. if (cf.dlgGlobalGetParm('xxAdvanced') == '0') {
  301. if (typeof grpVal == 'string')
  302. grpVal = grpVal.replace(/''/g, "'");
  303. removeFromAvailableValues(grpVal);
  304. }
  305. }
  306. };
  307. function addToCustomGroup(newValue)
  308. {
  309. if (typeof customGroupValues[customGroupSelectedIndex] != "object")
  310. {
  311. customGroupValues[customGroupSelectedIndex] = new Array();
  312. var newGroup = document.f.group_names.options[customGroupSelectedIndex].text;
  313. newGroup = newGroup.replace(/'/g, "''");
  314. customGroupNames[customGroupSelectedIndex] = newGroup;
  315. }
  316. else
  317. {
  318. for (var i = 0; i < customGroupValues[customGroupSelectedIndex].length; i++)
  319. {
  320. if (typeof customGroupValues[customGroupSelectedIndex][i] == "undefined")
  321. {
  322. if (typeof newValue == 'string')
  323. newValue = newValue.replace(/'/g, "''");
  324. customGroupValues[customGroupSelectedIndex][i] = newValue;
  325. return;
  326. }
  327. }
  328. }
  329. if (typeof newValue == 'string')
  330. newValue = newValue.replace(/'/g, "''");
  331. customGroupValues[customGroupSelectedIndex][customGroupValues[customGroupSelectedIndex].length] = newValue;
  332. };
  333. function getCustomGroupValues(arrayIndex)
  334. {
  335. var tempArray = new Array();
  336. if (typeof customGroupValues[arrayIndex] == "object")
  337. {
  338. for (var i = 0; i < customGroupValues[arrayIndex].length; i++)
  339. {
  340. if (typeof customGroupValues[arrayIndex][i] != "undefined")
  341. tempArray[tempArray.length] = customGroupValues[arrayIndex][i];
  342. }
  343. }
  344. return tempArray;
  345. };
  346. function removeFromCustomGroup(oldValue)
  347. {
  348. for (var i = 0; i < customGroupValues[customGroupSelectedIndex].length; i++)
  349. {
  350. var u = customGroupValues[customGroupSelectedIndex][i];
  351. if (u instanceof cf.CFilterValue){u=u.getUse();}
  352. if (u==oldValue){
  353. delete customGroupValues[customGroupSelectedIndex][i];
  354. return;
  355. }
  356. }
  357. };
  358. function reshuffleCustomGroupArray()
  359. {
  360. for (var i = customGroupSelectedIndex; i < (customGroupValues.length - 1); i++)
  361. customGroupValues[i] = customGroupValues[i + 1];
  362. for (var i = customGroupSelectedIndex; i < (customGroupNames.length - 1); i++)
  363. customGroupNames[i] = customGroupNames[i + 1];
  364. delete customGroupValues[customGroupValues.length - 1];
  365. delete customGroupNames[customGroupNames.length - 1];
  366. };
  367. function addValue()
  368. {
  369. if (cf.dlgGlobalGetParm('xxAdvanced') == '0')
  370. {
  371. <!-- picklist simple case -->
  372. if (customGroupSelectedIndex > -1)
  373. {
  374. var iter = 0;
  375. while (iter < document.f.available_values.options.length)
  376. {
  377. if (document.f.available_values.options[iter].selected == true)
  378. {
  379. var displayValue = cf.getDisplayValueForOption(document.f.available_values.options[iter]);
  380. document.f.group_values.options[document.f.group_values.options.length] = new Option(displayValue, document.f.available_values.options[iter].value);
  381. if (WO1076_flag) {
  382. addToCustomGroup(new cf.CFilterValue(document.f.available_values.options[iter].value, displayValue));
  383. }
  384. else {
  385. addToCustomGroup(document.f.available_values.options[iter].value);
  386. }
  387. document.f.available_values.options[iter] = null;
  388. }
  389. else
  390. iter++;
  391. }
  392. }
  393. else
  394. textBoxgroup_name.checkFail();
  395. }
  396. else if (cf.dlgGlobalGetParm('xxCustomType') == '0' || cf.dlgGlobalGetParm('xxCustomType') == '1')
  397. {
  398. <!-- string advanced -->
  399. if (customGroupSelectedIndex <= -1 || document.f._textEditBoxcustom_value.value == "")
  400. textBoxgroup_name.checkFail();
  401. else
  402. {
  403. document.f.group_values.options[document.f.group_values.options.length] = new Option(document.f._textEditBoxcustom_value.value, document.f._textEditBoxcustom_value.value);
  404. if (WO1076_flag)
  405. {
  406. addToCustomGroup(new cf.CFilterValue(document.f._textEditBoxcustom_value.value, document.f._textEditBoxcustom_value.value));
  407. }
  408. else
  409. {
  410. addToCustomGroup(document.f._textEditBoxcustom_value.value);
  411. }
  412. }
  413. }
  414. };
  415. function removeValue()
  416. {
  417. if (customGroupSelectedIndex > -1)
  418. {
  419. var iter = 0;
  420. while (iter < document.f.group_values.options.length)
  421. {
  422. if (document.f.group_values.options[iter].selected == true)
  423. {
  424. if (cf.dlgGlobalGetParm('xxAdvanced') == '0')
  425. document.f.available_values.options[document.f.available_values.options.length] = new Option(cf.getDisplayValueForOption(document.f.group_values.options[iter]), document.f.group_values.options[iter].value);
  426. removeFromCustomGroup(document.f.group_values.options[iter].value);
  427. document.f.group_values.options[iter] = null;
  428. }
  429. else
  430. iter++;
  431. }
  432. }
  433. };
  434. function deleteFromCustomGroupsValues()
  435. {
  436. while (document.f.group_values.options.length)
  437. {
  438. if (cf.dlgGlobalGetParm('xxAdvanced') == '0')
  439. document.f.available_values.options[document.f.available_values.options.length] = new Option(cf.getDisplayValueForOption(document.f.group_values.options[0]), document.f.group_values.options[0].value);
  440. document.f.group_values.options[0] = null;
  441. }
  442. customGroupValues[customGroupSelectedIndex] = new Array();
  443. delete customGroupNames[customGroupSelectedIndex];
  444. };
  445. function customGroupItemSelected()
  446. {
  447. customGroupSelectedIndex = document.f.group_names.selectedIndex;
  448. while (document.f.group_values.options.length)
  449. document.f.group_values.options[0] = null;
  450. var arrayVals = getCustomGroupValues(customGroupSelectedIndex);
  451. var i;
  452. for (i = 0; i < arrayVals.length; i++) {
  453. if (arrayVals[i] instanceof cf.CFilterValue) {
  454. document.f.group_values.options[document.f.group_values.options.length] = new Option(arrayVals[i].getDisplay(), arrayVals[i].getUse());
  455. }
  456. else if (typeof arrayVals[i] == 'object') {
  457. document.f.group_values.options[document.f.group_values.options.length] = new Option(arrayVals[i][1], arrayVals[i][0]);
  458. }
  459. else {
  460. document.f.group_values.options[document.f.group_values.options.length] = new Option(arrayVals[i].replace(/''/g, "'"), arrayVals[i].replace(/''/g, "'"));
  461. }
  462. }
  463. };
  464. function addGroup()
  465. {
  466. var group_name = textBoxgroup_name.sGetValue();
  467. if (group_name != "")
  468. {
  469. var custom_groups = new Array();
  470. var i;
  471. for (i = 0; i < document.f.group_names.options.length; i++)
  472. {
  473. if (group_name == document.f.group_names.options[i].value)
  474. return;
  475. }
  476. var newSlot = document.f.group_names.options.length;
  477. document.f.group_names.options[newSlot] = new Option(group_name, group_name);
  478. document.f.group_names.options[newSlot].selected = true;
  479. customGroupItemSelected();
  480. }
  481. document.f._textEditBoxgroup_name.value = "";
  482. };
  483. function deleteCustomGroup()
  484. {
  485. if (document.f.group_names.selectedIndex >= 0)
  486. {
  487. deleteFromCustomGroupsValues();
  488. reshuffleCustomGroupArray();
  489. document.f.group_names.options[document.f.group_names.selectedIndex] = null;
  490. customGroupSelectedIndex = -1;
  491. }
  492. };
  493. function selectAll(arrayName)
  494. {
  495. for (i = 0; i < eval("document.f." + arrayName + ".options.length"); i++)
  496. eval("document.f." + arrayName + ".options[" + i + "].selected = true");
  497. };
  498. function deselectAll(arrayName)
  499. {
  500. for (i = 0; i < eval("document.f." + arrayName + ".options.length"); i++)
  501. eval("document.f." + arrayName + ".options[" + i + "].selected = false");
  502. };
  503. function customTypeChange()
  504. {
  505. var customType = document.f.customizationType.value;
  506. if (customType == 1)
  507. {
  508. if (cf.dlgGlobalGetParm('xxExistingCol') == 'range')
  509. goDialogManager.getFeatureManager().launchFeature('CustomGroups');
  510. else
  511. cf.loadCustomRange();
  512. }
  513. };
  514. function addToAvailableValues(useVal, displayVal)
  515. {
  516. if (useVal == "")
  517. return;
  518. if (!displayVal)
  519. displayVal = useVal;
  520. for (var i = 0; i < allAvailableValues.length; i++)
  521. {
  522. if (allAvailableValues[i][0] == useVal)
  523. return;
  524. }
  525. allAvailableValues[allAvailableValues.length] = [useVal, displayVal];
  526. };
  527. function sendRequestForList()
  528. {
  529. showLoading();
  530. var url = "m=/" + cf.qs_dir + "/customizeGroupsRequest.xts&amp;b_action=xts.run";
  531. if (cf.dlgGlobalGetParm('xxColumnName'))
  532. url += "&xxColumnName=" + encodeURIComponent(cf.dlgGlobalGetParm('xxColumnName'));
  533. if (cf.dlgGlobalGetParm('xxModelName'))
  534. url += "&xxModelName=" + encodeURIComponent(cf.dlgGlobalGetParm('xxModelName'));
  535. for (var i = 0; i < cf.dlgGlobalSize('xxOtherColIds'); i++)
  536. url += "&xxOtherCols=" + cf.dlgGlobalConstructPairParm(url, encodeURIComponent(cf.dlgGlobalGetParmAt('xxOtherColIds', i)), encodeURIComponent(cf.dlgGlobalGetParmAt('xxOtherColExps', i)));
  537. if (cf.dlgGlobalGetParm('xxDesignMode'))
  538. url += "&xxDesignMode=" + encodeURIComponent(cf.dlgGlobalGetParm('xxDesignMode'));
  539. if (cf.dlgGlobalGetParm('xxColumnExpression'))
  540. url += "&xxColumnExpression=" + encodeURIComponent(cf.dlgGlobalGetParm('xxColumnExpression'));
  541. if (cf.dlgGlobalGetParm('xxDetailAggregateType'))
  542. url += "&xxDetailAggregateType=" + encodeURIComponent(cf.dlgGlobalGetParm('xxDetailAggregateType'));
  543. for (var i = 0; i < cf.dlgGlobalSize('xxPromptValues'); i++)
  544. url += "&xxPromptValues=" + encodeURIComponent(cf.dlgGlobalGetParmAt('xxPromptValues', i));
  545. if (cf.cafContextId != "")
  546. url += "&ui.cafcontextid=" + cf.cafContextId;
  547. if (cf.dlgGlobalGetParm('xxUseMUN'))
  548. url += "&xxUseMUN=" + encodeURIComponent(cf.dlgGlobalGetParm('xxUseMUN'));
  549. if (cf.dlgGlobalGetParm('xxExprLocale'))
  550. url += "&xxExprLocale=" + encodeURIComponent(cf.dlgGlobalGetParm('xxExprLocale'));
  551. if (cf.dlgGlobalGetParm('xxExecutionParameters'))
  552. url += "&xxExecutionParameters=" + encodeURIComponent(cf.dlgGlobalGetParm('xxExecutionParameters'));
  553. if (typeof cf.routingServerGroup != "undefined") {
  554. url += "&ui.routingServerGroup=" + encodeURIComponent(cf.routingServerGroup);
  555. }
  556. if (cf.cfgGet("markup_track") != "undefined")
  557. {
  558. url += "&markup_track=" + cf.cfgGet("markup_track");
  559. }
  560. cf.sendDispatcherRequest(url, processResponse);
  561. };
  562. function processResponse(response)
  563. {
  564. if (!cf.checkResponse(response, document, "customGroups", init))
  565. {
  566. hideLoading();
  567. return;
  568. }
  569. eval(response);
  570. if(typeof status != "undefined" && status == "working" && typeof tracking != "undefined" && tracking != "")
  571. {
  572. requestTracking = tracking;
  573. var url = "m=/" + cf.qs_dir + "/customizeGroupsRequest.xts&b_action=xts.run&ui.action=wait&m_tracking=";
  574. url += tracking;
  575. if (typeof cf.routingServerGroup != "undefined")
  576. {
  577. url += "&ui.routingServerGroup=" + encodeURIComponent(cf.routingServerGroup);
  578. }
  579. if (cf.cafContextId != "")
  580. {
  581. url += "&ui.cafcontextid=" + cf.cafContextId;
  582. }
  583. setTimeout("customizeGroups_sendWaitRequest('" + url + "');", 100);
  584. return;
  585. }
  586. if (cf.dlgGlobalGetParm('xxAdvanced') == '0')
  587. {
  588. for (var allVals = 0; allVals < allAvailableValues.length; allVals++)
  589. document.f.available_values.options[document.f.available_values.options.length] = new Option(allAvailableValues[allVals][1], allAvailableValues[allVals][0]);
  590. }
  591. if (WO1076_flag && MQge != null) {
  592. var FEs = MQge.childNodes;
  593. for (var i = 0; i < FEs.length; i++) {
  594. var values = FEs[i].childNodes;
  595. var gn = cf.sXmlDecode(FEs[i].getAttribute('label'));
  596. for (var j = 0; j < values.length; j++) {
  597. createOrAddToCustomGroupWithValue(gn, new cf.CFilterValue(cf.sXmlDecode(values[j].getAttribute('use')), cf.sXmlDecode(values[j].getAttribute('display'))));
  598. }
  599. }
  600. }
  601. else {
  602. for (var i = 0; i < cf.dlgGlobalSize('xxExistingGroups'); i++)
  603. {
  604. var existGroup = cf.dlgGlobalGetParmAt('xxExistingGroups', i);
  605. createOrAddToCustomGroupWithValue(existGroup[0], existGroup[1]);
  606. }
  607. }
  608. var sel = document.getElementById("available_values");
  609. if (sel)
  610. sel.style.display = "inline";
  611. hideLoading();
  612. };
  613. function showLoading()
  614. {
  615. var loadingDiv = document.getElementById("loadingDiv");
  616. if (loadingDiv == null || typeof loadingDiv == 'undefined')
  617. {
  618. loadingTimer = setTimeout(showLoading, 50);
  619. }
  620. else
  621. {
  622. var theSelect = document.getElementById("available_values");
  623. if (theSelect != null && typeof theSelect != 'undefined')
  624. {
  625. theSelect.style.display = "none";
  626. }
  627. var loadingIcon = document.createElement("IMG");
  628. loadingIcon.align = "middle";
  629. loadingIcon.src = cf.TREE_LOADING;
  630. loadingDiv.appendChild(loadingIcon);
  631. var newSpanText = document.createElement("SPAN");
  632. newSpanText.appendChild(document.createTextNode(PMT_TRE_TREE_LOADING));
  633. newSpanText.style.paddingLeft = "4px";
  634. newSpanText.className = "clsCheckBox";
  635. loadingDiv.appendChild(newSpanText);
  636. }
  637. };
  638. function hideLoading()
  639. {
  640. var theDiv = document.getElementById("loadingDiv");
  641. if (theDiv == null || typeof theDiv == 'undefined')
  642. {
  643. clearTimeout(loadingTimer);
  644. }
  645. else
  646. {
  647. theDiv.parentNode.removeChild(theDiv);
  648. var theSelect = document.getElementById("available_values");
  649. if (theSelect != null && typeof theSelect != 'undefined')
  650. {
  651. theSelect.style.display = "inline";
  652. }
  653. }
  654. };
  655. function showHideApplyRemaining(show)
  656. {
  657. var remainingValuesRow = document.getElementById("remainingValuesRow");
  658. var applyRemainingImg = document.getElementById("applyRemainingImg");
  659. var individualValuesText = document.getElementById("individualValuesText");
  660. var noRangeNameText = document.getElementById("noRangeNameText");
  661. var rangeNameText = document.getElementById("rangeNameText");
  662. var isReload = (typeof show != "undefined" && show == "reload");
  663. if ((!isReload) && (remainingValuesRow.style.display == "none" || (typeof show != "undefined" && show == true)))
  664. {
  665. if (document.all)
  666. remainingValuesRow.style.display = "inline";
  667. else
  668. remainingValuesRow.style.display = "table-row";
  669. applyRemainingImg.src = sDialogSkinPath + "/prompting/images/prompt_option_collapse.gif";
  670. individualValuesText.style.display = "none";
  671. noRangeNameText.style.display = "none";
  672. rangeNameText.style.display = "none";
  673. cf.showDialogFrame(advOpenSize);
  674. }
  675. else
  676. {
  677. if (isReload)
  678. {
  679. individualValuesText.style.display = "none";
  680. noRangeNameText.style.display = "none";
  681. rangeNameText.style.display = "none";
  682. }
  683. else
  684. {
  685. remainingValuesRow.style.display = "none";
  686. applyRemainingImg.src = sDialogSkinPath + "/prompting/images/prompt_option_expand.gif";
  687. }
  688. var doAction = ((isReload && (remainingValuesRow.style.display == "none")) || !isReload);
  689. if (document.f.remaining_values_options[0].checked == true)
  690. {
  691. if (doAction)
  692. {
  693. if (document.all)
  694. individualValuesText.style.display = "inline";
  695. else
  696. individualValuesText.style.display = "table-row";
  697. }
  698. }
  699. else if (document.f.remaining_values_options[1].checked == true || (document.f.remaining_values_options[2].checked == true && document.f.range_name_text.value == ""))
  700. {
  701. document.f.remaining_values_options[1].checked = true;
  702. if (doAction)
  703. {
  704. if (document.all)
  705. noRangeNameText.style.display = "inline";
  706. else
  707. noRangeNameText.style.display = "table-row";
  708. }
  709. }
  710. else
  711. {
  712. if (doAction)
  713. {
  714. if (document.all)
  715. rangeNameText.style.display = "inline";
  716. else
  717. rangeNameText.style.display = "table-row";
  718. }
  719. var rnv = document.getElementById("rangeNameValue")
  720. var rnvChild = stringReplace (sValuesRangeName, "\\^0", document.f.range_name_text.value);
  721. while (rnv.hasChildNodes())
  722. rnv.removeChild(rnv.firstChild);
  723. rnv.appendChild(document.createTextNode(rnvChild));
  724. }
  725. if (doAction)
  726. cf.showDialogFrame(advClosedSize);
  727. }
  728. };
  729. function customizeGroups_sendWaitRequest(url)
  730. {
  731. cf.sendDispatcherRequest(url, processResponse);
  732. };