Update of /var/cvs/applications/searchrelate/templates
In directory james.mmbase.org:/tmp/cvs-serv19178

Modified Files:
        Searcher.js.jsp page.jspx relations.tr.jspx 
Log Message:
allmost there with adding tr.relation after new reationnodes are committed, but 
could not get the 
query of the current list.



See also: http://cvs.mmbase.org/viewcvs/applications/searchrelate/templates


Index: Searcher.js.jsp
===================================================================
RCS file: /var/cvs/applications/searchrelate/templates/Searcher.js.jsp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- Searcher.js.jsp     8 Nov 2008 16:05:44 -0000       1.44
+++ Searcher.js.jsp     9 Nov 2008 20:22:03 -0000       1.45
@@ -18,7 +18,7 @@
  * - mmsrCommitted         (use   $("div.mm_related").bind("mmsrCommitted", 
function (e, submitter, status, relater) ) )
  *
  * @author Michiel Meeuwissen
- * @version $Id: Searcher.js.jsp,v 1.44 2008/11/08 16:05:44 andre Exp $
+ * @version $Id: Searcher.js.jsp,v 1.45 2008/11/09 20:22:03 andre Exp $
  */
 
 
@@ -28,7 +28,7 @@
  *
  */
 function MMBaseLogger(area) {
-    this.logEnabled   = true;
+    this.logEnabled   = false;
     /*this.traceEnabled = false;*/
     this.logarea      = area;
 }
@@ -148,9 +148,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.
+ * This jsp, in turn, depends on the query in the user's session which defined 
what precisely must happen.
  */
-
 MMBaseRelater.prototype.commit = function(ev) {
     var relatedNumbers   = this.getNumbers(this.related);
     var unrelatedNumbers = this.getNumbers(this.unrelated);
@@ -178,6 +177,17 @@
                     if (status == "success") {
                         //console.log("" + res);
                         $(a).addClass("succeeded");
+                        if (relatedNumbers != "") { // get them to create tr's 
to edit relations 
+                            var nrs = relatedNumbers.split(",");
+                            $(nrs).each(function(i) {
+                                var nr = this;
+                                console.log(i + ", nr: " + nr);
+                                // var trr = self.getTrrelation(nr); // 
allmost works except for query (you can't get the current one, getQueryId looks 
for a.search))
+                                // var tr = // find the tr
+                                // $(trr).after(tr);
+                            });
+                            
+                        }
                         this.related = {};
                         this.unrelated = {};
                         $(this.div).trigger("mmsrCommitted", [a, status, 
this]);
@@ -197,8 +207,6 @@
 }
 
 
-
-
 MMBaseRelater.prototype.getNumbers = function(map) {
     var numbers = "";
     $.each(map, function(key, value) {
@@ -210,6 +218,20 @@
     return numbers;
 }
 
+MMBaseRelater.prototype.getTrrelation = function(nodenr) {
+    var url = "${mm:link('/mmbase/searchrelate/relations.tr.jspx')}";
+    var params = {id: this.current.searcher.getQueryId(), node: nodenr, 
fields: this.repository.searcher.fields};
+    this.logger.debug(url + ", " + params);
+    var result;
+    $.ajax({async: false, url: url, type: "GET", dataType: "xml", data: params,
+            complete: function(res, status){
+                if ( status == "success" || status == "notmodified" ) {
+                    result = res.responseText;
+                }
+            }
+           });
+    return result;
+}
 
 MMBaseRelater.prototype.bindEvents = function(rep, type) {
     var self = this;
@@ -273,7 +295,6 @@
         this.unrelated[number] = null;
 
 
-
         var currentList =  $(this.current).find("div.searchresult table 
tbody");
         this.logger.debug(currentList[0]);
         currentList.append(tr);
@@ -327,7 +348,7 @@
     // Set up HTML
     var repository =  $(this.div).find("div.mm_relate_repository 
div.searchresult table tbody");
     repository.append(tr);
-    repository.append(relationTrs);
+    $(relationTrs).remove();    // remove the tr's to edit relations
 
     this.current.searcher.dec();
     this.repository.searcher.inc();
@@ -652,7 +673,6 @@
     return result;
 }
 
-
 MMBaseSearcher.prototype.deleteNewlyRemoved = function(rep) {
     this.logger.debug("Deleting newly removed");
     var self = this;


Index: page.jspx
===================================================================
RCS file: /var/cvs/applications/searchrelate/templates/page.jspx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- page.jspx   8 Nov 2008 16:05:44 -0000       1.23
+++ page.jspx   9 Nov 2008 20:22:03 -0000       1.24
@@ -9,7 +9,7 @@
       Presents a table with one page of query results. Plus paging to other 
pages (in tfoot).
       Used in ajax-calls, but can also be directly included with mm:include 
(for initial results).
       @todo Searching only happens in actual mmbase queries now. How about 
lucene queries?
-      @version $Id: page.jspx,v 1.23 2008/11/08 16:05:44 andre Exp $
+      @version $Id: page.jspx,v 1.24 2008/11/09 20:22:03 andre Exp $
   -->
   <jsp:output omit-xml-declaration="true" />
   <mm:import externid="id" required="true" />
@@ -120,7 +120,7 @@
             <mm:listnodes varStatus="status" jspvar="n">
               <mm:include page="node.tr.jspx" attributes="status,[EMAIL 
PROTECTED],customizedir?,fields?" />
               <mm:compare referid="id" regexp="\w*current">
-                <mm:include page="relations.tr.jspx" attributes="[EMAIL 
PROTECTED],query,customizedir?,colcount" />
+                <mm:include page="relations.tr.jspx" attributes="[EMAIL 
PROTECTED],query,customizedir?,fields?" />
               </mm:compare>
             </mm:listnodes>
           </tbody>


Index: relations.tr.jspx
===================================================================
RCS file: /var/cvs/applications/searchrelate/templates/relations.tr.jspx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- relations.tr.jspx   8 Nov 2008 16:05:44 -0000       1.1
+++ relations.tr.jspx   9 Nov 2008 20:22:03 -0000       1.2
@@ -7,24 +7,35 @@
   <mm:content expires="0" type="application/xml">
     <mm:cloud method="asis">
 
-      <mm:import externid="colcount" from="request,parameters" />
-      <mm:import externid="node"  jspvar="n" vartype="Node" required="true" 
from="request,parameters" />
-      <mm:import externid="query" jspvar="q" vartype="org.mmbase.bridge.Query" 
required="true" from="request,parameters" />
+      <mm:import externid="fields" from="request,parameters" />
+      <mm:import externid="node" from="request,parameters" />
+      <mm:import externid="id" from="request,parameters" />
+      <mm:import from="session" externid="${id}" id="q" jspvar="q" 
vartype="org.mmbase.bridge.Query" />
+
+      <mm:node referid="node" jspvar="n">
+        <c:choose>
+          <c:when test="${!empty fields}">
+            <mm:fieldlist fields="$fields">
+              <mm:size id="colcount" write="false" />
+            </mm:fieldlist>
+          </c:when>
+          <c:otherwise>
+            <mm:fieldlist type="list">
+              <mm:size id="colcount" write="false" />
+            </mm:fieldlist>
+          </c:otherwise>
+        </c:choose>
       
       <jsp:scriptlet>
         NodeList rl = Queries.getRelations(q, n);
         pageContext.setAttribute("rl", rl);
       </jsp:scriptlet>
+      </mm:node>
       
       <mm:listnodes referid="rl" id="relation">
         <mm:nodeinfo type="nodemanager" id="nodemanager" write="false" />
-        <tr class="relation node_${node} ${nodemanager}">
+        <tr class="relation node_${n} ${nodemanager}">
           <td colspan="${colcount + 3}">
-            <!--
-            <mm:compare referid="relation" value="$rel"><mm:present 
referid="changerel">
-              <strong class="message">The relation is changed.</strong>
-            </mm:present></mm:compare>
-              -->
             <mm:form styleClass="relation">
               <fieldset>
                 <legend>${nodemanager} relation</legend>
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to