Commit 236db07a61e480809c19df144a2f0c427b93c367
1 parent
3e0ed804
integrated dashboard news into dashboard
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1800 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
7 changed files
with
342 additions
and
126 deletions
lib/dashboard/Dashboard.inc
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); | |
| 4 | +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); | |
| 5 | +require_once("$default->fileSystemRoot/lib/links/link.inc"); | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * $Id$ | |
| 9 | + * | |
| 10 | + * Contains dashboard helper functions | |
| 11 | + * | |
| 12 | + * Licensed under the GNU GPL. For full terms see the file COPYING. | |
| 13 | + * | |
| 14 | + * @version $Revision$ | |
| 15 | + * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa | |
| 16 | + * @package lib.dashboard | |
| 17 | + */ | |
| 18 | + | |
| 19 | +class Dashboard { | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * The user id of the user viewing the dashboard | |
| 23 | + */ | |
| 24 | + var $iUserID; | |
| 25 | + | |
| 26 | + /** | |
| 27 | + * Constructs a new instance of the Dashboard | |
| 28 | + * @param integer the user id of the current user | |
| 29 | + */ | |
| 30 | + function Dashboard($iUserID){ | |
| 31 | + $this->iUserID = $iUserID; | |
| 32 | + } | |
| 33 | + | |
| 34 | + /** | |
| 35 | + * Retrieves the collaboration documents that the current user has pending | |
| 36 | + * | |
| 37 | + * @param integer the user to retrieve pending collaboration documents for | |
| 38 | + */ | |
| 39 | + function getPendingCollaborationDocuments(){ | |
| 40 | + global $default; | |
| 41 | + | |
| 42 | + $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID; | |
| 43 | + $aDocumentList = array(); | |
| 44 | + $sql = $default->db; | |
| 45 | + if ($sql->query($sQuery)) { | |
| 46 | + while ($sql->next_record()) { | |
| 47 | + $aDocumentList[] = & Document::get($sql->f("document_id")); | |
| 48 | + } | |
| 49 | + } | |
| 50 | + return $aDocumentList; | |
| 51 | + } | |
| 52 | + | |
| 53 | + /** | |
| 54 | + * Retrieve checked out documents for this user | |
| 55 | + * | |
| 56 | + * @return array of documents | |
| 57 | + */ | |
| 58 | + function getCheckedOutDocuments(){ | |
| 59 | + return Document::getList("checked_out_user_id=" . $this->iUserID); | |
| 60 | + } | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * Retrieve subscription alerts for this user. | |
| 64 | + * | |
| 65 | + * @return array of subscription alerts | |
| 66 | + */ | |
| 67 | + function getSubscriptionAlerts(){ | |
| 68 | + return SubscriptionManager::listSubscriptionAlerts($this->iUserID); | |
| 69 | + } | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * Retrieve quicklinks | |
| 73 | + * | |
| 74 | + * @return array of link objects | |
| 75 | + */ | |
| 76 | + function getQuickLinks(){ | |
| 77 | + return Link::getList("ORDER BY rank"); | |
| 78 | + } | |
| 79 | + | |
| 80 | + /** | |
| 81 | + * Retrieves the web documents that the current user has pending | |
| 82 | + * | |
| 83 | + * @param integer the user to retrieve pending web documents for | |
| 84 | + */ | |
| 85 | + function getPendingWebDocuments(){ | |
| 86 | + global $default; | |
| 87 | + $sQuery = "SELECT wd.id FROM web_documents wd " . | |
| 88 | + "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . | |
| 89 | + "WHERE ws.web_master_id=" . $this->iUserID . " AND wd.status_id=1"; | |
| 90 | + $aDocumentList = array(); | |
| 91 | + $sql = $default->db; | |
| 92 | + if ($sql->query($sQuery)) { | |
| 93 | + while ($sql->next_record()) { | |
| 94 | + $aDocumentList[] = & WebDocument::get($sql->f("id")); | |
| 95 | + } | |
| 96 | + } | |
| 97 | + return $aDocumentList; | |
| 98 | + } | |
| 99 | +} | |
| 0 | 100 | \ No newline at end of file | ... | ... |
lib/dashboard/DashboardNews.inc
| ... | ... | @@ -11,7 +11,7 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentMa |
| 11 | 11 | * |
| 12 | 12 | * @version $Revision$ |
| 13 | 13 | * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa |
| 14 | - * @package lib.authentication | |
| 14 | + * @package lib.dashboard | |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | class DashboardNews { |
| ... | ... | @@ -44,6 +44,14 @@ class DashboardNews { |
| 44 | 44 | * The mime type id of the image |
| 45 | 45 | */ |
| 46 | 46 | var $iImageMimeTypeID; |
| 47 | + /** | |
| 48 | + * The maximum allowable width of an image | |
| 49 | + */ | |
| 50 | + var $iMaxImageWidth = 80; | |
| 51 | + /** | |
| 52 | + * The maximum allowable height of an image | |
| 53 | + */ | |
| 54 | + var $iMaxImageHeight = 40; | |
| 47 | 55 | |
| 48 | 56 | /** |
| 49 | 57 | * Constructs a news item |
| ... | ... | @@ -53,6 +61,8 @@ class DashboardNews { |
| 53 | 61 | * @param integer the rank |
| 54 | 62 | */ |
| 55 | 63 | function DashboardNews($sNewSynopsis, $sNewBody, $iNewRank, $mImage = "") { |
| 64 | + global $default; | |
| 65 | + | |
| 56 | 66 | // primary key not set as document is not stored yet |
| 57 | 67 | $this->iId = -1; |
| 58 | 68 | $this->setSynopsis($sNewSynopsis); |
| ... | ... | @@ -64,11 +74,16 @@ class DashboardNews { |
| 64 | 74 | $this->setImage($mImage["image"]); |
| 65 | 75 | $this->setImageSize($mImage["filesize"]); |
| 66 | 76 | $this->setImageMimeTypeID($mImage["mimetypeid"]); |
| 67 | - } else { | |
| 77 | + } else if (strlen($mImage) > 0){ | |
| 68 | 78 | if (file_exists($mImage)) { |
| 69 | 79 | // we've been passed a file, so read it in |
| 70 | 80 | $this->setImageFile($mImage); |
| 71 | 81 | } |
| 82 | + } else { | |
| 83 | + // initialise | |
| 84 | + $this->setImage(""); | |
| 85 | + $this->setImageSize(0); | |
| 86 | + $this->setImageMimeTypeID(0); | |
| 72 | 87 | } |
| 73 | 88 | } |
| 74 | 89 | |
| ... | ... | @@ -103,6 +118,13 @@ class DashboardNews { |
| 103 | 118 | } |
| 104 | 119 | |
| 105 | 120 | /** |
| 121 | + * Returns a fragment of the body | |
| 122 | + */ | |
| 123 | + function getBodyFragment() { | |
| 124 | + return substr($this->sBody, 0, 50); | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 106 | 128 | * Sets the body |
| 107 | 129 | * |
| 108 | 130 | * @param string the new news body |
| ... | ... | @@ -174,6 +196,47 @@ class DashboardNews { |
| 174 | 196 | */ |
| 175 | 197 | function setImageMimeTypeID($iNewMimeTypeID) { |
| 176 | 198 | $this->iImageMimeTypeID = $iNewMimeTypeID; |
| 199 | + } | |
| 200 | + | |
| 201 | + /** | |
| 202 | + * Retrieve the maximum image width | |
| 203 | + */ | |
| 204 | + function getMaxImageWidth() { | |
| 205 | + return $this->iMaxImageWidth; | |
| 206 | + } | |
| 207 | + | |
| 208 | + /** | |
| 209 | + * Set the maximum image width | |
| 210 | + * | |
| 211 | + * @param integer the maximum image width | |
| 212 | + */ | |
| 213 | + function setMaxImageWidth($iNewMaxImageWidth) { | |
| 214 | + $this->iMaxImageWidth = $iNewMaxImageWidth; | |
| 215 | + } | |
| 216 | + | |
| 217 | + /** | |
| 218 | + * Retrieve the maximum image height | |
| 219 | + */ | |
| 220 | + function getMaxImageHeight() { | |
| 221 | + return $this->iMaxImageHeight; | |
| 222 | + } | |
| 223 | + | |
| 224 | + /** | |
| 225 | + * Set the maximum image height | |
| 226 | + * | |
| 227 | + * @param integer the maximum image height | |
| 228 | + */ | |
| 229 | + function setMaxImageHeight($iNewMaxImageHeight) { | |
| 230 | + $this->iMaxImageHeight = $iNewMaxImageHeight; | |
| 231 | + } | |
| 232 | + | |
| 233 | + /** | |
| 234 | + * Returns the maximum dimensions as a string | |
| 235 | + * | |
| 236 | + * @param string the maximum image dimensions | |
| 237 | + */ | |
| 238 | + function getMaxImageDimensions() { | |
| 239 | + return $this->iMaxImageWidth . "x" . $this->iMaxImageHeight; | |
| 177 | 240 | } |
| 178 | 241 | |
| 179 | 242 | /** |
| ... | ... | @@ -191,8 +254,10 @@ class DashboardNews { |
| 191 | 254 | * @param string path to the image on the filesystem |
| 192 | 255 | */ |
| 193 | 256 | function setImageFile($sPathToImage){ |
| 257 | + global $default; | |
| 258 | + $default->log->info("set image file called with $sPathToImage"); | |
| 194 | 259 | if (file_exists($sPathToImage)) { |
| 195 | - $aImage = $this->imageToString($sPathToImage); | |
| 260 | + $aImage = $this->readInImage($sPathToImage); | |
| 196 | 261 | $this->sImage = $aImage["image"]; |
| 197 | 262 | $this->iImageSize = $aImage["filesize"]; |
| 198 | 263 | $this->iImageMimeTypeID = $aImage["mimetypeid"]; |
| ... | ... | @@ -301,14 +366,14 @@ class DashboardNews { |
| 301 | 366 | global $default; |
| 302 | 367 | $aDashboardNewsArray = array(); |
| 303 | 368 | $sql = $default->db; |
| 304 | - $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); | |
| 369 | + $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC"); | |
| 305 | 370 | if ($result) { |
| 306 | 371 | $iCount = 0; |
| 307 | 372 | while ($sql->next_record()) { |
| 308 | 373 | $oDashboardNews = & DashboardNews::get($sql->f("id")); |
| 309 | 374 | $aDashboardNewsArray[$iCount++] = $oDashboardNews; |
| 310 | 375 | } |
| 311 | - return $aDocumentArray; | |
| 376 | + return $aDashboardNewsArray; | |
| 312 | 377 | } |
| 313 | 378 | return false; |
| 314 | 379 | } |
| ... | ... | @@ -319,7 +384,7 @@ class DashboardNews { |
| 319 | 384 | * @param string path to the image file |
| 320 | 385 | * @return string the image as a string |
| 321 | 386 | */ |
| 322 | - function imageToString($sImagePath) { | |
| 387 | + function readInImage($sImagePath) { | |
| 323 | 388 | // check if the image exists |
| 324 | 389 | if (file_exists($sImagePath)) { |
| 325 | 390 | // read in the file |
| ... | ... | @@ -332,4 +397,29 @@ class DashboardNews { |
| 332 | 397 | return false; |
| 333 | 398 | } |
| 334 | 399 | } |
| 400 | + | |
| 401 | + /** | |
| 402 | + * Evaluates the size of the image and returns false if it is too big | |
| 403 | + * | |
| 404 | + * @param integer the width of the image | |
| 405 | + * @param integer the height of the image | |
| 406 | + */ | |
| 407 | + function checkImageSize($iImageWidth, $iImageHeight) { | |
| 408 | + global $default; | |
| 409 | + $default->log->info("comparing $iImageWidth:" . $this->iMaxImageWidth . "; $iImageHeight:" . $this->iMaxImageHeight); | |
| 410 | + if ( ($iImageWidth <= $this->iMaxImageWidth) && ($iImageHeight <= $this->iMaxImageHeight) ) { | |
| 411 | + return true; | |
| 412 | + } else { | |
| 413 | + return false; | |
| 414 | + } | |
| 415 | + } | |
| 416 | + | |
| 417 | + /** | |
| 418 | + * Returns the link text for linking to the current news item image | |
| 419 | + */ | |
| 420 | + function getImageLink() { | |
| 421 | + global $default; | |
| 422 | + | |
| 423 | + return "<img width=\"$this->iMaxImageWidth\" height=\"$this->iMaxImageHeight\" src=\"$default->rootUrl/" . $default->siteMap->getPage("viewNewsImage") . "?fNewsID=" . $this->getID() . "\" border=\"0\">"; | |
| 424 | + } | |
| 335 | 425 | } |
| 336 | 426 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc
| ... | ... | @@ -15,19 +15,6 @@ require_once("$default->uiDirectory/administration/adminUI.inc"); |
| 15 | 15 | * @package presentation.lookAndFeel.knowledgeTree.administration.news |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | - | |
| 19 | -function renderNewsPopupJavascript() { | |
| 20 | - global $default; | |
| 21 | - return "\n\n<SCRIPT LANGUAGE=\"javascript\">\n " . | |
| 22 | - "<!--\n" . | |
| 23 | - "function popupNews() {\n" . | |
| 24 | - "window.open ('" . generateControllerUrl("displayNews", "fNewsID=" ) . "', 'newwindow', config='height=400,width=600,left=400,top=300, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');\n" . | |
| 25 | - "return false;\n" . | |
| 26 | - "}\n" . | |
| 27 | - "//-->\n" . | |
| 28 | - "</SCRIPT>\n\n"; | |
| 29 | -} | |
| 30 | - | |
| 31 | 18 | /** |
| 32 | 19 | * Displays an error message |
| 33 | 20 | */ |
| ... | ... | @@ -67,9 +54,10 @@ function renderNewsItem($oDashboardNews) { |
| 67 | 54 | global $default; |
| 68 | 55 | |
| 69 | 56 | $sToRender .= "<tr><td>Synopsis:</td><td>" . $oDashboardNews->getSynopsis() . "</td></tr>"; |
| 57 | + | |
| 70 | 58 | $sToRender .= "<tr><td>Body:</td><td>" . $oDashboardNews->getBody() . "</td></tr>"; |
| 71 | 59 | $sToRender .= "<tr><td>Rank:</td><td>" . $oDashboardNews->getRank() . "</td></tr>"; |
| 72 | - $sToRender .= "<tr><td colspan=\"2\">" . $oDashboardNews->getImageLink() . "</td></tr>"; | |
| 60 | + //$sToRender .= "<tr><td colspan=\"2\">" . $oDashboardNews->getImageLink() . "</td></tr>"; | |
| 73 | 61 | |
| 74 | 62 | $sToRender .= "<input type=\"hidden\" name=\"fNewsID\" value=\"" . $oDashboardNews->getID() . "\">"; |
| 75 | 63 | return $sToRender; |
| ... | ... | @@ -192,18 +180,4 @@ function renderDeleteNewsConfirmationPage($oDashboardNews) { |
| 192 | 180 | $sToRender .= "</table>\n"; |
| 193 | 181 | return $sToRender; |
| 194 | 182 | } |
| 195 | - | |
| 196 | -/** | |
| 197 | - * Displays a news item. | |
| 198 | - */ | |
| 199 | -function renderNewsItemPage($oDashboardNews) { | |
| 200 | - global $default; | |
| 201 | - | |
| 202 | - $sToRender .= "<table>\n"; | |
| 203 | - $sToRender .= renderNewsItem($oDashboardNews); | |
| 204 | - //$sToRender .= "<tr><td><a href=\"javascript:window.close()"><img src=\"$default->graphicsUrl/widgets/close.gif\" border=\"0\"></a></td></tr>\n"; | |
| 205 | - $sToRender .= "<tr><td><a href=\"javascript:window.close()\">close</a></td></tr>\n"; | |
| 206 | - $sToRender .= "</table>\n"; | |
| 207 | - return $sToRender; | |
| 208 | -} | |
| 209 | 183 | ?> |
| 210 | 184 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php
| ... | ... | @@ -14,8 +14,9 @@ require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); |
| 14 | 14 | * @author Michael Joseph <michael@jamwarehouse.com>, Jam Warehouse (Pty) Ltd, South Africa |
| 15 | 15 | * @package presentation.lookAndFeel.knowledgeTree.administration.news |
| 16 | 16 | */ |
| 17 | + | |
| 17 | 18 | if (isset($fNewsID)) { |
| 18 | 19 | $oNews = DashboardNews::get($fNewsID); |
| 19 | 20 | $oNews->displayImage(); |
| 20 | 21 | } |
| 21 | -?> | |
| 22 | 22 | \ No newline at end of file |
| 23 | + ?> | |
| 23 | 24 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php
0 → 100644
| 1 | +<?php | |
| 2 | + | |
| 3 | +require_once("../../../../../config/dmsDefaults.php"); | |
| 4 | +require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); | |
| 5 | +require_once("$default->uiDirectory/dashboardUI.inc"); | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * $Id$ | |
| 9 | + * | |
| 10 | + * Displays a news item. | |
| 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.administration.news | |
| 17 | + */ | |
| 18 | + | |
| 19 | +if (checkSession()) { | |
| 20 | + if (isset($fNewsID)) { | |
| 21 | + $oNews = DashboardNews::get($fNewsID); | |
| 22 | + //$oNews->displayImage(); | |
| 23 | + if ($oNews) { | |
| 24 | + echo renderNewsItemPage($oNews); | |
| 25 | + } else { | |
| 26 | + // do something intelligent like closing the popup automatically | |
| 27 | + // or more prosaically, printing an error message | |
| 28 | + } | |
| 29 | + } | |
| 30 | +} | |
| 31 | +?> | |
| 0 | 32 | \ No newline at end of file | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboardBL.php
| ... | ... | @@ -2,10 +2,9 @@ |
| 2 | 2 | |
| 3 | 3 | // main library routines and defaults |
| 4 | 4 | require_once("../../../config/dmsDefaults.php"); |
| 5 | -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); | |
| 6 | -require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); | |
| 5 | +require_once("$default->fileSystemRoot/lib/dashboard/Dashboard.inc"); | |
| 6 | +require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); | |
| 7 | 7 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| 8 | -require_once("$default->fileSystemRoot/lib/links/link.inc"); | |
| 9 | 8 | require_once("$default->uiDirectory/dashboardUI.inc"); |
| 10 | 9 | |
| 11 | 10 | /** |
| ... | ... | @@ -26,46 +25,6 @@ require_once("$default->uiDirectory/dashboardUI.inc"); |
| 26 | 25 | // page start |
| 27 | 26 | // ------------------------------- |
| 28 | 27 | |
| 29 | -/** | |
| 30 | - * Retrieves the collaboration documents that the current user has pending | |
| 31 | - * | |
| 32 | - * @param integer the user to retrieve pending collaboration documents for | |
| 33 | - */ | |
| 34 | -function getPendingCollaborationDocuments($iUserID) { | |
| 35 | - // TODO: move this to a more logical class/file | |
| 36 | - global $default; | |
| 37 | - $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $_SESSION["userID"]; | |
| 38 | - $aDocumentList = array(); | |
| 39 | - $sql = $default->db; | |
| 40 | - if ($sql->query($sQuery)) { | |
| 41 | - while ($sql->next_record()) { | |
| 42 | - $aDocumentList[] = & Document::get($sql->f("document_id")); | |
| 43 | - } | |
| 44 | - } | |
| 45 | - return $aDocumentList; | |
| 46 | -} | |
| 47 | - | |
| 48 | -/** | |
| 49 | - * Retrieves the web documents that the current user has pending | |
| 50 | - * | |
| 51 | - * @param integer the user to retrieve pending web documents for | |
| 52 | - */ | |
| 53 | -function getPendingWebDocuments($iUserID) { | |
| 54 | - // TODO: move this to a more logical class/file | |
| 55 | - global $default; | |
| 56 | - $sQuery = "SELECT wd.id FROM web_documents wd " . | |
| 57 | - "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . | |
| 58 | - "WHERE ws.web_master_id=$iUserID AND wd.status_id=1"; | |
| 59 | - $aDocumentList = array(); | |
| 60 | - $sql = $default->db; | |
| 61 | - if ($sql->query($sQuery)) { | |
| 62 | - while ($sql->next_record()) { | |
| 63 | - $aDocumentList[] = & WebDocument::get($sql->f("id")); | |
| 64 | - } | |
| 65 | - } | |
| 66 | - return $aDocumentList; | |
| 67 | -} | |
| 68 | - | |
| 69 | 28 | if (checkSession()) { |
| 70 | 29 | // include the page template (with navbar) |
| 71 | 30 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| ... | ... | @@ -73,19 +32,23 @@ if (checkSession()) { |
| 73 | 32 | // instantiate my content pattern |
| 74 | 33 | $oContent = new PatternCustom(); |
| 75 | 34 | |
| 35 | + // construct the dashboard object | |
| 36 | + $oDashboard = new Dashboard($_SESSION["userID"]); | |
| 37 | + | |
| 76 | 38 | // retrieve collaboration pending documents for this user |
| 77 | - $aPendingDocumentList = getPendingCollaborationDocuments($_SESSION["userID"]); | |
| 39 | + $aPendingDocumentList = $oDashboard->getPendingCollaborationDocuments(); | |
| 40 | + | |
| 78 | 41 | // retrieve checked out documents for this user |
| 79 | - $aCheckedOutDocumentList = Document::getList("checked_out_user_id=" . $_SESSION["userID"]); | |
| 42 | + $aCheckedOutDocumentList = $oDashboard->getCheckedOutDocuments(); | |
| 80 | 43 | |
| 81 | 44 | // retrieve subscription alerts for this user |
| 82 | - $aSubscriptionAlertList = SubscriptionManager::listSubscriptionAlerts($_SESSION["userID"]); | |
| 45 | + $aSubscriptionAlertList = $oDashboard->getSubscriptionAlerts(); | |
| 83 | 46 | |
| 84 | 47 | // retrieve quicklinks |
| 85 | - $aQuickLinks = Link::getList("ORDER BY rank"); | |
| 48 | + $aQuickLinks = $oDashboard->getQuickLinks(); | |
| 86 | 49 | |
| 87 | 50 | // retrieve pending web documents |
| 88 | - $aPendingWebDocuments = getPendingWebDocuments($_SESSION["userID"]); | |
| 51 | + $aPendingWebDocuments = $oDashboard->getPendingWebDocuments(); | |
| 89 | 52 | |
| 90 | 53 | // generate the html |
| 91 | 54 | $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments)); | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
| ... | ... | @@ -24,15 +24,15 @@ function renderPendingWebDocuments($aPendingDocumentList) { |
| 24 | 24 | |
| 25 | 25 | if (count($aPendingDocumentList) > 0) { |
| 26 | 26 | $sBgColor = "#9D9D7F"; |
| 27 | - $sToRender = "\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 27 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 28 | 28 | |
| 29 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Web Documents</font></th>\n"; | |
| 30 | - $sToRender .= "\t</tr>\n"; | |
| 29 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Web Documents</font></th>\n"; | |
| 30 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 31 | 31 | for ($i = 0; $i < count($aPendingDocumentList); $i++) { |
| 32 | 32 | $oWebDocument = $aPendingDocumentList[$i]; |
| 33 | - $sToRender .= "\t<tr>\n"; | |
| 34 | - $sToRender .= "<td colspan=\"2\">" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "</td>\n"; | |
| 35 | - $sToRender .= "\t</tr>\n"; | |
| 33 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 34 | + $sToRender .= "\t\t\t\t<td colspan=\"2\">" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "</td>\n"; | |
| 35 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 36 | 36 | } |
| 37 | 37 | return $sToRender; |
| 38 | 38 | } else { |
| ... | ... | @@ -53,15 +53,15 @@ function renderPendingCollaborationDocuments($aPendingDocumentList) { |
| 53 | 53 | } else { |
| 54 | 54 | $sBgColor = "#CECEBF"; |
| 55 | 55 | } |
| 56 | - $sToRender = "\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 56 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 57 | 57 | |
| 58 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Documents</font></th>\n"; | |
| 59 | - $sToRender .= "\t</tr>\n"; | |
| 58 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Pending Documents</font></th>\n"; | |
| 59 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 60 | 60 | for ($i = 0; $i < count($aPendingDocumentList); $i++) { |
| 61 | 61 | $oDocument = $aPendingDocumentList[$i]; |
| 62 | - $sToRender .= "\t<tr>\n"; | |
| 63 | - $sToRender .= "<td colspan=\"2\">" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n"; | |
| 64 | - $sToRender .= "\t</tr>\n"; | |
| 62 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 63 | + $sToRender .= "\t\t\t\t<td colspan=\"2\">" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n"; | |
| 64 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 65 | 65 | } |
| 66 | 66 | return $sToRender; |
| 67 | 67 | } |
| ... | ... | @@ -78,27 +78,27 @@ function renderCheckedOutDocuments($aCheckedOutDocumentList) { |
| 78 | 78 | } else { |
| 79 | 79 | $sBgColor = "#CECEBF"; |
| 80 | 80 | } |
| 81 | - $sToRender = "\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 82 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Checked Out Documents</font></th>\n"; | |
| 83 | - $sToRender .= "\t</tr>\n"; | |
| 81 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 82 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Checked Out Documents</font></th>\n"; | |
| 83 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 84 | 84 | |
| 85 | 85 | if (count($aCheckedOutDocumentList) > 0) { |
| 86 | - $sToRender .= "\t<tr>\n"; | |
| 87 | - $sToRender .= "<th align=\"left\" width=\"66%\" class=\"sectionColumns\">\n"; | |
| 88 | - $sToRender .= "Title\n"; | |
| 86 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 87 | + $sToRender .= "\t\t\t\t<th align=\"left\" width=\"66%\" class=\"sectionColumns\">"; | |
| 88 | + $sToRender .= "Title"; | |
| 89 | 89 | $sToRender .= "</th>\n"; |
| 90 | - $sToRender .= "<th align=\"right\" width=\"33%\" class=\"sectionColumns\">\n"; | |
| 91 | - $sToRender .= "Days\n"; | |
| 92 | - $sToRender .= "</th>"; | |
| 93 | - $sToRender .= "\t\t</tr>\n"; | |
| 90 | + $sToRender .= "\t\t\t\t<th align=\"right\" width=\"33%\" class=\"sectionColumns\">"; | |
| 91 | + $sToRender .= "Days"; | |
| 92 | + $sToRender .= "\t\t\t\t</th>\n"; | |
| 93 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) { |
| 97 | 97 | $oDocument = $aCheckedOutDocumentList[$i]; |
| 98 | - $sToRender .= "\t<tr>\n"; | |
| 99 | - $sToRender .= "<td>" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n"; | |
| 100 | - $sToRender .= "<td align=right>" . $oDocument->getDaysSinceLastModified() . "</td>\n"; | |
| 101 | - $sToRender .= "\t</tr>\n"; | |
| 98 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 99 | + $sToRender .= "\t\t\t\t<td>" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "<img src=\"$default->graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "</td>\n"; | |
| 100 | + $sToRender .= "\t\t\t\t<td align=right>" . $oDocument->getDaysSinceLastModified() . "</td>\n"; | |
| 101 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 102 | 102 | } |
| 103 | 103 | return $sToRender; |
| 104 | 104 | } |
| ... | ... | @@ -115,13 +115,13 @@ function renderSubscriptionAlerts($aSubscriptionAlertList) { |
| 115 | 115 | } else { |
| 116 | 116 | $sBgColor = "#CECEBF"; |
| 117 | 117 | } |
| 118 | - $sToRender = "\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 119 | - $sToRender .= "\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Subscription Alerts</font></th>\n"; | |
| 120 | - $sToRender .= "\t</tr>\n"; | |
| 118 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 119 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"><font color=\"ffffff\">Subscription Alerts</font></th>\n"; | |
| 120 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 121 | 121 | for ($i = 0; $i < count($aSubscriptionAlertList); $i++) { |
| 122 | - $sToRender .= "\t<tr>\n"; | |
| 123 | - $sToRender .= "<td colspan=\"2\">" . $aSubscriptionAlertList[$i]->getAlertLink() . "</td>\n"; | |
| 124 | - $sToRender .= "\t</tr>\n"; | |
| 122 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 123 | + $sToRender .= "\t\t\t\t<td colspan=\"2\">" . $aSubscriptionAlertList[$i]->getAlertLink() . "</td>\n"; | |
| 124 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 125 | 125 | } |
| 126 | 126 | return $sToRender; |
| 127 | 127 | } |
| ... | ... | @@ -131,18 +131,46 @@ function renderSubscriptionAlerts($aSubscriptionAlertList) { |
| 131 | 131 | */ |
| 132 | 132 | function renderQuickLinks($aQuickLinks) { |
| 133 | 133 | global $default; |
| 134 | - $sToRender .= "\t<tr align=\"left\" bgcolor=\"#9D9D7F\">\n"; | |
| 135 | - $sToRender .= "\t\t<th class=\"sectionHeading\">Quick Links</th>\n"; | |
| 136 | - $sToRender .= "\t</tr>\n"; | |
| 134 | + $sToRender .= "\t\t\t<tr align=\"left\" bgcolor=\"#9D9D7F\">\n"; | |
| 135 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\">Quick Links</th>\n"; | |
| 136 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 137 | 137 | for ($i = 0; $i < count($aQuickLinks); $i++) { |
| 138 | - $sToRender .= "\t<tr>\n"; | |
| 139 | - $sToRender .= "<td colspan=\"2\"><a href=\"" . $aQuickLinks[$i]->getUrl() . "\" target=\"_new\"><img src=\"$default->graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "</a></td>\n"; | |
| 140 | - $sToRender .= "\t</tr>\n"; | |
| 138 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 139 | + $sToRender .= "\t\t\t\t<td colspan=\"2\"><a href=\"" . $aQuickLinks[$i]->getUrl() . "\" target=\"_new\"><img src=\"$default->graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "</a></td>\n"; | |
| 140 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 141 | 141 | } |
| 142 | 142 | return $sToRender; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | /** |
| 146 | + * Displays the dashboard news items | |
| 147 | + * | |
| 148 | + */ | |
| 149 | +function renderDashboardNews() { | |
| 150 | + global $default; | |
| 151 | + | |
| 152 | + // retrieve all news items | |
| 153 | + $aDashboardNews = DashboardNews::getList(); | |
| 154 | + | |
| 155 | + $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; | |
| 156 | + // the main news item | |
| 157 | + $oMainDashboardNews = $aDashboardNews[0]; | |
| 158 | + $sToRender .= "\t\t\t\t<tr><td><strong>" . $oMainDashboardNews->getSynopsis() . "</strong></td></tr>\n"; | |
| 159 | + $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getImageLink() . "</td></tr>\n"; | |
| 160 | + $sToRender .= "\t\t\t\t<tr><td>" . $oMainDashboardNews->getBodyFragment() . "..... <a href=\"#\" onClick=\"javascript:window.open('" . generateControllerUrl("viewNewsItem", "fNewsID=" . $oMainDashboardNews->getID()) . "', 'newwindow', config='height=200,width=300,left=0,top=0, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, directories=no, status=no');return false;\">more</a></td></tr>\n"; | |
| 161 | + | |
| 162 | + // links to old news items | |
| 163 | + /* | |
| 164 | + for ($i=1; $i<count($aDashboardNews); $i++) { | |
| 165 | + $sToRender .= "\t\t\t\t<tr><td>" . generateControllerLink("viewNewsItem", "fNewsID=" . $aDashboardNews[$i]->getID(), $aDashboardNews[$i]->getSynopsis()) . "</td></tr>\n"; | |
| 166 | + } | |
| 167 | + */ | |
| 168 | + $sToRender .= "\t\t\t</table>\n"; | |
| 169 | + | |
| 170 | + return $sToRender; | |
| 171 | +} | |
| 172 | + | |
| 173 | +/** | |
| 146 | 174 | * Renders the dashboard |
| 147 | 175 | * |
| 148 | 176 | * @param array pending collaboration documents for this user |
| ... | ... | @@ -153,18 +181,23 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript |
| 153 | 181 | global $default; |
| 154 | 182 | |
| 155 | 183 | $sToRender = "<table border=\"0\" width=\"600\" >\n"; |
| 156 | - $sToRender .= "\t<tr>\n"; | |
| 157 | - $sToRender .= "\t\t<td><img src=\"$default->graphicsUrl/welcome.gif\"/></td>\n"; | |
| 184 | + $sToRender .= "\t<tr valign=\"top\">\n"; | |
| 185 | + $sToRender .= "\t\t<td><img src=\"$default->graphicsUrl/welcome.gif\" border=\"0\"/></td>\n"; | |
| 158 | 186 | |
| 159 | 187 | // some arb welcoming text goes here |
| 160 | 188 | $oUser = & User::get($_SESSION["userID"]); |
| 161 | 189 | $sUserName = $oUser->getName(); |
| 162 | 190 | $sToRender .= "\t\t<td>Hi" . (strlen($sUserName) > 0 ? " " . $sUserName : "") . ", welcome back to the " . lookupField($default->owl_organisations_table, "name", "id", $default->organisationID) . " DMS, part of the Knowledge Tree.</td>\n"; |
| 163 | - $sToRender .= "\t</tr>\n"; | |
| 191 | + | |
| 192 | + // dashboard news | |
| 193 | + $sToRender .= "\t\t<td>\n"; | |
| 194 | + $sToRender .= renderDashboardNews(); | |
| 195 | + $sToRender .= "\t\t</td>\n"; | |
| 196 | + $sToRender .= "\t</tr>\n"; | |
| 164 | 197 | |
| 165 | 198 | // dashboard alerts |
| 166 | 199 | $sToRender .= "\t<tr>\n"; |
| 167 | - $sToRender .= "\t\t<td width=\"50%\" valign=\"top\" colspan=2>\n"; | |
| 200 | + $sToRender .= "\t\t<td width=\"50%\" valign=\"top\" colspan=\"2\">\n"; | |
| 168 | 201 | $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; |
| 169 | 202 | $sToRender .= renderPendingWebDocuments($aWebDocuments) . "\n"; |
| 170 | 203 | $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList); |
| ... | ... | @@ -185,4 +218,29 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript |
| 185 | 218 | |
| 186 | 219 | return $sToRender; |
| 187 | 220 | } |
| 188 | -?> | |
| 221 | + | |
| 222 | +/** | |
| 223 | + * Displays a news item | |
| 224 | + */ | |
| 225 | +function renderNewsItemPage($oDashboardNews) { | |
| 226 | + global $default; | |
| 227 | + | |
| 228 | + $sToRender .= "<html>\n"; | |
| 229 | + $sToRender .= "<head>\n"; | |
| 230 | + $sToRender .= "<meta http-equiv=\"refresh\" content=\"" . ($default->sessionTimeout+3) . "\">\n"; | |
| 231 | + $sToRender .= "<link rel=\"SHORTCUT ICON\" href=\"$default->graphicsUrl/tree.ico\">\n"; | |
| 232 | + $sToRender .= "<link rel=\"stylesheet\" href=\"$default->uiUrl/stylesheet.php\">\n"; | |
| 233 | + $sToRender .= "</head>\n"; | |
| 234 | + $sToRender .= "<body marginleft=\"0\" marginheight=\"0\">\n"; | |
| 235 | + $sToRender .= "\t\t\t<table border=\"0\" width=\"100%\">\n"; | |
| 236 | + $sToRender .= "\t\t\t\t<tr><td><strong>" . $oDashboardNews->getSynopsis() . "</strong></td></tr>\n"; | |
| 237 | + $sToRender .= "\t\t\t\t<tr><td>" . $oDashboardNews->getImageLink() . "</td></tr>\n"; | |
| 238 | + $sToRender .= "\t\t\t\t<tr><td>" . $oDashboardNews->getBody() . "</td></tr>\n"; | |
| 239 | + $sToRender .= "<tr><td><a href=\"javascript:window.close()\">close</a></td></tr>\n"; | |
| 240 | + $sToRender .= "</table>"; | |
| 241 | + $sToRender .= "</body>"; | |
| 242 | + $sToRender .= "</html>"; | |
| 243 | + | |
| 244 | + return $sToRender; | |
| 245 | +} | |
| 246 | +?> | |
| 189 | 247 | \ No newline at end of file | ... | ... |