The branch, master has been updated via bb5fe3f2d63cdf0b8281b25cd060ffbf39856ab5 (commit) from 1c5be4523737f014c1038375b040cc66acc564b1 (commit)
- Log ----------------------------------------------------------------- commit bb5fe3f2d63cdf0b8281b25cd060ffbf39856ab5 Author: Michal Čihař mcihar@suse.cz Date: Fri Jun 17 10:35:23 2011 +0200
Factor out refresh rate selection and use ngettext for it
-----------------------------------------------------------------------
Summary of changes: server_status.php | 39 +++++++++++++++++---------------------- 1 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/server_status.php b/server_status.php index 0811558..045e40e 100644 --- a/server_status.php +++ b/server_status.php @@ -21,6 +21,21 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) require_once './libraries/common.inc.php';
/** + * Function to output refresh rate selection. + */ +function PMA_choose_refresh_rate() { + echo '<option value="5">' . __('Refresh rate') . '</option>'; + foreach(array(1, 2, 5, 1, 20, 40, 60, 120, 300, 600) as $key => $rate) { + if ($rate % 60 == 0) { + $minrate = $rate / 60; + echo '<option value="' . $rate . '">' . sprintf(_ngettext('%d minute', '%d minutes', $minrate), $minrate) . '</option>'; + } else { + echo '<option value="' . $rate . '">' . sprintf(_ngettext('%d second', '%d seconds', $rate), $rate) . '</option>'; + } + } +} + +/** * Ajax request */
@@ -394,17 +409,7 @@ echo __('Runtime Information'); <?php echo __('Refresh'); ?> </a> <select name="trafficChartRefresh" style="display:none;"> - <option value="5"><?php echo __('Refresh rate'); ?></option> - <option value="1">1 <?php echo __('second'); ?></option> - <option value="2">2 <?php echo __('seconds'); ?></option> - <option value="5">5 <?php echo __('seconds'); ?></option> - <option value="10">10 <?php echo __('seconds'); ?></option> - <option value="20">20 <?php echo __('seconds'); ?></option> - <option value="40">40 <?php echo __('seconds'); ?></option> - <option value="60">1 <?php echo __('minutes'); ?></option> - <option value="120">2 <?php echo __('minutes'); ?></option> - <option value="300">5 <?php echo __('minutes'); ?></option> - <option value="600">10 <?php echo __('minutes'); ?></option> + <?php PMA_choose_refresh_rate(); ?> </select>
<a class="tabChart livetrafficLink" href="#"> @@ -427,17 +432,7 @@ echo __('Runtime Information'); <?php echo __('Refresh'); ?> </a> <select name="queryChartRefresh" style="display:none;"> - <option value="5"><?php echo __('Refresh rate'); ?></option> - <option value="1">1 <?php echo __('second'); ?></option> - <option value="2">2 <?php echo __('seconds'); ?></option> - <option value="5">5 <?php echo __('seconds'); ?></option> - <option value="10">10 <?php echo __('seconds'); ?></option> - <option value="20">20 <?php echo __('seconds'); ?></option> - <option value="40">40 <?php echo __('seconds'); ?></option> - <option value="60">1 <?php echo __('minutes'); ?></option> - <option value="120">2 <?php echo __('minutes'); ?></option> - <option value="300">5 <?php echo __('minutes'); ?></option> - <option value="600">10 <?php echo __('minutes'); ?></option> + <?php PMA_choose_refresh_rate(); ?> </select> <a class="tabChart livequeriesLink" href="#"> <?php echo __('Live query chart'); ?>
hooks/post-receive