X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widget-main.js;h=d3a13cf2e2e1b729331759a2eae39c750dcd3b95;hb=f1b90c1b1c6d143d54c4a5752546100836117a9a;hp=55d628d500f602b0bb81623e50bcc0ebe87a5369;hpb=044c8e76ecb0309ea75216f419f3eabcae9ab82d;p=mkws-moved-to-github.git
diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js
index 55d628d..d3a13cf 100644
--- a/src/mkws-widget-main.js
+++ b/src/mkws-widget-main.js
@@ -8,8 +8,8 @@ mkws.registerWidgetType('Targets', function() {
var that = this;
var M = mkws.M;
- this.jqnode.html('No information available yet.');
- this.jqnode.css("display", "none");
+ this.node.html('No information available yet.');
+ this.node.css("display", "none");
this.team.queue("targets").subscribe(function(data) {
var table ='
' +
@@ -29,7 +29,7 @@ mkws.registerWidgetType('Targets', function() {
}
table += '
';
- that.jqnode.html(table);
+ that.node.html(table);
});
});
@@ -39,7 +39,7 @@ mkws.registerWidgetType('Stat', function() {
var M = mkws.M;
this.team.queue("stat").subscribe(function(data) {
- that.jqnode.html(' -- ' +
+ that.node.html(' -- ' +
'' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' +
' -- ' +
M('Retrieved records') + ': ' + data.records + '/' + data.hits);
@@ -52,7 +52,7 @@ mkws.registerWidgetType('Pager', function() {
var M = mkws.M;
this.team.queue("pager").subscribe(function(data) {
- that.jqnode.html(drawPager(data))
+ that.node.html(drawPager(data))
function drawPager(data) {
var teamName = that.team.name();
@@ -130,7 +130,7 @@ mkws.registerWidgetType('Records', function() {
html.push(team.renderDetails(team.currentRecordData()));
}
}
- that.jqnode.html(html.join(''));
+ that.node.html(html.join(''));
function renderSummary(hit) {
var template = team.loadTemplate(that.config.template || "Summary");
@@ -140,7 +140,7 @@ mkws.registerWidgetType('Records', function() {
}
});
- widget.autosearch(that);
+ that.autosearch();
});
@@ -166,7 +166,7 @@ mkws.registerWidgetType('Navi', function() {
');return false;">' + value + '';
});
- that.jqnode.html(text);
+ that.node.html(text);
});
});
@@ -177,8 +177,8 @@ mkws.registerWidgetType('Navi', function() {
mkws.registerWidgetType('Sort', function() {
var that = this;
- this.jqnode.change(function() {
- that.team.set_sortOrder(that.jqnode.val());
+ this.node.change(function() {
+ that.team.set_sortOrder(that.node.val());
if (that.team.submitted()) {
that.team.reShow();
}
@@ -190,8 +190,8 @@ mkws.registerWidgetType('Sort', function() {
mkws.registerWidgetType('Perpage', function() {
var that = this;
- this.jqnode.change(function() {
- that.team.set_perpage(that.jqnode.val());
+ this.node.change(function() {
+ that.team.set_perpage(that.node.val());
if (that.team.submitted()) {
that.team.reShow();
}
@@ -204,7 +204,7 @@ mkws.registerWidgetType('Done', function() {
var that = this;
this.team.queue("complete").subscribe(function(n) {
- that.jqnode.html("Search complete: found " + n + " records");
+ that.node.html("Search complete: found " + n + " records");
});
});
@@ -212,11 +212,11 @@ mkws.registerWidgetType('Done', function() {
mkws.registerWidgetType('Switch', function() {
if (!this.config.show_switch) return;
var tname = this.team.name();
- this.jqnode.html('\
+ this.node.html('\
Records \
| \
Targets');
- widget.hideWhenNarrow(this);
+ this.hideWhenNarrow();
});
@@ -224,7 +224,7 @@ mkws.registerWidgetType('Search', function() {
var tname = this.team.name();
var M = mkws.M;
- this.jqnode.html('\
+ this.node.html('\
';
- this.jqnode.html(s);
+ this.node.html(s);
function mkwsHtmlSort() {
@@ -371,8 +371,8 @@ mkws.registerWidgetType('Lang', function() {
}
}
- this.jqnode.html(data);
- widget.hideWhenNarrow(this);
+ this.node.html(data);
+ this.hideWhenNarrow();
// set or re-set "lang" URL parameter
@@ -400,11 +400,46 @@ mkws.registerWidgetType('MOTD', function() {
var container = this.team.widget('MOTDContainer');
if (container) {
// Move the MOTD from the provided element down into the container
- this.jqnode.appendTo(container.node); // #### can this be container.jqnode
+ this.node.appendTo(container.node);
}
});
+// 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.log(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 s = '';
+ for (var i = 0; i < data.clients; i++) {
+ if (i == data.clients - data.activeclients) {
+ s += '';
+ s += '';
+ }
+ s += '█';
+ }
+ s += '';
+ that.node.html(s);
+ that.node.show();
+ });
+});
+
+
// Some elements have mkws* classes that makes them appear as widgets
// -- for example, because we want to style them using CSS -- but have
// no actual functionality. We register these to prevent ignorable
@@ -413,6 +448,5 @@ mkws.registerWidgetType('MOTD', function() {
mkws.registerWidgetType('Query', function() {});
mkws.registerWidgetType('MOTDContainer', function() {});
mkws.registerWidgetType('Button', function() {});
-mkws.registerWidgetType('Popup', function() {});