summaryrefslogtreecommitdiffstats
path: root/modules-available/debugconfig
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/debugconfig')
-rw-r--r--modules-available/debugconfig/config.json4
-rw-r--r--modules-available/debugconfig/lang/de/messages.json5
-rw-r--r--modules-available/debugconfig/lang/de/module.json3
-rw-r--r--modules-available/debugconfig/lang/de/template-tags.json7
-rw-r--r--modules-available/debugconfig/lang/en/messages.json5
-rw-r--r--modules-available/debugconfig/lang/en/module.json3
-rw-r--r--modules-available/debugconfig/lang/en/template-tags.json6
-rw-r--r--modules-available/debugconfig/lang/pt/messages.json3
-rw-r--r--modules-available/debugconfig/lang/pt/module.json3
-rw-r--r--modules-available/debugconfig/lang/pt/template-tags.json3
-rw-r--r--modules-available/debugconfig/page.inc.php50
-rw-r--r--modules-available/debugconfig/templates/debugconfig.html42
-rw-r--r--modules-available/debugconfig/templates/relaystatus.html18
13 files changed, 152 insertions, 0 deletions
diff --git a/modules-available/debugconfig/config.json b/modules-available/debugconfig/config.json
new file mode 100644
index 00000000..b8d03278
--- /dev/null
+++ b/modules-available/debugconfig/config.json
@@ -0,0 +1,4 @@
+{
+ "category": "main.settings-server",
+ "dependencies" : ["js_selectize", "bootstrap_multiselect"]
+}
diff --git a/modules-available/debugconfig/lang/de/messages.json b/modules-available/debugconfig/lang/de/messages.json
new file mode 100644
index 00000000..bfa02332
--- /dev/null
+++ b/modules-available/debugconfig/lang/de/messages.json
@@ -0,0 +1,5 @@
+{
+ "invalid-hook": "Ung\u00fcltiger Hook: {{0}}",
+ "no-module-hook": "Modul {{0}} hat keinen Hook",
+ "settings-updated": "Einstellungen wurden aktualisiert"
+}
diff --git a/modules-available/debugconfig/lang/de/module.json b/modules-available/debugconfig/lang/de/module.json
new file mode 100644
index 00000000..461bebdb
--- /dev/null
+++ b/modules-available/debugconfig/lang/de/module.json
@@ -0,0 +1,3 @@
+{
+ "module_name": "KonfigurationsVariablen"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/lang/de/template-tags.json b/modules-available/debugconfig/lang/de/template-tags.json
new file mode 100644
index 00000000..cdd54f6a
--- /dev/null
+++ b/modules-available/debugconfig/lang/de/template-tags.json
@@ -0,0 +1,7 @@
+{
+ "lang_basicConfiguration": "Basiskonfiguration",
+ "lang_clientRelatedConfig": "Die Optionen auf dieser Seite beziehen sich auf das Verhalten der bwLehrpool-Clients.",
+ "lang_editOverrideNotice": "Sie bearbeiten die Einstellungen f\u00fcr einen Unterbereich",
+ "lang_enableOverride": "\u00dcberschreiben",
+ "lang_settingActive": "Einstellung aktiv"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/lang/en/messages.json b/modules-available/debugconfig/lang/en/messages.json
new file mode 100644
index 00000000..0e2ac9fe
--- /dev/null
+++ b/modules-available/debugconfig/lang/en/messages.json
@@ -0,0 +1,5 @@
+{
+ "invalid-hook": "Module {{0}} has an invalid baseconfig hook",
+ "no-module-hook": "Module {{0}} doesn't have a baseconfig hook",
+ "settings-updated": "Settings have been updated"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/lang/en/module.json b/modules-available/debugconfig/lang/en/module.json
new file mode 100644
index 00000000..74dc16c6
--- /dev/null
+++ b/modules-available/debugconfig/lang/en/module.json
@@ -0,0 +1,3 @@
+{
+ "module_name": "Remote debugging"
+}
diff --git a/modules-available/debugconfig/lang/en/template-tags.json b/modules-available/debugconfig/lang/en/template-tags.json
new file mode 100644
index 00000000..351dc0bc
--- /dev/null
+++ b/modules-available/debugconfig/lang/en/template-tags.json
@@ -0,0 +1,6 @@
+{
+ "lang_debugConfig": "Remote Debugging Configuration",
+ "lang_debugDescription": "Configure remote debugging options. If enabled, the satellite server will accept client requests and relay data to the debugging server.",
+ "lang_debuggingActive": "Remote debugging is enabled",
+ "lang_debuggingInactive": "Remote debugging is disabled"
+}
diff --git a/modules-available/debugconfig/lang/pt/messages.json b/modules-available/debugconfig/lang/pt/messages.json
new file mode 100644
index 00000000..f5cb96eb
--- /dev/null
+++ b/modules-available/debugconfig/lang/pt/messages.json
@@ -0,0 +1,3 @@
+{
+ "settings-updated": "As configura\u00e7\u00f5es foram atualizadas"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/lang/pt/module.json b/modules-available/debugconfig/lang/pt/module.json
new file mode 100644
index 00000000..dca9eb8b
--- /dev/null
+++ b/modules-available/debugconfig/lang/pt/module.json
@@ -0,0 +1,3 @@
+{
+ "module_name": "Vari\u00e1veis"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/lang/pt/template-tags.json b/modules-available/debugconfig/lang/pt/template-tags.json
new file mode 100644
index 00000000..14367665
--- /dev/null
+++ b/modules-available/debugconfig/lang/pt/template-tags.json
@@ -0,0 +1,3 @@
+{
+ "lang_basicConfiguration": "Configura\u00e7\u00e3o B\u00e1sica"
+} \ No newline at end of file
diff --git a/modules-available/debugconfig/page.inc.php b/modules-available/debugconfig/page.inc.php
new file mode 100644
index 00000000..09ae0d7d
--- /dev/null
+++ b/modules-available/debugconfig/page.inc.php
@@ -0,0 +1,50 @@
+<?php
+
+class Page_debugConfig extends Page
+{
+
+ const DEFAULT_CONFIG = array("enabled" => false, "debugServer" => "127.0.0.1", "port" => 5500);
+
+ protected function doPreprocess()
+ {
+ User::load();
+ if (!User::hasPermission('superadmin')) {
+ Message::addError('main.no-permission');
+ Util::redirect('?do=Main');
+ }
+ if (Request::post('action') === 'debugconf') {
+ /*if (!filter_var(Request::get('debugServer'), FILTER_VALIDATE_IP)) {
+ return;
+ }*/
+ $this->setConfig();
+ }
+ }
+
+ protected function doRender()
+ {
+ $debug_config = $this->getConfig();
+ Render::addTemplate('debugconfig', array("debugEnabled" => $debug_config["enabled"], "debugServer" => $debug_config["debugServer"], "port" => $debug_config["port"]));
+
+ $task = Property::getDebugTaskStruct();
+ $taskid = $task['id'];
+ $taskstatus = Taskmanager::status($task);
+ error_log(print_r($taskstatus, true));
+
+ Render::addTemplate('relaystatus', array("taskid" => $taskid, "taskstatus" => $taskstatus));
+ }
+
+ private function getConfig()
+ {
+ if (Property::getRemoteDebugConfig() == Null) {
+ Property::setRemoteDebugConfig(self::DEFAULT_CONFIG);
+ }
+ return Property::getRemoteDebugConfig();
+ }
+
+ private function setConfig()
+ {
+ $enabled = isset($_POST['toggleDebug']) ? true : false;
+ Property::setRemoteDebugConfig(array('enabled' => $enabled, 'debugServer' => Request::post('debugServer'), 'port' => Request::post('port')));
+ }
+}
+
diff --git a/modules-available/debugconfig/templates/debugconfig.html b/modules-available/debugconfig/templates/debugconfig.html
new file mode 100644
index 00000000..4e5353b5
--- /dev/null
+++ b/modules-available/debugconfig/templates/debugconfig.html
@@ -0,0 +1,42 @@
+<form action="?do=DebugConfig" method="post">
+ <input type="hidden" name="token" value="{{token}}">
+ <input type="hidden" name="action" value="debugconf">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{lang_debugConfig}}</div>
+ <div class="panel-body">
+ <p>{{lang_debugDescription}}</p>
+ <div class="col-md-5 slx-cfg-toggle">
+ <div>REMOTE_DBG_SERVER</div>
+ <div class="slx-default">master-ip</div>
+ <input class="bootstrap-switch" name="toggleDebug" type="checkbox"
+ {{#debugEnabled}}checked="true"><label style="margin-left: 10px;">{{lang_debuggingActive}}{{/debugEnabled}}
+ {{^debugEnabled}}><label style="margin-left: 10px;">{{lang_debuggingInactive}}{{/debugEnabled}}
+ </label>
+ </div>
+ <div class="col-md-3">
+ <input name="debugServer" id="DBG_SERVER_ADDR" class="form-control" value="{{debugServer}}" type="text"/>
+ </div>
+ <div class="col-md-2">
+ <input name="port" id="DBG_SERVER_PORT" class="form-control" value="{{port}}" type="text" />
+ </div>
+ <div class="col-md-2">
+ <a class="btn btn-default" data-toggle="modal" data-target="help-remoteDebugging">
+ <span class="glyphicon glyphicon-question-sign"></span>
+ </a>
+ </div>
+
+ <div class="modal fade" id="help-remoteDebugging" tabindex="-1" role="dialog">
+ <div class="modal-dialog">
+ <div class="modal-content">
+ <div class="modal-header">{{setting}}</div>
+ <div class="modal-body">{{{description}}}</div>
+ <div class="modal-footer"><a class="btn btn-primary" data-dismiss="modal">{{lang_close}}</a></div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div>
+ <button type="submit" class="btn btn-primary">{{lang_save}}</button>
+ </div>
+</form>
diff --git a/modules-available/debugconfig/templates/relaystatus.html b/modules-available/debugconfig/templates/relaystatus.html
new file mode 100644
index 00000000..60e4c494
--- /dev/null
+++ b/modules-available/debugconfig/templates/relaystatus.html
@@ -0,0 +1,18 @@
+
+<div class="panel panel-default">
+ <div class="panel-heading">Relay Status for task: {{taskid}}</div>
+ <div class="panel-body">
+ <div data-tm-id="{{taskid}}" data-tm-log="messages"></div>
+ </div>
+</div>
+
+<!-- <script type="text/javascript">
+ function restartCb(task)
+ {
+ console.log("here");
+ if (!task)
+ console.log("nothing");
+ else
+ console.log("something");
+ }
+</script> --> \ No newline at end of file