Exemplo n.º 1
0
 def tfoot(self):
     tr_content = (''.join(
         self.tfoot_td(i, col_key, col)
         for i, (col_key, col) in enumerate(self._cols.items())
         if col.show))
     content = element('tr', content=tr_content, escape_content=False)
     return element('tfoot', content=content, escape_content=False)
Exemplo n.º 2
0
    def tfoot_td(self, i, key, col):
        if key == "id":
            return element("td", content="#")

        if i == 1:
            url = url_for(".create_model")
            tag = f"<a href='{url}'>Add new</a>"
            return element("td", content=tag, escape_content=False)

        return element("td", content="")
Exemplo n.º 3
0
 def __html__(self):
     tbody = self.tbody()
     if tbody or self.allow_empty:
         content = '\n{thead}\n{tbody}\n{tfoot}\n'.format(
             thead=self.thead(),
             tbody=tbody,
             tfoot=self.tfoot(),
         )
         return element('table',
                        attrs=self.get_html_attrs(),
                        content=content,
                        escape_content=False)
     else:
         return element('p', content=self.no_items)
Exemplo n.º 4
0
 def td_contents(self, item, attr_list):
     name = self.from_attr_list(item, 'name')
     refdate = self.from_attr_list(item, 'refdate')
     # url = '/reprocess?filter={}&refdate={}'.format(name, refdate)
     url = 'https://us-central1-kyd-storage-001.cloudfunctions.net/kyd-generic-download-publish?filter={}&refdate={}'.format(
         name, refdate)
     return element('a', {'href': url}, content='Link')
Exemplo n.º 5
0
 def td_contents(self, item, attr_list):
     text = self.td_format(self.text(item, attr_list))
     attrs = dict(type='checkbox', value=text, name='input_checkbox')
     return html.element('input',
                         attrs=attrs,
                         content=' ',
                         escape_content=False)
Exemplo n.º 6
0
 def td_contents(self, item, attr_list):
     img = self.from_attr_list(item, [self.img_attr])
     return html.element('img', {
         'src': img,
         'alt': 'hi',
         'height': 80,
         'width': 80
     })
Exemplo n.º 7
0
 def td_contents(self, item, attr_list):
     attrs = dict(href=self.url(item))
     attrs.update(self.anchor_attrs)
     text = self.td_format(self.text(item, attr_list))
     element_ret = html.element('a',
                                attrs=attrs,
                                content=text,
                                escape_content=False)
     return element_ret
Exemplo n.º 8
0
 def tbody(self):
     out = [self.tr(item) for item in self.items]
     if self.use_item_notes:
         notes = [self.get_notes_tr(item) for item in self.items]
         out = list(itertools.chain(*zip(out, notes)))
     if not out:
         return ''
     content = '\n{}\n'.format('\n'.join(out))
     return element('tbody', content=content, escape_content=False)
Exemplo n.º 9
0
    def td_contents(self, item, attr_list):
        '''
        Wird unsere Link in einer HTML-a tag übersetzen

        '''
        text = self.from_attr_list(item, attr_list)
        link = self.from_attr_list(item, [self.url_attr])
        return element('a', {
            'href': link,
            'onclick': "loading();"
        },
                       content=text)
Exemplo n.º 10
0
 def td(self, item, attr):
     content = self.td_contents(item, self.get_attr_list(attr))
     if item.isActive == 'Active':
         return html.element('td',
                             content=content,
                             escape_content=False,
                             attrs={'class': 'serviceActive'})
     elif item.isActive == 'Inactive':
         return html.element('td',
                             content=content,
                             escape_content=False,
                             attrs={'class': 'serviceInactive'})
     elif item.isActive == 'Activating':
         return html.element('td',
                             content=content,
                             escape_content=False,
                             attrs={'class': 'serviceActivating'})
     else:
         return html.element('td',
                             content=content,
                             escape_content=False,
                             attrs={'class': 'serviceNone'})
Exemplo n.º 11
0
    def td(self, item, attr):
        content = self.td_contents(item, self.get_attr_list(attr))
        if attr == "total":
            if item.total > 0:
                over_par = {"bgcolor": "#0047b3", "style": 'text-align:center; font-size: 16pt; font-family: calibri; border-radius: 6px'}
                return element(
                    'td',
                    content="+"+str(content),
                    escape_content=False,
                    attrs=over_par)
            elif item.total < 0:
                under_par = {"bgcolor":"#FF0000","style":'text-align:center; font-size: 16pt; font-family: calibri; border-radius: 6px'}
                return element(
                    'td',
                    content=content,
                    escape_content=False,
                    attrs=under_par)
            elif item.total == 0:
                on_par = {"bgcolor":"#d3d3d3","style":'text-align:center; font-size: 16pt; font-family: calibri; border-radius: 6px'}
                return element(
                    'td',
                    content=content,
                    escape_content=False,
                    attrs=on_par)
        elif attr == "round":
            if item.round > 0:
                over_par = {"bgcolor": "#0000FF", "style": 'text-align:center; font-size: 16pt; font-family: calibri'}
                return element(
                    'td',
                    content="+"+str(content),
                    escape_content=False,
                    attrs=over_par)

            elif item.round < 0:
                under_par = {"bgcolor":"#FF0000","style":'text-align:center; font-size: 16pt; font-family: calibri'}
                return element(
                    'td',
                    content=content,
                    escape_content=False,
                    attrs=under_par)

            elif item.round == 0:
                on_par = {"bgcolor":"#d3d3d3","style":'text-align:center; font-size: 16pt; font-family: calibri'}
                return element(
                    'td',
                    content=content,
                    escape_content=False,
                    attrs=on_par)
        else:
            return element(
                'td',
                content=content,
                escape_content=False,
                attrs=self.td_html_attrs)
Exemplo n.º 12
0
    def td_contents(self, item, attr_list):
        #item is Task
        elements=[]
        #add fire mark
        if date.today() >= item.ddate:
            #delayed
            if date.today() > cycletypes.next(item.cycletype,item.cycle,item.ddate):
                #delayed more then twice
                elements.append(element('span ',attrs={'class':'glyphicon glyphicon-fire gly-spin color-red'}))
            else:
                #delayed a bit
                elements.append(element('span ',attrs={'class':'glyphicon glyphicon-bell color-yellow'}))

        if item.logging==0:
            #No logging required, making just a link send via ajax
            attrs = {'data-id':item.id,'type':"button",'class':"btn btn-primary btn-xs {}".format(self.endpoint)}
            text = 'Done'
            elements.append(element('button',attrs=attrs, content=text, escape_content=False))
        else:
            #we should show modal window and collect data
            attrs = {'data-logid':item.id,'type':"button",'class':"btn btn-success btn-xs {}".format(self.logendpoint)}
            text = 'Log...'
            elements.append(element('button',attrs=attrs, content=text, escape_content=False))
        return ''.join(elements)
Exemplo n.º 13
0
    def td(self, item, attr, id_attr=True):
        """add option to import tag attrs from item itself - item tag attrs override td_html_attrs"""
        content = self.td_contents(item, self.get_attr_list(attr))
        if len(item.html_attrs) and self.use_item_attrs:
            td_html_attrs = item.html_attrs
        else:
            td_html_attrs = self.td_html_attrs

        if id_attr:
            self.add_html_id_attr(item, td_html_attrs, attr)

        return element('td',
                       content=content,
                       escape_content=False,
                       attrs=td_html_attrs)
Exemplo n.º 14
0
    def th(self, col_key, col):
        content = self.th_contents(col_key, col)
        attrs = col.th_html_attrs

        if self.rotate_header:
            content = Markup('<div><span>') + content + Markup('</span></div>')
            if 'class' in attrs:
                attrs['class'] += ' rotate'
            else:
                attrs['class'] = 'rotate'

        return element(
            'th',
            content=content,
            escape_content=False,
            attrs=attrs,
        )
Exemplo n.º 15
0
 def td_contents(self, item, attr_list):
     text = 'View Petition'
     url = self.from_attr_list(item, [self.url_attr])
     return element('a', {'href': url}, content=text)
Exemplo n.º 16
0
 def td_format(self, content):
     #url = re.escape(content)
     url = content
     url = url.replace("I:\\", "\\\\Utsarr.net\\utfile\\USERS\\")
     print(url)
     return element('a', attrs=dict(href=url), content=url)
Exemplo n.º 17
0
 def td_contents(self, item, attr_list):
     text = self.from_attr_list(item, attr_list)
     url = self.from_attr_list(item, [self.url_attr])
     id = self.from_attr_list(item, [self.id_attr])
     return element('a', {'href': url, 'id': id}, content=text)
Exemplo n.º 18
0
 def td_contents(self, item, attr_list):
     attrs = {'data-id':item.id,'type':"button",'class':"btn btn-info btn-xs {}".format(Markup.escape(self.endpoint))}
     attrs.update(self.anchor_attrs)
     text = self.td_format(self.text(item, attr_list))
     return element('button',attrs=attrs, content=text, escape_content=False)
Exemplo n.º 19
0
 def td_contents(self, item, attr_list):
     attrs = {'data-target':self.endpoint, 'data-myid':item.id,'type':"button",'class':"btn btn-info btn-xs",'data-toggle':"modal"}
     attrs.update(self.anchor_attrs)
     text = self.td_format(self.text(item, attr_list))
     return element('button',attrs=attrs, content=text, escape_content=False)
Exemplo n.º 20
0
 def td_format(self, content):
     return element('a',
                    attrs=dict(href=content, target="_blank"),
                    content="Seite öffnen")
Exemplo n.º 21
0
 def td_contents(self, item, attr_list):
     text = self.from_attr_list(item, attr_list)
     url = self.from_attr_list(item, [self.url_attr])
     return html.element('a', {'href': url}, content=text)