/*** analog 1.93beta ***/ /* Please read Readme.html, or http://www.statslab.cam.ac.uk/~sret1/analog/ */ /*** formgen.c; generate a form for the analog form interface ***/ #include "analhea2.h" void genopts(FILE *outf, char name[17], char plural[16], int sortby, char codeletter) { fprintf(outf, "\n

%s options

\n\n", name); fprintf(outf, "Sort the %s \n\n"); fprintf(outf, "
(*) Include all %s with at least\n", plural); fprintf(outf, " requests/page requests\n", codeletter); fprintf(outf, "or the top "); fprintf(outf, " %s.\n", codeletter, plural); fprintf(outf, "
(+) Include all %s with at least\n", plural); fprintf(outf, " bytes\n", codeletter); fprintf(outf, "transferred or the top "); fprintf(outf, " %s.\n", codeletter, plural); } void repchoice(FILE *outf, char name[MAXSTRINGLENGTH], char codeletter, flag qq) { fprintf(outf, "
[On] ", codeletter, qq?" checked":""); fprintf(outf, " [Off] %s\n", codeletter, qq?"":" checked", name); } void formgen(void) { extern flag xq, mq, Wq, dq, Dq, hq, Hq, oq, Sq, iq, rq, tq, Bq, bq, fq, eq, cq; extern char reportorder[]; extern int osortby, isortby, Ssortby, rsortby, fsortby, bsortby, Bsortby, tsortby; extern int dirlevel; extern char *hostname, *hosturl, *logourl, *commandname; extern char *outfile; extern struct timestruct fromtime, totime; char *ro; FILE *outf; if (STREQ(outfile, "stdout")) outf = stdout; else if ((outf = fopen(outfile, "w")) == NULL) { fprintf(stderr, "%s: Error: failed to open output file %s for writing.\n", commandname, outfile); exit(ERR); /* shouldn't get here because also tested at the beginning */ } fprintf(outf, "\n"); fprintf(outf, "Analog form interface\n"); fprintf(outf, "\n\n"); fprintf(outf, "\n"); if (hosturl[0] == '-') fprintf(outf, "

\"\" Analog form interface for %s

\n", logourl, hostname); else fprintf(outf, "

\"\" Analog form interface for %s

\n", logourl, hosturl, hostname); fprintf(outf, "
\n"); fprintf(outf, "
You can set any options you like below. But they should all be set to\n"); fprintf(outf, "sensible default values, so you can ignore any of them too.\n"); fprintf(outf, "
\n

1. Report choices

\n"); fprintf(outf, "See the analog\n"); fprintf(outf, "home page for the meanings of the various reports.\n\n"); fprintf(outf, "

\n

Which reports do you want to see?

\n"); repchoice(outf, "General statistics", 'x', xq); for (ro = reportorder; *ro != '\0'; ro++) { switch(*ro) { case 'b': repchoice(outf, "Browser summary", 'b', bq); break; case 'B': repchoice(outf, "Browser report", 'B', Bq); break; case 'c': repchoice(outf, "Status code report", 'c', cq); break; case 'd': repchoice(outf, "Daily summary", 'd', dq); break; case 'D': repchoice(outf, "Daily report", 'D', Dq); break; case 'e': repchoice(outf, "Error report", 'e', eq); break; case 'f': repchoice(outf, "Referrer report", 'f', fq); break; case 'h': repchoice(outf, "Hourly summary", 'h', hq); break; case 'H': repchoice(outf, "Hourly report", 'H', Hq); break; case 'i': repchoice(outf, "Directory report", 'i', iq); break; case 'm': repchoice(outf, "Monthly report", 'm', mq); break; case 'o': repchoice(outf, "Domain report", 'o', oq); break; case 'r': repchoice(outf, "Request report", 'r', rq); break; case 'S': repchoice(outf, "Host report", 'S', Sq); break; case 't': repchoice(outf, "File type report", 't', tq); break; case 'W': repchoice(outf, "Weekly report", 'W', Wq); break; } } fprintf(outf, "

You can now run the program: \n"); fprintf(outf, "
Or you can fill in the options below for individual reports.\n"); fprintf(outf, "You can fill in the
(+) or (*) in each section according to which sort method you select.\n"); fprintf(outf, "You can use bytes to mean 10 Megabytes etc.\n"); fprintf(outf, "


\n

2. Detailed report options

\n"); for (ro = reportorder; *ro != '\0'; ro++) { switch(*ro) { case 'b': genopts(outf, "Browser summary", "browsers", bsortby, 'b'); break; case 'B': genopts(outf, "Browser report", "browsers", Bsortby, 'B'); break; case 'f': genopts(outf, "Referrer report", "referring URLs", fsortby, 'f'); break; case 'i': genopts(outf, "Directory report", "directories", isortby, 'i'); fprintf(outf, "
Print directories to depth "); fprintf(outf, "\n", dirlevel); break; case 'o': genopts(outf, "Domain report", "domains", osortby, 'o'); break; case 'r': genopts(outf, "Request report", "requests", rsortby, 'r'); fprintf(outf, "
Show\n"); fprintf(outf, "\n; include links to\n"); fprintf(outf, "\n"); break; case 'S': genopts(outf, "Host report", "hosts", Ssortby, 'S'); break; case 't': genopts(outf, "File type report", "extensions", tsortby, 't'); break; } } fprintf(outf, "
\n\n

3. Analysing only part of the logfile

\n"); fprintf(outf, "Only certain dates\n"); fprintf(outf, "
You can analyse only the requests from certain dates.\n"); fprintf(outf, "Enter the range of dates below in the from yymmdd;\n"); fprintf(outf, "e.g., 950701 for 1st July 1995 (or fill in just one box\n"); fprintf(outf, "to limit the range of dates on just one side)."); fprintf(outf, "
From -INFINITY) fprintf(outf, " value=\"%02d%02d%02d\"", fromtime.year % 100, fromtime.monthno + 1, fromtime.date); fprintf(outf, ">\nto \n\n"); fprintf(outf, "

Only certain files\n"); fprintf(outf, "
Only look at the following files (list, separated by commas; can contain wild character *)\n"); fprintf(outf, "
\n"); fprintf(outf, "
Ignore the following files\n"); fprintf(outf, "
\n"); fprintf(outf, "


4. Layout

\n"); fprintf(outf, "Your organisation's name (for the title of the page)\n"); fprintf(outf, "\n", hostname); fprintf(outf, "

Your organisation's home page (leave blank for none)\n"); fprintf(outf, "
URL: \n", hosturl); fprintf(outf, "


\n", getenv("TZ")!=NULL?getenv("TZ"):""); /* gets it twice, but easy */ fprintf(outf, " "); fprintf(outf, "\n"); fprintf(outf, "
\n"); fprintf(outf, "

\n"); fprintf(outf, "\"HTML\n"); fprintf(outf, "\n"); }