noheader: Remove leftovers from "noheader"
[ninja.git] / application / views / template_header.php
blobd5a11267eff92d47ed41450c17ad158ff85433c2
1 <?php
3 /** Shortcut format
5 * href, icon (in x16 sheet), attributes
6 * string, string, array
8 * @param href is an adress, if external; use the full adress from protocol and up,
9 * if internal; give the relative adress, e.g. /tac, /status/service/all etc.
11 * @param icon is the class of the spritesheet icon
13 * @param attribute An assoc. array containing additional attributes for the anchor, the class
14 * will always be image-link and nothing else.
18 $show_settings = ((isset($widgets) && is_array($widgets)) || (!isset($disable_refresh) || $disable_refresh === false) || (isset($listview_refresh) && $listview_refresh === true));
20 $shortcuts = array('internal' => array(), 'external' => array());
22 $shortcuts['internal'][] = array('#', 'icon-16 x16-refresh', array('title' => 'Refresh', 'onclick' => 'window.location.reload()'));
24 if ($show_settings) {
25 $shortcuts['internal'][] = array('#', 'icon-16 x16-settings', array('title' => 'Settings', 'id' => 'page_settings_icon'));
28 $shortcuts['internal'][] = array('/listview?q=[services] host.scheduled_downtime_depth = 0 and ((state != 0 and acknowledged = 0 and scheduled_downtime_depth = 0) or (host.state != 0 and host.acknowledged = 0))', 'icon-16 x16-shield-pending', array('id' => 'uh_problems', 'title' => 'Unhandled Problems'));
29 $shortcuts['internal'][] = array('/tac', 'icon-16 x16-hoststatus', array('title' => 'Tactical Overview'));
31 if( isset($help_link) && $help_link !== false ) {
32 $shortcuts['internal'][] = array($help_link, 'icon-16 x16-help', array('title' => 'Documentation', 'id' => 'help_icon'));
35 if (isset($int_shortcuts)) {
36 for ($i = 0; $i < count($int_shortcuts); $i++) {
37 $shortcuts['internal'][] = $int_shortcuts[$i];
42 <div class="header" id="header">
44 <?php
45 require __DIR__.'/template_menu.php';
48 <div class="headercontent">
50 <?php
51 $quri = '/'.url::current();
53 $buttons = $shortcuts['internal'];
55 echo '<ul id="dojo-quicklink-internal">';
57 for($i = 0; $i < count($buttons); $i++) {
59 $attributes = $buttons[$i][2];
60 $attributes['class'] = 'image-link';
61 $stripped = explode('?', $buttons[$i][0]);
62 $stripped = $stripped[0];
64 if ($quri == $stripped)
65 echo '<li class="selected">'.html::anchor($buttons[$i][0], '<span class="icon-16 x16-'.$buttons[$i][1].'"></span>', $attributes).'</li>';
66 else
67 echo '<li>'.html::anchor($buttons[$i][0], '<span class="'.$buttons[$i][1].'"></span>', $attributes).'</li>';
70 echo '</ul>';
73 </div>
74 <div class="headercontent" style="margin-left: 8px;">
75 <ul id="dojo-quicklink-external">
76 </ul>
77 </div>
78 <a href="#dojo-add-quicklink-menu" title="Manage quickbar" class="icon-12 x12-box-config no_border" id="dojo-add-quicklink" style="opacity: 0.5; margin-top: 22px; display: inline-block;"></a>
79 <div style="display: none">
80 <div id="dojo-add-quicklink-menu">
81 <form action="">
82 <h1>Add new quicklink</h1>
83 <hr />
84 <table class="no_border">
85 <tr>
86 <td><label for="dojo-add-quicklink-href"><?php echo _('URI') ?>:</label></td>
87 <td><input type="text" id="dojo-add-quicklink-href"></td>
88 </tr>
89 <tr>
90 <td><label for="dojo-add-quicklink-title"><?php echo _('Title') ?>:</label></td>
91 <td><input type="text" id="dojo-add-quicklink-title"></td>
92 </tr>
93 <tr>
94 <td><label for="dojo-add-quicklink-target"><?php echo _('Open in') ?>:</label></td>
95 <td>
96 <select id="dojo-add-quicklink-target">
97 <option value=""><?php echo _('This window') ?></option>
98 <option value="_BLANK"><?php echo _('New window') ?></option>
99 </select>
100 </td>
101 </tr>
102 <tr>
103 <td><label for="dojo-add-quicklink-icon"><?php echo _('Icon') ?>:</label></td>
104 <td>
105 <input type='hidden' id='dojo-add-quicklink-icon' name='dojo-add-quicklink-icon' />
106 <table style="width: auto" id="dojo-icon-container">
107 <tr>
108 <?php
109 $icons = glob((__DIR__) . '/icons/x16/*.png');
110 $counter = 0;
111 foreach ($icons as $icon) {
112 $name = pathinfo($icon, PATHINFO_FILENAME);
113 echo "<td><span data-icon='$name' class='icon-16 x16-$name'></span></td>";
114 if(++$counter % 16 === 0) {
115 $counter = 0;
116 echo "</tr><tr>";
120 </tr>
121 </table>
122 </td>
123 </tr>
124 <tr>
125 <td><?php echo _('Remove selected quicklinks') ?>:</td>
126 <td>
127 <ul id="dojo-quicklink-remove"></ul>
128 </td>
129 </tr>
130 <tr>
131 <td colspan=2>
132 <input type="submit" value="<?php echo _('Save') ?>" />
133 </td>
134 </tr>
135 </table>
136 </form>
137 </div>
138 </div>
140 <div class="header_right">
141 <div class="global_search">
142 <form action="<?php echo Kohana::config('config.site_domain') ?><?php echo Kohana::config('config.index_page') ?>/search/lookup" method="get">
143 <?php
144 if ( Auth::instance()->logged_in() ) {
145 echo html::anchor('user', html::specialchars(strlen(user::session('realname')) > 0 ? user::session('realname') : user::session('username')));
146 echo " at " . html::specialchars(gethostname());
147 if ( !op5auth::instance()->authorized_for('no_logout') ) {
148 echo " | " . html::anchor('default/logout', html::specialchars(_('Log out')));
153 <br />
154 <?php
155 $query = arr::search($_REQUEST, 'query');
156 if ($query !== false && Router::$controller == 'search' && Router::$method == 'lookup') { ?>
157 <input type="text" name="query" id="query" class="textbox" value="<?php echo html::specialchars($query) ?>" />
158 <?php } else { ?>
159 <input type="text" name="query" id="query" class="textbox" value="<?php echo _('Search')?>" onfocus="this.value=''" onblur="this.value='<?php echo _('Search')?>'" />
160 <?php } ?>
161 <?php echo help::render('search_help', 'search'); ?>
162 </form>
163 </div>
164 <?php customlogo::Render(); ?>
165 </div>
167 <div class="clear"></div>
169 <?php
170 if ( isset( $global_notifications ) && is_array( $global_notifications ) && count( $global_notifications ) >= 1 ) {
171 echo '<div class="notification-bar">';
172 echo '<span class="icon-16 x16-shield-warning" style="vertical-align: middle;"></span>';
173 foreach ( $global_notifications as $note )
174 echo "<span>" . $note[0] . "</span>";
175 echo '</div>';
179 <?php
180 if ( isset( $toolbar ) && get_class( $toolbar ) == "Toolbar_Controller" ) {
181 $toolbar->render();
185 </div>
187 <?php
188 if ($show_settings) {
190 <div id="page_settings" class="page_settings">
191 <ul>
192 <li id="menu_global_settings" <?php if ((isset($disable_refresh) && $disable_refresh !== false) && !isset($listview_refresh)) { ?> style="display:none"<?php } ?>><?php echo _('Global Settings') ?></li>
193 <?php if (!isset($disable_refresh) || $disable_refresh === false) { ?>
194 <li id="ninja_page_refresh">
195 <input type="checkbox" id="ninja_refresh_control" />
196 <label id="ninja_refresh_lable" for="ninja_refresh_control"> <?php echo _('Pause page refresh') ?></label>
197 </li>
198 <li id="ninja_refresh_edit">
199 <?php echo _('Edit global refresh rate') ?><br />
200 <div id="ninja_page_refresh_slider" style="width: 160px; margin-top: 8px;">
201 <input type="text" maxlength="3" size="3" id="ninja_page_refresh_value" name="ninja_page_refresh_value" data-key="config.page_refresh_rate" style="position: absolute; font-size: 11px; margin-left: 130px; padding: 1px; margin-top:-25px;z-index: 500" />
202 <div style="position: absolute; margin-left: 192px; margin-top: -23px"></div>
203 </div>
204 </li>
206 <?php
207 } # end if disable_refresh
208 if (isset($listview_refresh) && $listview_refresh === true) { ?>
209 <li id="listview_refresh">
210 <input type="checkbox" id="listview_refresh_control" />
211 <label id="listview_refresh_lable" for="listview_refresh_control"> <?php echo _('Pause list view refresh') ?></label>
212 </li>
213 <li id="listview_refresh_edit">
214 <label for="listview_refresh_value"><?php echo _('Edit listview refresh rate') ?></label> <input type="text" maxlength="2" size="3" id="listview_refresh_value" name="listview_refresh_value" data-key="config.listview_refresh_rate" /><br />
215 <div id="listview_refresh_slider">
216 <div></div>
217 </div>
218 </li>
219 <?php
220 } # end if listview_refresh
221 if (isset($widgets) && is_array($widgets)) {
222 echo '<li><h2>'._('Available Widgets').'</h2></li>'."\n";
223 foreach($widgets as $widget) {
224 $class_name = isset($widget->id) ? 'selected' : 'unselected';
225 echo '<li id="li-'.$widget->name.'-'.$widget->instance_id.'" data-name="'.$widget->name.'" data-instance_id="'.$widget->instance_id.'" class="'.$class_name.' widget-selector" onclick="control_widgets(this)">'.$widget->friendly_name.'</li>'."\n";
227 echo "<li><h2>"._('Widget settings')."</h2></li>";
228 echo '<li><form action="'.url::base(true).'widget/factory_reset_widgets" method="post"><input type="submit" class="plain" value="'._("Restore overview to factory settings").'" /></form></li>'."\n";
229 if ($authorized === true) {
230 echo '<li><a href="'.url::base(true).'upload">'._('Upload new widget').'</a></li>'."\n";
232 echo '<li><a href="#" id="show_global_widget_refresh">'._("Set every widget's refresh rate to (s.)").'</a></li>'."\n";
235 </ul>
237 </div>
239 <?php