Add Java dependency for charts module to Gradle

Version 2.5.7 of JXL is closest available version (2.4.3)

⚠️ Modules were not tested after upgrade
This commit is contained in:
Tobi Schäfer 2021-04-05 10:46:08 +02:00
parent 2f8160526c
commit aea04da690
4 changed files with 9 additions and 8 deletions

View file

@ -18,12 +18,12 @@
/** /**
* @fileoverview Fields and methods of the helma.Chart prototype * @fileoverview Fields and methods of the helma.Chart prototype
* <br /><br /> * <br /><br />
* To use this optional module, its repository needs to be added to the * To use this optional module, its repository needs to be added to the
* application, for example by calling app.addRepository('modules/helma/Chart.js') * application, for example by calling app.addRepository('modules/helma/Chart.js')
*/ */
// take care of any dependencies // take care of any dependencies
app.addRepository('modules/helma/jxl.jar'); app.addRepository('modules/helma/jxl-2.5.7.jar');
/** /**
* Define the global namespace if not existing * Define the global namespace if not existing
@ -55,12 +55,12 @@ helma.Chart = function(fpath, prefix, sheetName) {
var workbook, file; var workbook, file;
try { try {
file = new java.io.File(fpath); file = new java.io.File(fpath);
workbook = JXLPKG.getWorkbook(file); workbook = JXLPKG.getWorkbook(file);
} catch (e) { } catch (e) {
if (e instanceof TypeError == false) if (e instanceof TypeError == false)
throw(e); throw(e);
throw("helma.Chart needs " + JXLPKGNAME + throw("helma.Chart needs " + JXLPKGNAME +
" in lib/ext or application directory " + " in lib/ext or application directory " +
"[" + JXLPKGURL + "]"); "[" + JXLPKGURL + "]");
} }
@ -98,9 +98,9 @@ helma.Chart = function(fpath, prefix, sheetName) {
* Renders the Excel spreadsheet as XHTML table. * Renders the Excel spreadsheet as XHTML table.
*/ */
this.render = function() { this.render = function() {
res.write('<table border="0" cellspacing="1" class="' + res.write('<table border="0" cellspacing="1" class="' +
prefix + 'table">\n'); prefix + 'table">\n');
var rowBuf = []; var rowBuf = [];
var rows = sheet.getRows(); var rows = sheet.getRows();
var max = 0; var max = 0;
@ -110,7 +110,7 @@ helma.Chart = function(fpath, prefix, sheetName) {
max = row.length; max = row.length;
rowBuf.push(row); rowBuf.push(row);
} }
for (var i in rowBuf) { for (var i in rowBuf) {
res.write('<tr class="' + prefix + 'row">\n'); res.write('<tr class="' + prefix + 'row">\n');
for (var n=0; n<max; n+=1) { for (var n=0; n<max; n+=1) {
@ -145,7 +145,7 @@ helma.Chart = function(fpath, prefix, sheetName) {
} }
res.write('</tr>\n'); res.write('</tr>\n');
} }
res.write('</table>\n'); res.write('</table>\n');
workbook.close(); workbook.close();
}; };

View file

@ -1,5 +1,6 @@
dependencies { dependencies {
runtime 'ch.ethz.ganymed:ganymed-ssh2:build208' runtime 'ch.ethz.ganymed:ganymed-ssh2:build208'
runtime 'net.sourceforge.jexcelapi:jxl:2.5.7'
} }
task deps(type: Copy) { task deps(type: Copy) {

BIN
modules/helma/jxl-2.5.7.jar Normal file

Binary file not shown.

Binary file not shown.