Commit a64114634e530883285123bc12131e0a1dd0a3f4

Authored by Kevin Fourie
1 parent 16fd4b4f

KTC-262

"Action Restriction section of a work flow there are extra two extra columns as well as one that says "no name" after you select "Edit Action""

Fixed. Plugins now return their names correctly.

Committed By: Kevin Fourie
Reviewed By: Jonathan Byrne

git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7724 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktstandard/PDFGeneratorAction.php
@@ -2,35 +2,29 @@ @@ -2,35 +2,29 @@
2 /** 2 /**
3 * $Id$ 3 * $Id$
4 * 4 *
5 - * KnowledgeTree Open Source Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited 5 + * The contents of this file are subject to the KnowledgeTree Public
  6 + * License Version 1.1.2 ("License"); You may not use this file except in
  7 + * compliance with the License. You may obtain a copy of the License at
  8 + * http://www.knowledgetree.com/KPL
8 * 9 *
9 - * This program is free software; you can redistribute it and/or modify it under  
10 - * the terms of the GNU General Public License version 3 as published by the  
11 - * Free Software Foundation.  
12 - *  
13 - * This program is distributed in the hope that it will be useful, but WITHOUT  
14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
15 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
16 - * details.  
17 - *  
18 - * You should have received a copy of the GNU General Public License  
19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
20 - *  
21 - * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,  
22 - * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 10 + * Software distributed under the License is distributed on an "AS IS"
  11 + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  12 + * See the License for the specific language governing rights and
  13 + * limitations under the License.
  14 + *
  15 + * All copies of the Covered Code must include on each user interface screen:
  16 + * (i) the "Powered by KnowledgeTree" logo and
  17 + * (ii) the KnowledgeTree copyright notice
  18 + * in the same form as they appear in the distribution. See the License for
  19 + * requirements.
23 * 20 *
24 - * The interactive user interfaces in modified source and object code versions  
25 - * of this program must display Appropriate Legal Notices, as required under  
26 - * Section 5 of the GNU General Public License version 3. 21 + * The Original Code is: KnowledgeTree Open Source
27 * 22 *
28 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
29 - * these Appropriate Legal Notices must retain the display of the "Powered by  
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
31 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 23 + * The Initial Developer of the Original Code is The Jam Warehouse Software
  24 + * (Pty) Ltd, trading as KnowledgeTree.
  25 + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  26 + * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
  27 + * All Rights Reserved.
34 * Contributor( s): ______________________________________ 28 * Contributor( s): ______________________________________
35 * 29 *
36 */ 30 */
@@ -51,8 +45,8 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -51,8 +45,8 @@ class PDFGeneratorAction extends KTDocumentAction {
51 var $sDisplayName = 'Generate PDF'; 45 var $sDisplayName = 'Generate PDF';
52 // Note: 'asc' below seems to be a catchall for plain text docs. 46 // Note: 'asc' below seems to be a catchall for plain text docs.
53 // 'htm' and 'html' should work but are not so have been removed for now. 47 // 'htm' and 'html' should work but are not so have been removed for now.
54 - var $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',  
55 - // 'html', 'htm', 48 + var $aAcceptedMimeTypes = array('doc', 'ods', 'odt', 'ott', 'txt', 'rtf', 'sxw', 'stw',
  49 + // 'html', 'htm',
56 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc', 50 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc',
57 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl', 51 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl',
58 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg', 52 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg',
@@ -62,7 +56,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -62,7 +56,7 @@ class PDFGeneratorAction extends KTDocumentAction {
62 // We need to handle Windows differently - as usual ;) 56 // We need to handle Windows differently - as usual ;)
63 if (substr( PHP_OS, 0, 3) == 'WIN') { 57 if (substr( PHP_OS, 0, 3) == 'WIN') {
64 $cmdpath = KT_DIR . "/../openoffice/openoffice/program/python.bat"; 58 $cmdpath = KT_DIR . "/../openoffice/openoffice/program/python.bat";
65 - $cmdpath = str_replace( '/','\\',$cmdpath); 59 + $cmdpath = str_replace( '/','\\',$cmdpath);
66 } else { 60 } else {
67 $cmdpath = "../openoffice/program/python"; 61 $cmdpath = "../openoffice/program/python";
68 } 62 }
@@ -75,9 +69,8 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -75,9 +69,8 @@ class PDFGeneratorAction extends KTDocumentAction {
75 return _kt('Generate PDF') . "&nbsp;<a href=\"" . KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId(), "action" => "pdfdownload") ) . "\" <img src='resources/mimetypes/pdf.png' alt='PDF' border=0/></a>"; 69 return _kt('Generate PDF') . "&nbsp;<a href=\"" . KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId(), "action" => "pdfdownload") ) . "\" <img src='resources/mimetypes/pdf.png' alt='PDF' border=0/></a>";
76 } 70 }
77 } 71 }
78 - return _kt('Generate PDF');  
79 } 72 }
80 - return ''; 73 + return 'PDF Generator';
81 } 74 }
82 75
83 function form_main() { 76 function form_main() {
@@ -123,7 +116,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -123,7 +116,7 @@ class PDFGeneratorAction extends KTDocumentAction {
123 $this->do_pdfdownload(); 116 $this->do_pdfdownload();
124 } 117 }
125 redirect(KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId() ) ) ); 118 redirect(KTUtil::ktLink( 'action.php', 'ktstandard.pdf.generate', array( "fDocumentId" => $this->oDocument->getId() ) ) );
126 - exit(0); 119 + exit(0);
127 } 120 }
128 121
129 function do_main() { 122 function do_main() {
@@ -168,7 +161,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -168,7 +161,7 @@ class PDFGeneratorAction extends KTDocumentAction {
168 /** 161 /**
169 * Method for downloading the document as a pdf. 162 * Method for downloading the document as a pdf.
170 * 163 *
171 - * @return true on success else false 164 + * @return true on success else false
172 */ 165 */
173 function do_pdfdownload() { 166 function do_pdfdownload() {
174 167
@@ -188,7 +181,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -188,7 +181,7 @@ class PDFGeneratorAction extends KTDocumentAction {
188 if (substr( PHP_OS, 0, 3) == 'WIN') { 181 if (substr( PHP_OS, 0, 3) == 'WIN') {
189 182
190 $cmd = "\"" . KT_DIR . "/../openoffice/openoffice/program/python.bat\" \"". KT_DIR . "/bin/openoffice/pdfgen.py\" \"" . $sPath . "\" \"" . $sTempFilename . "\""; 183 $cmd = "\"" . KT_DIR . "/../openoffice/openoffice/program/python.bat\" \"". KT_DIR . "/bin/openoffice/pdfgen.py\" \"" . $sPath . "\" \"" . $sTempFilename . "\"";
191 - $cmd = str_replace( '/','\\',$cmd); 184 + $cmd = str_replace( '/','\\',$cmd);
192 185
193 // TODO: Check for more errors here 186 // TODO: Check for more errors here
194 // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands! 187 // SECURTIY: Ensure $sPath and $sTempFilename are safe or they could be used to excecute arbitrary commands!
@@ -211,7 +204,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -211,7 +204,7 @@ class PDFGeneratorAction extends KTDocumentAction {
211 204
212 } 205 }
213 206
214 - // Check the tempfile exists and the python script did not return anything (which would indicate an error) 207 + // Check the tempfile exists and the python script did not return anything (which would indicate an error)
215 if (file_exists($sTempFilename) && $res == '') { 208 if (file_exists($sTempFilename) && $res == '') {
216 209
217 $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') ); 210 $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') );
@@ -231,7 +224,7 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -231,7 +224,7 @@ class PDFGeneratorAction extends KTDocumentAction {
231 224
232 // HTTP/1.0 225 // HTTP/1.0
233 // header("Pragma: no-cache"); // Don't send this header! It breaks IE. 226 // header("Pragma: no-cache"); // Don't send this header! It breaks IE.
234 - 227 +
235 // Get a filelike object and send it to the browser 228 // Get a filelike object and send it to the browser
236 $oFile = new KTFSFileLike($sTempFilename); 229 $oFile = new KTFSFileLike($sTempFilename);
237 KTFileLikeUtil::send_contents($oFile); 230 KTFileLikeUtil::send_contents($oFile);
@@ -239,23 +232,23 @@ class PDFGeneratorAction extends KTDocumentAction { @@ -239,23 +232,23 @@ class PDFGeneratorAction extends KTDocumentAction {
239 unlink($sTempFilename); 232 unlink($sTempFilename);
240 233
241 // Create the document transaction 234 // Create the document transaction
242 - $oDocumentTransaction = new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions); 235 + $oDocumentTransaction = & new DocumentTransaction($oDocument, 'Document downloaded as PDF', 'ktcore.transactions.download', $aOptions);
243 $oDocumentTransaction->create(); 236 $oDocumentTransaction->create();
244 // Just stop here - the content has already been sent. 237 // Just stop here - the content has already been sent.
245 - exit(0); 238 + exit(0);
246 239
247 } else { 240 } else {
248 // Set the error messsage and redirect to view document 241 // Set the error messsage and redirect to view document
249 - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator. ' . $res)); 242 + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.<br>' . $res));
250 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); 243 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId())));
251 - exit(0); 244 + exit(0);
252 } 245 }
253 246
254 } else { 247 } else {
255 // Set the error messsage and redirect to view document 248 // Set the error messsage and redirect to view document
256 - $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator. The path to the document did not exist.')); 249 + $this->addErrorMessage(_kt('An error occurred generating the PDF - please contact the system administrator.<br>The path to the document did not exist.'));
257 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId()))); 250 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId())));
258 - exit(0); 251 + exit(0);
259 } 252 }
260 253
261 254
plugins/rssplugin/RSSDocumentLinkAction.php
1 <?php 1 <?php
2 /* 2 /*
3 - * $Id$  
4 - *  
5 - * KnowledgeTree Open Source Edition  
6 - * Document Management Made Simple  
7 - * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited  
8 - *  
9 - * This program is free software; you can redistribute it and/or modify it under  
10 - * the terms of the GNU General Public License version 3 as published by the  
11 - * Free Software Foundation.  
12 - *  
13 - * This program is distributed in the hope that it will be useful, but WITHOUT  
14 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  
15 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more  
16 - * details. 3 + * The contents of this file are subject to the KnowledgeTree Public
  4 + * License Version 1.1.2 ("License"); You may not use this file except in
  5 + * compliance with the License. You may obtain a copy of the License at
  6 + * http://www.knowledgetree.com/KPL
17 * 7 *
18 - * You should have received a copy of the GNU General Public License  
19 - * along with this program. If not, see <http://www.gnu.org/licenses/>.  
20 - *  
21 - * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place,  
22 - * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. 8 + * Software distributed under the License is distributed on an "AS IS"
  9 + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  10 + * See the License for the specific language governing rights and
  11 + * limitations under the License.
  12 + *
  13 + * All copies of the Covered Code must include on each user interface screen:
  14 + * (i) the "Powered by KnowledgeTree" logo and
  15 + * (ii) the KnowledgeTree copyright notice
  16 + * in the same form as they appear in the distribution. See the License for
  17 + * requirements.
23 * 18 *
24 - * The interactive user interfaces in modified source and object code versions  
25 - * of this program must display Appropriate Legal Notices, as required under  
26 - * Section 5 of the GNU General Public License version 3. 19 + * The Original Code is: KnowledgeTree Open Source
27 * 20 *
28 - * In accordance with Section 7(b) of the GNU General Public License version 3,  
29 - * these Appropriate Legal Notices must retain the display of the "Powered by  
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the  
31 - * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices  
32 - * must display the words "Powered by KnowledgeTree" and retain the original  
33 - * copyright notice. 21 + * The Initial Developer of the Original Code is The Jam Warehouse Software
  22 + * (Pty) Ltd, trading as KnowledgeTree.
  23 + * Portions created by The Jam Warehouse Software (Pty) Ltd are Copyright
  24 + * (C) 2007 The Jam Warehouse Software (Pty) Ltd;
  25 + * All Rights Reserved.
34 * Contributor( s): ______________________________________ 26 * Contributor( s): ______________________________________
35 * 27 *
36 */ 28 */
@@ -57,7 +49,7 @@ class RSSDocumentLinkAction extends KTDocumentAction { @@ -57,7 +49,7 @@ class RSSDocumentLinkAction extends KTDocumentAction {
57 49
58 // get document id 50 // get document id
59 if(!isset($oDocument)){ 51 if(!isset($oDocument)){
60 - return _kt('RSS'); 52 + return 'RSS';
61 } 53 }
62 $iFId = $oDocument->getID(); 54 $iFId = $oDocument->getID();
63 55