How to add the edit bar in the Files area

Re: How to add the edit bar in the Files area

by Alex Pallero González -
Number of replies: 7

Another possibility (question):

what php file manages the edition in the file area? Is possible to modify this filea to add some code to enable the editor bar?

Thanks

In reply to Alex Pallero González

Re: How to add the edit bar in the Files area

by Colin Fraser -
Picture of Documentation writers Picture of Testers

As for the first question, in both Moodle 1.9.x and 2.0.x once you go into html mode, none of the buttons are available. The buttons are actually macros that apply the html commands, and are available in the wysiwyg editor, but not the html editor - no need.

A word of caution here, if you or your team do not know a lot of html, then do not go there. Having said that, there are a lot of free tutorials on how to write basic html on the web, like W3Schools, about.com, and lots and lots more. All you need in Moodle is the structure and format, ie style, commands, or tags. The way Moodle is written fills in all the rest for you. HTML is really easy to pickup, I have taught it to absolute beginners and they were writing their own web pages in just minutes.

I do not understand the second question, but if you are wanting the same thing, then the same answer applies.The editor bar should come up automatically whenever you are writing anything in Moodle other than a text file.

if you are asking about editing html files you have imported into Moodle, then you can do so, but not with an active tool bar, for the same reason, the buttons are macros that supply the html commands, so no need for them in html mode.

(P.S. Never apologise for language, my Spanish is dreadful.. smile )

In reply to Alex Pallero González

Re: How to add the edit bar in the Files area

by Mauno Korpelainen -

In fact this is very easy to change in moodle 1.9.X  - but not recommended.

You only need to change in line 434 of files/index.php

from

                $usehtmleditor = false;    // Always keep it off for now

to

                $usehtmleditor = true;    // Always keep it off for now

It is not recommended to edit files with HTMLArea because HTMLArea is well known about capability to mess any code smile

In reply to Mauno Korpelainen

Re: How to add the edit bar in the Files area

by Alex Pallero González -

Thanks, thanks and thanks a lot for your help!

It's works fantastic and properly!

Kind regards Mauno from Tarragona (Spain)

In reply to Alex Pallero González

Re: How to add the edit bar in the Files area

by Colin Fraser -
Picture of Documentation writers Picture of Testers

mm Yes, I thought I got that in the first question as they use the same editor, which made the second question doubtful to me, but why would you want to? If you are editing raw code, why would you want the tool bar on? Maybe I am getting less elastic or something, but it does not make sense to me... tongueout but to be fair to Alex, he did say that their knowledge of HTML was not great. To me it would be the challenge of learning the HTML of which the basics are very easy to understand. Je ne comprend pas!

Thanks Mauno, something else in code I can add to my repetoire of things I can make a mess of..smile

In reply to Colin Fraser

Re: How to add the edit bar in the Files area

by Mauno Korpelainen -

I might say it this way: people can upload HTML files that are nowadays often created with some other tool than moodle to course files and want to edit them but may not be able to edit HTML source and need either online editor or some external tool to update their files.

Some years ago one of my collegues had a similar problem - she had created a very beautiful and big course with another learning environment, a complete set of HTML pages that had relative links from page to page and the whole course could be used as normal HTML pages. But we did not use that commercial learning environment anymore and she had no knowledge of using HTML source to update the files.

Because they were not MSOHTML pages, they were very classic pure HTML pages it was easy to unzip the whole package to course files and use this file editing feature the same way as we write these forum posts usually editor enabled - not as HTML source, right?

There may still be several problems in uploading HTML files directly to course files and editing them with HTMLArea. For example if those HTML files have event handlers this old bug can freeze HTMLArea:

http://tracker.moodle.org/browse/MDL-9963

Or if the HTML page is created with tools like MS Word (saved as html file) characters like äöÅ may look like ??? in HTMLArea because moodle is using UTF-8 and that file may use for example charset=windows-1252 - not to mention all that MSOHTML rubbish... that can of course be cleaned with editor buttons smile

And in any case users can disable editor from their profile (When editing page - Use standard web forms) if they prefer pure html smile

In reply to Mauno Korpelainen

Re: How to add the edit bar in the Files area

by Colin Fraser -
Picture of Documentation writers Picture of Testers

Now that, I can understand. I started out in HTML before there was a commercial tool. I think I used a package called Web-Spider once or twice but it was actually easier to use a hand written "template", and code it all by hand. It was only a bit later that we were adding style sheets and some "additional functionality" with javascript, rollovers, conditional linking and such, DHTML, but still all coded by hand. I think I still got my javascript library around somewhere, bound to be on a CD... The long and the short of this is that HTML is so easy to edit in the Moodle environment because it is straight forward. Perhaps one day things will be different, but for the nonce, it is easy to pick up. So I never considered the idea of the tool bar being useful in the HTML environment, and wondered why it would even be considered a good idea... mmm Oh well, that is what I like about these forums, I am learning all the time..smile

EDIT: Rereading it.. wasn't there a largish discussion about using event handlers a couple of years back? I seem to recall it, but I do not think the issue has come up since... and don't get me started on MSOHTML..