From 177abdd29e56c994e4c6f05e2530018c3dbeb50c Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sun, 21 Aug 2011 20:09:25 +0100 Subject: [PATCH] Don't show PDF Export on Windows --- node/handler/PadMessageHandler.js | 10 +++++++++- static/js/pad_impexp.js | 14 +++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/node/handler/PadMessageHandler.js b/node/handler/PadMessageHandler.js index a13273ca2..f89f4934c 100644 --- a/node/handler/PadMessageHandler.js +++ b/node/handler/PadMessageHandler.js @@ -27,6 +27,7 @@ var readOnlyManager = require("../db/ReadOnlyManager"); var settings = require('../utils/Settings'); var securityManager = require("../db/SecurityManager"); var log4js = require('log4js'); +var os = require("os"); var messageLogger = log4js.getLogger("message"); /** @@ -752,6 +753,13 @@ function handleClientReady(client, message) var apool = attribsForWire.pool.toJsonable(); atext.attribs = attribsForWire.translated; + //check if abiword is avaiable + var abiwordAvailable = settings.abiword != null ? "yes" : "no"; + if(settings.abiword != null && os.type().indexOf("Windows") != -1) + { + abiwordAvailable = "withoutPDF"; + } + var clientVars = { "accountPrivs": { "maxRevisions": 100 @@ -788,7 +796,7 @@ function handleClientReady(client, message) "fullWidth": false, "hideSidebar": false }, - "abiwordAvailable": settings.abiword != null, + "abiwordAvailable": abiwordAvailable, "hooks": {} } diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 8e4b269d9..efa8a6a46 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -236,7 +236,7 @@ var padimpexp = (function() $("#exportwordlea").attr("href", document.location.href + "/export/wordle"); //hide stuff thats not avaible if abiword is disabled - if(!clientVars.abiwordAvailable) + if(clientVars.abiwordAvailable == "no") { $("#exportworda").remove(); $("#exportpdfa").remove(); @@ -245,6 +245,18 @@ var padimpexp = (function() $("#importexportline").css({"height":"95px"}); $("#import").html("Import is not available"); } + else if(clientVars.abiwordAvailable == "withoutPDF") + { + $("#exportpdfa").remove(); + + $("#exportworda").attr("href", document.location.href + "/export/doc"); + $("#exportopena").attr("href", document.location.href + "/export/odt"); + + $("#importexport").css({"height":"142px"}); + $("#importexportline").css({"height":"142px"}); + + $("#importform").get(0).setAttribute('action', document.location.href + "/import"); + } else { $("#exportworda").attr("href", document.location.href + "/export/doc");