From d20eb077220e9e38eb6873c5f521eb38338437d5 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 11:25:58 -0400 Subject: [PATCH 1/9] Allow UTF-8 chars in about sections. --- common/lib/xmodule/xmodule/course_module.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 8435cfca9e..ff0302a26f 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -62,7 +62,7 @@ class CourseDescriptor(SequenceDescriptor): 'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']: try: with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: - return htmlFile.read() + return htmlFile.read().decode('utf-8') except ResourceNotFoundError: log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! About section missing !" @@ -91,7 +91,7 @@ class CourseDescriptor(SequenceDescriptor): if section_key in ['handouts', 'guest_handouts', 'updates', 'guest_updates']: try: with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile: - return htmlFile.read() + return htmlFile.read().decode('utf-8') except ResourceNotFoundError: log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url())) return "! Info section missing !" From e8516c5a3e9e85ecdd4bde70c69e29d529de77cd Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 14:31:13 -0400 Subject: [PATCH 2/9] Shorten course about link --- lms/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lms/urls.py b/lms/urls.py index 34fccc7070..0f4b6a4b88 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -90,7 +90,7 @@ if settings.COURSEWARE_ENABLED: # TODO (vshnayder): there is no student.views.course_info. # Where should this point instead? same as the info view? - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/about$', + url(r'^courses/(?P[^/]+/[^/]+/[^/]+)$', 'student.views.course_info', name="about_course"), ) From 27ec1b4dcffca36b5ae0a6da6a5d52ae78712e87 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Mon, 16 Jul 2012 16:56:25 -0400 Subject: [PATCH 3/9] Change course listing to show course numbers + title --- common/lib/xmodule/xmodule/course_module.py | 6 +++++- lms/templates/course.html | 2 +- lms/templates/portal/course_about.html | 5 +++++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index ff0302a26f..bc51fed51e 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -24,7 +24,11 @@ class CourseDescriptor(SequenceDescriptor): @property def title(self): - self.metadata['display_name'] + return self.metadata['display_name'] + + @property + def course_number(self): + return self.location.course @property def instructors(self): diff --git a/lms/templates/course.html b/lms/templates/course.html index bcfcab2526..e92a2eab1c 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -9,7 +9,7 @@
-

${course.get_about_section('title')}

+

${course.course_number} ${course.get_about_section('title')}

diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 9b1b616e46..de694611d2 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -47,6 +47,10 @@

Course staff

+ + ${course.get_about_section("instructors")} + +
From 373db8704d21b83c75d8f603fdecbf5245d658a5 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 08:21:10 -0400 Subject: [PATCH 4/9] Add number property to CourseDescriptor and switch templates to use it. --- common/lib/xmodule/xmodule/course_module.py | 2 +- lms/templates/course.html | 2 +- lms/templates/portal/course_about.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index bc51fed51e..7582a8b64f 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -27,7 +27,7 @@ class CourseDescriptor(SequenceDescriptor): return self.metadata['display_name'] @property - def course_number(self): + def number(self): return self.location.course @property diff --git a/lms/templates/course.html b/lms/templates/course.html index e92a2eab1c..5cc0c33a7a 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -9,7 +9,7 @@
-

${course.course_number} ${course.get_about_section('title')}

+

${course.number} ${course.get_about_section('title')}

diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index de694611d2..9e3bef53a0 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -11,7 +11,7 @@
-

${course.get_about_section("title")}

${course.get_about_section("university")}

+

${course.number}: ${course.get_about_section("title")}

${course.get_about_section("university")}

From c0e8dc1b69542d035ca158d5ae74930a127faf78 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 08:25:17 -0400 Subject: [PATCH 5/9] Remove duplicate entries of courses. --- lms/templates/course.html | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/lms/templates/course.html b/lms/templates/course.html index 5cc0c33a7a..b79cf02ac7 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -31,31 +31,3 @@

${course.get_about_section('university')}

- - From 17c3d068cfd93e057d3a09f2e2af8aa78a3946c7 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 17 Jul 2012 09:20:38 -0400 Subject: [PATCH 6/9] Add basic documentation of importing data into the CMS for development --- doc/development.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/development.md diff --git a/doc/development.md b/doc/development.md new file mode 100644 index 0000000000..cc71d4fbc9 --- /dev/null +++ b/doc/development.md @@ -0,0 +1,30 @@ +# Running the CMS + +One can start the CMS by running `rake cms`. This will run the server on localhost +port 8001. + +However, the server also needs data to work from. + +## Installing Mongodb + +Please see http://www.mongodb.org/downloads for more detailed instructions. + +### Ubuntu + + sudo apt-get install mongodb + +### OSX + + Use the MacPorts package `mongodb` or the Homebrew formula `mongodb` + +## Initializing Mongodb + +Check out the course data directories that you want to work with into the +`GITHUB_REPO_ROOT` (by default, `../data`). Then run the following command: + + + rake django-admin[import,cms,dev,../data] + +Replace `../data` with your `GITHUB_REPO_ROOT` if it's not the default value. + +This will import all courses in your data directory into mongodb From f6cc97a9ced4814966ca3792090d7c178790b638 Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Tue, 17 Jul 2012 09:22:09 -0400 Subject: [PATCH 7/9] Minor formatting change in OSX docs for CMS import --- doc/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/development.md b/doc/development.md index cc71d4fbc9..5b8e6fd837 100644 --- a/doc/development.md +++ b/doc/development.md @@ -15,7 +15,7 @@ Please see http://www.mongodb.org/downloads for more detailed instructions. ### OSX - Use the MacPorts package `mongodb` or the Homebrew formula `mongodb` +Use the MacPorts package `mongodb` or the Homebrew formula `mongodb` ## Initializing Mongodb From 28fc3ec18ae9564963931938bfe2ad2ca9eb3a35 Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 10:54:21 -0400 Subject: [PATCH 8/9] Add overview.html, a simple one page place where course staff can control a course about page. --- common/lib/xmodule/xmodule/course_module.py | 3 +- lms/templates/course.html | 2 +- lms/templates/portal/course_about.html | 68 ++------------------- 3 files changed, 9 insertions(+), 64 deletions(-) diff --git a/common/lib/xmodule/xmodule/course_module.py b/common/lib/xmodule/xmodule/course_module.py index 7582a8b64f..5f74873465 100644 --- a/common/lib/xmodule/xmodule/course_module.py +++ b/common/lib/xmodule/xmodule/course_module.py @@ -42,6 +42,7 @@ class CourseDescriptor(SequenceDescriptor): """ This returns the snippet of html to be rendered on the course about page, given the key for the section. Valid keys: + - overview - title - university - number @@ -63,7 +64,7 @@ class CourseDescriptor(SequenceDescriptor): # TODO: Remove number, instructors from this list if section_key in ['short_description', 'description', 'key_dates', 'video', 'course_staff_short', 'course_staff_extended', - 'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']: + 'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors', 'overview']: try: with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: return htmlFile.read().decode('utf-8') diff --git a/lms/templates/course.html b/lms/templates/course.html index b79cf02ac7..ab6067c6ea 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -19,7 +19,7 @@
-

An advanced introduction to analog circuits. An advanced introduction to analog circuits.

+ ${course.get_about_section('short_description')}
${course.get_about_section('university')} diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 9e3bef53a0..8d10938993 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -32,71 +32,15 @@
-
-

About this course

-

${course.get_about_section("description")}

-
- -
-

Course staff

- - ${course.get_about_section("instructors")} - - -
- -
-

Requirements

-

${course.get_about_section("requirements")}

-
- -
-

Syllabus

-

${course.get_about_section("syllabus")}

-
- -
-

Textbook

- ${course.get_about_section("textbook")} -
- -
-

Frequently Asked Questions

-

${course.get_about_section("faq")}

-
- + ${course.get_about_section("overview")}
From b4a8417e70a8c92b4d1300cd950d51780884f34d Mon Sep 17 00:00:00 2001 From: David Ormsbee Date: Tue, 17 Jul 2012 11:03:49 -0400 Subject: [PATCH 9/9] Use Course.number, remove final exam and content length from the course sidebar (do we have that data yet?) --- lms/templates/portal/course_about.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/templates/portal/course_about.html b/lms/templates/portal/course_about.html index 8d10938993..112333694f 100644 --- a/lms/templates/portal/course_about.html +++ b/lms/templates/portal/course_about.html @@ -63,9 +63,9 @@
  1. Classes Start

    7/12/12
  2. -
  3. Final Exam

    12/09/12
  4. -
  5. Course Length

    15 weeks
  6. -
  7. Course Number

    ${course.get_about_section("number")}
  8. + ##
  9. Final Exam

    12/09/12
  10. + ##
  11. Course Length

    15 weeks
  12. +
  13. Course Number

    ${course.number}