From 6867d881b17f198afd148e9752fd2b37d048e0ca Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Tue, 26 Jul 2011 18:54:42 +0100 Subject: [PATCH] Hide import/export options that are not avaiable if abiword isn't configured --- node/PadMessageHandler.js | 2 ++ static/js/pad_impexp.js | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/node/PadMessageHandler.js b/node/PadMessageHandler.js index 5d43fa6b..faf0ec6f 100644 --- a/node/PadMessageHandler.js +++ b/node/PadMessageHandler.js @@ -24,6 +24,7 @@ var Changeset = require("./Changeset"); var AttributePoolFactory = require("./AttributePoolFactory"); var authorManager = require("./AuthorManager"); var readOnlyManager = require("./ReadOnlyManager"); +var settings = require('./settings'); /** * A associative array that translates a session to a pad @@ -731,6 +732,7 @@ function handleClientReady(client, message) "fullWidth": false, "hideSidebar": false }, + "abiwordAvailable": settings.abiword != null, "hooks": {} } diff --git a/static/js/pad_impexp.js b/static/js/pad_impexp.js index 964eced6..e5dee7af 100644 --- a/static/js/pad_impexp.js +++ b/static/js/pad_impexp.js @@ -233,12 +233,26 @@ var padimpexp = (function() // build the export links $("#exporthtmla").attr("href", document.location.href + "/export/html"); $("#exportplaina").attr("href", document.location.href + "/export/txt"); - $("#exportworda").attr("href", document.location.href + "/export/doc"); - $("#exportpdfa").attr("href", document.location.href + "/export/pdf"); - $("#exportopena").attr("href", document.location.href + "/export/odt"); $("#exportwordlea").attr("href", document.location.href + "/export/wordle"); - - $("#importform").get(0).setAttribute('action', document.location.href + "/import"); + + //hide stuff thats not avaible if abiword is disabled + if(!clientVars.abiwordAvailable) + { + $("#exportworda").remove(); + $("#exportpdfa").remove(); + $("#exportopena").remove(); + $("#importexport").css({"height":"95px"}); + $("#importexportline").css({"height":"95px"}); + $("#import").html("Import is not available"); + } + else + { + $("#exportworda").attr("href", document.location.href + "/export/doc"); + $("#exportpdfa").attr("href", document.location.href + "/export/pdf"); + $("#exportopena").attr("href", document.location.href + "/export/odt"); + + $("#importform").get(0).setAttribute('action', document.location.href + "/import"); + } $("#impexp-close").click(function() {