From 236db07a61e480809c19df144a2f0c427b93c367 Mon Sep 17 00:00:00 2001 From: michael Date: Mon, 12 May 2003 16:02:41 +0000 Subject: [PATCH] integrated dashboard news into dashboard --- lib/dashboard/Dashboard.inc | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/dashboard/DashboardNews.inc | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc | 30 ++---------------------------- presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php | 3 ++- presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php | 31 +++++++++++++++++++++++++++++++ presentation/lookAndFeel/knowledgeTree/dashboardBL.php | 59 +++++++++++------------------------------------------------ presentation/lookAndFeel/knowledgeTree/dashboardUI.inc | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------- 7 files changed, 342 insertions(+), 126 deletions(-) create mode 100644 lib/dashboard/Dashboard.inc create mode 100644 presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php diff --git a/lib/dashboard/Dashboard.inc b/lib/dashboard/Dashboard.inc new file mode 100644 index 0000000..29fc2f8 --- /dev/null +++ b/lib/dashboard/Dashboard.inc @@ -0,0 +1,99 @@ +fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); +require_once("$default->fileSystemRoot/lib/links/link.inc"); + +/** + * $Id$ + * + * Contains dashboard helper functions + * + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * @package lib.dashboard + */ + +class Dashboard { + + /** + * The user id of the user viewing the dashboard + */ + var $iUserID; + + /** + * Constructs a new instance of the Dashboard + * @param integer the user id of the current user + */ + function Dashboard($iUserID){ + $this->iUserID = $iUserID; + } + + /** + * Retrieves the collaboration documents that the current user has pending + * + * @param integer the user to retrieve pending collaboration documents for + */ + function getPendingCollaborationDocuments(){ + global $default; + + $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $this->iUserID; + $aDocumentList = array(); + $sql = $default->db; + if ($sql->query($sQuery)) { + while ($sql->next_record()) { + $aDocumentList[] = & Document::get($sql->f("document_id")); + } + } + return $aDocumentList; + } + + /** + * Retrieve checked out documents for this user + * + * @return array of documents + */ + function getCheckedOutDocuments(){ + return Document::getList("checked_out_user_id=" . $this->iUserID); + } + + /** + * Retrieve subscription alerts for this user. + * + * @return array of subscription alerts + */ + function getSubscriptionAlerts(){ + return SubscriptionManager::listSubscriptionAlerts($this->iUserID); + } + + /** + * Retrieve quicklinks + * + * @return array of link objects + */ + function getQuickLinks(){ + return Link::getList("ORDER BY rank"); + } + + /** + * Retrieves the web documents that the current user has pending + * + * @param integer the user to retrieve pending web documents for + */ + function getPendingWebDocuments(){ + global $default; + $sQuery = "SELECT wd.id FROM web_documents wd " . + "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . + "WHERE ws.web_master_id=" . $this->iUserID . " AND wd.status_id=1"; + $aDocumentList = array(); + $sql = $default->db; + if ($sql->query($sQuery)) { + while ($sql->next_record()) { + $aDocumentList[] = & WebDocument::get($sql->f("id")); + } + } + return $aDocumentList; + } +} \ No newline at end of file diff --git a/lib/dashboard/DashboardNews.inc b/lib/dashboard/DashboardNews.inc index 1e8a5d8..26fd676 100644 --- a/lib/dashboard/DashboardNews.inc +++ b/lib/dashboard/DashboardNews.inc @@ -11,7 +11,7 @@ require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentMa * * @version $Revision$ * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa - * @package lib.authentication + * @package lib.dashboard */ class DashboardNews { @@ -44,6 +44,14 @@ class DashboardNews { * The mime type id of the image */ var $iImageMimeTypeID; + /** + * The maximum allowable width of an image + */ + var $iMaxImageWidth = 80; + /** + * The maximum allowable height of an image + */ + var $iMaxImageHeight = 40; /** * Constructs a news item @@ -53,6 +61,8 @@ class DashboardNews { * @param integer the rank */ function DashboardNews($sNewSynopsis, $sNewBody, $iNewRank, $mImage = "") { + global $default; + // primary key not set as document is not stored yet $this->iId = -1; $this->setSynopsis($sNewSynopsis); @@ -64,11 +74,16 @@ class DashboardNews { $this->setImage($mImage["image"]); $this->setImageSize($mImage["filesize"]); $this->setImageMimeTypeID($mImage["mimetypeid"]); - } else { + } else if (strlen($mImage) > 0){ if (file_exists($mImage)) { // we've been passed a file, so read it in $this->setImageFile($mImage); } + } else { + // initialise + $this->setImage(""); + $this->setImageSize(0); + $this->setImageMimeTypeID(0); } } @@ -103,6 +118,13 @@ class DashboardNews { } /** + * Returns a fragment of the body + */ + function getBodyFragment() { + return substr($this->sBody, 0, 50); + } + + /** * Sets the body * * @param string the new news body @@ -174,6 +196,47 @@ class DashboardNews { */ function setImageMimeTypeID($iNewMimeTypeID) { $this->iImageMimeTypeID = $iNewMimeTypeID; + } + + /** + * Retrieve the maximum image width + */ + function getMaxImageWidth() { + return $this->iMaxImageWidth; + } + + /** + * Set the maximum image width + * + * @param integer the maximum image width + */ + function setMaxImageWidth($iNewMaxImageWidth) { + $this->iMaxImageWidth = $iNewMaxImageWidth; + } + + /** + * Retrieve the maximum image height + */ + function getMaxImageHeight() { + return $this->iMaxImageHeight; + } + + /** + * Set the maximum image height + * + * @param integer the maximum image height + */ + function setMaxImageHeight($iNewMaxImageHeight) { + $this->iMaxImageHeight = $iNewMaxImageHeight; + } + + /** + * Returns the maximum dimensions as a string + * + * @param string the maximum image dimensions + */ + function getMaxImageDimensions() { + return $this->iMaxImageWidth . "x" . $this->iMaxImageHeight; } /** @@ -191,8 +254,10 @@ class DashboardNews { * @param string path to the image on the filesystem */ function setImageFile($sPathToImage){ + global $default; + $default->log->info("set image file called with $sPathToImage"); if (file_exists($sPathToImage)) { - $aImage = $this->imageToString($sPathToImage); + $aImage = $this->readInImage($sPathToImage); $this->sImage = $aImage["image"]; $this->iImageSize = $aImage["filesize"]; $this->iImageMimeTypeID = $aImage["mimetypeid"]; @@ -301,14 +366,14 @@ class DashboardNews { global $default; $aDashboardNewsArray = array(); $sql = $default->db; - $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); + $result = $sql->query("SELECT * FROM " . $default->owl_news_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "") . " ORDER BY rank ASC"); if ($result) { $iCount = 0; while ($sql->next_record()) { $oDashboardNews = & DashboardNews::get($sql->f("id")); $aDashboardNewsArray[$iCount++] = $oDashboardNews; } - return $aDocumentArray; + return $aDashboardNewsArray; } return false; } @@ -319,7 +384,7 @@ class DashboardNews { * @param string path to the image file * @return string the image as a string */ - function imageToString($sImagePath) { + function readInImage($sImagePath) { // check if the image exists if (file_exists($sImagePath)) { // read in the file @@ -332,4 +397,29 @@ class DashboardNews { return false; } } + + /** + * Evaluates the size of the image and returns false if it is too big + * + * @param integer the width of the image + * @param integer the height of the image + */ + function checkImageSize($iImageWidth, $iImageHeight) { + global $default; + $default->log->info("comparing $iImageWidth:" . $this->iMaxImageWidth . "; $iImageHeight:" . $this->iMaxImageHeight); + if ( ($iImageWidth <= $this->iMaxImageWidth) && ($iImageHeight <= $this->iMaxImageHeight) ) { + return true; + } else { + return false; + } + } + + /** + * Returns the link text for linking to the current news item image + */ + function getImageLink() { + global $default; + + return "iMaxImageWidth\" height=\"$this->iMaxImageHeight\" src=\"$default->rootUrl/" . $default->siteMap->getPage("viewNewsImage") . "?fNewsID=" . $this->getID() . "\" border=\"0\">"; + } } \ No newline at end of file diff --git a/presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc index 8ddefeb..2bd529b 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/administration/news/newsUI.inc @@ -15,19 +15,6 @@ require_once("$default->uiDirectory/administration/adminUI.inc"); * @package presentation.lookAndFeel.knowledgeTree.administration.news */ - -function renderNewsPopupJavascript() { - global $default; - return "\n\n\n\n"; -} - /** * Displays an error message */ @@ -67,9 +54,10 @@ function renderNewsItem($oDashboardNews) { global $default; $sToRender .= "Synopsis:" . $oDashboardNews->getSynopsis() . ""; + $sToRender .= "Body:" . $oDashboardNews->getBody() . ""; $sToRender .= "Rank:" . $oDashboardNews->getRank() . ""; - $sToRender .= "" . $oDashboardNews->getImageLink() . ""; + //$sToRender .= "" . $oDashboardNews->getImageLink() . ""; $sToRender .= "getID() . "\">"; return $sToRender; @@ -192,18 +180,4 @@ function renderDeleteNewsConfirmationPage($oDashboardNews) { $sToRender .= "\n"; return $sToRender; } - -/** - * Displays a news item. - */ -function renderNewsItemPage($oDashboardNews) { - global $default; - - $sToRender .= "\n"; - $sToRender .= renderNewsItem($oDashboardNews); - //$sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "
graphicsUrl/widgets/close.gif\" border=\"0\">
close
\n"; - return $sToRender; -} ?> \ No newline at end of file diff --git a/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php b/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php index a90341d..6e062f5 100644 --- a/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php +++ b/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsImage.php @@ -14,8 +14,9 @@ require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa * @package presentation.lookAndFeel.knowledgeTree.administration.news */ + if (isset($fNewsID)) { $oNews = DashboardNews::get($fNewsID); $oNews->displayImage(); } -?> \ No newline at end of file + ?> \ No newline at end of file diff --git a/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php b/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php new file mode 100644 index 0000000..57c0605 --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/dashboard/news/displayNewsItem.php @@ -0,0 +1,31 @@ +fileSystemRoot/lib/dashboard/DashboardNews.inc"); +require_once("$default->uiDirectory/dashboardUI.inc"); + +/** + * $Id$ + * + * Displays a news item. + * + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * @package presentation.lookAndFeel.knowledgeTree.administration.news + */ + +if (checkSession()) { + if (isset($fNewsID)) { + $oNews = DashboardNews::get($fNewsID); + //$oNews->displayImage(); + if ($oNews) { + echo renderNewsItemPage($oNews); + } else { + // do something intelligent like closing the popup automatically + // or more prosaically, printing an error message + } + } +} +?> \ No newline at end of file diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php index fa53e17..1f0073b 100644 --- a/presentation/lookAndFeel/knowledgeTree/dashboardBL.php +++ b/presentation/lookAndFeel/knowledgeTree/dashboardBL.php @@ -2,10 +2,9 @@ // main library routines and defaults require_once("../../../config/dmsDefaults.php"); -require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionManager.inc"); -require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); +require_once("$default->fileSystemRoot/lib/dashboard/Dashboard.inc"); +require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); -require_once("$default->fileSystemRoot/lib/links/link.inc"); require_once("$default->uiDirectory/dashboardUI.inc"); /** @@ -26,46 +25,6 @@ require_once("$default->uiDirectory/dashboardUI.inc"); // page start // ------------------------------- -/** - * Retrieves the collaboration documents that the current user has pending - * - * @param integer the user to retrieve pending collaboration documents for - */ -function getPendingCollaborationDocuments($iUserID) { - // TODO: move this to a more logical class/file - global $default; - $sQuery = "SELECT document_id FROM $default->owl_folders_user_roles_table WHERE active=1 AND user_id=" . $_SESSION["userID"]; - $aDocumentList = array(); - $sql = $default->db; - if ($sql->query($sQuery)) { - while ($sql->next_record()) { - $aDocumentList[] = & Document::get($sql->f("document_id")); - } - } - return $aDocumentList; -} - -/** - * Retrieves the web documents that the current user has pending - * - * @param integer the user to retrieve pending web documents for - */ -function getPendingWebDocuments($iUserID) { - // TODO: move this to a more logical class/file - global $default; - $sQuery = "SELECT wd.id FROM web_documents wd " . - "INNER JOIN web_sites ws ON wd.web_site_id = ws.id " . - "WHERE ws.web_master_id=$iUserID AND wd.status_id=1"; - $aDocumentList = array(); - $sql = $default->db; - if ($sql->query($sQuery)) { - while ($sql->next_record()) { - $aDocumentList[] = & WebDocument::get($sql->f("id")); - } - } - return $aDocumentList; -} - if (checkSession()) { // include the page template (with navbar) require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); @@ -73,19 +32,23 @@ if (checkSession()) { // instantiate my content pattern $oContent = new PatternCustom(); + // construct the dashboard object + $oDashboard = new Dashboard($_SESSION["userID"]); + // retrieve collaboration pending documents for this user - $aPendingDocumentList = getPendingCollaborationDocuments($_SESSION["userID"]); + $aPendingDocumentList = $oDashboard->getPendingCollaborationDocuments(); + // retrieve checked out documents for this user - $aCheckedOutDocumentList = Document::getList("checked_out_user_id=" . $_SESSION["userID"]); + $aCheckedOutDocumentList = $oDashboard->getCheckedOutDocuments(); // retrieve subscription alerts for this user - $aSubscriptionAlertList = SubscriptionManager::listSubscriptionAlerts($_SESSION["userID"]); + $aSubscriptionAlertList = $oDashboard->getSubscriptionAlerts(); // retrieve quicklinks - $aQuickLinks = Link::getList("ORDER BY rank"); + $aQuickLinks = $oDashboard->getQuickLinks(); // retrieve pending web documents - $aPendingWebDocuments = getPendingWebDocuments($_SESSION["userID"]); + $aPendingWebDocuments = $oDashboard->getPendingWebDocuments(); // generate the html $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments)); diff --git a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc index 48ada9c..4e24d5e 100644 --- a/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/dashboardUI.inc @@ -24,15 +24,15 @@ function renderPendingWebDocuments($aPendingDocumentList) { if (count($aPendingDocumentList) > 0) { $sBgColor = "#9D9D7F"; - $sToRender = "\t\n"; + $sToRender = "\t\t\t\n"; - $sToRender .= "\t\tPending Web Documents\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\tPending Web Documents\n"; + $sToRender .= "\t\t\t\n"; for ($i = 0; $i < count($aPendingDocumentList); $i++) { $oWebDocument = $aPendingDocumentList[$i]; - $sToRender .= "\t\n"; - $sToRender .= "" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\t" . generateControllerLink("webDocument", "fWebDocumentID=" . $oWebDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oWebDocument->getDisplayPath()) . "\n"; + $sToRender .= "\t\t\t\n"; } return $sToRender; } else { @@ -53,15 +53,15 @@ function renderPendingCollaborationDocuments($aPendingDocumentList) { } else { $sBgColor = "#CECEBF"; } - $sToRender = "\t\n"; + $sToRender = "\t\t\t\n"; - $sToRender .= "\t\tPending Documents\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\tPending Documents\n"; + $sToRender .= "\t\t\t\n"; for ($i = 0; $i < count($aPendingDocumentList); $i++) { $oDocument = $aPendingDocumentList[$i]; - $sToRender .= "\t\n"; - $sToRender .= "" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\t" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "\n"; + $sToRender .= "\t\t\t\n"; } return $sToRender; } @@ -78,27 +78,27 @@ function renderCheckedOutDocuments($aCheckedOutDocumentList) { } else { $sBgColor = "#CECEBF"; } - $sToRender = "\t\n"; - $sToRender .= "\t\tChecked Out Documents\n"; - $sToRender .= "\t\n"; + $sToRender = "\t\t\t\n"; + $sToRender .= "\t\t\t\tChecked Out Documents\n"; + $sToRender .= "\t\t\t\n"; if (count($aCheckedOutDocumentList) > 0) { - $sToRender .= "\t\n"; - $sToRender .= "\n"; - $sToRender .= "Title\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\t"; + $sToRender .= "Title"; $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "Days\n"; - $sToRender .= ""; - $sToRender .= "\t\t\n"; + $sToRender .= "\t\t\t\t"; + $sToRender .= "Days"; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\t\t\t\n"; } for ($i = 0; $i < count($aCheckedOutDocumentList); $i++) { $oDocument = $aCheckedOutDocumentList[$i]; - $sToRender .= "\t\n"; - $sToRender .= "" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "\n"; - $sToRender .= "" . $oDocument->getDaysSinceLastModified() . "\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\t" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), "graphicsUrl/widgets/dstatus.gif\" border=\"0\"/> " . $oDocument->getDisplayPath()) . "\n"; + $sToRender .= "\t\t\t\t" . $oDocument->getDaysSinceLastModified() . "\n"; + $sToRender .= "\t\t\t\n"; } return $sToRender; } @@ -115,13 +115,13 @@ function renderSubscriptionAlerts($aSubscriptionAlertList) { } else { $sBgColor = "#CECEBF"; } - $sToRender = "\t\n"; - $sToRender .= "\t\tSubscription Alerts\n"; - $sToRender .= "\t\n"; + $sToRender = "\t\t\t\n"; + $sToRender .= "\t\t\t\tSubscription Alerts\n"; + $sToRender .= "\t\t\t\n"; for ($i = 0; $i < count($aSubscriptionAlertList); $i++) { - $sToRender .= "\t\n"; - $sToRender .= "" . $aSubscriptionAlertList[$i]->getAlertLink() . "\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\t" . $aSubscriptionAlertList[$i]->getAlertLink() . "\n"; + $sToRender .= "\t\t\t\n"; } return $sToRender; } @@ -131,18 +131,46 @@ function renderSubscriptionAlerts($aSubscriptionAlertList) { */ function renderQuickLinks($aQuickLinks) { global $default; - $sToRender .= "\t\n"; - $sToRender .= "\t\tQuick Links\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\tQuick Links\n"; + $sToRender .= "\t\t\t\n"; for ($i = 0; $i < count($aQuickLinks); $i++) { - $sToRender .= "\t\n"; - $sToRender .= "getUrl() . "\" target=\"_new\">graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "\n"; - $sToRender .= "\t\n"; + $sToRender .= "\t\t\t\n"; + $sToRender .= "\t\t\t\tgetUrl() . "\" target=\"_new\">graphicsUrl/widgets/qlink.gif\" border=\"0\"/>" . $aQuickLinks[$i]->getName() . "\n"; + $sToRender .= "\t\t\t\n"; } return $sToRender; } /** + * Displays the dashboard news items + * + */ +function renderDashboardNews() { + global $default; + + // retrieve all news items + $aDashboardNews = DashboardNews::getList(); + + $sToRender .= "\t\t\t\n"; + // the main news item + $oMainDashboardNews = $aDashboardNews[0]; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\t\t\t\t\n"; + + // links to old news items + /* + for ($i=1; $i\n"; + } + */ + $sToRender .= "\t\t\t
" . $oMainDashboardNews->getSynopsis() . "
" . $oMainDashboardNews->getImageLink() . "
" . $oMainDashboardNews->getBodyFragment() . "..... more
\n"; + + return $sToRender; +} + +/** * Renders the dashboard * * @param array pending collaboration documents for this user @@ -153,18 +181,23 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript global $default; $sToRender = "\n"; - $sToRender .= "\t\n"; - $sToRender .= "\t\t\n"; + $sToRender .= "\t\n"; + $sToRender .= "\t\t\n"; // some arb welcoming text goes here $oUser = & User::get($_SESSION["userID"]); $sUserName = $oUser->getName(); $sToRender .= "\t\t\n"; - $sToRender .= "\t\n"; + + // dashboard news + $sToRender .= "\t\t\n"; + $sToRender .= "\t\n"; // dashboard alerts $sToRender .= "\t\n"; - $sToRender .= "\t\t
graphicsUrl/welcome.gif\"/>
graphicsUrl/welcome.gif\" border=\"0\"/>Hi" . (strlen($sUserName) > 0 ? " " . $sUserName : "") . ", welcome back to the " . lookupField($default->owl_organisations_table, "name", "id", $default->organisationID) . " DMS, part of the Knowledge Tree.
\n"; + $sToRender .= renderDashboardNews(); + $sToRender .= "\t\t
\n"; + $sToRender .= "\t\t\n"; $sToRender .= "\t\t\t\n"; $sToRender .= renderPendingWebDocuments($aWebDocuments) . "\n"; $sToRender .= renderPendingCollaborationDocuments($aPendingDocumentList); @@ -185,4 +218,29 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript return $sToRender; } -?> + +/** + * Displays a news item + */ +function renderNewsItemPage($oDashboardNews) { + global $default; + + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "sessionTimeout+3) . "\">\n"; + $sToRender .= "graphicsUrl/tree.ico\">\n"; + $sToRender .= "uiUrl/stylesheet.php\">\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\t\t\t
\n"; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\t\t\t\t\n"; + $sToRender .= "\n"; + $sToRender .= "
" . $oDashboardNews->getSynopsis() . "
" . $oDashboardNews->getImageLink() . "
" . $oDashboardNews->getBody() . "
close
"; + $sToRender .= ""; + $sToRender .= ""; + + return $sToRender; +} +?> \ No newline at end of file -- libgit2 0.21.4