def _getBody( self, params ): wc = WTemplated('LaTeXError') conf = self._error.params['conf'] return wc.getHTML({ 'report_id': self._error.report_id, 'is_manager': conf.as_event.can_manage(session.user), 'log': open(self._error.log_file, 'r').read(), 'source_code': open(self._error.source_file, 'r').read() })
def _getBody(self, params): params['calendar'] = RoomBookingCalendarWidget( params['occurrences'], params['start_dt'], params['end_dt'], rooms=params['rooms']).render() return WTemplated('RoomBookingCalendar').getHTML(params)
def getVars(self): wvars = WTemplated.getVars(self) wvars['standalone'] = self._standalone room = wvars['room'] wvars['attrs'] = { attr.attribute.name: attr for attr in room.attributes if not attr.attribute.is_hidden or rb_is_admin(session.user) } wvars['owner_name'] = room.owner.full_name wvars['bookable_hours'] = room.bookable_hours.all() wvars['nonbookable_periods'] = room.nonbookable_periods.all() # URLs wvars['stats_url'] = url_for('rooms.roomBooking-roomStats', room) wvars['delete_room_url'] = url_for('rooms_admin.delete_room', room) wvars['modify_room_url'] = url_for('rooms_admin.modify_room', room) if not self._standalone: wvars['conference'] = self._rh._conf wvars['show_on_map'] = room.map_url if room.map_url else url_for( 'rooms.roomBooking-mapOfRooms', room) return wvars
def _getBody(self, params): params['startDT'] = datetime.combine(date.today(), Location.working_time_start) params['endDT'] = datetime.combine(date.today(), Location.working_time_end) params['startT'] = params['startDT'].strftime('%H:%M') params['endT'] = params['endDT'].strftime('%H:%M') return WTemplated('RoomBookingSearchRooms').getHTML(params)
def _getPageContent(self, params): reservation = params['reservation'] params['endpoints'] = self.endpoints params['assistance_emails'] = rb_settings.get('assistance_emails') params['repetition'] = RepeatMapping.get_message(*reservation.repetition) params['edit_logs'] = reservation.edit_logs.order_by(ReservationEditLog.timestamp.desc()).all() params['excluded_days'] = reservation.find_excluded_days().all() return WTemplated('RoomBookingDetails').getHTML(params)
def _getPageContent(self, params): calendar = RoomBookingCalendarWidget(params['occurrences'], params['start_dt'], params['end_dt'], candidates=params['candidates'], rooms=params['rooms'], repeat_frequency=params['repeat_frequency'], repeat_interval=params['repeat_interval'], flexible_days=params['flexible_days']) params['calendar'] = calendar.render(show_summary=False, can_navigate=False, details_in_new_tab=True) return WTemplated('RoomBookingNewBookingSelectPeriod').getHTML(params)
def _getBody(self, params): params['period_options'] = [('pastmonth', _('Last 30 days')), (params['last_month'], _('Previous month')), ('thisyear', _('This year')), (params['last_year'], _('Previous year')), ('sinceever', _('Since ever'))] return WTemplated('RoomBookingRoomStats').getHTML(params)
def _getBody(self, params): cache_key = str(sorted(dict(request.args, lang=session.lang).items())) html = self.cache.get(cache_key) if html is None: params.update(self._get_widget_params()) html = WTemplated('RoomBookingMapOfRoomsWidget').getHTML(params) self.cache.set(cache_key, html, 3600) return html
def contextHelp(helpId): """ Allows you to put [?], the context help marker. Help content is defined in <div id="helpId"></div>. """ from indico.legacy.webinterface.wcomponents import WTemplated params = {"helpId" : helpId, "imgSrc" : Config.getInstance().getSystemIconURL("help")} return WTemplated('ContextHelp').getHTML(params)
def inlineContextHelp(helpContent): """ Allows you to put [?], the context help marker. Help content passed as argument helpContent. """ from indico.legacy.webinterface.wcomponents import WTemplated params = {"helpContent": helpContent, "imgSrc": '{}/help.png'.format(config.IMAGES_BASE_URL)} return WTemplated('InlineContextHelp').getHTML(params)
def contextHelp(helpId): """ Allows you to put [?], the context help marker. Help content is defined in <div id="helpId"></div>. """ from indico.legacy.webinterface.wcomponents import WTemplated params = {"helpId": helpId, "imgSrc": '{}/help.png'.format(config.IMAGES_BASE_URL)} return WTemplated('ContextHelp').getHTML(params)
def getVars( self ): from indico.modules.events.legacy import LegacyConference vars = WTemplated.getVars( self ) vars["area"]= _("Authorisation") vars["msg"] = _("The access to this page has been restricted by its owner and you are not authorised to view it") vars["contactInfo"] = "" if isinstance(self._rh._target, LegacyConference): vars["contactInfo"] = self._rh._target.as_event.no_access_contact return vars
def inlineContextHelp(helpContent): """ Allows you to put [?], the context help marker. Help content passed as argument helpContent. """ from indico.legacy.webinterface.wcomponents import WTemplated params = {"helpContent" : helpContent, "imgSrc" : Config.getInstance().getSystemIconURL("help")} return WTemplated('InlineContextHelp').getHTML(params)
def _getPageContent(self, params): params['endpoints'] = self.endpoints calendar = RoomBookingCalendarWidget(params['occurrences'], params['start_dt'], params['end_dt'], candidates=params['candidates'], specific_room=params['room'], repeat_frequency=params['repeat_frequency'], repeat_interval=params['repeat_interval']) params['calendar'] = calendar.render(show_navbar=False, details_in_new_tab=True) params['serializable_room'] = Room.get(params['room'].id).to_serializable('__public_exhaustive__') params['booking_limit'] = rb_settings.get('booking_limit') return WTemplated('RoomBookingBookingForm').getHTML(params)
def _getBody(self, params): api_key = rb_settings.get('google_maps_api_key') cache_key = str(sorted(dict(request.args, lang=session.lang).items())) + str(crc32(api_key)) html = self.cache.get(cache_key) if html is None: params.update(self._get_widget_params()) params['api_key'] = api_key html = WTemplated('RoomBookingMapOfRoomsWidget').getHTML(params) self.cache.set(cache_key, html, 3600) return html
def _getBody(self, params): params['summary'] = self._get_criteria_summary(params) calendar = RoomBookingCalendarWidget( params['occurrences'], params['start_dt'], params['end_dt'], rooms=params['rooms'], show_blockings=params['show_blockings']) params['calendar'] = calendar.render(form_data=params['form_data']) return WTemplated('RoomBookingSearchBookingsResults').getHTML(params)
def getVars(self): wvars = WTemplated.getVars(self) wvars['standalone'] = self._standalone room = wvars['room'] wvars['attrs'] = {attr.attribute.name: attr for attr in room.attributes if not attr.attribute.is_hidden or rb_is_admin(session.user)} wvars['owner_name'] = room.owner.full_name wvars['bookable_hours'] = room.bookable_hours.all() wvars['nonbookable_periods'] = room.nonbookable_periods.all() # URLs wvars['stats_url'] = url_for('rooms.roomBooking-roomStats', room) wvars['delete_room_url'] = url_for('rooms_admin.delete_room', room) wvars['modify_room_url'] = url_for('rooms_admin.modify_room', room) wvars['show_on_map'] = room.map_url if room.map_url else url_for('rooms.roomBooking-mapOfRooms', room) return wvars
def render(self, show_empty_rooms=True, show_empty_days=True, form_data=None, show_summary=True, show_navbar=True, can_navigate=True, details_in_new_tab=False): bars = self.build_bars_data(show_empty_rooms, show_empty_days) days = self.build_days_attrs() if self.specific_room and bars else {} period = self.end_dt.date() - self.start_dt.date() + timedelta(days=1) return WTemplated('RoomBookingCalendarWidget').getHTML({ 'form_data': form_data, 'bars': bars, 'days': days, 'start_dt': self.start_dt, 'end_dt': self.end_dt, 'period_name': _('day') if period.days == 1 else _('period'), 'specific_room': bool(self.specific_room), 'show_summary': show_summary, 'show_navbar': show_navbar, 'can_navigate': show_navbar and can_navigate, 'details_in_new_tab': details_in_new_tab, 'repeat_frequency': self.repeat_frequency, 'flexible_days': self.flexible_days })
def _get_legacy_content(self, params): params['field_opts'] = { 'assistance_emails': { 'rows': 3, 'cols': 40 }, 'notification_hour': { 'size': 2 }, 'notification_before_days': { 'size': 2 }, 'vc_support_emails': { 'rows': 3, 'cols': 40 }, 'booking_limit': { 'size': 3 }, } return WTemplated('RoomBookingSettings').getHTML(params)
def getVars(self): vars = WTemplated.getVars(self) vars["msg"] = self._msg return vars
def _getTabContent(self, params): return WTemplated('RoomBookingEventChooseEvent').getHTML(params)
def getVars(self): wvars = WTemplated.getVars(self) wvars['mapOfRoomsWidgetURL'] = url_for( 'rooms.roomBooking-mapOfRoomsWidget', **self._params) return wvars
def __init__(self, **params): WTemplated.__init__(self) self._params = params if params else {}
def getVars(self): vars = WTemplated.getVars(self) vars["postURL"] = quoteattr(url_for('misc.errors')) vars["dstEmail"] = quoteattr(self._dstMail) vars["reportMsg"] = quoteattr(self._msg) return vars
def _getBody(self, params): params['serializable_rooms'] = _get_serializable_rooms( [r.id for r in params['rooms']]) params['booking_limit'] = rb_settings.get('booking_limit') return WTemplated('RoomBookingNewBookingSelectRoom').getHTML(params)
def getVars(self): vars = WTemplated.getVars(self) vars["supportEmail"] = Config.getInstance().getPublicSupportEmail() return vars
def getVars(self): vars = WTemplated.getVars(self) vars["supportEmail"] = config.PUBLIC_SUPPORT_EMAIL return vars
def _getBody(self, params): params['endpoints'] = self.endpoints return WTemplated('RoomBookingNewBookingConfirm').getHTML(params)
def getVars(self): vars = WTemplated.getVars(self) vars["goBack"] = self._goBack return vars
def _getBody(self, params): return WTemplated('RoomBookingSearchBookings').getHTML(params)
def getVars(self): vars = WTemplated.getVars(self) ex = sys.exc_info()[1] vars["msg"] = self.htmlText(str(ex)) vars["area"] = "" ty, ex, tb = sys.exc_info() tracebackList = traceback.format_list(traceback.extract_tb(tb)) rh = self._rh.__class__ url = request.url.encode('utf-8') params = [] for k, v in request.values.iteritems(): if k.strip() != "password": params.append("""%s = %s""" % (self.htmlText(k), self.htmlText(v))) headers = [] for k, v in request.headers.iteritems(): headers.append("""%s: %s""" % (self.htmlText(k), self.htmlText(v))) userHTML = """-- none --""" vars["userEmail"] = "" try: user = session.user user_name = user and user.full_name user_email = user and user.email user_is_admin = user and user.is_admin except Exception: # Yuck! But we are handling an error and we don't know if we # can access the user or its attributes... user_is_admin = False else: if user: userHTML = self.htmlText(u'{} <{}>'.format( user_name, user_email).encode('utf-8')) vars["userEmail"] = quoteattr(user_email.encode('utf-8')) vars["reportURL"] = quoteattr(url_for('misc.errors')) details = "" if config.DEBUG or user_is_admin: details = """ <table class="errorDetailsBox"> <tr> <td>ERROR DETAILS</td> </tr> <tr> <td><br></td> </tr> <tr> <td nowrap align="right"><b>Exception type:</b></td> <td>%s</td> </tr> <tr> <td nowrap align="right" valign="top"><b>Exception message:</b></td> <td>%s</td> </tr> """ % (self.htmlText(str(ty)), self.htmlText(str(ex))) if hasattr(ex, 'problematic_templates') and hasattr( ex, 'template_tracebacks'): for i in range(len(ex.problematic_templates)): details += """ <tr> <td nowrap align="right" valign="top"><b>Traceback for<br>%s.tpl:</b></td> <td>%s</td> </tr> """ % (ex.problematic_templates[i], "<br>".join( ex.template_tracebacks[i])) details +=""" <tr> <td valign="top" nowrap align="right"><b>Traceback:</b></td> <td><pre>%s</pre></td> </tr> <tr> <td nowrap align="right"><b>Request handler:</b></td> <td>%s</td> </tr> <tr> <td nowrap align="right"><b>URL:</b></td> <td>%s</td> </tr> <tr> <td nowrap align="right" valign="top"><b>Params:</b></td> <td>%s</td> </tr> <tr> <td valign="top" nowrap align="right"><b>HTTP headers:</b></td> <td><pre>%s</pre></td> </tr> <tr> <td nowrap align="right"><b>Logged user:</b></td> <td>%s</td> </tr> </table> """%("\n".join( tracebackList ), rh.__name__, url, "<br>".join(params), \ "\n".join( headers ), userHTML ) vars["errorDetails"] = details vars["reportMsg"] = quoteattr( json.dumps({ 'request_info': get_request_info(), 'traceback': traceback.format_exc() })) return vars