Beispiel #1
0
    def resolve(self, **kwd):
        '''Accept and send'''
        log_req = self._create_log_req_for_object_view('PublicRequestAccept', **kwd)
        try:
            cherrypy.session['Admin'].processPublicRequest(int(kwd['id']), False)
            log_req.result = 'Success'
        except ccReg.Admin.REQUEST_BLOCKED:
            log_req.result = 'Fail'
            raise CustomView(self._render(
                'error', {'message': [
                    _(u'This object is blocked, request cannot be accepted.'
                      u'You can return back to '),
                    a(attr(href=f_urls[self.classname] + 'detail/?id=%s' % kwd['id']),
                      _('public request.'))
                ]}))
        except ccReg.Admin.OBJECT_NOT_FOUND:
            log_req.result = 'Fail'
            raise CustomView(self._render(
                'error', {'message': [
                    _(u'No such public request. Maybe it has already been resolved '
                      u'or this type of public request cannot be resolved. '
                      u'You can return back to '),
                    a(attr(href=f_urls[self.classname] + 'detail/?id=%s' % kwd['id']),
                      _('public request.'))
                ]}))
        finally:
            log_req.close()

        raise cherrypy.HTTPRedirect(f_urls[self.classname] + 'filter/?reload=1&load=1')
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 __init__(self, context=None):
     super(DomainFilterPage, self).__init__(context)
     c = self.context
     if hasattr(self.main, 'exports'):
         self.main.exports.add(
             p(
                 _('Export for out-of-zone notification'),
                 a(
                     attr(href='?txt=1&%s' %
                          self.NOTIFICATION_EXPORT_COLUMNS_QUERY), 'TXT'),
                 ',',
                 a(
                     attr(href='?csv=1&%s' %
                          self.NOTIFICATION_EXPORT_COLUMNS_QUERY), 'CSV')))
Beispiel #4
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 #5
0
    def unblock(self, id):
        context = DictLookup()
        try:
            reg_id = int(id)
        except (TypeError, ValueError):
            context.message = _("Required_integer_as_parameter")
            raise CustomView(self._render('error', ctx=context))

        return_message = [
            _(u'You can return back to '),
            a(attr(href=f_urls[self.classname] + 'detail/?id=%s' % reg_id),
              _('registrar.'))
        ]

        admin = cherrypy.session.get('Admin')
        if not admin.isRegistrarBlocked(reg_id):
            context.message = [_("This registrar is not blocked.")] + return_message
            return self._render('error', ctx=context)
        else:
            log_req = utils.create_log_request('RegistrarUpdate', [['blocked', 'False']], [[self.classname, reg_id]])
            try:
                admin.unblockRegistrar(reg_id, log_req.request_id)
                log_req.result = 'Success'
            finally:
                log_req.close()

            context.main = [_("Registrar successfully unblocked.")] + return_message
            return self._render('base', ctx=context)
Beispiel #6
0
    def make_content(self):
        self.content = []

        self.inner_field.owner_detail = self.owner_detail
        if self.value:
            for i, history_rec in enumerate(self.value):
                val = from_any(history_rec.value, True)
                inner_field_copy = copy(self.inner_field)
                inner_field_copy.value = val
                date_from = history_rec._from  #recoder.corba_to_datetime(history_rec._from)
                date_to = history_rec.to  #recoder.corba_to_datetime(history_rec.to)
                logger_url = f_urls[
                    'logger'] + 'detail/?id=%s' % history_rec.requestId

                history_tr = tr()
                if i > 0:
                    history_tr.cssc = 'history_row'
                log_req_link = a(attr(
                    href=logger_url), img(attr(src='/img/icons/open.png'))
                                 ) if history_rec.requestId else ''
                history_tr.add(
                    td(inner_field_copy),
                    td(attr(cssc='history_dates_field'), _('from'), date_from),
                    td(attr(cssc='history_dates_field'), date_to and _('to')
                       or '', date_to),
                    td(attr(cssc='history_dates_field'), log_req_link))
                self.add(history_tr)
        else:
            self.add(div(attr(cssc='field_empty')))
Beispiel #7
0
    def unblock(self, id):
        context = DictLookup()
        try:
            reg_id = int(id)
        except (TypeError, ValueError):
            context.message = _("Required_integer_as_parameter")
            raise CustomView(self._render('error', ctx=context))

        return_message = [
            _(u'You can return back to '),
            a(attr(href=f_urls[self.classname] + 'detail/?id=%s' % reg_id),
              _('registrar.'))
        ]

        admin = cherrypy.session.get('Admin')
        if not admin.isRegistrarBlocked(reg_id):
            context.message = [_("This registrar is not blocked.")
                               ] + return_message
            return self._render('error', ctx=context)
        else:
            log_req = utils.create_log_request('RegistrarUpdate',
                                               [['blocked', 'False']],
                                               [[self.classname, reg_id]])
            try:
                admin.unblockRegistrar(reg_id, log_req.request_id)
                log_req.result = 'Success'
            finally:
                log_req.close()

            context.main = [_("Registrar successfully unblocked.")
                            ] + return_message
            return self._render('base', ctx=context)
    def _get_check_messages_list(self, check):
        messages = c2u(
            cherrypy.session['Verification'].getContactCheckMessages(
                u2c(check.contact_id)))

        if len(messages):
            messages_table = SimpleTable(
                header=[
                    _('Id'),
                    _('Created'),
                    _('Channel'),
                    _('Type'),
                    _('Updated'),
                    _('Status')
                ],
                data=[(a(
                    attr(href=f_urls['mail' if msg.type_handle ==
                                     'email' else 'message'] +
                         'detail/?id=%s' % msg.id),
                    img(src='/img/icons/open.png')), msg.created,
                       msg.type_handle, msg.content_handle, msg.updated,
                       msg.status) for msg in messages],
                cssc='itertable')
            messages_table.media_files.append('/css/itertable.css')
            return messages_table
        else:
            return _('No messages have been sent.')
Beispiel #9
0
    def close(self, **kwd):
        '''Close and invalidate'''
        log_req = self._create_log_req_for_object_view(
            'PublicRequestInvalidate', **kwd)
        try:
            cherrypy.session['Admin'].processPublicRequest(
                int(kwd['id']), True)
            log_req.result = 'Success'
        except ccReg.Admin.REQUEST_BLOCKED:
            log_req.result = 'Fail'
            raise CustomView(
                self._render(
                    'error', {
                        'message': [
                            _(u'Request cannot be accepted.'
                              u'You can return back to '),
                            a(
                                attr(href=f_urls[self.classname] +
                                     'detail/?id=%s' % kwd['id']),
                                _('public request.'))
                        ]
                    }))
        finally:
            log_req.close()

        raise cherrypy.HTTPRedirect(f_urls[self.classname] +
                                    'filter/?reload=1&load=1')
Beispiel #10
0
    def make_content(self):
        self.content = []
        self.create_inner_details()

        if self.inner_details:
            # Header:
            thead_row = tr()
            for field in self.inner_details[0].fields.values():
                thead_row.add(th(field.label))
            thead_row.add(th(_('From')), th(_('To')), th(_('L.')))
            self.add(thead(thead_row))

            # rows (each row is made from one detail of object in object list
            self.add(tbody(tagid('tbody')))
            for i, detail in enumerate(self.inner_details):
                history_rec = self.value[i]
                date_from = history_rec._from  #recoder.corba_to_datetime(history_rec._from)
                date_to = history_rec.to  #recoder.corba_to_datetime(history_rec.to)
                logger_url = f_urls[
                    'logger'] + 'detail/?id=%s' % history_rec.requestId

                history_tr = tr()
                if i > 0:
                    history_tr.cssc = 'history_row'
                log_req_link = a(attr(
                    href=logger_url), img(attr(src='/img/icons/open.png'))
                                 ) if history_rec.requestId else ''
                history_tr.add(
                    detail, td(attr(cssc='history_dates_field'), date_from),
                    td(attr(cssc='history_dates_field'), date_to),
                    td(attr(cssc='history_dates_field'), log_req_link))
                self.add(history_tr)
        else:
            self.add(div(attr(cssc='field_empty')))
Beispiel #11
0
 def layout_fields(self): 
     section_name = self.section_spec[0]
     section_id = self.section_spec[1]
     link_id = "%s_display" % section_id
     self.add(div(
         attr(style="text-align: right; padding-right: 1em;"),
         a(
             "hide", 
             attr(href="JavaScript:void();"), 
             onclick="show_hide('%s', '%s');" % (section_id, link_id),
             id=link_id)))
     self.add(table(tagid("table"), id=section_id))
     self.add(legend(section_name))
     fields_in_section = self.get_fields()
     hidden_fields = []
     for field in fields_in_section:
         if field.is_hidden:
             hidden_fields.append(field)
             continue
         label_str = self.get_label_name(field)
         errors = self.form.errors.get(field.name_orig, None)
         self.table.add(tr(
             td(label_str),
             td(errors, field)))
     self.add(hidden_fields)
Beispiel #12
0
    def make_content(self):
        self.content = []

        self.inner_field.owner_detail = self.owner_detail
        if self.value:
            for i, history_rec in enumerate(self.value):
                val = from_any(history_rec.value, True)
                inner_field_copy = copy(self.inner_field)
                inner_field_copy.value = val
                date_from = history_rec._from #recoder.corba_to_datetime(history_rec._from)
                date_to = history_rec.to #recoder.corba_to_datetime(history_rec.to)
                logger_url = f_urls['logger'] + 'detail/?id=%s' % history_rec.requestId

                history_tr = tr()
                if i > 0:
                    history_tr.cssc = 'history_row'
                log_req_link = a(attr(href=logger_url), img(attr(src='/img/icons/open.png'))) if history_rec.requestId else ''
                history_tr.add(
                    td(inner_field_copy),
                    td(attr(cssc='history_dates_field'), _('from'), date_from),
                    td(attr(cssc='history_dates_field'), date_to and _('to') or '', date_to),
                    td(attr(cssc='history_dates_field'), log_req_link)
                )
                self.add(history_tr)
        else:
            self.add(div(attr(cssc='field_empty')))
Beispiel #13
0
    def make_content(self):
        self.content = []
        self.create_inner_details()

        if self.inner_details:
            # Header:
            thead_row = tr()
            for field in self.inner_details[0].fields.values():
                thead_row.add(th(field.label))
            thead_row.add(th(_('From')), th(_('To')), th(_('L.')))
            self.add(thead(thead_row))

            # rows (each row is made from one detail of object in object list
            self.add(tbody(tagid('tbody')))
            for i, detail in enumerate(self.inner_details):
                history_rec = self.value[i]
                date_from = history_rec._from #recoder.corba_to_datetime(history_rec._from)
                date_to = history_rec.to #recoder.corba_to_datetime(history_rec.to)
                logger_url = f_urls['logger'] + 'detail/?id=%s' % history_rec.requestId

                history_tr = tr()
                if i > 0:
                    history_tr.cssc = 'history_row'
                log_req_link = a(attr(href=logger_url), img(attr(src='/img/icons/open.png'))) if history_rec.requestId else ''
                history_tr.add(
                    detail,
                    td(attr(cssc='history_dates_field'), date_from),
                    td(attr(cssc='history_dates_field'), date_to),
                    td(attr(cssc='history_dates_field'), log_req_link)
                )
                self.add(history_tr)
        else:
            self.add(div(attr(cssc='field_empty')))
Beispiel #14
0
 def make_content(self):
     self.content = []
     oid = self._value
     if oid is not None:
         self.add(a(attr(href=f_urls[f_enum_name[oid.type]] + u'detail/?id=' + unicode(oid.id)),
                    oid.handle))
     else:
         self.add(div(attr(cssc='field_empty')))
Beispiel #15
0
 def add_to_bottom(self):
     ''' Usualy used for filterpanel and/or edit link. '''
     if self.editable:
         self.add(
             p(
                 a(
                     attr(href=u'../edit/?id=' +
                          unicode(self.data.get('id'))), _('Edit'))))
Beispiel #16
0
    def make_content(self):
        self.content = []

        if self.object_type_name is None: # this cannot be in constructor, becouse self.owner_detail is not known at construction time
            self.object_type_name = self.owner_detail.get_object_name()

        if self.value[self.handle_name] == '':
            self.add(div(attr(cssc='field_empty')))
        self.add(a(attr(href=f_urls[self.object_type_name] + 'detail/?id=%s' % self.value[self.id_name]), self.value[self.handle_name]))
Beispiel #17
0
 def make_content(self):
     self.content = []
     detail = utils.get_detail(recoder.u2c(self.object_type),
                               int(self.value))
     if self.error_msg:
         self.add(ErrorList([self.error_msg % detail.handle]))
     self.add(
         a(
             attr(href=f_urls[self.object_type] +
                  'detail/?id=%s' % self.value), (detail.handle)), br())
Beispiel #18
0
 def make_content(self):
     self.content = []
     if self.value:
         for i, oid in enumerate(self.value):
             if oid and oid.id:
                 if i != 0:
                     self.add(', ')
                 self.add(a(attr(href=f_urls[f_enum_name[oid.type]] + u'detail/?id=' + unicode(oid.id)),
 #                           strong(oid.handle)))
                            oid.handle))
Beispiel #19
0
 def make_content(self):
     self.content = []
     if not self._value:
         self.add(div(attr(cssc='field_empty')))
     else:
         self.add(
             a(
                 attr(href=(f_urls[f_enum_name[ccReg.FT_FILE]] +
                            u'detail/?id=' + unicode(self._value))),
                 self.handle))
Beispiel #20
0
 def make_content(self):
     self.content = []
     oid = self._value
     if oid is not None:
         self.add(
             a(
                 attr(href=f_urls[f_enum_name[oid.type]] + u'detail/?id=' +
                      unicode(oid.id)), oid.handle))
     else:
         self.add(div(attr(cssc='field_empty')))
Beispiel #21
0
 def make_content(self):
     self.content = []
     if not self._value:
         self.add(div(attr(cssc='field_empty')))
     else:
         self.add(a(attr(
             href=(
                 f_urls[f_enum_name[ ccReg.FT_FILE]] + u'detail/?id=' +
                 unicode(self._value))),
             self.handle))
Beispiel #22
0
 def index(self):
     context = DictLookup()
     context.main = ul(
         li(
             a(
                 attr(
                     href=
                     '''/file/filter/?json_data=[{%22presention|CreateTime%22:%22on%22,%22CreateTime/3%22:%2210%22,%22CreateTime/0/0%22:%22%22,%22CreateTime/0/1/0%22:%220%22,%22CreateTime/0/1/1%22:%220%22,%22CreateTime/1/0%22:%22%22,%22CreateTime/1/1/0%22:%220%22,%22CreateTime/1/1/1%22:%220%22,%22CreateTime/4%22:%22-2%22,%22CreateTime/2%22:%22%22,%22presention|Type%22:%22000%22,%22Type%22:%225%22}]'''
                 ), _('Domain expiration letters'))))
     return self._render('summary', ctx=context)
Beispiel #23
0
    def _render_col(self, col_num, col):
        if col.get('icon'):
            val = img(attr(src=col['icon']))
        else:
            val = col['value']

        if col.get('url'):
            val = a(attr(href=col['url']), val)

        return td(attr(cssc=col.get('cssc')), val)
Beispiel #24
0
    def __init__(self, context):
        super(ContactCheckDetail, self).__init__(context)
        c = self.context
        self.head.add(
            script(attr(type='text/javascript'),
                   'ajaxSourceURLOfChecks = "%s";' % c.ajax_json_filter_url,
                   'dontDisplayFilter = true;'))
        self.main.add(h1(_('Contact checks detail'), '-', c.test_suit_name))
        if c.contact_detail is None:
            self.main.add(h2(_('Contact was deleted')))
            verified_info = None
        else:
            if contact_has_state(c.contact_detail, 'validatedContact'):
                verified_info = _('Contact is validated')
            elif contact_has_state(c.contact_detail, 'identifiedContact'):
                verified_info = _('Contact is identified')
            else:
                verified_info = None

        self.main.add(
            table(
                attr(cssc='section_table'),
                tr(
                    td(attr(cssc='left_label'), _('Contact:'),
                       td(a(attr(href=c.contact_url),
                            c.check.contact_handle)))),
                tr(
                    td(attr(cssc='left_label'), _('Created: '),
                       td(c.check.created))),
                tr(
                    td(attr(cssc='left_label'), _('Verified status:'),
                       td(strong(attr(cssc='highlight_ok'), verified_info))))
                if verified_info else None))
        self.main.add(c.detail)
        if c.contact_detail:
            self.main.add(h2('Detail of contact:'))
            self.main.add(
                adifdetails.ContactDetail(c.contact_detail,
                                          c.history,
                                          is_nested=True))
        if cherrypy.session.get('history', False):
            self.main.add(h2(_('All checks of this contact:')))
            self.main.add(c.table_tag)

            self.main.add(h2(_('Contact checks messages:')))
            self.main.add(c.messages_list)

        lang_code = config.lang[:2]
        self.head.add(
            script(
                attr(type='text/javascript'),
                'scwLanguage = "%s"; //sets language of js_calendar' %
                lang_code,
                'scwDateOutputFormat = "%s"; // set output format for js_calendar'
                % config.js_calendar_date_format))
Beispiel #25
0
 def _format_tested_data(self, tested_data, test_handle):
     addition_to_data = []
     if test_handle in ('cz_address_existence', 'contactability',
                        'send_letter'):
         data_on_line = ' '.join(
             [item for item in (tested_data + [addition_to_data]) if item])
         addition_to_data.append(
             a(attr(href='http://www.google.com/#q=' + data_on_line),
               _('Search on Google')))
     return br().join(
         [item for item in (tested_data + addition_to_data) if item])
Beispiel #26
0
 def make_content(self):
     self.content = []
     if self.value:
         for i, ref in enumerate(self.value):
             if ref and ref.id:
                 if i != 0:
                     self.add(', ')
                 if f_req_object_type_name.get(ref.type): # only object displayable by daphne will be links, others plain text:
                     self.add(a(attr(href=f_urls[f_req_object_type_name[ref.type]] + u'detail/?id=' + unicode(ref.id)),
                                '%s:%s' % (ref.type, ref.id)))
                 else:
                     self.add('%s:%s' % (ref.type, ref.id))
Beispiel #27
0
 def make_content(self):
     self.content = []
     if self.value:
         for i, oid in enumerate(self.value):
             if oid and oid.id:
                 if i != 0:
                     self.add(', ')
                 self.add(
                     a(
                         attr(href=f_urls[f_enum_name[oid.type]] +
                              u'detail/?id=' + unicode(oid.id)),
                         #                           strong(oid.handle)))
                         oid.handle))
Beispiel #28
0
    def make_content(self):
        self.content = []

        if self.object_type_name is None:  # this cannot be in constructor, becouse self.owner_detail is not known at construction time
            self.object_type_name = self.owner_detail.get_object_name()

        if self.value[self.handle_name] == '':
            self.add(div(attr(cssc='field_empty')))
        self.add(
            a(
                attr(href=f_urls[self.object_type_name] +
                     'detail/?id=%s' % self.value[self.id_name]),
                self.value[self.handle_name]))
Beispiel #29
0
 def layout_start(self):
     section_name = self.section_spec[0]
     section_id = self.section_spec[1]
     link_id = "%s_display" % section_id
     if section_name:
         self.add(legend(section_name))
     self.add(div(
         attr(style="text-align: right; padding-right: 1em;"),
         a(
             "hide", 
             attr(href="JavaScript:void();"), 
             onclick="show_hide('%s', '%s');" % (section_id, link_id),
             id=link_id, 
             title="Click to show or hide the fieldset contents.")))
     self.add(table(
         tagid('table'), attr(cssc="form_table"), id=section_id))
Beispiel #30
0
 def make_content(self):
     self.content = []
     if self.value:
         for i, ref in enumerate(self.value):
             if ref and ref.id:
                 if i != 0:
                     self.add(', ')
                 if f_req_object_type_name.get(
                         ref.type
                 ):  # only object displayable by daphne will be links, others plain text:
                     self.add(
                         a(
                             attr(href=f_urls[f_req_object_type_name[
                                 ref.type]] + u'detail/?id=' +
                                  unicode(ref.id)),
                             '%s:%s' % (ref.type, ref.id)))
                 else:
                     self.add('%s:%s' % (ref.type, ref.id))
Beispiel #31
0
 def _add_row(i, j, detail):
     history_tr = tr()
     history_tr.cssc = ''
     if i > 0:
         history_tr.cssc += ' history_row'
     if detail:
         history_tr.add(detail)
     else:
         history_tr.add(td(attr(colspan=len(thead_row.content) - 3), div(attr(cssc='field_empty'))))
     if j == 0:
         history_tr.cssc += ' history_division_row'
         rowspan_attr = attr(rowspan=len(self.inner_details[i]) or 1, cssc='history_dates_field')
         log_req_link = a(attr(href=logger_url), img(src='/img/icons/open.png')) if history_rec.requestId else ''
         history_tr.add(
             td(rowspan_attr, date_from),
             td(rowspan_attr, date_to),
             td(rowspan_attr, log_req_link)
         )
     self.add(history_tr)
Beispiel #32
0
    def close(self, **kwd):
        '''Close and invalidate'''
        log_req = self._create_log_req_for_object_view('PublicRequestInvalidate', **kwd)
        try:
            cherrypy.session['Admin'].processPublicRequest(int(kwd['id']), True)
            log_req.result = 'Success'
        except ccReg.Admin.REQUEST_BLOCKED:
            log_req.result = 'Fail'
            raise CustomView(self._render(
                'error', {'message': [
                    _(u'Request cannot be accepted.'
                    u'You can return back to '), a(attr(
                        href=f_urls[self.classname] + 'detail/?id=%s' % kwd['id']),
                        _('public request.'))
            ]}))
        finally:
            log_req.close()

        raise cherrypy.HTTPRedirect(f_urls[self.classname] + 'filter/?reload=1&load=1')
Beispiel #33
0
    def _render_col(self, col_num, col):
        if col.get('icon'):
            val = img(attr(src=col['icon']))
        else:
            val = col['value']

        if col.get('url'):
            val = a(attr(href=col['url']), val)

        if col_num == 0:
            val = span(
                input(
                    attr(
                        type='checkbox',
                        name='object_selection',
                        value=col.get('value'),
                        cssc='object_selection',
                    ), val))

        return td(attr(cssc=col.get('cssc')), val)
Beispiel #34
0
 def _add_row(i, j, detail):
     history_tr = tr()
     history_tr.cssc = ''
     if i > 0:
         history_tr.cssc += ' history_row'
     if detail:
         history_tr.add(detail)
     else:
         history_tr.add(
             td(attr(colspan=len(thead_row.content) - 3),
                div(attr(cssc='field_empty'))))
     if j == 0:
         history_tr.cssc += ' history_division_row'
         rowspan_attr = attr(rowspan=len(self.inner_details[i]) or 1,
                             cssc='history_dates_field')
         log_req_link = a(attr(
             href=logger_url), img(src='/img/icons/open.png')
                          ) if history_rec.requestId else ''
         history_tr.add(td(rowspan_attr, date_from),
                        td(rowspan_attr, date_to),
                        td(rowspan_attr, log_req_link))
     self.add(history_tr)
Beispiel #35
0
 def __init__(self, context = None):
     super(DisconnectedPage, self).__init__(context)
     self.main.add(p(_('Server disconnected, please '), 
                     a(attr(href='/login/?next=%s' % get_current_url()), 
                       _('log in')), ' again.'))
Beispiel #36
0
 def index(self):
     context = DictLookup()
     context.main = ul(li(a(attr(href='''/file/filter/?json_data=[{%22presention|CreateTime%22:%22on%22,%22CreateTime/3%22:%2210%22,%22CreateTime/0/0%22:%22%22,%22CreateTime/0/1/0%22:%220%22,%22CreateTime/0/1/1%22:%220%22,%22CreateTime/1/0%22:%22%22,%22CreateTime/1/1/0%22:%220%22,%22CreateTime/1/1/1%22:%220%22,%22CreateTime/4%22:%22-2%22,%22CreateTime/2%22:%22%22,%22presention|Type%22:%22000%22,%22Type%22:%225%22}]'''), _('Domain expiration letters'))))
     context.main.add(li(a(attr(href='/domain/import_notif_emails/'),
                           _('Import emails for out-of-zone notification'))))
     return self._render('summary', ctx=context)
Beispiel #37
0
 def index(self):
     context = DictLookup()
     context.main = ul(li(a(attr(href='''/file/filter/?json_data=[{%22presention|CreateTime%22:%22on%22,%22CreateTime/3%22:%2210%22,%22CreateTime/0/0%22:%22%22,%22CreateTime/0/1/0%22:%220%22,%22CreateTime/0/1/1%22:%220%22,%22CreateTime/1/0%22:%22%22,%22CreateTime/1/1/0%22:%220%22,%22CreateTime/1/1/1%22:%220%22,%22CreateTime/4%22:%22-2%22,%22CreateTime/2%22:%22%22,%22presention|Type%22:%22000%22,%22Type%22:%225%22}]'''), _('Domain expiration letters'))))
     return self._render('summary', ctx=context)
Beispiel #38
0
    def __init__(self, context = None):
        super(FilterPage, self).__init__(context)
        c = self.context
        
        lang_code = config.lang[0:2]
        if lang_code == 'cs': # conversion between cs and cz identifier of lagnguage
            lang_code = 'cz'
        self.head.add(script(attr(type='text/javascript'), 
                             'scwLanguage = "%s"; //sets language of js_calendar' % lang_code,
                             'scwDateOutputFormat = "%s"; // set output format for js_calendar' % config.js_calendar_date_format))
                     
        if context.get('form') and (config.debug or not c.get('itertable') or c.get('show_form')):
            self.main.add(c.form)
            self.main.add(script(attr(type='text/javascript'), 'Ext.onReady(function () {addFieldsButtons()})'))
        else:
            self.main.add(a(attr(href=append_getpar_to_url(add_par_dict={'load': 1, 'show_form': 1})), _('Modify filter'))) 
        
        if c.get('result'):
            self.main.add(p(c['result']))
        
        if c.get('itertable'):
            itertable = c.itertable
            self.main.add(WIterTable(itertable))
            self.main.add(p(_('Table_as'), a(attr(href='?txt=1'), 'TXT'), ',', a(attr(href='?csv=1'), 'CSV')))
            
            if config.debug:
                self.main.add(br(), br())
                header = tr(attr(cssc="header"))
                for htext in itertable.header:
                    header.add(td(htext))
                
                rows = [header]
                for irow in itertable:
                    row = tr()
                    for col in irow:
                        if col.get('icon'):
                            val = img(attr(src=col['icon']))
                        else:
                            val = col['value']
                        
                        if col.get('url'):
                            val = a(attr(href=col['url']), val)
                        
                        row.add(td(attr(cssc=col.get('cssc')), val))
                    rows.append(row)


                self.main.add(table(attr(id='objectlist', media_files='/css/objectlist.css'), rows))
                
                # Numbers of entries 
                if itertable.num_rows_over_limit:
                    num_rows = span(attr(cssc='warning'), itertable.num_rows)
                else:
                    num_rows = itertable.num_rows
                pageflip = span(
                    '%s: %s,' % (_('Number_of_pages'), itertable.last_page),
                    '%s: ' % _('entries'), num_rows, ',', 
                    br())
                
                # Pager
                if itertable.num_pages > 1:
                    pageflip.add(div(
                        a(attr(cssc='pager-button', href='?page=%s' % itertable.first_page), noesc('«')),
                        a(attr(cssc='pager-button', href='?page=%s' % itertable.prev_page), noesc('‹')),
                        form(attr(style='display: inline;', method='GET'), input(attr(type='text', size='2', name='page', value=itertable.current_page))),
                        a(attr(cssc='pager-button', href='?page=%s' % itertable.next_page), noesc('›')),
                        a(attr(cssc='pager-button', href='?page=%s' % itertable.last_page), noesc('»'))
                    ))
                self.main.add(pageflip)
        if c.get("display_jump_links"):
            # Display the 'previous' and 'next' links (they auto-submit 
            # the form to display results for the prev./next time interval).
            jump_links_info = c.get("display_jump_links")
            self.main.add(div(a(
                attr(
                    title="Jumps to the previous time period.",
                    href=(jump_links_info['url'] + 
                        'filter/?jump_prev=1&field_name=%s' %
                        jump_links_info['field_name'])),
                "prev"), 
                a(attr(
                    title="Jumps to the next time period.",
                    href=(jump_links_info['url'] + 
                        'filter/?jump_next=1&field_name=%s' %
                        jump_links_info['field_name'])),
                    "next")))
Beispiel #39
0
 def add_to_bottom(self):
     ''' Usualy used for filterpanel and/or edit link. '''
     if self.editable:
         self.add(p(a(attr(href=u'../edit/?id=' + unicode(self.data.get('id'))), _('Edit'))))
Beispiel #40
0
    def __init__(self, itertable, *content, **kwd):
        super(WIterTable, self).__init__(*content, **kwd)
        self.media_files = [
            '/js/logging.js',
            '/js/itertable.js',
            '/css/itertable.css',
        ]

        self.tag = 'table'
        self.cssc = 'itertable'
        self.column_count = len(itertable.header)

        sort_col_num, sort_direction = itertable.get_sort()

        header = tr(attr(cssc="wi_header"))

        for i, htext in enumerate(itertable.header):
            col_num = i - 1
            if col_num == -1:  # first column is ID
                header.add(th(attr(id='id_column_header_cell'), htext))
            else:
                sort_dir = 1
                if col_num == sort_col_num and sort_direction:  # rendering column, according which is table sorted, so reverse direction for next click on this column
                    sort_dir = 0
                th_cell = th(
                    a(
                        attr(href=append_getpar_to_url(
                            add_par_dict={
                                'sort_col': col_num,
                                'sort_dir': sort_dir
                            },
                            del_par_list=['load', 'show_form'])), htext))
                if col_num == sort_col_num:
                    th_cell.cssc = 'sorted ' + ['descending', 'ascending'
                                                ][sort_direction]
                header.add(th_cell)
        self.add(thead(header))

        rows = []
        for row_num, irow in enumerate(itertable):
            row = tr(attr(cssc='row%s' % ((row_num % 2) + 1)))
            for col_num, col in enumerate(irow):
                row.add(self._render_col(col_num, col))
            rows.append(row)
        self.add(tbody(rows))

        # Pager
        pager = span()

        # Numbers of entries
        if itertable.num_rows_over_limit:
            num_rows = span(attr(cssc='warning'), itertable.num_rows)
        else:
            num_rows = itertable.num_rows

        if itertable.pagination:
            result_text = 'Displaying results %s - %s of %s' % (
                itertable.page_start,
                itertable.page_start + itertable.page_rows, num_rows)
        else:
            result_text = 'Displaying %s results' % (num_rows)
        pager.add(span(attr(cssc='pager_text'), noesc(result_text)))

        if itertable.pagination:
            if itertable.num_pages > 1:
                if itertable.current_page == 1:
                    first_button = span(
                        attr(cssc='pager-button'),
                        img(
                            attr(
                                src=
                                '/css/ext/images/default/grid/page-first-disabled.gif'
                            )))
                    prev_button = span(
                        attr(cssc='pager-button'),
                        img(
                            attr(
                                src=
                                '/css/ext/images/default/grid/page-prev-disabled.gif'
                            ))),
                else:
                    first_button = a(
                        attr(cssc='pager-button',
                             href='?page=%s' % itertable.first_page),
                        img(
                            attr(
                                src='/css/ext/images/default/grid/page-first.gif'
                            ))),
                    prev_button = a(
                        attr(cssc='pager-button',
                             href='?page=%s' % itertable.prev_page),
                        img(
                            attr(
                                src='/css/ext/images/default/grid/page-prev.gif'
                            ))),
                if itertable.current_page == itertable.last_page:
                    next_button = span(
                        attr(cssc='pager-button'),
                        img(
                            attr(
                                src=
                                '/css/ext/images/default/grid/page-next-disabled.gif'
                            ))),
                    last_button = span(
                        attr(cssc='pager-button'),
                        img(
                            attr(
                                src=
                                '/css/ext/images/default/grid/page-last-disabled.gif'
                            )))
                else:
                    next_button = a(
                        attr(cssc='pager-button',
                             href='?page=%s' % itertable.next_page),
                        img(
                            attr(
                                src='/css/ext/images/default/grid/page-next.gif'
                            ))),
                    last_button = a(
                        attr(cssc='pager-button',
                             href='?page=%s' % itertable.last_page),
                        img(
                            attr(
                                src='/css/ext/images/default/grid/page-last.gif'
                            )))

                pager.add(
                    first_button, prev_button,
                    form(
                        attr(style='display: inline;', method='GET'),
                        input(
                            attr(type='text',
                                 size='2',
                                 name='page',
                                 value=itertable.current_page)),
                        ' of %d ' % itertable.last_page), next_button,
                    last_button)
        self.add(tfoot(tr(td(attr(colspan=self.column_count), pager))))
Beispiel #41
0
 def make_content(self):
     self.content = []
     if self._value == '' or isinstance(self._value, fredtypes.Null):
         self.add(div(attr(cssc='field_empty')))
     if self._value:
         self.add(a(attr(href='mailto:' + self._value), self._value))
Beispiel #42
0
 def make_content(self):
     self.content = []
     if self._value == '' or isinstance(self._value, fredtypes.Null):
         self.add(div(attr(cssc='field_empty')))
     if self._value:
         self.add(a(attr(href='mailto:' + self._value), self._value))
Beispiel #43
0
    def __init__(self, itertable, *content, **kwd):
        super(WIterTable, self).__init__(*content, **kwd)
        self.media_files = ['/js/logging.js', 
                            '/css/itertable.css',
                           ]
        
        self.tag = 'table'
        self.cssc = 'itertable'
        self.column_count = len(itertable.header)
        
        sort_col_num, sort_direction = itertable.get_sort()
        
        header = tr(attr(cssc="wi_header"))

        for i, htext in enumerate(itertable.header):
            col_num = i - 1
            if col_num == -1: # first column is ID
                header.add(th(htext))
            else:
                sort_dir = 1
                if col_num == sort_col_num and sort_direction: # rendering column, according which is table sorted, so reverse direction for next click on this column 
                    sort_dir = 0
                th_cell = th(a(attr(href=append_getpar_to_url(add_par_dict={'sort_col': col_num, 'sort_dir': sort_dir}, del_par_list=['load', 'show_form'])), htext))
                if col_num == sort_col_num:
                    th_cell.cssc = 'sorted ' + ['ascending', 'descending'][sort_direction]
                header.add(th_cell)
        self.add(thead(header))
        
        rows = []
        for row_num, irow in enumerate(itertable):
            row = tr(attr(cssc='row%s' % ((row_num % 2) + 1)))
            for col in irow:
                if col.get('icon'):
                    val = img(attr(src=col['icon']))
                else:
                    val = col['value']
                
                if col.get('url'):
                    val = a(attr(href=col['url']), val)
                
                row.add(td(attr(cssc=col.get('cssc')), val))
            rows.append(row)
        self.add(tbody(rows))
        
        
        # Pager
        pager = span()

        # Numbers of entries 
        #if itertable.total_rows > itertable.num_rows:
        if itertable.num_rows_over_limit:
            num_rows = span(attr(cssc='warning'), itertable.num_rows)
        else:
            num_rows = itertable.num_rows
        
        pager.add(span(attr(cssc='pager_text'),
            noesc('Displaying results %s - %s of %s' % (itertable.page_start, itertable.page_start + itertable.page_rows, num_rows))
#            '%s: %s,' % (_('Number_of_pages'), itertable.last_page),
#            '%s: ' % _('entries'), num_rows, ',', 
#            '%s: %s' % (_('total'), itertable.total_rows),
#            #br()
        ))
        
        if itertable.num_pages > 1:
#            pager.add(
#                a(attr(cssc='pager-button', href='?page=%s' % itertable.first_page), noesc('«')),
#                a(attr(cssc='pager-button', href='?page=%s' % itertable.prev_page), noesc('‹')),
##                    a(attr(cssc='pager-button', href='?page=%s' % itertable._number), itertable._number),
#                form(attr(style='display: inline;', method='GET'), input(attr(type='text', size='2', name='page', value=itertable.current_page))),
#                a(attr(cssc='pager-button', href='?page=%s' % itertable.next_page), noesc('›')),
#                a(attr(cssc='pager-button', href='?page=%s' % itertable.last_page), noesc('»'))
#            )
            if itertable.current_page == 1:
                first_button = span(attr(cssc='pager-button'), img(attr(src='/css/ext/images/default/grid/page-first-disabled.gif')))
                prev_button = span(attr(cssc='pager-button'), img(attr(src='/css/ext/images/default/grid/page-prev-disabled.gif'))), 
            else:
                first_button = a(attr(cssc='pager-button', href='?page=%s' % itertable.first_page), img(attr(src='/css/ext/images/default/grid/page-first.gif'))),
                prev_button = a(attr(cssc='pager-button', href='?page=%s' % itertable.prev_page), img(attr(src='/css/ext/images/default/grid/page-prev.gif'))),
            if itertable.current_page == itertable.last_page:
                next_button = span(attr(cssc='pager-button'), img(attr(src='/css/ext/images/default/grid/page-next-disabled.gif'))),
                last_button = span(attr(cssc='pager-button'), img(attr(src='/css/ext/images/default/grid/page-last-disabled.gif'))) 
            else:
                next_button = a(attr(cssc='pager-button', href='?page=%s' % itertable.next_page), img(attr(src='/css/ext/images/default/grid/page-next.gif'))),
                last_button = a(attr(cssc='pager-button', href='?page=%s' % itertable.last_page), img(attr(src='/css/ext/images/default/grid/page-last.gif'))) 
                
            pager.add(
                first_button,
                prev_button,
#                    a(attr(cssc='pager-button', href='?page=%s' % itertable._number), itertable._number),
                form(attr(style='display: inline;', method='GET'), input(attr(type='text', size='2', name='page', value=itertable.current_page)), ' of %d ' % itertable.last_page),
                next_button,
                last_button
            )
        self.add(tfoot(tr(td(attr(colspan=self.column_count), pager))))
        
Beispiel #44
0
    def __init__(self, context=None):
        super(FilterPage, self).__init__(context)
        c = self.context

        lang_code = config.lang[0:2]
        if lang_code == 'cs':  # conversion between cs and cz identifier of lagnguage
            lang_code = 'cz'
        self.head.add(
            script(
                attr(type='text/javascript'),
                'scwLanguage = "%s"; //sets language of js_calendar' %
                lang_code,
                'scwDateOutputFormat = "%s"; // set output format for js_calendar'
                % config.js_calendar_date_format))

        if context.get('form') and (config.debug or not c.get('itertable')
                                    or c.get('show_form')):
            self.main.add(c.form)
            self.main.add(
                script(attr(type='text/javascript'),
                       'Ext.onReady(function () {addFieldsButtons()})'))
        else:
            self.main.add(
                a(
                    attr(href=append_getpar_to_url(add_par_dict={
                        'load': 1,
                        'show_form': 1
                    })), _('Modify filter')))

        if c.get('result'):
            self.main.add(p(c['result']))

        if c.get('witertable'):
            if c.get('blocking_mode'):
                self.main.add(
                    h1(attr(id='blocking_text'), _('Administrative blocking')))
            self.main.add(c.witertable)
            if not c.get('blocking_mode'):
                self.main.add(
                    p(tagid('exports'), _('Table_as'),
                      a(attr(href='?txt=1'), 'TXT'), ',',
                      a(attr(href='?csv=1'), 'CSV')))

        if c.get("display_jump_links"):
            # Display the 'previous' and 'next' links (they auto-submit
            # the form to display results for the prev./next time interval).
            jump_links_info = c.get("display_jump_links")
            self.main.add(
                div(
                    a(
                        attr(title="Jumps to the previous time period.",
                             href=(jump_links_info['url'] +
                                   'filter/?jump_prev=1&field_name=%s' %
                                   jump_links_info['field_name'])), "prev"),
                    a(
                        attr(title="Jumps to the next time period.",
                             href=(jump_links_info['url'] +
                                   'filter/?jump_next=1&field_name=%s' %
                                   jump_links_info['field_name'])), "next")))

        if c.get('blocking_possible') and not c.get('blocking_mode'):
            self.main.add(
                p(
                    a(attr(href='./blocking_start/'),
                      _('Administrative blocking'))))