<?php # Copyright(C) 2004-2008 INL # Written by Eric Leblond <regit@inl.fr> # Vincent Deffontaines <gryzor@inl.fr> # Jean Gillaux <jean@inl.fr> # Damien Boucard <damien.boucard AT inl.fr> # # $Id: headers.php 17927 2009-02-16 13:16:09Z haypo $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 3 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see <http://www.gnu.org/licenses/>. require_once ('nuphp/http.php'); require_once ('nuphp/debug.php'); require_once ('page_tree.php'); require_once ('display.php'); require_once ('page_function.php'); require_once ('html.php'); function html_head($title, $ruleset) { global $edenwall_integration; global $context_help; $page_title = 'NuFace - '.$title.' page'; if (isset($ruleset)) { $page_title .=' - '; if ($_SESSION['modified']) { $page_title .= sprintf(_("%s (modified)"), $ruleset->name); } else { $page_title .= $ruleset->name; } } echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"'."\n"; echo ' "http://www.w3.org/TR/1998/REC-html40-19980424/loose.dtd">'."\n"; echo '<html><head>'."\n"; echo '<meta http-equiv="content-type" content="text/html; charset=utf-8">'."\n"; echo '<title>'.$page_title.'</title>'."\n"; if ($title != 'index') print "<meta http-equiv=\"refresh\" content=\"900\">\n"; echo '<link rel="shortcut icon" href="images/favicon.ico">'."\n"; echo '<link rel="stylesheet" type="text/css" href="main.css" media="screen">'."\n"; echo '<link rel="stylesheet" type="text/css" href="js/yahoo/container/assets/container.css" media="screen">'."\n"; if ($edenwall_integration){ print "<link rel=\"stylesheet\" type=\"text/css\" href=\"../nuconf/edennavbar.css\" media=\"screen\">\n"; } $scripts = Array( "js/toolman/core.js", "js/toolman/events.js", "js/toolman/css.js", "js/toolman/coordinates.js", "js/toolman/drag.js", "js/toolman/dragsort.js", "js/toolman/cookies.js", "js/yahoo/yahoo/yahoo-min.js", "js/yahoo/event/event-min.js", "js/yahoo/dom/dom-min.js", "js/yahoo/connection/connection-min.js", "js/yahoo/logger/logger-min.js", "js/yahoo/dragdrop/dragdrop-min.js", "js/yahoo/container/container-min.js", "js/yahoo/autocomplete/autocomplete-min.js", "js/DDPlayer.js", "js/script.js", "js/fixed.js", ); if ($context_help) { $scripts[] = "js/yahoo/animation/animation-min.js"; } if (($title == 'acls') or ($title == 'localsin') or ($title == 'localsout')) { $scripts[] = "js/acls.js"; } else if ($title == 'nat') { $scripts[] = "js/nat.js"; } foreach ($scripts as $script) { html_include_javascript($script); } echo "</head>\n"; } function html_div_headers() { global $logo_nuface; $url = $_SERVER['REQUEST_URI']; $url = preg_replace(':/[a-z0-9_]+\.php.*:', '/index.php', $url); echo "<div class=\"nufacelogo\"><a href=\"$url\"><img src=\"".$logo_nuface."\" alt=\"Logo\"></a></div>\n"; } function displayTitle() { global $title, $links2text; print "<br><div class=header_title><h2><a href=\"".$title.".php\">".$links2text[$title]."</a></h2></div>"; } function displayMenu() { global $title, $pages_list, $pages_display, $sublinks_pages, $sublinks_display; echo "<div class=\"nufacelink\">"; $nb_page = count($pages_list); $sep = ' | '; for ($i=0; $i<$nb_page; $i++) { if ( ! $pages_list[$i]) { continue; } if ($i == $nb_page - 1) $sep = ''; echo "<dl>"; $page = $pages_list[$i]; if ($page == $title){ echo "<dt><a href=\"".$page.".php\" class=\"highlight\">".$pages_display[$i]." </a>$sep</dt> "; } else { if (array_key_exists($page, $sublinks_display) and is_array($sublinks_display[$page])){ $high = in_array($title,$sublinks_pages[$page]); display_submenu($pages_display[$i], $sublinks_display[$page], $sublinks_pages[$page], $high, $i, $sep); } else { echo "<dt> <a href=\"".$page.".php\">".$pages_display[$i]."</a>$sep</dt> "; } } echo "</dl>"; } echo "</div> <!-- nufacelink -->"; } function displayHistory() { $history = getSession('history'); if (!is_array($history)) { $history = array(); #Prevent warnings on empty var } print "<div class=\"headerhistory\">"._('History')." <select name=hist onchange=\"window.location.replace(this.value)\">"; print "<option>--</option>"; foreach (array_reverse($history) as $histtab) { print "<option value=\""; $page = $histtab[0]; print $page.".php?"; if (in_array($page, Array('acls', 'localsin', 'localsout'))) { print "acl="; }else{ print "elt="; } print $histtab[1]; print "\">"._($histtab[0])." : ".$histtab[2]."</option>\n"; } print "</select></div> <!-- headerhistory -->\n"; } function change_lang_menu() { global $AVAILABLE_LANGUAGES; $current_lang = get_language(); echo "<div class=\"langhead\">\n"; $sep = ''; foreach ($AVAILABLE_LANGUAGES as $lang=>$locale) { if ($current_lang == $lang) continue; if ($sep) { echo $sep; } else { $sep = ' | '; } print "<a href=\"?lang=$lang\">"; echo "<img border=0 src=\"images/$lang.jpg\" alt=\"Switch to language $lang\">"; echo "</a>"; } echo "</div> <!-- langhead -->\n"; } function header_block() { global $edenwall_integration, $title, $expolicy; getSearch(); html_head($title, $expolicy); print "<body>"; if ($edenwall_integration) require_once ('../nuconf/include/edennavbar.php'); echo '<div class="headers">'."\n"; html_div_headers(); echo "<div class=\"nufaceheaders\">\n"; if (array_key_exists('document', $_SESSION)) { displayMenu(); } if (! $edenwall_integration) { change_lang_menu(); } displayHistory(); print "</div> <!-- nufaceheaders -->\n"; displayTitle(); print "</div> <!-- headers -->\n"; if ($GLOBALS['debug_nuface_verbose']) { if (count($_GET)) { print_pre($_GET, '$_GET'); } if (count($_POST)) { print_pre($_POST, '$_POST'); } } } header_block(); ?>