예제 #1
0
/**
 * This file is a part of MyWebSQL package
 * codemirror2 editor functionality provider
 *
 * @file:      lib/editor/codemirror2.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2012 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
function createSqlEditor()
{
    $js = 'codemirror2,mysql';
    print '<link rel="stylesheet" type="text/css" href="cache.php?css=codemirror2" />';
    print "<script type=\"text/javascript\" language=\"javascript\" src=\"cache.php?script={$js}\"></script><script type=\"text/javascript\" language=\"javascript\">\n\t\t\tfunction editorHotkey(code, fn) {\n\t\t\t\t\$(document).bind('keydown', code, fn);\n\t\t\t\t\$(document).bind('keydown', code, fn);\n\t\t\t\t\$(document).bind('keydown', code, fn);\n\t\t\t}\n\t\t\t\$(function() {\n";
    sqlEditorJs('commandEditor', 'initStart();');
    sqlEditorJs('commandEditor2');
    sqlEditorJs('commandEditor3');
    print "\n}); </script>";
}
예제 #2
0
/**
 * This file is a part of MyWebSQL package
 * codemirror editor functionality provider
 *
 * @file:      lib/editor/codemirror.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2014 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
function createSqlEditor()
{
    $min = file_exists('js/min/minify.txt');
    $js = $min ? 'codemirror' : 'editor/codemirror';
    print '<link rel="stylesheet" type="text/css" href="cache.php?css=editor" />';
    print "<script type=\"text/javascript\" language=\"javascript\" src=\"cache.php?script={$js}\"></script><script type=\"text/javascript\" language=\"javascript\">\n\t\t\tfunction editorHotkey(code, fn) {\n\t\t\t\t\$(document.getElementById('sqlEditFrame').contentWindow.document).bind('keydown', code, fn);\n\t\t\t\t\$(document.getElementById('sqlEditFrame2').contentWindow.document).bind('keydown', code, fn);\n\t\t\t\t\$(document.getElementById('sqlEditFrame3').contentWindow.document).bind('keydown', code, fn);\n\t\t\t}\n\t\t\t\$(function() {\n";
    sqlEditorJs($min, 'commandEditor', 'sqlEditFrame', 'initEditor(0);');
    sqlEditorJs($min, 'commandEditor2', 'sqlEditFrame2', 'initEditor(1);');
    sqlEditorJs($min, 'commandEditor3', 'sqlEditFrame3', 'initEditor(2);');
    print '}); </script>';
}