summaryrefslogtreecommitdiff
path: root/swat/apps/plug-ins/echo.js
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2006-12-16 19:07:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:23 -0500
commitff8ef6c280a7107ce521eee57df9218b4cac0465 (patch)
treefbe240b4d3107db5c98bcd508624826d579f243c /swat/apps/plug-ins/echo.js
parent5249de851976e274ea02fefc3b71cddb4b5ab207 (diff)
downloadsamba-ff8ef6c280a7107ce521eee57df9218b4cac0465.tar.gz
samba-ff8ef6c280a7107ce521eee57df9218b4cac0465.tar.bz2
samba-ff8ef6c280a7107ce521eee57df9218b4cac0465.zip
r20220: Apply patch from Brad Henry with some additional qooxdoo/json-rpc SWAT
functionality: basic admin console. (This used to be commit 23f8dd44cbf85e05e4b3d38de9ed7798dd21defb)
Diffstat (limited to 'swat/apps/plug-ins/echo.js')
-rw-r--r--swat/apps/plug-ins/echo.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/swat/apps/plug-ins/echo.js b/swat/apps/plug-ins/echo.js
new file mode 100644
index 0000000000..1a32c5c320
--- /dev/null
+++ b/swat/apps/plug-ins/echo.js
@@ -0,0 +1,71 @@
+
+// This function takes the main pane widget and jams its widget in the right
+// sub-pane.
+
+function _asyncEchoHandler(result, ex, id, paneWidget) {
+ var replyTextArea = null;
+ var refreshButton = null;
+ var echoTextField = null;
+
+ if (ex == null) {
+ // We need to remove anything previously drawn in this area.
+ paneWidget.removeAll();
+
+ echoTextField = new qx.ui.form.TextField();
+ echoTextField.setTop(0);
+ echoTextField.setLeft(0);
+
+ refreshButton = new qx.ui.form.Button("Refresh");
+ refreshButton.setTop(0);
+ refreshButton.setLeft(150);
+
+ replyTextArea = new
+ qx.ui.form.TextArea(result);
+ replyTextArea.setWrap(true);
+ replyTextArea.setWidth("100%");
+ replyTextArea.setHeight("50%");
+ replyTextArea.setTop(30);
+ replyTextArea.setBottom(50);
+ replyTextArea.setLeft(0);
+ replyTextArea.setRight(20);
+ } else {
+ alert("Async(" + id + ") exception: " + ex);
+ }
+ paneWidget.add(replyTextArea);
+ paneWidget.add(refreshButton);
+ paneWidget.add(echoTextField);
+
+ // Provide a handler for the button.
+ with (refreshButton) {
+ addEventListener("execute", function(e) {
+ this.debug("executed: " + this.getLabel());
+ this.debug("echoTextField.getValue(): " + echoTextField.getValue());
+ _echoPlugInDisplay(paneWidget, echoTextField.getValue());
+ });
+ };
+}
+
+function _echoPlugInDisplay(paneWidget, echoText) {
+ if (echoText == null) {
+ echoText = "Hello World!";
+ }
+
+ var rpc = new qx.io.remote.Rpc();
+ rpc.setTimeout(60000);
+ rpc.setUrl("/services/");
+ rpc.setServiceName("samba.adm");
+ rpc.setCrossDomain(false);
+
+ mycall = rpc.callAsync(
+ function(result, ex, id) {
+ _asyncEchoHandler(result, ex, id, paneWidget);
+ },
+ "echo",
+ echoText);
+}
+
+function EchoPlugIn() {
+ var o = new Object();
+ o.display = _echoPlugInDisplay;
+ return o;
+}