Editor settings + spellchecking

Editor settings + spellchecking

Janne Mikkonen -
回帖数:51
Core developers的头像
I've just added editor settings and spellchecking (thanks to Marc Alier) into CVS.
It needs testing and I really would appreciate if someone could check the english language (mine is not so good).

Affected files:
  • new folder /moodle/lib/speller
  • /moodle/lib/weblib.php
  • /moodle/lib/defaults.php
  • /moodle/lib/javascript.php
  • /moodle/admin/editor.php
  • /moodle/admin/editor.html
  • /moodle/admin/index.php
  • /moodle/admin/configure.php
  • /moodle/lang/en/moodle.php
  • I possibly forget something 眨眼

- Janne -

回复Janne Mikkonen

Re: Editor settings + spellchecking

Gustav W Delius -

Great! Thanks! approve

You may like to test the code with debug on. There are loads of messages which make the configuration page unusable for example.

Can you give a bit of explanation on how to set up the spellchecker. I already installed aspell on my Windows server. What do I need to do next?

And finally: the HTML editor has disappeared, everything is plain textboxes. Javascript error is:  Expected identifier, string or number

回复Gustav W Delius

Re: Editor settings + spellchecking

Gustav W Delius -

I found the answer to my question about how to enable aspell myself. One has to set $CFG->aspellpath in config.php. Why not move this to the editor configuration screen as well?

And by the way, if you want to leave it in config.php, there are equal signs missing in your modified config-dist.php.

回复Gustav W Delius

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
The reason why $CFG->aspellpath is not in configuration screen that I wasn't sure if  I included it in to this post and you should have aspell installed before you can use it. There were one checking point missing in print_editor_config and now it should be there.

I was also making a code for spelling button for those who do not use HTML editor.
print_speller_button -function prints out the button (can be used before or after textarea) and you can add print_speller_code -function in if/else clause where use_html_editor -function is usually used:

if ($usehtmleditor) {
        use_html_editor("message");
} else {
    if(!empty($CFG->aspellpath)) {
       print_speller_code();
    }
}


I don't know does it make any sence...
回复Janne Mikkonen

Re: Editor settings + spellchecking

Gustav W Delius -
Thanks, everything is working well now. No more javascript errors, no more warnings in debug mode. I am not quite sure what you are saying with respect to having the aspell setup on the configuration screen rather than in config.php. Are you saying it is a good idea or a bad idea? One more wish: could you put the spell check button into one of the existing rows of buttons rather than into a third row all to itself? That would save screen space.
回复Gustav W Delius

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
If it's possible, yes. If it's not possible do you reckon the code it self should be in the htmlarea.php instead of weblib.php?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
I've not looked at the code yet, but it makes sense to me in principle that any code to toggle or handle the spelling button should be in htmlarea.php ...
回复Martin Dougiamas

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Ok! I'll try to include it in htmlarea.php.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Chardelle Busch -
Core developers的头像
Hi Janne, I wanted to mention that since you have been testing the spellchecker I have lost my toolbar in my html editor when posting. (See screenshot). I tried everything I can think of to get it back, and it works on other sites, just not on moodle.org. I'm using XP/Explorer. I have no text formatting either--but I've noticed that since then, others posts do have formatting, so its very strange--am I the only one? I had clicked on the spell check icon, nothing happened, but I did get an error on page message. Then, my text all went to html (without any toggling or anything on my part) before I clicked on the post button. I thought this might be a funny bug in the spellchecker. (I'm one of those who lost the editor body when adding an event to the new calendar--so this is probably just par for the course for MS). Chardelle
附件 text.gif
回复Chardelle Busch

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Actually you're missing the whole editor 眨眼
It's a bug in code and it's because of this:

config.fontname = {
"Arial":    'arial,helvetica,sans-serif',
"Courier New":    'courier new,courier,monospace',
"Georgia":    'georgia,times new roman,times,serif',
"Tahoma":    'tahoma,arial,helvetica,sans-serif',
"Times New Roman":    'times new roman,times,serif',
"Verdana":    'verdana,arial,helvetica,sans-serif',
"Impact":    'impact',
"Wingdings":    'wingdings', <- there is an comma that makes IE go nuts
};

I made a code for it to get rid of this last comma but it doesn't seem to work!? Have to check it out.

- Janne -
回复Gustav W Delius

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
I'll have to check it through 眨眼

Seems like PJ got rid of those conflict markers in /moodle/mod/forum/mod.html faster than I did. Thanks a lot Jon 微笑
回复Janne Mikkonen

Re: Editor settings + spellchecking

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
Please make sure spell-checking is all turned off by default ... I just noticed this new button on moodle.org and I haven't enabled anything.

Also, no new code in CVS please ... I'm trying to get close to a beta here ...
回复Martin Dougiamas

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Added one more check before config code is printed and it needs both $CFG->aspellpath and $CFG->editorspelling to be true.

No new code 微笑 got it.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Jacob Romeyn -

Hi Janne

The HTML editor in the pre-beta version works fine in Mozilla Firefoxbig grin but there is no editor in IE 6.0sad

回复Jacob Romeyn

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Hi Jacob.

How fresh is your copy? Do you see editor in IE on this site?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Jacob Romeyn -

I just installed it about one hour ago and also did an update. 

And, yes, the editor works on the moodle site.

Just to be sure I just installed the latest development program and still no editor in IE 6.0.

回复Jacob Romeyn

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
I need you to look the page source (on IE's toolbar View -> Source, usually opens in notepad).
At the bottom of the page source you should see config.fontname with enumerated fonts.
If there is comma after last wingdings (like "Wingdings": 'wingdings', };) then IE doesn't load the editor.

Did you remember to clear your browser cache after updating. IE likes to use it's own cache despite what page header tells it to.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Jacob Romeyn -

Yes it is like this:

"Wingdings": 'wingdings',

but it is OK in the htmlarea.php

I cleared the cach but the comma remains when I look in the source.  How do I get rid of the comma?

回复Jacob Romeyn

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Do not edit htmlarea.php the problem is not in there.

Can you tell me what is you weblib.php's revision number?

Same question to Marc below.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

I have the weblib.php from last night's update; not CVS.  Is that the file I need to get in the CVS to fix this?

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Yes, that's it. The problem is in weblib.php's print_editor_config -function which is used to fire up the editor.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

What should the code look like?  The CVS version of weblib.php is 24 hours old, so do you have newer one than that?

What lines should I change?

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
No That's the latest, use that ( Revision 1.280).
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

I am using it and it does not work. wink  So what now?

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Is your site online? Can I visit it?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

Yes, http://classroom.socialstudies4u.com use, demo and user as the username and passwords.

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Thanks. Just visited it. Can you tell me what version of PHP your using? Is this on Windows or *nix -server?

ps. You can delete that account that I've made.
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

PHP Version 4.3.8 is what my host uses.  BTW, there are quite a few more Moodle installations on this server and they are not having this problem; they are using a Moodle 1.4 dev from 2 weeks ago.

It is a UNIX server.

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Moodle 1.4dev uses the older code and do not have these new changes that I've made in the editor settings.

Argh! Big wheel is spinning but nothing happens tongueout.

Have you visit admin >> Editor settings? If not could you try this (very long shot):
Open the editor settings page, do not change anything just press the "save changes" -button. Clear IE's cache (all offline pages) and try if the editor shows up.

I'm trying to install a clean copy to see if I can dublicate this bug.

ps. Is there some sort of  PHP accelerator on your server?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

That did it!!!!!  I visited the Editor settings and changed the font to Arial and now everything works fine. 

Thanks

Marc

回复Marc Dastous

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Ok, now we know there is something wrong in default settings!

Thank you Marc 微笑 You helped a lot 眨眼
回复Janne Mikkonen

Re: Editor settings + spellchecking

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像

I'm having a similar error with the comma! - note when you click save on the editor.php file - you get a brief flash of the page with the errors:

NOTICE: Undefined Variable: fontlist in e:\moodle\admin\editor.php on line 71
NOTICE: Undefined Variable: spelling in e:\moodle\admin\editor.php on line 84

When I click save on the editor page - it still doesn't solve the problem with the comma - I'm using Moodle 1.4Beta (downloaded about 30min ago.)

微笑

Dan

回复Dan Marsden

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
NOTICE: Undefined Variable: fontlist in e:\moodle\admin\editor.php on line 71
NOTICE: Undefined Variable: spelling in e:\moodle\admin\editor.php on line 84


These are already taken care off though they do not affect to that comma problem.

If you're using 1.4 Beta you shouldn't have this error?!? Did you get it from CVS or from download page?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像

I got it from the download page - our proxy won't let me use my CVS program at the moment! - which page has the fix - I'll browse the CVS via http & grab the files.....

- the weblib.php in my download is v 1.282

Dan

回复Janne Mikkonen

Re: Editor settings + spellchecking

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像

Hi Janne,

I've just downloaded a copy from cvs, & the above errors disapear, but the comma is still there..... is anyone else still having trouble with the cvs version?

Dan

回复Dan Marsden

Re: Editor settings + spellchecking

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像

ok... the comma has gone, - reinstalled everything again... Must have been doing something strange.....

微笑

Dan

回复Dan Marsden

Re: Editor settings + spellchecking

Martin Dougiamas -
Core developers的头像 Documentation writers的头像 Moodle HQ的头像 Particularly helpful Moodlers的头像 Plugin developers的头像 Testers的头像
Browsers cache copies of things ... you probably just needed to reload the page with the shift key held down to force a refresh.
回复Dan Marsden

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Just woke up! I'm happy to hear that the problem has gone 大笑
回复Janne Mikkonen

Re: Editor settings + spellchecking

Dan Marsden -
Core developers的头像 Particularly helpful Moodlers的头像 Peer reviewers的头像 Plugin developers的头像 Plugins guardians的头像 Testers的头像 Translators的头像

hmmm, after a full reinstall - I'm having trouble again. - I've been working on Daryls Blogging feature, the htmleditor appears & works on other areas of the site, however it still doesn't appear when posting a blog (there isn't a comma there anymore, but it seems another bug is causing the problem!)

I get the following Javascript errors when I open the post a blog page:

"A runtime error has occured, do you wish to debug?
Line 1316
Error:Unterminated string constant

then:
"A runtime error has occured, do you wish to debug?
Line: 14
Error: 'HTMLArea' is undefined

then:
"A runtime error has occured, do you wish to debug?
Error: Expected identifier, string or number

previously this also occured on all the other pages with htmleditors - now that the "comma" problem has been fixed, this no-longer occurs on all the other pages, yet it still occurs on the post a blog page.

I've also mentioned this in:
http://moodle.org/mod/forum/discuss.php?d=11424

any ideas?

thanks,

Dan

(I've tried clearing the browsers cache & doing a hard refresh, but this doesn't fix the problem either.)

回复Dan Marsden

Re: Editor settings + spellchecking

Chardelle Busch -
Core developers的头像

Hi Janne,

I just wanted to mention that on moodle.org, the editor "came back", but I just went to make a post at test.moodle.com and no editor there.  Force refresh has no effect, by the way. 

回复Chardelle Busch

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
test.moodle.com site seem to use older version of moodle so the fix do not apply there yet.

Most likely this is because the admin of that site is a really busy man at this moment?
回复Janne Mikkonen

Re: Editor settings + spellchecking

Marc Dastous -

Ok, my htmlarea.php does NOT have the "," after the wingdings.  However, the "," still appears in the View --> Source in IE 6.

Is there another place, besides the htmlarea.php, that the "," appears and has to be edited out?

BTW, it doesn't work in Opera 7, but it does work in Mozilla.

Marc

回复Janne Mikkonen

Re: Editor settings + spellchecking

Tim Allen -

Hmm, I installed it on 1.4 Beta and everything went fine until I tested the spellcheck function in the editor, and it spell checks html code as well as text (see the screenshot).  This is a headache, expecially on heavily formatted text.  I'm using IE6.  sad

Have others experienced this?  What is wrong here, any ideas about fixing this?

Thanks in advance,  smile

Tim.

附件 spllchk_htmlcodeprob.png
回复Tim Allen

Re: Editor settings + spellchecking

Tim Allen -

Janne or anyone else, any comments about this?  wink  I would really like my students (ESL learners) to use this function, but don't want them to worry about spell-checking the underlying html code!

TIA,
Tim.

回复Tim Allen

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
Well at the moment it's just working that way 伤心

The text in the editor must be converted to text string (which include html tags as well) before spellchecking can take place and after spelling is done the whole thing is placed back into the editor.

I have to check is there any way to create ignore list which would be usefull to skip xhtml tagging.
回复Tim Allen

Re: Editor settings + spellchecking

Janne Mikkonen -
Core developers的头像
I just might've found a smooth road to somewhere 眨眼

Just updated the main trunk with a fix that I think will fix this problem. The change is only in aspell options so it's safe to replace your current /lib/speller/servers-scripts/spellchecker.php with this newer one. I'll also put it in here as an attachment so you don't have to dig it up from cvs.

Let me know if it fixes the problem.

- Janne -

ps. Start a new thread 眨眼 this is getting quite long...........