Commit abbf7656645a24b8e2127c62b6837f06527d920f
1 parent
8273df9f
added contact unit admin image and functionality
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1522 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
39 additions
and
3 deletions
presentation/webpageTemplate.inc
| @@ -11,12 +11,45 @@ | @@ -11,12 +11,45 @@ | ||
| 11 | * @package presentation.lookandfeel | 11 | * @package presentation.lookandfeel |
| 12 | */ | 12 | */ |
| 13 | 13 | ||
| 14 | +require_once("$default->fileSystemRoot/lib/users/User.inc"); | ||
| 14 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); | 15 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternMainPage.inc"); |
| 15 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternImage.inc"); | 16 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternImage.inc"); |
| 16 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableLinks.inc"); | 17 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableLinks.inc"); |
| 17 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); | 18 | require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc"); |
| 18 | require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc"); | 19 | require_once("$default->fileSystemRoot/lib/visualpatterns/NavBar.inc"); |
| 19 | 20 | ||
| 21 | + | ||
| 22 | +function getUnitAdminEmail() { | ||
| 23 | + global $default; | ||
| 24 | + // find out what unit we're in | ||
| 25 | + $iUnitID = User::getUnitID($_SESSION["userID"]); | ||
| 26 | + if ($iUnitID) { | ||
| 27 | + // then find the group that is unit_admin | ||
| 28 | + $sql = $default->db; | ||
| 29 | + $sEmail = ""; | ||
| 30 | + if ($sql->query("SELECT group_id FROM $default->owl_groups_units_table GUL " . | ||
| 31 | + "INNER JOIN $default->owl_groups_table GL on GUL.group_id=GL.id " . | ||
| 32 | + "WHERE GL.is_unit_admin=1 " . | ||
| 33 | + "AND unit_id=$iUnitID")) { | ||
| 34 | + // get the first record | ||
| 35 | + if ($sql->next_record()) { | ||
| 36 | + $iGroupID = $sql->f("group_id"); | ||
| 37 | + // then find the first user in this group that has an email address | ||
| 38 | + if ($sql->query("SELECT U.email FROM $default->owl_users_table U " . | ||
| 39 | + "INNER JOIN $default->owl_users_groups_table UGL on UGL.user_id=U.id " . | ||
| 40 | + "WHERE group_id=$iGroupID")) { | ||
| 41 | + while ($sql->next_record()) { | ||
| 42 | + if (strlen($sql->f("email")) > 0) { | ||
| 43 | + $sEmail = $sql->f("email"); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + } | ||
| 47 | + } | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + return ($sEmail == "") ? $default->emailAdmin : $sEmail; | ||
| 51 | +} | ||
| 52 | + | ||
| 20 | // create the navbar and north payload | 53 | // create the navbar and north payload |
| 21 | $navbar = & new NavBar($fBrowseType, $fFolderID, $fDocumentID, $fCategoryName, $fDocumentTypeID); | 54 | $navbar = & new NavBar($fBrowseType, $fFolderID, $fDocumentID, $fCategoryName, $fDocumentTypeID); |
| 22 | 55 | ||
| @@ -33,10 +66,11 @@ $navbar->setHighlightedSection($sectionName); | @@ -33,10 +66,11 @@ $navbar->setHighlightedSection($sectionName); | ||
| 33 | 66 | ||
| 34 | // setup nw payload | 67 | // setup nw payload |
| 35 | $colourBar = $navbar->getNWColourbar(); | 68 | $colourBar = $navbar->getNWColourbar(); |
| 36 | -$nwestLoad = "<table width=\"100%\" height=\"100%\">\n" . | 69 | +$nwestLoad = "<table cellspacing=0 cellpadding=0 border=0>\n" . |
| 37 | "<tr><td><img valign=\"top\" src=\"$default->graphicsUrl/tree.gif\"/></td></tr>\n" . | 70 | "<tr><td><img valign=\"top\" src=\"$default->graphicsUrl/tree.gif\"/></td></tr>\n" . |
| 38 | "<tr><td><img valign=\"top\" src=\"$colourBar\"/></td></tr>\n" . | 71 | "<tr><td><img valign=\"top\" src=\"$colourBar\"/></td></tr>\n" . |
| 39 | "</table>"; | 72 | "</table>"; |
| 73 | + | ||
| 40 | 74 | ||
| 41 | $nwPayLoad = new PatternCustom; | 75 | $nwPayLoad = new PatternCustom; |
| 42 | $nwPayLoad ->setHtml($nwestLoad); | 76 | $nwPayLoad ->setHtml($nwestLoad); |
| @@ -60,11 +94,13 @@ if ($sectionName != "General") { | @@ -60,11 +94,13 @@ if ($sectionName != "General") { | ||
| 60 | 94 | ||
| 61 | //set up links | 95 | //set up links |
| 62 | $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ; | 96 | $cAdmin = "$default->graphicsUrl/leftnav/cadmin.gif" ; |
| 97 | +$uAdmin = "$default->graphicsUrl/leftnav/uadmin.gif" ; | ||
| 63 | 98 | ||
| 64 | //setup the westpayload | 99 | //setup the westpayload |
| 65 | -$westLoad = "<table cellspacing=\"5\" cellpadding=\"5\" border=\"0\" width=\"100%\" height=\"75%\">\n" . | 100 | +$westLoad = "<table cellspacing=\"0\" cellpadding=\"2\" border=\"0\" width=\"100%\" height=\"75%\">\n" . |
| 66 | "\t<tr><td>$westRender</td></tr>\n" . | 101 | "\t<tr><td>$westRender</td></tr>\n" . |
| 67 | - "\t<tr><td><a href=\"mailto:$default->emailAdmin\"><img src=\"$cAdmin\"/ border=\"0\"></a></td></tr>\n" . | 102 | + "\t<tr><td align=left><a href=\"mailto:$default->emailAdmin\"><img src=\"$cAdmin\"/ border=\"0\"></a></td></tr>\n" . |
| 103 | + "\t<tr><td align=left><a href=\"mailto:" . getUnitAdminEmail() . "\"><img src=\"$uAdmin\"/ border=\"0\"></a></td></tr>\n" . | ||
| 68 | "</table>"; | 104 | "</table>"; |
| 69 | 105 | ||
| 70 | $westPayLoad = new PatternCustom; | 106 | $westPayLoad = new PatternCustom; |