From fcc68792fd00a2778746f6813efd0a5d879584d6 Mon Sep 17 00:00:00 2001 From: cash Date: Thu, 16 Dec 2010 02:12:03 +0000 Subject: moved friends widget into core git-svn-id: http://code.elgg.org/elgg/trunk@7640 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/users.php | 2 + languages/en.php | 6 +++ mod/friends/languages/en.php | 15 ------ mod/friends/manifest.xml | 11 ----- mod/friends/start.php | 14 ------ .../views/default/widgets/friends/content.php | 36 -------------- mod/friends/views/default/widgets/friends/edit.php | 57 ---------------------- views/default/widgets/friends/content.php | 36 ++++++++++++++ views/default/widgets/friends/edit.php | 57 ++++++++++++++++++++++ 9 files changed, 101 insertions(+), 133 deletions(-) delete mode 100644 mod/friends/languages/en.php delete mode 100644 mod/friends/manifest.xml delete mode 100644 mod/friends/start.php delete mode 100644 mod/friends/views/default/widgets/friends/content.php delete mode 100644 mod/friends/views/default/widgets/friends/edit.php create mode 100644 views/default/widgets/friends/content.php create mode 100644 views/default/widgets/friends/edit.php diff --git a/engine/lib/users.php b/engine/lib/users.php index 61ea58b29..076f7b9f7 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -1542,6 +1542,8 @@ function users_init() { elgg_register_action("user/passwordreset", '', 'public'); elgg_register_action("user/requestnewpassword", '', 'public'); + elgg_register_widget_type('friends', elgg_echo("friends"), elgg_echo('friends:widget:description')); + // User name change extend_elgg_settings_page('user/settings/name', 'usersettings/user', 1); //elgg_register_action("user/name"); diff --git a/languages/en.php b/languages/en.php index b89124c6c..34c141a5b 100644 --- a/languages/en.php +++ b/languages/en.php @@ -646,6 +646,12 @@ $english = array( 'members:title:searchname' => 'Member search for %s', 'members:title:searchtag' => 'Members tagged with %s', + 'friends:widget:description' => "Displays some of your friends.", + 'friends:num_display' => "Number of friends to display", + 'friends:icon_size' => "Icon size", + 'friends:tiny' => "tiny", + 'friends:small' => "small", + /** * Generic action words */ diff --git a/mod/friends/languages/en.php b/mod/friends/languages/en.php deleted file mode 100644 index 1d09cfca6..000000000 --- a/mod/friends/languages/en.php +++ /dev/null @@ -1,15 +0,0 @@ - "Displays some of your friends.", - 'friends:num_display' => "Number of friends to display", - 'friends:icon_size' => "Icon size", - 'friends:tiny' => "tiny", - 'friends:small' => "small", -); - -add_translation("en", $english); diff --git a/mod/friends/manifest.xml b/mod/friends/manifest.xml deleted file mode 100644 index 8cdd8c6bd..000000000 --- a/mod/friends/manifest.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/mod/friends/start.php b/mod/friends/start.php deleted file mode 100644 index 54675ee2f..000000000 --- a/mod/friends/start.php +++ /dev/null @@ -1,14 +0,0 @@ -owner_guid); - -// the number of friends to display -$num = (int) $vars['entity']->num_display; - -// get the correct size -$size = $vars['entity']->icon_size; - -// Get the user's friends -$friends = $owner->getFriends("", $num); - -// If there are any friends to view, view them -if (is_array($friends) && sizeof($friends) > 0) { - - echo "
"; - - foreach($friends as $friend) { - echo "
"; - echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size)); - echo "
"; - } - - echo "
"; -} diff --git a/mod/friends/views/default/widgets/friends/edit.php b/mod/friends/views/default/widgets/friends/edit.php deleted file mode 100644 index 9a6499ede..000000000 --- a/mod/friends/views/default/widgets/friends/edit.php +++ /dev/null @@ -1,57 +0,0 @@ -num_display)) { - $vars['entity']->num_display = 12; - $vars['entity']->icon_size = 'small'; -} - -// handle upgrade to 1.7.2 from previous versions -if ($vars['entity']->icon_size == 1) { - $vars['entity']->icon_size = 'small'; -} elseif ($vars['entity']->icon_size == 2) { - $vars['entity']->icon_size = 'tiny'; -} -?> - -

- : - -

- -

- - -

diff --git a/views/default/widgets/friends/content.php b/views/default/widgets/friends/content.php new file mode 100644 index 000000000..2f9ab71ea --- /dev/null +++ b/views/default/widgets/friends/content.php @@ -0,0 +1,36 @@ +owner_guid); + +// the number of friends to display +$num = (int) $vars['entity']->num_display; + +// get the correct size +$size = $vars['entity']->icon_size; + +// Get the user's friends +$friends = $owner->getFriends("", $num); + +// If there are any friends to view, view them +if (is_array($friends) && sizeof($friends) > 0) { + + echo "
"; + + foreach($friends as $friend) { + echo "
"; + echo elgg_view("profile/icon",array('entity' => get_user($friend->guid), 'size' => $size)); + echo "
"; + } + + echo "
"; +} diff --git a/views/default/widgets/friends/edit.php b/views/default/widgets/friends/edit.php new file mode 100644 index 000000000..9a6499ede --- /dev/null +++ b/views/default/widgets/friends/edit.php @@ -0,0 +1,57 @@ +num_display)) { + $vars['entity']->num_display = 12; + $vars['entity']->icon_size = 'small'; +} + +// handle upgrade to 1.7.2 from previous versions +if ($vars['entity']->icon_size == 1) { + $vars['entity']->icon_size = 'small'; +} elseif ($vars['entity']->icon_size == 2) { + $vars['entity']->icon_size = 'tiny'; +} +?> + +

+ : + +

+ +

+ + +

-- cgit v1.2.3