- return s;
- }
- });
- }
-
-
- function promoteRecords() {
- team.queue("records").subscribe(function(data) {
- var html = [];
- for (var i = 0; i < data.hits.length; i++) {
- var hit = data.hits[i];
- var divId = team.recordElementId(hit.recid[0]);
- html.push('<div class="record mkwsTeam_' + team.name() + ' ' + divId + '">', renderSummary(hit), '</div>');
- // ### At some point, we may be able to move the
- // m_currentRecordId and m_currentRecordData members
- // from the team object into this widget.
- if (hit.recid == team.currentRecordId()) {
- if (team.currentRecordData())
- html.push(team.renderDetails(team.currentRecordData()));
- }
- }
- $(node).html(html.join(''));
-
- function renderSummary(hit)
- {
- var template = team.loadTemplate("Summary");
- hit._id = team.recordElementId(hit.recid[0]);
- hit._onclick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;"
- return template(hit);
- }
- });
+mkws.registerWidgetType('Search', function() {
+ var tname = this.team.name();
+ var M = mkws.M;
+
+ $(this.node).html('\
+<form name="mkwsSearchForm" class="mkwsSearchForm mkwsTeam_' + tname + '" action="" >\
+ <input class="mkwsQuery mkwsTeam_' + tname + '" type="text" size="' + this.config.query_width + '" />\
+ <input class="mkwsButton mkwsTeam_' + tname + '" type="submit" value="' + M('Search') + '" />\
+</form>');
+});
+
+
+mkws.registerWidgetType('SearchForm', function() {
+ var team = this.team;
+ $(this.node).submit(function() {
+ var val = team.widget('Query').value();
+ team.newSearch(val);
+ return false;
+ });
+});
+
+
+mkws.registerWidgetType('Results', function() {
+ var tname = this.team.name();
+
+ $(this.node).html('\
+<table width="100%" border="0" cellpadding="6" cellspacing="0">\
+ <tr>\
+ <td class="mkwsTermlistContainer1 mkwsTeam_' + tname + '" width="250" valign="top">\
+ <div class="mkwsTermlists mkwsTeam_' + tname + '"></div>\
+ </td>\
+ <td class="mkwsMOTDContainer mkwsTeam_' + tname + '" valign="top">\
+ <div class="mkwsRanking mkwsTeam_' + tname + '"></div>\
+ <div class="mkwsPager mkwsTeam_' + tname + '"></div>\
+ <div class="mkwsNavi mkwsTeam_' + tname + '"></div>\
+ <div class="mkwsRecords mkwsTeam_' + tname + '"></div>\
+ </td>\
+ </tr>\
+ <tr>\
+ <td colspan="2">\
+ <div class="mkwsTermlistContainer2 mkwsTeam_' + tname + '"></div>\
+ </td>\
+ </tr>\
+</table>');
+});
+
+
+mkws.registerWidgetType('Ranking', function() {
+ var tname = this.team.name();
+ var that = this;
+ var M = mkws.M;
+
+ var s = '<form name="mkwsSelect" class="mkwsSelect mkwsTeam_' + tname + '" action="" >';
+ if (this.config.show_sort) {
+ s += M('Sort by') + ' ' + mkwsHtmlSort() + ' ';
+ }
+ if (this.config.show_perpage) {
+ s += M('and show') + ' ' + mkwsHtmlPerpage() + ' ' + M('per page') + '.';