YUI based course menu

YUI based course menu

by Alan Trick -
Number of replies: 139
Hi,

I have created yet another course menu because I wasn't really satisfied with the current offerings. We have page for the course menu on our demo site. Download is available there. It's freely available under the GPL 3.

Here's how it's better:
  • It uses the built-in YUI javascript libraries so it's much smaller
  • The previous menus had some less-than-beautiful coding (like short tags, and ignoring null values all over the place). This is quite a headache for people with a strict server configuration.
  • It works fine, even on the highest error reporting levels.
  • It is XHTML compatible.
  • It's much easier to add new options (although not as easy as it should be).
I also dropped a number of features in the original menus:
  • Chapters: extra complexity. I didn't really see any point in them, if someone wants to add them back in and can do it without sacrificing easy of use that would be great.
  • Control Panel: I really think this belongs in a separate module or something. Some of it is course-related, some is not. That can be quite confusing.
Let me know what you guys think.
Attachment course_menu.png
Average of ratings: -
In reply to Alan Trick

Re: YUI based course menu

by A. T. Wyatt -
Greetings, Alan!
This looks nice. I am now inspired to think about what I really want course menu to do. First, I like the idea of having an all-purpose block so that you can use ONE block where formerly a combination was necessary to provide all the needed tools.

The original "control panel" idea probably came from the need to transition people from Blackboard to Moodle. It was a familiar term, and the content was similar. If you have never used that system, then it probably doesn't make as much sense! I do like being able to get to administrator functions, like changing passwords and quiz pools without having to use the administration block as well as the course menu block.

One thing I liked about Sandor's course menu block is the ability to hide and show different items, and re-order them. I see that you have put those in your block also.

When I installed your block on my local instance (windows moodle installer,
moodle 1.8.2+ (2007021520)
I had trouble figuring out how to get the outline to collapse and expand. It took me a while to realize that you had to click on another topic in order to close the first one; clicking on the same topic did not seem to have a toggle effect (or maybe it was inconsistent?) I would like to see the resources that expand under the topics to be indented. It gets kind of hard to tell what is what when they are all at the same indentation level. I will attach a screen shot from a typical course on our system.

Looks like this block has a lot of potential! Themes may affect some of what I saw.

atw
Attachment trinity_coursemenu.gif
Average of ratings: Useful (1)
In reply to A. T. Wyatt

Re: YUI based course menu

by Alan Trick -

Ah, silly me to expect people to read the README.txt file smile. Unfortunately, it’s not 100% automatic, you have to add a line to your theme’s header.html file. This is for the YUI CSS stuff. The line is:

<link rel="stylesheet" type="text/css" href="<?php
echo $CFG->wwwroot; ?>/lib/yui/treeview/assets/tree.css" />

Just put it somewhere between your <body> and </body> tags.

Let me know if that works.

In reply to Alan Trick

Re: YUI based course menu

by A. T. Wyatt -
Aha! Well, you are right. I completely missed that. Sorry! I'll see what it does tonight when I get home.
atw
In reply to Alan Trick

Re: YUI based course menu

by A. T. Wyatt -
I did as you said! I am now getting a different problem. The icons are sometimes not showing up if one of the topics is expanded. What do you think is happening?

atw
Attachment trinitycourse_menu_missingi.gif
In reply to A. T. Wyatt

Re: YUI based course menu

by Alan Trick -

Ah, right. That’s a bug. The way my code was working, it assumed that your theme provides icons for everything.

I just added a check for that and uploaded the new version to the demo site (it’s it the same place as before). You can download it again or manually change the following in styles.php:

$ico = '../'.$CFG->theme.'/pix';
to
if ($THEME->custompix) {
 $ico = '../'.$CFG->theme.'/pix';
} else {
 $ico = '../../pix';
}
In reply to Alan Trick

Re: YUI based course menu

by A. T. Wyatt -
Got it--now it looks like this!

I guess in our case, this theme change requirement would be harder because we have a lot of themes that people choose from. If you used only one or two, it would not be so bad! I have also found that the whole icon thing is sometimes tricky. I have another block that is apparently missing an icon, and I need to add the new docx, xlsx, etc. for Office 2007. Oh well, onward and upward!

atw
Attachment trinitycourse_menu_fixed.gif
In reply to A. T. Wyatt

Re: YUI based course menu

by Alan Trick -
Yeah, the icons can be a bit tricky. The top level icons are specified where the available menu options are, the rest of the icons are taken from your theme or the default moodle icon for that particular activity (except for resources, which each specify their own icon).
In reply to Alan Trick

Re: YUI based course menu

by faisal memon -

Hi Alan,

The latest version of the block works perfectly fine if the course is created from scratch. When i configure the block for the course restored from backup the weekly outline comes out bloank. The plus sing to expand the tree is hidden and the title of weeks is missing. Below is the screenshot. I am using  Moodle 1.9.12+ (Build: 20110525)

In reply to A. T. Wyatt

Re: YUI based course menu

by Chad Parmentier -
Does anyone know how open university is able to show the course menu block alone with-in an html page seemingly created with moodle? here is a link to an example. http://openlearn.open.ac.uk/mod/resource/view.php?id=169597

In reply to Chad Parmentier

Re: YUI based course menu

by Alan Trick -
First, the thing you linked to is not the YUI course menu. It's an older menu block (the OU is using the course menu, however). Second, that HTML page is a resource, you can have blocks display on resource pages (it's one of the settings when you create/update the block).
In reply to Alan Trick

Re: YUI based course menu

by Jenny Gray -
Alan, you may not have recognised the block on the OpenLearn pages as the YUI course menu, but it is!

We chose to rename it "Unit Outline" because we don't offer full courses in OpenLearn, and I've switched off most of the activity module links because we don't use many of them - for most units the majority of content is just text.

The second part of what you say is correct. We've simply set the html resource pages to display blocks. The only fiddly part was in getting JUST that block to display rather than ALL the sticky blocks that we have on the unit home pages - I'm not going to share how, its a nasty hack!
In reply to Jenny Gray

Re: YUI based course menu

by Alan Trick -
Ah, I got confused by Moodle's auto linking. The first link in that post was to the older course menu, but it wasn't quite a link.
In reply to Jenny Gray

Re: YUI based course menu

by Chad Parmentier -

The nasty little hack is precisely the hack that I want. This really cleans up a course (compose webpage resource) in certain applications. We would be  in debt to you if you were to share! wide eyes 

 

In reply to Chad Parmentier

Re: YUI based course menu

by Jenny Gray -
Well ultimately I'd like to see Moodle support another level of sticky blocks. Currently you can define "my" and "course", and I'd like to see "module" too. I thought I was the only one, but if not maybe we should put something in Tracker. Its such a big thing, it would take a while to do, because you'd have to create new page classes for the modules - and then the contrib ones wouldn't support it sad

So that's what I wanted to do! What I actually did was much nastier. I really can't encourage its use, and so I'm not going to post the code here! I'll send you a separate email with it though as you asked so nicely smile
In reply to Jenny Gray

Re: YUI based course menu

by Chad Parmentier -
I would really appreciate it! I work as an instructional technologist and am having a terrible time trying to get my instructors to interact with students and post content. They really only want to load blackboard quiz cartridges. I thought maybe if I showed them how OU puts lecture content together it might inspire them to use it and who knows maybe they will even post discussion boards and create a community of learners online. On the other hand I administer a Moodle site for k12 and they are wonderful with regard to interacting with students and facilitating discussion boards. They wanted the web resources (lectures) to have the course menu as it very usable and easy for students to read materials independently of weekly/topic content. My correct email is in my profile and again i a appreciate you help.

P.S I also have some custom code in our moodle installation that complements the Minted ims package and am almost finished with a new theme that is similar to yahoo.com. If you interested you are welcome to have the code. The only other code we have is a modified delete courses script that automatically turns off canceled courses. once I ma finished I plan to submit it to moodle.
In reply to Alan Trick

Re: YUI based course menu

by Nicola Bennett -

Hi Alan,

Please could you tell me how to get a block to display on a resource page. For example we are linking to an html file which opens in the same window but I would also like to see the course menu in the same window. Where is this setting when you create/update the block?

Thanks

In reply to Nicola Bennett

Re: YUI based course menu

by Jenny Gray -
You set it on the resource page, not on the block.

Look for the "show course blocks" checkbox when you edit the resource - you might need to click the "Advanced" button. Once the box is ticked and you've saved the resource, you should see all the sticky blocks for the course around the resource content.
In reply to Jenny Gray

Re: YUI based course menu

by Nicola Bennett -
My resource is 'Link to a file or website' and I can't see the "show course block" checkbox anywhere, even with the Advanced settings showing?
In reply to Nicola Bennett

Re: YUI based course menu

by Chad Parmentier -
They are talking about the Show course blocks checkbox in the "compose webpage" item under resources. The problem is this will show all blocks without the special OU code. See attached Screen Shot
Attachment checkbox.jpg
In reply to Alan Trick

Re: YUI based course menu

by Bill Mounce -
Alan,

If put course_menu into the mod directory, started Moodle, went to admin, and received this error message.

Module course_menu: /Applications/MAMP/htdocs/GreekHebrew.com/mod/course_menu/version.php was not readable

As you can see, I am running this on a local computer. As far as I can tell, there is no "version.php" in course_menu.

Any suggestions?

Thanks.

Bill
In reply to Bill Mounce

Re: YUI based course menu

by A. T. Wyatt -
Greetings, Bill!
Try putting it in the blocks folder, not mod.

atw
In reply to A. T. Wyatt

Re: YUI based course menu

by Bill Mounce -
Daaa. Sorry to waste your time. I will enjoy learning this. Thanks. --Bil
In reply to Alan Trick

Re: YUI based course menu

by Alan Trick -

I just release another version of the menu. You can get it from our demo site. This one removes the need to edit your theme’s header.html file (you should remove any changes you made for the previous version). It also does a bunch of other stuff to make it more compatible with existing themes and there's some documentation on how to edit the menu items in the README.txt file.

Hopefully that will fix most most of the problems people are having now.

In reply to Alan Trick

Re: YUI based course menu

by Jenny Gray -
I agree - this is really nice big grin

Are you going to put the code into moodle-CVS as contrib? I'd even support a bid for making it core if Martin D could be persuaded?

Jenny
In reply to Jenny Gray

Re: YUI based course menu

by Alan Trick -
I would love to, but I don't have CVS access. How would I go about getting that?
In reply to Alan Trick

Re: YUI based course menu

by Jenny Gray -
I think you just email (or message through this site) Martin Dougiamas and he can set it up for you.

You should also put something in the modules & plugins database at http://moodle.org/mod/data/view.php?id=6009 . That way people looking for a new course menu block will find yours as well as any others listed in there.
In reply to Alan Trick

Re: YUI based course menu

by A. T. Wyatt -
Greetings, Alan!

A small thing, and I don't know if it is hard, but if you are going to put your block into contrib and in the database, would you consider slightly changing the title? The reason is because some people might like to have your version of this block as well as one of the other versions. I would do that on my site (especially for testing and demo, where I could have them side by side). But I don't know how that would work when they all seem to have the same name (course menu) and the same directory name. Can you even install two blocks with the same name? I didn't want to try!

atw
In reply to A. T. Wyatt

Re: YUI based course menu

by Alan Trick -
Yeah, I should probably change the name, I just couldn’t think of a good one. What about “yui_menu”?
In reply to Alan Trick

Suggested YUI improvement

by Stuart Anderson -

Hi there, love the block and have tested under IE6, IE7, Firefox, Opera, and Windows Safari and all seems fine.

I have made a small improvement(?) which you may wish to add into your own code if you consider it worth while. I wanted to have a means of highlighting the current week or highlighted topic so that users could quickly jump to the current point in a course (on long weekly format courses in particular). My changes are as follows:

Applies from line 297 of the course_sections() function in block_course_menu:

// highlight for current week or highlighted topic
if ($course->format == 'weeks' or $course->format == 'weekscss') {
$highlight = ceil((time()-$course->startdate)/604800);
}
else if ($course->format == 'topics') {
$highlight = $course->marker;
}
if($section->section == $highlight) {
$sectionstyle = 'course_menu_icon_section highlight';
}
else {
$sectionstyle = 'course_menu_icon_section';
}

// js name mangling

$name = 'course_menu_section_'.$section->section;

$url="{$CFG->wwwroot}/course/view.php?id={$course->id}&$format={$section->section}";

$url = htmlspecialchars($url);

$out .= "

var $name = new YAHOO.widget.TextNode('$summary', root, $expand);

{$name}.href = '$url';

{$name}.labelStyle = '$sectionstyle';";

// add any resources inside

$out .= $this->course_section($course, $section, $name, $mods);

}

return $out;

}


Also in styles.php I've just added the style:

.course_menu_outline_tree .highlight {
 font-weight: bold;
}

The debugger doesn't report any errors and all seems well with the change. Hope it is useful to someone else too.

--Stuart

P.S. Sorry about the formatting of this post. Stupid HTML editor keeps mangling the code.
Attachment course_menu.gif
In reply to Stuart Anderson

Re: Suggested YUI improvement

by Alan Trick -
Wow, I'd totally forgotten about this thread. I like your changes, I think I'll add it to my version as well.

I've been pretty busy dealing with other things, but there are a number of enhancements I'd like to make to the course menu to make it way more flexible than it currently is. There's several of hardcoded things that really belong in configuration. I'll contact Martin and see if I can get some CVS action.
In reply to Alan Trick

Re: Suggested YUI improvement

by Alan Trick -
Well, I sent a message to Martin yesterday. I haven't gotten a reply back, but I guess he's probably a pretty busy person.
In reply to Alan Trick

Re: Suggested YUI improvement

by Jenny Gray -
I believe he is at the New Zealand MoodleMoot this week, so it may take a little while before he picks it up.
In reply to Jenny Gray

Re: Suggested YUI improvement

by Alan Trick -

He’s already responded once, so things are on their way smile

I’ve made some more changes to the menu. Now it supports menu items for any activity module (except “label”), even 3rd party ones, as long as they were coded properly. By default it only displays the ones in the course.

The visibility of the outline is now configurable. I also disabled it by default because it wasn't very helpful for our usage of it.

I still have a few more changes to do before I’m mostly happy with it. I want to make a system wide configuration for default settings, disabling items, and adding new ones.

In reply to Alan Trick

Re: Suggested YUI improvement

by Alan Trick -

Just a little update. I noticed that I've been added to the Moodle project on sourceforge. I checked out the cvs repository and I was able to add some directories for my project (see http://moodle.cvs.sourceforge.net/moodle/contrib/plugins/blocks/yui_menu/) but when I tried to add files I got this message:

**** Access denied: Insufficient Karma (alantrick|path/to/file|)
cvs commit: Pre-commit check failed
cvs [commit aborted]: correct above errors first!

I guess I don't quite have all the necessary permissions yet.

In reply to Alan Trick

Re: Suggested YUI improvement

by Paulo Penteado Filho -
I am having a problem tryingo to install yui_menu v. 0.2. I have put the yui_menu folder in the blocks folder. But, when I go to the administrator page, a blank page appear and nothing happens.
Any hints?
Paulo
In reply to Paulo Penteado Filho

Re: Suggested YUI improvement

by Alan Trick -
My first guess would be a PHP parsing error. What version of PHP do you have? If your still using PHP 4 you'll need to edit yui_menu/block_yui_menu.php line 34. Change "public static" to "var static". I think that should do it (though I haven't tested).
In reply to Alan Trick

Re: Suggested YUI improvement

by Paulo Penteado Filho -
Alan,
Thank you for your answer. I changed line 34, but it didn't work: the same problem remains. My PHP version is 4.3.10.
Paulo

In reply to Paulo Penteado Filho

Re: Suggested YUI improvement

by Alan Trick -

Oh, it looks like it should just be "static" in PHP 4, no "var" (http://php.net/manual/en/language.oop5.static.php). If that doesn't work, try setting $CFG->debug = E_ALL | E_NOTICE; in config.php

In reply to Alan Trick

Re: Suggested YUI improvement

by Paulo Penteado Filho -
It didn't work. I set $CFG as you suggested and now I get a message error:

Parse error: parse error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /var/www/html/moodle/blocks/yui_menu/block_yui_menu.php on line 34

Should I put just "var" on line 34 of
block_yui_menu.php?

In reply to Paulo Penteado Filho

Re: Suggested YUI improvement

by Alan Trick -

Well, as far as I can tell, PHP4 doesn't support class variables. I'll make a workaround in the next version using a global. For now you can just remove the line. Then change line 92 to $menuid = 'yui_menu_tree_1'; and remove line 93.

This little means that you can only have 1 instance of the menu though, but I don't think we normally allow more than 1 anyways.

In reply to Alan Trick

Re: Suggested YUI improvement

by Paulo Penteado Filho -

Thanks a lot! I followed your instructions and now it is installed and working. A very nice block, indeed.

In reply to Stuart Anderson

Re: Suggested YUI improvement

by Alan Trick -
Ok, I've added these in to my version. I'm not terribly happy about the way I'm checking for course formats though. It's quite hackish and brittle (especially if someone creates their own format).
In reply to Alan Trick

Re: Suggested YUI improvement

by Michael Woods -
Picture of Core developers
It appears that this block is not picking up any "Books" that have been added to a course. Any advice on getting these to appear in the block?
In reply to Michael Woods

Re: Suggested YUI improvement

by Alan Trick -

That's odd. It works find for us (we use the book module here and there too). Can you show me an example?

In reply to Alan Trick

Truncated Menu items

by Mike Chambers -
Hi Alan,

Great work on this block. Works fine on the version of Moodle (1.8.2) we have installed.

However, I have discovered an issue with the menu display (current installed version 2007071200).

This may have already been solved, we might just be running an older version -- anyway.

If a heading or item displayed within a course contains an ' (apostophe) the course menu display appears truncated; it displays course outline -- but without the nested items below it.

Any ideas?

Mike Chambers
In reply to Mike Chambers

Re: Truncated Menu items

by Jenny Gray -
I've seen this on our (older) version too.

The way I dealt with this was to wrap all the titles for the nodes in addslashes() calls just before the calls to new YAHOO.widget.TextNode. I had to do it twice, once for $summary and then further down for $instancename.

It may be the Alan has fixed this already, but just in case, the above worked for me!
In reply to Jenny Gray

Re: Truncated Menu items

by Alan Trick -

One of the old versions was buggy that way. The solution right now is actually (oddly enough) to use htmlspecialchars* with ENT_QUOTES on it. Now, that you mention it, addslashes would be a good idea too, since the current code still won't handle \'s properly. I'll update my code there. Thanks for pointing that out.

* this is because the YAHOO.widget.TextNode takes the text as if it were HTML. This adds to the collective confusion. I've filled a bug about this and Yahoo is fixing it in a future version. I'll update yui_menu when they change that.

In reply to Alan Trick

Re: Truncated Menu items

by Alan Trick -

By the way, I've fixed this. All the changes that I make right now are going into the CVS repository.

In reply to Alan Trick

Re: Truncated Menu items

by Jenny Gray -
Hi Alan,

I migrated our sites to the more up to date code (version 2007092000) a few weeks back and everything seems fine smile

I've made a couple of changes to the code and I wondered if any-one else would like these things to be configurable...

- I'd like to switch on and off the Participants and Modules links in the block config. I'm sure I saw one version of the block which did this, but its gone again?

- I wanted to jump down the course home page rather than collapse it to show only one topic/week. The choice of which to do could be a config setting too perhaps?

- I've upped the character limit for truncate_html to 255 so that you get longer topic/week titles showing. Again, perhaps the limit should be a config setting?

If any-one is interested, I'm willing to put together the changes so these things are configurable? What do you think?
In reply to Jenny Gray

Re: Truncated Menu items

by Alan Trick -
Hi, I'm pretty sure the switching on and off should still work. If it's not then that's a bug. When editing is turned on, there should be a way to configure the block.

As for the jumping, I agree. The only problem is what do you do if only section 2 is showing and they click on section 3? Now that I think of it, I think the best way to implement it would be to check which sections are visible. Then link to the id fragment (i.e. #section-1 or whatever it is) for the visible ones, otherwise do what it does right now. How does that sound?

I also like the idea of configuring truncate_html. I was rather lazy when I wrote that bit.
In reply to Alan Trick

Adding some config options to yui menu block

by Jenny Gray -
OK, I'm an idiot. On the modules on/off its because I commented the whole lot out! I guess I thought that was quicker than doing the same config settings in several places, but its not really necessary.

With the jumping, what I was thinking is that the config for the block would offer a choice: "do you want to jump down the page, or show only the selected section" so the block code would handle the either or. I hadn't really thought about the problem of hidden sections. I guess that's because I've taken out the thing you click on in the main topic course format to hide sections, so it never happens on my site. But yes, if they've chosen the "jump to" config setting it ought to check first if the section is visible, and if it isn't do the show/hide instead.

I'll also look at adding a config setting for the truncate_html.

Do you want a patch for all this, or shall I just commit it to CVS?


In reply to Alan Trick

Adding some config options to yui menu block

by Jenny Gray -
So here's what I'm thinking of, attached as a patch. I've:

  1. made a config option for the length the section intros are truncated to
  2. made a config option for the text appended to truncated section intros
  3. made a config option for whether to scroll down or reveal a single section
  4. put additional language strings in to support these
  5. changed the main block code to use 1 and 2 in the truncate_html function
  6. changed the main block display code to use 3, but only to scroll if all the sections are displayed
  7. changed the way default visibility is assigned if the block is used as a sticky block.
I've just realised the code at 6 might not work for anything but the topics course format... I'll test that. [edit... tested and fixed for urls with week= and topic= parameters. Not sure what your twu course format does, you might need to add for that. New patch attached.]

Anyway, if you could review and let me know what you think, that'd be great.

In reply to Jenny Gray

Re: Adding some config options to yui menu block

by Alan Trick -

It looks good. There's a bunch of OU specific stuff in the patch file (in the `-` lines) so I'll just leave it up to you to patch the version in CVS (I'm assuming you have access to it).

Just 2 things:

Is there a reason you're doing strpos($_SERVER['REQUEST_URI'], 'week=' instead of checking $_GET?

The twu format is a courses format we use here at Trinity Western University. For the most part it's the same as the topics format. If I didn't stick that code in there though, the menu didn't know to treat it like the topics one. I don't know if it's actually necessary though. We could change block_yui_menu.php to read (at line 112-120 in the patch):

// check what the course format is like $hidden = false; foreach (array('topic', 'week') as $param) { if (isset($_GET[$param]) && $_GET[$param] != 'all') { $hidden = true; } }

No need to mention formats. However, this is still problematic because if you hide the other sections the will stay hidden until you make another request with the topic=all or something.

By the way, if you want to chat sometime, my jabber address is alantrick@gmail.com. I'm not always available, but sometimes that a more efficient way to communicate.

In reply to Alan Trick

Re: Adding some config options to yui menu block

by Jenny Gray -
Hi, yes I do have access to CVS and have committed the changes. Thanks for being so willing to let me tinker with your block.

I didn't have a reason for using the SERVER variable instead of GET - a brain fade moment obviously. blush

I've changed it over to use your suggestion anyway, as its much neater.

I did wonder about users who have the scroll config option, but have hidden sections, whether I should unhide everything then scroll rather than just show the single requested section. The thing is, I won't actually use that code, and I suppose neither will you. Perhaps we should wait to hear what some other users think?


In reply to Jenny Gray

Re: Adding some config options to yui menu block

by Alan Trick -

Unfortunately, the course formats seem to be more of an accident than anything else. It looks like they figure out which section to display based on a few things and put the result in $displaysection. Here's the example in the topics format (lines 31 to 39). The variable is null if the nothing is hidden, otherwise it's set to the section number that is being displayed.

What I'd like to do is just automatically link to "#section-{$section->section}" unless the $displaysection global is set (in which case we use "{$CFG->wwwroot}/course/view.php?id={$course->id}&$format={$section->section}"). No configuration should be needed.

In reply to Alan Trick

Block config form number problem

by Jenny Gray -
Just back from my summer hols and having another look at this. I'm not exactly sure you could do about a particular problem I've got, but I thought I'd log it in case any-one else comes across it.

I was having trouble getting the eye to open and shut in the block config. It turned out to be because the javascript looks for document.forms[0][id].value and I've got a site search form in my header so that's taken forms[0] and the block config has become forms[1].

If I change the config_instance.html javascript to look at forms[1][id].value it all works perfectly smile.

In an ideal world I'd find the time to track down where the <form> is created and give the form a name that you could then use in the javascript instead of relying on the order. Sadly time is against me - any-one else out there know?
In reply to Jenny Gray

Re: Block config form number problem

by Jenny Gray -
OK, I've worked it out. in lib/blocklib.php the form is created around line 515.

I've committed a change to HEAD and 1.9 stable with name='block-config' so the config_instance.html javascript can look to forms['block-config'] rather than relying on how many other forms the theme might have in the header.

I put a bug in Moodle Tracker to document this just in case http://tracker.moodle.org/browse/MDL-11159

I found something else along the way. The first time you click on either the top or bottom thing in the config list, it defaults to show. I think this is because the default value hasn't been set up in the code for these. I fixed it by changing line 34 of config_instance.html from:

if ($v['default']) $show = true;

to:

if ($v['default']) {$show = true;$config='show';}

The reason why I've been doing this? I got approval from my programme manager to use this block on our sites smile so it should go live with our next release in mid October. Thanks so much for developing and sharing it!



In reply to Jenny Gray

Re: Block config form number problem

by Matt Albert -
I have yet to be able to get this block to work in 1.9 beta+ Any suggestions?
In reply to Matt Albert

Re: Block config form number problem

by Karlene Clapp -
I didn't do anything special to get it working. I just dropped it in there. Mine was installed on an upgraded moodle, not a clean install of 1.9 beta. What problem are you having specifically?
In reply to Matt Albert

Re: Block config form number problem

by Alan Trick -
I haven't done any testing on 1.9 yet, so I don't know. I'll try it out and see what happens.
In reply to Alan Trick

Re: Block config form number problem

by Alan Trick -
From what I can tell, I think it might be an issue with themeing. I've only glanced at it though.
In reply to Alan Trick

Re: Block config form number problem

by Matt Albert -
It works! I was having unrelated server trouble and after a restart all is well in 1.9beta+ and this block.
In reply to Matt Albert

Re: Block config form number problem

by Alan Trick -
It turns out my problems were because of my name change from “course_menu” to “yui_menu”. I hadn’t changed everything some some of the elements were missing styles. Other than that, it seems to be working fine with 1.9.
In reply to Alan Trick

Re: Block config form number problem

by Matt Albert -
What would be really interesting is to get this course_menu block to appear on all activity pages like forums. It would go along way to solving some of the UI issues with moodle. Has anyone done this or know how to?
In reply to Matt Albert

Re: Block config form number problem

by Alan Trick -
The display of the various activity pages is all done by that activity. The "resource" activity will let you add the blocks to the activity, but others don't. AFAIK, the only way to do it would be to edit the code for those modules.
In reply to Alan Trick

Re: Block config form number problem

by Matt Albert -
It does seem that code needs to be modified to get this to show up. What I am confused by is exactly where and what code to drop in there to get the blocks to show on a mod like forums. Any suggestions?
In reply to Matt Albert

Re: Block config form number problem

by Alan Trick -
I think that would need to be taken up with the forum maintainer. There is an applicable_formats method on the block class, but that doesn't seem to help at all.
In reply to Alan Trick

Re: YUI based course menu

by DoVisH DoVisH -

hello to everyone,

any chance to have YUI BLOCK in the front page?

thank you

In reply to DoVisH DoVisH

Re: YUI based course menu

by Alan Trick -

Hi, I haven't actually tested it out, but I don't see why it wouldn't work on a front page.

Of course, it's probably not going to work as you would like, since the things that are in the menu don't really apply to a front page. Can you tell me what are you looking for?

In reply to Alan Trick

Re: YUI based course menu

by DoVisH DoVisH -

Hello Alan,

well in front page drop down block's menu the YUI course menu doesn't show ... but if I go to any other course it appears under the block's menu.

What I really want is a block very similar to yours (with the same functionality) but that allows me to create my own tree of resources or questionnaires or other activity/resource ...

Per example, I would like to have in my front page a block course that would have a tree titled articles with a bunch of different articles ...

thanks once more.

In reply to DoVisH DoVisH

Re: YUI based course menu

by Jenny Gray -
The reason it doesn't show in the drop down blocks menu on the site home page is because of the applicable_formats function.

If you add 'all' => true so the function looks like this

function applicable_formats() {
return array(
'all' => true, 'course' => true,
'my-index' => false,
);
}

Then the block will appear in the list. You'll need to configure the block then as normal to control what it displays. On my site I don't get anything helpful, but that's because there's not much at my top level - yours might work better!
In reply to Alan Trick

Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
Hello,

I'm having difficulty in just trying to have the block to work as I've noticed that when I clicked on Notifcation, no tables where created.

I've added blocks before so it should work.

here is my platform:

Ubuntu Server 7.10
Moodle: 1.9 + (Build: 20080402) (2007101509)

Steps:

1. click on notification, nothing happens

2. when to a course and block is not available.

what tables are affected (mdl_block?) and what tables are created?

Thank you.


In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
The block doesn't create any tables, it would add a row in mdl_block and also when the menu is added in a course it adds a row in mdl_block_instance.

Are you sure that the block is in the right directory and is readable by the webserver?
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
Hello Alan,

I noticed that when I tried it before it added a row in mdl_block and now it no longer adds them after a reinstall. I've deleted the block from the block directory and tried to reinstall and as I mentioned, it's nowhere to be found in any of these tables.

I block is in the right directory and is readable by webserver because I changed the owner and gave full permissions just to test so that should not be an issue.

For my own clarification, which directory is the "right" one as you mentioned?

Thanks

LN

In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
I must have screwed up the download somehow sad

Edit: No, that can't be the problem, the code in the tarball exactly the same as the code I have on this site (https://courses.mytwu.ca/demo/moodle/course/view.php?id=2).

The right directory should be {$CFG->dirroot}/blocks/yui_menu

Can you tell me what version of PHP and what database you're using? Also try enabling debug output and see if that tells you anything.
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
I have deleted the entire application (Moodle) and will try and reinstall it again.

For the record, it was in the correct directory.

If I encounter the same anomaly again, I'll reply again with more specifics

thanks
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
Okay...

still nothing ...

no entry in mdl_block and not surprisingly, none in mdl_block_instance

I notice that the yui_menu permissions are: drwxr-x---

this is weird how it doesn't work .. the OS is Ubuntu Server 7.10


In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -

Who's the owner of the the yui_menu directory and who's your web server running as?

By default (I think) Apache runs as www-data. If the directory is owned by a different user account, then Apache probably can't read those files. You can fix that by running chmod -R o+rx yui_menu.

In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
Okay,

I'm still not able to get the menu to work.

These are the steps I've done from scratch on a new system.

1. installed a fresh version of Moodle 1.9+ (April 30th build)

2. installed the block and made sure the permissions and owners are properly

3 Clicked on the Notifications link to execute the installation of the block... the message I got was this:
-------------
yui_menu
Course Menu tables have been set up correctly
-------------

4. Checked the mdl_block table and saw that it's now there.
-------------
52 | yui_menu | 2007092000 | 0 | 0 | 1 | 0
-------------

5. When to a course and tried to add the YUI Menu block but I don't see YUI Menu as one of the options I can add.

What else am I missing?

Thanks






In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
I think it's called "Course Menu".
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -

Hi Alan,

That's what I thought too so I added it but I don't see the collapseable menu =( or does it depend on the course contents?

In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by HJWUCGA INC. -
Okay.. I know what confused me .. the outline feature was not enabled by default.

I'll see how this goes ... =)


In reply to HJWUCGA INC.

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
Sorry about that, my fault. That really should be fixed. I disabled the outline by default on the version that we use at Trinity Western, but I didn't realize the change had creped into the official version.
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by Helena Jaeger -
Hi Alan,
I can't see the collapsable menu of topics either. Just the activities: forums, calendar, etc. And I don't know what it means "the outline feature is not enabled by default". How do I enable the outline to see the menu?
In reply to Helena Jaeger

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
There's three ways to fix this.
  1. Download the latest code in CVS (http://cvs.moodle.org/contrib/plugins/blocks/yui_menu/)
  2. in yui_menu/block_yui_menu.php on line 184 change the false to true.
  3. To change an individual menu. Turn editing on and click the "configure" icon on the block.
In reply to Alan Trick

Re: Does not show in 1.8.4+ and 1.9 build

by joe cool -
Thanks for the info, but I tried the above and still don't see the collapsible topics either.

I went into the yui_menu folder and did a CVS update.

I edited the file yui_menu/block_yui_menu.php and saw that what USED to be on line 184, was now on line 193:

$base = array(
'outline' => array('text' => get_string('outline', 'block_yui_menu'),
'url' => "/course/view.php?id={$course->id}&$viewall",
'icon' => "{$CFG->wwwroot}/blocks/yui_menu/icons/viewall.gif",
'default' => true),

I noticed the default value was already true. It was false in an earlier version of yui_menu which I had.

Then I deleted the block from Moodle's blocks admin page, and reloaded /admin/index.php

Anyway, the collapsing topics never appeared.

Any suggestions?
In reply to joe cool

Re: Does not show in 1.8.4+ and 1.9 build

by Alan Trick -
Check if there's a JavaScript error on the page. It would be helpful if I could see an example.
In reply to Alan Trick

Re: Strange theme behavior when using YUI

by Anthony Montalvo -
Hi Alan,

I've recently installed your YUI block and my users love it, however I've run into what I think is a CSS issue. I'm wondering if you can give me a hand in figuring out what's wrong. For reference, I'm using a theme based on the standard Moodle template.

The menu works perfectly when only one topic section is displayed (all the rest are hidden), as can be seen in the next two images:

Moodle_4.png

Moodle_1.png


The problem can be seen when all topics are shown. Specifically,
  • The menu's sidebar changes width depending on whether it's expanded or minimized
  • When minimized, the sidebar is very narrow but the content adjusts properly to the window
  • When expanded, the content widens and spills off the screen, braking the template and requiring a horizontal scroll
The following screenshots show the problem:


Moodle_2.png

Moodle_3.png

I really appreciate any help, this has been giving me headaches for weeks now!

All the best,
Tony
In reply to Anthony Montalvo

Re: Strange theme behavior when using YUI

by Alan Trick -
I'd guess it has something to do with the fact that YUI uses a table to make the menu, but that's mostly conjecture at the moment. Can you show me a copy of the page itself?
In reply to Anthony Montalvo

Re: Strange theme behavior when using YUI

by Mark Pearson -
Anthony,
I have just installed the yui_menu (after spending ages getting CVS to work ...) but I have not observed the behaviour that you describe. However, I am stumped as to how you minimize the block, so perhaps that's why. I do suggest that you choose a different theme for the course, perhaps a standard one (in Admin:Settings) and see whether it still misbehaves. It does seem as though it's a style problem and my approach would be to make use of the web developer extension for Firefox (you *are* using Firefox, aren't you?) which will allow you to debug things in the browser window. Firebug may also help...
Mark
In reply to Alan Trick

Re: Can't install YUI based course menu

by Lynn Daley -
Hi Alan I love your course menu block but I can only get it to work on my local test site and not on my server sites.

Test site is Moodle 1.9.2 (Build: 20080716) using apache 2 and php5

Hosted sites are apache 1.3.39 with php 4.4.7
One is Moodle 1.9.2+ (Build: 20080806) and the other is Moodle 1.9 + (Build: 20080402)

Can you think of any reason that it isn't working on the hosted server, but does work on the local site?

Regards, Lynn
In reply to Lynn Daley

Re: Can't install YUI based course menu

by HJWUCGA INC. -
Lynn,

Can you be more specific when you mentioned it does not work on your hosted server?

For example, were there any installation errors? can you see the folder in the directory? Are the permissions and ownerships set up properly?, etc.

that should help us troubleshoot it.

thanks

In reply to HJWUCGA INC.

Re: Can't install YUI based course menu

by Lynn Daley -
Hi Christopher, I've uploaded the file to my blocks folder and then extracted it. It's permissions are set to 755, the same as all the other blocks in there.

When I then go to admin/notification (logged in as admin) nothing happens. I don't see the installing tables message and if I look in the database I can't see any new tables, just the standard 198.

I'm not sure of any other permissions I need to set. Any ideas of where I need to look for the problem?

Edit (and now that I've tried it I can't install the certificate block either. Same thing so it is obviously a wider problem)

No that's not right - now I've installed the certificate module in moodle/mod and verify cert in moodle/blocks they both work fine, so it just seems to be a problem with yui_menu
In reply to Lynn Daley

Can't it show correct words on YUI based course menu

by max liao -
Excuse me!
I have a little problem.
I succeed in installing YUI based course menu.
I would like to display Chinese word on menu, so download language package
After using language package, find that it couldn't show correct words.
Someone say that must use "mb_substr".
So sorry!
I still couldn't figure out it.
Which file should be modified?
How should I modified this file??
In reply to Lynn Daley

Re: Can't install YUI based course menu

by Richard Wallace -
Alan

Yes I am having the same issue on a new install of Moodle 1.9.2, it does not come up with the instal process once I have clicked on the "Notifications" tab in the admin block.

I just tried to install in an old moodle 1.7 and it worked fine.

But love the block, so can not wait to get it working.

Cheers Richard
In reply to Richard Wallace

Re: Can't install YUI based course menu

by Alan Trick -
Hmm, we're using it with Moodle 1.9.2 (just updated to latest 1.9 code yesterday), but I actually haven't installed it for a while. I just tried deleting it and installing it today and it worked fine for me.

Can you tell me what version of PHP and what database you are using?
In reply to Alan Trick

YUI based course menu - not displaying correctly with Moodle 1.9.3

by Geoffrey Rowland -
Picture of Plugin developers
Had the Yui Course Menu working fine in Moodle 1.9.2+ but after an upgrade to Moodle 1.9.3 it is only displaying the outline icon and not the course topics/weeks. sad

Have tried reinstalling and poking around the configuration settings, with no luck. Any suggestions?
In reply to Geoffrey Rowland

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
Well, they've changed the version of YUI to 2.6 and that seems to be causing trouble.
Average of ratings: Useful (2)
In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Carina Martinez -
Picture of Plugin developers Picture of Testers
I had same problem, but it works fine in my Seamonkey browser... confuso
In reply to Carina Martinez

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
That's weird, I've updated the files in CVS so the Javascript bit should work in any browser. However, 2.6 has another bug with it's CSS files and images that will still probably make everything look wrong.That should be a problem no matter what your using.
In reply to Geoffrey Rowland

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
Well, YUI 2.6 requires another Javascript file, so I've modified it to get that to work. There's also a problem with the CSS in YUI. I've submitted a bug report, hopefully it will get fixed soon.
Average of ratings: Useful (1)
In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Geoffrey Rowland -
Picture of Plugin developers

Hi Alan.

Thanks for your prompt and informative responses. For the moment, we have just replaced the entire contents of the /lib/yui (2.6) folder in Moodle 1.9.3 with YUI 2.5.2 (specifically, the contents of the /build folder) and all seems to be working again cool

Geoff

In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Jenny Gray -
Do you have a Moodle tracker bug for this as well that I could watch? I'm keen to revert to core code as soon as possible.
In reply to Jenny Gray

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -

Good idea. I've submitted a Moodle bug report as well now.

In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Ashley Holman -
Hi Alan,

I'm using the latest Moodle version and latest yui block from contrib. I get the following javascript error in IE7 when loading a course page that contains the yui menu block.

The error also happens in IE6 and Firefox (with firebug enabled).

I believe we've had this problem since Moodle updated to YUI 2.6.

Do you get the same error/know what the problem is?

Thanks
Ash
Attachment yuierror.JPG
In reply to Ashley Holman

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
I can't reproduce it on our system at the moment. But that might be because I manually replaced YUI 2.6 with 2.5. Now that Moodle's fixed the messed up files in YUI, I should try it again. I'll try to get it done when I get to work tomorrow.

By the way, could you paste the error message from firefox (including the javascript file it's erroring in). IE's error messages are somewhat less than helpful.
In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
We just got a lovely amount of snow and ice, so I won't be going into work today. I'll look into this later this week.
In reply to Alan Trick

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Ashley Holman -
Sorry, my testing wasn't right, the problem is actually fixed in your latest CVS commit:

"update to work with YUI 2.6"

Fixes the JS error for me

Thanks!
In reply to Ashley Holman

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Warren Kleinman -
Moodle 1.9.4+ (Build: 20090211)
PHP 5.2.8

YUI Course Menu ver 0.3


Tried different themes, when trying to display outline, only shows Outline section, does not display the menu items below it for the sections. Found that if I click on Outline several times I actually saw a flash of the sections. It's like they are all hidden or something. No errors during install. Notifications all said successful.

Any thoughts? attached is screen shot of what I see when I have a a course with 15 sections.

Thanks

Warren
Attachment menu.JPG
In reply to Warren Kleinman

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Warren Kleinman -
Updated to latest block_yui_menu.php in CVS and now I have Courses listed but the icons aren't displaying. see attached


Attachment menu.JPG
In reply to Warren Kleinman

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
If you're using Moodle >= 1.9 and you haven't updated recently, you may be having trouble with another YUI bug. The Moodle developers made a work around though so it should work if you update to the latest stable version.
In reply to Warren Kleinman

Re: YUI based course menu - not displaying correctly with Moodle 1.9.3

by Alan Trick -
Yeah, there must be a javascript error. To put it shortly it shortly, the download on out website is a bit old and doesn't work with the current version of moodle. Yahoo introduced an incompatibility in YUI 2.6 fâché If you get the code from CVS it should work fine.
In reply to Alan Trick

Re: YUI based course menu

by Gianpaolo Valero -
Hi,

I installed this plugin. I can tell you that i like it already.

I just have one problem. I chose to showe the outline. So, it shows every topic of the course. But, whenever i click one of the links it takes me to the preview link i cliked before.

Example: First time i clicked topic 4 Resutl: it took me to the page where it was. Then I clicked topic 2 and it took me to topic 4. Then i clicked topic 3 and took me to topic 2.

any idea what could be happening?
In reply to Gianpaolo Valero

Re: YUI based course menu

by Alan Trick -
Can you show me an example? It could be that you have a label in section 2 with the text "Topic 3".
In reply to Alan Trick

Re: YUI based course menu

by Jane Davies -
Hi Alan

Could you tell me how to add back the control panel using the yui_menu instead of the course_menu?

Regards
Jane
In reply to Jane Davies

Re: YUI based course menu

by Alan Trick -

I didn't include it because it struck me as something that was feeping creaturism and something should probably done separately anyway. That said, it shouldn't be too difficult to modify yui_menu to include it. If you have a copy of HSU's course menu, you should be able to just add this bit of code in block_yui_menu.php it would go between lines 190 and 202 in the latest version of that file.

    'controlpanel' => array('text' => get_string('controlpanel','block_course_menu'),
        'url' => "/blocks/course_menu/controls/controls.php?id={$course->id}",
        'icon' => "{$CFG->wwwroot}/blocks/course_menu/icons/configure.gif",
        'default' => true),
In reply to Alan Trick

Re: YUI based course menu

by Jane Davies -
Thanks Alan, i now have the control panel back. There's a small problem with it though in 1.9 when logged in as a teacher, i only get access to the student control panel, not the admin one. I know this has nothing to do with you but are you able to help, or point me in the right direction to look? This worked correctly in 1.7, but with the new Roles in 1.9 its broken sad

Regards
Jane
In reply to Jane Davies

Re: YUI based course menu

by Alan Trick -

It looks like the control panel is using a rather old API and making calls to functions like isteacher and isguest that have been deprecated for a long time. They still should work, however. Check your teacher role, it should have a drop-down for "legacy role" make sure that is set to "teacher" or something like that.

If that doesn't work, you could try changing it to use the new API. This code is a bit hackish, but it gets the job done (I think). On line 20 of controls/controls.php change

if (isteacher($course->id)) {

to

$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (has_capability('moodle/course:update', $context)) {
In reply to Alan Trick

Re: YUI based course menu

by Jane Davies -

Thanks heaps for this Alan!  My legacy role for teacher was set to Course creator instead of teacher, so it was as simple as changing that.  Thanks for all your help.

Regards

Jane

In reply to Alan Trick

Re: YUI based course menu

by Saeed Rahman -
Hi Alan,
Many thanks for all your work on this module. I have downloaded and installed version 0.3 of yui_menu and am having some issues. Firstly I cannot see the outline icon, even though I can confirm that it is in the icon folder within the block. Secondly, I cannot see the expandable menu items, even though I have a course with resources, weblinks etc. Am I doing something wrong?

I am using moodle 1.9.2

Help!

Thanks
Attachment course_menu.jpg
In reply to Saeed Rahman

Re: YUI based course menu

by Alan Trick -
In Moodle 1.9.2 they introduced a new version of YUI with some changes and a bug.I mentioned the bug in an ealier post. Half of the problem (a new js file dependancy) is fixed in the CVS code of the yui_menu, the other half has been reported on the YUI bug tracker. Someone got assigned to it, but that's all I've heard about it.
In reply to Alan Trick

Re: YUI based course menu

by Andreas Grabs -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators
Hi Alan,

thank you very much for this great block! We often use it.
I found a little bug within the function "truncate_html". There is an false check of the length of the text. The text on this time is utf8-encoded. Some special signs are represented by more than one chars.
Example: the letter "ä" is represented as "ä"
If this letter is near the maxlength so it is cutted to "Ã".
My suggestion would be to decode the text before you truncate it and encode the text after that. For german strings it would be work. But I'm not sure whether this is working for other lang like jp sad.
I have tested the the following:
file: block_yui_menu.php on line 461

Original code:
if (strlen($text) > $max_size) {
$text = substr($text, 0, ($max_size - strlen($trunc))).$trunc;
}
return $text;

Changed code:
$text = utf8_decode($text); //inserted by grabs
if (strlen($text) > $max_size) {
$text = substr($text, 0, ($max_size - strlen($trunc))).$trunc;
}
return utf8_encode($text);
//changed by grabs

Thank you!
Best regards
Andreas
In reply to Andreas Grabs

Re: YUI based course menu

by Alan Trick -
Nice catch. I should have thought that. There is a function called mb_strlen that is precisely for solving this. The encode-decode method only works for a very small number of characters. I'll fix it when I get to work tomorrow.
In reply to Alan Trick

Re: YUI based course menu

by Alan Trick -
Petr pointed me to textlib which works without mbstring so I used that. I committed the patch to CVS. smile
In reply to Alan Trick

Re: YUI based course menu

by Andreas Grabs -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Translators
Hi Alan,

that's fantastic! I will try it as soon as possible.

Best regards
Andreas
In reply to Alan Trick

Re: YUI based course menu

by Dakota Duff -

Great block!

Things aren't quite lining up with our theme, though. Can you offer any suggestions?

Attachment course_menu.png
In reply to Dakota Duff

Re: YUI based course menu

by Alan Trick -

It's difficult to say without actually seeing the CSS and HTML that result in that. Could you link to the page?

Otherwise, this is a hack, but it will probable generate the desired results:

.yui_menu_outline_tree {
 padding-left: 1px;
}
In reply to Alan Trick

Re: YUI based course menu

by Emma Irwin -
We are using this menu as a static block across multiple page loads, and it was a requirement of ours that this menu's state be maintained. I spent quite a bit of time trying/failing with some ideas in the YUI sandbox for maintaining state, but ultimately have it working using cookies and some built-in YUI functions.

I am not sure if others out there are looking for something like this? If so I can work on taking out our other customizations (which you likely don't want) and posting the cvs version + this code.


In reply to Emma Irwin

Re: YUI based course menu

by Alan Trick -
Yeah, cookies would be the way to go. You could store the data in the database too, but that wouldn't be terribly efficient. As long as you don't bump the 4 kB size limit it should be fine.

I'd like to integrate the code into the main version. Can you post a copy of the code so I can review it?

Also, do you have access to CVS?
In reply to Alan Trick

Re: YUI based course menu

by Emma Irwin -
Hi Alan,

I have quite a bit of customizations to strip out, and absolutely I will put something together soon.

Regarding 4KB size. Yes, that was a pain for this. My original attempt was using the YUI function: getTreeDefinition(), which returns a lovely copy of the tree that can be passed in to rebuild that tree on new page loads. Unfortunately the size exceeded the cookie max even with a modest menu. My current alternative is to keep a comma-delimited string of the expanded branches (using subscribe() on expandcomplete and collapsecomplete). Ideally though getTreeDefinition() would have been preferred , and I would still like to find a way to use it.

I don't have access to cvs.



In reply to Alan Trick

Re: YUI based course menu

by Leo Dil -
Hallo Alan,

Great block. I've two question about it. Is it possible to highlight the active link? so if you click on an item, it will be for example bold or have a bigger font size?

if you want to add a new plugin how to do that?? I couldn't find anything about it.

Thanks a lot.

Cheers

leon