Commit 72f624dd65b0d2edf4fea94d3d1d6dca1aa16b40

Authored by nbm
1 parent 45a81121

Moved into the plugins system


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4136 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/subscriptions/manageSubscriptionsBL.php deleted
1 -<?php  
2 -  
3 -require_once("../../../../config/dmsDefaults.php");  
4 -  
5 -KTUtil::extractGPC('fConfirmed', 'fDocumentSubscriptionIDs', 'fFolderSubscriptionIDs');  
6 -  
7 -require_once("$default->fileSystemRoot/lib/subscriptions/Subscription.inc");  
8 -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");  
9 -require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");  
10 -require_once("subscriptionUI.inc");  
11 -require_once("$default->fileSystemRoot/presentation/Html.inc");  
12 -/**  
13 - * $Id$  
14 - *  
15 - * Manages subscriptions- displays all current subscriptions and allows  
16 - * multiple unsubscribes.  
17 - *  
18 - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com  
19 - *  
20 - * This program is free software; you can redistribute it and/or modify  
21 - * it under the terms of the GNU General Public License as published by  
22 - * the Free Software Foundation; either version 2 of the License, or  
23 - * (at your option) any later version.  
24 - *  
25 - * This program is distributed in the hope that it will be useful,  
26 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
27 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
28 - * GNU General Public License for more details.  
29 - *  
30 - * You should have received a copy of the GNU General Public License  
31 - * along with this program; if not, write to the Free Software  
32 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
33 - *  
34 - * @version $Revision$  
35 - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa  
36 - * @package subscriptions  
37 - */  
38 -  
39 -// only if we have a valid session  
40 -if (checkSession()) {  
41 -  
42 - $oPatternCustom = & new PatternCustom();  
43 -  
44 - if (isset($fFolderSubscriptionIDs) || isset($fDocumentSubscriptionIDs)) {  
45 - // we've got subscriptions to remove,  
46 - $aFolderSubscriptions = array();  
47 - $aDocumentSubscriptions = array();  
48 -  
49 - for ($i = 0; $i < count($fFolderSubscriptionIDs); $i++) {  
50 - $aFolderSubscriptions[] = & Subscription::get($fFolderSubscriptionIDs[$i], SubscriptionConstants::subscriptionType("FolderSubscription"));  
51 - }  
52 - for ($i = 0; $i < count($fDocumentSubscriptionIDs); $i++) {  
53 - $aDocumentSubscriptions[] = & Subscription::get($fDocumentSubscriptionIDs[$i], SubscriptionConstants::subscriptionType("DocumentSubscription"));  
54 - }  
55 -  
56 - if (isset($fConfirmed)) {  
57 - // remove subscriptions  
58 - $oSubscriptions = array_merge($aFolderSubscriptions, $aDocumentSubscriptions);  
59 -  
60 - $sErrorMessage = "";  
61 - for ($i = 0; $i < count($oSubscriptions); $i++) {  
62 - if ($oSubscriptions[$i]->delete()) {  
63 - $default->log->info("manageSubscriptionBL.php removed subscription for userID=$iUserID, subType=$iSubscriptionType, id=$iExternalID");  
64 - } else {  
65 - // error removing subscription  
66 - $default->log->error("manageSubscriptionBL.php error removing subscription=" . $oSubscriptions[$i]);  
67 - // add to error message  
68 - if (strlen($sErrorMessage) > 0) {  
69 - $sErrorMessage .= ", ";  
70 - }  
71 - $sErrorMessage .= $oSubscriptions[$i]->getContentDisplayPath();  
72 - }  
73 - }  
74 - if (strlen($sErrorMessage) > 0) {  
75 - $oPatternCustom->setHtml(renderErrorPage(_("There were errors removing the following subscriptions:") . $sErrorMessage));  
76 - } else {  
77 - // display the manage subscriptions page  
78 - $oPatternCustom->setHtml(renderManagePage());  
79 - }  
80 - } else {  
81 - // display confirmation page  
82 - $oPatternCustom->setHtml(renderMultipleRemoveConfirmationPage($aFolderSubscriptions, $aDocumentSubscriptions));  
83 - }  
84 - } else {  
85 - // display the manage subscriptions page  
86 - $oPatternCustom->setHtml(renderManagePage());  
87 - }  
88 -  
89 - require_once("../../../webpageTemplate.inc");  
90 - $main->setCentralPayload($oPatternCustom);  
91 - $main->setFormAction($_SERVER["PHP_SELF"]);  
92 - $main->render();  
93 -}  
94 -?>  
presentation/lookAndFeel/knowledgeTree/subscriptions/subscriptionUI.inc deleted
1 -<?php  
2 -/**  
3 - * $Id$  
4 - *  
5 - * UI for subscription pages.  
6 - *  
7 - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com  
8 - *  
9 - * This program is free software; you can redistribute it and/or modify  
10 - * it under the terms of the GNU General Public License as published by  
11 - * the Free Software Foundation; either version 2 of the License, or  
12 - * (at your option) any later version.  
13 - *  
14 - * This program is distributed in the hope that it will be useful,  
15 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
16 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
17 - * GNU General Public License for more details.  
18 - *  
19 - * You should have received a copy of the GNU General Public License  
20 - * along with this program; if not, write to the Free Software  
21 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
22 - *  
23 - * @version $Revision$  
24 - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa  
25 - * @package subscriptions  
26 - */  
27 -  
28 -/**  
29 - * Displays all current subscriptions with remove checkbox  
30 - */  
31 -function renderManagePage() {  
32 - global $default;  
33 -  
34 - // retrieve subscriptions for this user  
35 - $aFolderSubscriptions = SubscriptionManager::retrieveUserSubscriptions($_SESSION["userID"], SubscriptionConstants::subscriptionType("FolderSubscription"));  
36 - $aDocumentSubscriptions = SubscriptionManager::retrieveUserSubscriptions($_SESSION["userID"], SubscriptionConstants::subscriptionType("DocumentSubscription"));  
37 - $bNoSubscriptions = ( (count($aFolderSubscriptions) == 0) && (count($aDocumentSubscriptions) == 0) ) ? true : false;  
38 -  
39 - $sToRender = renderHeading(_("Subscriptions"), "Subscriptions");  
40 - $sToRender .= "<table width=\"600\">\n";  
41 - if ($bNoSubscriptions) {  
42 - $sToRender .= "<tr><td>" . _("You are not subscribed to any documents or folders.") . "</td></tr>\n";  
43 - } else {  
44 - $sToRender .= "<tr><td>" . _("The documents and folders you're subscribed to are listed below.") . "</td></tr>\n";  
45 - $sToRender .= "<tr><td>" . _("Select the subscriptions you'd like to unsubscribe from, and click 'Unsubscribe'") . "</td></tr>\n";  
46 - }  
47 - $sToRender .= "<tr/>\n";  
48 - $sToRender .= "<tr/>\n";  
49 - $sToRender .= "<tr/>\n";  
50 - $sToRender .= "<tr/>\n";  
51 -  
52 - // loop through them  
53 - for ($i = 0; $i < count($aFolderSubscriptions); $i++) {  
54 - $sToRender .= "\t<tr>\n";  
55 - $sToRender .= "\t\t<td bgcolor=\"" . getColour($i) . "\">\n";  
56 - $sToRender .= "<input type=\"checkbox\" name=\"fFolderSubscriptionIDs[]\" value=\"" . $aFolderSubscriptions[$i]->getID() . "\"/>\n";  
57 - if ($aFolderSubscriptions[$i]->getIsAlerted()) {  
58 - $sToRender .= $aFolderSubscriptions[$i]->getAlertLink() . "\n";  
59 - } else {  
60 - $sToRender .= $aFolderSubscriptions[$i]->getContentLink() . "\n";  
61 - }  
62 - $sToRender .= "\t\t</td>\n";  
63 - $sToRender .= "\t</tr>\n";  
64 - }  
65 - for ($i = 0; $i < count($aDocumentSubscriptions); $i++) {  
66 - $sToRender .= "\t<tr>\n";  
67 - $sToRender .= "\t\t<td bgcolor=\"" . getColour($i+count($aFolderSubscriptions)) . "\">\n";  
68 - $sToRender .= "<input type=\"checkbox\" name=\"fDocumentSubscriptionIDs[]\" value=\"" . $aDocumentSubscriptions[$i]->getID() . "\"/>\n";  
69 - if ($aDocumentSubscriptions[$i]->getIsAlerted()) {  
70 - $sToRender .= $aDocumentSubscriptions[$i]->getAlertLink() . "\n";  
71 - } else {  
72 - $sToRender .= $aDocumentSubscriptions[$i]->getContentLink() . "\n";  
73 - }  
74 - $sToRender .= "\t\t</td>\n";  
75 - $sToRender .= "\t</tr>\n";  
76 - }  
77 -  
78 - $sToRender .= "<tr/>\n";  
79 - $sToRender .= "<tr/>\n";  
80 - $sToRender .= "<tr><td>";  
81 - if (!$bNoSubscriptions) {  
82 - $sToRender .= "<input type=\"image\" src=\"" . KTHtml::getUnsubscribeButton() . "\" border=\"0\"/></a>\n";  
83 - }  
84 - $sToRender .= "</td></tr>\n";  
85 - $sToRender .= "</table>\n";  
86 -  
87 - return $sToRender;  
88 -}  
89 -  
90 -/**  
91 - * Asks for confirmation for removing multiple subscriptions  
92 - *  
93 - * @param array subscriptions to remove  
94 - */  
95 -function renderMultipleRemoveConfirmationPage($aFolderSubscriptions, $aDocumentSubscriptions) {  
96 - global $default;  
97 -  
98 - $sToRender = renderHeading(_("Subscriptions"), "Subscriptions");  
99 - $sToRender .= "<table width=\"600\">\n";  
100 - $sToRender .= "<tr><td>" . _("You have chosen to delete the following subscription(s):") . "</td></tr>\n";  
101 - $sToRender .= "<tr/>\n";  
102 - $sToRender .= "<tr/>\n";  
103 -  
104 - // loop through them  
105 - for ($i = 0; $i < count($aFolderSubscriptions); $i++) {  
106 - $sToRender .= "\t<tr>\n";  
107 - $sToRender .= "\t\t<td bgcolor=\"" . getColour($i) . "\">\n";  
108 - $sToRender .= $aFolderSubscriptions[$i]->getContentDisplayPath() . "\n";  
109 - $sToRender .= "\t\t</td>\n";  
110 - $sToRender .= "\t</tr>\n";  
111 - $sToRender .= "<input type=\"hidden\" name=\"fFolderSubscriptionIDs[]\" value=\"" . $aFolderSubscriptions[$i]->getID() . "\"/>";  
112 - }  
113 -  
114 - for ($i = 0; $i < count($aDocumentSubscriptions); $i++) {  
115 - $sToRender .= "\t<tr>\n";  
116 - $sToRender .= "\t\t<td bgcolor=\"" . getColour($i) . "\">\n";  
117 - $sToRender .= $aDocumentSubscriptions[$i]->getContentDisplayPath() . "\n";  
118 - $sToRender .= "\t\t</td>\n";  
119 - $sToRender .= "\t</tr>\n";  
120 - $sToRender .= "<input type=\"hidden\" name=\"fDocumentSubscriptionIDs[]\" value=\"" . $aDocumentSubscriptions[$i]->getID() . "\"/>";  
121 - }  
122 -  
123 - $sToRender .= "<tr/>\n";  
124 - $sToRender .= "<tr/>\n";  
125 - $sToRender .= "<tr/>\n";  
126 - $sToRender .= "<tr/>\n";  
127 - $sToRender .= "<td>" . _("Select 'Unsubscribe' to confirm the deletion(s), or 'Cancel' to cancel them") . "</td>\n";  
128 - $sToRender .= "<tr/>\n";  
129 - $sToRender .= "<tr/>\n";  
130 - $sToRender .= "<input type=\"hidden\" name=\"fConfirmed\" value=\"1\"/>";  
131 - $sToRender .= "<tr><td><input type=\"image\" src=\"" . KTHtml::getUnsubscribeButton() . "\" border=\"0\"/></a>\n";  
132 - $sToRender .= "<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td>\n";  
133 - $sToRender .= "</tr>\n";  
134 - $sToRender .= "</table>\n";  
135 -  
136 - return $sToRender;  
137 -}  
138 -  
139 - /**  
140 - * Confirms the users subscription deletion  
141 - *  
142 - * @param object the subscription  
143 - */  
144 -function renderRemoveConfirmationPage($oSubscription) {  
145 - global $default;  
146 -  
147 - $sContentType = $oSubscription->getSubscriptionTypeName();  
148 - if ($sContentType == "folder") {  
149 - $sContentName = Folder::getFolderName($oSubscription->getExternalID());  
150 - $sContentUrl = "fFolderID=" . $oSubscription->getExternalID();  
151 - } else {  
152 - $sContentName = Document::getDocumentName($oSubscription->getExternalID());  
153 - $sContentUrl = "fDocumentID=" . $oSubscription->getExternalID();  
154 - }  
155 -  
156 - $sToRender = renderHeading(_("Subscriptions"), "Subscriptions");  
157 - $sToRender .= "<table width=\"600\">\n";  
158 - $sToRender .= "<tr><td>" . _("You have chosen to delete your subscription to:") . " '$sContentName'.</td></tr>\n";  
159 - $sToRender .= "<tr/>\n";  
160 - $sToRender .= "<tr/>\n";  
161 - $sToRender .= "<td>" . _("Select 'Unsubscribe' to confirm the deletion, or 'Cancel' to cancel it") . "</td>\n";  
162 - $sToRender .= "</tr>\n";  
163 - $sToRender .= "<tr/>\n";  
164 - $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=removeSubscription&$sContentUrl&fConfirmed=1\"><img src =\"" . KTHtml::getUnsubscribeButton() . "\" border=\"0\"/></a>\n";  
165 - $sToRender .= "<a href=\"" . $oSubscription->getContentUrl() . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td>\n";  
166 - $sToRender .= "</tr>\n";  
167 - $sToRender .= "</table>\n";  
168 -  
169 - return $sToRender;  
170 -}  
171 -  
172 -/**  
173 - * Confirms the users subscription addition  
174 - *  
175 - * @param object the subscription  
176 - */  
177 -function renderAddConfirmationPage($oSubscription) {  
178 - global $default;  
179 -  
180 - $sContentType = $oSubscription->getSubscriptionTypeName();  
181 - if ($sContentType == "folder") {  
182 - $sContentName = Folder::getFolderName($oSubscription->getExternalID());  
183 - $sContentUrl = "fFolderID=" . $oSubscription->getExternalID();  
184 - } else {  
185 - $sContentName = Document::getDocumentName($oSubscription->getExternalID());  
186 - $sContentUrl = "fDocumentID=" . $oSubscription->getExternalID();  
187 - }  
188 -  
189 - $sToRender = renderHeading(_("Subscriptions"), "Subscriptions");  
190 - $sToRender .= "<table width=\"600\">\n";  
191 - $sToRender .= "<tr><td>" . _("You have chosen to subscribe to:") . " '$sContentName'.</td></tr>\n";  
192 - $sToRender .= "<tr/>\n";  
193 - $sToRender .= "<tr>\n";  
194 - $sToRender .= "<td>" . _("Select 'Subscribe' to confirm the subscription, or 'Cancel' to cancel it") . "</td>\n";  
195 - $sToRender .= "</tr>\n";  
196 - $sToRender .= "<tr/>\n";  
197 - $sToRender .= "<tr><td><a href=\"$default->rootUrl/control.php?action=addSubscription&$sContentUrl&fConfirmed=1\"><img src =\"" . KTHtml::getSubscribeButton() . "\" border=\"0\"/></a>\n";  
198 - $sToRender .= "<a href=\"" . $oSubscription->getContentUrl() . "\"><img src=\"" . KTHtml::getCancelButton() . "\" border=\"0\"></a></td>\n";  
199 - $sToRender .= "</tr>\n";  
200 - $sToRender .= "</table>\n";  
201 -  
202 - return $sToRender;  
203 -}  
204 -  
205 -function renderErrorPage($sErrorMessage) {  
206 - global $default;  
207 - $sToRender = renderHeading(_("Subscriptions"), "Subscriptions");  
208 - $sToRender .= "<table>\n";  
209 - $sToRender .= "<tr><td><p class=\"errorText\">$sErrorMessage</p>\n" .  
210 - "<a href=\"javascript:history.go(-1)\"><img src=\"" . KTHtml::getBackButton() . "\" border=\"0\"/></a>\n" .  
211 - "</p></td></tr></table>\n";  
212 - return $sToRender;  
213 -}  
214 -?>  
presentation/lookAndFeel/knowledgeTree/subscriptions/viewAlertBL.php deleted
1 -<?php  
2 -  
3 -require_once("../../../../config/dmsDefaults.php");  
4 -  
5 -KTUtil::extractGPC('fSubscriptionID', 'fSubscriptionType');  
6 -  
7 -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc");  
8 -/**  
9 - * $Id$  
10 - *  
11 - * Clears the subscription alert, and forwards to the content that  
12 - * triggered the alert.  
13 - *  
14 - * Querystring variables  
15 - * ---------------------  
16 - * fSubscriptionID - the subscription to view  
17 - * fSubscriptionType - the subscription type (folder,document) to view  
18 - *  
19 - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com  
20 - *  
21 - * This program is free software; you can redistribute it and/or modify  
22 - * it under the terms of the GNU General Public License as published by  
23 - * the Free Software Foundation; either version 2 of the License, or  
24 - * (at your option) any later version.  
25 - *  
26 - * This program is distributed in the hope that it will be useful,  
27 - * but WITHOUT ANY WARRANTY; without even the implied warranty of  
28 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
29 - * GNU General Public License for more details.  
30 - *  
31 - * You should have received a copy of the GNU General Public License  
32 - * along with this program; if not, write to the Free Software  
33 - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA  
34 - *  
35 - * @version $Revision$  
36 - * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa  
37 - * @package subscriptions  
38 - */  
39 -  
40 -// only if we have a valid session  
41 -if (checkSession()) {  
42 -  
43 - $default->log->debug("subID=$fSubscriptionID, type=$fSubscriptionType");  
44 - // retrieve variables  
45 - if ((!$fSubscriptionID) || (!$fSubscriptionType)) {  
46 - require_once("../../../webpageTemplate.inc");  
47 - $main->setErrorMessage(_("You have not selected a subscription alert"));  
48 - $oPatternCustom = & new PatternCustom();  
49 - $main->setCentralPayload($oPatternCustom);  
50 - $main->setFormAction($_SERVER["PHP_SELF"]);  
51 - $main->render();  
52 - } else {  
53 -  
54 - // instantiate the subscription manager  
55 - $oSubscriptionManager = new SubscriptionManager();  
56 - // clear the subscription alert and return the url to redirect to  
57 - $sContentUrl = SubscriptionManager::viewSubscription($fSubscriptionID, $fSubscriptionType);  
58 - if ($sContentUrl) {  
59 - $default->log->debug("retrieved $sContentUrl from viewSubscription");  
60 - // now redirect  
61 - redirect($sContentUrl);  
62 - } else {  
63 - // viewSubscription called failed  
64 - require_once("../../../webpageTemplate.inc");  
65 - $main->setErrorMessage(_("This subscription alert does not exist."));  
66 - $oPatternCustom = & new PatternCustom();  
67 - $main->setCentralPayload($oPatternCustom);  
68 - $main->setFormAction($_SERVER["PHP_SELF"]);  
69 - $main->render();  
70 - }  
71 - }  
72 -}  
73 -?>