+// This widget has no functionality of its own, but its configuration
+// is copied up into its team, allowing it to affect other widgets in
+// the team.
+//
+mkws.registerWidgetType('config', function() {
+ var c = this.config;
+ for (var name in c) {
+ if (c.hasOwnProperty(name)) {
+ this.team.config[name] = c[name];
+ this.info(this + " copied property " + name + "='" + c[name] + "' up to team");
+ }
+ }
+});
+
+
+mkws.registerWidgetType('progress', function() {
+ var that = this;
+ this.node.hide();
+ this.team.queue("stat").subscribe(function(data) {
+ var template = that.team.loadTemplate(that.config.template || "progress");
+ that.node.html(template({
+ done: data.clients - data.activeclients,
+ waiting: data.activeclients
+ }));
+ that.node.show();
+ });
+});
+
+
+mkws.registerWidgetType('waiting', function() {
+ var that = this;
+
+ this.node.css("visibility", "hidden");
+ var template = that.team.loadTemplate(that.config.template || "waiting");
+ this.node.html(template({
+ src: this.config.src || "http://mkws.indexdata.com/progress.gif"
+ }));
+
+ this.team.queue("searchtriggered").subscribe(function(data) {
+ that.node.css("visibility", "visible");
+ });
+ this.team.queue("complete").subscribe(function(n) {
+ that.node.css("visibility", "hidden");
+ });
+});
+
+