Commit b43693870dd345cf84289c2d2a6a7d68e9cab574
1 parent
2b2ccded
Put "Browseable Folders" and "Public Folders" on the dashboard, so that
users can access all parts of the tree they should be able to. Submitted by: Stefano Ciancio (sciancio) SF Tracker: 1182191 git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3253 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
114 additions
and
3 deletions
lib/dashboard/Dashboard.inc
| ... | ... | @@ -130,4 +130,44 @@ class Dashboard { |
| 130 | 130 | } |
| 131 | 131 | return $aDocumentList; |
| 132 | 132 | } |
| 133 | + | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * Retrieves Public Folders | |
| 137 | + */ | |
| 138 | + function getPublicFolders() { | |
| 139 | + global $default; | |
| 140 | + $sQuery = array("SELECT id FROM $default->folders_table WHERE is_public = 1"); | |
| 141 | + $aFolderList = array(); | |
| 142 | + $sql = $default->db; | |
| 143 | + $sql->query($sQuery); | |
| 144 | + while ($sql->next_record()) { | |
| 145 | + $aFolderList[] = & Folder::get($sql->f("id")); | |
| 146 | + } | |
| 147 | + return $aFolderList; | |
| 148 | + } | |
| 149 | + | |
| 150 | + /** | |
| 151 | + * Retrieves Browseable Folders for this user | |
| 152 | + */ | |
| 153 | + function getBrowseableFolders() { | |
| 154 | + global $default; | |
| 155 | + $sQuery = array("SELECT DISTINCT F.id as folderid, F.parent_id as parentfolderid " . | |
| 156 | + "FROM $default->folders_table F, $default->groups_folders_table GFL, $default->users_groups_table UGL " . | |
| 157 | + "WHERE UGL.user_id=? AND UGL.group_id=GFL.group_id AND GFL.folder_id = F.id AND " . | |
| 158 | + "F.id=F.permission_folder_id AND F.id \!= 1 ORDER BY F.id", $this->iUserID); | |
| 159 | + $aBrowseableList = array(); | |
| 160 | + $aShowedFolderList = array(); | |
| 161 | + $sql = $default->db; | |
| 162 | + $sql->query($sQuery); | |
| 163 | + while ($sql->next_record()) { | |
| 164 | + | |
| 165 | + if (!$aShowedFolderList[$sql->f("parentfolderid")]) { | |
| 166 | + $aBrowseableList[] = & Folder::get($sql->f("folderid")); | |
| 167 | + } | |
| 168 | + $aShowedFolderList[$sql->f("folderid")] = 1; // check the showed folder | |
| 169 | + } | |
| 170 | + return $aBrowseableList; | |
| 171 | + } | |
| 172 | + | |
| 133 | 173 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboardBL.php
| ... | ... | @@ -2,6 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | // main library routines and defaults |
| 4 | 4 | require_once("../../../config/dmsDefaults.php"); |
| 5 | +require_once("$default->fileSystemRoot/lib/unitmanagement/Unit.inc"); | |
| 5 | 6 | require_once("$default->fileSystemRoot/lib/dashboard/Dashboard.inc"); |
| 6 | 7 | require_once("$default->fileSystemRoot/lib/dashboard/DashboardNews.inc"); |
| 7 | 8 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); |
| ... | ... | @@ -64,8 +65,14 @@ if (checkSession()) { |
| 64 | 65 | // retrieve archive restoration requests |
| 65 | 66 | $aRestorationRequests = $oDashboard->getArchiveRestorationRequestDocuments(); |
| 66 | 67 | |
| 67 | - // generate the html | |
| 68 | - $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments, $aDependantDocuments, $aRestorationRequests)); | |
| 68 | + // retrieve public folders | |
| 69 | + $aPublicFolders = $oDashboard->getPublicFolders(); | |
| 70 | + | |
| 71 | + // retrieve browseable folders | |
| 72 | + $aBrowseableFolders = $oDashboard->getBrowseableFolders(); | |
| 73 | + | |
| 74 | + // generate the html | |
| 75 | + $oContent->setHtml(renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aPendingWebDocuments, $aDependantDocuments, $aRestorationRequests, $aBrowseableFolders, $aPublicFolders)); | |
| 69 | 76 | |
| 70 | 77 | // display |
| 71 | 78 | $main->setCentralPayload($oContent); | ... | ... |
presentation/lookAndFeel/knowledgeTree/dashboardUI.inc
| ... | ... | @@ -263,6 +263,66 @@ function renderDashboardNews() { |
| 263 | 263 | return $sToRender; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | + | |
| 267 | +function renderPublicFolders($aPublicFolders) { | |
| 268 | + global $default; | |
| 269 | + if (count($aPublicFolders) > 0) { | |
| 270 | + $sBgColor = "#9D9D7F"; | |
| 271 | + } else { | |
| 272 | + $sBgColor = "#CECEBF"; | |
| 273 | + } | |
| 274 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 275 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"> <img src=$default->graphicsUrl/widgets/dfolder.gif> <font color=\"ffffff\">" . _("Public Folders") . "</font></th>\n"; | |
| 276 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 277 | + for ($i = 0; $i < count($aPublicFolders); $i++) { | |
| 278 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 279 | + | |
| 280 | + $sToRender .= "\t\t\t\t<td colspan=\"2\">"; | |
| 281 | + $sToRender .= "<a href='$default->rootUrl/control.php?action=browse&fFolderID=". $aPublicFolders[$i]->getID()."'>"; | |
| 282 | + | |
| 283 | + $oUnit = Unit::get($aPublicFolders[$i]->getUnitID()); | |
| 284 | + if ($oUnit) { | |
| 285 | + $sToRender .= $aPublicFolders[$i]->getName() . " (<i>Unit: "; | |
| 286 | + $sToRender .= $oUnit->getName() . "</i>)</a></td>\n"; | |
| 287 | + } else { | |
| 288 | + $sToRender .= $aPublicFolders[$i]->getName() . " (<i>No Unit</i>)</a></td>\n"; | |
| 289 | + } | |
| 290 | + | |
| 291 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 292 | + } | |
| 293 | + return $sToRender; | |
| 294 | +} | |
| 295 | + | |
| 296 | +function renderBrowseableFolders($aBrowseableFolders) { | |
| 297 | + global $default; | |
| 298 | + if (count($aBrowseableFolders) > 0) { | |
| 299 | + $sBgColor = "#9D9D7F"; | |
| 300 | + } else { | |
| 301 | + $sBgColor = "#CECEBF"; | |
| 302 | + } | |
| 303 | + $sToRender = "\t\t\t<tr align=\"left\" bgcolor=\"$sBgColor\">\n"; | |
| 304 | + $sToRender .= "\t\t\t\t<th class=\"sectionHeading\" colspan=\"2\"> <img src=$default->graphicsUrl/widgets/dfolder.gif> <font color=\"ffffff\">" . _("Browseable Folders") . "</font></th>\n"; | |
| 305 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 306 | + for ($i = 0; $i < count($aBrowseableFolders); $i++) { | |
| 307 | + $sToRender .= "\t\t\t<tr>\n"; | |
| 308 | + | |
| 309 | + $sToRender .= "\t\t\t\t<td colspan=\"2\">"; | |
| 310 | + $sToRender .= "<a href='$default->rootUrl/control.php?action=browse&fFolderID=". $aBrowseableFolders[$i]->getID()."'>"; | |
| 311 | + | |
| 312 | + $oUnit = Unit::get($aBrowseableFolders[$i]->getUnitID()); | |
| 313 | + if ($oUnit) { | |
| 314 | + $sToRender .= $aBrowseableFolders[$i]->getName() . " (<i>Unit: "; | |
| 315 | + $sToRender .= $oUnit->getName() . "</i>)</a></td>\n"; | |
| 316 | + } else { | |
| 317 | + $sToRender .= $aBrowseableFolders[$i]->getName() . " (<i>No Unit</i>)</a></td>\n"; | |
| 318 | + } | |
| 319 | + | |
| 320 | + $sToRender .= "\t\t\t</tr>\n"; | |
| 321 | + } | |
| 322 | + return $sToRender; | |
| 323 | +} | |
| 324 | + | |
| 325 | + | |
| 266 | 326 | /** |
| 267 | 327 | * Renders the dashboard |
| 268 | 328 | * |
| ... | ... | @@ -270,7 +330,7 @@ function renderDashboardNews() { |
| 270 | 330 | * @param array checked out documents for this user |
| 271 | 331 | * @param array subscription alerts for this user |
| 272 | 332 | */ |
| 273 | -function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aWebDocuments, $aDependantDocuments, $aRestorationRequests) { | |
| 333 | +function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscriptionAlertList, $aQuickLinks, $aWebDocuments, $aDependantDocuments, $aRestorationRequests, $aBrowseableFolders, $aPublicFolders) { | |
| 274 | 334 | global $default; |
| 275 | 335 | |
| 276 | 336 | $sToRender = "<table border=\"0\" width=\"600\" >\n"; |
| ... | ... | @@ -300,6 +360,9 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript |
| 300 | 360 | $sToRender .= renderCheckedOutDocuments($aCheckedOutDocumentList) . "\n"; |
| 301 | 361 | $sToRender .= renderSubscriptionAlerts($aSubscriptionAlertList) . "\n"; |
| 302 | 362 | $sToRender .= renderDependantDocuments($aDependantDocuments) . "\n"; |
| 363 | + $sToRender .= "<td><br></td>\n"; | |
| 364 | + $sToRender .= renderBrowseableFolders($aBrowseableFolders) . "\n"; | |
| 365 | + $sToRender .= renderPublicFolders($aPublicFolders) . "\n"; | |
| 303 | 366 | $sToRender .= "\t\t\t</table>\n"; |
| 304 | 367 | $sToRender .= "\t\t</td>\n"; |
| 305 | 368 | |
| ... | ... | @@ -307,6 +370,7 @@ function renderPage($aPendingDocumentList, $aCheckedOutDocumentList, $aSubscript |
| 307 | 370 | $sToRender .= "\t\t<td width=\"50%\" valign=top>\n"; |
| 308 | 371 | $sToRender .= "\t\t\t<table width=\"100%\">\n"; |
| 309 | 372 | $sToRender .= renderQuickLinks($aQuickLinks); |
| 373 | + $sToRender .= "</td>\n"; | |
| 310 | 374 | $sToRender .= "\t\t\t</table>\n"; |
| 311 | 375 | |
| 312 | 376 | ... | ... |