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
b92a7bff
Commit
b92a7bff
authored
Jun 08, 2018
by
M. Chardon
Browse files
correction curseur fct de l'outil
parent
49bc6e52
Changes
4
Hide whitespace changes
Inline
Side-by-side
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-debug.js
View file @
b92a7bff
...
...
@@ -5015,7 +5015,7 @@ EDITOR.prototype = {
* @method refresh_button_state
*/
refresh_button_state
:
function
()
{
var
currenttoolnode
,
drawingregion
;
var
currenttoolnode
,
drawingregion
,
drawingcanvas
;
this
.
refresh_button_color_state
();
...
...
@@ -5030,6 +5030,21 @@ EDITOR.prototype = {
}
drawingregion
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGREGION
);
drawingregion
.
setAttribute
(
'
data-currenttool
'
,
this
.
currentedit
.
tool
);
drawingcanvas
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGCANVAS
);
switch
(
this
.
currentedit
.
tool
)
{
case
'
drag
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
move
'
);
break
;
case
'
highlight
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
text
'
);
break
;
case
'
select
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
default
'
);
break
;
default
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
},
/**
...
...
@@ -5662,9 +5677,6 @@ EDITOR.prototype = {
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
drawingregion
.
setStyle
(
'
cursor
'
,
'
move
'
);
}
if
(
tool
!==
"
select
"
)
{
...
...
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-min.js
View file @
b92a7bff
...
...
@@ -8,8 +8,8 @@ this.divcartridge+"_edit"),s=this.editor.get_dialogue_element("#"+this.divcartri
.
editor
.
get
(
"
readonly
"
)){
var
f
=
0
;
this
.
displayrotation
>
0
&&
(
f
=
1
);
var
l
=
e
.
Node
.
create
(
"
<input type='hidden' id='
"
+
this
.
divcartridge
+
"
_rotation' value=
"
+
f
+
"
/>
"
);
a
.
append
(
l
);
var
c
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonrotation' class='btn btn-sm btn-outline-dark' type='button'>
"
+
'
<i class="fa fa-refresh" aria-hidden="true"></i>
'
+
"
</button>
"
,
h
=
e
.
Node
.
create
(
c
);
h
.
on
(
"
click
"
,
this
.
change_stamp
,
this
),
a
.
append
(
h
)}
u
.
append
(
a
),
t
.
append
(
u
);
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
p
=
this
.
get_div_edition
();
u
.
append
(
p
)}
else
{
var
d
=
this
.
get_div_visu
(
i
);
u
.
append
(
d
)}
if
(
!
this
.
cartridgex
||
this
.
cartridgex
===
0
)
this
.
cartridgex
=
parseInt
(
this
.
tooltypefamille
.
cartridge_x
,
10
);
if
(
!
this
.
cartridgey
||
this
.
cartridgey
===
0
)
this
.
cartridgey
=
parseInt
(
this
.
tooltypefamille
.
cartridge_y
,
10
);
t
.
setX
(
this
.
x
+
this
.
cartridgex
),
t
.
setY
(
this
.
y
+
this
.
cartridgey
),
r
.
append
(
t
),
this
.
apply_visibility_annot
()}
else
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
),
t
.
setX
(
n
[
0
]
+
this
.
x
+
this
.
cartridgex
),
t
.
setY
(
n
[
1
]
+
this
.
y
+
this
.
cartridgey
);
return
!
0
},
change_stamp
:
function
(){
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_rotation
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
shape_id
+
"
_img
"
);
e
.
get
(
"
value
"
)
===
"
0
"
?(
this
.
displayrotation
=
1
,
e
.
set
(
"
value
"
,
1
),
t
.
removeClass
(
"
fa-arrows-h
"
),
t
.
addClass
(
"
fa-arrows-v
"
)):(
e
.
set
(
"
value
"
,
0
),
t
.
removeClass
(
"
fa-arrows-v
"
),
t
.
addClass
(
"
fa-arrows-h
"
),
this
.
displayrotation
=
0
),
this
.
editor
.
save_current_page
()},
move
:
function
(
e
,
t
){
var
n
=
e
-
this
.
x
,
r
=
t
-
this
.
y
;
this
.
x
+=
n
,
this
.
y
+=
r
,
this
.
endx
+=
n
,
this
.
endy
+=
r
,
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
drawables
.
push
(
this
.
draw
())},
remove
:
function
(
e
){
var
t
,
n
;
e
.
preventDefault
(),
t
=
this
.
editor
.
pages
[
this
.
editor
.
currentpage
].
annotations
;
for
(
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
]
===
this
){
if
(
this
.
divcartridge
!==
""
){
var
r
=
"
#
"
+
this
.
divcartridge
,
i
=
this
.
editor
.
get_dialogue_element
(
r
);
i
.
remove
()}
t
.
splice
(
n
,
1
),
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
currentannotation
=!
1
,
this
.
editor
.
save_current_page
();
return
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
annotationstampcomment
=
k
;
var
L
=
function
(
e
){
L
.
superclass
.
constructor
.
apply
(
this
,[
e
])};
L
.
NAME
=
"
annotationframe
"
,
L
.
ATTRS
=
{},
e
.
extend
(
L
,
M
.
assignfeedback_editpdfplus
.
annotation
,{
children
:[],
oldx
:
0
,
oldy
:
0
,
draw
:
function
(){
var
t
,
n
,
r
,
i
;
return
t
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
r
=
new
M
.
assignfeedback_editpdfplus
.
rect
,
r
.
bound
([
new
M
.
assignfeedback_editpdfplus
.
point
(
this
.
x
,
this
.
y
),
new
M
.
assignfeedback_editpdfplus
.
point
(
this
.
endx
,
this
.
endy
)]),
i
=
this
.
get_color
(),
this
.
shape_id
=
"
ct_frame_
"
+
(
new
Date
).
toJSON
().
replace
(
/:/g
,
""
).
replace
(
/
\.
/g
,
""
),
n
=
this
.
editor
.
graphic
.
addShape
({
id
:
this
.
shape_id
,
type
:
e
.
Rect
,
width
:
r
.
width
,
height
:
r
.
height
,
stroke
:{
weight
:
2
,
color
:
this
.
get_color
()},
x
:
r
.
x
,
y
:
r
.
y
}),
this
.
parent_annot_element
&&
n
.
addClass
(
"
class_
"
+
this
.
parent_annot_element
.
divcartridge
),
this
.
borderstyle
===
"
dashed
"
?
n
.
set
(
"
stroke
"
,{
dashstyle
:[
5
,
3
]}):
this
.
borderstyle
===
"
dotted
"
&&
n
.
set
(
"
stroke
"
,{
dashstyle
:[
2
,
2
]}),
t
.
shapes
.
push
(
n
),
this
.
drawable
=
t
,
this
.
draw_catridge
(),
L
.
superclass
.
draw
.
apply
(
this
)},
draw_current_edit
:
function
(
t
){
var
n
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
r
,
i
,
s
;
return
i
=
new
M
.
assignfeedback_editpdfplus
.
rect
,
i
.
bound
([
new
M
.
assignfeedback_editpdfplus
.
point
(
t
.
start
.
x
,
t
.
start
.
y
),
new
M
.
assignfeedback_editpdfplus
.
point
(
t
.
end
.
x
,
t
.
end
.
y
)]),
i
.
has_min_width
()
||
i
.
set_min_width
(),
s
=
this
.
get_color
(),
r
=
this
.
editor
.
graphic
.
addShape
({
type
:
e
.
Rect
,
width
:
i
.
width
,
height
:
16
,
stroke
:{
weight
:
2
,
color
:
this
.
get_color
()},
x
:
i
.
x
,
y
:
t
.
start
.
y
-
8
}),
this
.
parent_annot_element
&&
r
.
addClass
(
"
class_
"
+
this
.
parent_annot_element
.
divcartridge
),
this
.
borderstyle
===
"
dashed
"
?
r
.
set
(
"
stroke
"
,{
dashstyle
:[
5
,
3
]}):
this
.
borderstyle
===
"
dotted
"
&&
r
.
set
(
"
stroke
"
,{
dashstyle
:[
2
,
2
]}),
n
.
shapes
.
push
(
r
),
n
},
init_from_edit
:
function
(
e
){
var
t
=
new
M
.
assignfeedback_editpdfplus
.
rect
;
return
t
.
bound
([
e
.
start
,
e
.
end
]),
this
.
gradeid
=
this
.
editor
.
get
(
"
gradeid
"
),
this
.
pageno
=
this
.
editor
.
currentpage
,
this
.
x
=
t
.
x
,
this
.
y
=
e
.
start
.
y
-
8
,
this
.
endx
=
t
.
x
+
t
.
width
,
this
.
endy
=
e
.
start
.
y
+
16
-
8
,
this
.
page
=
""
,
t
.
has_min_width
()},
move
:
function
(
e
,
t
){
var
n
=
e
-
this
.
x
,
r
=
t
-
this
.
y
;
this
.
x
+=
n
,
this
.
y
+=
r
,
this
.
endx
+=
n
,
this
.
endy
+=
r
,
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
drawables
.
push
(
this
.
draw
())},
get_color
:
function
(){
return
this
.
colour
},
draw_catridge
:
function
(){
if
(
this
.
parent_annot_element
===
null
&&
this
.
parent_annot
===
0
){
var
t
,
n
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
).
getXY
();
if
(
this
.
divcartridge
===
""
){
this
.
init_div_cartridge_id
();
var
r
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
i
=
this
.
editor
.
graphic
.
getShapeById
(
this
.
shape_id
);
i
&&
i
.
addClass
(
"
class_
"
+
this
.
divcartridge
);
var
o
=
this
.
get_color
();
t
=
this
.
get_div_cartridge
(
o
),
t
.
addClass
(
"
assignfeedback_editpdfplus_frame
"
),
t
.
setStyles
({
"
border-style
"
:
this
.
borderstyle
});
var
u
=
this
.
get_div_cartridge_label
(
o
,
!
0
);
t
.
append
(
u
);
var
a
=
this
.
get_div_container
(
o
),
f
=
this
.
get_toolbar
();
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
l
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonpencil' class='btn btn-sm btn-outline-dark' type='button'>
"
;
l
+=
'
<i class="fa fa-eyedropper" aria-hidden="true"></i>
'
,
l
+=
"
</button>
"
;
var
c
=
e
.
Node
.
create
(
l
);
c
.
on
(
"
click
"
,
this
.
display_picker
,
this
);
var
h
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonadd' class='btn btn-sm btn-outline-dark' type='button'>
"
;
h
+=
'
<i class="fa fa-plus" aria-hidden="true"></i>
'
,
h
+=
"
</button>
"
;
var
p
=
e
.
Node
.
create
(
h
);
p
.
on
(
"
click
"
,
this
.
add_annot
,
this
),
f
.
append
(
c
),
f
.
append
(
p
)}
a
.
append
(
f
),
t
.
append
(
a
);
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
d
=
this
.
get_div_edition
();
a
.
append
(
d
)}
else
{
var
v
=
this
.
get_div_visu
(
o
);
a
.
append
(
v
)}
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
m
=
"
margin:5px;border:2px #ccc
"
,
g
=
"
min-width:20px;min-height:20px;
"
,
y
=
"
<div
"
;
y
+=
"
id='
"
+
this
.
divcartridge
+
"
_picker'
"
,
y
+=
"
class='assignfeedback_editpdfplus_frame_picker'
"
,
y
+=
"
style='display:none;text-align:right;'>
"
,
y
+=
"
</div>
"
;
var
b
=
e
.
Node
.
create
(
y
);
a
.
append
(
b
);
var
w
=
e
.
Node
.
create
(
"
<div style='display:inline-block;vertical-align:top;'></div>
"
),
E
=
e
.
Node
.
create
(
"
<div style='display:inline-block;vertical-align:top;'></div>
"
);
b
.
append
(
w
),
b
.
append
(
E
);
var
S
=
e
.
Node
.
create
(
"
<div style='background-color:white;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
S
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
white
"
);
var
x
=
e
.
Node
.
create
(
"
<div style='background-color:#E69F00;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
x
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
#E69F00
"
);
var
T
=
e
.
Node
.
create
(
"
<div style='background-color:#D55E00;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
T
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
#D55E00
"
);
var
N
=
e
.
Node
.
create
(
"
<div style='background-color:#009E73;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
N
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
#009E73
"
);
var
C
=
e
.
Node
.
create
(
"
<div style='background-color:#0072B2;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
C
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
#0072B2
"
);
var
k
=
e
.
Node
.
create
(
"
<div style='background-color:black;
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
k
.
on
(
"
click
"
,
this
.
change_color
,
this
,
"
black
"
),
w
.
append
(
S
),
w
.
append
(
x
),
w
.
append
(
T
),
w
.
append
(
N
),
w
.
append
(
C
),
w
.
append
(
k
);
var
L
=
e
.
Node
.
create
(
"
<div style='
"
+
m
+
"
solid;
"
+
g
+
"
'></div>
"
);
L
.
on
(
"
click
"
,
this
.
change_border
,
this
,
"
solid
"
);
var
A
=
e
.
Node
.
create
(
"
<div style='
"
+
m
+
"
dotted;
"
+
g
+
"
'></div>
"
);
A
.
on
(
"
click
"
,
this
.
change_border
,
this
,
"
dotted
"
);
var
O
=
"
<div style='
"
+
m
+
"
dashed;
"
+
g
+
"
'>
"
+
"
</div>
"
,
M
=
e
.
Node
.
create
(
O
);
M
.
on
(
"
click
"
,
this
.
change_border
,
this
,
"
dashed
"
),
E
.
append
(
L
),
E
.
append
(
A
),
E
.
append
(
M
)}
if
(
!
this
.
cartridgex
||
this
.
cartridgex
===
0
)
this
.
cartridgex
=
parseInt
(
this
.
tooltypefamille
.
cartridge_x
,
10
);
if
(
!
this
.
cartridgey
||
this
.
cartridgey
===
0
)
this
.
cartridgey
=
parseInt
(
this
.
tooltypefamille
.
cartridge_y
,
10
);
t
.
setX
(
this
.
cartridgex
),
t
.
setY
(
this
.
y
+
this
.
cartridgey
),
r
.
append
(
t
),
this
.
apply_visibility_annot
();
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
_
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_right
"
),
D
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_left
"
);
_
.
hide
(),
D
.
hide
()}}
else
{
var
P
=
"
#
"
+
this
.
divcartridge
;
t
=
this
.
editor
.
get_dialogue_element
(
P
),
t
.
setX
(
n
[
0
]
+
this
.
cartridgex
),
t
.
setY
(
n
[
1
]
+
this
.
y
+
this
.
cartridgey
)}}
return
!
0
},
move_cartridge_continue
:
function
(
e
){
e
.
preventDefault
();
var
t
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
clientX
+
t
.
get
(
"
docScrollX
"
),
e
.
clientY
+
t
.
get
(
"
docScrollY
"
)),
r
=
this
.
editor
.
get_canvas_coordinates
(
n
),
i
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
).
getXY
(),
o
=
r
.
x
-
this
.
oldx
,
u
=
r
.
y
-
this
.
oldy
,
a
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
);
a
.
setX
(
i
[
0
]
+
this
.
cartridgex
+
o
),
a
.
setY
(
i
[
1
]
+
this
.
y
+
this
.
cartridgey
+
u
)},
move_cartridge_stop
:
function
(
e
){
e
.
preventDefault
();
var
t
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
);
t
.
detach
(
"
mousemove
"
,
this
.
move_cartridge_continue
,
this
),
t
.
detach
(
"
mouseup
"
,
this
.
move_cartridge_stop
,
this
);
var
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
clientX
+
t
.
get
(
"
docScrollX
"
),
e
.
clientY
+
t
.
get
(
"
docScrollY
"
)),
r
=
this
.
editor
.
get_canvas_coordinates
(
n
),
i
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
).
getXY
(),
o
=
r
.
x
-
this
.
oldx
,
u
=
r
.
y
-
this
.
oldy
;
this
.
cartridgex
+=
o
,
this
.
cartridgey
+=
u
;
var
a
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
);
a
.
setX
(
i
[
0
]
+
this
.
cartridgex
),
a
.
setY
(
i
[
1
]
+
this
.
y
+
this
.
cartridgey
),
this
.
editor
.
save_current_page
()},
add_annot
:
function
(
e
){
this
.
editor
.
currentedit
.
parent_annot_element
=
this
,
this
.
editor
.
handle_tool_button
(
e
,
h
.
FRAME
,
"
ctbutton
"
+
this
.
toolid
,
1
)},
display_picker
:
function
(){
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_picker
"
),
n
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonpencil
"
);
e
.
setStyle
(
"
z-index
"
,
1
e3
),
t
.
show
(),
n
.
on
(
"
click
"
,
this
.
hide_picker
,
this
)},
hide_picker
:
function
(){
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_picker
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonpencil
"
),
n
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
);
e
.
hide
(),
n
.
setStyle
(
"
z-index
"
,
0
),
t
.
on
(
"
click
"
,
this
.
display_picker
,
this
)},
change_color
:
function
(
e
,
t
){
this
.
colour
=
t
;
var
n
=
this
.
editor
.
graphic
.
getShapeById
(
this
.
shape_id
);
n
.
set
(
"
stroke
"
,{
color
:
this
.
colour
});
var
r
=
null
;
this
.
id
?
r
=
this
.
editor
.
annotationsparent
[
this
.
id
]:
r
=
this
.
editor
.
annotationsparent
[
this
.
divcartridge
];
if
(
r
)
for
(
var
i
=
0
;
i
<
r
.
length
;
i
++
){
r
[
i
].
colour
=
t
;
var
s
=
this
.
editor
.
graphic
.
getShapeById
(
r
[
i
].
shape_id
);
s
&&
s
.
set
(
"
stroke
"
,{
color
:
this
.
colour
})}
var
o
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
);
o
.
setStyles
({
"
border-color
"
:
this
.
colour
,
color
:
this
.
colour
});
var
u
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_cartridge
"
);
u
.
setStyles
({
"
border-color
"
:
this
.
colour
,
color
:
this
.
colour
});
var
a
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_display
"
);
a
.
setStyles
({
color
:
this
.
colour
}),
this
.
hide_picker
(),
this
.
editor
.
save_current_page
()},
change_border
:
function
(
e
,
t
){
this
.
borderstyle
=
t
;
var
n
=
this
.
editor
.
graphic
.
getShapeById
(
this
.
shape_id
);
this
.
borderstyle
===
"
solid
"
?
n
.
set
(
"
stroke
"
,{
dashstyle
:
"
none
"
}):
this
.
borderstyle
===
"
dashed
"
?
n
.
set
(
"
stroke
"
,{
dashstyle
:[
5
,
3
]}):
n
.
set
(
"
stroke
"
,{
dashstyle
:[
2
,
2
]});
var
r
=
[];
this
.
id
?
r
=
this
.
editor
.
annotationsparent
[
this
.
id
]:
r
=
this
.
editor
.
annotationsparent
[
this
.
divcartridge
];
if
(
r
)
for
(
var
i
=
0
;
i
<
r
.
length
;
i
++
){
r
[
i
].
borderstyle
=
t
;
var
s
=
this
.
editor
.
graphic
.
getShapeById
(
r
[
i
].
shape_id
);
s
&&
(
this
.
borderstyle
===
"
solid
"
?
s
.
set
(
"
stroke
"
,{
dashstyle
:
"
none
"
}):
this
.
borderstyle
===
"
dashed
"
?
s
.
set
(
"
stroke
"
,{
dashstyle
:[
5
,
3
]}):
s
.
set
(
"
stroke
"
,{
dashstyle
:[
2
,
2
]}))}
var
o
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
);
o
.
setStyles
({
"
border-style
"
:
this
.
borderstyle
});
var
u
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_picker
"
);
u
.
hide
(),
this
.
editor
.
save_current_page
()},
edit_annot
:
function
(){
if
(
!
this
.
parent_annot_element
){
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonpencil
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonadd
"
);
this
.
hide_picker
(),
e
&&
(
e
.
hide
(),
t
.
hide
()),
L
.
superclass
.
edit_annot
.
call
(
this
)}},
hide_edit
:
function
(){
L
.
superclass
.
hide_edit
.
call
(
this
);
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_display
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonpencil
"
),
n
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonadd
"
),
r
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_right
"
),
i
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_left
"
);
e
&&
(
e
.
set
(
"
style
"
,
"
display:inline;color:
"
+
this
.
get_color
()
+
"
;
"
),
t
&&
(
t
.
show
(),
n
.
show
()),
r
&&
r
.
hide
(),
i
&&
i
.
hide
())},
remove
:
function
(
e
){
var
t
;
e
.
preventDefault
(),
t
=
this
.
editor
.
pages
[
this
.
editor
.
currentpage
].
annotations
;
for
(
var
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
]
===
this
){
if
(
this
.
divcartridge
!==
""
){
var
r
=
"
#
"
+
this
.
divcartridge
,
i
=
this
.
editor
.
get_dialogue_element
(
r
);
i
.
remove
()}
t
.
splice
(
n
,
1
),
this
.
drawable
&&
this
.
drawable
.
erase
();
var
s
=
[];
this
.
id
?
s
=
this
.
editor
.
annotationsparent
[
this
.
id
]:
s
=
this
.
editor
.
annotationsparent
[
this
.
divcartridge
];
if
(
s
)
for
(
var
o
=
0
;
o
<
s
.
length
;
o
++
)
for
(
var
u
=
0
;
u
<
t
.
length
;
u
++
)
t
[
u
]
===
s
[
o
]
&&
(
t
.
splice
(
u
,
1
),
s
[
o
].
drawable
&&
s
[
o
].
drawable
.
erase
());
this
.
editor
.
currentannotation
=!
1
,
this
.
editor
.
save_current_page
();
return
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
annotationframe
=
L
;
var
A
=
function
(
e
){
A
.
superclass
.
constructor
.
apply
(
this
,[
e
])};
A
.
NAME
=
"
annotationverticalline
"
,
A
.
ATTRS
=
{},
e
.
extend
(
A
,
M
.
assignfeedback_editpdfplus
.
annotation
,{
draw
:
function
(){
var
t
,
n
,
r
;
return
t
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
r
=
this
.
get_color
(),
n
=
this
.
editor
.
graphic
.
addShape
({
type
:
e
.
Path
,
fill
:
!
1
,
stroke
:{
weight
:
p
,
color
:
r
}}),
n
.
moveTo
(
this
.
x
,
this
.
y
),
this
.
endy
-
this
.
y
<=
30
&&
(
this
.
endy
=
this
.
y
+
30
),
n
.
lineTo
(
this
.
x
,
this
.
endy
),
n
.
end
(),
t
.
shapes
.
push
(
n
),
this
.
drawable
=
t
,
this
.
draw_catridge
(),
A
.
superclass
.
draw
.
apply
(
this
)},
draw_current_edit
:
function
(
t
){
var
n
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
r
,
i
,
s
;
return
i
=
new
M
.
assignfeedback_editpdfplus
.
rect
,
i
.
bound
([
new
M
.
assignfeedback_editpdfplus
.
point
(
t
.
start
.
x
,
t
.
start
.
y
),
new
M
.
assignfeedback_editpdfplus
.
point
(
t
.
end
.
x
,
t
.
end
.
y
)]),
i
.
has_min_width
()
||
i
.
set_min_width
(),
i
.
has_min_height
()
||
i
.
set_min_height
(),
s
=
this
.
get_color
(),
r
=
this
.
editor
.
graphic
.
addShape
({
type
:
e
.
Path
,
fill
:
!
1
,
stroke
:{
weight
:
p
,
color
:
s
}}),
r
.
moveTo
(
t
.
start
.
x
,
t
.
start
.
y
),
t
.
end
.
y
-
t
.
start
.
y
<=
30
?
r
.
lineTo
(
t
.
start
.
x
,
t
.
start
.
y
+
30
):
r
.
lineTo
(
t
.
start
.
x
,
t
.
end
.
y
),
r
.
end
(),
n
.
shapes
.
push
(
r
),
n
},
init_from_edit
:
function
(
e
){
return
this
.
gradeid
=
this
.
editor
.
get
(
"
gradeid
"
),
this
.
pageno
=
this
.
editor
.
currentpage
,
this
.
x
=
e
.
start
.
x
,
this
.
y
=
e
.
start
.
y
,
this
.
endx
=
e
.
end
.
x
+
4
,
e
.
end
.
y
-
this
.
y
<=
30
?
this
.
endy
=
this
.
y
+
30
:
this
.
endy
=
e
.
end
.
y
,
this
.
page
=
""
,
this
.
endx
-
this
.
x
!==
0
||
this
.
endy
-
this
.
y
!==
0
},
draw_catridge
:
function
(){
var
e
,
t
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
).
getXY
();
if
(
this
.
divcartridge
===
""
){
this
.
init_div_cartridge_id
();
var
n
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
this
.
get_color_cartridge
();
e
=
this
.
get_div_cartridge
(
r
),
e
.
addClass
(
"
assignfeedback_editpdfplus_verticalline
"
);
var
i
=
this
.
get_div_cartridge_label
(
r
,
!
0
);
e
.
append
(
i
);
var
o
=
this
.
get_div_container
(
r
),
u
=
this
.
get_toolbar
();
o
.
append
(
u
),
e
.
append
(
o
);
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
a
=
this
.
get_div_edition
();
o
.
append
(
a
)}
else
{
var
f
=
this
.
get_div_visu
(
r
);
o
.
append
(
f
)}
if
(
!
this
.
cartridgex
||
this
.
cartridgex
===
0
)
this
.
cartridgex
=
parseInt
(
this
.
tooltypefamille
.
cartridge_x
,
10
);
if
(
!
this
.
cartridgey
||
this
.
cartridgey
===
0
)
this
.
cartridgey
=
parseInt
(
this
.
tooltypefamille
.
cartridge_y
,
10
);
e
.
setX
(
this
.
x
+
this
.
cartridgex
),
e
.
setY
(
this
.
y
+
this
.
cartridgey
),
n
.
append
(
e
),
this
.
apply_visibility_annot
()}
else
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
),
e
.
setX
(
t
[
0
]
+
this
.
x
+
this
.
cartridgex
),
e
.
setY
(
t
[
1
]
+
this
.
y
+
this
.
cartridgey
);
return
!
0
},
remove
:
function
(
e
){
var
t
,
n
;
e
.
preventDefault
(),
t
=
this
.
editor
.
pages
[
this
.
editor
.
currentpage
].
annotations
;
for
(
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
]
===
this
){
if
(
this
.
divcartridge
!==
""
){
var
r
=
"
#
"
+
this
.
divcartridge
,
i
=
this
.
editor
.
get_dialogue_element
(
r
);
i
.
remove
()}
t
.
splice
(
n
,
1
),
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
currentannotation
=!
1
,
this
.
editor
.
save_current_page
();
return
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
annotationverticalline
=
A
;
var
O
=
function
(
e
){
O
.
superclass
.
constructor
.
apply
(
this
,[
e
])};
O
.
NAME
=
"
annotationcommentplus
"
,
O
.
ATTRS
=
{},
e
.
extend
(
O
,
M
.
assignfeedback_editpdfplus
.
annotation
,{
draw
:
function
(){
var
t
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
n
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
,
i
;
i
=
this
.
editor
.
get_window_coordinates
(
new
M
.
assignfeedback_editpdfplus
.
point
(
this
.
x
,
this
.
y
));
var
o
=
this
.
get_color_cartridge
();
return
r
=
e
.
Node
.
create
(
'
<div><i class="fa fa-commenting" aria-hidden="true" style="color:
'
+
o
+
'
;"></i></div>
'
),
r
.
setStyles
({
position
:
"
absolute
"
,
display
:
"
inline-block
"
,
zIndex
:
50
,
color
:
this
.
colour
,
padding
:
"
0 2px
"
}),
n
.
append
(
r
),
r
.
setX
(
i
.
x
),
r
.
setY
(
i
.
y
),
t
.
store_position
(
r
,
i
.
x
,
i
.
y
),
t
.
nodes
.
push
(
r
),
this
.
drawable
=
t
,
this
.
draw_catridge
(),
O
.
superclass
.
draw
.
apply
(
this
)},
draw_current_edit
:
function
(
t
){
var
n
=
new
M
.
assignfeedback_editpdfplus
.
rect
,
r
=
new
M
.
assignfeedback_editpdfplus
.
drawable
(
this
.
editor
),
i
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
o
,
u
;
return
n
.
bound
([
t
.
start
,
t
.
end
]),
u
=
this
.
editor
.
get_window_coordinates
(
new
M
.
assignfeedback_editpdfplus
.
point
(
n
.
x
,
n
.
y
)),
o
=
e
.
Node
.
create
(
"
<div>
"
+
this
.
tooltype
.
label
+
"
</div>
"
),
o
.
setStyles
({
position
:
"
absolute
"
,
display
:
"
inline-block
"
,
zIndex
:
50
,
color
:
this
.
colour
,
padding
:
"
0 2px
"
}),
i
.
append
(
o
),
o
.
setX
(
u
.
x
),
o
.
setY
(
u
.
y
),
r
.
store_position
(
o
,
u
.
x
,
u
.
y
),
r
.
nodes
.
push
(
o
),
r
},
init_from_edit
:
function
(
e
){
var
t
=
new
M
.
assignfeedback_editpdfplus
.
rect
;
return
t
.
bound
([
e
.
start
,
e
.
end
]),
t
.
width
<
20
&&
(
t
.
width
=
20
),
t
.
height
<
20
&&
(
t
.
height
=
20
),
this
.
gradeid
=
this
.
editor
.
get
(
"
gradeid
"
),
this
.
pageno
=
this
.
editor
.
currentpage
,
this
.
x
=
t
.
x
-
20
,
this
.
y
=
t
.
y
-
10
,
this
.
endx
=
t
.
x
+
t
.
width
,
this
.
endy
=
t
.
y
+
t
.
height
,
!
0
},
draw_catridge
:
function
(){
var
e
,
t
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
).
getXY
();
if
(
this
.
divcartridge
===
""
){
this
.
init_div_cartridge_id
();
var
n
=
this
.
editor
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
this
.
get_color_cartridge
();
e
=
this
.
get_div_cartridge
(
r
),
e
.
addClass
(
"
assignfeedback_editpdfplus_commentplus
"
);
var
i
=
this
.
get_div_cartridge_label
(
r
);
e
.
append
(
i
);
var
o
=
this
.
get_div_container
(
r
),
u
=
this
.
get_toolbar
();
o
.
append
(
u
),
e
.
append
(
o
);
if
(
!
this
.
editor
.
get
(
"
readonly
"
)){
var
a
=
this
.
get_div_edition
();
o
.
append
(
a
)}
else
{
var
f
=
this
.
get_div_visu
(
r
);
o
.
append
(
f
)}
e
.
setX
(
this
.
x
+
20
),
e
.
setY
(
this
.
y
),
n
.
append
(
e
),
this
.
apply_visibility_annot
()}
else
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
),
e
.
setX
(
t
[
0
]
+
this
.
x
+
20
),
e
.
setY
(
t
[
1
]
+
this
.
y
);
return
!
0
},
apply_visibility_annot
:
function
(){
O
.
superclass
.
apply_visibility_annot
.
apply
(
this
);
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_display
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_onof
"
),
n
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_right
"
),
r
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_left
"
);
n
&&
(
n
.
setHTML
(
'
<i class="fa fa-arrow-down" aria-hidden="true"></i>
'
),
r
.
setHTML
(
'
<i class="fa fa-arrow-up" aria-hidden="true"></i>
'
),
t
.
get
(
"
value
"
)
===
"
2
"
?
e
.
setContent
(
"
<table><tr><td>
"
+
this
.
get_text_to_diplay_in_cartridge
().
replace
(
/
\n
/g
,
"
<br/>
"
)
+
"
</td></tr></table><br/>
"
):
t
.
get
(
"
value
"
)
===
"
1
"
?
r
.
setHTML
(
'
<i class="fa fa-arrow-left" aria-hidden="true"></i>
'
):
t
.
get
(
"
value
"
)
===
"
0
"
&&
n
.
setHTML
(
'
<i class="fa fa-arrow-right" aria-hidden="true"></i>
'
))},
move
:
function
(
e
,
t
){
var
n
=
e
-
this
.
x
,
r
=
t
-
this
.
y
;
this
.
x
+=
n
,
this
.
y
+=
r
,
this
.
endx
+=
n
,
this
.
endy
+=
r
,
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
drawables
.
push
(
this
.
draw
())},
remove
:
function
(
e
){
var
t
,
n
;
e
.
preventDefault
(),
t
=
this
.
editor
.
pages
[
this
.
editor
.
currentpage
].
annotations
;
for
(
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
]
===
this
){
if
(
this
.
divcartridge
!==
""
){
var
r
=
"
#
"
+
this
.
divcartridge
,
i
=
this
.
editor
.
get_dialogue_element
(
r
);
i
.
remove
()}
t
.
splice
(
n
,
1
),
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
currentannotation
=!
1
,
this
.
editor
.
save_current_page
();
return
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
annotationcommentplus
=
O
;
var
_
=
"
Dropdown menu
"
,
D
;
D
=
function
(
e
){
e
.
draggable
=!
1
,
e
.
centered
=!
1
,
e
.
width
=
"
auto
"
,
e
.
visible
=!
1
,
e
.
footerContent
=
""
,
D
.
superclass
.
constructor
.
apply
(
this
,[
e
])},
e
.
extend
(
D
,
M
.
core
.
dialogue
,{
initializer
:
function
(
t
){
var
n
,
r
,
i
,
s
;
D
.
superclass
.
initializer
.
call
(
this
,
t
),
s
=
this
.
get
(
"
boundingBox
"
),
s
.
addClass
(
"
assignfeedback_editpdfplus_dropdown
"
),
n
=
this
.
get
(
"
buttonNode
"
),
r
=
this
.
bodyNode
,
i
=
e
.
Node
.
create
(
"
<h3/>
"
),
i
.
addClass
(
"
accesshide
"
),
i
.
setHTML
(
this
.
get
(
"
headerText
"
)),
r
.
prepend
(
i
),
r
.
on
(
"
clickoutside
"
,
function
(
e
){
this
.
get
(
"
visible
"
)
&&
e
.
target
.
get
(
"
id
"
)
!==
n
.
get
(
"
id
"
)
&&
e
.
target
.
ancestor
().
get
(
"
id
"
)
!==
n
.
get
(
"
id
"
)
&&
(
e
.
preventDefault
(),
this
.
hide
())},
this
),
n
.
on
(
"
click
"
,
function
(
e
){
e
.
preventDefault
(),
this
.
show
()},
this
),
n
.
on
(
"
key
"
,
this
.
show
,
"
enter,space
"
,
this
)},
show
:
function
(){
var
t
=
this
.
get
(
"
buttonNode
"
),
n
=
D
.
superclass
.
show
.
call
(
this
);
return
this
.
align
(
t
,[
e
.
WidgetPositionAlign
.
TL
,
e
.
WidgetPositionAlign
.
BL
]),
n
}},{
NAME
:
_
,
ATTRS
:{
headerText
:{
value
:
""
},
buttonNode
:{
value
:
null
}}}),
e
.
Base
.
modifyAttrs
(
D
,{
modal
:{
getter
:
function
(){
return
!
1
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
dropdown
=
D
;
var
P
=
"
Colourpicker
"
,
H
;
H
=
function
(
e
){
H
.
superclass
.
constructor
.
apply
(
this
,[
e
])},
e
.
extend
(
H
,
M
.
assignfeedback_editpdfplus
.
dropdown
,{
initializer
:
function
(
t
){
var
n
=
e
.
Node
.
create
(
'
<ul role="menu" class="assignfeedback_editpdfplus_menu"/>
'
),
r
,
i
;
e
.
each
(
this
.
get
(
"
colours
"
),
function
(
t
,
r
){
var
s
,
o
,
u
;
u
=
M
.
util
.
get_string
(
r
,
"
assignfeedback_editpdfplus
"
),
r
===
"
white
"
||
r
===
"
yellowlemon
"
?
i
=
e
.
Node
.
create
(
'
<span class="fa-stack fa-lg"><i class="fa fa-square fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x fa-inverse" aria-hidden="true" style="color:
'
+
t
+
'
;">
'
+
"
</i>
"
+
"
</span>
"
):
i
=
e
.
Node
.
create
(
'
<span class="fa-stack fa-lg"><i class="fa fa-square-o fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x" aria-hidden="true" style="color:
'
+
t
+
'
;">
'
+
"
</i>
"
+
"
</span>
"
),
i
.
setAttribute
(
"
data-colour
"
,
r
),
s
=
e
.
Node
.
create
(
'
<button class="btn btn-sm" type="button"></button>
'
),
s
.
append
(
i
),
s
.
setAttribute
(
"
data-colour
"
,
r
),
s
.
setAttribute
(
"
data-rgb
"
,
t
),
s
.
setStyle
(
"
backgroundImage
"
,
"
none
"
),
o
=
e
.
Node
.
create
(
"
<li/>
"
),
o
.
append
(
s
),
n
.
append
(
o
)},
this
),
r
=
e
.
Node
.
create
(
"
<div/>
"
),
n
.
delegate
(
"
click
"
,
this
.
callback_handler
,
"
button
"
,
this
),
n
.
delegate
(
"
key
"
,
this
.
callback_handler
,
"
down:13
"
,
"
button
"
,
this
),
this
.
set
(
"
headerText
"
,
M
.
util
.
get_string
(
"
colourpicker
"
,
"
assignfeedback_editpdfplus
"
)),
r
.
append
(
n
),
this
.
set
(
"
bodyContent
"
,
r
),
H
.
superclass
.
initializer
.
call
(
this
,
t
)},
callback_handler
:
function
(
t
){
t
.
preventDefault
();
var
n
=
this
.
get
(
"
callback
"
),
r
=
this
.
get
(
"
context
"
),
i
;
this
.
hide
(),
i
=
e
.
bind
(
n
,
r
,
t
),
i
()}},{
NAME
:
P
,
ATTRS
:{
colours
:{
value
:{}},
callback
:{
value
:
null
},
context
:{
value
:
null
},
iconprefix
:{
value
:
"
colour_
"
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
colourpicker
=
H
;
var
B
=
function
(){
B
.
superclass
.
constructor
.
apply
(
this
,
arguments
)};
B
.
prototype
=
{
dialogue
:
null
,
panel
:
null
,
pagecount
:
0
,
currentpage
:
0
,
pages
:[],
documentstatus
:
0
,
loadingicon
:
null
,
pageimage
:
null
,
graphic
:
null
,
currentedit
:
new
M
.
assignfeedback_editpdfplus
.
edit
,
currentdrawable
:
!
1
,
drawables
:[],
drawablesannotations
:[],
currentannotation
:
null
,
lastannotation
:
null
,
lastannotationtool
:
null
,
annotationsparent
:[],
studentstatut
:
-
1
,
questionstatut
:
-
1
,
currentannotationreview
:
null
,
initializer
:
function
(){
var
t
;
t
=
e
.
one
(
"
#
"
+
this
.
get
(
"
linkid
"
)),
t
&&
(
t
.
on
(
"
click
"
,
this
.
link_handler
,
this
),
t
.
on
(
"
key
"
,
this
.
link_handler
,
"
down:13
"
,
this
),
require
([
"
mod_assign/grading_review_panel
"
],
function
(
n
){
var
r
=
new
n
,
i
=
r
.
getReviewPanel
(
"
assignfeedback_editpdfplus
"
);
i
&&
(
i
=
e
.
one
(
i
),
i
.
empty
(),
t
.
ancestor
(
"
.fitem
"
).
hide
(),
this
.
open_in_panel
(
i
)),
this
.
currentedit
.
start
=!
1
,
this
.
currentedit
.
end
=!
1
}.
bind
(
this
)))},
refresh_button_state
:
function
(){
var
e
,
t
;
this
.
refresh_button_color_state
(),
this
.
currentedit
.
id
?
e
=
this
.
get_dialogue_element
(
"
#
"
+
this
.
currentedit
.
id
):
e
=
this
.
get_dialogue_element
(
l
[
this
.
currentedit
.
tool
]),
e
&&
(
e
.
addClass
(
"
active
"
),
e
.
setAttribute
(
"
aria-pressed
"
,
"
true
"
)),
t
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
t
.
setAttribute
(
"
data-currenttool
"
,
this
.
currentedit
.
tool
)
},
refresh_button_color_state
:
function
(){
var
e
;
e
=
this
.
get_dialogue_element
(
s
.
ANNOTATIONCOLOURBUTTON
);
if
(
this
.
currentedit
.
annotationcolour
===
"
white
"
)
e
.
one
(
"
i
"
)
.
setStyle
(
"
c
ol
or
"
,
this
.
currentedit
.
annotationcolour
),
e
.
setStyle
(
"
background-color
"
,
"
#EEEEEE
"
);
else
{
switch
(
this
.
currentedit
.
annotationcolour
){
case
"
yellowlemon
"
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
"
#fff44f
"
);
break
;
case
"
yellow
"
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
"
rgb(255,207,53)
"
);
break
;
default
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
this
.
currentedit
.
annotationcolour
)}
e
.
setStyle
(
"
background-color
"
,
""
)}},
get_canvas_bounds
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
t
=
e
.
getXY
(),
n
=
t
[
0
],
r
=
t
[
1
],
i
=
parseInt
(
e
.
getStyle
(
"
width
"
),
10
),
o
=
parseInt
(
e
.
getStyle
(
"
height
"
),
10
);
return
new
M
.
assignfeedback_editpdfplus
.
rect
(
n
,
r
,
i
,
o
)},
get_canvas_coordinates
:
function
(
e
){
var
t
=
this
.
get_canvas_bounds
(),
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
x
-
t
.
x
,
e
.
y
-
t
.
y
);
return
t
.
x
=
t
.
y
=
0
,
n
.
clip
(
t
),
n
},
get_window_coordinates
:
function
(
e
){
var
t
=
this
.
get_canvas_bounds
(),
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
x
+
t
.
x
,
e
.
y
+
t
.
y
);
return
n
},
open_in_panel
:
function
(
t
){
var
n
,
r
;
this
.
panel
=
t
,
t
.
append
(
this
.
get
(
"
body
"
)),
t
.
addClass
(
i
.
DIALOGUE
),
this
.
loadingicon
=
this
.
get_dialogue_element
(
s
.
LOADINGICON
),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
this
.
graphic
=
new
e
.
Graphic
({
render
:
n
}),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
r
.
on
(
"
scroll
"
,
this
.
move_canvas
,
this
),
this
.
get
(
"
readonly
"
)
||
(
n
.
on
(
"
gesturemovestart
"
,
this
.
edit_start
,
null
,
this
),
n
.
on
(
"
gesturemove
"
,
this
.
edit_move
,
null
,
this
),
n
.
on
(
"
gesturemoveend
"
,
this
.
edit_end
,
null
,
this
),
this
.
refresh_button_state
()),
this
.
start_generation
()},
link_handler
:
function
(
t
){
var
n
,
r
,
o
=!
0
;
t
.
preventDefault
(),
this
.
dialogue
||
(
this
.
dialogue
=
new
M
.
core
.
dialogue
({
headerContent
:
this
.
get
(
"
header
"
),
bodyContent
:
this
.
get
(
"
body
"
),
footerContent
:
this
.
get
(
"
footer
"
),
modal
:
!
0
,
width
:
"
840px
"
,
visible
:
!
1
,
draggable
:
!
0
}),
this
.
dialogue
.
get
(
"
boundingBox
"
).
addClass
(
i
.
DIALOGUE
),
this
.
loadingicon
=
this
.
get_dialogue_element
(
s
.
LOADINGICON
),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
this
.
graphic
=
new
e
.
Graphic
({
render
:
n
}),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
r
.
on
(
"
scroll
"
,
this
.
move_canvas
,
this
),
this
.
get
(
"
readonly
"
)
||
(
n
.
on
(
"
gesturemovestart
"
,
this
.
edit_start
,
null
,
this
),
n
.
on
(
"
gesturemove
"
,
this
.
edit_move
,
null
,
this
),
n
.
on
(
"
gesturemoveend
"
,
this
.
edit_end
,
null
,
this
),
this
.
refresh_button_state
()),
this
.
start_generation
(),
n
.
on
(
"
windowresize
"
,
this
.
resize
,
this
),
o
=!
1
),
this
.
dialogue
.
centerDialogue
(),
this
.
dialogue
.
show
(),
this
.
dialogue
.
dd
.
on
(
"
drag:end
"
,
this
.
redraw
,
this
),
o
&&
this
.
resize
()},
start_generation
:
function
(){
this
.
poll_document_conversion_status
()},
poll_document_conversion_status
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
e
.
io
(
n
,{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
pollconversions
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
readonly
:
this
.
get
(
"
readonly
"
)?
1
:
0
},
on
:{
success
:
function
(
t
,
n
){
var
r
=
this
.
handle_response_data
(
n
),
i
=!
1
;
if
(
r
){
this
.
documentstatus
=
r
.
status
;
if
(
r
.
status
===
0
)
i
=!
0
;
else
if
(
r
.
status
===
1
)
i
=!
0
;
else
if
(
r
.
status
===
2
||
r
.
status
===-
1
)
this
.
pagecount
=
r
.
pagecount
,
r
.
pageready
===
r
.
pagecount
?
this
.
prepare_pages_for_display
(
r
):(
this
.
update_page_load_progress
(),
this
.
start_document_to_image_conversion
());
i
&&
e
.
later
(
1
e3
,
this
,
this
.
poll_document_conversion_status
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}})},
start_document_to_image_conversion
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
e
.
io
(
n
,{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
pollconversions
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
readonly
:
this
.
get
(
"
readonly
"
)?
1
:
0
},
on
:{
success
:
function
(
e
,
t
){
var
n
=
this
.
handle_response_data
(
t
);
n
&&
(
this
.
documentstatus
=
n
.
status
,
n
.
status
===
2
&&
this
.
prepare_pages_for_display
(
n
))},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}})},
prepare_pages_for_display
:
function
(
e
){
var
t
,
n
,
r
;
if
(
!
e
.
pagecount
){
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
r
=
new
M
.
core
.
alert
({
message
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
)}),
r
.
show
();
return
}
this
.
pagecount
=
e
.
pagecount
,
this
.
pages
=
e
.
pages
,
this
.
tools
=
[];
for
(
t
=
0
;
t
<
e
.
tools
.
length
;
t
++
){
var
i
=
e
.
tools
[
t
];
this
.
tools
[
i
.
id
]
=
i
}
this
.
typetools
=
[];
for
(
t
=
0
;
t
<
e
.
typetools
.
length
;
t
++
){
var
s
=
e
.
typetools
[
t
];
this
.
typetools
[
s
.
id
]
=
s
}
this
.
axis
=
[];
for
(
t
=
0
;
t
<
e
.
axis
.
length
;
t
++
){
var
o
=
e
.
axis
[
t
];
o
.
visibility
=!
0
,
this
.
axis
[
o
.
id
]
=
o
}
for
(
t
=
0
;
t
<
this
.
pages
.
length
;
t
++
){
var
u
=
[];
for
(
n
=
0
;
n
<
this
.
pages
[
t
].
annotations
.
length
;
n
++
){
e
=
this
.
pages
[
t
].
annotations
[
n
],
e
.
parent_annot
&&
parseInt
(
e
.
parent_annot
,
10
)
!==
0
&&
(
e
.
parent_annot_element
=
u
[
e
.
parent_annot
]);
var
a
=
e
.
toolid
,
f
=
this
.
create_annotation
(
this
.
typetools
[
this
.
tools
[
a
].
type
].
label
,
a
,
e
,
this
.
tools
[
a
]);
if
(
f
.
parent_annot_element
){
var
l
=
f
.
parent_annot_element
.
id
;
this
.
annotationsparent
[
l
]?
this
.
annotationsparent
[
l
][
this
.
annotationsparent
[
l
].
length
]
=
f
:
this
.
annotationsparent
[
l
]
=
[
f
]}
u
[
e
.
id
]
=
f
,
this
.
pages
[
t
].
annotations
[
n
]
=
f
}}
this
.
setup_navigation
(),
this
.
setup_toolbar
(),
this
.
change_page
()},
update_page_load_progress
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
,
n
=
0
,
i
=
this
.
get_dialogue_element
(
s
.
PROGRESSBARCONTAINER
+
"
.bar
"
);
if
(
!
i
)
return
;
t
=
{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
conversionstatus
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
)},
on
:{
success
:
function
(
i
,
o
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
n
=
0
;
var
u
=
0
,
a
=
this
.
get_dialogue_element
(
s
.
PROGRESSBARCONTAINER
+
"
.bar
"
);
a
&&
(
u
=
o
.
response
/
this
.
pagecount
*
100
,
a
.
setStyle
(
"
width
"
,
u
+
"
%
"
),
a
.
ancestor
(
s
.
PROGRESSBARCONTAINER
).
setAttribute
(
"
aria-valuenow
"
,
u
),
u
<
100
&&
(
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})))},
failure
:
function
(
i
,
s
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
return
n
+=
1
,
this
.
pagecount
===
0
&&
n
<
5
&&
(
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})),
new
M
.
core
.
exception
(
s
.
responseText
)}}},
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
n
=
0
,
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})},
handle_response_data
:
function
(
t
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
n
;
try
{
n
=
e
.
JSON
.
parse
(
t
.
responseText
);
if
(
!
n
.
error
)
return
n
;
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
new
M
.
core
.
alert
({
message
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
),
visible
:
!
0
})}
catch
(
r
){
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
new
M
.
core
.
alert
({
title
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
),
visible
:
!
0
})}
return
},
handle_axis_button
:
function
(
e
,
t
,
n
){
t
.
visibility
=
n
.
get
(
"
checked
"
),
this
.
redraw
()},
setup_toolbar
:
function
(){
var
t
,
n
,
r
;
if
(
this
.
get
(
"
readonly
"
)){
for
(
var
i
in
this
.
axis
){
var
o
=
this
.
axis
[
i
],
u
=
this
.
get_dialogue_element
(
"
#ctaxis
"
+
o
.
id
);
u
&&
(
u
.
set
(
"
checked
"
,
"
true
"
),
u
.
on
(
"
click
"
,
this
.
handle_axis_button
,
this
,
o
,
u
))}
var
f
=
this
.
get_dialogue_element
(
s
.
QUESTIONSELECTOR
);
f
&&
f
.
on
(
"
change
"
,
this
.
update_visu_annotation_q
,
this
);
var
c
=
this
.
get_dialogue_element
(
s
.
STATUTSELECTOR
);
c
&&
c
.
on
(
"
change
"
,
this
.
update_visu_annotation
,
this
);
var
h
=
this
.
get_dialogue_element
(
s
.
STUDENTVALIDATION
);
h
&&
h
.
on
(
"
click
"
,
this
.
update_student_feedback
,
this
);
return
}
var
p
=
this
.
get_dialogue_element
(
s
.
CUSTOMTOOLBARID
+
"
1
"
);
p
&&
p
.
show
();
var
d
=
this
.
get_dialogue_element
(
s
.
AXISCUSTOMTOOLBAR
);
d
&&
d
.
on
(
"
change
"
,
this
.
update_custom_toolbars
,
this
),
this
.
update_custom_toolbars
(),
e
.
all
(
s
.
CUSTOMTOOLBARBUTTONS
).
each
(
function
(
e
){
var
t
=
e
.
get
(
"
id
"
),
n
=
e
.
getAttribute
(
"
data-tool
"
);
e
.
on
(
"
click
"
,
this
.
handle_tool_button
,
this
,
n
,
t
),
e
.
on
(
"
key
"
,
this
.
handle_tool_button
,
"
down:13
"
,
this
,
n
,
t
),
e
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
)},
this
),
e
.
each
(
l
,
function
(
e
,
n
){
t
=
this
.
get_dialogue_element
(
e
),
t
.
on
(
"
click
"
,
this
.
handle_tool_button
,
this
,
n
),
t
.
on
(
"
key
"
,
this
.
handle_tool_button
,
"
down:13
"
,
this
,
n
),
t
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
)},
this
),
n
=
this
.
get_dialogue_element
(
s
.
ANNOTATIONCOLOURBUTTON
),
r
=
new
M
.
assignfeedback_editpdfplus
.
colourpicker
({
buttonNode
:
n
,
iconprefix
:
"
colour_
"
,
colours
:
a
,
callback
:
function
(
e
){
var
t
=
e
.
target
.
getAttribute
(
"
data-colour
"
);
t
||
(
t
=
e
.
target
.
ancestor
().
getAttribute
(
"
data-colour
"
)),
this
.
currentedit
.
annotationcolour
=
t
,
this
.
refresh_button_color_state
()},
context
:
this
})},
update_student_feedback
:
function
(){
this
.
refresh_pdf
()},
update_visu_annotation_q
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
QUESTIONSELECTOR
+
"
option:checked
"
),
t
=
parseInt
(
e
.
get
(
"
value
"
),
10
)
-
1
;
this
.
questionstatut
=
t
,
this
.
redraw
()},
update_visu_annotation
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
STATUTSELECTOR
+
"
option:checked
"
),
t
=
parseInt
(
e
.
get
(
"
value
"
),
10
)
-
1
;
this
.
studentstatut
=
t
,
this
.
redraw
()},
update_custom_toolbars
:
function
(){
e
.
all
(
s
.
CUSTOMTOOLBARS
).
each
(
function
(
e
){
e
.
hide
()},
this
);
var
t
=
this
.
get_dialogue_element
(
s
.
AXISCUSTOMTOOLBAR
+
"
option:checked
"
),
n
=
parseInt
(
t
.
get
(
"
value
"
),
10
),
r
=
this
.
get_dialogue_element
(
s
.
CUSTOMTOOLBARID
+
""
+
n
);
r
.
show
()},
handle_tool_button
:
function
(
e
,
t
,
n
,
r
){
e
.
preventDefault
(),
this
.
handle_tool_button_action
(
t
,
n
,
r
)},
handle_tool_button_action
:
function
(
e
,
t
,
n
){
var
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
i
;
this
.
currentedit
.
id
?
i
=
this
.
get_dialogue_element
(
"
#
"
+
this
.
currentedit
.
id
):
i
=
this
.
get_dialogue_element
(
l
[
this
.
currentedit
.
tool
]),
i
&&
(
i
.
removeClass
(
"
active
"
),
i
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
),
r
.
setStyle
(
"
cursor
"
,
"
auto
"
)),
this
.
currentedit
.
tool
=
e
,
this
.
currentedit
.
id
=
t
,
e
!==
"
select
"
&&
e
!==
"
drag
"
?
(
this
.
lastannotationtool
=
e
,
r
.
setStyle
(
"
cursor
"
,
"
crosshair
"
)):
e
===
"
drag
"
&&
r
.
setStyle
(
"
cursor
"
,
"
move
"
),
e
!==
"
select
"
&&
this
.
redraw_annotation
(),
n
||
(
this
.
currentedit
.
parent_annot_element
=
null
),
this
.
refresh_button_state
()},
redraw_annotation
:
function
(){
this
.
currentannotation
=
null
;
var
t
=
this
.
pages
[
this
.
currentpage
].
annotations
;
e
.
each
(
t
,
function
(
e
){
e
&&
e
.
drawable
&&
(
e
.
drawable
.
erase
(),
e
.
draw
())})},
stringify_current_page
:
function
(){
var
t
=
[],
n
,
r
=
0
;
for
(
r
=
0
;
r
<
this
.
pages
[
this
.
currentpage
].
annotations
.
length
;
r
++
)
t
[
r
]
=
this
.
pages
[
this
.
currentpage
].
annotations
[
r
].
clean
();
return
n
=
{
annotations
:
t
},
e
.
JSON
.
stringify
(
n
)},
stringify_current_page_edited
:
function
(){
var
t
=
[],
n
,
r
=
0
;
for
(
r
=
0
;
r
<
this
.
pages
[
this
.
currentpage
].
annotations
.
length
;
r
++
)
t
[
r
]
=
this
.
pages
[
this
.
currentpage
].
annotations
[
r
].
light_clean
();
return
n
=
{
annotations
:
t
},
e
.
JSON
.
stringify
(
n
)},
get_current_drawable
:
function
(){
var
e
,
t
=!
1
;
if
(
!
this
.
currentedit
.
start
||!
this
.
currentedit
.
end
)
return
!
1
;
if
(
this
.
currentedit
.
tool
!==
"
comment
"
){
var
n
=
this
.
currentedit
.
id
;
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
"
c
"
&&
(
n
=
this
.
currentedit
.
id
.
substr
(
8
)),
e
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,{},
this
.
tools
[
n
]),
e
&&
(
t
=
e
.
draw_current_edit
(
this
.
currentedit
))}
return
t
},
get_dialogue_element
:
function
(
e
){
return
this
.
panel
?
this
.
panel
.
one
(
e
):
this
.
dialogue
.
get
(
"
boundingBox
"
).
one
(
e
)},
redraw_current_edit
:
function
(){
this
.
currentdrawable
&&
this
.
currentdrawable
.
erase
(),
this
.
currentdrawable
=
this
.
get_current_drawable
()},
edit_start
:
function
(
t
){
var
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
n
.
getXY
(),
i
=
n
.
get
(
"
docScrollY
"
),
o
=
n
.
get
(
"
docScrollX
"
),
u
=
{
x
:
t
.
clientX
-
r
[
0
]
+
o
,
y
:
t
.
clientY
-
r
[
1
]
+
i
},
a
=!
1
;
if
(
t
.
button
===
3
)
return
;
if
(
this
.
currentedit
.
starttime
)
return
;
this
.
currentedit
.
starttime
=
(
new
Date
).
getTime
(),
this
.
currentedit
.
start
=
u
,
this
.
currentedit
.
end
=
{
x
:
u
.
x
,
y
:
u
.
y
};
if
(
this
.
currentedit
.
tool
===
"
select
"
){
var
f
=
this
.
currentedit
.
end
.
x
,
l
=
this
.
currentedit
.
end
.
y
,
c
=
this
.
pages
[
this
.
currentpage
].
annotations
;
e
.
each
(
c
,
function
(
e
){(
f
-
e
.
x
)
*
(
f
-
e
.
endx
)
<=
0
&&
(
l
-
e
.
y
)
*
(
l
-
e
.
endy
)
<=
0
&&
(
a
=
e
)}),
a
?(
this
.
lastannotation
=
this
.
currentannotation
,
this
.
currentannotation
=
a
,
this
.
lastannotation
&&
this
.
lastannotation
!==
a
&&
this
.
lastannotation
.
drawable
&&
(
this
.
lastannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
lastannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
lastannotation
)),
this
.
currentannotation
.
drawable
&&
this
.
currentannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
currentannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
currentannotation
)):(
this
.
lastannotation
=
this
.
currentannotation
,
this
.
currentannotation
=
null
,
this
.
lastannotation
&&
this
.
lastannotation
.
drawable
&&
(
this
.
lastannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
lastannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
lastannotation
)))}
this
.
currentannotation
&&
(
this
.
currentedit
.
annotationstart
=
{
x
:
this
.
currentannotation
.
x
,
y
:
this
.
currentannotation
.
y
})},
edit_move
:
function
(
e
){
e
.
preventDefault
();
var
t
=
this
.
get_canvas_bounds
(),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
i
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
clientX
+
n
.
get
(
"
docScrollX
"
),
e
.
clientY
+
n
.
get
(
"
docScrollY
"
)),
o
=
this
.
get_canvas_coordinates
(
i
),
u
,
a
;
if
(
o
.
x
<
0
||
o
.
x
>
t
.
width
||
o
.
y
<
0
||
o
.
y
>
t
.
height
)
return
;
this
.
currentedit
.
tool
===
"
pen
"
&&
this
.
currentedit
.
path
.
push
(
o
),
this
.
currentedit
.
tool
===
"
select
"
?
this
.
currentannotation
&&
this
.
currentedit
&&
this
.
currentannotation
.
move
(
this
.
currentedit
.
annotationstart
.
x
+
o
.
x
-
this
.
currentedit
.
start
.
x
,
this
.
currentedit
.
annotationstart
.
y
+
o
.
y
-
this
.
currentedit
.
start
.
y
):
this
.
currentedit
.
tool
===
"
drag
"
?(
u
=
o
.
x
-
this
.
currentedit
.
start
.
x
,
a
=
o
.
y
-
this
.
currentedit
.
start
.
y
,
r
.
getDOMNode
().
scrollLeft
-=
u
,
r
.
getDOMNode
().
scrollTop
-=
a
):
this
.
currentedit
.
start
&&
(
this
.
currentedit
.
end
=
o
,
this
.
redraw_current_edit
())},
edit_end
:
function
(){
var
e
,
t
;
e
=
(
new
Date
).
getTime
()
-
this
.
currentedit
.
start
;
if
(
e
<
f
||
this
.
currentedit
.
start
===!
1
)
return
;
var
n
=
this
.
currentedit
.
id
;
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
"
c
"
&&
(
n
=
this
.
currentedit
.
id
.
substr
(
8
)),
t
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,{},
this
.
tools
[
n
]);
if
(
t
){
this
.
currentdrawable
&&
this
.
currentdrawable
.
erase
(),
this
.
currentdrawable
=!
1
;
if
(
t
.
init_from_edit
(
this
.
currentedit
)){
this
.
currentannotation
=
t
,
t
.
draw_catridge
(
this
.
currentedit
),
t
.
edit_annot
();
if
(
t
.
parent_annot_element
){
var
r
=
0
;
t
.
parent_annot_element
.
id
?
r
=
t
.
parent_annot_element
.
id
:
r
=
t
.
parent_annot_element
.
divcartridge
,
this
.
annotationsparent
[
r
]?
this
.
annotationsparent
[
r
][
this
.
annotationsparent
[
r
].
length
]
=
t
:
this
.
annotationsparent
[
r
]
=
[
t
]}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
t
),
this
.
drawables
.
push
(
t
.
draw
()),
this
.
drawablesannotations
.
push
(
t
)}}
this
.
save_current_page
(),
this
.
currentedit
.
starttime
=
0
,
this
.
currentedit
.
start
=!
1
,
this
.
currentedit
.
end
=!
1
,
this
.
currentedit
.
path
=
[],
this
.
currentedit
.
tool
!==
"
drag
"
&&
this
.
handle_tool_button_action
(
"
select
"
)},
resize
:
function
(){
var
t
,
n
;
if
(
this
.
dialogue
){
if
(
!
this
.
dialogue
.
get
(
"
visible
"
))
return
;
this
.
dialogue
.
centerDialogue
()}
return
n
=
e
.
one
(
"
body
"
).
get
(
"
winHeight
"
)
-
120
,
n
<
100
&&
(
n
=
100
),
t
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
this
.
dialogue
&&
t
.
setStyle
(
"
maxHeight
"
,
n
+
"
px
"
),
this
.
redraw
(),
!
0
},
create_annotation
:
function
(
e
,
t
,
n
,
r
){
!
e
||
typeof
e
==
"
undefined
"
||
typeof
t
!=
"
undefined
"
&&
t
!==
null
?
t
!==
null
&&
t
[
0
]
===
"
c
"
&&
(
n
.
toolid
=
t
.
substr
(
8
)):(
e
===
"
line
"
?
n
.
toolid
=
c
.
LINE
:
e
===
"
rectangle
"
?
n
.
toolid
=
c
.
RECTANGLE
:
e
===
"
oval
"
?
n
.
toolid
=
c
.
OVAL
:
e
===
"
pen
"
?
n
.
toolid
=
c
.
PEN
:
e
===
"
highlight
"
&&
(
n
.
toolid
=
c
.
HIGHLIGHT
),
n
.
tooltype
=
this
.
tools
[
n
.
toolid
]);
if
(
!
n
.
tooltype
||
n
.
tooltype
===
""
)
n
.
tooltype
=
r
;
return
n
.
tool
=
e
,
n
.
editor
=
this
,
n
.
tool
===
c
.
LINE
+
""
||
n
.
tool
===
h
.
LINE
?
new
M
.
assignfeedback_editpdfplus
.
annotationline
(
n
):
n
.
tool
===
c
.
RECTANGLE
+
""
||
n
.
tool
===
h
.
RECTANGLE
?
new
M
.
assignfeedback_editpdfplus
.
annotationrectangle
(
n
):
n
.
tool
===
c
.
OVAL
+
""
||
n
.
tool
===
h
.
OVAL
?
new
M
.
assignfeedback_editpdfplus
.
annotationoval
(
n
):
n
.
tool
===
c
.
PEN
+
""
||
n
.
tool
===
h
.
PEN
?
new
M
.
assignfeedback_editpdfplus
.
annotationpen
(
n
):
n
.
tool
===
c
.
HIGHLIGHT
+
""
||
n
.
tool
===
h
.
HIGHLIGHT
?
new
M
.
assignfeedback_editpdfplus
.
annotationhighlight
(
n
):
n
.
tool
===
c
.
FRAME
+
""
||
n
.
tool
===
h
.
FRAME
?(
r
&&
n
.
colour
===
""
&&
(
n
.
colour
=
this
.
typetools
[
r
.
type
].
color
),
!
n
.
parent_annot
&&!
n
.
parent_annot_element
&&
(
this
.
currentedit
.
parent_annot_element
?
n
.
parent_annot_element
=
this
.
currentedit
.
parent_annot_element
:(
n
.
parent_annot_element
=
null
,
n
.
parent_annot
=
0
)),
new
M
.
assignfeedback_editpdfplus
.
annotationframe
(
n
)):(
r
&&
(
r
.
colors
&&
r
.
colors
.
indexOf
(
"
,
"
)
!==-
1
?
n
.
colour
=
r
.
colors
.
substr
(
0
,
r
.
colors
.
indexOf
(
"
,
"
)):
n
.
colour
=
r
.
colors
,
n
.
colour
===
""
&&
(
n
.
colour
=
this
.
typetools
[
r
.
type
].
color
)),
n
.
tool
===
c
.
HIGHLIGHTPLUS
+
""
||
n
.
tool
===
h
.
HIGHLIGHTPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationhighlightplus
(
n
):
n
.
tool
===
c
.
STAMPPLUS
+
""
||
n
.
tool
===
h
.
STAMPPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationstampplus
(
n
):
n
.
tool
===
c
.
VERTICALLINE
+
""
||
n
.
tool
===
h
.
VERTICALLINE
?
new
M
.
assignfeedback_editpdfplus
.
annotationverticalline
(
n
):
n
.
tool
===
c
.
STAMPCOMMENT
+
""
||
n
.
tool
===
h
.
STAMPCOMMENT
?
new
M
.
assignfeedback_editpdfplus
.
annotationstampcomment
(
n
):
n
.
tool
===
c
.
COMMENTPLUS
+
""
||
n
.
tool
===
h
.
COMMENTPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationcommentplus
(
n
):
!
1
)},
refresh_pdf
:
function
(){
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
generatepdf
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
refresh
:
!
0
},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
save_current_page
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
savepage
"
,
index
:
this
.
currentpage
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
page
:
this
.
stringify_current_page
()},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
save_current_page_edited
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
updatestudentview
"
,
index
:
this
.
currentpage
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
page
:
this
.
stringify_current_page_edited
()},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
redraw
:
function
(){
var
t
,
n
,
r
;
r
=
this
.
pages
[
this
.
currentpage
];
if
(
r
===
undefined
)
return
;
while
(
this
.
drawables
.
length
>
0
)
this
.
drawables
.
pop
().
erase
();
while
(
this
.
drawablesannotations
.
length
>
0
){
n
=
this
.
drawablesannotations
.
pop
();
if
(
n
.
divcartridge
){
var
i
=
e
.
one
(
"
#
"
+
n
.
divcartridge
);
i
&&
i
.
remove
(),
n
.
divcartridge
=
""
}
n
.
drawable
&&
n
.
drawable
.
erase
()}
for
(
t
=
0
;
t
<
r
.
annotations
.
length
;
t
++
){
n
=
r
.
annotations
[
t
];
var
s
=
n
.
tooltype
;
if
(
this
.
get
(
"
readonly
"
)
&&
s
.
axis
&&
(
this
.
axis
[
s
.
axis
]
&&
this
.
axis
[
s
.
axis
].
visibility
||
s
.
axis
===
"
0
"
)
&&
(
this
.
studentstatut
<
0
||
this
.
studentstatut
===
n
.
studentstatus
)
&&
(
this
.
questionstatut
<
0
||
this
.
questionstatut
===
n
.
answerrequested
)
||!
this
.
get
(
"
readonly
"
))
this
.
drawables
.
push
(
n
.
draw
()),
this
.
drawablesannotations
.
push
(
n
)}},
change_page
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
t
,
n
,
r
;
n
=
this
.
get_dialogue_element
(
s
.
PREVIOUSBUTTON
),
r
=
this
.
get_dialogue_element
(
s
.
NEXTBUTTON
),
this
.
currentpage
>
0
?
n
.
removeAttribute
(
"
disabled
"
):
n
.
setAttribute
(
"
disabled
"
,
"
true
"
),
this
.
currentpage
<
this
.
pagecount
-
1
?
r
.
removeAttribute
(
"
disabled
"
):
r
.
setAttribute
(
"
disabled
"
,
"
true
"
),
t
=
this
.
pages
[
this
.
currentpage
],
this
.
loadingicon
.
hide
(),
e
.
setStyle
(
"
backgroundImage
"
,
'
url("
'
+
t
.
url
+
'
")
'
),
e
.
setStyle
(
"
width
"
,
t
.
width
+
"
px
"
),
e
.
setStyle
(
"
height
"
,
t
.
height
+
"
px
"
),
this
.
get_dialogue_element
(
s
.
PAGESELECT
).
set
(
"
selectedIndex
"
,
this
.
currentpage
),
this
.
resize
()},
setup_navigation
:
function
(){
var
t
,
n
,
r
,
i
,
o
,
u
;
t
=
this
.
get_dialogue_element
(
s
.
PAGESELECT
);
var
a
=
t
.
all
(
"
option
"
);
if
(
a
.
size
()
<=
1
)
for
(
n
=
0
;
n
<
this
.
pages
.
length
;
n
++
)
i
=
e
.
Node
.
create
(
"
<option/>
"
),
i
.
setAttribute
(
"
value
"
,
n
),
r
=
{
page
:
n
+
1
,
total
:
this
.
pages
.
length
},
i
.
setHTML
(
M
.
util
.
get_string
(
"
pagexofy
"
,
"
assignfeedback_editpdfplus
"
,
r
)),
t
.
append
(
i
);
t
.
removeAttribute
(
"
disabled
"
),
t
.
on
(
"
change
"
,
function
(){
this
.
currentpage
=
t
.
get
(
"
value
"
),
this
.
change_page
()},
this
),
o
=
this
.
get_dialogue_element
(
s
.
PREVIOUSBUTTON
),
u
=
this
.
get_dialogue_element
(
s
.
NEXTBUTTON
),
o
.
on
(
"
click
"
,
this
.
previous_page
,
this
),
o
.
on
(
"
key
"
,
this
.
previous_page
,
"
down:13
"
,
this
),
u
.
on
(
"
click
"
,
this
.
next_page
,
this
),
u
.
on
(
"
key
"
,
this
.
next_page
,
"
down:13
"
,
this
)},
previous_page
:
function
(
e
){
e
.
preventDefault
(),
this
.
currentpage
--
,
this
.
currentpage
<
0
&&
(
this
.
currentpage
=
0
),
this
.
change_page
()},
next_page
:
function
(
e
){
e
.
preventDefault
(),
this
.
currentpage
++
,
this
.
currentpage
>=
this
.
pages
.
length
&&
(
this
.
currentpage
=
this
.
pages
.
length
-
1
),
this
.
change_page
()},
move_canvas
:
function
(){
var
e
,
t
,
n
,
r
;
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
t
=
parseInt
(
e
.
get
(
"
scrollLeft
"
),
10
),
n
=
parseInt
(
e
.
get
(
"
scrollTop
"
),
10
);
for
(
r
=
0
;
r
<
this
.
drawables
.
length
;
r
++
)
this
.
drawables
[
r
].
scroll_update
(
t
,
n
)}},
e
.
extend
(
B
,
e
.
Base
,
B
.
prototype
,{
NAME
:
"
moodle-assignfeedback_editpdfplus-editor
"
,
ATTRS
:{
userid
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
assignmentid
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
attemptnumber
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
header
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
body
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
footer
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
linkid
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
deletelinkid
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
readonly
:{
validator
:
e
.
Lang
.
isBoolean
,
value
:
!
0
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
editor
=
M
.
assignfeedback_editpdfplus
.
editor
||
{},
M
.
assignfeedback_editpdfplus
.
editor
.
init
=
M
.
assignfeedback_editpdfplus
.
editor
.
init
||
function
(
e
){
return
typeof
M
.
assignfeedback_editpdfplus
.
instance
!=
"
undefined
"
&&
M
.
assignfeedback_editpdfplus
.
instance
.
destroy
(),
M
.
assignfeedback_editpdfplus
.
instance
=
new
B
(
e
),
M
.
assignfeedback_editpdfplus
.
instance
}},
"
@VERSION@
"
,{
requires
:[
"
base
"
,
"
event
"
,
"
node
"
,
"
io
"
,
"
graphics
"
,
"
json
"
,
"
event-move
"
,
"
event-resize
"
,
"
transition
"
,
"
querystring-stringify-simple
"
,
"
moodle-core-notification-dialog
"
,
"
moodle-core-notification-alert
"
,
"
moodle-core-notification-exception
"
,
"
moodle-core-notification-ajaxexception
"
]});
(
this
.
x
+
20
),
e
.
setY
(
this
.
y
),
n
.
append
(
e
),
this
.
apply_visibility_annot
()}
else
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
),
e
.
setX
(
t
[
0
]
+
this
.
x
+
20
),
e
.
setY
(
t
[
1
]
+
this
.
y
);
return
!
0
},
apply_visibility_annot
:
function
(){
O
.
superclass
.
apply_visibility_annot
.
apply
(
this
);
var
e
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_display
"
),
t
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_onof
"
),
n
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_right
"
),
r
=
this
.
editor
.
get_dialogue_element
(
"
#
"
+
this
.
divcartridge
+
"
_buttonedit_left
"
);
n
&&
(
n
.
setHTML
(
'
<i class="fa fa-arrow-down" aria-hidden="true"></i>
'
),
r
.
setHTML
(
'
<i class="fa fa-arrow-up" aria-hidden="true"></i>
'
),
t
.
get
(
"
value
"
)
===
"
2
"
?
e
.
setContent
(
"
<table><tr><td>
"
+
this
.
get_text_to_diplay_in_cartridge
().
replace
(
/
\n
/g
,
"
<br/>
"
)
+
"
</td></tr></table><br/>
"
):
t
.
get
(
"
value
"
)
===
"
1
"
?
r
.
setHTML
(
'
<i class="fa fa-arrow-left" aria-hidden="true"></i>
'
):
t
.
get
(
"
value
"
)
===
"
0
"
&&
n
.
setHTML
(
'
<i class="fa fa-arrow-right" aria-hidden="true"></i>
'
))},
move
:
function
(
e
,
t
){
var
n
=
e
-
this
.
x
,
r
=
t
-
this
.
y
;
this
.
x
+=
n
,
this
.
y
+=
r
,
this
.
endx
+=
n
,
this
.
endy
+=
r
,
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
drawables
.
push
(
this
.
draw
())},
remove
:
function
(
e
){
var
t
,
n
;
e
.
preventDefault
(),
t
=
this
.
editor
.
pages
[
this
.
editor
.
currentpage
].
annotations
;
for
(
n
=
0
;
n
<
t
.
length
;
n
++
)
if
(
t
[
n
]
===
this
){
if
(
this
.
divcartridge
!==
""
){
var
r
=
"
#
"
+
this
.
divcartridge
,
i
=
this
.
editor
.
get_dialogue_element
(
r
);
i
.
remove
()}
t
.
splice
(
n
,
1
),
this
.
drawable
&&
this
.
drawable
.
erase
(),
this
.
editor
.
currentannotation
=!
1
,
this
.
editor
.
save_current_page
();
return
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
annotationcommentplus
=
O
;
var
_
=
"
Dropdown menu
"
,
D
;
D
=
function
(
e
){
e
.
draggable
=!
1
,
e
.
centered
=!
1
,
e
.
width
=
"
auto
"
,
e
.
visible
=!
1
,
e
.
footerContent
=
""
,
D
.
superclass
.
constructor
.
apply
(
this
,[
e
])},
e
.
extend
(
D
,
M
.
core
.
dialogue
,{
initializer
:
function
(
t
){
var
n
,
r
,
i
,
s
;
D
.
superclass
.
initializer
.
call
(
this
,
t
),
s
=
this
.
get
(
"
boundingBox
"
),
s
.
addClass
(
"
assignfeedback_editpdfplus_dropdown
"
),
n
=
this
.
get
(
"
buttonNode
"
),
r
=
this
.
bodyNode
,
i
=
e
.
Node
.
create
(
"
<h3/>
"
),
i
.
addClass
(
"
accesshide
"
),
i
.
setHTML
(
this
.
get
(
"
headerText
"
)),
r
.
prepend
(
i
),
r
.
on
(
"
clickoutside
"
,
function
(
e
){
this
.
get
(
"
visible
"
)
&&
e
.
target
.
get
(
"
id
"
)
!==
n
.
get
(
"
id
"
)
&&
e
.
target
.
ancestor
().
get
(
"
id
"
)
!==
n
.
get
(
"
id
"
)
&&
(
e
.
preventDefault
(),
this
.
hide
())},
this
),
n
.
on
(
"
click
"
,
function
(
e
){
e
.
preventDefault
(),
this
.
show
()},
this
),
n
.
on
(
"
key
"
,
this
.
show
,
"
enter,space
"
,
this
)},
show
:
function
(){
var
t
=
this
.
get
(
"
buttonNode
"
),
n
=
D
.
superclass
.
show
.
call
(
this
);
return
this
.
align
(
t
,[
e
.
WidgetPositionAlign
.
TL
,
e
.
WidgetPositionAlign
.
BL
]),
n
}},{
NAME
:
_
,
ATTRS
:{
headerText
:{
value
:
""
},
buttonNode
:{
value
:
null
}}}),
e
.
Base
.
modifyAttrs
(
D
,{
modal
:{
getter
:
function
(){
return
!
1
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
dropdown
=
D
;
var
P
=
"
Colourpicker
"
,
H
;
H
=
function
(
e
){
H
.
superclass
.
constructor
.
apply
(
this
,[
e
])},
e
.
extend
(
H
,
M
.
assignfeedback_editpdfplus
.
dropdown
,{
initializer
:
function
(
t
){
var
n
=
e
.
Node
.
create
(
'
<ul role="menu" class="assignfeedback_editpdfplus_menu"/>
'
),
r
,
i
;
e
.
each
(
this
.
get
(
"
colours
"
),
function
(
t
,
r
){
var
s
,
o
,
u
;
u
=
M
.
util
.
get_string
(
r
,
"
assignfeedback_editpdfplus
"
),
r
===
"
white
"
||
r
===
"
yellowlemon
"
?
i
=
e
.
Node
.
create
(
'
<span class="fa-stack fa-lg"><i class="fa fa-square fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x fa-inverse" aria-hidden="true" style="color:
'
+
t
+
'
;">
'
+
"
</i>
"
+
"
</span>
"
):
i
=
e
.
Node
.
create
(
'
<span class="fa-stack fa-lg"><i class="fa fa-square-o fa-stack-2x" style="color:#E3E3E3;"></i><i class="fa fa-tint fa-stack-1x" aria-hidden="true" style="color:
'
+
t
+
'
;">
'
+
"
</i>
"
+
"
</span>
"
),
i
.
setAttribute
(
"
data-colour
"
,
r
),
s
=
e
.
Node
.
create
(
'
<button class="btn btn-sm" type="button"></button>
'
),
s
.
append
(
i
),
s
.
setAttribute
(
"
data-colour
"
,
r
),
s
.
setAttribute
(
"
data-rgb
"
,
t
),
s
.
setStyle
(
"
backgroundImage
"
,
"
none
"
),
o
=
e
.
Node
.
create
(
"
<li/>
"
),
o
.
append
(
s
),
n
.
append
(
o
)},
this
),
r
=
e
.
Node
.
create
(
"
<div/>
"
),
n
.
delegate
(
"
click
"
,
this
.
callback_handler
,
"
button
"
,
this
),
n
.
delegate
(
"
key
"
,
this
.
callback_handler
,
"
down:13
"
,
"
button
"
,
this
),
this
.
set
(
"
headerText
"
,
M
.
util
.
get_string
(
"
colourpicker
"
,
"
assignfeedback_editpdfplus
"
)),
r
.
append
(
n
),
this
.
set
(
"
bodyContent
"
,
r
),
H
.
superclass
.
initializer
.
call
(
this
,
t
)},
callback_handler
:
function
(
t
){
t
.
preventDefault
();
var
n
=
this
.
get
(
"
callback
"
),
r
=
this
.
get
(
"
context
"
),
i
;
this
.
hide
(),
i
=
e
.
bind
(
n
,
r
,
t
),
i
()}},{
NAME
:
P
,
ATTRS
:{
colours
:{
value
:{}},
callback
:{
value
:
null
},
context
:{
value
:
null
},
iconprefix
:{
value
:
"
colour_
"
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
colourpicker
=
H
;
var
B
=
function
(){
B
.
superclass
.
constructor
.
apply
(
this
,
arguments
)};
B
.
prototype
=
{
dialogue
:
null
,
panel
:
null
,
pagecount
:
0
,
currentpage
:
0
,
pages
:[],
documentstatus
:
0
,
loadingicon
:
null
,
pageimage
:
null
,
graphic
:
null
,
currentedit
:
new
M
.
assignfeedback_editpdfplus
.
edit
,
currentdrawable
:
!
1
,
drawables
:[],
drawablesannotations
:[],
currentannotation
:
null
,
lastannotation
:
null
,
lastannotationtool
:
null
,
annotationsparent
:[],
studentstatut
:
-
1
,
questionstatut
:
-
1
,
currentannotationreview
:
null
,
initializer
:
function
(){
var
t
;
t
=
e
.
one
(
"
#
"
+
this
.
get
(
"
linkid
"
)),
t
&&
(
t
.
on
(
"
click
"
,
this
.
link_handler
,
this
),
t
.
on
(
"
key
"
,
this
.
link_handler
,
"
down:13
"
,
this
),
require
([
"
mod_assign/grading_review_panel
"
],
function
(
n
){
var
r
=
new
n
,
i
=
r
.
getReviewPanel
(
"
assignfeedback_editpdfplus
"
);
i
&&
(
i
=
e
.
one
(
i
),
i
.
empty
(),
t
.
ancestor
(
"
.fitem
"
).
hide
(),
this
.
open_in_panel
(
i
)),
this
.
currentedit
.
start
=!
1
,
this
.
currentedit
.
end
=!
1
}.
bind
(
this
)))},
refresh_button_state
:
function
(){
var
e
,
t
,
n
;
this
.
refresh_button_color_state
(),
this
.
currentedit
.
id
?
e
=
this
.
get_dialogue_element
(
"
#
"
+
this
.
currentedit
.
id
):
e
=
this
.
get_dialogue_element
(
l
[
this
.
currentedit
.
tool
]),
e
&&
(
e
.
addClass
(
"
active
"
),
e
.
setAttribute
(
"
aria-pressed
"
,
"
true
"
)),
t
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
t
.
setAttribute
(
"
data-currenttool
"
,
this
.
currentedit
.
tool
)
,
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
);
switch
(
this
.
currentedit
.
tool
){
case
"
drag
"
:
n
.
setStyle
(
"
cursor
"
,
"
move
"
);
break
;
case
"
highlight
"
:
n
.
setStyle
(
"
c
urs
or
"
,
"
text
"
);
break
;
case
"
select
"
:
n
.
setStyle
(
"
cursor
"
,
"
default
"
);
break
;
default
:
n
.
setStyle
(
"
cursor
"
,
"
crosshair
"
)}},
refresh_button_color_state
:
function
(){
var
e
;
e
=
this
.
get_dialogue_element
(
s
.
ANNOTATIONCOLOURBUTTON
);
if
(
this
.
currentedit
.
annotationcolour
===
"
white
"
)
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
this
.
currentedit
.
annotationcolour
),
e
.
setStyle
(
"
background-color
"
,
"
#EEEEEE
"
);
else
{
switch
(
this
.
currentedit
.
annotationcolour
){
case
"
yellowlemon
"
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
"
#fff44f
"
);
break
;
case
"
yellow
"
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
"
rgb(255,207,53)
"
);
break
;
default
:
e
.
one
(
"
i
"
).
setStyle
(
"
color
"
,
this
.
currentedit
.
annotationcolour
)}
e
.
setStyle
(
"
background-color
"
,
""
)}},
get_canvas_bounds
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
t
=
e
.
getXY
(),
n
=
t
[
0
],
r
=
t
[
1
],
i
=
parseInt
(
e
.
getStyle
(
"
width
"
),
10
),
o
=
parseInt
(
e
.
getStyle
(
"
height
"
),
10
);
return
new
M
.
assignfeedback_editpdfplus
.
rect
(
n
,
r
,
i
,
o
)},
get_canvas_coordinates
:
function
(
e
){
var
t
=
this
.
get_canvas_bounds
(),
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
x
-
t
.
x
,
e
.
y
-
t
.
y
);
return
t
.
x
=
t
.
y
=
0
,
n
.
clip
(
t
),
n
},
get_window_coordinates
:
function
(
e
){
var
t
=
this
.
get_canvas_bounds
(),
n
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
x
+
t
.
x
,
e
.
y
+
t
.
y
);
return
n
},
open_in_panel
:
function
(
t
){
var
n
,
r
;
this
.
panel
=
t
,
t
.
append
(
this
.
get
(
"
body
"
)),
t
.
addClass
(
i
.
DIALOGUE
),
this
.
loadingicon
=
this
.
get_dialogue_element
(
s
.
LOADINGICON
),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
this
.
graphic
=
new
e
.
Graphic
({
render
:
n
}),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
r
.
on
(
"
scroll
"
,
this
.
move_canvas
,
this
),
this
.
get
(
"
readonly
"
)
||
(
n
.
on
(
"
gesturemovestart
"
,
this
.
edit_start
,
null
,
this
),
n
.
on
(
"
gesturemove
"
,
this
.
edit_move
,
null
,
this
),
n
.
on
(
"
gesturemoveend
"
,
this
.
edit_end
,
null
,
this
),
this
.
refresh_button_state
()),
this
.
start_generation
()},
link_handler
:
function
(
t
){
var
n
,
r
,
o
=!
0
;
t
.
preventDefault
(),
this
.
dialogue
||
(
this
.
dialogue
=
new
M
.
core
.
dialogue
({
headerContent
:
this
.
get
(
"
header
"
),
bodyContent
:
this
.
get
(
"
body
"
),
footerContent
:
this
.
get
(
"
footer
"
),
modal
:
!
0
,
width
:
"
840px
"
,
visible
:
!
1
,
draggable
:
!
0
}),
this
.
dialogue
.
get
(
"
boundingBox
"
).
addClass
(
i
.
DIALOGUE
),
this
.
loadingicon
=
this
.
get_dialogue_element
(
s
.
LOADINGICON
),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
this
.
graphic
=
new
e
.
Graphic
({
render
:
n
}),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
r
.
on
(
"
scroll
"
,
this
.
move_canvas
,
this
),
this
.
get
(
"
readonly
"
)
||
(
n
.
on
(
"
gesturemovestart
"
,
this
.
edit_start
,
null
,
this
),
n
.
on
(
"
gesturemove
"
,
this
.
edit_move
,
null
,
this
),
n
.
on
(
"
gesturemoveend
"
,
this
.
edit_end
,
null
,
this
),
this
.
refresh_button_state
()),
this
.
start_generation
(),
n
.
on
(
"
windowresize
"
,
this
.
resize
,
this
),
o
=!
1
),
this
.
dialogue
.
centerDialogue
(),
this
.
dialogue
.
show
(),
this
.
dialogue
.
dd
.
on
(
"
drag:end
"
,
this
.
redraw
,
this
),
o
&&
this
.
resize
()},
start_generation
:
function
(){
this
.
poll_document_conversion_status
()},
poll_document_conversion_status
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
e
.
io
(
n
,{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
pollconversions
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
readonly
:
this
.
get
(
"
readonly
"
)?
1
:
0
},
on
:{
success
:
function
(
t
,
n
){
var
r
=
this
.
handle_response_data
(
n
),
i
=!
1
;
if
(
r
){
this
.
documentstatus
=
r
.
status
;
if
(
r
.
status
===
0
)
i
=!
0
;
else
if
(
r
.
status
===
1
)
i
=!
0
;
else
if
(
r
.
status
===
2
||
r
.
status
===-
1
)
this
.
pagecount
=
r
.
pagecount
,
r
.
pageready
===
r
.
pagecount
?
this
.
prepare_pages_for_display
(
r
):(
this
.
update_page_load_progress
(),
this
.
start_document_to_image_conversion
());
i
&&
e
.
later
(
1
e3
,
this
,
this
.
poll_document_conversion_status
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}})},
start_document_to_image_conversion
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
e
.
io
(
n
,{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
pollconversions
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
readonly
:
this
.
get
(
"
readonly
"
)?
1
:
0
},
on
:{
success
:
function
(
e
,
t
){
var
n
=
this
.
handle_response_data
(
t
);
n
&&
(
this
.
documentstatus
=
n
.
status
,
n
.
status
===
2
&&
this
.
prepare_pages_for_display
(
n
))},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}})},
prepare_pages_for_display
:
function
(
e
){
var
t
,
n
,
r
;
if
(
!
e
.
pagecount
){
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
r
=
new
M
.
core
.
alert
({
message
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
)}),
r
.
show
();
return
}
this
.
pagecount
=
e
.
pagecount
,
this
.
pages
=
e
.
pages
,
this
.
tools
=
[];
for
(
t
=
0
;
t
<
e
.
tools
.
length
;
t
++
){
var
i
=
e
.
tools
[
t
];
this
.
tools
[
i
.
id
]
=
i
}
this
.
typetools
=
[];
for
(
t
=
0
;
t
<
e
.
typetools
.
length
;
t
++
){
var
s
=
e
.
typetools
[
t
];
this
.
typetools
[
s
.
id
]
=
s
}
this
.
axis
=
[];
for
(
t
=
0
;
t
<
e
.
axis
.
length
;
t
++
){
var
o
=
e
.
axis
[
t
];
o
.
visibility
=!
0
,
this
.
axis
[
o
.
id
]
=
o
}
for
(
t
=
0
;
t
<
this
.
pages
.
length
;
t
++
){
var
u
=
[];
for
(
n
=
0
;
n
<
this
.
pages
[
t
].
annotations
.
length
;
n
++
){
e
=
this
.
pages
[
t
].
annotations
[
n
],
e
.
parent_annot
&&
parseInt
(
e
.
parent_annot
,
10
)
!==
0
&&
(
e
.
parent_annot_element
=
u
[
e
.
parent_annot
]);
var
a
=
e
.
toolid
,
f
=
this
.
create_annotation
(
this
.
typetools
[
this
.
tools
[
a
].
type
].
label
,
a
,
e
,
this
.
tools
[
a
]);
if
(
f
.
parent_annot_element
){
var
l
=
f
.
parent_annot_element
.
id
;
this
.
annotationsparent
[
l
]?
this
.
annotationsparent
[
l
][
this
.
annotationsparent
[
l
].
length
]
=
f
:
this
.
annotationsparent
[
l
]
=
[
f
]}
u
[
e
.
id
]
=
f
,
this
.
pages
[
t
].
annotations
[
n
]
=
f
}}
this
.
setup_navigation
(),
this
.
setup_toolbar
(),
this
.
change_page
()},
update_page_load_progress
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
,
n
=
0
,
i
=
this
.
get_dialogue_element
(
s
.
PROGRESSBARCONTAINER
+
"
.bar
"
);
if
(
!
i
)
return
;
t
=
{
method
:
"
get
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
conversionstatus
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
)},
on
:{
success
:
function
(
i
,
o
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
n
=
0
;
var
u
=
0
,
a
=
this
.
get_dialogue_element
(
s
.
PROGRESSBARCONTAINER
+
"
.bar
"
);
a
&&
(
u
=
o
.
response
/
this
.
pagecount
*
100
,
a
.
setStyle
(
"
width
"
,
u
+
"
%
"
),
a
.
ancestor
(
s
.
PROGRESSBARCONTAINER
).
setAttribute
(
"
aria-valuenow
"
,
u
),
u
<
100
&&
(
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})))},
failure
:
function
(
i
,
s
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
return
n
+=
1
,
this
.
pagecount
===
0
&&
n
<
5
&&
(
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})),
new
M
.
core
.
exception
(
s
.
responseText
)}}},
M
.
util
.
js_pending
(
"
checkconversionstatus
"
),
e
.
later
(
1
e3
,
this
,
function
(){
n
=
0
,
M
.
util
.
js_complete
(
"
checkconversionstatus
"
),
e
.
io
(
r
,
t
)})},
handle_response_data
:
function
(
t
){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
n
;
try
{
n
=
e
.
JSON
.
parse
(
t
.
responseText
);
if
(
!
n
.
error
)
return
n
;
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
new
M
.
core
.
alert
({
message
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
),
visible
:
!
0
})}
catch
(
r
){
this
.
dialogue
&&
this
.
dialogue
.
hide
(),
new
M
.
core
.
alert
({
title
:
M
.
util
.
get_string
(
"
cannotopenpdf
"
,
"
assignfeedback_editpdfplus
"
),
visible
:
!
0
})}
return
},
handle_axis_button
:
function
(
e
,
t
,
n
){
t
.
visibility
=
n
.
get
(
"
checked
"
),
this
.
redraw
()},
setup_toolbar
:
function
(){
var
t
,
n
,
r
;
if
(
this
.
get
(
"
readonly
"
)){
for
(
var
i
in
this
.
axis
){
var
o
=
this
.
axis
[
i
],
u
=
this
.
get_dialogue_element
(
"
#ctaxis
"
+
o
.
id
);
u
&&
(
u
.
set
(
"
checked
"
,
"
true
"
),
u
.
on
(
"
click
"
,
this
.
handle_axis_button
,
this
,
o
,
u
))}
var
f
=
this
.
get_dialogue_element
(
s
.
QUESTIONSELECTOR
);
f
&&
f
.
on
(
"
change
"
,
this
.
update_visu_annotation_q
,
this
);
var
c
=
this
.
get_dialogue_element
(
s
.
STATUTSELECTOR
);
c
&&
c
.
on
(
"
change
"
,
this
.
update_visu_annotation
,
this
);
var
h
=
this
.
get_dialogue_element
(
s
.
STUDENTVALIDATION
);
h
&&
h
.
on
(
"
click
"
,
this
.
update_student_feedback
,
this
);
return
}
var
p
=
this
.
get_dialogue_element
(
s
.
CUSTOMTOOLBARID
+
"
1
"
);
p
&&
p
.
show
();
var
d
=
this
.
get_dialogue_element
(
s
.
AXISCUSTOMTOOLBAR
);
d
&&
d
.
on
(
"
change
"
,
this
.
update_custom_toolbars
,
this
),
this
.
update_custom_toolbars
(),
e
.
all
(
s
.
CUSTOMTOOLBARBUTTONS
).
each
(
function
(
e
){
var
t
=
e
.
get
(
"
id
"
),
n
=
e
.
getAttribute
(
"
data-tool
"
);
e
.
on
(
"
click
"
,
this
.
handle_tool_button
,
this
,
n
,
t
),
e
.
on
(
"
key
"
,
this
.
handle_tool_button
,
"
down:13
"
,
this
,
n
,
t
),
e
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
)},
this
),
e
.
each
(
l
,
function
(
e
,
n
){
t
=
this
.
get_dialogue_element
(
e
),
t
.
on
(
"
click
"
,
this
.
handle_tool_button
,
this
,
n
),
t
.
on
(
"
key
"
,
this
.
handle_tool_button
,
"
down:13
"
,
this
,
n
),
t
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
)},
this
),
n
=
this
.
get_dialogue_element
(
s
.
ANNOTATIONCOLOURBUTTON
),
r
=
new
M
.
assignfeedback_editpdfplus
.
colourpicker
({
buttonNode
:
n
,
iconprefix
:
"
colour_
"
,
colours
:
a
,
callback
:
function
(
e
){
var
t
=
e
.
target
.
getAttribute
(
"
data-colour
"
);
t
||
(
t
=
e
.
target
.
ancestor
().
getAttribute
(
"
data-colour
"
)),
this
.
currentedit
.
annotationcolour
=
t
,
this
.
refresh_button_color_state
()},
context
:
this
})},
update_student_feedback
:
function
(){
this
.
refresh_pdf
()},
update_visu_annotation_q
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
QUESTIONSELECTOR
+
"
option:checked
"
),
t
=
parseInt
(
e
.
get
(
"
value
"
),
10
)
-
1
;
this
.
questionstatut
=
t
,
this
.
redraw
()},
update_visu_annotation
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
STATUTSELECTOR
+
"
option:checked
"
),
t
=
parseInt
(
e
.
get
(
"
value
"
),
10
)
-
1
;
this
.
studentstatut
=
t
,
this
.
redraw
()},
update_custom_toolbars
:
function
(){
e
.
all
(
s
.
CUSTOMTOOLBARS
).
each
(
function
(
e
){
e
.
hide
()},
this
);
var
t
=
this
.
get_dialogue_element
(
s
.
AXISCUSTOMTOOLBAR
+
"
option:checked
"
),
n
=
parseInt
(
t
.
get
(
"
value
"
),
10
),
r
=
this
.
get_dialogue_element
(
s
.
CUSTOMTOOLBARID
+
""
+
n
);
r
.
show
()},
handle_tool_button
:
function
(
e
,
t
,
n
,
r
){
e
.
preventDefault
(),
this
.
handle_tool_button_action
(
t
,
n
,
r
)},
handle_tool_button_action
:
function
(
e
,
t
,
n
){
var
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
i
;
this
.
currentedit
.
id
?
i
=
this
.
get_dialogue_element
(
"
#
"
+
this
.
currentedit
.
id
):
i
=
this
.
get_dialogue_element
(
l
[
this
.
currentedit
.
tool
]),
i
&&
(
i
.
removeClass
(
"
active
"
),
i
.
setAttribute
(
"
aria-pressed
"
,
"
false
"
),
r
.
setStyle
(
"
cursor
"
,
"
auto
"
)),
this
.
currentedit
.
tool
=
e
,
this
.
currentedit
.
id
=
t
,
e
!==
"
select
"
&&
e
!==
"
drag
"
&&
(
this
.
lastannotationtool
=
e
),
e
!==
"
select
"
&&
this
.
redraw_annotation
(),
n
||
(
this
.
currentedit
.
parent_annot_element
=
null
),
this
.
refresh_button_state
()},
redraw_annotation
:
function
(){
this
.
currentannotation
=
null
;
var
t
=
this
.
pages
[
this
.
currentpage
].
annotations
;
e
.
each
(
t
,
function
(
e
){
e
&&
e
.
drawable
&&
(
e
.
drawable
.
erase
(),
e
.
draw
())})},
stringify_current_page
:
function
(){
var
t
=
[],
n
,
r
=
0
;
for
(
r
=
0
;
r
<
this
.
pages
[
this
.
currentpage
].
annotations
.
length
;
r
++
)
t
[
r
]
=
this
.
pages
[
this
.
currentpage
].
annotations
[
r
].
clean
();
return
n
=
{
annotations
:
t
},
e
.
JSON
.
stringify
(
n
)},
stringify_current_page_edited
:
function
(){
var
t
=
[],
n
,
r
=
0
;
for
(
r
=
0
;
r
<
this
.
pages
[
this
.
currentpage
].
annotations
.
length
;
r
++
)
t
[
r
]
=
this
.
pages
[
this
.
currentpage
].
annotations
[
r
].
light_clean
();
return
n
=
{
annotations
:
t
},
e
.
JSON
.
stringify
(
n
)},
get_current_drawable
:
function
(){
var
e
,
t
=!
1
;
if
(
!
this
.
currentedit
.
start
||!
this
.
currentedit
.
end
)
return
!
1
;
if
(
this
.
currentedit
.
tool
!==
"
comment
"
){
var
n
=
this
.
currentedit
.
id
;
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
"
c
"
&&
(
n
=
this
.
currentedit
.
id
.
substr
(
8
)),
e
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,{},
this
.
tools
[
n
]),
e
&&
(
t
=
e
.
draw_current_edit
(
this
.
currentedit
))}
return
t
},
get_dialogue_element
:
function
(
e
){
return
this
.
panel
?
this
.
panel
.
one
(
e
):
this
.
dialogue
.
get
(
"
boundingBox
"
).
one
(
e
)},
redraw_current_edit
:
function
(){
this
.
currentdrawable
&&
this
.
currentdrawable
.
erase
(),
this
.
currentdrawable
=
this
.
get_current_drawable
()},
edit_start
:
function
(
t
){
var
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
n
.
getXY
(),
i
=
n
.
get
(
"
docScrollY
"
),
o
=
n
.
get
(
"
docScrollX
"
),
u
=
{
x
:
t
.
clientX
-
r
[
0
]
+
o
,
y
:
t
.
clientY
-
r
[
1
]
+
i
},
a
=!
1
;
if
(
t
.
button
===
3
)
return
;
if
(
this
.
currentedit
.
starttime
)
return
;
this
.
currentedit
.
starttime
=
(
new
Date
).
getTime
(),
this
.
currentedit
.
start
=
u
,
this
.
currentedit
.
end
=
{
x
:
u
.
x
,
y
:
u
.
y
};
if
(
this
.
currentedit
.
tool
===
"
select
"
){
var
f
=
this
.
currentedit
.
end
.
x
,
l
=
this
.
currentedit
.
end
.
y
,
c
=
this
.
pages
[
this
.
currentpage
].
annotations
;
e
.
each
(
c
,
function
(
e
){(
f
-
e
.
x
)
*
(
f
-
e
.
endx
)
<=
0
&&
(
l
-
e
.
y
)
*
(
l
-
e
.
endy
)
<=
0
&&
(
a
=
e
)}),
a
?(
this
.
lastannotation
=
this
.
currentannotation
,
this
.
currentannotation
=
a
,
this
.
lastannotation
&&
this
.
lastannotation
!==
a
&&
this
.
lastannotation
.
drawable
&&
(
this
.
lastannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
lastannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
lastannotation
)),
this
.
currentannotation
.
drawable
&&
this
.
currentannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
currentannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
currentannotation
)):(
this
.
lastannotation
=
this
.
currentannotation
,
this
.
currentannotation
=
null
,
this
.
lastannotation
&&
this
.
lastannotation
.
drawable
&&
(
this
.
lastannotation
.
drawable
.
erase
(),
this
.
drawables
.
push
(
this
.
lastannotation
.
draw
()),
this
.
drawablesannotations
.
push
(
this
.
lastannotation
)))}
this
.
currentannotation
&&
(
this
.
currentedit
.
annotationstart
=
{
x
:
this
.
currentannotation
.
x
,
y
:
this
.
currentannotation
.
y
})},
edit_move
:
function
(
e
){
e
.
preventDefault
();
var
t
=
this
.
get_canvas_bounds
(),
n
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
r
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
i
=
new
M
.
assignfeedback_editpdfplus
.
point
(
e
.
clientX
+
n
.
get
(
"
docScrollX
"
),
e
.
clientY
+
n
.
get
(
"
docScrollY
"
)),
o
=
this
.
get_canvas_coordinates
(
i
),
u
,
a
;
if
(
o
.
x
<
0
||
o
.
x
>
t
.
width
||
o
.
y
<
0
||
o
.
y
>
t
.
height
)
return
;
this
.
currentedit
.
tool
===
"
pen
"
&&
this
.
currentedit
.
path
.
push
(
o
),
this
.
currentedit
.
tool
===
"
select
"
?
this
.
currentannotation
&&
this
.
currentedit
&&
this
.
currentannotation
.
move
(
this
.
currentedit
.
annotationstart
.
x
+
o
.
x
-
this
.
currentedit
.
start
.
x
,
this
.
currentedit
.
annotationstart
.
y
+
o
.
y
-
this
.
currentedit
.
start
.
y
):
this
.
currentedit
.
tool
===
"
drag
"
?(
u
=
o
.
x
-
this
.
currentedit
.
start
.
x
,
a
=
o
.
y
-
this
.
currentedit
.
start
.
y
,
r
.
getDOMNode
().
scrollLeft
-=
u
,
r
.
getDOMNode
().
scrollTop
-=
a
):
this
.
currentedit
.
start
&&
(
this
.
currentedit
.
end
=
o
,
this
.
redraw_current_edit
())},
edit_end
:
function
(){
var
e
,
t
;
e
=
(
new
Date
).
getTime
()
-
this
.
currentedit
.
start
;
if
(
e
<
f
||
this
.
currentedit
.
start
===!
1
)
return
;
var
n
=
this
.
currentedit
.
id
;
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
"
c
"
&&
(
n
=
this
.
currentedit
.
id
.
substr
(
8
)),
t
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,{},
this
.
tools
[
n
]);
if
(
t
){
this
.
currentdrawable
&&
this
.
currentdrawable
.
erase
(),
this
.
currentdrawable
=!
1
;
if
(
t
.
init_from_edit
(
this
.
currentedit
)){
this
.
currentannotation
=
t
,
t
.
draw_catridge
(
this
.
currentedit
),
t
.
edit_annot
();
if
(
t
.
parent_annot_element
){
var
r
=
0
;
t
.
parent_annot_element
.
id
?
r
=
t
.
parent_annot_element
.
id
:
r
=
t
.
parent_annot_element
.
divcartridge
,
this
.
annotationsparent
[
r
]?
this
.
annotationsparent
[
r
][
this
.
annotationsparent
[
r
].
length
]
=
t
:
this
.
annotationsparent
[
r
]
=
[
t
]}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
t
),
this
.
drawables
.
push
(
t
.
draw
()),
this
.
drawablesannotations
.
push
(
t
)}}
this
.
save_current_page
(),
this
.
currentedit
.
starttime
=
0
,
this
.
currentedit
.
start
=!
1
,
this
.
currentedit
.
end
=!
1
,
this
.
currentedit
.
path
=
[],
this
.
currentedit
.
tool
!==
"
drag
"
&&
this
.
handle_tool_button_action
(
"
select
"
)},
resize
:
function
(){
var
t
,
n
;
if
(
this
.
dialogue
){
if
(
!
this
.
dialogue
.
get
(
"
visible
"
))
return
;
this
.
dialogue
.
centerDialogue
()}
return
n
=
e
.
one
(
"
body
"
).
get
(
"
winHeight
"
)
-
120
,
n
<
100
&&
(
n
=
100
),
t
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
this
.
dialogue
&&
t
.
setStyle
(
"
maxHeight
"
,
n
+
"
px
"
),
this
.
redraw
(),
!
0
},
create_annotation
:
function
(
e
,
t
,
n
,
r
){
!
e
||
typeof
e
==
"
undefined
"
||
typeof
t
!=
"
undefined
"
&&
t
!==
null
?
t
!==
null
&&
t
[
0
]
===
"
c
"
&&
(
n
.
toolid
=
t
.
substr
(
8
)):(
e
===
"
line
"
?
n
.
toolid
=
c
.
LINE
:
e
===
"
rectangle
"
?
n
.
toolid
=
c
.
RECTANGLE
:
e
===
"
oval
"
?
n
.
toolid
=
c
.
OVAL
:
e
===
"
pen
"
?
n
.
toolid
=
c
.
PEN
:
e
===
"
highlight
"
&&
(
n
.
toolid
=
c
.
HIGHLIGHT
),
n
.
tooltype
=
this
.
tools
[
n
.
toolid
]);
if
(
!
n
.
tooltype
||
n
.
tooltype
===
""
)
n
.
tooltype
=
r
;
return
n
.
tool
=
e
,
n
.
editor
=
this
,
n
.
tool
===
c
.
LINE
+
""
||
n
.
tool
===
h
.
LINE
?
new
M
.
assignfeedback_editpdfplus
.
annotationline
(
n
):
n
.
tool
===
c
.
RECTANGLE
+
""
||
n
.
tool
===
h
.
RECTANGLE
?
new
M
.
assignfeedback_editpdfplus
.
annotationrectangle
(
n
):
n
.
tool
===
c
.
OVAL
+
""
||
n
.
tool
===
h
.
OVAL
?
new
M
.
assignfeedback_editpdfplus
.
annotationoval
(
n
):
n
.
tool
===
c
.
PEN
+
""
||
n
.
tool
===
h
.
PEN
?
new
M
.
assignfeedback_editpdfplus
.
annotationpen
(
n
):
n
.
tool
===
c
.
HIGHLIGHT
+
""
||
n
.
tool
===
h
.
HIGHLIGHT
?
new
M
.
assignfeedback_editpdfplus
.
annotationhighlight
(
n
):
n
.
tool
===
c
.
FRAME
+
""
||
n
.
tool
===
h
.
FRAME
?(
r
&&
n
.
colour
===
""
&&
(
n
.
colour
=
this
.
typetools
[
r
.
type
].
color
),
!
n
.
parent_annot
&&!
n
.
parent_annot_element
&&
(
this
.
currentedit
.
parent_annot_element
?
n
.
parent_annot_element
=
this
.
currentedit
.
parent_annot_element
:(
n
.
parent_annot_element
=
null
,
n
.
parent_annot
=
0
)),
new
M
.
assignfeedback_editpdfplus
.
annotationframe
(
n
)):(
r
&&
(
r
.
colors
&&
r
.
colors
.
indexOf
(
"
,
"
)
!==-
1
?
n
.
colour
=
r
.
colors
.
substr
(
0
,
r
.
colors
.
indexOf
(
"
,
"
)):
n
.
colour
=
r
.
colors
,
n
.
colour
===
""
&&
(
n
.
colour
=
this
.
typetools
[
r
.
type
].
color
)),
n
.
tool
===
c
.
HIGHLIGHTPLUS
+
""
||
n
.
tool
===
h
.
HIGHLIGHTPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationhighlightplus
(
n
):
n
.
tool
===
c
.
STAMPPLUS
+
""
||
n
.
tool
===
h
.
STAMPPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationstampplus
(
n
):
n
.
tool
===
c
.
VERTICALLINE
+
""
||
n
.
tool
===
h
.
VERTICALLINE
?
new
M
.
assignfeedback_editpdfplus
.
annotationverticalline
(
n
):
n
.
tool
===
c
.
STAMPCOMMENT
+
""
||
n
.
tool
===
h
.
STAMPCOMMENT
?
new
M
.
assignfeedback_editpdfplus
.
annotationstampcomment
(
n
):
n
.
tool
===
c
.
COMMENTPLUS
+
""
||
n
.
tool
===
h
.
COMMENTPLUS
?
new
M
.
assignfeedback_editpdfplus
.
annotationcommentplus
(
n
):
!
1
)},
refresh_pdf
:
function
(){
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
generatepdf
"
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
refresh
:
!
0
},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
save_current_page
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
savepage
"
,
index
:
this
.
currentpage
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
page
:
this
.
stringify_current_page
()},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIV
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
save_current_page_edited
:
function
(){
if
(
this
.
get
(
"
destroyed
"
))
return
;
var
t
=
n
,
r
;
r
=
{
method
:
"
post
"
,
context
:
this
,
sync
:
!
1
,
data
:{
sesskey
:
M
.
cfg
.
sesskey
,
action
:
"
updatestudentview
"
,
index
:
this
.
currentpage
,
userid
:
this
.
get
(
"
userid
"
),
attemptnumber
:
this
.
get
(
"
attemptnumber
"
),
assignmentid
:
this
.
get
(
"
assignmentid
"
),
page
:
this
.
stringify_current_page_edited
()},
on
:{
success
:
function
(
t
,
n
){
var
r
;
try
{
r
=
e
.
JSON
.
parse
(
n
.
responseText
);
if
(
r
.
error
)
return
new
M
.
core
.
ajaxException
(
r
);
e
.
one
(
s
.
UNSAVEDCHANGESINPUT
).
set
(
"
value
"
,
"
true
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
opacity
"
,
1
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
inline-block
"
),
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
transition
({
duration
:
1
,
delay
:
2
,
opacity
:
0
},
function
(){
e
.
one
(
s
.
UNSAVEDCHANGESDIVEDIT
).
setStyle
(
"
display
"
,
"
none
"
)})}
catch
(
i
){
return
new
M
.
core
.
exception
(
i
)}},
failure
:
function
(
e
,
t
){
return
new
M
.
core
.
exception
(
t
.
responseText
)}}},
e
.
io
(
t
,
r
)},
redraw
:
function
(){
var
t
,
n
,
r
;
r
=
this
.
pages
[
this
.
currentpage
];
if
(
r
===
undefined
)
return
;
while
(
this
.
drawables
.
length
>
0
)
this
.
drawables
.
pop
().
erase
();
while
(
this
.
drawablesannotations
.
length
>
0
){
n
=
this
.
drawablesannotations
.
pop
();
if
(
n
.
divcartridge
){
var
i
=
e
.
one
(
"
#
"
+
n
.
divcartridge
);
i
&&
i
.
remove
(),
n
.
divcartridge
=
""
}
n
.
drawable
&&
n
.
drawable
.
erase
()}
for
(
t
=
0
;
t
<
r
.
annotations
.
length
;
t
++
){
n
=
r
.
annotations
[
t
];
var
s
=
n
.
tooltype
;
if
(
this
.
get
(
"
readonly
"
)
&&
s
.
axis
&&
(
this
.
axis
[
s
.
axis
]
&&
this
.
axis
[
s
.
axis
].
visibility
||
s
.
axis
===
"
0
"
)
&&
(
this
.
studentstatut
<
0
||
this
.
studentstatut
===
n
.
studentstatus
)
&&
(
this
.
questionstatut
<
0
||
this
.
questionstatut
===
n
.
answerrequested
)
||!
this
.
get
(
"
readonly
"
))
this
.
drawables
.
push
(
n
.
draw
()),
this
.
drawablesannotations
.
push
(
n
)}},
change_page
:
function
(){
var
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGCANVAS
),
t
,
n
,
r
;
n
=
this
.
get_dialogue_element
(
s
.
PREVIOUSBUTTON
),
r
=
this
.
get_dialogue_element
(
s
.
NEXTBUTTON
),
this
.
currentpage
>
0
?
n
.
removeAttribute
(
"
disabled
"
):
n
.
setAttribute
(
"
disabled
"
,
"
true
"
),
this
.
currentpage
<
this
.
pagecount
-
1
?
r
.
removeAttribute
(
"
disabled
"
):
r
.
setAttribute
(
"
disabled
"
,
"
true
"
),
t
=
this
.
pages
[
this
.
currentpage
],
this
.
loadingicon
.
hide
(),
e
.
setStyle
(
"
backgroundImage
"
,
'
url("
'
+
t
.
url
+
'
")
'
),
e
.
setStyle
(
"
width
"
,
t
.
width
+
"
px
"
),
e
.
setStyle
(
"
height
"
,
t
.
height
+
"
px
"
),
this
.
get_dialogue_element
(
s
.
PAGESELECT
).
set
(
"
selectedIndex
"
,
this
.
currentpage
),
this
.
resize
()},
setup_navigation
:
function
(){
var
t
,
n
,
r
,
i
,
o
,
u
;
t
=
this
.
get_dialogue_element
(
s
.
PAGESELECT
);
var
a
=
t
.
all
(
"
option
"
);
if
(
a
.
size
()
<=
1
)
for
(
n
=
0
;
n
<
this
.
pages
.
length
;
n
++
)
i
=
e
.
Node
.
create
(
"
<option/>
"
),
i
.
setAttribute
(
"
value
"
,
n
),
r
=
{
page
:
n
+
1
,
total
:
this
.
pages
.
length
},
i
.
setHTML
(
M
.
util
.
get_string
(
"
pagexofy
"
,
"
assignfeedback_editpdfplus
"
,
r
)),
t
.
append
(
i
);
t
.
removeAttribute
(
"
disabled
"
),
t
.
on
(
"
change
"
,
function
(){
this
.
currentpage
=
t
.
get
(
"
value
"
),
this
.
change_page
()},
this
),
o
=
this
.
get_dialogue_element
(
s
.
PREVIOUSBUTTON
),
u
=
this
.
get_dialogue_element
(
s
.
NEXTBUTTON
),
o
.
on
(
"
click
"
,
this
.
previous_page
,
this
),
o
.
on
(
"
key
"
,
this
.
previous_page
,
"
down:13
"
,
this
),
u
.
on
(
"
click
"
,
this
.
next_page
,
this
),
u
.
on
(
"
key
"
,
this
.
next_page
,
"
down:13
"
,
this
)},
previous_page
:
function
(
e
){
e
.
preventDefault
(),
this
.
currentpage
--
,
this
.
currentpage
<
0
&&
(
this
.
currentpage
=
0
),
this
.
change_page
()},
next_page
:
function
(
e
){
e
.
preventDefault
(),
this
.
currentpage
++
,
this
.
currentpage
>=
this
.
pages
.
length
&&
(
this
.
currentpage
=
this
.
pages
.
length
-
1
),
this
.
change_page
()},
move_canvas
:
function
(){
var
e
,
t
,
n
,
r
;
e
=
this
.
get_dialogue_element
(
s
.
DRAWINGREGION
),
t
=
parseInt
(
e
.
get
(
"
scrollLeft
"
),
10
),
n
=
parseInt
(
e
.
get
(
"
scrollTop
"
),
10
);
for
(
r
=
0
;
r
<
this
.
drawables
.
length
;
r
++
)
this
.
drawables
[
r
].
scroll_update
(
t
,
n
)}},
e
.
extend
(
B
,
e
.
Base
,
B
.
prototype
,{
NAME
:
"
moodle-assignfeedback_editpdfplus-editor
"
,
ATTRS
:{
userid
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
assignmentid
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
attemptnumber
:{
validator
:
e
.
Lang
.
isInteger
,
value
:
0
},
header
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
body
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
footer
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
linkid
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
deletelinkid
:{
validator
:
e
.
Lang
.
isString
,
value
:
""
},
readonly
:{
validator
:
e
.
Lang
.
isBoolean
,
value
:
!
0
}}}),
M
.
assignfeedback_editpdfplus
=
M
.
assignfeedback_editpdfplus
||
{},
M
.
assignfeedback_editpdfplus
.
editor
=
M
.
assignfeedback_editpdfplus
.
editor
||
{},
M
.
assignfeedback_editpdfplus
.
editor
.
init
=
M
.
assignfeedback_editpdfplus
.
editor
.
init
||
function
(
e
){
return
typeof
M
.
assignfeedback_editpdfplus
.
instance
!=
"
undefined
"
&&
M
.
assignfeedback_editpdfplus
.
instance
.
destroy
(),
M
.
assignfeedback_editpdfplus
.
instance
=
new
B
(
e
),
M
.
assignfeedback_editpdfplus
.
instance
}},
"
@VERSION@
"
,{
requires
:[
"
base
"
,
"
event
"
,
"
node
"
,
"
io
"
,
"
graphics
"
,
"
json
"
,
"
event-move
"
,
"
event-resize
"
,
"
transition
"
,
"
querystring-stringify-simple
"
,
"
moodle-core-notification-dialog
"
,
"
moodle-core-notification-alert
"
,
"
moodle-core-notification-exception
"
,
"
moodle-core-notification-ajaxexception
"
]});
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor.js
View file @
b92a7bff
...
...
@@ -5015,7 +5015,7 @@ EDITOR.prototype = {
* @method refresh_button_state
*/
refresh_button_state
:
function
()
{
var
currenttoolnode
,
drawingregion
;
var
currenttoolnode
,
drawingregion
,
drawingcanvas
;
this
.
refresh_button_color_state
();
...
...
@@ -5030,6 +5030,21 @@ EDITOR.prototype = {
}
drawingregion
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGREGION
);
drawingregion
.
setAttribute
(
'
data-currenttool
'
,
this
.
currentedit
.
tool
);
drawingcanvas
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGCANVAS
);
switch
(
this
.
currentedit
.
tool
)
{
case
'
drag
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
move
'
);
break
;
case
'
highlight
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
text
'
);
break
;
case
'
select
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
default
'
);
break
;
default
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
},
/**
...
...
@@ -5662,9 +5677,6 @@ EDITOR.prototype = {
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
drawingregion
.
setStyle
(
'
cursor
'
,
'
move
'
);
}
if
(
tool
!==
"
select
"
)
{
...
...
yui/src/editor/js/editor.js
View file @
b92a7bff
...
...
@@ -236,7 +236,7 @@ EDITOR.prototype = {
* @method refresh_button_state
*/
refresh_button_state
:
function
()
{
var
currenttoolnode
,
drawingregion
;
var
currenttoolnode
,
drawingregion
,
drawingcanvas
;
this
.
refresh_button_color_state
();
...
...
@@ -251,6 +251,21 @@ EDITOR.prototype = {
}
drawingregion
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGREGION
);
drawingregion
.
setAttribute
(
'
data-currenttool
'
,
this
.
currentedit
.
tool
);
drawingcanvas
=
this
.
get_dialogue_element
(
SELECTOR
.
DRAWINGCANVAS
);
switch
(
this
.
currentedit
.
tool
)
{
case
'
drag
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
move
'
);
break
;
case
'
highlight
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
text
'
);
break
;
case
'
select
'
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
default
'
);
break
;
default
:
drawingcanvas
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
},
/**
...
...
@@ -883,9 +898,6 @@ EDITOR.prototype = {
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
drawingregion
.
setStyle
(
'
cursor
'
,
'
move
'
);
}
if
(
tool
!==
"
select
"
)
{
...
...
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