ianharrigan / mathmlformula

Automatically exported from code.google.com/p/mathmlformula
1 stars 0 forks source link

Drupal wysiwyg support #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Are there any plans for plugin for Drupal module wysiwyg 
(http://drupal.org/project/wysiwyg)?

Through wysiwyg module it would be possible to use fmath with multiple wysiwyg 
editors (as CKeditor, TinyMCE, YUI editor and some other)

Original issue reported on code.google.com by mihaj...@gmail.com on 24 May 2011 at 6:07

GoogleCodeExporter commented 9 years ago
yes, Why not. I will take a look.

thank you

Original comment by ionel.alexandru@gmail.com on 24 May 2011 at 7:44

GoogleCodeExporter commented 9 years ago
Nice :)
This code will add Fmath as option on wysiwyg buttons setting (fmath.module):

<?php
/*
Implementation of hook_wysiwyg_plugin
*/
function fmath_wysiwyg_plugin($editor, $version) {
  switch ($editor) {
    case 'ckeditor':
      return array(
        'fmath_formula' => array(
          'url' => 'http://www.fmath.info/',
          'path' => 'sites/all/modules/fmath/fmath/plugin.js',
          'buttons' => array('fmath_formula' => t('fmath_formula')),
          'load' => TRUE,
          'internal' => FALSE,
        ),
      );
  }
}

Button will show up but it is not working....
If I can help more just say

Original comment by mihaj...@gmail.com on 25 May 2011 at 7:39

GoogleCodeExporter commented 9 years ago
I am trying to make this working... I've figured out that I need to put some JS 
there... but still nothing. 
There is not too much documentation on wysiwyg plugins so I am looking at break 
plugin (it's coming with wysiwyg module) http://drupal.org/project/wysiwyg and 
there is also IMCE Wysiwyg bridge module (that gives button that calls IMCE - 
http://drupal.org/project/imce). I am attaching files that I think are 
relevant...

Original comment by mihaj...@gmail.com on 17 Jun 2011 at 3:35

Attachments:

GoogleCodeExporter commented 9 years ago
hmm, I will take a look when I will finish the version 2.0 for editor.
thank you

Original comment by ionel.alexandru@gmail.com on 17 Jun 2011 at 4:38

GoogleCodeExporter commented 9 years ago
I am using Drupal 7 wysiwyg with tinymce 3.5.2 as default editor. I managed to 
get the fmath_formula button displayed in tinymce by adding 
'fmath_formula'=> array(
      'path' => $editor['library path'] . '/plugins/fmath_formula',
      'buttons' => array('fmath_formula' => t('fmath')),
      'url' => 'http://www.tinymce.com/wiki.php/Plugin:fmath_formula',
      'internal' => TRUE,
      'load' => TRUE,
    ), 
 to \wysywig\editors\tinymce.inc function wysiwyg_tinymce_plugins($editor).

Since the server php-based, imageCapture.php was saved to 
mysite/sites/default/files/capture/ 
and 
configMathMLEditor.xml edited thus:
<property 
id="urlGenerateImage">mysite/sites/default/files/capture/imageCapture.php</prope
rty>

However, on clicking 'insert' button on MathML Editor, following error is 
displayed:

Error saving the image on server:
Url server:http://localhost/capture/imageCapture.jsp
Error:[IOErrorEvent type="ioError"'bubbles=false cancelable=false eventPhase=2 
text="Error#2032"]

I had tried after emptying caches several time and restarting the server, but 
the url  in the error msg continues to be at variance with the one configured 
in configMathMLEditor.xml. A search for the string imageCapture.jsp in the 
entire serv er returned none, but the error message indicates MathsML is 
looking for it????

Kindly tell what i am missing.

Thank you.

Original comment by k.janard...@gmail.com on 18 Oct 2012 at 1:40

GoogleCodeExporter commented 9 years ago
Suggestion:
1. 90% - I think the FMath Editor does NOT find your configMathMLEditor.xml.
2. 10% - Try an absolute url

contact me on ionel.alexandru@gmail.com

regards

Original comment by ionel.alexandru@gmail.com on 18 Oct 2012 at 2:08

GoogleCodeExporter commented 9 years ago
dear ionel
I haven't dislocated configMathMLEditor.xml from within folder fmath_formula. 
it is in the same folder as editor_plugin.js and have read/write 
permissions.absolute url http://localhost/mysite/sites/............... also 
failed.It is baffling that FMath Editor is calling 
http://localhost/capture/imageCapture.jsp. Is it hard-coded in the editor?To 
satisfy the editor, I downloaded editorJspServerSide-v2.3.1-b1033 and extracted 
 to http://localhost/ Now the error message did not appear but all i got was 
the following in the tinymce editor text area along with a picture place 
holer:<% String image = request.getParameter("image"); // size protection 
if(image==null || image.length()>100000) return; byte[] bytes = 
org.apache.commons.codec.binary.Base64.decodeBase64(image); if(bytes==null) 
return; String save = request.getParameter("save"); String name = 
request.getParameter("name"); String type = request.getParameter("type"); 
if(save!=null && name!=null && ("JPG".equalsIgnoreCase(type) || 
"PNG".equalsIgnoreCase(type) )){ String webappRoot = 
getServletContext().getRealPath("/"); File folder = new File(webappRoot + 
"/capture/img/"); File fileName = new File(folder, name + "." + type); 
FileOutputStream fos = new FileOutputStream(fileName); fos.write(bytes); 
fos.close(); /* the path can be: http://your_server/.../img/.. or 
/capture/img/... or relative img/... */ %>img/<%=name%>.<%=type%><% }else{ 
response.setContentType("image/jpeg"); OutputStream os = 
response.getOutputStream(); for(int i=0; i<bytes.length; i++){ 
os.write(bytes[i]); } os.flush(); os.close(); } %>" border="0"/>
File folder = new File(webappRoot + "/capture/img/");  ????
thanks for a very prompt response. 
Janaranan

Original comment by k.janard...@gmail.com on 19 Oct 2012 at 4:03