From: Mike Taylor Date: Mon, 3 Mar 2014 14:37:30 +0000 (+0000) Subject: Dramatically simplify onFormSubmitEventHandler() X-Git-Tag: 1.0.0~1367 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=cab59791c1404a649cd64c40d9fdccd27a8fbed4;p=mkws-moved-to-github.git Dramatically simplify onFormSubmitEventHandler() newSearch() can now be a regular, hidden member function. --- diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 2e0c5fd..0a0f632 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -448,21 +448,17 @@ function team($, teamName) { // when search button pressed - // ### This is closure, so can always just operate on its own team function onFormSubmitEventHandler() { - mkws.handle_node_with_team(this, function (tname) { - var val = findnode('.mkwsQuery').val(); - mkws.teams[tname].newSearch(val); - }); - + var val = findnode('.mkwsQuery').val(); + newSearch(val); return false; } // ### won't need to be externally visible once onFormSubmitEventHandler() is fixed. // ### doesn't need windowid - that.newSearch = function(query, sort, targets, windowid) + function newSearch(query, sort, targets, windowid) { debug("newSearch: " + query); @@ -476,7 +472,7 @@ function team($, teamName) { resetPage(); loadSelect(); triggerSearch(query, sort, targets, windowid); - that.switchView('records'); // In case it's configured to start off as hidden + switchView('records'); // In case it's configured to start off as hidden m_submitted = true; } @@ -740,7 +736,7 @@ function team($, teamName) { // switching view between targets and records - that.switchView = function(view) { + function switchView(view) { var targets = findnode('.mkwsTargets'); var results = findnode('.mkwsResults,.mkwsRecords'); var blanket = findnode('.mkwsBlanket'); @@ -772,6 +768,9 @@ function team($, teamName) { } + that.switchView = switchView; + + // detailed record drawing that.showDetails = function (prefixRecId) { var recId = prefixRecId.replace('mkwsRec_', ''); @@ -1169,7 +1168,7 @@ function team($, teamName) { if (targets) s += " in targets '" + targets + "'"; debug(s); - this.newSearch(query, sort, targets, m_teamName); + newSearch(query, sort, targets, m_teamName); }