Skip to content
GitLab
Menu
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
9e34de90
Commit
9e34de90
authored
Feb 01, 2007
by
Richard Mansfield
Browse files
Watchlist uses sendjsonrequest
parent
5cbf1864
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/account/watchlist/index.json.php
View file @
9e34de90
...
...
@@ -59,13 +59,11 @@ if ($stopmonitoring) {
}
catch
(
Exception
$e
)
{
db_rollback
();
$data
=
array
(
'error'
=>
$e
->
getMessage
);
echo
json_encode
(
$data
);
json_reply
(
'local'
,
get_string
(
'stopmonitoringfailed'
,
'activity'
)
.
': '
.
$e
->
getMessage
);
}
db_commit
();
$data
=
array
(
'success'
=>
1
,
'count'
=>
$count
);
echo
json_encode
(
$data
);
exit
;
$message
=
$count
?
get_string
(
'stopmonitoringsuccess'
,
'activity'
)
:
false
;
json_reply
(
false
,
array
(
'message'
=>
$message
,
'count'
=>
$count
));
}
if
(
!
empty
(
$userlist
))
{
if
(
$userlist
==
'views'
)
{
...
...
@@ -98,7 +96,7 @@ if (!empty($userlist)) {
foreach
(
$users
as
$u
)
{
$data
[]
=
array
(
'id'
=>
$u
->
id
,
'name'
=>
display_name
(
$u
,
$USER
));
}
json_reply
(
false
,
array
(
'users'
=>
$data
));
json_reply
(
false
,
array
(
'message'
=>
false
,
'users'
=>
$data
));
}
// normal processing (fetching tablerenderer results)
...
...
htdocs/account/watchlist/index.php
View file @
9e34de90
...
...
@@ -38,9 +38,6 @@ $allusersstring = get_string('allusers');
$andchildren
=
' * '
.
get_string
(
'andchildren'
,
'activity'
);
$savefailed
=
get_string
(
'stopmonitoringfailed'
,
'activity'
);
$savesuccess
=
get_string
(
'stopmonitoringsuccess'
,
'activity'
);
$wwwroot
=
get_config
(
'wwwroot'
);
$javascript
=
<<<JAVASCRIPT
...
...
@@ -103,23 +100,13 @@ function stopmonitoring(form) {
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';
sendjsonrequest('index.json.php', pd, 'GET', function (data) {
if (data.count > 0) {
watchlist.doupdate();
}
)
}, function () {
watchlist.doupdate();
});
}
function statusChange() {
...
...
@@ -146,9 +133,7 @@ function statusChange() {
}
else {
var pd = {'userlist': typevalue};
var d = loadJSONDoc('index.json.php', pd);
d.addCallbacks(function (data) {
sendjsonrequest('index.json.php', pd, 'GET', function (data) {
var userSelect = $('user');
var newOptions = new Array()
var opt = OPTION(null, '{$allusersstring}');
...
...
@@ -156,7 +141,7 @@ function statusChange() {
opt.selected = true;
}
newOptions.push(opt);
forEach (data.
message.
users, function (u) {
forEach (data.users, function (u) {
var opt = OPTION({'value': u.id}, u.name);
if (uservalue == u.id) {
opt.selected = true;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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