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
b0f9fd0d
Commit
b0f9fd0d
authored
Aug 31, 2013
by
Jason Bau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add link in lms legacy instructor dashboard to cms course_index
A one-click way of getting to editing the course
parent
b7e8af65
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
8 deletions
+50
-8
lms/djangoapps/courseware/courses.py
+17
-1
lms/djangoapps/courseware/tests/test_courses.py
+10
-1
lms/djangoapps/instructor/views/legacy.py
+11
-4
lms/envs/aws.py
+2
-0
lms/envs/common.py
+3
-0
lms/templates/courseware/instructor_dashboard.html
+7
-2
No files found.
lms/djangoapps/courseware/courses.py
View file @
b0f9fd0d
...
@@ -2,10 +2,11 @@ from collections import defaultdict
...
@@ -2,10 +2,11 @@ from collections import defaultdict
from
fs.errors
import
ResourceNotFoundError
from
fs.errors
import
ResourceNotFoundError
import
logging
import
logging
import
inspect
import
inspect
import
re
from
path
import
path
from
path
import
path
from
django.http
import
Http404
from
django.http
import
Http404
from
django.conf
import
settings
from
.module_render
import
get_module
from
.module_render
import
get_module
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.course_module
import
CourseDescriptor
from
xmodule.modulestore
import
Location
,
XML_MODULESTORE_TYPE
from
xmodule.modulestore
import
Location
,
XML_MODULESTORE_TYPE
...
@@ -294,3 +295,18 @@ def sort_by_announcement(courses):
...
@@ -294,3 +295,18 @@ def sort_by_announcement(courses):
courses
=
sorted
(
courses
,
key
=
key
)
courses
=
sorted
(
courses
,
key
=
key
)
return
courses
return
courses
def
get_cms_course_link_by_id
(
course_id
):
"""
Returns a proto-relative link to course_index for editing the course in cms, assuming that the course is actually
cms-backed. If course_id is improperly formatted, just return the root of the cms
"""
format_str
=
r'^(?P<org>[^/]+)/(?P<course>[^/]+)/(?P<name>[^/]+)$'
host
=
"//{}/"
.
format
(
settings
.
CMS_BASE
)
# protocol-relative
m
=
re
.
match
(
format_str
,
course_id
)
if
m
:
return
"{host}{org}/{course}/course/{name}"
.
format
(
host
=
host
,
org
=
m
.
group
(
'org'
),
course
=
m
.
group
(
'course'
),
name
=
m
.
group
(
'name'
))
return
host
lms/djangoapps/courseware/tests/test_courses.py
View file @
b0f9fd0d
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from
django.test
import
TestCase
from
django.test
import
TestCase
from
django.http
import
Http404
from
django.http
import
Http404
from
courseware.courses
import
get_course_by_id
from
courseware.courses
import
get_course_by_id
,
get_cms_course_link_by_id
class
CoursesTest
(
TestCase
):
class
CoursesTest
(
TestCase
):
def
test_get_course_by_id_invalid_chars
(
self
):
def
test_get_course_by_id_invalid_chars
(
self
):
...
@@ -14,3 +14,11 @@ class CoursesTest(TestCase):
...
@@ -14,3 +14,11 @@ class CoursesTest(TestCase):
get_course_by_id
(
'MITx/foobar/statistics=introduction'
)
get_course_by_id
(
'MITx/foobar/statistics=introduction'
)
get_course_by_id
(
'MITx/foobar/business and management'
)
get_course_by_id
(
'MITx/foobar/business and management'
)
get_course_by_id
(
'MITx/foobar/NiñøJoséMaríáßç'
)
get_course_by_id
(
'MITx/foobar/NiñøJoséMaríáßç'
)
def
test_get_cms_course_link_by_id
(
self
):
"""
Tests that get_cms_course_link_by_id returns the right thing
"""
self
.
assertEqual
(
"//localhost:8001/"
,
get_cms_course_link_by_id
(
"blah_bad_course_id"
))
self
.
assertEqual
(
"//localhost:8001/"
,
get_cms_course_link_by_id
(
"too/too/many/slashes"
))
self
.
assertEqual
(
"//localhost:8001/org/num/course/name"
,
get_cms_course_link_by_id
(
'org/num/name'
))
\ No newline at end of file
lms/djangoapps/instructor/views/legacy.py
View file @
b0f9fd0d
...
@@ -33,7 +33,7 @@ from xmodule.html_module import HtmlDescriptor
...
@@ -33,7 +33,7 @@ from xmodule.html_module import HtmlDescriptor
from
courseware
import
grades
from
courseware
import
grades
from
courseware.access
import
(
has_access
,
get_access_group_name
,
from
courseware.access
import
(
has_access
,
get_access_group_name
,
course_beta_test_group_name
)
course_beta_test_group_name
)
from
courseware.courses
import
get_course_with_access
from
courseware.courses
import
get_course_with_access
,
get_cms_course_link_by_id
from
courseware.models
import
StudentModule
from
courseware.models
import
StudentModule
from
django_comment_common.models
import
(
Role
,
from
django_comment_common.models
import
(
Role
,
FORUM_ROLE_ADMINISTRATOR
,
FORUM_ROLE_ADMINISTRATOR
,
...
@@ -799,16 +799,23 @@ def instructor_dashboard(request, course_id):
...
@@ -799,16 +799,23 @@ def instructor_dashboard(request, course_id):
else
:
else
:
email_editor
=
None
email_editor
=
None
# determine if this is a studio-backed course so we can 1) provide a link to edit this course in studio
# 2) enable course email
studio_url
=
None
is_studio_course
=
modulestore
()
.
get_modulestore_type
(
course_id
)
==
MONGO_MODULESTORE_TYPE
if
is_studio_course
:
studio_url
=
get_cms_course_link_by_id
(
course_id
)
# Flag for whether or not we display the email tab (depending upon
# Flag for whether or not we display the email tab (depending upon
# what backing store this course using (Mongo vs. XML))
# what backing store this course using (Mongo vs. XML))
if
settings
.
MITX_FEATURES
[
'ENABLE_INSTRUCTOR_EMAIL'
]
and
\
if
settings
.
MITX_FEATURES
[
'ENABLE_INSTRUCTOR_EMAIL'
]
and
is_studio_course
:
modulestore
()
.
get_modulestore_type
(
course_id
)
==
MONGO_MODULESTORE_TYPE
:
show_email_tab
=
True
show_email_tab
=
True
# display course stats only if there is no other table to display:
# display course stats only if there is no other table to display:
course_stats
=
None
course_stats
=
None
if
not
datatable
:
if
not
datatable
:
course_stats
=
get_course_stats_table
()
course_stats
=
get_course_stats_table
()
#----------------------------------------
#----------------------------------------
# context for rendering
# context for rendering
...
@@ -821,6 +828,7 @@ def instructor_dashboard(request, course_id):
...
@@ -821,6 +828,7 @@ def instructor_dashboard(request, course_id):
'course_stats'
:
course_stats
,
'course_stats'
:
course_stats
,
'msg'
:
msg
,
'msg'
:
msg
,
'modeflag'
:
{
idash_mode
:
'selectedmode'
},
'modeflag'
:
{
idash_mode
:
'selectedmode'
},
'studio_url'
:
studio_url
,
'to_option'
:
email_to_option
,
# email
'to_option'
:
email_to_option
,
# email
'subject'
:
email_subject
,
# email
'subject'
:
email_subject
,
# email
...
@@ -843,7 +851,6 @@ def instructor_dashboard(request, course_id):
...
@@ -843,7 +851,6 @@ def instructor_dashboard(request, course_id):
return
render_to_response
(
'courseware/instructor_dashboard.html'
,
context
)
return
render_to_response
(
'courseware/instructor_dashboard.html'
,
context
)
def
_do_remote_gradebook
(
user
,
course
,
action
,
args
=
None
,
files
=
None
):
def
_do_remote_gradebook
(
user
,
course
,
action
,
args
=
None
,
files
=
None
):
'''
'''
Perform remote gradebook action. Returns msg, datatable.
Perform remote gradebook action. Returns msg, datatable.
...
...
lms/envs/aws.py
View file @
b0f9fd0d
...
@@ -111,6 +111,8 @@ SITE_NAME = ENV_TOKENS['SITE_NAME']
...
@@ -111,6 +111,8 @@ SITE_NAME = ENV_TOKENS['SITE_NAME']
SESSION_ENGINE
=
ENV_TOKENS
.
get
(
'SESSION_ENGINE'
,
SESSION_ENGINE
)
SESSION_ENGINE
=
ENV_TOKENS
.
get
(
'SESSION_ENGINE'
,
SESSION_ENGINE
)
SESSION_COOKIE_DOMAIN
=
ENV_TOKENS
.
get
(
'SESSION_COOKIE_DOMAIN'
)
SESSION_COOKIE_DOMAIN
=
ENV_TOKENS
.
get
(
'SESSION_COOKIE_DOMAIN'
)
CMS_BASE
=
ENV_TOKENS
.
get
(
'CMS_BASE'
,
'studio.edx.org'
)
# allow for environments to specify what cookie name our login subsystem should use
# allow for environments to specify what cookie name our login subsystem should use
# this is to fix a bug regarding simultaneous logins between edx.org and edge.edx.org which can
# this is to fix a bug regarding simultaneous logins between edx.org and edge.edx.org which can
# happen with some browsers (e.g. Firefox)
# happen with some browsers (e.g. Firefox)
...
...
lms/envs/common.py
View file @
b0f9fd0d
...
@@ -353,6 +353,9 @@ DEBUG = False
...
@@ -353,6 +353,9 @@ DEBUG = False
TEMPLATE_DEBUG
=
False
TEMPLATE_DEBUG
=
False
USE_TZ
=
True
USE_TZ
=
True
# CMS base
CMS_BASE
=
'localhost:8001'
# Site info
# Site info
SITE_ID
=
1
SITE_ID
=
1
SITE_NAME
=
"edx.org"
SITE_NAME
=
"edx.org"
...
...
lms/templates/courseware/instructor_dashboard.html
View file @
b0f9fd0d
...
@@ -109,7 +109,7 @@ function goto( mode)
...
@@ -109,7 +109,7 @@ function goto( mode)
<div
class=
"instructor-dashboard-wrapper"
>
<div
class=
"instructor-dashboard-wrapper"
>
%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'):
%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BETA_DASHBOARD'):
<div
class=
"beta-button-wrapper"
><a
href=
"${ beta_dashboard_url }"
>
Try New Beta Dashboard
</a></div>
<div
class=
"beta-button-wrapper"
><a
href=
"${ beta_dashboard_url }"
>
${_("Try New Beta Dashboard")}
</a></div>
%endif
%endif
<section
class=
"instructor-dashboard-content"
>
<section
class=
"instructor-dashboard-content"
>
...
@@ -125,11 +125,16 @@ function goto( mode)
...
@@ -125,11 +125,16 @@ function goto( mode)
<a
href=
"#"
onclick=
"goto('Data');"
class=
"${modeflag.get('Data')}"
>
${_("DataDump")}
</a>
|
<a
href=
"#"
onclick=
"goto('Data');"
class=
"${modeflag.get('Data')}"
>
${_("DataDump")}
</a>
|
<a
href=
"#"
onclick=
"goto('Manage Groups');"
class=
"${modeflag.get('Manage Groups')}"
>
${_("Manage Groups")}
</a>
<a
href=
"#"
onclick=
"goto('Manage Groups');"
class=
"${modeflag.get('Manage Groups')}"
>
${_("Manage Groups")}
</a>
%if show_email_tab:
%if show_email_tab:
|
<a
href=
"#"
onclick=
"goto('Email')"
class=
"${modeflag.get('Email')}"
>
Email
</a>
|
<a
href=
"#"
onclick=
"goto('Email')"
class=
"${modeflag.get('Email')}"
>
${_("Email")}
</a>
%endif
%endif
%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_ANALYTICS'):
%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_ANALYTICS'):
|
<a
href=
"#"
onclick=
"goto('Analytics');"
class=
"${modeflag.get('Analytics')}"
>
${_("Analytics")}
</a>
|
<a
href=
"#"
onclick=
"goto('Analytics');"
class=
"${modeflag.get('Analytics')}"
>
${_("Analytics")}
</a>
%endif
%endif
%if studio_url:
## not checking access because if user can see this, they are at least course staff (with studio edit access)
|
<a
href=
"${studio_url}"
target=
"_blank"
>
${_('Edit Course')}
</a>
%endif
]
]
</h2>
</h2>
...
...
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