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
e37f2418
Commit
e37f2418
authored
Jun 08, 2018
by
M. Chardon
Browse files
optimisation php tools
parent
86f640c4
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
classes/bdd/tool_generic.php
View file @
e37f2418
...
...
@@ -45,7 +45,14 @@ class tool_generic extends tool {
public
function
getRendererBoutonHTMLDisplay
(
$disabled
=
false
)
{
$iconhtml
=
\
html_writer
::
tag
(
"i"
,
""
,
array
(
'class'
=>
self
::
DISPLAY_CLASS_BUTTON
[
$this
->
label
],
'aria-hidden'
=>
'true'
));
$iconparams
=
array
(
'data-tool'
=>
$this
->
label
,
'class'
=>
$this
->
label
.
'button generictoolbarbutton btn btn-secondary'
,
'type'
=>
'button'
);
$iconparams
=
array
(
'data-tool'
=>
$this
->
label
,
'class'
=>
$this
->
label
.
'button generictoolbarbutton btn btn-secondary'
,
'type'
=>
'button'
);
if
(
$this
->
id
)
{
$iconparams
[
'id'
]
=
'ctbutton'
.
$this
->
id
;
}
if
(
$disabled
)
{
$iconparams
[
'disabled'
]
=
'true'
;
}
...
...
classes/page_editor.php
View file @
e37f2418
...
...
@@ -48,6 +48,7 @@ class page_editor {
const
CONTEXTID
=
"contextid"
;
const
GRADEID
=
"gradeid"
;
const
DRAFLIB
=
"draft"
;
const
AXISGENERIC
=
0
;
/**
* Get all tools for a page.
...
...
@@ -72,7 +73,7 @@ class page_editor {
}
foreach
(
$records
as
$record
)
{
$tooltmp
=
null
;
if
(
7
<
$record
->
type
&&
$record
->
type
<
13
)
{
if
(
$record
->
axis
==
self
::
AXISGENERIC
)
{
$tooltmp
=
new
tool_generic
(
$record
);
}
else
{
$tooltmp
=
new
tool
(
$record
);
...
...
classes/renderer.php
View file @
e37f2418
...
...
@@ -110,17 +110,14 @@ class assignfeedback_editpdfplus_renderer extends plugin_renderer_base {
'aria-hidden'
=>
'true'
));
$navigation
.
=
html_writer
::
tag
(
'button'
,
$iconhtmlP
,
array
(
'disabled'
=>
'true'
,
'class'
=>
'btn btn-secondary navigate-previous-button'
,
'type'
=>
'button'
,
'accesskey'
=>
$this
->
get_shortcut
(
'navigate-previous-button'
)));
'type'
=>
'button'
));
$navigation
.
=
html_writer
::
tag
(
'select'
,
null
,
array
(
'disabled'
=>
'true'
,
'aria-label'
=>
get_string
(
'gotopage'
,
'assignfeedback_editpdfplus'
),
'class'
=>
self
::
TOOL_NAVPAGESELECT
,
'accesskey'
=>
$this
->
get_shortcut
(
self
::
TOOL_NAVPAGESELECT
)));
'aria-label'
=>
get_string
(
'gotopage'
,
'assignfeedback_editpdfplus'
),
'class'
=>
self
::
TOOL_NAVPAGESELECT
));
$iconhtmlN
=
html_writer
::
tag
(
"i"
,
""
,
array
(
'class'
=>
'fa fa-caret-right fa-2x'
,
'aria-hidden'
=>
'true'
));
$navigation
.
=
html_writer
::
tag
(
'button'
,
$iconhtmlN
,
array
(
'disabled'
=>
'true'
,
'class'
=>
'btn btn-secondary '
.
self
::
TOOL_NAVPAGENEXT
,
'type'
=>
'button'
,
'accesskey'
=>
$this
->
get_shortcut
(
self
::
TOOL_NAVPAGENEXT
)));
'type'
=>
'button'
));
$navigationBlock
=
html_writer
::
div
(
$navigation
,
"btn-group btn-group-sm mr-auto"
,
array
(
'role'
=>
'group'
));
...
...
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-debug.js
View file @
e37f2418
...
...
@@ -34,8 +34,6 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DRAWINGREGION
:
'
.drawingregion
'
,
DRAWINGCANVAS
:
'
.drawingcanvas
'
,
SAVE
:
'
.savebutton
'
,
COMMENTCOLOURBUTTON
:
'
.commentcolourbutton
'
,
COMMENTMENU
:
'
.commentdrawable a
'
,
ANNOTATIONCOLOURBUTTON
:
'
.annotationcolourbutton
'
,
DELETEANNOTATIONBUTTON
:
'
.deleteannotationbutton
'
,
UNSAVEDCHANGESDIV
:
'
.assignfeedback_editpdfplus_unsavedchanges
'
,
...
...
@@ -46,6 +44,7 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
GENERICTOOLBARBUTTONS
:
'
.generictoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
,
QUESTIONSELECTOR
:
'
#menuquestionselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
...
...
@@ -5657,11 +5656,11 @@ EDITOR.prototype = {
currenttoolnode
.
setAttribute
(
'
aria-pressed
'
,
'
false
'
);
drawingregion
.
setStyle
(
'
cursor
'
,
'
auto
'
);
}
//update
l
e currentedit object with the new tool
//update
th
e currentedit object with the new tool
this
.
currentedit
.
tool
=
tool
;
this
.
currentedit
.
id
=
toolid
;
if
(
tool
!==
"
comment
"
&&
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
...
...
@@ -5921,38 +5920,36 @@ EDITOR.prototype = {
return
;
}
if
(
this
.
currentedit
.
tool
!==
'
comment
'
)
{
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
}
...
...
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-min.js
View file @
e37f2418
This diff is collapsed.
Click to expand it.
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor.js
View file @
e37f2418
...
...
@@ -34,8 +34,6 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DRAWINGREGION
:
'
.drawingregion
'
,
DRAWINGCANVAS
:
'
.drawingcanvas
'
,
SAVE
:
'
.savebutton
'
,
COMMENTCOLOURBUTTON
:
'
.commentcolourbutton
'
,
COMMENTMENU
:
'
.commentdrawable a
'
,
ANNOTATIONCOLOURBUTTON
:
'
.annotationcolourbutton
'
,
DELETEANNOTATIONBUTTON
:
'
.deleteannotationbutton
'
,
UNSAVEDCHANGESDIV
:
'
.assignfeedback_editpdfplus_unsavedchanges
'
,
...
...
@@ -46,6 +44,7 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
GENERICTOOLBARBUTTONS
:
'
.generictoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
,
QUESTIONSELECTOR
:
'
#menuquestionselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
...
...
@@ -5657,11 +5656,11 @@ EDITOR.prototype = {
currenttoolnode
.
setAttribute
(
'
aria-pressed
'
,
'
false
'
);
drawingregion
.
setStyle
(
'
cursor
'
,
'
auto
'
);
}
//update
l
e currentedit object with the new tool
//update
th
e currentedit object with the new tool
this
.
currentedit
.
tool
=
tool
;
this
.
currentedit
.
id
=
toolid
;
if
(
tool
!==
"
comment
"
&&
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
...
...
@@ -5921,38 +5920,36 @@ EDITOR.prototype = {
return
;
}
if
(
this
.
currentedit
.
tool
!==
'
comment
'
)
{
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
}
...
...
yui/src/editor/js/editor.js
View file @
e37f2418
...
...
@@ -877,11 +877,11 @@ EDITOR.prototype = {
currenttoolnode
.
setAttribute
(
'
aria-pressed
'
,
'
false
'
);
drawingregion
.
setStyle
(
'
cursor
'
,
'
auto
'
);
}
//update
l
e currentedit object with the new tool
//update
th
e currentedit object with the new tool
this
.
currentedit
.
tool
=
tool
;
this
.
currentedit
.
id
=
toolid
;
if
(
tool
!==
"
comment
"
&&
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
if
(
tool
!==
"
select
"
&&
tool
!==
"
drag
"
)
{
this
.
lastannotationtool
=
tool
;
drawingregion
.
setStyle
(
'
cursor
'
,
'
crosshair
'
);
}
else
if
(
tool
===
"
drag
"
)
{
...
...
@@ -1141,38 +1141,36 @@ EDITOR.prototype = {
return
;
}
if
(
this
.
currentedit
.
tool
!==
'
comment
'
)
{
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
var
toolid
=
this
.
currentedit
.
id
;
if
(
this
.
currentedit
.
id
&&
this
.
currentedit
.
id
[
0
]
===
'
c
'
)
{
toolid
=
this
.
currentedit
.
id
.
substr
(
8
);
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
annotation
=
this
.
create_annotation
(
this
.
currentedit
.
tool
,
this
.
currentedit
.
id
,
{},
this
.
tools
[
toolid
]);
if
(
annotation
)
{
if
(
this
.
currentdrawable
)
{
this
.
currentdrawable
.
erase
();
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
currentdrawable
=
false
;
if
(
annotation
.
init_from_edit
(
this
.
currentedit
))
{
this
.
currentannotation
=
annotation
;
annotation
.
draw_catridge
(
this
.
currentedit
);
annotation
.
edit_annot
();
if
(
annotation
.
parent_annot_element
)
{
var
index
=
0
;
if
(
annotation
.
parent_annot_element
.
id
)
{
index
=
annotation
.
parent_annot_element
.
id
;
}
else
{
index
=
annotation
.
parent_annot_element
.
divcartridge
;
}
if
(
this
.
annotationsparent
[
index
])
{
this
.
annotationsparent
[
index
][
this
.
annotationsparent
[
index
].
length
]
=
annotation
;
}
else
{
this
.
annotationsparent
[
index
]
=
[
annotation
];
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
this
.
pages
[
this
.
currentpage
].
annotations
.
push
(
annotation
);
this
.
drawables
.
push
(
annotation
.
draw
());
this
.
drawablesannotations
.
push
(
annotation
);
}
}
...
...
yui/src/editor/js/globals.js
View file @
e37f2418
...
...
@@ -32,8 +32,6 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
DRAWINGREGION
:
'
.drawingregion
'
,
DRAWINGCANVAS
:
'
.drawingcanvas
'
,
SAVE
:
'
.savebutton
'
,
COMMENTCOLOURBUTTON
:
'
.commentcolourbutton
'
,
COMMENTMENU
:
'
.commentdrawable a
'
,
ANNOTATIONCOLOURBUTTON
:
'
.annotationcolourbutton
'
,
DELETEANNOTATIONBUTTON
:
'
.deleteannotationbutton
'
,
UNSAVEDCHANGESDIV
:
'
.assignfeedback_editpdfplus_unsavedchanges
'
,
...
...
@@ -44,6 +42,7 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
CUSTOMTOOLBARS
:
'
.customtoolbar
'
,
AXISCUSTOMTOOLBAR
:
'
.menuaxisselection
'
,
CUSTOMTOOLBARBUTTONS
:
'
.costumtoolbarbutton
'
,
GENERICTOOLBARBUTTONS
:
'
.generictoolbarbutton
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
,
QUESTIONSELECTOR
:
'
#menuquestionselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
...
...
Write
Preview
Markdown
is supported
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