Commit b6140065d1c29cea8934927bc63cc175b5d824cf
1 parent
5b0ca8b6
changed ui method name and moved multiple unsubscribe functionality to manageSubscriptionsBL.php
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1197 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
20 additions
and
1 deletions
presentation/lookAndFeel/knowledgeTree/subscriptions/removeSubscriptionBL.php
| @@ -64,7 +64,7 @@ if (checkSession()) { | @@ -64,7 +64,7 @@ if (checkSession()) { | ||
| 64 | } else { | 64 | } else { |
| 65 | // ask for confirmation | 65 | // ask for confirmation |
| 66 | $default->log->info("sub=" . arrayToString($oSubscription)); | 66 | $default->log->info("sub=" . arrayToString($oSubscription)); |
| 67 | - $oPatternCustom->setHtml(renderSubscriptionRemoveConfirmationPage($oSubscription)); | 67 | + $oPatternCustom->setHtml(renderRemoveConfirmationPage($oSubscription)); |
| 68 | } | 68 | } |
| 69 | } else { | 69 | } else { |
| 70 | // you're not subscribed | 70 | // you're not subscribed |
| @@ -76,7 +76,26 @@ if (checkSession()) { | @@ -76,7 +76,26 @@ if (checkSession()) { | ||
| 76 | $main->setCentralPayload($oPatternCustom); | 76 | $main->setCentralPayload($oPatternCustom); |
| 77 | $main->setFormAction($_SERVER["PHP_SELF"]); | 77 | $main->setFormAction($_SERVER["PHP_SELF"]); |
| 78 | $main->render(); | 78 | $main->render(); |
| 79 | + | ||
| 80 | + } else if ($fDocumentIDs || $fFolderIDs) { | ||
| 81 | + // multiple unsubscribes | ||
| 82 | + | ||
| 83 | + // unsubscribe folders | ||
| 79 | 84 | ||
| 85 | + // unsubscribe documents | ||
| 86 | + | ||
| 87 | + $oSubscription = & Subscription::getByIDs($iUserID, $iExternalID, $iSubscriptionType); | ||
| 88 | + // remove it | ||
| 89 | + if ($oSubscription->delete()) { | ||
| 90 | + $default->log->info("removeSubscriptionBL.php removed subscription for userID=$iUserID, subType=$iSubscriptionType, id=$iExternalID"); | ||
| 91 | + // redirect to viewFolder or viewDocument | ||
| 92 | + redirect($oSubscription->getContentUrl()); | ||
| 93 | + } else { | ||
| 94 | + // error removing subscription | ||
| 95 | + $default->log->error("removeSubscriptionBL.php error removing subscription for userID=$iUserID, subType=$iSubscriptionType, id=$iExternalID"); | ||
| 96 | + $oPatternCustom->setHtml(renderErrorPage("An error occurred while removing this subscription (" . $_SESSION["errorMessage"] . ")" )); | ||
| 97 | + } | ||
| 98 | + | ||
| 80 | } else { | 99 | } else { |
| 81 | // neither document or folder chosen | 100 | // neither document or folder chosen |
| 82 | $oPatternCustom->setHtml(renderErrorPage("You haven't chosen a folder or a document to unsubscribe from")); | 101 | $oPatternCustom->setHtml(renderErrorPage("You haven't chosen a folder or a document to unsubscribe from")); |