From 697a81f7d240e47e261421a462f3e28a92841a1c Mon Sep 17 00:00:00 2001 From: ben Date: Thu, 5 Feb 2009 16:52:50 +0000 Subject: Fitter, happier, more productive notifications plugin. git-svn-id: https://code.elgg.org/elgg/trunk@2657 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../views/default/notifications/css.php | 41 +++ .../default/notifications/subscriptions/form.php | 68 ++--- .../notifications/subscriptions/forminternals.php | 340 +++++++++++++++++++++ 3 files changed, 414 insertions(+), 35 deletions(-) create mode 100644 mod/notifications/views/default/notifications/css.php create mode 100644 mod/notifications/views/default/notifications/subscriptions/forminternals.php (limited to 'mod/notifications/views/default') diff --git a/mod/notifications/views/default/notifications/css.php b/mod/notifications/views/default/notifications/css.php new file mode 100644 index 000000000..1c20a7b96 --- /dev/null +++ b/mod/notifications/views/default/notifications/css.php @@ -0,0 +1,41 @@ +#notificationstable td.namefield { + width:250px; + text-align: left; + vertical-align: middle; +} +#notificationstable td.namefield img { + padding:6px 10px 6px 3px; + float:left; +} +#notificationstable td.namefield p.namefieldlink { + margin:9px 0 0 0; +} +#notificationstable td.emailtogglefield, +#notificationstable td.smstogglefield { + width:50px; + text-align: center; + vertical-align: middle; +} +#notificationstable td.spacercolumn { + width:30px; +} +#notificationstable td { + border-bottom: 1px solid silver; +} +#notificationstable td.emailtogglefield input { + margin-right:36px; + margin-top:5px; +} +#notificationstable td.emailtogglefield a { + width:46px; + height:24px; + cursor: pointer; + display: block; + outline: none; +} +#notificationstable td.emailtogglefield a.emailtoggleOff { + background: url(mod/notifications/graphics/icon_notifications_email.gif) no-repeat right 2px; +} +#notificationstable td.emailtogglefield a.emailtoggleOn { + background: url(mod/notifications/graphics/icon_notifications_email.gif) no-repeat right -36px; +} \ 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 3533a6ac3..08e539e17 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -1,36 +1,34 @@ - -

- -

- 'subscriptions', - 'entities' => get_user_friends($vars['user']->guid,'',9999,0), - 'value' => $people, - 'formtarget' => $vars['url'] . 'action/notificationsettings/save' - )); - -?> \ No newline at end of file + echo elgg_view('subscriptions/form/additions',$vars); + + // Display a description +?> +
+

+ +

+ elgg_view('notifications/subscriptions/forminternals'), + 'method' => 'post', + 'action' => $vars['url'] . 'action/notificationsettings/save', + )); + +?> +
\ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/forminternals.php b/mod/notifications/views/default/notifications/subscriptions/forminternals.php new file mode 100644 index 000000000..122a00fb5 --- /dev/null +++ b/mod/notifications/views/default/notifications/subscriptions/forminternals.php @@ -0,0 +1,340 @@ +guid,'',9999,0); + + global $NOTIFICATION_HANDLERS; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $subsbig[$method] = get_entities_from_relationship('notify' . $method,$vars['user']->guid,false,'user','',0,'',99999); + } + + $subs = array(); + foreach($subsbig as $method => $big) { + if (is_array($subsbig[$method]) && sizeof($subsbig[$method])) { + foreach($subsbig[$method] as $u) { $subs[$method][] = $u->guid; } + } + } + + // Let the system know that the friends picker is in use + global $pickerinuse; + $pickerinuse = true; + + // Initialise internalname + if (!isset($vars['internalname'])) { + $internalname = "friend"; + } else { + $internalname = $vars['internalname']; + } + + // Initialise values + if (!isset($vars['value'])) { + $vars['value'] = array(); + } else { + if (!is_array($vars['value'])) { + $vars['value'] = (int) $vars['value']; + $vars['value'] = array($vars['value']); + } + } + + // Initialise whether we're calling back or not + if (isset($vars['callback'])) { + $callback = $vars['callback']; + } else { + $callback = false; + } + + // We need to count the number of friends pickers on the page. + if (!isset($vars['friendspicker'])) { + global $friendspicker; + if (!isset($friendspicker)) $friendspicker = 0; + $friendspicker++; + } else { + $friendspicker = $vars['friendspicker']; + } + + $users = array(); + $activeletters = array(); + + // Are we displaying form tags and submit buttons? + // (If we've been given a target, then yes! Otherwise, no.) + if (isset($vars['formtarget'])) { + $formtarget = $vars['formtarget']; + } else { + $formtarget = false; + } + + // Sort users by letter + if (is_array($friends) && sizeof($friends)) + foreach($friends as $user) { + + $letter = strtoupper(substr($user->name,0,1)); + if ($letter >= "0" && $letter <= "9") { + $letter = "0"; + } + if (!isset($users[$letter])) { + $users[$letter] = array(); + } + $users[$letter][$user->name] = $user; + + } + + if (!$callback) { + +?> + +
+ + + +
+ + + + + + + + + +
+
+
+ +
+
+

+ + + + + + + $foo) { + if ($i > 0) + echo ""; +?> + + + + + + 0) + foreach($users[$letter] as $friend) { + if ($friend instanceof ElggUser ) { + + if (!in_array($letter,$activeletters)) + $activeletters[] = $letter; + + $method = array(); + $fields = ''; + $i = 0; + + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if (in_array($friend->guid,$subs[$method])) { + $checked[$method] = 'checked="checked"'; + } else { + $checked[$method] = ''; + } + if ($i > 0) $fields .= ""; + $fields .= <<< END + +END; + $i++; + } +?> + + + + + + + + + + + +
   
  + +
+ $friend, 'size' => 'tiny', 'override' => true)); +?> +  
+ + + +
+
+ +
+
+
+ + + +
+
+ + + + + + + + + + + + +
+
+ +
+ + + \ No newline at end of file -- cgit v1.2.3