check for soffice before removing export paths
parent
e98821cef7
commit
7f517eca0b
|
@ -1234,6 +1234,8 @@ function handleClientReady(client, message)
|
||||||
"serverTimestamp": new Date().getTime(),
|
"serverTimestamp": new Date().getTime(),
|
||||||
"userId": author,
|
"userId": author,
|
||||||
"abiwordAvailable": settings.abiwordAvailable(),
|
"abiwordAvailable": settings.abiwordAvailable(),
|
||||||
|
"sofficeAvailable": settings.sofficeAvailable(),
|
||||||
|
"exportAvailable": settings.exportAvailable(),
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"plugins": plugins.plugins,
|
"plugins": plugins.plugins,
|
||||||
"parts": plugins.parts,
|
"parts": plugins.parts,
|
||||||
|
|
|
@ -222,6 +222,27 @@ exports.abiwordAvailable = function()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.sofficeAvailable = function () {
|
||||||
|
if(exports.soffice != null) {
|
||||||
|
return os.type().indexOf("Windows") != -1 ? "withoutPDF": "yes";
|
||||||
|
} else {
|
||||||
|
return "no";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.exportAvailable = function () {
|
||||||
|
var abiword = exports.abiwordAvailable();
|
||||||
|
var soffice = exports.sofficeAvailable();
|
||||||
|
|
||||||
|
if(abiword == "no" && soffice == "no") {
|
||||||
|
return "no";
|
||||||
|
} else if ((abiword == "withoutPDF" && soffice == "no") || (abiword == "no" && soffice == "withoutPDF")) {
|
||||||
|
return "withoutPDF";
|
||||||
|
} else {
|
||||||
|
return "yes";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Provide git version if available
|
// Provide git version if available
|
||||||
exports.getGitCommit = function() {
|
exports.getGitCommit = function() {
|
||||||
var version = "";
|
var version = "";
|
||||||
|
@ -375,6 +396,20 @@ exports.reloadSettings = function reloadSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(exports.soffice) {
|
||||||
|
fs.exists(exports.soffice, function (exists) {
|
||||||
|
if(!exists) {
|
||||||
|
var sofficeError = "SOffice does not exist at this path, check your settings file";
|
||||||
|
|
||||||
|
if(!exports.suppressErrorsInPadText) {
|
||||||
|
exports.defaultPadText = exports.defaultPadText + "\nError: " + sofficeError + suppressDisableMsg;
|
||||||
|
}
|
||||||
|
console.error(sofficeError);
|
||||||
|
exports.soffice = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!exports.sessionKey) {
|
if (!exports.sessionKey) {
|
||||||
try {
|
try {
|
||||||
exports.sessionKey = fs.readFileSync("./SESSIONKEY.txt","utf8");
|
exports.sessionKey = fs.readFileSync("./SESSIONKEY.txt","utf8");
|
||||||
|
|
|
@ -207,8 +207,10 @@ var padimpexp = (function()
|
||||||
// activate action to import in the form
|
// activate action to import in the form
|
||||||
$("#importform").attr('action', pad_root_url + "/import");
|
$("#importform").attr('action', pad_root_url + "/import");
|
||||||
|
|
||||||
//hide stuff thats not avaible if abiword is disabled
|
console.log(clientVars);
|
||||||
if(clientVars.abiwordAvailable == "no")
|
|
||||||
|
//hide stuff thats not avaible if abiword/soffice is disabled
|
||||||
|
if(clientVars.exportAvailable == "no")
|
||||||
{
|
{
|
||||||
$("#exportworda").remove();
|
$("#exportworda").remove();
|
||||||
$("#exportpdfa").remove();
|
$("#exportpdfa").remove();
|
||||||
|
@ -216,7 +218,7 @@ var padimpexp = (function()
|
||||||
|
|
||||||
$("#importmessageabiword").show();
|
$("#importmessageabiword").show();
|
||||||
}
|
}
|
||||||
else if(clientVars.abiwordAvailable == "withoutPDF")
|
else if(clientVars.exportAvailable == "withoutPDF")
|
||||||
{
|
{
|
||||||
$("#exportpdfa").remove();
|
$("#exportpdfa").remove();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue