Commit | Line | Data |
---|---|---|
dc9c5d88 FAW |
1 | From: Julien Viard de Galbert <julien@vdg.blogsite.org> |
2 | Date: Wed, 24 Nov 2010 18:22:53 +0100 | |
3 | Subject: [PATCH] Allow configuring colors for logio datas | |
4 | ||
5 | This patch adds options to configure the colors of In and Out KBytes data | |
6 | from the apache_logio patch. It must be applied on top of apache_logio and | |
7 | apache_logio_optional patches. | |
8 | --- | |
9 | graphs.c | 9 +++++++-- | |
10 | output.c | 34 ++++++++++++++++++---------------- | |
11 | sample.conf | 2 ++ | |
12 | webalizer.c | 8 +++++++- | |
13 | webalizer.h | 2 ++ | |
14 | 5 files changed, 36 insertions(+), 19 deletions(-) | |
15 | ||
16 | Index: webalizer/graphs.c | |
17 | =================================================================== | |
18 | --- webalizer.orig/graphs.c 2011-01-08 20:59:32.000000000 +0100 | |
19 | +++ webalizer/graphs.c 2011-01-08 20:59:42.000000000 +0100 | |
20 | @@ -51,8 +51,8 @@ | |
21 | #define FILECOLOR file_or_blue /* files */ | |
22 | #define SITECOLOR site_or_orange /* sites */ | |
23 | #define KBYTECOLOR kbyte_or_red /* KBytes */ | |
24 | -#define IKBYTECOLOR file_or_blue /* In KBytes */ | |
25 | -#define OKBYTECOLOR hit_or_green /* Out KBytes */ | |
26 | +#define IKBYTECOLOR ikbyte_or_blue /* In KBytes */ | |
27 | +#define OKBYTECOLOR okbyte_or_green /* Out KBytes */ | |
28 | #define PAGECOLOR page_or_cyan /* Files */ | |
29 | #define VISITCOLOR visit_or_yellow /* Visits */ | |
30 | ||
31 | @@ -95,6 +95,7 @@ | |
32 | int mx; int my; }; /* midpoint x,y */ | |
33 | /* colors */ | |
34 | int black, white, grey, dkgrey, kbyte_or_red, | |
35 | + ikbyte_or_blue, okbyte_or_green, | |
36 | file_or_blue, site_or_orange, hit_or_green, | |
37 | page_or_cyan, visit_or_yellow, blue; | |
38 | ||
39 | @@ -992,6 +993,10 @@ | |
40 | file_or_blue = gdImageColorAllocate(im, r, g, b); | |
41 | r=getred(kbyte_color); g=getgreen(kbyte_color); b=getblue(kbyte_color); | |
42 | kbyte_or_red = gdImageColorAllocate(im, r, g, b); | |
43 | + r=getred(ikbyte_color); g=getgreen(ikbyte_color); b=getblue(ikbyte_color); | |
44 | + ikbyte_or_blue = gdImageColorAllocate(im, r, g, b); | |
45 | + r=getred(okbyte_color); g=getgreen(okbyte_color); b=getblue(okbyte_color); | |
46 | + okbyte_or_green = gdImageColorAllocate(im, r, g, b); | |
47 | r=getred(page_color); g=getgreen(page_color); b=getblue(page_color); | |
48 | page_or_cyan = gdImageColorAllocate(im, r, g, b); | |
49 | r=getred(visit_color); g=getgreen(visit_color); b=getblue(visit_color); | |
50 | Index: webalizer/output.c | |
51 | =================================================================== | |
52 | --- webalizer.orig/output.c 2011-01-08 20:59:32.000000000 +0100 | |
53 | +++ webalizer/output.c 2011-01-08 20:59:42.000000000 +0100 | |
54 | @@ -132,6 +132,8 @@ | |
55 | #define FILECOLOR file_color | |
56 | #define SITECOLOR site_color | |
57 | #define KBYTECOLOR kbyte_color | |
58 | +#define IKBYTECOLOR ikbyte_color | |
59 | +#define OKBYTECOLOR okbyte_color | |
60 | #define PAGECOLOR page_color | |
61 | #define VISITCOLOR visit_color | |
62 | #define MISCCOLOR misc_color | |
63 | @@ -726,8 +728,8 @@ | |
64 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \ | |
65 | "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \ | |
66 | "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n", | |
67 | - LTBLUE, msg_h_ixfer, | |
68 | - GREEN, msg_h_oxfer); | |
69 | + IKBYTECOLOR, msg_h_ixfer, | |
70 | + OKBYTECOLOR, msg_h_oxfer); | |
71 | } | |
72 | fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n"); | |
73 | ||
74 | @@ -833,8 +835,8 @@ | |
75 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n" \ | |
76 | "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=3>" \ | |
77 | "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n", | |
78 | - LTBLUE, msg_h_ixfer, | |
79 | - GREEN, msg_h_oxfer); | |
80 | + IKBYTECOLOR, msg_h_ixfer, | |
81 | + OKBYTECOLOR, msg_h_oxfer); | |
82 | } | |
83 | fprintf(out_fp,"<TR><TH ALIGN=center BGCOLOR=\"%s\">" \ | |
84 | "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \ | |
85 | @@ -867,12 +869,12 @@ | |
86 | "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \ | |
87 | "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \ | |
88 | "<FONT SIZE=\"-2\">%s</FONT></TH>\n", | |
89 | - LTBLUE, msg_h_avg, LTBLUE, msg_h_total); | |
90 | + IKBYTECOLOR, msg_h_avg, IKBYTECOLOR, msg_h_total); | |
91 | fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \ | |
92 | "<FONT SIZE=\"-2\">%s</FONT></TH>\n" \ | |
93 | "<TH ALIGN=center BGCOLOR=\"%s\" COLSPAN=2>" \ | |
94 | "<FONT SIZE=\"-2\">%s</FONT></TH></TR>\n", | |
95 | - GREEN, msg_h_avg, GREEN, msg_h_total); | |
96 | + OKBYTECOLOR, msg_h_avg, OKBYTECOLOR, msg_h_total); | |
97 | } | |
98 | ||
99 | fprintf(out_fp,"<TR><TH HEIGHT=4></TH></TR>\n"); | |
100 | @@ -984,9 +986,9 @@ | |
101 | if (dump_inout != 0) | |
102 | { | |
103 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
104 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",LTBLUE,msg_h_ixfer); | |
105 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",IKBYTECOLOR,msg_h_ixfer); | |
106 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
107 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREEN,msg_h_oxfer); | |
108 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",OKBYTECOLOR,msg_h_oxfer); | |
109 | } | |
110 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
111 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits); | |
112 | @@ -1217,10 +1219,10 @@ | |
113 | { | |
114 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
115 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n", | |
116 | - LTBLUE,msg_h_ixfer); | |
117 | + IKBYTECOLOR,msg_h_ixfer); | |
118 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
119 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n", | |
120 | - GREEN,msg_h_oxfer); | |
121 | + OKBYTECOLOR,msg_h_oxfer); | |
122 | } | |
123 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \ | |
124 | "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n", | |
125 | @@ -2001,9 +2003,9 @@ | |
126 | if (dump_inout != 0) | |
127 | { | |
128 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
129 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",LTBLUE,msg_h_ixfer); | |
130 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",IKBYTECOLOR,msg_h_ixfer); | |
131 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
132 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREEN,msg_h_oxfer); | |
133 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",OKBYTECOLOR,msg_h_oxfer); | |
134 | } | |
135 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
136 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits); | |
137 | @@ -2352,9 +2354,9 @@ | |
138 | if (dump_inout != 0) | |
139 | { | |
140 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
141 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",LTBLUE,msg_h_ixfer); | |
142 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",IKBYTECOLOR,msg_h_ixfer); | |
143 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center COLSPAN=2>" \ | |
144 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREEN,msg_h_oxfer); | |
145 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",OKBYTECOLOR,msg_h_oxfer); | |
146 | } | |
147 | fprintf(out_fp,"<TH BGCOLOR=\"%s\" ALIGN=center>" \ | |
148 | "<FONT SIZE=\"-1\">%s</FONT></TH></TR>\n",MISCCOLOR,msg_h_ctry); | |
149 | @@ -2782,9 +2784,9 @@ | |
150 | if (dump_inout != 0) | |
151 | { | |
152 | fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \ | |
153 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",LTBLUE,msg_h_ixfer); | |
154 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",IKBYTECOLOR,msg_h_ixfer); | |
155 | fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \ | |
156 | - "<FONT SIZE=\"-1\">%s</FONT></TH>\n",GREEN,msg_h_oxfer); | |
157 | + "<FONT SIZE=\"-1\">%s</FONT></TH>\n",OKBYTECOLOR,msg_h_oxfer); | |
158 | } | |
159 | fprintf(out_fp,"<TH ALIGN=center BGCOLOR=\"%s\">" \ | |
160 | "<FONT SIZE=\"-1\">%s</FONT></TH>\n",VISITCOLOR,msg_h_visits); | |
161 | Index: webalizer/sample.conf | |
162 | =================================================================== | |
163 | --- webalizer.orig/sample.conf 2011-01-08 20:59:32.000000000 +0100 | |
164 | +++ webalizer/sample.conf 2011-01-08 20:59:42.000000000 +0100 | |
165 | @@ -778,6 +778,8 @@ | |
166 | #ColorFile 0040ff | |
167 | #ColorSite ff8000 | |
168 | #ColorKbyte ff0000 | |
169 | +#ColorIKbyte 0080ff | |
170 | +#ColorOKbyte 00e000 | |
171 | #ColorPage 00e0ff | |
172 | #ColorVisit ffff00 | |
173 | #ColorMisc 00e0ff | |
174 | Index: webalizer/webalizer.c | |
175 | =================================================================== | |
176 | --- webalizer.orig/webalizer.c 2011-01-08 20:59:32.000000000 +0100 | |
177 | +++ webalizer/webalizer.c 2011-01-08 20:59:42.000000000 +0100 | |
178 | @@ -267,6 +267,8 @@ | |
179 | char file_color[] = "#0040ff"; /* graph file color */ | |
180 | char site_color[] = "#ff8000"; /* graph site color */ | |
181 | char kbyte_color[] = "#ff0000"; /* graph kbyte color */ | |
182 | +char ikbyte_color[]= "#0080ff"; /* graph ikbyte color */ | |
183 | +char okbyte_color[]= "#00e000"; /* graph okbyte color */ | |
184 | char page_color[] = "#00e0ff"; /* graph page color */ | |
185 | char visit_color[] = "#ffff00"; /* graph visit color */ | |
186 | char misc_color[] = "#00e0ff"; /* graph misc color */ | |
187 | @@ -1664,7 +1666,9 @@ | |
188 | "CountryFlags", /* show country flags? (0-no) 118 */ | |
189 | "FlagDir", /* directory w/flag images 119 */ | |
190 | "SearchCaseI", /* srch str case insensitive 120 */ | |
191 | - "InOutkB" /* logio (0=no,1=yes,2=auto) 121 */ | |
192 | + "InOutkB", /* logio (0=no,1=yes,2=auto) 121 */ | |
193 | + "ColorIKbyte", /* IKbyte Color (def=0080ff) 122 */ | |
194 | + "ColorOKbyte" /* OKbyte Color (def=00e000) 123 */ | |
195 | }; | |
196 | ||
197 | FILE *fp; | |
198 | @@ -1902,6 +1906,8 @@ | |
199 | case 121: dump_inout= | |
200 | (tolower(value[0])=='n')?0: | |
201 | (tolower(value[0])=='y')?1:2; break; /* InOutkB */ | |
202 | + case 122: strncpy(ikbyte_color+1,value,6); break; /* ColorIKbyte */ | |
203 | + case 123: strncpy(okbyte_color+1,value,6); break; /* ColorOKbyte */ | |
204 | } | |
205 | } | |
206 | fclose(fp); | |
207 | Index: webalizer/webalizer.h | |
208 | =================================================================== | |
209 | --- webalizer.orig/webalizer.h 2011-01-08 20:59:32.000000000 +0100 | |
210 | +++ webalizer/webalizer.h 2011-01-08 20:59:42.000000000 +0100 | |
211 | @@ -291,6 +291,8 @@ | |
212 | extern char file_color[]; /* graph file color */ | |
213 | extern char site_color[]; /* graph site color */ | |
214 | extern char kbyte_color[]; /* graph kbyte color */ | |
215 | +extern char ikbyte_color[]; /* graph ikbyte color */ | |
216 | +extern char okbyte_color[]; /* graph okbyte color */ | |
217 | extern char page_color[]; /* graph page color */ | |
218 | extern char visit_color[]; /* graph visit color */ | |
219 | extern char misc_color[]; /* graph misc color */ |