Merge pull request #291 from jhollinger/export_revisions

Add ability to export specific pad revisions
This commit is contained in:
John McLear 2012-01-08 07:06:13 -08:00
commit 86902c2c0b
10 changed files with 96 additions and 29 deletions

View file

@ -156,7 +156,7 @@ var padeditbar = (function()
}, cmd, true);
}
}
padeditor.ace.focus();
if(padeditor.ace) padeditor.ace.focus();
},
toogleDropDown: function(moduleName)
{

View file

@ -236,11 +236,16 @@ var padimpexp = (function()
var self = {
init: function()
{
//get /p/padname
var pad_root_path = new RegExp(/.*\/p\/[^\/]+/).exec(document.location.pathname)
//get http://example.com/p/padname
var pad_root_url = document.location.href.replace(document.location.pathname, pad_root_path)
// build the export links
$("#exporthtmla").attr("href", document.location.pathname + "/export/html");
$("#exportplaina").attr("href", document.location.pathname + "/export/txt");
$("#exportwordlea").attr("href", document.location.pathname + "/export/wordle");
$("#exportdokuwikia").attr("href", document.location.pathname + "/export/dokuwiki");
$("#exporthtmla").attr("href", pad_root_path + "/export/html");
$("#exportplaina").attr("href", pad_root_path + "/export/txt");
$("#exportwordlea").attr("href", pad_root_path + "/export/wordle");
$("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki");
//hide stuff thats not avaible if abiword is disabled
if(clientVars.abiwordAvailable == "no")
@ -256,21 +261,21 @@ var padimpexp = (function()
{
$("#exportpdfa").remove();
$("#exportworda").attr("href", document.location.pathname + "/export/doc");
$("#exportopena").attr("href", document.location.pathname + "/export/odt");
$("#exportworda").attr("href", pad_root_path + "/export/doc");
$("#exportopena").attr("href", pad_root_path + "/export/odt");
$("#importexport").css({"height":"142px"});
$("#importexportline").css({"height":"142px"});
$("#importform").get(0).setAttribute('action', document.location.href + "/import");
$("#importform").attr('action', pad_root_url + "/import");
}
else
{
$("#exportworda").attr("href", document.location.pathname + "/export/doc");
$("#exportpdfa").attr("href", document.location.pathname + "/export/pdf");
$("#exportopena").attr("href", document.location.pathname + "/export/odt");
$("#exportworda").attr("href", pad_root_path + "/export/doc");
$("#exportpdfa").attr("href", pad_root_path + "/export/pdf");
$("#exportopena").attr("href", pad_root_path + "/export/odt");
$("#importform").get(0).setAttribute('action', document.location.pathname + "/import");
$("#importform").attr('action', pad_root_path + "/import");
}
$("#impexp-close").click(function()
@ -308,7 +313,7 @@ var padimpexp = (function()
},
export2Wordle: function()
{
var padUrl = document.location.href + "/export/txt";
var padUrl = $('#exportwordlea').attr('href').replace(/\/wordle$/, '/txt')
$.get(padUrl, function(data)
{