aboutsummaryrefslogtreecommitdiff
path: root/views/default/friends/picker.php
diff options
context:
space:
mode:
Diffstat (limited to 'views/default/friends/picker.php')
-rw-r--r--views/default/friends/picker.php69
1 files changed, 61 insertions, 8 deletions
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>