# HG changeset patch # User Sylvain Thénault # Date 1270038520 -7200 # Node ID 5bf8baecfaf8a1241bb12ed327d07099ab93341e # Parent 9f3ea34f98d13bf183a3ef2e5272640edb604c9b [facet] fix 'bookmark this search': * vid wasn't included in the link generated by the facet box * proper url quoting in both js / box code (try an has_text search with '&' inside...) diff -r 9f3ea34f98d1 -r 5bf8baecfaf8 web/data/cubicweb.facets.js --- a/web/data/cubicweb.facets.js Wed Mar 31 14:27:02 2010 +0200 +++ b/web/data/cubicweb.facets.js Wed Mar 31 14:28:40 2010 +0200 @@ -47,10 +47,11 @@ var rql = result[0]; var $bkLink = jQuery('#facetBkLink'); if ($bkLink.length) { - var bkUrl = $bkLink.attr('cubicweb:target') + '&path=view?rql=' + rql; + var bkPath = 'view?rql=' + escape(rql); if (vid) { - bkUrl += '&vid=' + vid; + bkPath += '&vid=' + escape(vid); } + var bkUrl = $bkLink.attr('cubicweb:target') + '&path=' + escape(bkPath); $bkLink.attr('href', bkUrl); } var toupdate = result[1]; diff -r 9f3ea34f98d1 -r 5bf8baecfaf8 web/views/facets.py --- a/web/views/facets.py Wed Mar 31 14:27:02 2010 +0200 +++ b/web/views/facets.py Wed Mar 31 14:28:40 2010 +0200 @@ -105,7 +105,10 @@ def display_bookmark_link(self, rset): eschema = self._cw.vreg.schema.eschema('Bookmark') if eschema.has_perm(self._cw, 'add'): - bk_path = 'view?rql=%s' % rset.printable_rql() + bk_path = 'rql=%s' % self._cw.url_quote(rset.printable_rql()) + if self._cw.form.get('vid'): + bk_path += '&vid=%s' % self._cw.url_quote(self._cw.form['vid']) + bk_path = 'view?' + bk_path bk_title = self._cw._('my custom search') linkto = 'bookmarked_by:%s:subject' % self._cw.user.eid bk_add_url = self._cw.build_url('add/Bookmark', path=bk_path, title=bk_title, __linkto=linkto)