Commit f926925c by Victor Shnayder

Add a hide_progress_tab course policy flag

- for internal cs50 until we have grade integration set up (only really needed for external version)
parent 79109a62
...@@ -61,7 +61,7 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -61,7 +61,7 @@ class CourseDescriptor(SequenceDescriptor):
def __init__(self, system, definition=None, **kwargs): def __init__(self, system, definition=None, **kwargs):
super(CourseDescriptor, self).__init__(system, definition, **kwargs) super(CourseDescriptor, self).__init__(system, definition, **kwargs)
self.textbooks = self.definition['data']['textbooks'] self.textbooks = self.definition['data']['textbooks']
self.wiki_slug = self.definition['data']['wiki_slug'] or self.location.course self.wiki_slug = self.definition['data']['wiki_slug'] or self.location.course
msg = None msg = None
...@@ -101,19 +101,19 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -101,19 +101,19 @@ class CourseDescriptor(SequenceDescriptor):
for textbook in xml_object.findall("textbook"): for textbook in xml_object.findall("textbook"):
textbooks.append(cls.Textbook.from_xml_object(textbook)) textbooks.append(cls.Textbook.from_xml_object(textbook))
xml_object.remove(textbook) xml_object.remove(textbook)
#Load the wiki tag if it exists #Load the wiki tag if it exists
wiki_slug = None wiki_slug = None
wiki_tag = xml_object.find("wiki") wiki_tag = xml_object.find("wiki")
if wiki_tag is not None: if wiki_tag is not None:
wiki_slug = wiki_tag.attrib.get("slug", default=None) wiki_slug = wiki_tag.attrib.get("slug", default=None)
xml_object.remove(wiki_tag) xml_object.remove(wiki_tag)
definition = super(CourseDescriptor, cls).definition_from_xml(xml_object, system) definition = super(CourseDescriptor, cls).definition_from_xml(xml_object, system)
definition.setdefault('data', {})['textbooks'] = textbooks definition.setdefault('data', {})['textbooks'] = textbooks
definition['data']['wiki_slug'] = wiki_slug definition['data']['wiki_slug'] = wiki_slug
return definition return definition
def has_started(self): def has_started(self):
...@@ -219,7 +219,7 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -219,7 +219,7 @@ class CourseDescriptor(SequenceDescriptor):
# there are courses that change the number for different runs. This allows # there are courses that change the number for different runs. This allows
# courses to share the same css_class across runs even if they have # courses to share the same css_class across runs even if they have
# different numbers. # different numbers.
# #
# TODO get rid of this as soon as possible or potentially build in a robust # TODO get rid of this as soon as possible or potentially build in a robust
# way to add in course-specific styling. There needs to be a discussion # way to add in course-specific styling. There needs to be a discussion
# about the right way to do this, but arjun will address this ASAP. Also # about the right way to do this, but arjun will address this ASAP. Also
...@@ -234,14 +234,21 @@ class CourseDescriptor(SequenceDescriptor): ...@@ -234,14 +234,21 @@ class CourseDescriptor(SequenceDescriptor):
@property @property
def discussion_link(self): def discussion_link(self):
"""TODO: This is a quick kludge to allow CS50 (and other courses) to """TODO: This is a quick kludge to allow CS50 (and other courses) to
specify their own discussion forums as external links by specifying a specify their own discussion forums as external links by specifying a
"discussion_link" in their policy JSON file. This should later get "discussion_link" in their policy JSON file. This should later get
folded in with Syllabus, Course Info, and additional Custom tabs in a folded in with Syllabus, Course Info, and additional Custom tabs in a
more sensible framework later.""" more sensible framework later."""
return self.metadata.get('discussion_link', None) return self.metadata.get('discussion_link', None)
@property @property
def hide_progress_tab(self):
"""TODO: same as above, intended to let internal CS50 hide the progress tab
until we get grade integration set up."""
# Explicit comparison to True because we always want to return a bool.
return self.metadata.get('hide_progress_tab') == True
@property
def title(self): def title(self):
return self.display_name return self.display_name
......
...@@ -103,6 +103,7 @@ class XmlDescriptor(XModuleDescriptor): ...@@ -103,6 +103,7 @@ class XmlDescriptor(XModuleDescriptor):
xml_attribute_map = { xml_attribute_map = {
# type conversion: want True/False in python, "true"/"false" in xml # type conversion: want True/False in python, "true"/"false" in xml
'graded': bool_map, 'graded': bool_map,
'hide_progress_tab': bool_map,
} }
......
...@@ -37,7 +37,7 @@ def url_class(url): ...@@ -37,7 +37,7 @@ def url_class(url):
% elif settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'): % elif settings.MITX_FEATURES.get('ENABLE_DISCUSSION_SERVICE'):
<li class="discussion"><a href="${reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id])}" class="${url_class('discussion')}">Discussion</a></li> <li class="discussion"><a href="${reverse('django_comment_client.forum.views.forum_form_discussion', args=[course.id])}" class="${url_class('discussion')}">Discussion</a></li>
## <li class="news"><a href="${reverse('news', args=[course.id])}" class="${url_class('news')}">News</a></li> ## <li class="news"><a href="${reverse('news', args=[course.id])}" class="${url_class('news')}">News</a></li>
% endif % endif
## This is Askbot, which we should be retiring soon... ## This is Askbot, which we should be retiring soon...
% if settings.MITX_FEATURES.get('ENABLE_DISCUSSION'): % if settings.MITX_FEATURES.get('ENABLE_DISCUSSION'):
...@@ -48,7 +48,7 @@ def url_class(url): ...@@ -48,7 +48,7 @@ def url_class(url):
% if settings.WIKI_ENABLED: % if settings.WIKI_ENABLED:
<li class="wiki"><a href="${reverse('course_wiki', args=[course.id])}" class="${url_class('wiki')}">Wiki</a></li> <li class="wiki"><a href="${reverse('course_wiki', args=[course.id])}" class="${url_class('wiki')}">Wiki</a></li>
% endif % endif
% if user.is_authenticated(): % if user.is_authenticated() and not course.hide_progress_tab:
<li class="profile"><a href="${reverse('progress', args=[course.id])}" class="${url_class('progress')}">Progress</a></li> <li class="profile"><a href="${reverse('progress', args=[course.id])}" class="${url_class('progress')}">Progress</a></li>
% endif % endif
% if staff_access: % if staff_access:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment