jsharmony 1.7.0 → 1.7.1

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 CHANGED
@@ -24,7 +24,9 @@ var fs = require('fs');
24
24
 
25
25
  module.exports = exports = {};
26
26
 
27
- exports.getReport = function (req, res, fullmodelid, Q, P, callback) {
27
+ exports.getReport = function (req, res, fullmodelid, options, Q, P, callback) {
28
+ options = _.extend({ download: false }, options);
29
+
28
30
  if (!this.jsh.hasModel(req, fullmodelid)) throw new Error("Error: Report " + fullmodelid + " not found in collection.");
29
31
  var _this = this;
30
32
  if (typeof Q == 'undefined') Q = req.query;
@@ -51,14 +53,15 @@ exports.getReport = function (req, res, fullmodelid, Q, P, callback) {
51
53
  res.writeHead(200, {
52
54
  'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
53
55
  'Content-Length': fsize,
54
- 'Content-Disposition': 'filename = ' + encodeURIComponent(filename)
56
+ 'Content-Disposition': (options.download ? 'attachment;': '') + 'filename = ' + encodeURIComponent(filename)
55
57
  });
56
58
  }
57
59
  else {
58
60
  res.writeHead(200, {
59
61
  'Content-Type': 'application/pdf',
60
62
  'Content-Length': fsize,
61
- 'Content-Disposition': 'filename = ' + encodeURIComponent(filename)
63
+ 'Content-Disposition': (options.download ? 'attachment;': '') + 'filename = ' + encodeURIComponent(filename),
64
+ 'Cache-Control': 'no-cache',
62
65
  });
63
66
  }
64
67
  var rs = fs.createReadStream(tmppath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsharmony",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Rapid Application Development (RAD) Platform for Node.js Database Application Development",
5
5
  "main": "index.js",
6
6
  "scripts": {