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
065b0666
Commit
065b0666
authored
Oct 16, 2019
by
Francois.Morier-Genoud
Browse files
minimal version complet: added appreciation on annotation
parent
64cc55a0
Changes
18
Expand all
Show whitespace changes
Inline
Side-by-side
amd/build/annotation.min.js
View file @
065b0666
This diff is collapsed.
Click to expand it.
amd/build/tool.min.js
View file @
065b0666
define
([
"
./global
"
],
function
(
a
){
function
b
(){
return
this
.
_instanceID
=
d
(),
this
}
var
c
=
0
,
d
=
function
(){
return
++
c
};
return
b
.
getInstanceCount
=
function
(){
return
c
},
b
.
prototype
.
getInstanceID
=
function
(){
return
this
.
_instanceID
},
b
.
id
=-
1
,
b
.
axis
=-
1
,
b
.
typetool
=-
1
,
b
.
type
=
null
,
b
.
colors
=
""
,
b
.
cartridge
=
""
,
b
.
cartridgeColor
=
""
,
b
.
texts
=
""
,
b
.
label
=
""
,
b
.
reply
=!
0
,
b
.
enabled
=!
0
,
b
.
orderTool
=
1
e3
,
b
.
prototype
.
init
=
function
(
a
){
this
.
id
=
parseInt
(
a
.
id
,
10
)
||
0
,
this
.
axis
=
parseInt
(
a
.
axis
,
10
)
||
0
,
this
.
type
=
a
.
type
,
this
.
colors
=
a
.
colors
,
this
.
cartridge
=
a
.
cartridge
,
this
.
cartridgeColor
=
a
.
cartridgeColor
,
this
.
texts
=
a
.
texts
,
this
.
label
=
a
.
label
,
this
.
reply
=
a
.
reply
,
this
.
enabled
=
a
.
enabled
,
this
.
orderTool
=
a
.
orderTool
},
b
.
prototype
.
initAdmin
=
function
(
a
){
this
.
id
=
parseInt
(
a
.
toolid
,
10
)
||
0
,
this
.
axis
=
parseInt
(
a
.
axis
,
10
)
||
0
,
this
.
typetool
=
a
.
typetool
,
this
.
label
=
a
.
button
,
this
.
enabled
=
a
.
enable
,
this
.
orderTool
=
a
.
orderTool
},
b
.
prototype
.
getToolTypeLabel
=
function
(){
return
this
.
type
.
label
},
b
.
prototype
.
getToolTypeCartX
=
function
(){
return
this
.
type
.
cartridgeX
},
b
.
prototype
.
getToolTypeCartY
=
function
(){
return
this
.
type
.
cartridgeY
},
b
.
prototype
.
get_color
=
function
(){
var
b
=
a
.
ANNOTATIONCOLOUR
[
this
.
colors
];
return
b
?(
b
=
b
.
replace
(
"
rgb
"
,
"
rgba
"
),
b
=
b
.
replace
(
"
)
"
,
"
,0.5)
"
)):
b
=
this
.
colors
,
b
&&
""
!==
b
?
b
:
this
.
type
.
get_color
()},
b
.
prototype
.
get_color_cartridge
=
function
(){
var
b
=
a
.
ANNOTATIONCOLOUR
[
this
.
cartridgeColor
];
return
b
?(
b
=
b
.
replace
(
"
rgb
"
,
"
rgba
"
),
b
=
b
.
replace
(
"
)
"
,
"
,0.5)
"
)):
b
=
this
.
cartridgeColor
,
b
&&
""
!==
b
?
b
:
this
.
type
.
get_color_cartridge
()},
b
.
prototype
.
getButton
=
function
(
a
){
var
b
=
"
btn-sm
"
,
c
=
""
;
1
!==
this
.
enabled
&&
(
c
=
"
background-image:none;background-color:#CCCCCC;
"
),
this
.
id
===
a
&&
(
b
=
"
btn-primary
"
),
4
!==
this
.
typetool
&&
1
!==
this
.
typetool
||
(
c
+=
"
text-decoration: underline;
"
);
var
d
=
this
.
label
;
4
!==
this
.
typetool
&&
5
!==
this
.
typetool
||
(
d
=
"
|
"
+
d
,
4
===
this
.
typetool
&&
(
d
+=
"
|
"
));
var
e
=
"
<button class='btn
"
+
b
+
"
editpdlplus_tool' id='editpdlplus_tool_
"
+
this
.
id
+
"
' style='
"
+
c
+
"
' value='
"
+
this
.
id
+
"
' data-enable='
"
+
this
.
enabled
+
"
'>
"
+
d
+
"
</button>
"
;
return
e
},
b
.
prototype
.
getButtonSortable
=
function
(
a
){
return
"
<li style='float: left;display: block;'>
"
+
this
.
getButton
(
a
)
+
"
</li>
"
},
b
});
\ No newline at end of file
define
([
"
./global
"
],
function
(
a
){
function
b
(){
return
this
.
_instanceID
=
d
(),
this
}
var
c
=
0
,
d
=
function
(){
return
++
c
};
return
b
.
getInstanceCount
=
function
(){
return
c
},
b
.
prototype
.
getInstanceID
=
function
(){
return
this
.
_instanceID
},
b
.
id
=-
1
,
b
.
axis
=-
1
,
b
.
typetool
=-
1
,
b
.
type
=
null
,
b
.
colors
=
""
,
b
.
cartridge
=
""
,
b
.
cartridgeColor
=
""
,
b
.
texts
=
""
,
b
.
label
=
""
,
b
.
reply
=!
0
,
b
.
appreciation
=
0
,
b
.
enabled
=!
0
,
b
.
orderTool
=
1
e3
,
b
.
prototype
.
init
=
function
(
a
){
this
.
id
=
parseInt
(
a
.
id
,
10
)
||
0
,
this
.
axis
=
parseInt
(
a
.
axis
,
10
)
||
0
,
this
.
type
=
a
.
type
,
this
.
colors
=
a
.
colors
,
this
.
cartridge
=
a
.
cartridge
,
this
.
cartridgeColor
=
a
.
cartridgeColor
,
this
.
texts
=
a
.
texts
,
this
.
label
=
a
.
label
,
this
.
reply
=
a
.
reply
,
this
.
enabled
=
a
.
enabled
,
this
.
orderTool
=
a
.
orderTool
},
b
.
prototype
.
initAdmin
=
function
(
a
){
this
.
id
=
parseInt
(
a
.
toolid
,
10
)
||
0
,
this
.
axis
=
parseInt
(
a
.
axis
,
10
)
||
0
,
this
.
typetool
=
a
.
typetool
,
this
.
label
=
a
.
button
,
this
.
enabled
=
a
.
enable
,
this
.
orderTool
=
a
.
orderTool
},
b
.
prototype
.
getToolTypeLabel
=
function
(){
return
this
.
type
.
label
},
b
.
prototype
.
getToolTypeCartX
=
function
(){
return
this
.
type
.
cartridgeX
},
b
.
prototype
.
getToolTypeCartY
=
function
(){
return
this
.
type
.
cartridgeY
},
b
.
prototype
.
get_color
=
function
(){
var
b
=
a
.
ANNOTATIONCOLOUR
[
this
.
colors
];
return
b
?(
b
=
b
.
replace
(
"
rgb
"
,
"
rgba
"
),
b
=
b
.
replace
(
"
)
"
,
"
,0.5)
"
)):
b
=
this
.
colors
,
b
&&
""
!==
b
?
b
:
this
.
type
.
get_color
()},
b
.
prototype
.
get_color_cartridge
=
function
(){
var
b
=
a
.
ANNOTATIONCOLOUR
[
this
.
cartridgeColor
];
return
b
?(
b
=
b
.
replace
(
"
rgb
"
,
"
rgba
"
),
b
=
b
.
replace
(
"
)
"
,
"
,0.5)
"
)):
b
=
this
.
cartridgeColor
,
b
&&
""
!==
b
?
b
:
this
.
type
.
get_color_cartridge
()},
b
.
prototype
.
getButton
=
function
(
a
){
var
b
=
""
,
c
=
""
;
1
!==
this
.
enabled
&&
(
c
=
"
background-image:none;background-color:#CCCCCC;
"
),
this
.
id
===
a
&&
(
b
=
"
btn-primary
"
),
4
!==
this
.
typetool
&&
1
!==
this
.
typetool
||
(
c
+=
"
text-decoration: underline;
"
);
var
d
=
this
.
label
;
4
!==
this
.
typetool
&&
5
!==
this
.
typetool
||
(
d
=
"
|
"
+
d
,
4
===
this
.
typetool
&&
(
d
+=
"
|
"
));
var
e
=
"
<button class='btn
"
+
b
+
"
editpdlplus_tool' id='editpdlplus_tool_
"
+
this
.
id
+
"
' style='
"
+
c
+
"
' value='
"
+
this
.
id
+
"
' data-enable='
"
+
this
.
enabled
+
"
'>
"
+
d
+
"
</button>
"
;
return
e
},
b
.
prototype
.
getButtonSortable
=
function
(
a
){
return
"
<li style='float: left;display: block;'>
"
+
this
.
getButton
(
a
)
+
"
</li>
"
},
b
});
\ No newline at end of file
amd/src/annotation.js
View file @
065b0666
...
...
@@ -137,6 +137,7 @@ define(['jquery', './global'],
* @public
*/
Annotation
.
cartridgex
=
0
;
/**
* position y of the cartridge.
* @property cartridgey
...
...
@@ -144,6 +145,15 @@ define(['jquery', './global'],
* @public
*/
Annotation
.
cartridgey
=
0
;
/**
* appreciation of the annotation.
* @property appreciation
* @type Int
* @public
*/
Annotation
.
appreciation
=
0
;
/**
* mode readonly demo or not
* @property adminDemo
...
...
amd/src/tool.js
View file @
065b0666
...
...
@@ -125,6 +125,15 @@ define(['./global'],
* @type Boolean
*/
Tool
.
reply
=
true
;
/**
* default appreciation of the annotation.
* @property appreciation
* @type Int
* @public
*/
Tool
.
appreciation
=
0
;
/**
* If the tool can be used in annotation workspace
* @property enabled
...
...
classes/admin_editor.php
View file @
065b0666
...
...
@@ -99,6 +99,10 @@ class admin_editor {
$tool
->
cartridge_color
=
$data
->
catridgecolor
;
$tool
->
contextid
=
$contextid
;
$tool
->
label
=
$data
->
button
;
$tool
->
appreciation
=
0
;
if
(
$data
->
appreciation
)
{
$tool
->
appreciation
=
$data
->
appreciation
;
}
$tool
->
reply
=
0
;
if
(
$data
->
reply
==
"on"
)
{
$tool
->
reply
=
1
;
...
...
@@ -304,6 +308,7 @@ class admin_editor {
$tool
->
texts
=
$tool_json
->
texts
;
$tool
->
label
=
$tool_json
->
button
;
$tool
->
enabled
=
$tool_json
->
enabled
;
$tool
->
appreciation
=
$tool_json
->
appreciation
;
if
(
$tool_json
->
reply
==
"on"
)
{
$tool
->
reply
=
1
;
}
else
{
...
...
classes/bdd/annotation.php
View file @
065b0666
...
...
@@ -75,6 +75,9 @@ class annotation {
/** @var bool displayrotation for displaying the sign of the annotation */
public
$displayrotation
=
0
;
/** @var int appreciation of the annotation -1 = negative 0 = neutral 1 = positive */
public
$appreciation
=
0
;
/** @var string borderstyle */
public
$borderstyle
=
''
;
...
...
@@ -140,6 +143,7 @@ class annotation {
$this
->
colour
=
$annotationRef
->
colour
;
$this
->
displaylock
=
$annotationRef
->
displaylock
;
$this
->
displayrotation
=
$annotationRef
->
displayrotation
;
$this
->
appreciation
=
$annotationRef
->
appreciation
;
$this
->
borderstyle
=
$annotationRef
->
borderstyle
;
//$this->parent_annot = $annotationRef->parent_annot;
$this
->
answerrequested
=
$annotationRef
->
answerrequested
;
...
...
classes/bdd/tool.php
View file @
065b0666
...
...
@@ -67,6 +67,9 @@ class tool {
/** @var boolean, allow reply or not */
public
$reply
=
0
;
/** @var int default appreciation of the annotation -1 = negative 0 = neutral 1 = positive */
public
$appreciation
=
0
;
/** @var boolean, if tool is actived or not */
public
$enabled
=
1
;
...
...
db/install.xml
View file @
065b0666
...
...
@@ -25,6 +25,7 @@
<FIELD
NAME=
"studentstatus"
TYPE=
"char"
LENGTH=
"50"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"displaylock"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"1"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"displayrotation"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"appreciation"
TYPE=
"int"
LENGTH=
"2"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"borderstyle"
TYPE=
"char"
LENGTH=
"20"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"parent_annot"
TYPE=
"int"
LENGTH=
"10"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"pdfdisplay"
TYPE=
"char"
LENGTH=
"20"
NOTNULL=
"false"
/>
...
...
@@ -67,6 +68,7 @@
<FIELD
NAME=
"texts"
TYPE=
"char"
LENGTH=
"500"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"label"
TYPE=
"char"
LENGTH=
"20"
NOTNULL=
"true"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"reply"
TYPE=
"int"
LENGTH=
"2"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"appreciation"
TYPE=
"int"
LENGTH=
"2"
NOTNULL=
"true"
DEFAULT=
"0"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"enabled"
TYPE=
"int"
LENGTH=
"1"
NOTNULL=
"true"
DEFAULT=
"1"
SEQUENCE=
"false"
/>
<FIELD
NAME=
"order_tool"
TYPE=
"int"
LENGTH=
"11"
NOTNULL=
"false"
SEQUENCE=
"false"
/>
</FIELDS>
...
...
db/upgrade.php
View file @
065b0666
...
...
@@ -382,5 +382,24 @@ function xmldb_assignfeedback_editpdfplus_upgrade($oldversion) {
upgrade_plugin_savepoint
(
true
,
2019070100
,
'assignfeedback'
,
'editpdfplus'
);
}
if
(
$oldversion
<
2019100801
)
{
/* annotation table */
$table
=
new
xmldb_table
(
'assignfeedback_editpp_annot'
);
$field
=
new
xmldb_field
(
'appreciation'
,
XMLDB_TYPE_INTEGER
,
'2'
,
null
,
true
,
false
,
0
);
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
/* tool table */
$table
=
new
xmldb_table
(
'assignfeedback_editpp_tool'
);
$field
=
new
xmldb_field
(
'appreciation'
,
XMLDB_TYPE_INTEGER
,
'2'
,
null
,
true
,
false
,
0
);
if
(
!
$dbman
->
field_exists
(
$table
,
$field
))
{
$dbman
->
add_field
(
$table
,
$field
);
}
// Editpdfplus savepoint reached.
upgrade_plugin_savepoint
(
true
,
2019100801
,
'assignfeedback'
,
'editpdfplus'
);
}
return
true
;
}
lang/en/assignfeedback_editpdfplus.php
View file @
065b0666
...
...
@@ -155,6 +155,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string
[
'admintoolboxannotation_color'
]
=
'Color'
;
$string
[
'admintoolboxannotation_texts'
]
=
'Predefined texts'
;
$string
[
'admintoolboxannotation_reply'
]
=
'Question/answer'
;
$string
[
'admintoolboxannotation_appreciation'
]
=
'Default appreciation'
;
$string
[
'appreciation_negative'
]
=
'Negative'
;
$string
[
'appreciation_neutral'
]
=
'Neutral'
;
$string
[
'appreciation_positive'
]
=
'Positive'
;
$string
[
'admindeltool_messageok'
]
=
'Tool deleted'
;
$string
[
'admindeltool_messageko'
]
=
'Error on delete'
;
$string
[
'adminaddtool_messageok'
]
=
'Tool added'
;
...
...
lang/fr/assignfeedback_editpdfplus.php
View file @
065b0666
...
...
@@ -154,6 +154,10 @@ $string['admintoolboxannotation'] = 'Annotation';
$string
[
'admintoolboxannotation_color'
]
=
'Couleur'
;
$string
[
'admintoolboxannotation_texts'
]
=
'Textes prédéfinis'
;
$string
[
'admintoolboxannotation_reply'
]
=
'Question/réponse'
;
$string
[
'admintoolboxannotation_appreciation'
]
=
'Appréciation par défault'
;
$string
[
'appreciation_negative'
]
=
'Négative'
;
$string
[
'appreciation_neutral'
]
=
'Neutre'
;
$string
[
'appreciation_positive'
]
=
'Positive'
;
$string
[
'admindeltool_messageok'
]
=
'Outil supprimé'
;
$string
[
'admindeltool_messageko'
]
=
'Erreur à la suppression'
;
$string
[
'adminaddtool_messageok'
]
=
'Ajout enregistré'
;
...
...
templates/tool_form.mustache
View file @
065b0666
...
...
@@ -179,6 +179,16 @@
<input
type=
"checkbox"
id=
"reply"
{{#
tool
.
reply
}}
checked
{{/
tool
.
reply
}}
name=
"reply"
/>
</div>
</div>
<div
class=
"form-group row"
>
<label
class=
"col-sm-3 form-control-label"
for=
"reply"
>
{{#
str
}}
admintoolboxannotation_appreciation, assignfeedback_editpdfplus
{{/
str
}}
</label>
<div
class=
"col-sm-9"
>
<select
class=
"form-control"
id=
"appreciation"
name=
"appreciation"
>
<option
value=
'-1'
>
{{#
str
}}
appreciation_negative, assignfeedback_editpdfplus
{{/
str
}}
</option>
<option
selected=
"selected"
value=
'0'
>
{{#
str
}}
appreciation_neutral, assignfeedback_editpdfplus
{{/
str
}}
</option>
<option
value=
'1'
>
{{#
str
}}
appreciation_positive, assignfeedback_editpdfplus
{{/
str
}}
</option>
</select>
</div>
</div>
</div>
</div>
</div>
...
...
@@ -208,8 +218,11 @@
{{#
js
}}
require(['jquery','core/ajax','core/notification'], function($,ajax,notification) {
{{#
tool
.
id
}}
$("#typetool").val(
{{
tool
.
type
}}
);
{{/
tool
.
id
}}
{{#
tool
.
id
}}
$("#toolaxis").val(
{{
tool
.
axis
}}
);
{{/
tool
.
id
}}
{{#
tool
.
id
}}
$("#typetool").val(
{{
tool
.
type
}}
);
$("#toolaxis").val(
{{
tool
.
axis
}}
);
$("#appreciation").val(
{{
tool
.
appreciation
}}
);
{{/
tool
.
id
}}
var $collectionHolder;
...
...
version.php
View file @
065b0666
...
...
@@ -25,9 +25,9 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
version
=
2019
070102
;
$plugin
->
version
=
2019
100801
;
$plugin
->
requires
=
2019051100
;
// Moodle 3.7
$plugin
->
maturity
=
MATURITY_STABLE
;
$plugin
->
release
=
"2.
3.5
(Build: 2019
070102
)"
;
$plugin
->
release
=
"2.
4.0
(Build: 2019
100801
)"
;
$plugin
->
component
=
'assignfeedback_editpdfplus'
;
yui/build/moodle-assignfeedback_editpdfplus-editor/moodle-assignfeedback_editpdfplus-editor-debug.js
View file @
065b0666
...
...
@@ -57,7 +57,8 @@ var AJAXBASE = M.cfg.wwwroot + '/mod/assign/feedback/editpdfplus/ajax.php',
HELPBTNCLASS
:
'
.helpmessage
'
,
STATUTSELECTOR
:
'
#menustatutselection
'
,
QUESTIONSELECTOR
:
'
#menuquestionselection
'
,
STUDENTVALIDATION
:
'
#student_valide_button
'
STUDENTVALIDATION
:
'
#student_valide_button
'
,
NOHIDE
:
'
noHide
'
},
SELECTEDBORDERCOLOUR
=
'
rgba(200, 200, 255, 0.9)
'
,
SELECTEDFILLCOLOUR
=
'
rgba(200, 200, 255, 0.5)
'
,
...
...
@@ -690,6 +691,16 @@ Y.extend(ANNOTATION, Y.Base, {
* @public
*/
displayrotation
:
0
,
/**
* Appreciation of the annotation
* -1 = negative 0 = neutral 1 = positive
* @property appreciation
* @type Int
* @public
*/
appreciation
:
0
,
/**
* Border style for cartridge and other element (frame...)
* @property borderstyle
...
...
@@ -767,12 +778,21 @@ Y.extend(ANNOTATION, Y.Base, {
* @public
*/
pdfdisplay
:
"
footnote
"
,
/**
* minimum size for resize area
* @type Int
* @public
*/
minresizewidth
:
20
,
/**
* used to check if the annotation needs to be minimized
* @type Int
* @public
*/
hideAnnot
:
1
,
/**
* Initialise the annotation.
*
...
...
@@ -790,7 +810,8 @@ Y.extend(ANNOTATION, Y.Base, {
this
.
tooltype
=
config
.
tooltype
;
this
.
textannot
=
config
.
parent_annot_element
.
textannot
;
this
.
displaylock
=
parseInt
(
config
.
parent_annot_element
.
displaylock
,
10
);
this
.
displayrotation
=
config
.
parent_annot_element
.
displayrotation
;
this
.
displayrotation
=
parseInt
(
config
.
parent_annot_element
.
displayrotation
,
10
);
this
.
appreciation
=
parseInt
(
config
.
parent_annot_element
.
appreciation
,
10
)
||
0
;
this
.
borderstyle
=
config
.
parent_annot_element
.
borderstyle
||
'
solid
'
;
this
.
parent_annot
=
parseInt
(
config
.
parent_annot_element
.
id
,
10
);
this
.
answerrequested
=
parseInt
(
config
.
parent_annot_element
.
answerrequested
,
10
)
||
0
;
...
...
@@ -806,7 +827,8 @@ Y.extend(ANNOTATION, Y.Base, {
this
.
tooltype
=
config
.
tooltype
;
this
.
textannot
=
config
.
textannot
;
this
.
displaylock
=
parseInt
(
config
.
displaylock
,
10
);
this
.
displayrotation
=
config
.
displayrotation
;
this
.
displayrotation
=
parseInt
(
config
.
displayrotation
,
10
);
this
.
appreciation
=
parseInt
(
config
.
appreciation
,
10
)
||
0
;
this
.
borderstyle
=
config
.
borderstyle
||
'
solid
'
;
this
.
parent_annot
=
parseInt
(
config
.
parent_annot
,
10
);
this
.
answerrequested
=
parseInt
(
config
.
answerrequested
,
10
)
||
0
;
...
...
@@ -849,12 +871,14 @@ Y.extend(ANNOTATION, Y.Base, {
textannot
:
this
.
textannot
,
displaylock
:
parseInt
(
this
.
displaylock
,
10
),
displayrotation
:
parseInt
(
this
.
displayrotation
,
10
),
appreciation
:
parseInt
(
this
.
appreciation
,
10
),
borderstyle
:
this
.
borderstyle
,
parent_annot
:
parseInt
(
this
.
parent_annot
,
10
),
divcartridge
:
this
.
divcartridge
,
parent_annot_div
:
this
.
parent_annot_element
.
divcartridge
,
answerrequested
:
parseInt
(
this
.
answerrequested
,
10
),
pdfdisplay
:
this
.
pdfdisplay
pdfdisplay
:
this
.
pdfdisplay
,
appreciationdisplay
:
this
.
appreciationdisplay
};
}
return
{
...
...
@@ -873,13 +897,15 @@ Y.extend(ANNOTATION, Y.Base, {
textannot
:
this
.
textannot
,
displaylock
:
parseInt
(
this
.
displaylock
,
10
),
displayrotation
:
parseInt
(
this
.
displayrotation
,
10
),
appreciation
:
parseInt
(
this
.
appreciation
,
10
),
borderstyle
:
this
.
borderstyle
,
parent_annot
:
parseInt
(
this
.
parent_annot
,
10
),
divcartridge
:
this
.
divcartridge
,
parent_annot_div
:
''
,
answerrequested
:
parseInt
(
this
.
answerrequested
,
10
),
studentstatus
:
parseInt
(
this
.
studentstatus
,
10
),
pdfdisplay
:
this
.
pdfdisplay
pdfdisplay
:
this
.
pdfdisplay
,
appreciationdisplay
:
this
.
appreciationdisplay
};
},
/**
...
...
@@ -1185,6 +1211,7 @@ Y.extend(ANNOTATION, Y.Base, {
divconteneurdisplay
.
append
(
inputonof
);
divconteneurdisplay
.
append
(
this
.
get_input_question
());
divconteneurdisplay
.
append
(
this
.
get_input_pdfdisplay
());
divconteneurdisplay
.
append
(
this
.
get_input_appreciationdisplay
());
return
divconteneurdisplay
;
},
...
...
@@ -1202,6 +1229,7 @@ Y.extend(ANNOTATION, Y.Base, {
divtoolbardisplay
.
append
(
this
.
get_button_visibility_right
());
divtoolbardisplay
.
append
(
this
.
get_button_save
());
divtoolbardisplay
.
append
(
this
.
get_button_cancel
());
divtoolbardisplay
.
append
(
this
.
get_button_appreciation
());
if
(
this
.
tooltype
.
reply
===
1
)
{
divtoolbardisplay
.
append
(
this
.
get_button_question
());
}
...
...
@@ -1347,6 +1375,30 @@ Y.extend(ANNOTATION, Y.Base, {
buttontrashdisplay
.
on
(
'
click
'
,
this
.
change_pdf_display
,
this
);
return
buttontrashdisplay
;
},
/**
* get the html node for the button to change appreciation for the annotation
* @return node
*/
get_button_appreciation
:
function
()
{
//aaaa
var
iconClass
=
'
fa fa-meh-o
'
;
var
buttonappreciation
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonappreciation' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark
"
+
SELECTOR
.
NOHIDE
+
"
'
"
+
"
type='button'>
"
+
"
<i class='
"
+
iconClass
+
"
"
+
SELECTOR
.
NOHIDE
+
"
' aria-hidden='true'></i>
"
+
"
</button>
"
;
var
buttonappreciationdisplay
=
Y
.
Node
.
create
(
buttonappreciation
);
buttonappreciationdisplay
.
on
(
'
click
'
,
this
.
change_appreciation_display
,
this
);
return
buttonappreciationdisplay
;
},
/**
* get the html node for the hidden input to keep information about question state
* @return node
...
...
@@ -1365,6 +1417,28 @@ Y.extend(ANNOTATION, Y.Base, {
get_input_pdfdisplay
:
function
()
{
return
Y
.
Node
.
create
(
"
<input type='hidden' id='
"
+
this
.
divcartridge
+
"
_pdfdisplay' value='
"
+
this
.
pdfdisplay
+
"
'/>
"
);
},
/**
* get the html node for the hidden input to keep information about appreciation state
* @return node
*/
get_input_appreciationdisplay
:
function
()
{
window
.
console
.
log
(
this
.
appreciation
);
var
appreciation
=
this
.
appreciation
;
if
(
!
this
.
id
&&
this
.
tooltype
.
appreciation
)
{
appreciation
=
this
.
tooltype
.
appreciation
;
}
window
.
console
.
log
(
appreciation
);
return
Y
.
Node
.
create
(
"
<input type='hidden' id='
"
+
this
.
divcartridge
+
"
_appreciationdisplay' value='
"
+
appreciation
+
"
'/>
"
);
},
/**
* get the final reference text value
* @return node
...
...
@@ -1429,6 +1503,7 @@ Y.extend(ANNOTATION, Y.Base, {
}
this
.
apply_question_status
();
this
.
apply_pdfdisplay
();
this
.
apply_appreciationdisplay
();
},
/**
* get the html node for the text to display for the annotation, according to parameters
...
...
@@ -1475,6 +1550,9 @@ Y.extend(ANNOTATION, Y.Base, {
* change question status of the annotation (with or not)
*/
change_pdf_display
:
function
()
{
window
.
console
.
log
(
'
pdfdisplay
'
);
var
pdfdisplayvalue
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_pdfdisplay
"
);
var
value
=
pdfdisplayvalue
.
get
(
'
value
'
);
if
(
value
===
"
footnote
"
)
{
...
...
@@ -1484,9 +1562,42 @@ Y.extend(ANNOTATION, Y.Base, {
pdfdisplayvalue
.
set
(
'
value
'
,
"
footnote
"
);
this
.
pdfdisplay
=
"
footnote
"
;
}
this
.
hideAnnot
=
0
;
this
.
apply_pdfdisplay
();
this
.
editor
.
save_current_page
();
},
/**
* change appreciation of the annotation (positive, neutral, negative)
*/
change_appreciation_display
:
function
()
{
window
.
console
.
log
(
'
ChangeAppreciation
'
);
var
appreciationdisplayvalue
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_appreciationdisplay
"
);
if
(
appreciationdisplayvalue
!==
null
)
{
var
value
=
appreciationdisplayvalue
.
get
(
'
value
'
);
if
(
value
==
1
)
{
appreciationdisplayvalue
.
set
(
'
value
'
,
0
);
this
.
appreciation
=
0
;
}
else
if
(
value
==
-
1
)
{
appreciationdisplayvalue
.
set
(
'
value
'
,
1
);
this
.
appreciation
=
1
;
}
else
{
appreciationdisplayvalue
.
set
(
'
value
'
,
-
1
);
this
.
appreciation
=
-
1
;
}
this
.
hideAnnot
=
0
;
this
.
apply_appreciationdisplay
();
this
.
editor
.
save_current_page
();
}
},
/**
* change question status of the annotation (with or not)
*/
...
...
@@ -1499,6 +1610,9 @@ Y.extend(ANNOTATION, Y.Base, {
}
questionvalue
.
set
(
'
value
'
,
finalvalue
);
this
.
answerrequested
=
finalvalue
;
this
.
hideAnnot
=
0
;
this
.
apply_question_status
();
this
.
editor
.
save_current_page
();
},
...
...
@@ -1566,6 +1680,35 @@ Y.extend(ANNOTATION, Y.Base, {
}
return
;
},
/**
* change pdf display mode set of the annotation
* @return null
*/
apply_appreciationdisplay
:
function
()
{
window
.
console
.
log
(
'
AppreciationDisplay
'
);
var
buttonappreciation
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonappreciation
"
);
if
(
!
buttonappreciation
)
{
return
;
}
var
appreciationdisplayvalue
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_appreciationdisplay
"
);
var
value
=
appreciationdisplayvalue
.
get
(
'
value
'
);
if
(
value
==
1
)
{
buttonappreciation
.
setHTML
(
"
<i class='fa fa-smile-o
"
+
SELECTOR
.
NOHIDE
+
"
' aria-hidden='true'></i>
"
);
}
else
if
(
value
==
-
1
)
{
buttonappreciation
.
setHTML
(
"
<i class='fa fa-frown-o
"
+
SELECTOR
.
NOHIDE
+
"
' aria-hidden='true'></i>
"
);
}
else
{
buttonappreciation
.
setHTML
(
"
<i class='fa fa-meh-o
"
+
SELECTOR
.
NOHIDE
+
"
' aria-hidden='true'></i>
"
);
}
return
;
},
/**
* drag-and-drop start
* @param {type} e
...
...
@@ -1618,7 +1761,6 @@ Y.extend(ANNOTATION, Y.Base, {
var
divcartridge
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
);
divcartridge
.
setX
(
offsetcanvas
[
0
]
+
this
.
x
+
this
.
cartridgex
);
divcartridge
.
setY
(
offsetcanvas
[
1
]
+
this
.
y
+
this
.
cartridgey
);
//window.console.log('move_cartridge_stop');
this
.
editor
.
save_current_page
();
},
/**
...
...
@@ -1787,6 +1929,7 @@ Y.extend(ANNOTATION, Y.Base, {
var
buttonquestion
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonquestion
"
);
var
buttonrotation
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonrotation
"
);
var
buttonpdfdisplay
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonpdfdisplay
"
);
var
buttonappreciation
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonappreciation
"
);
var
buttonremove
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonremove
"
);
var
input
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_editinput
"
);
divdisplay
.
hide
();
...
...
@@ -1806,6 +1949,7 @@ Y.extend(ANNOTATION, Y.Base, {
buttonquestion
.
show
();
}
buttonpdfdisplay
.
show
();
buttonappreciation
.
show
();
buttonremove
.
show
();
divprincipale
.
setStyle
(
'
z-index
'
,
1000
);
if
(
input
)
{
...
...
@@ -1827,10 +1971,24 @@ Y.extend(ANNOTATION, Y.Base, {
}
this
.
save_annot
(
unputtext
);
},
save_annot_clickout
:
function
(
e
,
clickType
)
{
//aaaaaaaaaa
window
.
console
.
log
(
'
clickout
'
);
window
.
console
.
log
(
e
);
window
.
console
.
log
(
e
.
target
.
get
(
'
className
'
));
if
(
e
.
target
.
get
(
'
className
'
).
includes
(
SELECTOR
.
NOHIDE
))
{
return
;
}
if
(
!
(
clickType
===
'
clickoutside
'
&&
this
.
editor
.
currentannotation
===
this
))
{
this
.
save_annot
(
null
);
}
return
;
},
/**
...
...
@@ -1891,6 +2049,15 @@ Y.extend(ANNOTATION, Y.Base, {
* @param {string} clickType
*/
hide_edit
:
function
(
e
,
clickType
)
{
window
.
console
.
log
(
'
hideedit
'
);
//used when specific toolbar button are clicked(appreciation, question, pdf)
if
(
this
.
hideAnnot
===
0
)
{
this
.
hideAnnot
=
1
;
return
;
}
if
(
!
clickType
||
!
(
clickType
===
'
clickoutside
'
&&
this
.
editor
.
currentannotation
===
this
))
{
var
divprincipale
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
);
var
divdisplay
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_display
"
);
...
...
@@ -1901,6 +2068,7 @@ Y.extend(ANNOTATION, Y.Base, {
var
buttonquestion
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonquestion
"
);
var
buttonrotation
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonrotation
"
);
var
buttonpdfdisplay
=
this
.
editor
.
get_dialogue_element
(
'
#
'
+
this
.
divcartridge
+
"
_buttonpdfdisplay
"
);
var
buttonappreciation
=
this
.