Пример #1
0
 def cell_call(self, row, col, **kwargs):
     """the one line view for an entity: linked text view
     """
     entity = self.cw_rset.get_entity(row, col)
     desc = cut(entity.dc_description(), 50)
     title = cut(entity.dc_title(),
                 self._cw.property_value('navigation.short-line-size'))
     self.w(u'<a href="%s" title="%s">%s</a>' % (xml_escape(
         entity.absolute_url()), xml_escape(desc), xml_escape(title)))
Пример #2
0
 def wpath_part(self,
                w,
                part,
                contextentity,
                last=False):  # XXX deprecates last argument?
     if isinstance(part, Entity):
         w(part.view('breadcrumbs'))
     elif isinstance(part, tuple):
         url, title = part
         textsize = self._cw.property_value('navigation.short-line-size')
         w(self.link_template %
           (xml_escape(url), xml_escape(uilib.cut(title, textsize))))
     else:
         textsize = self._cw.property_value('navigation.short-line-size')
         w(xml_escape(uilib.cut(str(part), textsize)))
Пример #3
0
    def build_unrelated_select_div(self,
                                   entity,
                                   rschema,
                                   role,
                                   is_cell=False,
                                   hidden=True):
        options = []
        divid = 'div%s_%s_%s' % (rschema.type, role, entity.eid)
        selectid = 'select%s_%s_%s' % (rschema.type, role, entity.eid)
        if rschema.symmetric or role == 'subject':
            targettypes = rschema.objects(entity.e_schema)
            etypes = '/'.join(
                sorted(etype.display_name(self._cw) for etype in targettypes))
        else:
            targettypes = rschema.subjects(entity.e_schema)
            etypes = '/'.join(
                sorted(etype.display_name(self._cw) for etype in targettypes))
        etypes = uilib.cut(
            etypes, self._cw.property_value('navigation.short-line-size'))
        options.append('<option>%s %s</option>' %
                       (self._cw._('select a'), etypes))
        options += self._get_select_options(entity, rschema, role)
        options += self._get_search_options(entity, rschema, role, targettypes)
        relname, role = self._cw.form.get('relation').rsplit('_', 1)
        return u"""\
<div class="%s" id="%s">
  <select id="%s"
          onchange="javascript: addPendingInsert(this.options[this.selectedIndex], %s, %s, '%s');">
    %s
  </select>
</div>
""" % (hidden and 'hidden' or '', divid, selectid,
        xml_escape(json_dumps(entity.eid)), is_cell and 'true'
        or 'null', relname, '\n'.join(options))
Пример #4
0
 def cell_call(self, row, col, **kwargs):
     entity = self.cw_rset.get_entity(row, col)
     root = entity.cw_adapt_to('ITree').root()
     self.w(u'<a href="%s">%s %s</a> ' % (
         xml_escape(root.absolute_url()),
         xml_escape(root.dc_type()),
         xml_escape(cut(root.dc_title(), 40))))
Пример #5
0
 def cell_call(self, row, col, **kwargs):
     entity = self.cw_rset.get_entity(row, col)
     desc = uilib.cut(entity.dc_description(), 50)
     # NOTE remember camember: tags.a autoescapes
     self.w(
         tags.a(entity.view('breadcrumbtext'),
                href=entity.absolute_url(),
                title=desc))
Пример #6
0
 def prevnext_entity(self, w, entity, type):
     textsize = self._cw.property_value('navigation.short-line-size')
     content = xml_escape(cut(entity.dc_title(), textsize))
     if type == 'prev':
         title = self._cw._('i18nprevnext_previous')
         icon = self.prev_icon
         cssclass = u'previousEntity left'
         content = icon + '&#160;&#160;' + content
     else:
         title = self._cw._('i18nprevnext_next')
         icon = self.next_icon
         cssclass = u'nextEntity right'
         content = content + '&#160;&#160;' + icon
     self.prevnext_div(w, type, cssclass, entity.absolute_url(), title,
                       content)
Пример #7
0
 def cell_call(self, row, col, **kwargs):
     entity = self.cw_rset.get_entity(row, col)
     textsize = self._cw.property_value('navigation.short-line-size')
     self.w(uilib.cut(entity.dc_title(), textsize))
Пример #8
0
 def dc_title(self):
     return uilib.cut(self.printable_value('content', format='text/plain'), 50)
Пример #9
0
 def cell_call(self, row, col, **kwargs):
     entity = self.cw_rset.get_entity(row, col)
     maxsize = self._cw.property_value('navigation.short-line-size')
     content = entity.printable_value('content', format='text/plain')
     self.w(xml_escape(cut(content, maxsize)))
Пример #10
0
 def cell_call(self, row, col=0, **kwargs):
     entity = self.cw_rset.get_entity(row, col)
     self.w(
         cut(entity.dc_title(),
             self._cw.property_value('navigation.short-line-size')))
Пример #11
0
 def cell_call(self, row, col):
     entity = self.cw_rset.get_entity(row, col)
     desc = cut(entity.dc_description(), 50)
     self.w(u'<a href="%s" title="%s">%s</a>' %
            (xml_escape(entity.absolute_url()), xml_escape(desc),
             xml_escape(entity.dc_long_title())))