22 |
22 |
23 from logilab.mtconverter import xml_escape |
23 from logilab.mtconverter import xml_escape |
24 |
24 |
25 from cubicweb import Unauthorized |
25 from cubicweb import Unauthorized |
26 from cubicweb.selectors import is_instance, one_line_rset |
26 from cubicweb.selectors import is_instance, one_line_rset |
27 from cubicweb.web.htmlwidgets import BoxWidget, BoxMenu, RawBoxItem |
27 from cubicweb.web import (action, component, uicfg, htmlwidgets, |
28 from cubicweb.web import action, component, uicfg, formwidgets as fw |
28 formwidgets as fw) |
29 from cubicweb.web.views import primary |
29 from cubicweb.web.views import primary |
30 |
30 |
31 _abaa = uicfg.actionbox_appearsin_addmenu |
31 _abaa = uicfg.actionbox_appearsin_addmenu |
32 _abaa.tag_subject_of(('*', 'bookmarked_by', '*'), False) |
32 _abaa.tag_subject_of(('*', 'bookmarked_by', '*'), False) |
33 _abaa.tag_object_of(('*', 'bookmarked_by', '*'), False) |
33 _abaa.tag_object_of(('*', 'bookmarked_by', '*'), False) |
103 dlink = u'[<a class="action" href="javascript:removeBookmark(%s)" title="%s">-</a>]' % ( |
103 dlink = u'[<a class="action" href="javascript:removeBookmark(%s)" title="%s">-</a>]' % ( |
104 bookmark.eid, req._('delete this bookmark')) |
104 bookmark.eid, req._('delete this bookmark')) |
105 label = '<div>%s %s</div>' % (dlink, label) |
105 label = '<div>%s %s</div>' % (dlink, label) |
106 self.append(label) |
106 self.append(label) |
107 if self.can_edit: |
107 if self.can_edit: |
108 menu = BoxMenu(req._('manage bookmarks')) |
108 menu = htmlwidgets.BoxMenu(req._('manage bookmarks')) |
109 linkto = 'bookmarked_by:%s:subject' % ueid |
109 linkto = 'bookmarked_by:%s:subject' % ueid |
110 # use a relative path so that we can move the instance without |
110 # use a relative path so that we can move the instance without |
111 # loosing bookmarks |
111 # loosing bookmarks |
112 path = req.relative_path() |
112 path = req.relative_path() |
113 # XXX if vtitle specified in params, extract it and use it as |
113 # XXX if vtitle specified in params, extract it and use it as |