Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-18014

Automatically and periodically save WYSIWYG editor content as a draft/concept

    Details

    • Testing Instructions:
      Hide

      Run the entire behat suite. We are looking for any tests that accidentally trigger this "recovery" confirm window.

      Open a page with an Atto editor.
      Type some text - wait more than 60 seconds.
      Leave the page without submitting the form.
      Go back to the page.
      Verify a small notification shows in the editor and the unsaved text was recovered.

      With the editor open, shutdown apache and make some changes to the text. Verify you get a warning after 60 seconds - "Could not connect to the server. If you submit this page now, your changes may be lost.".
      Start apache again, verify the warning goes away after 60 seconds.
      With the editor open in a page, in another tab, logout the current session. Make some changes to the text, verify after 60 seconds you get the same warning.

      Load a forum - make 2 posts. Start replying to the first post, then wait until the "Draft saved" message is shown. Then leave the page without saving the form. Start replying to the second post and verify the draft is not recovered for the wrong post. Go back and start replying to the first post and ensure the draft is recovered because it matches this post.

      Another potentially tricky case:

      1. Create a quiz with an Essay question in it.
      2. Attempt the quiz as two different students.
      3. Go to Results -> Manual grading, and select the essay question.
      4. Verify that autosave works on the two editors on that page.
      Show
      Run the entire behat suite. We are looking for any tests that accidentally trigger this "recovery" confirm window. Open a page with an Atto editor. Type some text - wait more than 60 seconds. Leave the page without submitting the form. Go back to the page. Verify a small notification shows in the editor and the unsaved text was recovered. With the editor open, shutdown apache and make some changes to the text. Verify you get a warning after 60 seconds - "Could not connect to the server. If you submit this page now, your changes may be lost.". Start apache again, verify the warning goes away after 60 seconds. With the editor open in a page, in another tab, logout the current session. Make some changes to the text, verify after 60 seconds you get the same warning. Load a forum - make 2 posts. Start replying to the first post, then wait until the "Draft saved" message is shown. Then leave the page without saving the form. Start replying to the second post and verify the draft is not recovered for the wrong post. Go back and start replying to the first post and ensure the draft is recovered because it matches this post. Another potentially tricky case: Create a quiz with an Essay question in it. Attempt the quiz as two different students. Go to Results -> Manual grading, and select the essay question. Verify that autosave works on the two editors on that page.
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-18014-master
    • Story Points (Obsolete):
      40
    • Sprint:
      BACKEND Sprint 15

      Description

      This emerged during the discussion at MDL-13370. Shortly: use AJAX to automatically and periodically (eg. every minute) save the content of a WYSIWYG editor to the concepts (drafts) space. See GMail for the working example.

      It seems to me that we could use table mdl_post for this therefore not DB changes should be required. There will be a flag for a rich text field definitions that enables this feature. Every WYSIWYG will have to have some uniq identifier. Concepts are accessible to their owners only (and admins?) - maybe via a card in their profiles? Their lifetime is a subject of configuration - couple of hours by default.

        Gliffy Diagrams

          Attachments

          1. autosave-1.png
            autosave-1.png
            28 kB
          2. autosave-2.png
            autosave-2.png
            29 kB
          3. autosave-3.png
            autosave-3.png
            7 kB
          4. autosave-4.png
            autosave-4.png
            9 kB
          5. MDL-18014-autosave-alpha1.diff.txt
            19 kB
          6. notices.jpg
            notices.jpg
            18 kB
          7. OK and warning.png
            OK and warning.png
            2 kB
          8. shot.png
            shot.png
            67 kB

            Issue Links

              Activity

                People

                • Votes:
                  84 Vote for this issue
                  Watchers:
                  55 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    10/Nov/14