diff --git a/action.php b/action.php index 6ac9d14..162a891 100644 --- a/action.php +++ b/action.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 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 The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. 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 - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -86,35 +86,35 @@ class KTActionDispatcher extends KTStandardDispatcher { function do_bulkaction() { $act = (array) KTUtil::arrayGet($_REQUEST, 'submit',null); - + $targets = array_keys($act); if (!empty($targets)) { $target = $targets[0]; } else { - $this->errorRedirectToMain(_kt('No action selected.')); + $this->errorRedirectToBrowse(_kt('No action selected.')); exit(0); } $aFolderSelection = KTUtil::arrayGet($_REQUEST, 'selection_f' , array()); - $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array()); + $aDocumentSelection = KTUtil::arrayGet($_REQUEST, 'selection_d' , array()); $oFolder = Folder::get(KTUtil::arrayGet($_REQUEST, 'fFolderId', 1)); - if (PEAR::isError($oFolder)) { - $this->errorRedirectToMain(_kt('Invalid folder selected.')); + if (PEAR::isError($oFolder)) { + $this->errorRedirectToBrowse(_kt('Invalid folder selected.')); exit(0); } if (empty($aFolderSelection) && empty($aDocumentSelection)) { - $this->errorRedirectToMain(_kt('Please select documents or folders first.'), sprintf('fFolderId=%d', $oFolder->getId())); + $this->errorRedirectToBrowse(_kt('Please select documents or folders first.'), sprintf('fFolderId=%d', $oFolder->getId())); exit(0); - } - + } + // prepare for passing to bulk actions $oActionRegistry =& KTActionRegistry::getSingleton(); $oAction =& $oActionRegistry->initializeAction($target, $this->oUser); - + if(!$oAction || PEAR::isError($oAction)) { - $this->errorRedirectToMain(_kt('No such action.')); + $this->errorRedirectToBrowse(_kt('No such action.')); exit(0); } @@ -126,7 +126,7 @@ class KTActionDispatcher extends KTStandardDispatcher { // exit(0); } - + /** * Handle output from this dispatcher. diff --git a/lib/dispatcher.inc.php b/lib/dispatcher.inc.php index 81c1192..0c7f34e 100644 --- a/lib/dispatcher.inc.php +++ b/lib/dispatcher.inc.php @@ -5,32 +5,32 @@ * KnowledgeTree Open Source Edition * Document Management Made Simple * Copyright (C) 2004 - 2007 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 The Jam Warehouse Software (Pty) Limited, Unit 1, Tramber Place, * Blake Street, Observatory, 7925 South Africa. 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 - * copyright notice. + * must display the words "Powered by KnowledgeTree" and retain the original + * copyright notice. * Contributor( s): ______________________________________ * */ @@ -234,6 +234,22 @@ class KTDispatcher { return $this->redirectTo('main', $sQuery); } + function errorRedirectToBrowse($sErrorMessage, $sQuery = "", $event = 'main') { + if ($this->bTransactionStarted) { + $this->rollbackTransaction(); + } + + $_SESSION['KTErrorMessage'][] = $sErrorMessage; + + // meld persistant options + $sQuery = $this->meldPersistQuery($sQuery, $event); + + $server = str_replace('action.php', 'browse.php', $_SERVER['PHP_SELF']); + $sRedirect = KTUtil::addQueryString($server, $sQuery); + $this->oRedirector->redirect($sRedirect); + exit(0); + } + function handleOutput($sOutput) { print $sOutput; }