diff --git a/.gitignore b/.gitignore index d01baf055a..76cc1efa95 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.swp *.orig *.DS_Store +*.mo :2e_* :2e# .AppleDouble @@ -22,6 +23,8 @@ reports/ *.egg-info Gemfile.lock .env/ +conf/locale/en/LC_MESSAGES/*.po +!messages.po lms/static/sass/*.css cms/static/sass/*.css lms/lib/comment_client/python @@ -33,3 +36,7 @@ chromedriver.log /nbproject ghostdriver.log node_modules +.pip_download_cache/ +.prereqs_cache +autodeploy.properties +.ws_migrations_complete diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 253bae3686..0000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "common/test/phantom-jasmine"] - path = common/test/phantom-jasmine - url = https://github.com/jcarver989/phantom-jasmine.git \ No newline at end of file diff --git a/.tx/config b/.tx/config new file mode 100644 index 0000000000..540c4732af --- /dev/null +++ b/.tx/config @@ -0,0 +1,26 @@ +[main] +host = https://www.transifex.com + +[edx-studio.django-partial] +file_filter = conf/locale//LC_MESSAGES/django-partial.po +source_file = conf/locale/en/LC_MESSAGES/django-partial.po +source_lang = en +type = PO + +[edx-studio.djangojs] +file_filter = conf/locale//LC_MESSAGES/djangojs.po +source_file = conf/locale/en/LC_MESSAGES/djangojs.po +source_lang = en +type = PO + +[edx-studio.mako] +file_filter = conf/locale//LC_MESSAGES/mako.po +source_file = conf/locale/en/LC_MESSAGES/mako.po +source_lang = en +type = PO + +[edx-studio.messages] +file_filter = conf/locale//LC_MESSAGES/messages.po +source_file = conf/locale/en/LC_MESSAGES/messages.po +source_lang = en +type = PO diff --git a/LICENSE.TXT b/LICENSE similarity index 100% rename from LICENSE.TXT rename to LICENSE diff --git a/README.md b/README.md index ec17d7c9a4..ed52c21fb2 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Installation The installation process is a bit messy at the moment. Here's a high-level overview of what you should do to get started. -**TLDR:** There is a `create-dev-env.sh` script that will attempt to set all +**TLDR:** There is a `scripts/create-dev-env.sh` script that will attempt to set all of this up for you. If you're in a hurry, run that script. Otherwise, I suggest that you understand what the script is doing, and why, by reading this document. @@ -77,11 +77,16 @@ environment), and Node has a library installer called Once you've got your languages and virtual environments set up, install the libraries like so: - $ pip install -r pre-requirements.txt - $ pip install -r requirements.txt + $ pip install -r requirements/edx/base.txt + $ pip install -r requirements/edx/post.txt $ bundle install $ npm install +You can also use [`rake`](http://rake.rubyforge.org/) to get all of the prerequisites (or to update) +them if they've changed + + $ rake install_prereqs + Other Dependencies ------------------ You'll also need to install [MongoDB](http://www.mongodb.org/), since our @@ -137,7 +142,7 @@ Studio, visit `127.0.0.1:8001` in your web browser; to view the LMS, visit There's also an older version of the LMS that saves its information in XML files in the `data` directory, instead of in Mongo. To run this older version, run: -$ rake lms + $ rake lms Further Documentation ===================== diff --git a/cms/djangoapps/contentstore/features/advanced-settings.feature b/cms/djangoapps/contentstore/features/advanced-settings.feature index ca5b62e596..6f6cc50702 100644 --- a/cms/djangoapps/contentstore/features/advanced-settings.feature +++ b/cms/djangoapps/contentstore/features/advanced-settings.feature @@ -11,7 +11,8 @@ Feature: Advanced (manual) course policy Given I am on the Advanced Course Settings page in Studio Then the settings are alphabetized - @skip-phantom + # Skipped because Ubuntu ChromeDriver cannot click notification "Cancel" + @skip Scenario: Test cancel editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key @@ -20,7 +21,8 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is unchanged - @skip-phantom + # Skipped because Ubuntu ChromeDriver cannot click notification "Save" + @skip Scenario: Test editing key value Given I am on the Advanced Course Settings page in Studio When I edit the value of a policy key and save @@ -28,7 +30,8 @@ Feature: Advanced (manual) course policy And I reload the page Then the policy key value is changed - @skip-phantom + # Skipped because Ubuntu ChromeDriver cannot edit CodeMirror input + @skip Scenario: Test how multi-line input appears Given I am on the Advanced Course Settings page in Studio When I create a JSON object as a value @@ -36,7 +39,8 @@ Feature: Advanced (manual) course policy And I reload the page Then it is displayed as formatted - @skip-phantom + # Skipped because Ubuntu ChromeDriver cannot edit CodeMirror input + @skip Scenario: Test automatic quoting of non-JSON values Given I am on the Advanced Course Settings page in Studio When I create a non-JSON value not in quotes diff --git a/cms/djangoapps/contentstore/features/checklists.feature b/cms/djangoapps/contentstore/features/checklists.feature index ddf1adf263..3767144c99 100644 --- a/cms/djangoapps/contentstore/features/checklists.feature +++ b/cms/djangoapps/contentstore/features/checklists.feature @@ -10,8 +10,6 @@ Feature: Course checklists Then I can check and uncheck tasks in a checklist And They are correctly selected after I reload the page - @skip-phantom - @skip-firefox Scenario: A task can link to a location within Studio Given I have opened Checklists When I select a link to the course outline @@ -19,8 +17,6 @@ Feature: Course checklists And I press the browser back button Then I am brought back to the course outline in the correct state - @skip-phantom - @skip-firefox Scenario: A task can link to a location outside Studio Given I have opened Checklists When I select a link to help page diff --git a/cms/djangoapps/contentstore/features/checklists.py b/cms/djangoapps/contentstore/features/checklists.py index d433dbbf0d..1c9fbf0994 100644 --- a/cms/djangoapps/contentstore/features/checklists.py +++ b/cms/djangoapps/contentstore/features/checklists.py @@ -2,7 +2,7 @@ #pylint: disable=W0621 from lettuce import world, step -from nose.tools import assert_true, assert_equal +from nose.tools import assert_true, assert_equal, assert_in from terrain.steps import reload_the_page from selenium.common.exceptions import StaleElementReferenceException @@ -63,7 +63,7 @@ def i_select_a_link_to_the_course_outline(step): @step('I am brought to the course outline page$') def i_am_brought_to_course_outline(step): - assert_equal('Course Outline', world.css_find('.outline .title-1')[0].text) + assert_in('Course Outline', world.css_find('.outline .page-header')[0].text) assert_equal(1, len(world.browser.windows)) diff --git a/cms/djangoapps/contentstore/features/course-settings.feature b/cms/djangoapps/contentstore/features/course-settings.feature index fc9641cb46..e869bfe47a 100644 --- a/cms/djangoapps/contentstore/features/course-settings.feature +++ b/cms/djangoapps/contentstore/features/course-settings.feature @@ -1,20 +1,17 @@ Feature: Course Settings As a course author, I want to be able to configure my course settings. - @skip-phantom Scenario: User can set course dates Given I have opened a new course in Studio When I select Schedule and Details And I set course dates Then I see the set dates on refresh - @skip-phantom Scenario: User can clear previously set course dates (except start date) Given I have set course dates And I clear all the dates except start Then I see cleared dates on refresh - @skip-phantom Scenario: User cannot clear the course start date Given I have set course dates And I clear the course start date diff --git a/cms/djangoapps/contentstore/features/section.feature b/cms/djangoapps/contentstore/features/section.feature index 24cbeb3db9..236cf501fc 100644 --- a/cms/djangoapps/contentstore/features/section.feature +++ b/cms/djangoapps/contentstore/features/section.feature @@ -3,7 +3,6 @@ Feature: Create Section As a course author I want to create and edit sections - @skip-phantom Scenario: Add a new section to a course Given I have opened a new course in Studio When I click the New Section link @@ -27,7 +26,8 @@ Feature: Create Section And I save a new section release date Then the section release date is updated - @skip-phantom + # Skipped because Ubuntu ChromeDriver hangs on alert + @skip Scenario: Delete section Given I have opened a new course in Studio And I have added a new section diff --git a/cms/djangoapps/contentstore/features/signup.py b/cms/djangoapps/contentstore/features/signup.py index 6ca358183b..398f8d074d 100644 --- a/cms/djangoapps/contentstore/features/signup.py +++ b/cms/djangoapps/contentstore/features/signup.py @@ -18,10 +18,7 @@ def i_fill_in_the_registration_form(step): @step('I press the Create My Account button on the registration form$') def i_press_the_button_on_the_registration_form(step): submit_css = 'form#register_form button#submit' - # Workaround for click not working on ubuntu - # for some unknown reason. - e = world.css_find(submit_css) - e.type(' ') + world.css_click(submit_css) @step('I should see be on the studio home page$') diff --git a/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature b/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature index a0e0a48f9e..c9f5b43dfb 100644 --- a/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature +++ b/cms/djangoapps/contentstore/features/studio-overview-togglesection.feature @@ -14,7 +14,6 @@ Feature: Overview Toggle Section When I navigate to the course overview page Then I do not see the "Collapse All Sections" link - @skip-phantom Scenario: Collapse link appears after creating first section of a course Given I have a course with no sections When I navigate to the course overview page @@ -22,7 +21,8 @@ Feature: Overview Toggle Section Then I see the "Collapse All Sections" link And all sections are expanded - @skip-phantom + # Skipped because Ubuntu ChromeDriver hangs on alert + @skip Scenario: Collapse link is not removed after last section of a course is deleted Given I have a course with 1 section And I navigate to the course overview page diff --git a/cms/djangoapps/contentstore/features/subsection.feature b/cms/djangoapps/contentstore/features/subsection.feature index 28285bf8a1..8bb12467ff 100644 --- a/cms/djangoapps/contentstore/features/subsection.feature +++ b/cms/djangoapps/contentstore/features/subsection.feature @@ -3,14 +3,12 @@ Feature: Create Subsection As a course author I want to create and edit subsections - @skip-phantom Scenario: Add a new subsection to a section Given I have opened a new course section in Studio When I click the New Subsection link And I enter the subsection name and click save Then I see my subsection on the Courseware page - @skip-phantom Scenario: Add a new subsection (with a name containing a quote) to a section (bug #216) Given I have opened a new course section in Studio When I click the New Subsection link @@ -27,7 +25,6 @@ Feature: Create Subsection And I reload the page Then I see it marked as Homework - @skip-phantom Scenario: Set a due date in a different year (bug #256) Given I have opened a new subsection in Studio And I have set a release date and due date in different years @@ -35,7 +32,8 @@ Feature: Create Subsection And I reload the page Then I see the correct dates - @skip-phantom + # Skipped because Ubuntu ChromeDriver hangs on alert + @skip Scenario: Delete a subsection Given I have opened a new course section in Studio And I have added a new subsection diff --git a/cms/djangoapps/contentstore/features/subsection.py b/cms/djangoapps/contentstore/features/subsection.py index f9e5b52bb2..edc8b17168 100644 --- a/cms/djangoapps/contentstore/features/subsection.py +++ b/cms/djangoapps/contentstore/features/subsection.py @@ -63,14 +63,6 @@ def test_have_set_dates_in_different_years(step): set_date_and_time('input#due_date', '01/02/2012', 'input#due_time', '04:00') -@step('I see the correct dates$') -def i_see_the_correct_dates(step): - assert_equal('12/25/2011', world.css_find('input#start_date').first.value) - assert_equal('03:00', world.css_find('input#start_time').first.value) - assert_equal('01/02/2012', world.css_find('input#due_date').first.value) - assert_equal('04:00', world.css_find('input#due_time').first.value) - - @step('I mark it as Homework$') def i_mark_it_as_homework(step): world.css_click('a.menu-toggle') @@ -101,8 +93,20 @@ def the_subsection_does_not_exist(step): assert world.browser.is_element_not_present_by_css(css) +@step('I see the correct dates$') +def i_see_the_correct_dates(step): + assert_equal('12/25/2011', get_date('input#start_date')) + assert_equal('03:00', get_date('input#start_time')) + assert_equal('01/02/2012', get_date('input#due_date')) + assert_equal('04:00', get_date('input#due_time')) + + ############ HELPER METHODS ################### +def get_date(css): + return world.css_find(css).first.value.strip() + + def save_subsection_name(name): name_css = 'input.new-subsection-name-input' save_css = 'input.new-subsection-name-save' diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 844ba87a11..0aec61729c 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -220,6 +220,14 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): num_drafts = self._get_draft_counts(course) self.assertEqual(num_drafts, 1) + def test_import_textbook_as_content_element(self): + import_from_xml(modulestore(), 'common/test/data/', ['full']) + + module_store = modulestore('direct') + course = module_store.get_item(Location(['i4x', 'edX', 'full', 'course', '6.002_Spring_2012', None])) + + self.assertGreater(len(course.textbooks), 0) + def test_static_tab_reordering(self): import_from_xml(modulestore(), 'common/test/data/', ['full']) @@ -293,7 +301,6 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): # make sure the parent no longer points to the child object which was deleted self.assertFalse(sequential.location.url() in chapter.children) - def test_about_overrides(self): ''' This test case verifies that a course can use specialized override for about data, e.g. /about/Fall_2012/effort.html @@ -490,6 +497,11 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase): self.assertTrue(getattr(test_private_vertical, 'is_draft', False)) + # make sure the textbook survived the export/import + course = module_store.get_item(Location(['i4x', 'edX', 'full', 'course', '6.002_Spring_2012', None])) + + self.assertGreater(len(course.textbooks), 0) + shutil.rmtree(root_dir) def test_course_handouts_rewrites(self): @@ -634,7 +646,7 @@ class ContentStoreTest(ModuleStoreTestCase): resp = self.client.get(reverse('index')) self.assertContains( resp, - '

My Courses

', + '

My Courses

', status_code=200, html=True ) diff --git a/cms/djangoapps/contentstore/tests/test_course_updates.py b/cms/djangoapps/contentstore/tests/test_course_updates.py index 80d4f0bbc2..ae14555b32 100644 --- a/cms/djangoapps/contentstore/tests/test_course_updates.py +++ b/cms/djangoapps/contentstore/tests/test_course_updates.py @@ -10,9 +10,9 @@ class CourseUpdateTest(CourseTestCase): '''Go through each interface and ensure it works.''' # first get the update to force the creation url = reverse('course_info', - kwargs={'org': self.course_location.org, - 'course': self.course_location.course, - 'name': self.course_location.name}) + kwargs={'org': self.course_location.org, + 'course': self.course_location.course, + 'name': self.course_location.name}) self.client.get(url) init_content = ' \ No newline at end of file diff --git a/common/test/data/word_cloud/chapter/Staff.xml b/common/test/data/word_cloud/chapter/Staff.xml new file mode 100644 index 0000000000..e1d5216f6d --- /dev/null +++ b/common/test/data/word_cloud/chapter/Staff.xml @@ -0,0 +1,3 @@ + + + diff --git a/common/test/data/word_cloud/course.xml b/common/test/data/word_cloud/course.xml new file mode 100644 index 0000000000..1b97a5a714 --- /dev/null +++ b/common/test/data/word_cloud/course.xml @@ -0,0 +1,2 @@ + + diff --git a/common/test/data/word_cloud/course/2013_Spring.xml b/common/test/data/word_cloud/course/2013_Spring.xml new file mode 100644 index 0000000000..cb6e7c1217 --- /dev/null +++ b/common/test/data/word_cloud/course/2013_Spring.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/common/test/data/word_cloud/creating_course.xml b/common/test/data/word_cloud/creating_course.xml new file mode 100644 index 0000000000..4c90f1c2ec --- /dev/null +++ b/common/test/data/word_cloud/creating_course.xml @@ -0,0 +1,8 @@ + diff --git a/common/test/data/word_cloud/info/2013_Spring/handouts.html b/common/test/data/word_cloud/info/2013_Spring/handouts.html new file mode 100644 index 0000000000..35f2c89474 --- /dev/null +++ b/common/test/data/word_cloud/info/2013_Spring/handouts.html @@ -0,0 +1,3 @@ +
    +
  1. A list of course handouts, or an empty file if there are none.
  2. +
diff --git a/common/test/data/word_cloud/info/2013_Spring/updates.html b/common/test/data/word_cloud/info/2013_Spring/updates.html new file mode 100644 index 0000000000..9744c1699d --- /dev/null +++ b/common/test/data/word_cloud/info/2013_Spring/updates.html @@ -0,0 +1,10 @@ + +
    + +
  1. December 9

    +
    +

    Announcement text

    +
    +
  2. + +
diff --git a/common/test/data/word_cloud/policies/2013_Spring/policy.json b/common/test/data/word_cloud/policies/2013_Spring/policy.json new file mode 100644 index 0000000000..e2a204815c --- /dev/null +++ b/common/test/data/word_cloud/policies/2013_Spring/policy.json @@ -0,0 +1,8 @@ +{ + "course/2013_Spring": { + "start": "2099-01-01T00:00", + "advertised_start" : "Spring 2013", + "display_name": "Justice" + } + +} diff --git a/common/test/data/word_cloud/roots/2013_Spring.xml b/common/test/data/word_cloud/roots/2013_Spring.xml new file mode 100644 index 0000000000..1b97a5a714 --- /dev/null +++ b/common/test/data/word_cloud/roots/2013_Spring.xml @@ -0,0 +1,2 @@ + + diff --git a/common/test/data/word_cloud/sequential/Problem_Demos.xml b/common/test/data/word_cloud/sequential/Problem_Demos.xml new file mode 100644 index 0000000000..21568128a4 --- /dev/null +++ b/common/test/data/word_cloud/sequential/Problem_Demos.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/common/test/data/word_cloud/static/README b/common/test/data/word_cloud/static/README new file mode 100644 index 0000000000..e22f378b5e --- /dev/null +++ b/common/test/data/word_cloud/static/README @@ -0,0 +1,5 @@ +Images, handouts, and other statically-served content should go ONLY +in this directory. + +Images for the front page should go in static/images. The frontpage +banner MUST be named course_image.jpg \ No newline at end of file diff --git a/__init__.py b/common/test/data/word_cloud/word_cloud/cloud.xml similarity index 100% rename from __init__.py rename to common/test/data/word_cloud/word_cloud/cloud.xml diff --git a/conf/locale/config b/conf/locale/config index 2d01e1ea43..58f8da0513 100644 --- a/conf/locale/config +++ b/conf/locale/config @@ -1 +1,4 @@ -{"locales" : ["en"]} +{ + "locales" : ["en", "es"], + "dummy-locale" : "fr" +} diff --git a/conf/locale/en/LC_MESSAGES/messages.po b/conf/locale/en/LC_MESSAGES/messages.po index 1bb8bf6d7f..e5961753c5 100644 --- a/conf/locale/en/LC_MESSAGES/messages.po +++ b/conf/locale/en/LC_MESSAGES/messages.po @@ -1 +1,20 @@ +# edX translation file +# Copyright (C) 2013 edX +# This file is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE. +# +msgid "" +msgstr "" +"Project-Id-Version: EdX Studio\n" +"Report-Msgid-Bugs-To: translation_team@edx.org\n" +"POT-Creation-Date: 2013-05-02 13:13-0400\n" +"PO-Revision-Date: 2013-05-02 13:27-0400\n" +"Last-Translator: \n" +"Language-Team: translation team \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: en\n" + # empty +msgid "This is a key string." +msgstr "" diff --git a/distribute-0.6.32.tar.gz b/distribute-0.6.32.tar.gz deleted file mode 100644 index 2438db60fa..0000000000 Binary files a/distribute-0.6.32.tar.gz and /dev/null differ diff --git a/distribute-0.6.34.tar.gz b/distribute-0.6.34.tar.gz deleted file mode 100644 index 4e91b3af62..0000000000 Binary files a/distribute-0.6.34.tar.gz and /dev/null differ diff --git a/doc/development.md b/doc/development.md index a6a1de4ef7..c99e99f906 100644 --- a/doc/development.md +++ b/doc/development.md @@ -36,7 +36,7 @@ Check out the course data directories that you want to work with into the To create your development environment, run the shell script in the root of the repo: - create-dev-env.sh + scripts/create-dev-env.sh ## Starting development servers diff --git a/doc/public/course_data_formats/word_cloud/word_cloud.png b/doc/public/course_data_formats/word_cloud/word_cloud.png new file mode 100644 index 0000000000..07b7292b5e Binary files /dev/null and b/doc/public/course_data_formats/word_cloud/word_cloud.png differ diff --git a/doc/public/course_data_formats/word_cloud/word_cloud.rst b/doc/public/course_data_formats/word_cloud/word_cloud.rst new file mode 100644 index 0000000000..5c3d31e149 --- /dev/null +++ b/doc/public/course_data_formats/word_cloud/word_cloud.rst @@ -0,0 +1,59 @@ +********************************************** +Xml format of "Word Cloud" module [xmodule] +********************************************** + +.. module:: word_cloud + +Format description +================== + +The main tag of Word Cloud module input is: + +.. code-block:: xml + + + +The following attributes can be specified for this tag:: + + [display_name| AUTOGENERATE] – Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash. + [num_inputs| 5] – Number of inputs. + [num_top_words| 250] – Number of max words, which will be displayed. + [display_student_percents| True] – Display usage percents for each word on the same line together with words. + +.. note:: + + Percent is shown always when mouse over the word in cloud. + +.. note:: + + Possible answer for boolean type attributes: + True – "True", "true", "T", "t", "1" + False – "False", "false", "F", "f", "0" + +.. note:: + + If you want to use the same word cloud (the same storage of words), you must use the same display_name value. + + +Code Example +============ + +Examples of word_cloud without all attributes (all attributes get by default) +----------------------------------------------------------------------------- + +.. code-block:: xml + + + +Examples of poll with all attributes +------------------------------------ + +.. code-block:: xml + + + +Screenshots +=========== + +.. image:: word_cloud.png + :width: 50% diff --git a/doc/public/index.rst b/doc/public/index.rst index ee681a822e..064b3ff443 100644 --- a/doc/public/index.rst +++ b/doc/public/index.rst @@ -26,6 +26,7 @@ Specific Problem Types course_data_formats/graphical_slider_tool/graphical_slider_tool.rst course_data_formats/poll_module/poll_module.rst course_data_formats/conditional_module/conditional_module.rst + course_data_formats/word_cloud/word_cloud.rst course_data_formats/custom_response.rst diff --git a/doc/testing.md b/doc/testing.md index 84175fee3d..d6c7b7ee86 100644 --- a/doc/testing.md +++ b/doc/testing.md @@ -161,36 +161,36 @@ try running `bundle install` to install the required ruby gems. We use [Lettuce](http://lettuce.it/) for acceptance testing. Most of our tests use [Splinter](http://splinter.cobrateam.info/) to simulate UI browser interactions. Splinter, in turn, -uses [Selenium](http://docs.seleniumhq.org/) to control the browser. +uses [Selenium](http://docs.seleniumhq.org/) to control the Chrome browser. **Prerequisite**: You must have [ChromeDriver](https://code.google.com/p/selenium/wiki/ChromeDriver) -installed to run the tests in Chrome. +installed to run the tests in Chrome. The tests are confirmed to run +with Chrome (not Chromium) version 26.0.0.1410.63 with ChromeDriver +version r195636. -Before running the tests, you need to set up the test database: +To run all the acceptance tests: - rm ../db/test_mitx.db - rake django-admin[syncdb,lms,acceptance,--noinput] - rake django-admin[migrate,lms,acceptance,--noinput] - -To run the acceptance tests: - -1. Start the Django server locally using the settings in **acceptance.py**: - - rake lms[acceptance] - -2. In another shell, run the tests: - - django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/portal/features/ + rake test_acceptance_lms + rake test_acceptance_cms To test only a specific feature: - django-admin.py harvest --no-server --settings=lms.envs.acceptance --pythonpath=. lms/djangoapps/courseware/features/high-level-tabs.feature + rake test_acceptance_lms[lms/djangoapps/courseware/features/problems.feature] + +To start the debugger on failure, add the `--pdb` option: + + rake test_acceptance_lms["lms/djangoapps/courseware/features/problems.feature --pdb"] + +To run tests faster by not collecting static files, you can use +`rake fasttest_acceptance_lms` and `rake fasttest_acceptance_cms`. + **Troubleshooting**: If you get an error message that says something about harvest not being a command, you probably are missing a requirement. Try running: pip install -r requirements.txt +**Note**: The acceptance tests can *not* currently run in parallel. ## Viewing Test Coverage diff --git a/docs/source/xmodule.rst b/docs/source/xmodule.rst index 45caa82c30..d68ab779f6 100644 --- a/docs/source/xmodule.rst +++ b/docs/source/xmodule.rst @@ -165,6 +165,13 @@ Video :members: :show-inheritance: +Word Cloud +========== + +.. automodule:: xmodule.word_cloud_module + :members: + :show-inheritance: + X = diff --git a/fixtures/anonymize_fixtures.py b/fixtures/anonymize_fixtures.py deleted file mode 100755 index ba62652de5..0000000000 --- a/fixtures/anonymize_fixtures.py +++ /dev/null @@ -1,98 +0,0 @@ -#! /usr/bin/env python - -import sys -import json -import random -import copy -from collections import defaultdict -from argparse import ArgumentParser, FileType -from datetime import datetime - -def generate_user(user_number): - return { - "pk": user_number, - "model": "auth.user", - "fields": { - "status": "w", - "last_name": "Last", - "gold": 0, - "is_staff": False, - "user_permissions": [], - "interesting_tags": "", - "email_key": None, - "date_joined": "2012-04-26 11:36:39", - "first_name": "", - "email_isvalid": False, - "avatar_type": "n", - "website": "", - "is_superuser": False, - "date_of_birth": None, - "last_login": "2012-04-26 11:36:48", - "location": "", - "new_response_count": 0, - "email": "user{num}@example.com".format(num=user_number), - "username": "user{num}".format(num=user_number), - "is_active": True, - "consecutive_days_visit_count": 0, - "email_tag_filter_strategy": 1, - "groups": [], - "password": "sha1$90e6f$562a1d783a0c47ce06ebf96b8c58123a0671bbf0", - "silver": 0, - "bronze": 0, - "questions_per_page": 10, - "about": "", - "show_country": True, - "country": "", - "display_tag_filter_strategy": 0, - "seen_response_count": 0, - "real_name": "", - "ignored_tags": "", - "reputation": 1, - "gravatar": "366d981a10116969c568a18ee090f44c", - "last_seen": "2012-04-26 11:36:39" - } - } - - -def parse_args(args=sys.argv[1:]): - parser = ArgumentParser() - parser.add_argument('-d', '--data', type=FileType('r'), default=sys.stdin) - parser.add_argument('-o', '--output', type=FileType('w'), default=sys.stdout) - parser.add_argument('count', type=int) - return parser.parse_args(args) - - -def main(args=sys.argv[1:]): - args = parse_args(args) - - data = json.load(args.data) - unique_students = set(entry['fields']['student'] for entry in data) - if args.count > len(unique_students) * 0.1: - raise Exception("Can't be sufficiently anonymous selecting {count} of {unique} students".format( - count=args.count, unique=len(unique_students))) - - by_problems = defaultdict(list) - for entry in data: - by_problems[entry['fields']['module_id']].append(entry) - - out_data = [] - out_pk = 1 - for name, answers in by_problems.items(): - for student_id in xrange(args.count): - sample = random.choice(answers) - data = copy.deepcopy(sample) - data["fields"]["student"] = student_id + 1 - data["fields"]["created"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") - data["fields"]["modified"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S") - data["pk"] = out_pk - out_pk += 1 - out_data.append(data) - - for student_id in xrange(args.count): - out_data.append(generate_user(student_id)) - - json.dump(out_data, args.output, indent=2) - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/fixtures/pm.json b/fixtures/pm.json deleted file mode 100644 index 5ecb839093..0000000000 --- a/fixtures/pm.json +++ /dev/null @@ -1 +0,0 @@ -[{"pk": 1, "model": "user.userprofile", "fields": {"name": "pm", "language": "pm", "courseware": "course.xml", "meta": "", "location": "pm", "user": 1}}, {"pk": 1, "model": "auth.user", "fields": {"status": "w", "last_name": "", "gold": 0, "is_staff": true, "user_permissions": [], "interesting_tags": "", "email_key": null, "date_joined": "2012-01-23 17:03:54", "first_name": "", "email_isvalid": false, "avatar_type": "n", "website": "", "is_superuser": true, "date_of_birth": null, "last_login": "2012-01-23 17:04:16", "location": "", "new_response_count": 0, "email": "pmitros@csail.mit.edu", "username": "pm", "is_active": true, "consecutive_days_visit_count": 0, "email_tag_filter_strategy": 1, "groups": [], "password": "sha1$a3e96$dbabbd114f0da01bce2cc2adcafa2ca651c7ae0a", "silver": 0, "bronze": 0, "questions_per_page": 10, "about": "", "show_country": false, "country": "", "display_tag_filter_strategy": 0, "seen_response_count": 0, "real_name": "", "ignored_tags": "", "reputation": 1, "gravatar": "7a591afd0cc7972fdbe5e12e26af352a", "last_seen": "2012-01-23 17:04:41"}}, {"pk": 1, "model": "user.userprofile", "fields": {"name": "pm", "language": "pm", "courseware": "course.xml", "meta": "", "location": "pm", "user": 1}}, {"pk": 1, "model": "auth.user", "fields": {"status": "w", "last_name": "", "gold": 0, "is_staff": true, "user_permissions": [], "interesting_tags": "", "email_key": null, "date_joined": "2012-01-23 17:03:54", "first_name": "", "email_isvalid": false, "avatar_type": "n", "website": "", "is_superuser": true, "date_of_birth": null, "last_login": "2012-01-23 17:04:16", "location": "", "new_response_count": 0, "email": "pmitros@csail.mit.edu", "username": "pm", "is_active": true, "consecutive_days_visit_count": 0, "email_tag_filter_strategy": 1, "groups": [], "password": "sha1$a3e96$dbabbd114f0da01bce2cc2adcafa2ca651c7ae0a", "silver": 0, "bronze": 0, "questions_per_page": 10, "about": "", "show_country": false, "country": "", "display_tag_filter_strategy": 0, "seen_response_count": 0, "real_name": "", "ignored_tags": "", "reputation": 1, "gravatar": "7a591afd0cc7972fdbe5e12e26af352a", "last_seen": "2012-01-23 17:04:41"}}] \ No newline at end of file diff --git a/i18n/config.py b/i18n/config.py new file mode 100644 index 0000000000..4f246ed942 --- /dev/null +++ b/i18n/config.py @@ -0,0 +1,77 @@ +import os, json +from path import path + +# BASE_DIR is the working directory to execute django-admin commands from. +# Typically this should be the 'mitx' directory. +BASE_DIR = path(__file__).abspath().dirname().joinpath('..').normpath() + +# LOCALE_DIR contains the locale files. +# Typically this should be 'mitx/conf/locale' +LOCALE_DIR = BASE_DIR.joinpath('conf', 'locale') + +class Configuration: + """ + # Reads localization configuration in json format + + """ + _source_locale = 'en' + + def __init__(self, filename): + self._filename = filename + self._config = self.read_config(filename) + + def read_config(self, filename): + """ + Returns data found in config file (as dict), or raises exception if file not found + """ + if not os.path.exists(filename): + raise Exception("Configuration file cannot be found: %s" % filename) + with open(filename) as stream: + return json.load(stream) + + @property + def locales(self): + """ + Returns a list of locales declared in the configuration file, + e.g. ['en', 'fr', 'es'] + Each locale is a string. + """ + return self._config['locales'] + + @property + def source_locale(self): + """ + Returns source language. + Source language is English. + """ + return self._source_locale + + @property + def dummy_locale(self): + """ + Returns a locale to use for the dummy text, e.g. 'fr'. + Throws exception if no dummy-locale is declared. + The locale is a string. + """ + dummy = self._config.get('dummy-locale', None) + if not dummy: + raise Exception('Could not read dummy-locale from configuration file.') + return dummy + + def get_messages_dir(self, locale): + """ + Returns the name of the directory holding the po files for locale. + Example: mitx/conf/locale/fr/LC_MESSAGES + """ + return LOCALE_DIR.joinpath(locale, 'LC_MESSAGES') + + @property + def source_messages_dir(self): + """ + Returns the name of the directory holding the source-language po files (English). + Example: mitx/conf/locale/en/LC_MESSAGES + """ + return self.get_messages_dir(self.source_locale) + + +CONFIGURATION = Configuration(LOCALE_DIR.joinpath('config').normpath()) diff --git a/i18n/execute.py b/i18n/execute.py index 3c3416b65d..8e7f0f52de 100644 --- a/i18n/execute.py +++ b/i18n/execute.py @@ -1,69 +1,30 @@ -import os, subprocess, logging, json +import os, subprocess, logging -def init_module(): - """ - Initializes module parameters - """ - global BASE_DIR, LOCALE_DIR, CONFIG_FILENAME, SOURCE_MSGS_DIR, SOURCE_LOCALE, LOG +from config import CONFIGURATION, BASE_DIR - # BASE_DIR is the working directory to execute django-admin commands from. - # Typically this should be the 'mitx' directory. - BASE_DIR = os.path.normpath(os.path.dirname(os.path.abspath(__file__))+'/..') +LOG = logging.getLogger(__name__) - # Source language is English - SOURCE_LOCALE = 'en' - - # LOCALE_DIR contains the locale files. - # Typically this should be 'mitx/conf/locale' - LOCALE_DIR = BASE_DIR + '/conf/locale' - - # CONFIG_FILENAME contains localization configuration in json format - CONFIG_FILENAME = LOCALE_DIR + '/config' - - # SOURCE_MSGS_DIR contains the English po files. - SOURCE_MSGS_DIR = messages_dir(SOURCE_LOCALE) - - # Default logger. - LOG = get_logger() - - -def messages_dir(locale): - """ - Returns the name of the directory holding the po files for locale. - Example: mitx/conf/locale/en/LC_MESSAGES - """ - return os.path.join(LOCALE_DIR, locale, 'LC_MESSAGES') - -def get_logger(): - """Returns a default logger""" - log = logging.getLogger(__name__) - log.setLevel(logging.INFO) - log_handler = logging.StreamHandler() - log_handler.setFormatter(logging.Formatter('%(asctime)s [%(levelname)s] %(message)s')) - log.addHandler(log_handler) - return log - -# Run this after defining messages_dir and get_logger, because it depends on these. -init_module() - -def execute (command, working_directory=BASE_DIR, log=LOG): +def execute(command, working_directory=BASE_DIR): """ Executes shell command in a given working_directory. Command is a string to pass to the shell. - Output is logged to log. + Output is ignored. """ - log.info(command) + LOG.info(command) subprocess.call(command.split(' '), cwd=working_directory) - -def get_config(): - """Returns data found in config file, or returns None if file not found""" - config_path = os.path.abspath(CONFIG_FILENAME) - if not os.path.exists(config_path): - log.warn("Configuration file cannot be found: %s" % \ - os.path.relpath(config_path, BASE_DIR)) - return None - with open(config_path) as stream: - return json.load(stream) + + +def call(command, working_directory=BASE_DIR): + """ + Executes shell command in a given working_directory. + Command is a string to pass to the shell. + Returns a tuple of two strings: (stdout, stderr) + + """ + LOG.info(command) + p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=working_directory) + out, err = p.communicate() + return (out, err) def create_dir_if_necessary(pathname): dirname = os.path.dirname(pathname) @@ -71,16 +32,16 @@ def create_dir_if_necessary(pathname): os.makedirs(dirname) -def remove_file(filename, log=LOG, verbose=True): +def remove_file(filename, verbose=True): """ Attempt to delete filename. + log is boolean. If true, removal is logged. Log a warning if file does not exist. Logging filenames are releative to BASE_DIR to cut down on noise in output. """ if verbose: - log.info('Deleting file %s' % os.path.relpath(filename, BASE_DIR)) + LOG.info('Deleting file %s' % os.path.relpath(filename, BASE_DIR)) if not os.path.exists(filename): - log.warn("File does not exist: %s" % os.path.relpath(filename, BASE_DIR)) + LOG.warn("File does not exist: %s" % os.path.relpath(filename, BASE_DIR)) else: os.remove(filename) - diff --git a/i18n/extract.py b/i18n/extract.py index c6fedd3bfa..c28c3868e2 100755 --- a/i18n/extract.py +++ b/i18n/extract.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow @@ -15,28 +15,35 @@ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow """ -import os +import os, sys, logging from datetime import datetime from polib import pofile -from execute import execute, create_dir_if_necessary, remove_file, \ - BASE_DIR, LOCALE_DIR, SOURCE_MSGS_DIR, LOG +from config import BASE_DIR, LOCALE_DIR, CONFIGURATION +from execute import execute, create_dir_if_necessary, remove_file # BABEL_CONFIG contains declarations for Babel to extract strings from mako template files # Use relpath to reduce noise in logs -BABEL_CONFIG = os.path.relpath(LOCALE_DIR + '/babel.cfg', BASE_DIR) +BABEL_CONFIG = BASE_DIR.relpathto(LOCALE_DIR.joinpath('babel.cfg')) # Strings from mako template files are written to BABEL_OUT # Use relpath to reduce noise in logs -BABEL_OUT = os.path.relpath(SOURCE_MSGS_DIR + '/mako.po', BASE_DIR) +BABEL_OUT = BASE_DIR.relpathto(CONFIGURATION.source_messages_dir.joinpath('mako.po')) +SOURCE_WARN = 'This English source file is machine-generated. Do not check it into github' + +LOG = logging.getLogger(__name__) def main (): + logging.basicConfig(stream=sys.stdout, level=logging.INFO) create_dir_if_necessary(LOCALE_DIR) - generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') + source_msgs_dir = CONFIGURATION.source_messages_dir + remove_file(source_msgs_dir.joinpath('django.po')) + generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') for filename in generated_files: - remove_file(os.path.join(SOURCE_MSGS_DIR, filename)) + remove_file(source_msgs_dir.joinpath(filename)) + # Extract strings from mako templates babel_mako_cmd = 'pybabel extract -F %s -c "TRANSLATORS:" . -o %s' % (BABEL_CONFIG, BABEL_OUT) @@ -52,13 +59,13 @@ def main (): execute(make_django_cmd, working_directory=BASE_DIR) # makemessages creates 'django.po'. This filename is hardcoded. # Rename it to django-partial.po to enable merging into django.po later. - os.rename(os.path.join(SOURCE_MSGS_DIR, 'django.po'), - os.path.join(SOURCE_MSGS_DIR, 'django-partial.po')) + os.rename(source_msgs_dir.joinpath('django.po'), + source_msgs_dir.joinpath('django-partial.po')) execute(make_djangojs_cmd, working_directory=BASE_DIR) for filename in generated_files: LOG.info('Cleaning %s' % filename) - po = pofile(os.path.join(SOURCE_MSGS_DIR, filename)) + po = pofile(source_msgs_dir.joinpath(filename)) # replace default headers with edX headers fix_header(po) # replace default metadata with edX metadata @@ -79,10 +86,11 @@ def fix_header(po): """ Replace default headers with edX headers """ + po.metadata_is_fuzzy = [] # remove [u'fuzzy'] header = po.header fixes = ( - ('SOME DESCRIPTIVE TITLE', 'edX translation file'), - ('Translations template for PROJECT.', 'edX translation file'), + ('SOME DESCRIPTIVE TITLE', 'edX translation file\n' + SOURCE_WARN), + ('Translations template for PROJECT.', 'edX translation file\n' + SOURCE_WARN), ('YEAR', '%s' % datetime.utcnow().year), ('ORGANIZATION', 'edX'), ("THE PACKAGE'S COPYRIGHT HOLDER", "EdX"), @@ -119,10 +127,9 @@ def fix_metadata(po): 'Report-Msgid-Bugs-To': 'translation_team@edx.org', 'Project-Id-Version': '0.1a', 'Language' : 'en', + 'Last-Translator' : '', 'Language-Team': 'translation team ', } - if po.metadata.has_key('Last-Translator'): - del po.metadata['Last-Translator'] po.metadata.update(fixes) def strip_key_strings(po): diff --git a/i18n/generate.py b/i18n/generate.py index ddbaadfa70..65c65c00d6 100755 --- a/i18n/generate.py +++ b/i18n/generate.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python """ See https://edx-wiki.atlassian.net/wiki/display/ENG/PO+File+workflow @@ -13,50 +13,71 @@ languages to generate. """ -import os -from execute import execute, get_config, messages_dir, remove_file, \ - BASE_DIR, LOG, SOURCE_LOCALE +import os, sys, logging +from polib import pofile -def merge(locale, target='django.po'): +from config import BASE_DIR, CONFIGURATION +from execute import execute + +LOG = logging.getLogger(__name__) + +def merge(locale, target='django.po', fail_if_missing=True): """ For the given locale, merge django-partial.po, messages.po, mako.po -> django.po + target is the resulting filename + If fail_if_missing is True, and the files to be merged are missing, + throw an Exception. + If fail_if_missing is False, and the files to be merged are missing, + just return silently. """ LOG.info('Merging locale={0}'.format(locale)) - locale_directory = messages_dir(locale) + locale_directory = CONFIGURATION.get_messages_dir(locale) files_to_merge = ('django-partial.po', 'messages.po', 'mako.po') - validate_files(locale_directory, files_to_merge) + try: + validate_files(locale_directory, files_to_merge) + except Exception, e: + if not fail_if_missing: + return + raise e # merged file is merged.po merge_cmd = 'msgcat -o merged.po ' + ' '.join(files_to_merge) execute(merge_cmd, working_directory=locale_directory) + # clean up redunancies in the metadata + merged_filename = locale_directory.joinpath('merged.po') + clean_metadata(merged_filename) + # rename merged.po -> django.po (default) - merged_filename = os.path.join(locale_directory, 'merged.po') - django_filename = os.path.join(locale_directory, target) + django_filename = locale_directory.joinpath(target) os.rename(merged_filename, django_filename) # can't overwrite file on Windows +def clean_metadata(file): + """ + Clean up redundancies in the metadata caused by merging. + This reads in a PO file and simply saves it back out again. + """ + pofile(file).save() + def validate_files(dir, files_to_merge): """ Asserts that the given files exist. files_to_merge is a list of file names (no directories). - dir is the directory in which the files should appear. + dir is the directory (a path object from path.py) in which the files should appear. raises an Exception if any of the files are not in dir. """ for path in files_to_merge: - pathname = os.path.join(dir, path) - if not os.path.exists(pathname): - raise Exception("File not found: {0}".format(pathname)) + pathname = dir.joinpath(path) + if not pathname.exists(): + raise Exception("I18N: Cannot generate because file not found: {0}".format(pathname)) def main (): - configuration = get_config() - if configuration == None: - LOG.warn('Configuration file not found, using only English.') - locales = (SOURCE_LOCALE,) - else: - locales = configuration['locales'] - for locale in locales: - merge(locale) + logging.basicConfig(stream=sys.stdout, level=logging.INFO) + for locale in CONFIGURATION.locales: + merge(locale) + # Dummy text is not required. Don't raise exception if files are missing. + merge(CONFIGURATION.dummy_locale, fail_if_missing=False) compile_cmd = 'django-admin.py compilemessages' execute(compile_cmd, working_directory=BASE_DIR) diff --git a/i18n/make_dummy.py b/i18n/make_dummy.py index c8dcde861a..6c14edd45a 100755 --- a/i18n/make_dummy.py +++ b/i18n/make_dummy.py @@ -1,7 +1,13 @@ -#!/usr/bin/python +#!/usr/bin/env python # Generate test translation files from human-readable po files. # +# Dummy language is specified in configuration file (see config.py) +# two letter language codes reference: +# see http://www.loc.gov/standards/iso639-2/php/code_list.php +# +# Django will not localize in languages that django itself has not been +# localized for. So we are using a well-known language (default='fr'). # # po files can be generated with this: # django-admin.py makemessages --all --extension html -l en @@ -10,14 +16,15 @@ # # $ ./make_dummy.py # -# $ ./make_dummy.py mitx/conf/locale/en/LC_MESSAGES/django.po +# $ ./make_dummy.py ../conf/locale/en/LC_MESSAGES/django.po # # generates output to -# mitx/conf/locale/vr/LC_MESSAGES/django.po +# mitx/conf/locale/fr/LC_MESSAGES/django.po import os, sys import polib from dummy import Dummy +from config import CONFIGURATION from execute import create_dir_if_necessary def main(file, locale): @@ -41,27 +48,19 @@ def new_filename(original_filename, new_locale): orig_dir = os.path.dirname(original_filename) msgs_dir = os.path.basename(orig_dir) orig_file = os.path.basename(original_filename) - return os.path.join(orig_dir, - '/../..', - new_locale, - msgs_dir, - orig_file) - - -# Dummy language -# two letter language codes reference: -# see http://www.loc.gov/standards/iso639-2/php/code_list.php -# -# Django will not localize in languages that django itself has not been -# localized for. So we are using a well-known language: 'fr'. - -DEFAULT_LOCALE = 'fr' + return os.path.abspath(os.path.join(orig_dir, + '../..', + new_locale, + msgs_dir, + orig_file)) if __name__ == '__main__': + # required arg: file if len(sys.argv)<2: raise Exception("missing file argument") - if len(sys.argv)<2: - locale = DEFAULT_LOCALE + # optional arg: locale + if len(sys.argv)<3: + locale = CONFIGURATION.get_dummy_locale() else: locale = sys.argv[2] main(sys.argv[1], locale) diff --git a/i18n/tests/__init__.py b/i18n/tests/__init__.py index d60515c712..ee6283376e 100644 --- a/i18n/tests/__init__.py +++ b/i18n/tests/__init__.py @@ -1,4 +1,6 @@ +from test_config import TestConfiguration from test_extract import TestExtract from test_generate import TestGenerate from test_converter import TestConverter from test_dummy import TestDummy +import test_validate diff --git a/i18n/tests/test_config.py b/i18n/tests/test_config.py new file mode 100644 index 0000000000..bcec6ac354 --- /dev/null +++ b/i18n/tests/test_config.py @@ -0,0 +1,33 @@ +import os +from unittest import TestCase + +from config import Configuration, LOCALE_DIR, CONFIGURATION + +class TestConfiguration(TestCase): + """ + Tests functionality of i18n/config.py + """ + + def test_config(self): + config_filename = os.path.normpath(os.path.join(LOCALE_DIR, 'config')) + config = Configuration(config_filename) + self.assertEqual(config.source_locale, 'en') + + def test_no_config(self): + config_filename = os.path.normpath(os.path.join(LOCALE_DIR, 'no_such_file')) + with self.assertRaises(Exception): + Configuration(config_filename) + + def test_valid_configuration(self): + """ + Make sure we have a valid configuration file, + and that it contains an 'en' locale. + Also check values of dummy_locale and source_locale. + """ + self.assertIsNotNone(CONFIGURATION) + locales = CONFIGURATION.locales + self.assertIsNotNone(locales) + self.assertIsInstance(locales, list) + self.assertIn('en', locales) + self.assertEqual('fr', CONFIGURATION.dummy_locale) + self.assertEqual('en', CONFIGURATION.source_locale) diff --git a/i18n/tests/test_extract.py b/i18n/tests/test_extract.py index b14ae9872d..7e8b1a9d2b 100644 --- a/i18n/tests/test_extract.py +++ b/i18n/tests/test_extract.py @@ -4,7 +4,7 @@ from nose.plugins.skip import SkipTest from datetime import datetime, timedelta import extract -from execute import SOURCE_MSGS_DIR +from config import CONFIGURATION # Make sure setup runs only once SETUP_HAS_RUN = False @@ -39,7 +39,7 @@ class TestExtract(TestCase): Fails assertion if one of the files doesn't exist. """ for filename in self.generated_files: - path = os.path.join(SOURCE_MSGS_DIR, filename) + path = os.path.join(CONFIGURATION.source_messages_dir, filename) exists = os.path.exists(path) self.assertTrue(exists, msg='Missing file: %s' % filename) if exists: diff --git a/i18n/tests/test_generate.py b/i18n/tests/test_generate.py index fc22988251..468858664f 100644 --- a/i18n/tests/test_generate.py +++ b/i18n/tests/test_generate.py @@ -1,9 +1,10 @@ -import os, string, random +import os, string, random, re +from polib import pofile from unittest import TestCase from datetime import datetime, timedelta import generate -from execute import get_config, messages_dir, SOURCE_MSGS_DIR, SOURCE_LOCALE +from config import CONFIGURATION class TestGenerate(TestCase): """ @@ -12,29 +13,16 @@ class TestGenerate(TestCase): generated_files = ('django-partial.po', 'djangojs.po', 'mako.po') def setUp(self): - self.configuration = get_config() - # Subtract 1 second to help comparisons with file-modify time succeed, # since os.path.getmtime() is not millisecond-accurate self.start_time = datetime.now() - timedelta(seconds=1) - def test_configuration(self): - """ - Make sure we have a valid configuration file, - and that it contains an 'en' locale. - """ - self.assertIsNotNone(self.configuration) - locales = self.configuration['locales'] - self.assertIsNotNone(locales) - self.assertIsInstance(locales, list) - self.assertIn('en', locales) - def test_merge(self): """ Tests merge script on English source files. """ - filename = os.path.join(SOURCE_MSGS_DIR, random_name()) - generate.merge(SOURCE_LOCALE, target=filename) + filename = os.path.join(CONFIGURATION.source_messages_dir, random_name()) + generate.merge(CONFIGURATION.source_locale, target=filename) self.assertTrue(os.path.exists(filename)) os.remove(filename) @@ -47,13 +35,35 @@ class TestGenerate(TestCase): after start of test suite) """ generate.main() - for locale in self.configuration['locales']: - for filename in ('django.mo', 'djangojs.mo'): - path = os.path.join(messages_dir(locale), filename) + for locale in CONFIGURATION.locales: + for filename in ('django', 'djangojs'): + mofile = filename+'.mo' + path = os.path.join(CONFIGURATION.get_messages_dir(locale), mofile) exists = os.path.exists(path) - self.assertTrue(exists, msg='Missing file in locale %s: %s' % (locale, filename)) + self.assertTrue(exists, msg='Missing file in locale %s: %s' % (locale, mofile)) self.assertTrue(datetime.fromtimestamp(os.path.getmtime(path)) >= self.start_time, msg='File not recently modified: %s' % path) + self.assert_merge_headers(locale) + + def assert_merge_headers(self, locale): + """ + This is invoked by test_main to ensure that it runs after + calling generate.main(). + + There should be exactly three merge comment headers + in our merged .po file. This counts them to be sure. + A merge comment looks like this: + # #-#-#-#-# django-partial.po (0.1a) #-#-#-#-# + + """ + path = os.path.join(CONFIGURATION.get_messages_dir(locale), 'django.po') + po = pofile(path) + pattern = re.compile('^#-#-#-#-#', re.M) + match = pattern.findall(po.header) + self.assertEqual(len(match), 3, + msg="Found %s (should be 3) merge comments in the header for %s" % \ + (len(match), path)) + def random_name(size=6): """Returns random filename as string, like test-4BZ81W""" diff --git a/i18n/tests/test_validate.py b/i18n/tests/test_validate.py new file mode 100644 index 0000000000..bef563faea --- /dev/null +++ b/i18n/tests/test_validate.py @@ -0,0 +1,34 @@ +import os, sys, logging +from unittest import TestCase +from nose.plugins.skip import SkipTest + +from config import LOCALE_DIR +from execute import call + +def test_po_files(root=LOCALE_DIR): + """ + This is a generator. It yields all of the .po files under root, and tests each one. + """ + log = logging.getLogger(__name__) + logging.basicConfig(stream=sys.stdout, level=logging.INFO) + + for (dirpath, dirnames, filenames) in os.walk(root): + for name in filenames: + (base, ext) = os.path.splitext(name) + if ext.lower() == '.po': + yield validate_po_file, os.path.join(dirpath, name), log + + +def validate_po_file(filename, log): + """ + Call GNU msgfmt -c on each .po file to validate its format. + Any errors caught by msgfmt are logged to log. + """ + # Skip this test for now because it's very noisy + raise SkipTest() + # Use relative paths to make output less noisy. + rfile = os.path.relpath(filename, LOCALE_DIR) + (out, err) = call(['msgfmt','-c', rfile], working_directory=LOCALE_DIR) + if err != '': + log.warn('\n'+err) + diff --git a/i18n/transifex.py b/i18n/transifex.py new file mode 100755 index 0000000000..ac203f3eea --- /dev/null +++ b/i18n/transifex.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python + +import os, sys +from polib import pofile +from config import CONFIGURATION +from extract import SOURCE_WARN +from execute import execute + +TRANSIFEX_HEADER = 'Translations in this file have been downloaded from %s' +TRANSIFEX_URL = 'https://www.transifex.com/projects/p/edx-studio/' + +def push(): + execute('tx push -s') + +def pull(): + for locale in CONFIGURATION.locales: + if locale != CONFIGURATION.source_locale: + execute('tx pull -l %s' % locale) + clean_translated_locales() + + +def clean_translated_locales(): + """ + Strips out the warning from all translated po files + about being an English source file. + """ + for locale in CONFIGURATION.locales: + if locale != CONFIGURATION.source_locale: + clean_locale(locale) + +def clean_locale(locale): + """ + Strips out the warning from all of a locale's translated po files + about being an English source file. + Iterates over machine-generated files. + """ + dirname = CONFIGURATION.get_messages_dir(locale) + for filename in ('django-partial.po', 'djangojs.po', 'mako.po'): + clean_file(dirname.joinpath(filename)) + +def clean_file(file): + """ + Strips out the warning from a translated po file about being an English source file. + Replaces warning with a note about coming from Transifex. + """ + po = pofile(file) + if po.header.find(SOURCE_WARN) != -1: + new_header = get_new_header(po) + new = po.header.replace(SOURCE_WARN, new_header) + po.header = new + po.save() + +def get_new_header(po): + team = po.metadata.get('Language-Team', None) + if not team: + return TRANSIFEX_HEADER % TRANSIFEX_URL + else: + return TRANSIFEX_HEADER % team + +if __name__ == '__main__': + if len(sys.argv)<2: + raise Exception("missing argument: push or pull") + arg = sys.argv[1] + if arg == 'push': + push() + elif arg == 'pull': + pull() + else: + raise Exception("unknown argument: (%s)" % arg) + diff --git a/jenkins/base.sh b/jenkins/base.sh deleted file mode 100644 index fc2595662a..0000000000 --- a/jenkins/base.sh +++ /dev/null @@ -1,12 +0,0 @@ - -function github_status { - gcli status create edx mitx $GIT_COMMIT \ - --params=$1 \ - target_url:$BUILD_URL \ - description:"Build #$BUILD_NUMBER is running" \ - -f csv -} - -function github_mark_failed_on_exit { - trap '[ $? == "0" ] || github_status state:failed' EXIT -} diff --git a/jenkins/test.sh b/jenkins/test.sh index 7475076086..32279fe22f 100755 --- a/jenkins/test.sh +++ b/jenkins/test.sh @@ -3,8 +3,21 @@ set -e set -x +## +## requires >= 1.3.0 of the Jenkins git plugin +## + function github_status { - gcli status create edx mitx $GIT_COMMIT \ + if [[ ! ${GIT_URL} =~ git@github.com:([^/]+)/([^\.]+).git ]]; then + echo "Cannot parse Github org or repo from URL, using defaults." + ORG="edx" + REPO="edx-platform" + else + ORG=${BASH_REMATCH[1]} + REPO=${BASH_REMATCH[2]} + fi + + gcli status create $ORG $REPO $GIT_COMMIT \ --params=$1 \ target_url:$BUILD_URL \ description:"Build #$BUILD_NUMBER $2" \ @@ -27,21 +40,32 @@ git submodule foreach 'git reset --hard HEAD' export PYTHONIOENCODING=UTF-8 GIT_BRANCH=${GIT_BRANCH/HEAD/master} -if [ ! -d /mnt/virtualenvs/"$JOB_NAME" ]; then - mkdir -p /mnt/virtualenvs/"$JOB_NAME" - virtualenv /mnt/virtualenvs/"$JOB_NAME" + +# When running in parallel on jenkins, workspace could be suffixed by @x +# In that case, we want to use a separate virtualenv that matches up with +# workspace +# +# We need to handle both the case of /path/to/workspace +# and /path/to/workspace@2, which is why we use the following substitutions +# +# $WORKSPACE is the absolute path for the workspace +WORKSPACE_SUFFIX=$(expr "$WORKSPACE" : '.*\(@.*\)') || true + +VIRTUALENV_DIR="/mnt/virtualenvs/${JOB_NAME}${WORKSPACE_SUFFIX}" + +if [ ! -d "$VIRTUALENV_DIR" ]; then + mkdir -p "$VIRTUALENV_DIR" + virtualenv "$VIRTUALENV_DIR" fi export PIP_DOWNLOAD_CACHE=/mnt/pip-cache +# Allow django liveserver tests to use a range of ports +export DJANGO_LIVE_TEST_SERVER_ADDRESS=${DJANGO_LIVE_TEST_SERVER_ADDRESS-localhost:8000-9000} + source /mnt/virtualenvs/"$JOB_NAME"/bin/activate -pip install -q -r pre-requirements.txt -yes w | pip install -q -r requirements.txt - -bundle install - -npm install +rake install_prereqs rake clobber rake pep8 > pep8.log || cat pep8.log rake pylint > pylint.log || cat pylint.log @@ -54,7 +78,7 @@ rake test_lms[false] || TESTS_FAILED=1 rake test_common/lib/capa || TESTS_FAILED=1 rake test_common/lib/xmodule || TESTS_FAILED=1 -# Run the jaavascript unit tests +# Run the javascript unit tests rake phantomjs_jasmine_lms || TESTS_FAILED=1 rake phantomjs_jasmine_cms || TESTS_FAILED=1 rake phantomjs_jasmine_common/lib/xmodule || TESTS_FAILED=1 diff --git a/jenkins/test_acceptance.sh b/jenkins/test_acceptance.sh new file mode 100755 index 0000000000..1d11265d08 --- /dev/null +++ b/jenkins/test_acceptance.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +set -e +set -x + +git remote prune origin + +# Reset the submodule, in case it changed +git submodule foreach 'git reset --hard HEAD' + +# Set the IO encoding to UTF-8 so that askbot will start +export PYTHONIOENCODING=UTF-8 + +if [ ! -d /mnt/virtualenvs/"$JOB_NAME" ]; then + mkdir -p /mnt/virtualenvs/"$JOB_NAME" + virtualenv /mnt/virtualenvs/"$JOB_NAME" +fi + +export PIP_DOWNLOAD_CACHE=/mnt/pip-cache + +source /mnt/virtualenvs/"$JOB_NAME"/bin/activate +rake install_prereqs +rake clobber + +TESTS_FAILED=0 + +# Assumes that Xvfb has been started by upstart +# and is capturing display :1 +# The command for this is: +# /usr/bin/Xvfb :1 -screen 0 1024x268x24 +# This allows us to run Chrome without a display +export DISPLAY=:1 + +# Run the lms and cms acceptance tests +# (the -v flag turns off color in the output) +rake test_acceptance_lms["-v 3"] || TESTS_FAILED=1 +rake test_acceptance_cms["-v 3"] || TESTS_FAILED=1 + +[ $TESTS_FAILED == '0' ] diff --git a/lms/djangoapps/courseware/tabs.py b/lms/djangoapps/courseware/tabs.py index ea6f2fc556..42b1c05743 100644 --- a/lms/djangoapps/courseware/tabs.py +++ b/lms/djangoapps/courseware/tabs.py @@ -185,6 +185,11 @@ def _combined_open_ended_grading(tab, user, course, active_page): return tab return [] +def _notes_tab(tab, user, course, active_page): + if user.is_authenticated() and settings.MITX_FEATURES.get('ENABLE_STUDENT_NOTES'): + link = reverse('notes', args=[course.id]) + return [CourseTab(tab['name'], link, active_page == 'notes')] + return [] #### Validators @@ -227,6 +232,7 @@ VALID_TAB_TYPES = { 'peer_grading': TabImpl(null_validator, _peer_grading), 'staff_grading': TabImpl(null_validator, _staff_grading), 'open_ended': TabImpl(null_validator, _combined_open_ended_grading), + 'notes': TabImpl(null_validator, _notes_tab) } diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index d5064ec5e5..d50e0b4526 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -399,6 +399,14 @@ class TestCoursesLoadTestCase_MongoModulestore(PageLoaderTestCase): import_from_xml(module_store, TEST_DATA_DIR, ['toy']) self.check_random_page_loads(module_store) + def test_full_textbooks_loads(self): + module_store = modulestore() + import_from_xml(module_store, TEST_DATA_DIR, ['full']) + + course = module_store.get_item(Location(['i4x', 'edX', 'full', 'course', '6.002_Spring_2012', None])) + + self.assertGreater(len(course.textbooks), 0) + @override_settings(MODULESTORE=TEST_DATA_XML_MODULESTORE) class TestNavigation(LoginEnrollmentTestCase): @@ -623,8 +631,8 @@ class TestViewAuth(LoginEnrollmentTestCase): urls = reverse_urls(['info', 'progress'], course) urls.extend([ reverse('book', kwargs={'course_id': course.id, - 'book_index': book.title}) - for book in course.textbooks + 'book_index': index}) + for index, book in enumerate(course.textbooks) ]) return urls @@ -635,8 +643,6 @@ class TestViewAuth(LoginEnrollmentTestCase): """ urls = reverse_urls(['about_course'], course) urls.append(reverse('courses')) - # Need separate test for change_enrollment, since it's a POST view - #urls.append(reverse('change_enrollment')) return urls diff --git a/lms/djangoapps/notes/README.md b/lms/djangoapps/notes/README.md new file mode 100644 index 0000000000..2e81fa5ec1 --- /dev/null +++ b/lms/djangoapps/notes/README.md @@ -0,0 +1,57 @@ +Notes Django App +================ + +This is a django application that stores and displays notes that students make while reading static HTML book(s) in their courseware. Note taking functionality in the static HTML book(s) is handled by a wrapper script around [annotator.js](http://okfnlabs.org/annotator/), which interfaces with the API provided by this application to store and retrieve notes. + +Usage +----- + +To use this application, course staff must opt-in by doing the following: + +* Login to [Studio](http://studio.edx.org/). +* Go to *Course Settings* -> *Advanced Settings* +* Find the ```advanced_modules``` policy key and in the policy value field, add ```"notes"``` to the list. +* Save the course settings. + +The result of following these steps is that you should see a new tab appear in the courseware named *My Notes*. This will display a journal of notes that the student has created in the static HTML book(s). Second, when you highlight text in the static HTML book(s), a dialog will appear. You can enter some notes and tags and save it. The note will appear highlighted in the text and will also be saved to the journal. + +To disable the *My Notes* tab and notes in the static HTML book(s), simply reverse the above steps (i.e. remove ```"notes"``` from the ```advanced_modules``` policy setting). + +### Caveats and Limitations + +* Notes are private to each student. +* Sharing and replying to notes is not supported. +* The student *My Notes* interface is very limited. +* There is no instructor interface to view student notes. + +Developer Overview +------------------ + +### Quickstart + +``` +$ rake django-admin[syncdb] +$ rake django-admin[migrate] +``` + +Then follow the steps above to enable the *My Notes* tab or manually add a tab to the policy tab configuration with ```{"type": "notes", "name": "My Notes"}```. + +### App Directory Structure: + +lms/djangoapps/notes: + +* api.py - API used by annotator.js on the frontend +* models.py - Contains note model for storing notes +* tests.py - Unit tests +* views.py - View to display the journal of notes (i.e. *My Notes* tab) +* urls.py - Maps the API and View routes. +* utils.py - Contains method for checking if the course has this app enabled. Intended to be public to other modules. + +Also requires: + +* lms/static/coffee/src/notes.coffee -- wrapper around annotator.js +* lms/templates/notes.html -- used by views.py to display the notes + +Interacts with: + +* lms/djangoapps/staticbook - the html static book checks to see if notes is enabled and has some logic to enable/disable accordingly diff --git a/lms/djangoapps/notes/__init__.py b/lms/djangoapps/notes/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lms/djangoapps/notes/api.py b/lms/djangoapps/notes/api.py new file mode 100644 index 0000000000..1162a144c0 --- /dev/null +++ b/lms/djangoapps/notes/api.py @@ -0,0 +1,251 @@ +from django.contrib.auth.decorators import login_required +from django.http import HttpResponse, Http404 +from django.core.exceptions import ValidationError + +from notes.models import Note +from notes.utils import notes_enabled_for_course +from courseware.courses import get_course_with_access + +import json +import logging +import collections + +log = logging.getLogger(__name__) + +API_SETTINGS = { + 'META': {'name': 'Notes API', 'version': 1}, + + # Maps resources to HTTP methods and actions + 'RESOURCE_MAP': { + 'root': {'GET': 'root'}, + 'notes': {'GET': 'index', 'POST': 'create'}, + 'note': {'GET': 'read', 'PUT': 'update', 'DELETE': 'delete'}, + 'search': {'GET': 'search'}, + }, + + # Cap the number of notes that can be returned in one request + 'MAX_NOTE_LIMIT': 1000, +} + +# Wrapper class for HTTP response and data. All API actions are expected to return this. +ApiResponse = collections.namedtuple('ApiResponse', ['http_response', 'data']) + +#----------------------------------------------------------------------# +# API requests are routed through api_request() using the resource map. + + +def api_enabled(request, course_id): + ''' + Returns True if the api is enabled for the course, otherwise False. + ''' + course = _get_course(request, course_id) + return notes_enabled_for_course(course) + + +@login_required +def api_request(request, course_id, **kwargs): + ''' + Routes API requests to the appropriate action method and returns JSON. + Raises a 404 if the requested resource does not exist or notes are + disabled for the course. + ''' + + # Verify that the api should be accessible to this course + if not api_enabled(request, course_id): + log.debug('Notes are disabled for course: {0}'.format(course_id)) + raise Http404 + + # Locate the requested resource + resource_map = API_SETTINGS.get('RESOURCE_MAP', {}) + resource_name = kwargs.pop('resource') + resource_method = request.method + resource = resource_map.get(resource_name) + + if resource is None: + log.debug('Resource "{0}" does not exist'.format(resource_name)) + raise Http404 + + if resource_method not in resource.keys(): + log.debug('Resource "{0}" does not support method "{1}"'.format(resource_name, resource_method)) + raise Http404 + + # Execute the action associated with the resource + func = resource.get(resource_method) + module = globals() + if func not in module: + log.debug('Function "{0}" does not exist for request {1} {2}'.format(func, resource_method, resource_name)) + raise Http404 + + log.debug('API request: {0} {1}'.format(resource_method, resource_name)) + + api_response = module[func](request, course_id, **kwargs) + http_response = api_format(api_response) + + return http_response + + +def api_format(api_response): + ''' + Takes an ApiResponse and returns an HttpResponse. + ''' + http_response = api_response.http_response + content_type = 'application/json' + content = '' + + # not doing a strict boolean check on data becuase it could be an empty list + if api_response.data is not None and api_response.data != '': + content = json.dumps(api_response.data) + + http_response['Content-type'] = content_type + http_response.content = content + + log.debug('API response type: {0} content: {1}'.format(content_type, content)) + + return http_response + + +def _get_course(request, course_id): + ''' + Helper function to load and return a user's course. + ''' + return get_course_with_access(request.user, course_id, 'load') + +#----------------------------------------------------------------------# +# API actions exposed via the resource map. + + +def index(request, course_id): + ''' + Returns a list of annotation objects. + ''' + MAX_LIMIT = API_SETTINGS.get('MAX_NOTE_LIMIT') + + notes = Note.objects.order_by('id').filter(course_id=course_id, + user=request.user)[:MAX_LIMIT] + + return ApiResponse(http_response=HttpResponse(), data=[note.as_dict() for note in notes]) + + +def create(request, course_id): + ''' + Receives an annotation object to create and returns a 303 with the read location. + ''' + note = Note(course_id=course_id, user=request.user) + + try: + note.clean(request.body) + except ValidationError as e: + log.debug(e) + return ApiResponse(http_response=HttpResponse('', status=400), data=None) + + note.save() + response = HttpResponse('', status=303) + response['Location'] = note.get_absolute_url() + + return ApiResponse(http_response=response, data=None) + + +def read(request, course_id, note_id): + ''' + Returns a single annotation object. + ''' + try: + note = Note.objects.get(id=note_id) + except Note.DoesNotExist: + return ApiResponse(http_response=HttpResponse('', status=404), data=None) + + if note.user.id != request.user.id: + return ApiResponse(http_response=HttpResponse('', status=403), data=None) + + return ApiResponse(http_response=HttpResponse(), data=note.as_dict()) + + +def update(request, course_id, note_id): + ''' + Updates an annotation object and returns a 303 with the read location. + ''' + try: + note = Note.objects.get(id=note_id) + except Note.DoesNotExist: + return ApiResponse(http_response=HttpResponse('', status=404), data=None) + + if note.user.id != request.user.id: + return ApiResponse(http_response=HttpResponse('', status=403), data=None) + + try: + note.clean(request.body) + except ValidationError as e: + log.debug(e) + return ApiResponse(http_response=HttpResponse('', status=400), data=None) + + note.save() + + response = HttpResponse('', status=303) + response['Location'] = note.get_absolute_url() + + return ApiResponse(http_response=response, data=None) + + +def delete(request, course_id, note_id): + ''' + Deletes the annotation object and returns a 204 with no content. + ''' + try: + note = Note.objects.get(id=note_id) + except Note.DoesNotExist: + return ApiResponse(http_response=HttpResponse('', status=404), data=None) + + if note.user.id != request.user.id: + return ApiResponse(http_response=HttpResponse('', status=403), data=None) + + note.delete() + + return ApiResponse(http_response=HttpResponse('', status=204), data=None) + + +def search(request, course_id): + ''' + Returns a subset of annotation objects based on a search query. + ''' + MAX_LIMIT = API_SETTINGS.get('MAX_NOTE_LIMIT') + + # search parameters + offset = request.GET.get('offset', '') + limit = request.GET.get('limit', '') + uri = request.GET.get('uri', '') + + # validate search parameters + if offset.isdigit(): + offset = int(offset) + else: + offset = 0 + + if limit.isdigit(): + limit = int(limit) + if limit == 0 or limit > MAX_LIMIT: + limit = MAX_LIMIT + else: + limit = MAX_LIMIT + + # set filters + filters = {'course_id': course_id, 'user': request.user} + if uri != '': + filters['uri'] = uri + + # retrieve notes + notes = Note.objects.order_by('id').filter(**filters) + total = notes.count() + rows = notes[offset:offset + limit] + result = { + 'total': total, + 'rows': [note.as_dict() for note in rows] + } + + return ApiResponse(http_response=HttpResponse(), data=result) + + +def root(request, course_id): + ''' + Returns version information about the API. + ''' + return ApiResponse(http_response=HttpResponse(), data=API_SETTINGS.get('META')) diff --git a/lms/djangoapps/notes/migrations/0001_initial.py b/lms/djangoapps/notes/migrations/0001_initial.py new file mode 100644 index 0000000000..738d121e79 --- /dev/null +++ b/lms/djangoapps/notes/migrations/0001_initial.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding model 'Note' + db.create_table('notes_note', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])), + ('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), + ('uri', self.gf('django.db.models.fields.CharField')(max_length=1024, db_index=True)), + ('text', self.gf('django.db.models.fields.TextField')(default='')), + ('quote', self.gf('django.db.models.fields.TextField')(default='')), + ('range_start', self.gf('django.db.models.fields.CharField')(max_length=2048)), + ('range_start_offset', self.gf('django.db.models.fields.IntegerField')()), + ('range_end', self.gf('django.db.models.fields.CharField')(max_length=2048)), + ('range_end_offset', self.gf('django.db.models.fields.IntegerField')()), + ('tags', self.gf('django.db.models.fields.TextField')(default='')), + ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, null=True, db_index=True, blank=True)), + ('updated', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, db_index=True, blank=True)), + )) + db.send_create_signal('notes', ['Note']) + + + def backwards(self, orm): + # Deleting model 'Note' + db.delete_table('notes_note') + + + models = { + 'auth.group': { + 'Meta': {'object_name': 'Group'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) + }, + 'auth.permission': { + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + }, + 'auth.user': { + 'Meta': {'object_name': 'User'}, + 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), + 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), + 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), + 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) + }, + 'contenttypes.contenttype': { + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + }, + 'notes.note': { + 'Meta': {'object_name': 'Note'}, + 'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), + 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'quote': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'range_end': ('django.db.models.fields.CharField', [], {'max_length': '2048'}), + 'range_end_offset': ('django.db.models.fields.IntegerField', [], {}), + 'range_start': ('django.db.models.fields.CharField', [], {'max_length': '2048'}), + 'range_start_offset': ('django.db.models.fields.IntegerField', [], {}), + 'tags': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'text': ('django.db.models.fields.TextField', [], {'default': "''"}), + 'updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}), + 'uri': ('django.db.models.fields.CharField', [], {'max_length': '1024', 'db_index': 'True'}), + 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}) + } + } + + complete_apps = ['notes'] \ No newline at end of file diff --git a/lms/djangoapps/notes/migrations/__init__.py b/lms/djangoapps/notes/migrations/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/lms/djangoapps/notes/models.py b/lms/djangoapps/notes/models.py new file mode 100644 index 0000000000..7c9db7dc28 --- /dev/null +++ b/lms/djangoapps/notes/models.py @@ -0,0 +1,81 @@ +from django.db import models +from django.contrib.auth.models import User +from django.core.urlresolvers import reverse +from django.core.exceptions import ValidationError +from django.utils.html import strip_tags +import json + + +class Note(models.Model): + user = models.ForeignKey(User, db_index=True) + course_id = models.CharField(max_length=255, db_index=True) + uri = models.CharField(max_length=1024, db_index=True) + text = models.TextField(default="") + quote = models.TextField(default="") + range_start = models.CharField(max_length=2048) # xpath string + range_start_offset = models.IntegerField() + range_end = models.CharField(max_length=2048) # xpath string + range_end_offset = models.IntegerField() + tags = models.TextField(default="") # comma-separated string + created = models.DateTimeField(auto_now_add=True, null=True, db_index=True) + updated = models.DateTimeField(auto_now=True, db_index=True) + + def clean(self, json_body): + ''' + Cleans the note object or raises a ValidationError. + ''' + if json_body is None: + raise ValidationError('Note must have a body.') + + body = json.loads(json_body) + if not type(body) is dict: + raise ValidationError('Note body must be a dictionary.') + + # NOTE: all three of these fields should be considered user input + # and may be output back to the user, so we need to sanitize them. + # These fields should only contain _plain text_. + self.uri = strip_tags(body.get('uri', '')) + self.text = strip_tags(body.get('text', '')) + self.quote = strip_tags(body.get('quote', '')) + + ranges = body.get('ranges') + if ranges is None or len(ranges) != 1: + raise ValidationError('Note must contain exactly one range.') + + self.range_start = ranges[0]['start'] + self.range_start_offset = ranges[0]['startOffset'] + self.range_end = ranges[0]['end'] + self.range_end_offset = ranges[0]['endOffset'] + + self.tags = "" + tags = [strip_tags(tag) for tag in body.get('tags', [])] + if len(tags) > 0: + self.tags = ",".join(tags) + + def get_absolute_url(self): + ''' + Returns the aboslute url for the note object. + ''' + kwargs = {'course_id': self.course_id, 'note_id': str(self.pk)} + return reverse('notes_api_note', kwargs=kwargs) + + def as_dict(self): + ''' + Returns the note object as a dictionary. + ''' + return { + 'id': self.pk, + 'user_id': self.user.pk, + 'uri': self.uri, + 'text': self.text, + 'quote': self.quote, + 'ranges': [{ + 'start': self.range_start, + 'startOffset': self.range_start_offset, + 'end': self.range_end, + 'endOffset': self.range_end_offset + }], + 'tags': self.tags.split(","), + 'created': str(self.created), + 'updated': str(self.updated) + } diff --git a/lms/djangoapps/notes/tests.py b/lms/djangoapps/notes/tests.py new file mode 100644 index 0000000000..a7609b91ac --- /dev/null +++ b/lms/djangoapps/notes/tests.py @@ -0,0 +1,398 @@ +""" +Unit tests for the notes app. +""" + +from django.test import TestCase +from django.test.client import Client +from django.core.urlresolvers import reverse +from django.contrib.auth.models import User +from django.core.exceptions import ValidationError + +import collections +import unittest +import json +import logging + +from . import utils, api, models + + +class UtilsTest(TestCase): + def setUp(self): + ''' + Setup a dummy course-like object with a tabs field that can be + accessed via attribute lookup. + ''' + self.course = collections.namedtuple('DummyCourse', ['tabs']) + self.course.tabs = [] + + def test_notes_not_enabled(self): + ''' + Tests that notes are disabled when the course tab configuration does NOT + contain a tab with type "notes." + ''' + self.assertFalse(utils.notes_enabled_for_course(self.course)) + + def test_notes_enabled(self): + ''' + Tests that notes are enabled when the course tab configuration contains + a tab with type "notes." + ''' + self.course.tabs = [{'type': 'foo'}, + {'name': 'My Notes', 'type': 'notes'}, + {'type': 'bar'}] + + self.assertTrue(utils.notes_enabled_for_course(self.course)) + + +class ApiTest(TestCase): + + def setUp(self): + self.client = Client() + + # Mocks + api.api_enabled = self.mock_api_enabled(True) + + # Create two accounts + self.password = 'abc' + self.student = User.objects.create_user('student', 'student@test.com', self.password) + self.student2 = User.objects.create_user('student2', 'student2@test.com', self.password) + self.instructor = User.objects.create_user('instructor', 'instructor@test.com', self.password) + self.course_id = 'HarvardX/CB22x/The_Ancient_Greek_Hero' + self.note = { + 'user': self.student, + 'course_id': self.course_id, + 'uri': '/', + 'text': 'foo', + 'quote': 'bar', + 'range_start': 0, + 'range_start_offset': 0, + 'range_end': 100, + 'range_end_offset': 0, + 'tags': 'a,b,c' + } + + # Make sure no note with this ID ever exists for testing purposes + self.NOTE_ID_DOES_NOT_EXIST = 99999 + + def mock_api_enabled(self, is_enabled): + return (lambda request, course_id: is_enabled) + + def login(self, as_student=None): + username = None + password = self.password + + if as_student is None: + username = self.student.username + else: + username = as_student.username + + self.client.login(username=username, password=password) + + def url(self, name, args={}): + args.update({'course_id': self.course_id}) + return reverse(name, kwargs=args) + + def create_notes(self, num_notes, create=True): + notes = [] + for n in range(num_notes): + note = models.Note(**self.note) + if create: + note.save() + notes.append(note) + return notes + + def test_root(self): + self.login() + + resp = self.client.get(self.url('notes_api_root')) + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + + self.assertEqual(set(('name', 'version')), set(content.keys())) + self.assertIsInstance(content['version'], int) + self.assertEqual(content['name'], 'Notes API') + + def test_index_empty(self): + self.login() + + resp = self.client.get(self.url('notes_api_notes')) + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + self.assertEqual(len(content), 0) + + def test_index_with_notes(self): + num_notes = 3 + self.login() + self.create_notes(num_notes) + + resp = self.client.get(self.url('notes_api_notes')) + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + self.assertIsInstance(content, list) + self.assertEqual(len(content), num_notes) + + def test_index_max_notes(self): + self.login() + + MAX_LIMIT = api.API_SETTINGS.get('MAX_NOTE_LIMIT') + num_notes = MAX_LIMIT + 1 + self.create_notes(num_notes) + + resp = self.client.get(self.url('notes_api_notes')) + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + self.assertIsInstance(content, list) + self.assertEqual(len(content), MAX_LIMIT) + + def test_create_note(self): + self.login() + + notes = self.create_notes(1) + self.assertEqual(len(notes), 1) + + note_dict = notes[0].as_dict() + excluded_fields = ['id', 'user_id', 'created', 'updated'] + note = dict([(k, v) for k, v in note_dict.items() if k not in excluded_fields]) + + resp = self.client.post(self.url('notes_api_notes'), + json.dumps(note), + content_type='application/json', + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + + self.assertEqual(resp.status_code, 303) + self.assertEqual(len(resp.content), 0) + + def test_create_empty_notes(self): + self.login() + + for empty_test in [None, [], '']: + resp = self.client.post(self.url('notes_api_notes'), + json.dumps(empty_test), + content_type='application/json', + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + self.assertEqual(resp.status_code, 400) + + def test_create_note_missing_ranges(self): + self.login() + + notes = self.create_notes(1) + self.assertEqual(len(notes), 1) + note_dict = notes[0].as_dict() + + excluded_fields = ['id', 'user_id', 'created', 'updated'] + ['ranges'] + note = dict([(k, v) for k, v in note_dict.items() if k not in excluded_fields]) + + resp = self.client.post(self.url('notes_api_notes'), + json.dumps(note), + content_type='application/json', + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + self.assertEqual(resp.status_code, 400) + + def test_read_note(self): + self.login() + + notes = self.create_notes(3) + self.assertEqual(len(notes), 3) + + for note in notes: + resp = self.client.get(self.url('notes_api_note', {'note_id': note.pk})) + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + self.assertEqual(content['id'], note.pk) + self.assertEqual(content['user_id'], note.user_id) + + def test_note_doesnt_exist_to_read(self): + self.login() + resp = self.client.get(self.url('notes_api_note', { + 'note_id': self.NOTE_ID_DOES_NOT_EXIST + })) + self.assertEqual(resp.status_code, 404) + self.assertEqual(resp.content, '') + + def test_student_doesnt_have_permission_to_read_note(self): + notes = self.create_notes(1) + self.assertEqual(len(notes), 1) + note = notes[0] + + # set the student id to a different student (not the one that created the notes) + self.login(as_student=self.student2) + resp = self.client.get(self.url('notes_api_note', {'note_id': note.pk})) + self.assertEqual(resp.status_code, 403) + self.assertEqual(resp.content, '') + + def test_delete_note(self): + self.login() + + notes = self.create_notes(1) + self.assertEqual(len(notes), 1) + note = notes[0] + + resp = self.client.delete(self.url('notes_api_note', { + 'note_id': note.pk + })) + self.assertEqual(resp.status_code, 204) + self.assertEqual(resp.content, '') + + with self.assertRaises(models.Note.DoesNotExist): + models.Note.objects.get(pk=note.pk) + + def test_note_does_not_exist_to_delete(self): + self.login() + + resp = self.client.delete(self.url('notes_api_note', { + 'note_id': self.NOTE_ID_DOES_NOT_EXIST + })) + self.assertEqual(resp.status_code, 404) + self.assertEqual(resp.content, '') + + def test_student_doesnt_have_permission_to_delete_note(self): + notes = self.create_notes(1) + self.assertEqual(len(notes), 1) + note = notes[0] + + self.login(as_student=self.student2) + resp = self.client.delete(self.url('notes_api_note', { + 'note_id': note.pk + })) + self.assertEqual(resp.status_code, 403) + self.assertEqual(resp.content, '') + + try: + models.Note.objects.get(pk=note.pk) + except models.Note.DoesNotExist: + self.fail('note should exist and not be deleted because the student does not have permission to do so') + + def test_update_note(self): + notes = self.create_notes(1) + note = notes[0] + + updated_dict = note.as_dict() + updated_dict.update({ + 'text': 'itchy and scratchy', + 'tags': ['simpsons', 'cartoons', 'animation'] + }) + + self.login() + resp = self.client.put(self.url('notes_api_note', {'note_id': note.pk}), + json.dumps(updated_dict), + content_type='application/json', + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + self.assertEqual(resp.status_code, 303) + self.assertEqual(resp.content, '') + + actual = models.Note.objects.get(pk=note.pk) + actual_dict = actual.as_dict() + for field in ['text', 'tags']: + self.assertEqual(actual_dict[field], updated_dict[field]) + + def test_search_note_params(self): + self.login() + + total = 3 + notes = self.create_notes(total) + invalid_uri = ''.join([note.uri for note in notes]) + + tests = [{'limit': 0, 'offset': 0, 'expected_rows': total}, + {'limit': 0, 'offset': 2, 'expected_rows': total - 2}, + {'limit': 0, 'offset': total, 'expected_rows': 0}, + {'limit': 1, 'offset': 0, 'expected_rows': 1}, + {'limit': 2, 'offset': 0, 'expected_rows': 2}, + {'limit': total, 'offset': 2, 'expected_rows': 1}, + {'limit': total, 'offset': total, 'expected_rows': 0}, + {'limit': total + 1, 'offset': total + 1, 'expected_rows': 0}, + {'limit': total + 1, 'offset': 0, 'expected_rows': total}, + {'limit': 0, 'offset': 0, 'uri': invalid_uri, 'expected_rows': 0, 'expected_total': 0}] + + for test in tests: + params = dict([(k, str(test[k])) + for k in ('limit', 'offset', 'uri') + if k in test]) + resp = self.client.get(self.url('notes_api_search'), + params, + content_type='application/json', + HTTP_X_REQUESTED_WITH='XMLHttpRequest') + + self.assertEqual(resp.status_code, 200) + self.assertNotEqual(resp.content, '') + + content = json.loads(resp.content) + + for expected_key in ('total', 'rows'): + self.assertTrue(expected_key in content) + + if 'expected_total' in test: + self.assertEqual(content['total'], test['expected_total']) + else: + self.assertEqual(content['total'], total) + + self.assertEqual(len(content['rows']), test['expected_rows']) + + for row in content['rows']: + self.assertTrue('id' in row) + + +class NoteTest(TestCase): + def setUp(self): + self.password = 'abc' + self.student = User.objects.create_user('student', 'student@test.com', self.password) + self.course_id = 'HarvardX/CB22x/The_Ancient_Greek_Hero' + self.note = { + 'user': self.student, + 'course_id': self.course_id, + 'uri': '/', + 'text': 'foo', + 'quote': 'bar', + 'range_start': 0, + 'range_start_offset': 0, + 'range_end': 100, + 'range_end_offset': 0, + 'tags': 'a,b,c' + } + + def test_clean_valid_note(self): + reference_note = models.Note(**self.note) + body = reference_note.as_dict() + + note = models.Note(course_id=self.course_id, user=self.student) + try: + note.clean(json.dumps(body)) + self.assertEqual(note.uri, body['uri']) + self.assertEqual(note.text, body['text']) + self.assertEqual(note.quote, body['quote']) + self.assertEqual(note.range_start, body['ranges'][0]['start']) + self.assertEqual(note.range_start_offset, body['ranges'][0]['startOffset']) + self.assertEqual(note.range_end, body['ranges'][0]['end']) + self.assertEqual(note.range_end_offset, body['ranges'][0]['endOffset']) + self.assertEqual(note.tags, ','.join(body['tags'])) + except ValidationError: + self.fail('a valid note should not raise an exception') + + def test_clean_invalid_note(self): + note = models.Note(course_id=self.course_id, user=self.student) + for empty_type in (None, '', 0, []): + with self.assertRaises(ValidationError): + note.clean(None) + + with self.assertRaises(ValidationError): + note.clean(json.dumps({ + 'text': 'foo', + 'quote': 'bar', + 'ranges': [{} for i in range(10)] # too many ranges + })) + + def test_as_dict(self): + note = models.Note(course_id=self.course_id, user=self.student) + d = note.as_dict() + self.assertNotIsInstance(d, basestring) + self.assertEqual(d['user_id'], self.student.id) + self.assertTrue('course_id' not in d) diff --git a/lms/djangoapps/notes/urls.py b/lms/djangoapps/notes/urls.py new file mode 100644 index 0000000000..6abe92253a --- /dev/null +++ b/lms/djangoapps/notes/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls import patterns, url + + +id_regex = r"(?P[0-9A-Fa-f]+)" +urlpatterns = patterns('notes.api', + url(r'^api$', 'api_request', {'resource': 'root'}, name='notes_api_root'), + url(r'^api/annotations$', 'api_request', {'resource': 'notes'}, name='notes_api_notes'), + url(r'^api/annotations/' + id_regex + r'$', 'api_request', {'resource': 'note'}, name='notes_api_note'), + url(r'^api/search', 'api_request', {'resource': 'search'}, name='notes_api_search') + ) diff --git a/lms/djangoapps/notes/utils.py b/lms/djangoapps/notes/utils.py new file mode 100644 index 0000000000..e6e784ce49 --- /dev/null +++ b/lms/djangoapps/notes/utils.py @@ -0,0 +1,17 @@ +from django.conf import settings + + +def notes_enabled_for_course(course): + + ''' + Returns True if the notes app is enabled for the course, False otherwise. + + In order for the app to be enabled it must be: + 1) enabled globally via MITX_FEATURES. + 2) present in the course tab configuration. + ''' + + tab_found = next((True for t in course.tabs if t['type'] == 'notes'), False) + feature_enabled = settings.MITX_FEATURES.get('ENABLE_STUDENT_NOTES') + + return feature_enabled and tab_found diff --git a/lms/djangoapps/notes/views.py b/lms/djangoapps/notes/views.py new file mode 100644 index 0000000000..654d7fb31d --- /dev/null +++ b/lms/djangoapps/notes/views.py @@ -0,0 +1,24 @@ +from django.contrib.auth.decorators import login_required +from django.http import Http404 +from mitxmako.shortcuts import render_to_response +from courseware.courses import get_course_with_access +from notes.models import Note +from notes.utils import notes_enabled_for_course +import json + + +@login_required +def notes(request, course_id): + ''' Displays the student's notes. ''' + + course = get_course_with_access(request.user, course_id, 'load') + if not notes_enabled_for_course(course): + raise Http404 + + notes = Note.objects.filter(course_id=course_id, user=request.user).order_by('-created', 'uri') + context = { + 'course': course, + 'notes': notes + } + + return render_to_response('notes.html', context) diff --git a/lms/djangoapps/open_ended_grading/tests.py b/lms/djangoapps/open_ended_grading/tests.py index 93d27d8e24..ffc02608d5 100644 --- a/lms/djangoapps/open_ended_grading/tests.py +++ b/lms/djangoapps/open_ended_grading/tests.py @@ -84,7 +84,9 @@ class TestStaffGradingService(LoginEnrollmentTestCase): data = {'location': self.location} r = self.check_for_post_code(200, url, data) + d = json.loads(r.content) + self.assertTrue(d['success']) self.assertEquals(d['submission_id'], self.mock_service.cnt) self.assertIsNotNone(d['submission']) @@ -130,6 +132,7 @@ class TestStaffGradingService(LoginEnrollmentTestCase): r = self.check_for_post_code(200, url, data) d = json.loads(r.content) + self.assertTrue(d['success'], str(d)) self.assertIsNotNone(d['problem_list']) @@ -179,7 +182,8 @@ class TestPeerGradingService(LoginEnrollmentTestCase): data = {'location': self.location} r = self.peer_module.get_next_submission(data) - d = json.loads(r) + d = r + self.assertTrue(d['success']) self.assertIsNotNone(d['submission_id']) self.assertIsNotNone(d['prompt']) @@ -213,7 +217,8 @@ class TestPeerGradingService(LoginEnrollmentTestCase): qdict.keys = data.keys r = self.peer_module.save_grade(qdict) - d = json.loads(r) + d = r + self.assertTrue(d['success']) def test_save_grade_missing_keys(self): @@ -225,7 +230,8 @@ class TestPeerGradingService(LoginEnrollmentTestCase): def test_is_calibrated_success(self): data = {'location': self.location} r = self.peer_module.is_student_calibrated(data) - d = json.loads(r) + d = r + self.assertTrue(d['success']) self.assertTrue('calibrated' in d) @@ -239,9 +245,8 @@ class TestPeerGradingService(LoginEnrollmentTestCase): data = {'location': self.location} r = self.peer_module.show_calibration_essay(data) - d = json.loads(r) - log.debug(d) - log.debug(type(d)) + d = r + self.assertTrue(d['success']) self.assertIsNotNone(d['submission_id']) self.assertIsNotNone(d['prompt']) diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 96fe338c8a..6d3dcbd5ca 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -1,9 +1,11 @@ from django.contrib.auth.decorators import login_required from django.http import Http404 +from django.core.urlresolvers import reverse from mitxmako.shortcuts import render_to_response from courseware.access import has_access from courseware.courses import get_course_with_access +from notes.utils import notes_enabled_for_course from static_replace import replace_static_urls @@ -23,7 +25,8 @@ def index(request, course_id, book_index, page=None): return render_to_response('staticbook.html', {'book_index': book_index, 'page': int(page), - 'course': course, 'book_url': textbook.book_url, + 'course': course, + 'book_url': textbook.book_url, 'table_of_contents': table_of_contents, 'start_page': textbook.start_page, 'end_page': textbook.end_page, @@ -100,6 +103,7 @@ def html_index(request, course_id, book_index, chapter=None): """ course = get_course_with_access(request.user, course_id, 'load') staff_access = has_access(request.user, course, 'staff') + notes_enabled = notes_enabled_for_course(course) book_index = int(book_index) if book_index < 0 or book_index >= len(course.html_textbooks): @@ -128,4 +132,5 @@ def html_index(request, course_id, book_index, chapter=None): 'course': course, 'textbook': textbook, 'chapter': chapter, - 'staff_access': staff_access}) + 'staff_access': staff_access, + 'notes_enabled': notes_enabled}) diff --git a/lms/envs/acceptance.py b/lms/envs/acceptance.py index 2c51dda5e6..611c3fdac8 100644 --- a/lms/envs/acceptance.py +++ b/lms/envs/acceptance.py @@ -8,13 +8,17 @@ from .test import * # otherwise the browser will not render the pages correctly DEBUG = True +# Disable warnings for acceptance tests, to make the logs readable +import logging +logging.disable(logging.ERROR) + # Use the mongo store for acceptance tests modulestore_options = { 'default_class': 'xmodule.raw_module.RawDescriptor', 'host': 'localhost', 'db': 'test_xmodule', - 'collection': 'modulestore', - 'fs_root': GITHUB_REPO_ROOT, + 'collection': 'acceptance_modulestore', + 'fs_root': TEST_ROOT / "data", 'render_template': 'mitxmako.shortcuts.render_to_string', } @@ -33,7 +37,7 @@ CONTENTSTORE = { 'ENGINE': 'xmodule.contentstore.mongo.MongoContentStore', 'OPTIONS': { 'host': 'localhost', - 'db': 'test_xcontent', + 'db': 'test_xmodule', } } @@ -43,8 +47,8 @@ CONTENTSTORE = { DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ENV_ROOT / "db" / "test_mitx.db", - 'TEST_NAME': ENV_ROOT / "db" / "test_mitx.db", + 'NAME': TEST_ROOT / "db" / "test_mitx.db", + 'TEST_NAME': TEST_ROOT / "db" / "test_mitx.db", } } diff --git a/lms/envs/common.py b/lms/envs/common.py index e6d761c070..c111b3c18e 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -92,6 +92,9 @@ MITX_FEATURES = { # Staff Debug tool. 'ENABLE_STUDENT_HISTORY_VIEW': True, + # Enables the student notes API and UI. + 'ENABLE_STUDENT_NOTES': True, + # Provide a UI to allow users to submit feedback from the LMS 'ENABLE_FEEDBACK_SUBMISSION': False, } @@ -123,9 +126,7 @@ sys.path.append(COMMON_ROOT / 'lib') # For Node.js -system_node_path = os.environ.get("NODE_PATH", None) -if system_node_path is None: - system_node_path = "/usr/local/lib/node_modules" +system_node_path = os.environ.get("NODE_PATH", REPO_ROOT / 'node_modules') node_paths = [COMMON_ROOT / "static/js/vendor", COMMON_ROOT / "static/coffee/src", @@ -424,11 +425,15 @@ main_vendor_js = [ 'js/vendor/jquery.qtip.min.js', 'js/vendor/swfobject/swfobject.js', 'js/vendor/jquery.ba-bbq.min.js', + 'js/vendor/annotator.min.js', + 'js/vendor/annotator.store.min.js', + 'js/vendor/annotator.tags.min.js' ] discussion_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/discussion/**/*.js')) staff_grading_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/staff_grading/**/*.js')) open_ended_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/open_ended/**/*.js')) +notes_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/notes/**/*.coffee')) PIPELINE_CSS = { 'application': { @@ -441,6 +446,7 @@ PIPELINE_CSS = { 'css/vendor/jquery.treeview.css', 'css/vendor/ui-lightness/jquery-ui-1.8.22.custom.css', 'css/vendor/jquery.qtip.min.css', + 'css/vendor/annotator.min.css', 'sass/course.css', 'xmodule/modules.css', ], @@ -462,7 +468,7 @@ PIPELINE_JS = { 'source_filenames': sorted( set(rooted_glob(COMMON_ROOT / 'static', 'coffee/src/**/*.js') + rooted_glob(PROJECT_ROOT / 'static', 'coffee/src/**/*.js')) - - set(courseware_js + discussion_js + staff_grading_js + open_ended_js) + set(courseware_js + discussion_js + staff_grading_js + open_ended_js + notes_js) ) + [ 'js/form.ext.js', 'js/my_courses_dropdown.js', @@ -503,7 +509,12 @@ PIPELINE_JS = { 'source_filenames': open_ended_js, 'output_filename': 'js/open_ended.js', 'test_order': 6, - } + }, + 'notes': { + 'source_filenames': notes_js, + 'output_filename': 'js/notes.js', + 'test_order': 7 + }, } PIPELINE_DISABLE_WRAPPER = True @@ -593,5 +604,8 @@ INSTALLED_APPS = ( # Discussion forums 'django_comment_client', + + # Student notes + 'notes', ) diff --git a/lms/envs/jasmine.py b/lms/envs/jasmine.py index f3f20e7fbc..ba4fcc5261 100644 --- a/lms/envs/jasmine.py +++ b/lms/envs/jasmine.py @@ -33,6 +33,6 @@ PIPELINE_JS['spec'] = { JASMINE_TEST_DIRECTORY = PROJECT_ROOT + '/static/coffee' -STATICFILES_DIRS.append(COMMON_ROOT / 'test' / 'phantom-jasmine' / 'lib') +STATICFILES_DIRS.append(REPO_ROOT/'node_modules/phantom-jasmine/lib') INSTALLED_APPS += ('django_jasmine', ) diff --git a/lms/lib/comment_client/utils.py b/lms/lib/comment_client/utils.py index 53bdd462ad..1ce03ed3c7 100644 --- a/lms/lib/comment_client/utils.py +++ b/lms/lib/comment_client/utils.py @@ -1,3 +1,4 @@ +from dogapi import dog_stats_api import json import logging import requests @@ -30,12 +31,18 @@ def merge_dict(dic1, dic2): def perform_request(method, url, data_or_params=None, *args, **kwargs): if data_or_params is None: data_or_params = {} + tags = [ + "{k}:{v}".format(k=k, v=v) + for (k, v) in data_or_params.items() + [("method", method), ("url", url)] + if k != 'api_key' + ] data_or_params['api_key'] = settings.API_KEY try: - if method in ['post', 'put', 'patch']: - response = requests.request(method, url, data=data_or_params, timeout=5) - else: - response = requests.request(method, url, params=data_or_params, timeout=5) + with dog_stats_api.timer('comment_client.request.time', tags=tags): + if method in ['post', 'put', 'patch']: + response = requests.request(method, url, data=data_or_params, timeout=5) + else: + response = requests.request(method, url, params=data_or_params, timeout=5) except Exception as err: # remove API key if it is in the params if 'api_key' in data_or_params: diff --git a/lms/static/coffee/src/notes.coffee b/lms/static/coffee/src/notes.coffee new file mode 100644 index 0000000000..e13707256e --- /dev/null +++ b/lms/static/coffee/src/notes.coffee @@ -0,0 +1,73 @@ +class StudentNotes + _debug: false + + targets: [] # holds elements with annotator() instances + + # Adds a listener for "notes" events that may bubble up from descendants. + constructor: ($, el) -> + console.log 'student notes init', arguments, this if @_debug + + if not $(el).data('notes-instance') + events = 'notes:init': @onInitNotes + $(el).delegate('*', events) + $(el).data('notes-instance', @) + + # Initializes annotations on a container element in response to an init event. + onInitNotes: (event, uri=null) => + event.stopPropagation() + + storeConfig = @getStoreConfig uri + found = @targets.some (target) -> target is event.target + + if found + annotator = $(event.target).data('annotator') + if annotator + store = annotator.plugins['Store'] + $.extend(store.options, storeConfig) + if uri + store.loadAnnotationsFromSearch(storeConfig['loadFromSearch']) + else + console.log 'URI is required to load annotations' + else + console.log 'No annotator() instance found for target: ', event.target + else + $(event.target).annotator() + .annotator('addPlugin', 'Tags') + .annotator('addPlugin', 'Store', storeConfig) + @targets.push(event.target) + + # Returns a JSON config object that can be passed to the annotator Store plugin + getStoreConfig: (uri) -> + prefix = @getPrefix() + if uri is null + uri = @getURIPath() + + storeConfig = + prefix: prefix + loadFromSearch: + uri: uri + limit: 0 + annotationData: + uri: uri + storeConfig + + # Returns the API endpoint for the annotation store + getPrefix: () -> + re = /^(\/courses\/[^/]+\/[^/]+\/[^/]+)/ + match = re.exec(@getURIPath()) + prefix = (if match then match[1] else '') + return "#{prefix}/notes/api" + + # Returns the URI path of the current page for filtering annotations + getURIPath: () -> + window.location.href.toString().split(window.location.host)[1] + + +# Enable notes by default on the document root. +# To initialize annotations on a container element in the document: +# +# $('#myElement').trigger('notes:init'); +# +# Comment this line to disable notes. + +$(document).ready ($) -> new StudentNotes $, @ diff --git a/lms/static/css/vendor/annotator.css b/lms/static/css/vendor/annotator.css new file mode 100644 index 0000000000..b3af816775 --- /dev/null +++ b/lms/static/css/vendor/annotator.css @@ -0,0 +1,899 @@ +/* Base Reset +-------------------------------------------------------------------- */ + +.annotator-notice, +.annotator-filter *, +.annotator-widget * { + font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; + font-weight: normal; + text-align: left; + margin: 0; + padding: 0; + background: none; + -webkit-transition: none; + -moz-transition: none; + -o-transition: none; + transition: none; + -moz-box-shadow: none; + -webkit-box-shadow: none; + -o-box-shadow: none; + box-shadow: none; + color: rgb(144, 144, 144); +} + +/* Images +-------------------------------------------------------------------- */ + +.annotator-adder { + background-image: url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YGLQcbzxEtETDzRIdjRJd8pnpIDQfG/kvwjv/5GohK8fFPf3Yl26qTCWEkI+2tohIpoGux2h3SxMfHk5OTIxWPz6oCgkCq2uaHwjTfeIAHcohEUPxXGShaf9IJIRbRIEhErTvFsRmURFc+5bUHxDxmbSeD/PUpB8WeV7F9J+nEgXbiMdLclYmNGLc+2rvnYZyvIXleyPyj+lwfMbTf6ej+vBO9/K5lYT2OrV69e6XwkCBmPPjpDsj7s0Z6cnGOb6Xdu5du84NunibS8/vrrxJ/N047kv3Juu8Tfi/J3TV4srdk33tjELM9m+l1A/INTM+45/7rr+1aiPz0olsuYz4+RNkM/7XoO++35m+l3AfG/PHCuJrQ+yM4QtL3JsV1H16xZs4IKh32eyf7ihks8b8lUr2Q6iVwwHVwC4r96fgfll1brMnX6MCqe3VQ8//LJPzg13etc4n3hX3dt3woumY5/F2SGwoB9joLNWdf2+eR/edCPAxp/fQd0SJ4ttFkMY4KxWCx5Op0u4pNPPlkvi/YV4ZcvX04IuWd/DNAnPxOMYG/J4zg+4lrhFz75B495geAB4s+6+vVbln72PB3l33ztgE/+ZYOfCJie8/GX6v06h8wnyzMDveu9/CqRp4vtxBNM43/5y1/ueMO5I/gl8QRRLp/NfiD4mXiC2oq6U3rXxBOFVUzmY1tcr/Lq6CjxdERxTfwd8Qcrno4orom/I/5gxdMhAlIQkXwF064CLzwI4lERUUD891M8KiIKiP9OxNNhAvISEVFZDpevaJIHRTwKIvKb/0EQj4KI/Oa/U/F0qIA03JnS+wdKPD7cmSL/gyQeH+5Mkb8jxHOnWZiWiOTBLVH6/kEtbmHIglui9P2DWtzCWH3534r8HSUcd/l/AQYA7PGYKl3+RK0AAAAASUVORK5CYII='); + background-repeat: no-repeat; +} + +.annotator-resize, +.annotator-widget::after, +.annotator-editor a::after, +.annotator-viewer .annotator-controls button, +.annotator-viewer .annotator-controls a, +.annotator-filter .annotator-filter-navigation button::after, +.annotator-filter .annotator-filter-property .annotator-filter-clear { + background-image: url('data:image/png;base64,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hLMlquF8vuDzcH1I5BaKO1o/tEk3jC0sUcUyD69RvckwWDHIuStIDSHjKE3actwlgYoRXj/2HH9GYkfGlInyreEZ3/jXuyoFlWIy8RRBgAxJ+WCRD6cPdfxgzyI3ZMHwPu4Z6sgKaPLO+z6ze5J0usPzMVIYWPKZ0YuJr1lPB91ihImjmhlj5bfI118SlIHkRIRqeYAxFchNZiX+EMP6ScImq7WpuSi5SwTHYyc4u7rFEvWuS09TH79wz6nwADANCoQA3w0fcjAAAAAElFTkSuQmCC'); + background-repeat: no-repeat; +} + +/* Annotator Highlight +-------------------------------------------------------------------- */ + +.annotator-hl { + background: rgba(255, 255, 10, 0.3); +} + +.annotator-hl-temporary { + background: rgba(0, 124, 255, 0.3); +} + +/* Annotator Wrapper +-------------------------------------------------------------------- */ + +.annotator-wrapper { + position: relative; +} + +/* NB: If you change the list of classes for which z-index is set, + you should update Annotator._setupDynamicStyle() */ +.annotator-adder, +.annotator-outer, +.annotator-notice { + z-index: 1020; +} + +.annotator-filter { + z-index: 1010; +} + +.annotator-adder, +.annotator-outer, +.annotator-widget, +.annotator-notice { + position: absolute; + font-size: 10px; + line-height: 1; +} + +.annotator-hide { + display: none; + visibility: hidden; +} + +/* Annotator Adder +-------------------------------------------------------------------- */ + +.annotator-adder { + margin-top: -48px; + margin-left: -24px; + width: 48px; + height: 48px; + background-position: left top; +} + +.annotator-adder:hover { + background-position: center top; +} + +.annotator-adder:active { + background-position: center right; +} + +.annotator-adder button { + display: block; + width: 36px; + height: 41px; + margin: 0 auto; + border: none; + background: none; + text-indent: -999em; + cursor: pointer; +} + +/** NOTE: fix for conflict with course.css */ +.annotator-adder button:hover, +.annotator-adder button:active { + background-color: inherit; + -webkit-box-shadow: inherit; + -moz-box-shadow: inherit; + box-shadow: inherit; + text-shadow: inherit; + border: inherit; +} + +/* Annotator Widget + + This applies to both the Viewer and the Editor +-------------------------------------------------------------------- */ + +.annotator-outer { + width: 0; + height: 0; +} + +.annotator-widget { + margin: 0; + padding: 0; + bottom: 15px; + left: -18px; + min-width: 265px; + background-color: rgba(251, 251, 251, 0.98); + border: 1px solid rgba(122, 122, 122, 0.6); + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + border-radius: 5px; + -webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); + -o-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); +} + +.annotator-invert-x .annotator-widget { + left: auto; + right: -18px; +} + +.annotator-invert-y .annotator-widget { + bottom: auto; + top: 8px; +} + +.annotator-widget strong { + font-weight: bold; +} + +.annotator-widget .annotator-listing, +.annotator-widget .annotator-item { + padding: 0; + margin: 0; + list-style: none; +} + +.annotator-widget::after { + content: ""; + display: block; + width: 18px; + height: 10px; + background-position: 0 0; + position: absolute; + bottom: -10px; + left: 8px; +} + +.annotator-invert-x .annotator-widget::after { + left: auto; + right: 8px; +} + +.annotator-invert-y .annotator-widget::after { + background-position: 0 -15px; + bottom: auto; + top: -9px; +} + +.annotator-widget .annotator-item, +.annotator-editor .annotator-item input, +.annotator-editor .annotator-item textarea { + position: relative; + font-size: 12px; +} + +.annotator-viewer .annotator-item { + border-top: 2px solid rgba(122, 122, 122, 0.2); +} + +.annotator-widget .annotator-item:first-child { + border-top: none; +} + +.annotator-editor .annotator-item, +.annotator-viewer div { + border-top: 1px solid rgba(133, 133, 133, 0.11); +} + +/* Annotator Viewer +-------------------------------------------------------------------- */ + +.annotator-viewer div { + padding: 6px 6px; +} + +.annotator-viewer .annotator-item ol, +.annotator-viewer .annotator-item ul { + padding: 4px 16px; +} + +.annotator-viewer .annotator-item li { +} + +.annotator-viewer div:first-of-type, +.annotator-editor .annotator-item:first-child textarea { + padding-top: 12px; + padding-bottom: 12px; + color: rgb(60, 60, 60); + font-size: 13px; + font-style: italic; + line-height: 1.3; + border-top: none; +} + +.annotator-viewer .annotator-controls { + position: relative; + top: 5px; + right: 5px; + padding-left: 5px; + opacity: 0; + -webkit-transition: opacity 0.2s ease-in; + -moz-transition: opacity 0.2s ease-in; + -o-transition: opacity 0.2s ease-in; + transition: opacity 0.2s ease-in; + float: right; +} + +.annotator-viewer li:hover .annotator-controls, +.annotator-viewer li .annotator-controls.annotator-visible { + opacity: 1; +} + +.annotator-viewer .annotator-controls button, +.annotator-viewer .annotator-controls a { + cursor: pointer; + display: inline-block; + width: 13px; + height: 13px; + margin-left: 2px; + border: none; + opacity: 0.2; + text-indent: -900em; + background-color: transparent; + outline: none; +} + +.annotator-viewer .annotator-controls button:hover, +.annotator-viewer .annotator-controls button:focus, +.annotator-viewer .annotator-controls a:hover, +.annotator-viewer .annotator-controls a:focus { + opacity: 0.9; +} + +.annotator-viewer .annotator-controls button:active, +.annotator-viewer .annotator-controls a:active { + opacity: 1; +} + +.annotator-viewer .annotator-controls button[disabled] { + display: none; +} + +.annotator-viewer .annotator-controls .annotator-edit { + background-position: 0 -60px; +} + +.annotator-viewer .annotator-controls .annotator-delete { + background-position: 0 -75px; +} + +.annotator-viewer .annotator-controls .annotator-link { + background-position: 0 -270px; +} + +/* Annotator Editor +-------------------------------------------------------------------- */ + +.annotator-editor .annotator-item { + position: relative; +} + +.annotator-editor .annotator-item label { + top: 0; + display: inline; + cursor: pointer; + font-size: 12px; +} + +.annotator-editor .annotator-item input, +.annotator-editor .annotator-item textarea { + display: block; + min-width: 100%; + padding: 10px 8px; + border: none; + margin: 0; + color: rgb(60, 60, 60); + background: none; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + -o-box-sizing: border-box; + box-sizing: border-box; + resize: none; +} + +.annotator-editor .annotator-item textarea::-webkit-scrollbar { + height: 8px; + width: 8px; +} + +.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece { + margin: 13px 0 3px; + background-color: #e5e5e5; + -webkit-border-radius: 4px; +} + +.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical { + height: 25px; + background-color: #ccc; + -webkit-border-radius: 4px; + -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.1); +} + +.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal { + width: 25px; + background-color: #ccc; + -webkit-border-radius: 4px; +} + +.annotator-editor .annotator-item:first-child textarea { + min-height: 5.5em; + -webkit-border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + -o-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; +} + +.annotator-editor .annotator-item input:focus, +.annotator-editor .annotator-item textarea:focus{ + background-color: rgb(243, 243, 243); + outline: none; +} + +.annotator-editor .annotator-item input[type=radio], +.annotator-editor .annotator-item input[type=checkbox] { + width: auto; + min-width: 0; + padding: 0; + display: inline; + margin: 0 4px 0 0; + cursor: pointer; +} + +.annotator-editor .annotator-checkbox { + padding: 8px 6px; +} + +.annotator-filter, +.annotator-filter .annotator-filter-navigation button, +.annotator-editor .annotator-controls { + text-align: right; + padding: 3px; + border-top: 1px solid rgb(212,212,212); + background-color: rgb(212, 212, 212); + background-image: -webkit-gradient( + linear, left top, left bottom, + from(rgb(245, 245, 245)), + color-stop(0.6, rgb(220, 220, 220)), + to(rgb(210, 210, 210)) + ); + background-image: -moz-linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(220, 220, 220) 60%, + rgb(210, 210, 210) + ); + background-image: -webkit-linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(220, 220, 220) 60%, + rgb(210, 210, 210) + ); + background-image: linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(220, 220, 220) 60%, + rgb(210, 210, 210) + ); + -webkit-box-shadow: + inset 1px 0 0 rgba(255, 255, 255, 0.7), + inset -1px 0 0 rgba(255, 255, 255, 0.7), + inset 0 1px 0 rgba(255, 255, 255, 0.7); + -moz-box-shadow: + inset 1px 0 0 rgba(255, 255, 255, 0.7), + inset -1px 0 0 rgba(255, 255, 255, 0.7), + inset 0 1px 0 rgba(255, 255, 255, 0.7); + -o-box-shadow: + inset 1px 0 0 rgba(255, 255, 255, 0.7), + inset -1px 0 0 rgba(255, 255, 255, 0.7), + inset 0 1px 0 rgba(255, 255, 255, 0.7); + box-shadow: + inset 1px 0 0 rgba(255, 255, 255, 0.7), + inset -1px 0 0 rgba(255, 255, 255, 0.7), + inset 0 1px 0 rgba(255, 255, 255, 0.7); + -webkit-border-radius: 0 0 5px 5px; + -moz-border-radius: 0 0 5px 5px; + -o-border-radius: 0 0 5px 5px; + border-radius: 0 0 5px 5px; +} + +.annotator-editor.annotator-invert-y .annotator-controls { + border-top: none; + border-bottom: 1px solid rgb(180, 180, 180); + -webkit-border-radius: 5px 5px 0 0; + -moz-border-radius: 5px 5px 0 0; + -o-border-radius: 5px 5px 0 0; + border-radius: 5px 5px 0 0; +} + +.annotator-editor a, +.annotator-filter .annotator-filter-property label { + position: relative; + display: inline-block; + padding: 0 6px 0 22px; + color: rgb(54, 54, 54); + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75); + text-decoration: none; + line-height: 24px; + font-size: 12px; + font-weight: bold; + border: 1px solid rgb(162, 162, 162); + background-color: rgb(212, 212, 212); + background-image: -webkit-gradient( + linear, left top, left bottom, + from(rgb(245, 245, 245)), + color-stop(0.5, rgb(210, 210, 210)), + color-stop(0.5, rgb(190, 190, 190)), + to(rgb(210, 210, 210)) + ); + background-image: -moz-linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(210, 210, 210) 50%, + rgb(190, 190, 190) 50%, + rgb(210, 210, 210) + ); + background-image: -webkit-linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(210, 210, 210) 50%, + rgb(190, 190, 190) 50%, + rgb(210, 210, 210) + ); + background-image: linear-gradient( + -90deg, + rgb(245, 245, 245), + rgb(210, 210, 210) 50%, + rgb(190, 190, 190) 50%, + rgb(210, 210, 210) + ); + -webkit-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + -moz-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + -o-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; +} + +.annotator-editor a::after { + position: absolute; + top: 50%; + left: 5px; + display: block; + content: ""; + width: 15px; + height: 15px; + margin-top: -7px; + background-position: 0 -90px; +} + +.annotator-editor a:hover, +.annotator-editor a:focus, +.annotator-editor a.annotator-focus, +.annotator-filter .annotator-filter-active label, +.annotator-filter .annotator-filter-navigation button:hover { + outline: none; + border-color: rgb(67, 90, 160); + background-color: rgb(56, 101, 249); + background-image: -webkit-gradient( + linear, left top, left bottom, + from(rgb(118, 145, 251)), + color-stop(0.5, rgb(80, 117, 251)), + color-stop(0.5, rgb(56, 101, 249)), + to(rgb(54, 101, 250)) + ); + background-image: -moz-linear-gradient( + -90deg, + rgb(118, 145, 251), + rgb(80, 117, 251) 50%, + rgb(56, 101, 249) 50%, + rgb(54, 101, 250) + ); + background-image: -webkit-linear-gradient( + -90deg, + rgb(118, 145, 251), + rgb(80, 117, 251) 50%, + rgb(56, 101, 249) 50%, + rgb(54, 101, 250) + ); + background-image: linear-gradient( + -90deg, + rgb(118, 145, 251), + rgb(80, 117, 251) 50%, + rgb(56, 101, 249) 50%, + rgb(54, 101, 250) + ); + color: rgb(255, 255, 255); + text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.42); +} + +.annotator-editor a:hover::after, +.annotator-editor a:focus::after { + margin-top: -8px; + background-position: 0 -105px; +} + +.annotator-editor a:active, +.annotator-filter .annotator-filter-navigation button:active { + border-color: rgb(112, 12, 73); + background-color: rgb(209, 46, 142); + background-image: -webkit-gradient( + linear, left top, left bottom, + from(rgb(252, 124, 202)), + color-stop(0.5, rgb(232, 93, 178)), + color-stop(0.5, rgb(209, 46, 142)), + to(rgb(255, 0, 156)) + ); + background-image: -moz-linear-gradient( + -90deg, + rgb(252, 124, 202), + rgb(232, 93, 178) 50%, + rgb(209, 46, 142) 50%, + rgb(255, 0, 156) + ); + background-image: -webkit-linear-gradient( + -90deg, + rgb(252, 124, 202), + rgb(232, 93, 178) 50%, + rgb(209, 46, 142) 50%, + rgb(255, 0, 156) + ); + background-image: linear-gradient( + -90deg, + rgb(252, 124, 202), + rgb(232, 93, 178) 50%, + rgb(209, 46, 142) 50%, + rgb(255, 0, 156) + ); +} + +.annotator-editor a.annotator-save::after { + background-position: 0 -120px; +} + +.annotator-editor a.annotator-save:hover::after, +.annotator-editor a.annotator-save:focus::after, +.annotator-editor a.annotator-save.annotator-focus::after { + margin-top: -8px; + background-position: 0 -135px; +} + +.annotator-editor .annotator-widget::after { + background-position: 0 -30px; +} + +.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls { + background-color: #f2f2f2; +} + +.annotator-editor.annotator-invert-y .annotator-widget::after { + background-position: 0 -45px; + height: 11px; +} + +.annotator-resize { + position: absolute; + top: 0; + right: 0; + width: 12px; + height: 12px; + background-position: 2px -150px; +} + +.annotator-invert-x .annotator-resize { + right: auto; + left: 0; + background-position: 0 -195px; +} + +.annotator-invert-y .annotator-resize { + top: auto; + bottom: 0; + background-position: 2px -165px; +} + +.annotator-invert-y.annotator-invert-x .annotator-resize { + background-position: 0 -180px; +} + +/* Annotator Notification +-------------------------------------------------------------------- */ + +.annotator-notice { + color: #fff; + position: absolute; + position: fixed; + top: -54px; + left: 0; + width: 100%; + font-size: 14px; + line-height: 50px; + text-align: center; + background: black; + background: rgba(0, 0, 0, 0.9); + border-bottom: 4px solid #d4d4d4; + -webkit-transition: top 0.4s ease-out; + -moz-transition: top 0.4s ease-out; + -o-transition: top 0.4s ease-out; + transition: top 0.4s ease-out; +} + +.ie6 .annotator-notice { + position: absolute; +} + +.annotator-notice-success { + border-color: #3665f9; +} + +.annotator-notice-error { + border-color: #ff7e00; +} + +.annotator-notice p { + margin: 0; +} + +.annotator-notice a { + color: #fff; +} + +.annotator-notice-show { + top: 0; +} + +/* Annotator Tags Plugin +-------------------------------------------------------------------- */ + +.annotator-tags { + margin-bottom: -2px; +} + +.annotator-tags .annotator-tag { + display: inline-block; + padding: 0 8px; + margin-bottom: 2px; + line-height: 1.6; + font-weight: bold; + background-color: rgb(230, 230, 230); + -webkit-border-radius: 8px; + -moz-border-radius: 8px; + -o-border-radius: 8px; + border-radius: 8px; +} + +/* Annotator Filter Plugin +-------------------------------------------------------------------- */ + +.annotator-filter { + position: fixed; + top: 0; + right: 0; + left: 0; + text-align: left; + line-height: 0; + border: none; + border-bottom: 1px solid #878787; + padding-left: 10px; + padding-right: 10px; + -webkit-border-radius: 0; + -moz-border-radius: 0; + -o-border-radius: 0; + border-radius: 0; + -webkit-box-shadow: + inset 0 -1px 0 rgba(255, 255, 255, 0.3); + -moz-box-shadow: + inset 0 -1px 0 rgba(255, 255, 255, 0.3); + -o-box-shadow: + inset 0 -1px 0 rgba(255, 255, 255, 0.3); + box-shadow: + inset 0 -1px 0 rgba(255, 255, 255, 0.3); +} + +.annotator-filter strong { + font-size: 12px; + font-weight: bold; + color: #3c3c3c; + text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7); + position: relative; + top: -9px; +} + + +.annotator-filter .annotator-filter-property, +.annotator-filter .annotator-filter-navigation { + position: relative; + display: inline-block; + overflow: hidden; + line-height: 10px; + padding: 2px 0; + margin-right: 8px; +} + +.annotator-filter .annotator-filter-property label, +.annotator-filter .annotator-filter-navigation button { + text-align: left; + display: block; + float: left; + line-height: 20px; + -webkit-border-radius: 10px 0 0 10px; + -moz-border-radius: 10px 0 0 10px; + -o-border-radius: 10px 0 0 10px; + border-radius: 10px 0 0 10px; +} + +.annotator-filter .annotator-filter-property label { + padding-left: 8px; +} + +.annotator-filter .annotator-filter-property input { + display: block; + float: right; + -webkit-appearance: none; + background-color: #fff; + border: 1px solid #878787; + border-left: none; + padding: 2px 4px; + line-height: 16px; + min-height: 16px; + font-size: 12px; + width: 150px; + color: #333; + background-color: #f8f8f8; + -webkit-border-radius: 0 10px 10px 0; + -moz-border-radius: 0 10px 10px 0; + -o-border-radius: 0 10px 10px 0; + border-radius: 0 10px 10px 0; + -webkit-box-shadow: + inset 0 1px 1px rgba(0, 0, 0, 0.2); + -moz-box-shadow: + inset 0 1px 1px rgba(0, 0, 0, 0.2); + -o-box-shadow: + inset 0 1px 1px rgba(0, 0, 0, 0.2); + box-shadow: + inset 0 1px 1px rgba(0, 0, 0, 0.2); + +} + +.annotator-filter .annotator-filter-property input:focus { + outline: none; + background-color: #fff; +} + +.annotator-filter .annotator-filter-clear { + position: absolute; + right: 3px; + top: 6px; + border: none; + text-indent: -900em; + width: 15px; + height: 15px; + background-position: 0 -90px; + opacity: 0.4; +} + +.annotator-filter .annotator-filter-clear:hover, +.annotator-filter .annotator-filter-clear:focus { + opacity: 0.8; +} + +.annotator-filter .annotator-filter-clear:active { + opacity: 1; +} + +.annotator-filter .annotator-filter-navigation button { + border: 1px solid rgb(162, 162, 162); + padding: 0; + text-indent: -900px; + width: 20px; + min-height: 22px; + -webkit-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + -moz-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + -o-box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); + box-shadow: + inset 0 0 5px rgba(255, 255, 255, 0.2), + inset 0 0 1px rgba(255, 255, 255, 0.8); +} + +.annotator-filter .annotator-filter-navigation button, +.annotator-filter .annotator-filter-navigation button:hover, +.annotator-filter .annotator-filter-navigation button:focus { + color: transparent; +} + +.annotator-filter .annotator-filter-navigation button::after { + position: absolute; + top: 8px; + left: 8px; + content: ""; + display: block; + width: 9px; + height: 9px; + background-position: 0 -210px; +} + +.annotator-filter .annotator-filter-navigation button:hover::after { + background-position: 0 -225px; +} + +.annotator-filter .annotator-filter-navigation .annotator-filter-next { + -webkit-border-radius: 0 10px 10px 0; + -moz-border-radius: 0 10px 10px 0; + -o-border-radius: 0 10px 10px 0; + border-radius: 0 10px 10px 0; + border-left: none; +} + +.annotator-filter .annotator-filter-navigation .annotator-filter-next::after { + left: auto; + right: 7px; + background-position: 0 -240px; +} + +.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover::after { + background-position: 0 -255px; +} + +.annotator-hl-active { + background: rgba(255, 255, 10, 0.8); +} + +.annotator-hl-filtered { + background-color: transparent; +} + diff --git a/lms/static/css/vendor/annotator.min.css b/lms/static/css/vendor/annotator.min.css new file mode 100644 index 0000000000..f0e81eaff1 --- /dev/null +++ b/lms/static/css/vendor/annotator.min.css @@ -0,0 +1 @@ +.annotator-notice,.annotator-filter *,.annotator-widget *{font-family:"Helvetica Neue",Arial,Helvetica,sans-serif;font-weight:normal;text-align:left;margin:0;padding:0;background:0;-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none;-moz-box-shadow:none;-webkit-box-shadow:none;-o-box-shadow:none;box-shadow:none;color:#909090}.annotator-adder{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAAAwCAYAAAD+WvNWAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk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fll1brMnX6MCqe3VQ8//LJPzg13etc4n3hX3dt3woumY5/F2SGwoB9joLNWdf2+eR/edCPAxp/fQd0SJ4ttFkMY4KxWCx5Op0u4pNPPlkvi/YV4ZcvX04IuWd/DNAnPxOMYG/J4zg+4lrhFz75B495geAB4s+6+vVbln72PB3l33ztgE/+ZYOfCJie8/GX6v06h8wnyzMDveu9/CqRp4vtxBNM43/5y1/ueMO5I/gl8QRRLp/NfiD4mXiC2oq6U3rXxBOFVUzmY1tcr/Lq6CjxdERxTfwd8Qcrno4orom/I/5gxdMhAlIQkXwF064CLzwI4lERUUD891M8KiIKiP9OxNNhAvISEVFZDpevaJIHRTwKIvKb/0EQj4KI/Oa/U/F0qIA03JnS+wdKPD7cmSL/gyQeH+5Mkb8jxHOnWZiWiOTBLVH6/kEtbmHIglui9P2DWtzCWH3534r8HSUcd/l/AQYA7PGYKl3+RK0AAAAASUVORK5CYII=');background-repeat:no-repeat}.annotator-resize,.annotator-widget::after,.annotator-editor a::after,.annotator-viewer .annotator-controls button,.annotator-viewer .annotator-controls a,.annotator-filter .annotator-filter-navigation button::after,.annotator-filter .annotator-filter-property .annotator-filter-clear{background-image:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAEiCAYAAAD0w4JOAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgt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Ly3O2em1NUFDQ4cLCwoA6t9G2bdscpk6des3BwaGyTiC0yachISHX9+zZk4Qq3qtrxuYEmQWJO3v2bEzv3r2/qWui1R6y5Hl4f72vWTgjY0n78UoDZp2rplKpHCCd6gIiB+44evTod1NSUhZb21Yvd+jQYZROp9tZWVlZVlxcnKU03aFo2di8du/evVa88MQqEP58IZ0Itxakhkyj1R51AkkWDui1QzXvWw0SAWmVyjeWguq9vx70XCIkxjD6T3E4ZGlSUlK+1Rrt3buXFpPSmtFbyEimQdRWgRo0aPA2O6b/X6+DXAQs4Hm0EYXZw4CF1Qnk5uZWGhgY+CnaK9KqjM3W1rZ62LBhVydMmDDdw8PjqMWNlJubewL5UWZiYmIo/WPTmgRCiJBLIc2tBdTHo/+3tMaS1IZnRknLX23qpNLBgwddk5OT93p5edG/nFtLtTTbIOPi4uif4TXl5eUFBw4cWOfo6EgfWTS1GiRa7vnzmjVrKD9qXyeQaAuzBCS37OxnyAykf3utCiPck9U8tEIzEpASa15qaHkHLfloY860UL3314Pk4pG7u4ex+7QYhT60bA6Jh2yAlGZkpBu1bOlGn6HtF52P4Z587duVk6xpM1a1cSLIEchJkYazzG0jWuxOCTstfKMv6OhLMlquF8vuDzcH1I5BaKO1o/tEk3jC0sUcUyD69RvckwWDHIuStIDSHjKE3actwlgYoRXj/2HH9GYkfGlInyreEZ3/jXuyoFlWIy8RRBgAxJ+WCRD6cPdfxgzyI3ZMHwPu4Z6sgKaPLO+z6ze5J0usPzMVIYWPKZ0YuJr1lPB91ihImjmhlj5bfI118SlIHkRIRqeYAxFchNZiX+EMP6ScImq7WpuSi5SwTHYyc4u7rFEvWuS09TH79wz6nwADANCoQA3w0fcjAAAAAElFTkSuQmCC');background-repeat:no-repeat}.annotator-hl{background:rgba(255,255,10,0.3)}.annotator-hl-temporary{background:rgba(0,124,255,0.3)}.annotator-wrapper{position:relative}.annotator-adder,.annotator-outer,.annotator-notice{z-index:1020}.annotator-filter{z-index:1010}.annotator-adder,.annotator-outer,.annotator-widget,.annotator-notice{position:absolute;font-size:10px;line-height:1}.annotator-hide{display:none;visibility:hidden}.annotator-adder{margin-top:-48px;margin-left:-24px;width:48px;height:48px;background-position:left top}.annotator-adder:hover{background-position:center top}.annotator-adder:active{background-position:center right}.annotator-adder button{display:block;width:36px;height:41px;margin:0 auto;border:0;background:0;text-indent:-999em;cursor:pointer}.annotator-adder button:hover,.annotator-adder button:active{background-color:inherit;-webkit-box-shadow:inherit;-moz-box-shadow:inherit;box-shadow:inherit;text-shadow:inherit;border:inherit}.annotator-outer{width:0;height:0}.annotator-widget{margin:0;padding:0;bottom:15px;left:-18px;min-width:265px;background-color:rgba(251,251,251,0.98);border:1px solid rgba(122,122,122,0.6);-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 15px rgba(0,0,0,0.2);-o-box-shadow:0 5px 15px rgba(0,0,0,0.2);box-shadow:0 5px 15px rgba(0,0,0,0.2)}.annotator-invert-x .annotator-widget{left:auto;right:-18px}.annotator-invert-y .annotator-widget{bottom:auto;top:8px}.annotator-widget strong{font-weight:bold}.annotator-widget .annotator-listing,.annotator-widget .annotator-item{padding:0;margin:0;list-style:none}.annotator-widget::after{content:"";display:block;width:18px;height:10px;background-position:0 0;position:absolute;bottom:-10px;left:8px}.annotator-invert-x .annotator-widget::after{left:auto;right:8px}.annotator-invert-y .annotator-widget::after{background-position:0 -15px;bottom:auto;top:-9px}.annotator-widget .annotator-item,.annotator-editor .annotator-item input,.annotator-editor .annotator-item textarea{position:relative;font-size:12px}.annotator-viewer .annotator-item{border-top:2px solid rgba(122,122,122,0.2)}.annotator-widget .annotator-item:first-child{border-top:0}.annotator-editor .annotator-item,.annotator-viewer div{border-top:1px solid rgba(133,133,133,0.11)}.annotator-viewer div{padding:6px 6px}.annotator-viewer .annotator-item ol,.annotator-viewer .annotator-item ul{padding:4px 16px}.annotator-viewer div:first-of-type,.annotator-editor .annotator-item:first-child textarea{padding-top:12px;padding-bottom:12px;color:#3c3c3c;font-size:13px;font-style:italic;line-height:1.3;border-top:0}.annotator-viewer .annotator-controls{position:relative;top:5px;right:5px;padding-left:5px;opacity:0;-webkit-transition:opacity .2s ease-in;-moz-transition:opacity .2s ease-in;-o-transition:opacity .2s ease-in;transition:opacity .2s ease-in;float:right}.annotator-viewer li:hover .annotator-controls,.annotator-viewer li .annotator-controls.annotator-visible{opacity:1}.annotator-viewer .annotator-controls button,.annotator-viewer .annotator-controls a{cursor:pointer;display:inline-block;width:13px;height:13px;margin-left:2px;border:0;opacity:.2;text-indent:-900em;background-color:transparent;outline:0}.annotator-viewer .annotator-controls button:hover,.annotator-viewer .annotator-controls button:focus,.annotator-viewer .annotator-controls a:hover,.annotator-viewer .annotator-controls a:focus{opacity:.9}.annotator-viewer .annotator-controls button:active,.annotator-viewer .annotator-controls a:active{opacity:1}.annotator-viewer .annotator-controls button[disabled]{display:none}.annotator-viewer .annotator-controls .annotator-edit{background-position:0 -60px}.annotator-viewer .annotator-controls .annotator-delete{background-position:0 -75px}.annotator-viewer .annotator-controls .annotator-link{background-position:0 -270px}.annotator-editor .annotator-item{position:relative}.annotator-editor .annotator-item label{top:0;display:inline;cursor:pointer;font-size:12px}.annotator-editor .annotator-item input,.annotator-editor .annotator-item textarea{display:block;min-width:100%;padding:10px 8px;border:0;margin:0;color:#3c3c3c;background:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-o-box-sizing:border-box;box-sizing:border-box;resize:none}.annotator-editor .annotator-item textarea::-webkit-scrollbar{height:8px;width:8px}.annotator-editor .annotator-item textarea::-webkit-scrollbar-track-piece{margin:13px 0 3px;background-color:#e5e5e5;-webkit-border-radius:4px}.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:vertical{height:25px;background-color:#ccc;-webkit-border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.1)}.annotator-editor .annotator-item textarea::-webkit-scrollbar-thumb:horizontal{width:25px;background-color:#ccc;-webkit-border-radius:4px}.annotator-editor .annotator-item:first-child textarea{min-height:5.5em;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;-o-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.annotator-editor .annotator-item input:focus,.annotator-editor .annotator-item textarea:focus{background-color:#f3f3f3;outline:0}.annotator-editor .annotator-item input[type=radio],.annotator-editor .annotator-item input[type=checkbox]{width:auto;min-width:0;padding:0;display:inline;margin:0 4px 0 0;cursor:pointer}.annotator-editor .annotator-checkbox{padding:8px 6px}.annotator-filter,.annotator-filter .annotator-filter-navigation button,.annotator-editor .annotator-controls{text-align:right;padding:3px;border-top:1px solid #d4d4d4;background-color:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),color-stop(0.6,#dcdcdc),to(#d2d2d2));background-image:-moz-linear-gradient(-90deg,#f5f5f5,#dcdcdc 60%,#d2d2d2);background-image:-webkit-linear-gradient(-90deg,#f5f5f5,#dcdcdc 60%,#d2d2d2);background-image:linear-gradient(-90deg,#f5f5f5,#dcdcdc 60%,#d2d2d2);-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.7),inset -1px 0 0 rgba(255,255,255,0.7),inset 0 1px 0 rgba(255,255,255,0.7);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.7),inset -1px 0 0 rgba(255,255,255,0.7),inset 0 1px 0 rgba(255,255,255,0.7);-o-box-shadow:inset 1px 0 0 rgba(255,255,255,0.7),inset -1px 0 0 rgba(255,255,255,0.7),inset 0 1px 0 rgba(255,255,255,0.7);box-shadow:inset 1px 0 0 rgba(255,255,255,0.7),inset -1px 0 0 rgba(255,255,255,0.7),inset 0 1px 0 rgba(255,255,255,0.7);-webkit-border-radius:0 0 5px 5px;-moz-border-radius:0 0 5px 5px;-o-border-radius:0 0 5px 5px;border-radius:0 0 5px 5px}.annotator-editor.annotator-invert-y .annotator-controls{border-top:0;border-bottom:1px solid #b4b4b4;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;-o-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.annotator-editor a,.annotator-filter .annotator-filter-property label{position:relative;display:inline-block;padding:0 6px 0 22px;color:#363636;text-shadow:0 1px 0 rgba(255,255,255,0.75);text-decoration:none;line-height:24px;font-size:12px;font-weight:bold;border:1px solid #a2a2a2;background-color:#d4d4d4;background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),color-stop(0.5,#d2d2d2),color-stop(0.5,#bebebe),to(#d2d2d2));background-image:-moz-linear-gradient(-90deg,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);background-image:-webkit-linear-gradient(-90deg,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);background-image:linear-gradient(-90deg,#f5f5f5,#d2d2d2 50%,#bebebe 50%,#d2d2d2);-webkit-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);-moz-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);-o-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);-webkit-border-radius:5px;-moz-border-radius:5px;-o-border-radius:5px;border-radius:5px}.annotator-editor a::after{position:absolute;top:50%;left:5px;display:block;content:"";width:15px;height:15px;margin-top:-7px;background-position:0 -90px}.annotator-editor a:hover,.annotator-editor a:focus,.annotator-editor a.annotator-focus,.annotator-filter .annotator-filter-active label,.annotator-filter .annotator-filter-navigation button:hover{outline:0;border-color:#435aa0;background-color:#3865f9;background-image:-webkit-gradient(linear,left top,left bottom,from(#7691fb),color-stop(0.5,#5075fb),color-stop(0.5,#3865f9),to(#3665fa));background-image:-moz-linear-gradient(-90deg,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);background-image:-webkit-linear-gradient(-90deg,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);background-image:linear-gradient(-90deg,#7691fb,#5075fb 50%,#3865f9 50%,#3665fa);color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.42)}.annotator-editor a:hover::after,.annotator-editor a:focus::after{margin-top:-8px;background-position:0 -105px}.annotator-editor a:active,.annotator-filter .annotator-filter-navigation button:active{border-color:#700c49;background-color:#d12e8e;background-image:-webkit-gradient(linear,left top,left bottom,from(#fc7cca),color-stop(0.5,#e85db2),color-stop(0.5,#d12e8e),to(#ff009c));background-image:-moz-linear-gradient(-90deg,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c);background-image:-webkit-linear-gradient(-90deg,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c);background-image:linear-gradient(-90deg,#fc7cca,#e85db2 50%,#d12e8e 50%,#ff009c)}.annotator-editor a.annotator-save::after{background-position:0 -120px}.annotator-editor a.annotator-save:hover::after,.annotator-editor a.annotator-save:focus::after,.annotator-editor a.annotator-save.annotator-focus::after{margin-top:-8px;background-position:0 -135px}.annotator-editor .annotator-widget::after{background-position:0 -30px}.annotator-editor.annotator-invert-y .annotator-widget .annotator-controls{background-color:#f2f2f2}.annotator-editor.annotator-invert-y .annotator-widget::after{background-position:0 -45px;height:11px}.annotator-resize{position:absolute;top:0;right:0;width:12px;height:12px;background-position:2px -150px}.annotator-invert-x .annotator-resize{right:auto;left:0;background-position:0 -195px}.annotator-invert-y .annotator-resize{top:auto;bottom:0;background-position:2px -165px}.annotator-invert-y.annotator-invert-x .annotator-resize{background-position:0 -180px}.annotator-notice{color:#fff;position:absolute;position:fixed;top:-54px;left:0;width:100%;font-size:14px;line-height:50px;text-align:center;background:black;background:rgba(0,0,0,0.9);border-bottom:4px solid #d4d4d4;-webkit-transition:top .4s ease-out;-moz-transition:top .4s ease-out;-o-transition:top .4s ease-out;transition:top .4s ease-out}.ie6 .annotator-notice{position:absolute}.annotator-notice-success{border-color:#3665f9}.annotator-notice-error{border-color:#ff7e00}.annotator-notice p{margin:0}.annotator-notice a{color:#fff}.annotator-notice-show{top:0}.annotator-tags{margin-bottom:-2px}.annotator-tags .annotator-tag{display:inline-block;padding:0 8px;margin-bottom:2px;line-height:1.6;font-weight:bold;background-color:#e6e6e6;-webkit-border-radius:8px;-moz-border-radius:8px;-o-border-radius:8px;border-radius:8px}.annotator-filter{position:fixed;top:0;right:0;left:0;text-align:left;line-height:0;border:0;border-bottom:1px solid #878787;padding-left:10px;padding-right:10px;-webkit-border-radius:0;-moz-border-radius:0;-o-border-radius:0;border-radius:0;-webkit-box-shadow:inset 0 -1px 0 rgba(255,255,255,0.3);-moz-box-shadow:inset 0 -1px 0 rgba(255,255,255,0.3);-o-box-shadow:inset 0 -1px 0 rgba(255,255,255,0.3);box-shadow:inset 0 -1px 0 rgba(255,255,255,0.3)}.annotator-filter strong{font-size:12px;font-weight:bold;color:#3c3c3c;text-shadow:0 1px 0 rgba(255,255,255,0.7);position:relative;top:-9px}.annotator-filter .annotator-filter-property,.annotator-filter .annotator-filter-navigation{position:relative;display:inline-block;overflow:hidden;line-height:10px;padding:2px 0;margin-right:8px}.annotator-filter .annotator-filter-property label,.annotator-filter .annotator-filter-navigation button{text-align:left;display:block;float:left;line-height:20px;-webkit-border-radius:10px 0 0 10px;-moz-border-radius:10px 0 0 10px;-o-border-radius:10px 0 0 10px;border-radius:10px 0 0 10px}.annotator-filter .annotator-filter-property label{padding-left:8px}.annotator-filter .annotator-filter-property input{display:block;float:right;-webkit-appearance:none;background-color:#fff;border:1px solid #878787;border-left:none;padding:2px 4px;line-height:16px;min-height:16px;font-size:12px;width:150px;color:#333;background-color:#f8f8f8;-webkit-border-radius:0 10px 10px 0;-moz-border-radius:0 10px 10px 0;-o-border-radius:0 10px 10px 0;border-radius:0 10px 10px 0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.2);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.2);-o-box-shadow:inset 0 1px 1px rgba(0,0,0,0.2);box-shadow:inset 0 1px 1px rgba(0,0,0,0.2)}.annotator-filter .annotator-filter-property input:focus{outline:0;background-color:#fff}.annotator-filter .annotator-filter-clear{position:absolute;right:3px;top:6px;border:0;text-indent:-900em;width:15px;height:15px;background-position:0 -90px;opacity:.4}.annotator-filter .annotator-filter-clear:hover,.annotator-filter .annotator-filter-clear:focus{opacity:.8}.annotator-filter .annotator-filter-clear:active{opacity:1}.annotator-filter .annotator-filter-navigation button{border:1px solid #a2a2a2;padding:0;text-indent:-900px;width:20px;min-height:22px;-webkit-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);-moz-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);-o-box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8);box-shadow:inset 0 0 5px rgba(255,255,255,0.2),inset 0 0 1px rgba(255,255,255,0.8)}.annotator-filter .annotator-filter-navigation button,.annotator-filter .annotator-filter-navigation button:hover,.annotator-filter .annotator-filter-navigation button:focus{color:transparent}.annotator-filter .annotator-filter-navigation button::after{position:absolute;top:8px;left:8px;content:"";display:block;width:9px;height:9px;background-position:0 -210px}.annotator-filter .annotator-filter-navigation button:hover::after{background-position:0 -225px}.annotator-filter .annotator-filter-navigation .annotator-filter-next{-webkit-border-radius:0 10px 10px 0;-moz-border-radius:0 10px 10px 0;-o-border-radius:0 10px 10px 0;border-radius:0 10px 10px 0;border-left:none}.annotator-filter .annotator-filter-navigation .annotator-filter-next::after{left:auto;right:7px;background-position:0 -240px}.annotator-filter .annotator-filter-navigation .annotator-filter-next:hover::after{background-position:0 -255px}.annotator-hl-active{background:rgba(255,255,10,0.8)}.annotator-hl-filtered{background-color:transparent} \ No newline at end of file diff --git a/lms/templates/notes.html b/lms/templates/notes.html new file mode 100644 index 0000000000..3fea6faa3e --- /dev/null +++ b/lms/templates/notes.html @@ -0,0 +1,81 @@ +<%namespace name='static' file='static_content.html'/> +<%inherit file="main.html" /> +<%! + from django.core.urlresolvers import reverse +%> + +<%block name="headextra"> + <%static:css group='course'/> + <%static:js group='courseware'/> + + + + +<%block name="js_extra"> + + + +<%include file="/courseware/course_navigation.html" args="active_page='notes'" /> + +
+
+

My Notes

+ % for note in notes: +
+
${note.quote|h}
+
${note.text.replace("\n", "
") | n,h}
+
    + % if note.tags: +
  • Tags: ${note.tags|h}
  • + % endif +
  • Author: ${note.user.username}
  • +
  • Created: ${note.created.strftime('%m/%d/%Y %H:%m')}
  • +
  • Source: ${note.uri|h}
  • +
+
+ % endfor + % if notes is UNDEFINED or len(notes) == 0: +

You do not have any notes.

+ % endif +
+
+ + + + diff --git a/lms/templates/static_htmlbook.html b/lms/templates/static_htmlbook.html index 830ddddca9..8a3c50f680 100644 --- a/lms/templates/static_htmlbook.html +++ b/lms/templates/static_htmlbook.html @@ -26,22 +26,41 @@ // chapters, and it should be in-bounds. chapterToLoad = options.chapterNum; } + var anchorToLoad = null; + if (options.chapters) { + anchorToLoad = options.anchor_id; + } - loadUrl = function htmlViewLoadUrl(url) { + var onComplete = function() {}; + if(options.notesEnabled) { + onComplete = function(url) { + return function() { + $('#viewerContainer').trigger('notes:init', [url]); + } + }; + } + + loadUrl = function htmlViewLoadUrl(url, anchorId) { // clear out previous load, if any: parentElement = document.getElementById('bookpage'); while (parentElement.hasChildNodes()) parentElement.removeChild(parentElement.lastChild); // load new URL in: - $('#bookpage').load(url); - }; + $('#bookpage').load(url, null, onComplete(url)); - loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum) { + // if there is an anchor set, then go to that location: + if (anchorId != null) { + // TODO: add implementation.... + } + + }; + + loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum, anchorId) { if (chapterNum < 1 || chapterNum > chapterUrls.length) { return; } var chapterUrl = chapterUrls[chapterNum-1]; - loadUrl(chapterUrl); + loadUrl(chapterUrl, anchorId); }; // define navigation links for chapters: @@ -54,15 +73,15 @@ }; for (var index = 1; index <= chapterUrls.length; index += 1) { $("#htmlchapter-" + index).click(loadChapterUrlHelper(index)); - } + } } // finally, load the appropriate url/page if (urlToLoad != null) { - loadUrl(urlToLoad); + loadUrl(urlToLoad, anchorToLoad); } else { - loadChapterUrl(chapterToLoad); - } + loadChapterUrl(chapterToLoad, anchorToLoad); + } } })(jQuery); @@ -82,6 +101,14 @@ %if chapter is not None: options.chapterNum = ${chapter}; %endif + %if anchor_id is not UNDEFINED and anchor_id is not None: + options.anchor_id = ${anchor_id}; + %endif + + options.notesEnabled = false; + %if notes_enabled is not UNDEFINED and notes_enabled: + options.notesEnabled = true; + %endif $('#outerContainer').myHTMLViewer(options); }); diff --git a/lms/templates/word_cloud.html b/lms/templates/word_cloud.html new file mode 100644 index 0000000000..7ff90ee6d6 --- /dev/null +++ b/lms/templates/word_cloud.html @@ -0,0 +1,28 @@ +
+ +
+ % for row in range(num_inputs): + + % endfor + +
+ +
+
+ +
+

Your words:

+

Total number of words:

+
+
+ +
diff --git a/lms/urls.py b/lms/urls.py index b00813a40d..2846e091be 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -61,10 +61,12 @@ urlpatterns = ('', # nopep8 url(r'^heartbeat$', include('heartbeat.urls')), + ## + ## Only universities without courses should be included here. If + ## courses exist, the dynamic profile rule below should win. + ## url(r'^(?i)university_profile/WellesleyX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'WellesleyX'}), - url(r'^(?i)university_profile/GeorgetownX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'GeorgetownX'}), url(r'^(?i)university_profile/McGillX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'McGillX'}), url(r'^(?i)university_profile/TorontoX$', 'courseware.views.static_university_profile', @@ -73,8 +75,6 @@ urlpatterns = ('', # nopep8 name="static_university_profile", kwargs={'org_id': 'RiceX'}), url(r'^(?i)university_profile/ANUx$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'ANUx'}), - url(r'^(?i)university_profile/DelftX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'DelftX'}), url(r'^(?i)university_profile/EPFLx$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'EPFLx'}), @@ -283,6 +283,10 @@ if settings.COURSEWARE_ENABLED: url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/peer_grading$', 'open_ended_grading.views.peer_grading', name='peer_grading'), + + url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/notes$', 'notes.views.notes', name='notes'), + url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/notes/', include('notes.urls')), + ) # allow course staff to change to student view of courseware diff --git a/package.json b/package.json index 4ce95d04ce..7fa287018a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,8 @@ { "name": "mitx", "version": "0.1.0", - "dependencies": { "coffee-script": "1.6.x"} -} \ No newline at end of file + "dependencies": { + "coffee-script": "1.6.X", + "phantom-jasmine": "0.1.0" + } +} diff --git a/pre-requirements.txt b/pre-requirements.txt deleted file mode 100644 index d39199a741..0000000000 --- a/pre-requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -# We use `scipy` in our project, which relies on `numpy`. `pip` apparently -# installs packages in a two-step process, where it will first try to build -# all packages, and then try to install all packages. As a result, if we simply -# added these packages to the top of `requirements.txt`, `pip` would try to -# build `scipy` before `numpy` has been installed, and it would fail. By -# separating this out into a `pre-requirements.txt` file, we can make sure -# that `numpy` is built *and* installed before we try to build `scipy`. - -numpy==1.6.2 -distribute>=0.6.28 diff --git a/rakefile b/rakefile index 32d92a0349..cef93e67eb 100644 --- a/rakefile +++ b/rakefile @@ -1,581 +1,12 @@ require 'rake/clean' -require 'tempfile' -require 'net/http' -require 'launchy' -require 'colorize' -require 'erb' -require 'tempfile' +require './rakefiles/helpers.rb' + +Dir['rakefiles/*.rake'].each do |rakefile| + import rakefile +end # Build Constants REPO_ROOT = File.dirname(__FILE__) -BUILD_DIR = File.join(REPO_ROOT, "build") REPORT_DIR = File.join(REPO_ROOT, "reports") -LMS_REPORT_DIR = File.join(REPORT_DIR, "lms") - -# Packaging constants -DEPLOY_DIR = "/opt/wwc" -PACKAGE_NAME = "mitx" -LINK_PATH = "/opt/wwc/mitx" -PKG_VERSION = "0.1" -COMMIT = (ENV["GIT_COMMIT"] || `git rev-parse HEAD`).chomp()[0, 10] -BRANCH = (ENV["GIT_BRANCH"] || `git symbolic-ref -q HEAD`).chomp().gsub('refs/heads/', '').gsub('origin/', '') -BUILD_NUMBER = (ENV["BUILD_NUMBER"] || "dev").chomp() - -# Set up the clean and clobber tasks -CLOBBER.include(BUILD_DIR, REPORT_DIR, 'test_root/*_repo', 'test_root/staticfiles') -CLEAN.include("#{BUILD_DIR}/*.deb", "#{BUILD_DIR}/util") - -def select_executable(*cmds) - cmds.find_all{ |cmd| system("which #{cmd} > /dev/null 2>&1") }[0] || fail("No executables found from #{cmds.join(', ')}") -end - -def django_admin(system, env, command, *args) - django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') - return "#{django_admin} #{command} --traceback --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" -end - -# Runs Process.spawn, and kills the process at the end of the rake process -# Expects the same arguments as Process.spawn -def background_process(*command) - pid = Process.spawn({}, *command, {:pgroup => true}) - - at_exit do - puts "Ending process and children" - pgid = Process.getpgid(pid) - begin - Timeout.timeout(5) do - puts "Terminating process group #{pgid}" - Process.kill(:SIGTERM, -pgid) - puts "Waiting on process group #{pgid}" - Process.wait(-pgid) - puts "Done waiting on process group #{pgid}" - end - rescue Timeout::Error - puts "Killing process group #{pgid}" - Process.kill(:SIGKILL, -pgid) - puts "Waiting on process group #{pgid}" - Process.wait(-pgid) - puts "Done waiting on process group #{pgid}" - end - end -end - -def django_for_jasmine(system, django_reload) - if !django_reload - reload_arg = '--noreload' - end - - port = 10000 + rand(40000) - jasmine_url = "http://localhost:#{port}/_jasmine/" - - background_process(*django_admin(system, 'jasmine', 'runserver', '-v', '0', port.to_s, reload_arg).split(' ')) - - up = false - start_time = Time.now - until up do - if Time.now - start_time > 30 - abort "Timed out waiting for server to start to run jasmine tests" - end - begin - response = Net::HTTP.get_response(URI(jasmine_url)) - puts response.code - up = response.code == '200' - rescue => e - puts e.message - ensure - puts('Waiting server to start') - sleep(0.5) - end - end - yield jasmine_url -end - -def template_jasmine_runner(lib) - coffee_files = Dir["#{lib}/**/js/**/*.coffee", "common/static/coffee/src/**/*.coffee"] - if !coffee_files.empty? - sh("node_modules/.bin/coffee -c #{coffee_files.join(' ')}") - end - phantom_jasmine_path = File.expand_path("common/test/phantom-jasmine") - common_js_root = File.expand_path("common/static/js") - common_coffee_root = File.expand_path("common/static/coffee/src") - - # Get arrays of spec and source files, ordered by how deep they are nested below the library - # (and then alphabetically) and expanded from a relative to an absolute path - spec_glob = File.join("#{lib}", "**", "spec", "**", "*.js") - src_glob = File.join("#{lib}", "**", "src", "**", "*.js") - js_specs = Dir[spec_glob].sort_by {|p| [p.split('/').length, p]} .map {|f| File.expand_path(f)} - js_source = Dir[src_glob].sort_by {|p| [p.split('/').length, p]} .map {|f| File.expand_path(f)} - - template = ERB.new(File.read("#{lib}/jasmine_test_runner.html.erb")) - template_output = "#{lib}/jasmine_test_runner.html" - File.open(template_output, 'w') do |f| - f.write(template.result(binding)) - end - yield File.expand_path(template_output) -end - - -def report_dir_path(dir) - return File.join(REPORT_DIR, dir.to_s) -end - -def compile_assets(watch=false, debug=false) - xmodule_cmd = 'xmodule_assets common/static/xmodule' - if watch - xmodule_cmd = "watchmedo shell-command \ - --patterns='*.js;*.coffee;*.sass;*.scss;*.css' \ - --recursive \ - --command='#{xmodule_cmd}' \ - common/lib/xmodule" - end - coffee_cmd = "node_modules/.bin/coffee #{watch ? '--watch' : ''} --compile */static" - sass_cmd = "sass #{debug ? '--debug-info' : '--style compressed'} " + - "--load-path ./common/static/sass " + - "--require ./common/static/sass/bourbon/lib/bourbon.rb " + - "#{watch ? '--watch' : '--update --force'} */static" - - [xmodule_cmd, coffee_cmd, sass_cmd].each do |cmd| - if watch - background_process(cmd) - else - pid = Process.spawn(cmd) - puts "Waiting for `#{cmd}` to complete (pid #{pid})" - Process.wait(pid) - puts "Completed" - if !$?.exited? || $?.exitstatus != 0 - abort "`#{cmd}` failed" - end - end - end -end task :default => [:test, :pep8, :pylint] - -directory REPORT_DIR - -default_options = { - :lms => '8000', - :cms => '8001', -} - -desc "Install all prerequisites needed for the lms and cms" -task :install_prereqs => [:install_node_prereqs, :install_ruby_prereqs, :install_python_prereqs] - -desc "Install all node prerequisites for the lms and cms" -task :install_node_prereqs do - sh('npm install') -end - -desc "Install all ruby prerequisites for the lms and cms" -task :install_ruby_prereqs do - sh('bundle install') -end - -desc "Install all python prerequisites for the lms and cms" -task :install_python_prereqs do - sh('pip install -r requirements.txt') - # Check for private-requirements.txt: used to install our libs as working dirs, - # or personal-use tools. - if File.file?("private-requirements.txt") - sh('pip install -r private-requirements.txt') - end -end - -task :predjango do - sh("find . -type f -name *.pyc -delete") - sh('pip install -q --no-index -r local-requirements.txt') -end - -task :clean_test_files do - sh("git clean -fqdx test_root") -end - -[:lms, :cms, :common].each do |system| - report_dir = report_dir_path(system) - directory report_dir - - desc "Run pep8 on all #{system} code" - task "pep8_#{system}" => report_dir do - sh("pep8 #{system} | tee #{report_dir}/pep8.report") - end - task :pep8 => "pep8_#{system}" - - desc "Run pylint on all #{system} code" - task "pylint_#{system}" => report_dir do - apps = Dir["#{system}/*.py", "#{system}/djangoapps/*", "#{system}/lib/*"].map do |app| - File.basename(app) - end.select do |app| - app !=~ /.pyc$/ - end.map do |app| - if app =~ /.py$/ - app.gsub('.py', '') - else - app - end - end - - pythonpath_prefix = "PYTHONPATH=#{system}:#{system}/djangoapps:#{system}/lib:common/djangoapps:common/lib" - sh("#{pythonpath_prefix} pylint --rcfile=.pylintrc -f parseable #{apps.join(' ')} | tee #{report_dir}/pylint.report") - end - task :pylint => "pylint_#{system}" - -end - -$failed_tests = 0 - -def run_under_coverage(cmd, root) - cmd0, cmd_rest = cmd.split(" ", 2) - # We use "python -m coverage" so that the proper python will run the importable coverage - # rather than the coverage that OS path finds. - cmd = "python -m coverage run --rcfile=#{root}/.coveragerc `which #{cmd0}` #{cmd_rest}" - return cmd -end - -def run_tests(system, report_dir, stop_on_failure=true) - ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") - dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"] - cmd = django_admin(system, :test, 'test', '--logging-clear-handlers', *dirs.each) - sh(run_under_coverage(cmd, system)) do |ok, res| - if !ok and stop_on_failure - abort "Test failed!" - end - $failed_tests += 1 unless ok - end -end - -TEST_TASK_DIRS = [] - -task :fastlms do - # this is >2 times faster that rake [lms], and does not need web, good for local dev - django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') - sh("#{django_admin} runserver --traceback --settings=lms.envs.dev --pythonpath=.") -end - -[:lms, :cms].each do |system| - report_dir = report_dir_path(system) - - # Per System tasks - desc "Run all django tests on our djangoapps for the #{system}" - task "test_#{system}", [:stop_on_failure] => ["clean_test_files", :predjango, "#{system}:gather_assets:test", "fasttest_#{system}"] - - # Have a way to run the tests without running collectstatic -- useful when debugging without - # messing with static files. - task "fasttest_#{system}", [:stop_on_failure] => [report_dir, :predjango] do |t, args| - args.with_defaults(:stop_on_failure => 'true') - run_tests(system, report_dir, args.stop_on_failure) - end - - task :fasttest => "fasttest_#{system}" - - TEST_TASK_DIRS << system - - desc <<-desc - Start the #{system} locally with the specified environment (defaults to dev). - Other useful environments are devplus (for dev testing with a real local database) - desc - task system, [:env, :options] => [:predjango] do |t, args| - args.with_defaults(:env => 'dev', :options => default_options[system]) - - # Compile all assets first - compile_assets(watch=false, debug=true) - - # Listen for any changes to assets - compile_assets(watch=true, debug=true) - - sh(django_admin(system, args.env, 'runserver', args.options)) - end - - # Per environment tasks - Dir["#{system}/envs/**/*.py"].each do |env_file| - env = env_file.gsub("#{system}/envs/", '').gsub(/\.py/, '').gsub('/', '.') - desc "Attempt to import the settings file #{system}.envs.#{env} and report any errors" - task "#{system}:check_settings:#{env}" => :predjango do - sh("echo 'import #{system}.envs.#{env}' | #{django_admin(system, env, 'shell')}") - end - - desc "Compile coffeescript and sass, and then run collectstatic in the specified environment" - task "#{system}:gather_assets:#{env}" do - compile_assets() - sh("#{django_admin(system, env, 'collectstatic', '--noinput')} > /dev/null") do |ok, status| - if !ok - abort "collectstatic failed!" - end - end - end - end - - desc "Open jasmine tests for #{system} in your default browser" - task "browse_jasmine_#{system}" do - compile_assets() - django_for_jasmine(system, true) do |jasmine_url| - Launchy.open(jasmine_url) - puts "Press ENTER to terminate".red - $stdin.gets - end - end - - desc "Use phantomjs to run jasmine tests for #{system} from the console" - task "phantomjs_jasmine_#{system}" do - compile_assets() - phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' - django_for_jasmine(system, false) do |jasmine_url| - sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") - end - end -end - -desc "Reset the relational database used by django. WARNING: this will delete all of your existing users" -task :resetdb, [:env] do |t, args| - args.with_defaults(:env => 'dev') - sh(django_admin(:lms, args.env, 'syncdb')) - sh(django_admin(:lms, args.env, 'migrate')) -end - -desc "Update the relational database to the latest migration" -task :migrate, [:env] do |t, args| - args.with_defaults(:env => 'dev') - sh(django_admin(:lms, args.env, 'migrate')) -end - -desc "Run tests for the internationalization library" -task :test_i18n do - test = File.join(REPO_ROOT, "i18n", "tests") - sh("nosetests #{test}") -end - -Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| - task_name = "test_#{lib}" - - report_dir = report_dir_path(lib) - - desc "Run tests for common lib #{lib}" - task task_name => report_dir do - ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") - cmd = "nosetests #{lib}" - sh(run_under_coverage(cmd, lib)) do |ok, res| - $failed_tests += 1 unless ok - end - end - TEST_TASK_DIRS << lib - - desc "Run tests for common lib #{lib} (without coverage)" - task "fasttest_#{lib}" do - sh("nosetests #{lib}") - end - - desc "Open jasmine tests for #{lib} in your default browser" - task "browse_jasmine_#{lib}" do - template_jasmine_runner(lib) do |f| - sh("python -m webbrowser -t 'file://#{f}'") - puts "Press ENTER to terminate".red - $stdin.gets - end - end - - desc "Use phantomjs to run jasmine tests for #{lib} from the console" - task "phantomjs_jasmine_#{lib}" do - phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' - template_jasmine_runner(lib) do |f| - sh("#{phantomjs} common/test/phantom-jasmine/lib/run_jasmine_test.coffee #{f}") - end - end -end - -task :report_dirs - -TEST_TASK_DIRS.each do |dir| - report_dir = report_dir_path(dir) - directory report_dir - task :report_dirs => [REPORT_DIR, report_dir] -end - -task :test do - TEST_TASK_DIRS.each do |dir| - Rake::Task["test_#{dir}"].invoke(false) - end - - if $failed_tests > 0 - abort "Tests failed!" - end -end - -namespace :coverage do - desc "Build the html coverage reports" - task :html => :report_dirs do - TEST_TASK_DIRS.each do |dir| - report_dir = report_dir_path(dir) - - if !File.file?("#{report_dir}/.coverage") - next - end - - sh("coverage html --rcfile=#{dir}/.coveragerc") - end - end - - desc "Build the xml coverage reports" - task :xml => :report_dirs do - TEST_TASK_DIRS.each do |dir| - report_dir = report_dir_path(dir) - - if !File.file?("#{report_dir}/.coverage") - next - end - # Why doesn't the rcfile control the xml output file properly?? - sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc") - end - end -end - -task :runserver => :lms - -desc "Run django-admin against the specified system and environment" -task "django-admin", [:action, :system, :env, :options] do |t, args| - args.with_defaults(:env => 'dev', :system => 'lms', :options => '') - sh(django_admin(args.system, args.env, args.action, args.options)) -end - -desc "Set the staff bit for a user" -task :set_staff, [:user, :system, :env] do |t, args| - args.with_defaults(:env => 'dev', :system => 'lms', :options => '') - sh(django_admin(args.system, args.env, 'set_staff', args.user)) -end - -namespace :cms do - desc "Clone existing MongoDB based course" - task :clone do - - if ENV['SOURCE_LOC'] and ENV['DEST_LOC'] - sh(django_admin(:cms, :dev, :clone, ENV['SOURCE_LOC'], ENV['DEST_LOC'])) - else - raise "You must pass in a SOURCE_LOC and DEST_LOC parameters" - end - end - - desc "Delete existing MongoDB based course" - task :delete_course do - - if ENV['LOC'] and ENV['COMMIT'] - sh(django_admin(:cms, :dev, :delete_course, ENV['LOC'], ENV['COMMIT'])) - elsif ENV['LOC'] - sh(django_admin(:cms, :dev, :delete_course, ENV['LOC'])) - else - raise "You must pass in a LOC parameter" - end - end - - desc "Import course data within the given DATA_DIR variable" - task :import do - if ENV['DATA_DIR'] and ENV['COURSE_DIR'] - sh(django_admin(:cms, :dev, :import, ENV['DATA_DIR'], ENV['COURSE_DIR'])) - elsif ENV['DATA_DIR'] - sh(django_admin(:cms, :dev, :import, ENV['DATA_DIR'])) - else - raise "Please specify a DATA_DIR variable that point to your data directory.\n" + - "Example: \`rake cms:import DATA_DIR=../data\`" - end - end - - desc "Imports all the templates from the code pack" - task :update_templates do - sh(django_admin(:cms, :dev, :update_templates)) - end - - desc "Import course data within the given DATA_DIR variable" - task :xlint do - if ENV['DATA_DIR'] and ENV['COURSE_DIR'] - sh(django_admin(:cms, :dev, :xlint, ENV['DATA_DIR'], ENV['COURSE_DIR'])) - elsif ENV['DATA_DIR'] - sh(django_admin(:cms, :dev, :xlint, ENV['DATA_DIR'])) - else - raise "Please specify a DATA_DIR variable that point to your data directory.\n" + - "Example: \`rake cms:import DATA_DIR=../data\`" - end - end - - desc "Export course data to a tar.gz file" - task :export do - if ENV['COURSE_ID'] and ENV['OUTPUT_PATH'] - sh(django_admin(:cms, :dev, :export, ENV['COURSE_ID'], ENV['OUTPUT_PATH'])) - else - raise "Please specify a COURSE_ID and OUTPUT_PATH.\n" + - "Example: \`rake cms:export COURSE_ID=MITx/12345/name OUTPUT_PATH=foo.tar.gz\`" - end - end -end - -desc "Build a properties file used to trigger autodeploy builds" -task :autodeploy_properties do - File.open("autodeploy.properties", "w") do |file| - file.puts("UPSTREAM_NOOP=false") - file.puts("UPSTREAM_BRANCH=#{BRANCH}") - file.puts("UPSTREAM_JOB=#{PACKAGE_NAME}") - file.puts("UPSTREAM_REVISION=#{COMMIT}") - end -end - -# --- Internationalization tasks - -desc "Extract localizable strings from sources" -task :extract_dev_strings do - sh(File.join(REPO_ROOT, "i18n", "extract.py")) -end - -desc "Compile localizable strings from sources. With optional flag 'extract', will extract strings first." -task :generate_i18n do - if ARGV.last.downcase == 'extract' - Rake::Task["extract_dev_strings"].execute - end - sh(File.join(REPO_ROOT, "i18n", "generate.py")) -end - -desc "Simulate international translation by generating dummy strings corresponding to source strings." -task :dummy_i18n do - source_files = Dir["#{REPO_ROOT}/conf/locale/en/LC_MESSAGES/*.po"] - dummy_locale = 'fr' - cmd = File.join(REPO_ROOT, "i18n", "make_dummy.py") - for file in source_files do - sh("#{cmd} #{file} #{dummy_locale}") - end -end - -# --- Develop and public documentation --- -desc "Invoke sphinx 'make build' to generate docs." -task :builddocs, [:options] do |t, args| - if args.options == 'pub' - path = "doc/public" - else - path = "docs" - end - - Dir.chdir(path) do - sh('make html') - end -end - -desc "Show docs in browser (mac and ubuntu)." -task :showdocs, [:options] do |t, args| - if args.options == 'pub' - path = "doc/public" - else - path = "docs" - end - - Dir.chdir("#{path}/build/html") do - if RUBY_PLATFORM.include? 'darwin' # mac os - sh('open index.html') - elsif RUBY_PLATFORM.include? 'linux' # make more ubuntu specific? - sh('sensible-browser index.html') # ubuntu - else - raise "\nUndefined how to run browser on your machine. -Please use 'rake builddocs' and then manually open -'mitx/#{path}/build/html/index.html." - end - end -end - -desc "Build docs and show them in browser" -task :doc, [:options] => :builddocs do |t, args| - Rake::Task["showdocs"].invoke(args.options) -end -# --- Develop and public documentation --- diff --git a/rakefiles/assets.rake b/rakefiles/assets.rake new file mode 100644 index 0000000000..0954dc9815 --- /dev/null +++ b/rakefiles/assets.rake @@ -0,0 +1,100 @@ + +def xmodule_cmd(watch=false, debug=false) + xmodule_cmd = 'xmodule_assets common/static/xmodule' + if watch + "watchmedo shell-command " + + "--patterns='*.js;*.coffee;*.sass;*.scss;*.css' " + + "--recursive " + + "--command='#{xmodule_cmd}' " + + "common/lib/xmodule" + else + xmodule_cmd + end +end + +def coffee_cmd(watch=false, debug=false) + "node_modules/.bin/coffee #{watch ? '--watch' : ''} --compile */static" +end + +def sass_cmd(watch=false, debug=false) + "sass #{debug ? '--debug-info' : '--style compressed'} " + + "--load-path ./common/static/sass " + + "--require ./common/static/sass/bourbon/lib/bourbon.rb " + + "#{watch ? '--watch' : '--update'} */static" +end + +desc "Compile all assets" +multitask :assets => 'assets:all' + +namespace :assets do + + desc "Compile all assets in debug mode" + multitask :debug + + desc "Watch all assets for changes and automatically recompile" + task :watch => 'assets:_watch' do + puts "Press ENTER to terminate".red + $stdin.gets + end + + {:xmodule => :install_python_prereqs, + :coffee => :install_node_prereqs, + :sass => :install_ruby_prereqs}.each_pair do |asset_type, prereq_task| + desc "Compile all #{asset_type} assets" + task asset_type => prereq_task do + cmd = send(asset_type.to_s + "_cmd", watch=false, debug=false) + sh(cmd) + end + + multitask :all => asset_type + multitask :debug => "assets:#{asset_type}:debug" + multitask :_watch => "assets:#{asset_type}:_watch" + + namespace asset_type do + desc "Compile all #{asset_type} assets in debug mode" + task :debug => prereq_task do + cmd = send(asset_type.to_s + "_cmd", watch=false, debug=true) + sh(cmd) + end + + desc "Watch all #{asset_type} assets and compile on change" + task :watch => "assets:#{asset_type}:_watch" do + puts "Press ENTER to terminate".red + $stdin.gets + end + + task :_watch => prereq_task do + cmd = send(asset_type.to_s + "_cmd", watch=true, debug=true) + background_process(cmd) + end + end + end + + + multitask :sass => 'assets:xmodule' + namespace :sass do + # In watch mode, sass doesn't immediately compile out of date files, + # so force a recompile first + task :_watch => 'assets:sass:debug' + multitask :debug => 'assets:xmodule:debug' + end + + multitask :coffee => 'assets:xmodule' + namespace :coffee do + multitask :debug => 'assets:xmodule:debug' + end +end + +[:lms, :cms].each do |system| + # Per environment tasks + environments(system).each do |env| + desc "Compile coffeescript and sass, and then run collectstatic in the specified environment" + task "#{system}:gather_assets:#{env}" => :assets do + sh("#{django_admin(system, env, 'collectstatic', '--noinput')} > /dev/null") do |ok, status| + if !ok + abort "collectstatic failed!" + end + end + end + end +end diff --git a/rakefiles/deploy.rake b/rakefiles/deploy.rake new file mode 100644 index 0000000000..1d0a1b2c4f --- /dev/null +++ b/rakefiles/deploy.rake @@ -0,0 +1,15 @@ + +# Packaging constants +COMMIT = (ENV["GIT_COMMIT"] || `git rev-parse HEAD`).chomp()[0, 10] +PACKAGE_NAME = "mitx" +BRANCH = (ENV["GIT_BRANCH"] || `git symbolic-ref -q HEAD`).chomp().gsub('refs/heads/', '').gsub('origin/', '') + +desc "Build a properties file used to trigger autodeploy builds" +task :autodeploy_properties do + File.open("autodeploy.properties", "w") do |file| + file.puts("UPSTREAM_NOOP=false") + file.puts("UPSTREAM_BRANCH=#{BRANCH}") + file.puts("UPSTREAM_JOB=#{PACKAGE_NAME}") + file.puts("UPSTREAM_REVISION=#{COMMIT}") + end +end \ No newline at end of file diff --git a/rakefiles/django.rake b/rakefiles/django.rake new file mode 100644 index 0000000000..1a021c71b8 --- /dev/null +++ b/rakefiles/django.rake @@ -0,0 +1,125 @@ +default_options = { + :lms => '8000', + :cms => '8001', +} + +task :predjango => :install_python_prereqs do + sh("find . -type f -name *.pyc -delete") + sh('pip install -q --no-index -r requirements/edx/local.txt') +end + + +task :fastlms do + # this is >2 times faster that rake [lms], and does not need web, good for local dev + django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') + sh("#{django_admin} runserver --traceback --settings=lms.envs.dev --pythonpath=.") +end + +[:lms, :cms].each do |system| + desc <<-desc + Start the #{system} locally with the specified environment (defaults to dev). + Other useful environments are devplus (for dev testing with a real local database) + desc + task system, [:env, :options] => [:install_prereqs, 'assets:_watch', :predjango] do |t, args| + args.with_defaults(:env => 'dev', :options => default_options[system]) + sh(django_admin(system, args.env, 'runserver', args.options)) + end + + # Per environment tasks + environments(system).each do |env| + desc "Attempt to import the settings file #{system}.envs.#{env} and report any errors" + task "#{system}:check_settings:#{env}" => :predjango do + sh("echo 'import #{system}.envs.#{env}' | #{django_admin(system, env, 'shell')}") + end + end +end + +desc "Reset the relational database used by django. WARNING: this will delete all of your existing users" +task :resetdb, [:env] do |t, args| + args.with_defaults(:env => 'dev') + sh(django_admin(:lms, args.env, 'syncdb')) + sh(django_admin(:lms, args.env, 'migrate')) +end + +desc "Update the relational database to the latest migration" +task :migrate, [:env] do |t, args| + args.with_defaults(:env => 'dev') + sh(django_admin(:lms, args.env, 'migrate')) +end + +task :runserver => :lms + +desc "Run django-admin against the specified system and environment" +task "django-admin", [:action, :system, :env, :options] do |t, args| + args.with_defaults(:env => 'dev', :system => 'lms', :options => '') + sh(django_admin(args.system, args.env, args.action, args.options)) +end + +desc "Set the staff bit for a user" +task :set_staff, [:user, :system, :env] do |t, args| + args.with_defaults(:env => 'dev', :system => 'lms', :options => '') + sh(django_admin(args.system, args.env, 'set_staff', args.user)) +end + +namespace :cms do + desc "Clone existing MongoDB based course" + task :clone do + + if ENV['SOURCE_LOC'] and ENV['DEST_LOC'] + sh(django_admin(:cms, :dev, :clone, ENV['SOURCE_LOC'], ENV['DEST_LOC'])) + else + raise "You must pass in a SOURCE_LOC and DEST_LOC parameters" + end + end + + desc "Delete existing MongoDB based course" + task :delete_course do + + if ENV['LOC'] and ENV['COMMIT'] + sh(django_admin(:cms, :dev, :delete_course, ENV['LOC'], ENV['COMMIT'])) + elsif ENV['LOC'] + sh(django_admin(:cms, :dev, :delete_course, ENV['LOC'])) + else + raise "You must pass in a LOC parameter" + end + end + + desc "Import course data within the given DATA_DIR variable" + task :import do + if ENV['DATA_DIR'] and ENV['COURSE_DIR'] + sh(django_admin(:cms, :dev, :import, ENV['DATA_DIR'], ENV['COURSE_DIR'])) + elsif ENV['DATA_DIR'] + sh(django_admin(:cms, :dev, :import, ENV['DATA_DIR'])) + else + raise "Please specify a DATA_DIR variable that point to your data directory.\n" + + "Example: \`rake cms:import DATA_DIR=../data\`" + end + end + + desc "Imports all the templates from the code pack" + task :update_templates do + sh(django_admin(:cms, :dev, :update_templates)) + end + + desc "Import course data within the given DATA_DIR variable" + task :xlint do + if ENV['DATA_DIR'] and ENV['COURSE_DIR'] + sh(django_admin(:cms, :dev, :xlint, ENV['DATA_DIR'], ENV['COURSE_DIR'])) + elsif ENV['DATA_DIR'] + sh(django_admin(:cms, :dev, :xlint, ENV['DATA_DIR'])) + else + raise "Please specify a DATA_DIR variable that point to your data directory.\n" + + "Example: \`rake cms:import DATA_DIR=../data\`" + end + end + + desc "Export course data to a tar.gz file" + task :export do + if ENV['COURSE_ID'] and ENV['OUTPUT_PATH'] + sh(django_admin(:cms, :dev, :export, ENV['COURSE_ID'], ENV['OUTPUT_PATH'])) + else + raise "Please specify a COURSE_ID and OUTPUT_PATH.\n" + + "Example: \`rake cms:export COURSE_ID=MITx/12345/name OUTPUT_PATH=foo.tar.gz\`" + end + end +end diff --git a/rakefiles/docs.rake b/rakefiles/docs.rake new file mode 100644 index 0000000000..f10fc80d59 --- /dev/null +++ b/rakefiles/docs.rake @@ -0,0 +1,34 @@ +require 'launchy' + +# --- Develop and public documentation --- +desc "Invoke sphinx 'make build' to generate docs." +task :builddocs, [:options] do |t, args| + if args.options == 'pub' + path = "doc/public" + else + path = "docs" + end + + Dir.chdir(path) do + sh('make html') + end +end + +desc "Show docs in browser (mac and ubuntu)." +task :showdocs, [:options] do |t, args| + if args.options == 'pub' + path = "doc/public" + else + path = "docs" + end + + Dir.chdir("#{path}/build/html") do + Launchy.open('index.html') + end +end + +desc "Build docs and show them in browser" +task :doc, [:options] => :builddocs do |t, args| + Rake::Task["showdocs"].invoke(args.options) +end +# --- Develop and public documentation --- diff --git a/rakefiles/helpers.rb b/rakefiles/helpers.rb new file mode 100644 index 0000000000..be5929d805 --- /dev/null +++ b/rakefiles/helpers.rb @@ -0,0 +1,70 @@ +require 'digest/md5' + + +def select_executable(*cmds) + cmds.find_all{ |cmd| system("which #{cmd} > /dev/null 2>&1") }[0] || fail("No executables found from #{cmds.join(', ')}") +end + +def django_admin(system, env, command, *args) + django_admin = ENV['DJANGO_ADMIN_PATH'] || select_executable('django-admin.py', 'django-admin') + return "#{django_admin} #{command} --traceback --settings=#{system}.envs.#{env} --pythonpath=. #{args.join(' ')}" +end + +def report_dir_path(dir) + return File.join(REPORT_DIR, dir.to_s) +end + +def when_changed(*files) + Rake::Task[PREREQS_MD5_DIR].invoke + cache_file = File.join(PREREQS_MD5_DIR, files.join('-').gsub(/\W+/, '-')) + '.md5' + digest = Digest::MD5.new() + Dir[*files].select{|file| File.file?(file)}.each do |file| + digest.file(file) + end + if !File.exists?(cache_file) or digest.hexdigest != File.read(cache_file) + yield + File.write(cache_file, digest.hexdigest) + end +end + +# Runs Process.spawn, and kills the process at the end of the rake process +# Expects the same arguments as Process.spawn +def background_process(*command) + pid = Process.spawn({}, *command, {:pgroup => true}) + + at_exit do + puts "Ending process and children" + pgid = Process.getpgid(pid) + begin + Timeout.timeout(5) do + puts "Interrupting process group #{pgid}" + Process.kill(:SIGINT, -pgid) + puts "Waiting on process group #{pgid}" + Process.wait(-pgid) + puts "Done waiting on process group #{pgid}" + end + rescue Timeout::Error + begin + Timeout.timeout(5) do + puts "Terminating process group #{pgid}" + Process.kill(:SIGTERM, -pgid) + puts "Waiting on process group #{pgid}" + Process.wait(-pgid) + puts "Done waiting on process group #{pgid}" + end + rescue Timeout::Error + puts "Killing process group #{pgid}" + Process.kill(:SIGKILL, -pgid) + puts "Waiting on process group #{pgid}" + Process.wait(-pgid) + puts "Done waiting on process group #{pgid}" + end + end + end +end + +def environments(system) + Dir["#{system}/envs/**/*.py"].select{|file| ! (/__init__.py$/ =~ file)}.map do |env_file| + env_file.gsub("#{system}/envs/", '').gsub(/\.py/, '').gsub('/', '.') + end +end diff --git a/rakefiles/i18n.rake b/rakefiles/i18n.rake new file mode 100644 index 0000000000..e30c119e2e --- /dev/null +++ b/rakefiles/i18n.rake @@ -0,0 +1,73 @@ +# --- Internationalization tasks + +namespace :i18n do + + desc "Extract localizable strings from sources" + task :extract => "i18n:validate:gettext" do + sh(File.join(REPO_ROOT, "i18n", "extract.py")) + end + + desc "Compile localizable strings from sources. With optional flag 'extract', will extract strings first." + task :generate => "i18n:validate:gettext" do + if ARGV.last.downcase == 'extract' + Rake::Task["i18n:extract"].execute + end + sh(File.join(REPO_ROOT, "i18n", "generate.py")) + end + + desc "Simulate international translation by generating dummy strings corresponding to source strings." + task :dummy do + source_files = Dir["#{REPO_ROOT}/conf/locale/en/LC_MESSAGES/*.po"] + dummy_locale = 'fr' + cmd = File.join(REPO_ROOT, "i18n", "make_dummy.py") + for file in source_files do + sh("#{cmd} #{file} #{dummy_locale}") + end + end + + namespace :validate do + + desc "Make sure GNU gettext utilities are available" + task :gettext do + begin + select_executable('xgettext') + rescue + msg = "Cannot locate GNU gettext utilities, which are required by django for internationalization.\n" + msg += "(see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files)\n" + msg += "Try downloading them from http://www.gnu.org/software/gettext/" + abort(msg.red) + end + end + + desc "Make sure config file with username/password exists" + task :transifex_config do + config_file = "#{Dir.home}/.transifexrc" + if !File.file?(config_file) or File.size(config_file)==0 + msg ="Cannot connect to Transifex, config file is missing or empty: #{config_file}\n" + msg += "See http://help.transifex.com/features/client/#transifexrc" + abort(msg.red) + end + end + end + + namespace :transifex do + desc "Push source strings to Transifex for translation" + task :push => "i18n:validate:transifex_config" do + cmd = File.join(REPO_ROOT, "i18n", "transifex.py") + sh("#{cmd} push") + end + + desc "Pull translated strings from Transifex" + task :pull => "i18n:validate:transifex_config" do + cmd = File.join(REPO_ROOT, "i18n", "transifex.py") + sh("#{cmd} pull") + end + end + + desc "Run tests for the internationalization library" + task :test => "i18n:validate:gettext" do + test = File.join(REPO_ROOT, "i18n", "tests") + sh("nosetests #{test}") + end + +end diff --git a/rakefiles/jasmine.rake b/rakefiles/jasmine.rake new file mode 100644 index 0000000000..d9b3bee427 --- /dev/null +++ b/rakefiles/jasmine.rake @@ -0,0 +1,97 @@ +require 'colorize' +require 'erb' +require 'launchy' +require 'net/http' + + +def django_for_jasmine(system, django_reload) + if !django_reload + reload_arg = '--noreload' + end + + port = 10000 + rand(40000) + jasmine_url = "http://localhost:#{port}/_jasmine/" + + background_process(*django_admin(system, 'jasmine', 'runserver', '-v', '0', port.to_s, reload_arg).split(' ')) + + up = false + start_time = Time.now + until up do + if Time.now - start_time > 30 + abort "Timed out waiting for server to start to run jasmine tests" + end + begin + response = Net::HTTP.get_response(URI(jasmine_url)) + puts response.code + up = response.code == '200' + rescue => e + puts e.message + ensure + puts('Waiting server to start') + sleep(0.5) + end + end + yield jasmine_url +end + +def template_jasmine_runner(lib) + coffee_files = Dir["#{lib}/**/js/**/*.coffee", "common/static/coffee/src/**/*.coffee"] + if !coffee_files.empty? + sh("node_modules/.bin/coffee -c #{coffee_files.join(' ')}") + end + phantom_jasmine_path = File.expand_path("node_modules/phantom-jasmine") + common_js_root = File.expand_path("common/static/js") + common_coffee_root = File.expand_path("common/static/coffee/src") + + # Get arrays of spec and source files, ordered by how deep they are nested below the library + # (and then alphabetically) and expanded from a relative to an absolute path + spec_glob = File.join("#{lib}", "**", "spec", "**", "*.js") + src_glob = File.join("#{lib}", "**", "src", "**", "*.js") + js_specs = Dir[spec_glob].sort_by {|p| [p.split('/').length, p]} .map {|f| File.expand_path(f)} + js_source = Dir[src_glob].sort_by {|p| [p.split('/').length, p]} .map {|f| File.expand_path(f)} + + template = ERB.new(File.read("#{lib}/jasmine_test_runner.html.erb")) + template_output = "#{lib}/jasmine_test_runner.html" + File.open(template_output, 'w') do |f| + f.write(template.result(binding)) + end + yield File.expand_path(template_output) +end + +[:lms, :cms].each do |system| + desc "Open jasmine tests for #{system} in your default browser" + task "browse_jasmine_#{system}" => :assets do + django_for_jasmine(system, true) do |jasmine_url| + Launchy.open(jasmine_url) + puts "Press ENTER to terminate".red + $stdin.gets + end + end + + desc "Use phantomjs to run jasmine tests for #{system} from the console" + task "phantomjs_jasmine_#{system}" => :assets do + phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' + django_for_jasmine(system, false) do |jasmine_url| + sh("#{phantomjs} node_modules/phantom-jasmine/lib/run_jasmine_test.coffee #{jasmine_url}") + end + end +end + +Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| + desc "Open jasmine tests for #{lib} in your default browser" + task "browse_jasmine_#{lib}" do + template_jasmine_runner(lib) do |f| + sh("python -m webbrowser -t 'file://#{f}'") + puts "Press ENTER to terminate".red + $stdin.gets + end + end + + desc "Use phantomjs to run jasmine tests for #{lib} from the console" + task "phantomjs_jasmine_#{lib}" do + phantomjs = ENV['PHANTOMJS_PATH'] || 'phantomjs' + template_jasmine_runner(lib) do |f| + sh("#{phantomjs} node_modules/phantom-jasmine/lib/run_jasmine_test.coffee #{f}") + end + end +end diff --git a/rakefiles/prereqs.rake b/rakefiles/prereqs.rake new file mode 100644 index 0000000000..9a2d7ccd17 --- /dev/null +++ b/rakefiles/prereqs.rake @@ -0,0 +1,39 @@ +require './rakefiles/helpers.rb' + + +PREREQS_MD5_DIR = ENV["PREREQ_CACHE_DIR"] || File.join(REPO_ROOT, '.prereqs_cache') + +CLOBBER.include(PREREQS_MD5_DIR) + +directory PREREQS_MD5_DIR + +desc "Install all prerequisites needed for the lms and cms" +task :install_prereqs => [:install_node_prereqs, :install_ruby_prereqs, :install_python_prereqs] + +desc "Install all node prerequisites for the lms and cms" +task :install_node_prereqs => "ws:migrate" do + when_changed('package.json') do + sh('npm install') + end unless ENV['NO_PREREQ_INSTALL'] +end + +desc "Install all ruby prerequisites for the lms and cms" +task :install_ruby_prereqs => "ws:migrate" do + when_changed('Gemfile') do + sh('bundle install') + end unless ENV['NO_PREREQ_INSTALL'] +end + +desc "Install all python prerequisites for the lms and cms" +task :install_python_prereqs => "ws:migrate" do + when_changed('requirements/**') do + ENV['PIP_DOWNLOAD_CACHE'] ||= '.pip_download_cache' + sh('pip install --exists-action w -r requirements/edx/base.txt') + sh('pip install --exists-action w -r requirements/edx/post.txt') + # Check for private-requirements.txt: used to install our libs as working dirs, + # or personal-use tools. + if File.file?("requirements/private.txt") + sh('pip install -r requirements/private.txt') + end + end unless ENV['NO_PREREQ_INSTALL'] +end diff --git a/rakefiles/quality.rake b/rakefiles/quality.rake new file mode 100644 index 0000000000..00ce627ac5 --- /dev/null +++ b/rakefiles/quality.rake @@ -0,0 +1,31 @@ + +[:lms, :cms, :common].each do |system| + report_dir = report_dir_path(system) + directory report_dir + + desc "Run pep8 on all #{system} code" + task "pep8_#{system}" => [report_dir, :install_python_prereqs] do + sh("pep8 #{system} | tee #{report_dir}/pep8.report") + end + task :pep8 => "pep8_#{system}" + + desc "Run pylint on all #{system} code" + task "pylint_#{system}" => [report_dir, :install_python_prereqs] do + apps = Dir["#{system}/*.py", "#{system}/djangoapps/*", "#{system}/lib/*"].map do |app| + File.basename(app) + end.select do |app| + app !=~ /.pyc$/ + end.map do |app| + if app =~ /.py$/ + app.gsub('.py', '') + else + app + end + end + + pythonpath_prefix = "PYTHONPATH=#{system}:#{system}/djangoapps:#{system}/lib:common/djangoapps:common/lib" + sh("#{pythonpath_prefix} pylint --rcfile=.pylintrc -f parseable #{apps.join(' ')} | tee #{report_dir}/pylint.report") + end + task :pylint => "pylint_#{system}" + +end \ No newline at end of file diff --git a/rakefiles/tests.rake b/rakefiles/tests.rake new file mode 100644 index 0000000000..ebe8ea6375 --- /dev/null +++ b/rakefiles/tests.rake @@ -0,0 +1,137 @@ + +# Set up the clean and clobber tasks +CLOBBER.include(REPORT_DIR, 'test_root/*_repo', 'test_root/staticfiles') + +$failed_tests = 0 + +def run_under_coverage(cmd, root) + cmd0, cmd_rest = cmd.split(" ", 2) + # We use "python -m coverage" so that the proper python will run the importable coverage + # rather than the coverage that OS path finds. + cmd = "python -m coverage run --rcfile=#{root}/.coveragerc `which #{cmd0}` #{cmd_rest}" + return cmd +end + +def run_tests(system, report_dir, stop_on_failure=true) + ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") + dirs = Dir["common/djangoapps/*"] + Dir["#{system}/djangoapps/*"] + cmd = django_admin(system, :test, 'test', '--logging-clear-handlers', *dirs.each) + sh(run_under_coverage(cmd, system)) do |ok, res| + if !ok and stop_on_failure + abort "Test failed!" + end + $failed_tests += 1 unless ok + end +end + +def run_acceptance_tests(system, report_dir, harvest_args) + sh(django_admin(system, 'acceptance', 'syncdb', '--noinput')) + sh(django_admin(system, 'acceptance', 'migrate', '--noinput')) + sh(django_admin(system, 'acceptance', 'harvest', '--debug-mode', '--tag -skip', harvest_args)) +end + + +directory REPORT_DIR + +task :clean_test_files do + sh("git clean -fqdx test_root") +end + +TEST_TASK_DIRS = [] + +[:lms, :cms].each do |system| + report_dir = report_dir_path(system) + + # Per System tasks + desc "Run all django tests on our djangoapps for the #{system}" + task "test_#{system}", [:stop_on_failure] => ["clean_test_files", :predjango, "#{system}:gather_assets:test", "fasttest_#{system}"] + + # Have a way to run the tests without running collectstatic -- useful when debugging without + # messing with static files. + task "fasttest_#{system}", [:stop_on_failure] => [report_dir, :install_prereqs, :predjango] do |t, args| + args.with_defaults(:stop_on_failure => 'true') + run_tests(system, report_dir, args.stop_on_failure) + end + + # Run acceptance tests + desc "Run acceptance tests" + task "test_acceptance_#{system}", [:harvest_args] => ["#{system}:gather_assets:acceptance", "fasttest_acceptance_#{system}"] + + desc "Run acceptance tests without collectstatic" + task "fasttest_acceptance_#{system}", [:harvest_args] => ["clean_test_files", :predjango, report_dir] do |t, args| + args.with_defaults(:harvest_args => '') + run_acceptance_tests(system, report_dir, args.harvest_args) + end + + + task :fasttest => "fasttest_#{system}" + + TEST_TASK_DIRS << system +end + +Dir["common/lib/*"].select{|lib| File.directory?(lib)}.each do |lib| + task_name = "test_#{lib}" + + report_dir = report_dir_path(lib) + + desc "Run tests for common lib #{lib}" + task task_name => report_dir do + ENV['NOSE_XUNIT_FILE'] = File.join(report_dir, "nosetests.xml") + cmd = "nosetests #{lib}" + sh(run_under_coverage(cmd, lib)) do |ok, res| + $failed_tests += 1 unless ok + end + end + TEST_TASK_DIRS << lib + + desc "Run tests for common lib #{lib} (without coverage)" + task "fasttest_#{lib}" do + sh("nosetests #{lib}") + end +end + +task :report_dirs + +TEST_TASK_DIRS.each do |dir| + report_dir = report_dir_path(dir) + directory report_dir + task :report_dirs => [REPORT_DIR, report_dir] +end + +task :test do + TEST_TASK_DIRS.each do |dir| + Rake::Task["test_#{dir}"].invoke(false) + end + + if $failed_tests > 0 + abort "Tests failed!" + end +end + +namespace :coverage do + desc "Build the html coverage reports" + task :html => :report_dirs do + TEST_TASK_DIRS.each do |dir| + report_dir = report_dir_path(dir) + + if !File.file?("#{report_dir}/.coverage") + next + end + + sh("coverage html --rcfile=#{dir}/.coveragerc") + end + end + + desc "Build the xml coverage reports" + task :xml => :report_dirs do + TEST_TASK_DIRS.each do |dir| + report_dir = report_dir_path(dir) + + if !File.file?("#{report_dir}/.coverage") + next + end + # Why doesn't the rcfile control the xml output file properly?? + sh("coverage xml -o #{report_dir}/coverage.xml --rcfile=#{dir}/.coveragerc") + end + end +end diff --git a/rakefiles/workspace.rake b/rakefiles/workspace.rake new file mode 100644 index 0000000000..c705899f58 --- /dev/null +++ b/rakefiles/workspace.rake @@ -0,0 +1,16 @@ +MIGRATION_MARKER_DIR = File.join(REPO_ROOT, '.ws_migrations_complete') +SKIP_MIGRATIONS = ENV['SKIP_WS_MIGRATIONS'] || false + +directory MIGRATION_MARKER_DIR + +namespace :ws do + task :migrate => MIGRATION_MARKER_DIR do + Dir['ws_migrations/*'].select{|m| File.executable?(m)}.each do |migration| + completion_file = File.join(MIGRATION_MARKER_DIR, File.basename(migration)) + if ! File.exist?(completion_file) + sh(migration) + File.write(completion_file, "") + end + end unless SKIP_MIGRATIONS + end +end \ No newline at end of file diff --git a/repo-requirements.txt b/repo-requirements.txt deleted file mode 100644 index aa503e9779..0000000000 --- a/repo-requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ --r github-requirements.txt --r local-requirements.txt \ No newline at end of file diff --git a/requirements.txt b/requirements/edx/base.txt similarity index 92% rename from requirements.txt rename to requirements/edx/base.txt index d3fdd46b81..f6cc250587 100644 --- a/requirements.txt +++ b/requirements/edx/base.txt @@ -1,7 +1,9 @@ --r repo-requirements.txt +-r repo.txt + beautifulsoup4==4.1.3 beautifulsoup==3.2.1 boto==2.6.0 +distribute==0.6.28 django-celery==3.0.11 django-countries==1.5 django-followit==0.0.3 @@ -21,11 +23,9 @@ feedparser==5.1.3 fs==0.4.0 GitPython==0.3.2.RC1 glob2==0.3 -http://sympy.googlecode.com/files/sympy-0.7.1.tar.gz lxml==3.0.1 mako==0.7.3 Markdown==2.2.1 -MySQL-python==1.2.4c1 networkx==1.7 nltk==2.0.4 numpy==1.6.2 @@ -33,6 +33,7 @@ paramiko==1.9.0 path.py==3.0.1 Pillow==1.7.8 pip +polib==1.0.3 pygments==1.5 pygraphviz==1.1 pymongo==2.4.1 @@ -41,10 +42,10 @@ python-openid==2.2.5 pytz==2012h PyYAML==3.10 requests==0.14.2 -scipy==0.11.0 Shapely==1.2.16 sorl-thumbnail==11.12 South==0.7.6 +sympy==0.7.1 xmltodict==0.4.1 # Used for debugging diff --git a/github-requirements.txt b/requirements/edx/github.txt similarity index 100% rename from github-requirements.txt rename to requirements/edx/github.txt diff --git a/local-requirements.txt b/requirements/edx/local.txt similarity index 100% rename from local-requirements.txt rename to requirements/edx/local.txt diff --git a/requirements/edx/post.txt b/requirements/edx/post.txt new file mode 100644 index 0000000000..e1e26b381a --- /dev/null +++ b/requirements/edx/post.txt @@ -0,0 +1,6 @@ + +# This must be installed after distribute 0.6.28 +MySQL-python==1.2.4c1 + +# This must be installed after numpy +scipy==0.11.0 diff --git a/requirements/edx/repo.txt b/requirements/edx/repo.txt new file mode 100644 index 0000000000..da3903b3de --- /dev/null +++ b/requirements/edx/repo.txt @@ -0,0 +1,2 @@ +-r github.txt +-r local.txt diff --git a/brew-formulas.txt b/requirements/system/mac_os_x/brew-formulas.txt similarity index 100% rename from brew-formulas.txt rename to requirements/system/mac_os_x/brew-formulas.txt diff --git a/apt-packages.txt b/requirements/system/ubuntu/apt-packages.txt similarity index 100% rename from apt-packages.txt rename to requirements/system/ubuntu/apt-packages.txt diff --git a/apt-repos.txt b/requirements/system/ubuntu/apt-repos.txt similarity index 100% rename from apt-repos.txt rename to requirements/system/ubuntu/apt-repos.txt diff --git a/create-dev-env.sh b/scripts/create-dev-env.sh similarity index 100% rename from create-dev-env.sh rename to scripts/create-dev-env.sh diff --git a/install-system-req.sh b/scripts/install-system-req.sh similarity index 100% rename from install-system-req.sh rename to scripts/install-system-req.sh diff --git a/run.sh b/scripts/run.sh similarity index 100% rename from run.sh rename to scripts/run.sh diff --git a/run_watch_data.py b/scripts/run_watch_data.py similarity index 100% rename from run_watch_data.py rename to scripts/run_watch_data.py diff --git a/runone.py b/scripts/runone.py similarity index 100% rename from runone.py rename to scripts/runone.py diff --git a/setup-test-dirs.sh b/scripts/setup-test-dirs.sh similarity index 100% rename from setup-test-dirs.sh rename to scripts/setup-test-dirs.sh diff --git a/ws_migrations/README.rst b/ws_migrations/README.rst new file mode 100644 index 0000000000..c952a25c7b --- /dev/null +++ b/ws_migrations/README.rst @@ -0,0 +1,29 @@ +Developer Workspace Migrations +============================== + +This directory contains executable files which run once prior to +installation of pre-requisites to bring a developers workspace +into line. + +Specifications +-------------- + +Each file in this directory should meet the following criteria + +* Executable (`chmod +x ws_migrations/foo.sh`) +* Idempotent (ideally, each script is run only once, but no + guarantees are made by the caller, so the script must do + the right thing) +* Either fast or verbose (if the script is going to take + a long time, it should notify the user of that) +* A comment at the top of the file explaining the migration + +Execution +--------- + +The scripts are run by the rake task `ws:migrate`. That task +only runs a given script if a corresponding marker file +in .completed-ws-migrations doesn't already exist. + +If the SKIP_WS_MIGRATIONS environment variable is set, then +no workspace migrations will be run. \ No newline at end of file diff --git a/ws_migrations/clean_xmodule_assets.sh b/ws_migrations/clean_xmodule_assets.sh new file mode 100755 index 0000000000..ebda0fda55 --- /dev/null +++ b/ws_migrations/clean_xmodule_assets.sh @@ -0,0 +1,11 @@ +#! /bin/sh + +# Remove all of the old xmodule coffee and sass directories +# in preparation to switching to use the xmodule_assets script + +rm -rf cms/static/coffee/descriptor +rm -rf cms/static/coffee/module +rm -rf cms/static/sass/descriptor +rm -rf cms/static/sass/module +rm -rf lms/static/coffee/module +rm -rf lms/static/sass/module