Also added a fix to the function course_page_type_list(). It was making a call to
get_context_info_array() which will generate an error if $currentcontext is not set.
This commit simplifies the logic, so that $CFG->undeletableblocks
applies to all blocks, not just ones on certain page types in the
system context.
It also makes the setting apply to adding blocks, so you cannot
accidentally add a block that you cannot delete.
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.
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
New PARAM_COMPONENT, PARAM_AREA and PARAM_PLUGIN + fixing of hopefully all current incorrect parameter types. This should help with diagnosing of incorrectly named 3rd party plugins too.