This commit is contained in:
John McLear 2016-05-31 06:23:48 +08:00
parent ec093c9c85
commit d408575d60
6 changed files with 16 additions and 5 deletions

View file

@ -69,6 +69,7 @@
"pad.importExport.exportword": "Microsoft Word", "pad.importExport.exportword": "Microsoft Word",
"pad.importExport.exportpdf": "PDF", "pad.importExport.exportpdf": "PDF",
"pad.importExport.exportopen": "ODF (Open Document Format)", "pad.importExport.exportopen": "ODF (Open Document Format)",
"pad.importExport.authorColors": "Include Author Colors in HTML Export",
"pad.importExport.abiword.innerHTML": "You only can import from plain text or HTML formats. For more advanced import features please <a href=\"https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord\">install abiword</a>.", "pad.importExport.abiword.innerHTML": "You only can import from plain text or HTML formats. For more advanced import features please <a href=\"https://github.com/ether/etherpad-lite/wiki/How-to-enable-importing-and-exporting-different-file-formats-in-Ubuntu-or-OpenSuse-or-SLES-with-AbiWord\">install abiword</a>.",
"pad.modals.connected": "Connected.", "pad.modals.connected": "Connected.",

View file

@ -92,7 +92,8 @@ exports.doExport = function(req, res, padId, type)
//render the html document //render the html document
function(callback) function(callback)
{ {
exporthtml.getPadHTMLDocument(padId, req.params.rev, false, function(err, _html) var authorColors = req.query.authorColors;
exporthtml.getPadHTMLDocument(padId, req.params.rev, false, authorColors, function(err, _html)
{ {
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
html = _html; html = _html;

View file

@ -40,7 +40,7 @@ exports.expressCreateServer = function (hook_name, args, cb) {
hasPadAccess(req, res, function() hasPadAccess(req, res, function()
{ {
//render the html document //render the html document
exporthtml.getPadHTMLDocument(padId, null, false, function(err, _html) exporthtml.getPadHTMLDocument(padId, null, false, false, function(err, _html)
{ {
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
html = _html; html = _html;

View file

@ -478,7 +478,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
return pieces.join(''); return pieces.join('');
} }
exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback) exports.getPadHTMLDocument = function (padId, revNum, noDocType, authorColor, callback)
{ {
padManager.getPad(padId, function (err, pad) padManager.getPad(padId, function (err, pad)
{ {
@ -591,8 +591,7 @@ exports.getPadHTMLDocument = function (padId, revNum, noDocType, callback)
'</style>\n' + '</head>\n') + '</style>\n' + '</head>\n') +
'<body>'; '<body>';
var foot = '</body>\n</html>\n'; var foot = '</body>\n</html>\n';
getPadHTML(pad, revNum, authorColor, function (err, html)
getPadHTML(pad, revNum, function (err, html)
{ {
if(ERR(err, callback)) return; if(ERR(err, callback)) return;
callback(null, head + html + foot); callback(null, head + html + foot);

View file

@ -193,6 +193,14 @@ var padimpexp = (function()
//get http://example.com/p/padname without Params //get http://example.com/p/padname without Params
var pad_root_url = document.location.protocol + '//' + document.location.host + document.location.pathname; var pad_root_url = document.location.protocol + '//' + document.location.host + document.location.pathname;
$('#exportauthorcolors').click(function(){
if($('#exportauthorcolors').is(":checked")){
$("#exporthtmla").attr("href", pad_root_path + "/export/html?authorColors=true");
}else{
$("#exporthtmla").attr("href", pad_root_path + "/export/html");
}
});
//i10l buttom import //i10l buttom import
$('#importsubmitinput').val(html10n.get("pad.impexp.importbutton")); $('#importsubmitinput').val(html10n.get("pad.impexp.importbutton"));
html10n.bind('localized', function() { html10n.bind('localized', function() {

View file

@ -232,6 +232,8 @@
<a id="exportworda" target="_blank" class="exportlink"><div class="exporttype" id="exportword" data-l10n-id="pad.importExport.exportword"></div></a> <a id="exportworda" target="_blank" class="exportlink"><div class="exporttype" id="exportword" data-l10n-id="pad.importExport.exportword"></div></a>
<a id="exportpdfa" target="_blank" class="exportlink"><div class="exporttype" id="exportpdf" data-l10n-id="pad.importExport.exportpdf"></div></a> <a id="exportpdfa" target="_blank" class="exportlink"><div class="exporttype" id="exportpdf" data-l10n-id="pad.importExport.exportpdf"></div></a>
<a id="exportopena" target="_blank" class="exportlink"><div class="exporttype" id="exportopen" data-l10n-id="pad.importExport.exportopen"></div></a> <a id="exportopena" target="_blank" class="exportlink"><div class="exporttype" id="exportopen" data-l10n-id="pad.importExport.exportopen"></div></a>
<input type="checkbox" name="checkbox" value="cake" id="exportauthorcolors">
<label for="exportauthorcolors" data-l10n-id="pad.importExport.authorColors"></label>
<% e.end_block(); %> <% e.end_block(); %>
</div> </div>
</div> </div>