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
30dd47a6
Commit
30dd47a6
authored
May 30, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3907 from lduarte1991/lduarte-harvardx-image2
Annotation Tools: Load Tinymce in student_view
parents
0a8b2649
a4c912a0
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
24 additions
and
24 deletions
+24
-24
common/lib/xmodule/xmodule/imageannotation_module.py
+6
-2
common/lib/xmodule/xmodule/tests/test_imageannotation.py
+2
-2
common/lib/xmodule/xmodule/tests/test_textannotation.py
+2
-2
common/lib/xmodule/xmodule/tests/test_videoannotation.py
+2
-2
common/lib/xmodule/xmodule/textannotation_module.py
+6
-3
common/lib/xmodule/xmodule/videoannotation_module.py
+6
-3
lms/templates/imageannotation.html
+0
-3
lms/templates/textannotation.html
+0
-3
lms/templates/videoannotation.html
+0
-4
No files found.
common/lib/xmodule/xmodule/imageannotation_module.py
View file @
30dd47a6
...
@@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor
...
@@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor
from
xblock.core
import
Scope
,
String
from
xblock.core
import
Scope
,
String
from
xmodule.annotator_mixin
import
get_instructions
,
html_to_text
from
xmodule.annotator_mixin
import
get_instructions
,
html_to_text
from
xmodule.annotator_token
import
retrieve_token
from
xmodule.annotator_token
import
retrieve_token
from
xblock.fragment
import
Fragment
import
textwrap
import
textwrap
...
@@ -94,7 +95,7 @@ class ImageAnnotationModule(AnnotatableFields, XModule):
...
@@ -94,7 +95,7 @@ class ImageAnnotationModule(AnnotatableFields, XModule):
""" 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. """
return
get_instructions
(
xmltree
)
return
get_instructions
(
xmltree
)
def
get_html
(
self
):
def
student_view
(
self
,
context
):
""" Renders parameters to template. """
""" Renders parameters to template. """
context
=
{
context
=
{
'display_name'
:
self
.
display_name_with_default
,
'display_name'
:
self
.
display_name_with_default
,
...
@@ -105,7 +106,10 @@ class ImageAnnotationModule(AnnotatableFields, XModule):
...
@@ -105,7 +106,10 @@ class ImageAnnotationModule(AnnotatableFields, XModule):
'openseadragonjson'
:
self
.
openseadragonjson
,
'openseadragonjson'
:
self
.
openseadragonjson
,
}
}
return
self
.
system
.
render_template
(
'imageannotation.html'
,
context
)
fragment
=
Fragment
(
self
.
system
.
render_template
(
'imageannotation.html'
,
context
))
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js"
)
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js"
)
return
fragment
class
ImageAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
# pylint: disable=abstract-method
class
ImageAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
# pylint: disable=abstract-method
...
...
common/lib/xmodule/xmodule/tests/test_imageannotation.py
View file @
30dd47a6
...
@@ -69,10 +69,10 @@ class ImageAnnotationModuleTestCase(unittest.TestCase):
...
@@ -69,10 +69,10 @@ class ImageAnnotationModuleTestCase(unittest.TestCase):
actual
=
self
.
mod
.
_extract_instructions
(
xmltree
)
# pylint: disable=protected-access
actual
=
self
.
mod
.
_extract_instructions
(
xmltree
)
# pylint: disable=protected-access
self
.
assertIsNone
(
actual
)
self
.
assertIsNone
(
actual
)
def
test_
get_html
(
self
):
def
test_
student_view
(
self
):
"""
"""
Tests the function that passes in all the information in the context that will be used in templates/textannotation.html
Tests the function that passes in all the information in the context that will be used in templates/textannotation.html
"""
"""
context
=
self
.
mod
.
get_html
()
context
=
self
.
mod
.
student_view
({})
.
content
for
key
in
[
'display_name'
,
'instructions_html'
,
'annotation_storage'
,
'token'
,
'tag'
,
'openseadragonjson'
]:
for
key
in
[
'display_name'
,
'instructions_html'
,
'annotation_storage'
,
'token'
,
'tag'
,
'openseadragonjson'
]:
self
.
assertIn
(
key
,
context
)
self
.
assertIn
(
key
,
context
)
common/lib/xmodule/xmodule/tests/test_textannotation.py
View file @
30dd47a6
...
@@ -54,10 +54,10 @@ class TextAnnotationModuleTestCase(unittest.TestCase):
...
@@ -54,10 +54,10 @@ class TextAnnotationModuleTestCase(unittest.TestCase):
actual
=
self
.
mod
.
_extract_instructions
(
xmltree
)
# pylint: disable=W0212
actual
=
self
.
mod
.
_extract_instructions
(
xmltree
)
# pylint: disable=W0212
self
.
assertIsNone
(
actual
)
self
.
assertIsNone
(
actual
)
def
test_
get_html
(
self
):
def
test_
student_view
(
self
):
"""
"""
Tests the function that passes in all the information in the context that will be used in templates/textannotation.html
Tests the function that passes in all the information in the context that will be used in templates/textannotation.html
"""
"""
context
=
self
.
mod
.
get_html
()
context
=
self
.
mod
.
student_view
({})
.
content
for
key
in
[
'display_name'
,
'tag'
,
'source'
,
'instructions_html'
,
'content_html'
,
'annotation_storage'
,
'token'
]:
for
key
in
[
'display_name'
,
'tag'
,
'source'
,
'instructions_html'
,
'content_html'
,
'annotation_storage'
,
'token'
]:
self
.
assertIn
(
key
,
context
)
self
.
assertIn
(
key
,
context
)
common/lib/xmodule/xmodule/tests/test_videoannotation.py
View file @
30dd47a6
...
@@ -62,10 +62,10 @@ class VideoAnnotationModuleTestCase(unittest.TestCase):
...
@@ -62,10 +62,10 @@ class VideoAnnotationModuleTestCase(unittest.TestCase):
self
.
assertEqual
(
expectedyoutube
,
result2
)
self
.
assertEqual
(
expectedyoutube
,
result2
)
self
.
assertEqual
(
expectednotyoutube
,
result1
)
self
.
assertEqual
(
expectednotyoutube
,
result1
)
def
test_
get_html
(
self
):
def
test_
student_view
(
self
):
"""
"""
Tests to make sure variables passed in truly exist within the html once it is all rendered.
Tests to make sure variables passed in truly exist within the html once it is all rendered.
"""
"""
context
=
self
.
mod
.
get_html
()
context
=
self
.
mod
.
student_view
({})
.
content
for
key
in
[
'display_name'
,
'instructions_html'
,
'sourceUrl'
,
'typeSource'
,
'poster'
,
'annotation_storage'
]:
for
key
in
[
'display_name'
,
'instructions_html'
,
'sourceUrl'
,
'typeSource'
,
'poster'
,
'annotation_storage'
]:
self
.
assertIn
(
key
,
context
)
self
.
assertIn
(
key
,
context
)
common/lib/xmodule/xmodule/textannotation_module.py
View file @
30dd47a6
...
@@ -8,7 +8,7 @@ from xmodule.raw_module import RawDescriptor
...
@@ -8,7 +8,7 @@ from xmodule.raw_module import RawDescriptor
from
xblock.core
import
Scope
,
String
from
xblock.core
import
Scope
,
String
from
xmodule.annotator_mixin
import
get_instructions
from
xmodule.annotator_mixin
import
get_instructions
from
xmodule.annotator_token
import
retrieve_token
from
xmodule.annotator_token
import
retrieve_token
from
xblock.fragment
import
Fragment
import
textwrap
import
textwrap
# Make '_' a no-op so we can scrape strings
# Make '_' a no-op so we can scrape strings
...
@@ -73,7 +73,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
...
@@ -73,7 +73,7 @@ class TextAnnotationModule(AnnotatableFields, XModule):
""" 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. """
return
get_instructions
(
xmltree
)
return
get_instructions
(
xmltree
)
def
get_html
(
self
):
def
student_view
(
self
,
context
):
""" Renders parameters to template. """
""" Renders parameters to template. """
context
=
{
context
=
{
'course_key'
:
self
.
runtime
.
course_id
,
'course_key'
:
self
.
runtime
.
course_id
,
...
@@ -85,7 +85,10 @@ class TextAnnotationModule(AnnotatableFields, XModule):
...
@@ -85,7 +85,10 @@ class TextAnnotationModule(AnnotatableFields, XModule):
'annotation_storage'
:
self
.
annotation_storage_url
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'token'
:
retrieve_token
(
self
.
user_email
,
self
.
annotation_token_secret
),
'token'
:
retrieve_token
(
self
.
user_email
,
self
.
annotation_token_secret
),
}
}
return
self
.
system
.
render_template
(
'textannotation.html'
,
context
)
fragment
=
Fragment
(
self
.
system
.
render_template
(
'textannotation.html'
,
context
))
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js"
)
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js"
)
return
fragment
class
TextAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
class
TextAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
...
...
common/lib/xmodule/xmodule/videoannotation_module.py
View file @
30dd47a6
...
@@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor
...
@@ -9,6 +9,7 @@ from xmodule.raw_module import RawDescriptor
from
xblock.core
import
Scope
,
String
from
xblock.core
import
Scope
,
String
from
xmodule.annotator_mixin
import
get_instructions
,
get_extension
from
xmodule.annotator_mixin
import
get_instructions
,
get_extension
from
xmodule.annotator_token
import
retrieve_token
from
xmodule.annotator_token
import
retrieve_token
from
xblock.fragment
import
Fragment
import
textwrap
import
textwrap
...
@@ -72,7 +73,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
...
@@ -72,7 +73,7 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
''' get the extension of a given url '''
''' get the extension of a given url '''
return
get_extension
(
src_url
)
return
get_extension
(
src_url
)
def
get_html
(
self
):
def
student_view
(
self
,
context
):
""" Renders parameters to template. """
""" Renders parameters to template. """
extension
=
self
.
_get_extension
(
self
.
sourceurl
)
extension
=
self
.
_get_extension
(
self
.
sourceurl
)
...
@@ -87,8 +88,10 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
...
@@ -87,8 +88,10 @@ class VideoAnnotationModule(AnnotatableFields, XModule):
'annotation_storage'
:
self
.
annotation_storage_url
,
'annotation_storage'
:
self
.
annotation_storage_url
,
'token'
:
retrieve_token
(
self
.
user_email
,
self
.
annotation_token_secret
),
'token'
:
retrieve_token
(
self
.
user_email
,
self
.
annotation_token_secret
),
}
}
fragment
=
Fragment
(
self
.
system
.
render_template
(
'videoannotation.html'
,
context
))
return
self
.
system
.
render_template
(
'videoannotation.html'
,
context
)
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/tinymce.full.min.js"
)
fragment
.
add_javascript_url
(
"/static/js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js"
)
return
fragment
class
VideoAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
class
VideoAnnotationDescriptor
(
AnnotatableFields
,
RawDescriptor
):
...
...
lms/templates/imageannotation.html
View file @
30dd47a6
...
@@ -31,8 +31,6 @@
...
@@ -31,8 +31,6 @@
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/tinymce.full.min.js', raw=True)}"
/>
<
script
type
=
"text/javascript"
src
=
"${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', raw=True)}"
/>
</div>
</div>
<div
id=
"catchDIV"
>
<div
id=
"catchDIV"
>
## Translators: Notes below refer to annotations. They wil later be put under a "Notes" section.
## Translators: Notes below refer to annotations. They wil later be put under a "Notes" section.
...
@@ -180,7 +178,6 @@
...
@@ -180,7 +178,6 @@
optionsOSDA
:{},
optionsOSDA
:{},
};
};
tinymce
.
baseURL
=
"${settings.STATIC_URL}"
+
"js/vendor/tinymce/js/tinymce"
;
var
imgURLRoot
=
"${settings.STATIC_URL}"
+
"js/vendor/ova/catch/img/"
;
var
imgURLRoot
=
"${settings.STATIC_URL}"
+
"js/vendor/ova/catch/img/"
;
if
(
typeof
Annotator
!=
'undefined'
){
if
(
typeof
Annotator
!=
'undefined'
){
...
...
lms/templates/textannotation.html
View file @
30dd47a6
...
@@ -2,8 +2,6 @@
...
@@ -2,8 +2,6 @@
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/tinymce.full.min.js', raw=True)}"
/>
<
script
type
=
"text/javascript"
src
=
"${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', raw=True)}"
/>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-header"
>
<div
class=
"annotatable-header"
>
...
@@ -167,7 +165,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
...
@@ -167,7 +165,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
};
};
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/tinymce/js/tinymce"
;
//remove old instances
//remove old instances
if
(
Annotator
.
_instances
.
length
!==
0
)
{
if
(
Annotator
.
_instances
.
length
!==
0
)
{
...
...
lms/templates/videoannotation.html
View file @
30dd47a6
...
@@ -2,9 +2,6 @@
...
@@ -2,9 +2,6 @@
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-content', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
${static.css(group='style-vendor-tinymce-skin', raw=True)}
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/tinymce.full.min.js', raw=True)}"
/>
<
script
type
=
"text/javascript"
src
=
"${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', raw=True)}"
/>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-wrapper"
>
<div
class=
"annotatable-header"
>
<div
class=
"annotatable-header"
>
...
@@ -168,7 +165,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
...
@@ -168,7 +165,6 @@ ${static.css(group='style-vendor-tinymce-skin', raw=True)}
};
};
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/tinymce/js/tinymce"
;
//remove old instances
//remove old instances
if
(
Annotator
.
_instances
.
length
!==
0
)
{
if
(
Annotator
.
_instances
.
length
!==
0
)
{
...
...
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