Commit 5b07a0c6 authored by Penny Leach's avatar Penny Leach
Browse files

more work on watchlist

parent bc9a36a2
......@@ -75,11 +75,12 @@ $prefix = get_config('dbprefix');
if ($type == 'views') {
$count = count_records('usr_watchlist_view', 'usr', $userid);
$sql = 'SELECT v.*
$sql = 'SELECT v.*, v.title AS name
FROM ' . $prefix . 'view v
JOIN ' . $prefix . 'usr_watchlist_view w ON w.view = v.id
WHERE w.usr = ?';
if ($records = get_rows_sql($sql, array($userid), 'v.mtime DESC', '*', $offset, $limit)) {
WHERE w.usr = ?
ORDER BY v.mtime DESC';
if ($records = get_rows_sql($sql, array($userid), $offset, $limit)) {
foreach ($records as &$r) {
// @todo session expandey stuff
}
......@@ -90,23 +91,23 @@ else if ($type == 'communities') {
$sql = 'SELECT c.*
FROM ' . $prefix . 'community c
JOIN ' . $prefix . 'usr_watchlist_community w ON w.community = c.id
WHERE w.usr = ?';
$records = get_rows_sql($sql, array($userid), 'c.mtime DESC', '*', $offset, $limit);
WHERE w.usr = ?
ORDER BY c.mtime DESC';
$records = get_rows_sql($sql, array($userid), $offset, $limit);
}
if (empty($records)) {
$records = array();
}
$activity = array(
'count' => $count,
'offset' => $offset,
'limit' => $limit,
'data' => $records,
'type' => $type,
'minusicon' => theme_get_image_path('minus.gif'),
'plusicon' => theme_get_image_path('plus.gif'),
'minusicon' => theme_get_image_path('minus.png'),
'plusicon' => theme_get_image_path('plus.png'),
'minusalt' => get_string('collapse'),
'plusalt' => get_string('expand'),
);
......
......@@ -44,12 +44,12 @@ var watchlist = new TableRenderer(
return TD(null, '');
}
if (r.expanded) {
return TD(null, A({'href': '', 'onClick' : 'collapse(' + r.id | ')'}),
IMG({'src' : d.minusicon, 'alt' : d.minusalt}));
return TD(null, A({'href': '', 'onclick': 'collapse(' + r.id + '); return false;'},
IMG({'src' : d.minusicon, 'alt' : d.minusalt, 'border': 0})));
}
else {
return TD(null, A({'href': '', 'onClick' : 'collapse(' + r.id | ')'}),
IMG({'src' : d.plusicon, 'alt' : d.plusalt}));
return TD(null, A({'href': '', 'onclick': 'expand(' + r.id + '); return false;'},
IMG({'src' : d.plusicon, 'alt' : d.plusalt, 'border': 0})));
}
},
function(r) {
......@@ -59,7 +59,7 @@ var watchlist = new TableRenderer(
return TD(null,r.name);
},
function (r) {
return TD(null, INPUT({'type' : 'checkbox', 'class' : 'viewcheck', 'name' : 'view-' + r.id}));
return TD(null, INPUT({'type' : 'checkbox', 'class': 'tocheck', 'name': 'view-' + r.id}));
}
]
);
......@@ -73,6 +73,14 @@ function changeTitle(title) {
$('typeheader').innerHTML = '{$monitoredstring} ' + titles[title];
}
function collapse(id) {
}
function expand(id) {
}
JAVASCRIPT;
$typechange = 'watchlist.doupdate({\'type\':this.options[this.selectedIndex].value}); changeTitle(this.options[this.selectedIndex].value);';
......@@ -81,6 +89,7 @@ $smarty = smarty(array('tablerenderer'));
$smarty->assign('site_menu', site_menu());
$smarty->assign('typechange', $typechange);
$smarty->assign('typestr', get_string('viewsandartefacts', 'activity'));
$smarty->assign('selectall', 'toggleChecked(\'tocheck\'); return false;');
$smarty->assign('INLINEJAVASCRIPT', $javascript);
$smarty->display('account/watchlist/index.tpl');
......
......@@ -55,5 +55,6 @@ $string['stopmonitoring'] = 'Stop monitoring';
$string['viewsandartefacts'] = 'Views and artefacts';
$string['communities'] = 'Communities';
$string['monitored'] = 'Monitored';
$string['stopmonitoring'] = 'Stop monitoring';
?>
......@@ -214,6 +214,8 @@ $string['height'] = 'Height';
$string['widthshort'] = 'w';
$string['heightshort'] = 'h';
$string['filter'] = 'Filter';
$string['expand'] = 'Expand';
$string['collapse'] = 'Collapse';
$string['nohelpfound'] = 'There was no help found for this item';
......
......@@ -12,7 +12,7 @@
<option value="communities">{str section='activity' tag='communities'}</option>
</select>
</form>
<div id="typeheader">{str section='activity' tag='monitored'} {$typestr}</div>
<p><b><div id="typeheader">{str section='activity' tag='monitored'} {$typestr}</div></b></p>
<form method="post" onSubmit="{$stopmonitoring}">
<table id="watchlist">
<thead>
......@@ -28,7 +28,7 @@
<tfoot>
<tr>
<td align="right" colspan="4"><div id="messagediv"></div></td>
<td align="right"><input type="submit" value="{str tag='update'}" /></td>
<td align="right"><input type="submit" value="{str tag='stopmonitoring' section='activity'}" /></td>
</tr>
</tfoot>
</table>
......
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