/applet command
authorDarren <darren@darrenwhitlen.com>
Sat, 15 Sep 2012 20:03:24 +0000 (21:03 +0100)
committerDarren <darren@darrenwhitlen.com>
Sat, 15 Sep 2012 20:03:24 +0000 (21:03 +0100)
client_backbone/dev/model_application.js

index 648da47637890b2884eeb548149a504641f69e1d..a33e910106340738a976ff624ecb0a1ca1ade0c5 100644 (file)
@@ -512,6 +512,7 @@ kiwi.model.Application = Backbone.Model.extend(new (function () {
             $script(ev.params[0] + '?' + (new Date().getTime()));\r
         });\r
 \r
+        controlbox.on('command_applet', this.appletCommand);\r
         controlbox.on('command_settings', this.settingsCommand);\r
     };\r
 \r
@@ -632,6 +633,28 @@ kiwi.model.Application = Backbone.Model.extend(new (function () {
         panel.view.show();\r
     };\r
 \r
+    this.appletCommand = function (ev) {\r
+        if (!ev.params[0]) return;\r
+\r
+        var panel = new kiwi.model.Applet();\r
+\r
+        if (ev.params[1]) {\r
+            // Url and name given\r
+            panel.load(ev.params[0], ev.params[1]);\r
+        } else {\r
+            // Load a pre-loaded applet\r
+            if (kiwi.applets[ev.params[0]]) {\r
+                panel.load(new kiwi.applets[ev.params[0]]);\r
+            } else {\r
+                kiwi.app.panels.server.addMsg('', 'Applet "' + ev.params[0] + '" does not exist');\r
+                return;\r
+            }\r
+        }\r
+        \r
+        kiwi.app.panels.add(panel);\r
+        panel.view.show();\r
+    };\r
+\r
 \r
 \r
 \r