Bookmarklet for quickly adding web pages to course -- testers needed

Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Number of replies: 21
I ginned up some code this weekend to create a browser bookmarklet that lets you add web pages to your course in just a couple of clicks (i.e., you find a web page you like, click the bookmarklet, and you get a popup window that lets you add the link to your course on the spot).

I used a slightly different approach than the one Jan Diercks discusses here, in that mine lives over in the admin block rather than being a separate resource type.

If anyone would like to test it, you can go here (login: teacher pw: teacher). I'm particularly interested in learning if it works okay on IE under Windows, as my Windows box is being recalcitrant at the moment (time for another reinstall...sigh). It does seem to work fine in Safari, Firefox, and IE on the Mac, and Firefox on Linux.

If the code works okay for others, and there's any general interest, I'd be happy to post it here.

Average of ratings: -
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Conrad Taylor -

Hi Tony

Excellent work, works will from your test site under IE 6.0 under Windows 2000 for me.. 

Can't wait for your posting of code...

Conrad

In reply to Conrad Taylor

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Thanks, Conrad!

I'm going to beat on it a bit more just to be positive everything is working, but be looking for the code soon.

In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by koen roggemans -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Translators
Great tool!
In reply to koen roggemans

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by N Hansen -
I tested it from inside your course first, where I manually entered the site. I accidentally typed the wrong address for the site I added the first time, and while it correctly found no site, it still added the site. See my two attempts at adding the Theban Mapping Project. It perhaps should validate whether a site can actually be found before adding it. However, I do like the fact that it goes to the site to show it, gives a teacher a chance to see if the link is ok or not.

Another option you should add to opening the resource in a frame and opening it in the same window, is opening it in a new window (or is it even possible to make an option to open in a new tab for Mozilla users?). As of now, if one wanted this option, one would have to go in and edit it.

Otherwise, this is an absolutely wonderful tool. Two things I would like to see possible with it in the future, giving it the ability to add links to a separate resource page, and allowing students to use it.

Oh, I used Firefox PR1.0 in Windows while testing it.
In reply to N Hansen

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Hi, n. I don't understand about typing the wrong name for the site. It should fill that in automatically (i.e., you browse to the site you want to add, click the bookmarklet link on your toolbar, and the site URL and title are filled in automatically). Did that not work for you?

Thanks for trying it!
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by N Hansen -
Before dragging it to my toolbar, I actually opened the page from the link, so that way it did not fill in the page automatically, I had to type it in.
In reply to N Hansen

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Ah. Maybe there should be a better explanation of how bookmarklets work. I think we're so used to just clicking a link on a page that it's hard to shift to a different mental model of how they work, at least that was the case for me when I first encountered bookmarklets.
In reply to koen roggemans

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Thanks, Koen! I'm enjoying looking at the links that everyone is adding, even if I don't speak Flemish (I assume?). smile

In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Przemyslaw Stencel -
Works great (WinXP Pro/Mozilla 1.7.2)

I'd like to second n's suggestion - why not have the option to open in a new window? Actually, why not simply use the same code and interface that Moodle uses when adding a resource (Link to a file or web site)?
In reply to Przemyslaw Stencel

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
I guess it was a combination of looking for simplicity and avoiding tearing into too much existing code. The mod.php file is a little complicated (it handles adding all kinds of resources, not just web pages) and I didn't want to dig into it far enough to figure out how to fill in the form information (I'm new at this smile). However, I'll give it a shot if enough people want it.
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Jon Bolton -
Picture of Particularly helpful Moodlers Picture of Testers
Well done Tony, looks good.
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Here's the code if anyone wants to play with it. I tried to adhere to the Moodle coding guidelines to the best of my understanding, but if I messed anything up please don't hesitate to point it out.

Also, while I have a lot of programming experience (being a CS refugee and all) I'm fairly new to the PHP language and definitely new to Moodle code. Constructive criticism is very welcome.

Usual disclaimers about experimental code apply. smile
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Ger Tielemans -

Nice tool for students and yes, real SC !!

Small wish I: when I come from a course and enter my personal bookmarks, it would be handy to have in the navigation bar a "back to last course" like in Willams bookmarks. '(OOPS clown already there: the goto choice!!)


For me it are two different products: William's BM is putting "donkey ears" inside Moodle, yours will be part of a toolbox that the student will carry from course to course. (So block is the right place)

Small wish II: is it possible to get a favicon if I paste the javascript link in my favorits?

When you start you wonder about choices with the same name: New, move, delete... for folders(left en files (right) can you make a visual marker?

Question: how can I save all my bookmarks into a file with IE6?

Wish III: export bookmarks as XML?

In reply to Ger Tielemans

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Jan Dierckx -

Ger, I think you are refering to this bookmark block based on Stefan Frech's code??

Small wish I: when I come from a course and enter my personal bookmarks, it would be handy to have in the navigation bar a "back to last course" like in Willams bookmarks. '(OOPS clown already there: the goto choice!!)

I used the goto button, because I wanted to be able to add bookmarks to multiple courses at once. I sometimes find a link which is suitable for all the students I have. That's why I didn't want the navigation bar to show one course...

Small wish II: is it possible to get a favicon if I paste the javascript link in my favorits?

Yes, but I think it will always be the one all the Moodle pages have.  

When you start you wonder about choices with the same name: New, move, delete... for folders(left) and files (right) can you make a visual marker?

Yes, I'm thinking of using the icons Stefan Frech provides, makes translating the block easier too... Maybe different colors for folders / bookmarks? 

Question: how can I save all my bookmarks into a file with IE6?

In IE click on File / Import and export...

Wish III: export bookmarks as XML?

Can't help you with that...

In reply to Jan Dierckx

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Ah! I couldn't figure out what Ger meant. Everything is clear now. smile
In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by N Hansen -
Tony-The readme file was a bit difficult to use because it lacked line breaks, also there seems to be no step 5 in the instructions. Is there something missing?
In reply to N Hansen

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Sigh.... I thought we were finally past the line-break/word-wrap issue. I guess that's with us forever. I'll reformat before I post again (probably sometime this weekend).

There is no step 6, actually. It's a typo. The step labeled step 6 should be labeled step 5. I'll fix that as well.

I should have Spanish and Korean translations available, too (not that those languages should be considered privileged, but those are the ones my officemates speak smile)

In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Jan Dierckx -
Really nice code. Learned a lot from it. At first I thought the form processing part was missing from your script, but ... blush of course mod.php already processes the form. I hadn't thought of that one, when I was trying to make such a tool. me->clown 
In reply to Jan Dierckx

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Tony Hursh -
Thanks, Jan. Yours is great, too. I think they fulfil different needs, and both are useful additions.

In reply to Tony Hursh

Re: Bookmarklet for quickly adding web pages to course -- testers needed

by Hans de Zwart -
Lovely tool!

Worked flawlessly on Firefox 0.8.

Thank you very much.
In reply to Tony Hursh

Updated code

by Tony Hursh -
As promised, here's an updated package.

Change summary:

1) Fixed typo in README file (there is now no mysterious "step 6")

2) Tried to improve word-wrap issues in the README file, but this was difficult due to there being a few lines of code in there. If you're having trouble, maybe a text editor that handles long lines would be a better way to proceed.

3) Clarified some docs and bookmarklet installation instructions.

4) Fixed a minor bug that might cause incorrect behavior when adding a web page that doesn't have a title tag.

6) Suggested Spanish and Korean translations for the help file are now provided, thanks to my officemates.

I looked into making this use the full-blown resource display tweaking (control of window size, etc.) that you get with the standard Moodle add resource function, but in the end I decided not to do that. It would greatly complicate the instructions for adding the modification (you'd need to add code to several places in mod.php).

If Martin or someone else on the official programming team wanted to add this feature to the general Moodle release it'd be worth altering mod.php, but otherwise probably not (since you'd have to do it all over again every time you upgraded). If you really need all the cool features you can always edit the resource after adding it. smile

Again, you can test out the modification before installing it by going to http://teachanything.net/course/view.php?id=38 and logging in as teacher, password teacher.

This code should still be considered experimental, but so far no one has reported any serious bugs.