Author: andre
Date: 2010-02-12 11:23:55 +0100 (Fri, 12 Feb 2010)
New Revision: 40979

Modified:
   
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
Log:
intermediate commit during development of option to not instantly 
relate/unrelate, added relater.instant config variable, removed some apparently 
unused stuff, some doc


Modified: 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
===================================================================
--- 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
    2010-02-11 21:12:50 UTC (rev 40978)
+++ 
mmbase/branches/MMBase-1_9/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Searcher.js.jsp
    2010-02-12 10:23:55 UTC (rev 40979)
@@ -63,6 +63,7 @@
     this.logger.debug(d);
     this.logger.debug("setting up current");
     this.current       = $(d).find(".mm_relate_current")[0];
+    this.instant       = $(d).hasClass("instant");  // instant action
     this.canUnrelate   = $(d).hasClass("can_unrelate");
     this.canEditrelations = $(d).hasClass("can_editrelations");
     if (this.current != null) {
@@ -116,6 +117,7 @@
     var relater = this;
     if ($(el).hasClass("searchable")) {
         var searcher =  new MMBaseSearcher(el, this, type, this.logger);
+        // search
         $(el).find("a.search").each(function() {
             var anchor = this;
             anchor.searcher = searcher;
@@ -124,7 +126,7 @@
                     return this.searcher.search(document.getElementById(id), 
0, anchor);
             });
         });
-
+        // search (submit)
         $(this.repository).find("form.searchform").each(function() {
             var form = this;
             form.searcher = searcher;
@@ -132,6 +134,7 @@
                 return this.searcher.search(form, 0);
             });
         });
+        // create
         $(el).find("a.create").each(function() {
             var anchor = this;
             anchor.searcher = searcher;
@@ -139,13 +142,6 @@
                 return this.searcher.create(anchor);
             });
         });
-        if (this.canUnrelate && this.current) {
-            $(this.current).find("tr.click").each(function() {
-                $(this).click(function(tr) {
-                    relater.unrelate(this);
-                    return false;
-                })});
-        }
     }
 }
 
@@ -158,8 +154,8 @@
 
 
 /**
- * Commits made changes to MMBase. Depends on a jsp 
/mmbase/searchrelate/relate.jsp to do the actual work.
- * This jsp, in turn, depends on the query in the user's session which defined 
what precisely must happen.
+ * Commits makes changes to MMBase. Depends on a jsp 
/mmbase/searchrelate/relate.jsp to do the actual work.
+ * This jsp, in turn, depends on the query in the user's session which defines 
precisely what must happen.
  */
 MMBaseRelater.prototype.commit = function(ev) {
     var relatedNumbers   = this.getNumbers(this.related);
@@ -323,7 +319,6 @@
 
         this.unrelated[number] = null;
 
-
         var currentList =  $(this.current).find("div.searchresult table 
tbody");
         this.logger.debug(currentList[0]);
         currentList.append(tr);
@@ -395,15 +390,15 @@
 
     // Events
     $(tr).unbind();
-    var searcher = this;
+    var self = this;
     $(tr).click(function() {
-        searcher.relate(this)
+        self.relateIt(this)
     });
     $(this.div).trigger("mmsrUnrelate", [tr, this]);
 }
 
 /**
- * Saves a modified relations values.
+ * Does not create a relation but saves a modified one. 
  */
 MMBaseRelater.prototype.saverelation = function(ev) {
     ev.preventDefault();
@@ -823,7 +818,6 @@
 
 }
 
-
 MMBaseSearcher.prototype.filter = function(tr) {
     if (this.type == "repository" && this.relater != null) {
         var number = this.relater.getNumber(tr);

_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to