def confDisplaySMFillDict(cls, obj, params): sideMenuItemsDict = params['dict'] conf = params['conf'] sideMenuItemsDict["instantMessaging"] = { \ "caption": N_("Chat Rooms"), \ "URL": urlHandlers.UHConferenceInstantMessaging, \ "staticURL": "", \ "parent": ""}
class RepeatMapping(object): mapping = { (RepeatFrequency.NEVER, 0): (N_('Single reservation'), None, 'none'), (RepeatFrequency.DAY, 1): (N_('Repeat daily'), 0, 'daily'), (RepeatFrequency.WEEK, 1): (N_('Repeat once a week'), 1, 'weekly'), (RepeatFrequency.WEEK, 2): (N_('Repeat once every two weeks'), 2, 'everyTwoWeeks'), (RepeatFrequency.WEEK, 3): (N_('Repeat once every three weeks'), 3, 'everyThreeWeeks'), (RepeatFrequency.MONTH, 1): (N_('Repeat every month'), 4, 'monthly') } @classmethod @unimplemented(exceptions=(KeyError, ), message=_('Unimplemented repetition pair')) def get_message(cls, repeat_frequency, repeat_interval): return cls.mapping[(repeat_frequency, repeat_interval)][0] @classmethod @unimplemented(exceptions=(KeyError, ), message=_('Unimplemented repetition pair')) def get_short_name(cls, repeat_frequency, repeat_interval): # for the API return cls.mapping[(repeat_frequency, repeat_interval)][2] @classmethod @unimplemented(exceptions=(KeyError, ), message=_('Unknown old repeatability')) def convert_legacy_repeatability(cls, repeat): if repeat is None or repeat < 5: for k, (_, v, _) in cls.mapping.iteritems(): if v == repeat: return k else: raise KeyError('Undefined old repeat: {}'.format(repeat))
class RepeatMapping(object): mapping = { (RepeatFrequency.NEVER, 0): (N_('Single reservation'), None, 'none'), (RepeatFrequency.DAY, 1): (N_('Repeat daily'), 0, 'daily'), (RepeatFrequency.WEEK, 1): (N_('Repeat once a week'), 1, 'weekly'), (RepeatFrequency.WEEK, 2): (N_('Repeat once every two weeks'), 2, 'everyTwoWeeks'), (RepeatFrequency.WEEK, 3): (N_('Repeat once every three weeks'), 3, 'everyThreeWeeks'), (RepeatFrequency.MONTH, 1): (N_('Repeat every month'), 4, 'monthly') } @classmethod def get_message(cls, repeat_frequency, repeat_interval): # XXX: move this somewhere else # not translated since it's only used in log messages now if repeat_frequency == RepeatFrequency.NEVER: return u'single booking' elif repeat_frequency == RepeatFrequency.DAY: return u'daily booking' elif repeat_frequency == RepeatFrequency.WEEK: return u'weekly' if repeat_interval == 1 else u'every {} weeks'.format( repeat_interval) elif repeat_frequency == RepeatFrequency.MONTH: return u'monthly' if repeat_interval == 1 else u'every {} months'.format( repeat_interval) @classmethod @unimplemented(exceptions=(KeyError, ), message=_('Unimplemented repetition pair')) def get_short_name(cls, repeat_frequency, repeat_interval): # for the API return cls.mapping[(repeat_frequency, repeat_interval)][2]