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

Main course formats need to have tables removed but keep AJAX working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0
    • Component/s: Accessibility, JavaScript
    • Labels:
      None
    • Affected Branches:
      MOODLE_18_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      The current main course formats currently use tables for layout

      course/format/topics
      course/format/weeks

      which the AJAX course editing functionality (eg Turn Editing on) relies upon (because of the DOM).

      These formats need to to be changed to use a DIV+CSS only structure exactly like

      course/format/weekscss

      And since weekscss will be deprecated it needs to be deleted and all courses using it can be changed to simply "weeks".

      The main issue though is that AJAX will no longer work because of the changed DOM.

      Someone needs to fix the AJAX so that it will work on these formats exactly as it does now.

        Gliffy Diagrams

        1. courseformats.tar
          43 kB
          Ann Adamcik
        2. csscourseformatpatch.txt
          7 kB
          Ann Adamcik
        3. cssformatpatch.txt
          5 kB
          Ann Adamcik
        4. cssformats.tar
          38 kB
          Ann Adamcik
        5. Musik WDH 2CB.doc
          26 kB
          Philipp-Andreas Daniel Kaufmann
        1. moodle2_tableless_course.png
          116 kB

          Issue Links

            Activity

            Hide
            dougiamas Martin Dougiamas added a comment -

            Don Pinto is keen to work on this.

            Show
            dougiamas Martin Dougiamas added a comment - Don Pinto is keen to work on this.
            Hide
            j.ryan John Ryan added a comment -

            I have just downloaded the latest 1.9dev version from moodle.org.

            I have found that the right hand blocks disappear when I turn Editing on if the format is set to topics or weeks but stay if the format is set to weekscss.

            Is this a new bug or simply a work in progress?

            I also find that AJAX no longer works even though it is turned at the site level.

            Show
            j.ryan John Ryan added a comment - I have just downloaded the latest 1.9dev version from moodle.org. I have found that the right hand blocks disappear when I turn Editing on if the format is set to topics or weeks but stay if the format is set to weekscss. Is this a new bug or simply a work in progress? I also find that AJAX no longer works even though it is turned at the site level.
            Hide
            dougiamas Martin Dougiamas added a comment -

            Don Pinto, did you have any success with this?

            Show
            dougiamas Martin Dougiamas added a comment - Don Pinto, did you have any success with this?
            Hide
            ajnabiz AjnabiZ added a comment -

            Any news on this ?

            Show
            ajnabiz AjnabiZ added a comment - Any news on this ?
            Hide
            adamann2 Ann Adamcik added a comment -

            It doesn't look like this is being worked on, so I'm willing to jump in. I've modified lib/ajax/section_classes.js to work with the weekscss format. I need to do some more testing on it, and then I'll work on creating a css version of the topic format. More next week, I hope...

            Show
            adamann2 Ann Adamcik added a comment - It doesn't look like this is being worked on, so I'm willing to jump in. I've modified lib/ajax/section_classes.js to work with the weekscss format. I need to do some more testing on it, and then I'll work on creating a css version of the topic format. More next week, I hope...
            Hide
            adamann2 Ann Adamcik added a comment -

            Attached are new weekscss and topicscss course formats. The second attachment contains patches for lib/ajax/section_classes.js, lang/en_utf8/moodle.php, theme/standard/styles_layout.css, and theme/custom_corners/user_styles.css.

            If the intent is to completely replace the table-based weeks and topics formats with these, then the lang and standard theme changes won't have to be applied. Let me know if this is the case and I will attach new files.

            Show
            adamann2 Ann Adamcik added a comment - Attached are new weekscss and topicscss course formats. The second attachment contains patches for lib/ajax/section_classes.js, lang/en_utf8/moodle.php, theme/standard/styles_layout.css, and theme/custom_corners/user_styles.css. If the intent is to completely replace the table-based weeks and topics formats with these, then the lang and standard theme changes won't have to be applied. Let me know if this is the case and I will attach new files.
            Hide
            dougiamas Martin Dougiamas added a comment -

            Oo cool, thanks! Let's get these into HEAD so it gets some thorough testing and if it works well then maybe we can backport to 1.9.1 or something later.

            Show
            dougiamas Martin Dougiamas added a comment - Oo cool, thanks! Let's get these into HEAD so it gets some thorough testing and if it works well then maybe we can backport to 1.9.1 or something later.
            Hide
            dougiamas Martin Dougiamas added a comment -

            Yu, can you review these patches and, if good, apply them to HEAD?

            Show
            dougiamas Martin Dougiamas added a comment - Yu, can you review these patches and, if good, apply them to HEAD?
            Hide
            dougiamas Martin Dougiamas added a comment -

            Another patch from Ann Nicolas, can you please review and put in HEAD only please (for now)

            Show
            dougiamas Martin Dougiamas added a comment - Another patch from Ann Nicolas, can you please review and put in HEAD only please (for now)
            Hide
            nicolasconnault Nicolas Connault added a comment -

            Applied Ann's patches: all seems to work very well, the output is entirely XHTML compliant, and displays really nicely. The AJAX works very well too.

            Show
            nicolasconnault Nicolas Connault added a comment - Applied Ann's patches: all seems to work very well, the output is entirely XHTML compliant, and displays really nicely. The AJAX works very well too.
            Hide
            nfreear Nick Freear added a comment -

            Hi Ann,
            Thank you for your work on this - it's moving us forward, which is a big help!

            A question, once these CSS formats have been thoroughly tested and replace the old ones, is the plan to replace layout tables in index.php (and tag/index.php) too? (Probably a new bug.)

            (Just fixed 2 minor bugs: MDL-7878, MDL-11439).
            Regards, Nick Freear (OU)

            Show
            nfreear Nick Freear added a comment - Hi Ann, Thank you for your work on this - it's moving us forward, which is a big help! A question, once these CSS formats have been thoroughly tested and replace the old ones, is the plan to replace layout tables in index.php (and tag/index.php) too? (Probably a new bug.) (Just fixed 2 minor bugs: MDL-7878 , MDL-11439 ). Regards, Nick Freear (OU)
            Hide
            dougiamas Martin Dougiamas added a comment - - edited

            Nicolas, can you please fix this checkin so that the formats replace weeks and topics (and get rid of weekscss and topicscss).

            You'll also need an upgrade like:

            UPDATE course SET format = 'weeks' WHERE format = 'weekscss'

            to clear up any older courses that might be using the defunct format.

            (note also that the changes to lib/ajax probably broke AJAX for the table-based layouts ... check that nothing else was affected).

            Show
            dougiamas Martin Dougiamas added a comment - - edited Nicolas, can you please fix this checkin so that the formats replace weeks and topics (and get rid of weekscss and topicscss). You'll also need an upgrade like: UPDATE course SET format = 'weeks' WHERE format = 'weekscss' to clear up any older courses that might be using the defunct format. (note also that the changes to lib/ajax probably broke AJAX for the table-based layouts ... check that nothing else was affected).
            Hide
            dougiamas Martin Dougiamas added a comment -

            Nick F, yes indeed, we should lose the tables in those places as well as My Moodle and Admin pages. But I remain to be convinced that we are free from ugly text-overflowing-out-of-divs problems.

            Show
            dougiamas Martin Dougiamas added a comment - Nick F, yes indeed, we should lose the tables in those places as well as My Moodle and Admin pages. But I remain to be convinced that we are free from ugly text-overflowing-out-of-divs problems.
            Hide
            adamann2 Ann Adamcik added a comment -

            Nick & Martin -

            I've attached new css weeks and topics formats that can replace the old weeks and topics directories. For consistency, I changed class names from weekscss* and topicscss* to weeks* and topics*.

            I did attempt to make the ajax changes in such a way that the topics formats would continue to work, but more testing is always a good thing.

            -Ann

            Show
            adamann2 Ann Adamcik added a comment - Nick & Martin - I've attached new css weeks and topics formats that can replace the old weeks and topics directories. For consistency, I changed class names from weekscss* and topicscss* to weeks* and topics*. I did attempt to make the ajax changes in such a way that the topics formats would continue to work, but more testing is always a good thing. -Ann
            Hide
            nicolasconnault Nicolas Connault added a comment -

            Finished all these tasks, seems to be working OK.

            Show
            nicolasconnault Nicolas Connault added a comment - Finished all these tasks, seems to be working OK.
            Hide
            urshunkler Urs Hunkler added a comment -

            Ann and Nick,

            the custom_corners theme is a Chameleon engine enabled theme. You must not write hooks as comma separated lists of elements like "td#middle-column div.bt, div#middle-column div.bt" in Chameleon themes because the Chameleon engine can't handle these comma lists.

            Please write two declarations instead. I correct those properties now.

            Show
            urshunkler Urs Hunkler added a comment - Ann and Nick, the custom_corners theme is a Chameleon engine enabled theme. You must not write hooks as comma separated lists of elements like "td#middle-column div.bt, div#middle-column div.bt" in Chameleon themes because the Chameleon engine can't handle these comma lists. Please write two declarations instead. I correct those properties now.
            Hide
            skodak Petr Skoda added a comment -

            This is not good - if you compare the course page and any blocks you will see that the size and color is different

            Show
            skodak Petr Skoda added a comment - This is not good - if you compare the course page and any blocks you will see that the size and color is different
            Hide
            dougiamas Martin Dougiamas added a comment -

            Urs, can that be documented please in the Chameleon themes?

            Show
            dougiamas Martin Dougiamas added a comment - Urs, can that be documented please in the Chameleon themes?
            Hide
            skodak Petr Skoda added a comment -

            Another big problem is the code in upgrade.php - we must not make HEAD specific upgrades yet because we still have the same version numbers in 19 and head.
            The upgrade code will NOT be executed during upgrade from MOODLE_19_STABLE to HEAD!
            This can not be fixed now, we must wait untill we separate the versions - please no HEAD specific changes in upgrade.php yet

            Show
            skodak Petr Skoda added a comment - Another big problem is the code in upgrade.php - we must not make HEAD specific upgrades yet because we still have the same version numbers in 19 and head. The upgrade code will NOT be executed during upgrade from MOODLE_19_STABLE to HEAD! This can not be fixed now, we must wait untill we separate the versions - please no HEAD specific changes in upgrade.php yet
            Hide
            urshunkler Urs Hunkler added a comment -

            Another issue: When for example the left column contains no blocks the column does show up empty. Should behave like the table version.

            Show
            urshunkler Urs Hunkler added a comment - Another issue: When for example the left column contains no blocks the column does show up empty. Should behave like the table version.
            Hide
            urshunkler Urs Hunkler added a comment -

            Seeing all these issues I urgently recommend not to replace the table course formats but to add the table-less formats and let people change the course format by hand. I expect several courses breaking when the table-less format automatically replaces the table format.

            Show
            urshunkler Urs Hunkler added a comment - Seeing all these issues I urgently recommend not to replace the table course formats but to add the table-less formats and let people change the course format by hand. I expect several courses breaking when the table-less format automatically replaces the table format.
            Hide
            urshunkler Urs Hunkler added a comment -

            Explanation added for hooks as comma separated lists in Chameleon in README.html

            Show
            urshunkler Urs Hunkler added a comment - Explanation added for hooks as comma separated lists in Chameleon in README.html
            Hide
            brummie1 Matthew Cannings added a comment -

            The blocks_have_content function can be used to adjust the width of the middle column when left or right column is empty

            echo '<div id="middle-column" style="';
            if (!blocks_have_content($pageblocks, BLOCK_POS_LEFT) && !$editing)

            { echo 'margin-left:0;'; }

            if (!blocks_have_content($pageblocks, BLOCK_POS_RIGHT) && !$editing)

            { echo 'margin-right:0;'; }

            echo '">';

            Show
            brummie1 Matthew Cannings added a comment - The blocks_have_content function can be used to adjust the width of the middle column when left or right column is empty echo '<div id="middle-column" style="'; if (!blocks_have_content($pageblocks, BLOCK_POS_LEFT) && !$editing) { echo 'margin-left:0;'; } if (!blocks_have_content($pageblocks, BLOCK_POS_RIGHT) && !$editing) { echo 'margin-right:0;'; } echo '">';
            Hide
            inceebee Nate Baxley added a comment -

            What is the current status of this issue? I would like to turn on the AJAX drag and drop for our new format that is based on the Weekly CSS/No Tables format. Is this currently possible? I have enabled all the admin AJAX settings and in the user profile as well. It appears that moving the course from Weekly format to Weekly CSS format disables the AJAX drag and drop. What is the planned version for adding drag and drop to the CSS formats?

            Show
            inceebee Nate Baxley added a comment - What is the current status of this issue? I would like to turn on the AJAX drag and drop for our new format that is based on the Weekly CSS/No Tables format. Is this currently possible? I have enabled all the admin AJAX settings and in the user profile as well. It appears that moving the course from Weekly format to Weekly CSS format disables the AJAX drag and drop. What is the planned version for adding drag and drop to the CSS formats?
            Hide
            chuang Wen Hao Chuang added a comment -

            Sorry for the quick question, we are evaluating the course area AJAX feature right now in 1.9.4. Is this issue (MDL-9306) only affect moodle 1.8.x or does it also affect 1.9.x? Thanks!

            Show
            chuang Wen Hao Chuang added a comment - Sorry for the quick question, we are evaluating the course area AJAX feature right now in 1.9.4. Is this issue ( MDL-9306 ) only affect moodle 1.8.x or does it also affect 1.9.x? Thanks!
            Hide
            dougiamas Martin Dougiamas added a comment -

            AJAX is working fine for me in 2.0

            Show
            dougiamas Martin Dougiamas added a comment - AJAX is working fine for me in 2.0

              People

              • Votes:
                7 Vote for this issue
                Watchers:
                15 Start watching this issue

                Dates

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