semi working requires browser refresh

This commit is contained in:
John McLear 2014-12-29 20:57:58 +01:00
parent 565097efb4
commit 3773b6346b
7 changed files with 91 additions and 42 deletions

View file

@ -21,6 +21,7 @@
var ERR = require("async-stacktrace");
var exporthtml = require("../utils/ExportHtml");
var exporttxt = require("../utils/ExportTxt");
var exportEtherpad = require("../utils/ExportEtherpad");
var async = require("async");
var fs = require("fs");
var settings = require('../utils/Settings');
@ -52,14 +53,21 @@ exports.doExport = function(req, res, padId, type)
// if fileName is set then set it to the padId, note that fileName is returned as an array.
if(hookFileName.length) fileName = hookFileName;
//tell the browser that this is a downloadable file
res.attachment(fileName + "." + type);
//if this is a plain text export, we can do this directly
// We have to over engineer this because tabs are stored as attributes and not plain text
if(type == "txt")
if(type == "etherpad"){
console.log("Exporting Etherpad");
exportEtherpad.getPadRaw(padId, function(err, pad){
if(!err){
res.send(pad);
// return;
}
});
}
else if(type == "txt")
{
var txt;
var randNum;