jsharmony 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AppSrv.Report.js +29 -18
- package/jsHarmony.LoadModels.js +4 -2
- package/package.json +1 -1
package/AppSrv.Report.js
CHANGED
|
@@ -29,7 +29,7 @@ exports.getReport = function (req, res, fullmodelid, Q, P, callback) {
|
|
|
29
29
|
var _this = this;
|
|
30
30
|
if (typeof Q == 'undefined') Q = req.query;
|
|
31
31
|
if (typeof P == 'undefined') P = req.body;
|
|
32
|
-
if (typeof callback == 'undefined') callback = function (err, tmppath, dispose) {
|
|
32
|
+
if (typeof callback == 'undefined') callback = function (err, tmppath, dispose, dbdata) {
|
|
33
33
|
if(err){ Helper.GenError(req, res, -99999, err.toString()); return; }
|
|
34
34
|
|
|
35
35
|
/* Report Done */
|
|
@@ -37,23 +37,34 @@ exports.getReport = function (req, res, fullmodelid, Q, P, callback) {
|
|
|
37
37
|
if (err != null) return dispose();
|
|
38
38
|
var fsize = stat.size;
|
|
39
39
|
var model = _this.jsh.getModel(req, fullmodelid);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
'
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
40
|
+
var filename = fullmodelid + (model.format == 'xlsx' ? '.xlsx' : '.pdf');
|
|
41
|
+
Helper.execif(model.ongetfilename,
|
|
42
|
+
function(done){
|
|
43
|
+
model.ongetfilename(function(rslt){
|
|
44
|
+
if(rslt) filename = rslt.toString();
|
|
45
|
+
return done();
|
|
46
|
+
}, model, Q, P, req, dbdata);
|
|
47
|
+
},
|
|
48
|
+
function(){
|
|
49
|
+
//Send MIME type
|
|
50
|
+
if(model.format=='xlsx'){
|
|
51
|
+
res.writeHead(200, {
|
|
52
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
53
|
+
'Content-Length': fsize,
|
|
54
|
+
'Content-Disposition': 'filename = ' + encodeURIComponent(filename)
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
res.writeHead(200, {
|
|
59
|
+
'Content-Type': 'application/pdf',
|
|
60
|
+
'Content-Length': fsize,
|
|
61
|
+
'Content-Disposition': 'filename = ' + encodeURIComponent(filename)
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
var rs = fs.createReadStream(tmppath);
|
|
65
|
+
rs.pipe(res).on('finish', function () { dispose(); });
|
|
66
|
+
}
|
|
67
|
+
);
|
|
57
68
|
});
|
|
58
69
|
}
|
|
59
70
|
|
package/jsHarmony.LoadModels.js
CHANGED
|
@@ -1752,7 +1752,7 @@ exports.ParseEntities = function () {
|
|
|
1752
1752
|
}
|
|
1753
1753
|
|
|
1754
1754
|
//Convert mutli-line variables to single string
|
|
1755
|
-
ParseMultiLineProperties(model, ['js', 'jslib', 'sqlselect', 'sqldownloadselect', 'sqlinsert', 'sqlinsertencrypt', 'sqlupdate', 'sqldelete', 'sqlexec', 'sqlwhere', 'sqlgetinsertkeys', 'oninit', 'onload', 'onloadimmediate', 'oninsert', 'onvalidate', 'onupdate', 'ondestroy', 'oncommit', 'onchange']);
|
|
1755
|
+
ParseMultiLineProperties(model, ['js', 'jslib', 'sqlselect', 'sqldownloadselect', 'sqlinsert', 'sqlinsertencrypt', 'sqlupdate', 'sqldelete', 'sqlexec', 'sqlwhere', 'sqlgetinsertkeys', 'ongetfilename', 'oninit', 'onload', 'onloadimmediate', 'oninsert', 'onvalidate', 'onupdate', 'ondestroy', 'oncommit', 'onchange']);
|
|
1756
1756
|
if (model.breadcrumbs) ParseMultiLineProperties(model.breadcrumbs, ['sql']);
|
|
1757
1757
|
if (model.fields) _.each(model.fields, function (field) {
|
|
1758
1758
|
ParseMultiLineProperties(field, ['onchange', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlwhere', 'sqlsort', 'sqlsearch', 'sqlsearchsound', 'value']);
|
|
@@ -1908,6 +1908,8 @@ exports.ParseEntities = function () {
|
|
|
1908
1908
|
});
|
|
1909
1909
|
}
|
|
1910
1910
|
_this.validateDisplayLayouts(model);
|
|
1911
|
+
if(model.ongetfilename) model.ongetfilename = _this.createFunction(model.ongetfilename, ['callback', 'xmodel', 'Q', 'P', 'req', 'dbdata'], model.id+' model.ongetfilename');
|
|
1912
|
+
|
|
1911
1913
|
|
|
1912
1914
|
//Validate Model and Field Parameters
|
|
1913
1915
|
var _v_model = [
|
|
@@ -1917,7 +1919,7 @@ exports.ParseEntities = function () {
|
|
|
1917
1919
|
'hide_system_buttons', 'grid_expand_search', 'grid_rowcount', 'reselectafteredit', 'newrowposition', 'commitlevel', 'validationlevel',
|
|
1918
1920
|
'grid_require_search', 'default_search', 'grid_static', 'rowstyle', 'rowclass', 'rowlimit', 'disableautoload',
|
|
1919
1921
|
'oninit', 'oncommit', 'onload', 'oninsert', 'onupdate', 'onvalidate', 'onloadstate', 'ongetstate', 'onrowbind', 'onrowunbind', 'ondestroy', 'onchange', 'getapi', 'onrender', 'onrendered',
|
|
1920
|
-
'js', 'jslib', 'ejs', 'header', 'css', 'dberrors', 'tablestyle', 'tableclass', 'formstyle', 'formclass', 'popup', 'onloadimmediate', 'sqlwhere', 'sqlwhere_disabled_on_insert', 'breadcrumbs', 'tabpos', 'tabs', 'tabpanelstyle',
|
|
1922
|
+
'js', 'jslib', 'ejs', 'header', 'css', 'dberrors', 'tablestyle', 'tableclass', 'formstyle', 'formclass', 'popup', 'ongetfilename', 'onloadimmediate', 'sqlwhere', 'sqlwhere_disabled_on_insert', 'breadcrumbs', 'tabpos', 'tabs', 'tabpanelstyle',
|
|
1921
1923
|
'nokey', 'nodatalock', 'unbound', 'duplicate', 'sqlselect', 'sqlupdate', 'sqlinsert', 'sqlgetinsertkeys', 'sqldelete', 'sqlexec', 'sqlexec_comment', 'sqltype', 'onroute', 'tabcode', 'noresultsmessage', 'bindings',
|
|
1922
1924
|
'path', 'module', 'templates', 'db', 'onecolumn', 'namespace',
|
|
1923
1925
|
//Report Parameters
|