Exemplo n.º 1
0
 def pupil_info(self, ar):
     if ar is None:
         return ''
     elems = [
         ar.obj2html(self.pupil, self.pupil.get_full_name(nominative=True))
     ]
     elems += [', ']
     elems += join_elems(list(self.pupil.address_location_lines()),
                         sep=', ')
     return E.p(*elems)
Exemplo n.º 2
0
 def pupil_info(self, ar):
     if ar is None:
         return ''
     elems = [ar.obj2html(self.pupil,
                          self.pupil.get_full_name(nominative=True))]
     elems += [', ']
     elems += join_elems(
         list(self.pupil.address_location_lines()),
         sep=', ')
     return E.p(*elems)
Exemplo n.º 3
0
Arquivo: ui.py Projeto: khchine5/noi
 def my_description(cls, obj, ar):
     mi = ar.master_instance
     if mi is None:
         return
     lst = [obj.summary]
     tpl = u"{0}: {1}"
     # if obj.site is not None and obj.site == mi.interesting_for:
     #     lst.append(_("site-specific"))
     if obj.site is not None:  # and obj.site != mi.interesting_for:
         lst.append(tpl.format(
             ensureUtf(_("Site")), ensureUtf(obj.site)))
     if obj.reporter is not None:
         lst.append(tpl.format(
             ensureUtf(_("Reporter")), ensureUtf(obj.reporter)))
     if obj.project is not None:
         lst.append(tpl.format(
             ensureUtf(_("Project")), ensureUtf(obj.project)))
     if obj.topic is not None:
         lst.append(tpl.format(
             ensureUtf(_("Topic")), ensureUtf(obj.topic)))
     return E.p(*join_elems(lst, '. '))
Exemplo n.º 4
0
Arquivo: ui.py Projeto: khchine5/noi
    def get_slave_summary(self, obj, ar):
        if ar is None:
            return ''
        elems = []

        # Active sessions:
        active_sessions = []
        qs = rt.modules.clocking.Session.objects.filter(ticket=obj)
        tot = Duration()
        for ses in qs:
            d = ses.get_duration()
            if d is not None:
                tot += d
            if ses.end_time is None:
                txt = "{0} since {1}".format(ses.user, ses.start_time)
                lnk = ar.obj2html(ses, txt)
                sar = ses.end_session.request_from(ar)
                if sar.get_permission():
                    lnk = E.span(lnk, " ", sar.ar2button(ses))
                active_sessions.append(lnk)

        # elems.append(E.p(_("Total {0} hours.").format(tot)))
        elems.append(E.p(_("Total %s hours.") % tot))

        if len(active_sessions) > 0:
            elems.append(E.p(
                ensureUtf(_("Active sessions")), ": ",
                *join_elems(active_sessions, ', ')))

        # Button for starting a session from ticket

        sar = obj.start_session.request_from(ar)
        # if ar.renderer.is_interactive and sar.get_permission():
        if sar.get_permission():
            btn = sar.ar2button(obj)
            elems += [E.p(btn)]
        
        return E.div(*elems)