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

Front page block with context set to all doesnt work correctly

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.3
    • Fix Version/s: 2.1
    • Component/s: Blocks
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      1. add a block to the front page.
      2. edit the block's settings and set it to appear throughout the entire site.
      3. check that the block appears on the front page, in courses, in activities etc.

      Show
      1. add a block to the front page. 2. edit the block's settings and set it to appear throughout the entire site. 3. check that the block appears on the front page, in courses, in activities etc.
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE
    • Pull Master Branch:
      MDL-27812_front_page_blocks

      Description

      Add a block to the front page of your Moodle. Edit its settings to and set its "Page contexts" to "display throughout entire site". The block should then appear on every page in the site. However it appears to only appear on the front page.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            salvetore Michael de Raadt added a comment -

            Promoting this issue as it relates to a QA test.

            Show
            salvetore Michael de Raadt added a comment - Promoting this issue as it relates to a QA test.
            Hide
            andyjdavis Andrew Davis added a comment -

            Ive put up a fix for this. Because, for some reason, we use integers to represent the desired "show on page types" when we're talking about blocks on the front page (everywhere else just uses the relevant page type as the value) the code is somewhat complex. This bug was occurring as the page type pattern property wasn't being set correctly and was relying on the page type pattern from the block instance loaded from the database.

            $bi->pagetypepattern = $data->bui_pagetypepattern;

            Show
            andyjdavis Andrew Davis added a comment - Ive put up a fix for this. Because, for some reason, we use integers to represent the desired "show on page types" when we're talking about blocks on the front page (everywhere else just uses the relevant page type as the value) the code is somewhat complex. This bug was occurring as the page type pattern property wasn't being set correctly and was relying on the page type pattern from the block instance loaded from the database. $bi->pagetypepattern = $data->bui_pagetypepattern;
            Hide
            marina Marina Glancy added a comment -

            The variable showinsubcontexts is actually boolean (1 or 0), you should not assign an integer constant to it

            Show
            marina Marina Glancy added a comment - The variable showinsubcontexts is actually boolean (1 or 0), you should not assign an integer constant to it
            Hide
            andyjdavis Andrew Davis added a comment -

            Marina, has spotted an oddity. View the front page of your site and turn editing on. Using the "main menu" block, add a page. The page is created somewhere like /mod/page/view.php?id=81 and has a page type of "mod-page-view".

            To be a subpage of the front page it should have a page type like "site-index-something" I believe. I'm not sure how these pages come to exist.

            Currently if you add any blocks to the front page and set their "page contexts" to "Display on the front page and any pages added to the front page" then create pages via the main menu the blocks will not appear on those pages because their page type says they are related to mod-page and not site-index. Maybe this is correct. I don't know yet.

            I'll open another issue for this for me to look into.

            Show
            andyjdavis Andrew Davis added a comment - Marina, has spotted an oddity. View the front page of your site and turn editing on. Using the "main menu" block, add a page. The page is created somewhere like /mod/page/view.php?id=81 and has a page type of "mod-page-view". To be a subpage of the front page it should have a page type like "site-index-something" I believe. I'm not sure how these pages come to exist. Currently if you add any blocks to the front page and set their "page contexts" to "Display on the front page and any pages added to the front page" then create pages via the main menu the blocks will not appear on those pages because their page type says they are related to mod-page and not site-index. Maybe this is correct. I don't know yet. I'll open another issue for this for me to look into.
            Hide
            andyjdavis Andrew Davis added a comment -

            Also, re the boolean/integer thing you pointed out, we store all booleans in small int columns. I believe it makes database independence easier. Plus its probably a bad habit I got from c/c++ programming that Ive never grown out of. false == 0 true == any non-zero value

            Show
            andyjdavis Andrew Davis added a comment - Also, re the boolean/integer thing you pointed out, we store all booleans in small int columns. I believe it makes database independence easier. Plus its probably a bad habit I got from c/c++ programming that Ive never grown out of. false == 0 true == any non-zero value
            Hide
            andyjdavis Andrew Davis added a comment -

            Ive raised MDL-28092 to look more into the issue of pages added via the main menu and whether they are meant to be sub pages of the front page or not.

            Show
            andyjdavis Andrew Davis added a comment - Ive raised MDL-28092 to look more into the issue of pages added via the main menu and whether they are meant to be sub pages of the front page or not.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Integrated thanks!

            Silly question, the fix requires editing the existing block, correct? Because the problem was on edition, correct?

            If so seems ok, I don't think we need to updgrade.php anything.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Integrated thanks! Silly question, the fix requires editing the existing block, correct? Because the problem was on edition, correct? If so seems ok, I don't think we need to updgrade.php anything.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Passing test without further action. Will be tested by MDLQA-1161 once this meets upstream.

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Passing test without further action. Will be tested by MDLQA-1161 once this meets upstream.
            Hide
            stronk7 Eloy Lafuente (stronk7) added a comment -

            Upstream-ized! Thanks!

            Show
            stronk7 Eloy Lafuente (stronk7) added a comment - Upstream-ized! Thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  1/Jul/11