Google Gadgets Block

Google Gadgets Block

by Anil Sharma -
Number of replies: 8
Is there a way to integrate Goolge Gadgets into Moodle, or to display their content into Blocks ?

When a google gadget is selected, it wants a javascript to be run inside an HTML page, for e.g :
<script src="http://gmodules.com/ig/ifr?url=http://www.kodey.com/modules/google_sector_summary.xml&amp;synd=open&amp;w=250&amp;h=200&amp;title=Google+Finance+Sector+Summary&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

Is there a way to run a script like this inside the "HTML Block" of moodle, or in any other place, like a "label" ?
Average of ratings: -
In reply to Anil Sharma

Re: Google Gadgets Block

by Dean Mattson -
Yes, I'd like to know this as well. Google has just come up with this amazing feature where you can create your own search engine and add it to a webpage. It'd be very cool if I could add this to some of my school's moodle pages.

Unfortunately, it doesn't seem to be working right now. Has anyone got it working? If not, would it be difficult to add this feature?

Thanks!
In reply to Dean Mattson

Re: Google Gadgets Block

by Dean Mattson -
Okay, I got mine working right now. I just had to click on the Toggle HTML Source button and paste the code in. Hey, I'm new! smile
In reply to Anil Sharma

Re: Google Gadgets Block

by Martin Hartnett -

Hello Anil,

Did you ever get an answer to your question on using xml coded gadgets?

The gadget I want is coded in xml and I too dont know if/how you can use xml im moodle, so I am stuck.

My workaround was to find an rss feed and use that  http://weather.yahoo.com/forecast/CHXX0049.html 

Its not exactly what I want, but would work for me until I can get more details on using xml

In reply to Martin Hartnett

Re: Google Gadgets Block

by Anil Sharma -
Hello Martin

It is possible to add google gadgets. When you find a gadget, and want to add it to your web page, it gives an option to "Get the Code" . This code is normally a line like :
<script src="http://gmodules.com/ig/ifr?url=http://1o4.jp/google/module/slim-reader.xml&amp;up_mtitle=Slim%20RSS%20Reader&amp;up_mfeed=http%3A%2F%2Fgoogleblog.blogspot.com%2Fatom.xml&amp;up_contentsnum=9&amp;up_titlelink=http%3A%2F%2Fgoogleblog.blogspot.com%2F&amp;synd=open&amp;w=320&amp;h=25&amp;title=__UP_mtitle__&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>

However, it works only it "Labels" and "HTML Block" , i haven't tried it in too many places, but it doesn't work in forum posts for sure.

Anil


In reply to Anil Sharma

Re: Google Gadgets Block

by Timothy Kane -

I am trying to use Google Translate Gadget. I have set the course to allow guests so Google can enter.

I login is as Admin. When I try to use the translator it will translate the page and then send me to the login page. You are then stuck at that page.

Any ideas?

The Google code is:

<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_Xlanguage=en&w=160&h=60&title=&border=&output=js"></script>


In reply to Timothy Kane

Re: Google Gadgets Block

by Matt Bury -
Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Timothy,

Personally, I'd recommend creating a new block to display each new Google Gadget. The main reason is so that you can easily deploy the block anywhere in your Moodle installation quickly and easily, and another reason is that if you want to edit the Gadget code embedded in the block, you won't have to do it for every instance of the block, i.e. if you just copied and pasted the code into HTML blocks.

Here's a simple block I created for displaying a Google Talk Gadget:

Save this script in a directory like this:

http://***MOODLEROOT***/blocks/googletalk/block_googletalk.php

<?php
class block_googletalk extends block_base {
function init() {
$this->title = get_string('Google Talk', 'block_googletalk');
$this->version = 2008121200;
}

function specialization() {
if(!empty($this->config->title)) {
$this->title = $this->config->title;
} else {
$this->config->title = '';
}
if(empty($this->config->text)) {
$this->config->text = '';
}
}

function hide_header() {
return true;
}

function preferred_width() {
return 210;
}

function get_content() {
if($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '<script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/googletalk.xml&amp;synd=open&amp;w=200&amp;h=400&amp;title=&amp;lang=en&amp;country=US&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>';
$this->content->footer = '';
return $this->content;
}
}
?>

Actually, for something as simple as a translator, you probably don't even need to use a Google Gadget. They're just simple HTML forms anyway. I'm using Google's Dictionary like this:

Save script as: http://***MOODLEROOT***/blocks/dictionary/block_dictionary.php

The Google icon is here:

Or you can hotlink to one of their default logos... just, er, well... Google it! ;)


<?php
class block_dictionary extends block_base {
function init() {
$this->title = get_string('Dictionary', 'block_dictionary');
$this->version = 2008121600;
}

function specialization() {
if(!empty($this->config->title)) {
$this->title = $this->config->title;
} else {
$this->config->title = '';
}
if(empty($this->config->text)) {
$this->config->text = '';
}
}

function hide_header() {
return true;
}

function preferred_width() {
return 210;
}

function get_content() {
if($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text = '<div align="center">
<form action="http://www.google.co.uk/dictionary" name="f" target="_blank">
<img src="../blocks/dictionary/Logo_25wht.gif" alt="Google" width="71" height="24" hspace="0" vspace="0" align="bottom"><strong> Dictionary</strong><br />
<input autocomplete="off" type="text" name="q" size="25" maxlength="50" value=""title="Search Dictionary">
<br />
<select id="dct-slc" name="langpair" onChange="">
<option value="en|en">Select a language...</option>
<option value="en|fr">English &raquo; French </option>
<option value="fr|en">French &raquo; English </option>
<option value="en|de">English &raquo; German </option>
<option value="de|en">German &raquo; English </option>
<option value="en|it">English &raquo; Italian </option>
<option value="it|en">Italian &raquo; English </option>
<option value="en|ko">English &raquo; Korean </option>
<option value="ko|en">Korean &raquo; English </option>
<option value="en|es">English &raquo; Spanish </option>
<option value="es|en">Spanish &raquo; English </option>
<option value="en|ru">English &raquo; Russian </option>
<option value="ru|en">Russian &raquo; English </option>
<option value="en|zh-TW">English &raquo; Chinese (Trad) </option>
<option value="zh-TW|en">Chinese (Trad) &raquo; English </option>
<option value="en|zh-CN">English &raquo; Chinese (Simp) </option>
<option value="zh-CN|en">Chinese (Simp) &raquo; English </option>
<option value="en|pt">English &raquo; Portuguese </option>
<option value="pt|en">Portuguese &raquo; English </option>
<option value="en|hi">English &raquo; Hindi </option>
<option value="hi|en">Hindi &raquo; English </option>
<option value="en|ar">English &raquo; Arabic </option>
<option value="ar|en">Arabic &raquo; English </option>
<option value="en|cs">English &raquo; Czech </option>
<option value="cs|en">Czech &raquo; English </option>
<option value="en|th">English &raquo; Thai </option>
<option value="th|en">Thai &raquo; English </option>
<option value="en|bg">English &raquo; Bulgarian </option>
<option value="bg|en">Bulgarian &raquo; English </option>
<option value="en|hr">English &raquo; Croatian </option>
<option value="hr|en">Croatian &raquo; English </option>
<option value="en|fi">English &raquo; Finnish </option>
<option value="fi|en">Finnish &raquo; English </option>
<option value="en|iw">English &raquo; Hebrew </option>
<option value="iw|en">Hebrew &raquo; English </option>
<option value="en|el">English &raquo; Greek </option>
<option value="el|en">Greek &raquo; English </option>
<option value="en|sr">English &raquo; Serbian </option>
<option value="sr|en">Serbian &raquo; English </option>
</select>
<br/>
<input type="submit" value="Search">
</form>
</div>';
$this->content->footer = '';
return $this->content;
}
}
?>

Hope this helps! smile