417 Commits

Author SHA1 Message Date
samhemelryk
5afbd0e783 blocklib MDL-20207 Added $CFG->undeletableblocktypes and documented in config-dist 2009-09-11 06:00:32 +00:00
samhemelryk
f4e6a86e41 blocks MDL-20206 Added checking to initialise block weight array outsite of min/max if blocks weight already exceeds that range 2009-09-09 02:44:57 +00:00
samhemelryk
7d2a049292 navigation MDL-14632 Very significant navigation commit
This patch introduces two new blocks global_navigation_tree and settings_navigation_tree
both of which have been designed to make full use of the new navigation objects available through
the $PAGE object.
Bulk of this code is within lib/navigationlib.php
2009-08-28 08:47:31 +00:00
poltawski
d836aa4b4f lib/blocklib: MDL-20146 - Don't mask errors as a way to ignore missing code files
Instead of simply ignoring all errors from blocks, allow the errors to be
exposed and test if the file exists. The previous solution makes it very
hard to debug problems with blocks and gives the 'white screen of death' even
with debugging set as high as it can go.

Also ensure that blocks without code are not added to the list of instances,
as I assume was the intended behaviour.
2009-08-22 11:24:39 +00:00
nicolasconnault
7b1f2c829f MDL-19756 Renamed moodle_select to html_select for better API consistency 2009-08-10 08:38:45 +00:00
nicolasconnault
d81b05e701 MDL-19799 Converted calls to popup_form() 2009-08-10 03:39:21 +00:00
tjhunt
2cdb8d8452 blocks: MDL-19893 move blocks on page UI - part 2
This updates the DB.

I beleive this is correct, but it is very hairy and badly needs unit tests.
2009-07-30 10:29:14 +00:00
jerome
1d7e341e8f block MDL-19946 fix "cannot add block" bug (Tim's fix) 2009-07-30 09:40:11 +00:00
tjhunt
00a24d44f7 blocks: MDL-19893 move blocks on page UI - part 1
This does all the UI. It does not yet update the DB when you click to complete the action.
2009-07-30 08:22:12 +00:00
tjhunt
d14edf06ee blocks: MDL-19399 proper permissions checks for editing blocks.
In particular for editing sticky blocks. If the admin addes one at site level,
then the teacher should not be able to change its configuration from
the course page, but should be able to set the position on this page.
2009-07-30 03:44:10 +00:00
tjhunt
166e3bd161 blocks: MDL-19010 fix block editing icon URLs. 2009-07-29 11:14:41 +00:00
tjhunt
e9f7fdec00 blocks: MDL-19946 Sorry, remove debug code. 2009-07-29 03:57:30 +00:00
tjhunt
a23bbaa30b blocks: MDL-19946 More bug fixes. 2009-07-29 03:51:16 +00:00
tjhunt
d0f0cab776 blocks: MDL-19946 And another bug fix. 2009-07-29 03:21:07 +00:00
tjhunt
7bbc2890f7 blocks: MDL-19946 bugfixes for my previous commit. 2009-07-29 03:19:43 +00:00
tjhunt
a19f419db2 blocks: MDL-19946 Block editing form must be displayed from the original URL, with properliy initialised $page 2009-07-28 09:59:21 +00:00
tjhunt
78d27a9049 blocks MDL-19902: were seeing empty block columns on the front page when not logged in.
It turns out the only reliable way to find out whether blocks will appear is to get the contents. :-(
2009-07-22 05:38:28 +00:00
tjhunt
4578a5eb7a block MDL-19398 Initialise all blocks on this page before output is started. 2009-07-20 03:04:08 +00:00
tjhunt
73e2e5c03d blocks editing ui: MDL-19398 Can now edit the position of any block.
I think this is probaby insecure at the moment. I am still working on it.
2009-07-16 11:05:26 +00:00
tjhunt
1d13c75c15 blocks editing ui: MDL-19398 Can how precisely control block positioning using the edit icon
This mostly works now, but ...
* The UI needs further work. In particular we need a non-advanced mode.
* This only works for blocks that use a new edit_form.php to replace config_instance.html.
* .. and so far I have only implemented edit_form.php for the HTML block so far.
* Needs to be enabled (with no block-specific config) for blocks without instance config, so you can control their positioning.
2009-07-16 10:50:19 +00:00
tjhunt
ae42ff6fee blocks editing ui: MDL-19398 showing and hiding blocks now works. 2009-07-15 07:41:25 +00:00
tjhunt
4a3b462021 blocks editing ui: MDL-19398 give users a path back after assigning block roles 2009-07-15 06:33:13 +00:00
tjhunt
02b126af8a blocks editing ui: MDL-19398 permissions checks when deleting a block. 2009-07-14 11:16:21 +00:00
tjhunt
1936f20b8b blocks editing ui: MDL-19398 move generating the block edit icons to blocklib.php
Since that is where the resulting actions are processed.
2009-07-14 10:57:06 +00:00
tjhunt
727ae4362e blocks editing ui: MDL-19398 fix adding a block to a page that forgets to call $PAGE->set_url. 2009-07-14 10:41:59 +00:00
tjhunt
2a3b076368 blocks editing ui: MDL-19398 fix some bugs with adding a block. 2009-07-14 09:28:10 +00:00
tjhunt
a2789e3426 blocks editing ui: MDL-19398 add block now secure. Delete block works insecurely.
Will add security checks in a moment.
2009-07-14 08:37:28 +00:00
tjhunt
21d33bdf62 blocks editing ui: MDL-19398 you can now add new blocks! 2009-07-14 07:18:57 +00:00
tjhunt
e92c286c20 block contexts: MDL-19098 every block should have a context
even non-course and sticky blocks.

The parent context is block_instances.parentcontextid.

The block context should be used for checking permissions directly
related to the block, like moodle/block:view or moodle/site:manageblocks.

However, if the block is displaying information about the current page,
for example the participants block showing who 'here', then it may be
better to use the context of the page where the bloack is appearing -
in other words $this->page->context - to check permissions about the
user's ability to see participants here.

Or, if the block is displaying something stronly related to courses,
for example, a course meny block, the block should probably use the
context for $this->page->course to check permissions.
2009-07-13 08:37:34 +00:00
tjhunt
13a0d3d3c9 blocks MDL-19536: rename block_instances.contextid to parentcontextid to avoid gross confusion 2009-07-10 05:58:59 +00:00
tjhunt
fc2593fef9 blocks - MDL-19010 fix bug where blocks did not show up with editing off. 2009-07-09 08:17:23 +00:00
tjhunt
d4a03c00ea themes & blocks - MDL-19077 & MDL-19010 blocks are now printed by the theme
The code to print blocks in now in theme layout.php files. (Or in
moodle_core_renderer::handle_legacy_theme)

Code for printing blocks everywhere else has been stripped out.
(Total diffstat 1225 insertions, 2019 deletions)

The way the HTML for a block instance is generated has been cleaned
up a lot. Now, the block_instance generates a block_contents
object which gives a structured representation of the block,
and then $OUTPUT->block builds all the HTML from that.

How theme config.php files specify the layout template and block
regions by page general type has been changed to be even more flexible.

Further refinement for how the theme and block code gets initialised.

Ability for scrits to add 'pretend blocks' to the page. That is,
things that look like blocks, but are not normal block_instances.
(Like the add a new block UI.)

Things that are still broken:
 * some pages in lesson, quiz and resource. I'm working on it.
 * lots of developer debug notices pointing out things that
   need to be updated.
2009-07-09 07:35:03 +00:00
tjhunt
b70094743a themes: MDL-19077 change how the theme is initialised and CSS is served.
This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F

$THEME is now initialised at the same time as $OUTPUT. Old functions like
theme_setup are deprecated in favour of methods on $PAGE. There is a new
theme_config class in outputlib.php that deals with loading the theme config.php file.

CSS used to be served by themes styles.php files calling a function in weblib.php.
Now it works by each theme's styles.php file doing
$themename = basename(dirname(__FILE__));
require_once(dirname(__FILE__) . '/../../theme/styles.php');
which is less code to be copied into each theme. (Old-style styles.php files still
work thanks to some code in deprecatedlib.php.)

Admin UI for choosing a theme cleaned up.

A couple of theme-specific hard-coded hacks like $THEME->cssconstants and
$THEME->CSSEdit have been replaced by a more generic $THEME->customcssoutputfunction
hook. See examples at the end of outputlib.php

Also:
* Fix setting the theme in the URL, which seems to have been broken since 1.9.
* Fix up errors on a few pages caused by the new initialisation order.
* MDL-19097 moodle_page::set_course should not set $COURSE unless it is $PAGE.
* httpsrequired() from moodlelib.php moved to $PAGE->https_required().
* Move has_started() method to the renderer base class.
* Further fixes to display of early errors.
* Remove print_header/footer_old from weblib. I did not mean to commit them before.
2009-07-01 05:54:26 +00:00
tjhunt
c679c3582a Fix some fallout from the pagelib changes. 2009-06-12 11:56:30 +00:00
samhemelryk
d4accfc0ad blocklib.php MDL-19236 added phpdocs and copyrights 2009-05-22 02:18:49 +00:00
tjhunt
6cbcbf0fb3 blocklib: MDL-19010 eliminate remaining calls to blocks_repopulate_page 2009-05-08 08:22:59 +00:00
tjhunt
e03c0c1d49 blocklib: MDL-19010 fix editing block config and block roles. 2009-05-08 07:47:50 +00:00
tjhunt
f4d38d20fb blocklib: MDL-19010 and now you can delete blocks too! 2009-05-08 06:34:40 +00:00
tjhunt
7130fb212c blocklib: MDL-19010 once again you can add blocks, at least on the coures page. 2009-05-08 03:30:58 +00:00
tjhunt
1d00ec6a6a blocklib: MDL-19010 finally fix the regressions that mean that you could not create a new course. 2009-05-08 03:11:24 +00:00
tjhunt
feed19003c blocks: MDL-19010 Fix, or prevent being executed, all references to blocks_insance_old inside blocklib.php 2009-05-07 09:16:22 +00:00
tjhunt
f474a4e583 blocks: MDL-19010 Fix further blocks-related breakage, including removing all references to blocks_insance_old outside blocklib.php 2009-05-07 08:55:10 +00:00
tjhunt
9d1d606e0d blocklib: MDL-19010 fix new install.
* Fix the blocks bit of build_context_path
* Replace blocks_repopulate_page
* Make starting_output work during setup
2009-05-07 07:05:22 +00:00
tjhunt
d19e819597 blocklib: MDL-19010 move the check for whether the right database tables exist to a place where it is better encapsulated. 2009-05-07 02:56:48 +00:00
tjhunt
f2c6739c39 blocklib: MDL-19010 rename $position -> $region throughout blocklib.php 2009-05-06 09:27:02 +00:00
tjhunt
6bf44482c6 pagelib: MDL-12212 eliminate quiz_page 2009-05-06 09:24:45 +00:00
tjhunt
1b6b940022 moodle_page: MDL-12212 eliminate page_my_moodle 2009-05-06 09:23:37 +00:00
tjhunt
bb46a4fa2a blocklib: MDL-19010 refactor blocklib to use block_manager to get the blocks for rendering 2009-05-06 09:15:05 +00:00
tjhunt
08eab89703 blocklib: MDL-19010 add block and get_blocks methods 2009-05-06 09:14:42 +00:00
tjhunt
86b5ea0f85 blocklib: MDL-19010 start of block_manager - get and set regions 2009-05-06 09:14:01 +00:00