It seems that there are some overlapping constants in the blocks
subsystem that were causing some code, initially planned only
to frontpage, to be executed in other contexts. This commit moves
the bui_editingatfrontpage condition as root condition.
The dual front-page/system-wide form to edit blocks can
be reduced asuming that, always:
A) system sets the context to system,
recursively and with page-type set to "*"
B) frontpage only sets the context to site-course,
non-recursively and with page-type set to "site-index"
C) frontpage all added sets the context to site-course,
recursively and with paget-type set to "*"
And that is the change that this patch provides, by:
1) detecting properly if we are editing blocks @ protpage
2) passing that information to the form data processor
3) setting parentcontextid, showinsubcontexts and
pagetypepattern following the A, B, C immutables above.
Finally, and affecting some other system-wide pages, there
are cases (my, user templates...) having only one possible
pagetypepattern, and it looks badly if the page has subpages, so
for those system-wide cases we are showing exceptionaly the
pagetypepattern statically. This will be revisited once MDL-30574
is decided and implemented, although perhaps it's ok to leave it
as default to places with only one pagetypepattern available.
This is an attempt to clean up and fix the computation of the block
stickiness. At first, the page pattern can't be ignored because the user
may want to currently try to limit the page pattern. Second, the
site-index pattern can be forced only if the user selected 'Front page
only' as the page context.
This is an alternative solution to MDL-27812. If the current block
instance has page type set to site-index, we need to provide a way how
that page type pattern can be reset back to other value.
Added the * option that is not affected by the 'varying-pagetype'
problem that has been detected and issued @ MDL-30564. So now, it's
(back) possible to define coursecat blocks to be spread over children
coursecats/courses/modules (contexts).
Everytime that one block instance is edited @ any subcontext,
guarantee that the 'bring back' pattern (* = all pages) is
available, so the block can be reseted to its original context