r9469: Add a right-click menu to the SWAT desktop.
authorDeryck Hodge <deryck@samba.org>
Mon, 22 Aug 2005 03:38:31 +0000 (03:38 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:34:19 +0000 (13:34 -0500)
This includes a generic showMessage() for opening
a dialog window to the user.

Next is a start menu, and then I'll move on to more
practical functionality... user manager, server config, etc.

deryck
(This used to be commit eeacd73ef2da16337f2968aec86f9f9313085c25)

swat/desktop/index.esp

index aeded6ed4750da0110c50941af5b967fafa87c1c..e45a099156ab16d5bb968d2021f81b49d9df1639 100644 (file)
@@ -38,6 +38,60 @@ function docHeight()
   return y;
 }
 
   return y;
 }
 
+function showMessage(m)
+{
+    var message = new QxWindow();
+    with(message) {
+      setWidth(300);
+      setTop("35%");
+      setLeft("35%");
+      setShowMaximize(false);
+      setShowMinimize(false);
+    }
+
+    var note = new QxAtom(m);
+    with(note) {
+      setTop(10);
+      setLeft(10);
+    }
+
+    var ok = new QxButton("OK");
+    with(ok) {
+      setLeft("42%");
+      setBottom(2);
+    }
+    ok.addEventListener("click", function() {
+      w.remove(message);
+    });
+
+    message.add(note);
+    message.add(ok);
+    w.add(message);
+    message.setVisible(true);
+}
+
+function showContextMenu(e)
+{
+
+  var aboutCmd = new QxCommand();
+  aboutCmd.addEventListener("execute", function() {
+    showMessage("SWAT, the Samba Web Administration Tool.<br/>This tool is currently under development.");
+  });
+
+  var menu = new QxMenu;
+
+  var sub1 = new QxMenuButton("About SWAT", null, aboutCmd);
+  var sep = new QxMenuSeparator();
+  var sub2 = new QxMenuButton("More menu later...", null);
+
+  menu.add(sub1, sep, sub2);
+
+  menu.setLeft(e.getClientX());
+  menu.setTop(e.getClientY());
+  w.add(menu);
+  menu.setVisible(true);
+}
+
 /*** init the page for qooxdoo ***/
 window.application.main = function()
 {
 /*** init the page for qooxdoo ***/
 window.application.main = function()
 {
@@ -50,14 +104,15 @@ window.application.main = function()
     setWidth(docWidth());
     setHeight(docHeight());
   }
     setWidth(docWidth());
     setHeight(docHeight());
   }
+  doc.addEventListener("contextmenu", showContextMenu);
   doc.add(w);
 
 }
 
 window.onresize = function() 
 {
   doc.add(w);
 
 }
 
 window.onresize = function() 
 {
-      w.setWidth(docWidth());
-      w.setHeight(docHeight());
+  w.setWidth(docWidth());
+  w.setHeight(docHeight());
 }
 
 function showReg()
 }
 
 function showReg()