| Re: Template editor |
| by frankblack on 2010/2/16 17:07:43 Nice work! Just two questions/comments? How is the edited file saved back to the server? I assume you can run into trouble with owner rights and chmods, but perhaps I am wrong... Whenever I use addScript or addStylesheet I pass on some more information although this is optional: le="color: #000000"><?php $xoTheme->addScript('browse.php?modules/system/js/codemirror.js', array('type' => 'text/javascript', 'charset' => _CHARSET), null); le="color: #000000"><?php $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/docs.css', array('type' => 'text/css', 'media' => 'screen'), null);
|
| Re: Template editor |
| by Dylian on 2010/2/16 14:03:05 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 le="color: #000000"><?php $xoTheme->addScript('browse.php?modules/system/js/codemirror.js'); after le="color: #000000"><?php $xoTheme->addScript('browse.php?modules/system/js/templates.js'); in modules/system/admin/tplsets/main.php .Step 2: Add le="color: #000000"><?php $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/docs.css'); after le="color: #000000"><?php $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css'); in modules/system/admin/tplsets/main.php .Step 3: Change le="color: #000000"><?php 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 le="color: #000000"><?php 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 le="color: #000000"><?php <textarea name="templates" rows=24 cols=110>'.$content.'</textarea> to le="color: #000000"><?php <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 le="color: #000000"><?php $xoTheme->addScript('browse.php?modules/system/js/codemirror.js'); after le="color: #000000"><?php $xoTheme->addScript('browse.php?modules/system/js/templates.js'); in modules/system/admin/filemanager/main.php .Step 2: Add le="color: #000000"><?php $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/docs.css'); after le="color: #000000"><?php $xoTheme->addStylesheet( XOOPS_URL . '/modules/system/css/admin.css'); in modules/system/admin/filemanager/main.php .Step 3: Change le="color: #000000"><?php 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 le="color: #000000"><?php 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 le="color: #000000"><?php <textarea name="filemanager" rows=24 cols=110>'.$content.'</textarea> to le="color: #000000"><?php <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 |
| Re: Template editor |
| by kraven30 on 2010/2/15 12:26:31 There is a bug with Firefox, code mirror dont work. On IE and Chrome, it's ok. On firefox, it works with you ? ++ |
| Re: Template editor |
| by Dylian on 2010/2/13 12:12:39 Ok, updated the package, template manager now also has the CodeMirror editor. And i changed the code to first check what kind of file is loaded, so the right parser can be loaded .Quote: Did you work on the latest version of SVN? No i used the files from xo25a. But the hack is very easy to implement so i don't think it would be hard to add it to the latest version. Greets Dylian. |
| Re: Template editor |
| by kraven30 on 2010/2/13 11:57:40 Good Job Dylan PS: We searched with Muss to add syntax coloring but we had not found an interesting plugin, thx CodeMirror, thx Dylian . To add in templates editor and filemanager, there will be no worries but the core, I don't knowDid you work on the latest version of SVN? ++ |