mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/driver/dr...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/driver/dr...
Date: Sun, 04 Feb 2007 17:21:05 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Changes by:     spiralvoice <spiralvoice>       07/02/04 17:21:05

Modified files:
        distrib        : ChangeLog 
        src/daemon/driver: driverCommands.ml driverInteractive.ml 

Log message:
        patch #5722

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/distrib/ChangeLog?cvsroot=mldonkey&r1=1.1170&r2=1.1171
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverCommands.ml?cvsroot=mldonkey&r1=1.217&r2=1.218
http://cvs.savannah.gnu.org/viewcvs/mldonkey/src/daemon/driver/driverInteractive.ml?cvsroot=mldonkey&r1=1.124&r2=1.125

Patches:
Index: distrib/ChangeLog
===================================================================
RCS file: /sources/mldonkey/mldonkey/distrib/ChangeLog,v
retrieving revision 1.1170
retrieving revision 1.1171
diff -u -b -r1.1170 -r1.1171
--- distrib/ChangeLog   4 Feb 2007 17:19:50 -0000       1.1170
+++ distrib/ChangeLog   4 Feb 2007 17:21:05 -0000       1.1171
@@ -15,6 +15,7 @@
 =========
 
 2007/02/04
+5722: HTML: use Printf2.html_mods_cntr () for table row classes (Schlumpf)
 5720: Swarmer: block choice algorithm 2 from patch 5141 is new default
 - remove swarming_block_selection_algorithm = 1
   because it finishes chunks too slowly

Index: src/daemon/driver/driverCommands.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml,v
retrieving revision 1.217
retrieving revision 1.218
diff -u -b -r1.217 -r1.218
--- src/daemon/driver/driverCommands.ml 30 Jan 2007 21:23:01 -0000      1.217
+++ src/daemon/driver/driverCommands.ml 4 Feb 2007 17:21:05 -0000       1.218
@@ -209,11 +209,9 @@
         ( "0", "srh", "Weekdays", "Weekdays" ) ;
         ( "0", "srh", "Hours", "Hours" ) ;
         ( "0", "srh", "Command", "Command" ) ] ;
-      let counter = ref 0 in
+      html_mods_cntr_init ();
       List.iter (fun (wdays, hours, command) ->
-          incr counter;
-          if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr 
class=\\\"dl-1\\\"\\>"
-          else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\"\\>";
+          Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" (html_mods_cntr 
());
           let wdays_string = ref "" in
          let hours_string = ref "" in
          List.iter (fun day ->
@@ -411,17 +409,17 @@
                 ( "1", "srh ar", "Session UL bytes to this client for all 
files", "sUL" ) ;
                 ( "1", "srh ar", "Session DL bytes from this client for all 
files", "sDL" )]);
 
-            let counter = ref 0 in
+            html_mods_cntr_init ();
             let all_clients_list = clients_get_all () in
             List.iter (fun num ->
                 let c = client_find num in
                 let i = client_info c in
-                if use_html_mods o then Printf.bprintf buf "\\<tr 
class=\\\"%s\\\"
+                if use_html_mods o then Printf.bprintf buf "\\<tr 
class=\\\"dl-%d\\\"
                   title=\\\"Add as friend\\\"
                   
onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"
                   onMouseOver=\\\"mOvr(this);\\\"
                   onMouseOut=\\\"mOut(this);\\\"\\>"
-                    (if (!counter mod 2 == 0) then "dl-1" else "dl-2") num;
+                    (html_mods_cntr ()) num;
                     client_print c o;
                     if use_html_mods o then
                     html_mods_td buf ([
@@ -437,7 +435,6 @@
                      ("", "sr ar", (size_of_int64 
i.client_session_downloaded))]);
                 if use_html_mods o then Printf.bprintf buf "\\</tr\\>"
                 else Printf.bprintf buf "\n";
-                incr counter;
             ) all_clients_list;
             if use_html_mods o then Printf.bprintf buf 
"\\</table\\>\\</div\\>";
           end
@@ -522,7 +519,7 @@
 
     "message_log", Arg_multiple (fun args o ->
         let buf = o.conn_buf in
-        let counter = ref 0 in
+        html_mods_cntr_init ();
 
         (match args with
             [arg] ->
@@ -556,8 +553,8 @@
 
             Fifo.iter (fun (t,i,num,n,s) ->
                 if use_html_mods o then begin
-                    Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"
-                      (if (!counter mod 2 == 0) then "dl-1" else "dl-2");
+                    Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>"
+                      (html_mods_cntr ());
                     html_mods_td buf [
                       ("", "sr", Date.simple (BasicSocket.date_of_int t));
                       ("", "sr",  i);
@@ -569,7 +566,6 @@
                 else
                   Printf.bprintf buf "\n%s [client #%d] %s(%s): %s\n"
                     (Date.simple (BasicSocket.date_of_int t)) num n i s;
-                incr counter;
             ) chat_message_fifo;
             if use_html_mods o then Printf.bprintf buf
                 "\\</table\\>\\</div\\>\\</div\\>";
@@ -955,19 +951,18 @@
               ( "0", "srh", "Name", "Name" ) ;
               ( "0", "srh", "State", "State" ) ] ;
           end;
-        let counter = ref 0 in
+        html_mods_cntr_init ();
         List.iter (fun c ->
             let i = client_info c in
             let n = network_find_by_num i.client_network in
             if use_html_mods o then
               begin
 
-                Printf.bprintf buf "\\<tr class=\\\"%s\\\"
+                Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"
                 onMouseOver=\\\"mOvr(this);\\\"
                 onMouseOut=\\\"mOut(this);\\\"\\>"
-                  (if (!counter mod 2 == 0) then "dl-1" else "dl-2");
+                  (html_mods_cntr ());
 
-                incr counter;
                 Printf.bprintf buf "
                        \\<td title=\\\"Client number\\\"
                        onClick=\\\"location.href='submit?q=files+%d'\\\"
@@ -2477,7 +2472,7 @@
         let nuploaders = Intmap.length !uploaders in
         if use_html_mods o then
           begin
-            let counter = ref 0 in
+            html_mods_cntr_init ();
             Printf.bprintf buf "\\<div class=\\\"uploaders\\\"\\>";
             html_mods_table_one_row buf "uploadersTable" "uploaders" [
               ("", "srh", Printf.sprintf "Total upload slots: %d (%d) | 
Pending slots: %d\n" nuploaders
@@ -2512,14 +2507,13 @@
                     try
                       let i = client_info c in
                       if is_connected i.client_state then begin
-                          incr counter;
 
-                          Printf.bprintf buf "\\<tr class=\\\"%s\\\"
+                          Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"
                         title=\\\"[%d] Add as friend (avg: %.1f KB/s)\\\"
                         onMouseOver=\\\"mOvr(this);\\\"
                         onMouseOut=\\\"mOut(this);\\\"
                         
onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"\\>"
-                            ( if (!counter mod 2 == 0) then "dl-1" else 
"dl-2";) (client_num c)
+                            (html_mods_cntr ()) (client_num c)
                           ( float_of_int (Int64.to_int 
i.client_session_uploaded / 1024) /.
                               float_of_int (max 1 ((last_time ()) - 
i.client_connect_time)) )
                           (client_num c);
@@ -2595,12 +2589,11 @@
                     try
                       let i = client_info c in
                      let ips,cc,cn = string_of_kind_geo i.client_kind in
-                      incr counter;
 
-                      Printf.bprintf buf "\\<tr class=\\\"%s\\\"
+                      Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"
                                        title=\\\"Add as Friend\\\" 
onMouseOver=\\\"mOvr(this);\\\" onMouseOut=\\\"mOut(this);\\\"
                                        
onClick=\\\"parent.fstatus.location.href='submit?q=friend_add+%d'\\\"\\>"
-                        ( if (!counter mod 2 == 0) then "dl-1" else "dl-2";) 
cnum;
+                        (html_mods_cntr ()) cnum;
 
                       html_mods_td buf [
                         ("", "sr", Printf.sprintf "%d" (client_num c)); ];
@@ -3247,12 +3240,11 @@
               ( "0", "srh ar", "Download quota", "Max DLs" ) ;
               ( "0", "srh ar", "Download count", "DLs" ) ];
 
-            let counter = ref 0 in
+            html_mods_cntr_init ();
             user2_users_iter (fun user ->
-                incr counter;
                let u_dls = user2_num_user_dls user in
-                Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>"
-                (if !counter mod 2 == 0 then "dl-1" else "dl-2");
+                Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>"
+                (html_mods_cntr ());
                if user <> admin_user && (u_dls = 0) then Printf.bprintf buf
 "\\<td title=\\\"Click to remove user\\\"
 onMouseOver=\\\"mOvr(this);\\\"

Index: src/daemon/driver/driverInteractive.ml
===================================================================
RCS file: /sources/mldonkey/mldonkey/src/daemon/driver/driverInteractive.ml,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -b -r1.124 -r1.125
--- src/daemon/driver/driverInteractive.ml      28 Jan 2007 20:25:44 -0000      
1.124
+++ src/daemon/driver/driverInteractive.ml      4 Feb 2007 17:21:05 -0000       
1.125
@@ -391,13 +391,10 @@
 
 let print_table_html_mods buf lines =
 
-  let counter = ref 0 in
+  html_mods_cntr_init ();
 
   List.iter (fun line ->
-      if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr class=dl-1"
-      else Printf.bprintf buf "\\<tr class=dl-2";
-      incr counter;
-
+      Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"" (html_mods_cntr ());
       Array.iter (fun data ->
           Printf.bprintf buf "%s" data;
       ) line;
@@ -1200,6 +1197,7 @@
   let counter = ref 0 in
   if use_html_mods o then
   begin
+    html_mods_cntr_init ();
     if !!html_mods_use_js_tooltips then Printf.bprintf buf "\\<div 
id=\\\"object1\\\" style=\\\"position:absolute; 
background-color:#FFFFDD;color:black;border-color:black;border-width:20px;font-size:8pt;
 visibility:visible; left:25px; top:-100px; z-index:+1\\\" 
onmouseover=\\\"overdiv=1;\\\"  onmouseout=\\\"overdiv=0; 
setTimeout(\\\'hideLayer()\\\',1000)\\\"\\>\\&nbsp;\\</div\\>\n";
     html_mods_table_header_colspan buf "resultsTable" "results" [
       ( "1", "0", "srh", "Network", "Network" ) ;
@@ -1220,10 +1218,7 @@
               if !counter >= !!max_displayed_results then raise Exit;
 
               if use_html_mods o then
-                begin
-                  if (!counter mod 2 == 0) then Printf.bprintf buf "\\<tr 
class=\\\"dl-1\\\"\\>"
-                  else Printf.bprintf buf "\\<tr class=\\\"dl-2\\\"\\>";
-                end;
+                Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>" 
(html_mods_cntr ());
 
               user.ui_last_results <- (!counter, rs) :: user.ui_last_results;
               let network_name = 
@@ -1950,12 +1945,11 @@
        ( "0", "srh", "", "" ) ]
     else
       Printf.bprintf buf "\n\t--Buildinfo--\n";
-    let counter = ref 0 in
+    html_mods_cntr_init ();
     List.iter (fun (desc, text) ->
-      incr counter;
       if html then 
-       Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
-          (if !counter mod 2 = 0 then "dl-1" else "dl-2") desc text
+       Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
+          (html_mods_cntr ()) desc text
       else
        Printf.bprintf buf "%s %s\n" desc text;
     ) list;
@@ -2069,12 +2063,11 @@
        ( "0", "srh", "", "" ) ]
     else
       Printf.bprintf buf "\n\t--Runinfo--\n";
-    let counter = ref 0 in
+    html_mods_cntr_init ();
     List.iter (fun (desc, text) ->
-      incr counter;
       if html then 
-       Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
-          (if !counter mod 2 = 0 then "dl-1" else "dl-2") desc text
+       Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
+          (html_mods_cntr ()) desc text
       else
        Printf.bprintf buf "%s %s\n" desc text;
     ) list;
@@ -2145,7 +2138,7 @@
   let fill_dir_line = String.make (!len_dir - 9) '-' in
   let fill_strategy = String.make (!len_strategy - 4) ' ' in
   let fill_strategy_line = String.make (!len_strategy - 4) '-' in
-  let counter = ref 0 in
+  html_mods_cntr_init ();
   if html then
       html_mods_table_header buf "sharesTable" "shares" [
        ( "0", "srh", "Directory", "Directory" ) ;
@@ -2163,7 +2156,6 @@
         fill_dir_line fill_strategy_line;
     end;
   List.iter (fun (dir, strategy) ->
-       incr counter;
        let diskused =
          match Unix32.diskused dir with
          | None -> Printf.sprintf "---"
@@ -2181,11 +2173,10 @@
        in
        let filesystem = Unix32.filesystem dir in
        if html then
-         begin
-           Printf.bprintf buf "\\<tr class=\\\"%s\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\<td 
class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td 
class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
-           (if !counter mod 2 = 0 then "dl-1" else "dl-2")
-           dir strategy diskused diskfree percentfree filesystem
-         end
+           Printf.bprintf buf "\\<tr class=\\\"dl-%d\\\"\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\<td class=\\\"sr\\\"\\>%s\\</td\\>
+             \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td class=\\\"sr 
ar\\\"\\>%s\\</td\\>
+             \\<td class=\\\"sr ar\\\"\\>%s\\</td\\>\\<td 
class=\\\"sr\\\"\\>%s\\</td\\>\\</tr\\>"
+           (html_mods_cntr ()) dir strategy diskused diskfree percentfree 
filesystem
        else
          Printf.bprintf buf "%-*s|%-*s|%8s|%8s|%5s|%-s\n"
            (max !len_dir (!len_dir - String.length dir)) dir




reply via email to

[Prev in Thread] Current Thread [Next in Thread]