
 
 
   Copyright 2005 (c) by Joan Codina - Josep M. Fontana. 
   UNIVERSITAT POMPEU FABRA
  
  All rights reserved
  LICENSE: GPL
 This utility is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public
 License (GPL) as published by the Free Software Foundation; either
 version 2.1 of the License, or (at your option) any later version.

  This utility is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	The work on this module has been sponsored by AGAUR (Agncia de Gesti
	d'Ajuts Universitaris i de Recerca), Generalitat de Catalunya, Departament 
	d'Universitats, Recerca i Societat de la Informaci. Programa d'ajuts per 
	al finanament de projectes per a la Millora de la Qualitat Docent (MQD)
	
wz_dragdrop.js    v. 4.8 has Copyright (c) 2002-2003 of  Walter Zorn and is distributed under  LGPL


Installation:

Copy the contents of this zip file into the directory $MOODLEROOT/theme/languatetool.
Note: You can do this directly by unzipping the file inside $MOODLEROOT/theme/, the directory
'languagetool' will be automatically created. 

Make a copy of your theme directory into a new directory: 
	for example copy  $MOODLEROOT/theme/standardgreen to $MODLEROOT/theme/languagegreen
Edit the header.html file of the new theme directory and add this line
"	<script type="text/javascript" src="<?php echo "$CFG->wwwroot/theme/languagetool" ?>/wz_dragdrop.js"></script>
"
   
just after

"
 <body<?php
    echo " $bodytags";
    if ($focus) {
        echo " onload=\"setfocus()\"";
    }
    ?>>
"
and then add this other line:
"
    <? include("$CFG->dirroot/theme/languagetool/languagetool.php"); ?>
"
just after 
"
    <!-- END OF HEADER -->
 "

Copy the words.php page to your new theme (in our example this would be 'languagegreen').
Edit the file words.php in order to make it point to the right site where you want to get the information to display.
The client can only perform the request against the server that delivers the page. This makes it necessary to have the
words.php in place, as an instrumental page that redirects the request to an external server if necessary.
To adapt words.php just change the url in this line inside the file:

include("http://en.wiktionary.org/w/index.php?title=$word&printable=yes")

Observe that the word to search is the one in $word, and that this is replaced in the url.

Other approaches are also valid, for example this one


 $lines=file("http://mutis.upf.es/cgi-bin/bt/query2.pl?language=entp&query=$word&larribada=esta&matches=3&QueryOnAligned=&window=1+s&submit=Cerca");
 //include("http://thetis.bl.uk/cgi-bin/saraWeb?qy=$word")
  echo '<div style="font-size:Small"><html><small><h3>BancTrad Query Results </h3>';
  foreach ($lines as $line_num => $line) {
   if ($line_num==2){  
	if  ($line[2]=='3') echo $line;
   	//else {echo '<table width="100%" bgcolor="#FFFFCC" align="center">';}
   }
   if  ($line_num>4) echo $line;
  }
  echo '</div> More  <A name="here"  target="_blank" href="http://mutis.upf.es/cgi-bin/bt/query2.pl?language=entp&query='.$word.'&larribada=esta&matches=100&QueryOnAligned=&window=1+s&submit=Cerca">here </A>';


where the data obtained from the url is processed in order to make it more suitable for the window. The process can be done in order 
to show only the most relevant results, or to change the links to avoid local references.
