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))
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)
def __init__(self, context = None): super(MessageDetail, self).__init__(context) c = self.context if c.get('result'): self.main.add(h1(_('Detail_of_%s' % self.get_object_name()))) self.main.add(adifdetails.MessageDetail(c.result, c.history)) if config.debug: self.main.add('MessageDETAIL:', pre(unicode(c.result).replace(u', ', u',\n')))
def __init__(self, context = None): super(BankStatementDetailWithPaymentPairing, self).__init__(context) c = self.context if c.get('detail'): self.main.add(h1(_('Detail of payment'))) self.main.add(adifdetails.BankStatementDetail(c.detail, c.history)) if c.get('form'): self.main.add(c.form)
def __init__(self, context = None): super(BankStatementDetail, self).__init__(context) c = self.context if c.get('detail'): self.main.add(h1(_("Detail of payment"))) self.main.add(adifdetails.BankStatementDetail(c.detail, c.history)) if config.debug: self.main.add('BankStatementDETAIL:', pre(unicode(c.detail).replace(u', ', u',\n')))
def __init__(self, context = None): super(MailDetail, self).__init__(context) c = self.context if c.get('result'): self.main.add(h1(_('Detail_of_%s' % self.get_object_name()))) self.main.add(adifdetails.MailDetail(c.result, c.history)) if config.debug: self.main.add('MailDETAIL:', div(attr(style='width: 1024px; overflow: auto;'), pre(unicode(c.result).replace(u', ', u',\n'))))
def __init__(self, context): super(FormPage, self).__init__(context) c = self.context self.main.add( h1(c['heading']) if 'heading' in c else None, p(c['before_form']) if 'before_form' in c else None, c['form'] if 'form' in c else None, p(c['after_form']) if 'after_form' in c else None)
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))
def __init__(self, context): super(DomainBlocking, self).__init__(context) c = self.context self.main.add(h1(c['heading'])) if c.get('form'): self.main.add(c['form']) lang_code = config.lang[: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))
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]
def __init__(self, context): super(ContactCheckList, self).__init__(context) c = self.context self.head.add( script(attr(type='text/javascript'), 'ajaxSourceURLOfChecks = "%s";' % c.ajax_json_filter_url)) if 'default_js_type_filter' in c: self.head.add( script(attr(type='text/javascript'), 'defaultTypeFilter = "%s";' % c.default_js_type_filter)) self.main.add(h1(c.heading)) self.main.add(c.table_tag) lang_code = config.lang[: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))
def _get_list(self, context, cleaned_filters=None, in_log_props=None, **kwd): log_req = create_log_request(f_name_actionfiltername[self.__class__.__name__.lower()], properties=in_log_props) try: out_props = [] table = self._get_itertable() show_result = True try: page = int(kwd.get('page', 1)) except (ValueError, TypeError): page = 1 try: sort_col = kwd.get('sort_col') if sort_col is not None: sort_col = int(kwd.get('sort_col')) except (ValueError, TypeError): sort_col = 1 try: sort_dir = bool(int(kwd.get('sort_dir', 1))) except (ValueError, TypeError): sort_dir = True if cleaned_filters is not None: table.set_filter(cleaned_filters) if kwd.get('save_input'): # save filter props = (('name', kwd['save_input']), ('type', f_name_actionfiltername[self.__class__.__name__.lower()])) save_log_req = create_log_request('SaveFilter', properties = props) try: table.save_filter(kwd['save_input']) save_log_req.result = 'Success' finally: save_log_req.close() context['main'].add(_('Filter saved as "%s"') % kwd['save_input']) show_result = False else: # normal setting filter table.reload() if kwd.get('filter_id'): # load filter # Do not log filter load (Jara's decision - it would just clutter # the log output). table.load_filter(int(kwd.get('filter_id'))) if kwd.get('show_form') or not table.all_fields_filled(): show_result = False filter_data = table.get_filter_data() form_class = self._get_filterform_class() context['form'] = UnionFilterForm( filter_data, data_cleaned=True, form_class=form_class) else: table.reload() if kwd.get('cf'): table.clear_filter() if kwd.get('reload'): table.reload() if kwd.get('load'): # load current filter from backend cleaned_filter_data = table.get_filter_data() form_class = self._get_filterform_class() form = UnionFilterForm( cleaned_filter_data, form_class=form_class, data_cleaned=True) context['form'] = form context['show_form'] = kwd.get('show_form') if config.debug: context['main'].add( 'kwd_json_data_loaded:', cleaned_filter_data) if kwd.get('list_all'): table.clear_filter() table._table.add() table.reload() if sort_col is not None: table.set_sort(sort_col, sort_dir) log_req.result = 'Success' if show_result: out_props.append(('result_size', table.num_rows)) if table.num_rows == 0: context['result'] = _("No_entries_found") if table.num_rows == 1: rowId = table.get_row_id(0) raise (cherrypy.HTTPRedirect(f_urls[self.classname] + 'detail/?id=%s' % rowId)) if kwd.get('txt', None): cherrypy.response.headers["Content-Type"] = "text/plain" cherrypy.response.headers["Content-Disposition"] = \ "inline; filename=%s_%s.txt" % (self.classname, time.strftime('%Y-%m-%d')) return fileGenerator(table) elif kwd.get('csv', None): cherrypy.response.headers["Content-Type"] = "text/plain" cherrypy.response.headers["Content-Disposition"] = \ "attachement; filename=%s_%s.csv" % ( self.classname, time.strftime('%Y-%m-%d')) return fileGenerator(table) table.set_page(page) context['itertable'] = table except ccReg.Filters.SqlQueryTimeout, e: context['main'].add(h1(_('Timeout')), p(_('Database timeout, please try to be more specific about requested data.')))
def __init__(self, context = None): super(NotFound404Page, self).__init__(context) self.main.add(h1(_('Not found (404)')), p(_('Page not found')) )
def __init__(self, context = None): super(ErrorPage, self).__init__(context) c = self.context self.main.add(h1('Error:')) if c.has_key('message'): self.main.add(p(c.message))
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'))))