merge stable
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>
Thu, 09 Jul 2009 09:42:44 +0200
branchstable
changeset 2341 6db26d081c37
parent 2336 a15d3f54f0f2 (current diff)
parent 2340 65445ae67db0 (diff)
child 2342 923111e6ab33
merge
--- a/web/data/cubicweb.ajax.js	Wed Jul 08 21:46:30 2009 +0200
+++ b/web/data/cubicweb.ajax.js	Thu Jul 09 09:42:44 2009 +0200
@@ -59,8 +59,8 @@
     if (typeof buildWidgets != 'undefined') {
 	buildWidgets(node);
     }
-    if (typeof roundedCornersOnLoad != 'undefined') {
-	roundedCornersOnLoad();
+    if (typeof roundedCorners != 'undefined') {
+	roundedCorners(node);
     }
     loadDynamicFragments(node);
     jQuery(CubicWeb).trigger('ajax-loaded');
@@ -231,6 +231,7 @@
 	    // make sure the component is visible
 	    removeElementClass(node, "hidden");
 	    swapDOM(node, domnode);
+	    postAjaxLoad(domnode);
 	}
     });
     d.addCallback(resetCursor);
--- a/web/data/cubicweb.htmlhelpers.js	Wed Jul 08 21:46:30 2009 +0200
+++ b/web/data/cubicweb.htmlhelpers.js	Thu Jul 09 09:42:44 2009 +0200
@@ -1,4 +1,5 @@
 CubicWeb.require('python.js');
+CubicWeb.require('jquery.corner.js');
 
 /* returns the document's baseURI. (baseuri() uses document.baseURI if
  * available and inspects the <base> tag manually otherwise.)
@@ -253,13 +254,25 @@
 }
 
 //============= page loading events ==========================================//
+
+CubicWeb.rounded = [
+		    ['div.sideBoxBody', 'bottom 6px'],
+		    ['div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month', 'top 6px'],
+		    ];
+
 function roundedCornersOnLoad() {
-    jQuery('div.sideBoxBody').corner('bottom 6px');
-    jQuery('div.boxTitle, div.boxPrefTitle, div.sideBoxTitle, th.month').corner('top 6px');
+    roundedCorners();
+}
+
+function roundedCorners(node) {
+    node == node || document.body;
+    node = jQuery(node);
+    for(var r=0; r<CubicWeb.rounded.length;r++){
+       node.find(CubicWeb.rounded[r][0]).corner(CubicWeb.rounded[r][1]);
+    }
 }
 
 jQuery(document).ready(roundedCornersOnLoad);
 
-
 CubicWeb.provide('htmlhelpers.js');
 
--- a/web/views/facets.py	Wed Jul 08 21:46:30 2009 +0200
+++ b/web/views/facets.py	Thu Jul 09 09:42:44 2009 +0200
@@ -16,7 +16,8 @@
                                 match_context_prop, yes, relation_possible)
 from cubicweb.web.box import BoxTemplate
 from cubicweb.web.facet import (AbstractFacet, FacetStringWidget, RelationFacet,
-                                prepare_facets_rqlst, filter_hiddens)
+                                prepare_facets_rqlst, filter_hiddens, _cleanup_rqlst,
+                                _prepare_vocabulary_rqlst)
 
 @objectify_selector
 def contextview_selector(cls, req, rset=None, row=None, col=None, view=None,
@@ -163,6 +164,21 @@
             return
         self.rqlst.add_type_restriction(self.filtered_variable, value)
 
+    def possible_values(self):
+        """return a list of possible values (as string since it's used to
+        compare to a form value in javascript) for this facet
+        """
+        rqlst = self.rqlst
+        rqlst.save_state()
+        try:
+            _cleanup_rqlst(rqlst, self.filtered_variable)
+            etype_var = _prepare_vocabulary_rqlst(rqlst, self.filtered_variable, self.rtype, self.role)
+            attrvar = rqlst.make_variable()
+            rqlst.add_selected(attrvar)
+            rqlst.add_relation(etype_var, 'name', attrvar)
+            return [etype for _, etype in self.rqlexec(rqlst.as_string())]
+        finally:
+            rqlst.recover()
 
 class HasTextFacet(AbstractFacet):
     __select__ = relation_possible('has_text', 'subject') & match_context_prop()