From 5356a17ae82982ebe96e91ea309ab89713cf888d Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 5 Feb 2009 17:47:07 +0000 Subject: Further notification settings changes. git-svn-id: https://code.elgg.org/elgg/trunk@2658 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/notifications/actions/save.php | 4 +- mod/notifications/languages/en.php | 5 +- mod/notifications/start.php | 10 +++- .../views/default/notifications/css.php | 4 ++ .../notifications/settings/usersettings.php | 3 ++ .../notifications/subscriptions/collections.php | 3 ++ .../default/notifications/subscriptions/form.php | 7 ++- .../notifications/subscriptions/forminternals.php | 3 ++ .../notifications/subscriptions/personal.php | 63 ++++++++++++++++++++++ 9 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 mod/notifications/views/default/notifications/settings/usersettings.php create mode 100644 mod/notifications/views/default/notifications/subscriptions/collections.php create mode 100644 mod/notifications/views/default/notifications/subscriptions/personal.php (limited to 'mod') diff --git a/mod/notifications/actions/save.php b/mod/notifications/actions/save.php index 3e50ffc11..44b341e9b 100644 --- a/mod/notifications/actions/save.php +++ b/mod/notifications/actions/save.php @@ -18,6 +18,9 @@ global $NOTIFICATION_HANDLERS; foreach($NOTIFICATION_HANDLERS as $method => $foo) { $subscriptions[$method] = get_input($method.'subscriptions'); + $personal[$method] = get_input($method.'personal'); + + set_user_notification_setting($_SESSION['user']->guid, $method, ($personal[$method] == '1') ? true : false); remove_entity_relationships($SESSION['user']->guid,'notify' , $method, false); } @@ -25,7 +28,6 @@ foreach($subscriptions as $key => $subscription) if (is_array($subscription) && !empty($subscription)) { foreach($subscription as $subscriptionperson) { - // register_notification_interest($SESSION['user']->guid, $subscription); add_entity_relationship($_SESSION['user']->guid, 'notify' . $key, $subscriptionperson); } } diff --git a/mod/notifications/languages/en.php b/mod/notifications/languages/en.php index db2d143b7..71db65744 100644 --- a/mod/notifications/languages/en.php +++ b/mod/notifications/languages/en.php @@ -2,12 +2,15 @@ $english = array( + 'notifications:subscriptions:personal:description' => 'Receive notifications when actions are performed on your content', + 'notifications:subscriptions:personal:title' => 'Personal notifications', + 'notifications:subscriptions:changesettings' => 'Notifications', 'notification:method:email' => 'Email', 'notifications:subscriptions:description' => 'To receive notifications from your friends when they create new content, find them below and select the notification method you would like to use.', - 'notifications:subscriptions:success' => 'Your subscriptions have been saved.', + 'notifications:subscriptions:success' => 'Your subscription settings have been saved.', ); diff --git a/mod/notifications/start.php b/mod/notifications/start.php index 22d4a0be0..1691872a6 100644 --- a/mod/notifications/start.php +++ b/mod/notifications/start.php @@ -23,10 +23,18 @@ function notifications_plugin_init() { extend_view('css','notifications/css'); + global $CONFIG; + + // Unset the default user settings hook + if (isset($CONFIG->hooks['usersettings:save']['user'])) + foreach($CONFIG->hooks['usersettings:save']['user'] as $key => $function) { + if ($function == 'notification_user_settings_save') + unset($CONFIG->hooks['usersettings:save']['user'][$key]); + } } register_elgg_event_handler('pagesetup','system','notifications_plugin_pagesetup',1000); - register_elgg_event_handler('init','system','notifications_plugin_init'); + register_elgg_event_handler('init','system','notifications_plugin_init',1000); // Register action global $CONFIG; diff --git a/mod/notifications/views/default/notifications/css.php b/mod/notifications/views/default/notifications/css.php index 1c20a7b96..db766a2c9 100644 --- a/mod/notifications/views/default/notifications/css.php +++ b/mod/notifications/views/default/notifications/css.php @@ -38,4 +38,8 @@ } #notificationstable td.emailtogglefield a.emailtoggleOn { background: url(mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px; +} + +.notification_personal { + margin-bottom: 25px; } \ No newline at end of file diff --git a/mod/notifications/views/default/notifications/settings/usersettings.php b/mod/notifications/views/default/notifications/settings/usersettings.php new file mode 100644 index 000000000..0165eb215 --- /dev/null +++ b/mod/notifications/views/default/notifications/settings/usersettings.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php new file mode 100644 index 000000000..0165eb215 --- /dev/null +++ b/mod/notifications/views/default/notifications/subscriptions/collections.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php index 08e539e17..a81f4290b 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -19,13 +19,12 @@ // Display a description ?>
-

- -

elgg_view('notifications/subscriptions/forminternals'), + 'body' => elgg_view('notifications/subscriptions/personal') . + elgg_view('notifications/subscriptions/collections') . + elgg_view('notifications/subscriptions/forminternals'), 'method' => 'post', 'action' => $vars['url'] . 'action/notificationsettings/save', )); diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php index 122a00fb5..e73dc5f3e 100644 --- a/mod/notifications/views/default/notifications/subscriptions/forminternals.php +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -1,3 +1,6 @@ +

+ +

+
+
+

+ +

+
+ + + + $foo) { + if ($i > 0) + echo ""; +?> + + + + + + + + $foo) { + if ($notification_settings = get_user_notification_settings($vars['user']->guid)) { + if ($notification_settings->$method) { + $personalchecked[$method] = 'checked="checked"'; + } else { + $personalchecked[$method] = ''; + } + } + if ($i > 0) $fields .= ""; + $fields .= <<< END + +END; + $i++; + } + echo $fields; + +?> + + + +
   
+

+ +

+ +
  + +  
+
\ No newline at end of file -- cgit v1.2.3