Commit 6ff2528b1dc43870b960445d7ddeea0c8905cc4f

Authored by Michael Joseph
1 parent 82f34a26

added document subscribe / unsubscribe buttons


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1181 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
... ... @@ -169,6 +169,14 @@ function getEditPage($oDocument) {
169 169 $sToRender .= "<td><a href=\"" . generateControllerLink("checkOutDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/checkout.gif\" border=\"0\" /></a></td>\n";
170 170 }
171 171  
  172 + // display the unsubscribe button if the user is subscribed to the document
  173 + if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) {
  174 + $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n";
  175 + // otherwise display the subscribe button
  176 + } else {
  177 + $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n";
  178 + }
  179 +
172 180 $sToRender .= "</tr>\n";
173 181 $sToRender .= "</table>\n";
174 182  
... ... @@ -209,6 +217,15 @@ function getViewPage($oDocument) {
209 217 $sToRender .= "<tr>\n";
210 218 $sToRender .= "<td><a href=\"" . $_SERVER["PHP_SELF"] . "?fDocumentID=" . $oDocument->getID() . "&fForDownload=1\"><img src=\"$default->graphicsUrl/widgets/download.gif\" border=\"0\" /></a></td>\n";
211 219 $sToRender .= "<td><a href=\"" . generateControllerLink("emailDocument", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/email.gif\" border=\"0\" /></a></td>\n";
  220 +
  221 + // display the unsubscribe button if the user is subscribed to the document
  222 + if (Subscription::exists($_SESSION["userID"], $oDocument->getID(), SubscriptionConstants::subscriptionType("DocumentSubscription"))) {
  223 + $sToRender .= "<td><a href=\"" . generateControllerLink("removeSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/unsubscribe.gif\" border=\"0\" /></a></td>\n";
  224 + // otherwise display the subscribe button
  225 + } else {
  226 + $sToRender .= "<td><a href=\"" . generateControllerLink("addSubscription", "fDocumentID=" . $oDocument->getID()) . "\"><img src=\"$default->graphicsUrl/widgets/subscribe.gif\" border=\"0\" /></a></td>\n";
  227 + }
  228 +
212 229 $sToRender .= "</tr>\n";
213 230 $sToRender .= "</table>\n";
214 231  
... ...