Ok, fixed it... The dom tree was changed after CodeMirror was loaded, so i moved the code from the jquery.php files to the js files (filemanager.js and templates.js).
Here is how to implemented the hacks.
Template manager hack:Step 1: Add
$xoTheme->addScript('browse.php?modules/system/js/codemirror.js');
after
$xoTheme->addScript('browse.php?modules/system/js/templates.js');
in modules/system/admin/tplsets/main.php .
Step 2: Add
$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/docs.css');
after
$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
in modules/system/admin/tplsets/main.php .
Step 3: Change
function tpls_edit_file(path_file, file)
{
$('#display_contenu').hide();
$('#display_form').hide();
$('#loading').show();
$.ajax({
type: "POST",
url: "./admin/tplsets/jquery.php",
data: "op=tpls_edit_file&path_file="+path_file+"&file="+file,
success: function(msg){
$('#display_contenu').html(msg);
$('#loading').hide();
$('#display_contenu').fadeIn('fast');
}
});
return false;
}
to
function tpls_edit_file(path_file, file)
{
$('#display_contenu').hide();
$('#display_form').hide();
$('#loading').show();
$.ajax({
type: "POST",
url: "./admin/tplsets/jquery.php",
data: "op=tpls_edit_file&path_file="+path_file+"&file="+file,
success: function(msg){
$('#display_contenu').html(msg);
$('#loading').hide();
$('#display_contenu').fadeIn('fast');
if(path_file.slice(-3) == "css"){
var editor = CodeMirror.fromTextArea("template_code", {
height: "350px",
parserfile: "parsecss.js",
stylesheet: "css/csscolors.css",
lineNumbers: true,
textWrapping: false,
path: "js/"
});
}else if(path_file.slice(-3) == ".js"){
var editor = CodeMirror.fromTextArea("template_code", {
height: "350px",
parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
stylesheet: "css/jscolors.css",
autoMatchParens: true,
lineNumbers: true,
textWrapping: false,
path: "js/"
});
}else{
var editor = CodeMirror.fromTextArea("template_code", {
height: "350px",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
"tokenizephp.js", "parsephp.js",
"parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css"],
lineNumbers: true,
textWrapping: false,
path: "js/",
continuousScanning: 500
});
}
}
});
return false;
}
in modules/system/js/templates.js .
Step 4: Change
<textarea name="templates" rows=24 cols=110>'.$content.'textarea>
to
<textarea id="template_code" name="templates" rows=24 cols=110>'.$content.'textarea>
in modules/system/admin/tplsets/jquery.php.
That should do it for the template manager, the hack for the filemanager is almost the same but here's the guide for that
...
File manager hack:Step 1: Add
$xoTheme->addScript('browse.php?modules/system/js/codemirror.js');
after
$xoTheme->addScript('browse.php?modules/system/js/templates.js');
in modules/system/admin/filemanager/main.php .
Step 2: Add
$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/docs.css');
after
$xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css');
in modules/system/admin/filemanager/main.php .
Step 3: Change
function filemanager_edit_file(path_file, path, file)
{
$('#display_file').hide();
$('#edit_file').hide();
$('#loading').show();
$.ajax({
type: "POST",
url: "./admin/filemanager/jquery.php",
data: "op=filemanager_edit_file&path_file="+path_file+"&path="+path+"&file="+file,
success: function(msg){
$('#edit_file').html(msg);
$('#loading').hide();
$('#edit_file').fadeIn('fast');
}
});
return false;
}
to
function filemanager_edit_file(path_file, path, file)
{
$('#display_file').hide();
$('#edit_file').hide();
$('#loading').show();
$.ajax({
type: "POST",
url: "./admin/filemanager/jquery.php",
data: "op=filemanager_edit_file&path_file="+path_file+"&path="+path+"&file="+file,
success: function(msg){
$('#edit_file').html(msg);
$('#loading').hide();
$('#edit_file').fadeIn('fast');
if(path_file.slice(-3) == "css"){
var editor = CodeMirror.fromTextArea("filemanager_code", {
height: "350px",
parserfile: "parsecss.js",
stylesheet: "css/csscolors.css",
lineNumbers: true,
textWrapping: false,
path: "js/"
});
}else if(path_file.slice(-3) == ".js"){
var editor = CodeMirror.fromTextArea("filemanager_code", {
height: "350px",
parserfile: ["tokenizejavascript.js", "parsejavascript.js"],
stylesheet: "css/jscolors.css",
autoMatchParens: true,
lineNumbers: true,
textWrapping: false,
path: "js/"
});
}else{
var editor = CodeMirror.fromTextArea("filemanager_code", {
height: "350px",
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js",
"tokenizephp.js", "parsephp.js",
"parsephphtmlmixed.js"],
stylesheet: ["css/xmlcolors.css", "css/jscolors.css", "css/csscolors.css", "css/phpcolors.css"],
lineNumbers: true,
textWrapping: false,
path: "js/",
continuousScanning: 500
});
}
}
});
return false;
}
in modules/system/js/filemanager.js .
Step 4: Change
<textarea name="filemanager" rows=24 cols=110>'.$content.'textarea>
to
<textarea id="filemanager_code" name="filemanager" rows=24 cols=110>'.$content.'textarea>
in modules/system/admin/filemanager/jquery.php.
The package is also updated (Still based on the code delivered with XOOPS 2.5 Alpha) :-p.
I hope it works and it will be included in the core.
Greets Dylian.
BTW, got the solution from this Google Groups post:
http://groups.google.com/group/codemirror/browse_thread/thread/1a7a5f529eccc1a/a5928c35dff3ef80?lnk=gst&q=false#a5928c35dff3ef80