Development:Navigation 2.0
Goals
Improving navigation in a complex web application like Moodle touches on a lot of areas, but in particular we must aim to hit these goals:
Clarity
It should be clearer what settings affect only yourself, and what settings affect what others see.
It should be clear what is global navigation (whole site), and what is local navigation (within a course or module).
Consistency
All parts of the interface should be consistent. We need to have a set of guidelines and core frameworks to better restrict what developers are allowed to do, while also reworking the core code to implement things like blocks and tabs in consistent ways.
Usability
Users should be able to easily learn what is there for them.
Users should be able to move around "their world" within Moodle with a minimum of effort.
Performance
Processing blocks and building up a page with navigation must be very efficient.
Backward compatibility
If possible, plugins should not have to change.
Users should also not find the new interface too different (just better!)
Scope
What parts of Moodle might be affected by this work?
Since Moodle 1.9, we construct the navigation bar from an array using the build_navigation function. However, that converts all the data to a string, which is then passed to the theme. Instead, we should keep the information about the navigation bar links as structured data, and let the theme choose how to render it.
In different places we have the global administration tree, the Course admin block, the Jump to menu, tabs like in the user profile, various activities, in the roles UI, and the 'Update this forum' button. These are all ways of getting around nearby, related pages. It would be good to make these concepts more consistent. (There is also $homelink in the footer. Currently the HTML for this is generated in print_header.)
This is an area we need to think about a lot more
- Please discuss here: http://moodle.org/mod/forum/discuss.php?d=115620
Blocks/pagelib
Blocks themselves should not change. What is currently inconsistent is how blocks get associated with particular pages. At the moment this is done through the (pageid, pagetype) columns of block_instance, and the pagetype column of block_pinned. Does it work if we change this to (contextid, pagetype)?
The other thought is, can we make sticky blocks more flexible? What if we let them be configured in any context, not just globally? This would let people do things like add a block to every course in a particular category.
Perhaps let themes control where on the page blocks can appear.
Some more thought required here.
- Please discuss here: http://moodle.org/mod/forum/discuss.php?d=95882
Course view
What do we need on top of the existing course formats?
Themability
Give themers as much flexibility as possible, without having to do major changes throughout Moodle.
Let them change the HTML output by the print_XXX functions in weblib.php.
Should we allow themes to have their own lang files and settings.php page in the admin tree?
Design
As I write this, we don't have a clear overview of the whole solution, but following some discussions, I have some ideas about how some components of the solution should work, and I want to write them down. Therefore, I present a possible (partial) design. (Real development never happens as they teach in Software Engineering classes anyway. ;-) )--Tim Hunt 23:28, 29 January 2009 (CST)
Relevant tracker issues
These come from a review of all the 'Theme' tracker issues.
- MDL-3625 $menu in header does too many things
- MDL-3626 header.html and footer.html $variable inconsistency
- MDL-8369 Folder-like presentation of the courses at the main page
- MDL-9306 Main course formats need to have tables removed but keep AJAX working - there seem to be some regressions from this work ;-)
- MDL-10522 Hard-coded <br /> used for spacing.
- MDL-14058 Code includes
tags in many places, which breaks theming, or makes it more difficult
- MDL-14058 Code includes
- MDL-10681 Popup windows need uniform body class
- MDL-12093 It is not possible to change the page layout in popup windows
- MDL-12183 Improve block HTML structure
- MDL-12191 Let themes know whether this page has blocks.
- MDL-14061 Add category short names, and an option for categories in the navigation bar.
- MDL-14305 Class on body to identify the page as Moodle, and a specific site. (Enables sharing of stylesheets, but with a few specific customisations.)
- MDL-14306 The course category hierarchy should be reflected in CSS classes on the body tag (actually, contextids would let this be done more efficiently).
- MDL-14539 Replace table layout with div - parhaps a duplicate of MDL-9306.
- MDL-14632 Increase use of tabs on all mod activities.
- MDL-14901 Themes can no longer control the separater used in the nav bar.
- MDL-15400 Sideblocks on "My Moodle" page not conforming to global width
- MDL-15817 Part course them and part site theme is used when displayng Outline and Complete reports
- MDL-15959 patch any theme to have a personal visual style (CSS file) for each course - not sure this is a good solution, but it is an interesting requirement.
- MDL-16244 Support for a drop-down menu bar - Like on moodle.org now.