Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
edeebe7b
Commit
edeebe7b
authored
May 08, 2014
by
lduarte1991
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes from @singingwolfboy in PR #3466
parent
26eb16eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
70 deletions
+70
-70
common/lib/xmodule/xmodule/textannotation_module.py
+3
-3
common/lib/xmodule/xmodule/videoannotation_module.py
+3
-3
common/static/js/vendor/ova/annotator-full-firebase-auth.js
+7
-7
lms/templates/textannotation.html
+57
-57
No files found.
common/lib/xmodule/xmodule/textannotation_module.py
View file @
edeebe7b
...
@@ -61,9 +61,9 @@ class TextAnnotationModule(AnnotatableFields, XModule):
...
@@ -61,9 +61,9 @@ class TextAnnotationModule(AnnotatableFields, XModule):
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
user
=
""
self
.
user
_email
=
""
if
self
.
runtime
.
get_real_user
is
not
None
:
if
self
.
runtime
.
get_real_user
is
not
None
:
self
.
user
=
self
.
runtime
.
get_real_user
(
self
.
runtime
.
anonymous_student_id
)
.
email
self
.
user
_email
=
self
.
runtime
.
get_real_user
(
self
.
runtime
.
anonymous_student_id
)
.
email
def
_extract_instructions
(
self
,
xmltree
):
def
_extract_instructions
(
self
,
xmltree
):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
...
@@ -83,7 +83,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
...
@@ -83,7 +83,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
'instructions_html'
:
self
.
instructions
,
'instructions_html'
:
self
.
instructions
,
'content_html'
:
self
.
content
,
'content_html'
:
self
.
content
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'token'
:
retrieve_token
(
self
.
user
,
self
.
annotation_token_secret
),
'token'
:
retrieve_token
(
self
.
user_email
,
self
.
annotation_token_secret
),
}
}
return
self
.
system
.
render_template
(
'textannotation.html'
,
context
)
return
self
.
system
.
render_template
(
'textannotation.html'
,
context
)
...
...
common/lib/xmodule/xmodule/videoannotation_module.py
View file @
edeebe7b
...
@@ -56,9 +56,9 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
...
@@ -56,9 +56,9 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
user
=
""
self
.
user
_email
=
""
if
self
.
runtime
.
get_real_user
is
not
None
:
if
self
.
runtime
.
get_real_user
is
not
None
:
self
.
user
=
self
.
runtime
.
get_real_user
(
self
.
runtime
.
anonymous_student_id
)
.
email
self
.
user
_email
=
self
.
runtime
.
get_real_user
(
self
.
runtime
.
anonymous_student_id
)
.
email
def
_extract_instructions
(
self
,
xmltree
):
def
_extract_instructions
(
self
,
xmltree
):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
...
@@ -93,7 +93,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
...
@@ -93,7 +93,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
'poster'
:
self
.
poster_url
,
'poster'
:
self
.
poster_url
,
'content_html'
:
self
.
content
,
'content_html'
:
self
.
content
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'token'
:
retrieve_token
(
self
.
user
,
self
.
annotation_token_secret
),
'token'
:
retrieve_token
(
self
.
user
_email
,
self
.
annotation_token_secret
),
}
}
return
self
.
system
.
render_template
(
'videoannotation.html'
,
context
)
return
self
.
system
.
render_template
(
'videoannotation.html'
,
context
)
...
...
common/static/js/vendor/ova/annotator-full-firebase-auth.js
View file @
edeebe7b
Annotator
.
Plugin
.
Auth
.
prototype
.
haveValidToken
=
function
()
{
Annotator
.
Plugin
.
Auth
.
prototype
.
haveValidToken
=
function
()
{
var
allFields
;
return
(
allFields
=
this
.
_unsafeToken
&&
this
.
_unsafeToken
.
d
.
issuedAt
&&
this
.
_unsafeToken
.
d
.
ttl
&&
this
.
_unsafeToken
.
d
.
consumerKey
;
this
.
_unsafeToken
&&
if
(
allFields
&&
this
.
timeToExpiry
()
>
0
)
{
this
.
_unsafeToken
.
d
.
issuedAt
&&
return
true
;
this
.
_unsafeToken
.
d
.
ttl
&&
}
else
{
this
.
_unsafeToken
.
d
.
consumerKey
&&
return
false
;
this
.
timeToExpiry
()
>
0
}
);
};
};
Annotator
.
Plugin
.
Auth
.
prototype
.
timeToExpiry
=
function
()
{
Annotator
.
Plugin
.
Auth
.
prototype
.
timeToExpiry
=
function
()
{
...
...
lms/templates/textannotation.html
View file @
edeebe7b
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-header"
>
<div
class=
"annotatable-header"
>
% if display_name is not UNDEFINED and display_name is not None:
% if display_name is not UNDEFINED and display_name is not None:
<div
class=
"annotatable-title"
>
${display_name}
</div>
<div
class=
"annotatable-title"
>
${display_name}
</div>
% endif
% endif
</div>
</div>
% if instructions_html is not UNDEFINED and instructions_html is not None:
% if instructions_html is not UNDEFINED and instructions_html is not None:
<div
class=
"annotatable-section shaded"
>
<div
class=
"annotatable-section shaded"
>
<div
class=
"annotatable-section-title"
>
<div
class=
"annotatable-section-title"
>
${_('Instructions')}
${_('Instructions')}
<a
class=
"annotatable-toggle annotatable-toggle-instructions expanded"
href=
"javascript:void(0)"
>
${_('Collapse Instructions')}
</a>
<a
class=
"annotatable-toggle annotatable-toggle-instructions expanded"
href=
"javascript:void(0)"
>
${_('Collapse Instructions')}
</a>
</div>
</div>
<div
class=
"annotatable-section-body annotatable-instructions"
>
<div
class=
"annotatable-section-body annotatable-instructions"
>
${instructions_html}
${instructions_html}
</div>
</div>
</div>
</div>
% endif
% endif
<div
class=
"annotatable-section"
>
<div
class=
"annotatable-section"
>
<div
class=
"annotatable-content"
>
<div
class=
"annotatable-content"
>
<div
id=
"textHolder"
>
${content_html}
</div>
<div
id=
"textHolder"
>
${content_html}
</div>
<div
id=
"sourceCitation"
>
${_('Source:')} ${source}
</div>
<div
id=
"sourceCitation"
>
${_('Source:')} ${source}
</div>
<div
id=
"catchDIV"
>
<div
id=
"catchDIV"
>
<div
class=
"annotationListContainer"
>
${_('You do not have any notes.')}
</div>
<div
class=
"annotationListContainer"
>
${_('You do not have any notes.')}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
<script>
function
onClickHideInstructions
(){
function
onClickHideInstructions
(){
//Reset function if there is more than one event handler
//Reset function if there is more than one event handler
$
(
this
).
off
();
$
(
this
).
off
();
$
(
this
).
on
(
'click'
,
onClickHideInstructions
);
$
(
this
).
on
(
'click'
,
onClickHideInstructions
);
var
hide
=
$
(
this
).
html
()
==
'Collapse Instructions'
?
true
:
false
,
var
hide
=
$
(
this
).
html
()
==
'Collapse Instructions'
?
true
:
false
,
cls
,
txt
,
slideMethod
;
cls
,
txt
,
slideMethod
;
txt
=
(
hide
?
'Expand'
:
'Collapse'
)
+
' Instructions'
;
txt
=
(
hide
?
'Expand'
:
'Collapse'
)
+
' Instructions'
;
cls
=
(
hide
?
[
'expanded'
,
'collapsed'
]
:
[
'collapsed'
,
'expanded'
]);
cls
=
(
hide
?
[
'expanded'
,
'collapsed'
]
:
[
'collapsed'
,
'expanded'
]);
slideMethod
=
(
hide
?
'slideUp'
:
'slideDown'
);
slideMethod
=
(
hide
?
'slideUp'
:
'slideDown'
);
$
(
this
).
text
(
txt
).
removeClass
(
cls
[
0
]).
addClass
(
cls
[
1
]);
$
(
this
).
text
(
txt
).
removeClass
(
cls
[
0
]).
addClass
(
cls
[
1
]);
$
(
this
).
parents
(
'.annotatable-section:first'
).
find
(
'.annotatable-instructions'
)[
slideMethod
]();
$
(
this
).
parents
(
'.annotatable-section:first'
).
find
(
'.annotatable-instructions'
)[
slideMethod
]();
}
}
$
(
'.annotatable-toggle-instructions'
).
on
(
'click'
,
onClickHideInstructions
);
$
(
'.annotatable-toggle-instructions'
).
on
(
'click'
,
onClickHideInstructions
);
//Grab uri of the course
//Grab uri of the course
var
parts
=
window
.
location
.
href
.
split
(
"/"
),
var
parts
=
window
.
location
.
href
.
split
(
"/"
),
uri
=
''
;
uri
=
''
;
for
(
var
index
=
0
;
index
<=
9
;
index
+=
1
)
uri
+=
parts
[
index
]
+
"/"
;
//Get the unit url
for
(
var
index
=
0
;
index
<=
9
;
index
+=
1
)
uri
+=
parts
[
index
]
+
"/"
;
//Get the unit url
//Change uri in cms
//Change uri in cms
var
lms_location
=
$
(
'.sidebar .preview-button'
).
attr
(
'href'
);
var
lms_location
=
$
(
'.sidebar .preview-button'
).
attr
(
'href'
);
if
(
typeof
lms_location
!=
'undefined'
){
if
(
typeof
lms_location
!=
'undefined'
){
uri
=
window
.
location
.
protocol
;
uri
=
window
.
location
.
protocol
;
for
(
var
index
=
0
;
index
<=
9
;
index
+=
1
)
uri
+=
lms_location
.
split
(
"/"
)[
index
]
+
"/"
;
//Get the unit url
for
(
var
index
=
0
;
index
<=
9
;
index
+=
1
)
uri
+=
lms_location
.
split
(
"/"
)[
index
]
+
"/"
;
//Get the unit url
}
}
var
unit_id
=
$
(
'#sequence-list'
).
find
(
'.active'
).
attr
(
"data-element"
);
var
unit_id
=
$
(
'#sequence-list'
).
find
(
'.active'
).
attr
(
"data-element"
);
uri
+=
unit_id
;
uri
+=
unit_id
;
var
pagination
=
100
,
var
pagination
=
100
,
is_staff
=
!
(
'${user.is_staff}'
==
'False'
),
is_staff
=
!
(
'${user.is_staff}'
==
'False'
),
options
=
{
options
=
{
optionsAnnotator
:
{
optionsAnnotator
:
{
permissions
:{
permissions
:{
...
@@ -88,7 +88,7 @@
...
@@ -88,7 +88,7 @@
if
(
annotation
.
permissions
)
{
if
(
annotation
.
permissions
)
{
tokens
=
annotation
.
permissions
[
action
]
||
[];
tokens
=
annotation
.
permissions
[
action
]
||
[];
if
(
is_staff
){
if
(
is_staff
){
return
true
;
return
true
;
}
}
if
(
tokens
.
length
===
0
)
{
if
(
tokens
.
length
===
0
)
{
return
true
;
return
true
;
...
@@ -139,7 +139,7 @@
...
@@ -139,7 +139,7 @@
offset
:
0
,
offset
:
0
,
uri
:
uri
,
uri
:
uri
,
media
:
'text'
,
media
:
'text'
,
userid
:
'${user.email}'
,
userid
:
'${user.email}'
,
}
}
},
},
highlightTags
:{
highlightTags
:{
...
@@ -164,10 +164,10 @@
...
@@ -164,10 +164,10 @@
},
},
};
};
var
imgURLRoot
=
"${settings.STATIC_URL}"
+
"js/vendor/ova/catch/img/"
;
var
imgURLRoot
=
"${settings.STATIC_URL}"
+
"js/vendor/ova/catch/img/"
;
tinyMCE
.
baseURL
=
"${settings.STATIC_URL}"
+
"js/vendor/ova"
;
tinyMCE
.
baseURL
=
"${settings.STATIC_URL}"
+
"js/vendor/ova"
;
//remove old instances
//remove old instances
if
(
Annotator
.
_instances
.
length
!==
0
)
{
if
(
Annotator
.
_instances
.
length
!==
0
)
{
$
(
'#textHolder'
).
annotator
(
"destroy"
);
$
(
'#textHolder'
).
annotator
(
"destroy"
);
}
}
...
@@ -183,7 +183,7 @@
...
@@ -183,7 +183,7 @@
imageUrlRoot
:
imgURLRoot
,
imageUrlRoot
:
imgURLRoot
,
showMediaSelector
:
false
,
showMediaSelector
:
false
,
showPublicPrivate
:
true
,
showPublicPrivate
:
true
,
userId
:
'${user.email}'
,
userId
:
'${user.email}'
,
pagination
:
pagination
,
//Number of Annotations per load in the pagination,
pagination
:
pagination
,
//Number of Annotations per load in the pagination,
flags
:
is_staff
flags
:
is_staff
},
},
...
...
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