Instalando Dragmath en Moodle 1.9

Instalando Dragmath en Moodle 1.9

by Miguel Angel Daza -
Number of replies: 24


para la instalación me he basado en el escrito RE: Install dragmath on Moodle 1.7 de Shafie Salleh y que aparece en http://moodle.org/mod/forum/discuss.php?d=100464.

1) En primer lugar lo que hice fue descargar en http://moodle.org/mod/data/view.php?d=13&rid=1454

la versión para Moodle 1.9


Con el archivo dragmath.zip ya en tu PC descomprimelo y se crea una carpeta con el nombre dragmath que contiene una subcarpeta llamada lib y esta a su vez una más que se llama editor que a su vez contiene otra que se llama htmlarea y esta su vez tres carpetas más que se llaman: imagenes, plugins, popups.


2) copia el archivo em.icon.dragmath que encontraras en tu carpeta tu_PC...\dragmath\lib\editor\htmlarea\images\
y lo pegas en la carpeta del servidor  $CFG->dirroot\lib\editor\htmlarea\images\


3) copia el archivo dlg_ins_dragmath que encontrarás en tu carpeta tu_PC...\dragmath\lib\editor\htmlarea\popups
y lo pegas en la carpeta del servidor $CFG->dirroot\lib\editor\htmlarea\popups\

4) Copia TODO el contenido de la carpeta plugins en la carpeta del servidor $CFG->dirroot\lib\editor\htmlarea\plugins,
que no es otra cosa que una carpeta llamada DragMath.

5) copia el archivo htmlarea.php que está en tu carpeta tu_PC...\dragmath\lib\editor\htmlarea  y lo pegas en la carpeta del servidor
$CFG->dirroot\lib\editor\htmlarea. Reemplazando el existente,  del que previamente has hecho una copia.


6) En la carpeta del servidor $CFG->dirroot\lib\editor\htmlarea editar el archivo dialog.js y
añadir esta línea:   case "dlg_ins_dragmath": x = 540; y = 340; break;
que le da los valores de ancho y alto a la caja en la que mostrará al editor de ecuaciones DragMath, cuando
pulsemos sobre el botón con icono de Pi.

con todo lo anterior he conseguido que me funcione el editor.

Espero que os pueda ser de ayuda.

Un saludo.

Average of ratings: -
In reply to Miguel Angel Daza

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
My apologies as I don't speak Spanish, but if the drift of your posting is about using the information posted by Shafie to install Dragmath, the most important thing I can tell you is NOT to do that. Please go to the Moodle Dragmath docs and follow those instructions.

http://docs.moodle.org/en/Dragmath
In reply to Marc Grober

Re: Instalando Dragmath en Moodle 1.9

by Alexandra Patricio -

Hello !

I tried to install DragMath in Moodle 1.9 following the instructions in http://docs.moodle.org/en/Dragmath , but it doesn't work. I even can't see DragMath button in the editor.

Can someone help me, please ?

In reply to Alexandra Patricio

Re: Instalando Dragmath en Moodle 1.9

by Mauno Korpelainen -

Here you have the simplest possible dragmath installation guide (done in 2 minutes): download and unzip

http://download.moodle.org/patches19/dragmath.zip

That file contains folder dragmath - inside it subfolder lib - inside it subfolder editor and file adminlib.php (this is not the latest version of adminlib.php however...)

Simply copy or upload files from folder lib/editor of the unzipped dragmath package over the corresponding files of your current moodle folder lib/editor  ( = overwrite )

If you want to enable hiding dragmath from editor settings in administration menu you can add tags

'insertdragmath' => 'em.icon.dragmath.gif',

to your current adminlib.php (to function admin_setting_special_editorhidebuttons)

Without this change installing dragmath to latest moodle 1.9.2 took only 40 seconds when I tested it... wink

In reply to Mauno Korpelainen

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
This is one issue with packaging integrations that are not fully integrated.....

adminlib.php is included as part of the dragmath cvs as there were some major changes to adminlib.php moving from 1.8 to 1.9. While adminlib.php is current for 1.9.0, it is not current with respect to any changes post 1.9, and that is my responsibility so I will try to get a replacement in the cvs for dragmath asap.... but that means that once again if there are changes we risk a loss of compatibility unless there is a separate dragmath for all minor versions.... and that seems a bit ridiculous.

However, as we have agreed I think that dragmath will be moving to core functionality can we merge the features of the dragmath 1.9 adminlib.php with 1.9 Stable (as well as dragmath 1.8.4+ to 1.8.4 Stable ) so that this won't be an issue anymore? Then I can delete the adminlib.php from the dragmath CVS?

I will add this to the tracker. http://tracker.moodle.org/browse/MDL-16280

As far as functionality, I just did an install of dragmath to 1.9.2 and found things to be a little shaky on install until the cache was cleared out.
In reply to Marc Grober

Re: Instalando Dragmath en Moodle 1.9

by Jean-Pierre Pawlak -
Any chance of getting this 1.9.2+ adminlib.php file?
It's still missing in CVS.
Installing the old one kills my moodle admin frontpage...
In reply to Jean-Pierre Pawlak

Re: Instalando Dragmath en Moodle 1.9

by Mauno Korpelainen -
If you need to use dragmath you don't probably need the feature to hide dragmath button from editor... using file adminlib.php from moodle 1.9.2+ (from the same version as your main moodle package is) should work ok.
In reply to Jean-Pierre Pawlak

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
My apologies. As someone who went through the same kind of disaster I am responsible for your discomfort as I am the maintainer for dragmath at present.

FYI, the underlying issue is maintaining compatibility where a patch/plugin implements a "patch" to a core file. This was part of the conversation about maintaining dragmath when John gave up maintaining it and I am not sure about the balancing act we are currently engaged in (i. e. providing an updated adminlib.php in the dragmath distribution everytime someone makes a change in adminlib.php in core vs simply adding the one line in core.)

I have altered the docs to address this, referencing my suggestion that the line be added in core so that I can just delete the file from the dragmath CVS. As I state there, the idea of providing a patch to add one line or of trying to build a complete CVS of dragmath to match core is problematic (and is what shut down my moodle for a day this past spring)

Please vote.

In the interim, I do apologize for any problems. Use the adminlib that came with your distro and add the suggested line post 1.8.2 if you wish.
In reply to Marc Grober

Re: Instalando Dragmath en Moodle 1.9

by Maher Hassanieah -
Marc, I have a question for you! I installed drag Math on our Moodle 1.9 server and everything looked fine except for two things:
  1. After inserting the expression and saving changes, the mathematical expression is shown but with a hyperlink (to http://moodletest.aub.edu.lb/edited19x/filter/tex/displaytex.php?...), how can i disable this hyperlink.
  2. In the HTML editor, the DragMath button pushed the "Enlarge Editor" button out of the editor.
Can you please advise on the above mentioned?
Cheers!
In reply to Maher Hassanieah

Re: Instalando Dragmath en Moodle 1.9

by Mauno Korpelainen -

Maher,

1. is not caused by Dragmath, if you open /filter/tex/filter.php and find function string_file_picture_tex and there rows

if ($imagefile) {
        if (!file_exists("$CFG->dataroot/filter/tex/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
          $output .= "<a href=\"$CFG->wwwroot/filter/tex/texdebug.php\">";
        } else {
          $output .= "<a target=\"popup\" title=\"TeX\" href=";
          $output .= "\"$CFG->wwwroot/filter/tex/displaytex.php?";
          $output .= urlencode($tex) . "\" onclick=\"return openpopup('/filter/tex/displaytex.php?";
          $output .= urlencode($tex) . "', 'popup', 'menubar=0,location=0,scrollbars,";
          $output .= "resizable,width=300,height=240', 0);\">";
        }
        $output .= "<img class=\"texrender\" $title alt=\"$alt\" src=\"";
        if ($CFG->slasharguments) {        // Use this method if possible for better caching
            $output .= "$CFG->wwwroot/filter/tex/pix.php/$imagefile";
        } else {
            $output .= "$CFG->wwwroot/filter/tex/pix.php?file=$imagefile";
        }
        $output .= "\" $style />";
        $output .= "</a>";
    }

you just need to take away the underlined tags around image tags. The edited code should be

if ($imagefile) {
        if (!file_exists("$CFG->dataroot/filter/tex/$imagefile") && has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
          $output .= "<a href=\"$CFG->wwwroot/filter/tex/texdebug.php\">";
        } else {
        }
        $output .= "<img class=\"texrender\" $title alt=\"$alt\" src=\"";
        if ($CFG->slasharguments) {        // Use this method if possible for better caching
            $output .= "$CFG->wwwroot/filter/tex/pix.php/$imagefile";
        } else {
            $output .= "$CFG->wwwroot/filter/tex/pix.php?file=$imagefile";
        }
        $output .= "\" $style />";
    }

Refresh your browsers to see the difference - and TeX without that hyperlink.

In reply to Mauno Korpelainen

Re: Instalando Dragmath en Moodle 1.9

by Maher Hassanieah -
Mauno,

Thank you very much, you have been very helpful!!

Cheers!
Maher,

In reply to Maher Hassanieah

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
Mauno is much more the htmlarea expert, but I have to guess that this is a result of your screen resolution as I think all the icons are done in pixels. What is your screen display set at, what browser are you using and does anyone else have this issue?
In reply to Marc Grober

Re: Instalando Dragmath en Moodle 1.9

by Mauno Korpelainen -

Basicly it's a css problem - the more buttons the more space toolbar needs.

I made some padding values smaller in attached lib/editor/htmlarea/htmlarea.css - it should let you to put a couple of more buttons to toolbar...

Edit: ...and in some cases custom theme css might override css of htmlarea.css

In reply to Mauno Korpelainen

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
Problem though is the edit will have the same effect on all users, while MH may be the only one with the problem, no? That's why I am wondering whether simply fiddling the display geometry might not be the easiest way to address it...
In reply to Marc Grober

Re: Instalando Dragmath en Moodle 1.9

by Mauno Korpelainen -

TinyMCE is a little smarter than htmlarea to fix width of toolbar according to buttons and css...

It's true that if you have for example selected (forced) custom style sheet in browser and do not allow site css at all editor will look totally different so it might be a browser issue as well.

In reply to Mauno Korpelainen

Re: Instalando Dragmath en Moodle 1.9

by Ravi Vare -
Hi,
Sorry to say but you make fool to me.

lib/editor=overwrite

Not Working

It erase my old data.

Bye.
In reply to Ravi Vare

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
Hello Ravi, Who made a fool of you? I can assure you that if you follow the installation instructions in Moodle docs that dragmath installs with no trouble. However, reading two year old forum posts instead of the installation docs might result in your getting confused.
In reply to Miguel Angel Daza

Re: Instalando Dragmath en Moodle 1.9

by José luis gonzalez -
Tengo moodle 1.9 para windows y estoy trabajando
En localhost. He realizado todos los pasos, pero el icono de dragmath no aparece en el editor de html. la carpeta dragmath la puse en plugins, pero nada¿Qué podrá ser?
In reply to José luis gonzalez

Re: Instalando Dragmath en Moodle 1.9

by Livia Spini -
Hi, Jose!
I think you have to install java run time environment
In reply to Livia Spini

Re: Instalando Dragmath en Moodle 1.9

by José luis gonzalez -
Thanks Livia Spini I´d appreciated your help in my problem, I read that you must unzip files of dragmath before the install, so proceed to install moodle And happyfully it´s work, Icon of dragmath is visible and now I can working with math expressions.
Thanks a lot
In reply to José luis gonzalez

Re: Instalando Dragmath en Moodle 1.9

by Marc Grober -
See the troubleshooting section of the DragMath docs at docs.moodle.org
In reply to Miguel Angel Daza

Re: Instalando Dragmath en Moodle 1.9

by Manuel Tello Guerrero -

Siguiendo los pasos de instalción de Dragmath no tuve ningún problema para correrlo, sin embargo, al momento de lanzar la fórmula, no cambia la forma en que se inserta en el editor html.

Que estará pasado?

In reply to Miguel Angel Daza

Re: Instalando Dragmath en Moodle 1.9

by Manuel Tello Guerrero -

Hola Miguel Ángel:

A tu aportación, sólo agregaría lo siguiente como punto 7 y 8:

7) Administrar los iconos del editor a través de adminlib.php de la carpeta del servidor $CFG->dirroot\lib\ insertando la siguiente línea: " insertdragmath '= > ' em.icon.dragmath.gif , debajo de la línea: " insertsmile '= > ' em.icon.smile.gif ,

8) Activar notación Tex en tu Moodle: Administración del sitio>Módulos>Filtros>Filtros Administrar>Activado notación Tex

De esta manera pude editar el icono del editor y apreciar las expresiones que creaba en moodle.

Saludos.