From 78d84a88e0f87ad2b44aa8f3c6b5d37fee2135e7 Mon Sep 17 00:00:00 2001 From: Vinicius Coque Date: Sat, 22 Oct 2011 17:02:04 -0200 Subject: Converting from prototype to jQuery status_* --- usr/local/www/status_filter_reload.php | 14 +++++++------- usr/local/www/status_queues.php | 22 +++++++++++----------- usr/local/www/status_rrd_graph.php | 4 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/usr/local/www/status_filter_reload.php b/usr/local/www/status_filter_reload.php index a5dd334..78c6f8d 100644 --- a/usr/local/www/status_filter_reload.php +++ b/usr/local/www/status_filter_reload.php @@ -101,18 +101,18 @@ function update_data(obj) { result_text = result_text.replace("\n",""); result_text = result_text.replace("\r",""); if (result_text) { - $('status').innerHTML = ' ' + result_text + '...'; + jQuery('#status').html(' ' + result_text + '...'); } else { - $('status').innerHTML = ' Obtaining filter status...'; + jQuery('#status').html(' Obtaining filter status...'); } if(result_text == "Initializing") { - $('status').innerHTML = ' Initializing...'; + jQuery('#status').html(' Initializing...'); } else if(result_text == "Done") { new Effect.Highlight($('status')); - $('status').innerHTML = 'Done. The filter rules have been reloaded.'; - $('reloadinfo').style.visibility="hidden"; - $('doneurl').style.visibility="visible"; - $('doneurl').innerHTML = "

Queue Status"; + jQuery('#status').html('Done. The filter rules have been reloaded.'); + jQuery('#reloadinfo').css("visibility","hidden"); + jQuery('#doneurl').css("visibility","visible"); + jQuery('#doneurl').html("

Queue Status"); } window.setTimeout('update_status_thread()', 2500); } diff --git a/usr/local/www/status_queues.php b/usr/local/www/status_queues.php index a317bdf..32dfd09 100755 --- a/usr/local/www/status_queues.php +++ b/usr/local/www/status_queues.php @@ -82,13 +82,13 @@ if ($_REQUEST['getactivity']) { $packet_s = round(400 * (1 - $q['pkts']/ $total_packets_s), 0); - $finscript .= "$('queue{$q['name']}{$q['interface']}widthb').width='{$packet_s}';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}widtha').width='" . (400 - $packet_s) . "';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}pps').value = '{$q['measured']}/pps';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}bps').value = '{$q['measuredspeed']}';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}borrows').value = '{$q['borrows']} borrows';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}suspends').value = '{$q['suspends']} suspends';"; - $finscript .= "$('queue{$q['name']}{$q['interface']}drops').value = '{$q['droppedpkts']} drops';"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}widthb').width('{$packet_s}');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}widtha').width('" . (400 - $packet_s) . "');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}pps').val('{$q['measured']}/pps');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}bps').val('{$q['measuredspeed']}');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}borrows').val('{$q['borrows']} borrows');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}suspends').val('{$q['suspends']} suspends');"; + $finscript .= "jQuery('#queue{$q['name']}{$q['interface']}drops').val('{$q['droppedpkts']} drops');"; } header("Content-type: text/javascript"); echo $finscript; @@ -115,12 +115,12 @@ if(!is_array($config['shaper']['queue']) && count($config['shaper']['queue']) < function getqueueactivity() { var url = "/status_queues.php"; var pars = 'getactivity=yes'; - var myAjax = new Ajax.Request( + jQuery.ajax( url, { - method: 'post', - parameters: pars, - onComplete: activitycallback + type: 'post', + data: pars, + complete: activitycallback }); } function activitycallback(transport) { diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index e548530..5ef7add 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -605,9 +605,9 @@ function get_dates($curperiod, $graph) { if($curperiod == "current") { $end = $dates['end']; } - /* generate update events utilizing prototype $('') feature */ + /* generate update events utilizing jQuery('') feature */ echo "\n"; - echo "\t\t\$('{$graph}-{$curoption}-{$curdatabase}').src='status_rrd_graph_img.php?start={$start}&graph={$graph}&database={$curdatabase}&style={$curstyle}&tmp=' + randomid;\n"; + echo "\t\tjQuery('#{$graph}-{$curoption}-{$curdatabase}').attr('src','status_rrd_graph_img.php?start={$start}&graph={$graph}&database={$curdatabase}&style={$curstyle}&tmp=' + randomid);\n"; } } ?> -- cgit v1.1