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
a840e3a8
Commit
a840e3a8
authored
Feb 01, 2007
by
Richard Mansfield
Browse files
use sendjsonrequest in collapsabletree
parent
7e80d6e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/js/collapsabletree.js
View file @
a840e3a8
...
...
@@ -45,17 +45,11 @@ function CollapsableTree(data, source) {
}
});
var
req
=
getXMLHttpRequest
();
req
.
open
(
'
post
'
,
self
.
source
);
req
.
setRequestHeader
(
'
Content-type
'
,
'
application/x-www-form-urlencoded
'
);
var
d
=
sendXMLHttpRequest
(
req
,
queryString
(
request_args
));
d
.
addCallbacks
(
function
(
response
)
{
var
data
=
evalJSONRequest
(
response
);
sendjsonrequest
(
self
.
source
,
request_args
,
'
POST
'
,
function
(
data
)
{
if
(
!
data
.
error
)
{
if
(
data
.
message
)
{
if
(
data
.
data
)
{
// Add the new children into the list item that was expanded
var
ul
=
self
.
convertDataToDOM
(
data
.
message
);
var
ul
=
self
.
convertDataToDOM
(
data
.
data
);
appendChildNodes
(
p
,
ul
);
p
.
child
=
ul
;
}
...
...
@@ -67,15 +61,6 @@ function CollapsableTree(data, source) {
// Replace the 'expand' link with a 'collapse' one
replaceChildNodes
(
p
.
id
+
'
_toggle
'
,
self
.
getCollapseLink
(
p
));
}
else
{
alert
(
'
did not get data :(
'
);
// @todo insert sad face or something
}
processingStop
();
},
function
()
{
alert
(
'
no data for you!
'
);
processingStop
();
});
}
else
{
...
...
htdocs/json/artefacttree.json.php
View file @
a840e3a8
...
...
@@ -55,7 +55,9 @@ $data = get_records_sql_array("SELECT id, artefacttype, container, title
AND owner = ?
ORDER BY title"
,
array
(
$pluginname
,
$userid
));
if
(
!
$data
)
{
json_reply
(
false
,
null
);
echo
json_encode
(
array
(
'error'
=>
false
,
'data'
=>
false
));
exit
;
}
// Format the data for return. Each artefact type has the opportunity to format
...
...
@@ -102,6 +104,7 @@ foreach ($artefacts as $artefact) {
'rendersto'
=>
call_static_method
(
$artefactclass
,
'get_render_list'
)
);
}
json_reply
(
false
,
$items
);
echo
json_encode
(
array
(
'error'
=>
false
,
'data'
=>
$items
));
?>
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