Date localisation (global and charts).

Add zoom capabilities on charts. Dbl-click to reset.
This commit is contained in:
jerome 2014-03-24 21:18:53 +01:00
parent 437939736f
commit 9201c9fff6
12 changed files with 77 additions and 9 deletions

View File

@ -288,7 +288,7 @@ function psm_date($time)
{
if(empty($time) || $time == '0000-00-00 00:00:00')
return 'never';
return date('d/m/Y H:i:s', strtotime($time));
return date(psm_get_lang('system', 'date_time_format'), strtotime($time));
}
/**

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'Налична е нова версия. Може да я свалите от <a href="http://www.phpservermonitor.org" target="_blank">тук</a>.',
'back_to_top' => 'Нагоре',
'go_back' => 'Go back',
'date_time_format' => 'd.m.Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Настройки',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%d.%m.%Y %H:%M:%S',
'chart_short_date_format' => '%d.%m %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'Основни настройки',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'Uma atualização disponível em <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Voltar ao topo',
'go_back' => 'Go back',
'date_time_format' => 'd/m/Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Configuração',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%d/%m/%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'Geral',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'Ein neues Update ist verf&uuml;gbar auf <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Back to top',
'go_back' => 'Go back',
'date_time_format' => 'd.m.Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Einstellungen',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%d.%m.%Y %H:%M:%S',
'chart_short_date_format' => '%d.%m %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'General',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'A new update is available from <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Back to top',
'go_back' => 'Go back',
'date_time_format' => 'Y-m-d H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Config',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'General',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'Une nouvelle version est disponible à l\'adresse <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Haut de page',
'go_back' => 'Retour',
'date_time_format' => 'd/m/Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Configuration',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Heure',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%d/%m/%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'Général',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => '새로운 업데이트가 있습니다. 다음사이트를 방문 해 주십시오. <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Back to top',
'go_back' => 'Go back',
'date_time_format' => 'Y-m-d H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => '설정',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => '일반',

View File

@ -44,6 +44,8 @@ $sm_lang = array(
'update_available' => 'Een nieuwe update is beschikbaar op <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
'back_to_top' => 'Terug naar boven',
'go_back' => 'Terug',
'date_time_format' => 'd-m-Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
),
'menu' => array(
'config' => 'Config',
@ -111,6 +113,11 @@ $sm_lang = array(
'hour' => 'Hour',
'warning_threshold' => 'Warning threshold',
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
'chart_long_date_format' => '%d-%m-%Y %H:%M:%S',
'chart_short_date_format' => '%d-%m %H:%M',
'chart_short_time_format' => '%H:%M',
),
'config' => array(
'general' => 'Algemeen',

View File

@ -101,7 +101,7 @@ class HistoryController extends AbstractServerController {
'server_name' => $server['label'],
'server_lines' => sizeof($lines) ? '[' . implode(',', $lines) . ']' : '',
'server_down' => sizeof($down) ? '[' . implode(',', $down) . ']' : '',
'server_online' => $server['last_online'],
'server_online' => psm_date($server['last_online']),
'server_rtime' => round((float)$server['rtime'], 3),
);
}
@ -123,6 +123,9 @@ class HistoryController extends AbstractServerController {
'label_week' => psm_get_lang('servers', 'week'),
'label_day' => psm_get_lang('servers', 'day'),
'label_hour' => psm_get_lang('servers', 'hour'),
'long_date_format' => psm_get_lang('servers', 'chart_long_date_format'),
'short_date_format' => psm_get_lang('servers', 'chart_short_date_format'),
'short_time_format' => psm_get_lang('servers', 'chart_short_time_format'),
)
);

View File

@ -3,10 +3,16 @@
<!--[if lt IE 9]><script type="text/javascript" src="static/plugin/excanvas.js"></script><![endif]-->
<script type="text/javascript" src="static/plugin/jqplot/jquery.jqplot.min.js"></script>
<script type="text/javascript" src="static/plugin/jqplot/jqplot.canvasOverlay.min.js"></script>
<script type="text/javascript" src="static/plugin/jqplot/jqplot.cursor.min.js"></script>
<script type="text/javascript" src="static/plugin/jqplot/jqplot.dateAxisRenderer.min.js"></script>
<script type="text/javascript" src="static/plugin/jqplot/jqplot.highlighter.min.js"></script>
<link href="static/css/history.css" rel="stylesheet" >
<script type="text/javascript">
var long_date_format = '{long_date_format}';
var short_date_format = '{short_date_format}';
var short_time_format = '{short_time_format}';
</script>
<script type="text/javascript" src="static/js/history.js"></script>
<div id="history-panel">

View File

@ -51,20 +51,20 @@ function create_plot($this, mode)
{
case 'month':
timeStamp = 1000 * 60 * 60 * 24 * 30;
tickFormat = '%d/%m %H:%M';
tickFormat = short_date_format;
break;
case 'week':
timeStamp = 1000 * 60 * 60 * 24 * 7;
tickFormat = '%d/%m %H:%M';
tickFormat = short_date_format;
break;
case 'day':
timeStamp = 1000 * 60 * 60 *24;
tickFormat = '%H:%M';
tickFormat = short_time_format;
break;
case 'hour':
default:
timeStamp = 1000 * 60 * 60;
tickFormat = '%H:%M';
tickFormat = short_time_format;
break;
}
@ -85,7 +85,7 @@ function create_plot($this, mode)
color: '#fe5d5d',
showTooltip: true,
showTooltipPrecision: 1.0,
tooltipFormatString: "&darr; " + d.strftime('%d/%m/%y %H:%M:%S')
tooltipFormatString: "&darr; " + d.strftime(long_date_format)
}});
}
}
@ -108,7 +108,7 @@ function create_plot($this, mode)
{
var point = plot.series[seriesIndex].data[pointIndex];
var d = new $.jsDate(point[0]);
return "&uarr; " + d.strftime('%d/%m/%y %H:%M:%S') + ' - ' + $.jqplot.sprintf('%.3fs', point[1]);
return "&uarr; " + d.strftime(long_date_format) + ' - ' + $.jqplot.sprintf('%.3fs', point[1]);
}
},
seriesDefaults: {
@ -117,7 +117,14 @@ function create_plot($this, mode)
canvasOverlay: {
show: true,
objects: downArray
}
},
cursor:{
show: true,
zoom: true,
showTooltip:false,
dblClickReset: true,
constrainZoomTo: 'x'
}
});
$this.data('psm_plot', plot);
}

File diff suppressed because one or more lines are too long