fRequest::validateCSRFToken(fRequest::get('token')); $line->store(); fMessaging::create('affected', fURL::get(), $graph->getName()); fMessaging::create('success', fURL::getWithQueryString(), 'The Line ' . $line->getAlias() . ' was successfully updated'); } } catch (fNotFoundException $e) { fMessaging::create('error', Graph::makeUrl('edit', $graph), 'The Line requested, ' . fHTML::encode($line_id) . ', could not be found'); fURL::redirect(Graph::makeUrl('edit', $graph)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } include VIEW_PATH . '/add_edit_line.php'; // --------------------------------- // } elseif ('add' == $action) { $line = new Line(); $graph = new Graph($graph_id); if (fRequest::isPost()) { try { $line->populate(); fRequest::validateCSRFToken(fRequest::get('token')); $line->store(); $graph_url = Graph::makeUrl('edit', $graph); fMessaging::create('affected', $graph_url, $line->getAlias()); fMessaging::create('success', $graph_url, 'The Line ' . $line->getAlias() . ' was successfully created'); fURL::redirect($graph_url); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } } include VIEW_PATH . '/add_edit_line.php'; }
include VIEW_PATH . '/add_edit_graph.php'; // --------------------------------- // } elseif ('add' == $action) { $graph = new Graph(); $dashboard = new Dashboard($dashboard_id); if (fRequest::isPost()) { try { $graph->populate(); $graph->setStartsAtMidnight(isset($_POST['starts_at_midnight']) ? $_POST['starts_at_midnight'] : false); fRequest::validateCSRFToken(fRequest::get('token')); $graphs_in_dashboard = Graph::findAll($dashboard_id); $graph->setWeight($graphs_in_dashboard->count(TRUE)); $graph->store(); fMessaging::create('affected', $manage_url, $graph->getName()); fMessaging::create('success', $manage_url, 'The Graph ' . $graph->getName() . ' was successfully created'); fURL::redirect(Graph::makeUrl('edit', $graph)); } catch (fExpectedException $e) { fMessaging::create('error', fURL::get(), $e->getMessage()); } } include VIEW_PATH . '/add_edit_graph.php'; } elseif ('delete' == $action) { $class_name = 'Graph'; try { $obj = new Graph($graph_id); $dashboard = new Dashboard($obj->getDashboardId()); $delete_text = 'Are you sure you want to delete the graph : <strong>' . $obj->getName() . '</strong>?'; if (fRequest::isPost()) { fRequest::validateCSRFToken(fRequest::get('token')); $obj->delete(); $lines = Line::findAll($graph_id);
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'); }