rexpert.js 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. // Rexpert context root url & etc
  2. var targetProtocal=window.location.href.split("://")[0]; // SSL 일경우를 대비
  3. var rex_gsRexServiceRootURL = targetProtocal+"://" + location.host + "/himed/rexpert/";
  4. var rex_gsPreViewURL = rex_gsRexServiceRootURL + "rexpreview.jsp";
  5. var rex_gsRptServiceURL = rex_gsRexServiceRootURL + "rexservice.jsp";
  6. //var rex_gsReportURL = rex_gsRexServiceRootURL + "rebfiles/";
  7. var rex_gsReportURL = "http://" + location.host;
  8. // Export Service URL
  9. var rex_gsRptExportServiceURL = "http://" + location.host + "/himed/rexpert/" + "exportservice.jsp";
  10. // Export URL
  11. var rex_gsRptExportURL = "http://" + location.host + "/himed/rexpert/" + "export.jsp";
  12. // default DBconnection
  13. var rex_gsUserService = "hisdb";
  14. // viewer Version
  15. var rex_viewer_version = "1,0,0,17";
  16. var rex_viewer_install = "EACH"; // EACH, ONCE, NONE
  17. // CSV
  18. var rex_gsCsvSeparatorColumn = "|*|";
  19. var rex_gsCsvSeparatorRow = "^#^";
  20. var rex_gsCsvEncoding = "utf-8";
  21. // XML
  22. var rex_gsXPath = "gubun/rpt1/rexdataset/rexrow";
  23. // 2013.02.13 장재현 - Rexpert Size 조절 옵션화로 인해 ZUM006.JS 파일에서 선언함.
  24. // Rexpert Web Viewer Windows Size
  25. // var rex_gsPreViewFeatures = "center=yes,scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,width=855,height=800";
  26. var rex_gsPreViewFeaturesModal = "center:yes;resizable:no;scroll:no;status:no;dialogWidth:855px;dialogHeight:800px";
  27. // Language information
  28. var rex_gsViewerLanguage = "ko";
  29. // RexServer 2.5 compatible
  30. var rex_gsServerVersion = "3.0" // 2.5, 3.0
  31. var rex_gsRptServiceURL_RexServer25 = "http://" + location.host + "/report/" + "RexService.jsp";
  32. var rex_gsCsvSeparatorColumn_RexServer25 = "|*|";
  33. var rex_gsCsvSeparatorRow_RexServer25 = "^#^";
  34. var rex_gsCsvEncoding_RexServer25 = "EUC-KR";
  35. var rex_gsXPath_RexServer25 = "root/main/rpt1/rexdataset/rexrow";
  36. var rex_Agent = function () {
  37. var a = navigator.userAgent;
  38. function is(s,t) {
  39. return ((s||"").indexOf(t)>-1);
  40. }
  41. this.isWin = is(a,"Windows");
  42. this.isMac = is(a,"Macintosh");
  43. this.isUnix = !(this.isWin || this.isMac);
  44. this.isVista = is(a.toLowerCase(), "nt 6");
  45. this.isWinXp = is(a.toLowerCase(), "nt 5.1");
  46. this.isW2k = is(a.toLowerCase(), "nt 5.0");
  47. this.isW98 = is(a.toLowerCase(), "windows 98");
  48. this.isOP = is(a.toLowerCase(),"opera");
  49. this.isIE = is(a.toLowerCase(),"msie");
  50. this.isFF = is(a.toLowerCase(),"firefox");
  51. this.isCR = is(a.toLowerCase(),"chrome");
  52. this.isSF = is(a.toLowerCase(),"safari");
  53. if (this.isIE) {
  54. var v = parseFloat(a.match(/MSIE ([0-9\.]+)/)[1]);
  55. if (isNaN(v)) this.isIE0 = true;
  56. if (6 <= v && v < 7) {
  57. this.isIE6 = true;
  58. return;
  59. } else if (7 <= v && v < 8) {
  60. this.isIE7 = true;
  61. return;
  62. } else if (5.5 <= v && v < 6) {
  63. this.isIE55 = true;
  64. return;
  65. } else if (v < 5.5) {
  66. this.isIE5 = true;
  67. this.isIE = false;
  68. return;
  69. } else if (8 <= v) {
  70. this.isIE8 = true;
  71. return;
  72. }
  73. }
  74. }
  75. function rex_writeRexCtl(sID) {
  76. var sWidth = "100%";
  77. var sHeight = "100%";
  78. if (arguments.length > 1) sWidth = arguments[1];
  79. if (arguments.length > 2) sHeight = arguments[2];
  80. document.write(rex_getRexCtl(sID, sWidth, sHeight));
  81. }
  82. function rex_getRexCtl() {
  83. var oAgent = new rex_Agent();
  84. var sCtl = "";
  85. var sID = "RexCtl";
  86. var sWidth = "100%";
  87. var sHeight = "100%";
  88. if (arguments.length > 0) sID = arguments[0];
  89. if (arguments.length > 1) sWidth = arguments[1];
  90. if (arguments.length > 2) sHeight = arguments[2];
  91. if (oAgent.isWin) {
  92. if (oAgent.isIE) {
  93. //var sCodeBase = "CODEBASE='" + rex_gsRexServiceRootURL + "/cab/Rexpert30Viewer.cab#version=" + rex_viewer_version + "'";
  94. if (rex_viewer_install.toUpperCase() == "NONE") sCodeBase = "";
  95. sCtl += "<object id='" + sID + "' classid='CLSID:FC035099-833E-4AB1-BF48-37D08F5E553C' " + " width='" + sWidth + "' height='" + sHeight + "'>";
  96. sCtl += "</object>";
  97. } else {
  98. sCtl += "<object id='" + sID + "' type='application/rexpert3.0.plugin,version=1.0.0.1' " +
  99. " codebase='" + rex_gsRexServiceRootURL + "/cab/rexpert30viewer.exe' " +
  100. " pluginspage='" + rex_gsRexServiceRootURL + "/cab/download/setup.html'" + " width='" + sWidth + "' height='" + sHeight + "'/>";
  101. }
  102. } else {
  103. sCtl += "<iframe id='rex_ifrmRexPreview' src='" + rex_gsRexServiceRootURL + "/cab/download/export.html' width='" + sWidth + "' height='" + sHeight + "'></iframe>";
  104. }
  105. return sCtl;
  106. }
  107. //********************************************************
  108. //LocationHost() class declaration
  109. //********************************************************
  110. function rex_fnLocationHost()
  111. {
  112. var str = "" + document.location;
  113. var header = "http://";
  114. var header_length = header.length;
  115. var pos = str.indexOf( "/" , header_length );
  116. var str_server = str.substring( 0, pos );
  117. return str_server;
  118. }
  119. //********************************************************
  120. //param class declaration
  121. //********************************************************
  122. var rex_goParamSet = {};
  123. var rex_iframeindex = 0;
  124. var rex_iframeid = new Array();
  125. var rex_iframedata = new Array();
  126. function GetfnParamSet() {
  127. if (arguments.length > 0) {
  128. rex_goParamSet[arguments[0]] = new rex_fnParamSet(arguments[0]);
  129. rex_goParamSet[arguments[0]].datatype = "CSV";
  130. return rex_goParamSet[arguments[0]];
  131. }
  132. else {
  133. rex_goParamSet["0"] = new rex_fnParamSet("0");
  134. return rex_goParamSet["0"];
  135. }
  136. }
  137. function rex_fnParamSet(id) {
  138. this.id = id;
  139. this.type; //http, file, memo, ado(not used)
  140. this.opentype;
  141. this.rptname;
  142. this.exportrptname = null;
  143. this.exportfiletype = "pdf";
  144. this.datatype;
  145. this.title; // added by kimhd.
  146. this.rptnames; // added by kimhd. it stores array of rptname;
  147. this.callback; // added by kimhd. it invoked after printing.
  148. this.rebfiles = {};
  149. this.subreports = {};
  150. this.params = {};
  151. this.httpparams = {};
  152. this.datasets = {};
  153. this.printoption;
  154. this.event = {};
  155. rex_fnParamSet.prototype.reb = function(id) {
  156. if (this.rebfiles[id] == undefined) {
  157. this.rebfiles[id] = new rex_RebFile(id);
  158. }
  159. return this.rebfiles[id];
  160. }
  161. rex_fnParamSet.prototype.param = function(id) {
  162. if (this.params[id] == undefined) {
  163. this.params[id] = {};
  164. }
  165. return this.params[id];
  166. }
  167. rex_fnParamSet.prototype.httpparam = function(id) {
  168. if (this.httpparams[id] == undefined) {
  169. this.httpparams[id] = {};
  170. }
  171. return this.httpparams[id];
  172. }
  173. rex_fnParamSet.prototype.sub = function(id) {
  174. if (this.subreports[id] == undefined) {
  175. this.subreports[id] = new rex_RebSubReport(id);
  176. }
  177. return this.subreports[id];
  178. }
  179. rex_fnParamSet.prototype.dataset = function(id) {
  180. if (this.datasets[id] == undefined) {
  181. this.datasets[id] = {};
  182. }
  183. return this.datasets[id];
  184. }
  185. rex_fnParamSet.prototype.toString = function() {
  186. var sb = "";
  187. var con = new rex_RebConnction();
  188. var oParam = {};
  189. var rebfile = new rex_RebFile();
  190. sb += "<?xml version='1.0' encoding='utf-8'?>";
  191. sb += "<oof version ='3.0'>";
  192. //sb += "<document title='A' enable-thread='0'>";
  193. sb += "<document enable-thread='1'>";
  194. //sb += "<document>";
  195. if (this.type == undefined) this.type = "http";
  196. sb += "<file-list>";
  197. if(this.rptname != undefined)
  198. {
  199. sb += rebfile.toStringFile(this.rptname, "", "") + "";
  200. this.exportrptname = this.rptname.substr(this.rptname.lastIndexOf("/") + 1);
  201. }
  202. var sConnMain = "";
  203. var sConnSub = "";
  204. var sConn = "";
  205. for(var nkey in this.rebfiles)
  206. {
  207. if (this.rebfiles[nkey].connectname != undefined) {
  208. oParam["type"] = this.rebfiles[nkey].type;
  209. oParam["namespace"] = this.rebfiles[nkey].namespace;
  210. oParam["path"] = this.rebfiles[nkey].path;
  211. oParam["data"] = this.rebfiles[nkey].data;
  212. oParam["connectname"] = this.rebfiles[nkey].connectname;
  213. oParam["datatype"] = this.rebfiles[nkey].datatype;
  214. oParam["xpath"] = this.rebfiles[nkey].xpath;
  215. oParam["encoding"] = this.rebfiles[nkey].encoding;
  216. con = new rex_RebConnction();
  217. sConn += con.toString(oParam, this.rebfiles[nkey].httpparams, this.rebfiles[nkey].datasets);
  218. }
  219. for(var key in this.rebfiles[nkey].subreports)
  220. {
  221. if(key != undefined)
  222. {
  223. if(this.rebfiles[nkey].sub(key).namespace == undefined )
  224. {
  225. oParam["namespace"] = key;
  226. } else {
  227. oParam["namespace"] = this.rebfiles[nkey].sub(key).namespace;
  228. }
  229. oParam["type"] = this.rebfiles[nkey].sub(key).type;
  230. oParam["path"] = this.rebfiles[nkey].sub(key).path;
  231. oParam["data"] = this.rebfiles[nkey].sub(key).data;
  232. oParam["connectname"] = this.rebfiles[nkey].sub(key).connectname;
  233. oParam["datatype"] = this.rebfiles[nkey].sub(key).datatype;
  234. oParam["xpath"] = this.rebfiles[nkey].sub(key).xpath;
  235. oParam["encoding"] = this.rebfiles[nkey].sub(key).encoding;
  236. con = new rex_RebConnction();
  237. sConn += con.toString(oParam, this.rebfiles[nkey].sub(key).httpparams, this.rebfiles[nkey].sub(key).datasets);
  238. }
  239. }
  240. if (sConn != "") {
  241. sConn = "<connection-list>" + sConn + "</connection-list>";
  242. }
  243. //alert(this.rebfiles[nkey].subreports["ADO2"]);
  244. if(this.rebfiles[nkey].rptname != undefined)
  245. {
  246. rebfile = new rex_RebFile();
  247. sb += rebfile.toStringFile(this.rebfiles[nkey].rptname, rebfile.toStringField(this.rebfiles[nkey].params), sConn) + "";
  248. if (this.exportrptname == null) {
  249. this.exportrptname = this.rebfiles[nkey].rptname.substr(this.rebfiles[nkey].rptname.lastIndexOf("/") + 1);
  250. }
  251. }
  252. } // end for
  253. sb += "</file-list>";
  254. sConnMain += "<connection-list>";
  255. for(var nkey in this.subreports)
  256. {
  257. if(this.subreports[nkey].namespace == undefined )
  258. {
  259. oParam["namespace"] = nkey;
  260. } else {
  261. oParam["namespace"] = this.subreports[nkey].namespace;
  262. }
  263. oParam["type"] = this.subreports[nkey].type;
  264. oParam["path"] = this.subreports[nkey].path;
  265. oParam["data"] = this.subreports[nkey].data;
  266. oParam["connectname"] = this.subreports[nkey].connectname;
  267. oParam["datatype"] = this.subreports[nkey].datatype;
  268. oParam["xpath"] = this.subreports[nkey].xpath;
  269. oParam["encoding"] = this.subreports[nkey].encoding;
  270. con = new rex_RebConnction();
  271. sConnSub += con.toString(oParam, this.subreports[nkey].httpparams, this.subreports[nkey].datasets);
  272. }
  273. if (sConnSub == "") {
  274. oParam["type"] = this.type; // http, file, memo
  275. oParam["namespace"] = this.namespace;
  276. oParam["path"] = this.path;
  277. oParam["data"] = this.data;
  278. oParam["connectname"] = this.connectname;
  279. oParam["datatype"] = this.datatype;
  280. oParam["xpath"] = this.xpath;
  281. oParam["encoding"] = this.encoding;
  282. sConnMain += con.toString(oParam, this.httpparams, this.datasets);
  283. } else {
  284. sConnMain += sConnSub;
  285. }
  286. sConnMain += "</connection-list>";
  287. if (sConn == "") {
  288. sb += sConnMain;
  289. }
  290. sb += rebfile.toStringField(this.params);
  291. sb += "</document>";
  292. sb += "</oof>";
  293. return sb;
  294. }
  295. } // end of rex_fnParamSet
  296. function rex_RebFile() {
  297. this.id = arguments[0];
  298. this.subreports = {};
  299. this.params = {};
  300. this.httpparams = {};
  301. rex_RebFile.prototype.sub = function(id) {
  302. if (this.subreports[id] == undefined) {
  303. this.subreports[id] = new rex_RebSubReport(id);
  304. }
  305. return this.subreports[id];
  306. }
  307. rex_RebFile.prototype.param = function(id) {
  308. if (this.params[id] == undefined) {
  309. this.params[id] = {};
  310. }
  311. return this.params[id];
  312. }
  313. rex_RebFile.prototype.httpparam = function(id) {
  314. if (this.httpparams[id] == undefined) {
  315. this.httpparams[id] = {};
  316. }
  317. return this.httpparams[id];
  318. }
  319. rex_RebFile.prototype.toStringFile = function(rptname, param, connect) {
  320. var sb = "";
  321. if (rptname.length > 7) {
  322. if (rptname.substring( 0, 7 ) != "http://" && rptname.substring( 0, 8 ) != "https://") {
  323. rptname = rex_gsReportURL + rptname;
  324. }
  325. } else {
  326. rptname = rex_gsReportURL + rptname;
  327. }
  328. //sb += "<file type='reb' path='" + rptname + ".reb'>";
  329. sb += "<file type='reb' path='" + rptname+"'>"; // modified by kimhd
  330. sb += param;
  331. sb += connect;
  332. sb += "</file>";
  333. return sb;
  334. }
  335. rex_RebFile.prototype.toStringField = function(param) {
  336. var sb = "";
  337. sb += "<field-list>";
  338. for ( var key in param) {
  339. sb += "<field name='" + key + "'><![CDATA[" + param[key].value + "]]></field>";
  340. }
  341. sb += "</field-list>";
  342. return sb;
  343. }
  344. } // end of rex_RebFile
  345. function rex_RebSubReport() {
  346. this.id = arguments[0];
  347. this.params = {};
  348. this.httpparams = {};
  349. this.datasets = {}
  350. rex_RebSubReport.prototype.param = function(id) {
  351. if (this.params[id] == undefined) {
  352. this.params[id] = {};
  353. }
  354. return this.params[id];
  355. }
  356. rex_RebSubReport.prototype.httpparam = function(id) {
  357. if (this.httpparams[id] == undefined) {
  358. this.httpparams[id] = {};
  359. }
  360. return this.httpparams[id];
  361. }
  362. rex_RebSubReport.prototype.dataset = function(id) {
  363. if (this.datasets[id] == undefined) {
  364. this.datasets[id] = {};
  365. }
  366. return this.datasets[id];
  367. }
  368. } // end of rex_RebSubReport
  369. function rex_RebConnction() {
  370. rex_RebConnction.prototype.toString = function(oParam, oHttpParams, oDataSets) {
  371. var sb = "";
  372. var type = oParam["type"];
  373. var namespace = oParam["namespace"];
  374. var path = oParam["path"];
  375. var isExistPath = false;
  376. var data = oParam["data"];
  377. var connectname = oParam["connectname"];
  378. var datatype = oParam["datatype"];
  379. var encoding = oParam["encoding"];
  380. var xpath = oParam["xpath"];
  381. if (type == undefined) type = "http";
  382. if (namespace == undefined) namespace = "*";
  383. if (path == undefined) {
  384. isExistPath = false;
  385. if (rex_gsServerVersion == "2.5") {
  386. path = rex_gsRptServiceURL_RexServer25;
  387. } else {
  388. path = rex_gsRptServiceURL;
  389. }
  390. } else {
  391. isExistPath = true;
  392. }
  393. if (data == undefined) data = "";
  394. if (connectname == undefined) {
  395. if (rex_gsServerVersion == "2.5") {
  396. connectname = "";
  397. } else {
  398. connectname = rex_gsUserService;
  399. }
  400. }
  401. if (datatype == undefined) datatype = "CSV";
  402. if (encoding == undefined) {
  403. if (rex_gsServerVersion == "2.5") {
  404. encoding = rex_gsCsvEncoding_RexServer25;
  405. } else {
  406. encoding = rex_gsCsvEncoding;
  407. }
  408. }
  409. if (xpath == undefined) {
  410. if (rex_gsServerVersion == "2.5") {
  411. xpath = rex_gsXPath_RexServer25;
  412. } else {
  413. if (type == "http") {
  414. if (!isExistPath) xpath = rex_gsXPath;
  415. } else {
  416. xpath = "{%dataset.xml.root%}";
  417. }
  418. }
  419. }
  420. sb += "<connection type='" + type + "' namespace='" + namespace + "'>";
  421. var sHttpParams = "";
  422. if(oHttpParams != undefined )
  423. {
  424. for(var key in oHttpParams)
  425. {
  426. if (typeof(oHttpParams[key].value) == "object") {
  427. for(var i = 0; i < oHttpParams[key].value.length; i++) {
  428. sHttpParams += "<http-param name='" + key + "'><![CDATA[" + oHttpParams[key].value[i] + "]]></http-param>";
  429. }
  430. } else {
  431. sHttpParams += "<http-param name='" + key + "'><![CDATA[" + oHttpParams[key].value + "]]></http-param>";
  432. //sHttpParams += "<http-param name='" + key + "'>" + oHttpParams[key].value + "</http-param>";
  433. }
  434. }
  435. }
  436. if (type == "http") {
  437. if (sHttpParams != "") {
  438. sHttpParams = "<http-param-list>" + sHttpParams + "</http-param-list>";
  439. } else if (isExistPath == false) {
  440. if (rex_gsServerVersion == "2.5") {
  441. sHttpParams += "<http-param-list>";
  442. sHttpParams += "<http-param name='designtype'>run</http-param>";
  443. sHttpParams += "<http-param name='datatype'>" + datatype.toUpperCase() + "</http-param>";
  444. sHttpParams += "<http-param name='sql'>{%auto%}</http-param>";
  445. sHttpParams += "<http-param name='split'></http-param>";
  446. sHttpParams += "<http-param name='userservice'>" + connectname + "</http-param>";
  447. sHttpParams += "<http-param name='image'></http-param>";
  448. sHttpParams += "<http-param name='rex_param_sql'></http-param>";
  449. sHttpParams += "</http-param-list>";
  450. } else {
  451. sHttpParams += "<http-param-list>";
  452. sHttpParams += "<http-param name='Q1SQL'>{%auto%}</http-param>";
  453. sHttpParams += "<http-param name='OE'>None</http-param>";
  454. sHttpParams += "<http-param name='CN'>" + connectname + "</http-param>";
  455. sHttpParams += "<http-param name='ID'>SD" + datatype.toUpperCase() + "</http-param>";
  456. sHttpParams += "<http-param name='PE'>FALSE</http-param>";
  457. sHttpParams += "<http-param name='QC'>1</http-param>";
  458. sHttpParams += "<http-param name='OT'>DataOnly</http-param>";
  459. sHttpParams += "<http-param name='Q1Type'>SQL</http-param>";
  460. sHttpParams += "</http-param-list>";
  461. }
  462. }
  463. sb += "<config-param-list>";
  464. sb += "<config-param name='path'>" + path + "</config-param>";
  465. sb += "</config-param-list>";
  466. sb += sHttpParams;
  467. } else if (type == "file") {
  468. sb += "<config-param-list>";
  469. sb += "<config-param name='path'>" + path + "</config-param>";
  470. sb += "</config-param-list>";
  471. if (sHttpParams != "") {
  472. sb += sHttpParams;
  473. }
  474. } else if (type == "memo") {
  475. sb += "<config-param-list>";
  476. if (datatype.toUpperCase() == "CSV") {
  477. sb += "<config-param name='data'><![CDATA[" + data + "]]></config-param>";
  478. } else {
  479. sb += "<config-param name='data'>" + data + "</config-param>";
  480. }
  481. sb += "</config-param-list>";
  482. }
  483. if (datatype.toUpperCase() == "CSV") {
  484. if (rex_gsServerVersion == "2.5") {
  485. sb += "<content content-type='csv'>";
  486. if (type == "memo") {
  487. sb += "<content-param name='col-delim'>" + rex_gsCsvSeparatorColumn + "</content-param>";
  488. sb += "<content-param name='row-delim'>" + rex_gsCsvSeparatorRow + "</content-param>";
  489. encoding = "utf16le";
  490. } else {
  491. sb += "<content-param name='col-delim'>" + rex_gsCsvSeparatorColumn_RexServer25 + "</content-param>";
  492. sb += "<content-param name='row-delim'>" + rex_gsCsvSeparatorRow_RexServer25 + "</content-param>";
  493. }
  494. sb += "<content-param name='encoding'>" + encoding + "</content-param>";
  495. sb += "</content>";
  496. } else {
  497. sb += "<content content-type='csv'>";
  498. sb += "<content-param name='col-delim'>" + rex_gsCsvSeparatorColumn + "</content-param>";
  499. sb += "<content-param name='row-delim'>" + rex_gsCsvSeparatorRow + "</content-param>";
  500. if (type == "memo") encoding = "utf16le";
  501. sb += "<content-param name='encoding'>" + encoding + "</content-param>";
  502. sb += "</content>";
  503. }
  504. } else {
  505. var sDataSets = "";
  506. if(oDataSets != undefined )
  507. {
  508. for(var key in oDataSets)
  509. {
  510. sDataSets += "<content content-type='xml' namespace='" + key + "'>";
  511. sDataSets += "<content-param name='root'>" + oDataSets[key].xpath + "</content-param>";
  512. sDataSets += "<content-param name='preservedwhitespace'>1</content-param>";
  513. sDataSets += "<content-param name='bindmode'>name</content-param>";
  514. sDataSets += "</content>";
  515. }
  516. }
  517. if (sDataSets == "") {
  518. sDataSets += "<content content-type='xml'>";
  519. sDataSets += "<content-param name='root'>" + xpath + "</content-param>";
  520. sDataSets += "<content-param name='preservedwhitespace'>1</content-param>";
  521. sDataSets += "<content-param name='bindmode'>name</content-param>";
  522. sDataSets += "</content>";
  523. }
  524. sb += sDataSets;
  525. }
  526. sb += "</connection>";
  527. return sb;
  528. }
  529. } // end of rex_RebConnction
  530. rex_fnParamSet.prototype.open = function(iveiwerObj) {
  531. this.opentype = "open";
  532. //var oAgent = new rex_Agent();
  533. if (iveiwerObj != null)
  534. {
  535. iveiwerObj.window.javascript.loadReport(rex_gsPreViewURL + "?id=" + this.id);
  536. }
  537. else
  538. {
  539. window.open(rex_gsPreViewURL + "?id=" + this.id, "", rex_gsPreViewFeatures);
  540. }
  541. //if (oAgent.isWin) {
  542. //} else {
  543. // Mac, Unix(Linux)
  544. // alert("Mac or Linux : PDF");
  545. //}
  546. }
  547. rex_fnParamSet.prototype.iframe = function(oIframe) {
  548. this.opentype = "iframe";
  549. var oAgent = new rex_Agent();
  550. if (oAgent.isIE) {
  551. if (typeof(oIframe) == "object") {
  552. oIframe.location.href = rex_gsPreViewURL + "?id=" + this.id;
  553. } else {
  554. document.getElementById(oIframe).src = rex_gsPreViewURL + "?id=" + this.id;
  555. }
  556. } else {
  557. if (typeof(oIframe) == "object") {
  558. document.getElementById(oIframe.name).contentWindow.location.href = rex_gsPreViewURL + "?id=" + this.id;
  559. } else {
  560. document.getElementById(oIframe).contentWindow.location.href = rex_gsPreViewURL + "?id=" + this.id;
  561. }
  562. }
  563. }
  564. rex_fnParamSet.prototype.embed = function(sRexCtl) {
  565. this.opentype = "embed";
  566. var oAgent = new rex_Agent();
  567. var oOOF;
  568. var oRexCtl;
  569. oRexCtl = document.getElementById(sRexCtl);
  570. oOOF = rex_goParamSet[this.id];
  571. if (oAgent.isWin) {
  572. var printoption = oOOF.printoption;
  573. var exportoption = oOOF.exportoption;
  574. var toolbarbuttonoption = oOOF.toolbarbuttonoption;
  575. if(printoption != null) {
  576. rex_fnPrintSetting(oRexCtl,printoption);
  577. }
  578. if(exportoption != null) {
  579. rex_fnExportVisible(oRexCtl, exportoption);
  580. }
  581. if(toolbarbuttonoption != null) {
  582. rex_fnToolBarButtonEnableTrue(oRexCtl,toolbarbuttonoption);
  583. }
  584. try {
  585. var sVer = oRexCtl.GetVersion();
  586. } catch(ex) {
  587. // activex not install !!
  588. return;
  589. }
  590. if (oOOF.event.init != undefined) {
  591. oOOF.event.init(oRexCtl, "init", null);
  592. }
  593. oRexCtl.CloseAll();
  594. oRexCtl.OpenOOF(oOOF.toString());
  595. } else {
  596. // Mac, Linux, Others
  597. document.getElementById("rex_ifrmRexPreview").contentWindow.location.href = rex_gsPreViewURL + "?id=" + this.id;
  598. }
  599. }
  600. rex_fnParamSet.prototype.iframepush = function(id,param) {
  601. var iframparam;
  602. rex_iframeid.push(id);
  603. if(rex_iframeid.length>0 )
  604. {
  605. iframparam = rex_goParamSet[rex_iframeindex];
  606. //alert(" rex_goParamSet["+rex_iframeindex+"]"+ rex_goParamSet[rex_iframeindex]);
  607. rex_fnParamSet.prototype.iframe(rex_iframeid[rex_iframeindex],rex_goParamSet[rex_iframeindex]);
  608. }
  609. rex_iframeindex++;
  610. }
  611. rex_fnParamSet.prototype.iframeall = function() {
  612. //alert("aaaa");
  613. var param1 = rex_goParamSet["1"];
  614. //alert("1111" + param1);
  615. rex_fnParamSet.prototype.iframe("ifrmRexview",param1);
  616. }
  617. rex_fnParamSet.prototype.popupmodal = function() {
  618. //alert(this);
  619. //goOOF = this;
  620. window.showModalDialog(rex_gsPreViewURL,window,"center:yes;resizable:no;scroll:no;status:no;dialogWidth:825px;dialogHeight:600px");
  621. }
  622. rex_fnParamSet.prototype.print = function() {
  623. this.opentype = "print";
  624. this.print = {};
  625. this.print.dialog = arguments[0];
  626. this.print.startpage = arguments[1];
  627. this.print.endpage = arguments[2];
  628. this.print.copycount = arguments[3];
  629. this.print.Option = arguments[4];
  630. var oAgent = new rex_Agent();
  631. if (oAgent.isIE) {
  632. if (document.getElementById("rex_ifrmRexPreview") == null) {
  633. var sHTML = "<iframe id='rex_ifrmRexPreview' src='" + rex_gsPreViewURL + "?id=" + this.id + "' width='5' height='5'></iframe>";
  634. //document.body.innerHTML += sHTML;
  635. document.body.insertAdjacentHTML("beforeEnd", sHTML);
  636. } else {
  637. document.getElementById("rex_ifrmRexPreview").src = rex_gsPreViewURL + "?id=" + this.id;
  638. }
  639. } else {
  640. if (document.getElementById("rex_ifrmRexPreview") == null) {
  641. var sHTML = "<iframe id='rex_ifrmRexPreview' src='" + rex_gsPreViewURL + "?id=" + this.id + "' width='0' height='0'></iframe>";
  642. //document.body.insertAdjacentHTML("beforeEnd", sHTML);
  643. document.body.innerHTML += sHTML;
  644. //document.body.appendChild( document.createTextNode(sHTML) );
  645. //document.getElementById("rex_ifrmRexPreview").contentWindow.location.href = rex_gsPreViewURL + "?id=" + this.id;
  646. } else {
  647. document.getElementById("rex_ifrmRexPreview").contentWindow.location.href = rex_gsPreViewURL + "?id=" + this.id;
  648. }
  649. }
  650. }
  651. rex_fnParamSet.prototype.save = function() {
  652. this.opentype = "save";
  653. this.save = {};
  654. this.save.dialog = arguments[0];
  655. this.save.filetype = arguments[1];
  656. this.save.fileName = arguments[2];
  657. this.save.startpage = arguments[3];
  658. this.save.endpage = arguments[4];
  659. this.save.Option = arguments[5];
  660. var oAgent = new rex_Agent();
  661. if (oAgent.isIE) {
  662. if (document.getElementById("rex_ifrmRexPreview") == null) {
  663. var sHTML = "<iframe id='rex_ifrmRexPreview' src='" + rex_gsPreViewURL + "?id=" + this.id + "' width='0' height='0'></iframe>";
  664. document.body.insertAdjacentHTML("beforeEnd", sHTML);
  665. } else {
  666. document.getElementById("rex_ifrmRexPreview").src = rex_gsPreViewURL + "?id=" + this.id;
  667. }
  668. } else {
  669. window.open(rex_gsPreViewURL + "?id=" + this.id, "", "center=yes,scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no, left=1000, top=1000, width=10,height=10");
  670. }
  671. }
  672. rex_fnParamSet.prototype.exportserver = function() {
  673. this.opentype = "export";
  674. this.exportserver = {};
  675. this.exportserver.filename = arguments[0];
  676. this.exportserver.filetype = arguments[1];
  677. var oAgent = new rex_Agent();
  678. if (oAgent.isIE) {
  679. if (document.getElementById("rex_ifrmRexPreview") == null) {
  680. var sHTML = "<iframe id='rex_ifrmRexPreview' src='" + rex_gsPreViewURL + "?id=" + this.id + "' width='0' height='0'></iframe>";
  681. document.body.insertAdjacentHTML("beforeEnd", sHTML);
  682. } else {
  683. document.getElementById("rex_ifrmRexPreview").src = rex_gsPreViewURL + "?id=" + this.id;
  684. }
  685. } else {
  686. window.open(rex_gsPreViewURL + "?id=" + this.id, "", "center=yes,scrollbars=no,status=no,toolbar=no,resizable=0,location=no,menu=no, left=1000, top=1000, width=10,height=10");
  687. }
  688. }
  689. //********************************************************
  690. //fnPrintSetting class declaration
  691. //********************************************************
  692. function rex_fnPrintSetting(oRexCtl,printoption)
  693. {
  694. if (printoption.indexOf("paperorientation=") >= 0) {
  695. // change paper orientation, so we set to ignore report setting.
  696. oRexCtl.SetCSS("print.papersetting=1");
  697. }
  698. if (printoption.indexOf("frompage=") >= 0 || printoption.indexOf("topage") >= 0) {
  699. // set to print range.
  700. oRexCtl.SetCSS("print.printrange=1");
  701. }
  702. var arrprint = [];
  703. var strprint = printoption.split(";");
  704. for(var i =0; i< strprint.length; i++)
  705. {
  706. arrprint[i] = strprint[i];
  707. }
  708. for(var i =0 ; i < arrprint.length; i++)
  709. {
  710. oRexCtl.SetCSS("print."+arrprint[i]);
  711. }
  712. oRexCtl.UpdateCSS();
  713. }
  714. //********************************************************
  715. //fnExportVisible class declaration
  716. //********************************************************
  717. function rex_fnExportVisible(oRexCtl, exportoption)
  718. {
  719. var sb = "";
  720. var strexport = exportoption.split(";");
  721. var arrexport =[] ;
  722. for(var i =0; i< strexport.length; i++)
  723. {
  724. arrexport[i] = strexport[i];
  725. }
  726. for(var i =0 ; i < arrexport.length; i++)
  727. {
  728. var lastexport = arrexport[i].split("=");
  729. //sb += "RexCtl.SetCSS(\"export.appearance."+lastexport[0]+".visible="+lastexport[1]+"\");");
  730. oRexCtl.SetCSS("export.appearance."+lastexport[0]+".visible="+lastexport[1]);
  731. }
  732. //sb += "RexCtl.UpdateCSS();");
  733. oRexCtl.UpdateCSS();
  734. //return sb;
  735. }
  736. function rex_fnToolBarButtonVisible(oRexCtl,toolbarbuttonoption) {
  737. if (toolbarbuttonoption.indexOf("open=1") < 0) {
  738. oRexCtl.SetCSS("appearance.toolbar.button.open.visible=0");
  739. }
  740. if (toolbarbuttonoption.indexOf("save=1") < 0) {
  741. oRexCtl.SetCSS("appearance.toolbar.button.export.visible=0");
  742. }
  743. if (toolbarbuttonoption.indexOf("print=0") >= 0) {
  744. oRexCtl.SetCSS("appearance.toolbar.button.print.visible=0");
  745. }
  746. if (toolbarbuttonoption.indexOf("refresh=0") >= 0) {
  747. oRexCtl.SetCSS("appearance.toolbar.button.refresh.visible=0");
  748. }
  749. if (toolbarbuttonoption.indexOf("zoom=0") >= 0) {
  750. oRexCtl.SetCSS("appearance.toolbar.button.zoom.visible=0");
  751. }
  752. if (toolbarbuttonoption.indexOf("excel=0") >= 0) {
  753. oRexCtl.SetCSS("appearance.toolbar.button.exportxls.visible=0");
  754. }
  755. if (toolbarbuttonoption.indexOf("pdf=0") >= 0) {
  756. oRexCtl.SetCSS("appearance.toolbar.button.exportpdf.visible=0");
  757. }
  758. if (toolbarbuttonoption.indexOf("hwp=0") >= 0) {
  759. oRexCtl.SetCSS("appearance.toolbar.button.exporthwp.visible=0");
  760. }
  761. if (toolbarbuttonoption.indexOf("moveprev=0") >= 0) {
  762. oRexCtl.SetCSS("appearance.toolbar.button.moveprev.visible=0");
  763. }
  764. if (toolbarbuttonoption.indexOf("movenext=0") >= 0) {
  765. oRexCtl.SetCSS("appearance.toolbar.button.movenext.visible=0");
  766. }
  767. if (toolbarbuttonoption.indexOf("page=0") >= 0) {
  768. oRexCtl.SetCSS("appearance.toolbar.button.pagenumber.visible=0");
  769. oRexCtl.SetCSS("appearance.toolbar.button.pagecount.visible=0");
  770. }
  771. if (toolbarbuttonoption.indexOf("movefirst=0") >= 0) {
  772. oRexCtl.SetCSS("appearance.toolbar.button.movefirst.visible=0");
  773. }
  774. if (toolbarbuttonoption.indexOf("movelast=0") >= 0) {
  775. oRexCtl.SetCSS("appearance.toolbar.button.movelast.visible=0");
  776. }
  777. if (toolbarbuttonoption.indexOf("about=0") >= 0) {
  778. oRexCtl.SetCSS("appearance.toolbar.button.about.visible=0");
  779. }
  780. if (toolbarbuttonoption.indexOf("toolbar=0") >= 0) {
  781. oRexCtl.SetCSS("appearance.toolbar.visible=0");
  782. }
  783. if (toolbarbuttonoption.indexOf("statusbar=0") >= 0) {
  784. oRexCtl.SetCSS("appearance.statusbar.visible=0");
  785. }
  786. if (toolbarbuttonoption.indexOf("tab=1") < 0) {
  787. oRexCtl.SetCSS("appearance.tabheader.visible=0");
  788. }
  789. oRexCtl.UpdateCSS();
  790. }
  791. function rex_fnToolBarButtonEnableTrue(oRexCtl,toolbarbuttonoption)
  792. {
  793. var sb = "";
  794. oRexCtl.SetCSS("appearance.toolbar.button."+toolbarbuttonoption);
  795. oRexCtl.UpdateCSS();
  796. }