Commit 0eb5b35f668ad3b80a136d7aed53dc44df34a0e7
1 parent
7b06b78f
KTS-2664
"When no document is selected when performing a bulk action in a folder the error message is not displayed as per Knowledge Tree standard." Fixed. Added a new redirect method to dispatcher "redirectToBrowse()". The action now redirects to the browse.php instead of action.php. Committed by: Megan Watson Reviewed by: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7644 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
45 additions
and
29 deletions
action.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 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 | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 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. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -86,35 +86,35 @@ class KTActionDispatcher extends KTStandardDispatcher { |
| 86 | 86 | |
| 87 | 87 | function do_bulkaction() { |
| 88 | 88 | $act = (array) KTUtil::arrayGet($_REQUEST, 'submit',null); |
| 89 | - | |
| 89 | + | |
| 90 | 90 | $targets = array_keys($act); |
| 91 | 91 | if (!empty($targets)) { |
| 92 | 92 | $target = $targets[0]; |
| 93 | 93 | } else { |
| 94 | - $this->errorRedirectToMain(_kt('No action selected.')); | |
| 94 | + $this->errorRedirectToBrowse(_kt('No action selected.')); | |
| 95 | 95 | exit(0); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | $aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array()); |
| 99 | - $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array()); | |
| 99 | + $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array()); | |
| 100 | 100 | |
| 101 | 101 | $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); |
| 102 | - if (PEAR::isError($oFolder)) { | |
| 103 | - $this->errorRedirectToMain(_kt('Invalid folder selected.')); | |
| 102 | + if (PEAR::isError($oFolder)) { | |
| 103 | + $this->errorRedirectToBrowse(_kt('Invalid folder selected.')); | |
| 104 | 104 | exit(0); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | if (empty($aFolderSelection) && empty($aDocumentSelection)) { |
| 108 | - $this->errorRedirectToMain(_kt('Please select documents or folders first.'), sprintf('fFolderId=%d', $oFolder->getId())); | |
| 108 | + $this->errorRedirectToBrowse(_kt('Please select documents or folders first.'), sprintf('fFolderId=%d', $oFolder->getId())); | |
| 109 | 109 | exit(0); |
| 110 | - } | |
| 111 | - | |
| 110 | + } | |
| 111 | + | |
| 112 | 112 | // prepare for passing to bulk actions |
| 113 | 113 | $oActionRegistry =& KTActionRegistry::getSingleton(); |
| 114 | 114 | $oAction =& $oActionRegistry->initializeAction($target, $this->oUser); |
| 115 | - | |
| 115 | + | |
| 116 | 116 | if(!$oAction || PEAR::isError($oAction)) { |
| 117 | - $this->errorRedirectToMain(_kt('No such action.')); | |
| 117 | + $this->errorRedirectToBrowse(_kt('No such action.')); | |
| 118 | 118 | exit(0); |
| 119 | 119 | } |
| 120 | 120 | |
| ... | ... | @@ -126,7 +126,7 @@ class KTActionDispatcher extends KTStandardDispatcher { |
| 126 | 126 | |
| 127 | 127 | // exit(0); |
| 128 | 128 | } |
| 129 | - | |
| 129 | + | |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | 132 | * Handle output from this dispatcher. | ... | ... |
lib/dispatcher.inc.php
| ... | ... | @@ -5,32 +5,32 @@ |
| 5 | 5 | * KnowledgeTree Open Source Edition |
| 6 | 6 | * Document Management Made Simple |
| 7 | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | |
| 8 | + * | |
| 9 | 9 | * This program is free software; you can redistribute it and/or modify it under |
| 10 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | 11 | * Free Software Foundation. |
| 12 | - * | |
| 12 | + * | |
| 13 | 13 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 14 | 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 15 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | 16 | * details. |
| 17 | - * | |
| 17 | + * | |
| 18 | 18 | * You should have received a copy of the GNU General Public License |
| 19 | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | |
| 20 | + * | |
| 21 | 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, |
| 22 | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | |
| 27 | + * | |
| 28 | 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, |
| 29 | 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 | |
| 30 | + * KnowledgeTree" logo and retain the original copyright notice. If the display of the | |
| 31 | 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. | |
| 32 | + * must display the words "Powered by KnowledgeTree" and retain the original | |
| 33 | + * copyright notice. | |
| 34 | 34 | * Contributor( s): ______________________________________ |
| 35 | 35 | * |
| 36 | 36 | */ |
| ... | ... | @@ -234,6 +234,22 @@ class KTDispatcher { |
| 234 | 234 | return $this->redirectTo('main', $sQuery); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | + function errorRedirectToBrowse($sErrorMessage, $sQuery = "", $event = 'main') { | |
| 238 | + if ($this->bTransactionStarted) { | |
| 239 | + $this->rollbackTransaction(); | |
| 240 | + } | |
| 241 | + | |
| 242 | + $_SESSION['KTErrorMessage'][] = $sErrorMessage; | |
| 243 | + | |
| 244 | + // meld persistant options | |
| 245 | + $sQuery = $this->meldPersistQuery($sQuery, $event); | |
| 246 | + | |
| 247 | + $server = str_replace('action.php', 'browse.php', $_SERVER['PHP_SELF']); | |
| 248 | + $sRedirect = KTUtil::addQueryString($server, $sQuery); | |
| 249 | + $this->oRedirector->redirect($sRedirect); | |
| 250 | + exit(0); | |
| 251 | + } | |
| 252 | + | |
| 237 | 253 | function handleOutput($sOutput) { |
| 238 | 254 | print $sOutput; |
| 239 | 255 | } | ... | ... |