Prenosy sharujicich IPcek jsou nyni rozkliknutelne (pomoci JQuery)
authorxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Wed, 30 Nov 2011 17:28:43 +0000 (17:28 +0000)
committerxchaos <xchaos@251d49ef-1d17-4917-a970-b30cf55b089b>
Wed, 30 Nov 2011 17:28:43 +0000 (17:28 +0000)
git-svn-id: https://dev.arachne.cz/repos/prometheus/trunk@154 251d49ef-1d17-4917-a970-b30cf55b089b

cll1-0.6.2.h
prometheus.c

index 12d27bfcf81ee64ecfa8a240b574a8e9bc18b9ce..7c33ce8f3742dfae1fc31535c560a4dde87f3392 100644 (file)
@@ -71,7 +71,7 @@
 
 /* String macros & sequences, updated 2004-04-19 by xCh. */
 
-#define eq(A,B) !strcmp(A,B)
+#define eq(A,B) ((A) && (B) && !strcmp(A,B))
 #define strcmpi(A,B) strcasecmp(A,B)
 #define strlwr(A) {char *_S=A; while(_&&*_S){*_S=tolower(*_S);_S++;}}
 #define strupr(A) {char *_S=A; while(_&&*_S){*_S=toupper(*_S);_S++;}}
index 4731bcc2dac89bdaedcc9d37421c702066f65ad9..0ea9378bb4406bc4cabcdfe2b3c489754fc373b7 100644 (file)
@@ -7,7 +7,7 @@
 /*  Credit: CZFree.Net,Martin Devera,Netdave,Aquarius,Gandalf  */\r
 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */\r
 \r
-/* Modified by: xChaos, 20110428\r
+/* Modified by: xChaos, 20111130\r
                  ludva, 20080415\r
  \r
    Prometheus QoS is free software; you can redistribute it and/or\r
@@ -33,7 +33,7 @@
 \r
 #include "cll1-0.6.2.h"\r
 \r
-const char *version = "0.8.3"; \r
+const char *version = "0.8.3-b";\r
 \r
 /* Version numbers: 0.8.3 is development releases ("beta"), 0.8.4 will be "stable" */\r
 /* Debian(RPM) package versions/patchlevels: 0.7.9-2, 0.8.0-1, 0.8.0-2, etc. */\r
@@ -1511,6 +1511,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
   printf("Sorting data and generating statistics page %s ...\n",ptr);\r
   /*-----------------------------------------------------------------*/\r
 \r
+  fputs("<script type=\"text/javascript\" src=\"/jquery.js\"></script>\n",f);\r
   fputs("<table border>\n<tr><th align=\"right\">#</th><th align=\"right\">group</th><th align=\"right\">IPs</th><th align=\"right\">requested</th>\n",f);\r
   fprintf(f,"<th colspan=\"%d\">data limits</th>\n",keywordcount);\r
   fputs("</tr>\n",f);\r
@@ -1554,12 +1555,12 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
  {\r
   unsigned long long total_traffic=0, total_direct=0, total_proxy=0, total_upload=0, tmp_sum=0;\r
   int active_classes=0;\r
-  int colspan;\r
+  int colspan=11;\r
   FILE *iplog;\r
   struct Sum {unsigned long long l; int i; list(Sum);} *sum,*sums=NULL;\r
   int limit_count=0, prio_count=0;\r
+  int popup_button=0;\r
 \r
-  colspan=11;\r
   if(qos_proxy)\r
   {\r
    colspan++;\r
@@ -1609,7 +1610,24 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
 #ifdef DEBUG\r
    printf("%03d. %-22s %10Lu (%d/%d)\n",i ,ip->name, ip->traffic, ip->min, ip->max); \r
 #endif\r
-   fprintf(f,"<tr><td align=\"right\"><a name=\"%s\"></a>%d</td><td><a href=\"%s%s.log\">%s</a></td>\n", ip->name, i, log_url, ip->name, ip->name);\r
+   /* hostnames -------------------------------------- */\r
+   fprintf(f,"<tr><td align=\"right\"><a name=\"%s\"></a>%d</td><td><a href=\"%s%s.log\">%s</a>\n", ip->name, i, log_url, ip->name, ip->name);   \r
+   fprintf(f,"<span id=\"sharing_%d\" style=\"display:none\">",i);\r
+   popup_button=0;\r
+   for_selected(sharedip,ips,eq(ip->name,sharedip->sharing))\r
+   {\r
+    fprintf(f,"<br /><a href=\"%s%s.log\">%s</a>\n", log_url, sharedip->name, sharedip->name);\r
+    popup_button=1;\r
+   }\r
+   fputs("</span>\n",f);\r
+   if(popup_button)\r
+   {\r
+    fprintf(f,"<span id=\"toggle_%d\">[<a href=\"#\" onClick=\"$(\'#toggle_%d\').remove();$(\'#sharing_%d\').show();$(\'#download_%d\').show();$(\'#upload_%d\').show();return(false);\" style=\"cursor: pointer; text-decoration:none;\">+</a>]</span>",\r
+              i, i, i, i, i);\r
+   }\r
+   fputs("</td>\n",f);\r
+   /* ----------------------------------------------- */\r
+\r
    if(found_lmsid)\r
    {\r
     fputs("<td align=\"right\">",f);\r
@@ -1622,17 +1640,38 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     {\r
      fputs("-------",f);\r
     }\r
-    fputs("</td>\n",f);    \r
+    fputs("</td>\n",f);\r
    }\r
    fprintf(f,"<td align=\"right\">%Lu M</td>\n", ip->credit);\r
    fprintf(f,"<td align=\"right\"><span style=\"color:#%s\">%Lu M</span></td>",\r
-             ip->keyword->html_color, ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
-   fprintf(f,"<td align=\"right\">%s%Lu M%s</td><td align=\"right\">%Lu M</td>\n", f1, ip->traffic, f2, ip->direct);\r
+             ip->keyword->html_color,\r
+             ip->credit+(ip->min*ip->keyword->data_limit+(ip->keyword->fixed_limit<<20)));\r
+   fprintf(f,"<td align=\"right\">%s%Lu M%s",f1, ip->traffic, f2);\r
+\r
+   /* download --------------------------------------- */\r
+   fprintf(f,"</td><td align=\"right\">%Lu M", ip->direct);\r
+   fprintf(f,"<span id=\"download_%d\" style=\"display:none\">",i);\r
+   for_selected(sharedip,ips,eq(ip->name,sharedip->sharing))\r
+   {\r
+    fprintf(f,"<br />%Lu M", sharedip->direct);\r
+   }\r
+   fputs("</span></td>\n",f);\r
+   /* ----------------------------------------------- */\r
+\r
    if(qos_proxy)\r
    {\r
     fprintf(f,"<td align=\"right\">%Lu M</td>\n", ip->proxy);\r
    }\r
-   fprintf(f,"<td align=\"right\">%Lu M</td>\n", ip->upload);\r
+   /* upload ---------------------------------------- */\r
+   fprintf(f,"<td align=\"right\">%Lu M", ip->upload);\r
+   fprintf(f,"<span id=\"upload_%d\" style=\"display:none\">",i);\r
+   for_selected(sharedip,ips,eq(ip->name,sharedip->sharing))\r
+   {\r
+    fprintf(f,"<br />%Lu M", sharedip->upload);\r
+   }\r
+   fputs("</span></td>\n",f);\r
+   /* ----------------------------------------------- */\r
+\r
    fprintf(f,"<td align=\"right\">%d k</td><td align=\"right\">%d k</td><td align=\"right\">%s%d k%s</td><td>%s%d%s</td></tr>\n",\r
              ip->min,ip->desired,f1,ip->max,f2,f1,ip->prio,f2);\r
    total_traffic+=ip->traffic;\r
@@ -1664,8 +1703,7 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
    }\r
   }\r
   fprintf(f,"<tr><th colspan=\"%d\" align=\"left\">SUMMARY:</td>",colspan-7);\r
-  fprintf(f,"<th align=\"right\">%Lu M</th>\\r
-  <th align=\"right\">%Lu M</th>\n", total_traffic, total_direct);\r
+  fprintf(f,"<th align=\"right\">%Lu M</th><th align=\"right\">%Lu M</th>\n", total_traffic, total_direct);\r
   if(qos_proxy)\r
   {\r
    fprintf(f,"<th align=\"right\">%Lu M</th>\n", total_proxy);\r
@@ -1747,8 +1785,8 @@ Credit: CZFree.Net, Martin Devera, Netdave, Aquarius, Gandalf\n\n",version);
     if(iplog)\r
     {\r
      fprintf(iplog,"%ld\t%d\t%d %%\t%Lu M\t%Ld %%\tACTIVE %d\tTRAFFIC %Lu M\tCLASSES %d\tFUP-LIMIT %d\tLOW-PRIO %d\t%s",\r
-                    time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, \r
-                    active_classes, total_traffic, total, limit_count, prio_count, d); /* d = date*/\r
+                   time(NULL), top20_count, top20_perc1, top20_sum, top20_perc2, \r
+                   active_classes, total_traffic, total, limit_count, prio_count, d); /* d = date*/\r
      fclose(iplog);\r
     }\r
    }\r
This page took 0.389275 seconds and 4 git commands to generate.