Commit 27a3550b authored by Penny Leach's avatar Penny Leach
Browse files

tweaks to recent activity

parent 5f5dc05f
......@@ -33,12 +33,13 @@ json_headers();
$markasread = param_integer('markasread', 0);
if ($markasread) {
$count = 0;
db_begin();
try {
foreach ($_GET as $k => $v) {
if (preg_match('/^unread\-(\d+)$/',$k,$m)) {
set_field('notification_internal_activity', 'read', 1, 'id', $m[1]);
$count++;
}
}
}
......@@ -48,7 +49,7 @@ if ($markasread) {
echo json_encode($data);
}
db_commit();
$data = array('success' => 1);
$data = array('success' => 1, 'count' => $count);
echo json_encode($data);
exit;
}
......@@ -80,16 +81,17 @@ $data = array();
$star = theme_get_image_path('star.png');
$unread = get_string('unread', 'activity');
foreach ($records as $r) {
foreach ($records as &$r) {
$r['date'] = format_date(strtotime($r['ctime']));
$r['type'] = get_string('type' . $r['type'], 'activity');
}
$activity = array(
'count' => $count,
'count' => $count,
'offset' => $offset,
'limit' => $limit,
'data' => $records,
'star' => $star,
'limit' => $limit,
'data' => $records,
'star' => $star,
'unread' => $unread,
);
......
......@@ -46,9 +46,10 @@ var activitylist = new TableRenderer(
}
return TD(null,r.message);
},
'type',
'ctime',
function (r, d) {
if (r.read == 0) {
if (r.read == 1) {
return TD(null,IMG({'src' : d.star, 'alt' : d.unread}));
}
return TD(null);
......@@ -94,8 +95,10 @@ function markread(form) {
var d = loadJSONDoc('index.json.php', pd);
d.addCallbacks(function (data) {
if (data.success) {
$('messagediv').innerHTML = '$readsave';
activitylist.doupdate();
if (data.count > 0) {
$('messagediv').innerHTML = '$readsave';
activitylist.doupdate();
}
}
if (data.error) {
$('messagediv').innerHTML = '$readsavefail(' + data.error + ')';
......
......@@ -36,7 +36,7 @@ $string['typeobjectionable'] = 'Objectionable content';
$string['typevirusrepeat'] = 'Virus flat repeat';
$string['typevirusrelease'] = 'Virus flag release';
$string['type'] = 'Activity type: ';
$string['type'] = 'Activity type';
$string['attime'] = 'at';
$string['prefsdescr'] = 'For options other than Activity log, notifications will still go into the Activity log, but will be automatically marked as read';
......
......@@ -5,7 +5,7 @@
<div class="content">
<form method="post">
{str section='activity' tag='type'}
{str section='activity' tag='type'}:
<select name="type" onChange="{$typechange}">
<option value="all">{str section='activity' tag='alltypes'}</option>
{foreach from=$types item='type'}
......@@ -20,6 +20,7 @@
<thead>
<tr>
<th></th>
<th>{str section='activity' tag='type'}</th>
<th>{str section='activity' tag='date'}</th>
<th>{str section='activity' tag='read'}</th>
<th>{str section='activity' tag='markasread'} [<a href="" onClick="{$selectall}">{str section='activity' tag='selectall'}</a>]</th>
......
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