Ejemplo n.º 1
0
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 to display 'All day' option"),
                         default=False)
Ejemplo n.º 2
0
class TopicQueryGroup(z3cgroup.Group):
    label = _(u'Query', default="Query")

    fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select(
        'availableCriterias', 'displayUndefined', 'overrideStateForAdmin')
    fields['availableCriterias'].widgetFactory[
        INPUT_MODE] = CriteriasOrderedSelectFieldWidget
Ejemplo n.º 3
0
class FolderQueryGroup(z3cgroup.Group):
    label = _(u'Sub-Folders', default="Sub-Folders")

    fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select(
        'availableSubFolders', )
    fields['availableSubFolders'].widgetFactory[
        INPUT_MODE] = CriteriasOrderedSelectFieldWidget
Ejemplo n.º 4
0
 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}
Ejemplo n.º 5
0
class CalendarGroup(z3cgroup.Group):
    label = _(u'Calendar', default="Calendar")

    fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select(
        'slotMinutes', 'allDaySlot', 'defaultCalendarView',
        'shortDayNameFormat', 'headerLeft', 'headerRight', 'weekends',
        'firstDay', 'relativeFirstDay', 'firstHour', 'minTime', 'maxTime',
        'gcalSources', 'target_folder', 'calendarHeight',
        'displayNoscriptList', 'disableAJAX', 'caleditable', 'disableDragging',
        'disableResizing', 'eventType')
    fields['target_folder'].widgetFactory[INPUT_MODE] = ContentTreeFieldWidget
Ejemplo n.º 6
0
 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
     }
def availableViews(context):
    voc = [('month', _('Month', default='Month')),
           ('basicWeek', _('basicWeek', default='basicWeek')),
           ('basicDay', _('basicDay', default='basicDay')),
           ('agendaWeek', _('agendaWeek', default='agendaWeek')),
           ('agendaDay', _('agendaDay', default='agendaDay')),
           ('agendaDaySplit', _('agendaDaySplit', default='Day Split'))]
    return TitledVocabulary.fromTitles(voc)
def availableViews( context ):
    voc = [('month', _('Month', default='Month')),
           ('basicWeek', _('basicWeek', default='basicWeek')),
           ('basicDay', _('basicDay', default='basicDay')),
           ('agendaWeek', _('agendaWeek', default='agendaWeek')),
           ('agendaDay', _('agendaDay', default='agendaDay')),
           ('agendaDaySplit', _('agendaDaySplit', default='Day Split'))
          ]
    return TitledVocabulary.fromTitles( voc )
Ejemplo n.º 9
0
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
Ejemplo n.º 10
0
 def getWeekTranslation(self):
     return _('Week', 'Week')
Ejemplo n.º 11
0
    def render(self):
        currentValues = self.value or {}
        criteria = self.getCriteria()
        html = ''
        for fieldid, selectedItems in [(a['i'], a.get('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)
                if isinstance(selectedItems, unicode):
                    selectedItems = [selectedItems]
                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&nbsp;</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>&nbsp;</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) or IDexterityContainer.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>&nbsp;</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
Ejemplo n.º 12
0
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')

    headerLeft = schema.TextLine(title=_(u"label_headerLeft"),
                                 required=False,
                                 description=_(u"help_headerLeft"),
                                 default=u'prev,next today calendar')

    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')

    gcalSources = schema.Text(
        title=_(u"label_gcalSources", default="Google Calendar Sources"),
        required=False,
        description=_(u"help_gcalSources",
                      default="Enter your Google Calendar feeds url here. the "
                      "syntax must be: "
                      "http://www.google.com/calendar/feeds/yourmail@"
                      "gmail.com/... One url per line."),
        default=u'')

    target_folder = schema.Choice(
        title=_(u"label_target_folder"),
        description=_(u"help_target_folder"),
        required=False,
        source=PathSourceBinder(
            object_provides=(IATFolder.__identifier__,
                             IOrderedContainer.__identifier__,
                             IDexterityContainer.__identifier__), ))

    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=[])

    availableSubFolders = schema.List(
        title=_(u"label_availableSubFolders"),
        required=False,
        description=_(u"help_availableSubFolders"),
        value_type=schema.Choice(
            title=_(u"label_availableSubFolders"),
            source="solgemafullcalendar.availableSubFolders"),
        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)

    disableAJAX = schema.Bool(title=_(u"label_disableAJAX",
                                      default="Disable AJAX"),
                              required=False,
                              description=_(
                                  u"help_disableAJAX",
                                  default="Disables contextual adding menu."),
                              default=False)

    caleditable = schema.Bool(
        title=_(u"label_caleditable", default="Editable"),
        required=False,
        description=_(u"help_caleditable",
                      default="Check this box if you want the events in the "
                      "calendar to be editable."),
        default=True)

    disableDragging = schema.Bool(
        title=_(u"label_disableDragging", default="Disable Dragging"),
        required=False,
        description=_(u"help_disableDragging",
                      default="Disables all event dragging, even when events "
                      "are editable."),
        default=False)

    disableResizing = schema.Bool(
        title=_(u"label_disableResizing", default="Disable Resizing"),
        required=False,
        description=_(u"help_disableResizing",
                      default="Disables all event resizing, even when events "
                      "are editable."),
        default=False)

    eventType = schema.TextLine(
        title=_(u"label_eventType", default=u"Event type"),
        required=False,
        description=_(u"help_eventType",
                      default=u"Portal type to use when creating a new event"),
        default=u'Event')

    def isSolgemaFullcalendar(self):
        """Get name of days XXX??
def shortNameFormats(context):
    return TitledVocabulary.fromTitles([('a',
                                         _(u'abbreviated',
                                           default='abbreviated')),
                                        ('s', _(u'short', default='short'))])
Ejemplo n.º 14
0
 def getAddEventText(self):
     return _('addNewEvent', 'Add New Event')
Ejemplo n.º 15
0
 def getDaySplitTranslation(self):
     return _('DaySplit', 'DaySplit')
Ejemplo n.º 16
0
 def getWeekTranslation(self):
     return _('Week', 'Week')
Ejemplo n.º 17
0
class ColorsGroup(z3cgroup.Group):
    label = _(u'Colors', default="Colors")

    fields = z3cfield.Fields(ISolgemaFullcalendarProperties).select(
        'queryColors')
Ejemplo n.º 18
0
 def getMonthTranslation(self):
     return _('Month', 'Month')
Ejemplo n.º 19
0
    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&nbsp;</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>&nbsp;</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>&nbsp;</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
Ejemplo n.º 20
0
 def getMonthTranslation(self):
     return _('Month', 'Month')
Ejemplo n.º 21
0
 def getDayTranslation(self):
     return _('Day', 'Day')
Ejemplo n.º 22
0
 def getDayTranslation(self):
     return _('Day', 'Day')
Ejemplo n.º 23
0
 def getDaySplitTranslation(self):
     return _('DaySplit', 'DaySplit')
Ejemplo n.º 24
0
 def getAllDayText(self):
     return _('Allday', 'all-day')
Ejemplo n.º 25
0
 def getAllDayText(self):
     return _('Allday', 'all-day')
Ejemplo n.º 26
0
 def getEditEventText(self):
     return _('editEvent', 'Edit Event')
Ejemplo n.º 27
0
 def getAddEventText(self):
     return _('addNewEvent', 'Add New Event')
Ejemplo n.º 28
0
def shortNameFormats(context):
    return TitledVocabulary.fromTitles([('a', _(u'abbreviated', default='abbreviated')),
                                        ('s', _(u'short', default='short'))])
Ejemplo n.º 29
0
 def getEditEventText(self):
     return _('editEvent', 'Edit Event')