root/trunk/flowmon-web/common.inc.php

Revision 6, 4.4 kB (checked in by ixs, 16 years ago)

Minor changes to html formatting, added logo

Line 
1 <?php
2 #
3 # Copyright (C) 2008 Red Hat, Inc.
4 # Author: Andreas Thienemann <athienem@redhat.com>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU Library General Public License as published by
8 # the Free Software Foundation; version 2 only
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU Library General Public License for more details.
14 #
15 # You should have received a copy of the GNU Library General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Copyright 2004, 2005 Red Hat, Inc.
19 #
20 # AUTHOR: Andreas Thienemann <athienem@redhat.com>
21 #
22
23 // HTML Header
24 function html_header($title = '', $calendar = False, $refresh = False) {
25
26     $js = '';
27     $refresh = '';
28
29     if ($calendar == True) {
30         $js .= '<script language="JavaScript" src="js/cal/calendar.js"></script>';
31     }
32
33     if ($refresh !== False) {
34         $refresh = '<meta http-equiv="refresh" content="300" />';
35     }
36
37
38     $head = '<?xml version="1.0" encoding="iso-8859-1"?>
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
40           "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
41 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
42 <head>
43   <link rel="stylesheet" href="styles.css" type="text/css" />
44   '.$refresh.'
45   <title>'.$title.'</title>
46   '.$js.'
47   <meta http-equiv="content-type" content="application/xhtml+xml; charset=iso-8859-1" />
48 </head>
49 <body>
50 ';
51
52     return $head;
53 }
54
55 // HTML Footer
56 function html_footer() {
57         global $prog_name, $prog_url, $prog_vers, $date_fmt_str;
58     $foot = '<p><i>This page was generated by <a href="'.$prog_url.'">'.$prog_name.'</a> version '.$prog_vers.' at '.strftime($date_fmt_str).'</i></p>
59 </body>
60 </html>
61 ';
62     return $foot;
63 }
64
65 // The Top-Bar
66 function page_header($title = '') {
67     $head = '<table class="head" width="100%">
68    <tr class="whiteonblack">
69     <td class="whiteonblack" width="33%" id="left"> <a href="'.$_SERVER['SCRIPT_NAME'].'"><img src="img/net-icon.png" width="48" height="48" alt="Back Home" border="0"></a></td>
70     <td class="whiteonblack" width="33%" id="middle">'.$title.'</td>
71     <td class="whiteonblack" width="33%" id="right">&nbsp;</td>
72    </tr>
73
74    <tr class="brownondarkbrown">
75     <td align="left" class="brownondarkbrown">
76      &nbsp;
77     </td>
78     <td align="center">
79      Bugs? Errors? <a class="logintext" href="mailto:andreas@bawue.net">andreas@bawue.net</a>. This is beta&trade; after all.
80     </td>
81     <td align="right" class="brownondarkbrown">
82      &nbsp;
83     </td>
84
85    </tr>
86   </table>
87 ';
88
89     return $head;
90 }
91
92 function chartstyle_header() {
93
94     global $chart_styles;
95
96     if (@$_REQUEST['nslookup'] == 'on') {
97         $nslookup = 'checked="checked"';
98     } else {
99         $nslookup = False;
100     }
101     if (@$_REQUEST['rolling'] == 'on') {
102         $rolling = 'checked="checked"';
103     } else {
104         $rolling = False;
105     }
106
107     $output = '<div style="margin: 30px auto 30px auto; width: 850px; text-align: left;"><form action='.$_SERVER['SCRIPT_NAME'].'>
108     <table>
109      <tr>
110       <td>Start Date: <input type="text" name="startdate" value="'.$_REQUEST['startdate'].'" size="10" /></td>
111       <td>Start Time: <input type="text" name="starttime" value="'.$_REQUEST['starttime'].'" size="5" /></td>
112       <td>End Date: <input type="text" name="enddate" value="'.$_REQUEST['enddate'].'" size="10" /></td>
113       <td>End Time: <input type="text" name="endtime" value="'.$_REQUEST['endtime'].'" size="5" /></td>
114       <td>Chart Style: <select name="style" size=1>';
115
116                 foreach ($chart_styles as $style=>$file) {
117             if (@$_REQUEST['style'] == $style) {
118                             $output .= '<option selected="selected">'.$style.'</option>'."\n";
119             } else {
120                             $output .= '<option>'.$style.'</option>'."\n";
121             }
122                 }
123
124     $output .= ' </select><td>Nslookup: <input type="checkbox" name="nslookup" '.$nslookup.'/><td>
125        </select><td>Rolling chart: <input type="checkbox" name="rolling" '.$rolling.'/><td>
126       <td><input type="hidden" name="probe" value="'.$_REQUEST['probe'].'" /><input type="hidden" name="action" value="chart" /><input type="submit" value="Chart!" /></td>
127      </tr>
128     </table>
129     </form></div>';
130
131 // <tr><td><input type="hidden" name="probe" value="'.$_REQUEST['probe'].'" /><select name="timeframe"><option $
132
133     return $output;
134 }
135
Note: See TracBrowser for help on using the browser.