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
d36e00d4
Commit
d36e00d4
authored
Jun 20, 2014
by
Usman Khalid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass storage_url and token values as parameters to StudentNotes init.
LMS-2848
parent
f253f9a7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
33 deletions
+8
-33
lms/djangoapps/staticbook/views.py
+4
-0
lms/static/coffee/src/notes.coffee
+3
-31
lms/templates/static_htmlbook.html
+1
-2
No files found.
lms/djangoapps/staticbook/views.py
View file @
d36e00d4
...
...
@@ -7,6 +7,8 @@ from django.http import Http404
from
edxmako.shortcuts
import
render_to_response
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
from
xmodule.annotator_token
import
retrieve_token
from
courseware.access
import
has_access
from
courseware.courses
import
get_course_with_access
from
notes.utils
import
notes_enabled_for_course
...
...
@@ -170,5 +172,7 @@ def html_index(request, course_id, book_index, chapter=None):
'student'
:
student
,
'staff_access'
:
staff_access
,
'notes_enabled'
:
notes_enabled
,
'storage'
:
course
.
annotation_storage_url
,
'token'
:
retrieve_token
(
student
.
email
,
course
.
annotation_token_secret
),
},
)
lms/static/coffee/src/notes.coffee
View file @
d36e00d4
...
...
@@ -13,10 +13,9 @@ class StudentNotes
$
(
el
).
data
(
'notes-instance'
,
@
)
# Initializes annotations on a container element in response to an init event.
onInitNotes
:
(
event
,
uri
=
null
)
=>
onInitNotes
:
(
event
,
uri
=
null
,
storage_url
=
null
,
token
=
null
)
=>
event
.
stopPropagation
()
storeConfig
=
@
getStoreConfig
uri
found
=
@
targets
.
some
(
target
)
->
target
is
event
.
target
# Get uri
...
...
@@ -47,10 +46,10 @@ class StudentNotes
return
user
.
id
if
user
and
user
.
id
user
auth
:
token
Url
:
location
.
protocol
+
'//'
+
location
.
host
+
"/token?course_id="
+
courseid
token
:
token
store
:
prefix
:
'http://catch.aws.af.cm/annotator'
prefix
:
storage_url
annotationData
:
uri
:
uri
...
...
@@ -88,33 +87,6 @@ class StudentNotes
else
@
targets
.
push
(
event
.
target
)
# Returns a JSON config object that can be passed to the annotator Store plugin
getStoreConfig
:
(
uri
)
->
prefix
=
@
getPrefix
()
if
uri
is
null
uri
=
@
getURIPath
()
storeConfig
=
prefix
:
prefix
loadFromSearch
:
uri
:
uri
limit
:
0
annotationData
:
uri
:
uri
storeConfig
# Returns the API endpoint for the annotation store
getPrefix
:
()
->
re
=
/^(\/courses\/[^/]+\/[^/]+\/[^/]+)/
match
=
re
.
exec
(
@
getURIPath
())
prefix
=
(
if
match
then
match
[
1
]
else
''
)
return
"
#{
prefix
}
/notes/api"
# Returns the URI path of the current page for filtering annotations
getURIPath
:
()
->
window
.
location
.
href
.
toString
().
split
(
window
.
location
.
host
)[
1
]
# Enable notes by default on the document root.
# To initialize annotations on a container element in the document:
#
...
...
lms/templates/static_htmlbook.html
View file @
d36e00d4
...
...
@@ -14,7 +14,6 @@
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/tinymce.full.min.js')}"
></script>
<script
type=
"text/javascript"
src=
"${static.url('js/vendor/tinymce/js/tinymce/jquery.tinymce.min.js')}"
></script>
<script
type=
"text/javascript"
>
tinyMCE
.
baseURL
=
"${static.url('js/vendor/tinymce/js/tinymce')}"
;
(
function
(
$
)
{
$
.
fn
.
myHTMLViewer
=
function
(
options
)
{
var
urlToLoad
=
null
;
...
...
@@ -40,7 +39,7 @@
if
(
options
.
notesEnabled
)
{
onComplete
=
function
(
url
)
{
return
function
()
{
$
(
'#viewerContainer'
).
trigger
(
'notes:init'
,
[
url
]);
$
(
'#viewerContainer'
).
trigger
(
'notes:init'
,
[
url
,
"${storage}"
,
"${token}"
]);
}
};
}
...
...
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