Commit 69c43a7d authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

added update to pending friend count in sideblock when accepting/rejecting...

added update to pending friend count in sideblock when accepting/rejecting friendship request on user/view.php
parent 23acce17
...@@ -445,6 +445,8 @@ function jsstrings() { ...@@ -445,6 +445,8 @@ function jsstrings() {
'showtags', 'showtags',
'unreadmessages', 'unreadmessages',
'unreadmessage', 'unreadmessage',
'pendingfriend',
'pendingfriends',
'couldnotgethelp', 'couldnotgethelp',
), ),
), ),
...@@ -480,10 +482,6 @@ function jsstrings() { ...@@ -480,10 +482,6 @@ function jsstrings() {
'requestfriendship', 'requestfriendship',
'cancel', 'cancel',
), ),
'mahara' => array(
'pendingfriend',
'pendingfriends',
),
), ),
'views' => array( 'views' => array(
'view' => array( 'view' => array(
......
...@@ -59,10 +59,24 @@ $inlinejs = <<<EOF ...@@ -59,10 +59,24 @@ $inlinejs = <<<EOF
} }
} }
} }
swapDOM(formname, P(null, data.message)); swapDOM(formname, P(null, data.message));
return true; return true;
} }
function friendship_accept_reject(formname, data) {
var oldcount = parseInt($('pendingfriendscount').innerHTML);
var newcount = oldcount - 1;
var messagenode = $('pendingfriendsmessage');
if (newcount == 1) { // jump through hoops to change between plural and singular
messagenode.innerHTML = get_string('pendingfriend');
}
else {
messagenode.innerHTML = get_string('pendingfriends');
}
$('pendingfriendscount').innerHTML = newcount;
usercontrol_success(formname, data);
}
EOF; EOF;
// Get the user's details // Get the user's details
...@@ -244,6 +258,7 @@ EOF; ...@@ -244,6 +258,7 @@ EOF;
$friendformmessage = get_string('friendshipalreadyrequested', 'mahara', $name); $friendformmessage = get_string('friendshipalreadyrequested', 'mahara', $name);
} }
else { else {
$friendform['jssuccesscallback'] = 'friendship_accept_reject';
$friendform['elements']['requested'] = array( $friendform['elements']['requested'] = array(
'type' => 'html', 'type' => 'html',
'value' => get_string('friendshipalreadyrequestedowner', 'mahara', $name) 'value' => get_string('friendshipalreadyrequestedowner', 'mahara', $name)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment