~ubuntu-branches/ubuntu/quantal/netams/quantal

« back to all changes in this revision

Viewing changes to src/html.c

  • Committer: Bazaar Package Importer
  • Author(s): Alexander GQ Gerasiov
  • Date: 2010-07-24 16:37:01 UTC
  • mfrom: (2.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20100724163701-rni105xlqseqe26h
Tags: 3.4.5-2
* debian/Rules.make: Add -lcrypto to fix FTBFS with binutils-gold.
* debian/netams.postinst: Fix some sed magic in netams.conf
  processing.
* debian/control: Standards version updated.
* Vietnamese translation added. Closes: #576026. Thanks to Clytie
  Siddall.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
***     located at http://www.netams.com
8
8
***
9
9
*************************************************************************/
10
 
/* $Id: html.c,v 1.109 2009-08-01 09:23:55 anton Exp $ */
 
10
/* $Id: html.c,v 1.111 2010-01-17 14:15:57 anton Exp $ */
11
11
 
12
12
#include "netams.h"
13
13
 
681
681
//////////////////////////////////////////////////////////////////////////////////////////
682
682
void sHPrintHeader(FILE *f, const char *title, const char *back, const char *logopath){
683
683
 
684
 
        fprintf(f, "<html><head><title>NeTAMS - %s</title><META http-equiv=\"Pragma\" content=\"no-cache\"><META http-equiv=\"Expires\" content=\"-1\"><META http-equiv=\"Cache-Control\" content=\"no-cache\"><META http-equiv=\"Content-type\" content=\"text/html; charset=%s\">\n</HEAD> \n\
685
 
                <body bgcolor=white marginheight=0 leftmargin=0 topmargin=0 marginwidth=0> \n\
 
684
        fprintf(f, "<html><head><title>NeTAMS - %s</title><META http-equiv=\"Pragma\" content=\"no-cache\"><META http-equiv=\"Expires\" content=\"-1\"><META http-equiv=\"Cache-Control\" content=\"no-cache\"><META http-equiv=\"Content-type\" content=\"text/html; charset=%s\">\n \
 
685
                <script type=\"text/javascript\" src=\"%s/netams.js\"></script> \n\
 
686
                </HEAD><body bgcolor=white marginheight=0 leftmargin=0 topmargin=0 marginwidth=0> \n\
686
687
                <table width=100%% align=left border=0 cellpadding=5 cellspacing=0> \n\
687
688
                <tr bgcolor='white' align=left><td width=376> \n\
688
689
                <A href=\"http://www.netams.com/index.html\"> \n\
689
690
                <img src=\"%s/images/logo_sm.jpg\" width=376 height=60 border=0></a></td> \n\
690
691
                <td valign=middle align=left width=80%%> %s     <a href=\"http://www.netams.com/index.html\"><b>NeTAMS</b></a><br> \
691
 
                <b>%s: </b>", title, language_charset_str[lang], logopath?logopath:"../../../../..", Locale(LC_H_REPORT), Locale(LC_H_SW_VERSION));
 
692
                <b>%s: </b>", title, language_charset_str[lang], logopath?logopath:"../../../../..", logopath?logopath:"../../../../..", Locale(LC_H_REPORT), Locale(LC_H_SW_VERSION));
692
693
        fprintf(f, "%s<br>\n", SHOW_VERSION);
693
694
 
694
695
        char buff[32];
695
696
        fprintf(f, "<b>%s:</b> %s<br> </td></tr> <tr bgcolor='#ccccff'><td colspan=2> \n\
696
697
                <h3>%s", Locale(LC_H_CR_TIME), timeU2T(time(NULL), buff), title);
697
698
        if (back)
698
 
                fprintf(f, "<font face=monospace size=-1><b> [<a href=\"%s\"> <- %s</a> ]</b></font>",
 
699
                fprintf(f, "<font face=monospace size=-1><b> [<a href=\"%s\"> <- %s</a> ]&nbsp;[ <a href=\"#\" id='expandall' style='e:1' onclick='expandall();'>expand all</a> ]</b></font>",
699
700
                        back, Locale(LC_H_BACK));
700
701
        fprintf(f, "</h3></td></tr><tr><td colspan=2>\n");
701
702
}
776
777
 
777
778
        if (u->type==NETUNIT_GROUP) {
778
779
                sHPrintTHeader(f);
779
 
                fprintf(f, "<tr bgcolor='#000000'><td colspan=11 height=2> </td></tr><tr bgcolor='#ffffcc'><td colspan=11>");
 
780
                fprintf(f, "<tr bgcolor='#000000'><td colspan=11 height=2> </td></tr><tr bgcolor='#ffffcc' id='%06X'><td colspan=11>", u->id);
780
781
                if (!is_zero_counters && *tmp) {
781
782
                    fprintf(f, "<A href=\"../../../../../cgi-bin/netams_graph.cgi?oid=%06X&policy=%s&year=%u&month=%u&day=%u\">D</a>", u->id, tmp, tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday);
782
783
                    fprintf(f, "<A href=\"../../../../../cgi-bin/netams_graph.cgi?oid=%06X&policy=%s&year=%u&week=d2w-%u-%u-%u\">W</a>", u->id, tmp, tm.tm_year+1900, tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday);
796
797
                } else
797
798
                    *tmp=0;
798
799
 
799
 
                fprintf(f, "GROUP: <b>%s</b> <font size=-1>oid %06X</font></td></tr>\n", u->name?u->name:"", u->id);
 
800
                fprintf(f, "GROUP: <b>%s</b> <font size=-1>oid %06X</font>&nbsp;<a href=\"#\" id='%06X_c' onclick=\"expand_children('%06X')\">expand children</a>&nbsp;<a href=\"#\" id='%06X_p' onclick=\"expand_policies('%06X')\">expand policies</a></td></tr>\n", u->name?u->name:"", u->id, u->id, u->id, u->id, u->id);
800
801
                sHPrintUnitST(f, u, *tmp?tmp:NULL);
801
 
                fprintf(f, "<tr bgcolor='#ccffcc'><td colspan=11 align=right>\n");
 
802
                fprintf(f, "<tr bgcolor='#ccffcc' id='%06X_child' style='display:none'><td colspan=11 align=right>\n", u->id);
802
803
 
803
804
                sHPrintUnitsRoot(f, cfg, u);
804
805
 
805
806
                fprintf(f, "</td></tr>\n");
806
807
                fprintf(f, "</table><br>\n");
807
808
    } else {
808
 
                fprintf(f, "<tr bgcolor='#ffffcc'><td colspan=11>");
 
809
                fprintf(f, "<tr bgcolor='#ffffcc' id='%06X'><td colspan=11>", u->id);
809
810
                if (isadmintool) fprintf(f, "<A href=\"../../../../../cgi-bin/admintool.cgi?oid=%06X\"><img src=\"../../../../../images/admintool-logo.gif\" width=20 height=20 border=1 align=absmiddle></a> ", u->id);
810
811
                if (!is_zero_counters && *tmp) {
811
812
                    fprintf(f, "<A href=\"../../../../../cgi-bin/netams_graph.cgi?oid=%06X&policy=%s&year=%u&month=%u&day=%u\">D</a>", u->id, tmp, tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday);
851
852
                if (u->description) fprintf(f, "&nbsp;&nbsp;&nbsp;<font color=navy>%s</font>", u->description);
852
853
 
853
854
                if (is_zero_counters) fprintf(f, "&nbsp;&nbsp;&nbsp;<font color=navy>(%s)</font>", Locale(LC_H_ALL_ZERO));
854
 
                fprintf(f, "</td></tr>\n\n");
 
855
                fprintf(f, "&nbsp;<a href=\"#\" id='%06X_p' onclick=\"expand_policies('%06X')\">expand policies</a></td></tr>\n\n", u->id, u->id);
855
856
                if (!is_zero_counters) sHPrintUnitST(f, u, NULL);
856
857
        }
857
858
}
864
865
        netams_rwlock_rdlock(&u->ap->rwlock);
865
866
        for (cpd=u->ap->root; cpd!=NULL; cpd=cpd->next) {
866
867
                if (cpd->policy->hidden) continue;
867
 
                fprintf(f, "<tr align=right>");
 
868
                fprintf(f, "<tr align=right style=\"display: none;\" id='%06X_pol'>", u->id);
868
869
                if (unit_list) {
869
870
                    fprintf(f, "<td align=left valign=middle bgcolor='#ffffaa'>");
870
871
                    fprintf(f, "<A href=\"../../../../../cgi-bin/netams_graph.cgi?oid=%s&policy=%06X&year=%u&month=%u&day=%u&oids=unit\">D</a>", unit_list, cpd->policy->id, tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday);