Moodle
  1. Moodle
  2. MDL-31660

Rename and tidy up lib/yui/formslib/formslib.js

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.3
    • Component/s: Forms Library
    • Labels:
    • Testing Instructions:
      Hide

      Note to tester: This change is related to MDL-31655 and MDL-31656. To aid your testing, you may want to test all three together. These instructions are additive

      These test instructions are from MDL-31315. This patch should not change the functionality of that functionality issued in that issue.

      Please note, this functionality is not supported in Opera, or Mobile Safari.

      You may also like to keep a Javascript Console handy to ensure that no JS errors were reported during the testing.

      Open the Moodle Login Page

      • Make a change to to the username
      • Hit Refresh
      • The page refreshes

      Log in to Moodle and navigate to a course

      • Choose Edit Settings
      Without any changes
      • Refresh the page (the page refreshes)
      • Hit the back button (you go back in time and space)
      • Go back to the Edit Settings Page
      • Try closing the browser window (it closes)
      • Click Save and Display (the form saves)
      Now make some changes to various fields
      • Go back to the Edit Settings Page
      • Make a change to the 'Course full name'
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Click Save and Display (the form saves)

      Repeat the above steps using a select instead of 'Course full name'
      Repeat the above steps using a textarea (not TinyMCE) instead of 'Course full name'

      Go back to the course and create an Assignment
      • Choose Edit Settings
      Without any changes
      • Refresh the page to confirm that it refreshes when there have been no changes
      Make some changes to the TinyMCE editor
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Click Save and Display (the form saves)
      Uploading files
      • As a Student, choose the 'Upload Files' option
      • Refresh the page to confirm that it refreshes when there have been no changes
      • Upload a file using the 'Add' button and the filepicker
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Refresh the page and this time leave to start afresh
      • Upload a file using the drag/drop functionality (Supported browsers only - Chrome and Firefox)
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Click 'Save Changes'
      Modify existing files
      • Choose the 'Edit these files' button
      • Refresh the page and this time leave to start afresh
      • From the drop-down on a file, choose the rename option and enter a new name
      • Upload a file using the drag/drop functionality (Supported browsers only - Chrome and Firefox)
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Refresh the page and this time leave to start afresh
      • From the drop-down menu on a file, choose the Delete option and confirm
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Refresh the page and this time leave to start afresh
      • Create a new directory
      • From the drop-down menu on a file, choose the Delete option and confirm
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      • Refresh the page and this time leave to start afresh
      • Add an additional files using either option
      • From the drop-down menu on a file, choose the Delete option and confirm
      • Refresh the page (you get a popup) - click to stay
      • Hit the back button (you get a popup) - click to stay
      • Try closing the browser window/tab (you get a popup) - click to stay
      Admin Pages

      These changes are also included in admin/settings.php pages. The same code is used throughout so it's not really necessary to test all functionality again, but you may wish to ensure that the feature is still present.

      Show
      Note to tester: This change is related to MDL-31655 and MDL-31656 . To aid your testing, you may want to test all three together. These instructions are additive These test instructions are from MDL-31315 . This patch should not change the functionality of that functionality issued in that issue. Please note, this functionality is not supported in Opera, or Mobile Safari. You may also like to keep a Javascript Console handy to ensure that no JS errors were reported during the testing. Open the Moodle Login Page Make a change to to the username Hit Refresh The page refreshes Log in to Moodle and navigate to a course Choose Edit Settings Without any changes Refresh the page (the page refreshes) Hit the back button (you go back in time and space) Go back to the Edit Settings Page Try closing the browser window (it closes) Click Save and Display (the form saves) Now make some changes to various fields Go back to the Edit Settings Page Make a change to the 'Course full name' Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Click Save and Display (the form saves) Repeat the above steps using a select instead of 'Course full name' Repeat the above steps using a textarea (not TinyMCE) instead of 'Course full name' Go back to the course and create an Assignment Choose Edit Settings Without any changes Refresh the page to confirm that it refreshes when there have been no changes Make some changes to the TinyMCE editor Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Click Save and Display (the form saves) Uploading files As a Student, choose the 'Upload Files' option Refresh the page to confirm that it refreshes when there have been no changes Upload a file using the 'Add' button and the filepicker Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Refresh the page and this time leave to start afresh Upload a file using the drag/drop functionality (Supported browsers only - Chrome and Firefox) Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Click 'Save Changes' Modify existing files Choose the 'Edit these files' button Refresh the page and this time leave to start afresh From the drop-down on a file, choose the rename option and enter a new name Upload a file using the drag/drop functionality (Supported browsers only - Chrome and Firefox) Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Refresh the page and this time leave to start afresh From the drop-down menu on a file, choose the Delete option and confirm Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Refresh the page and this time leave to start afresh Create a new directory From the drop-down menu on a file, choose the Delete option and confirm Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Refresh the page and this time leave to start afresh Add an additional files using either option From the drop-down menu on a file, choose the Delete option and confirm Refresh the page (you get a popup) - click to stay Hit the back button (you get a popup) - click to stay Try closing the browser window/tab (you get a popup) - click to stay Admin Pages These changes are also included in admin/settings.php pages. The same code is used throughout so it's not really necessary to test all functionality again, but you may wish to ensure that the feature is still present.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-31660-master-3
    • Rank:
      38234

      Description

      As discussed in MDL-31315 we should ideally rename the formslib change detector to something more specific - for example formchangeprotection

      In doing this, I also came across a couple of areas to tidy up:

      • the unset_changed function isn't required. It was from an early Proof of Concept and somehow made it through review several times
      • The listeners only need to be called once, not on every change. This should reduce browser footprints slightly

      This change should ideally be tested at the same time as MDL-31655 and MDL-31656 which make modifications to the same functionality

        Issue Links

          Activity

          Hide
          Andrew Nicols added a comment -

          This issue ideally needs to be completed either before MDL-31655 and MDL-31656, or afterwards to avoid a nasty merge mess.

          Show
          Andrew Nicols added a comment - This issue ideally needs to be completed either before MDL-31655 and MDL-31656 , or afterwards to avoid a nasty merge mess.
          Hide
          Andrew Nicols added a comment -

          I've got this ready in the pipeline and will rebase on the weeklies when they're available.

          Show
          Andrew Nicols added a comment - I've got this ready in the pipeline and will rebase on the weeklies when they're available.
          Hide
          Andrew Nicols added a comment - - edited

          This is just a basic rename as requested by samh in MDL-31315
          Submitting for peer review

          Show
          Andrew Nicols added a comment - - edited This is just a basic rename as requested by samh in MDL-31315 Submitting for peer review
          Hide
          Dan Poltawski added a comment -

          Looks fine.

          To those who are not familiar with the linked issues this formslib.js was introduced in the last integration cycle - so this is changing a brand new 'regression' from the past issue. It won't be impacting historical things.

          Show
          Dan Poltawski added a comment - Looks fine. To those who are not familiar with the linked issues this formslib.js was introduced in the last integration cycle - so this is changing a brand new 'regression' from the past issue. It won't be impacting historical things.
          Hide
          Andrew Nicols added a comment -

          Holding off on putting this up for Integration Review until MDL-31655 and MDL-31673 have been looked at. These should ideally all be submitted together as they should be tested together and are all related.

          Show
          Andrew Nicols added a comment - Holding off on putting this up for Integration Review until MDL-31655 and MDL-31673 have been looked at. These should ideally all be submitted together as they should be tested together and are all related.
          Hide
          Andrew Nicols added a comment -

          I've updated this patch to take on the comments in MDL-31673 and MDL-31740 (which I'll close). This patch now:

          • renames formslib to formchangechecker
          • moves all functions out of lib/javascript-static.js into the formchangechecker namespace
          • stores state information under the formchangechecker namespace
          • converts the .on to .once (as discussed in MDL-31673)
          • removes the unset_changed function which isn't required
          Show
          Andrew Nicols added a comment - I've updated this patch to take on the comments in MDL-31673 and MDL-31740 (which I'll close). This patch now: renames formslib to formchangechecker moves all functions out of lib/javascript-static.js into the formchangechecker namespace stores state information under the formchangechecker namespace converts the .on to .once (as discussed in MDL-31673 ) removes the unset_changed function which isn't required
          Hide
          Andrew Nicols added a comment -

          Hi Dan,

          This probably needs to be re-peer reviewed as I've made some changes to the way in which it is instantiated, and I've merged in the changes discussed in MDL-31673 and MDL-31740

          Show
          Andrew Nicols added a comment - Hi Dan, This probably needs to be re-peer reviewed as I've made some changes to the way in which it is instantiated, and I've merged in the changes discussed in MDL-31673 and MDL-31740
          Hide
          Dan Poltawski added a comment - - edited

          Hi Andrew,

          Looks good. Some comments - you have a few variables which are not following the coding guidelines and have underscores:

          form_changed
          form_submitted

          By removing the underscores (and ensuring underscores in function names as separators) it makes it easier to distinguish between functions and variables.

          There is also the variable returnValue - I understand e.returnValue is there for what the browser expects but our private variable doesn't have to be named camel case I don't think.

          [but these are just minor comments]

          Show
          Dan Poltawski added a comment - - edited Hi Andrew, Looks good. Some comments - you have a few variables which are not following the coding guidelines and have underscores: form_changed form_submitted By removing the underscores (and ensuring underscores in function names as separators) it makes it easier to distinguish between functions and variables. There is also the variable returnValue - I understand e.returnValue is there for what the browser expects but our private variable doesn't have to be named camel case I don't think. [but these are just minor comments]
          Hide
          Andrew Nicols added a comment -

          Updated with comments suggested by Dan

          Show
          Andrew Nicols added a comment - Updated with comments suggested by Dan
          Hide
          Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Andrew Nicols added a comment -

          Rebases cleanly onto latest master

          Show
          Andrew Nicols added a comment - Rebases cleanly onto latest master
          Hide
          Sam Hemelryk added a comment -

          Awesome thanks Andrew - this has been integrated now!

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Awesome thanks Andrew - this has been integrated now! Cheers Sam
          Hide
          Andrew Davis added a comment -

          Phew. This all works as described. Passing.

          Show
          Andrew Davis added a comment - Phew. This all works as described. Passing.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!).

          icao_reverse('arreis olik rebemevon afla letoh ognat');
          

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!). icao_reverse('arreis olik rebemevon afla letoh ognat'); Closing, ciao

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: