Remove vacuous try/catch that merely sets mkws_config.error, a member
[mkws-moved-to-github.git] / src / mkws-team.js
index c529c1e..1f0766a 100644 (file)
@@ -153,36 +153,6 @@ function team($, teamName) {
     }
 
 
-    ////////////////////////////////////////////////////////////////////////////////
-    ////////////////////////////////////////////////////////////////////////////////
-
-
-    // when search button pressed
-    function onFormSubmitEventHandler()
-    {
-       var val = findnode('.mkwsQuery').val();
-       newSearch(val);
-       return false;
-    }
-
-
-    function newSearch(query, sortOrder, targets)
-    {
-       log("newSearch: " + query);
-
-       if (mkws_config.use_service_proxy && !mkws.authenticated) {
-           alert("searching before authentication");
-           return;
-       }
-
-       m_filters = []
-       triggerSearch(query, sortOrder, targets);
-       switchView('records'); // In case it's configured to start off as hidden
-       m_submitted = true;
-    }
-
-
-    // limit by target functions
     that.limitTarget  = function (id, name)
     {
        log("limitTarget(id=" + id + ", name=" + name + ")");
@@ -192,7 +162,6 @@ function team($, teamName) {
     }
 
 
-    // limit the query after clicking the facet
     that.limitQuery = function (field, value)
     {
        log("limitQuery(field=" + field + ", value=" + value + ")");
@@ -244,6 +213,32 @@ function team($, teamName) {
     }
 
 
+    that.showPage = function (pageNum)
+    {
+       m_currentPage = pageNum;
+       m_paz.showPage(m_currentPage - 1);
+    }
+
+
+    that.pagerNext = function () {
+       if (m_totalRecordCount - m_perpage*m_currentPage > 0) {
+            m_paz.showNext();
+            m_currentPage++;
+       }
+    }
+
+
+    that.pagerPrev = function () {
+       if (m_paz.showPrev() != false)
+            m_currentPage--;
+    }
+
+
+    that.reShow = function() {
+       m_paz.show(0, m_perpage, m_sortOrder);
+    }
+
+
     function resetPage()
     {
        m_currentPage = 1;
@@ -252,6 +247,22 @@ function team($, teamName) {
     that.resetPage = resetPage;
 
 
+    function newSearch(query, sortOrder, targets)
+    {
+       log("newSearch: " + query);
+
+       if (mkws_config.use_service_proxy && !mkws.authenticated) {
+           alert("searching before authentication");
+           return;
+       }
+
+       m_filters = []
+       triggerSearch(query, sortOrder, targets);
+       switchView('records'); // In case it's configured to start off as hidden
+       m_submitted = true;
+    }
+
+
     function triggerSearch (query, sortOrder, targets)
     {
        resetPage();
@@ -302,32 +313,6 @@ function team($, teamName) {
     }
 
 
-    that.reShow = function() {
-       m_paz.show(0, m_perpage, m_sortOrder);
-    }
-
-
-    that.showPage = function (pageNum)
-    {
-       m_currentPage = pageNum;
-       m_paz.showPage(m_currentPage - 1);
-    }
-
-
-    that.pagerNext = function () {
-       if (m_totalRecordCount - m_perpage*m_currentPage > 0) {
-            m_paz.showNext();
-            m_currentPage++;
-       }
-    }
-
-
-    that.pagerPrev = function () {
-       if (m_paz.showPrev() != false)
-            m_currentPage--;
-    }
-
-
     // switching view between targets and records
     function switchView(view) {
        var targets = findnode('.mkwsTargets');
@@ -444,7 +429,11 @@ function team($, teamName) {
 
        mkwsHtmlSwitch();
 
-       findnode('.mkwsSearchForm').submit(onFormSubmitEventHandler);
+       findnode('.mkwsSearchForm').submit(function() {
+           var val = findnode('.mkwsQuery').val();
+           newSearch(val);
+           return false;
+       });
 
        // on first page, hide the termlist
        $(document).ready(function() { findnode(".mkwsTermlists").hide(); });
@@ -787,17 +776,8 @@ function team($, teamName) {
 
     // main
     (function() {
-       try {
-           mkwsHtmlAll()
-       }
-
-       catch (e) {
-           mkws_config.error = e.message;
-           // alert(e.message);
-       }
+       mkwsHtmlAll()
     })();
 
-    // Bizarrely, 'that' is just an empty hash. All its state is in
-    // the closure variables defined earlier in this function.
     return that;
 };