From a6eb3bf8d0f49e9b20fa8153ddca7b9d551f950d Mon Sep 17 00:00:00 2001
From: cash
Date: Wed, 15 Dec 2010 12:56:01 +0000
Subject: moving friends views into core
git-svn-id: http://code.elgg.org/elgg/trunk@7633 36083f99-b078-4883-b0ff-0f9b5a30f544
---
engine/lib/access.php | 4 +-
engine/lib/users.php | 12 +-
mod/groups/views/default/forms/groups/invite.php | 2 +-
pages/friends/pickercallback.php | 6 +-
views/default/core/friends/collection.php | 54 ++++
views/default/core/friends/collections.php | 40 +++
views/default/core/friends/collectiontabs.php | 57 ++++
views/default/core/friends/picker.php | 329 +++++++++++++++++++++
views/default/core/friends/tablelist.php | 50 ++++
.../default/core/friends/tablelistcountupdate.php | 17 ++
views/default/forms/friends/edit.php | 2 +-
views/default/friends/collection.php | 54 ----
views/default/friends/collections.php | 40 ---
views/default/friends/collectiontabs.php | 57 ----
views/default/friends/picker.php | 329 ---------------------
views/default/friends/tablelist.php | 50 ----
views/default/friends/tablelistcountupdate.php | 17 --
17 files changed, 555 insertions(+), 565 deletions(-)
create mode 100644 views/default/core/friends/collection.php
create mode 100644 views/default/core/friends/collections.php
create mode 100644 views/default/core/friends/collectiontabs.php
create mode 100644 views/default/core/friends/picker.php
create mode 100644 views/default/core/friends/tablelist.php
create mode 100644 views/default/core/friends/tablelistcountupdate.php
delete mode 100644 views/default/friends/collection.php
delete mode 100644 views/default/friends/collections.php
delete mode 100644 views/default/friends/collectiontabs.php
delete mode 100644 views/default/friends/picker.php
delete mode 100644 views/default/friends/tablelist.php
delete mode 100644 views/default/friends/tablelistcountupdate.php
diff --git a/engine/lib/access.php b/engine/lib/access.php
index b87d150c0..ef9794802 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -725,7 +725,7 @@ function get_members_of_access_collection($collection, $idonly = FALSE) {
}
/**
- * Displays a user's access collections, using the friends/collections view
+ * Displays a user's access collections, using the core/friends/collections view
*
* @param int $owner_guid The GUID of the owning user
*
@@ -740,7 +740,7 @@ function elgg_view_access_collections($owner_guid) {
}
}
- return elgg_view('friends/collections', array('collections' => $collections));
+ return elgg_view('core/friends/collections', array('collections' => $collections));
}
/**
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 033a4bdb6..61ea58b29 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1515,19 +1515,8 @@ function users_pagesetup() {
* @return void
*/
function users_init() {
- // Load config
global $CONFIG;
- // add Friends to tools menu - if profile mod is running
- // now added to toolbar
- /*
- if ( isloggedin() && is_plugin_enabled('profile') ) {
- $user = get_loggedin_user();
- add_menu(elgg_echo('friends'), $CONFIG->wwwroot .
- "pg/friends/" . $user->username, array(), 'core:friends');
- }
- */
-
register_page_handler('friends', 'friends_page_handler');
register_page_handler('friendsof', 'friends_of_page_handler');
register_page_handler('dashboard', 'dashboard_page_handler');
@@ -1535,6 +1524,7 @@ function users_init() {
register_page_handler('resetpassword', 'elgg_user_resetpassword_page_handler');
register_page_handler('login', 'elgg_user_login_page_handler');
register_page_handler('members', 'elgg_members_page_handler');
+ //register_page_handler('collections', 'collections_page_handler');
add_menu(elgg_echo('members'), 'pg/members/');
diff --git a/mod/groups/views/default/forms/groups/invite.php b/mod/groups/views/default/forms/groups/invite.php
index 279e11a20..8b8ccb665 100644
--- a/mod/groups/views/default/forms/groups/invite.php
+++ b/mod/groups/views/default/forms/groups/invite.php
@@ -17,7 +17,7 @@ if ($friends) {
$friends, 'internalname' => 'user_guid', 'highlight' => 'all'));
+ echo elgg_view('core/friends/picker',array('entities' => $friends, 'internalname' => 'user_guid', 'highlight' => 'all'));
?>
diff --git a/pages/friends/pickercallback.php b/pages/friends/pickercallback.php
index 16cef1110..1ca29ede9 100644
--- a/pages/friends/pickercallback.php
+++ b/pages/friends/pickercallback.php
@@ -32,14 +32,14 @@ if (!$pageowner) {
// Depending on the view type, launch a different view
switch($type) {
case 'list':
- $js_segment = elgg_view('friends/tablelistcountupdate',
+ $js_segment = elgg_view('core/friends/tablelistcountupdate',
array('friendspicker' => $friendspicker, 'count' => sizeof($members)));
- $content = elgg_view('friends/tablelist',
+ $content = elgg_view('core/friends/tablelist',
array('entities' => $members, 'content' => $js_segment));
break;
default:
$friends = $pageowner->getFriends('', 9999);
- $content = elgg_view('friends/picker', array(
+ $content = elgg_view('core/friends/picker', array(
'entities' => $friends,
'value' => $members,
'callback' => true,
diff --git a/views/default/core/friends/collection.php b/views/default/core/friends/collection.php
new file mode 100644
index 000000000..9463d5b42
--- /dev/null
+++ b/views/default/core/friends/collection.php
@@ -0,0 +1,54 @@
+members)) {
+ $count = sizeof($vars['collection']->members);
+} else {
+ $count = 0;
+}
+
+echo "";
+
+//as collections are private, check that the logged in user is the owner
+if ($coll->owner_guid == get_loggedin_userid()) {
+ echo "
";
+ echo elgg_view('output/confirmlink', array(
+ 'href' => 'action/friends/deletecollection?collection=' . $coll->id,
+ 'class' => 'delete_collection'
+ ));
+ echo "
";
+}
+echo $coll->name;
+echo " ({$count}) ";
+
+// individual collection panels
+if ($friends = $vars['collection']->entities) {
+ $content = elgg_view('core/friends/collectiontabs', array('owner' => get_loggedin_user(), 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker']));
+
+ echo elgg_view('core/friends/picker', array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => '', 'friendspicker' => $vars['friendspicker']));
+ ?>
+
+
+ ";
diff --git a/views/default/core/friends/collections.php b/views/default/core/friends/collections.php
new file mode 100644
index 000000000..6554059b1
--- /dev/null
+++ b/views/default/core/friends/collections.php
@@ -0,0 +1,40 @@
+";
+
+ foreach($vars['collections'] as $collection) {
+ $friendspicker++;
+ echo elgg_view('core/friends/collection', array('collection' => $collection, 'friendspicker' => $friendspicker));
+ }
+
+ echo "";
+
+} else {
+ echo elgg_echo("friends:nocollections");
+}
+
+?>
+
+
diff --git a/views/default/core/friends/collectiontabs.php b/views/default/core/friends/collectiontabs.php
new file mode 100644
index 000000000..6aef4bf1e
--- /dev/null
+++ b/views/default/core/friends/collectiontabs.php
@@ -0,0 +1,57 @@
+id;
+$ownerid = $vars['owner']->getGUID();
+
+?>
+
+
+
+
diff --git a/views/default/core/friends/picker.php b/views/default/core/friends/picker.php
new file mode 100644
index 000000000..3bbe4ffe2
--- /dev/null
+++ b/views/default/core/friends/picker.php
@@ -0,0 +1,329 @@
+name,0,1));
+ } else {
+ $letter = strtoupper(substr($user->name,0,1));
+ }
+
+ if (!substr_count($chararray,$letter)) {
+ $letter = "*";
+ }
+ if (!isset($users[$letter])) {
+ $users[$letter] = array();
+ }
+ $users[$letter][$user->guid] = $user;
+ }
+}
+
+// sort users in letters alphabetically
+foreach ($users as $letter => $letter_users) {
+ usort($letter_users, create_function('$a, $b', '
+ return strcasecmp($a->name, $b->name);
+ '));
+ $users[$letter] = $letter_users;
+}
+
+if (!$callback) {
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $entity, 'size' => 'tiny')); ?>
+
+ |
+
+ name; ?>
+ |
+
";
+ $column = 0;
+ }
+ }
+ }
+
+if ($column < 3 && $column != 0) echo "
";
+ echo "
";
+}
+
+if (isset($vars['content'])) {
+ echo $vars['content'];
+}
\ No newline at end of file
diff --git a/views/default/core/friends/tablelistcountupdate.php b/views/default/core/friends/tablelistcountupdate.php
new file mode 100644
index 000000000..8e2ab637d
--- /dev/null
+++ b/views/default/core/friends/tablelistcountupdate.php
@@ -0,0 +1,17 @@
+
+
+
\ No newline at end of file
diff --git a/views/default/forms/friends/edit.php b/views/default/forms/friends/edit.php
index 632268fb8..16bb32fd9 100644
--- a/views/default/forms/friends/edit.php
+++ b/views/default/forms/friends/edit.php
@@ -41,7 +41,7 @@ if($vars['collection_members']){
$form_body .= "
";
$form_body .= "".
- elgg_view('friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection', 'highlight' => $highlight)) . "
";
+ elgg_view('core/friends/picker',array('entities' => $vars['friends'], 'internalname' => 'friends_collection', 'highlight' => $highlight)) . "";
$form_body .= "";
if (isset($vars['collection'])) {
diff --git a/views/default/friends/collection.php b/views/default/friends/collection.php
deleted file mode 100644
index 665e6d34d..000000000
--- a/views/default/friends/collection.php
+++ /dev/null
@@ -1,54 +0,0 @@
-members)) {
- $count = sizeof($vars['collection']->members);
-} else {
- $count = 0;
-}
-
-echo "
";
-
-//as collections are private, check that the logged in user is the owner
-if ($coll->owner_guid == get_loggedin_userid()) {
- echo "
";
- echo elgg_view('output/confirmlink', array(
- 'href' => 'action/friends/deletecollection?collection=' . $coll->id,
- 'class' => 'delete_collection'
- ));
- echo "
";
-}
-echo $coll->name;
-echo " ({$count}) ";
-
-// individual collection panels
-if ($friends = $vars['collection']->entities) {
- $content = elgg_view('friends/collectiontabs', array('owner' => get_loggedin_user(), 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker']));
-
- echo elgg_view('friends/picker',array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => '', 'friendspicker' => $vars['friendspicker']));
- ?>
-
-
- ";
diff --git a/views/default/friends/collections.php b/views/default/friends/collections.php
deleted file mode 100644
index d0669bb46..000000000
--- a/views/default/friends/collections.php
+++ /dev/null
@@ -1,40 +0,0 @@
-";
-
- foreach($vars['collections'] as $collection) {
- $friendspicker++;
- echo elgg_view('friends/collection',array('collection' => $collection, 'friendspicker' => $friendspicker));
- }
-
- echo "";
-
-} else {
- echo elgg_echo("friends:nocollections");
-}
-
-?>
-
-
diff --git a/views/default/friends/collectiontabs.php b/views/default/friends/collectiontabs.php
deleted file mode 100644
index 6aef4bf1e..000000000
--- a/views/default/friends/collectiontabs.php
+++ /dev/null
@@ -1,57 +0,0 @@
-id;
-$ownerid = $vars['owner']->getGUID();
-
-?>
-
-
-
-
diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php
deleted file mode 100644
index 3bbe4ffe2..000000000
--- a/views/default/friends/picker.php
+++ /dev/null
@@ -1,329 +0,0 @@
-name,0,1));
- } else {
- $letter = strtoupper(substr($user->name,0,1));
- }
-
- if (!substr_count($chararray,$letter)) {
- $letter = "*";
- }
- if (!isset($users[$letter])) {
- $users[$letter] = array();
- }
- $users[$letter][$user->guid] = $user;
- }
-}
-
-// sort users in letters alphabetically
-foreach ($users as $letter => $letter_users) {
- usort($letter_users, create_function('$a, $b', '
- return strcasecmp($a->name, $b->name);
- '));
- $users[$letter] = $letter_users;
-}
-
-if (!$callback) {
- ?>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- $entity, 'size' => 'tiny')); ?>
-
- |
-
- name; ?>
- |
-
";
- $column = 0;
- }
- }
- }
-
-if ($column < 3 && $column != 0) echo "
";
- echo "
";
-}
-
-if (isset($vars['content'])) {
- echo $vars['content'];
-}
\ No newline at end of file
diff --git a/views/default/friends/tablelistcountupdate.php b/views/default/friends/tablelistcountupdate.php
deleted file mode 100644
index 8e2ab637d..000000000
--- a/views/default/friends/tablelistcountupdate.php
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
\ No newline at end of file
--
cgit v1.2.3