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() {
'showtags',
'unreadmessages',
'unreadmessage',
'pendingfriend',
'pendingfriends',
'couldnotgethelp',
),
),
......@@ -480,10 +482,6 @@ function jsstrings() {
'requestfriendship',
'cancel',
),
'mahara' => array(
'pendingfriend',
'pendingfriends',
),
),
'views' => array(
'view' => array(
......
......@@ -59,10 +59,24 @@ $inlinejs = <<<EOF
}
}
}
swapDOM(formname, P(null, data.message));
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;
// Get the user's details
......@@ -244,6 +258,7 @@ EOF;
$friendformmessage = get_string('friendshipalreadyrequested', 'mahara', $name);
}
else {
$friendform['jssuccesscallback'] = 'friendship_accept_reject';
$friendform['elements']['requested'] = array(
'type' => 'html',
'value' => get_string('friendshipalreadyrequestedowner', 'mahara', $name)
......
Markdown is supported
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