diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-31 15:22:48 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-07-31 15:22:48 +0000 |
commit | ab7d70b9d870d69a5b79c3fbb005565302112efc (patch) | |
tree | 3e1b7ed7925885fe4780c249a4008f9bd3f5cea9 /views/default/friends/picker.php | |
parent | 2ba7cd11ba933888f137f875006766122fa6e0b0 (diff) | |
download | elgg-ab7d70b9d870d69a5b79c3fbb005565302112efc.tar.gz elgg-ab7d70b9d870d69a5b79c3fbb005565302112efc.tar.bz2 |
Picker saves correctly!
git-svn-id: https://code.elgg.org/elgg/trunk@1635 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/friends/picker.php')
-rw-r--r-- | views/default/friends/picker.php | 69 |
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> |