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
37ab2fc1
Commit
37ab2fc1
authored
Apr 27, 2015
by
David Baumgold
Committed by
Sarina Canelake
May 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap block with license info in LMS only
parent
ca2fee12
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
31 additions
and
81 deletions
+31
-81
cms/static/js/models/license.js
+0
-0
cms/static/js/spec/models/license_spec.js
+0
-0
cms/static/js/spec/views/license_spec.js
+0
-0
cms/static/js/views/license.js
+0
-0
cms/static/js/views/metadata.js
+2
-1
cms/templates/js/license-selector.underscore
+2
-3
common/lib/xmodule/xmodule/capa_base.py
+0
-9
common/lib/xmodule/xmodule/discussion_module.py
+0
-9
common/lib/xmodule/xmodule/editing_module.py
+9
-0
common/lib/xmodule/xmodule/html_module.py
+0
-36
common/lib/xmodule/xmodule/mixin.py
+11
-0
common/lib/xmodule/xmodule/raw_module.py
+0
-12
common/templates/license_wrapper.html
+3
-0
common/templates/xblock_wrapper.html
+0
-5
lms/djangoapps/courseware/module_render.py
+4
-0
openedx/core/lib/xblock_utils.py
+0
-6
No files found.
cms/static/js/models/license.js
View file @
37ab2fc1
cms/static/js/spec/models/license_spec.js
View file @
37ab2fc1
cms/static/js/spec/views/license_spec.js
View file @
37ab2fc1
cms/static/js/views/license.js
View file @
37ab2fc1
cms/static/js/views/metadata.js
View file @
37ab2fc1
...
...
@@ -6,7 +6,8 @@ define(
"js/views/video/transcripts/metadata_videolist"
,
"js/views/video/translations_editor"
],
function
(
BaseView
,
_
,
MetadataModel
,
AbstractEditor
,
FileUpload
,
UploadDialog
,
LicenseModel
,
LicenseView
,
VideoList
,
VideoTranslations
)
{
function
(
BaseView
,
_
,
MetadataModel
,
AbstractEditor
,
FileUpload
,
UploadDialog
,
LicenseModel
,
LicenseView
,
VideoList
,
VideoTranslations
)
{
var
Metadata
=
{};
Metadata
.
Editor
=
BaseView
.
extend
({
...
...
cms/templates/js/license-selector.underscore
View file @
37ab2fc1
...
...
@@ -6,9 +6,8 @@
<% var link_start_tpl = '<a href="{url}" target="_blank">'; %>
<% _.each(licenseInfo, function(license, licenseType) { %>
<li data-license="<%- licenseType %>">
<button name="license-<%- licenseType %>" class="action license-button
<% if(model.type === licenseType) { print("is-selected"); } %>"
name="license-<%- licenseType %>"
<button name="license-<%- licenseType %>"
class="action license-button <% if(model.type === licenseType) { print("is-selected"); } %>"
<% if (license.tooltip) { %>data-tooltip="<%- license.tooltip %>"<% } %>>
<%- license.name %>
</button>
...
...
common/lib/xmodule/xmodule/capa_base.py
View file @
37ab2fc1
...
...
@@ -200,15 +200,6 @@ class CapaFields(object):
scope
=
Scope
.
settings
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
CapaFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
CapaFields
.
data
)
return
non_editable_fields
class
CapaMixin
(
CapaFields
):
"""
...
...
common/lib/xmodule/xmodule/discussion_module.py
View file @
37ab2fc1
...
...
@@ -41,15 +41,6 @@ class DiscussionFields(object):
)
sort_key
=
String
(
scope
=
Scope
.
settings
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
DiscussionFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
DiscussionFields
.
data
)
return
non_editable_fields
class
DiscussionModule
(
DiscussionFields
,
XModule
):
js
=
{
...
...
common/lib/xmodule/xmodule/editing_module.py
View file @
37ab2fc1
...
...
@@ -22,6 +22,15 @@ class EditingDescriptor(EditingFields, MakoModuleDescriptor):
"""
mako_template
=
"widgets/raw-edit.html"
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
EditingDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
self
.
fields
[
'data'
])
return
non_editable_fields
# cdodge: a little refactoring here, since we're basically doing the same thing
# here as with our parent class, let's call into it to get the basic fields
# set and then add our additional fields. Trying to keep it DRY.
...
...
common/lib/xmodule/xmodule/html_module.py
View file @
37ab2fc1
...
...
@@ -55,15 +55,6 @@ class HtmlFields(object):
scope
=
Scope
.
settings
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
HtmlFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
HtmlFields
.
data
)
return
non_editable_fields
class
HtmlModuleMixin
(
HtmlFields
,
XModule
):
"""
...
...
@@ -312,15 +303,6 @@ class AboutFields(object):
scope
=
Scope
.
content
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
AboutFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
AboutFields
.
data
)
return
non_editable_fields
@XBlock.tag
(
"detached"
)
class
AboutModule
(
AboutFields
,
HtmlModuleMixin
):
...
...
@@ -358,15 +340,6 @@ class StaticTabFields(object):
help
=
_
(
"HTML for the additional pages"
)
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
StaticTabFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
StaticTabFields
.
data
)
return
non_editable_fields
@XBlock.tag
(
"detached"
)
class
StaticTabModule
(
StaticTabFields
,
HtmlModuleMixin
):
...
...
@@ -401,15 +374,6 @@ class CourseInfoFields(object):
scope
=
Scope
.
content
)
@property
def
non_editable_metadata_fields
(
self
):
"""
`data` should not be editable in the Studio settings editor.
"""
non_editable_fields
=
super
(
CourseInfoFields
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
CourseInfoFields
.
data
)
return
non_editable_fields
@XBlock.tag
(
"detached"
)
class
CourseInfoModule
(
CourseInfoFields
,
HtmlModuleMixin
):
...
...
common/lib/xmodule/xmodule/mixin.py
View file @
37ab2fc1
...
...
@@ -51,3 +51,14 @@ class LicenseMixin(XBlockMixin):
"""
if
getattr
(
self
,
"license"
,
None
):
node
.
set
(
'license'
,
self
.
license
)
def
wrap_with_license
(
block
,
view
,
frag
,
context
):
# pylint: disable=unused-argument
"""
In the LMS, display the custom license underneath the XBlock.
"""
license
=
getattr
(
block
,
"license"
,
None
)
# pylint: disable=redefined-builtin
if
license
:
context
=
{
"license"
:
license
}
frag
.
content
+=
block
.
runtime
.
render_template
(
'license_wrapper.html'
,
context
)
return
frag
common/lib/xmodule/xmodule/raw_module.py
View file @
37ab2fc1
...
...
@@ -15,12 +15,6 @@ class RawDescriptor(XmlDescriptor, XMLEditingDescriptor):
"""
data
=
String
(
help
=
"XML data for the module"
,
default
=
""
,
scope
=
Scope
.
content
)
@property
def
non_editable_metadata_fields
(
self
):
non_editable_fields
=
super
(
RawDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
RawDescriptor
.
data
)
return
non_editable_fields
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
return
{
'data'
:
etree
.
tostring
(
xml_object
,
pretty_print
=
True
,
encoding
=
'unicode'
)},
[]
...
...
@@ -50,12 +44,6 @@ class EmptyDataRawDescriptor(XmlDescriptor, XMLEditingDescriptor):
"""
data
=
String
(
default
=
''
,
scope
=
Scope
.
content
)
@property
def
non_editable_metadata_fields
(
self
):
non_editable_fields
=
super
(
EmptyDataRawDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
append
(
EmptyDataRawDescriptor
.
data
)
return
non_editable_fields
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
if
len
(
xml_object
)
==
0
and
len
(
xml_object
.
items
())
==
0
:
...
...
common/templates/license_wrapper.html
0 → 100644
View file @
37ab2fc1
<div
class=
"xblock-license"
>
<
%
include
file=
"license.html"
args=
"license=license"
/>
</div>
common/templates/xblock_wrapper.html
View file @
37ab2fc1
...
...
@@ -5,9 +5,4 @@
</script>
% endif
${content}
% if license:
<div
class=
"xblock-license"
>
<
%
include
file=
"license.html"
args=
"license=license"
/>
</div>
% endif
</div>
lms/djangoapps/courseware/module_render.py
View file @
37ab2fc1
...
...
@@ -67,6 +67,7 @@ from openedx.core.lib.xblock_utils import (
)
from
xmodule.lti_module
import
LTIModule
from
xmodule.x_module
import
XModuleDescriptor
from
xmodule.mixin
import
wrap_with_license
from
xblock_django.user_service
import
DjangoXBlockUserService
from
util.json_request
import
JsonResponse
from
util.sandboxing
import
can_execute_unsafe_code
,
get_python_lib_zip
...
...
@@ -533,6 +534,9 @@ def get_module_system_for_user(user, field_data_cache,
# to the Fragment content coming out of the xblocks that are about to be rendered.
block_wrappers
=
[]
if
settings
.
FEATURES
.
get
(
"LICENSING"
,
False
):
block_wrappers
.
append
(
wrap_with_license
)
# Wrap the output display in a single div to allow for the XModule
# javascript to be bound correctly
if
wrap_xmodule_display
is
True
:
...
...
openedx/core/lib/xblock_utils.py
View file @
37ab2fc1
...
...
@@ -122,18 +122,12 @@ def wrap_xblock(
if
block
.
name
:
data
[
'name'
]
=
block
.
name
if
settings
.
FEATURES
.
get
(
"LICENSING"
,
False
):
license
=
getattr
(
block
,
"license"
,
None
)
else
:
license
=
None
template_context
=
{
'content'
:
block
.
display_name
if
display_name_only
else
frag
.
content
,
'classes'
:
css_classes
,
'display_name'
:
block
.
display_name_with_default
,
'data_attributes'
:
u' '
.
join
(
u'data-{}="{}"'
.
format
(
markupsafe
.
escape
(
key
),
markupsafe
.
escape
(
value
))
for
key
,
value
in
data
.
iteritems
()),
'license'
:
license
,
}
if
hasattr
(
frag
,
'json_init_args'
)
and
frag
.
json_init_args
is
not
None
:
...
...
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