Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
23b65cac
Commit
23b65cac
authored
Nov 21, 2006
by
Penny Leach
Browse files
more work on watchlist. now everything is done except for the foldey
out artefact tree :/
parent
266fa82f
Changes
4
Hide whitespace changes
Inline
Side-by-side
htdocs/account/watchlist/index.json.php
View file @
23b65cac
...
...
@@ -34,20 +34,21 @@ $stopmonitoring = param_integer('stopmonitoring', 0);
$getartefacts
=
param_integer
(
'getartefacts'
,
0
);
if
(
$stopmonitoring
)
{
$userid
=
$SESSION
->
get
(
'id'
);
$count
=
0
;
db_begin
();
try
{
foreach
(
$_GET
as
$k
=>
$v
)
{
if
(
preg_match
(
'/^stopview\-(\d+)$/'
,
$k
,
$m
))
{
// @todo
delete_records
(
'usr_watchlist_view'
,
'usr'
,
$userid
,
'view'
,
$m
[
1
]);
$count
++
;
}
else
if
(
preg_match
(
'/^stopartefact\-(\d+)$/'
,
$k
,
$m
))
{
// @todo
delete_records
(
'usr_watchlist_artefact'
,
'usr'
,
$userid
,
'artefact'
,
$m
[
1
]);
$count
++
;
}
else
if
(
preg_match
(
'/^stopcommunity\-(\d+)$/'
,
$k
,
$m
))
{
// @todo
delete_records
(
'usr_watchlist_community'
,
'usr'
,
$userid
,
'community'
,
$m
[
1
]);
$count
++
;
}
}
...
...
htdocs/account/watchlist/index.php
View file @
23b65cac
...
...
@@ -34,6 +34,10 @@ $viewstring = get_string('viewsandartefacts', 'activity');
$communitystring
=
get_string
(
'communities'
,
'activity'
);
$monitoredstring
=
get_string
(
'monitored'
,
'activity'
);
$savefailed
=
get_string
(
'stopmonitoringfailed'
,
'activity'
);
$savesuccess
=
get_string
(
'stopmonitoringsuccess'
,
'activity'
);
$javascript
=
<<<JAVASCRIPT
var watchlist = new TableRenderer(
'watchlist',
...
...
@@ -59,7 +63,12 @@ var watchlist = new TableRenderer(
return TD(null,r.name);
},
function (r) {
return TD(null, INPUT({'type' : 'checkbox', 'class': 'tocheck', 'name': 'view-' + r.id}));
if (r.type == 'community') {
return TD(null, INPUT({'type' : 'checkbox', 'class': 'tocheck', 'name': 'stopcommunity-' + r.id}));
}
else {
return TD(null, INPUT({'type' : 'checkbox', 'class': 'tocheck', 'name': 'stopview-' + r.id}));
}
}
]
);
...
...
@@ -81,6 +90,39 @@ function expand(id) {
}
function stopmonitoring(form) {
var c = 'tocheck';
var e = getElementsByTagAndClassName(null,'tocheck',form);
var pd = {};
for (cb in e) {
if (e[cb].checked == true) {
pd[e[cb].name] = 1;
}
}
pd['stopmonitoring'] = 1;
var d = loadJSONDoc('index.json.php', pd);
d.addCallbacks(function (data) {
if (data.success) {
if (data.count > 0) {
$('messagediv').innerHTML = '$savesuccess';
watchlist.doupdate();
}
}
if (data.error) {
$('messagediv').innerHTML = '$savefailed (' + data.error + ')';
}
},
function () {
$('messagediv').innerHTML = '$savefailed';
watchlist.doupdate();
}
)
}
JAVASCRIPT;
$typechange
=
'watchlist.doupdate({\'type\':this.options[this.selectedIndex].value}); changeTitle(this.options[this.selectedIndex].value);'
;
...
...
@@ -90,6 +132,7 @@ $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
(
'stopmonitoring'
,
'stopmonitoring(this); return false;'
);
$smarty
->
assign
(
'INLINEJAVASCRIPT'
,
$javascript
);
$smarty
->
display
(
'account/watchlist/index.tpl'
);
...
...
htdocs/lang/en.utf8/activity.php
View file @
23b65cac
...
...
@@ -57,4 +57,7 @@ $string['communities'] = 'Communities';
$string
[
'monitored'
]
=
'Monitored'
;
$string
[
'stopmonitoring'
]
=
'Stop monitoring'
;
$string
[
'stopmonitoringsuccess'
]
=
'Stopped monitoring successfully'
;
$string
[
'stopmonitoringfailed'
]
=
'Failed to stop monitoring'
;
?>
htdocs/theme/default/templates/account/watchlist/index.tpl
View file @
23b65cac
...
...
@@ -19,7 +19,7 @@
<tr>
<th></th>
<th></th>
<th>
{
str
section
=
'activity'
tag
=
'stopmonitoring'
}
[
<a
href=
""
onClick=
"
{
$selectall
}
"
>
{
str
section
=
'activity'
tag
=
'selectall'
}
</a>
]
</th>
<th>
[
<a
href=
""
onClick=
"
{
$selectall
}
"
>
{
str
section
=
'activity'
tag
=
'selectall'
}
</a>
]
</th>
</tr>
</thead>
<tbody>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment