diff -ru awffull-3.02-beta2/doc/awffull.1 awffull-3.02-beta2-user-color/doc/awffull.1 --- awffull-3.02-beta2/doc/awffull.1 2005-12-12 06:37:01.000000000 +0100 +++ awffull-3.02-beta2-user-color/doc/awffull.1 2006-01-16 22:12:27.000000000 +0100 @@ -718,6 +718,36 @@ Dump the search string data to a tab delimited file. This data is only available if processing a web log that contains referrer information and had search string information present. +.TP 8 +.B ColorHit \fP( rrggbb | \fB00805c\fP ) +Sets the graph's hit-color to the specified html color (no '#'). +.TP 8 +.B ColorFile \fP( rrggbb | \fB0000ff\fP ) +Sets the graph's file-color to the specified html color (no '#'). +.TP 8 +.B ColorSite \fP( rrggbb | \fBff8000\fP ) +Sets the graph's site-color to the specified html color (no '#'). +.TP 8 +.B ColorKbyte \fP( rrggbb | \fBff0000\fP ) +Sets the graph's kilobyte-color to the specified html color (no '#'). +.TP 8 +.B ColorPage \fP( rrggbb | \fB00c0ff\fP ) +Sets the graph's page-color to the specified html color (no '#'). +.TP 8 +.B ColorVisit \fP( rrggbb | \fBffff00\fP ) +Sets the graph's visit-color to the specified html color (no '#'). +.TP 8 +.B PieColor1 \fP( rrggbb | \fB800080\fP ) +Sets the pie's first optional color to the specified html color (no '#'). +.TP 8 +.B PieColor2 \fP( rrggbb | \fB80ffc0\fP ) +Sets the pie's second optional color to the specified html color (no '#'). +.TP 8 +.B PieColor3 \fP( rrggbb | \fBff00ff\fP ) +Sets the pie's third optinal color to the specified html color (no '#'). +.TP 8 +.B PieColor4 \fP( rrggbb | \fBffc480\fP ) +Sets the pie's fourth optional color to the specified html color (no '#'). .SH FILES .TP 20 .I awffull.conf diff -ru awffull-3.02-beta2/sample.conf awffull-3.02-beta2-user-color/sample.conf --- awffull-3.02-beta2/sample.conf 2005-12-11 10:30:59.000000000 +0100 +++ awffull-3.02-beta2-user-color/sample.conf 2006-01-16 22:07:18.000000000 +0100 @@ -658,4 +658,20 @@ #GraphPieX 512 #GraphPieY 300 +# The custom bar graph and pie Colors are defined here. +# Declare them in the standard hexadecimal way (as HTML, but without the '#') +# If none are given, you will get the standard webalizer colors. + +#ColorHit 00805c +#ColorFile 0000ff +#ColorSite ff8000 +#ColorKbyte ff0000 +#ColorPage 00c0ff +#ColorVisit ffff00 + +#PieColor1 800080 +#PieColor2 80ffc0 +#PieColor3 ff00ff +#PieColor4 ffc480 + # End of configuration file... Have a nice day! diff -ru awffull-3.02-beta2/src/awffull.c awffull-3.02-beta2-user-color/src/awffull.c --- awffull-3.02-beta2/src/awffull.c 2006-01-11 10:14:49.000000000 +0100 +++ awffull-3.02-beta2-user-color/src/awffull.c 2006-01-16 21:55:09.000000000 +0100 @@ -196,6 +196,17 @@ char *f_cp = f_buf + GZ_BUFSIZE; /* pointer into the buffer */ int f_end; /* count to end of buffer */ +char hit_color[] = "#00805c"; /* graph hit color */ +char file_color[] = "#0000ff"; /* graph file color */ +char site_color[] = "#ff8000"; /* graph site color */ +char kbyte_color[] = "#ff0000"; /* graph kbyte color */ +char page_color[] = "#00c0ff"; /* graph page color */ +char visit_color[] = "#ffff00"; /* graph visit color */ +char pie_color1[] = "#800080"; /* pie additionnal color 1 */ +char pie_color2[] = "#80ffc0"; /* pie additionnal color 2 */ +char pie_color3[] = "#ff00ff"; /* pie additionnal color 3 */ +char pie_color4[] = "#ffc480"; /* pie additionnal color 4 */ + /*********************************************/ /* MAIN - start here */ /*********************************************/ @@ -1340,6 +1351,16 @@ "TopSitesbyPagesGraph", /* Display TOP Sites by Volume Graph 103 */ "TopSitesbyVolGraph", /* Display TOP Sites by Pages Graph 104 */ "TopAgentsGraph" /* Display TOP Agents Graph (by Pages) 105 */ + "ColorHit", /* Hit Color (def=00805c) 106 */ + "ColorFile", /* File Color (def=0000ff) 107 */ + "ColorSite", /* Site Color (def=ff8000) 108 */ + "ColorKbyte", /* Kbyte Color (def=ff0000) 109 */ + "ColorPage", /* Page Color (def=00c0ff) 110 */ + "ColorVisit", /* Visit Color (def=ffff00) 111 */ + "PieColor1", /* Pie Color 1 (def=800080) 112 */ + "PieColor2", /* Pie Color 2 (def=80ffc0) 113 */ + "PieColor3", /* Pie Color 3 (def=ff00ff) 114 */ + "PieColor4" /* Pie Color 4 (def=ffc480) 115 */ }; FILE *fp; @@ -1722,6 +1743,26 @@ case 105: agents_graph = (value[0] == 'y') ? 1 : 0; break; /* TOP User Agents (by pages) Pie Chart */ + case 106: strncpy(hit_color+1,value,6); + break; + case 107: strncpy(file_color+1,value,6); + break; + case 108: strncpy(site_color+1,value,6); + break; + case 109: strncpy(kbyte_color+1,value,6); + break; + case 110: strncpy(page_color+1,value,6); + break; + case 111: strncpy(visit_color+1,value,6); + break; + case 112: strncpy(pie_color1 +1,value,6); + break; + case 113: strncpy(pie_color2 +1,value,6); + break; + case 114: strncpy(pie_color3 +1,value,6); + break; + case 115: strncpy(pie_color4 +1,value,6); + break; } } fclose(fp); diff -ru awffull-3.02-beta2/src/awffull.h awffull-3.02-beta2-user-color/src/awffull.h --- awffull-3.02-beta2/src/awffull.h 2006-01-11 10:14:49.000000000 +0100 +++ awffull-3.02-beta2-user-color/src/awffull.h 2006-01-16 21:56:34.000000000 +0100 @@ -342,6 +342,17 @@ extern CLISTPTR *top_ctrys; /* Top countries table */ +extern char hit_color[]; /* graph hit color */ +extern char file_color[]; /* graph file color */ +extern char site_color[]; /* graph site color */ +extern char kbyte_color[]; /* graph kbyte color */ +extern char page_color[]; /* graph page color */ +extern char visit_color[]; /* graph visit color */ +extern char pie_color1[]; /* pie additionnal color 1 */ +extern char pie_color2[]; /* pie additionnal color 2 */ +extern char pie_color3[]; /* pie additionnal color 3 */ +extern char pie_color4[]; /* pie additionnal color 4 */ + /* define our externally visable functions */ extern char *current_time(void); Seulement dans awffull-3.02-beta2-user-color/src: awffull_lang.h Seulement dans awffull-3.02-beta2/src: config.h diff -ru awffull-3.02-beta2/src/graphs.c awffull-3.02-beta2-user-color/src/graphs.c --- awffull-3.02-beta2/src/graphs.c 2006-01-11 10:14:49.000000000 +0100 +++ awffull-3.02-beta2-user-color/src/graphs.c 2006-01-16 22:50:52.000000000 +0100 @@ -42,12 +42,12 @@ #define PI 3.14159265358979323846 #endif -#define COLOR1 green /* graph color - hits */ -#define COLOR2 blue /* files */ -#define COLOR3 orange /* sites */ -#define COLOR4 red /* KBytes */ -#define COLOR5 cyan /* Files */ -#define COLOR6 yellow /* Visits */ +#define HITCOLOR hitcolor /* hits (green) */ +#define FILECOLOR filecolor /* files (blue) */ +#define SITECOLOR sitecolor /* sites (orange) */ +#define KBYTECOLOR kbytecolor /* KBytes (red) */ +#define PAGECOLOR pagecolor /* Files (cyan) */ +#define VISITCOLOR visitcolor /* Visits (yellow) */ #define CX 156 /* center x (for pie) */ #define CY 150 /* center y (chart) */ @@ -80,7 +80,65 @@ }; /* midpoint x,y */ /* colors */ -int black, white, grey, dkgrey, red, blue, orange, green, cyan, yellow; +int black, white, grey, dkgrey; +int kbytecolor, filecolor, sitecolor, hitcolor, pagecolor, visitcolor; + +/*************************************************************** + * ashex2int - ascii hexadecimal to integer converter * + * does _not_ exactly do the same as strtoul() * + * * + * Returns a base-10 integer value from a 2 char * + * ascii hexadecimal color number * + * this integer is usable by th GD functions * + * * + ***************************************************************/ +int ashex2int (const char* twocharstr) +{ + int val; + switch (twocharstr[1]) + { + case 'a':; + case 'A': val=10; break; + case 'b':; + case 'B': val=11; break; + case 'c':; + case 'C': val=12; break; + case 'd':; + case 'D': val=13; break; + case 'e':; + case 'E': val=14; break; + case 'f':; + case 'F': val=15; break; + default: val=(int)twocharstr[1]-48; + } + switch (twocharstr[0]) + { + case 'a':; + case 'A': val+=160; break; + case 'b':; + case 'B': val+=176; break; + case 'c':; + case 'C': val+=192; break; + case 'd':; + case 'D': val+=208; break; + case 'e':; + case 'E': val+=224; break; + case 'f':; + case 'F': val+=240; break; + default: val+=(int)(twocharstr[0]-48)*16; + } + return val; +} + +/******************************************************************* + * shortcuts to convert ascii hex color for gdImageColorAllocate() * + *******************************************************************/ +#define getred(s) (ashex2int((s[0] == '#')?s+1:s)) +/* returns the red base-10 integer value from a html color */ +#define getgreen(s) (ashex2int((s[0] == '#')?s+3:s+2)) +/* returns the green base-10 integer value from a html color */ +#define getblue(s) (ashex2int((s[0] == '#')?s+5:s+4)) +/* returns the blue base-10 integer value from a html color */ /**************************************************************** * grid_spacing * @@ -410,33 +468,33 @@ i = (strlen(msg_h_xfer) * font_char_width); edge_text_offset = main_bottom + GRAPH_TEXT_Y_OFFSET; gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 1 - i, edge_text_offset + 1, (unsigned char *) msg_h_xfer, dkgrey); - gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - i, edge_text_offset, (unsigned char *) msg_h_xfer, COLOR4); + gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - i, edge_text_offset, (unsigned char *) msg_h_xfer, KBYTECOLOR); /* Sites/Visits Legend */ i = (strlen(msg_h_visits) * font_char_width); j = (strlen(msg_h_sites) * font_char_width); edge_text_offset = GRAPH_INNER_BOX_TOP - font_char_height - GRAPH_TEXT_Y_OFFSET - 1; gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 1 - i - j - k2, edge_text_offset + 1, (unsigned char *) msg_h_visits, dkgrey); - gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - i - j - k2, edge_text_offset, (unsigned char *) msg_h_visits, COLOR6); + gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - i - j - k2, edge_text_offset, (unsigned char *) msg_h_visits, VISITCOLOR); gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 1 - j - k2 + k, edge_text_offset + 1, (unsigned char *) "/", dkgrey); gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - j - k2 + k, edge_text_offset, (unsigned char *) "/", black); gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 1 - j, edge_text_offset + 1, (unsigned char *) msg_h_sites, dkgrey); - gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - j, edge_text_offset, (unsigned char *) msg_h_sites, COLOR3); + gdImageString(im, gdFontSmall, graph_index_x - GRAPH_INNER_BOX_LEFT - 2 - j, edge_text_offset, (unsigned char *) msg_h_sites, SITECOLOR); /* Hits/Files/Pages Legend */ i = (strlen(msg_h_pages) * font_char_width); j = (strlen(msg_h_files) * font_char_width); edge_text_offset = main_bottom + GRAPH_TEXT_Y_OFFSET; gdImageString(im, gdFontSmall, section_left + 1, edge_text_offset + 1, (unsigned char *) msg_h_pages, dkgrey); - gdImageString(im, gdFontSmall, section_left, edge_text_offset, (unsigned char *) msg_h_pages, COLOR5); + gdImageString(im, gdFontSmall, section_left, edge_text_offset, (unsigned char *) msg_h_pages, PAGECOLOR); gdImageString(im, gdFontSmall, section_left + i + k + 1, edge_text_offset + 1, (unsigned char *) "/", dkgrey); gdImageString(im, gdFontSmall, section_left + i + k, edge_text_offset, (unsigned char *) "/", black); gdImageString(im, gdFontSmall, section_left + i + k2 + 1, edge_text_offset + 1, (unsigned char *) msg_h_files, dkgrey); - gdImageString(im, gdFontSmall, section_left + i + k2, edge_text_offset, (unsigned char *) msg_h_files, COLOR2); + gdImageString(im, gdFontSmall, section_left + i + k2, edge_text_offset, (unsigned char *) msg_h_files, FILECOLOR); gdImageString(im, gdFontSmall, section_left + i + j + k2 + k + 1, edge_text_offset + 1, (unsigned char *) "/", dkgrey); gdImageString(im, gdFontSmall, section_left + i + j + k2 + k, edge_text_offset, (unsigned char *) "/", black); gdImageString(im, gdFontSmall, section_left + i + j + k2 * 2 + 1, edge_text_offset + 1, (unsigned char *) msg_h_hits, dkgrey); - gdImageString(im, gdFontSmall, section_left + i + j + k2 * 2, edge_text_offset, (unsigned char *) msg_h_hits, COLOR1); + gdImageString(im, gdFontSmall, section_left + i + j + k2 * 2, edge_text_offset, (unsigned char *) msg_h_hits, HITCOLOR); } /**************************************************** @@ -492,7 +550,7 @@ } xbarleft = GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + ((i - idx_start) * bar_offset); - draw_bar(xbarleft, main_bottom, section_middle + 1, bar_width, percent, do_year, COLOR1); + draw_bar(xbarleft, main_bottom, section_middle + 1, bar_width, percent, do_year, HITCOLOR); /* X Axis */ text_centring = (((double) strlen(s_month[history_list[i].month - 1])) / 2.0) * (double) font_char_width; @@ -506,7 +564,7 @@ /* FILES */ percent = ((double) history_list[i].file / (double) maxval); - draw_bar(xbarleft + bar_sep, main_bottom, section_middle + 1, bar_width, percent, 0, COLOR2); + draw_bar(xbarleft + bar_sep, main_bottom, section_middle + 1, bar_width, percent, 0, FILECOLOR); } /**************************************************** @@ -536,7 +594,7 @@ do_year = 0; } draw_bar(GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + ((i - idx_start) * bar_offset), - section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, do_year, COLOR5); + section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, do_year, PAGECOLOR); } /**************************************************** @@ -570,11 +628,11 @@ do_year = 0; } xbarleft = section_left + 2 + bar_gap + ((i - idx_start) * bar_offset); - draw_bar(xbarleft, section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, do_year, COLOR6); + draw_bar(xbarleft, section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, do_year, VISITCOLOR); /* SITES */ percent = ((double) history_list[i].site / (double) maxval); - draw_bar(xbarleft + bar_sep, section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR3); + draw_bar(xbarleft + bar_sep, section_middle - GRAPH_TB_IN_OFFSET - 1, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, SITECOLOR); } /**************************************************** @@ -603,7 +661,7 @@ } else { do_year = 0; } - draw_bar(section_left + 2 + bar_gap + ((i - idx_start) * bar_offset), main_bottom, section_middle + 1, bar_width, percent, do_year, COLOR4); + draw_bar(section_left + 2 + bar_gap + ((i - idx_start) * bar_offset), main_bottom, section_middle + 1, bar_width, percent, do_year, KBYTECOLOR); } /* save png image */ @@ -711,7 +769,7 @@ /* i = (strlen (msg_h_xfer) * font_char_width); */ edge_text_offset = graph_daily_x - GRAPH_INNER_BOX_RIGHT; /* + GRAPH_TEXT_X_OFFSET; */ gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, graph_daily_y - GRAPH_INNER_BOX_BOTTOM - GRAPH_TEXT_Y_OFFSET - 1, (unsigned char *) msg_h_xfer, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, graph_daily_y - GRAPH_INNER_BOX_BOTTOM - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_xfer, COLOR4); + gdImageStringUp(im, gdFontSmall, edge_text_offset, graph_daily_y - GRAPH_INNER_BOX_BOTTOM - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_xfer, KBYTECOLOR); /* Sites/Visits Legend */ i = (strlen(msg_h_sites) * font_char_width); @@ -719,26 +777,26 @@ k2 = font_char_width * 2; /* Half Space '/' Half Space */ /* j = (strlen (msg_h_sites) * font_char_width); */ gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_bottom - GRAPH_TEXT_Y_OFFSET - 1, (unsigned char *) msg_h_sites, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, section_bottom - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_sites, COLOR3); + gdImageStringUp(im, gdFontSmall, edge_text_offset, section_bottom - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_sites, SITECOLOR); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_bottom - GRAPH_TEXT_Y_OFFSET - i - k - 1, (unsigned char *) text_separator, dkgrey); gdImageStringUp(im, gdFontSmall, edge_text_offset, section_bottom - GRAPH_TEXT_Y_OFFSET - i - k, (unsigned char *) text_separator, black); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_bottom - GRAPH_TEXT_Y_OFFSET - i - k2 - 1, (unsigned char *) msg_h_visits, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, section_bottom - GRAPH_TEXT_Y_OFFSET - i - k2, (unsigned char *) msg_h_visits, COLOR6); + gdImageStringUp(im, gdFontSmall, edge_text_offset, section_bottom - GRAPH_TEXT_Y_OFFSET - i - k2, (unsigned char *) msg_h_visits, VISITCOLOR); /* Hits/Files/Pages Legend */ i = (strlen(msg_h_pages) * font_char_width); j = (strlen(msg_h_files) * font_char_width); /* k same as above */ gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_middle - GRAPH_TEXT_Y_OFFSET - 1, (unsigned char *) msg_h_pages, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_pages, COLOR5); + gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET, (unsigned char *) msg_h_pages, PAGECOLOR); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_middle - GRAPH_TEXT_Y_OFFSET - i - k - 1, (unsigned char *) text_separator, dkgrey); gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - k, (unsigned char *) text_separator, black); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_middle - GRAPH_TEXT_Y_OFFSET - i - k2 - 1, (unsigned char *) msg_h_files, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - k2, (unsigned char *) msg_h_files, COLOR2); + gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - k2, (unsigned char *) msg_h_files, FILECOLOR); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_middle - GRAPH_TEXT_Y_OFFSET - i - j - k2 - k - 1, (unsigned char *) text_separator, dkgrey); gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - j - k2 - k - 1, (unsigned char *) text_separator, black); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, section_middle - GRAPH_TEXT_Y_OFFSET - i - j - k2 * 2 - 1, (unsigned char *) msg_h_hits, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - j - k2 * 2 - 1, (unsigned char *) msg_h_hits, COLOR1); + gdImageStringUp(im, gdFontSmall, edge_text_offset, section_middle - GRAPH_TEXT_Y_OFFSET - i - j - k2 * 2 - 1, (unsigned char *) msg_h_hits, HITCOLOR); } /**************************************************** @@ -772,25 +830,25 @@ /* HITS */ percent = ((double) data1[i] / (double) maxval); xbarleft = GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + (i * bar_offset); - draw_bar(xbarleft, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR1); + draw_bar(xbarleft, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, HITCOLOR); /* X Axis */ text_centring = (((double) strlen(numchar[i + 1])) / 2.0) * (double) font_char_width; cur_text_start = xbarleft + day_middle_x - text_centring; /* fprintf (stderr, "textcent: %d start: %d midx: %d bottom: %d\n", text_centring, cur_text_start, day_middle_x, bottom_lower + GRAPH_TEXT_Y_OFFSET); */ if ((julday % 7 == 6) || (julday % 7 == 0)) /* Change colour for Sat/Sun */ - gdImageString(im, gdFontSmall, cur_text_start, bottom_lower + GRAPH_TEXT_Y_OFFSET, (unsigned char *) numchar[i + 1], COLOR1); + gdImageString(im, gdFontSmall, cur_text_start, bottom_lower + GRAPH_TEXT_Y_OFFSET, (unsigned char *) numchar[i + 1], HITCOLOR); else gdImageString(im, gdFontSmall, cur_text_start, bottom_lower + GRAPH_TEXT_Y_OFFSET, (unsigned char *) numchar[i + 1], black); julday++; /* FILES */ percent = ((double) data2[i] / (double) maxval); - draw_bar(xbarleft + bar_sep, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR2); + draw_bar(xbarleft + bar_sep, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, FILECOLOR); /* PAGES */ percent = ((double) data5[i] / (double) maxval); - draw_bar(xbarleft + bar_sep + bar_sep, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR5); + draw_bar(xbarleft + bar_sep + bar_sep, bottom_upper, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, PAGECOLOR); } /**************************************************** @@ -817,11 +875,11 @@ /* Visits */ percent = ((double) data6[i] / (double) maxval); xbarleft = GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + (i * bar_offset); - draw_bar(xbarleft, bottom_middle, bottom_middle - height_middle, bar_width, percent, 0, COLOR6); + draw_bar(xbarleft, bottom_middle, bottom_middle - height_middle, bar_width, percent, 0, VISITCOLOR); /* Sites */ percent = ((double) data3[i] / (double) maxval); - draw_bar(xbarleft + bar_sep, bottom_middle, bottom_middle - height_middle, bar_width, percent, 0, COLOR3); + draw_bar(xbarleft + bar_sep, bottom_middle, bottom_middle - height_middle, bar_width, percent, 0, SITECOLOR); } /**************************************************** @@ -846,7 +904,7 @@ /* VOLUME */ percent = ((double) data4[i] / (double) fmaxval); xbarleft = GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + (i * bar_offset); - draw_bar(xbarleft, bottom_lower, bottom_lower - height_lower, bar_width, percent, 0, COLOR4); + draw_bar(xbarleft, bottom_lower, bottom_lower - height_lower, bar_width, percent, 0, KBYTECOLOR); } /* open file for writing */ @@ -928,15 +986,15 @@ edge_text_offset = graph_hourly_x - GRAPH_INNER_BOX_RIGHT; /* + GRAPH_TEXT_X_OFFSET; */ gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i - 1, (unsigned char *) msg_h_pages, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i, (unsigned char *) msg_h_pages, COLOR5); + gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i, (unsigned char *) msg_h_pages, PAGECOLOR); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + k2 - k - 1, (unsigned char *) text_separator, dkgrey); gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + k2 - k, (unsigned char *) text_separator, black); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + k2 - 1, (unsigned char *) msg_h_files, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + k2, (unsigned char *) msg_h_files, COLOR2); + gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + k2, (unsigned char *) msg_h_files, FILECOLOR); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + k2 * 2 - k - 1, (unsigned char *) text_separator, dkgrey); gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + k2 * 2 - k, (unsigned char *) text_separator, black); gdImageStringUp(im, gdFontSmall, edge_text_offset + 1, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + l + k2 * 2 - 1, (unsigned char *) msg_h_hits, dkgrey); - gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + l + k2 * 2, (unsigned char *) msg_h_hits, COLOR1); + gdImageStringUp(im, gdFontSmall, edge_text_offset, GRAPH_INNER_BOX_TOP + GRAPH_TEXT_Y_OFFSET + i + j + l + k2 * 2, (unsigned char *) msg_h_hits, HITCOLOR); } for (i = 0; i < 24; i++) { @@ -967,7 +1025,7 @@ /* HITS */ percent = ((double) data1[i] / (double) maxval); xbarleft = GRAPH_INNER_BOX_LEFT + GRAPH_LR_IN_OFFSET + bar_gap + (i * bar_offset); - draw_bar(xbarleft, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR1); + draw_bar(xbarleft, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, HITCOLOR); /* X Axis */ text_centring = (((double) strlen(numchar[i + 1])) / 2.0) * (double) font_char_width; @@ -976,11 +1034,11 @@ /* FILES */ percent = ((double) data2[i] / (double) maxval); - draw_bar(xbarleft + bar_sep, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR2); + draw_bar(xbarleft + bar_sep, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, FILECOLOR); /* PAGES */ percent = ((double) data3[i] / (double) maxval); - draw_bar(xbarleft + bar_sep + bar_sep, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, COLOR5); + draw_bar(xbarleft + bar_sep + bar_sep, bottom, GRAPH_INNER_BOX_TOP + 1, bar_width, percent, 0, PAGECOLOR); } /* save as png file */ @@ -1012,7 +1070,8 @@ double XtoYratio = 5.0 / 6.0; /* Ratio of set X to Y dynamic => 5/6 = 0.833... */ int text_max_x; /* Max right point for text listing */ double s_arc = 0.0; - int purple, ltpurple, ltgreen, brown; + int r, g, b; + int piecolor1, piecolor2, piecolor3, piecolor4; char buffer[128]; struct pie_data gdata; @@ -1020,10 +1079,14 @@ /* init graph and colors */ init_graph(title, graph_pie_x, graph_pie_y); - purple = gdImageColorAllocate(im, 128, 0, 128); - ltgreen = gdImageColorAllocate(im, 128, 255, 192); - ltpurple = gdImageColorAllocate(im, 255, 0, 255); - brown = gdImageColorAllocate(im, 255, 196, 128); + r = getred(pie_color1); g = getgreen(pie_color1); b = getblue(pie_color1); + piecolor1 = gdImageColorAllocate(im, r, g, b); + r = getred(pie_color2); g = getgreen(pie_color2); b = getblue(pie_color2); + piecolor2 = gdImageColorAllocate(im, r, g, b); + r = getred(pie_color3); g = getgreen(pie_color3); b = getblue(pie_color3); + piecolor3 = gdImageColorAllocate(im, r, g, b); + r = getred(pie_color4); g = getgreen(pie_color4); b = getblue(pie_color4); + piecolor4 = gdImageColorAllocate(im, r, g, b); /* base caclulations */ centre_x = (int) ((double) graph_pie_x * (1.0 / 3.0) + 1.0); @@ -1128,7 +1191,7 @@ void init_graph(char *title, int xsize, int ysize) { - int i; + int i, r, g, b; int edge_text_offset; /* px. Offset from the edge for descriptive text */ int font_char_height; /* px. Height of an individual char in a given font - magic constant */ @@ -1139,12 +1202,18 @@ dkgrey = gdImageColorAllocate(im, 128, 128, 128); black = gdImageColorAllocate(im, 0, 0, 0); white = gdImageColorAllocate(im, 255, 255, 255); - green = gdImageColorAllocate(im, 0, 128, 92); - orange = gdImageColorAllocate(im, 255, 128, 0); - blue = gdImageColorAllocate(im, 0, 0, 255); - red = gdImageColorAllocate(im, 255, 0, 0); - cyan = gdImageColorAllocate(im, 0, 192, 255); - yellow = gdImageColorAllocate(im, 255, 255, 0); + r = getred(hit_color); g = getgreen(hit_color); b = getblue(hit_color); + hitcolor = gdImageColorAllocate(im, r, g, b); + r = getred(site_color); g = getgreen(site_color); b = getblue(site_color); + sitecolor = gdImageColorAllocate(im, r, g, b); + r = getred(file_color); g = getgreen(file_color); b = getblue(file_color); + filecolor = gdImageColorAllocate(im, r, g, b); + r = getred(kbyte_color); g = getgreen(kbyte_color); b = getblue(kbyte_color); + kbytecolor = gdImageColorAllocate(im, r, g, b); + r = getred(page_color); g = getgreen(page_color); b = getblue(page_color); + pagecolor = gdImageColorAllocate(im, r, g, b); + r = getred(visit_color); g = getgreen(visit_color); b = getblue(visit_color); + visitcolor = gdImageColorAllocate(im, r, g, b); /* make borders */ @@ -1162,7 +1231,7 @@ /* display the graph title */ font_char_height = 10; edge_text_offset = GRAPH_INNER_BOX_TOP - font_char_height - GRAPH_TEXT_Y_OFFSET - 1; - gdImageString(im, gdFontMediumBold, GRAPH_INNER_BOX_LEFT, edge_text_offset, (unsigned char *) title, blue); + gdImageString(im, gdFontMediumBold, GRAPH_INNER_BOX_LEFT, edge_text_offset, (unsigned char *) title, filecolor); return; } diff -ru awffull-3.02-beta2/src/output.c awffull-3.02-beta2-user-color/src/output.c --- awffull-3.02-beta2/src/output.c 2006-01-11 10:14:49.000000000 +0100 +++ awffull-3.02-beta2-user-color/src/output.c 2006-01-16 22:45:25.000000000 +0100 @@ -106,6 +106,14 @@ #define CYAN "#00E0FF" #define GRPCOLOR "#D0D0E0" +/* configurable html colors */ +#define HITCOLOR hit_color +#define FILECOLOR file_color +#define SITECOLOR site_color +#define KBYTECOLOR kbyte_color +#define PAGECOLOR page_color +#define VISITCOLOR visit_color + /* sort arrays */ UNODEPTR *u_array = NULL; /* Sort array for URL's */ HNODEPTR *h_array = NULL; /* hostnames (sites) */ @@ -623,8 +631,8 @@ "%s\n" "