Update of /var/cvs/speeltuin/mihxil/wiki/mmbase/taglib
In directory james.mmbase.org:/tmp/cvs-serv2257
Modified Files:
Searcher.js.jsp
Log Message:
added some documentation
See also: http://cvs.mmbase.org/viewcvs/speeltuin/mihxil/wiki/mmbase/taglib
Index: Searcher.js.jsp
===================================================================
RCS file: /var/cvs/speeltuin/mihxil/wiki/mmbase/taglib/Searcher.js.jsp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- Searcher.js.jsp 25 Mar 2008 16:50:52 -0000 1.4
+++ Searcher.js.jsp 31 Mar 2008 14:09:57 -0000 1.5
@@ -1,6 +1,19 @@
// -*- mode: javascript; -*-
<[EMAIL PROTECTED] uri="http://www.mmbase.org/mmbase-taglib-2.0" prefix="mm"
%>
<mm:content type="text/javascript" expires="0">
+/**
+ * Generic mmbase search & relate tool. Javascript part.
+ *
+ *
+ * Usage: It is sufficient to use the <mm:relate tag. This tag wil know wether
this javascript is already loaded, and if not, will arrange for that. It is
required to load jquery, though.
+
+ * On ready, the necessary javascript will then be connected to .mm_related
a.search
+
+ *
+ * @author Michiel Meeuwissen
+ * @version $Id:
+ */
+
function MMBaseSearcher(d) {
this.logEnabled = true;
@@ -25,6 +38,12 @@
}
+/**
+ * This method is called if somebody clicks on a.search.
+ * It depends on a jsp /mmbase/taglib/page.jspx to return the search results.
+ * Feeded are 'id' 'offset' and 'search'.
+ * The actual query is supposed to be on the user's session, and will be
picked up in page.jspx.
+ */
MMBaseSearcher.prototype.search = function(offset) {
var newSearch =
$(this.div).find("input.mm_relate_repository_search")[0].value;
if (newSearch != this.value) {
@@ -69,6 +88,10 @@
return false;
}
+
+/**
+ * Moves a node from the 'unrelated' repository to the list of related nodes.
+ */
MMBaseSearcher.prototype.relate = function(el) {
var number = $(el).find("td.node.number")[0].textContent;
if (typeof(this.unrelated[number]) == "undefined") {
@@ -83,6 +106,9 @@
});
}
+/**
+ * Moves a node from the list of related nodes to the 'unrelated' repository.
+ */
MMBaseSearcher.prototype.unrelate = function(el) {
var number = $(el).find("td.node.number")[0].textContent;
if (typeof(this.related[number]) == "undefined") {
@@ -97,6 +123,11 @@
});
}
+/**
+ * Commits made changes to MMBase. Depends on a jsp /mmbase/taglib/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.
+ */
+
MMBaseSearcher.prototype.commit = function(node) {
this.log("Commiting changed relations of " + this.div.id);
var id = this.div.id;
@@ -129,6 +160,7 @@
});
}
+
$(document).ready(function(){
$("body").find(".mm_related a.search")
.each(function() {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs