Beispiel #1
0
    def __init__(self, context = None):
        context = context or {}
        
        if not context.get('title'):
            context['title'] = 'Daphne'
            if context.get('user') and context.get('corba_server'):
                context['title'] += ' - %s' % context.get('corba_server')

        super(BaseSite, self).__init__(context)
        c = self.context

        self.add_media_files('/css/basesite.css')
        self.header.add(
            div(attr(id='branding'), save(self, 'branding'),
                div(attr(id='user_tools'), save(self, 'user_tools'))),
            div(
                div(attr(id='menu_container'), save(self, 'menu_container')),
                div(attr(id='right_menu_container'), save(self, 'right_menu_container'), 
                )
            )
        )
        self.branding.add(h1('Daphne'))
        
        if c.get('user') and c.get('corba_server'):
            self.user_tools.add(span('Server: %s' % c.corba_server),
                                '|',
                                span('User: %s(%s %s)' % (c.user.login, c.user.firstname, c.user.surname)), 
                                '|', 
                                a(attr(href="/logout"), 'Log out'))

        if c.get('main'):
            self.main.add(c.main)
Beispiel #2
0
    def __init__(self, context):
        super(DomainBlockingResult, self).__init__(context)
        c = self.context
        self.main.add(h1(c['heading']))
        if c.get('blocked_objects'):
            self.main.add(p(_('These domains were successfully changed:')),
                          ul(save(self, 'blocked_object_ul')))

            for blocked_object in c['blocked_objects']:
                if c.get('holder_changes') and c.holder_changes.get(
                        blocked_object.id):
                    old_holder = c.holder_changes[
                        blocked_object.id]['old_holder']
                    new_holder = c.holder_changes[
                        blocked_object.id]['new_holder']
                    holder_change_text = notag(
                        ', holder changed ',
                        a(attr(href=old_holder['link']), old_holder['handle']),
                        ' -> ',
                        a(attr(href=new_holder['link']), new_holder['handle']))
                else:
                    holder_change_text = None
                self.blocked_object_ul.add(
                    li(
                        a(attr(href=c['detail_url'] % blocked_object.id),
                          blocked_object.handle), holder_change_text))
Beispiel #3
0
 def make_content(self):
     self.add(self.fields[3],
              span(attr(cssc='date_interval'),
                   save(self, 'date_interval_span'),
                   _('from') + ':', self.fields[0],
                   _('to') + ':', self.fields[1],
              ),
              span(save(self, 'date_interval_offset_span'),
                   attr(cssc='date_interval_offset'), _('offset') + ':', self.fields[4]),
                  
              span(attr(cssc='date_day'),
                   save(self, 'date_day_span'),
                   _('day') + ':', self.fields[2]
                  ),
             )
     self.content_initialized = True
     self.set_iterval_date_display()
Beispiel #4
0
 def make_content(self):
     self.add(
         self.fields[3],
         span(
             attr(cssc='date_interval'),
             save(self, 'date_interval_span'),
             _('from') + ':',
             self.fields[0],
             _('to') + ':',
             self.fields[1],
         ),
         span(save(self, 'date_interval_offset_span'),
              attr(cssc='date_interval_offset'),
              _('offset') + ':', self.fields[4]),
         span(attr(cssc='date_day'), save(self, 'date_day_span'),
              _('day') + ':', self.fields[2]),
     )
     self.content_initialized = True
     self.set_iterval_date_display()
Beispiel #5
0
 def __init__(self, context = None):
     super(BaseSiteMenu, self).__init__(context)
     c = self.context
     if c.has_key('menu'):
         self.menu_container.add(div(attr(id='main-menu'), c.menu))
     if c.get('body_id'):
         self.body.add(attr(id=c.body_id))
     if c.get('headline'):
         self.main.add(h1(c.headline))
     self.right_menu_container.add(
         input(save(self, 'history_checkbox'),
               attr(media_files=['/js/history_button.js', '/js/ext/ext-base.js', '/js/ext/ext-all.js'],
                    id='history_checkbox', 
                    type='checkbox', onchange='setHistory(this)')), 
               label(attr(for_id='history_checkbox'), _('history'))
     )
     if c.history:
         self.history_checkbox.checked = ['', 'checked'][c.history]
Beispiel #6
0
 def __init__(self, context = None):
     if context.get('doctype') is None:
         context['doctype'] = 'xhtml10strict'
     super(BaseTemplate, self).__init__(context)
     self.add_media_files('/css/base.css')
     self.body.add(div(attr(id='container'),
                       save(self, 'container'),
                       div(attr(id='header'), save(self, 'header')),
                       div(attr(id='content_all'), save(self, 'content_all'), #cannot be "content", because of content attribute of gpyweb widgets
                           div(attr(id='columnwrap'), save(self, 'columnwrap'),
                               div(attr(id='content-main'), save(self, 'main')))),
                       div(attr(id='footer'), save(self, 'footer'))
                       ))
Beispiel #7
0
    def render(self, indent_level=0):
        col_count = self.col_count = len(self.header)

        tests_table = table(attr(cssc='verification_check_table'),
                            caption(attr(cssc='section_label'), _('Tests:')))

        if self.resolve:
            self.add(
                form(
                    attr(method='post',
                         onsubmit='return confirm("%s")' % _('Are you sure?')),
                    tests_table))
        else:
            self.add(tests_table)

        tests_table.media_files.extend(
            ['/css/details.css', '/js/contactcheck_detail.js'])
        tests_table.add_css_class('section_table')
        if cherrypy.session.get('history', False):
            tests_table.add_css_class('history')

        tested_data_changed = self.get_data_info()
        if tested_data_changed:
            self.header.insert(
                self.header.index(_('Tested data')) + 1, _('Changed to'))

        tests_table.add(thead([th(item) for item in self.header]))

        if self.check.test_list:
            for row_num, test_data in enumerate(
                    sorted(self.check.test_list,
                           key=lambda k: enums.TEST_DESCS[k.test_handle])):
                rows = []
                row = tr(attr(cssc='row%s' % ((row_num % 2) + 1)))

                current_status = test_data.status_history[-1]
                if current_status.status == 'ok':
                    row.add_css_class('status_ok')
                elif current_status.status == 'fail':
                    row.add_css_class('status_fail')

                row.add(
                    td(attr(title=enums.TEST_DESCS[test_data.test_handle]),
                       enums.TEST_NAMES[test_data.test_handle]))

                row.add(
                    td(
                        self._format_tested_data(test_data.tested_contact_data,
                                                 test_data.test_handle)))
                if tested_data_changed:
                    if test_data.current_contact_data != test_data.tested_contact_data:
                        row.add(
                            td(
                                self._format_tested_data(
                                    test_data.current_contact_data,
                                    test_data.test_handle)))
                    else:
                        row.add(td())

                self._render_test_status(row, current_status,
                                         test_data.test_handle, True)

                rows.append(row)

                if cherrypy.session.get('history', False):
                    for older_status in reversed(
                            test_data.status_history[0:-1]):
                        row = tr(attr(cssc='row%s' % ((row_num % 2) + 1)))
                        row.add(
                            td(
                                attr(colspan=3 if tested_data_changed else 2,
                                     cssc='borderless')))
                        self._render_test_status(row, older_status,
                                                 test_data.test_handle, False)
                        rows.append(row)

                # one tbody per test - tbodies have double border in css to separate tests as sections:
                tests_table.add(tbody(rows))

        current_check_status = self.check.status_history[-1]
        tests_table.add(tfoot(save(tests_table, 'footer')))
        self._render_check_status(tests_table,
                                  current_check_status,
                                  is_current_status=True)
        if cherrypy.session.get('history', False):
            for check_status in reversed(self.check.status_history[:-1]):
                self._render_check_status(tests_table,
                                          check_status,
                                          is_current_status=False)

        if self.resolve:
            tests_table.footer.add(
                tr(
                    td(
                        attr(colspan=col_count),
                        table(
                            attr(cssc='submit-row'),
                            tr(
                                td(
                                    button(
                                        attr(type='submit',
                                             name='status_action',
                                             value=status_action,
                                             id=status_action), action_name))
                                for status_action, action_name
                                in get_status_action(
                                    self.check.test_suite_handle,
                                    current_check_status.status).items())))))

        filters = [[[
            _('Domains_owner'), 'domain',
            [{
                'Registrant.Handle': self.check.contact_handle
            }]
        ]]]
        panel = FilterPanel(filters)
        self.add(panel)

        return super(VerificationCheckDetail, self).render(indent_level)