Gitlab CSE Unil
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
M. Chardon
moodle-assignfeedback_editpdfplus
Commits
9e4edd46
Commit
9e4edd46
authored
Jul 15, 2016
by
M. Chardon
Browse files
init
parents
Changes
206
Expand all
Hide whitespace changes
Inline
Side-by-side
.old/mod/lti/amd/build/external_registration.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/ajax
"
,
"
core/notification
"
,
"
core/templates
"
,
"
mod_lti/events
"
,
"
mod_lti/tool_proxy
"
,
"
mod_lti/tool_type
"
,
"
mod_lti/keys
"
,
"
core/str
"
],
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
){
var
j
=
{
EXTERNAL_REGISTRATION_CONTAINER
:
"
#external-registration-page-container
"
,
EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER
:
"
#external-registration-template-container
"
,
EXTERNAL_REGISTRATION_CANCEL_BUTTON
:
"
#cancel-external-registration
"
,
TOOL_TYPE_CAPABILITIES_CONTAINER
:
"
#tool-type-capabilities-container
"
,
TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER
:
"
#tool-type-capabilities-template-container
"
,
CAPABILITIES_AGREE_CONTAINER
:
"
.capabilities-container
"
},
k
=
function
(){
return
a
(
j
.
EXTERNAL_REGISTRATION_CANCEL_BUTTON
)},
l
=
function
(){
return
a
(
j
.
EXTERNAL_REGISTRATION_CONTAINER
)},
m
=
function
(){
return
a
(
j
.
EXTERNAL_REGISTRATION_TEMPLATE_CONTAINER
)},
n
=
function
(){
return
a
(
j
.
TOOL_TYPE_CAPABILITIES_CONTAINER
)},
o
=
function
(){
return
a
(
j
.
TOOL_TYPE_CAPABILITIES_TEMPLATE_CONTAINER
)},
p
=
function
(){
n
().
addClass
(
"
loading
"
)},
q
=
function
(){
n
().
removeClass
(
"
loading
"
)},
r
=
function
(){
k
().
addClass
(
"
loading
"
)},
s
=
function
(){
k
().
removeClass
(
"
loading
"
)},
t
=
function
(){
n
().
addClass
(
"
hidden
"
)},
u
=
function
(){
n
().
removeClass
(
"
hidden
"
)},
v
=
function
(){
l
().
addClass
(
"
hidden
"
)},
w
=
function
(){
l
().
removeClass
(
"
hidden
"
)},
x
=
function
(
a
){
var
b
=
k
();
b
.
attr
(
"
data-tool-proxy-id
"
,
a
)},
y
=
function
(){
var
a
=
k
();
return
a
.
attr
(
"
data-tool-proxy-id
"
)},
z
=
function
(){
var
a
=
k
();
a
.
removeAttr
(
"
data-tool-proxy-id
"
)},
A
=
function
(){
return
y
()?
!
0
:
!
1
},
B
=
function
(){
var
a
=
k
();
return
a
.
attr
(
"
data-tool-proxy-new
"
)
&&
A
()},
C
=
function
(){
var
a
=
k
();
return
a
.
attr
(
"
data-tool-proxy-new
"
,
"
new
"
)},
D
=
function
(){
var
a
=
k
();
return
a
.
removeAttr
(
"
data-tool-proxy-new
"
)},
E
=
function
(
a
){
var
c
=
{
methodname
:
"
mod_lti_get_tool_proxy_registration_request
"
,
args
:{
id
:
a
}};
return
b
.
call
([
c
])[
0
]},
F
=
function
(){
r
();
var
b
=
a
.
Deferred
();
if
(
B
()){
var
d
=
y
();
f
[
"
delete
"
](
d
).
done
(
function
(){
b
.
resolve
()}).
fail
(
function
(
a
){
b
.
reject
(
a
)})}
else
b
.
resolve
();
return
b
.
done
(
function
(){
L
(),
s
()}).
fail
(
function
(
b
){
c
.
exception
(
b
),
L
(),
s
(),
i
.
get_string
(
"
failedtodeletetoolproxy
"
,
"
mod_lti
"
).
done
(
function
(
b
){
var
c
=
{
message
:
b
,
error
:
!
0
};
a
(
document
).
trigger
(
e
.
REGISTRATION_FEEDBACK
,
c
)}).
fail
(
c
.
exception
)}),
b
},
G
=
function
(
a
){
var
b
=
d
.
render
(
"
mod_lti/tool_proxy_registration_form
"
,
a
);
return
b
.
done
(
function
(
a
,
b
){
var
c
=
m
();
c
.
append
(
a
),
d
.
runTemplateJS
(
b
),
c
.
find
(
"
form
"
).
submit
(),
w
()}).
fail
(
c
.
exception
),
b
},
H
=
function
(
a
){
return
g
.
update
({
id
:
a
.
id
,
state
:
g
.
constants
.
state
.
configured
})},
I
=
function
(
b
){
var
f
=
a
.
Deferred
();
return
d
.
render
(
"
mod_lti/tool_type_capabilities_agree
"
,
b
).
done
(
function
(
a
,
c
){
var
g
=
o
();
v
(),
u
(),
d
.
replaceNodeContents
(
g
,
a
,
c
);
var
h
=
g
.
find
(
j
.
CAPABILITIES_AGREE_CONTAINER
);
h
.
on
(
e
.
CAPABILITIES_AGREE
,
function
(){
p
(),
H
(
b
).
always
(
function
(){
q
(),
g
.
empty
(),
f
.
resolve
()})}),
h
.
on
(
e
.
CAPABILITIES_DECLINE
,
function
(){
g
.
empty
(),
f
.
resolve
()})}).
fail
(
f
.
reject
),
f
.
done
(
function
(){
t
()}).
fail
(
c
.
exception
),
f
},
J
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
b
&&
""
!==
b
?
f
.
create
({
regurl
:
b
}).
done
(
function
(
a
){
C
(),
c
=
K
(
a
.
id
)}).
fail
(
function
(
b
){
F
();
var
d
=
{
message
:
b
.
message
,
error
:
!
0
};
a
(
document
).
trigger
(
e
.
REGISTRATION_FEEDBACK
,
d
),
c
.
reject
(
b
)}):
c
.
resolve
(),
c
},
K
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
x
(
b
),
E
(
b
).
done
(
function
(
a
){
G
(
a
).
done
(
function
(){
c
.
resolve
()}).
fail
(
c
.
fail
)}).
fail
(
c
.
fail
),
c
},
L
=
function
(){
A
()
&&
z
(),
D
(
!
1
),
v
();
var
b
=
m
();
b
.
empty
(),
a
(
document
).
trigger
(
e
.
STOP_EXTERNAL_REGISTRATION
)},
M
=
function
(){
a
(
document
).
on
(
e
.
START_EXTERNAL_REGISTRATION
,
function
(
a
,
b
){
b
&&
(
b
.
url
&&
J
(
b
.
url
),
b
.
proxyid
&&
K
(
b
.
proxyid
))});
var
b
=
k
();
b
.
click
(
function
(
a
){
a
.
preventDefault
(),
F
()}),
b
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
(
a
.
keyCode
==
h
.
ENTER
||
a
.
keyCode
==
h
.
SPACE
)
&&
(
a
.
preventDefault
(),
F
())}),
window
.
triggerExternalRegistrationComplete
=
function
(
b
){
var
d
=
a
.
Deferred
(),
f
=
{
message
:
""
,
error
:
!
1
};
if
(
"
success
"
==
b
.
status
){
if
(
i
.
get_string
(
"
successfullycreatedtooltype
"
,
"
mod_lti
"
).
done
(
function
(
a
){
f
.
message
=
a
}).
fail
(
c
.
exception
),
d
.
done
(
function
(){
L
(),
a
(
document
).
trigger
(
e
.
REGISTRATION_FEEDBACK
,
f
),
a
(
document
).
trigger
(
e
.
NEW_TOOL_TYPE
)}).
fail
(
c
.
exception
),
B
()){
var
h
=
y
();
g
.
getFromToolProxyId
(
h
).
done
(
function
(
a
){
if
(
a
&&
a
.
length
){
var
b
=
a
[
0
];
b
.
hascapabilitygroups
?
I
(
b
).
always
(
function
(){
d
.
resolve
()}):
d
.
resolve
()}
else
d
.
resolve
()}).
fail
(
function
(){
d
.
resolve
()})}}
else
f
.
message
=
b
.
error
,
f
.
error
=!
0
,
d
.
done
(
function
(){
F
().
always
(
function
(){
a
(
document
).
trigger
(
e
.
REGISTRATION_FEEDBACK
,
f
)})}).
fail
(
c
.
exception
),
d
.
resolve
();
return
d
}};
return
{
init
:
function
(){
M
()}}});
\ No newline at end of file
.old/mod/lti/amd/build/external_registration_return.min.js
0 → 100755
View file @
9e4edd46
define
([],
function
(){
return
{
init
:
function
(
a
,
b
,
c
,
d
){
window
.
parent
&&
window
.
parent
.
triggerExternalRegistrationComplete
({
message
:
a
,
error
:
b
,
id
:
c
,
status
:
d
})}}});
\ No newline at end of file
.old/mod/lti/amd/build/keys.min.js
0 → 100755
View file @
9e4edd46
define
([],
function
(){
return
{
ENTER
:
13
,
SPACE
:
32
}});
\ No newline at end of file
.old/mod/lti/amd/build/tool_card_controller.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/ajax
"
,
"
core/notification
"
,
"
core/templates
"
,
"
mod_lti/tool_type
"
,
"
mod_lti/events
"
,
"
mod_lti/keys
"
,
"
core/str
"
],
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
){
var
i
=
{
DELETE_BUTTON
:
"
.delete
"
,
NAME_ELEMENT
:
"
.name
"
,
DESCRIPTION_ELEMENT
:
"
.description
"
,
CAPABILITIES_CONTAINER
:
"
.capabilities-container
"
,
ACTIVATE_BUTTON
:
"
.tool-card-footer a.activate
"
},
j
=
2
e3
,
k
=
function
(
a
){
return
a
.
find
(
i
.
DELETE_BUTTON
)},
l
=
function
(
a
){
return
a
.
find
(
i
.
NAME_ELEMENT
)},
m
=
function
(
a
){
return
a
.
find
(
i
.
DESCRIPTION_ELEMENT
)},
n
=
function
(
a
){
return
a
.
find
(
i
.
ACTIVATE_BUTTON
)},
o
=
function
(
a
){
return
n
(
a
).
length
?
!
0
:
!
1
},
p
=
function
(
a
){
return
a
.
find
(
i
.
CAPABILITIES_CONTAINER
)},
q
=
function
(
a
){
return
p
(
a
).
length
?
!
0
:
!
1
},
r
=
function
(
a
){
return
a
.
attr
(
"
data-type-id
"
)},
s
=
function
(
a
){
a
.
removeClass
(
"
announcement loading success fail capabilities
"
)},
t
=
function
(
a
){
s
(
a
),
a
.
addClass
(
"
announcement loading
"
)},
u
=
function
(
a
){
a
.
removeClass
(
"
announcement loading
"
)},
v
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
s
(
b
),
b
.
addClass
(
"
announcement success
"
),
setTimeout
(
function
(){
b
.
removeClass
(
"
announcement success
"
),
c
.
resolve
()},
j
),
c
},
w
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
s
(
b
),
b
.
addClass
(
"
announcement fail
"
),
setTimeout
(
function
(){
b
.
removeClass
(
"
announcement fail
"
),
c
.
resolve
()},
j
),
c
},
x
=
function
(
b
){
var
d
=
a
.
Deferred
(),
f
=
r
(
b
);
return
t
(
b
),
""
===
f
?
a
.
Deferred
().
resolve
():(
h
.
get_strings
([{
key
:
"
delete
"
,
component
:
"
mod_lti
"
},{
key
:
"
delete_confirmation
"
,
component
:
"
mod_lti
"
},{
key
:
"
delete
"
,
component
:
"
mod_lti
"
},{
key
:
"
cancel
"
,
component
:
"
core
"
}]).
done
(
function
(
a
){
c
.
confirm
(
a
[
0
],
a
[
1
],
a
[
2
],
a
[
3
],
function
(){
e
[
"
delete
"
](
f
).
done
(
function
(){
u
(
b
),
v
(
b
).
done
(
function
(){
b
.
remove
()}).
fail
(
c
.
exception
).
always
(
function
(){
d
.
resolve
()})}).
fail
(
function
(
a
){
w
(
b
),
d
.
reject
(
a
)})},
function
(){
u
(
b
),
d
.
resolve
()})}).
fail
(
function
(
a
){
u
(
b
),
c
.
exception
(
a
),
d
.
reject
(
a
)}),
d
)},
y
=
function
(
a
,
b
){
a
.
attr
(
"
data-val-snapshot
"
,
b
)},
z
=
function
(
a
){
return
a
.
attr
(
"
data-val-snapshot
"
)},
A
=
function
(
a
){
var
b
=
m
(
a
);
if
(
!
b
.
hasClass
(
"
loading
"
)){
var
c
=
b
.
text
().
trim
();
y
(
b
,
c
)}},
B
=
function
(
b
){
var
d
=
r
(
b
);
if
(
""
===
d
)
return
a
.
Deferred
().
resolve
();
var
f
=
m
(
b
);
if
(
f
.
hasClass
(
"
loading
"
))
return
a
.
Deferred
().
resolve
();
var
g
=
f
.
text
().
trim
(),
h
=
z
(
f
);
if
(
h
==
g
)
return
a
.
Deferred
().
resolve
();
f
.
addClass
(
"
loading
"
);
var
i
=
e
.
update
({
id
:
d
,
description
:
g
});
return
i
.
done
(
function
(
a
){
f
.
removeClass
(
"
loading
"
),
f
.
text
(
a
.
description
)}).
fail
(
c
.
exception
),
i
.
fail
(
function
(){
f
.
removeClass
(
"
loading
"
)}),
i
},
C
=
function
(
a
){
var
b
=
l
(
a
);
if
(
!
b
.
hasClass
(
"
loading
"
)){
var
c
=
b
.
text
().
trim
();
y
(
b
,
c
)}},
D
=
function
(
b
){
var
c
=
r
(
b
);
if
(
""
===
c
)
return
a
.
Deferred
().
resolve
();
var
d
=
l
(
b
);
if
(
d
.
hasClass
(
"
loading
"
))
return
a
.
Deferred
().
resolve
();
var
f
=
d
.
text
().
trim
(),
g
=
z
(
d
);
if
(
g
==
f
)
return
a
.
Deferred
().
resolve
();
d
.
addClass
(
"
loading
"
);
var
h
=
e
.
update
({
id
:
c
,
name
:
f
});
return
h
.
done
(
function
(
a
){
d
.
removeClass
(
"
loading
"
),
d
.
text
(
a
.
name
)}),
h
.
fail
(
function
(){
d
.
removeClass
(
"
loading
"
)}),
h
},
E
=
function
(
b
){
var
c
=
r
(
b
);
if
(
""
===
c
)
return
a
.
Deferred
().
resolve
();
t
(
b
);
var
f
=
e
.
update
({
id
:
c
,
state
:
e
.
constants
.
state
.
configured
});
return
f
.
done
(
function
(
c
){
u
(
b
);
var
e
=
v
(
b
),
f
=
d
.
render
(
"
mod_lti/tool_card
"
,
c
);
a
.
when
(
f
,
e
).
then
(
function
(
a
){
var
c
=
a
[
0
],
e
=
a
[
1
];
d
.
replaceNode
(
b
,
c
,
e
)})}),
f
.
fail
(
function
(){
u
(
b
),
w
(
b
)}),
f
},
F
=
function
(
a
){
a
.
addClass
(
"
announcement capabilities
"
)},
G
=
function
(
a
){
a
.
removeClass
(
"
announcement capabilities
"
)},
H
=
function
(
a
){
q
(
a
)?
F
(
a
):
E
(
a
)},
I
=
function
(
a
){
var
b
=
k
(
a
);
b
.
click
(
function
(
b
){
b
.
preventDefault
(),
x
(
a
)}),
b
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
(
a
.
keyCode
==
g
.
ENTER
||
a
.
keyCode
==
g
.
SPACE
)
&&
(
a
.
preventDefault
(),
b
.
click
())});
var
c
=
m
(
a
);
c
.
focus
(
function
(
b
){
b
.
preventDefault
(),
A
(
a
)}),
c
.
blur
(
function
(
b
){
b
.
preventDefault
(),
B
(
a
)}),
c
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
a
.
keyCode
==
g
.
ENTER
&&
(
a
.
preventDefault
(),
c
.
blur
())});
var
d
=
l
(
a
);
if
(
d
.
focus
(
function
(
b
){
b
.
preventDefault
(),
C
(
a
)}),
d
.
blur
(
function
(
b
){
b
.
preventDefault
(),
D
(
a
)}),
d
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
a
.
keyCode
==
g
.
ENTER
&&
(
a
.
preventDefault
(),
d
.
blur
())}),
o
(
a
)){
var
e
=
n
(
a
);
e
.
click
(
function
(
b
){
b
.
preventDefault
(),
H
(
a
)}),
e
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
(
a
.
keyCode
==
g
.
ENTER
||
a
.
keyCode
==
g
.
SPACE
)
&&
(
a
.
preventDefault
(),
e
.
click
())})}
if
(
q
(
a
)){
var
h
=
p
(
a
);
h
.
on
(
f
.
CAPABILITIES_AGREE
,
function
(){
E
(
a
)}),
h
.
on
(
f
.
CAPABILITIES_DECLINE
,
function
(){
G
(
a
)})}};
return
{
init
:
function
(
a
){
I
(
a
)}}});
\ No newline at end of file
.old/mod/lti/amd/build/tool_configure_controller.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/ajax
"
,
"
core/notification
"
,
"
core/templates
"
,
"
mod_lti/events
"
,
"
mod_lti/keys
"
,
"
mod_lti/tool_type
"
,
"
mod_lti/tool_proxy
"
,
"
core/str
"
],
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
){
var
j
=
{
EXTERNAL_REGISTRATION_CONTAINER
:
"
#external-registration-container
"
,
EXTERNAL_REGISTRATION_PAGE_CONTAINER
:
"
#external-registration-page-container
"
,
CARTRIDGE_REGISTRATION_CONTAINER
:
"
#cartridge-registration-container
"
,
CARTRIDGE_REGISTRATION_FORM
:
"
#cartridge-registration-form
"
,
ADD_TOOL_FORM
:
"
#add-tool-form
"
,
TOOL_LIST_CONTAINER
:
"
#tool-list-container
"
,
TOOL_CREATE_BUTTON
:
"
#tool-create-button
"
,
REGISTRATION_CHOICE_CONTAINER
:
"
#registration-choice-container
"
,
TOOL_URL
:
"
#tool-url
"
},
k
=
function
(){
return
a
(
j
.
TOOL_CREATE_BUTTON
)},
l
=
function
(){
return
a
(
j
.
TOOL_LIST_CONTAINER
)},
m
=
function
(){
return
a
(
j
.
EXTERNAL_REGISTRATION_CONTAINER
)},
n
=
function
(){
return
a
(
j
.
CARTRIDGE_REGISTRATION_CONTAINER
)},
o
=
function
(){
return
a
(
j
.
REGISTRATION_CHOICE_CONTAINER
)},
p
=
function
(){
return
a
(
j
.
TOOL_URL
).
val
()},
q
=
function
(){
m
().
addClass
(
"
hidden
"
)},
r
=
function
(){
n
().
addClass
(
"
hidden
"
)},
s
=
function
(){
o
().
addClass
(
"
hidden
"
)},
t
=
function
(){
r
(),
s
(),
m
().
removeClass
(
"
hidden
"
),
v
(
m
())},
u
=
function
(
a
){
q
(),
s
(),
n
().
removeClass
(
"
hidden
"
),
n
().
find
(
j
.
CARTRIDGE_REGISTRATION_FORM
).
attr
(
"
data-cartridge-url
"
,
a
),
v
(
n
())},
v
=
function
(
a
){
var
b
=
a
.
children
().
clone
(
!
0
,
!
0
);
a
.
empty
(),
a
.
append
(
b
)},
w
=
function
(){
q
(),
r
(),
o
().
removeClass
(
"
hidden
"
),
v
(
o
())},
x
=
function
(){
l
().
addClass
(
"
hidden
"
)},
y
=
function
(){
l
().
removeClass
(
"
hidden
"
)},
z
=
function
(
a
){
var
b
=
a
.
error
?
"
error
"
:
"
success
"
;
c
.
addNotification
({
message
:
a
.
message
,
type
:
b
})},
A
=
function
(
a
){
a
.
addClass
(
"
loading
"
)},
B
=
function
(
a
){
a
.
removeClass
(
"
loading
"
)},
C
=
function
(){
var
b
=
a
.
Deferred
(),
e
=
l
();
A
(
e
),
a
.
when
(
g
.
query
(),
h
.
query
({
orphanedonly
:
!
0
})).
done
(
function
(
a
,
c
){
d
.
render
(
"
mod_lti/tool_list
"
,{
tools
:
a
,
proxies
:
c
}).
done
(
function
(
a
,
c
){
e
.
empty
(),
e
.
append
(
a
),
d
.
runTemplateJS
(
c
),
b
.
resolve
()}).
fail
(
b
.
reject
)}).
fail
(
b
.
reject
),
b
.
fail
(
c
.
exception
).
always
(
function
(){
B
(
e
)})},
D
=
function
(){
var
b
=
a
.
trim
(
p
());
if
(
""
===
b
)
return
a
.
Deferred
().
resolve
();
var
d
=
k
();
A
(
d
);
var
f
=
g
.
isCartridge
(
b
);
return
f
.
always
(
function
(){
B
(
d
)}),
f
.
done
(
function
(
c
){
c
.
iscartridge
?(
a
(
j
.
TOOL_URL
).
val
(
""
),
a
(
document
).
trigger
(
e
.
START_CARTRIDGE_REGISTRATION
,
b
)):
a
(
document
).
trigger
(
e
.
START_EXTERNAL_REGISTRATION
,{
url
:
b
})}),
f
.
fail
(
function
(){
i
.
get_string
(
"
errorbadurl
"
,
"
mod_lti
"
).
done
(
function
(
b
){
a
(
document
).
trigger
(
e
.
REGISTRATION_FEEDBACK
,{
message
:
b
,
error
:
!
0
})}).
fail
(
c
.
exception
)}),
f
},
E
=
function
(){
a
(
document
).
on
(
e
.
NEW_TOOL_TYPE
,
function
(){
C
()}),
a
(
document
).
on
(
e
.
START_EXTERNAL_REGISTRATION
,
function
(){
t
(),
a
(
j
.
TOOL_URL
).
val
(
""
),
x
()}),
a
(
document
).
on
(
e
.
STOP_EXTERNAL_REGISTRATION
,
function
(){
y
(),
w
()}),
a
(
document
).
on
(
e
.
START_CARTRIDGE_REGISTRATION
,
function
(
a
,
b
){
u
(
b
)}),
a
(
document
).
on
(
e
.
STOP_CARTRIDGE_REGISTRATION
,
function
(){
n
().
find
(
j
.
CARTRIDGE_REGISTRATION_FORM
).
removeAttr
(
"
data-cartridge-url
"
),
w
()}),
a
(
document
).
on
(
e
.
REGISTRATION_FEEDBACK
,
function
(
a
,
b
){
z
(
b
)});
var
b
=
a
(
j
.
ADD_TOOL_FORM
);
b
.
submit
(
function
(
a
){
a
.
preventDefault
(),
D
()})};
return
{
init
:
function
(){
E
(),
C
()}}});
\ No newline at end of file
.old/mod/lti/amd/build/tool_proxy.min.js
0 → 100755
View file @
9e4edd46
define
([
"
core/ajax
"
,
"
core/notification
"
],
function
(
a
,
b
){
return
{
query
:
function
(
c
){
var
d
=
{
methodname
:
"
mod_lti_get_tool_proxies
"
,
args
:
c
||
{}},
e
=
a
.
call
([
d
])[
0
];
return
e
.
fail
(
b
.
exception
),
e
},
"
delete
"
:
function
(
c
){
var
d
=
{
methodname
:
"
mod_lti_delete_tool_proxy
"
,
args
:{
id
:
c
}},
e
=
a
.
call
([
d
])[
0
];
return
e
.
fail
(
b
.
exception
),
e
},
create
:
function
(
b
){
var
c
=
{
methodname
:
"
mod_lti_create_tool_proxy
"
,
args
:
b
},
d
=
a
.
call
([
c
])[
0
];
return
d
}}});
\ No newline at end of file
.old/mod/lti/amd/build/tool_proxy_card_controller.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/ajax
"
,
"
core/notification
"
,
"
core/templates
"
,
"
mod_lti/tool_proxy
"
,
"
mod_lti/events
"
,
"
mod_lti/keys
"
,
"
core/str
"
],
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
){
var
i
=
{
DELETE_BUTTON
:
"
.delete
"
,
CAPABILITIES_CONTAINER
:
"
.capabilities-container
"
,
ACTIVATE_BUTTON
:
"
.tool-card-footer a.activate
"
},
j
=
2
e3
,
k
=
function
(
a
){
return
a
.
find
(
i
.
DELETE_BUTTON
)},
l
=
function
(
a
){
return
a
.
find
(
i
.
ACTIVATE_BUTTON
)},
m
=
function
(
a
){
return
a
.
attr
(
"
data-proxy-id
"
)},
n
=
function
(
a
){
a
.
removeClass
(
"
announcement loading success fail capabilities
"
)},
o
=
function
(
a
){
n
(
a
),
a
.
addClass
(
"
announcement loading
"
)},
p
=
function
(
a
){
a
.
removeClass
(
"
announcement loading
"
)},
q
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
n
(
b
),
b
.
addClass
(
"
announcement success
"
),
setTimeout
(
function
(){
b
.
removeClass
(
"
announcement success
"
),
c
.
resolve
()},
j
),
c
},
r
=
function
(
b
){
var
c
=
a
.
Deferred
();
return
n
(
b
),
b
.
addClass
(
"
announcement fail
"
),
setTimeout
(
function
(){
b
.
removeClass
(
"
announcement fail
"
),
c
.
resolve
()},
j
),
c
},
s
=
function
(
b
){
var
d
=
a
.
Deferred
(),
f
=
m
(
b
);
return
o
(
b
),
""
===
f
?
a
.
Deferred
().
resolve
():(
h
.
get_strings
([{
key
:
"
delete
"
,
component
:
"
mod_lti
"
},{
key
:
"
delete_confirmation
"
,
component
:
"
mod_lti
"
},{
key
:
"
delete
"
,
component
:
"
mod_lti
"
},{
key
:
"
cancel
"
,
component
:
"
core
"
}]).
done
(
function
(
a
){
c
.
confirm
(
a
[
0
],
a
[
1
],
a
[
2
],
a
[
3
],
function
(){
e
[
"
delete
"
](
f
).
done
(
function
(){
p
(
b
),
q
(
b
).
done
(
function
(){
b
.
remove
(),
d
.
resolve
()}).
fail
(
c
.
exception
)}).
fail
(
function
(
a
){
r
(
b
),
d
.
reject
(
a
)})},
function
(){
p
(
b
),
d
.
resolve
()})}).
fail
(
function
(
a
){
p
(
b
),
c
.
exception
(
a
),
d
.
reject
(
a
)}),
d
)},
t
=
function
(
b
){
var
c
=
{
proxyid
:
m
(
b
)};
a
(
document
).
trigger
(
f
.
START_EXTERNAL_REGISTRATION
,
c
)},
u
=
function
(
a
){
var
b
=
k
(
a
);
b
.
click
(
function
(
b
){
b
.
preventDefault
(),
s
(
a
)}),
b
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
(
a
.
keyCode
==
g
.
ENTER
||
a
.
keyCode
==
g
.
SPACE
)
&&
(
a
.
preventDefault
(),
b
.
click
())});
var
c
=
l
(
a
);
c
.
click
(
function
(
b
){
b
.
preventDefault
(),
t
(
a
)}),
c
.
keypress
(
function
(
a
){
a
.
metaKey
||
a
.
shiftKey
||
a
.
altKey
||
a
.
ctrlKey
||
(
a
.
keyCode
==
g
.
ENTER
||
a
.
keyCode
==
g
.
SPACE
)
&&
(
a
.
preventDefault
(),
c
.
click
())})};
return
{
init
:
function
(
a
){
u
(
a
)}}});
\ No newline at end of file
.old/mod/lti/amd/build/tool_type.min.js
0 → 100755
View file @
9e4edd46
define
([
"
core/ajax
"
,
"
core/notification
"
],
function
(
a
,
b
){
return
{
query
:
function
(
c
){
var
d
=
{
methodname
:
"
mod_lti_get_tool_types
"
,
args
:
c
||
{}},
e
=
a
.
call
([
d
])[
0
];
return
e
.
fail
(
b
.
exception
),
e
},
create
:
function
(
b
){
var
c
=
{
methodname
:
"
mod_lti_create_tool_type
"
,
args
:
b
},
d
=
a
.
call
([
c
])[
0
];
return
d
},
update
:
function
(
c
){
var
d
=
{
methodname
:
"
mod_lti_update_tool_type
"
,
args
:
c
},
e
=
a
.
call
([
d
])[
0
];
return
e
.
fail
(
b
.
exception
),
e
},
"
delete
"
:
function
(
c
){
var
d
=
{
methodname
:
"
mod_lti_delete_tool_type
"
,
args
:{
id
:
c
}},
e
=
a
.
call
([
d
])[
0
];
return
e
.
fail
(
b
.
exception
),
e
},
getFromToolProxyId
:
function
(
a
){
return
this
.
query
({
toolproxyid
:
a
})},
isCartridge
:
function
(
b
){
var
c
=
{
methodname
:
"
mod_lti_is_cartridge
"
,
args
:{
url
:
b
}},
d
=
a
.
call
([
c
])[
0
];
return
d
},
constants
:{
state
:{
configured
:
1
,
pending
:
2
,
rejected
:
3
}}}});
\ No newline at end of file
.old/mod/quiz/amd/build/preflightcheck.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/yui
"
],
function
(
a
,
b
){
var
c
=
{
confirmDialogue
:
null
,
init
:
function
(
a
,
d
,
e
,
f
){
var
g
=
a
;
b
.
use
(
"
moodle-core-notification
"
,
"
moodle-core-formchangechecker
"
,
"
io-form
"
,
function
(){
b
.
one
(
e
)
&&
(
c
.
confirmDialogue
=
new
M
.
core
.
dialogue
({
headerContent
:
d
,
bodyContent
:
b
.
one
(
e
),
draggable
:
!
0
,
visible
:
!
1
,
center
:
!
0
,
modal
:
!
0
,
width
:
null
,
extraClasses
:[
"
mod_quiz_preflight_popup
"
]}),
b
.
one
(
a
).
on
(
"
click
"
,
c
.
displayDialogue
),
b
.
one
(
"
#id_cancel
"
).
on
(
"
click
"
,
c
.
hideDialogue
),
g
=
c
.
confirmDialogue
.
get
(
"
boundingBox
"
).
one
(
'
[name="submitbutton"]
'
)),
f
&&
b
.
one
(
g
).
on
(
"
click
"
,
c
.
launchQuizPopup
,
c
,
f
)})},
displayDialogue
:
function
(
a
){
a
&&
a
.
halt
(),
c
.
confirmDialogue
.
show
()},
hideDialogue
:
function
(
a
){
a
&&
a
.
halt
(),
c
.
confirmDialogue
.
hide
(
a
)},
launchQuizPopup
:
function
(
a
,
c
){
a
.
halt
(),
M
.
core_formchangechecker
.
reset_form_dirty_state
();
var
d
=
a
.
target
.
ancestor
(
"
form
"
);
window
.
openpopup
(
a
,{
url
:
d
.
get
(
"
action
"
)
+
"
?
"
+
b
.
IO
.
stringify
(
d
).
replace
(
/
\b
cancel=/
,
"
x=
"
),
windowname
:
"
quizpopup
"
,
options
:
c
,
fullscreen
:
!
0
})}};
return
c
});
\ No newline at end of file
.old/report/competency/amd/build/grading_popup.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
,
"
core/notification
"
,
"
core/str
"
,
"
core/ajax
"
,
"
core/log
"
,
"
core/templates
"
,
"
tool_lp/dialogue
"
],
function
(
a
,
b
,
c
,
d
,
e
,
f
,
g
){
var
h
=
function
(
b
,
c
){
this
.
_regionSelector
=
b
,
this
.
_userCompetencySelector
=
c
,
a
(
this
.
_regionSelector
).
on
(
"
click
"
,
this
.
_userCompetencySelector
,
this
.
_handleClick
.
bind
(
this
))};
return
h
.
prototype
.
_handleClick
=
function
(
c
){
var
f
=
a
(
c
.
target
).
closest
(
this
.
_userCompetencySelector
),
g
=
a
(
f
).
data
(
"
competencyid
"
),
h
=
a
(
f
).
data
(
"
courseid
"
),
i
=
a
(
f
).
data
(
"
userid
"
);
e
.
debug
(
"
Clicked on cell: competencyId=
"
+
g
+
"
, courseId=
"
+
h
+
"
, userId=
"
+
i
);
var
j
=
d
.
call
([{
methodname
:
"
tool_lp_data_for_user_competency_summary_in_course
"
,
args
:{
userid
:
i
,
competencyid
:
g
,
courseid
:
h
},
done
:
this
.
_contextLoaded
.
bind
(
this
),
fail
:
b
.
exception
}]);
j
[
0
].
then
(
function
(){
d
.
call
([{
methodname
:
"
core_competency_user_competency_viewed_in_course
"
,
args
:{
userid
:
i
,
competencyid
:
g
,
courseid
:
h
},
fail
:
b
.
exception
}])})},
h
.
prototype
.
_contextLoaded
=
function
(
a
){
var
d
=
this
;
a
.
displayuser
=!
0
,
f
.
render
(
"
tool_lp/user_competency_summary_in_course
"
,
a
).
done
(
function
(
a
,
e
){
c
.
get_string
(
"
usercompetencysummary
"
,
"
report_competency
"
).
done
(
function
(
b
){
new
g
(
b
,
a
,
f
.
runTemplateJS
.
bind
(
f
,
e
),
d
.
_refresh
.
bind
(
d
),
!
0
)}).
fail
(
b
.
exception
)}).
fail
(
b
.
exception
)},
h
.
prototype
.
_refresh
=
function
(){
var
c
=
a
(
this
.
_regionSelector
),
e
=
c
.
data
(
"
courseid
"
),
f
=
c
.
data
(
"
userid
"
);
d
.
call
([{
methodname
:
"
report_competency_data_for_report
"
,
args
:{
courseid
:
e
,
userid
:
f
},
done
:
this
.
_pageContextLoaded
.
bind
(
this
),
fail
:
b
.
exception
}])},
h
.
prototype
.
_pageContextLoaded
=
function
(
a
){
var
c
=
this
;
f
.
render
(
"
report_competency/report
"
,
a
).
done
(
function
(
a
,
b
){
f
.
replaceNode
(
c
.
_regionSelector
,
a
,
b
)}).
fail
(
b
.
exception
)},
h
.
prototype
.
_regionSelector
=
null
,
h
.
prototype
.
_userCompetencySelector
=
null
,
h
});
\ No newline at end of file
.old/report/competency/amd/build/user_course_navigation.min.js
0 → 100755
View file @
9e4edd46
define
([
"
jquery
"
],
function
(
a
){
var
b
=
function
(
b
,
c
,
d
,
e
){
this
.
_baseUrl
=
c
,
this
.
_userId
=
d
+
""
,
this
.
_courseId
=
e
,
a
(
b
).
on
(
"
change
"
,
this
.
_userChanged
.
bind
(
this
))};
return
b
.
prototype
.
_userChanged
=
function
(
b
){
var
c
=
a
(
b
.
target
).
val
(),
d
=
"
?user=
"
+
c
+
"
&id=
"
+
this
.
_courseId
;
document
.
location
=
this
.
_baseUrl
+
d
},
b
.
prototype
.
_userId
=
null
,
b
.
prototype
.
_courseId
=
null
,
b
.
prototype
.
_baseUrl
=
null
,
b
});
\ No newline at end of file
.old/theme/bootstrapbase/amd/build/bootstrap.min.js
0 → 100755
View file @
9e4edd46
This diff is collapsed.
Click to expand it.
ajax.php
0 → 100755
View file @
9e4edd46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Process ajax requests
*
* @package assignfeedback_editpdfplus
* @copyright 2012 Davo Smith
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use
\
assignfeedback_editpdfplus\document_services
;
use
\
assignfeedback_editpdfplus\page_editor
;
use
\
assignfeedback_editpdfplus\comments_quick_list
;
define
(
'AJAX_SCRIPT'
,
true
);
require
(
'../../../../config.php'
);
require_once
(
$CFG
->
dirroot
.
'/mod/assign/locallib.php'
);
require_sesskey
();
$action
=
optional_param
(
'action'
,
''
,
PARAM_ALPHANUM
);
$assignmentid
=
required_param
(
'assignmentid'
,
PARAM_INT
);
$userid
=
required_param
(
'userid'
,
PARAM_INT
);
$attemptnumber
=
required_param
(
'attemptnumber'
,
PARAM_INT
);
$readonly
=
optional_param
(
'readonly'
,
false
,
PARAM_BOOL
);
$cm
=
\
get_coursemodule_from_instance
(
'assign'
,
$assignmentid
,
0
,
false
,
MUST_EXIST
);
$context
=
\
context_module
::
instance
(
$cm
->
id
);
$assignment
=
new
\
assign
(
$context
,
null
,
null
);
require_login
(
$assignment
->
get_course
(),
false
,
$cm
);
if
(
!
$assignment
->
can_view_submission
(
$userid
))
{
print_error
(
'nopermission'
);
}
if
(
$action
==
'loadallpages'
)
{
$draft
=
true
;
if
(
!
has_capability
(
'mod/assign:grade'
,
$context
))
{
$draft
=
false
;
$readonly
=
true
;
// A student always sees the readonly version.
require_capability
(
'mod/assign:submit'
,
$context
);
}
// Whoever is viewing the readonly version should not use the drafts, but the actual annotations.
if
(
$readonly
)
{
$draft
=
false
;
}
$pages
=
document_services
::
get_page_images_for_attempt
(
$assignment
,
$userid
,
$attemptnumber
,
$readonly
);
$response
=
new
stdClass
();
$response
->
pagecount
=
count
(
$pages
);
$response
->
pages
=
array
();
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
// The readonly files are stored in a different file area.
$filearea
=
document_services
::
PAGE_IMAGE_FILEAREA
;
if
(
$readonly
)
{
$filearea
=
document_services
::
PAGE_IMAGE_READONLY_FILEAREA
;
}
foreach
(
$pages
as
$id
=>
$pagefile
)
{
$index
=
count
(
$response
->
pages
);
$page
=
new
stdClass
();
$comments
=
page_editor
::
get_comments
(
$grade
->
id
,
$index
,
$draft
);
$page
->
url
=
moodle_url
::
make_pluginfile_url
(
$context
->
id
,
'assignfeedback_editpdfplus'
,
$filearea
,
$grade
->
id
,
'/'
,
$pagefile
->
get_filename
())
->
out
();
$page
->
comments
=
$comments
;
if
(
$imageinfo
=
$pagefile
->
get_imageinfo
())
{
$page
->
width
=
$imageinfo
[
'width'
];
$page
->
height
=
$imageinfo
[
'height'
];
}
else
{
$page
->
width
=
0
;
$page
->
height
=
0
;
}
$annotations
=
page_editor
::
get_annotations
(
$grade
->
id
,
$index
,
$draft
);
$page
->
annotations
=
$annotations
;
array_push
(
$response
->
pages
,
$page
);
}
echo
json_encode
(
$response
);
die
();
}
else
if
(
$action
==
'savepage'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$response
=
new
stdClass
();
$response
->
errors
=
array
();
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
$pagejson
=
required_param
(
'page'
,
PARAM_RAW
);
$page
=
json_decode
(
$pagejson
);
$index
=
required_param
(
'index'
,
PARAM_INT
);
$added
=
page_editor
::
set_comments
(
$grade
->
id
,
$index
,
$page
->
comments
);
if
(
$added
!=
count
(
$page
->
comments
))
{
array_push
(
$response
->
errors
,
get_string
(
'couldnotsavepage'
,
'assignfeedback_editpdfplus'
,
$index
+
1
));
}
$added
=
page_editor
::
set_annotations
(
$grade
->
id
,
$index
,
$page
->
annotations
);
if
(
$added
!=
count
(
$page
->
annotations
))
{
array_push
(
$response
->
errors
,
get_string
(
'couldnotsavepage'
,
'assignfeedback_editpdfplus'
,
$index
+
1
));
}
echo
json_encode
(
$response
);
die
();
}
else
if
(
$action
==
'generatepdf'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$response
=
new
stdClass
();
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
$file
=
document_services
::
generate_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
);
$response
->
url
=
''
;
if
(
$file
)
{
$url
=
moodle_url
::
make_pluginfile_url
(
$assignment
->
get_context
()
->
id
,
'assignfeedback_editpdfplus'
,
document_services
::
FINAL_PDF_FILEAREA
,
$grade
->
id
,
'/'
,
$file
->
get_filename
(),
false
);
$response
->
url
=
$url
->
out
(
true
);
$response
->
filename
=
$file
->
get_filename
();
}
echo
json_encode
(
$response
);
die
();
}
else
if
(
$action
==
'loadquicklist'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$result
=
comments_quick_list
::
get_comments
();
echo
json_encode
(
$result
);
die
();
}
else
if
(
$action
==
'addtoquicklist'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$comment
=
required_param
(
'commenttext'
,
PARAM_RAW
);
$width
=
required_param
(
'width'
,
PARAM_INT
);
$colour
=
required_param
(
'colour'
,
PARAM_ALPHA
);
$result
=
comments_quick_list
::
add_comment
(
$comment
,
$width
,
$colour
);
echo
json_encode
(
$result
);
die
();
}
else
if
(
$action
==
'revertchanges'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
$result
=
page_editor
::
revert_drafts
(
$gradeid
);
echo
json_encode
(
$result
);
die
();
}
else
if
(
$action
==
'removefromquicklist'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$commentid
=
required_param
(
'commentid'
,
PARAM_INT
);
$result
=
comments_quick_list
::
remove_comment
(
$commentid
);
echo
json_encode
(
$result
);
die
();
}
else
if
(
$action
==
'deletefeedbackdocument'
)
{
require_capability
(
'mod/assign:grade'
,
$context
);
$grade
=
$assignment
->
get_user_grade
(
$userid
,
true
);
$result
=
document_services
::
delete_feedback_document
(
$assignment
,
$userid
,
$attemptnumber
);
$result
=
$result
&&
page_editor
::
unrelease_drafts
(
$grade
->
id
);
echo
json_encode
(
$result
);
die
();
}
ajax_progress.php
0 → 100755
View file @
9e4edd46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Process concurrent ajax request.
* ALL RETURNED INFO IS PUBLIC.
*
* @package assignfeedback_editpdfplus
* @copyright 2013 Jerome Mouneyrac
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define
(
'AJAX_SCRIPT'
,
true
);
// To be able to process concurrent ajax request with the generate pdf ajax request we can not use cookie.
define
(
'NO_MOODLE_COOKIES'
,
true
);
use
\
assignfeedback_editpdfplus\document_services
;
require_once
(
'../../../../config.php'
);
try
{
$assignmentid
=
required_param
(
'assignmentid'
,
PARAM_INT
);
$userid
=
required_param
(
'userid'
,
PARAM_INT
);
$attemptnumber
=
required_param
(
'attemptnumber'
,
PARAM_INT
);
// Retrieve the assignments.
require_once
(
$CFG
->
dirroot
.
'/mod/assign/locallib.php'
);
$cm
=
get_coursemodule_from_instance
(
'assign'
,
$assignmentid
,
0
,
false
,
MUST_EXIST
);
$context
=
context_module
::
instance
(
$cm
->
id
);
$assignment
=
new
assign
(
$context
,
null
,
null
);
// Get the generated images from file API call.
$grade
=
$assignment
->
get_user_grade
(
$userid
,
false
,
$attemptnumber
);
// Check we found a grade.
if
(
empty
(
$grade
))
{
throw
new
coding_exception
(
'grade not found'
);
}
// No need to handle the readonly files here, the should be already generated.
$component
=
'assignfeedback_editpdfplus'
;
$filearea
=
document_services
::
PAGE_IMAGE_FILEAREA
;
$filepath
=
'/'
;
$fs
=
get_file_storage
();
$files
=
$fs
->
get_directory_files
(
$context
->
id
,
$component
,
$filearea
,
$grade
->
id
,
$filepath
);
// The important security part: we ONLY RETURN the total NUMBER of generated images.
echo
$OUTPUT
->
header
();
echo
json_encode
(
count
(
$files
));
echo
$OUTPUT
->
footer
();
}
catch
(
Exception
$e
)
{
// This should never happened!
// Return a 500 HTTP header so Y.io gets it as a failure.
if
(
substr
(
php_sapi_name
(),
0
,
3
)
==
'cgi'
)
{
header
(
"Status: 500 Internal Server Error"
);
}
else
{
header
(
'HTTP/1.0 500 Internal Server Error'
);
}
throw
new
moodle_exception
(
'An exception was caught but can not be returned for security purpose.
To easily debug, comment the try catch.'
);
}
backup/moodle2/backup_assignfeedback_editpdfplus_subplugin.class.php
0 → 100755
View file @
9e4edd46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the backup code for the feedback_editpdfplus plugin.
*
* @package assignfeedback_editpdfplus
* @copyright 2013 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* Provides the information to backup feedback pdf annotations.
*
* This just adds its fileareas to the annotations and the comments and annotation data.
*
* @package assignfeedback_editpdfplus
* @copyright 2013 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
backup_assignfeedback_editpdfplus_subplugin
extends
backup_subplugin
{
/**
* Returns the subplugin information to attach to feedback element
* @return backup_subplugin_element
*/
protected
function
define_grade_subplugin_structure
()
{
// Create XML elements.
$subplugin
=
$this
->
get_subplugin_element
();
$subpluginwrapper
=
new
backup_nested_element
(
$this
->
get_recommended_name
());
$subpluginelementfiles
=
new
backup_nested_element
(
'feedback_editpdfplus_files'
,
null
,
array
(
'gradeid'
));
$subpluginelementannotations
=
new
backup_nested_element
(
'feedback_editpdfplus_annotations'
);
$subpluginelementannotation
=
new
backup_nested_element
(
'annotation'
,
null
,
array
(
'gradeid'
,
'pageno'
,
'type'
,
'x'
,
'y'
,
'endx'
,
'endy'
,
'colour'
,
'path'
,
'draft'
));
$subpluginelementcomments
=
new
backup_nested_element
(
'feedback_editpdfplus_comments'
);
$subpluginelementcomment
=
new
backup_nested_element
(
'comment'
,
null
,
array
(
'gradeid'
,
'pageno'
,
'x'
,
'y'
,
'width'
,
'rawtext'
,
'colour'
,
'draft'
));
// Connect XML elements into the tree.
$subplugin
->
add_child
(
$subpluginwrapper
);
$subpluginelementannotations
->
add_child
(
$subpluginelementannotation
);
$subpluginelementcomments
->
add_child
(
$subpluginelementcomment
);
$subpluginwrapper
->
add_child
(
$subpluginelementfiles
);
$subpluginwrapper
->
add_child
(
$subpluginelementannotations
);
$subpluginwrapper
->
add_child
(
$subpluginelementcomments
);
// Set source to populate the data.
$subpluginelementfiles
->
set_source_sql
(
'SELECT id AS gradeid from {assign_grades} where id = :gradeid'
,
array
(
'gradeid'
=>
backup
::
VAR_PARENTID
));
$subpluginelementannotation
->
set_source_table
(
'assignfeedback_editpp_annot'
,
array
(
'gradeid'
=>
backup
::
VAR_PARENTID
));
$subpluginelementcomment
->
set_source_table
(
'assignfeedback_editpp_cmnt'
,
array
(
'gradeid'
=>
backup
::
VAR_PARENTID
));
// We only need to backup the files in the final pdf area, and the readonly page images - the others can be regenerated.
$subpluginelementfiles
->
annotate_files
(
'assignfeedback_editpdfplus'
,
\
assignfeedback_editpdfplus\document_services
::
FINAL_PDF_FILEAREA
,
'gradeid'
);
$subpluginelementfiles
->
annotate_files
(
'assignfeedback_editpdfplus'
,
\
assignfeedback_editpdfplus\document_services
::
PAGE_IMAGE_READONLY_FILEAREA
,
'gradeid'
);
$subpluginelementfiles
->
annotate_files
(
'assignfeedback_editpdfplus'
,
'stamps'
,
'gradeid'
);
return
$subplugin
;
}
}
backup/moodle2/restore_assignfeedback_editpdfplus_subplugin.class.php
0 → 100755
View file @
9e4edd46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains the restore code for the feedback_editpdfplus plugin.
*
* @package assignfeedback_editpdfplus
* @copyright 2013 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined
(
'MOODLE_INTERNAL'
)
||
die
();
/**
* Restore subplugin class.
*
* Provides the necessary information needed
* to restore one assign_feedback subplugin.
*
* @package assignfeedback_editpdfplus
* @copyright 2013 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class
restore_assignfeedback_editpdfplus_subplugin
extends
restore_subplugin
{
/**
* Returns the paths to be handled by the subplugin at assignment level
* @return array
*/
protected
function
define_grade_subplugin_structure
()
{
$paths
=
array
();
// We used get_recommended_name() so this works.
// The files node is a placeholder just containing gradeid so we can restore files once per grade.
$elename
=
$this
->
get_namefor
(
'files'
);
$elepath
=
$this
->
get_pathfor
(
'/feedback_editpdfplus_files'
);
$paths
[]
=
new
restore_path_element
(
$elename
,
$elepath
);
// Now we have the list of comments and annotations per grade.
$elename
=
$this
->
get_namefor
(
'comment'
);
$elepath
=
$this
->
get_pathfor
(
'/feedback_editpdfplus_comments/comment'
);
$paths
[]
=
new
restore_path_element
(
$elename
,
$elepath
);
$elename
=
$this
->
get_namefor
(
'annotation'
);
$elepath
=
$this
->
get_pathfor
(
'/feedback_editpdfplus_annotations/annotation'
);
$paths
[]
=
new
restore_path_element
(
$elename
,
$elepath
);
return
$paths
;
}
/**
* Processes one feedback_editpdfplus_files element
* @param mixed $data
*/
public
function
process_assignfeedback_editpdfplus_files
(
$data
)
{
$data
=
(
object
)
$data
;
// In this case the id is the old gradeid which will be mapped.
$this
->
add_related_files
(
'assignfeedback_editpdfplus'
,
\
assignfeedback_editpdfplus\document_services
::
FINAL_PDF_FILEAREA
,
'grade'
,
null
,
$data
->
gradeid
);
$this
->
add_related_files
(
'assignfeedback_editpdfplus'
,
\
assignfeedback_editpdfplus\document_services
::
PAGE_IMAGE_READONLY_FILEAREA
,
'grade'
,
null
,
$data
->
gradeid
);
$this
->
add_related_files
(
'assignfeedback_editpdfplus'
,
'stamps'
,
'grade'
,
null
,
$data
->
gradeid
);
}
/**
* Processes one feedback_editpdfplus_annotations/annotation element
* @param mixed $data
*/
public
function
process_assignfeedback_editpdfplus_annotation
(
$data
)
{
global
$DB
;
$data
=
(
object
)
$data
;
$oldgradeid
=
$data
->
gradeid
;
// The mapping is set in the restore for the core assign activity
// when a grade node is processed.
$data
->
gradeid
=
$this
->
get_mappingid
(
'grade'
,
$data
->
gradeid
);
$DB
->
insert_record
(
'assignfeedback_editpp_annot'
,
$data
);
}
/**
* Processes one feedback_editpdfplus_comments/comment element
* @param mixed $data
*/
public
function
process_assignfeedback_editpdfplus_comment
(
$data
)
{
global
$DB
;
$data
=
(
object
)
$data
;
$oldgradeid
=
$data
->
gradeid
;
// The mapping is set in the restore for the core assign activity
// when a grade node is processed.
$data
->
gradeid
=
$this
->
get_mappingid
(
'grade'
,
$data
->
gradeid
);
$DB
->
insert_record
(
'assignfeedback_editpp_cmnt'
,
$data
);
}
}
classes/annotation.php
0 → 100755
View file @
9e4edd46
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of