Commit 3093f017b0e66a63ece064761f2942f217fca50e

Authored by Michael Joseph
1 parent 9499abfe

initial revision of alert viewing page (clears alert and redirects)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@912 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/subscriptions/viewAlertBL.php 0 → 100644
  1 +<?php
  2 +
  3 +require_once("../../../../config/dmsDefaults.php");
  4 +require_once("$default->owl_fs_root/lib/subscriptions/SubscriptionManager.inc");
  5 +
  6 +/**
  7 + * $Id$
  8 + *
  9 + * Clears the subscription alert, and forwards to the content that
  10 + * triggered the alert.
  11 + *
  12 + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING.
  13 + *
  14 + * @version $Revision$
  15 + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa
  16 + * @package presentation.lookAndFeel.knowledgeTree.subscriptions
  17 + */
  18 +
  19 +/*
  20 + * Querystring variables
  21 + * ---------------------
  22 + * fSubscriptionID - the subscription to view
  23 + * fSubscriptionType - the subscription type (folder,document) to view
  24 + */
  25 +
  26 +// -------------------------------
  27 +// page start
  28 +// -------------------------------
  29 +
  30 +// only if we have a valid session
  31 +if (checkSession()) {
  32 +
  33 + $default->log->debug("subID=$fSubscriptionID, type=$fSubscriptionType");
  34 + // retrieve variables
  35 + if ((!$fSubscriptionID) || (!$fSubscriptionType)) {
  36 + require_once("../../../webpageTemplate.inc");
  37 + $main->setErrorMessage("You have not selected a subscription alert");
  38 + $oPatternCustom = & new PatternCustom();
  39 + $main->setCentralPayload($oPatternCustom);
  40 + $main->setFormAction($_SERVER["PHP_SELF"]);
  41 + $main->render();
  42 + } else {
  43 +
  44 + // instantiate the subscription manager
  45 + $oSubscriptionManager = new SubscriptionManager();
  46 + // clear the subscription alert and return the url to redirect to
  47 + $sContentUrl = SubscriptionManager::viewSubscription($fSubscriptionID, $fSubscriptionType);
  48 + if ($sContentUrl) {
  49 + $default->log->debug("retrieved $sContentUrl from viewSubscription");
  50 + // now redirect
  51 + redirect($sContentUrl);
  52 + } else {
  53 + // viewSubscription called failed
  54 + require_once("../../../webpageTemplate.inc");
  55 + $main->setErrorMessage("This subscription alert does not exist (" . $_SESSION["errorMessage"] . ")");
  56 + $oPatternCustom = & new PatternCustom();
  57 + $main->setCentralPayload($oPatternCustom);
  58 + $main->setFormAction($_SERVER["PHP_SELF"]);
  59 + $main->render();
  60 + }
  61 + }
  62 +} else {
  63 + // redirect to no permission page
  64 + redirect("$default->owl_ui_url/noAccess.php");
  65 +}
  66 +?>