202 Commits

Author SHA1 Message Date
mudrd8mz
3a0481a4d8 NOBUG: Fixed bug in $PAGE->set_url() when moodle_url passed
When moodle_url was passed as a param to set_url(), the str_replace() kept
the leading '/' in the $shorturl. This then led to the <body> classes
like '-mod-workshop' instead of correct 'mod-workshop' (the slash
replaced with minus sign).
2009-09-05 17:32:10 +00:00
samhemelryk
91152a3518 navigation MDL-20216 Refactored add arguments
Moved $action argument from arg5 to arg2
2009-09-04 03:12:01 +00:00
moodler
c1df9d7c51 lib/pagelib Improved the debugging message about set_url 2009-09-03 07:47:43 +00:00
samhemelryk
de6d81e667 admin MDL-19799 Upgraded print_header and build_navigation calls to use PAGE and OUTPUT equivilants 2009-09-03 06:59:25 +00:00
samhemelryk
e120c61d24 navigation MDL-14632 Deprecate print_header menu argument and provide PAGE method 2009-09-01 03:47:07 +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
mudrd8mz
de8a1d1056 MDL-19956 $PAGE->set_url(...) passes the same arguments to the legacy page object
Credit goes to Tim Hunt, thanks for explaining this to me.
2009-07-29 16:38:40 +00:00
mudrd8mz
7dc928b5ff MDL-19956 $PAGE->set_url(...) accepts already prepared instance of moodle_url 2009-07-29 16:05:36 +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
a8c310c253 Fix new install with developer debug on. Can't print context name in the page footer before DB tables exist! Also, show page generaltype in the footer. 2009-07-21 13:58:47 +00:00
tjhunt
2c0901cb5a MDL-19010: In developer debug mode, print information about this page in the footer. 2009-07-20 06:18:16 +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
jerome
a475c67308 moodle_page: MDL-12212 misspelling 2009-07-15 06:11:55 +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
21d33bdf62 blocks editing ui: MDL-19398 you can now add new blocks! 2009-07-14 07:18:57 +00:00
tjhunt
144390b4d9 themes: MDL-19077 Don't need both output_starting_hook and starting_output method on page. 2009-07-14 05:14:45 +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
94398fb3e8 MDL-19696 make sure install works. 2009-07-03 09:03:50 +00:00
tjhunt
d436d197d1 MDL-19690 - the last lot of $CFG->pixpath to $OUTPUT->old_icon_url
Including MDL-19693

RIP $CFG->pixpath
2009-07-03 07:55:30 +00:00
skodak
b8e99844ef MDL-19696 undoing my previous veryveryuglyhack, I did not solve much, sorry 2009-07-02 20:29:21 +00:00
skodak
f071ad0269 MDL-19696 veryveryuglyhack which partially ubreaks installation after latest pagelib changes 2009-07-02 13:39:55 +00:00
samhemelryk
f14c0f1d84 pagelib MDL-19077 Fixed minor error in pagelib 2009-07-02 07:29:08 +00:00
tjhunt
db8d89d822 MDL-19077 I just found a way to reduce the coupling between the classes. 2009-07-02 07:06:25 +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
samhemelryk
afa2dcad43 outputlib pagelib MDL-19236 Cleaned up PHPdocs on a couple of functions 2009-07-01 03:47:52 +00:00
samhemelryk
17a6649b95 output MDL-19077 Implemented periodic refresh to meta refresh by delay
Also created layout-popup.php for standardwhite theme to provide a simpler template
2009-06-30 07:57:41 +00:00
tjhunt
c84a2dbea2 MDL-19077 - change how $OUTPUT is initialised.
Please read the comment at the top of bootstrap_renderer in setuplib.php
2009-06-29 05:00:45 +00:00
tjhunt
34a2777ccb themes: MDL-19077 new $OUTPUT->header/footer to replace print_header/footer.
Also, part of the change from weblib.php functions to $OUTPUT-> methods.

This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F

This is a big change, and the result is not perfect yet. Expect some debugging output
on some pages.

The main part of these changes are that $OUTPUT->header now looks for a file
in the theme called layout.php, rather than header.html and footer.html. Also
you can have special templates for certain pages like layout-home.php. There is
fallback code for Moodle 1.9 themes, so they still work.

A few of the old arguments to print_header are no longer supported. (You get an
exception if you try to use them.) Sam H will be cleaning those up.

All the weblib functions that have been replaced with $OUTPUT-> have version in
deprecatedlib, so existing code will go on working for the foreseeable future.
2009-06-26 09:06:16 +00:00
tjhunt
31a9987770 install: MDL-19610 encapsulate empty($CFG->rolesactive) checks in a during_initial_install() function. 2009-06-24 09:17:56 +00:00
tjhunt
571fa82824 themes: MDL-19077 implement the renderer_factory instrastructure.
This is part of http://docs.moodle.org/en/Development:Theme_engines_for_Moodle%3F

The concept is that all the print_... functions in weblib get replaced  by methods
on a moodle_core_renderer class. Then, the theme can choose whether to
use the standard moodle_core_renderer class, or another implemenatation of
its own choosing, to generate different HTML.

Also, becuase Moodle is modular, we may need a moodle_mod_forum_renderer
and so on.

In order for the theme to be able to choose which renderers get created, we
introduce the concept  of a renderer factory, as in the factory design pattern.
The theme will choose which factory should be used, and that then creates
the renderer objects based on the module name.

This commit includes 4 types of factory:
* standard_renderer_factory
* custom_corners_renderer_factory
* theme_overridden_renderer_factory
* template_renderer_factory

All this with unit tests and PHP doc comments.

Note, this new code is not actually used yet. Still todo:
1. actually define the moodle_core_renderer class, and deprecate a lot of weblib functions.
2. make theme_setup initialise everything, so it is used.
2009-06-18 10:43:13 +00:00
tjhunt
5c5418fe9d Further fixes to PHPdoc comments. 2009-06-15 04:03:59 +00:00
tjhunt
2c144fc308 Further fixes to PHPdoc comments. 2009-06-15 03:54:00 +00:00
tjhunt
cf6155226c ajaxlib/require_js: MDL-16693 $PAGE->requires->... deprecates require_js etc.
There is a new implementation of require_js in lib/deprecatedlib.php,
based on $PAGE->requires.

There were a few other recently introduced functions in lib/weblib.php,
namely print_js_call, print_delayed_js_call, print_js_config and
standard_js_config. These have been removed, since they were never in
a stable branch, and all the places that used them have been changed
to use the newer $PAGE->requires->... methods.

get_require_js_code is also gone, and the evil places that were calling
it, even though it is an internal function, have been fixed.

Also, I made some minor improvements to the code I committed yesterday
for MDL-16695.

All that remains is to update all the places in core code that are
still using require_js.

(This commit also fixes the problem where the admin tree would not
start with the right categories expanded.)
2009-06-12 12:13:07 +00:00
tjhunt
b2330db606 ajaxlib: MDL-16695 New page_requirements_manager class. Soon to replace require_js.
This new class does the work that require_js used to do, and more.
It can track a number of different things that may be required to
be output somewhere on the page, including:

    * Links to JS files
    * Links to CSS files
    * Links to YUI libraries (this class knows about the dependancies between the different libs).
    * Skip links that go from the top of <body> to various places in the content.
    * Calls to JavaScript functions (for example to initialise things)
    * Bits of data from PHP that need to be available to JavaScript
    * As a special case of that, an easy way to pass language strings to JS.

The new API looks like

$PAGE->requires->css('mod/mymod/styles.css');
$PAGE->requires->js('mod/mymod/script.js');
$PAGE->requires->js('mod/mymod/small_but_urgent.js')->in_head();
$PAGE->requires->js_function_call('init_mymod', array($data))->on_dom_ready();

$PAGE->requires is the canonical instances of this new class.

The commit also includes unit tests, and hopefully the PHP doc comments are
clear enough that it is easy to understand.
2009-06-12 03:13:29 +00:00
samhemelryk
50fcb1d835 lib MDL-19236 Added boilerplates and copyrights 2009-05-26 03:23:32 +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
e3bd4690e0 blocklib: MDL-19010 move the check for whether the right database tables exist - and we no longer need this global. 2009-05-07 02:57:39 +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
nicolasconnault
0a75f205cb MDL-19010 Only output blocks after upgrade 2009-05-06 10:49:49 +00:00
tjhunt
b7b2d0f37d moodle_page: MDL-12212 improve comments and add some work-in-progress warnings 2009-05-06 09:29:05 +00:00
tjhunt
b80856bd6e moodle_page: MDL-12212 add a couple more useful classes to body 2009-05-06 09:28:06 +00:00
tjhunt
a132617056 moodle_page: MDL-12212 add a couple more useful classes to body 2009-05-06 09:27:16 +00:00
tjhunt
3681f9a953 pagelib: MDL-12212 eliminate data_page 2009-05-06 09:26:46 +00:00
tjhunt
c85acc871f pagelib: MDL-12212 eliminate chat_page 2009-05-06 09:25:54 +00:00
tjhunt
5d3e9d9fe3 moodle_page: MDL-12212 remove deprecated calls from course/view.php and page_course::print_header 2009-05-06 09:19:46 +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