aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
Diffstat (limited to 'views')
-rw-r--r--views/default/friends/collection.php6
-rw-r--r--views/default/friends/collectiontabs.php19
-rw-r--r--views/default/friends/forms/collectionfields.php23
-rw-r--r--views/default/friends/forms/edit.php7
-rw-r--r--views/default/friends/picker.php69
5 files changed, 94 insertions, 30 deletions
diff --git a/views/default/friends/collection.php b/views/default/friends/collection.php
index 8d8afd7d1..438d82e8c 100644
--- a/views/default/friends/collection.php
+++ b/views/default/friends/collection.php
@@ -36,16 +36,14 @@
// individual collection panels
if($friends = $vars['collection']->entities){
- $members = $vars['collection']->members;
- $implodedmemberslist = implode(',',$members);
- $content = elgg_view('friends/collectiontabs', array('members' => $members, 'friends' => $friends, 'collection' => $vars['collection'], 'friendspicker' => $vars['friendspicker']));
+ $content = elgg_view('friends/collectiontabs', array('owner' => $_SESSION['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 $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $implodedmemberslist; ?>');
+ $('#friends_picker_placeholder<?php echo $vars['friendspicker']; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $vars['collection']->id; ?>');
});
</script>
diff --git a/views/default/friends/collectiontabs.php b/views/default/friends/collectiontabs.php
index 1e40dd584..cdeb6b798 100644
--- a/views/default/friends/collectiontabs.php
+++ b/views/default/friends/collectiontabs.php
@@ -2,19 +2,8 @@
$friendspicker = $vars['friendspicker'];
- if (isset($vars['members'])) {
- $members = implode(',',$vars['members']);
- } else {
- $members = "";
- }
-
- $friends = "";
- if (isset($vars['friends'])) {
- foreach($vars['friends'] as $friend) {
- if (!empty($friends)) $friends .= ",";
- $friends .= $friend->getGUID();
- }
- }
+ $collectionid = $vars['collection']->id;
+ $ownerid = $vars['owner']->getGUID();
?>
@@ -32,7 +21,7 @@ $(document).ready(function () {
$('a.collectionmembers<?php echo $friendspicker; ?>').click(function () {
// load collection members pane
- $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&members=<?php echo $members; ?>');
+ $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=list&collection=<?php echo $collectionid; ?>');
// remove selected state from previous tab
$(this).parent().parent().find("li.selected").removeClass("selected");
@@ -44,7 +33,7 @@ $(document).ready(function () {
$('a.editmembers<?php echo $friendspicker; ?>').click(function () {
// load friends picker pane
- $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['user']->username; ?>&type=picker&members=<?php echo $members; ?>&friends=<?php echo $friends; ?>&friendspicker=<?php echo $friendspicker; ?>');
+ $('#friends_picker_placeholder<?php echo $friendspicker; ?>').load('<?php echo $vars['url']; ?>friends/pickercallback.php?username=<?php echo $_SESSION['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");
diff --git a/views/default/friends/forms/collectionfields.php b/views/default/friends/forms/collectionfields.php
new file mode 100644
index 000000000..ef3c367e3
--- /dev/null
+++ b/views/default/friends/forms/collectionfields.php
@@ -0,0 +1,23 @@
+<?php
+
+ /**
+ * Elgg friend collections required hidden fields for js friends picker form
+ *
+ * @package Elgg
+ * @subpackage Core
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.org/
+ */
+
+ 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/friends/forms/edit.php b/views/default/friends/forms/edit.php
index 6ed58d5bf..7c8a3f455 100644
--- a/views/default/friends/forms/edit.php
+++ b/views/default/friends/forms/edit.php
@@ -3,11 +3,12 @@
/**
* Elgg friend collections add/edit
*
- * @package ElggFriends
+ * @package Elgg
+ * @subpackage Core
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
- * @author Dave Tosh <dave@elgg.com>
+ * @author Curverider Ltd
* @copyright Curverider Ltd 2008
- * @link http://elgg.com/
+ * @link http://elgg.org/
*
* @uses $vars['object'] Optionally, the collection edit
*/
diff --git a/views/default/friends/picker.php b/views/default/friends/picker.php
index 94211f49b..d813e6fe7 100644
--- a/views/default/friends/picker.php
+++ b/views/default/friends/picker.php
@@ -49,6 +49,14 @@
$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']))
@@ -85,10 +93,40 @@
}
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() {
+ 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="friendsPicker_wrapper">
<div id="friendsPicker<?php echo $friendspicker; ?>">
@@ -171,12 +209,27 @@
}
?>
- </div>
- <!-- Collection members form -->
- <form id="collectionMembersForm"> <!-- action="" method=""> -->
- <input type="submit" class="submit_button" value="Save changes" onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();"/>
- <input type="button" class="cancel_button" value="Cancel" onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();" />
- </form>
+ </div>
+
+<?php
+
+ if ($formtarget) {
+
+ if (isset($vars['formcontents']))
+ echo $vars['formcontents'];
+
+?>
+ <input type="submit" class="submit_button" value="<?php echo elgg_echo('save'); ?>" />
+ <!-- onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();" -->
+ <input type="button" class="cancel_button" value="<?php echo elgg_echo('cancel'); ?>" onclick="$('a.collectionmembers<?php echo $friendspicker; ?>').click();" />
+ </form>
+
+<?php
+
+ }
+
+?>
+
</div>
</div>