diff --git a/bin/openoffice/pdfgen.py b/bin/openoffice/pdfgen.py index 120df77..875de43 100755 --- a/bin/openoffice/pdfgen.py +++ b/bin/openoffice/pdfgen.py @@ -6,37 +6,56 @@ # Document Management Made Simple # Copyright (C) 2008 KnowledgeTree Inc. # Portions copyright The Jam Warehouse Software (Pty) Limited -# +# # This program is free software; you can redistribute it and/or modify it under # the terms of the GNU General Public License version 3 as published by the # Free Software Foundation. -# +# # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. -# +# # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# -# You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, +# +# You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, # California 94120-7775, or email info@knowledgetree.com. -# +# # The interactive user interfaces in modified source and object code versions # of this program must display Appropriate Legal Notices, as required under # Section 5 of the GNU General Public License version 3. -# +# # In accordance with Section 7(b) of the GNU General Public License version 3, # these Appropriate Legal Notices must retain the display of the "Powered by -# KnowledgeTree" logo and retain the original copyright notice. If the display of the +# KnowledgeTree" logo and retain the original copyright notice. If the display of the # logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices -# must display the words "Powered by KnowledgeTree" and retain the original +# must display the words "Powered by KnowledgeTree" and retain the original # copyright notice. # Contributor( s): ______________________________________ # -import uno -import sys +import os, sys, glob + +extrapaths = glob.glob('/usr/lib*/openoffice*/program/') + glob.glob('/usr/lib*/ooo*/program') + [ '/Applications/NeoOffice.app/Contents/program', 'c:/program files/ktdms/openoffice/program' ] + +ooProgramPath = os.environ.get('ooProgramPath') +if not ooProgramPath is None: + extrapaths = [ ooProgramPath ] + extrapaths + +for path in extrapaths: + try: + sys.path.append(path) + import uno + os.environ['PATH'] = '%s:' % path + os.environ['PATH'] + break + except ImportError: + sys.path.remove(path) + continue +else: + print >>sys.stderr, "PyODConverter: Cannot find the pyuno.so library in sys.path and known paths." + sys.exit(1) + from com.sun.star.beans import PropertyValue NoConnectException = uno.getClass("com.sun.star.connection.NoConnectException") @@ -87,7 +106,7 @@ except RuntimeException, e: if doc == None: sys.stderr.write("The document could not be opened for conversion. This could indicate an unsupported mimetype.\n") sys.exit(1) - + ### Save File properties = [] diff --git a/ktwebservice/KTDownloadManager.inc.php b/ktwebservice/KTDownloadManager.inc.php index d5c1def..d4b5650 100644 --- a/ktwebservice/KTDownloadManager.inc.php +++ b/ktwebservice/KTDownloadManager.inc.php @@ -134,8 +134,8 @@ class KTDownloadManager */ function download($document_id, $hash, $version = null) { - $sql = "SELECT 1 FROM download_files WHERE hash='$hash' AND session='$this->session' AND document_id=$document_id"; - $rows = DBUtil::getResultArray($sql); + $sql = "SELECT 1 FROM download_files WHERE hash=? AND session=? AND document_id=?"; + $rows = DBUtil::getResultArray(array($sql, array($hash, $this->session, $document_id))); if (PEAR::isError($rows)) { return $rows; diff --git a/plugins/ktstandard/KTEmail.php b/plugins/ktstandard/KTEmail.php index 32712e1..34810dc 100644 --- a/plugins/ktstandard/KTEmail.php +++ b/plugins/ktstandard/KTEmail.php @@ -143,11 +143,11 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo $sMessage = ''; $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); $sMessage .= " \n"; - $sMessage .= _kt('Click on the hyperlink below to view it'); + $sMessage .= _kt('Click on the hyperlink below to view it.') . '

'; $sMsgEnd = '

' . _kt('Comments') . ':
' . $sComment; $sMsgEnd .= '
'; - $sTitle = sprintf(_kt("Link: %s from %s"), $sDocumentName, $oSendingUser->getName()); + $sTitle = sprintf(_kt("Link (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); $sEmail = null; $sEmailFrom = null; @@ -171,6 +171,8 @@ function sendExternalEmails($aEmailAddresses, $iDocumentID, $sDocumentName, $sCo $oDownloadManager->set_session($session); $link = $oDownloadManager->allow_download($iDocumentID); + $link = "{$link}"; + $sMsg = $sMessage.$link.$sMsgEnd; $res = $oEmail->send(array($sAddress), $sTitle, $sMsg); @@ -220,7 +222,7 @@ function sendEmailDocument($aDestEmailAddress, $iDocumentID, $sDocumentName, $sC if (strlen($sComment) > 0) { $sMessage .= '

' . _kt('Comments') . ':
' . $sComment; } - $sTitle = sprintf(_kt("Document: %s from %s"), $sDocumentName, $oSendingUser->getName()); + $sTitle = sprintf(_kt("Document (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); $sEmail = null; $sEmailFrom = null; @@ -278,7 +280,7 @@ function sendEmailHyperlink($aDestEmailAddress, $iDocumentID, $sDocumentName, $s */ $sMessage .= sprintf(_kt("Your colleague, %s, wishes you to view the document entitled '%s'."), $oSendingUser->getName(), $sDocumentName); $sMessage .= " \n"; - $sMessage .= _kt('Click on the hyperlink below to view it.'); + $sMessage .= _kt('Click on the hyperlink below to view it.') . '
'; // add the link to the document to the mail $sMessage .= '
' . generateControllerLink('viewDocument', "fDocumentID=$iDocumentID", $sDocumentName, true); // add optional comment @@ -286,7 +288,7 @@ function sendEmailHyperlink($aDestEmailAddress, $iDocumentID, $sDocumentName, $s $sMessage .= '

' . _kt('Comments') . ':
' . $sComment; } $sMessage .= ''; - $sTitle = sprintf(_kt("Link: %s from %s"), $sDocumentName, $oSendingUser->getName()); + $sTitle = sprintf(_kt("Link (ID %s): %s from %s"), $iDocumentID, $sDocumentName, $oSendingUser->getName()); //email the hyperlink // $sEmail = null; diff --git a/plugins/ktstandard/PDFGeneratorAction.php b/plugins/ktstandard/PDFGeneratorAction.php index 59e14c7..25b7bb6 100644 --- a/plugins/ktstandard/PDFGeneratorAction.php +++ b/plugins/ktstandard/PDFGeneratorAction.php @@ -66,6 +66,7 @@ class PDFGeneratorAction extends KTDocumentAction { function getDisplayName() { $cmdpath = KTUtil::findCommand('externalBinary/python'); // Check if openoffice and python are available + if($cmdpath != false && file_exists($cmdpath) && !empty($cmdpath)) { $sDocType = $this->getMimeExtension(); // make sure that the selected document is of an acceptable extension @@ -178,6 +179,8 @@ class PDFGeneratorAction extends KTDocumentAction { $oDocument = $this->oDocument; $oStorage =& KTStorageManagerUtil::getSingleton(); $oConfig =& KTConfig::getSingleton(); + $default = realpath(str_replace('\\','/',KT_DIR . '/../openoffice/program')); + putenv('ooProgramPath=' . $oConfig->get('openoffice/programPath', $default)); $cmdpath = KTUtil::findCommand('externalBinary/python'); // Check if openoffice and python are available if($cmdpath == false || !file_exists($cmdpath) || empty($cmdpath)) { diff --git a/search2/indexing/extractorCore.inc.php b/search2/indexing/extractorCore.inc.php index 79fd2fd..83dccac 100755 --- a/search2/indexing/extractorCore.inc.php +++ b/search2/indexing/extractorCore.inc.php @@ -353,7 +353,7 @@ abstract class ExternalDocumentExtractor extends DocumentExtractor $config = KTConfig::getSingleton(); - $default = realpath(str_replace('\\','/',KT_ROOT_DIR . '/../openoffice/program')); + $default = realpath(str_replace('\\','/',KT_DIR . '/../openoffice/program')); putenv('ooProgramPath=' . $config->get('openoffice/programPath', $default)); }