Commit 6e902705ce08a94372e47a003f991d089f44868d
1 parent
14839c93
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,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 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 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 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 | 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 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 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/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 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. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 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 | 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 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 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 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -86,35 +86,35 @@ class KTActionDispatcher extends KTStandardDispatcher { | @@ -86,35 +86,35 @@ class KTActionDispatcher extends KTStandardDispatcher { | ||
| 86 | 86 | ||
| 87 | function do_bulkaction() { | 87 | function do_bulkaction() { |
| 88 | $act = (array) KTUtil::arrayGet($_REQUEST, 'submit',null); | 88 | $act = (array) KTUtil::arrayGet($_REQUEST, 'submit',null); |
| 89 | - | 89 | + |
| 90 | $targets = array_keys($act); | 90 | $targets = array_keys($act); |
| 91 | if (!empty($targets)) { | 91 | if (!empty($targets)) { |
| 92 | $target = $targets[0]; | 92 | $target = $targets[0]; |
| 93 | } else { | 93 | } else { |
| 94 | - $this->errorRedirectToMain(_kt('No action selected.')); | 94 | + $this->errorRedirectToBrowse(_kt('No action selected.')); |
| 95 | exit(0); | 95 | exit(0); |
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | $aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array()); | 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 | $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); | 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 | exit(0); | 104 | exit(0); |
| 105 | } | 105 | } |
| 106 | 106 | ||
| 107 | if (empty($aFolderSelection) && empty($aDocumentSelection)) { | 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 | exit(0); | 109 | exit(0); |
| 110 | - } | ||
| 111 | - | 110 | + } |
| 111 | + | ||
| 112 | // prepare for passing to bulk actions | 112 | // prepare for passing to bulk actions |
| 113 | $oActionRegistry =& KTActionRegistry::getSingleton(); | 113 | $oActionRegistry =& KTActionRegistry::getSingleton(); |
| 114 | $oAction =& $oActionRegistry->initializeAction($target, $this->oUser); | 114 | $oAction =& $oActionRegistry->initializeAction($target, $this->oUser); |
| 115 | - | 115 | + |
| 116 | if(!$oAction || PEAR::isError($oAction)) { | 116 | if(!$oAction || PEAR::isError($oAction)) { |
| 117 | - $this->errorRedirectToMain(_kt('No such action.')); | 117 | + $this->errorRedirectToBrowse(_kt('No such action.')); |
| 118 | exit(0); | 118 | exit(0); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| @@ -126,7 +126,7 @@ class KTActionDispatcher extends KTStandardDispatcher { | @@ -126,7 +126,7 @@ class KTActionDispatcher extends KTStandardDispatcher { | ||
| 126 | 126 | ||
| 127 | // exit(0); | 127 | // exit(0); |
| 128 | } | 128 | } |
| 129 | - | 129 | + |
| 130 | 130 | ||
| 131 | /** | 131 | /** |
| 132 | * Handle output from this dispatcher. | 132 | * Handle output from this dispatcher. |
lib/dispatcher.inc.php
| @@ -5,32 +5,32 @@ | @@ -5,32 +5,32 @@ | ||
| 5 | * KnowledgeTree Open Source Edition | 5 | * KnowledgeTree Open Source Edition |
| 6 | * Document Management Made Simple | 6 | * Document Management Made Simple |
| 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited | 7 | * Copyright (C) 2004 - 2007 The Jam Warehouse Software (Pty) Limited |
| 8 | - * | 8 | + * |
| 9 | * This program is free software; you can redistribute it and/or modify it under | 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 | 10 | * the terms of the GNU General Public License version 3 as published by the |
| 11 | * Free Software Foundation. | 11 | * Free Software Foundation. |
| 12 | - * | 12 | + * |
| 13 | * This program is distributed in the hope that it will be useful, but WITHOUT | 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 | 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 | 15 | * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 16 | * details. | 16 | * details. |
| 17 | - * | 17 | + * |
| 18 | * You should have received a copy of the GNU General Public License | 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/>. | 19 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | - * | 20 | + * |
| 21 | * You can contact The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, | 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. | 22 | * Blake Street, Observatory, 7925 South Africa. or email info@knowledgetree.com. |
| 23 | - * | 23 | + * |
| 24 | * The interactive user interfaces in modified source and object code versions | 24 | * The interactive user interfaces in modified source and object code versions |
| 25 | * of this program must display Appropriate Legal Notices, as required under | 25 | * of this program must display Appropriate Legal Notices, as required under |
| 26 | * Section 5 of the GNU General Public License version 3. | 26 | * Section 5 of the GNU General Public License version 3. |
| 27 | - * | 27 | + * |
| 28 | * In accordance with Section 7(b) of the GNU General Public License version 3, | 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 | 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 | * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices | 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 | * Contributor( s): ______________________________________ | 34 | * Contributor( s): ______________________________________ |
| 35 | * | 35 | * |
| 36 | */ | 36 | */ |
| @@ -234,6 +234,22 @@ class KTDispatcher { | @@ -234,6 +234,22 @@ class KTDispatcher { | ||
| 234 | return $this->redirectTo('main', $sQuery); | 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 | function handleOutput($sOutput) { | 253 | function handleOutput($sOutput) { |
| 238 | print $sOutput; | 254 | print $sOutput; |
| 239 | } | 255 | } |