issue #115: add warning to server page when notifications are disabled

This commit is contained in:
Pepijn Over 2014-08-01 15:04:36 +02:00
parent f038ccbff1
commit e60e647eb3
16 changed files with 65 additions and 14 deletions

View File

@ -27,6 +27,7 @@ Bugs:
* #111: Generated urls for non-default ports included the port twice.
* #28: Permission denied page.
* #53: User selection on server edit page.
* #115: Warning on server page when notifications are disabled.
* Composer added for dependencies.
v3.0.1 (released April 12, 2014)

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d.%m.%Y %H:%M:%S',
'chart_short_date_format' => '%d.%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d-%m-%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d.%m.%Y %H:%M:%S',
'chart_short_date_format' => '%d.%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d/%m/%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Serveur non trouvé.',
'error_server_label_bad_length' => 'Le nom doit avoir entre 1 et 255 caractères.',
'error_server_ip_bad_length' => 'Domaine/IP doit avoir entre 1 et 255 caractères.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -87,7 +87,6 @@ $sm_lang = array(
'pushover_description' => 'Pushover is een dienst die het gemakkelijk maakt om real-time notificaties te ontvangen. Zie <a href="https://pushover.net/">hun website</a> voor meer informatie.',
'pushover_key' => 'Pushover Key',
'pushover_device' => 'Pushover Device',
'pushover_device_description' => 'Device name to send the message to. Leave empty to send it to all devices.',
'pushover_device_description' => 'Apparaat waar de berichten naar toe gaan. Laat leeg voor alle apparaten.',
'delete_title' => 'Verwijder gebruiker',
'delete_message' => 'Weet je zeker dat je deze gebruiker wilt verwijderen: \'%1\'?',
@ -162,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d-%m-%Y %H:%M:%S',
'chart_short_date_format' => '%d-%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notificaties zijn uitgeschakeld.',
'warning_notifications_disabled_email' => 'Email notificaties zijn uitgeschakeld.',
'warning_notifications_disabled_pushover' => 'Pushover notificaties zijn uitgeschakeld.',
'error_server_no_match' => 'Server niet gevonden.',
'error_server_label_bad_length' => 'Het label moet tussen de 1 en 255 karakters lang zijn.',
'error_server_ip_bad_length' => 'Het domein / IP moet tussen de 1 en 255 karakters lang zijn.',
@ -199,7 +201,6 @@ $sm_lang = array(
'pushover_status' => 'Sta Pushover berichten toe?',
'pushover_description' => 'Pushover is een dienst die het gemakkelijk maakt om real-time notificaties te ontvangen. Zie <a href="https://pushover.net/">hun website</a> voor meer informatie.',
'pushover_api_token' => 'Pushover App API Token',
'pushover_api_token_description' => 'Before you can use Pushover, you need to register an App at their website and enter the App API Token here.',
'pushover_api_token_description' => 'Voordat je Pushover kunt gebruiken moet je een App registreren via hun website, en daarvan de App API Token hier invullen.',
'alert_type' => 'Selecteer wanneer je een notificatie wilt.<br/>',
'alert_type_description' => '<b>Status change:</b> '.

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d/%m/%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%d-%m-%Y %H:%M:%S',
'chart_short_date_format' => '%d/%m %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Сервер не найден.',
'error_server_label_bad_length' => 'Лейбл должен содержать от 1 до 255 знака.',
'error_server_ip_bad_length' => 'Домен/IP должен содержать от 1 до 255 знаков',

View File

@ -161,6 +161,9 @@ $sm_lang = array(
'chart_long_date_format' => '%Y-%m-%d %H:%M:%S',
'chart_short_date_format' => '%m/%d %H:%M',
'chart_short_time_format' => '%H:%M',
'warning_notifications_disabled_sms' => 'SMS notifications are disabled.',
'warning_notifications_disabled_email' => 'Email notifications are disabled.',
'warning_notifications_disabled_pushover' => 'Pushover notifications are disabled.',
'error_server_no_match' => 'Server not found.',
'error_server_label_bad_length' => 'The label must be between 1 and 255 characters.',
'error_server_ip_bad_length' => 'The domain / IP must be between 1 and 255 characters.',

View File

@ -220,10 +220,20 @@ class ServerController extends AbstractServerController {
));
}
$this->tpl->addTemplateData(
$this->getTemplateId(),
$tpl_data
);
$notifications = array('email', 'sms', 'pushover');
$this->tpl->newTemplate('server_update_warning', 'server/server.tpl.html');
foreach($notifications as $notification) {
if(psm_get_conf($notification . '_status') == 0) {
$tpl_data['control_class_' . $notification] = 'warning';
$tpl_data['warning_' . $notification] = $this->tpl->addTemplateData(
$this->tpl->getTemplate('server_update_warning'),
array('label_warning' => psm_get_lang('servers', 'warning_notifications_disabled_' . $notification)),
true
);
}
}
$this->tpl->addTemplateData($this->getTemplateId(), $tpl_data);
}
/**
@ -234,8 +244,6 @@ class ServerController extends AbstractServerController {
// dont process anything if no data has been posted
return $this->executeIndex();
}
$clean = array(
'label' => trim(strip_tags(psm_POST('label', ''))),
'ip' => trim(strip_tags(psm_POST('ip', ''))),

View File

@ -131,8 +131,8 @@
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="email">{label_send_email}</label>
<div class="control-group {control_class_email}">
<label class="control-label" for="email">{label_send_email} {warning_email}</label>
<div class="controls">
<select id="email" name="email">
<option value="yes" {edit_email_selected_yes}>{label_yes}</option>
@ -140,8 +140,8 @@
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sms">{label_send_sms}</label>
<div class="control-group {control_class_sms}">
<label class="control-label" for="sms">{label_send_sms} {warning_sms}</label>
<div class="controls">
<select id="sms" name="sms">
<option value="yes" {edit_sms_selected_yes}>{label_yes}</option>
@ -149,8 +149,8 @@
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="pushover">{label_pushover}</label>
<div class="control-group {control_class_pushover}">
<label class="control-label" for="pushover">{label_pushover} {warning_pushover}</label>
<div class="controls">
<select id="pushover" name="pushover">
<option value="yes" {edit_pushover_selected_yes}>{label_yes}</option>
@ -182,3 +182,7 @@
</fieldset>
</form>
<!--%%tpl_server_update-->
<!--%tpl_server_update_warning-->
<p class="help-inline"><i class="icon-warning-sign" data-toggle="tooltip" title="{label_warning}"></i></p>
<!--%%tpl_server_update_warning-->

View File

@ -77,6 +77,10 @@ function psm_tooltips() {
'placement': 'right',
'container': 'body'
});
$('i[data-toggle="tooltip"]').tooltip({
'trigger':'hover',
'placement': 'bottom'
});
}
function psm_goTo(url) {