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
a196b645
Commit
a196b645
authored
Aug 07, 2017
by
M. Chardon
Browse files
edition des textes des outils améliorer
parent
d1b74faa
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
amd/build/admin_panel.min.js
View file @
a196b645
This diff is collapsed.
Click to expand it.
amd/build/annotationframe.min.js
View file @
a196b645
define
([
"
jquery
"
,
"
./annotation
"
],
function
(
a
,
b
){
function
c
(){
return
b
.
call
(
this
),
this
}
return
c
.
prototype
=
Object
.
create
(
b
.
prototype
),
c
.
prototype
.
initAdminDemo
=
function
(
a
,
c
){
b
.
prototype
.
initAdminDemo
.
call
(
this
,
a
,
c
),
this
.
x
=
279
,
this
.
y
=
113
,
this
.
endx
=
435
,
this
.
endy
=
129
,
this
.
parent_annot
=
0
},
c
.
prototype
.
initChildAdminDemo
=
function
(
a
){
b
.
prototype
.
initAdminDemo
.
call
(
this
,
a
.
tooltype
,
a
.
tooltypefamille
),
this
.
x
=
144
,
this
.
y
=
216
,
this
.
endx
=
296
,
this
.
endy
=
232
,
this
.
parent_annot
=
a
.
id
,
this
.
id
=
"
previsu_annot_child
"
},
c
.
prototype
.
draw
=
function
(
b
){
if
(
b
){
var
c
=
"
<div id='
"
+
this
.
id
+
"
'></div>
"
;
b
.
append
(
c
),
a
(
"
#
"
+
this
.
id
).
css
(
"
width
"
,
this
.
endx
-
this
.
x
),
a
(
"
#
"
+
this
.
id
).
css
(
"
height
"
,
this
.
endy
-
this
.
y
),
a
(
"
#
"
+
this
.
id
).
css
(
"
border
"
,
"
solid 2px red
"
),
a
(
"
#
"
+
this
.
id
).
css
(
"
position
"
,
"
relative
"
),
a
(
"
#
"
+
this
.
id
).
css
(
"
left
"
,
this
.
x
),
a
(
"
#
"
+
this
.
id
).
css
(
"
top
"
,
this
.
y
)}
return
this
.
draw_catridge
(
b
),
this
},
c
.
prototype
.
draw_catridge
=
function
(
b
){
if
(
!
this
.
parent_annot_element
&&
0
===
this
.
parent_annot
){
var
c
;
if
(
!
this
.
divcartridge
||
""
===
this
.
divcartridge
){
this
.
init_div_cartridge_id
();
var
d
=
a
(
"
#
"
+
this
.
id
);
d
&&
d
.
addClass
(
"
class_
"
+
this
.
divcartridge
);
var
e
=
this
.
get_color
();
c
=
this
.
get_div_cartridge
(
e
,
b
),
c
.
addClass
(
"
assignfeedback_editpdfplus_frame
"
),
this
.
get_div_cartridge_label
(
e
,
c
,
!
0
);
var
f
=
this
.
get_div_container
(
e
,
c
),
g
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonpencil' class='btn btn-default
"
;
this
.
adminDemo
&&
(
g
+=
"
disabled
"
),
g
+=
"
' type='button'>
"
,
g
+=
'
<i class="fa fa-eyedropper" aria-hidden="true"></i>
'
,
g
+=
"
</button>
"
;
var
h
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonadd' class='btn btn-default
"
;
this
.
adminDemo
&&
(
h
+=
"
disabled
"
),
h
+=
"
' type='button'>
"
,
h
+=
'
<i class="fa fa-plus" aria-hidden="true"></i>
'
,
h
+=
"
</button>
"
,
f
.
append
(
g
),
f
.
append
(
h
),
this
.
get_div_edition
(
f
),
this
.
cartridgex
&&
0
!==
this
.
cartridgex
||
(
this
.
cartridgex
=
parseInt
(
this
.
tooltypefamille
.
cartridge_x
,
10
)),
this
.
cartridgey
&&
0
!==
this
.
cartridgey
||
(
this
.
cartridgey
=
parseInt
(
this
.
tooltypefamille
.
cartridge_y
,
10
)),
c
.
css
(
"
left
"
,
this
.
cartridgex
+
15
),
c
.
css
(
"
top
"
,
this
.
y
+
this
.
cartridgey
),
this
.
apply_visibility_annot
()}}
return
!
0
},
c
});
\ No newline at end of file
define
([
"
jquery
"
,
"
./annotation
"
],
function
(
a
,
b
){
function
c
(){
return
b
.
call
(
this
),
this
}
return
c
.
prototype
=
Object
.
create
(
b
.
prototype
),
c
.
prototype
.
initAdminDemo
=
function
(
a
,
c
){
b
.
prototype
.
initAdminDemo
.
call
(
this
,
a
,
c
),
this
.
x
=
279
,
this
.
y
=
113
,
this
.
endx
=
435
,
this
.
endy
=
129
,
this
.
parent_annot
=
0
,
this
.
colour
=
"
#FF0000
"
},
c
.
prototype
.
initChildAdminDemo
=
function
(
a
){
b
.
prototype
.
initAdminDemo
.
call
(
this
,
a
.
tooltype
,
a
.
tooltypefamille
),
this
.
x
=
144
,
this
.
y
=
216
,
this
.
endx
=
296
,
this
.
endy
=
232
,
this
.
parent_annot
=
a
.
id
,
this
.
id
=
"
previsu_annot_child
"
,
this
.
colour
=
"
#FF0000
"
},
c
.
prototype
.
draw
=
function
(
b
){
if
(
b
){
var
c
=
"
<div id='
"
+
this
.
id
+
"
'></div>
"
;
b
.
append
(
c
),
a
(
"
#
"
+
this
.
id
).
css
(
"
width
"
,
this
.
endx
-
this
.
x
),
a
(
"
#
"
+
this
.
id
).
css
(
"
height
"
,
this
.
endy
-
this
.
y
),
a
(
"
#
"
+
this
.
id
).
css
(
"
border
"
,
"
solid 2px red
"
),
a
(
"
#
"
+
this
.
id
).
css
(
"
position
"
,
"
relative
"
),
a
(
"
#
"
+
this
.
id
).
css
(
"
left
"
,
this
.
x
),
a
(
"
#
"
+
this
.
id
).
css
(
"
top
"
,
this
.
y
)}
return
this
.
draw_catridge
(
b
),
this
},
c
.
prototype
.
draw_catridge
=
function
(
b
){
if
(
!
this
.
parent_annot_element
&&
0
===
this
.
parent_annot
){
var
c
;
if
(
!
this
.
divcartridge
||
""
===
this
.
divcartridge
){
this
.
init_div_cartridge_id
();
var
d
=
a
(
"
#
"
+
this
.
id
);
d
&&
d
.
addClass
(
"
class_
"
+
this
.
divcartridge
);
var
e
=
this
.
get_color
();
c
=
this
.
get_div_cartridge
(
e
,
b
),
c
.
addClass
(
"
assignfeedback_editpdfplus_frame
"
),
this
.
get_div_cartridge_label
(
e
,
c
,
!
0
);
var
f
=
this
.
get_div_container
(
e
,
c
),
g
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonpencil' class='btn btn-default
"
;
this
.
adminDemo
&&
(
g
+=
"
disabled
"
),
g
+=
"
' type='button'>
"
,
g
+=
'
<i class="fa fa-eyedropper" aria-hidden="true"></i>
'
,
g
+=
"
</button>
"
;
var
h
=
"
<button id='
"
+
this
.
divcartridge
+
"
_buttonadd' class='btn btn-default
"
;
this
.
adminDemo
&&
(
h
+=
"
disabled
"
),
h
+=
"
' type='button'>
"
,
h
+=
'
<i class="fa fa-plus" aria-hidden="true"></i>
'
,
h
+=
"
</button>
"
,
f
.
append
(
g
),
f
.
append
(
h
),
this
.
get_div_edition
(
f
),
this
.
cartridgex
&&
0
!==
this
.
cartridgex
||
(
this
.
cartridgex
=
parseInt
(
this
.
tooltypefamille
.
cartridge_x
,
10
)),
this
.
cartridgey
&&
0
!==
this
.
cartridgey
||
(
this
.
cartridgey
=
parseInt
(
this
.
tooltypefamille
.
cartridge_y
,
10
)),
c
.
css
(
"
left
"
,
this
.
cartridgex
+
15
),
c
.
css
(
"
top
"
,
this
.
y
+
this
.
cartridgey
),
this
.
apply_visibility_annot
()}}
return
!
0
},
c
});
\ No newline at end of file
amd/src/admin_panel.js
View file @
a196b645
...
...
@@ -72,6 +72,7 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
$
(
"
#assignfeedback_editpdfplus_widget_admin_button_editaxis
"
).
on
(
"
click
"
,
this
.
openDivEditAxis
);
$
(
"
#assignfeedback_editpdfplus_widget_admin_button_delaxis
"
).
on
(
"
click
"
,
this
.
openDivDelAxis
);
$
(
"
#assignfeedback_editpdfplus_widget_admin_button_addtool
"
).
on
(
"
click
"
,
this
.
openDivAddTool
);
$
(
"
.btn-primary
"
).
click
();
};
//
...
...
@@ -250,6 +251,15 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
currentTool
.
reply
=
$
(
"
#reply
"
).
val
();
currentTool
.
order
=
$
(
"
#order
"
).
val
();
$
(
"
#toolFormSubmit
"
).
on
(
"
click
"
,
function
()
{
var
res
=
""
;
$
(
"
input[name^='text[']
"
).
each
(
function
()
{
if
(
$
(
this
).
val
()
&&
(
$
(
this
).
val
()).
length
>
0
)
{
res
+=
'
"
'
+
$
(
this
).
val
()
+
'
",
'
;
}
});
if
(
res
.
length
>
0
){
$
(
"
#texts
"
).
val
(
res
.
substring
(
0
,
res
.
length
-
1
));
}
var
form
=
$
(
'
#assignfeedback_editpdfplus_edit_tool
'
);
var
data
=
form
.
serialize
();
ajax
.
call
([
...
...
@@ -419,6 +429,16 @@ define(['jquery'/*, 'core/yui'*/, 'core/notification', 'core/templates', 'core/f
action
=
null
;
}
$
(
"
#toolFormSubmit
"
).
on
(
"
click
"
,
function
()
{
//jen suis ici pour lajout de nouvel outil
var
res
=
""
;
$
(
"
input[name^='text[']
"
).
each
(
function
()
{
if
(
$
(
this
).
val
()
&&
(
$
(
this
).
val
()).
length
>
0
)
{
res
+=
'
"
'
+
$
(
this
).
val
()
+
'
",
'
;
}
});
if
(
res
.
length
>
0
){
$
(
"
#texts
"
).
val
(
res
.
substring
(
0
,
res
.
length
-
1
));
}
var
form
=
$
(
'
#assignfeedback_editpdfplus_edit_tool
'
);
var
data
=
form
.
serialize
();
ajax
.
call
([
...
...
amd/src/annotationframe.js
View file @
a196b645
...
...
@@ -39,6 +39,7 @@ define(['jquery', './annotation'],
this
.
endx
=
435
;
this
.
endy
=
129
;
this
.
parent_annot
=
0
;
this
.
colour
=
"
#FF0000
"
;
};
AnnotationFrame
.
prototype
.
initChildAdminDemo
=
function
(
annotationparent
)
{
...
...
@@ -49,6 +50,7 @@ define(['jquery', './annotation'],
this
.
endy
=
232
;
this
.
parent_annot
=
annotationparent
.
id
;
this
.
id
=
'
previsu_annot_child
'
;
this
.
colour
=
"
#FF0000
"
;
};
/**
* Draw a highlight annotation
...
...
locallib_admin.php
View file @
a196b645
...
...
@@ -150,6 +150,20 @@ class assign_feedback_editpdfplus_admin {
$tool
->
removable
=
true
;
$data
->
tool
=
$tool
;
}
$tooltexts
=
$data
->
tool
->
texts
;
if
(
$tooltexts
)
{
$tooltextsarray
=
explode
(
","
,
$tooltexts
);
$compteur
=
0
;
foreach
(
$tooltextsarray
as
$value
)
{
$obj
=
new
object
();
$obj
->
text
=
substr
(
$value
,
1
,
-
1
);
$obj
->
index
=
$compteur
;
$data
->
tool
->
textsarray
[]
=
$obj
;
$compteur
++
;
}
}
else
{
$data
->
tool
->
textsarray
=
null
;
}
$data
->
tools
=
admin_editor
::
get_typetools
();
foreach
(
$data
->
tools
as
$toolRef
)
{
$toolRef
->
libelle
=
get_string
(
'typetool_'
.
$toolRef
->
label
,
'assignfeedback_editpdfplus'
);
...
...
templates/tool_form.mustache
View file @
a196b645
...
...
@@ -101,7 +101,7 @@
<a
data-toggle=
"collapse"
href=
"#collapse4"
data-parent=
"#accordion"
>
{{#
str
}}
admintoolboxannotation, assignfeedback_editpdfplus
{{/
str
}}
</a>
</div>
<div
id=
"collapse4"
class=
"panel-collapse collapse"
>
<div
class=
"panel-body"
style=
"margin-bottom: 80px;"
>
<div
class=
"panel-body"
style=
"margin-bottom: 80px;
overflow: auto;
"
>
<div
class=
"form-group"
>
<label
class=
"control-label col-sm-3"
for=
"color"
>
{{#
str
}}
admintoolboxannotation_color, assignfeedback_editpdfplus
{{/
str
}}
</label>
<div
class=
"col-sm-9"
>
...
...
@@ -112,7 +112,14 @@
<div
class=
"form-group"
>
<label
class=
"control-label col-sm-3"
for=
"texts"
>
{{#
str
}}
admintoolboxannotation_texts, assignfeedback_editpdfplus
{{/
str
}}
</label>
<div
class=
"col-sm-9"
>
<input
type=
"text"
class=
"form-control"
id=
"texts"
value=
"
{{
tool
.
texts
}}
"
name=
"texts"
/>
<input
type=
"hidden"
class=
"form-control"
id=
"texts"
value=
"
{{
tool
.
texts
}}
"
name=
"texts"
/>
<ul
class=
"textform"
data-prototype=
"<input type='text' class='form-control' value='' name='text[__name__]' style='width:90%;display:inline-block;' />"
style=
"list-style-type:none;padding:0px;"
>
{{#
tool
.
textsarray
}}
<li><input
type=
'text'
class=
'form-control'
value=
'
{{
text
}}
'
name=
'text[
{{
index
}}
]'
style=
'width:90%;display:inline-block;'
/></li>
{{/
tool
.
textsarray
}}
</ul>
</div>
</div>
<div
class=
"form-group"
>
...
...
@@ -152,5 +159,70 @@ require(['jquery','core/ajax','core/notification'], function($,ajax,notification
{{#
tool
.
id
}}
$("#typetool").val(
{{
tool
.
type
}}
);
{{/
tool
.
id
}}
var $collectionHolder;
// setup an "add a tag" link
var $addTagLink = $('
<a
href=
"#"
class=
"add_text_link"
><i
class=
"fa fa-plus"
></i></a>
');
var $newLinkLi = $('
<li></li>
').append($addTagLink);
jQuery(document).ready(function() {
// Get the ul that holds the collection of tags
$collectionHolder = $('ul.textform');
// add a delete link to all of the existing tag form li elements
$collectionHolder.find('li').each(function() {
addTagFormDeleteLink($(this));
});
// add the "add a tag" anchor and li to the tags ul
$collectionHolder.append($newLinkLi);
// count the current form inputs we have (e.g. 2), use that as the new
// index when inserting a new item (e.g. 2)
$collectionHolder.data('index', $collectionHolder.find(':input').length);
$addTagLink.on('click', function(e) {
// prevent the link from creating a "#" on the URL
e.preventDefault();
// add a new tag form (see next code block)
addTagForm($collectionHolder, $newLinkLi);
});
});
function addTagForm($collectionHolder, $newLinkLi) {
// Get the data-prototype explained earlier
var prototype = $collectionHolder.data('prototype');
// get the new index
var index = $collectionHolder.data('index');
// Replace '__name__' in the prototype's HTML to
// instead be a number based on how many items we have
var newForm = prototype.replace(/__name__/g, index);
// increase the index with one for the next item
$collectionHolder.data('index', index + 1);
// Display the form in the page in an li, before the "Add a tag" link li
var $newFormLi = $('
<li></li>
').append(newForm);
$newLinkLi.before($newFormLi);
// add a delete link to the new form
addTagFormDeleteLink($newFormLi);
}
function addTagFormDeleteLink($tagFormLi) {
var $removeFormA = $('
<a
href=
"#"
><i
class=
"fa fa-remove"
></i></a>
');
$tagFormLi.append($removeFormA);
$removeFormA.on('click', function(e) {
// prevent the link from creating a "#" on the URL
e.preventDefault();
// remove the li for the tag form
$tagFormLi.remove();
});
}
});
{{/
js
}}
\ No newline at end of file
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