[UPDATE] Allow global notification settings

Fixes #1232 and allows further expansion in the future.
Addresses #1672 too.
This commit is contained in:
Sebastian Grewe 2014-02-06 11:13:22 +01:00
parent 7673c34d80
commit 7cf3fb27fb
4 changed files with 22 additions and 11 deletions

View File

@ -148,7 +148,7 @@ if (empty($aAllBlocks)) {
$log->logError('Failed to create Bonus transaction in database for user ' . $user->getUserName($iAccountId) . ' for block ' . $aBlock['height'] . ': ' . $transaction->getCronError());
}
if ($setting->getValue('disable_notifications') != 1) {
if ($setting->getValue('disable_notifications') != 1 && $setting->getValue('notifications_disable_block') != 1) {
// Notify users
$aAccounts = $notification->getNotificationAccountIdByType('new_block');
if (is_array($aAccounts)) {

View File

@ -271,13 +271,6 @@ $aSettings['system'][] = array(
'name' => 'disable_auto_payouts', 'value' => $setting->getValue('disable_auto_payouts'),
'tooltip' => 'Enable or Disable the payout cronjob. Users will not be able to withdraw any funds automatically if disabled. Will NOT be logged in monitoring page.'
);
$aSettings['system'][] = array(
'display' => 'Disable notifications', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'disable_notifications', 'value' => $setting->getValue('disable_notifications'),
'tooltip' => 'Enable or Disable system notifications. This includes new found blocks, monitoring and all other notifications.'
);
$aSettings['system'][] = array(
'display' => 'Disable API', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
@ -397,4 +390,17 @@ $aSettings['monitoring'][] = array(
'name' => 'monitoring_uptimerobot_api_keys', 'value' => $setting->getValue('monitoring_uptimerobot_api_keys'),
'tooltip' => 'Create per-monitor API keys and save them here to propagate your uptime statistics.'
);
$aSettings['notifications'][] = array(
'display' => 'Disable notifications', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes' ),
'default' => 0,
'name' => 'disable_notifications', 'value' => $setting->getValue('disable_notifications'),
'tooltip' => 'Enable or Disable system notifications. This includes new found blocks, monitoring and all other notifications.'
);
$aSettings['notifications'][] = array(
'display' => 'Disable Block Notifications', 'type' => 'select',
'options' => array( 0 => 'No', 1 => 'Yes'),
'default' => 0,
'name' => 'notifications_disable_block', 'value' => $setting->getValue('notifications_disable_block'),
'tooltip' => 'Enable/Disable block notifications globally. Will remove the user option too.'
);

View File

@ -22,13 +22,16 @@ if ($user->isAuthenticated()) {
$aNotifications = $notification->getNofifications($_SESSION['USERDATA']['id']);
if (!$aNotifications) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any notifications', 'TYPE' => 'errormsg');
// Fetch global settings
$smarty->assign('DISABLE_BLOCKNOTIFICATIONS', $setting->getValue('notifications_disable_block'));
// Fetch user notification settings
$aSettings = $notification->getNotificationSettings($_SESSION['USERDATA']['id']);
$smarty->assign('NOTIFICATIONS', $aNotifications);
$smarty->assign('SETTINGS', $aSettings);
$smarty->assign('CONTENT', 'default.tpl');
}
}
?>
?>

View File

@ -25,6 +25,7 @@
</span>
</td>
</tr>
{if $DISABLE_BLOCKNOTIFICATIONS|default:"" != 1}
<tr>
<td align="left">New Blocks</td>
<td>
@ -37,6 +38,7 @@
</span>
</td>
</tr>
{/if}
<tr>
<td align="left">Auto Payout</td>
<td>