From d071cfa113f00cb3e38d5030ecb38d25cbcdc97a Mon Sep 17 00:00:00 2001 From: Waqas Khalid Date: Sat, 20 Feb 2016 14:54:44 +0500 Subject: [PATCH 1/2] Reduce option of html xblock to text only In html xblock we have ability to choose different options like announcement, zooming tool etc. Now we want to only have text option. I have removed the template directory and directory path from html module. --- common/lib/xmodule/xmodule/html_module.py | 1 - .../xmodule/templates/html/announcement.yaml | 18 ------ .../xmodule/templates/html/anon_user_id.yaml | 19 ------- .../xmodule/templates/html/iframe.yaml | 32 ----------- .../xmodule/templates/html/image_modal.yaml | 24 -------- .../xmodule/templates/html/latex_html.yaml | 21 ------- .../xmodule/xmodule/templates/html/raw.yaml | 14 ----- .../xmodule/templates/html/zooming_image.yaml | 57 ------------------- 8 files changed, 186 deletions(-) delete mode 100644 common/lib/xmodule/xmodule/templates/html/announcement.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/anon_user_id.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/iframe.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/image_modal.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/latex_html.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/raw.yaml delete mode 100644 common/lib/xmodule/xmodule/templates/html/zooming_image.yaml diff --git a/common/lib/xmodule/xmodule/html_module.py b/common/lib/xmodule/xmodule/html_module.py index 62fce42e3f83..1e62375ad001 100644 --- a/common/lib/xmodule/xmodule/html_module.py +++ b/common/lib/xmodule/xmodule/html_module.py @@ -119,7 +119,6 @@ class HtmlDescriptor(HtmlBlock, XmlDescriptor, EditingDescriptor): # pylint: di mako_template = "widgets/html-edit.html" module_class = HtmlModule filename_extension = "xml" - template_dir_name = "html" show_in_read_only_mode = True js = {'coffee': [resource_string(__name__, 'js/src/html/edit.coffee')]} diff --git a/common/lib/xmodule/xmodule/templates/html/announcement.yaml b/common/lib/xmodule/xmodule/templates/html/announcement.yaml deleted file mode 100644 index a0f4b07e4eed..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/announcement.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -metadata: - display_name: Announcement -data: | -

To use this template, replace the example text with your own text.

-

When you add the component, be sure to select Settings - to specify a Display Name and other values that apply.

-

Announcement Date

-
-
-

Short note that introduces the topic

-

Instructor's name

-
-

Heading for announcement 1

-

Announcement 1 text

-

Heading for announcement 2

-

Announcement 2 text

-
\ No newline at end of file diff --git a/common/lib/xmodule/xmodule/templates/html/anon_user_id.yaml b/common/lib/xmodule/xmodule/templates/html/anon_user_id.yaml deleted file mode 100644 index cfba26a6b4e4..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/anon_user_id.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -metadata: - display_name: Anonymous User ID -data: | -

Your explanatory text here.

-

YOUR_LINK_TEXT

- - diff --git a/common/lib/xmodule/xmodule/templates/html/iframe.yaml b/common/lib/xmodule/xmodule/templates/html/iframe.yaml deleted file mode 100644 index 65d8caac8815..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/iframe.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -metadata: - display_name: IFrame Tool -data: | -

IFrame Tool

-

Use the IFrame tool to embed an exercise or tool from any web site into your course content. For example, the tool below allows learners to experiment with how the shape of a triangle affects a line that is derived from the triangle.

-

Exercises in an IFrame are not graded. To embed graded exercises, use a Custom JavaScript Problem.

-

The following code is the HTML format required to use the IFrame tool. For the IFrame in this template, you must replace the values in italics.

-
-        <iframe title="The required title of the tool"
-          src="The URL of the tool, starting with https://">
-           Message displayed when the browser does not support IFrames.
-        </iframe>
-        
-

The Iframe below includes the width, height, marginwidth, marginheight, frameborder, and scrolling attributes. These attributes are optional. You can remove these attributes or replace their values.

-

Modify this template as needed.

-

To modify the IFrame, you must edit the HTML source code. When editing this template, click HTML in the toolbar.

-

Then modify the example below for your own use. -

    -
  1. Replace the value of the src attribute of the IFrame with the URL of the tool that you want in your course. -

    Note: The URL must start with https instead of http, to ensure that the tool appears in all browsers that support IFrames.

  2. -
  3. Replace the value of the title attribute with the title of the tool. You must include the title to provide an accessible label.
  4. -
  5. Replace other IFrame attributes as needed. See the IFrame specification for more information.
  6. -
  7. Optionally, replace the text between the opening and closing iframe tags. -
    Your browser does not support IFrames.
    -

    A learner sees this text if the browser does not support IFrames.

    -
  8. -
-

The sample IFrame follows. Modify its attributes as described above.

- diff --git a/common/lib/xmodule/xmodule/templates/html/image_modal.yaml b/common/lib/xmodule/xmodule/templates/html/image_modal.yaml deleted file mode 100644 index 5efc6cba4814..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/image_modal.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -metadata: - display_name: Full Screen Image Tool -data: | -

Full Screen Image Tool

-

Use the Full Screen Image tool to allow learners to open and zoom in on a larger version of an image in your course.

-

With the Full Screen Image tool, learners can see the image's details as well as its context within the unit.

-

To enable users to view the larger image, you wrap the smaller image in a link to the larger version of the image.

-

The following HTML code shows the format required to use the Full Screen Image tool. For the example in this template, you must replace the values in italics.

-
-        <a href="Path to full screen image" class="modal-content">
-          <img alt="Text for screen readers"
-          src="Path to image to include in unit page"/>
-        </a>
-        
-

You can modify the example below for your own use.

-
    -
  1. Replace the value of the link's href attribute with the path to the full size image. Do not change the value of the class attribute.
  2. -
  3. Replace the value of the image's src attribute with the path to the image that will appear in the unit before a learner opens it in full screen mode.
  4. -
  5. Replace the value of the image's alt attribute with text that both describes the image and the action or destination of clicking on the image. You must include alt text to provide an accessible label.
  6. -
-

Note: Test viewing the image in full screen mode in the LMS; you cannot view it in full screen from within Studio.

- - An image of the Stanford Hills. Select the image to open it in full screen mode. diff --git a/common/lib/xmodule/xmodule/templates/html/latex_html.yaml b/common/lib/xmodule/xmodule/templates/html/latex_html.yaml deleted file mode 100644 index f82c60ed8d5f..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/latex_html.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -metadata: - display_name: E-text Written in LaTeX - source_code: | - \subsection{Example of E-text in LaTeX} - - You can write complex equations in LaTeX. - - \begin{equation} - x = \frac{-b\pm\sqrt{b^2-4*a*c}}{2a} - \end{equation} - -data: | - -

Example: E-text page

-

You can write complex equations in LaTeX.

-

When you add the component, be sure to select Settings - to specify a Display Name and other values that apply.

-

When editing this component, select Launch Latex Source Compiler to edit equations.

-

Then, in the equation editor, select Save and Compile to edX XML to see the equation in the component.

- diff --git a/common/lib/xmodule/xmodule/templates/html/raw.yaml b/common/lib/xmodule/xmodule/templates/html/raw.yaml deleted file mode 100644 index 8d4c78ca8900..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/raw.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -metadata: - display_name: Raw HTML - editor: raw -data: | -

This template is similar to the Text template. The only difference is - that this template opens in the Raw HTML editor rather than in the Visual - editor.

- -

The Raw HTML editor saves your HTML exactly as you enter it. - You can switch to the Visual editor by clicking the Settings tab and - changing the Editor setting to Visual. Note, however, that some of your - HTML may be modified when you save the component if you switch to the - Visual editor.

diff --git a/common/lib/xmodule/xmodule/templates/html/zooming_image.yaml b/common/lib/xmodule/xmodule/templates/html/zooming_image.yaml deleted file mode 100644 index 16bc5a693264..000000000000 --- a/common/lib/xmodule/xmodule/templates/html/zooming_image.yaml +++ /dev/null @@ -1,57 +0,0 @@ ---- -metadata: - display_name: Zooming Image Tool -data: | -

Zooming Image Tool

-

Use the Zooming Image Tool to enable learners to see details of large, complex images.

-

With the Zooming Image Tool, the learner can move the mouse pointer over a part of the image to enlarge it and see more detail.

-

To use the Zooming Image Tool, you must first add the jquery.loupeAndLightbox.js JavaScript file to your course.

-

You must also add both the regular and magnified image files to your course.

-

The following HTML code shows the format required to use the Zooming Image tool. For the example in this template, you must replace the values in italics.

-
-        <div class="zooming-image-place" style="position: relative;">
-          <a class="loupe" href="path to the magnified version of the image">
-            <img alt="Text for screen readers"
-              src="path to the image you want to display in the unit" />
-          </a>
-          <div class="script_placeholder"
-            data-src="path to the jquery.loupeAndLightbox.js JavaScript file in your course"/>
-        </div>
-        <script type="text/javascript">// >![CDATA[
-        JavascriptLoader.executeModuleScripts($('.zooming-image-place').eq(0), function() {
-          $('.loupe').loupeAndLightbox({
-            width: 350,
-            height: 350,
-            lightbox: false
-          });
-        });
-        // ]]></script>
-        <div id="ap_listener_added"></div>
-        
- -

You can modify the example below for your own use.

-
    -
  1. Replace the value of the link's href attribute with the path to the magnified image. Do not change the value of the class attribute.
  2. -
  3. Replace the value of the image's src attribute with the path to the image that will appear in the unit.
  4. -
  5. Replace the value of the image's alt attribute with text that both describes the image and the action or destination of clicking on the image. You must include alt text to provide an accessible label.
  6. -
  7. Replace the value of the div element's data-src attribute with the path to the jquery.loupeAndLightbox.js JavaScript file in your course.
  8. -
-

The example below shows a subset of the biochemical reactions that cells carry out.

-

You can view the chemical structures of the molecules by clicking on them. The magnified view also lists the enzymes involved in each step.

-

Press spacebar to open the magnifier.

-
- - magnify - -
-
- -
From e62038e98ae29952064eb2c9562b047f0f1fa1dd Mon Sep 17 00:00:00 2001 From: Waqas Khalid Date: Sat, 20 Feb 2016 16:32:17 +0500 Subject: [PATCH 2/2] Fix the failed cms unit tests --- cms/djangoapps/contentstore/tests/test_crud.py | 7 +++---- cms/djangoapps/contentstore/views/tests/test_item.py | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_crud.py b/cms/djangoapps/contentstore/tests/test_crud.py index 512667fa02ac..ed4974fb39e2 100644 --- a/cms/djangoapps/contentstore/tests/test_crud.py +++ b/cms/djangoapps/contentstore/tests/test_crud.py @@ -25,7 +25,6 @@ def test_get_templates(self): self.assertIsNotNone(found.get('problem')) self.assertEqual(len(found.get('course')), 0) self.assertEqual(len(found.get('about')), 1) - self.assertGreaterEqual(len(found.get('html')), 2) self.assertGreaterEqual(len(found.get('problem')), 10) dropdown = None for template in found['problem']: @@ -42,10 +41,10 @@ def test_get_templates(self): def test_get_some_templates(self): self.assertEqual(len(SequenceDescriptor.templates()), 0) - self.assertGreater(len(HtmlDescriptor.templates()), 0) + self.assertGreater(len(CapaDescriptor.templates()), 0) self.assertIsNone(SequenceDescriptor.get_template('doesntexist.yaml')) - self.assertIsNone(HtmlDescriptor.get_template('doesntexist.yaml')) - self.assertIsNotNone(HtmlDescriptor.get_template('announcement.yaml')) + self.assertIsNone(CapaDescriptor.get_template('doesntexist.yaml')) + self.assertIsNotNone(CapaDescriptor.get_template('blank_common.yaml')) def test_factories(self): test_course = CourseFactory.create( diff --git a/cms/djangoapps/contentstore/views/tests/test_item.py b/cms/djangoapps/contentstore/views/tests/test_item.py index 03024fb587ab..16b6e603b9f5 100644 --- a/cms/djangoapps/contentstore/views/tests/test_item.py +++ b/cms/djangoapps/contentstore/views/tests/test_item.py @@ -223,13 +223,13 @@ def test_split_test(self): root_usage_key = self._create_vertical() resp = self.create_xblock(category='split_test', parent_usage_key=root_usage_key) split_test_usage_key = self.response_usage_key(resp) - resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='html', boilerplate='announcement.yaml') + resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='problem', boilerplate='blank_common.yaml') self.assertEqual(resp.status_code, 200) - resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='html', boilerplate='zooming_image.yaml') + resp = self.create_xblock(parent_usage_key=split_test_usage_key, category='problem', boilerplate='checkboxes_response.yaml') self.assertEqual(resp.status_code, 200) html, __ = self._get_container_preview(split_test_usage_key) - self.assertIn('Announcement', html) - self.assertIn('Zooming', html) + self.assertIn('Blank Common Problem', html) + self.assertIn('Checkboxes', html) def test_split_test_edited(self): """