Commit 1e958ed5 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

changed update of unread messages so it works as a class, not an id

unread messages in sideblock works now :D
parent 32af4b64
......@@ -105,16 +105,19 @@ function markread(form) {
if (!data.error) {
if (data.count > 0) {
activitylist.doupdate();
var oldcount = parseInt($('headerunreadmessagecount').innerHTML);
var newcount = (oldcount - data.count);
var messagenode = $('headerunreadmessages');
if (newcount == 1) { // jump through hoops to change between plural and singular
messagenode.innerHTML = get_string('unreadmessage');
}
else {
messagenode.innerHTML = get_string('unreadmessages');
}
$('headerunreadmessagecount').innerHTML = newcount;
forEach(getElementsByTagAndClassName('span', 'unreadmessagescontainer'), function(message) {
var countnode = message.firstChild;
var oldcount = parseInt(countnode.innerHTML);
var newcount = (oldcount - data.count);
var messagenode = message.lastChild;
if (newcount == 1) { // jump through hoops to change between plural and singular
messagenode.innerHTML = get_string('unreadmessage');
}
else {
messagenode.innerHTML = get_string('unreadmessages');
}
countnode.innerHTML = newcount;
});
}
}
}, function () {
......
......@@ -1666,10 +1666,10 @@ function profile_sideblock() {
);
$unreadnotifications = call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'));
if ($unreadnotifications == 1) {
$data['unreadnotifications'] = '1 ' . get_string('unreadmessages');
$data['unreadnotifications'] = '<span class="unreadmessagecount">1</span> <span class="unreadmessages">' . get_string('unreadmessages') . '</span>';
}
else if ($unreadnotifications > 1) {
$data['unreadnotifications'] = $unreadnotifications . ' ' . get_string('unreadmessages');
$data['unreadnotifications'] = '<span class="unreadmessagecount">' . $unreadnotifications . '</span> <span class="unreadmessages">' . get_string('unreadmessages') . '</span>';
}
$invitedgroups = get_invited_groups();
$invitedgroups = $invitedgroups ? count($invitedgroups) : 0;
......@@ -1695,6 +1695,14 @@ function profile_sideblock() {
ORDER BY v.title',
array('profile', $USER->get('id'))
);
$data['artefacts'] = get_records_sql_array(
'SELECT a.id, a.artefacttype, a.title
FROM {artefact} a
INNER JOIN {artefact_tag} at ON (a.id = at.artefact AND tag = ?)
WHERE a.owner = ?
ORDER BY a.title',
array('profile', $USER->get('id'))
);
return $data;
}
......
......@@ -1791,8 +1791,8 @@ function get_loggedin_string() {
// these spans are here so that on the ajax page that marks messages as read, the contents can be updated.
$str .=
' (<a href="' . get_config('wwwroot') . 'account/activity/">' .
'<span id="headerunreadmessagecount">' . $count . '</span> ' .
'<span id="headerunreadmessages">' . get_string($key) . '</span></a>)';
'<span class="unreadmessagescontainer"><span class="unreadmessagecount">' . $count . '</span> ' .
'<span class="unreadmessages">' . get_string($key) . '</span></span></a>)';
}
$saveduser = $USER->get('parentuser');
......
......@@ -319,7 +319,7 @@ tr.required th {
padding: 15px 0 0 0px;
color: #474220;
}
#headerunreadmessagecount {
.unreadmessagecount {
background: url(../images/email-green.gif) no-repeat;
padding: 3px 0 5px 18px;
margin: 0 0 3px 2px;
......
<h3><a style="color:white" href="{$WWWROOT}user/view.php?id={$data.id}">{$data.id|display_name|escape}</a></h3>
<a href="{$WWWROOT}user/view.php?id={$data.id}"><img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=50&amp;id={$data.id}" alt=""></a>
<a href="{$WWWROOT}?logout">{str tag="logout"}</a>
<ul style="color:black">
{if $data.unreadnotifications}<li><a href="{$WWWROOT}account/activity/">{$data.unreadnotifications}</a></li>{/if}
<div class="fr"><a href="{$WWWROOT}user/view.php?id={$data.id}"><img src="{$WWWROOT}thumb.php?type=profileicon&amp;maxsize=50&amp;id={$data.id}" alt=""></a></div>
<ul>
{if $data.unreadnotifications}<li><a href="{$WWWROOT}account/activity/"><span class="unreadmessagescontainer">{$data.unreadnotifications}</span></a></li>{/if}
{if $data.invitedgroups}<li><a href="{$WWWROOT}group/mygroups.php?filter=invited">{$data.invitedgroups}</a></li>{/if}
{if $data.pendingfriends}<li><a href="{$WWWROOT}user/?filter=2">{$data.pendingfriends}</a></li>{/if}
{if $data.groups}
......@@ -25,4 +24,5 @@
</ul>
</li>
{/if}
</ul>
\ No newline at end of file
</ul>
<div class="center"><a href="{$WWWROOT}?logout">{str tag="logout"}</a></div>
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