Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: YUI menu.

YUI menu: Difference between revisions

From MoodleDocs
(added documentation from README in cvs)
(→‎Future Development: the future is now!)
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
{{Plugin
{{Plugin
|screenshot = [[Image:YUI_Menu.png]]
|screenshot = [[Image:YUI_Menu.png]]
|caption    = The menu in Moodle 1.8
|caption    = The menu in Moodle 1.9
|type      = Block
|type      = Block
|license    = [[GNU General Public License|GPL]] 3 or greater
|license    = [[GNU General Public License|GPL]] 3 or greater
Line 24: Line 23:
Install this block in the [[Installing_contributed_modules_or_plugins|standard way]]. Unpack it into the <tt>blocks/</tt> directory. Then go to Moodle’s admin page and it will install itself.
Install this block in the [[Installing_contributed_modules_or_plugins|standard way]]. Unpack it into the <tt>blocks/</tt> directory. Then go to Moodle’s admin page and it will install itself.


== Customisation ==
== Troubleshooting ==
 
For various reasons, you may have trouble installing this module. Here are a list of questions which have been raised in the discussion forums.
 
=== Unable to find block after installation ===
 
If you have installed installed the block and the installation went fine, you should be able to find it under ''Modules > Blocks > Manage blocks'' in the site administration menu. The one caveat is that its name (at the moment) is “Course Menu” not “YUI menu” as you might expect. You should also be able to go into a course page and add the block there (it will be also called “Course Menu” there).
 
=== Old Problems ===
 
Using the latest version of the YUI menu should solve all of these.
 
==== Error on page (Javascript) ====
 
The YUI menu depends directly on the YUI library in Moodle. Moodle 1.9.3 upgraded from YUI 2.4 to 2.6. Unfortunately, YUI broke backwards compatibility in this release. Early versions of the YUI menu won’t work with Moodle 1.9.4 or later. If you have this problem, update to the latest version of the YUI menu.


The YUI menu blocks can be customised individually. To do this turn editing on, and an edit button should appear under the title of
==== Outline is messed up and +/- icons not showing ====
the block. This customisation allows the available menu items to be moved around and either hidden or shown.


By default, the available menu items are comprised of module links and other pre-set items. The module links are created based on which activity modules are in the course. For example, a course with a news forum will have an item for forums. There are five pre-set items:
In the same update, the YUI developers managed to royally mess up their style files, essentially breaking the menu. Either manually downgrade to YUI 2.4 or upgrade to Moodle 1.9.4 (the Moodle developers have provided a workaround (MDL-17218) for the bug).


;Outline
==== Outline does not show ====
:Off by default. This is where the YUI code is used place. Creates a collapsible tree of the course content.
;Messages
:Off by default. A link to the Moodle messages page.
;Calendar
:Off by default. The course calendar page;
;Gradebook
:Only available if the <code>showgrades</code> setting is turned on in the course. On by default.
;Participants
:Only available if the user has the <code>moodle/course:viewparticipants</code> capability. On by default.


=== Adding new items ===
The outline used to be turned off by default.


The code that generates this is in the <code>available_items</code> function of <code>block_yui_menu.php</code>. They are structured in an array. Each item is an entry, the key defines the item’s name which must be unique, but is otherwise insignificant. The value is another array which contains the following:
== Customisation ==


;text
The YUI menu blocks can be customised individually or globally. To edit it individually, go to the course that it is in and turn editing on, and an edit button should appear under the title of the block. This customisation allows the available menu items to be moved around and either hidden or shown.
:A string. The text inside the label. This is usually contains a call to the <code>get_string</code> function for localisation.
;url
:A string. Where the item points to. This is not a fully qualified URL, it is automatically prefixed with <code>$CFG->wwwroot</code>.
;icon
:A string. The URL for the icon, unlike '''url''' this actual isn't prefixed with anything and should contain the full path.
;default
:A boolean. Whether or not the item is displayed by default on unconfigured menus.
;title
: An optional string. Will put a tooltip on the item with the given text.


=== Icons ===
To edit it globally, go to the admin page and it should should up in the menu (under blocks). You can enable and disable menu plugins there as well as set their default ordering. It is also possible to write your own plugins. Look at the other plugins as a reference.


The icons that are used come from 3 different sources.
== Future Development ==


# The top-level icons for each item is set in the <code>available_items</code> function (see the above section).
There are no more plans to migrate the YUI menu to Moodle 2.0. Instead, it will be replaced by a similar block that will become part of the Moodle core. A migration plan should be developed.
# Most of the other icons are set in the <code>styles.php</code> css file. Some things like the <code>+</code> and <code>-</code> icons for the menu come from YUI. Other parts, like the icons for the section nodes and individual modules are pulled from standard Moodle icons.
# The resources are a bit funny. A resource is an activity module, and it will get the default resource icon set in <code>styles.php</code> like the other activities. However, a resource can specify an icon that overrides this. Because this is done on an individual basis, so it needs to be done when the javascript code creates that tree item. The end result is that the icons for each resource is overridden by setting the the <code>_yui_menu_icon</code> near the end of the <code>course_section</code> function in <code>block_yui_menu.php</code>. The actual setting of the background image is done elsewhere.


== External Links ==
== External Links ==


* [http://moodle.org/mod/data/view.php?d=13&rid=915 Modules and Plugins page]
* [http://moodle.org/mod/data/view.php?d=13&rid=915 Modules and Plugins page]
* [http://demo.mytwu.ca/moodle/course/view.php?id=2 Demo]


[[Category:Block]]
[[Category:Block]]
[[Category:Contributed code]]
[[Category:Contributed code]]
[[fr:Menu YUI]]
[[fr:Menu YUI]]

Latest revision as of 23:36, 8 June 2009

YUI Menu.png
The menu in Moodle 1.9
TypeBlock
DownloadLatest version
Source CodeCVS
Bug TrackerMoodle Tracker
LicenseGPL 3 or greater

The YUI menu is a course menu is inspired by the Course Menu+ from NetSapiensis.com as well as the one from Humbolt State University. It is freely available under the GPL 3.

Here’s how it’s different:

  • It uses the built-in YUI javascript libraries so it’s much smaller
  • It works fine, even on the highest error reporting levels.
  • It is XHTML compatible.
  • It’s easier to add new sorts of menu items (although not as easy as it should be).
  • The ‘Chapters’ and ‘Control Panel’ have been dropped because they added unnecessary complexity or belonged in a separate module.

Installation

Install this block in the standard way. Unpack it into the blocks/ directory. Then go to Moodle’s admin page and it will install itself.

Troubleshooting

For various reasons, you may have trouble installing this module. Here are a list of questions which have been raised in the discussion forums.

Unable to find block after installation

If you have installed installed the block and the installation went fine, you should be able to find it under Modules > Blocks > Manage blocks in the site administration menu. The one caveat is that its name (at the moment) is “Course Menu” not “YUI menu” as you might expect. You should also be able to go into a course page and add the block there (it will be also called “Course Menu” there).

Old Problems

Using the latest version of the YUI menu should solve all of these.

Error on page (Javascript)

The YUI menu depends directly on the YUI library in Moodle. Moodle 1.9.3 upgraded from YUI 2.4 to 2.6. Unfortunately, YUI broke backwards compatibility in this release. Early versions of the YUI menu won’t work with Moodle 1.9.4 or later. If you have this problem, update to the latest version of the YUI menu.

Outline is messed up and +/- icons not showing

In the same update, the YUI developers managed to royally mess up their style files, essentially breaking the menu. Either manually downgrade to YUI 2.4 or upgrade to Moodle 1.9.4 (the Moodle developers have provided a workaround (MDL-17218) for the bug).

Outline does not show

The outline used to be turned off by default.

Customisation

The YUI menu blocks can be customised individually or globally. To edit it individually, go to the course that it is in and turn editing on, and an edit button should appear under the title of the block. This customisation allows the available menu items to be moved around and either hidden or shown.

To edit it globally, go to the admin page and it should should up in the menu (under blocks). You can enable and disable menu plugins there as well as set their default ordering. It is also possible to write your own plugins. Look at the other plugins as a reference.

Future Development

There are no more plans to migrate the YUI menu to Moodle 2.0. Instead, it will be replaced by a similar block that will become part of the Moodle core. A migration plan should be developed.

External Links