Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
cf8f6ec
first commit to the branch
danielcebrian Feb 7, 2014
38c5ee8
Added padding to the top of the title (only when it's in the annotata…
lduarte1991 Feb 28, 2014
9b0917a
Added logic to make sure that when adding a new component, only 1 ann…
lduarte1991 Feb 28, 2014
8ead133
Revert "Added logic to make sure that when adding a new component, on…
lduarte1991 Feb 28, 2014
1cc32ee
Changed the location of the javascript files so they were attached to…
lduarte1991 Mar 19, 2014
3ab658b
Fixed location of the annotation tool code from vendor to xmodule/js,…
lduarte1991 Mar 24, 2014
0082cc6
For some reason it didn't save my movement of the files the first time
lduarte1991 Mar 24, 2014
0928b95
Accidentally capitalized one letter in a file_name call
lduarte1991 Mar 24, 2014
e17525d
Still some files that git refused to add
lduarte1991 Mar 24, 2014
1e8d1eb
Collapsable code was referenced as coffee instead of javascript
lduarte1991 Mar 24, 2014
921b364
Moved vjs.youtube.js into the xmodule so it wouldn't throw an error i…
lduarte1991 Mar 27, 2014
0612e24
Added missing youtube javascript file
lduarte1991 Mar 27, 2014
0e87877
Removed our version of the firebase-token-generator for the one in PyPl
lduarte1991 Mar 28, 2014
01dd003
added new tinymce plugins needed for annotation tool
lduarte1991 Apr 6, 2014
51fc879
For final jenkins test fixes
lduarte1991 Apr 11, 2014
b03f735
Checking to see if skin.min.css is the issue.
lduarte1991 Apr 21, 2014
0949f90
Removing skin completely
lduarte1991 Apr 21, 2014
de2d1da
Token generator test file not needed.
lduarte1991 Apr 21, 2014
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,9 @@
'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css',
'css/vendor/jquery.qtip.min.css',
'js/vendor/markitup/skins/simple/style.css',
'js/vendor/markitup/sets/wiki/style.css'
'js/vendor/markitup/sets/wiki/style.css',
'css/vendor/ova/video-js.min.css',
'css/vendor/ova/token-input.css',
],
'output_filename': 'css/cms-style-vendor.css',
},
Expand Down
2 changes: 1 addition & 1 deletion cms/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@
"coffee/src/logger": {
exports: "Logger",
deps: ["coffee/src/ajax_prefix"]
}
},
},
// load jquery and gettext automatically
deps: ["jquery", "gettext"],
Expand Down
99 changes: 0 additions & 99 deletions common/djangoapps/student/firebase_token_generator.py

This file was deleted.

43 changes: 0 additions & 43 deletions common/djangoapps/student/tests/test_token_generator.py

This file was deleted.

25 changes: 1 addition & 24 deletions common/djangoapps/student/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

from student.models import anonymous_id_for_user, user_by_anonymous_id, CourseEnrollment, unique_id_for_user
from student.views import (process_survey_link, _cert_info,
change_enrollment, complete_course_mode_info, token)
change_enrollment, complete_course_mode_info)
from student.tests.factories import UserFactory, CourseModeFactory

import shoppingcart
Expand Down Expand Up @@ -458,26 +458,3 @@ def test_roundtrip_for_logged_user(self):
anonymous_id = anonymous_id_for_user(self.user, self.course.id)
real_user = user_by_anonymous_id(anonymous_id)
self.assertEqual(self.user, real_user)


@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
class Token(ModuleStoreTestCase):
"""
Test for the token generator. This creates a random course and passes it through the token file which generates the
token that will be passed in to the annotation_storage_url.
"""
request_factory = RequestFactory()
COURSE_SLUG = "100"
COURSE_NAME = "test_course"
COURSE_ORG = "edx"

def setUp(self):
self.course = CourseFactory.create(org=self.COURSE_ORG, display_name=self.COURSE_NAME, number=self.COURSE_SLUG)
self.user = User.objects.create(username="username", email="username")
self.req = self.request_factory.post('/token?course_id=edx/100/test_course', {'user': self.user})
self.req.user = self.user

def test_token(self):
expected = HttpResponse("eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJpc3N1ZWRBdCI6ICIyMDE0LTAxLTIzVDE5OjM1OjE3LjUyMjEwNC01OjAwIiwgImNvbnN1bWVyS2V5IjogInh4eHh4eHh4LXh4eHgteHh4eC14eHh4LXh4eHh4eHh4eHh4eCIsICJ1c2VySWQiOiAidXNlcm5hbWUiLCAidHRsIjogODY0MDB9.OjWz9mzqJnYuzX-f3uCBllqJUa8PVWJjcDy_McfxLvc", mimetype="text/plain")
response = token(self.req)
self.assertEqual(expected.content.split('.')[0], response.content.split('.')[0])
24 changes: 0 additions & 24 deletions common/djangoapps/student/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
create_comments_service_user, PasswordHistory
)
from student.forms import PasswordResetFormNoActive
from student.firebase_token_generator import create_token

from verify_student.models import SoftwareSecurePhotoVerification, MidcourseReverificationWindow
from certificates.models import CertificateStatuses, certificate_status_for_student
Expand Down Expand Up @@ -1780,26 +1779,3 @@ def change_email_settings(request):
track.views.server_track(request, "change-email-settings", {"receive_emails": "no", "course": course_id}, page='dashboard')

return JsonResponse({"success": True})


@login_required
def token(request):
'''
Return a token for the backend of annotations.
It uses the course id to retrieve a variable that contains the secret
token found in inheritance.py. It also contains information of when
the token was issued. This will be stored with the user along with
the id for identification purposes in the backend.
'''
course_id = request.GET.get("course_id")
course = course_from_id(course_id)
dtnow = datetime.datetime.now()
dtutcnow = datetime.datetime.utcnow()
delta = dtnow - dtutcnow
newhour, newmin = divmod((delta.days * 24 * 60 * 60 + delta.seconds + 30) // 60, 60)
newtime = "%s%+02d:%02d" % (dtnow.isoformat(), newhour, newmin)
secret = course.annotation_token_secret
custom_data = {"issuedAt": newtime, "consumerKey": secret, "userId": request.user.email, "ttl": 86400}
newtoken = create_token(secret, custom_data)
response = HttpResponse(newtoken, mimetype="text/plain")
return response
56 changes: 56 additions & 0 deletions common/lib/xmodule/xmodule/annotator_mixin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"""
Annotations Tool Mixin
This file contains global variables and functions used in the various Annotation Tools.
"""
from pkg_resources import resource_string
from lxml import etree
from urlparse import urlparse
from os.path import splitext, basename

def get_instructions(xmltree):
""" Removes <instructions> from the xmltree and returns them as a string, otherwise None. """
instructions = xmltree.find('instructions')
if instructions is not None:
instructions.tag = 'div'
xmltree.remove(instructions)
return etree.tostring(instructions, encoding='unicode')
return None

def get_extension(srcurl):
''' get the extension of a given url '''
if 'youtu' in srcurl:
return 'video/youtube'
else:
disassembled = urlparse(srcurl)
file_ext = splitext(basename(disassembled.path))[1]
return 'video/' + file_ext.replace('.', '')

ANNOTATOR_COMMON_JS = [
resource_string(__name__, 'js/src/ova/annotator-full.js'),
resource_string(__name__, 'js/src/ova/annotator-full-firebase-auth.js'),
resource_string(__name__, 'js/src/ova/video.dev.js'),
resource_string(__name__, 'js/src/ova/vjs.youtube.js'),
resource_string(__name__, 'js/src/ova/rangeslider.js'),
resource_string(__name__, 'js/src/ova/share-annotator.js'),
resource_string(__name__, 'js/src/ova/richText-annotator.js'),
resource_string(__name__, 'js/src/ova/reply-annotator.js'),
resource_string(__name__, 'js/src/ova/tags-annotator.js'),
resource_string(__name__, 'js/src/ova/flagging-annotator.js'),
resource_string(__name__, 'js/src/ova/jquery-Watch.js'),
resource_string(__name__, 'js/src/ova/diacritic-annotator.js'),
resource_string(__name__, 'js/src/ova/ova.js'),
resource_string(__name__, 'js/src/ova/catch/js/catch.js'),
resource_string(__name__, 'js/src/ova/catch/js/handlebars-1.1.2.js'),
]

ANNOTATOR_COMMON_CSS = [
resource_string(__name__, 'css/ova/edx-annotator.css'),
resource_string(__name__, 'css/ova/annotator.css'),
resource_string(__name__, 'css/ova/ova.css'),
resource_string(__name__, 'css/ova/rangeslider.css'),
resource_string(__name__, 'css/ova/share-annotator.css'),
resource_string(__name__, 'css/ova/richText-annotator.css'),
resource_string(__name__, 'css/ova/diacritic-annotator.css'),
resource_string(__name__, 'css/ova/flagging-annotator.css'),
resource_string(__name__, 'js/src/ova/catch/css/main.css'),
]
26 changes: 26 additions & 0 deletions common/lib/xmodule/xmodule/annotator_token.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'''
This file contains a function used to retrieve the token for the annotation backend
without having to create a view, but just returning a string instead.

It can be called from other files by using the following:
from xmodule.annotator_token import retrieve_token
'''
import datetime
from firebase_token_generator import create_token

def retrieve_token(userid, secret):
'''
Return a token for the backend of annotations.
It uses the course id to retrieve a variable that contains the secret
token found in inheritance.py. It also contains information of when
the token was issued. This will be stored with the user along with
the id for identification purposes in the backend.
'''
dtnow = datetime.datetime.now()
dtutcnow = datetime.datetime.utcnow()
delta = dtnow - dtutcnow
newhour, newmin = divmod((delta.days * 24 * 60 * 60 + delta.seconds + 30) // 60, 60)
newtime = "%s%+02d:%02d" % (dtnow.isoformat(), newhour, newmin)
custom_data = {"issuedAt": newtime, "consumerKey": secret, "userId": userid, "ttl": 86400}
newtoken = create_token(secret, custom_data)
return newtoken
6 changes: 6 additions & 0 deletions common/lib/xmodule/xmodule/css/ova/diacritic-annotator.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.mark{
width:10px;
height:10px;
position:absolute;
background-size:contain;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
/*This is written to fix some design problems with edX*/
.annotatable-wrapper .annotatable-header .annotatable-title{
padding-top: 20px !important;
}

.annotator-wrapper .annotator-adder button {
opacity:0;
}
Expand Down Expand Up @@ -27,6 +31,11 @@ span.annotator-hl{
display: none!important;
}
/*Catch*/

#catchDIV{
margin-top:15px;
}

#mainCatch *{
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
z-index:3000000000!important; /*To fix full-screen problems*/
}

.mce-container-body {
min-width:400px;
}

iframe[id^="annotator-field"] {
width: inherit;
min-width: 400px;
}

div.mce-tinymce.mce-container.mce-panel {
min-width: 400px;
}

/* Some change in the design of Annotator */
.annotator-editor .annotator-widget{
Expand All @@ -31,3 +43,4 @@
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QkBBB07nraNoQAAAhZJREFUKM+NkstrE1EUxr+5c08ykztpJtVoazHBF8FgQQzonyBKEZS6FrQKLl0EXBRT0ZULJSs3oii4TyHgu90IlTaL6qouWlv7Ck1N0BSnmZk714WbPHz07M4534+Pw3eAHdTY8A9+Nd9/bshU1DpnO4HXjh2ZY2J9/OSTxHTrnP8PvJYf+BDQ6qEDaQBB43jrTusUFy4oPjsYWYzF+VS91nxLYfdhKgONaQT3W/KMxr1XY5e+qj86f8zsKYYsZ6AvjWFzA8ORHkAnwN8So7evzL/8pzMAXL/Hq8mMv1up371T7Z+/c3n9cKeuDS6Xy6dN07zLuZ56Onk2Ed2/ANJsnE/PQMpgyffle+kYzwazB1+3waVS6X48Hr9BRPB9H57nYXplFKeSt8D1Hriug9XKF0x+Lmw+ys8m2m42DOOn4zhQSsGyLOi6jqONm9isbmFVFlDbaGKx8QaB1rvdlbNhGLAsC0IIGIYBIQSy2ROQ0oOp7wOPraHXEugRvDtnzjmi0SiICEIIEBGklAB9B6cmbG0AUnrY5m73h+m6DsYYTNMEYwxEBMY0hGNVhHkcZigBO9qHlDHS7cwYg23bAIBQKAQigud7IH0XwtxDoHwEIQ9SLKx0wa7rPiaivYyxESklXNeFBg0mjyNQTQSuATMSm6ipuYt//eVcLhdeXl5+UKlUlur1upqamVAv3j3/VCyOD3VqfwF6uLp3q+vMcgAAAABJRU5ErkJggg==');
background-repeat: no-repeat;
}

1 change: 1 addition & 0 deletions common/lib/xmodule/xmodule/css/ova/skin.min.css

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Annotator.Plugin.Auth.prototype.haveValidToken = function() {
var allFields;
allFields = this._unsafeToken && this._unsafeToken.d.issuedAt && this._unsafeToken.d.ttl && this._unsafeToken.d.consumerKey;
if (allFields && this.timeToExpiry() > 0) {
return true;
} else {
return false;
}
};

Annotator.Plugin.Auth.prototype.timeToExpiry = function() {
var expiry, issue, now, timeToExpiry;
now = new Date().getTime() / 1000;
issue = createDateFromISO8601(this._unsafeToken.d.issuedAt).getTime() / 1000;
expiry = issue + this._unsafeToken.d.ttl;
timeToExpiry = expiry - now;
if (timeToExpiry > 0) {
return timeToExpiry;
} else {
return 0;
}
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading