diff options
author | jim-p <jim@pingle.org> | 2010-02-27 20:45:03 -0500 |
---|---|---|
committer | jim-p <jim@pingle.org> | 2010-02-27 20:45:03 -0500 |
commit | 312d166b02d1b2acb656b7daca256b30b2e05033 (patch) | |
tree | 18b3aa9e3c6c3ae9720c0f0b446bc1b031597a78 /usr/local/www/widgets/widgets/gmirror_status.widget.php | |
parent | 9f9b88e2172994610dd6794057ed5c567ade0a9e (diff) | |
download | pfsense-312d166b02d1b2acb656b7daca256b30b2e05033.zip pfsense-312d166b02d1b2acb656b7daca256b30b2e05033.tar.gz |
AJAX-ify the gmirror status widget. Add license header while I'm here.
Diffstat (limited to 'usr/local/www/widgets/widgets/gmirror_status.widget.php')
-rw-r--r-- | usr/local/www/widgets/widgets/gmirror_status.widget.php | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/usr/local/www/widgets/widgets/gmirror_status.widget.php b/usr/local/www/widgets/widgets/gmirror_status.widget.php index dcbcbc4..cd73a0f 100644 --- a/usr/local/www/widgets/widgets/gmirror_status.widget.php +++ b/usr/local/www/widgets/widgets/gmirror_status.widget.php @@ -1,7 +1,7 @@ <?php /* gmirror_status.widget.php - Copyright (C) 2009 Jim Pingle + Copyright (C) 2009-2010 Jim Pingle Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -27,35 +27,21 @@ require_once("/usr/local/www/widgets/include/gmirror_status.inc"); -$mirrors = get_gmirror_status(); - +if ($_GET['textonly'] == "true") { + header("Cache-Control: no-cache"); + echo gmirror_html_status(); + exit; +} ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> - <tbody> -<?php if (count($mirrors) > 0) { ?> - <tr> - <td width="40%" class="vncellt">Name</td> - <td width="40%" class="vncellt">Status</td> - <td width="20%" class="vncellt">Component</td> - </tr> - <?php foreach ($mirrors as $mirror => $name) { ?> - <tr> - <td width="40%" rowspan="<?= count($name["components"]) ?>" class="listr"><?= $name["name"] ?></td> - <td width="40%" rowspan="<?= count($name["components"]) ?>" class="listr"><?= $name["status"] ?></td> - <td width="20%" class="listr"><?= $name["components"][0] ?></td> - </tr> - <?php - if (count($name["components"]) > 1) { - $morecomponents = array_slice($name["components"], 1); - foreach ($morecomponents as $component) { ?> - <tr> - <td width="20%" class="listr"><?= $component ?></td> - </tr> - <?php } - } ?> - <?php } ?> -<?php } else { ?> - <tr><td colspan="3" class="listr">No Mirrors Found</td></tr> -<?php } ?> + <tbody id="gmirror_status_table"> + <?php echo gmirror_html_status(); ?> </tbody> </table> + +<script type="text/javascript" language="javascript"> + // <![CDATA[ + var gmirrorupdater = new Ajax.PeriodicalUpdater('gmirror_status_table', '/widgets/widgets/gmirror_status.widget.php?textonly=true', + { method: 'get', frequency: 5 } ); + // ]]> +</script> |