diff --git a/html/includes/print-date-selector.inc.php b/html/includes/print-date-selector.inc.php
new file mode 100644
index 000000000..3333df0b6
--- /dev/null
+++ b/html/includes/print-date-selector.inc.php
@@ -0,0 +1,40 @@
+
+
+
+';
diff --git a/html/index.php b/html/index.php
index e42190acc..6499e2c27 100644
--- a/html/index.php
+++ b/html/index.php
@@ -165,6 +165,7 @@ else {
+
';
-
if (is_file("pages/device/edit/".mres($vars['section']).".inc.php")) {
require "pages/device/edit/".mres($vars['section']).".inc.php";
}
diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php
index b01fe1c59..2e9c53815 100644
--- a/html/pages/devices.inc.php
+++ b/html/pages/devices.inc.php
@@ -51,7 +51,7 @@ foreach ($menu_options as $option => $text) {
if ($vars['format'] == 'graph_'.$option) {
echo("");
}
@@ -90,6 +90,34 @@ print_optionbar_end();
list($format, $subformat) = explode("_", $vars['format'], 2);
if($format == "graph") {
+
+ if (!is_numeric($vars['from'])) {
+ $graph_array['from'] = $config['time']['day'];
+ }
+ else {
+ $graph_array['from'] = $vars['from'];
+ }
+ if (!is_numeric($vars['to'])) {
+ $graph_array['to'] = $config['time']['now'];
+ }
+ else {
+ $graph_array['to'] = $vars['to'];
+ }
+
+ echo "
+
+
+
+
+ ";
+ include_once 'includes/print-date-selector.inc.php';
+ echo '
+
+
+
+
+ ';
+
$sql_param = array();
if(isset($vars['state'])) {
@@ -191,17 +219,17 @@ if($format == "graph") {
$width=315;
}
- $graph_array = array();
- $graph_array['type'] = $graph_type;
- $graph_array['device'] = $device['device_id'];
- $graph_array['to'] = $config['time']['now'];
- $graph_array['from'] = $config['time']['day'];
- $graph_array['height'] = '110';
- $graph_array['width'] = $width;
- $graph_array['legend'] = 'no';
- $graph_array['title'] = 'yes';
+ $graph_array_new = array();
+ $graph_array_new['type'] = $graph_type;
+ $graph_array_new['device'] = $device['device_id'];
+ $graph_array_new['height'] = '110';
+ $graph_array_new['width'] = $width;
+ $graph_array_new['legend'] = 'no';
+ $graph_array_new['title'] = 'yes';
+ $graph_array_new['from'] = $graph_array['from'];
+ $graph_array_new['to'] = $graph_array['to'];
- $graph_array_zoom = $graph_array;
+ $graph_array_zoom = $graph_array_new;
$graph_array_zoom['height'] = '150';
$graph_array_zoom['width'] = '400';
$graph_array_zoom['legend'] = 'yes';
@@ -209,7 +237,7 @@ if($format == "graph") {
$overlib_link = "device/device=".$device['device_id']."/";
echo "";
echo '
';
- echo overlib_link($overlib_link, generate_lazy_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL);
+ echo overlib_link($overlib_link, generate_lazy_graph_tag($graph_array_new), generate_graph_tag($graph_array_zoom), NULL);
echo "
\n\n";
}
}
diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php
index 582aacd71..6385ea969 100644
--- a/html/pages/graphs.inc.php
+++ b/html/pages/graphs.inc.php
@@ -113,57 +113,8 @@ else {
echo("
");
- // datetime range picker
-?>
-
-
-
-
+ include_once 'includes/print-date-selector.inc.php';
- ');
echo ('');
echo('');
if ($vars['legend'] == "no") {
diff --git a/html/pages/settings.inc.php b/html/pages/settings.inc.php
index f2a85f740..1271e8d22 100644
--- a/html/pages/settings.inc.php
+++ b/html/pages/settings.inc.php
@@ -35,8 +35,6 @@ $pagetitle[] = $page_name . ' Settings';
$config['memcached']['enable'] = false;
?>
-
-