aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-26 20:57:09 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-26 20:57:09 +0000
commita2250e1854f23351b2a39e304e2bd5977f3fd867 (patch)
treec7a846a455073b88ef2db21115baf21fee57b138
parent657295df1ff884ed9f00b001389978b142ac6ba7 (diff)
downloadelgg-a2250e1854f23351b2a39e304e2bd5977f3fd867.tar.gz
elgg-a2250e1854f23351b2a39e304e2bd5977f3fd867.tar.bz2
Fixes #2982 friends collections work even if the code is convoluted and poorly written.
git-svn-id: http://code.elgg.org/elgg/trunk@8495 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--_graphics/friendspicker.pngbin0 -> 4853 bytes
-rw-r--r--actions/friends/collections/edit.php6
-rw-r--r--languages/en.php4
-rw-r--r--pages/friends/collections/add.php8
-rw-r--r--pages/friends/collections/pickercallback.php16
-rw-r--r--views/default/core/friends/collections.php2
-rw-r--r--views/default/css/elements/forms.php15
-rw-r--r--views/default/css/elements/misc.php5
-rw-r--r--views/default/forms/friends/collections/add.php (renamed from views/default/forms/friends/collections/edit.php)2
-rw-r--r--views/default/input/friendspicker.php13
10 files changed, 35 insertions, 36 deletions
diff --git a/_graphics/friendspicker.png b/_graphics/friendspicker.png
new file mode 100644
index 000000000..78b540397
--- /dev/null
+++ b/_graphics/friendspicker.png
Binary files differ
diff --git a/actions/friends/collections/edit.php b/actions/friends/collections/edit.php
index 8fd1eae18..b7fb716f2 100644
--- a/actions/friends/collections/edit.php
+++ b/actions/friends/collections/edit.php
@@ -1,6 +1,6 @@
<?php
/**
- * Elgg collection add page
+ * Friends collection edit action
*
* @package Elgg.Core
* @subpackage Friends.Collections
@@ -10,4 +10,6 @@ $collection_id = get_input('collection_id');
$friends = get_input('friend');
//chech the collection exists and the current user owners it
-update_access_collection($collection_id, $friends); \ No newline at end of file
+update_access_collection($collection_id, $friends);
+
+exit;
diff --git a/languages/en.php b/languages/en.php
index 26599414b..d5575f572 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -327,11 +327,11 @@ $english = array(
'friends:collections' => "Friend collections",
'collections:add' => "New collection",
'friends:collections:add' => "New friends collection",
- 'friends:addfriends' => "Add friends",
+ 'friends:addfriends' => "Select friends",
'friends:collectionname' => "Collection name",
'friends:collectionfriends' => "Friends in collection",
'friends:collectionedit' => "Edit this collection",
- 'friends:nocollections' => "You do not yet have any collections.",
+ 'friends:nocollections' => "You do not have any collections yet.",
'friends:collectiondeleted' => "Your collection has been deleted.",
'friends:collectiondeletefailed' => "We were unable to delete the collection. Either you don't have permission, or some other problem has occurred.",
'friends:collectionadded' => "Your collection was successfully created",
diff --git a/pages/friends/collections/add.php b/pages/friends/collections/add.php
index 51425db37..0bc3f1fcb 100644
--- a/pages/friends/collections/add.php
+++ b/pages/friends/collections/add.php
@@ -13,12 +13,8 @@ $title = elgg_echo('friends:collections:add');
$content = elgg_view_title($title);
-$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,
+$content .= elgg_view_form('friends/collections/add', array(), array(
+ 'friends' => get_user_friends(elgg_get_logged_in_user_guid(), "", 9999),
));
$body = elgg_view_layout('one_sidebar', array('content' => $content));
diff --git a/pages/friends/collections/pickercallback.php b/pages/friends/collections/pickercallback.php
index 8da44d8c0..228037590 100644
--- a/pages/friends/collections/pickercallback.php
+++ b/pages/friends/collections/pickercallback.php
@@ -43,27 +43,15 @@ switch($type) {
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' => $form_body,
+ 'collection_id' => $collection,
'formtarget' => $site_url . 'action/friends/collections/edit',
));
- *
- */
break;
}
diff --git a/views/default/core/friends/collections.php b/views/default/core/friends/collections.php
index 5c1c824e7..d88d591ad 100644
--- a/views/default/core/friends/collections.php
+++ b/views/default/core/friends/collections.php
@@ -32,7 +32,7 @@ if (is_array($vars['collections']) && sizeof($vars['collections'])) {
<script>
$(document).ready(function(){
$('#friends_collections_accordian h2').click(function () {
- $(this.parentNode).children("[class=friends-picker]").slideToggle("fast");
+ $(this.parentNode).children("[class=friends-picker-main-wrapper]").slideToggle("fast");
//return false;
});
});
diff --git a/views/default/css/elements/forms.php b/views/default/css/elements/forms.php
index c237c79a5..7c2d273f2 100644
--- a/views/default/css/elements/forms.php
+++ b/views/default/css/elements/forms.php
@@ -104,6 +104,9 @@ input[type="radio"] {
padding:0;
width: 730px;
height: auto;
+ background-color: #dedede;
+ -moz-border-radius: 8px;
+ -webkit-border-radius: 8px;
}
.friendspicker-savebuttons {
background: white;
@@ -176,8 +179,8 @@ input[type="radio"] {
}
.friends-picker-navigation-l a, .friends-picker-navigation-r a {
display: block;
- height: 43px;
- width: 43px;
+ height: 40px;
+ width: 40px;
}
.friends-picker-navigation-l {
right: 48px;
@@ -188,16 +191,16 @@ input[type="radio"] {
z-index:1;
}
.friends-picker-navigation-l {
- background: url("<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png") no-repeat left top;
+ background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat left top;
}
.friends-picker-navigation-r {
- background: url("<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png") no-repeat -60px top;
+ background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat -60px top;
}
.friends-picker-navigation-l:hover {
- background: url("<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png") no-repeat left -44px;
+ background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat left -44px;
}
.friends-picker-navigation-r:hover {
- background: url("<?php echo elgg_get_site_url(); ?>_graphics/elgg_sprites.png") no-repeat -60px -44px;
+ background: url("<?php echo elgg_get_site_url(); ?>_graphics/friendspicker.png") no-repeat -60px -44px;
}
.friendspicker-savebuttons .elgg-button-submit,
.friendspicker-savebuttons .elgg-button-cancel {
diff --git a/views/default/css/elements/misc.php b/views/default/css/elements/misc.php
index abcbb894a..d159761a1 100644
--- a/views/default/css/elements/misc.php
+++ b/views/default/css/elements/misc.php
@@ -50,11 +50,14 @@
margin: 10px 0;
padding: 4px 2px 4px 6px;
}
+#friends_collections_accordian li h2:hover {
+ background-color: #333333;
+}
#friends_collections_accordian .friends_collections_controls {
float: right;
font-size: 70%;
}
-#friends_collections_accordian .friends-picker {
+#friends_collections_accordian .friends-picker-main-wrapper {
background: none repeat scroll 0 0 white;
display: none;
padding: 0;
diff --git a/views/default/forms/friends/collections/edit.php b/views/default/forms/friends/collections/add.php
index 975307085..644c7adb9 100644
--- a/views/default/forms/friends/collections/edit.php
+++ b/views/default/forms/friends/collections/add.php
@@ -17,7 +17,7 @@ if (isset($vars['collection'])) {
$highlight = 'all';
}
-echo "<div><label>" . elgg_echo("friends:collectionname") . "<br/>";
+echo "<div class=\"mtm\"><label>" . elgg_echo("friends:collectionname") . "<br/>";
echo elgg_view("input/text", array(
"name" => "collection_name",
"value" => $title,
diff --git a/views/default/input/friendspicker.php b/views/default/input/friendspicker.php
index b95640b0b..82ef3e3d7 100644
--- a/views/default/input/friendspicker.php
+++ b/views/default/input/friendspicker.php
@@ -3,6 +3,8 @@
* Elgg friends picker
* Lists the friends picker
*
+ * @warning Below is the ugliest code in Elgg. It needs to be rewritten or removed
+ *
* @package Elgg
* @subpackage Core
*
@@ -99,7 +101,7 @@ foreach ($users as $letter => $letter_users) {
if (!$callback) {
?>
- <div class="friends-picker">
+ <div class="friends-picker-main-wrapper">
<?php
@@ -118,7 +120,7 @@ if (!isset($vars['replacement'])) {
?>
<?php //@todo JS 1.8: no ?>
<script language="text/javascript">
- $(function() { // onload...do
+ $(function() { // onload...do
$('#collectionMembersForm<?php echo $friendspicker; ?>').submit(function() {
var inputs = [];
$(':input', this).each(function() {
@@ -145,6 +147,11 @@ if (!isset($vars['replacement'])) {
<form id="collectionMembersForm<?php echo $friendspicker; ?>" action="<?php echo $formtarget; ?>" method="post"> <!-- action="" method=""> -->
<?php
+ echo elgg_view('input/securitytoken');
+ echo elgg_view('input/hidden', array(
+ 'name' => 'collection_id',
+ 'value' => $vars['collection_id'],
+ ));
}
?>
@@ -305,7 +312,7 @@ if (!isset($vars['replacement'])) {
// initialise picker
$("div#friends-picker<?php echo $friendspicker; ?>").friendsPicker(<?php echo $friendspicker; ?>);
</script>
-<script>
+<script type="text/javascript">
$(document).ready(function () {
// manually add class to corresponding tab for panels that have content
<?php