diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-26 14:23:32 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-26 14:23:32 +0000 |
commit | c1411ffc81908882edaace315c46e500419d2aba (patch) | |
tree | 73ea8aa0a8a10c2a2a85977409f5ff4ae8968115 /views/default/core | |
parent | 1ab250f2a8e90c4aa24ada873f98c81dbdd4ae93 (diff) | |
download | elgg-c1411ffc81908882edaace315c46e500419d2aba.tar.gz elgg-c1411ffc81908882edaace315c46e500419d2aba.tar.bz2 |
Refs #2982 adding and deleting friend collections works - editing does not
git-svn-id: http://code.elgg.org/elgg/trunk@8490 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/core')
-rw-r--r-- | views/default/core/friends/collection.php | 32 | ||||
-rw-r--r-- | views/default/core/friends/collections.php | 13 | ||||
-rw-r--r-- | views/default/core/friends/collectiontabs.php | 31 |
3 files changed, 45 insertions, 31 deletions
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; }); |