Index: xymongen/pagegen.c =================================================================== --- xymongen/pagegen.c (revision 6772) +++ xymongen/pagegen.c (working copy) @@ -314,6 +314,127 @@ return strcmp((*n1)->hostname, (*n2)->hostname); } +typedef struct vprec_t { + char *testname; + host_t **hosts; + entry_t **entries; +} vprec_t; + +void do_vertical(host_t *head, FILE *output, char *pagepath) +{ + /* + * This routine outputs the host part of a page or a group, + * but with the hosts going across the page, and the test going down. + * I.e. it generates buttons and links to all the hosts for + * a test, and the host docs. + */ + + host_t *h; + entry_t *e; + char *xymonskin; + int rowcount = 0, hostcount = 0; + int usetooltip = 0; + int width; + int hidx; + void *vptree; + xtreePos_t handle; + + if (head == NULL) + return; + + vptree = xtreeNew(strcmp); + + xymonskin = strdup(xgetenv("XYMONSKIN")); + + switch (tooltipuse) { + case TT_STDONLY: case TT_ALWAYS: usetooltip = 1; break; + case TT_NEVER: usetooltip = 0; break; + } + + width = atoi(xgetenv("DOTWIDTH")); + if ((width < 0) || (width > 50)) width = 16; + width += 4; + + /* Start the table ... */ + fprintf(output, "
\n"); + + /* output column headings */ + fprintf(output, ""); + for (h = head, hostcount = 0; (h); h = h->next, hostcount++) { + fprintf(output, " \n", + hostsvcurl(h->hostname, xgetenv("INFOCOLUMN"), 1), + xgetenv("XYMONPAGECOLFONT"), h->hostname); + } + fprintf(output, "\n"); + fprintf(output, "\n\n", hostcount); + + /* Create a tree indexed by the testname, and holding the show/noshow status of each test */ + for (h = head, hidx = 0; (h); h = h->next, hidx++) { + for (e = h->entries; (e); e = e->next) { + vprec_t *itm; + char *hptr; + + handle = xtreeFind(vptree, e->column->name); + if (handle == xtreeEnd(vptree)) { + itm = (vprec_t *)malloc(sizeof(vprec_t)); + itm->testname = e->column->name; + itm->hosts = (host_t **)calloc(hostcount, sizeof(host_t *)); + itm->entries = (entry_t **)calloc(hostcount, sizeof(entry_t *)); + xtreeAdd(vptree, itm->testname, itm); + } + else { + itm = xtreeData(vptree, handle); + } + + (itm->hosts)[hidx] = h; + (itm->entries)[hidx] = e; + } + } + + for (handle = xtreeFirst(vptree); (handle != xtreeEnd(vptree)); handle = xtreeNext(vptree, handle)) { + vprec_t *itm = xtreeData(vptree, handle); + + fprintf(output, ""); + fprintf(output, "", itm->testname); + + for (hidx = 0; (hidx < hostcount); hidx++) { + char *skin, *htmlalttag; + host_t *h = (itm->hosts)[hidx]; + entry_t *e = (itm->entries)[hidx]; + + fprintf(output, ""); + } + + fprintf(output, "\n"); + } + + fprintf(output, "
 "); + fprintf(output, " %s
 
%s"); + if (e == NULL) { + fprintf(output, "-"); + } + else { + + if (strcmp(e->column->name, xgetenv("INFOCOLUMN")) == 0) { + /* show the host ip on the hint display of the "info" column */ + htmlalttag = alttag(e->column->name, COL_GREEN, 0, 1, h->ip); + } + else { + htmlalttag = alttag(e->column->name, e->color, e->acked, e->propagate, e->age); + } + + skin = (e->skin ? e->skin : xymonskin); + + fprintf(output, "", hostsvcurl(h->hostname, e->column->name, 1)); + fprintf(output, "\"%s\"", + skin, dotgiffilename(e->color, e->acked, e->oldage), + htmlalttag, htmlalttag, + xgetenv("DOTHEIGHT"), xgetenv("DOTWIDTH")); + } + fprintf(output, "

\n"); + xfree(xymonskin); +} + void do_hosts(host_t *head, int sorthosts, char *onlycols, char *exceptcols, FILE *output, FILE *rssoutput, char *grouptitle, int pagetype, char *pagepath) { /* @@ -883,8 +1004,13 @@ } if (!embedded && !hostsbeforepages && page->subpages) do_page_subpages(output, page->subpages, pagepath); - do_hosts(page->hosts, 0, NULL, NULL, output, rssoutput, "", PAGE_NORMAL, pagepath); - do_groups(page->groups, output, rssoutput, pagepath); + if (page->vertical) { + do_vertical(page->hosts, output, pagepath); + } + else { + do_hosts(page->hosts, 0, NULL, NULL, output, rssoutput, "", PAGE_NORMAL, pagepath); + do_groups(page->groups, output, rssoutput, pagepath); + } if (!embedded && hostsbeforepages && page->subpages) do_page_subpages(output, page->subpages, pagepath); /* Summaries on main page only */ Index: xymongen/xymongen.h =================================================================== --- xymongen/xymongen.h (revision 6772) +++ xymongen/xymongen.h (working copy) @@ -198,6 +198,7 @@ int color; /* Calculated */ int oldage; char *pretitle; + int vertical; struct xymongen_page_t *next; struct xymongen_page_t *subpages; struct xymongen_page_t *parent; Index: xymongen/loadlayout.c =================================================================== --- xymongen/loadlayout.c (revision 6772) +++ xymongen/loadlayout.c (working copy) @@ -112,7 +112,7 @@ return result; /* This may be an empty string */ } -xymongen_page_t *init_page(char *name, char *title) +xymongen_page_t *init_page(char *name, char *title, int vertical) { xymongen_page_t *newpage = (xymongen_page_t *) calloc(1, sizeof(xymongen_page_t)); @@ -131,6 +131,7 @@ newpage->color = -1; newpage->oldage = 1; + newpage->vertical = vertical; newpage->pretitle = NULL; newpage->groups = NULL; newpage->hosts = NULL; @@ -416,6 +417,7 @@ xymongen_page_t *load_layout(char *pgset) { char pagetag[100], subpagetag[100], subparenttag[100], + vpagetag[100], vsubpagetag[100], vsubparenttag[100], grouptag[100], summarytag[100], titletag[100], hosttag[100]; char *name, *link, *onlycols, *exceptcols; char hostname[MAX_LINE_LEN]; @@ -457,12 +459,15 @@ sprintf(pagetag, "%spage", pgset); sprintf(subpagetag, "%ssubpage", pgset); sprintf(subparenttag, "%ssubparent", pgset); + sprintf(vpagetag, "v%spage", pgset); + sprintf(vsubpagetag, "v%ssubpage", pgset); + sprintf(vsubparenttag, "v%ssubparent", pgset); sprintf(grouptag, "%sgroup", pgset); sprintf(summarytag, "%ssummary", pgset); sprintf(titletag, "%stitle", pgset); sprintf(hosttag, "%s:", pgset); for (p=hosttag; (*p); p++) *p = toupper((int)*p); - toppage = init_page("", ""); + toppage = init_page("", "", 0); addtopagelist(toppage); curpage = NULL; cursubpage = NULL; @@ -485,14 +490,14 @@ dbgprintf("load_layout: -- got line '%s'\n", inbol); - if (strncmp(inbol, pagetag, strlen(pagetag)) == 0) { + if ((strncmp(inbol, pagetag, strlen(pagetag)) == 0) || (strncmp(inbol, vpagetag, strlen(vpagetag)) == 0)) { getnamelink(inbol, &name, &link); if (curpage == NULL) { /* First page - hook it on toppage as a subpage from there */ - curpage = toppage->subpages = init_page(name, link); + curpage = toppage->subpages = init_page(name, link, (strncmp(inbol, vpagetag, strlen(vpagetag)) == 0)); } else { - curpage = curpage->next = init_page(name, link); + curpage = curpage->next = init_page(name, link, (strncmp(inbol, vpagetag, strlen(vpagetag)) == 0)); } curpage->parent = toppage; @@ -506,7 +511,7 @@ curhost = NULL; addtopagelist(curpage); } - else if (strncmp(inbol, subpagetag, strlen(subpagetag)) == 0) { + else if ( (strncmp(inbol, subpagetag, strlen(subpagetag)) == 0) || (strncmp(inbol, vsubpagetag, strlen(vsubpagetag)) == 0) ) { if (curpage == NULL) { errprintf("'subpage' ignored, no preceding 'page' tag : %s\n", inbol); goto nextline; @@ -514,10 +519,10 @@ getnamelink(inbol, &name, &link); if (cursubpage == NULL) { - cursubpage = curpage->subpages = init_page(name, link); + cursubpage = curpage->subpages = init_page(name, link, (strncmp(inbol, vsubpagetag, strlen(vsubpagetag)) == 0)); } else { - cursubpage = cursubpage->next = init_page(name, link); + cursubpage = cursubpage->next = init_page(name, link, (strncmp(inbol, vsubpagetag, strlen(vsubpagetag)) == 0)); } cursubpage->parent = curpage; if (curtitle) { @@ -529,7 +534,7 @@ curhost = NULL; addtopagelist(cursubpage); } - else if (strncmp(inbol, subparenttag, strlen(subparenttag)) == 0) { + else if ( (strncmp(inbol, subparenttag, strlen(subparenttag)) == 0) || (strncmp(inbol, vsubparenttag, strlen(vsubparenttag)) == 0) ) { xymongen_page_t *parentpage, *walk; getparentnamelink(inbol, toppage, &parentpage, &name, &link); @@ -538,7 +543,7 @@ goto nextline; } - cursubparent = init_page(name, link); + cursubparent = init_page(name, link, (strncmp(inbol, vsubparenttag, strlen(vsubparenttag)) == 0)); if (parentpage->subpages == NULL) { parentpage->subpages = cursubparent; }