Dialplan XML: Integrate editor.
|
|
@ -101,21 +101,94 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
// load editor preferences/defaults
|
||||
$setting_size = $_SESSION["editor"]["font_size"]["text"] != '' ? $_SESSION["editor"]["font_size"]["text"] : '12px';
|
||||
$setting_theme = $_SESSION["editor"]["theme"]["text"] != '' ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
|
||||
$setting_invisibles = $_SESSION["editor"]["invisibles"]["boolean"] != '' ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
|
||||
$setting_indenting = $_SESSION["editor"]["indent_guides"]["boolean"] != '' ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
|
||||
$setting_numbering = $_SESSION["editor"]["line_numbers"]["boolean"] != '' ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
|
||||
|
||||
//show the header
|
||||
require_once "resources/header.php";
|
||||
$document['title'] = $text['title-dialplan_edit'].' XML';
|
||||
|
||||
//scripts and styles
|
||||
echo "<script language='JavaScript' type='text/javascript'>\n";
|
||||
|
||||
echo " function toggle_option(opt) {\n";
|
||||
echo " switch (opt) {\n";
|
||||
echo " case 'numbering':\n";
|
||||
echo " toggle_option_do('showLineNumbers');\n";
|
||||
echo " toggle_option_do('fadeFoldWidgets');\n";
|
||||
echo " break;\n";
|
||||
echo " case 'invisibles':\n";
|
||||
echo " toggle_option_do('showInvisibles');\n";
|
||||
echo " break;\n";
|
||||
echo " case 'indenting':\n";
|
||||
echo " toggle_option_do('displayIndentGuides');\n";
|
||||
echo " break;\n";
|
||||
echo " }\n";
|
||||
echo " focus_editor();\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function toggle_option_do(opt_name) {\n";
|
||||
echo " var opt_val = editor.getOption(opt_name);\n";
|
||||
echo " editor.setOption(opt_name, ((opt_val) ? false : true));\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function focus_editor() {\n";
|
||||
echo " editor.focus();\n";
|
||||
echo " }\n";
|
||||
|
||||
//copy the value from the editor on submit
|
||||
echo " function set_value() {\n";
|
||||
echo " $('#dialplan_xml').val(editor.session.getValue());\n";
|
||||
echo " }\n";
|
||||
|
||||
//load editor value from hidden textarea
|
||||
echo " function load_value() {\n";
|
||||
echo " editor.session.setValue($('#dialplan_xml').val());";
|
||||
echo " }\n";
|
||||
|
||||
echo "</script>\n";
|
||||
|
||||
echo "<style>\n";
|
||||
|
||||
echo " img.control {\n";
|
||||
echo " cursor: pointer;\n";
|
||||
echo " width: auto;\n";
|
||||
echo " height: 23px;\n";
|
||||
echo " border: none;\n";
|
||||
echo " opacity: 0.5;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " img.control:hover {\n";
|
||||
echo " opacity: 1.0;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " div#editor {\n";
|
||||
echo " box-shadow: 0 3px 10px #333;\n";
|
||||
echo " text-align: left;\n";
|
||||
echo " width: 100%;\n";
|
||||
echo " height: 600px;\n";
|
||||
echo " font-size: 12px;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo "</style>\n";
|
||||
|
||||
//show the content
|
||||
echo "<form method='post' name='frm' action=''>\n";
|
||||
echo "<form method='post' name='frm' id='frm' onsubmit='return submit_check();'>\n";
|
||||
echo " <input type='hidden' name='app_uuid' value='".$app_uuid."'>\n";
|
||||
echo " <input type='hidden' name='dialplan_uuid' value='".$dialplan_uuid."'>\n";
|
||||
echo " <textarea name='dialplan_xml' id='dialplan_xml' style='display: none;'>".$dialplan_xml."</textarea>";
|
||||
echo " <table width='100%' border='0' cellpadding='0' cellspacing='1'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left' width='30%'>\n";
|
||||
echo " <span class='title'>".$text['title-dialplan_edit']."</span><br />\n";
|
||||
echo " <span class='title'>".$text['title-dialplan_edit']." XML</span><br />\n";
|
||||
echo " </td>\n";
|
||||
echo " <td width='70%' align='right'>\n";
|
||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='dialplan_edit.php?id=".$dialplan_uuid.(is_uuid($app_uuid) ? "&app_uuid=".$app_uuid : null)."';\" value='".$text['button-back']."'>\n";
|
||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||
echo " <input type='button' class='btn' value='".$text['button-save']."' onclick=\"set_value(); $('#frm').submit();\">\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
|
|
@ -125,9 +198,115 @@
|
|||
echo " </tr>\n";
|
||||
echo " </table>";
|
||||
echo " <br />\n";
|
||||
echo " <textarea name='dialplan_xml' class='formfld' style='width: 100%; max-width: 100%; height: 450px; padding: 2px 0;'>".$dialplan_xml."</textarea>\n";
|
||||
echo " <table cellpadding='0' cellspacing='0' border='0' style='width: 100%;'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td valign='middle' style='padding: 0 6px;' width='100%'><span id='description'></span></td>\n";
|
||||
echo " <td valign='middle' style='padding: 0;'><img src='resources/images/blank.gif' style='width: 1px; height: 30px; border: none;'></td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_numbering.png' title='Toggle Line Numbers' class='control' onclick=\"toggle_option('numbering');\"></td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_invisibles.png' title='Toggle Invisibles' class='control' onclick=\"toggle_option('invisibles');\"></td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_indenting.png' title='Toggle Indent Guides' class='control' onclick=\"toggle_option('indenting');\"></td>\n";
|
||||
// echo " <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_replace.png' title='Show Find/Replace [Ctrl+H]' class='control' onclick=\"editor.execCommand('replace');\"></td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 6px;'><img src='resources/images/icon_goto.png' title='Show Go To Line' class='control' onclick=\"editor.execCommand('gotoline');\"></td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 4px;'>\n";
|
||||
echo " <select id='size' style='height: 23px;' onchange=\"document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();\">\n";
|
||||
$sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
|
||||
if (!in_array($setting_size, $sizes)) {
|
||||
echo " <option value='".$setting_size."'>".escape($setting_size)."</option>\n";
|
||||
echo " <option value='' disabled='disabled'></option>\n";
|
||||
}
|
||||
foreach ($sizes as $size) {
|
||||
$selected = $size == $setting_size ? 'selected' : null;
|
||||
echo " <option value='".$size."' ".$selected.">".escape($size)."</option>\n";
|
||||
}
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " <td valign='middle' style='padding-left: 4px; padding-right: 0px;'>\n";
|
||||
echo " <select id='theme' style='height: 23px;' onchange=\"editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();\">\n";
|
||||
$themes['Light']['chrome']= 'Chrome';
|
||||
$themes['Light']['clouds']= 'Clouds';
|
||||
$themes['Light']['crimson_editor']= 'Crimson Editor';
|
||||
$themes['Light']['dawn']= 'Dawn';
|
||||
$themes['Light']['dreamweaver']= 'Dreamweaver';
|
||||
$themes['Light']['eclipse']= 'Eclipse';
|
||||
$themes['Light']['github']= 'GitHub';
|
||||
$themes['Light']['iplastic']= 'IPlastic';
|
||||
$themes['Light']['solarized_light']= 'Solarized Light';
|
||||
$themes['Light']['textmate']= 'TextMate';
|
||||
$themes['Light']['tomorrow']= 'Tomorrow';
|
||||
$themes['Light']['xcode']= 'XCode';
|
||||
$themes['Light']['kuroir']= 'Kuroir';
|
||||
$themes['Light']['katzenmilch']= 'KatzenMilch';
|
||||
$themes['Light']['sqlserver']= 'SQL Server';
|
||||
$themes['Dark']['ambiance']= 'Ambiance';
|
||||
$themes['Dark']['chaos']= 'Chaos';
|
||||
$themes['Dark']['clouds_midnight']= 'Clouds Midnight';
|
||||
$themes['Dark']['cobalt']= 'Cobalt';
|
||||
$themes['Dark']['idle_fingers']= 'idle Fingers';
|
||||
$themes['Dark']['kr_theme']= 'krTheme';
|
||||
$themes['Dark']['merbivore']= 'Merbivore';
|
||||
$themes['Dark']['merbivore_soft']= 'Merbivore Soft';
|
||||
$themes['Dark']['mono_industrial']= 'Mono Industrial';
|
||||
$themes['Dark']['monokai']= 'Monokai';
|
||||
$themes['Dark']['pastel_on_dark']= 'Pastel on dark';
|
||||
$themes['Dark']['solarized_dark']= 'Solarized Dark';
|
||||
$themes['Dark']['terminal']= 'Terminal';
|
||||
$themes['Dark']['tomorrow_night']= 'Tomorrow Night';
|
||||
$themes['Dark']['tomorrow_night_blue']= 'Tomorrow Night Blue';
|
||||
$themes['Dark']['tomorrow_night_bright']= 'Tomorrow Night Bright';
|
||||
$themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
|
||||
$themes['Dark']['twilight']= 'Twilight';
|
||||
$themes['Dark']['vibrant_ink']= 'Vibrant Ink';
|
||||
foreach ($themes as $optgroup => $theme) {
|
||||
echo "<optgroup label='".$optgroup."'>\n";
|
||||
foreach ($theme as $value => $label) {
|
||||
$selected = strtolower($label) == strtolower($setting_theme) ? 'selected' : null;
|
||||
echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
|
||||
echo " </select>\n";
|
||||
echo " </td>\n";
|
||||
echo " </tr>\n";
|
||||
echo " </table>\n";
|
||||
echo " <div id='editor'></div>\n";
|
||||
|
||||
echo "</form>\n";
|
||||
|
||||
|
||||
echo "<script type='text/javascript' src='".PROJECT_PATH."/resources/ace/ace.js' charset='utf-8'></script>\n";
|
||||
echo "<script type='text/javascript'>\n";
|
||||
|
||||
//load editor
|
||||
echo " var editor = ace.edit('editor');\n";
|
||||
echo " editor.setOptions({\n";
|
||||
echo " mode: 'ace/mode/xml',\n";
|
||||
echo " theme: 'ace/theme/'+document.getElementById('theme').options[document.getElementById('theme').selectedIndex].value,\n";
|
||||
echo " selectionStyle: 'text',\n";
|
||||
echo " cursorStyle: 'smooth',\n";
|
||||
echo " showInvisibles: ".$setting_invisibles.",\n";
|
||||
echo " displayIndentGuides: ".$setting_indenting.",\n";
|
||||
echo " showLineNumbers: ".$setting_numbering.",\n";
|
||||
echo " showGutter: true,\n";
|
||||
echo " scrollPastEnd: true,\n";
|
||||
echo " fadeFoldWidgets: ".$setting_numbering.",\n";
|
||||
echo " showPrintMargin: false,\n";
|
||||
echo " highlightGutterLine: false,\n";
|
||||
echo " useSoftTabs: false\n";
|
||||
echo " });\n";
|
||||
echo " document.getElementById('editor').style.fontSize='".$setting_size."';\n";
|
||||
echo " focus_editor();\n";
|
||||
|
||||
//load value into editor
|
||||
echo " load_value();\n";
|
||||
|
||||
//remove certain keyboard shortcuts
|
||||
echo " editor.commands.bindKey('Ctrl-T', null);\n"; //disable transpose letters - prefer new browser tab
|
||||
echo " editor.commands.bindKey('Ctrl-F', null);\n"; //disable find - control broken with bootstrap
|
||||
echo " editor.commands.bindKey('Ctrl-H', null);\n"; //disable replace - control broken with bootstrap
|
||||
|
||||
echo "</script>\n";
|
||||
|
||||
//show the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 49 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 726 B |
|
After Width: | Height: | Size: 417 B |
|
After Width: | Height: | Size: 324 B |
|
After Width: | Height: | Size: 821 B |
|
After Width: | Height: | Size: 521 B |
|
After Width: | Height: | Size: 504 B |
|
|
@ -113,14 +113,6 @@
|
|||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Set the default visibility of line numbers for Editor.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "62cfc1ac-6566-45ba-8c7d-f4234ab1b31e";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "editor";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "live_previews";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "false";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable or disable live previewing of syntax, text size and theme changes.";
|
||||
$y++;
|
||||
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "7b403afd-e4d6-4e96-8c8f-2cf5d6187191";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_category'] = "editor";
|
||||
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "theme";
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@
|
|||
$setting_invisibles = ($_SESSION["editor"]["invisibles"]["boolean"] != '') ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
|
||||
$setting_indenting = ($_SESSION["editor"]["indent_guides"]["boolean"] != '') ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
|
||||
$setting_numbering = ($_SESSION["editor"]["line_numbers"]["boolean"] != '') ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
|
||||
$setting_preview = ($_SESSION["editor"]["live_preview"]["boolean"] != '') ? $_SESSION["editor"]["live_preview"]["boolean"] : 'true';
|
||||
|
||||
//get and then set the favicon
|
||||
if (isset($_SESSION['theme']['favicon']['text'])){
|
||||
|
|
@ -238,10 +237,9 @@
|
|||
$modes['c_cpp'] = 'C';
|
||||
$modes['c_cpp'] = 'CPP';
|
||||
$modes['pgsql'] = 'PGSQL';
|
||||
$preview = ($setting_preview == 'true') ? "onmouseover=\"editor.getSession().setMode('ace/mode/' + this.value);\"" : null;
|
||||
foreach ($modes as $value => $label) {
|
||||
$selected = ($value == $mode) ? 'selected' : null;
|
||||
echo "<option value='".$value."' ".$selected." ".$preview.">".$label."</option>\n";
|
||||
echo "<option value='".$value."' ".$selected.">".$label."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
@ -250,14 +248,13 @@
|
|||
<select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
|
||||
<?php
|
||||
$sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
|
||||
$preview = ($setting_preview == 'true') ? "onmouseover=\"document.getElementById('editor').style.fontSize = this.value;\"" : null;
|
||||
if (!in_array($setting_size, $sizes)) {
|
||||
echo "<option value='".$setting_size."' ".$preview.">".$setting_size."</option>\n";
|
||||
echo "<option value='".$setting_size."'>".$setting_size."</option>\n";
|
||||
echo "<option value='' disabled='disabled'></option>\n";
|
||||
}
|
||||
foreach ($sizes as $size) {
|
||||
$selected = ($size == $setting_size) ? 'selected' : null;
|
||||
echo "<option value='".$size."' ".$selected." ".$preview.">".$size."</option>\n";
|
||||
echo "<option value='".$size."' ".$selected.">".$size."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
@ -299,12 +296,11 @@
|
|||
$themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
|
||||
$themes['Dark']['twilight']= 'Twilight';
|
||||
$themes['Dark']['vibrant_ink']= 'Vibrant Ink';
|
||||
$preview = ($setting_preview == 'true') ? "onmouseover=\"editor.setTheme('ace/theme/' + this.value);\"" : null;
|
||||
foreach ($themes as $optgroup => $theme) {
|
||||
echo "<optgroup label='".$optgroup."'>\n";
|
||||
foreach ($theme as $value => $label) {
|
||||
$selected = (strtolower($label) == strtolower($setting_theme)) ? 'selected' : null;
|
||||
echo "<option value='".$value."' ".$selected." ".$preview.">".$label."</option>\n";
|
||||
echo "<option value='".$value."' ".$selected.">".$label."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
$setting_invisibles = ($_SESSION["editor"]["invisibles"]["boolean"] != '') ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
|
||||
$setting_indenting = ($_SESSION["editor"]["indent_guides"]["boolean"] != '') ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
|
||||
$setting_numbering = ($_SESSION["editor"]["line_numbers"]["boolean"] != '') ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
|
||||
$setting_preview = ($_SESSION["editor"]["live_preview"]["boolean"] != '') ? $_SESSION["editor"]["live_preview"]["boolean"] : 'true';
|
||||
|
||||
//get the html values and set them as variables
|
||||
$handler = ($_REQUEST["handler"] != '') ? trim($_REQUEST["handler"]) : ((permission_exists('exec_switch')) ? 'switch' : null);
|
||||
|
|
@ -340,11 +339,8 @@
|
|||
$modes['xml'] = 'XML';
|
||||
$modes['sql'] = 'SQL';
|
||||
foreach ($modes as $value => $label) {
|
||||
if ($setting_preview == 'true') {
|
||||
$preview = "onmouseover=\"editor.getSession().setMode(".(($value == 'php') ? "{path:'ace/mode/php', inline:true}" : "'ace/mode/' + this.value").");\"";
|
||||
}
|
||||
$selected = ($value == $mode) ? 'selected' : null;
|
||||
echo "<option value='".escape($value)."' ".escape($selected)." ".escape($preview).">".escape($label)."</option>\n";
|
||||
$selected = $value == $mode ? 'selected' : null;
|
||||
echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
@ -353,14 +349,13 @@
|
|||
<select id='size' style='height: 23px;' onchange="document.getElementById('editor').style.fontSize = this.options[this.selectedIndex].value; focus_editor();">
|
||||
<?php
|
||||
$sizes = explode(',','9px,10px,11px,12px,14px,16px,18px,20px');
|
||||
$preview = ($setting_preview == 'true') ? "onmouseover=\"document.getElementById('editor').style.fontSize = this.value;\"" : null;
|
||||
if (!in_array($setting_size, $sizes)) {
|
||||
echo "<option value='".escape($setting_size)."' ".escape($preview).">".escape($setting_size)."</option>\n";
|
||||
echo "<option value='".$setting_size."'>".escape($setting_size)."</option>\n";
|
||||
echo "<option value='' disabled='disabled'></option>\n";
|
||||
}
|
||||
foreach ($sizes as $size) {
|
||||
$selected = ($size == $setting_size) ? 'selected' : null;
|
||||
echo "<option value='".escape($size)."' ".$selected." ".escape($preview).">".escape($size)."</option>\n";
|
||||
echo "<option value='".$size."' ".$selected.">".escape($size)."</option>\n";
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
|
|
@ -402,12 +397,11 @@
|
|||
$themes['Dark']['tomorrow_night_eighties']= 'Tomorrow Night 80s';
|
||||
$themes['Dark']['twilight']= 'Twilight';
|
||||
$themes['Dark']['vibrant_ink']= 'Vibrant Ink';
|
||||
$preview = ($setting_preview == 'true') ? "onmouseover=\"editor.setTheme('ace/theme/' + this.value);\"" : null;
|
||||
foreach ($themes as $optgroup => $theme) {
|
||||
echo "<optgroup label='".$optgroup."'>\n";
|
||||
foreach ($theme as $value => $label) {
|
||||
$selected = (strtolower($label) == strtolower($setting_theme)) ? 'selected' : null;
|
||||
echo "<option value='".escape($value)."' ".$selected." ".escape($preview).">".escape($label)."</option>\n";
|
||||
$selected = strtolower($label) == strtolower($setting_theme) ? 'selected' : null;
|
||||
echo "<option value='".$value."' ".$selected.">".escape($label)."</option>\n";
|
||||
}
|
||||
echo "</optgroup>\n";
|
||||
}
|
||||
|
|
|
|||