diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-15 12:56:01 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-15 12:56:01 +0000 |
commit | a6eb3bf8d0f49e9b20fa8153ddca7b9d551f950d (patch) | |
tree | a435afa05cab8bf2ea5d7e4b785f018e695f1869 /views/default/friends | |
parent | 2165e929ddf954f02a589234b2e0faef7ef18df7 (diff) | |
download | elgg-a6eb3bf8d0f49e9b20fa8153ddca7b9d551f950d.tar.gz elgg-a6eb3bf8d0f49e9b20fa8153ddca7b9d551f950d.tar.bz2 |
moving friends views into core
git-svn-id: http://code.elgg.org/elgg/trunk@7633 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/friends')
-rw-r--r-- | views/default/friends/collection.php | 54 | ||||
-rw-r--r-- | views/default/friends/collections.php | 40 | ||||
-rw-r--r-- | views/default/friends/collectiontabs.php | 57 | ||||
-rw-r--r-- | views/default/friends/picker.php | 329 | ||||
-rw-r--r-- | views/default/friends/tablelist.php | 50 | ||||
-rw-r--r-- | views/default/friends/tablelistcountupdate.php | 17 |
6 files changed, 0 insertions, 547 deletions
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 @@ -<?php -/** - * Elgg friends collection - * Lists one of a user's friends collections - * - * @package Elgg - * @subpackage Core - * - * @see collections.php - * - * @uses $vars['collection'] The individual friends collection - */ - -$coll = $vars['collection']; - -if (is_array($vars['collection']->members)) { - $count = sizeof($vars['collection']->members); -} else { - $count = 0; -} - -echo "<li><h2>"; - -//as collections are private, check that the logged in user is the owner -if ($coll->owner_guid == get_loggedin_userid()) { - echo "<div class=\"friends_collections_controls\">"; - echo elgg_view('output/confirmlink', array( - 'href' => 'action/friends/deletecollection?collection=' . $coll->id, - 'class' => 'delete_collection' - )); - echo "</div>"; -} -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('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'])); - ?> - - <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 get_loggedin_user()->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>'); - - }); - </script> - <?php -} - -// close friends-picker div and the accordian list item -echo "</li>"; 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 @@ -<?php -/** - * Elgg friends collections - * Lists a user's friends collections - * - * @package Elgg - * @subpackage Core - * - * @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++; - echo elgg_view('friends/collection',array('collection' => $collection, 'friendspicker' => $friendspicker)); - } - - echo "</ul>"; - -} else { - echo elgg_echo("friends:nocollections"); -} - -?> - -<script> -$(document).ready(function(){ - $('#friends_collections_accordian h2').click(function () { - $(this.parentNode).children("[class=friends-picker]").slideToggle("fast"); - //return false; - }); -}); -</script> 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 @@ -<?php -/** - * Elgg friends collections - * Lists a user's friends collections - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['collections'] The array of friends collections - */ - -$friendspicker = $vars['friendspicker']; - -$collectionid = $vars['collection']->id; -$ownerid = $vars['owner']->getGUID(); - -?> - -<div id="elgg-horizontal-tabbed-nav"> -<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> -</div> - -<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 get_loggedin_user()->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"); - // add selected class to current tab - $(this).parent().addClass("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 get_loggedin_user()->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"); - // add selected class to current tab - $(this).parent().addClass("selected"); - - return false; - }); - - -}); -</script> 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 @@ -<?php -/** - * Elgg friends picker - * Lists the friends picker - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['entities'] The array of ElggUser objects - */ - -$base = elgg_get_site_url(); -$viewtype = elgg_get_viewtype(); -elgg_register_js("{$base}vendors/jquery/jquery.easing.1.3.packed.js", 'jquery.easing'); -$url = elgg_view_get_simplecache_url('js', 'friendsPickerv1'); -elgg_register_js($url, 'friendsPicker'); - -$chararray = elgg_echo('friendspicker:chararray'); - -// Initialise internalname -if (!isset($vars['internalname'])) { - $internalname = "friend"; -} else { - $internalname = $vars['internalname']; -} - -// Are we highlighting default or all? -if (empty($vars['highlight'])) { - $vars['highlight'] = 'default'; -} -if ($vars['highlight'] != 'all') { - $vars['highlight'] = 'default'; -} - -// Initialise values -if (!isset($vars['value'])) { - $vars['value'] = array(); -} else { - if (!is_array($vars['value'])) { - $vars['value'] = (int) $vars['value']; - $vars['value'] = array($vars['value']); - } -} - -// Initialise whether we're calling back or not -if (isset($vars['callback'])) { - $callback = $vars['callback']; -} else { - $callback = false; -} - -// We need to count the number of friends pickers on the page. -if (!isset($vars['friendspicker'])) { - global $friendspicker; - if (!isset($friendspicker)) { - $friendspicker = 0; - } - $friendspicker++; -} else { - $friendspicker = $vars['friendspicker']; -} - -$users = array(); -$activeletters = array(); - -// Are we displaying form tags and submit buttons? -// (If we've been given a target, then yes! Otherwise, no.) -if (isset($vars['formtarget'])) { - $formtarget = $vars['formtarget']; -} else { - $formtarget = false; -} - -// Sort users by letter -if (is_array($vars['entities']) && sizeof($vars['entities'])) { - foreach($vars['entities'] as $user) { - if (is_callable('mb_substr')) { - $letter = strtoupper(mb_substr($user->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) { - ?> - - <div class="friends-picker"> - - <?php - - if (isset($vars['content'])) { - echo $vars['content']; - } - ?> - - <div id="friends-picker_placeholder<?php echo $friendspicker; ?>"> - - <?php -} - -if (!isset($vars['replacement'])) { - if ($formtarget) { -?> - -<script language="text/javascript"> - $(function() { // onload...do - $('#collectionMembersForm<?php echo $friendspicker; ?>').submit(function() { - var inputs = []; - $(':input', this).each(function() { - if (this.type != 'checkbox' || (this.type == 'checkbox' && this.checked != false)) { - inputs.push(this.name + '=' + escape(this.value)); - } - }); - jQuery.ajax({ - type: "POST", - data: inputs.join('&'), - url: this.action, - success: function(){ - $('a.collectionmembers<?php echo $friendspicker; ?>').click(); - } - - }); - return false; - }) - }) - - </script> - -<!-- Collection members form --> -<form id="collectionMembersForm<?php echo $friendspicker; ?>" action="<?php echo $formtarget; ?>" method="post"> <!-- action="" method=""> --> - -<?php - } -?> - -<div class="friends-picker-wrapper"> -<div id="friends-picker<?php echo $friendspicker; ?>"> - <div class="friends-picker-container"> -<?php - -// Initialise letters - $chararray .= "*"; - if (is_callable('mb_substr')) { - $letter = mb_substr($chararray,0,1); - } else { - $letter = substr($chararray,0,1); - } - $letpos = 0; - while (1 == 1) { - ?> - <div class="panel" title="<?php echo $letter; ?>"> - <div class="wrapper"> - <h3><?php echo $letter; ?></h3> - <?php - - if (isset($users[$letter])) { - ksort($users[$letter]); - - echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"; - $col = 0; - - foreach($users[$letter] as $friend) { - if ($col == 0) { - echo "<tr>"; - } - - //echo "<p>" . $user->name . "</p>"; - $label = elgg_view("profile/icon",array('entity' => $friend, 'size' => 'tiny', 'override' => true)); - $options[$label] = $friend->getGUID(); - - if ($vars['highlight'] == 'all' - && !in_array($letter,$activeletters)) { - - $activeletters[] = $letter; - } - - - if (in_array($friend->getGUID(),$vars['value'])) { - $checked = "checked = \"checked\""; - if (!in_array($letter,$activeletters) && $vars['highlight'] == 'default') { - $activeletters[] = $letter; - } - } else { - $checked = ""; - } - ?> - - <td> - - <input type="checkbox" <?php echo $checked; ?> name="<?php echo $internalname; ?>[]" value="<?php echo $options[$label]; ?>" /> - - </td> - - <td> - - <div style="width: 25px; margin-bottom: 15px;"> - <?php - echo $label; - ?> - </div> - </td> - <td style="width: 200px; padding: 5px;"> - <?php echo $friend->name; ?> - </td> - <?php - $col++; - if ($col == 3){ - echo "</tr>"; - $col = 0; - } - } - if ($col < 3) { - echo "</tr>"; - } - - echo "</table>"; - } - -?> - - </div> - </div> -<?php - //if ($letter == 'Z') break; - - if (is_callable('mb_substr')) { - $substr = mb_substr($chararray,strlen($chararray) - 1,1); - } else { - $substr = substr($chararray,strlen($chararray) - 1,1); - } - if ($letter == $substr) { - break; - } - //$letter++; - $letpos++; - if (is_callable('mb_substr')) { - $letter = mb_substr($chararray,$letpos,1); - } else { - $letter = substr($chararray,$letpos,1); - } - } - -?> - </div> - -<?php - -if ($formtarget) { - - if (isset($vars['formcontents'])) - echo $vars['formcontents']; - -?> - <div class="clearfix"></div> - <div class="friendspicker-savebuttons"> - <input type="submit" class="submit-button" value="<?php echo elgg_echo('save'); ?>" /> - <input type="button" class="cancel-button" value="<?php echo elgg_echo('cancel'); ?>" onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();" /> - <br /></div> - </form> - -<?php - -} - -?> - -</div> -</div> - -<?php -} else { - echo $vars['replacement']; -} -if (!$callback) { - -?> - -</div> -</div> - - -<?php - -} - -if (!isset($vars['replacement'])) { -?> - -<script type="text/javascript"> - // initialise picker - $("div#friends-picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>); -</script> -<script> -$(document).ready(function () { -// manually add class to corresponding tab for panels that have content -<?php -if (sizeof($activeletters) > 0) - //$chararray = elgg_echo('friendspicker:chararray'); - foreach($activeletters as $letter) { - $tab = strpos($chararray, $letter) + 1; -?> -$("div#friends-picker-navigation<?php echo $friendspicker; ?> li.tab<?php echo $tab; ?> a").addClass("tabHasContent"); -<?php - } - -?> -}); -</script> - -<?php - -}
\ No newline at end of file diff --git a/views/default/friends/tablelist.php b/views/default/friends/tablelist.php deleted file mode 100644 index 12a0763c9..000000000 --- a/views/default/friends/tablelist.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Elgg friends picker - * Lists the friends picker - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['entities'] The array of ElggUser objects - */ - -if (is_array($vars['entities'])) { - -?> - -<table cellspacing="0" id="collectionMembersTable"> - <tr> - <?php - $column = 0; - foreach($vars['entities'] as $entity) { - if (!($entity instanceof ElggEntity)) { - $entity = get_entity($entity); - } - - if ($entity instanceof ElggEntity) { - ?> - <td style="width:25px;"> - <div style="width: 25px; margin-bottom: 15px;"> - <?php echo elgg_view("profile/icon",array('entity' => $entity, 'size' => 'tiny')); ?> - </div> - </td> - <td style="width: 200px; padding: 5px;"> - <?php echo $entity->name; ?> - </td> - <?php - $column++; - if ($column == 3) { - echo "</tr><tr>"; - $column = 0; - } - } - } - -if ($column < 3 && $column != 0) echo "</tr>"; - echo "</table>"; -} - -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 @@ -<?php -/** - * Elgg friends picker count updater - * Updates the friends count on a collection - * - * @package Elgg - * @subpackage Core - * - * @uses $vars['count'] The count - * @uses $vars['friendspicker'] The friendspicker counter number - */ - -?> - -<script language="text/javascript"> - $("#friends_membership_count<?php echo $vars['friendspicker']; ?>").html("<?php echo $vars['count']; ?>"); -</script>
\ No newline at end of file |