def availableViews(context): voc = [('month', _('Month', default='Month')), ('basicWeek', _('basicWeek', default='basicWeek')), ('basicDay', _('basicDay', default='basicDay')), ('agendaWeek', _('agendaWeek', default='agendaWeek')), ('agendaDay', _('agendaDay', default='agendaDay'))] return TitledVocabulary.fromTitles(voc)
def render(self): msg = translate(_('title_add_to_ical', default=u"Download this calendar in iCal format"), context=self.request) title = translate(_(u"iCal export"), context=self.request) title_print = 'Imprimir as próximas reservas.' url = self.context.absolute_url() portal_url = getToolByName(self.context, 'portal_url')() return """ <a id="sfc-ical-export" class="visualNoPrint" title="%(msg)s" href="%(url)s/ics_view"> <img width="16" height="16" title="%(title)s" alt="%(title)s" src="%(portal_url)s/icon_export_ical.png"> <span>%(title)s</span></a> <a onclick="window.open('%(url)s/print_reservations', 'Imprimir', 'STATUS=NO, TOOLBAR=NO, LOCATION=NO, DIRECTORIES=NO, RESISABLE=YES, SCROLLBARS=YES, TOP=50, LEFT=50, WIDTH=700, HEIGHT=600');" id="sfc-ical-export" class="visualNoPrint" title="%(title_print)s" style="margin-right: 10px; cursor: pointer;"> <img width="16" height="16" title="%(title_print)s" alt="%(title_print)s" src="%(portal_url)s/print_icon.png"> <span>Imprimir</span> <a> """ % {'msg': msg, 'title': title,'title_print': title_print, 'url': url, 'portal_url': portal_url}
def availableViews( context ): voc = [('month', _('Month', default='Month')), ('basicWeek', _('basicWeek', default='basicWeek')), ('basicDay', _('basicDay', default='basicDay')), ('agendaWeek', _('agendaWeek', default='agendaWeek')), ('agendaDay', _('agendaDay', default='agendaDay')) ] return TitledVocabulary.fromTitles( voc )
class ISFBaseEventFields(Interface): """An interface that defines the specific Fullcalendar's events fields """ allDay = schema.Bool( title=_(u"label_allDay", default=u"Display All day option"), description=_(u"help_allDay", default=u"Check this box to display All day option"), default=False)
class QueryGroup(z3cgroup.Group): label = _(u'Query', default="Query") fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select( 'availableCriterias', 'displayUndefined', 'overrideStateForAdmin') fields['availableCriterias'].widgetFactory[ INPUT_MODE] = CriteriasOrderedSelectFieldWidget
def render(self): msg = translate(_('title_add_to_ical', default=u"Download this calendar in iCal format"), context=self.request) title = translate(_(u"iCal export"), context=self.request) url = self.context.absolute_url() portal_url = getToolByName(self.context, 'portal_url')() return """ <a id="sfc-ical-export" class="visualNoPrint" title="%(msg)s" href="%(url)s/ics_view"> <img width="16" height="16" title="%(title)s" alt="%(title)s" src="%(portal_url)s/icon_export_ical.png"> <span>%(title)s</span></a> """ % {'msg': msg, 'title': title, 'url': url, 'portal_url': portal_url}
class CalendarGroup(z3cgroup.Group): label = _(u'Calendar', default="Calendar") fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select( 'slotMinutes', 'allDaySlot', 'defaultCalendarView', 'headerRight', 'weekends', 'firstDay', 'relativeFirstDay', 'firstHour', 'minTime', 'maxTime', 'target_folder', 'calendarHeight', 'displayNoscriptList') fields['target_folder'].widgetFactory[ INPUT_MODE] = QuerySourceFieldRadioWidget
def render(self): msg = translate(_('title_add_to_ical', default=u"Download this calendar in iCal format"), context=self.request) title = translate(_(u"iCal export"), context=self.request) url = self.context.absolute_url() portal_url = getToolByName(self.context, 'portal_url')() return """ <a id="sfc-ical-export" class="visualNoPrint" title="%(msg)s" href="%(url)s/ics_view"> <img width="16" height="16" title="%(title)s" alt="%(title)s" src="%(portal_url)s/icon_export_ical.png"> <span>%(title)s</span></a> """ % { 'msg': msg, 'title': title, 'url': url, 'portal_url': portal_url }
class ColorDictDataConverter(BaseDataConverter): type = dict errorMessage = _('The entered value is not a valid dict.') component.adapts(ICustomUpdatingDict, IColorDictInputWidget) def toWidgetValue(self, value): """See interfaces.IDataConverter""" if value is self.field.missing_value: return {} return value def toFieldValue(self, value): """See interfaces.IDataConverter""" if not value or len([a for a in value.values() if a]) == 0: return self.field.missing_value return value
def getWeekTranslation(self): return _('Week', 'Week')
class ColorsGroup(z3cgroup.Group): label = _(u'Colors', default="Colors") fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select( 'queryColors') fields['queryColors'].widgetFactory[INPUT_MODE] = ColorDictInputFieldWidget
def getMonthTranslation(self): return _('Month', 'Month')
def getEditEventText(self): return _('editEvent', 'Edit Event')
def getDaySplitTranslation(self): return _('DaySplit', 'DaySplit')
class ISFBaseEventFields(Interface): """An interface that defines the specific Fullcalendar's events fields """ allDay = schema.Bool( title=_(u"label_allDay"), description = _(u"help_allDay"), default=False)
def getAddEventText(self): return _('addNewEvent', 'Add New Event')
class ISolgemaFullcalendarProperties(Interface): """An interface for specific calendar content stored in the object""" slotMinutes = schema.Int(title=_(u"label_slotMinutes"), required=True, description=_(u"help_slotMinutes"), default=30) allDaySlot = schema.Bool(title=_(u"label_allDaySlot"), default=True) defaultCalendarView = schema.Choice( title=_(u"label_defaultCalendarView"), required=True, description=_(u"help_defaultCalendarView"), source="solgemafullcalendar.availableViews", default='agendaWeek') shortDayNameFormat = schema.Choice( title=_(u"label_shortDayNameFormat"), required=True, description=_(u"help_shortDayNameFormat"), source="solgemafullcalendar.shortNameFormats", default='a') headerRight = schema.List(title=_(u"label_headerRight"), description=_(u"help_headerRight"), value_type=schema.Choice( title=_(u"label_headerRight"), source="solgemafullcalendar.availableViews"), default=['month', 'agendaWeek', 'agendaDay']) weekends = schema.Bool(title=_(u"label_weekends"), description=_(u"help_weekends"), default=True) firstDay = schema.Choice(title=_(u"label_firstDay"), required=True, description=_(u"help_firstDay"), source="solgemafullcalendar.daysOfWeek", default=1) relativeFirstDay = schema.TextLine(title=_(u"label_relativeFirstDay"), required=False, description=_(u"help_relativeFirstDay"), default=u'') firstHour = schema.TextLine(title=_(u"label_firstHour"), required=True, description=_(u"help_firstHour"), default=u'-1') minTime = schema.TextLine(title=_(u"label_minTime"), required=True, description=_(u"help_minTime"), default=u'0') maxTime = schema.TextLine(title=_(u"label_maxTime"), description=_(u"help_minTime"), default=u'24') target_folder = schema.Choice( title=_(u"label_target_folder"), description=_(u"help_target_folder"), required=False, source=CustomSearchableTextSourceBinder( {'object_provides': IATFolder.__identifier__}, default_query='path:')) calendarHeight = schema.TextLine(title=_(u"label_calendarHeight"), required=False, description=_(u"help_calendarHeight"), default=u'600') availableCriterias = schema.List( title=_(u"label_availableCriterias"), required=False, description=_(u"help_availableCriterias"), value_type=schema.Choice( title=_(u"label_availableCriterias"), source="solgemafullcalendar.availableCriterias"), default=[]) queryColors = CustomUpdatingDict(title=_(u"label_queryColors"), required=False, description=_(u"help_queryColors"), default={}) displayUndefined = schema.Bool(title=_(u"label_displayUndefined"), required=False, description=_(u"help_displayUndefined"), default=False) overrideStateForAdmin = schema.Bool( title=_(u"label_overrideStateForAdmin"), required=False, description=_(u"help_overrideStateForAdmin"), default=True) displayNoscriptList = schema.Bool( title=_(u"label_displayNoscriptList"), required=False, description=_(u"help_displayNoscriptList"), default=True) def isSolgemaFullcalendar(self): """get name of days"""
def render(self): currentValues = self.value or {} criteria = self.getCriteria() html = '' for fieldid, selectedItems in [(a['i'], a['v']) for a in criteria]: index = self.context.portal_atct.getIndex(fieldid) fieldname = index.friendlyName or index.index if selectedItems: html += '<br/><b>%s</b><br/><table>' % (fieldname) for item in selectedItems: name = safe_unicode(item) item = str(component.queryUtility(IURLNormalizer).normalize(name)) value = '' if fieldid in currentValues \ and item in currentValues[fieldid]: value = currentValues[fieldid][item] html += """<tr><td>%s </td><td> <input type="text" size="10" name="%s:record" value="%s" class="colorinput" style="background-color:%s;" /> </td></tr>""" % ( name, self.name+'.'+fieldid+'.'+item, value, value) html+='</table>' calendar = ISolgemaFullcalendarProperties(self.context, None) gcalSourcesAttr = getattr(calendar, 'gcalSources', '') if gcalSourcesAttr != None: gcalSources = gcalSourcesAttr.split('\n') if gcalSources: html += '<br/><b>%s</b><br/><table>' % (_('Google Calendar Sources')) fieldid = 'gcalSources' for i in range(len(gcalSources)): url = gcalSources[i] item = 'source'+str(i) value = '' if fieldid in currentValues \ and item in currentValues[fieldid]: value = currentValues[fieldid][item] html += """<tr><td><span title="%s">%s</span> </td></td><td> <input type="text" size="10" name="%s:record" value="%s" class="colorinput" style="background-color:%s;" /> </td></tr>""" % ( str(url), 'Source '+str(i+1), self.name+'.'+fieldid+'.'+item, value, value) html+='</table>' availableSubFolders = getattr(calendar, 'availableSubFolders', []) if IATFolder.providedBy(self.context) and availableSubFolders: html += '<br/><b>%s</b><br/><table>' % (_('Sub-Folders')) fieldid = 'subFolders' for folderId in availableSubFolders: value = '' if fieldid in currentValues \ and folderId in currentValues[fieldid]: value = currentValues[fieldid][folderId] html += """<tr><td><span title="%s">%s</span> </td></td><td> <input type="text" size="10" name="%s:record" value="%s" class="colorinput" style="background-color:%s;" /> </td></tr>""" % ( folderId, folderId, self.name+'.'+fieldid+'.'+folderId, value, value) html+='</table>' return html
def getDayTranslation(self): return _('Day', 'Day')
def shortNameFormats(context): return TitledVocabulary.fromTitles([('a', _(u'abbreviated', default='abbreviated')), ('s', _(u'short', default='short'))])
def getAllDayText(self): return _('Allday', 'all-day')
class ColorsGroup(z3cgroup.Group): label = _(u'Colors', default="Colors") fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select( 'queryColors')