Part of ACREP-30.
[mkws-moved-to-github.git] / src / mkws-team.js
index c688f76..17f0f1f 100644 (file)
@@ -114,6 +114,37 @@ mkws.makeTeam = function($, teamName) {
     return x;
   }
 
+  that.handleChanges = function(oldState, newState) {
+    for (var key in newState) {
+      var val = newState[key];
+      if (newState.hasOwnProperty(key) &&
+          (!oldState || val != oldState[key])) {
+        that.warn("changed property " + key + ": " + 
+                  (oldState ? ("'" + oldState[key] + "'") : "undefined") +
+                  " -> '" + val + "'");
+        if (key === 'page') {
+          that.showPage(parseInt(val));
+        } else if (key === 'sort') {
+          that.set_sortOrder(val);
+          if (that.submitted()) {
+            that.reShow();
+          }
+        } else if (key === 'size') {
+          that.set_perpage(val);
+          if (that.submitted()) {
+            that.reShow();
+          }
+        } else if (key.indexOf('xt-') == 0) {
+          that.limitTarget(key.substring(3), val);
+        } else if (key.indexOf('xf-') == 0) {
+          var a = key.split('-');
+          that.limitQuery(a[1], a[2]);
+        }
+      }
+    }
+  };
+
+
   // The following PubSub code is modified from the jQuery manual:
   // http://api.jquery.com/jQuery.Callbacks/
   //