From 402134632f0d60e9644d0121c2a84db4a4c1a169 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 13 May 2010 01:11:33 +0000 Subject: merged in notifications plugin cleanup from 1.7 branch: [5962], [5978] - [5980], [6000] git-svn-id: http://code.elgg.org/elgg/trunk@6020 36083f99-b078-4883-b0ff-0f9b5a30f544 --- .../notifications/subscriptions/collections.php | 161 +++++++++++---------- .../default/notifications/subscriptions/form.php | 45 +++--- .../notifications/subscriptions/groupsform.php | 145 ++++++++++--------- .../notifications/subscriptions/jsfuncs.php | 10 +- .../notifications/subscriptions/personal.php | 84 +++++------ 5 files changed, 234 insertions(+), 211 deletions(-) (limited to 'mod/notifications/views/default') diff --git a/mod/notifications/views/default/notifications/subscriptions/collections.php b/mod/notifications/views/default/notifications/subscriptions/collections.php index 87906bf76..d89dddb7b 100644 --- a/mod/notifications/views/default/notifications/subscriptions/collections.php +++ b/mod/notifications/views/default/notifications/subscriptions/collections.php @@ -5,10 +5,10 @@ for ( var i in members ) { var checked = $('#' + method + 'collections' + id).children("INPUT[type='checkbox']").attr('checked'); if ($("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked') != checked) { - $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked); - functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");'; - eval(functioncall); - } + $("#"+method+members[i]).children("INPUT[type='checkbox']").attr('checked', checked); + functioncall = 'adjust' + method + '_alt("'+method+members[i]+'");'; + eval(functioncall); + } } } @@ -21,121 +21,130 @@

- - + + $foo) { - if ($i > 0) + if ($i > 0) { echo ""; + } ?> - - + + guid,'',9999,0)) { - foreach($friends as $friend) - $members[] = $friend->guid; + $members = array(); + if ($friends = get_user_friends($vars['user']->guid, '', 9999, 0)) { + foreach($friends as $friend) { + $members[] = $friend->guid; } - $memberno = sizeof($members); - $members = implode(',',$members); + } + $memberno = sizeof($members); + $members = implode(',',$members); ?> - - + + $foo) { - $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { - if (!empty($collections_preferences) && !is_array($collections_preferences)) - $collections_preferences = array($collections_preferences); - if (is_array($collections_preferences)) + $fields = ''; + $i = 0; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $metaname = 'collections_notifications_preferences_' . $method; + if ($collections_preferences = $vars['user']->$metaname) { + if (!empty($collections_preferences) && !is_array($collections_preferences)) { + $collections_preferences = array($collections_preferences); + } + if (is_array($collections_preferences)) { if (in_array(-1,$collections_preferences)) { $collectionschecked[$method] = 'checked="checked"'; } else { $collectionschecked[$method] = ''; } } - if ($i > 0) $fields .= ""; - $fields .= <<< END - -END; - $i++; } - echo $fields; + if ($i > 0) { + $fields .= ""; + } + $fields .= <<< END + +END; + $i++; + } + echo $fields; ?> - - + + guid)) { - foreach($collections as $collection) { - $members = get_members_of_access_collection($collection->id, true); - $memberno = sizeof($members); - $members = implode(',',$members); + foreach($collections as $collection) { + $members = get_members_of_access_collection($collection->id, true); + $memberno = sizeof($members); + $members = implode(',', $members); ?> - - - + + + $foo) { - $metaname = 'collections_notifications_preferences_' . $method; - if ($collections_preferences = $vars['user']->$metaname) { - if (!empty($collections_preferences) && !is_array($collections_preferences)) - $collections_preferences = array($collections_preferences); - if (is_array($collections_preferences)) - if (in_array($collection->id,$collections_preferences)) { - $collectionschecked[$method] = 'checked="checked"'; - } else { - $collectionschecked[$method] = ''; + $fields = ''; + $i = 0; + foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $metaname = 'collections_notifications_preferences_' . $method; + if ($collections_preferences = $vars['user']->$metaname) { + if (!empty($collections_preferences) && !is_array($collections_preferences)) { + $collections_preferences = array($collections_preferences); + } + if (is_array($collections_preferences)) { + if (in_array($collection->id,$collections_preferences)) { + $collectionschecked[$method] = 'checked="checked"'; + } else { + $collectionschecked[$method] = ''; + } + } } - } - if ($i > 0) $fields .= ""; - $fields .= <<< END - + if ($i > 0) { + $fields .= ""; + } + $fields .= <<< END + END; - $i++; - } - echo $fields; + $i++; + } + echo $fields; ?> - - - + + + diff --git a/mod/notifications/views/default/notifications/subscriptions/form.php b/mod/notifications/views/default/notifications/subscriptions/form.php index 8ad0110bf..d4f243e20 100644 --- a/mod/notifications/views/default/notifications/subscriptions/form.php +++ b/mod/notifications/views/default/notifications/subscriptions/form.php @@ -1,33 +1,34 @@
elgg_view('notifications/subscriptions/personal') . - elgg_view('notifications/subscriptions/collections') . - elgg_view('notifications/subscriptions/forminternals'), - 'method' => 'post', - 'action' => $vars['url'] . 'action/notificationsettings/save', - )); + +echo elgg_view('input/form',array( + '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/groupsform.php b/mod/notifications/views/default/notifications/subscriptions/groupsform.php index fa002b9da..edb9c587c 100644 --- a/mod/notifications/views/default/notifications/subscriptions/groupsform.php +++ b/mod/notifications/views/default/notifications/subscriptions/groupsform.php @@ -1,95 +1,106 @@ $foo) { - $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'group', 'limit' => 99999)); - $tmparray = array(); - if ($subsbig[$method]) { - foreach($subsbig[$method] as $tmpent) { - $tmparray[] = $tmpent->guid; - } +global $NOTIFICATION_HANDLERS; +foreach($NOTIFICATION_HANDLERS as $method => $foo) { + $subsbig[$method] = elgg_get_entities_from_relationship(array('relationship' => 'notify' . $method, 'relationship_guid' => $vars['user']->guid, 'types' => 'group', 'limit' => 99999)); + $tmparray = array(); + if ($subsbig[$method]) { + foreach($subsbig[$method] as $tmpent) { + $tmparray[] = $tmpent->guid; } - $subsbig[$method] = $tmparray; } + $subsbig[$method] = $tmparray; +} + +echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings:groups')); +?> -echo elgg_view_title(elgg_echo('notifications:subscriptions:changesettings:groups')); ?>
+ + + +

- -

- -

+ echo elgg_echo('notifications:subscriptions:groups:description'); + + ?> +

-
 
     
 
-

- () -

-
+

+ () +

+
  - -   + +  
 
-

- name; ?> () -

- -
+

+ name; ?> () +

+
  - -   + +  
 
- - +
 
+ + $foo) { - if ($i > 0) + if ($i > 0) { echo ""; + } ?> - + - - - $foo) { - if (in_array($group->guid,$subsbig[$method])) { - $checked[$method] = 'checked="checked"'; - } else { - $checked[$method] = ''; - } - if ($i > 0) $fields .= ""; - $fields .= <<< END - + + + $foo) { + if (in_array($group->guid,$subsbig[$method])) { + $checked[$method] = 'checked="checked"'; + } else { + $checked[$method] = ''; + } + if ($i > 0) { + $fields .= ""; + } + $fields .= <<< END + END; - $i++; - } - + $i++; + } + ?> - - + + - - + + -
     
  - -  
  + +
-

- name; ?> -

-
+

+ name; ?> +

+
 
 
+ - - - \ No newline at end of file + + diff --git a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php index da1598dae..d94edf9ef 100644 --- a/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php +++ b/mod/notifications/views/default/notifications/subscriptions/jsfuncs.php @@ -1,6 +1,6 @@ @@ -8,14 +8,14 @@ $(document).ready(function () { $foo) { +foreach($NOTIFICATION_HANDLERS as $method => $foo) { ?> $('input[type=checkbox]:checked').parent("a.toggleOff").each(function(){ $(this).removeClass('toggleOff').addClass('toggleOn'); }); }); @@ -23,7 +23,7 @@ $(document).ready(function () { clickflag = 0; $foo) { +foreach($NOTIFICATION_HANDLERS as $method => $foo) { ?> function adjust(linkId) { var obj = $(this).prev("a"); @@ -48,7 +48,7 @@ function adjust_alt(linkId) { return false; } \ No newline at end of file diff --git a/mod/notifications/views/default/notifications/subscriptions/personal.php b/mod/notifications/views/default/notifications/subscriptions/personal.php index d8ce0e97e..e70207aa3 100644 --- a/mod/notifications/views/default/notifications/subscriptions/personal.php +++ b/mod/notifications/views/default/notifications/subscriptions/personal.php @@ -1,6 +1,6 @@
@@ -10,54 +10,56 @@
- - + + $foo) { - if ($i > 0) - echo ""; +$i = 0; +foreach($NOTIFICATION_HANDLERS as $method => $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++; +$fields = ''; +$i = 0; +foreach($NOTIFICATION_HANDLERS as $method => $foo) { + if ($notification_settings = get_user_notification_settings($vars['user']->guid)) { + if ($notification_settings->$method) { + $personalchecked[$method] = 'checked="checked"'; + } else { + $personalchecked[$method] = ''; } - echo $fields; + } + if ($i > 0) { + $fields .= ""; + } + $fields .= <<< END + +END; + $i++; +} +echo $fields; ?> - - - + + +
 
      
-

- -

- -
 
+

+ +

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