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 2 /**
3 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 28 * Contributor( s): ______________________________________
35 29 *
36 30 */
... ... @@ -51,8 +45,8 @@ class PDFGeneratorAction extends KTDocumentAction {
51 45 var $sDisplayName = 'Generate PDF';
52 46 // Note: 'asc' below seems to be a catchall for plain text docs.
53 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 50 'xml' , 'pdb', 'psw', 'ods', 'ots', 'sxc',
57 51 'stc', 'dif', 'dbf', 'xls', 'xlt', 'slk', 'csv', 'pxl',
58 52 'odp', 'otp', 'sxi', 'sti', 'ppt', 'pot', 'sxd', 'odg',
... ... @@ -62,7 +56,7 @@ class PDFGeneratorAction extends KTDocumentAction {
62 56 // We need to handle Windows differently - as usual ;)
63 57 if (substr( PHP_OS, 0, 3) == 'WIN') {
64 58 $cmdpath = KT_DIR . "/../openoffice/openoffice/program/python.bat";
65   - $cmdpath = str_replace( '/','\\',$cmdpath);
  59 + $cmdpath = str_replace( '/','\\',$cmdpath);
66 60 } else {
67 61 $cmdpath = "../openoffice/program/python";
68 62 }
... ... @@ -75,9 +69,8 @@ class PDFGeneratorAction extends KTDocumentAction {
75 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 76 function form_main() {
... ... @@ -123,7 +116,7 @@ class PDFGeneratorAction extends KTDocumentAction {
123 116 $this->do_pdfdownload();
124 117 }
125 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 122 function do_main() {
... ... @@ -168,7 +161,7 @@ class PDFGeneratorAction extends KTDocumentAction {
168 161 /**
169 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 166 function do_pdfdownload() {
174 167  
... ... @@ -188,7 +181,7 @@ class PDFGeneratorAction extends KTDocumentAction {
188 181 if (substr( PHP_OS, 0, 3) == 'WIN') {
189 182  
190 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 186 // TODO: Check for more errors here
194 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 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 208 if (file_exists($sTempFilename) && $res == '') {
216 209  
217 210 $sUrlEncodedFileName = substr($oDocument->getFileName(), 0, strrpos($oDocument->getFileName(), '.') );
... ... @@ -231,7 +224,7 @@ class PDFGeneratorAction extends KTDocumentAction {
231 224  
232 225 // HTTP/1.0
233 226 // header("Pragma: no-cache"); // Don't send this header! It breaks IE.
234   -
  227 +
235 228 // Get a filelike object and send it to the browser
236 229 $oFile = new KTFSFileLike($sTempFilename);
237 230 KTFileLikeUtil::send_contents($oFile);
... ... @@ -239,23 +232,23 @@ class PDFGeneratorAction extends KTDocumentAction {
239 232 unlink($sTempFilename);
240 233  
241 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 236 $oDocumentTransaction->create();
244 237 // Just stop here - the content has already been sent.
245   - exit(0);
  238 + exit(0);
246 239  
247 240 } else {
248 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 243 redirect(generateControllerLink('viewDocument',sprintf(_kt('fDocumentId=%d'),$oDocument->getId())));
251   - exit(0);
  244 + exit(0);
252 245 }
253 246  
254 247 } else {
255 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 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 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 26 * Contributor( s): ______________________________________
35 27 *
36 28 */
... ... @@ -57,7 +49,7 @@ class RSSDocumentLinkAction extends KTDocumentAction {
57 49  
58 50 // get document id
59 51 if(!isset($oDocument)){
60   - return _kt('RSS');
  52 + return 'RSS';
61 53 }
62 54 $iFId = $oDocument->getID();
63 55  
... ...