System Status: Enhance Support Information section.

This commit is contained in:
fusionate 2024-01-24 16:49:10 +00:00
parent 7a24e2aa1f
commit 657cbb1b48
No known key found for this signature in database
12 changed files with 230 additions and 44 deletions

View File

@ -819,28 +819,4 @@ $text['label-json']['zh-cn'] = "JSON";
$text['label-json']['ja-jp'] = "JSON";
$text['label-json']['ko-kr'] = "JSON";
$text['label-copy_to_clipboard']['en-us'] = "Copy to Clipboard";
$text['label-copy_to_clipboard']['en-gb'] = "Copy to Clipboard";
$text['label-copy_to_clipboard']['ar-eg'] = "";
$text['label-copy_to_clipboard']['de-at'] = "";
$text['label-copy_to_clipboard']['de-ch'] = "";
$text['label-copy_to_clipboard']['de-de'] = "";
$text['label-copy_to_clipboard']['es-cl'] = "";
$text['label-copy_to_clipboard']['es-mx'] = "";
$text['label-copy_to_clipboard']['fr-ca'] = "";
$text['label-copy_to_clipboard']['fr-fr'] = "";
$text['label-copy_to_clipboard']['he-il'] = "";
$text['label-copy_to_clipboard']['it-it'] = "";
$text['label-copy_to_clipboard']['nl-nl'] = "";
$text['label-copy_to_clipboard']['pl-pl'] = "";
$text['label-copy_to_clipboard']['pt-br'] = "";
$text['label-copy_to_clipboard']['pt-pt'] = "";
$text['label-copy_to_clipboard']['ro-ro'] = "";
$text['label-copy_to_clipboard']['ru-ru'] = "";
$text['label-copy_to_clipboard']['sv-se'] = "";
$text['label-copy_to_clipboard']['uk-ua'] = "";
$text['label-copy_to_clipboard']['zh-cn'] = "";
$text['label-copy_to_clipboard']['ja-jp'] = "";
$text['label-copy_to_clipboard']['ko-kr'] = "";
?>
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 417 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 504 B

View File

@ -1,6 +1,6 @@
function copy_to_clipboard() {
const span_id = document.getElementById("system_information");
const text_to_copy = span_id.innerText;
const element_id = document.getElementById("system_information");
const text_to_copy = element_id.value;
navigator.clipboard.writeText(text_to_copy)
.then(function() {
@ -9,4 +9,4 @@ function copy_to_clipboard() {
.catch(function(err) {
console.error('Unable to copy text to clipboard', err);
});
}
}

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2023
Portions created by the Initial Developer are Copyright (C) 2008-2024
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -45,10 +45,87 @@
$language = new text;
$text = $language->get();
//load editor preferences/defaults
if (permission_exists("system_view_support")) {
$setting_size = !empty($_SESSION["editor"]["font_size"]["text"]) ? $_SESSION["editor"]["font_size"]["text"] : '12px';
$setting_theme = !empty($_SESSION["editor"]["theme"]["text"]) ? $_SESSION["editor"]["theme"]["text"] : 'cobalt';
$setting_invisibles = !empty($_SESSION["editor"]["invisibles"]["boolean"]) ? $_SESSION["editor"]["invisibles"]["boolean"] : 'false';
$setting_indenting = !empty($_SESSION["editor"]["indent_guides"]["boolean"]) ? $_SESSION["editor"]["indent_guides"]["boolean"] : 'false';
$setting_numbering = !empty($_SESSION["editor"]["line_numbers"]["boolean"]) ? $_SESSION["editor"]["line_numbers"]["boolean"] : 'true';
}
//additional includes
require_once "resources/header.php";
require_once 'app/system/resources/functions/system_information.php';
//ace editor helpers
if (permission_exists("system_view_support")) {
echo "<script language='JavaScript' type='text/javascript' src='resources/javascript/copy_to_clipboard.js'></script>";
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";
//load editor value from hidden textarea
echo " function load_value() {\n";
echo " editor.session.setValue($('#system_information').val());";
echo " }\n";
//copy the value from the editor to the clipboard
echo " function do_copy() {\n";
echo " $('#system_information').val(editor.session.getValue());\n";
echo " copy_to_clipboard();\n";
echo " alert(\"".$text['message-copied_to_clipboard']."\");\n";
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 " text-align: left;\n";
echo " width: 100%;\n";
echo " height: 300px;\n";
echo " font-size: 12px;\n";
echo " }\n";
echo "</style>\n";
}
//Load an array of system information
$system_information = system_information();
@ -370,22 +447,129 @@
echo "<br /><br />\n";
}
echo "<script src='resources/javascript/copy_to_clipboard.js'></script>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"7\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <th class='th' colspan='2' align='left'>".$text['label-support']."</th>\n";
echo " </tr>\n";
echo "<tr>\n";
echo " <td width='20%' class=\"vncell\" style='text-align: left;'>\n";
echo " <button type='button' id='btn_copy' alt='".$text['label-copy']."' title='' onclick='copy_to_clipboard()' class='btn btn-default' style='margin-left: 15px;'><span class='fas fa-regular fa-clipboard'></span><span class='button-label pad'>" . $text['title-copy_to_clipboard'] . "</span></button>\n";
echo " </td>\n";
echo " <td class=\"row_style1\">\n";
echo " <span id='system_information' name='system_information'>". json_encode($system_information, JSON_PRETTY_PRINT)."</span>\n";
echo " </td>\n";
echo "</tr>\n";
echo "</table>\n";
if (permission_exists("system_view_support")) {
echo "<table width='100%' border='0' cellpadding='7' cellspacing='0'>\n";
echo "<tr>\n";
echo " <th class='th' align='left'>".$text['label-support']."</th>\n";
echo " <th class='th' style='text-align: right;'>\n";
echo " <button type='button' class='btn btn-default' id='btn_copy' alt=\"".$text['label-copy']."\" title=\"".$text['label-copy']."\" onclick='do_copy();'>".$text['label-copy']."<i class='fas fa-regular fa-clipboard pl-5'></i></button>\n";
echo " </th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo " <td width='20%' class='vncell' style='text-align: left;'>\n";
echo " &nbsp;\n";
echo " </td>\n";
echo " <td class='row_style1'>\n";
echo " <textarea class='formfld' id='system_information' name='system_information' style='display: none;'>".json_encode($system_information, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)."</textarea>\n";
echo " <div id='editor'></div>\n";
echo " <table cellpadding='0' cellspacing='0' border='0' style='float: right; padding-top: 5px;'>\n";
echo " <tr>\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' class='formfld' 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";
$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';
echo " <select id='theme' class='formfld' onchange=\"editor.setTheme('ace/theme/' + this.options[this.selectedIndex].value); focus_editor();\">\n";
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 " </td>\n";
echo "</tr>\n";
echo "</table>\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/json',\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";
}
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -260,6 +260,32 @@ $text['message-copy']['zh-cn'] = "复制完成";
$text['message-copy']['ja-jp'] = "コピーが完了しました";
$text['message-copy']['ko-kr'] = "복사 완료";
$text['message-copied_to_clipboard']['en-us'] = "Copied to Clipboard";
$text['message-copied_to_clipboard']['en-gb'] = "Copied to Clipboard";
$text['message-copied_to_clipboard']['ar-eg'] = "نسخ إلى الحافظة";
$text['message-copied_to_clipboard']['de-at'] = "In die Zwischenablage kopiert";
$text['message-copied_to_clipboard']['de-ch'] = "In die Zwischenablage kopiert";
$text['message-copied_to_clipboard']['de-de'] = "In die Zwischenablage kopiert";
$text['message-copied_to_clipboard']['el-gr'] = "Αντιγράφηκε στο Πρόχειρο";
$text['message-copied_to_clipboard']['es-cl'] = "Copiado al portapapeles";
$text['message-copied_to_clipboard']['es-mx'] = "Copiado al portapapeles";
$text['message-copied_to_clipboard']['fr-ca'] = "Copié dans le presse-papier";
$text['message-copied_to_clipboard']['fr-fr'] = "Copié dans le presse-papier";
$text['message-copied_to_clipboard']['he-il'] = "הועתק ללוח";
$text['message-copied_to_clipboard']['it-it'] = "Copiato negli Appunti";
$text['message-copied_to_clipboard']['nl-nl'] = "Gekopieerd naar het klembord";
$text['message-copied_to_clipboard']['pl-pl'] = "Skopiowane do schowka";
$text['message-copied_to_clipboard']['pt-br'] = "Copiado para a área de transferência";
$text['message-copied_to_clipboard']['pt-pt'] = "Copiado para a área de transferência";
$text['message-copied_to_clipboard']['ro-ro'] = "Copiat în Clipboard";
$text['message-copied_to_clipboard']['ru-ru'] = "Скопировано в буфер обмена";
$text['message-copied_to_clipboard']['sv-se'] = "Kopierade till Urklipp";
$text['message-copied_to_clipboard']['uk-ua'] = "Скопійовано в буфер обміну";
$text['message-copied_to_clipboard']['tr-tr'] = "Panoya kopyalandı";
$text['message-copied_to_clipboard']['zh-cn'] = "已复制到剪贴板";
$text['message-copied_to_clipboard']['ja-jp'] = "クリップボードにコピーされました";
$text['message-copied_to_clipboard']['ko-kr'] = "클립보드에 복사됨";
$text['message-toggle']['en-us'] = "Toggle Completed";
$text['message-toggle']['en-gb'] = "Toggle Completed";
$text['message-toggle']['ar-eg'] = "الانتهاء من تبديل";