From 70e29b30f6b8ff627b6f5738f4fcf4b9dbd6e4c7 Mon Sep 17 00:00:00 2001 From: Kevin Fourie Date: Mon, 25 Feb 2008 10:38:52 +0000 Subject: [PATCH] KTS-3057 "Cleanup link on System Folder Utilization dashlet points to an non-existing url" Fixed. Cleaned up Url creation for Windows. --- bin/openoffice/pdfgen.py | 15 ++++++++++++--- plugins/housekeeper/DiskUsageDashlet.inc.php | 9 +++++++++ plugins/housekeeper/FolderUsageDashlet.inc.php | 7 ++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/bin/openoffice/pdfgen.py b/bin/openoffice/pdfgen.py index 4273081..487bc03 100755 --- a/bin/openoffice/pdfgen.py +++ b/bin/openoffice/pdfgen.py @@ -84,7 +84,7 @@ except RuntimeException, e: sys.stderr.write("An unknown error occured: " + e.Message + "\n") if doc == None: - sys.stderr.write("OpenOffice could not load the document for conversion. This could indicate an unsupported minetype.\n") + sys.stderr.write("The document could not be opened for conversion. This could indicate an unsupported mimetype.\n") sys.exit(1) @@ -100,5 +100,14 @@ p.Value = 'writer_pdf_Export' properties.append(p) properties = tuple(properties) -doc.storeToURL(url_save, properties) -doc.dispose() +try: + doc.storeToURL(url_save, properties) + doc.dispose() +except IOException, e: + sys.stderr.write("URL (" + url_save + ") couldn't be found or was corrupt (" + e.Message + ")\n") + sys.exit(1) +except IllegalArgumentException, e: + sys.stderr.write("Given parameters don't conform to the specification ( " + e.Message + ")\n") + sys.exit(1) +except RuntimeException, e: + sys.stderr.write("An unknown error occured: " + e.Message + "\n") diff --git a/plugins/housekeeper/DiskUsageDashlet.inc.php b/plugins/housekeeper/DiskUsageDashlet.inc.php index 6770477..db80a7e 100755 --- a/plugins/housekeeper/DiskUsageDashlet.inc.php +++ b/plugins/housekeeper/DiskUsageDashlet.inc.php @@ -145,7 +145,16 @@ class DiskUsageDashlet extends KTBaseDashlet $oRegistry =& KTPluginRegistry::getSingleton(); $oPlugin =& $oRegistry->getPlugin('ktcore.housekeeper.plugin'); + $config = KTConfig::getSingleton(); + $rootUrl = $config->get('KnowledgeTree/rootUrl'); + $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); + if (!empty($rootUrl)) $dispatcherURL .= $rootUrl . $dispatcherURL; + if ( substr( $dispatcherURL, 0,1 ) == '/' || substr( $dispatcherURL, 0,1 ) == '\\') + { + $dispatcherURL = substr($dispatcherURL,1); + } + $dispatcherURL = str_replace( '\\', '/', $dispatcherURL); $aTemplateData = array( diff --git a/plugins/housekeeper/FolderUsageDashlet.inc.php b/plugins/housekeeper/FolderUsageDashlet.inc.php index c1a96a0..7c89ef3 100755 --- a/plugins/housekeeper/FolderUsageDashlet.inc.php +++ b/plugins/housekeeper/FolderUsageDashlet.inc.php @@ -156,12 +156,13 @@ class FolderUsageDashlet extends KTBaseDashlet $dispatcherURL = $oPlugin->getURLPath('HouseKeeperDispatcher.php'); if (!empty($rootUrl)) $dispatcherURL .= $rootUrl . $dispatcherURL; - if (substr($dispatcherURL, 0,1 ) == '/') + if ( substr( $dispatcherURL, 0,1 ) == '/' || substr( $dispatcherURL, 0,1 ) == '\\') { $dispatcherURL = substr($dispatcherURL,1); } - - $this->getUsage(); + $dispatcherURL = str_replace( '\\', '/', $dispatcherURL); + + $this->getUsage(); $aTemplateData = array( 'context' => $this, -- libgit2 0.21.4