def update(self): context = aq_inner(self.context) self.calendar_url = get_calendar_url(context, self.search_base_path) self.year, self.month, self.date = year, month, date = self._year_month_date_display_patch() self.prev_year, self.prev_month = prev_year, prev_month = ( self.get_previous_month(year, month)) self.next_year, self.next_month = next_year, next_month = ( self.get_next_month(year, month)) self.prev_query = '?month=%s&year=%s' % (prev_month, prev_year) self.next_query = '?month=%s&year=%s' % (next_month, next_year) self.cal = calendar.Calendar(first_weekday()) self._ts = getToolByName(context, 'translation_service') self.month_name = PLMF( self._ts.month_msgid(month), default=self._ts.month_english(month) ) # strftime %w interprets 0 as Sunday unlike the calendar. strftime_wkdays = [ wkday_to_mon1(day) for day in self.cal.iterweekdays() ] self.weekdays = [ PLMF(self._ts.day_msgid(day, format='s'), default=self._ts.weekday_english(day, format='a')) for day in strftime_wkdays ]
def update(self): context = aq_inner(self.context) self.calendar_url = get_calendar_url(context, self.search_base_path) self.year, self.month = year, month = self.year_month_display() self.prev_year, self.prev_month = prev_year, prev_month = ( self.get_previous_month(year, month)) self.next_year, self.next_month = next_year, next_month = ( self.get_next_month(year, month)) self.prev_query = '?month=%s&year=%s' % (prev_month, prev_year) self.next_query = '?month=%s&year=%s' % (next_month, next_year) self.cal = calendar.Calendar(first_weekday()) self._ts = getToolByName(context, 'translation_service') self.month_name = PLMF( self._ts.month_msgid(month), default=self._ts.month_english(month) ) # strftime %w interprets 0 as Sunday unlike the calendar. strftime_wkdays = [ wkday_to_mon1(day) for day in self.cal.iterweekdays() ] self.weekdays = [ PLMF(self._ts.day_msgid(day, format='s'), default=self._ts.weekday_english(day, format='a')) for day in strftime_wkdays ]
def __init__(self, *args): base.Renderer.__init__(self, *args) context = aq_inner(self.context) calendar_url = get_calendar_url(context, self.data.search_base) self.next_url = '%s?mode=future' % calendar_url self.prev_url = '%s?mode=past' % calendar_url portal_state = getMultiAdapter((self.context, self.request), name='plone_portal_state') self.portal = portal_state.portal()
def __init__(self, *args): base.Renderer.__init__(self, *args) context = aq_inner(self.context) calendar_url = get_calendar_url(context, self.data.search_base) self.next_url = '%s?mode=future' % calendar_url self.prev_url = '%s?mode=past' % calendar_url portal_state = getMultiAdapter( (self.context, self.request), name='plone_portal_state' ) self.portal = portal_state.portal()
def update(self): context = aq_inner(self.context) if IHomePage.providedBy(self.context) or \ IPloneSiteRoot.providedBy(self.context) or \ not IDexterityContent.providedBy(self.context): path = '' else: if ICommunity.providedBy(aq_inner(self.context)): community = aq_inner(self.context) portal = api.portal.get() portal_path = portal.getPhysicalPath() community_path = community.getPhysicalPath() path = '/' + '/'.join(set(community_path) - set(portal_path)) else: path = '' self.search_base = path self.state = ('published', 'intranet') self.username = api.user.get_current().id # self.user_info = get_safe_member_by_id(self.username) self.calendar_url = get_calendar_url(context, self.search_base) self.year, self.month = year, month = self.year_month_display() self.prev_year, self.prev_month = prev_year, prev_month = ( self.get_previous_month(year, month)) self.next_year, self.next_month = next_year, next_month = ( self.get_next_month(year, month)) # TODO: respect current url-query string self.prev_query = '?month=%s&year=%s' % (prev_month, prev_year) self.next_query = '?month=%s&year=%s' % (next_month, next_year) self.cal = calmodule.Calendar(first_weekday()) self._ts = getToolByName(context, 'translation_service') self.month_name = PLMF( self._ts.month_msgid(month), default=self._ts.month_english(month) ) # strftime %w interprets 0 as Sunday unlike the calendar. strftime_wkdays = [ wkday_to_mon1(day) for day in self.cal.iterweekdays() ] self.weekdays = [ PLMF(self._ts.day_msgid(day, format='s'), default=self._ts.weekday_english(day, format='a')) for day in strftime_wkdays ]
def update(self): context = aq_inner(self.context) calendar_url = get_calendar_url(context, self.search_base_path) self.next_url = '%s?mode=future' % calendar_url self.prev_url = '%s?mode=past' % calendar_url