Commit c1482b03 authored by Nigel McNie's avatar Nigel McNie
Browse files
parents 4652e561 33bf6d03
......@@ -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 () {
......
......@@ -107,7 +107,7 @@ $form = pieform(array(
'submit' => array(
'type' => 'submitcancel',
'value' => array(get_string('yes'), get_string('no')),
'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topic,
'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topic . '#post' . $postid
),
'post' => array(
'type' => 'hidden',
......@@ -116,6 +116,10 @@ $form = pieform(array(
'topic' => array(
'type' => 'hidden',
'value' => $post->topic
),
'parent' => array(
'type' => 'hidden',
'value' => $post->parent
)
)
));
......@@ -128,7 +132,7 @@ function deletepost_submit(Pieform $form, $values) {
array('id' => $values['post'])
);
$SESSION->add_ok_msg(get_string('deletepostsuccess', 'interaction.forum'));
redirect('/interaction/forum/topic.php?id=' . $values['topic']);
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $values['parent']);
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($post->group))));
......
......@@ -164,8 +164,7 @@ $editform = pieform(array(
'title' => get_string('Subject', 'interaction.forum'),
'defaultvalue' => isset($post) ? $post->subject : null,
'rules' => array(
'maxlength' => 255,
'required' => isset($post) && !$post->parent ? true : false
'maxlength' => 255
)
),
'body' => array(
......@@ -182,7 +181,7 @@ $editform = pieform(array(
isset($post) ? get_string('edit') : get_string('Post','interaction.forum'),
get_string('cancel')
),
'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $parent->topic
'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $parent->topic . '#post' . (isset($postid) ? $postid : $parentid)
),
'topic' => array(
'type' => 'hidden',
......@@ -219,13 +218,13 @@ function editpost_submit(Pieform $form, $values) {
}
db_commit();
$SESSION->add_ok_msg(get_string('editpostsuccess', 'interaction.forum'));
redirect('/interaction/forum/topic.php?id=' . $values['topic']);
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $postid);
}
function addpost_submit(Pieform $form, $values) {
global $USER, $SESSION;
$parentid = param_integer('parent');
insert_record(
$postid = insert_record(
'interaction_forum_post',
(object)array(
'topic' => $values['topic'],
......@@ -234,10 +233,11 @@ function addpost_submit(Pieform $form, $values) {
'subject' => $values['subject'],
'body' => $values['body'],
'ctime' => db_format_timestamp(time())
)
),
'id', true
);
$SESSION->add_ok_msg(get_string('addpostsuccess', 'interaction.forum'));
redirect('/interaction/forum/topic.php?id=' . $values['topic']);
redirect('/interaction/forum/topic.php?id=' . $values['topic'] . '#post' . $postid);
}
$smarty = smarty(array(), array(), array(), array('sideblocks' => array(interaction_sideblock($parent->group))));
......
......@@ -15,7 +15,7 @@
{/if}
<td>
<a href="{$WWWROOT}interaction/forum/topic.php?id={$topic->id|escape}">{$topic->subject|escape}</a>
<div>{$topic->body}</div>
<div>{$topic->body|escape}</div>
</td>
<td>
<a href="{$WWWROOT}user/view.php?id={$topic->poster}"
......
......@@ -293,7 +293,6 @@ function setup_topics(&$topics) {
if ($more) {
$topic->body .= '...';
}
$topic->body = htmlspecialchars($topic->body);
$topic->lastposttime = relative_date(get_string('strftimerecentrelative', 'interaction.forum'), get_string('strftimerecent'), $topic->lastposttime);
}
}
......
......@@ -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;
}
......
......@@ -363,12 +363,15 @@ EOF;
// ---------- sideblock stuff ----------
if (get_config('installed')) {
$smarty->assign('SITEMENU', site_menu());
$SIDEBLOCKS[] = array(
'name' => 'mainmenu',
'weight' => 10,
'data' => site_menu(),
);
$data = site_menu();
if (!empty($data)) {
$smarty->assign('SITEMENU', site_menu());
$SIDEBLOCKS[] = array(
'name' => 'mainmenu',
'weight' => 10,
'data' => $data,
);
}
}
if ($USER->is_logged_in() && defined('MENUITEM') && substr(MENUITEM, 0, 11) == 'myportfolio') {
......@@ -1791,8 +1794,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');
......
......@@ -168,7 +168,7 @@ END;
set_config_plugin('search', 'solr', 'solrurl', $values['solrurl']);
}
private static function remove_key_prefix($results) {
private static function remove_key_prefix(&$results) {
if (is_array($results['data'])) {
$toarray = array(
'institutions' => 1,
......@@ -208,7 +208,7 @@ END;
}
$results = self::send_query($query_string, $limit, $offset,
array('type' => 'user', 'index_active' => 1));
self::remove_key_prefix(&$results);
self::remove_key_prefix($results);
return $results;
}
......@@ -259,7 +259,7 @@ END;
$sort = $solrfields[$sortby] . ' ' . $sortdir;
$results = self::send_query($q, $limit, $offset, array('type' => 'user'), '*', false, $sort);
self::remove_key_prefix(&$results);
self::remove_key_prefix($results);
return $results;
}
......
......@@ -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>{str tag="mainmenu"}{contextualhelp plugintype='core' pluginname='mainmenu' section='mainmenu'}</h3>
<h3>{str tag="mainmenu"}</h3>
{if $data}
<ul id="sitemenu">
......
<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}
......@@ -17,7 +16,7 @@
{/if}
{if $data.views}
<li>
<a href="{$WWWROOT}view/">{str tag="myviews"}:</a>
<a href="{$WWWROOT}view/">{str tag="views"}:</a>
<ul>
{foreach from=$data.views item=view}
<li><a href="{$WWWROOT}view/view.php?id={$view->id}">{$view->title|escape}</a></li>
......@@ -25,4 +24,24 @@
</ul>
</li>
{/if}
</ul>
\ No newline at end of file
{if $data.artefacts}
<li>
<a href="{$WWWROOT}artefact/file/">{str tag="artefacts"}:</a>
<ul>
{foreach from=$data.artefacts item=artefact}
{if $artefact->artefacttype == 'blog'}
<li><a href="{$WWWROOT}artefact/blog/view/?id={$artefact->id}">{$artefact->title|escape}</a></li>
{elseif $artefact->artefacttype == 'file' || $artefact->artefacttype == 'image'}
<li><a href="{$WWWROOT}artefact/file/download.php?file={$artefact->id}">{$artefact->title|escape}</a></li>
{elseif $artefact->artefacttype == 'folder'}
<li><a href="{$WWWROOT}artefact/file/?folder={$artefact->id}">{$artefact->title|escape}</a></li>
{/if}
{/foreach}
</ul>
</li>
{/if}
</ul>
<div class="center">
<a href="{$WWWROOT}?logout">{str tag="logout"}</a>
| <a href="{$WWWROOT}account/">{str tag="settings"}</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