Patch suggestion

Marc-Christian Petersen <[email protected]>
Newsgroups gmane.network.cacti.user
Message-ID <[email protected]>
Hi all,

I'd like to suggest two patches.

1st: support dot in RRD time format (for german date format for example)

2nd: lowercase " To " in RRD images for the time frame. Looks better ;)

applies to 0.8.8a and 0.8.8b

-- 
ciao, Marc

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk

_______________________________________________
cacti-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cacti-user
cacti-0.8.8-dot-time-support.patch (text/plain, 1 KB)
--- old/site/lib/rrd.php	2013-05-18 12:24:26.000000000 +0200
+++ new/site/lib/rrd.php	2013-08-05 21:17:01.697733319 +0200
@@ -820,8 +820,10 @@ function rrdtool_function_graph($local_g
 
 	if ($datechar == GDC_HYPHEN) {
 		$datechar = "-";
-	}else {
+	} else if ($datechar == GDC_SLASH) {
 		$datechar = "/";
+	} else if ($datechar == GDC_DOT) {
+		$datechar = ".";
 	}
 
 	switch ($date_fmt) {
--- old/site/include/global_arrays.php	2013-08-05 21:18:08.000000000 +0200
+++ new/site/include/global_arrays.php	2013-08-05 21:18:19.949061378 +0200
@@ -687,7 +687,8 @@ $graph_dateformats = array(
 
 $graph_datechar = array(
 	GDC_HYPHEN => "-",
-	GDC_SLASH => "/"
+	GDC_SLASH => "/",
+	GDC_DOT => "."
 	);
 
 $plugin_architecture = array(
--- old/site/include/global_constants.php	2012-04-23 04:00:14.000000000 +0200
+++ new/site/include/global_constants.php	2013-08-05 21:19:03.334134363 +0200
@@ -179,6 +179,7 @@ define("GD_Y_MN_D", 5);
 
 define("GDC_HYPHEN", 0);
 define("GDC_SLASH", 1);
+define("GDC_DOT", 2);
 
 define("SNMP_POLLER", 0);
 define("SNMP_CMDPHP", 1);
cacti-0.8.8-lowercase.patch (text/plain, 2.5 KB)
--- old/site/lib/rrd.php	2013-08-08 12:22:58.000000000 +0200
+++ new/site/lib/rrd.php	2013-08-08 12:29:26.206809941 +0200
@@ -851,15 +851,15 @@ function rrdtool_function_graph($local_g
 	if ((isset($graph_data_array["graph_start"])) && (isset($graph_data_array["graph_end"]))) {
 		if (($graph_data_array["graph_start"] < 0) && ($graph_data_array["graph_end"] < 0)) {
 			if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
-				$graph_legend .= "COMMENT:\"From " . str_replace(":", "\:", date($graph_date, time()+$graph_data_array["graph_start"])) . " To " . str_replace(":", "\:", date($graph_date, time()+$graph_data_array["graph_end"])) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
+				$graph_legend .= "COMMENT:\"From " . str_replace(":", "\:", date($graph_date, time()+$graph_data_array["graph_start"])) . " to " . str_replace(":", "\:", date($graph_date, time()+$graph_data_array["graph_end"])) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
 			}else {
-				$graph_legend .= "COMMENT:\"From " . date($graph_date, time()+$graph_data_array["graph_start"]) . " To " . date($graph_date, time()+$graph_data_array["graph_end"]) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
+				$graph_legend .= "COMMENT:\"From " . date($graph_date, time()+$graph_data_array["graph_start"]) . " to " . date($graph_date, time()+$graph_data_array["graph_end"]) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
 			}
 		}else if (($graph_data_array["graph_start"] >= 0) && ($graph_data_array["graph_end"] >= 0)) {
 			if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
-				$graph_legend .= "COMMENT:\"From " . str_replace(":", "\:", date($graph_date, $graph_data_array["graph_start"])) . " To " . str_replace(":", "\:", date($graph_date, $graph_data_array["graph_end"])) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
+				$graph_legend .= "COMMENT:\"From " . str_replace(":", "\:", date($graph_date, $graph_data_array["graph_start"])) . " to " . str_replace(":", "\:", date($graph_date, $graph_data_array["graph_end"])) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
 			}else {
-				$graph_legend .= "COMMENT:\"From " . date($graph_date, $graph_data_array["graph_start"]) . " To " . date($graph_date, $graph_data_array["graph_end"]) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
+				$graph_legend .= "COMMENT:\"From " . date($graph_date, $graph_data_array["graph_start"]) . " to " . date($graph_date, $graph_data_array["graph_end"]) . "\\c\"" . RRD_NL . "COMMENT:\"  \\n\"" . RRD_NL;
 			}
 		}
 	}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.