} ?> </head> <body> <?php if (!$this->get('full_screen')) { ?> <nav class="navbar navbar-inverse"> <div class="navbar-inner"> <div class="container-fluid"> <a class="navbar-brand" href="index.php">Tattle </a> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <?php $current_url = '?' . fURL::getQueryString(); echo '<li' . (fURL::is_menu_active('index') ? ' class="active"' : '') . '><a href="index.php">Alerts</a></li>' . "\n"; $threshold_check_list = Check::makeURL('list', 'threshold'); echo '<li' . (fURL::is_menu_active('check', 'type=threshold') ? ' class="active"' : '') . '><a href="' . $threshold_check_list . '" >Threshold Checks</a></li>' . "\n"; $predictive_check_list = Check::makeURL('list', 'predictive'); echo '<li' . (fURL::is_menu_active('check', 'type=predictive') ? ' class="active"' : '') . '><a href="' . $predictive_check_list . '" >Predictive Checks</a></li>' . "\n"; $subscription_list = Subscription::makeURL('list'); echo '<li' . (fURL::is_menu_active('subscription') ? ' class="active"' : '') . '><a href="' . $subscription_list . '" >Subscriptions</a></li>' . "\n"; $dashboard_list = Dashboard::makeURL('list'); echo '<li' . (fURL::is_menu_active('dashboard') ? ' class="active"' : '') . '><a href="' . $dashboard_list . '">Dashboards</a></li>'; $group_list = Group::makeURL('list'); echo '<li' . (fURL::is_menu_active('group') ? ' class="active"' : '') . '><a href="' . $group_list . '">Groups</a></li>'; $setting_list = Setting::makeURL('list', 'user'); echo '<li' . (fURL::is_menu_active('setting', 'type=user') ? ' class="active"' : '') . '><a href="' . $setting_list . '" >Settings</a></li>' . "\n"; if (fAuthorization::checkAuthLevel('admin')) { $setting_list = Setting::makeURL('list', 'system');
$dashboard_dest_id = fRequest::get('dashboard_dest_id', 'integer?'); $graph_id = fRequest::get('graph_id', 'integer?'); $manage_url = $_SERVER['SCRIPT_NAME']; // --------------------------------- // if ('edit' == $action) { try { $graph = new Graph($graph_id); $dashboard = new Dashboard($graph->getDashboardId()); $lines = Line::findAll($graph_id); if (fRequest::isPost()) { $graph->populate(); $graph->setStartsAtMidnight(isset($_POST['starts_at_midnight']) ? $_POST['starts_at_midnight'] : false); fRequest::validateCSRFToken(fRequest::get('token')); $graph->store(); fMessaging::create('affected', fURL::get(), $graph->getName()); fMessaging::create('success', '?' . fURL::getQueryString(), 'The Graph ' . $graph->getName() . ' was successfully updated'); fURL::redirect(Dashboard::makeUrl('edit', $dashboard)); } } catch (fNotFoundException $e) { fMessaging::create('error', $manage_url, 'The Graph requested, ' . fHTML::encode($graph_id) . ', could not be found'); fURL::redirect($manage_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/add_edit_graph.php'; // --------------------------------- // } elseif ('add' == $action) { $graph = new Graph(); $dashboard = new Dashboard($dashboard_id); if (fRequest::isPost()) { try {
public static function is_menu_active($menu_to_active, $type = NULL) { $menu_included_in = array('result.php' => 'index', 'graphs.php' => 'dashboard', 'lines.php' => 'dashboard', 'groups.php' => 'group'); $result = FALSE; $current_url = fURL::get(); $pos_last_slash = strrpos($current_url, "/"); $url_to_check = substr($current_url, $pos_last_slash + 1, strlen($current_url) - $pos_last_slash); if (in_array($url_to_check, array_keys($menu_included_in))) { $corresponding_menu = $menu_included_in[$url_to_check]; if ($menu_to_active == $corresponding_menu) { $result = TRUE; } } else { // If it isn't in the array, we try to test manually if ($url_to_check == $menu_to_active . ".php") { $result = TRUE; } } if (!empty($type)) { $result = $result && strpos(fURL::getQueryString(), $type) !== FALSE; } return $result; }
<?php $page_title = $action == 'add' ? 'Add a Group' : 'Edit Group'; $tmpl->set('title', $page_title); $breadcrumbs[] = array('name' => $page_title, 'url' => '?' . fURL::getQueryString(), 'active' => true); $tmpl->set('breadcrumbs', $breadcrumbs); $tmpl->place('header'); $query_string = ''; if (isset($group_id)) { $query_string = "&group_id={$group_id}"; } ?> <div class="row"> <div class="col-md-6"> <form action="?action=<?php echo $action . $query_string; ?> " method="post" class="form-horizontal"> <div class="form-group"> <label for="group-name" class="col-sm-2 control-label">Name<em>*</em></label> <div class="col-sm-10"> <input id="group-name" class="form-control" type="text" size="30" name="name" value="<?php echo $group->encodeName(); ?> " /> </div> </div><!-- /clearfix --> <div class="form-group"> <label for="group-description" class="col-sm-2 control-label">Description<em>*</em></label> <div class="col-sm-10"> <textarea class="form-control" id="group-description" name="description" rows="3"><?php
until_moment = until_moment.add("minutes",1); new_until = until_moment.format("HH:mm_YYYYMMDD"); } $(".slider img").each(function(){ var url_graph_to_zoom = $(this).attr("src"); var old_from = getParamValue("from",url_graph_to_zoom); var old_until = getParamValue("until",url_graph_to_zoom); url_graph_to_zoom = url_graph_to_zoom.replace("from="+old_from,"from="+new_from); if (old_until == "") { url_graph_to_zoom += "&until="+new_until; } else { url_graph_to_zoom = url_graph_to_zoom.replace("until="+old_until,"until="+new_until); } $(this).attr("src",url_graph_to_zoom); }); } } } } }); }); }); </script> <?php if (!$full_screen) { echo '<a href="' . Dashboard::makeUrl('edit', $dashboard) . '">Edit Dashboard</a> | <a href="' . Graph::makeUrl('add', $dashboard) . '">Add Graph</a> | <a href="?' . fURL::getQueryString() . '&full_screen=true">Full Screen</a>'; $tmpl->set('show_bubbles', true); $tmpl->place('footer'); }
function show_hide_new_password() { if ($("#div_new_password").is(":hidden")){ $("#div_new_password").show(); $("#btn_change_password").html("Hide change password"); $("#change_password_hidden_input").val(true); } else { $("#div_new_password").hide(); $("#btn_change_password").html("Change password"); $("#change_password_hidden_input").val(false); } } </script> <div class="row"> <div class="col-md-8"> <form action="?<?php echo fURL::getQueryString(); ?> " method="post" class="form-horizontal"> <div class="main" id="main"> <fieldset> <div class="form-group"> <label for="user-username" class="col-sm-2 control-label">User Name<em>*</em></label> <div class="col-sm-10"> <?php if ($GLOBALS['ALLOW_HTTP_AUTH']) { echo $_SERVER['PHP_AUTH_USER']; ?> <input id="user-username" class=form-control" type="hidden" name="username" value="<?php echo $_SERVER['PHP_AUTH_USER']; ?> ">