Commit 3493c2fdabbc3b1b0ee2144913c31f048fa84acb
1 parent
d1d5dfef
Remove obsolete and unused file.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4297 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
0 additions
and
319 deletions
lib/visualpatterns/NavBar.inc deleted
| 1 | -<?php | ||
| 2 | -require_once(KT_LIB_DIR . "/visualpatterns/PatternCustom.inc"); | ||
| 3 | -/** | ||
| 4 | - * $Id$ | ||
| 5 | - * | ||
| 6 | - * Contains all the functions to create the Navbar. | ||
| 7 | - * | ||
| 8 | - * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 9 | - * | ||
| 10 | - * This program is free software; you can redistribute it and/or modify | ||
| 11 | - * it under the terms of the GNU General Public License as published by | ||
| 12 | - * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | - * (at your option) any later version. | ||
| 14 | - * | ||
| 15 | - * This program is distributed in the hope that it will be useful, | ||
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | - * GNU General Public License for more details. | ||
| 19 | - * | ||
| 20 | - * You should have received a copy of the GNU General Public License | ||
| 21 | - * along with this program; if not, write to the Free Software | ||
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | - * | ||
| 24 | - * @version $Revision$ | ||
| 25 | - * @author Mukhtar Dharsey, Jam Warehouse (Pty) Ltd, South Africa | ||
| 26 | - * @package lib.visualpatterns | ||
| 27 | - */ | ||
| 28 | -class NavBar { | ||
| 29 | - //variable used to pass highlighting | ||
| 30 | - var $home; | ||
| 31 | - var $mdocs; | ||
| 32 | - var $subscriptions; | ||
| 33 | - var $asearch; | ||
| 34 | - var $admin; | ||
| 35 | - var $prefs; | ||
| 36 | - var $help; | ||
| 37 | - var $logout; | ||
| 38 | - var $nwColourbar; | ||
| 39 | - var $sSection; | ||
| 40 | - | ||
| 41 | - /** variables used for searching */ | ||
| 42 | - var $sBrowseType; | ||
| 43 | - var $iFolderID; | ||
| 44 | - var $iDocumentID; | ||
| 45 | - var $sCategoryName; | ||
| 46 | - var $iDocTypeID; | ||
| 47 | - | ||
| 48 | - function NavBar($sTmpBrowseType, $iTmpFolderID, $iTmpDocumentID, $sTmpCategoryName, $iTmpDocTypeID) { | ||
| 49 | - global $default; | ||
| 50 | - | ||
| 51 | - $this->sBrowseType = $iTmpBrowseType; | ||
| 52 | - $this->iFolderID = $iTmpFolderID; | ||
| 53 | - $this->iDocumentID = $iTmpDocumentID; | ||
| 54 | - $this->sCategoryName = $sTmpCategoryName; | ||
| 55 | - $this->iDocTypeID = $iTmpDocTypeID; | ||
| 56 | - | ||
| 57 | - $this->mdocs = "$default->graphicsUrl/navbar/mdocs/norm.gif"; | ||
| 58 | - $this->home = "$default->graphicsUrl/navbar/home/norm.gif"; | ||
| 59 | - $this->subscriptions = "$default->graphicsUrl/navbar/subscriptions/norm.gif"; | ||
| 60 | - $this->asearch = "$default->graphicsUrl/navbar/asearch/norm.gif"; | ||
| 61 | - $this->admin = "$default->graphicsUrl/navbar/admin/norm.gif"; | ||
| 62 | - $this->prefs = "$default->graphicsUrl/navbar/prefs/norm.gif"; | ||
| 63 | - $this->help = "$default->graphicsUrl/navbar/help/norm.gif"; | ||
| 64 | - $this->logout = "$default->graphicsUrl/navbar/logout/norm.gif"; | ||
| 65 | - | ||
| 66 | - $this->mdocsClass = "dash"; | ||
| 67 | - $this->homeClass = "dash"; | ||
| 68 | - $this->subscriptionsClass = "dash"; | ||
| 69 | - $this->asearchClass = "dash"; | ||
| 70 | - $this->adminClass = "dash"; | ||
| 71 | - $this->prefsClass = "dash"; | ||
| 72 | - $this->helpClass = "dash"; | ||
| 73 | - $this->logoutClass = "dash"; | ||
| 74 | - } | ||
| 75 | - | ||
| 76 | - /** | ||
| 77 | - * gets the url for the colour bar | ||
| 78 | - * | ||
| 79 | - * @param The section that needs to be highlighted | ||
| 80 | - */ | ||
| 81 | - function getNWColourbar() { | ||
| 82 | - return $this->nwColourBar; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * sets a highlighted section varaibles | ||
| 87 | - * | ||
| 88 | - * @param The section that needs to be highlighted | ||
| 89 | - */ | ||
| 90 | - function setHighlightedSection($section) { | ||
| 91 | - global $default; | ||
| 92 | - $this->sSection = $section; | ||
| 93 | - | ||
| 94 | - // check for highlighting..and highlight as required | ||
| 95 | - if($section == "General") { | ||
| 96 | - $this->home = "$default->graphicsUrl/navbar/home/over.gif"; | ||
| 97 | - $this->nwColourBar = "$default->graphicsUrl/navbar/home/def.gif"; | ||
| 98 | - $this->homeClass = "dashactive"; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - if(($section == "Manage Documents") || ($section == "Manage Categories") || ($section == "Manage Document Types")) { | ||
| 102 | - $this->mdocs = "$default->graphicsUrl/navbar/mdocs/over.gif"; | ||
| 103 | - $this->nwColourBar = "$default->graphicsUrl/navbar/mdocs/def.gif"; | ||
| 104 | - $this->mdocsClass = "dashactive"; | ||
| 105 | - } | ||
| 106 | - if($section == "Discussion Threads" ) { | ||
| 107 | - $this->mdocs = "$default->graphicsUrl/navbar/mdocs/over.gif"; | ||
| 108 | - $this->nwColourBar = "$default->graphicsUrl/navbar/mdocs/def.gif"; | ||
| 109 | - $this->mdocsClass = "dashactive"; | ||
| 110 | - } | ||
| 111 | - | ||
| 112 | - if($section == "Subscriptions") { | ||
| 113 | - $this->subscriptions = "$default->graphicsUrl/navbar/subscriptions/over.gif"; | ||
| 114 | - $this->nwColourBar = "$default->graphicsUrl/navbar/subscriptions/def.gif"; | ||
| 115 | - $this->subscriptionsClass = "dashactive"; | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | - if(($section == "Standard Search") || ($section == "Advanced Search")) { | ||
| 119 | - $this->asearch = "$default->graphicsUrl/navbar/asearch/over.gif"; | ||
| 120 | - $this->nwColourBar = "$default->graphicsUrl/navbar/asearch/def.gif"; | ||
| 121 | - $this->asearchClass = "dashactive"; | ||
| 122 | - } | ||
| 123 | - | ||
| 124 | - if(substr($section, -14) == "Administration") { | ||
| 125 | - $this->admin = "$default->graphicsUrl/navbar/admin/over.gif"; | ||
| 126 | - $this->nwColourBar = "$default->graphicsUrl/navbar/admin/def.gif"; | ||
| 127 | - $this->adminClass = "dashactive"; | ||
| 128 | - } | ||
| 129 | - | ||
| 130 | - if($section == "Preferences") { | ||
| 131 | - $this->prefs = "$default->graphicsUrl/navbar/prefs/over.gif"; | ||
| 132 | - $this->nwColourBar = "$default->graphicsUrl/navbar/prefs/def.gif"; | ||
| 133 | - $this->prefsClass = "dashactive"; | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | - if($section == "Help") { | ||
| 137 | - $this->help = "$default->graphicsUrl/navbar/help/over.gif"; | ||
| 138 | - $this->nwColourBar = "$default->graphicsUrl/navbar/help/def.gif"; | ||
| 139 | - $this->helpClass = "dashactive"; | ||
| 140 | - } | ||
| 141 | - | ||
| 142 | - if($section == "Logout") { | ||
| 143 | - $this->logout = "$default->graphicsUrl/navbar/logout/over.gif"; | ||
| 144 | - $this->nwColourBar = "$default->graphicsUrl/navbar/logout/def.gif"; | ||
| 145 | - $this->logoutClass = "dashactive"; | ||
| 146 | - } | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - /** | ||
| 150 | - * this function creates the navbar for a specific page... | ||
| 151 | - */ | ||
| 152 | - function render() { | ||
| 153 | - global $default; | ||
| 154 | - | ||
| 155 | - //set up headings for row 1 and 2 | ||
| 156 | - $heading = "$default->graphicsUrl/heading.gif"; | ||
| 157 | - $hStretched = "$default->graphicsUrl/hrepeat.gif"; | ||
| 158 | - | ||
| 159 | - // set colour pics for row 4 of navbar | ||
| 160 | - $colourHome = "$default->graphicsUrl/navbar/home/colour.gif"; | ||
| 161 | - $colourmdocs = "$default->graphicsUrl/navbar/mdocs/colour.gif"; | ||
| 162 | - $coloursubscriptions = "$default->graphicsUrl/navbar/subscriptions/colour.gif"; | ||
| 163 | - $colourasearch = "$default->graphicsUrl/navbar/asearch/colour.gif"; | ||
| 164 | - $colouradmin = "$default->graphicsUrl/navbar/admin/colour.gif"; | ||
| 165 | - $colourprefs = "$default->graphicsUrl/navbar/prefs/colour.gif"; | ||
| 166 | - $colourhelp = "$default->graphicsUrl/navbar/help/colour.gif"; | ||
| 167 | - $colourlogout = "$default->graphicsUrl/navbar/logout/colour.gif"; | ||
| 168 | - | ||
| 169 | - // get list of sections | ||
| 170 | - $aTopMenuLinks = array(generateControllerUrl("dashboard"), | ||
| 171 | - generateControllerUrl($default->siteMap->getDefaultAction("Manage Documents")), | ||
| 172 | - generateControllerUrl($default->siteMap->getDefaultAction("Subscriptions")), | ||
| 173 | - generateControllerUrl($default->siteMap->getDefaultAction("Advanced Search")), | ||
| 174 | - generateControllerUrl($default->siteMap->getDefaultAction("Administration")), | ||
| 175 | - generateControllerUrl($default->siteMap->getDefaultAction("Preferences")), | ||
| 176 | - "help", | ||
| 177 | - generateControllerUrl($default->siteMap->getDefaultAction("Logout"))); | ||
| 178 | - | ||
| 179 | - // create array of images for navbar sections | ||
| 180 | - $aTopMenuImages = array($this->home, | ||
| 181 | - $this->mdocs, | ||
| 182 | - $this->subscriptions, | ||
| 183 | - $this->asearch, | ||
| 184 | - $this->admin, | ||
| 185 | - $this->prefs, | ||
| 186 | - $this->help, | ||
| 187 | - $this->logout); | ||
| 188 | - | ||
| 189 | - $aTopMenuClasses = array($this->homeClass, | ||
| 190 | - $this->mdocsClass, | ||
| 191 | - $this->subscriptionsClass, | ||
| 192 | - $this->asearchClass, | ||
| 193 | - $this->adminClass, | ||
| 194 | - $this->prefsClass, | ||
| 195 | - $this->helpClass, | ||
| 196 | - $this->logoutClass); | ||
| 197 | - | ||
| 198 | - $aTopMenuWords = array( | ||
| 199 | - _("Dashboard"), | ||
| 200 | - _("Browse Collections"), | ||
| 201 | - _("Subscriptions"), | ||
| 202 | - _("Advanced Search"), | ||
| 203 | - _("Admin"), | ||
| 204 | - _("Preferences"), | ||
| 205 | - _("Help"), | ||
| 206 | - _("Logout"), | ||
| 207 | - ); | ||
| 208 | - | ||
| 209 | - $aTopMenuColourClass = array( | ||
| 210 | - "dashboard", | ||
| 211 | - "browse", | ||
| 212 | - "subscriptions", | ||
| 213 | - "asearch", | ||
| 214 | - "admin", | ||
| 215 | - "prefs", | ||
| 216 | - "help", | ||
| 217 | - "logout", | ||
| 218 | - ); | ||
| 219 | - | ||
| 220 | - // create array of menu colour images | ||
| 221 | - $aColourMenuImages = array($colourHome,$colourmdocs,$coloursubscriptions,$colourasearch,$colouradmin,$colourprefs,$colourhelp,$colourlogout); | ||
| 222 | - | ||
| 223 | - if ($default->useTextButtons === false) { | ||
| 224 | - //set up the links | ||
| 225 | - for ($i = 0; $i < count($aTopMenuLinks); $i++) { | ||
| 226 | - if (strcmp($aTopMenuLinks[$i], "help") == 0) { | ||
| 227 | - $sTopMenu .= "<td width=\"10\"><a href=\"#\" onClick=\"javascript:helpWindow();\"><img src=\"" . $aTopMenuImages[$i] . "\" border=\"0\" /></a></td>\n"; | ||
| 228 | - $sColourMenu .= "<td width=\"10\"><a href=\"#\" onClick=\"javascript:helpWindow();\"><img src=\"" . $aColourMenuImages[$i] . "\" border=\"0\" /></a></td>\n"; | ||
| 229 | - } else { | ||
| 230 | - $sTopMenu .= "<td width=\"10\">" . (strlen($aTopMenuLinks[$i]) > 0 ? "<a href=\"" . $aTopMenuLinks[$i] . "\">" : "") . "<img src=\"" . $aTopMenuImages[$i] . "\" border=\"0\" /></a></td>\n"; | ||
| 231 | - $sColourMenu .= "<td width=\"10\">" . (strlen($aTopMenuLinks[$i]) > 0 ? "<a href=\"" . $aTopMenuLinks[$i] . "\">" : "") . "<img src=\"" . $aColourMenuImages[$i] . "\" border=\"0\"/></a></td>\n"; | ||
| 232 | - } | ||
| 233 | - } | ||
| 234 | - } else { | ||
| 235 | - for ($i = 0; $i < count($aTopMenuLinks); $i++) { | ||
| 236 | - if (strcmp($aTopMenuLinks[$i], "help") == 0) { | ||
| 237 | - $sTopMenu .= "<td valign=\"top\"><a href=\"#\" onClick=\"javascript:helpWindow();\"><span class=\"" . $aTopMenuClasses[$i] . "\">" . strtoupper($aTopMenuWords[$i]) . "</span></a></td>\n"; | ||
| 238 | - $sColourMenu .= "<td valign=\"top\" class=\"colour_" . $aTopMenuColourClass[$i] . "\"><a href=\"#\" onClick=\"javascript:helpWindow();\"><span> </span></a></td>\n"; | ||
| 239 | - } else { | ||
| 240 | - $sTopMenu .= "<td valign=\"top\">" . (strlen($aTopMenuLinks[$i]) > 0 ? "<a href=\"" . $aTopMenuLinks[$i] . "\">" : "") . "<span class=\"" . $aTopMenuClasses[$i] . "\">" . strtoupper($aTopMenuWords[$i]) . "</span></a></td>\n"; | ||
| 241 | - $sColourMenu .= "<td valign=\"top\" class=\"colour_" . $aTopMenuColourClass[$i] . "\">" . (strlen($aTopMenuLinks[$i]) > 0 ? "<a href=\"" . $aTopMenuLinks[$i] . "\">" : "") . "<span> </span></a></td>\n"; | ||
| 242 | - } | ||
| 243 | - } | ||
| 244 | - } | ||
| 245 | - | ||
| 246 | - $toRender = new PatternCustom; | ||
| 247 | - | ||
| 248 | - // build the nav bar | ||
| 249 | - $bar = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"608\">\n"; | ||
| 250 | - $bar .= "\t<tr height=\"30\">\n"; | ||
| 251 | - $bar .= "\t\t<td valign=\"top\" width=\"100%\" colspan=\"2\" bgcolor=\"#1A4383\"><img src=\"$heading\"/><img src=\"$default->graphicsUrl/logo.jpg\" width=\"30\" height=\"36\" style=\"border-right:3px solid white;\"/></td>\n"; | ||
| 252 | - $bar .= "\t</tr>\n"; | ||
| 253 | - $bar .= "\t<tr height=\"30\">\n"; | ||
| 254 | - $bar .= "\t\t<td colspan=\"2\" bgcolor=\"#1A4383\" width=\"100%\">"; | ||
| 255 | - $bar .= "<img align=\"absmiddle\" src=\"$default->graphicsUrl/arrow.gif\" ></img>\n"; | ||
| 256 | - | ||
| 257 | - $bar .= "<INPUT type=\"hidden\" name=\"fForStandardSearch\" value=\"no\" />\n "; | ||
| 258 | - //disable the search bar if we are browsing search results | ||
| 259 | - if ((strcmp($this->sSection,"Standard Search") == 0) || (strcmp($this->sSection,"Advanced Search") == 0)) { | ||
| 260 | - $bar .= "<INPUT type=\"hidden\" name=\"fSearchText\"/>\n "; | ||
| 261 | - } else { | ||
| 262 | - $bar .= "<INPUT type=\"text\" name=\"fSearchText\" width=\"30\" height = \"10\" onKeyPress=\"return checkKeyPressed(event, validateStandardSearch, '" . $default->rootUrl . "/control.php')\"/>\n"; | ||
| 263 | - (isset($this->iFolderID) ? $bar .= "<INPUT type=\"hidden\" name=\"fFolderID\" value=\"" . $this->iFolderID . "\" />\n " : $bar .= ""); | ||
| 264 | - (isset($this->iDocumentID) ? $bar .= "<INPUT type=\"hidden\" name=\"fDocumentID\" value=\"" . $this->iDocumentID . "\" />\n " : $bar .= ""); | ||
| 265 | - (isset($this->sCategoryName) ? $bar .= "<INPUT type=\"hidden\" name=\"fCategoryName\" value=\"" . $this->sCategoryName . "\" />\n " : $bar .= ""); | ||
| 266 | - (isset($this->iDocTypeID) ? $bar .= "<INPUT type=\"hidden\" name=\"fDocTypeID\" value=\"" . $this->iDocTypeID . "\" />\n " : $bar .= ""); | ||
| 267 | - //this next line works in IE, and Netscape 4.79 up, but NOT Netscape 4.79 | ||
| 268 | - //$bar .= "<INPUT type=\"image\" onClick=\"return validateStandardSearch('" . $default->rootUrl . "/control.php')\" src=\"$default->graphicsUrl/search.gif\" align = \"absmiddle\" border=\"0\" />\n"; | ||
| 269 | - //replaced with this line | ||
| 270 | - $bar .= "<a href=\"#\" onClick=\"return validateStandardSearch('" . $default->rootUrl . "/control.php')\"><img align=\"absmiddle\" src=\"$default->graphicsUrl/search.gif\" border=\"0\" /></a>"; | ||
| 271 | - | ||
| 272 | - } | ||
| 273 | - $bar .= "\t\t</td>\n"; | ||
| 274 | - $bar .= "\t</tr>\n"; | ||
| 275 | - /* $bar .= "<tr height=30><td ><table cellspacing=0 cellpadding=0 border=0><tr>$sTopMenu</tr>\n"; */ | ||
| 276 | - $bar .= "<tr><td><table cellspacing=0 cellpadding=0 border=0><tr>$sTopMenu</tr>\n"; | ||
| 277 | - $bar .= "<tr>$sColourMenu</tr></table></td></tr>\n"; | ||
| 278 | - $bar .= "</table>\n"; | ||
| 279 | - | ||
| 280 | - //set the bar as html to object | ||
| 281 | - $toRender->setHtml($bar); | ||
| 282 | - | ||
| 283 | - //render the object | ||
| 284 | - return $this->getSearchValidationJavaScript() . $toRender->render(); | ||
| 285 | - | ||
| 286 | - } | ||
| 287 | - | ||
| 288 | - function getSearchValidationJavaScript() { | ||
| 289 | - $sToRender = "\n\n<SCRIPT LANGUAGE=\"javascript\">\n "; | ||
| 290 | - $sToRender .= "<!--\n"; | ||
| 291 | - | ||
| 292 | - $sToRender .= ' | ||
| 293 | -// From http://www.severnsolutions.co.uk/twblog/archive/2003/09/14/keypressevents | ||
| 294 | -function checkKeyPressed(evt, func, params) | ||
| 295 | -{ | ||
| 296 | - evt = (evt) ? evt : (window.event) ? event : null; | ||
| 297 | - if (evt) | ||
| 298 | - { | ||
| 299 | - var charCode = (evt.charCode) ? evt.charCode : | ||
| 300 | - ((evt.keyCode) ? evt.keyCode : | ||
| 301 | - ((evt.which) ? evt.which : 0)); | ||
| 302 | - if (charCode == 13) return func(params); | ||
| 303 | - } | ||
| 304 | - return true; | ||
| 305 | -}'; | ||
| 306 | - | ||
| 307 | - $sToRender .= "function validateStandardSearch(newAction) {\n"; | ||
| 308 | - $sToRender .= "\tif (!(validRequired(document.MainForm.fSearchText, 'Search text'))) {\n"; | ||
| 309 | - $sToRender .= "\t\treturn false;\n\t}\n"; | ||
| 310 | - $sToRender .= "\telse {\n"; | ||
| 311 | - $sToRender .= "\t\tsetActionAndSubmitSearch(newAction);\n"; | ||
| 312 | - $sToRender .= "\t}\n"; | ||
| 313 | - $sToRender .= "}\n"; | ||
| 314 | - $sToRender .= "//-->\n"; | ||
| 315 | - $sToRender .= "</SCRIPT>\n\n"; | ||
| 316 | - return $sToRender; | ||
| 317 | - } | ||
| 318 | -} | ||
| 319 | -?> |