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
9c0d14ea
Commit
9c0d14ea
authored
Jun 05, 2014
by
lduarte1991
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotator Tools: OpaqueKeys update for Notes
parent
68acf66f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
30 deletions
+38
-30
common/static/js/vendor/ova/catch/js/catch.js
+5
-1
lms/djangoapps/notes/views.py
+5
-3
lms/templates/notes.html
+28
-26
No files found.
common/static/js/vendor/ova/catch/js/catch.js
View file @
9c0d14ea
...
...
@@ -106,7 +106,7 @@ annotationMediaSelector:
'<li class="ui-state-default" media="video">'
+
gettext
(
'Video'
)
+
'</li>'
+
'li class="ui-state-default" media="image">'
+
'
<
li class="ui-state-default" media="image">'
+
gettext
(
'Image'
)
+
'</li>'
+
'</ul>'
,
...
...
@@ -815,6 +815,10 @@ CatchAnnotation.prototype = {
var
allannotations
=
this
.
annotator
.
plugins
[
'Store'
].
annotations
,
osda
=
this
.
annotator
.
osda
;
if
(
this
.
options
.
externalLink
){
uri
+=
(
uri
.
indexOf
(
'?'
)
>=
0
)?
'&osdaId='
+
osdaId
:
'?osdaId='
+
osdaId
;
location
.
href
=
uri
;
}
for
(
var
item
in
allannotations
){
var
an
=
allannotations
[
item
];
if
(
typeof
an
.
id
!=
'undefined'
&&
an
.
id
==
osdaId
){
//this is the annotation
...
...
lms/djangoapps/notes/views.py
View file @
9c0d14ea
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
Http404
from
edxmako.shortcuts
import
render_to_response
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
courseware.courses
import
get_course_with_access
from
notes.models
import
Note
from
notes.utils
import
notes_enabled_for_course
...
...
@@ -10,12 +11,12 @@ from xmodule.annotator_token import retrieve_token
@login_required
def
notes
(
request
,
course_id
):
''' Displays the student's notes. '''
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_
id
)
course_key
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
course
=
get_course_with_access
(
request
.
user
,
'load'
,
course_
key
)
if
not
notes_enabled_for_course
(
course
):
raise
Http404
notes
=
Note
.
objects
.
filter
(
course_id
=
course_
id
,
user
=
request
.
user
)
.
order_by
(
'-created'
,
'uri'
)
notes
=
Note
.
objects
.
filter
(
course_id
=
course_
key
,
user
=
request
.
user
)
.
order_by
(
'-created'
,
'uri'
)
student
=
request
.
user
storage
=
course
.
annotation_storage_url
...
...
@@ -25,6 +26,7 @@ def notes(request, course_id):
'student'
:
student
,
'storage'
:
storage
,
'token'
:
retrieve_token
(
student
.
email
,
course
.
annotation_token_secret
),
'default_tab'
:
'myNotes'
,
}
return
render_to_response
(
'notes.html'
,
context
)
lms/templates/notes.html
View file @
9c0d14ea
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
${static.css(group='style-vendor-tinymce-content', 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>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js', raw=True)}"
></script>
<
%
inherit
file=
"main.html"
/>
<
%!
from
django
.
core
.
urlresolvers
import
reverse
...
...
@@ -102,7 +106,7 @@
if
(
annotation
.
permissions
)
{
tokens
=
annotation
.
permissions
[
action
]
||
[];
if
(
is_staff
){
return
true
;
return
true
;
}
if
(
tokens
.
length
===
0
)
{
return
true
;
...
...
@@ -128,7 +132,7 @@
},
},
auth
:
{
token
Url
:
location
.
protocol
+
'//'
+
location
.
host
+
"/token?course_id=${course.id.to_deprecated_string()
}"
token
:
"${token
}"
},
store
:
{
// The endpoint of the store on your server.
...
...
@@ -158,37 +162,34 @@
optionsRichText
:
{
tinymce
:{
selector
:
"li.annotator-item textarea"
,
plugins
:
"media image
insertdatetime link code
"
,
plugins
:
"media image
codemirror
"
,
menubar
:
false
,
toolbar_items_size
:
'small'
,
extended_valid_elements
:
"iframe[src|frameborder|style|scrolling|class|width|height|name|align|id]"
,
toolbar
:
"insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent |
link image media
rubric | code "
,
toolbar
:
"insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent |
image
rubric | code "
,
}
return
true
;
},
},
auth
:
{
token
:
"${token}"
},
store
:
{
// The endpoint of the store on your server.
prefix
:
"${storage}"
,
annotationData
:
{},
urls
:
{
// These are the default URLs.
create
:
'/create'
,
read
:
'/read/:id'
,
update
:
'/update/:id'
,
destroy
:
'/delete/:id'
,
search
:
'/search'
},
auth
:
{
token
:
"${token}"
},
store
:
{
// The endpoint of the store on your server.
prefix
:
"${storage}"
,
annotationData
:
{},
urls
:
{
// These are the default URLs.
create
:
'/create'
,
read
:
'/read/:id'
,
update
:
'/update/:id'
,
destroy
:
'/delete/:id'
,
search
:
'/search'
},
}
};
tinyMCE
.
baseURL
=
"${settings.STATIC_URL}"
+
"js/vendor/ova"
;
var
imgURLRoot
=
"${settings.STATIC_URL}"
+
"js/vendor/ova/catch/img/"
;
//remove old instances
if
(
Annotator
.
_instances
.
length
!==
0
)
{
$
(
'#notesHolder'
).
annotator
(
"destroy"
);
...
...
@@ -207,7 +208,8 @@
showMediaSelector
:
true
,
showPublicPrivate
:
true
,
pagination
:
pagination
,
//Number of Annotations per load in the pagination,
flags
:
is_staff
flags
:
is_staff
,
default_tab
:
"${default_tab}"
,
},
Catch
=
new
CatchAnnotation
(
$
(
'#catchDIV'
),
catchOptions
);
</script>
...
...
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