domingo, 19 de diciembre de 2010

¡No al cierre de webs! ¡Red SOStenible!

Habilitar CKEditor para Chrome y Safari en Moodle

Para que el editor WYSIWYG CKEditor pueda "funcionar" correctamente en Chrome y Safari modificaremos

Fichero: /lib/moodlelib.php

Donde nos topamos con :


function can_use_html_editor() {
global $USER, $CFG;

if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
if (check_browser_version('MSIE', 5.5)) {
return 'MSIE';
} else if (check_browser_version('Gecko', 20030516)) {
return 'Gecko';
}
}
return false;
}


usaremos este código :


function can_use_html_editor() {
global $USER, $CFG;

if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
if (check_browser_version('MSIE', 5.5)) {
return 'MSIE';
} else if (check_browser_version('Gecko', 20030516)) {
return 'Gecko';
}
else {

return 1;

}
}
return false;
}


Fichero /lib/editor/htmlarea/htmlarea.php

Donde nos topamos con:



HTMLArea.checkSupportedBrowser = function() {
if (HTMLArea.is_gecko) {
if (navigator.productSub < 20021201) {
alert("You need at least Mozilla-1.3 Alpha.\n" +
"Sorry, your Gecko is not supported.");
return false;
}
if (navigator.productSub < 20030210) {
alert("Mozilla < 1.3 Beta is not supported!\n" +
"I'll try, though, but it might not work.");
}
}
if(HTMLArea.is_safari) {
return false;
}
return HTMLArea.is_gecko || HTMLArea.is_ie;
};


deberíamos ....


HTMLArea.checkSupportedBrowser = function() {
if (HTMLArea.is_gecko) {
if (navigator.productSub < 20021201) {
alert("You need at least Mozilla-1.3 Alpha.\n" +
"Sorry, your Gecko is not supported.");
return false;
}
if (navigator.productSub < 20030210) {
//alert("Mozilla < 1.3 Beta is not supported!\n" +
// "I'll try, though, but it might not work.");
return 'HTMLArea.is_gecko';
}
}
if(HTMLArea.is_safari) {
//return false;
return 'HTMLArea.is_gecko';
}
return HTMLArea.is_gecko || HTMLArea.is_ie;
};


Visto en http://lewiscarr.co.uk/