Added a simple XBlockMixin for courseware licenses

This allows course authors to choose between two difference licenses for their
course content: All Rights Reserved, or Creative Commons. In the backend, XBlocks
that wish to allow custom licenses need only inherit from LicenseMixin, which
adds a `license` field as a string.

License information is displayed in the Studio editor view, and just below the
rendered XBlock in the LMS. In addition, if the course block itself has a custom
license set, this license will display just below the main body of the page
on courseware pages.

This entire feature is gated behind the LICENSING feature flag.
This commit is contained in:
David Baumgold
2015-03-05 10:56:14 -05:00
committed by Sarina Canelake
parent 8a4503b3f4
commit 2159d34128
48 changed files with 1333 additions and 25 deletions

View File

@@ -42,6 +42,7 @@ class CourseDetails(object):
self.overview = "" # html to render as the overview
self.intro_video = None # a video pointer
self.effort = None # int hours/week
self.license = None
self.course_image_name = ""
self.course_image_asset_path = "" # URL of the course image
self.pre_requisite_courses = [] # pre-requisite courses
@@ -79,6 +80,7 @@ class CourseDetails(object):
course_details.pre_requisite_courses = descriptor.pre_requisite_courses
course_details.course_image_name = descriptor.course_image
course_details.course_image_asset_path = course_image_url(descriptor)
course_details.license = getattr(descriptor, "license", None)
for attribute in ABOUT_ATTRIBUTES:
value = cls._fetch_about_attribute(course_key, attribute)
@@ -173,6 +175,10 @@ class CourseDetails(object):
descriptor.pre_requisite_courses = jsondict['pre_requisite_courses']
dirty = True
if 'license' in jsondict:
descriptor.license = jsondict['license']
dirty = True
if dirty:
module_store.update_item(descriptor, user.id)