-
- // switching view between targets and records
- function switchView(view) {
- var targets = widgetNode('Targets');
- var results = widgetNode('Results') || widgetNode('Records');
- var blanket = widgetNode('Blanket');
- var motd = widgetNode('MOTD');
-
- switch(view) {
- case 'targets':
- if (targets) targets.css('display', 'block');
- if (results) results.css('display', 'none');
- if (blanket) blanket.css('display', 'none');
- if (motd) motd.css('display', 'none');
- break;
- case 'records':
- if (targets) targets.css('display', 'none');
- if (results) results.css('display', 'block');
- if (blanket) blanket.css('display', 'block');
- if (motd) motd.css('display', 'none');
- break;
- case 'none':
- alert("mkws.switchView(" + m_teamName + ", 'none') shouldn't happen");
- if (targets) targets.css('display', 'none');
- if (results) results.css('display', 'none');
- if (blanket) blanket.css('display', 'none');
- if (motd) motd.css('display', 'none');
- break;
- default:
- alert("Unknown view '" + view + "'");
- }
- }
- that.switchView = switchView;
-
-
- // detailed record drawing
- that.showDetails = function(recId) {
- var oldRecordId = m_currentRecordId;
- m_currentRecordId = recId;
-
- // remove current detailed view if any
- findnode('#' + recordDetailsId(oldRecordId)).remove();
-
- // if the same clicked, just hide
- if (recId == oldRecordId) {
- m_currentRecordId = '';
- m_currentRecordData = null;
- return;
- }
- // request the record
- log("showDetails() requesting record '" + recId + "'");
- m_paz.record(recId);
- };
-
-
- /*
- * All the HTML stuff to render the search forms and
- * result pages.
- */
- function mkwsHtmlAll() {
- mkwsSetLang();
- if (m_config.show_lang)
- mkwsHtmlLang();
-
- var ranking_data = '<form name="mkwsSelect" class="mkwsSelect mkwsTeam_' + m_teamName + '" action="" >';
- if (m_config.show_sort) {
- ranking_data += M('Sort by') + ' ' + mkwsHtmlSort() + ' ';
- }
- if (m_config.show_perpage) {
- ranking_data += M('and show') + ' ' + mkwsHtmlPerpage() + ' ' + M('per page') + '.';
- }
- ranking_data += '</form>';
- findnode(".mkwsRanking").html(ranking_data);
-
- var container = findnode(".mkwsMOTDContainer");
- if (container.length) {
- // Move the MOTD from the provided element down into the container
- findnode(".mkwsMOTD").appendTo(container);
- }
- }
-
-
- function mkwsSetLang() {
- var lang = mkws.getParameterByName("lang") || m_config.lang;
- if (!lang || !mkws.locale_lang[lang]) {
- m_config.lang = ""
- } else {
- m_config.lang = lang;
- }
-
- log("Locale language: " + (m_config.lang ? m_config.lang : "none"));
- return m_config.lang;
+ m_filterSet.removeMatching(function(f) { return f.type !== 'category' });
+ triggerSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery);
+ switchView('records'); // In case it's configured to start off as hidden
+ m_submitted = true;
+ }
+ that.newSearch = newSearch;
+
+
+ function triggerSearch(query, sortOrder, maxrecs, perpage, limit, targets, torusquery) {
+ resetPage();
+ queue("navi").publish();
+
+ // Continue to use previous query/sort-order unless new ones are specified
+ if (query) m_query = query;
+ if (sortOrder) m_sortOrder = sortOrder;
+ if (perpage) m_perpage = perpage;
+ if (targets) m_filterSet.add(targetFilter(targets, targets));
+
+ var pp2filter = m_filterSet.pp2filter();
+ var pp2limit = m_filterSet.pp2limit(limit);
+ var pp2catLimit = m_filterSet.pp2catLimit();
+ if (pp2catLimit) {
+ pp2filter = pp2filter ? pp2filter + "," + pp2catLimit : pp2catLimit;