aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/friends/collections/add.php (renamed from actions/friends/addcollection.php)0
-rw-r--r--actions/friends/collections/delete.php (renamed from actions/friends/deletecollection.php)0
-rw-r--r--actions/friends/collections/edit.php (renamed from actions/friends/editcollection.php)0
-rw-r--r--engine/lib/users.php14
-rw-r--r--pages/friends/collections/add.php (renamed from pages/friends/add.php)9
-rw-r--r--pages/friends/collections/pickercallback.php (renamed from pages/friends/pickercallback.php)32
-rw-r--r--pages/friends/collections/view.php (renamed from pages/friends/collections.php)0
-rw-r--r--pages/friends/edit.php30
-rw-r--r--views/default/core/friends/collection.php32
-rw-r--r--views/default/core/friends/collections.php13
-rw-r--r--views/default/core/friends/collectiontabs.php31
-rw-r--r--views/default/forms/friends/collectionfields.php15
-rw-r--r--views/default/forms/friends/collections/edit.php53
-rw-r--r--views/default/forms/friends/edit.php53
14 files changed, 136 insertions, 146 deletions
diff --git a/actions/friends/addcollection.php b/actions/friends/collections/add.php
index eac8bced8..eac8bced8 100644
--- a/actions/friends/addcollection.php
+++ b/actions/friends/collections/add.php
diff --git a/actions/friends/deletecollection.php b/actions/friends/collections/delete.php
index f0ceaf023..f0ceaf023 100644
--- a/actions/friends/deletecollection.php
+++ b/actions/friends/collections/delete.php
diff --git a/actions/friends/editcollection.php b/actions/friends/collections/edit.php
index 8fd1eae18..8fd1eae18 100644
--- a/actions/friends/editcollection.php
+++ b/actions/friends/collections/edit.php
diff --git a/engine/lib/users.php b/engine/lib/users.php
index fd68ef276..1b9a6128b 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -1145,18 +1145,20 @@ function friends_of_page_handler($page_elements) {
*/
function collections_page_handler($page_elements) {
elgg_set_context('friends');
+ $base = elgg_get_config('path');
if (isset($page_elements[0])) {
if ($page_elements[0] == "add") {
set_page_owner(elgg_get_logged_in_user_guid());
collections_submenu_items();
- require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/add.php");
+ require_once "{$base}pages/friends/collections/add.php";
} else {
- if ($user = get_user_by_username($page_elements[0])) {
+ $user = get_user_by_username($page_elements[0]);
+ if ($user) {
set_page_owner($user->getGUID());
if (elgg_get_logged_in_user_guid() == elgg_get_page_owner_guid()) {
collections_submenu_items();
}
- require_once(dirname(dirname(dirname(__FILE__))) . "/pages/friends/collections.php");
+ require_once "{$base}pages/friends/collections/view.php";
}
}
}
@@ -1566,9 +1568,9 @@ function users_init() {
elgg_register_action('avatar/crop');
elgg_register_action('profile/edit');
- elgg_register_action('friends/addcollection');
- elgg_register_action('friends/deletecollection');
- elgg_register_action('friends/editcollection');
+ elgg_register_action('friends/collections/add');
+ elgg_register_action('friends/collections/delete');
+ elgg_register_action('friends/collections/edit');
elgg_register_plugin_hook_handler('entity:icon:url', 'user', 'user_avatar_hook');
diff --git a/pages/friends/add.php b/pages/friends/collections/add.php
index 96da26ae1..51425db37 100644
--- a/pages/friends/add.php
+++ b/pages/friends/collections/add.php
@@ -13,10 +13,13 @@ $title = elgg_echo('friends:collections:add');
$content = elgg_view_title($title);
-$content .= elgg_view_form('friends/edit', array(), array(
+$form_body = elgg_view('forms/friends/collections/edit', array(
'friends' => get_user_friends(elgg_get_logged_in_user_guid(), "", 9999)
- )
-);
+));
+$content .= elgg_view('input/form', array(
+ 'action' => 'action/friends/collections/add',
+ 'body' => $form_body,
+));
$body = elgg_view_layout('one_sidebar', array('content' => $content));
diff --git a/pages/friends/pickercallback.php b/pages/friends/collections/pickercallback.php
index f613f1ae1..8da44d8c0 100644
--- a/pages/friends/pickercallback.php
+++ b/pages/friends/collections/pickercallback.php
@@ -7,7 +7,7 @@
*/
// Load Elgg engine
-require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php");
$site_url = elgg_get_site_url();
@@ -32,22 +32,38 @@ if (!$pageowner) {
// Depending on the view type, launch a different view
switch($type) {
case 'list':
- $js_segment = elgg_view('core/friends/tablelistcountupdate',
- array('friendspicker' => $friendspicker, 'count' => sizeof($members)));
- $content = elgg_view('core/friends/tablelist',
- array('entities' => $members, 'content' => $js_segment));
+ $js_segment = elgg_view('core/friends/tablelistcountupdate', array(
+ 'friendspicker' => $friendspicker,
+ 'count' => sizeof($members),
+ ));
+ $content = elgg_view('core/friends/tablelist', array(
+ 'entities' => $members,
+ 'content' => $js_segment,
+ ));
break;
default:
$friends = $pageowner->getFriends('', 9999);
+ $params = array(
+ 'collection' => get_access_collection($collection),
+ 'friends' => $friends,
+ 'friendspicker' => $friendspicker,
+ );
+ $content = elgg_view_form('friends/collections/edit', array(), $params);
+ /*
+ $form_body = elgg_view('input/hidden', array(
+ 'name' => 'collection_id',
+ 'value' => get_access_collection($collection)->id,
+ ));
$content = elgg_view('input/friendspicker', array(
'entities' => $friends,
'value' => $members,
'callback' => true,
'friendspicker' => $friendspicker,
- 'formcontents' => elgg_view('forms/friends/collectionfields',
- array('collection' => get_access_collection($collection))),
- 'formtarget' => $site_url . 'action/friends/editcollection',
+ 'formcontents' => $form_body,
+ 'formtarget' => $site_url . 'action/friends/collections/edit',
));
+ *
+ */
break;
}
diff --git a/pages/friends/collections.php b/pages/friends/collections/view.php
index fa7527f4d..fa7527f4d 100644
--- a/pages/friends/collections.php
+++ b/pages/friends/collections/view.php
diff --git a/pages/friends/edit.php b/pages/friends/edit.php
deleted file mode 100644
index 665929319..000000000
--- a/pages/friends/edit.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Elgg add a collection of friends
- *
- * @package Elgg
- * @subpackage Core
- */
-
-// You need to be logged in for this one
-gatekeeper();
-
-$title = elgg_echo('friends:collectionedit');
-
-$content = elgg_view_title($title);
-
-//grab the collection id passed to the edit form
-$collection_id = get_input('collection');
-
-//get the full collection
-$collection = get_access_collection($collection_id);
-
-//get all members of the collection
-$collection_members = get_members_of_access_collection($collection_id);
-
-$content .= elgg_view_form('friends/edit', array(), array('collection' => $collection,
- 'collection_members' => $collection_members));
-
-$body = elgg_view_layout('one_sidebar', array('content' => $content));
-
-echo elgg_view_page($title, $body); \ No newline at end of file
diff --git a/views/default/core/friends/collection.php b/views/default/core/friends/collection.php
index 89c44a2b3..95f5944e7 100644
--- a/views/default/core/friends/collection.php
+++ b/views/default/core/friends/collection.php
@@ -1,13 +1,10 @@
<?php
/**
- * Elgg friends collection
- * Lists one of a user's friends collections
+ * View a friends collection
*
* @package Elgg
* @subpackage Core
*
- * @see collections.php
- *
* @uses $vars['collection'] The individual friends collection
*/
@@ -25,8 +22,10 @@ echo "<li><h2>";
if ($coll->owner_guid == elgg_get_logged_in_user_guid()) {
echo "<div class=\"friends_collections_controls\">";
echo elgg_view('output/confirmlink', array(
- 'href' => 'action/friends/deletecollection?collection=' . $coll->id,
- 'class' => 'delete_collection'
+ 'href' => 'action/friends/collections/delete?collection=' . $coll->id,
+ 'class' => 'delete_collection',
+ 'text' => elgg_view_icon('delete'),
+ 'text_encode' => false,
));
echo "</div>";
}
@@ -34,16 +33,27 @@ echo $coll->name;
echo " (<span id=\"friends_membership_count{$vars['friendspicker']}\">{$count}</span>) </h2>";
// individual collection panels
-if ($friends = $vars['collection']->entities) {
- $content = elgg_view('core/friends/collectiontabs', array('owner' => elgg_get_logged_in_user_entity(), 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker']));
+$friends = $vars['collection']->entities;
+if ($friends) {
+ $content = elgg_view('core/friends/collectiontabs', array(
+ 'owner' => elgg_get_logged_in_user_entity(),
+ 'collection' => $vars['collection'],
+ 'friendspicker' => $vars['friendspicker'],
+ ));
- echo elgg_view('input/friendspicker', array('entities' => $friends, 'value' => $members, 'content' => $content, 'replacement' => '', 'friendspicker' => $vars['friendspicker']));
- ?>
+ echo elgg_view('input/friendspicker', array(
+ 'entities' => $friends,
+ 'value' => $members,
+ 'content' => $content,
+ 'replacement' => '',
+ 'friendspicker' => $vars['friendspicker'],
+ ));
+?>
<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
$(document).ready(function () {
- $('#friends-picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>');
+ $('#friends-picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>');
});
</script>
diff --git a/views/default/core/friends/collections.php b/views/default/core/friends/collections.php
index 5a052b121..5c1c824e7 100644
--- a/views/default/core/friends/collections.php
+++ b/views/default/core/friends/collections.php
@@ -9,17 +9,16 @@
* @uses $vars['collections'] The array of friends collections
*/
-if (!isset($friendspicker)) {
- $friendspicker = 0;
-}
-
-
if (is_array($vars['collections']) && sizeof($vars['collections'])) {
echo "<ul id=\"friends_collections_accordian\">";
- foreach($vars['collections'] as $collection) {
+ $friendspicker = 0;
+ foreach ($vars['collections'] as $collection) {
$friendspicker++;
- echo elgg_view('core/friends/collection', array('collection' => $collection, 'friendspicker' => $friendspicker));
+ echo elgg_view('core/friends/collection', array(
+ 'collection' => $collection,
+ 'friendspicker' => $friendspicker,
+ ));
}
echo "</ul>";
diff --git a/views/default/core/friends/collectiontabs.php b/views/default/core/friends/collectiontabs.php
index 168d2cdfb..2fafe6a8c 100644
--- a/views/default/core/friends/collectiontabs.php
+++ b/views/default/core/friends/collectiontabs.php
@@ -16,38 +16,43 @@ $ownerid = $vars['owner']->getGUID();
?>
-<div id="elgg-tabs">
-<ul>
-<li class="selected"><a href="#" class="collectionmembers<?php echo $friendspicker; ?>"><?php echo elgg_echo('friends:collections:members'); ?></a></li>
-
-<li><a href="#" class="editmembers<?php echo $friendspicker; ?>"><?php echo elgg_echo('friends:collections:edit'); ?></a></li>
-
+<ul class="elgg-tabs">
+ <li class="elgg-state-selected">
+ <a href="#" class="collectionmembers<?php echo $friendspicker; ?>">
+ <?php echo elgg_echo('friends:collections:members'); ?>
+ </a>
+ </li>
+ <li>
+ <a href="#" class="editmembers<?php echo $friendspicker; ?>">
+ <?php echo elgg_echo('friends:collections:edit'); ?>
+ </a>
+ </li>
</ul>
-</div>
+
<?php //@todo JS 1.8: no ?>
<script type="text/javascript">
$(document).ready(function () {
$('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
// load collection members pane
- $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');
+ $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=list&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');
// remove selected state from previous tab
- $(this).parent().parent().find("li.selected").removeClass("selected");
+ $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
// add selected class to current tab
- $(this).parent().addClass("selected");
+ $(this).parent().addClass("elgg-state-selected");
return false;
});
$('a.editmembers<?php echo $friendspicker; ?>').click(function () {
// load friends picker pane
- $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');
+ $('#friends-picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo elgg_get_site_url(); ?>pages/friends/collections/pickercallback.php?username=<?php echo elgg_get_logged_in_user_entity()->username; ?>&type=picker&collection=<?php echo $collectionid; ?>&friendspicker=<?php echo $friendspicker; ?>');
// remove selected state from previous tab
- $(this).parent().parent().find("li.selected").removeClass("selected");
+ $(this).parent().parent().find("li.elgg-state-selected").removeClass("elgg-state-selected");
// add selected class to current tab
- $(this).parent().addClass("selected");
+ $(this).parent().addClass("elgg-state-selected");
return false;
});
diff --git a/views/default/forms/friends/collectionfields.php b/views/default/forms/friends/collectionfields.php
deleted file mode 100644
index 35db3a962..000000000
--- a/views/default/forms/friends/collectionfields.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Elgg friend collections required hidden fields for js friends picker form
- *
- * @package Elgg
- * @subpackage Core
- */
-
-if (isset($vars['collection'])) {
-?>
-
- <input type="hidden" name="collection_id" value="<?php echo $vars['collection']->id; ?>" />
-
-<?php
-} \ No newline at end of file
diff --git a/views/default/forms/friends/collections/edit.php b/views/default/forms/friends/collections/edit.php
new file mode 100644
index 000000000..975307085
--- /dev/null
+++ b/views/default/forms/friends/collections/edit.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Form body for editing or adding a friend collection
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['collection'] Optionally, the collection to edit
+ */
+
+// Set title, form destination
+if (isset($vars['collection'])) {
+ $title = $vars['collection']->name;
+ $highlight = 'default';
+} else {
+ $title = "";
+ $highlight = 'all';
+}
+
+echo "<div><label>" . elgg_echo("friends:collectionname") . "<br/>";
+echo elgg_view("input/text", array(
+ "name" => "collection_name",
+ "value" => $title,
+ ));
+echo "</label></div>";
+
+echo "<div>";
+if ($vars['collection_members']) {
+ echo elgg_echo("friends:collectionfriends") . "<br />";
+ foreach ($vars['collection_members'] as $mem) {
+ echo elgg_view_entity_icon($mem, 'tiny');
+ echo $mem->name;
+ }
+}
+echo "</div>";
+
+echo "<div><label>" . elgg_echo("friends:addfriends") . "</label>";
+echo elgg_view('input/friendspicker', array(
+ 'entities' => $vars['friends'],
+ 'name' => 'friends_collection',
+ 'highlight' => $highlight,
+));
+echo "</div>";
+
+echo "<div>";
+if (isset($vars['collection'])) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'collection_id',
+ 'value' => $vars['collection']->id,
+ ));
+}
+echo elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save')));
+echo "</div>";
diff --git a/views/default/forms/friends/edit.php b/views/default/forms/friends/edit.php
deleted file mode 100644
index 902113c9c..000000000
--- a/views/default/forms/friends/edit.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Elgg friend collections add/edit
- *
- * @package Elgg
- * @subpackage Core
- *
- * @uses $vars['object'] Optionally, the collection edit
- */
-
-// var_export($vars['collection'][0]->id);
-
-// Set title, form destination
-if (isset($vars['collection'])) {
- $action = "friends/editcollection";
- $title = $vars['collection'][0]->name;
- $highlight = 'default';
-} else {
- $action = "friends/addcollection";
- $title = "";
- $highlight = 'all';
-}
-
-
-$form_body = "<div class='contentWrapper'><div><label>" . elgg_echo("friends:collectionname") . "<br />" .
- elgg_view("input/text", array(
- "name" => "collection_name",
- "value" => $title,
- )) . "</label></div>";
-
-$form_body .= "<div>";
-
-if($vars['collection_members']){
- $form_body .= elgg_echo("friends:collectionfriends") . "<br />";
- foreach($vars['collection_members'] as $mem){
- $form_body .= elgg_view_entity_icon($mem, 'tiny');
- $form_body .= $mem->name;
- }
-}
-
-$form_body .= "</div>";
-
-$form_body .= "<div><label>" . elgg_echo("friends:addfriends") . "</label>".
- elgg_view('input/friendspicker',array('entities' => $vars['friends'], 'name' => 'friends_collection', 'highlight' => $highlight)) . "</div>";
-
-$form_body .= "<div>";
-if (isset($vars['collection'])) {
- $form_body .= elgg_view('input/hidden', array('name' => 'collection_id', 'value' => "{$vars['collection'][0]->id}"));
-}
-$form_body .= elgg_view('input/submit', array('name' => 'submit', 'value' => elgg_echo('save')));
-$form_body .= "</div></div>";
-
-echo $form_body; \ No newline at end of file