Author: michiel
Date: 2010-03-15 23:26:46 +0100 (Mon, 15 Mar 2010)
New Revision: 41381
Modified:
mmbase/trunk/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Toggle.js.jsp
Log:
Modified:
mmbase/trunk/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Toggle.js.jsp
===================================================================
---
mmbase/trunk/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Toggle.js.jsp
2010-03-15 22:01:11 UTC (rev 41380)
+++
mmbase/trunk/applications/searchrelate/src/main/webapp/mmbase/searchrelate/Toggle.js.jsp
2010-03-15 22:26:46 UTC (rev 41381)
@@ -1,48 +1,72 @@
-$(document).ready(function() {
- $("a.toggle").live("click",
- function() {
- var a = this;
- var body = $(a).siblings("div.toggle_body");
- body.toggle();
- $(a).toggle();
- $(a).siblings("a.toggle").toggle();
- var li = $(a).closest("li");
- $(li).trigger("mmsrToggle", [body]);
- });
- $("div.list li").live("mmsrToggle",
- function(ev, div) {
- // arrange lazy loading
- var li = ev.target;
- div.find("div.unloaded").each(
- function() {
- var unloadedblock = $(this);
- // a.lazyloading child stores
information about what must be loaded
- var a =
unloadedblock.find("a.lazyloading");
- var href = a.attr("href");
- // var
id = blockId.replace("-", "_");;
+/*
+<%...@page contentType="text/javascript; charset=UTF-8"
+%><%...@taglib uri="http://www.mmbase.org/mmbase-taglib-2.0" prefix="mm"
+%><mm:content type="text/javascript">
+*/
+$(document).ready(
+ function() {
+ $("a.toggle").live("click",
+ function() {
+ var a = this;
+ var body = $(a).siblings("div.toggle_body");
+ body.toggle();
+ $(a).toggle();
+ $(a).siblings("a.toggle").toggle();
+ var li = $(a).closest("li");
+ $(li).trigger("mmsrToggle", [body]);
+ });
+ $("div.list li").live("mmsrToggle",
+ function(ev, div, b) {
+ // arrange lazy loading
+ var li = ev.target;
+ var pdiv = $(li).closest("div.list");
+ var rid = pdiv[0].list.rid;
+ // Hmm, in jquery 1.3 it seems that div is
not correctly arriving
+ div.find("div.unloaded").each(
+ function() {
+ var unloadedblock = $(this);
+ // a.lazyloading child stores
information about what must be loaded
+ var a =
unloadedblock.find("a.lazyloading");
+ var classes =
a.attr("class").split(' ');
+ var node;
+ for (var i in classes) {
+ var cl = classes[i];
+ if (cl.indexOf("node_") == 0) {
+ node =
cl.substring("node_".length);
+ }
+ }
+ var href = a.attr("href");
+ // var id = blockId.replace("-",
"_");
+ var lazypart =
"${mm:link('/mmbase/searchrelate/list/lazy-part.jspx')}";
- var id = $(li).attr("id"); // TODO: find
a nice, reproducable, unique id for this item, preferable without the
node-number, because that
- // changes after commit of a new node
(:-()
- unloadedblock.load(href,
- {requestID: id,
-
"org.mmbase.sr.relatednodes.load": "false"},
-
function(responseText, textStatus) {
- if ("success" ==
textStatus) {
- // switch on
mm-sr stuf in this newly loaded block too
-
List.prototype.init(this);
- } else {
- // well, it
doesn't work.
- // Show at
least that.
-
unloadedblock.empty().append(textStatus);
- }
+ var id = $(li).attr("id"); // TODO:
find a nice, reproducable, unique id for this item, preferable without the
node-number, because that
+ // changes after commit of a new
node (:-()
+ unloadedblock.load(lazypart,
+ {requestID: id,
+ href: href,
+ rid: rid,
+ node: node
+ },
+
function(responseText, textStatus) {
+ if ("success"
== textStatus) {
+ // switch
on mm-sr stuf in this newly loaded block too
+
List.prototype.init(this);
+ } else {
+ // well,
it doesn't work.
+ // Show
at least that.
+
unloadedblock.empty().append(textStatus);
+ }
}
- );
- unloadedblock.removeClass("unloaded");
// not any more unloaded
- // mark the block as loaded in the
'lazyloaded' form entry too:
- //
self.getLoadedLazyBlocks(blockId);
+ );
+
unloadedblock.removeClass("unloaded"); // not any more unloaded
+ // mark the block as loaded in the
'lazyloaded' form entry too:
+ //
self.getLoadedLazyBlocks(blockId);
- });
- });
+ });
+ });
-});
\ No newline at end of file
+ }
+);
+
+/*</mm:content>*/
\ No newline at end of file
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs