diff --git a/cms/djangoapps/contentstore/context_processors.py b/cms/djangoapps/contentstore/context_processors.py
index 66ba685661..076b06bde1 100644
--- a/cms/djangoapps/contentstore/context_processors.py
+++ b/cms/djangoapps/contentstore/context_processors.py
@@ -1,4 +1,5 @@
import ConfigParser
+from locale import getlocale
from django.conf import settings
config_file = open(settings.REPO_ROOT / "docs" / "config.ini")
@@ -6,15 +7,37 @@ config = ConfigParser.ConfigParser()
config.readfp(config_file)
-def doc_url(request):
- # in the future, we will detect the locale; for now, we will
- # hardcode en_us, since we only have English documentation
- locale = "en_us"
+def doc_url(request=None):
- def get_doc_url(token):
- try:
- return config.get(locale, token)
- except ConfigParser.NoOptionError:
- return config.get(locale, "default")
+ def get_online_help_info(page_token):
- return {"doc_url": get_doc_url}
+ def get_config_value(section_name, key, default_key="default"):
+ try:
+ return config.get(section_name, key)
+ except (ConfigParser.NoOptionError, AttributeError):
+ return config.get(section_name, default_key)
+
+ def get_page_path(page_token):
+ return get_config_value("pages", page_token)
+
+ def get_langage_path(request):
+ language_code = settings.LANGUAGE_CODE
+ return get_config_value("locales", language_code)
+
+ def get_url(base_option):
+ return "{base_url}/{language}/{version}/{page_path}".format(
+ base_url=config.get("server_settings", base_option),
+ language=language_dir,
+ version=config.get("server_settings", "version"),
+ page_path=page_path,
+ )
+
+ language_dir = get_langage_path(request)
+ page_path = get_page_path(page_token)
+
+ return {
+ "doc_url": get_url("base_url"),
+ "pdf_url": get_url("base_pdf"),
+ }
+
+ return {'get_online_help_info': get_online_help_info}
diff --git a/cms/templates/base.html b/cms/templates/base.html
index 93a3ec4ff7..75b94fe32e 100644
--- a/cms/templates/base.html
+++ b/cms/templates/base.html
@@ -264,7 +264,8 @@
- <%include file="widgets/header.html" />
+ <% online_help_token = self.online_help_token() if hasattr(self, 'online_help_token') else None %>
+ <%include file="widgets/header.html" args="online_help_token=online_help_token" />
diff --git a/cms/templates/edit-tabs.html b/cms/templates/edit-tabs.html
index 2c0c964508..76ae27e268 100644
--- a/cms/templates/edit-tabs.html
+++ b/cms/templates/edit-tabs.html
@@ -1,4 +1,5 @@
<%inherit file="base.html" />
+<%def name="online_help_token()"><% return "pages" %>%def>
<%namespace name='static' file='static_content.html'/>
<%!
from django.utils.translation import ugettext as _
diff --git a/cms/templates/textbooks.html b/cms/templates/textbooks.html
index 09267faef5..12c40ef6cd 100644
--- a/cms/templates/textbooks.html
+++ b/cms/templates/textbooks.html
@@ -1,4 +1,5 @@
<%inherit file="base.html" />
+<%def name="online_help_token()"><% return "textbooks" %>%def>
<%namespace name='static' file='static_content.html'/>
<%! import json %>
<%! from django.utils.translation import ugettext as _ %>
diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html
index f27d5b9ea9..0e87a63c48 100644
--- a/cms/templates/widgets/header.html
+++ b/cms/templates/widgets/header.html
@@ -3,7 +3,9 @@
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from xmodule.modulestore.django import loc_mapper
+ from contentstore.context_processors import doc_url
%>
+<%page args="online_help_token"/>
diff --git a/docs/config.ini b/docs/config.ini
index 6337e350de..a0b0050327 100644
--- a/docs/config.ini
+++ b/docs/config.ini
@@ -1,2 +1,29 @@
-[en_us]
-default=default
+# below are the server-wide settings for documentation
+[server_settings]
+base_url = http://edx.readthedocs.org/projects/edx-partner-course-staff
+base_pdf = https://media.readthedocs.org/pdf/edx-partner-course-staff
+version = latest
+
+# below are the sub-paths to the documentation for the various pages
+[pages]
+default = index.html
+home = getting_started/get_started.html
+courses = building_course/creating_new_course.html
+outline = creating_content/organizing_course.html
+updates = creating_content/handouts_updates.html
+pages = creating_content/pages.html
+files = creating_content/course_files.html
+textbooks = creating_content/textbooks.html
+schedule = building_course/setting_up_student_view.html
+grading = building_course/establish_grading_policy.html
+team = building_course/creating_new_course.html#add-course-team-members
+advanced = index.html
+checklist = building_course/creating_new_course.html#use-the-course-checklist
+import = building_course/export_import_course.html
+export = building_course/export_import_course.html
+
+# below are the language directory names for the different locales
+[locales]
+default = en
+en = en
+en_us = en