Issue Details (XML | Word | Printable)

Key: MDL-20310
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Eloy Lafuente (stronk7)
Reporter: Tim Hunt
Votes: 0
Watchers: 3
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Text filter to make 'insert special character' buttons

Created: 17/Sep/09 06:34 PM   Updated: 24/Sep/09 05:21 AM
Return to search
Component/s: Filters
Affects Version/s: 1.9.5
Fix Version/s: None

Participants: Eloy Lafuente (stronk7), Mauno Korpelainen, Olli Savolainen and Tim Hunt
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
The underlying problem is that the teacher wants the students to be able to easily type special charaters (for example è é ê ç, or maths symbols) in a place where the HTML editor is not used (for example a short-answer question in the quiz). See http://moodle.org/mod/forum/discuss.php?d=132945.

A difficulty is that you may not know which special characters are relevant in any particular place.

I think a good solution to this would be a new filter. You would be able to type something like:

[keyboard|èéêç]

and the filter would change that into HTML and JavaScript for buttons that insert those symbols into an appropriate input field.

A difficulty is identifying the appropriate input field.

The filter should generate no visible output if JavaScript is disabled, so probably the filter should just do $PAGE->requires->js('filter/keyboard/script.js');
$PAGE->requries->js_function_call('filter_keyboard.init', 'èéêç')->on_dom_ready();

Anyway attempting this should look at the code in the emoticons_help class in lib/javascript-static.js in Moodle 2.0 for a useful starting point.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Olli Savolainen added a comment - 17/Sep/09 07:35 PM
This could be out of scope but: Inserting that filter code could use a UI? Is it granted that when someone wants to create those buttons they can create them from the keyboard, or are they supposed to use the character map of the operating system? Or could we provide the palette of characters also tinymce provides, for selecting which buttons are needed?

Mauno Korpelainen added a comment - 17/Sep/09 08:15 PM
It's an interesting idea.

For people who have javascript enabled in browser we have Richard Ishida's famous Uniview character picker and other picker scripts

http://rishida.net/scripts/uniview/

http://people.w3.org/rishida/scripts/pickers/latin/

and it is also possible to create new advanced unicode picker plugin for TinyMCE - I already had one as a part of my unpublished math plugins - and Gunther Krauss has a nice picker in http://www.guntherkrauss.de/computer/xml/daten/edicode.html but all of these use javascript.

They can still be used for normal text input fields - you just need to type the special characters (or maths) first and either use plugin to send input back to textarea (place of selection) or copy and paste the input to text input field.

I had a similar idea about creating a sort of "graphlets" that would first output just a button, empty graph or default graph and when you click one button you get the rest of "graphlet" and can copy the content to your text field - again I am able to create such filter and I have the code for getting graphs with some settings but my "graphlets" use javascript to produce controlled svg or vml depending on browser.


Tim Hunt added a comment - 17/Sep/09 09:16 PM
Mauno, we don't want some nightmare UI to let people select any unicode character. We want a really simple interface to let students input the half dozen characters that they cannot type but with they need for the task at hand, where the list of characters must be selectable by the teacher.

And we are not using Tiny MCE.

Olli, UI for creating filter markup. Nice idea, but an entirely separate issue. For now, teachers will have to learn the markup and use char map. The UI for students will be nice.


Mauno Korpelainen added a comment - 17/Sep/09 09:41 PM
Oh sorry - I did not notice this was 1.9 issues...although it is all the time possible to render minimal custom tinymce anywhere we like also in moodle 1.9 if we want...

Yes - I understood that you would like to show only a couple of buttons with filter...

The simplest solution might still be to type those 3-4 characters to question area so that students can simply copy the ones they need

Like the characters in your example: èéêç


Mauno Korpelainen added a comment - 17/Sep/09 09:47 PM
For example in Enrique's plugin for HTMLArea http://moodle.org/mod/forum/discuss.php?d=20864 the only difference to current add symbols plugin is that extra drop down menu for selectable characters - but that's another story...

Mauno Korpelainen added a comment - 24/Sep/09 05:21 AM
Tim, could this filter idea be used for implementing Google Virtual keyboard to single input fields as well (that are not using editor) - http://moodle.org/mod/forum/discuss.php?d=126715 ?