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 | |
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')
-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 | ||||
-rw-r--r-- | views/default/forms/friends/collectionfields.php | 15 | ||||
-rw-r--r-- | views/default/forms/friends/collections/edit.php | 53 | ||||
-rw-r--r-- | views/default/forms/friends/edit.php | 53 |
6 files changed, 98 insertions, 99 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; }); 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 |