condStyles.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  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. var cf = (typeof getConfigFrame == "function" ? getConfigFrame() : this);
  14. var giRANGE_STRING = -1;
  15. var giRANGE_NUMERIC = 0;
  16. var giRANGE_DATE = 1;
  17. var giRANGE_TIME = 2;
  18. var giRANGE_DATETIME = 3;
  19. var giRANGE_INTERVAL = 4;
  20. var giRANGE_VALUES = 5;
  21. var gsPREVIEW = "pb-";
  22. var gsRANGEHEADER = "Range";
  23. var gsSELECTHEADER = "Selection";
  24. var gsSELECTLINK = "(Select a value)";
  25. var gsADDRANGELINK = "(Add a range)";
  26. var gsSTYLEHEADER = "Style";
  27. var gsPREVIEWTEXT = "AaBbCc";
  28. var gsSELECTCLASS = "sc-";
  29. var gsTHRESHOLD = "tb-";
  30. var gsHIGHESTVALUE = "Highest value";
  31. var gsLOWESTVALUE = "Highest value";
  32. var gsCSSCLASS_DEFAULT = 'cs-default';
  33. var gsCSSCLASS_CUSTOM = 'cs-custom';
  34. var gsCSS_DEFAULT = "(default)";
  35. var gsCSS_EXCELLENT = "Great";
  36. var gsCSS_GOOD = "Good";
  37. var gsCSS_AVERAGE = "Average";
  38. var gsCSS_BAD = "Bad";
  39. var gsCSS_POOR = "Poor";
  40. var gsCSS_CUSTOM = "(custom)";
  41. var gsDATAFORMAT_INTERVAL = "^0 days, ^1 hrs, ^2 mins";
  42. var gsMISSING_VALUES = "<missing values>";
  43. function CStyleRangeList(columnId, type, colType) {
  44. this.m_columnId = columnId;
  45. this.m_id = "csrl_" + getSafeIdentifier(columnId);
  46. this.m_ranges = null;
  47. this.setType(type);
  48. this.setColType(colType);
  49. this.m_defaultClass = "";
  50. this.m_defaultStyleInfo = "";
  51. this.m_ranges = new Array();
  52. };
  53. function CStyleRangeList_initStrings(sRange, sSelect, sSelectLink, sAddRangeLink, sStyle, sHigh, sLow, sPreview, sDefault, sExcellent, sGood, sAvg, sBad, sPoor, sCustom, sIntervalFormat, sMissingValues)
  54. {
  55. gsPREVIEWTEXT = sPreview;
  56. gsRANGEHEADER = sRange;
  57. gsSELECTHEADER = sSelect;
  58. gsSELECTLINK = sSelectLink;
  59. gsADDRANGELINK = sAddRangeLink;
  60. gsSTYLEHEADER = sStyle;
  61. gsHIGHESTVALUE = sHigh;
  62. gsLOWESTVALUE = sLow;
  63. gsCSS_DEFAULT = sDefault;
  64. gsCSS_EXCELLENT = sExcellent;
  65. gsCSS_GOOD = sGood;
  66. gsCSS_AVERAGE = sAvg;
  67. gsCSS_BAD = sBad;
  68. gsCSS_POOR = sPoor;
  69. gsCSS_CUSTOM = sCustom;
  70. gsDATAFORMAT_INTERVAL = sIntervalFormat;
  71. gsMISSING_VALUES = cf.htmlencode(sMissingValues);
  72. };
  73. function CStyleRangeList_addStyleRange(styleRange) {
  74. this.m_ranges[this.m_ranges.length] = styleRange;
  75. styleRange.m_parent = this;
  76. return styleRange;
  77. };
  78. function CStyleRangeList_addRange(from, to) {
  79. var r = new CStyleRange(from, to, true, true);
  80. r.setId(this.generateID());
  81. return ( this.addStyleRange(r) );
  82. };
  83. function CStyleRangeList_addSVList(svList) {
  84. var sv = new CStyleSV(svList);
  85. sv.setId(this.generateID());
  86. return ( this.addStyleRange(sv) );
  87. };
  88. function CStyleRangeList_addThreshold(threshold)
  89. {
  90. if ( this.m_type == giRANGE_VALUES )
  91. return null;
  92. if ( !this.m_ranges )
  93. this.m_ranges = new Array();
  94. if ( this.m_type == giRANGE_NUMERIC ) {
  95. threshold = parseFloat(threshold);
  96. if (isNaN(threshold)) {
  97. return;
  98. }
  99. }
  100. var rangeIndex = this.indexWith(threshold);
  101. var aNewRanges = new Array();
  102. if ( rangeIndex > -1 ) {
  103. var old_r = this.m_ranges[rangeIndex];
  104. if (old_r.getFrom() == threshold || old_r.getTo() == threshold) {
  105. return;
  106. }
  107. var new_r = old_r.clone();
  108. new_r.setId(this.generateID());
  109. new_r.setTo(threshold);
  110. new_r.setToInclusive(true);
  111. if ( this.rangeExists(new_r) ) {
  112. return;
  113. }
  114. old_r.setFrom(threshold);
  115. old_r.setFromInclusive(false);
  116. this.insertRangeAt(new_r,rangeIndex);
  117. aNewRanges[aNewRanges.length] = new_r;
  118. aNewRanges[aNewRanges.length] = old_r;
  119. }
  120. else {
  121. var r1 = new CStyleRange(null, threshold);
  122. r1.setId(this.generateID());
  123. r1.setClass(this.getClass());
  124. r1.setStyleInfo(this.getStyleInfo());
  125. aNewRanges[aNewRanges.length] = this.addStyleRange( r1 );
  126. var r2 = new CStyleRange(threshold, null);
  127. r2.setId(this.generateID());
  128. r2.setClass(this.getClass());
  129. r2.setStyleInfo(this.getStyleInfo());
  130. aNewRanges[aNewRanges.length] = this.addStyleRange( r2 );
  131. }
  132. return aNewRanges;
  133. };
  134. function CStyleRangeList_clone() {
  135. var clone = new CStyleRangeList();
  136. clone.m_columnId = this.columnId;
  137. clone.m_ranges = this.m_ranges.clone();
  138. clone.m_type = this.m_type;
  139. clone.m_colType = this.m_colType;
  140. if (clone.m_ranges) {
  141. for (var i = 0; i < clone.m_ranges.length; i++) {
  142. clone.m_ranges[i].m_parent = clone;
  143. }
  144. }
  145. return clone;
  146. };
  147. function CStyleRangeList_generateID()
  148. {
  149. var i = 0;
  150. while ( this.getRangeById("styleRange" + i) != null )
  151. i++;
  152. return ("styleRange" + i);
  153. };
  154. function CStyleRangeList_getClass() {
  155. if (this.m_defaultClass == null) {
  156. this.m_defaultClass = "";
  157. }
  158. return this.m_defaultClass;
  159. };
  160. function CStyleRangeList_getColType() {
  161. return this.m_colType;
  162. };
  163. function CStyleRangeList_getCommand() {
  164. var s = "OA:" + cf.escapeParam(this.m_columnId) + ",";
  165. var filterType = '';
  166. switch (this.getType()) {
  167. case giRANGE_NUMERIC:
  168. filterType = "numeric"; break;
  169. case giRANGE_STRING:
  170. filterType = "string"; break;
  171. case giRANGE_DATE:
  172. filterType = "date"; break;
  173. case giRANGE_DATETIME:
  174. filterType = "datetime"; break;
  175. case giRANGE_TIME:
  176. filterType = "time"; break;
  177. case giRANGE_INTERVAL:
  178. filterType = "interval"; break;
  179. case giRANGE_VALUES:
  180. filterType = "selectValue"; break;
  181. default:
  182. break;
  183. }
  184. var xml = '<CStyle type="' + filterType + '"';
  185. if (this.getColType()) {
  186. xml += ' colType="' + this.getColType() + '"';
  187. }
  188. xml += '>';
  189. var FEs = new Array();
  190. for (var i = 0; i < this.m_ranges.length; i++) {
  191. var v = this.m_ranges[i];
  192. var fe = null;
  193. if (v instanceof CStyleSV) {
  194. fe = new cf.CFilterExpression(v.getId(),v.m_selectValueList);
  195. }
  196. else if (v instanceof CStyleRange) {
  197. fe = new cf.CFilterExpression(v.getId());
  198. fe.setFilterType('range');
  199. var from = (v.getFrom() != null ? v.getFrom().toString() : '');
  200. var to = (v.getTo() != null ? v.getTo().toString() : '');
  201. var decimalSeparator = goDialogManager.getMiniQueryManager().getDecimalSeparator();
  202. if (filterType == "numeric") {
  203. from = from.replace(/\./gi, decimalSeparator);
  204. to = to.replace(/\./gi, decimalSeparator);
  205. }
  206. fe.setFrom(from,from,!v.getFromInclusive());
  207. fe.setTo(to,to,!v.getToInclusive());
  208. }
  209. if (fe !== null) {
  210. fe.setClassName(v.getClass());
  211. fe.setStyle(v.getStyleInfo());
  212. var t = cf.dlgGlobalGetParm('xxDataType');
  213. if (t == "level" || t == "hierarchy" || t == "member") {
  214. fe.setDataType('MUN');
  215. }
  216. else {
  217. fe.setDataType(t);
  218. }
  219. xml += fe.getXML();
  220. }
  221. }
  222. if (this.getStyleInfo()) {
  223. var fe = new cf.CFilterExpression();
  224. fe.setDefault(true);
  225. fe.setClassName(this.getClass());
  226. fe.setStyle(this.getStyleInfo());
  227. xml += fe.getXML();
  228. }
  229. xml += '</CStyle>';
  230. s += cf.escapeParam(xml);
  231. return s;
  232. };
  233. function CStyleRangeList_getId() {
  234. return this.m_id;
  235. };
  236. function CStyleRangeList_getRangeAt(index) {
  237. if (index < 0) {
  238. return null;
  239. }
  240. if (this.m_ranges != null && index < this.m_ranges.length) {
  241. return this.m_ranges[index];
  242. }
  243. return null;
  244. };
  245. function CStyleRangeList_getRangeById(id) {
  246. if (this.m_ranges) {
  247. for (var i = 0; i < this.m_ranges.length; i++) {
  248. if (this.m_ranges[i].getId() == id) {
  249. return this.m_ranges[i];
  250. }
  251. }
  252. }
  253. if (id == this.m_id) {
  254. return this;
  255. }
  256. return null;
  257. };
  258. function CStyleRangeList_getStyleInfo() {
  259. if (this.m_defaultStyleInfo == null) {
  260. this.m_defaultStyleInfo = "";
  261. }
  262. return this.m_defaultStyleInfo;
  263. };
  264. function CStyleRangeList_getType() {
  265. return this.m_type;
  266. };
  267. function CStyleRangeList_indexOf(value) {
  268. if (this.m_ranges) {
  269. for (var i = 0; i < this.m_ranges.length; i++) {
  270. if (this.m_ranges[i] == value || this.m_ranges[i].getId() == value) {
  271. return i;
  272. }
  273. }
  274. }
  275. return -1;
  276. };
  277. function CStyleRangeList_indexWith(value) {
  278. if (this.m_ranges) {
  279. for (var i = 0; i < this.m_ranges.length; i++) {
  280. if (this.m_ranges[i].contains(value)==0) {
  281. return i;
  282. }
  283. }
  284. }
  285. return -1;
  286. };
  287. function CStyleRangeList_insertRangeAt(range, index) {
  288. if (this.m_ranges) {
  289. var new_ranges = new Array();
  290. if (index < 0) {
  291. new_ranges[new_ranges.length] = range;
  292. }
  293. for (var i = 0; i < this.m_ranges.length; i++) {
  294. if (i == index) {
  295. new_ranges[new_ranges.length] = range;
  296. }
  297. new_ranges[new_ranges.length] = this.m_ranges[i];
  298. }
  299. if (index >= this.m_ranges.length || index == null)
  300. new_ranges[new_ranges.length] = range;
  301. this.m_ranges = new_ranges;
  302. }
  303. };
  304. function CStyleRangeList_moveRange(id, delta)
  305. {
  306. var r = this.getRangeById(id);
  307. if (r)
  308. {
  309. var rIndex = this.indexOf(r);
  310. var step = (delta < 0 ? -1 : 1);
  311. if (delta < 0 && (rIndex + delta) >= 0) {
  312. for (var i = rIndex; i > rIndex + delta; i--) {
  313. var swapObject = this.m_ranges[i];
  314. this.m_ranges[i] = this.m_ranges[i + step];
  315. this.m_ranges[i + step] = swapObject;
  316. }
  317. }
  318. else if (delta > 0 && (rIndex + delta) < this.m_ranges.length) {
  319. for (var i = rIndex; i < rIndex + delta; i++) {
  320. var swapObject = this.m_ranges[i];
  321. this.m_ranges[i] = this.m_ranges[i + step];
  322. this.m_ranges[i + step] = swapObject;
  323. }
  324. }
  325. }
  326. };
  327. function CStyleRangeList_rangeExists(new_r) {
  328. if (this.m_ranges) {
  329. for (var i = 0; i < this.m_ranges.length; i++) {
  330. var r = this.m_ranges[i];
  331. var n_from = new_r.getFrom();
  332. var n_to = new_r.getTo();
  333. var o_from = r.getFrom();
  334. var o_to = r.getTo();
  335. if (typeof n_from == "string") { n_from = n_from.toUpperCase(); }
  336. if (typeof n_to == "string") { n_to = n_to.toUpperCase(); }
  337. if (typeof o_from == "string") { o_from = o_from.toUpperCase(); }
  338. if (typeof o_to == "string") { o_to = o_to.toUpperCase(); }
  339. if (n_from == o_from && n_to == o_to && new_r.getFromInclusive() == r.getFromInclusive() && new_r.getToInclusive() == r.getToInclusive())
  340. return true;
  341. }
  342. }
  343. return false;
  344. };
  345. function CStyleRangeList_removeRange(r)
  346. {
  347. if ( !(r instanceof CStyleRange || r instanceof CStyleSV) ) {
  348. r = this.getRangeById(r);
  349. }
  350. if ( !(r instanceof CStyleRange || r instanceof CStyleSV) ) {
  351. return;
  352. }
  353. var retval = null;
  354. var newRanges = new Array();
  355. for (var i = 0; i < this.m_ranges.length; i++) {
  356. if (this.m_ranges[i].getId() == r.getId()) {
  357. retval = this.m_ranges[i];
  358. if (this.m_type != giRANGE_VALUES) {
  359. if ( (i+1) < this.m_ranges.length ) {
  360. this.m_ranges[i+1].setFrom( (newRanges.length > 0 ? newRanges[newRanges.length-1].getTo() : null) );
  361. this.m_ranges[i+1].setFromInclusive( !(newRanges.length > 0 ? newRanges[newRanges.length-1].getToInclusive() : true) );
  362. }
  363. else if ( newRanges.length > 0 ) {
  364. newRanges[newRanges.length-1].getTo() = null;
  365. }
  366. }
  367. }
  368. else {
  369. newRanges[newRanges.length] = this.m_ranges[i];
  370. }
  371. }
  372. this.m_ranges = newRanges;
  373. if (this.m_type != giRANGE_VALUES) {
  374. if (this.m_ranges && this.m_ranges.length <= 1 && this.m_ranges[0].getFrom() == null && this.m_ranges[0].getTo() == null) {
  375. this.setClass(this.m_ranges[0].getClass());
  376. this.setStyleInfo(this.m_ranges[0].getStyleInfo());
  377. this.m_ranges = new Array();
  378. }
  379. }
  380. return retval;
  381. };
  382. function CStyleRangeList_removeThreshold(threshold) {
  383. for (var i = 0; i < this.m_ranges.length; i++) {
  384. if ( this.m_ranges[i].getTo() == threshold ) {
  385. return this.removeRange(this.m_ranges[i]);
  386. }
  387. }
  388. return null;
  389. };
  390. function CStyleRangeList_render(container, clientWin)
  391. {
  392. if ( typeof container != "object" ) {
  393. }
  394. var hs =
  395. '<td height="15" width="1" nowrap="nowrap" style="padding: 2px;">' +
  396. '<table border="0" cellpadding="0" cellspacing="0" ><tr>' +
  397. '<td class="tableHeaderDivider" width="1"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/ps/images/space.gif" border="0" height="15" width="1"/></td>' +
  398. '</tr></table>' +
  399. '</td>';
  400. var out =
  401. '<table' + ( this.m_type == giRANGE_VALUES ? '' : ' height="100%"' ) + ' border="0" cellpadding="0" cellspacing="0">' +
  402. '<tr class="tableHeader">' +
  403. '<td width="1" nowrap="nowrap"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/ps/images/space.gif" border="0" height="1" width="21"/></td>' +
  404. hs +
  405. '<td class="tableTitle" height="10" '+( this.m_type == giRANGE_VALUES ? 'width="50%"' : 'width="105"' )+' valign="center" nowrap="nowrap" style="padding-left:2px;padding-top:2px;">' +
  406. ( this.m_type == giRANGE_VALUES ? gsSELECTHEADER : gsRANGEHEADER ) +
  407. '</td>' +
  408. '<td nowrap="nowrap" colspan="2"' + ( this.m_type == giRANGE_VALUES ? 'width="50%"' : ' width="100%"' ) + '><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>' +
  409. '<td width="1" nowrap="nowrap"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/ps/images/space.gif" border="0" height="1" width="10"/></td>' +
  410. hs +
  411. '<td class="tableTitle" width="100%" height="10" valign="center" nowrap="nowrap" style="padding-left:2px;padding-top:2px;">' +
  412. gsSTYLEHEADER +
  413. '</td>' +
  414. '</tr></table></td>' +
  415. '</tr>';
  416. var msgID_highest = "HIGHEST";
  417. var msgID_lowest = "LOWEST";
  418. if (this.m_type == giRANGE_DATE || this.m_type == giRANGE_DATETIME) {
  419. msgID_highest = "HIGHEST_DATE";
  420. msgID_lowest = "LOWEST_DATE";
  421. }
  422. else if (this.m_type == giRANGE_TIME) {
  423. msgID_highest = "HIGHEST_TIME";
  424. msgID_lowest = "LOWEST_TIME";
  425. }
  426. if (this.m_ranges.length > 0) {
  427. if (this.m_type == giRANGE_VALUES) {
  428. for (var i = 0; i < this.m_ranges.length; i++) {
  429. out += this.m_ranges[i].render(clientWin);
  430. }
  431. }
  432. else {
  433. out += splitRow(msgCndFrmt[msgID_highest]);
  434. for (var i = this.m_ranges.length - 1; i > 0; i--) {
  435. out += this.m_ranges[i].render(clientWin);
  436. out += splitRow("");
  437. }
  438. if (this.m_ranges.length > 0) {
  439. out += this.m_ranges[0].render(clientWin);
  440. }
  441. out += splitRow(msgCndFrmt[msgID_lowest]);
  442. }
  443. }
  444. if (this.m_ranges.length == 0 || this.m_type == giRANGE_VALUES) {
  445. if (this.m_type == giRANGE_VALUES) {
  446. out += '<tr>' +
  447. '<td colspan="2"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="1" height="20" /></td>' +
  448. '<td colspan="' + (this.m_ranges.length > 0 ? '2' : '1') + '" class="tabletext">' +
  449. '<a href="javascript:void(0);" onmousedown="pickValues()">' + cf.htmlencode(gsSELECTLINK) + '</a> ' +
  450. msgCndFrmt["OR"] +
  451. ' <a href="javascript:void(0);" onmousedown="pickTextRange()">' + cf.htmlencode(gsADDRANGELINK) + '</a>' +
  452. (this.m_ranges.length > 0 ? '' : renderStyleControls(this)) +
  453. '</td></tr>';
  454. if (this.m_ranges.length > 0) {
  455. out += '<tr><td colspan="2"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="1" height="1" /></td>' +
  456. '<td class="tabletext" nowrap="nowrap">' +
  457. msgCndFrmt["REMAINING_VALUES"] +
  458. '</td>'+
  459. renderStyleControls(this) +
  460. '</tr>';
  461. }
  462. }
  463. else {
  464. out += splitRow(msgCndFrmt[msgID_highest]) +
  465. '<tr height="100%"><td colspan="3"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="131" height="1" /></td>' +
  466. '<td width="1">' +
  467. '<table border="0" cellpadding="0" cellspacing="0" height="100%" width="1">' +
  468. '<tr><td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() +'/qs/images/range_top.gif" border="0" height="3" width="23" /></td></tr>' +
  469. '<tr><td style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() +'/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" height="3" width="23" /></td></tr>' +
  470. '<tr height="100%"><td height="100%" style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_middle.gif" border="0" height="11" width="23" /></td></tr>' +
  471. '<tr><td style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" height="3" width="23" /></td></tr>' +
  472. '<tr><td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_bottom.gif" border="0" height="3" width="23" /></td></tr>' +
  473. '</table>' +
  474. '</td>' +
  475. renderStyleControls(this) + '</tr>';
  476. }
  477. if (this.m_type != giRANGE_VALUES) {
  478. out += splitRow(msgCndFrmt[msgID_lowest]);
  479. }
  480. }
  481. out += '</table>';
  482. container.innerHTML = out;
  483. };
  484. function renderStyleControls(obj)
  485. {
  486. var _id = "";
  487. var _class = "";
  488. var _style = "";
  489. if (obj != null) {
  490. _id = obj.getId();
  491. _class = obj.getClass();
  492. _style = obj.getStyleInfo();
  493. }
  494. var _bThresholdUI = false;
  495. var _t = obj.m_type;
  496. if (_t == null && obj.m_parent != null) {
  497. _t = obj.m_parent.m_type;
  498. }
  499. switch (_t) {
  500. case giRANGE_NUMERIC:
  501. case giRANGE_DATE:
  502. case giRANGE_TIME:
  503. case giRANGE_DATETIME:
  504. case giRANGE_INTERVAL:
  505. _bThresholdUI = true;
  506. }
  507. var s = '<td' + (_bThresholdUI ? ' width="100%"' : '') + ' valign="center" style="padding:3px;">' +
  508. '<table border="0" cellpadding="0" cellspacing="0"><tr>' +
  509. (_bThresholdUI ? '' : '<td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="15" height="1" /></td>' ) +
  510. '<td><select id="' + gsSELECTCLASS + _id + '" onchange="changeCSSClass(\'' + _id + '\');">' +
  511. renderClassOption(gsCSSCLASS_DEFAULT, gsCSS_DEFAULT) +
  512. renderClassOption('csExcellent', gsCSS_EXCELLENT, _class, _style) +
  513. renderClassOption('csGood', gsCSS_GOOD, _class, _style) +
  514. renderClassOption('csAverage', gsCSS_AVERAGE, _class, _style) +
  515. renderClassOption('csBad', gsCSS_BAD, _class, _style) +
  516. renderClassOption('csPoor', gsCSS_POOR, _class, _style) +
  517. renderClassOption(gsCSSCLASS_CUSTOM, gsCSS_CUSTOM, _class, '') +
  518. '</select>' +
  519. '</td><td>' +
  520. '<img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="10" height="1" />' +
  521. '</td><td>' +
  522. renderPreviewBox(obj) +
  523. '</td><td style="padding:0px 2px 0px 5px;">' +
  524. '<img class="icon" title="' + cf.htmlencode(msgCndFrmt["EDIT_STYLE_TIP"]) + '" src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/ps/portal/images/action_edit.gif" border="0" onmousedown="pickStyles(\'' + _id + '\');"/>' +
  525. '</td></tr></table>' +
  526. '</td>';
  527. return s;
  528. };
  529. function renderClassOption(name, text, css_class, css_style, bSelected)
  530. {
  531. var buf = '<option value="' + name + '"';
  532. if (css_class == name || bSelected) {
  533. buf += ' selected="true"';
  534. }
  535. buf += '>' + cf.htmlencode(text) + '</option>';
  536. return buf;
  537. };
  538. function renderPreviewBox(obj)
  539. {
  540. var _id = "";
  541. var _class = "";
  542. var _style = "";
  543. if (obj != null) {
  544. _id = obj.getId();
  545. _class = obj.getClass();
  546. _style = obj.getStyleInfo();
  547. }
  548. var s = '<div class="previewBox" style="line-height:20px;height:20px;width:60px;overflow:hidden;">' +
  549. '<div id="' + gsPREVIEW + _id + '" class="' + _class + '" style="' + _style + '">' +
  550. gsPREVIEWTEXT +
  551. '</div>' +
  552. '</div>';
  553. return s;
  554. };
  555. function renderThresholdControl(obj, bUpperBound, clientWin, _value, _formattedValue)
  556. {
  557. var objId = obj.getId();
  558. if (!bUpperBound) {
  559. var idx = getCSR().indexOf(obj);
  560. objId = getCSR().getRangeAt(idx-1).getId();
  561. }
  562. var s = '<tr><td style="padding:0px 5px;">' +
  563. '<img class="icon" title="' + cf.htmlencode(msgCndFrmt["DELETE_TIP"]) + '" src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/toolbar/action_delete.gif" height="16" width="16" border="0" onclick="delTS(\'' + objId + '\');"/>' +
  564. '</td><td width="100%">';
  565. if (obj.m_parent.m_type == giRANGE_DATE ||
  566. obj.m_parent.m_type == giRANGE_TIME ||
  567. obj.m_parent.m_type == giRANGE_DATETIME ||
  568. obj.m_parent.m_type == giRANGE_INTERVAL)
  569. {
  570. s += '<table cellpadding="0" cellspacing="0" width="100%" border="0"><tr><td width="100%" style="padding-right:5px;text-align:right;" class="tabletext" nowrap="nowrap">';
  571. s += '<a href="javascript:void(0);" onmousedown="pickValues(\''+objId+'\');">' + _formattedValue + '</a>';
  572. s += '</td><td valign="bottom">';
  573. s += renderMoveTSIcon(obj, bUpperBound, true);
  574. s += '</td></tr></table>';
  575. }
  576. else {
  577. if (clientWin != null && typeof clientWin.sFormatNumber == 'function') {
  578. _value = clientWin.sFormatNumber(_value, false, true);
  579. }
  580. s += '<table cellpadding="0" cellspacing="0" border="0" height="100%">';
  581. s += '<tr><td><input id="' + gsTHRESHOLD + objId + '" type="text" style="text-align:right;width:100px;" value="' + _value + '" onchange="updTS(\'' + objId + '\');" onkeyup="if (event && event.keyCode==13){updTS(\'' + objId + '\');}">';
  582. s += '</td><td valign="' + (bUpperBound?'top':'bottom') + '">' + renderMoveTSIcon(obj, bUpperBound) + '</td></tr>';
  583. s += '</table>';
  584. }
  585. s += '</td></tr>';
  586. return s;
  587. };
  588. function renderMoveTSIcon(obj, bUp, bBorderLeft)
  589. {
  590. bUp = !(bUp == false);
  591. var icon = '' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/style/rangestyle_' + (bUp ? 'up_' : 'down_');
  592. var s = '<img border="0" class="icon" src="' + icon + 'normal.gif" onclick="' +
  593. (bUp ? 'moveTSUp' : 'moveTSDown') + '(\'' + obj.getId() + '\');" onmouseover="this.src=\'' +
  594. icon + 'rollover.gif\';" onmouseout="this.src=\'' +
  595. icon + 'normal.gif\';"' + (document.all?' style="margin:1px 0px;"' : '') +
  596. 'title="' + msgCndFrmt[(bUp ? 'THRESHOLD_UP_TIP' : 'THRESHOLD_DOWN_TIP')] + '">';
  597. return s;
  598. };
  599. function splitRow(txt)
  600. {
  601. return '<tr height="1">' +
  602. '<td colspan="4" style="text-align:right;">' +
  603. '<table border="0" height="100%" cellpadding="0" cellspacing="0"><tr>' +
  604. '<td height="1" width="100%" style="text-align:right;" class="text" nowrap="nowrap">' +
  605. txt +
  606. '</td>' +
  607. '<td height="1" ><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_tic' +
  608. (txt ? '' : '_mid') + '.gif" height="' + (txt ? 11 : 6) + '" width="23" border="0"/></td>' +
  609. '</tr></table>' +
  610. '</td>' +
  611. '<td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="1" height="1"/></td>' +
  612. '</tr>';
  613. };
  614. function CStyleRangeList_setClass(c) {
  615. this.m_defaultClass = (c ? c : gsCSSCLASS_DEFAULT);
  616. };
  617. function CStyleRangeList_setColType(type) {
  618. if (type && typeof type == "string") {
  619. this.m_colType = type;
  620. }
  621. else {
  622. this.m_colType = "";
  623. }
  624. };
  625. function CStyleRangeList_setId(id) {
  626. this.m_id = getSafeIdentifier(id);
  627. };
  628. function CStyleRangeList_setStyleInfo(s) {
  629. this.m_defaultStyleInfo = s;
  630. };
  631. function CStyleRangeList_setType(type) {
  632. switch (type) {
  633. case "numeric":
  634. type = giRANGE_NUMERIC; break;
  635. case "string":
  636. type = giRANGE_STRING; break;
  637. case "date":
  638. type = giRANGE_DATE; break;
  639. case "datetime":
  640. type = giRANGE_DATETIME; break;
  641. case "time":
  642. type = giRANGE_TIME; break;
  643. case "interval":
  644. type = giRANGE_INTERVAL; break;
  645. case "selectValue":
  646. type = giRANGE_VALUES; break;
  647. default:
  648. break;
  649. }
  650. if ( type == giRANGE_NUMERIC ||
  651. type == giRANGE_DATE ||
  652. type == giRANGE_DATETIME ||
  653. type == giRANGE_TIME ||
  654. type == giRANGE_INTERVAL ||
  655. type == giRANGE_VALUES)
  656. {
  657. this.m_type = type;
  658. }
  659. else
  660. {
  661. this.m_type = giRANGE_STRING;
  662. }
  663. };
  664. function CStyleRangeList_updateRangeStyle(id, className, styleInfo) {
  665. var r = this.getRangeById(id);
  666. if ( r instanceof CStyleRange ) {
  667. r.m_className = className;
  668. r.m_styleInfo = styleInfo;
  669. }
  670. };
  671. function CStyleRangeList_updateSVList(id, list) {
  672. var sv = this.getRangeById(id);
  673. if ( sv instanceof CStyleSV ) {
  674. sv.update(list);
  675. }
  676. };
  677. function CStyleRangeList_updateThreshold(id, threshold) {
  678. var aCSSStyles = new Array();
  679. for (var i = 0; i < this.m_ranges.length; i++) {
  680. var r = this.m_ranges[i];
  681. aCSSStyles[aCSSStyles.length] = [r.getClass(), r.getStyleInfo(), r.getFromInclusive(), r.getToInclusive()];
  682. }
  683. var aNewRanges = this.addThreshold(threshold);
  684. if ( aNewRanges && aNewRanges[0] instanceof CStyleRange ) {
  685. var r = this.removeRange(id);
  686. }
  687. for (var i = 0; i < this.m_ranges.length; i++) {
  688. var r = this.m_ranges[i];
  689. r.setClass(aCSSStyles[i][0]);
  690. r.setStyleInfo(aCSSStyles[i][1]);
  691. r.setFromInclusive(aCSSStyles[i][2]);
  692. r.setToInclusive(aCSSStyles[i][3]);
  693. }
  694. };
  695. CStyleRangeList.prototype.addStyleRange = CStyleRangeList_addStyleRange;
  696. CStyleRangeList.prototype.addRange = CStyleRangeList_addRange;
  697. CStyleRangeList.prototype.addSVList = CStyleRangeList_addSVList;
  698. CStyleRangeList.prototype.addThreshold = CStyleRangeList_addThreshold;
  699. CStyleRangeList.prototype.clone = CStyleRangeList_clone;
  700. CStyleRangeList.prototype.generateID = CStyleRangeList_generateID;
  701. CStyleRangeList.prototype.getClass = CStyleRangeList_getClass;
  702. CStyleRangeList.prototype.getColType = CStyleRangeList_getColType;
  703. CStyleRangeList.prototype.getCommand = CStyleRangeList_getCommand;
  704. CStyleRangeList.prototype.getId = CStyleRangeList_getId;
  705. CStyleRangeList.prototype.getRangeAt = CStyleRangeList_getRangeAt;
  706. CStyleRangeList.prototype.getRangeById = CStyleRangeList_getRangeById;
  707. CStyleRangeList.prototype.getStyleInfo = CStyleRangeList_getStyleInfo;
  708. CStyleRangeList.prototype.getType = CStyleRangeList_getType;
  709. CStyleRangeList.prototype.indexOf = CStyleRangeList_indexOf;
  710. CStyleRangeList.prototype.indexWith = CStyleRangeList_indexWith;
  711. CStyleRangeList.prototype.initStrings = CStyleRangeList_initStrings;
  712. CStyleRangeList.prototype.insertRangeAt = CStyleRangeList_insertRangeAt;
  713. CStyleRangeList.prototype.moveRange = CStyleRangeList_moveRange;
  714. CStyleRangeList.prototype.rangeExists = CStyleRangeList_rangeExists;
  715. CStyleRangeList.prototype.removeRange = CStyleRangeList_removeRange;
  716. CStyleRangeList.prototype.removeThreshold = CStyleRangeList_removeThreshold;
  717. CStyleRangeList.prototype.render = CStyleRangeList_render;
  718. CStyleRangeList.prototype.setClass = CStyleRangeList_setClass;
  719. CStyleRangeList.prototype.setColType = CStyleRangeList_setColType;
  720. CStyleRangeList.prototype.setId = CStyleRangeList_setId;
  721. CStyleRangeList.prototype.setStyleInfo = CStyleRangeList_setStyleInfo;
  722. CStyleRangeList.prototype.setType = CStyleRangeList_setType;
  723. CStyleRangeList.prototype.updateRangeStyle = CStyleRangeList_updateRangeStyle;
  724. CStyleRangeList.prototype.updateSVList = CStyleRangeList_updateSVList;
  725. CStyleRangeList.prototype.updateThreshold = CStyleRangeList_updateThreshold;
  726. function CStyleRange(fromValue, toValue, fromInclusive, toInclusive, className, styleInfo) {
  727. this.m_id = generateGUID();
  728. this.m_className = (className != null ? className : "");
  729. this.m_fromValue = null;
  730. this.m_toValue = null;
  731. this.m_parent = null;
  732. this.m_styleInfo = (styleInfo != null ? styleInfo : "");
  733. this.setFrom(fromValue);
  734. this.setFromInclusive(fromInclusive != null ? fromInclusive : false);
  735. this.setTo(toValue);
  736. this.setToInclusive(toInclusive != null ? toInclusive : true);
  737. };
  738. function CStyleRange_clone() {
  739. var clone = new CStyleRange();
  740. clone.m_id = this.m_id;
  741. clone.m_className = this.m_className;
  742. clone.m_fromInclusive = this.m_fromInclusive;
  743. clone.m_fromValue = this.m_fromValue;
  744. clone.m_parent = this.m_parent;
  745. clone.m_styleInfo = this.m_styleInfo;
  746. clone.m_toInclusive = this.m_toInclusive;
  747. clone.m_toValue = this.m_toValue;
  748. return clone;
  749. };
  750. function CStyleRange_contains(value) {
  751. var from = this.getFrom();
  752. var to = this.getTo();
  753. var v = value;
  754. from = getDaysFromInterval(from);
  755. to = getDaysFromInterval(to);
  756. v = getDaysFromInterval(v);
  757. if (typeof from == "string") { from = from.toUpperCase(); }
  758. else if (typeof from == "number") { from = parseFloat(from); }
  759. if (typeof to == "string") { to = to.toUpperCase(); }
  760. else if (typeof to == "number") {to = parseFloat(to);}
  761. if (typeof v == "string") { v = v.toUpperCase(); }
  762. else if (typeof v == "number") {v = parseFloat(v);}
  763. if ( (from == null || v > from) && (to == null || v < to))
  764. return 0;
  765. else if (this.getFromInclusive() && v == from)
  766. return 0;
  767. else if (this.getToInclusive() && v == to)
  768. return 0;
  769. else if (v <= from)
  770. return -1;
  771. else if (v >= to)
  772. return 1;
  773. return null;
  774. };
  775. function CStyleRange_getCommand() {
  776. var decimalSeparator = goDialogManager.getMiniQueryManager().getDecimalSeparator();
  777. var from = (this.getFrom() != null? this.getFrom().toString() : '');
  778. var to = (this.getTo() != null ? this.getTo().toString() : '');
  779. from = from.replace(/\./gi, decimalSeparator);
  780. to = to.replace(/\./gi, decimalSeparator);
  781. var a = [
  782. "range",
  783. (this.getClass() && this.getClass() != gsCSSCLASS_DEFAULT ? cf.escapeParam(this.getClass()) : "\\"),
  784. (this.getStyleInfo() ? cf.escapeParam(this.getStyleInfo()) : "\\"),
  785. (from != null ? cf.escapeParam(from) : "\\"),
  786. cf.escapeParam(this.getFromInclusive()),
  787. (to != null ? cf.escapeParam(to) : "\\"),
  788. cf.escapeParam(this.getToInclusive())
  789. ];
  790. return a.join();
  791. };
  792. function CStyleRange_getClass() {
  793. if (this.m_className == null) {
  794. this.m_className = "";
  795. }
  796. return this.m_className;
  797. };
  798. function CStyleRange_getFrom() {
  799. return this.m_fromValue;
  800. };
  801. function CStyleRange_getFromInclusive() {
  802. return this.m_fromInclusive;
  803. };
  804. function CStyleRange_getId() {
  805. return this.m_id;
  806. };
  807. function CStyleRange_getTo() {
  808. return this.m_toValue;
  809. };
  810. function CStyleRange_getToInclusive() {
  811. return this.m_toInclusive;
  812. };
  813. function CStyleRange_getStyleInfo() {
  814. if (this.m_styleInfo == null) {
  815. this.m_styleInfo = "";
  816. }
  817. return this.m_styleInfo;
  818. };
  819. function CStyleRange_getIndex() {
  820. if (this.m_parent instanceof CStyleRangeList && this.m_parent.m_ranges) {
  821. for (var i = 0; i < this.m_parent.m_ranges.length; i++) {
  822. if (this.m_parent.m_ranges[i].getId() == this.getId()) {
  823. return i;
  824. }
  825. }
  826. }
  827. return -1;
  828. };
  829. function CStyleRange_render(clientWin)
  830. {
  831. var out = '<tr>';
  832. var _from = this.getFrom();
  833. var _to = this.getTo();
  834. var _sFrom = (_from == null ? '' : _from);
  835. var _sTo = (_to == null ? '' : _to);
  836. if (this.m_parent.m_type == giRANGE_DATE) {
  837. if (_from != null) { _sFrom = getFormatDate(dParseDate(_from, 'YMD'), 0, g_dateOrder); }
  838. if (_to != null) { _sTo = getFormatDate(dParseDate(_to, 'YMD'), 0, g_dateOrder); }
  839. }
  840. else if (this.m_parent.m_type == giRANGE_TIME) {
  841. if (_from != null) { _sFrom = getFormatTime(dParseTime(_from), 2); }
  842. if (_to != null) { _sTo = getFormatTime(dParseTime(_to), 2); }
  843. }
  844. else if (this.m_parent.m_type == giRANGE_DATETIME) {
  845. if (_from != null) {
  846. _from.match(/(\d\d\d\d-\d\d-\d\d)\s*(.+)*/gi);
  847. var sDate = RegExp.$1; var sTime = RegExp.$2;
  848. _sFrom = getFormatDate(dParseDate(sDate, 'YMD'), 0, g_dateOrder) + (sTime ? " " + getFormatTime(dParseTime(sTime), 2) : "" );
  849. }
  850. if (_to != null) {
  851. _to.match(/(\d\d\d\d-\d\d-\d\d)\s*(.+)*/gi);
  852. var sDate = RegExp.$1; var sTime = RegExp.$2;
  853. _sTo = getFormatDate(dParseDate(sDate, 'YMD'), 0, g_dateOrder) + (sTime ? " " + getFormatTime(dParseTime(sTime), 2) : "" );
  854. }
  855. }
  856. else if (this.m_parent.m_type == giRANGE_INTERVAL) {
  857. if (_from != null) {
  858. _from.match(/(-?\d+) (\d\d):(\d\d)/gi);
  859. var sDays = parseInt(RegExp.$1, 10); var sHrs = parseInt(RegExp.$2, 10); var sMin = parseInt(RegExp.$3, 10);
  860. _sFrom = gsDATAFORMAT_INTERVAL.replace(/\^0/gi, sDays).replace(/\^1/gi, sHrs).replace(/\^2/gi, sMin);
  861. }
  862. if (_to != null) {
  863. _to.match(/(-?\d+) (\d\d):(\d\d)/gi);
  864. var sDays = parseInt(RegExp.$1, 10); var sHrs = parseInt(RegExp.$2, 10); var sMin = parseInt(RegExp.$3, 10);
  865. _sTo = gsDATAFORMAT_INTERVAL.replace(/\^0/gi, sDays).replace(/\^1/gi, sHrs).replace(/\^2/gi, sMin);
  866. }
  867. }
  868. else if (this.m_parent.m_type == giRANGE_NUMERIC)
  869. {
  870. if (clientWin != null && typeof clientWin.sFormatNumber == 'function') {
  871. if (_from != null) {
  872. _sFrom = clientWin.sFormatNumber(_from, false, true);
  873. }
  874. if (_to != null) {
  875. _sTo = clientWin.sFormatNumber(_to, false, true);
  876. }
  877. }
  878. }
  879. if (this.m_parent != null && this.m_parent.m_type == giRANGE_VALUES) {
  880. var out = '<tr id="csrow-' + this.getId() + '">' +
  881. '<td colspan="2"><img class="icon" title="' + cf.htmlencode(msgCndFrmt["SELECT_LINE_TIP"]) + '" src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/filter/row_selector.gif" height="16" width="16" border="0" onclick="CS_SelectRow(event, \''+this.getId()+'\')"/></td>' +
  882. '<td class="tabletext"><a href="javascript:void(0);" onmousedown="pickTextRange(\''+this.getId()+'\')">';
  883. if (_from != null && _from !== "" && _to != null && _to !== "") {
  884. out += msgCndFrmt["RANGE_LINK"].replace(/\^0/gi, _sFrom).replace(/\^1/gi, _sTo);
  885. }
  886. else if (_from != null && _from !== "") {
  887. out += msgCndFrmt["RANGE_LINK_FROM"].replace(/\^0/gi, _sFrom);
  888. }
  889. else if (_to != null && _to !== "") {
  890. out += msgCndFrmt["RANGE_LINK_TO"].replace(/\^0/gi, _sTo);
  891. }
  892. out += '</a></td>';
  893. }
  894. else {
  895. out += '<td colspan="3"><table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%" >';
  896. if (_to != null && this.getToInclusive()) {
  897. out += renderThresholdControl(this, true, clientWin, _to, _sTo);
  898. }
  899. out += '<tr><td height="100%"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="26" height="1"/></td><td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" width="1" height="1"/></td></tr>';
  900. if (_from != null && this.getFromInclusive()) {
  901. out += renderThresholdControl(this, false, clientWin, _from, _sFrom);
  902. }
  903. out += '</table></td>';
  904. var rangeTip = "RANGE";
  905. if (_to != null) {
  906. rangeTip += '_LT';
  907. if (this.getToInclusive()) {
  908. rangeTip += '_EQ';
  909. }
  910. }
  911. if (_from != null) {
  912. rangeTip += '_GT';
  913. if (this.getFromInclusive()) {
  914. rangeTip += '_EQ';
  915. }
  916. }
  917. switch (this.m_parent.m_type) {
  918. case giRANGE_DATE:
  919. rangeTip += '_DATE'; break;
  920. case giRANGE_DATETIME:
  921. rangeTip += '_DATETIME'; break;
  922. case giRANGE_TIME:
  923. rangeTip += '_TIME'; break;
  924. }
  925. rangeTip = msgCndFrmt[(rangeTip + '_TIP')];
  926. if (typeof rangeTip == "string") {
  927. if (_to != null && _from != null) {
  928. rangeTip = rangeTip.replace(/\^0/gi, _sFrom).replace(/\^1/gi, _sTo);
  929. }
  930. else if (_from != null) {
  931. rangeTip = rangeTip.replace(/\^0/gi, _sFrom);
  932. }
  933. else if (_to != null) {
  934. rangeTip = rangeTip.replace(/\^0/gi, _sTo);
  935. }
  936. }
  937. else {
  938. rangeTip = "";
  939. }
  940. out +=
  941. '<td title="' + rangeTip + '" style="text-align:right;">' +
  942. '<table height="100%" border="0" cellpadding="0" cellspacing="0">' +
  943. '<tr><td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_top.gif" border="0" height="3" width="23"/></td></tr>' +
  944. '<tr><td style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" height="3" width="23"/></td></tr>' +
  945. '<tr height="100%"><td height="100%" style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_middle.gif" border="0" height="11" width="23"/></td></tr>' +
  946. '<tr><td style="background:url(' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_resize.gif); background-repeat : repeat-y;"><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/common/images/spacer.gif" border="0" height="3" width="23"/></td></tr>' +
  947. '<tr><td><img src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/range_bottom.gif" border="0" height="3" width="23"/></td></tr>' +
  948. '</table>' +
  949. '</td>';
  950. }
  951. out += renderStyleControls(this) + '</tr>';
  952. return out;
  953. };
  954. function CStyleRange_setClass(c) {
  955. this.m_className = (c ? c : gsCSSCLASS_DEFAULT);
  956. };
  957. function CStyleRange_setFrom(v) {
  958. this.m_fromValue = v;
  959. };
  960. function CStyleRange_setFromInclusive(v) {
  961. this.m_fromInclusive = (v == true || v == 'true');
  962. };
  963. function CStyleRange_setId(id) {
  964. this.m_id = getSafeIdentifier(id);
  965. };
  966. function CStyleRange_setTo(v) {
  967. this.m_toValue = v;
  968. };
  969. function CStyleRange_setToInclusive(v) {
  970. this.m_toInclusive = (v == true || v == 'true');
  971. };
  972. function CStyleRange_setStyleInfo(s) {
  973. this.m_styleInfo = s;
  974. };
  975. function CStyleRange_toString() {
  976. var s = (this.getFromInclusive() ? '[' : ']') +
  977. this.getFrom() +
  978. ', ' +
  979. this.getTo() +
  980. (this.getToInclusive() ? ']' : '[');
  981. return s;
  982. };
  983. function CStyleRange_update() {
  984. };
  985. CStyleRange.prototype.clone = CStyleRange_clone;
  986. CStyleRange.prototype.contains = CStyleRange_contains;
  987. CStyleRange.prototype.getCommand = CStyleRange_getCommand;
  988. CStyleRange.prototype.getClass = CStyleRange_getClass;
  989. CStyleRange.prototype.getFrom = CStyleRange_getFrom;
  990. CStyleRange.prototype.getFromInclusive = CStyleRange_getFromInclusive;
  991. CStyleRange.prototype.getId = CStyleRange_getId;
  992. CStyleRange.prototype.getTo = CStyleRange_getTo;
  993. CStyleRange.prototype.getToInclusive = CStyleRange_getToInclusive;
  994. CStyleRange.prototype.getStyleInfo = CStyleRange_getStyleInfo;
  995. CStyleRange.prototype.getIndex = CStyleRange_getIndex;
  996. CStyleRange.prototype.render = CStyleRange_render;
  997. CStyleRange.prototype.setClass = CStyleRange_setClass;
  998. CStyleRange.prototype.setFrom = CStyleRange_setFrom;
  999. CStyleRange.prototype.setFromInclusive = CStyleRange_setFromInclusive;
  1000. CStyleRange.prototype.setId = CStyleRange_setId;
  1001. CStyleRange.prototype.setTo = CStyleRange_setTo;
  1002. CStyleRange.prototype.setToInclusive = CStyleRange_setToInclusive;
  1003. CStyleRange.prototype.setStyleInfo = CStyleRange_setStyleInfo;
  1004. CStyleRange.prototype.toString = CStyleRange_toString;
  1005. CStyleRange.prototype.update = CStyleRange_update;
  1006. function CStyleSV(svList) {
  1007. if (svList != null && svList.length && !(svList[0] instanceof cf.CFilterValue)) {
  1008. for (var i = 0; i < svList.length; i++) {
  1009. if (typeof svList[i] == "object" && svList[i].length >= 2) {
  1010. svList[i] = new cf.CFilterValue(svList[i][0], svList[i][1]);
  1011. }
  1012. else {
  1013. svList[i] = new cf.CFilterValue(svList[i]);
  1014. }
  1015. }
  1016. }
  1017. else if (svList != null && svList.length && !(svList[0] instanceof cf.CFilterValue)) {
  1018. for (var i = 0; i < svList.length; i++) {
  1019. if (typeof svList[i] == "object" && svList[i].length >= 2) {
  1020. svList[i] = new cf.CFilterValue(svList[i][0], svList[i][1]);
  1021. }
  1022. else {
  1023. svList[i] = new cf.CFilterValue(svList[i]);
  1024. }
  1025. }
  1026. }
  1027. this.m_id = "";
  1028. this.m_className = "";
  1029. this.m_selectValueList = (svList != null ? svList : new Array());
  1030. this.m_parent = null;
  1031. this.m_styleInfo = "";
  1032. this.m_missingValues = false;
  1033. };
  1034. function CStyleSV_clone() {
  1035. var clone = new CStyleSV();
  1036. clone.m_id = this.m_id;
  1037. clone.m_className = this.m_className;
  1038. clone.m_selectValueList = this.m_selectValueList;
  1039. clone.m_parent = this.m_parent;
  1040. clone.m_styleInfo = this.m_styleInfo;
  1041. return clone;
  1042. };
  1043. function CStyleSV_getClass() {
  1044. if (this.m_className == null) {
  1045. this.m_className = "";
  1046. }
  1047. return this.m_className;
  1048. };
  1049. function CStyleSV_getCommand() {
  1050. var a = [
  1051. "selectValue",
  1052. (this.getClass() && this.getClass() != gsCSSCLASS_DEFAULT ? cf.escapeParam(this.getClass()) : "\\"),
  1053. (this.getStyleInfo() ? cf.escapeParam(this.getStyleInfo()) : "\\") ];
  1054. if (this.m_selectValueList != null) {
  1055. a[a.length] = this.m_selectValueList.length + ( this.getMissingValues() ? 1 : 0);
  1056. for (var i = 0; i < this.m_selectValueList.length; i++) {
  1057. a[a.length] = (this.m_selectValueList[i].getUse() ? cf.escapeParam(this.m_selectValueList[i].getUse()) : "\\");
  1058. a[a.length] = (this.m_selectValueList[i].getDisplay() ? cf.escapeParam(this.m_selectValueList[i].getDisplay()) : "\\");
  1059. }
  1060. if (this.getMissingValues()) {
  1061. a[a.length] = "\\";
  1062. a[a.length] = "\\";
  1063. }
  1064. }
  1065. return a.join();
  1066. };
  1067. function CStyleSV_getId() {
  1068. return this.m_id;
  1069. };
  1070. function CStyleSV_getValues() {
  1071. return this.m_selectValueList;
  1072. };
  1073. function CStyleSV_getMissingValues() {
  1074. return this.m_missingValues;
  1075. };
  1076. function CStyleSV_getStyleInfo() {
  1077. if (this.m_styleInfo == null) {
  1078. this.m_styleInfo = "";
  1079. }
  1080. return this.m_styleInfo;
  1081. };
  1082. function CStyleSV_render(clientWin) {
  1083. var out = '<tr id="csrow-'+this.getId()+'">' +
  1084. '<td colspan="2"><img class="icon" title="' + cf.htmlencode(msgCndFrmt["SELECT_LINE_TIP"]) + '" src="' + goDialogManager.getReportFrame().oCVQS.getWebContentRoot() + '/qs/images/filter/row_selector.gif" height="16" width="16" border="0" onclick="CS_SelectRow(event, \''+this.getId()+'\')"/></td>' +
  1085. '<td class="tabletext">';
  1086. var sValues = "";
  1087. if (this.m_selectValueList != null && this.m_selectValueList.length > 0) {
  1088. var sConcatArray = msgCndFrmt["ARRAY_VALUES"];
  1089. sValues = ( typeof this.m_selectValueList[0].getDisplay == "function" ?
  1090. this.m_selectValueList[0].getDisplay() :
  1091. this.m_selectValueList[0] );
  1092. for (var i = 1; i < this.m_selectValueList.length; i++) {
  1093. sValues = sConcatArray
  1094. .replace(/\^0/gi, sValues)
  1095. .replace(/\^1/gi, ( typeof this.m_selectValueList[i].getDisplay == "function" ?
  1096. this.m_selectValueList[i].getDisplay() :
  1097. this.m_selectValueList[i] ) );
  1098. }
  1099. }
  1100. if (this.getMissingValues()) {
  1101. if (sValues) {
  1102. sValues = sConcatArray.replace(/\^0/gi, sValues).replace(/\^1/gi, gsMISSING_VALUES);
  1103. }
  1104. else {
  1105. sValues = gsMISSING_VALUES;
  1106. }
  1107. }
  1108. var maxStringLength = 1250;
  1109. out += '<a href="javascript:void(0);" onmousedown="pickValues(\''+this.getId()+'\')"' +
  1110. ( sValues.length <= 100 ? '' : ' title="' + cf.truncate_string.replace(/\^0/gi, (sValues.replace(/"/gi, '&quot;')).substring(0,maxStringLength)) + '"' ) +
  1111. '>' +
  1112. ( sValues.length <= 100 ? sValues : getConfigFrame().truncate_string.replace(/\^0/gi, sValues.substring(0,100)) ) +
  1113. '</a></td>' +
  1114. renderStyleControls(this) +
  1115. '</tr>';
  1116. return out;
  1117. };
  1118. function CStyleSV_setClass(c) {
  1119. this.m_className = (c ? c : gsCSSCLASS_DEFAULT);
  1120. };
  1121. function CStyleSV_setId(id) {
  1122. this.m_id = getSafeIdentifier(id);
  1123. };
  1124. function CStyleSV_setMissingValues(b) {
  1125. this.m_missingValues = (b == true || b == "true" || b == "include" ? true : false);
  1126. };
  1127. function CStyleSV_setStyleInfo(str) {
  1128. this.m_styleInfo = str;
  1129. };
  1130. function CStyleSV_update(svList) {
  1131. if (svList != null && svList.length && !(svList[0] instanceof cf.CFilterValue)) {
  1132. for (var i = 0; i < svList.length; i++) {
  1133. if (typeof svList[i] == "object" && svList[i].length >= 2) {
  1134. svList[i] = new cf.CFilterValue(svList[i][0], svList[i][1]);
  1135. }
  1136. else {
  1137. svList[i] = new cf.CFilterValue(svList[i]);
  1138. }
  1139. }
  1140. }
  1141. this.m_selectValueList = svList;
  1142. };
  1143. CStyleSV.prototype.clone = CStyleSV_clone;
  1144. CStyleSV.prototype.getClass = CStyleSV_getClass;
  1145. CStyleSV.prototype.getCommand = CStyleSV_getCommand;
  1146. CStyleSV.prototype.getMissingValues = CStyleSV_getMissingValues;
  1147. CStyleSV.prototype.getStyleInfo = CStyleSV_getStyleInfo;
  1148. CStyleSV.prototype.getId = CStyleSV_getId;
  1149. CStyleSV.prototype.getValues = CStyleSV_getValues;
  1150. CStyleSV.prototype.render = CStyleSV_render;
  1151. CStyleSV.prototype.setClass = CStyleSV_setClass;
  1152. CStyleSV.prototype.setId = CStyleSV_setId;
  1153. CStyleSV.prototype.setMissingValues = CStyleSV_setMissingValues;
  1154. CStyleSV.prototype.setStyleInfo = CStyleSV_setStyleInfo;
  1155. CStyleSV.prototype.update = CStyleSV_update;
  1156. function generateGUID()
  1157. {
  1158. var prefix = "guid-";
  1159. var i = 0;
  1160. while (document.getElementById(prefix + i))
  1161. { i++; }
  1162. return prefix + i;
  1163. };
  1164. function getDaysFromInterval(value) {
  1165. var str = (value != null ? value.toString() : '');
  1166. if ( str != null && str.match(/^\s*(-*\d+) (\d+:\d+:\d+\.\d+)/) ) {
  1167. var d = RegExp.$1;
  1168. var t = RegExp.$2;
  1169. d = parseInt(d,10);
  1170. t = (d < 0 ? -1 : 1) * getDaysFromTime(t);
  1171. return (d + t);
  1172. }
  1173. return value;
  1174. };
  1175. function getDaysFromTime(str) {
  1176. if (str.match(/(\d+):(\d+):(\d+)\.(\d+)/)) {
  1177. var h = parseInt(RegExp.$1, 10);
  1178. var m = parseInt(RegExp.$2, 10);
  1179. var s = parseInt(RegExp.$3, 10);
  1180. var ms = parseInt(RegExp.$4, 10);
  1181. return ( ((h*3600000) + (m*60000) + (s*1000) + ms) / 86400000);
  1182. }
  1183. return null;
  1184. };
  1185. function getSafeIdentifier(str)
  1186. {
  1187. return str.replace(/\W/g, '_');
  1188. };