Commit 71eaf359fee6e132fc1b2db035ee406fa9cd78f6
1 parent
373b960c
updated to handle more than 1 admin section
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@943 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
152 additions
and
116 deletions
lib/visualpatterns/NavBar.inc
| ... | ... | @@ -19,113 +19,136 @@ global $default; |
| 19 | 19 | * @author Mukhtar Dharsey |
| 20 | 20 | * @date 22 January 2003 |
| 21 | 21 | */ |
| 22 | -class NavBar { | |
| 23 | - //variable used to pass highlighting | |
| 24 | - var $home; | |
| 25 | - var $mdocs; | |
| 26 | - var $subscriptions; | |
| 27 | - var $asearch; | |
| 28 | - var $admin; | |
| 29 | - var $prefs; | |
| 30 | - var $help; | |
| 31 | - var $logout; | |
| 32 | - var $nwColourbar; | |
| 22 | +class NavBar | |
| 23 | +{ | |
| 24 | + //variable used to pass highlighting | |
| 25 | + var $home; | |
| 26 | + var $mdocs; | |
| 27 | + var $subscriptions; | |
| 28 | + var $asearch; | |
| 29 | + var $admin; | |
| 30 | + var $prefs; | |
| 31 | + var $help; | |
| 32 | + var $logout; | |
| 33 | + var $nwColourbar; | |
| 34 | + | |
| 35 | + function NavBar() | |
| 36 | + { | |
| 37 | + global $default; | |
| 38 | + $this->mdocs = "$default->owl_graphics_url/mdocs/norm.gif"; | |
| 39 | + $this->home = "$default->owl_graphics_url/home/norm.gif"; | |
| 40 | + $this->subscriptions = "$default->owl_graphics_url/subscriptions/norm.gif"; | |
| 41 | + $this->asearch = "$default->owl_graphics_url/asearch/norm.gif"; | |
| 42 | + $this->admin = "$default->owl_graphics_url/admin/norm.gif"; | |
| 43 | + $this->prefs = "$default->owl_graphics_url/prefs/norm.gif"; | |
| 44 | + $this->help = "$default->owl_graphics_url/help/norm.gif"; | |
| 45 | + $this->logout = "$default->owl_graphics_url/logout/norm.gif"; | |
| 46 | + | |
| 47 | + } | |
| 48 | + | |
| 49 | + | |
| 50 | + /** | |
| 51 | + * gets the url for the colour bar | |
| 52 | + * | |
| 53 | + * @param The section that needs to be highlighted | |
| 54 | + */ | |
| 55 | + function getNWColourbar() | |
| 56 | + { | |
| 57 | + return $this->nwColourBar; | |
| 58 | + } | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * sets a highlighted section varaibles | |
| 64 | + * | |
| 65 | + * @param The section that needs to be highlighted | |
| 66 | + */ | |
| 67 | + function setHighlightedSection($section) | |
| 68 | + { | |
| 69 | + global $default; | |
| 70 | + | |
| 71 | + // check for highlighting..and highlight as required | |
| 72 | + if($section == "General") | |
| 73 | + { | |
| 74 | + $this->home = "$default->owl_graphics_url/home/over.gif"; | |
| 75 | + $this->nwColourBar = "$default->owl_graphics_url/home/def.gif"; | |
| 76 | + } | |
| 77 | + | |
| 78 | + if($section == "Manage Documents") | |
| 79 | + { | |
| 80 | + $this->mdocs = "$default->owl_graphics_url/mdocs/over.gif"; | |
| 81 | + $this->nwColourBar = "$default->owl_graphics_url/mdocs/def.gif"; | |
| 82 | + } | |
| 83 | + | |
| 84 | + if($section == "Subscriptions") | |
| 85 | + { | |
| 86 | + $this->subscriptions = "$default->owl_graphics_url/subscriptions/over.gif"; | |
| 87 | + $this->nwColourBar = "$default->owl_graphics_url/subscriptions/def.gif"; | |
| 88 | + } | |
| 89 | + | |
| 90 | + if($section == "Advanced Search") | |
| 91 | + { | |
| 92 | + $this->asearch = "$default->owl_graphics_url/asearch/over.gif"; | |
| 93 | + $this->nwColourBar = "$default->owl_graphics_url/asearch/def.gif"; | |
| 94 | + } | |
| 95 | + | |
| 96 | + | |
| 97 | + if(substr($section, -14) == "Administration") | |
| 98 | + { | |
| 99 | + $this->admin = "$default->owl_graphics_url/admin/over.gif"; | |
| 100 | + $this->nwColourBar = "$default->owl_graphics_url/admin/def.gif"; | |
| 101 | + } | |
| 102 | + | |
| 103 | + if($section == "Preferences") | |
| 104 | + { | |
| 105 | + $this->prefs = "$default->owl_graphics_url/prefs/over.gif"; | |
| 106 | + $this->nwColourBar = "$default->owl_graphics_url/prefs/def.gif"; | |
| 107 | + } | |
| 108 | + | |
| 109 | + if($section == "Help") | |
| 110 | + { | |
| 111 | + $this->help = "$default->owl_graphics_url/help/over.gif"; | |
| 112 | + $this->nwColourBar = "$default->owl_graphics_url/help/def.gif"; | |
| 113 | + } | |
| 114 | + | |
| 115 | + | |
| 116 | + if($section == "Logout") | |
| 117 | + { | |
| 118 | + $this->logout = "$default->owl_graphics_url/logout/over.gif"; | |
| 119 | + $this->nwColourBar = "$default->owl_graphics_url/logout/def.gif"; | |
| 120 | + } | |
| 121 | + } | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + /** | |
| 126 | + * | |
| 127 | + * this function creates the navbar for a specific page... | |
| 128 | + * | |
| 129 | + * | |
| 130 | + */ | |
| 131 | + function render() | |
| 132 | + { | |
| 133 | + global $default; | |
| 134 | + | |
| 135 | + //set up headings for row 1 and 2 | |
| 136 | + $heading = "$default->owl_graphics_url/heading.gif"; | |
| 137 | + $hStretched = "$default->owl_graphics_url/hrepeat.gif"; | |
| 138 | + | |
| 139 | + // set colour pics for row 4 of navbar | |
| 140 | + $colourHome = "$default->owl_graphics_url/home/colour.gif"; | |
| 141 | + $colourmdocs = "$default->owl_graphics_url/mdocs/colour.gif"; | |
| 142 | + $coloursubscriptions = "$default->owl_graphics_url/subscriptions/colour.gif"; | |
| 143 | + $colourasearch = "$default->owl_graphics_url/asearch/colour.gif"; | |
| 144 | + $colouradmin = "$default->owl_graphics_url/admin/colour.gif"; | |
| 145 | + $colourprefs = "$default->owl_graphics_url/prefs/colour.gif"; | |
| 146 | + $colourhelp = "$default->owl_graphics_url/help/colour.gif"; | |
| 147 | + $colourlogout = "$default->owl_graphics_url/logout/colour.gif"; | |
| 148 | + | |
| 149 | + | |
| 150 | + // get list of sections | |
| 33 | 151 | |
| 34 | - function NavBar() { | |
| 35 | - global $default; | |
| 36 | - $this->mdocs = "$default->owl_graphics_url/mdocs/norm.gif"; | |
| 37 | - $this->home = "$default->owl_graphics_url/home/norm.gif"; | |
| 38 | - $this->subscriptions = "$default->owl_graphics_url/subscriptions/norm.gif"; | |
| 39 | - $this->asearch = "$default->owl_graphics_url/asearch/norm.gif"; | |
| 40 | - $this->admin = "$default->owl_graphics_url/admin/norm.gif"; | |
| 41 | - $this->prefs = "$default->owl_graphics_url/prefs/norm.gif"; | |
| 42 | - $this->help = "$default->owl_graphics_url/help/norm.gif"; | |
| 43 | - $this->logout = "$default->owl_graphics_url/logout/norm.gif"; | |
| 44 | - | |
| 45 | - } | |
| 46 | - | |
| 47 | - /** | |
| 48 | - * gets the url for the colour bar | |
| 49 | - * | |
| 50 | - * @param The section that needs to be highlighted | |
| 51 | - */ | |
| 52 | - function getNWColourbar() { | |
| 53 | - return $this->nwColourBar; | |
| 54 | - } | |
| 55 | - | |
| 56 | - /** | |
| 57 | - * sets a highlighted section varaibles | |
| 58 | - * | |
| 59 | - * @param The section that needs to be highlighted | |
| 60 | - */ | |
| 61 | - function setHighlightedSection($section) { | |
| 62 | - global $default; | |
| 63 | - | |
| 64 | - // check for highlighting..and highlight as required | |
| 65 | - if($section == "General") { | |
| 66 | - $this->home = "$default->owl_graphics_url/home/over.gif"; | |
| 67 | - $this->nwColourBar = "$default->owl_graphics_url/home/def.gif"; | |
| 68 | - } | |
| 69 | - | |
| 70 | - if($section == "Manage Documents") { | |
| 71 | - $this->mdocs = "$default->owl_graphics_url/mdocs/over.gif"; | |
| 72 | - $this->nwColourBar = "$default->owl_graphics_url/mdocs/def.gif"; | |
| 73 | - } | |
| 74 | - | |
| 75 | - if($section == "Subscriptions") { | |
| 76 | - $this->subscriptions = "$default->owl_graphics_url/subscriptions/over.gif"; | |
| 77 | - $this->nwColourBar = "$default->owl_graphics_url/subscriptions/def.gif"; | |
| 78 | - } | |
| 79 | - | |
| 80 | - if($section == "Advanced Search") { | |
| 81 | - $this->asearch = "$default->owl_graphics_url/asearch/over.gif"; | |
| 82 | - $this->nwColourBar = "$default->owl_graphics_url/asearch/def.gif"; | |
| 83 | - } | |
| 84 | - | |
| 85 | - | |
| 86 | - if($section == "Administration") { | |
| 87 | - $this->admin = "$default->owl_graphics_url/admin/over.gif"; | |
| 88 | - $this->nwColourBar = "$default->owl_graphics_url/admin/def.gif"; | |
| 89 | - } | |
| 90 | - | |
| 91 | - if($section == "Preferences") { | |
| 92 | - $this->prefs = "$default->owl_graphics_url/prefs/over.gif"; | |
| 93 | - $this->nwColourBar = "$default->owl_graphics_url/prefs/def.gif"; | |
| 94 | - } | |
| 95 | - | |
| 96 | - if($section == "Help") { | |
| 97 | - $this->help = "$default->owl_graphics_url/help/over.gif"; | |
| 98 | - $this->nwColourBar = "$default->owl_graphics_url/help/def.gif"; | |
| 99 | - } | |
| 100 | - | |
| 101 | - if($section == "Logout") { | |
| 102 | - $this->logout = "$default->owl_graphics_url/logout/over.gif"; | |
| 103 | - $this->nwColourBar = "$default->owl_graphics_url/logout/def.gif"; | |
| 104 | - } | |
| 105 | - } | |
| 106 | - | |
| 107 | - /** | |
| 108 | - * this function creates the navbar for a specific page... | |
| 109 | - */ | |
| 110 | - function render() { | |
| 111 | - global $default; | |
| 112 | - | |
| 113 | - //set up headings for row 1 and 2 | |
| 114 | - $heading = "$default->owl_graphics_url/heading.gif"; | |
| 115 | - $hStretched = "$default->owl_graphics_url/hrepeat.gif"; | |
| 116 | - | |
| 117 | - // set colour pics for row 4 of navbar | |
| 118 | - $colourHome = "$default->owl_graphics_url/home/colour.gif"; | |
| 119 | - $colourmdocs = "$default->owl_graphics_url/mdocs/colour.gif"; | |
| 120 | - $coloursubscriptions = "$default->owl_graphics_url/subscriptions/colour.gif"; | |
| 121 | - $colourasearch = "$default->owl_graphics_url/asearch/colour.gif"; | |
| 122 | - $colouradmin = "$default->owl_graphics_url/admin/colour.gif"; | |
| 123 | - $colourprefs = "$default->owl_graphics_url/prefs/colour.gif"; | |
| 124 | - $colourhelp = "$default->owl_graphics_url/help/colour.gif"; | |
| 125 | - $colourlogout = "$default->owl_graphics_url/logout/colour.gif"; | |
| 126 | - | |
| 127 | - | |
| 128 | - // get list of sections | |
| 129 | 152 | $aTopMenuLinks = array(generateControllerUrl("dashboard"), |
| 130 | 153 | generateControllerUrl($default->siteMap->getDefaultAction("Manage Documents")), |
| 131 | 154 | generateControllerUrl($default->siteMap->getDefaultAction("Subscriptions")), | ... | ... |
presentation/webpageTemplate.inc
| ... | ... | @@ -20,8 +20,13 @@ require_once("$default->owl_fs_root/lib/visualpatterns/NavBar.inc"); |
| 20 | 20 | // create the navbar and north payload |
| 21 | 21 | $navbar = new NavBar(); |
| 22 | 22 | |
| 23 | -//get the section name | |
| 24 | -$sectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->owl_root_url), strlen($_SERVER["PHP_SELF"]))); | |
| 23 | + | |
| 24 | +if ($sectionName == "") | |
| 25 | +//get the section name if not specified in the url | |
| 26 | +{ | |
| 27 | + $sectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->owl_root_url), strlen($_SERVER["PHP_SELF"]))); | |
| 28 | +} | |
| 29 | + | |
| 25 | 30 | |
| 26 | 31 | //highlight the respective section |
| 27 | 32 | $navbar->setHighlightedSection($sectionName); |
| ... | ... | @@ -48,16 +53,24 @@ $nwPayLoad ->setHtml($nwestLoad); |
| 48 | 53 | if ($sectionName != "General") { |
| 49 | 54 | $sectionArray = $default->siteMap->getSectionLinks($sectionName); |
| 50 | 55 | |
| 51 | - //format the array..by taking first element off | |
| 52 | - $output1["links"] = array_shift ($sectionArray["links"]); | |
| 53 | - $output2["descriptions"] = array_shift($sectionArray["descriptions"]); | |
| 56 | + //format the array..by taking first element off if its not an admin section | |
| 57 | + if((substr($sectionName, -14)) == "Administration" and (strlen($sectionName) > 15)){ | |
| 58 | + $output1["links"] = $sectionArray["links"]; | |
| 59 | + $output2["descriptions"] = $sectionArray["descriptions"]; | |
| 60 | + } | |
| 61 | + else{ | |
| 62 | + $output1["links"] = array_shift ($sectionArray["links"]); | |
| 63 | + $output2["descriptions"] = array_shift($sectionArray["descriptions"]); | |
| 64 | + } | |
| 65 | + | |
| 66 | + //create links | |
| 67 | + $westLinks = new PatternTableLinks($sectionArray["links"], $sectionArray["descriptions"], 40 , 1 ,1,null); | |
| 68 | + $westRender = $westLinks->render(); | |
| 54 | 69 | |
| 55 | - //create links | |
| 56 | - $westLinks = new PatternTableLinks($sectionArray["links"], $sectionArray["descriptions"], 50 , 1 ,1,null); | |
| 57 | - $westRender = $westLinks->render(); | |
| 58 | 70 | } else { |
| 59 | - $westLinks = new PatternTableLinks(array(), array(), 50 , 1 ,1,null); | |
| 60 | - $westRender = $westLinks->render(); | |
| 71 | + $westLinks = new PatternTableLinks(array(), array(), 40 , 1 ,1,null); | |
| 72 | + $westRender = $westLinks->render(); | |
| 73 | + | |
| 61 | 74 | } |
| 62 | 75 | |
| 63 | 76 | //set up links | ... | ... |