Exemplo n.º 1
0
 def __call__(self):
     eventPhysicalPath = '/'.join(self.context.getPhysicalPath())
     wft = getToolByName(self.context, 'portal_workflow')
     state = wft.getInfoFor(self.context, 'review_state')
     member = self.context.portal_membership.getAuthenticatedMember()
     memberid = member.id
     if member.has_permission('Modify portal content', self.context):
         editable = True
     if self.context.end() - self.context.start() > 1.0:
         allday = True
     else:
         allday = False
     adapted = ISFBaseEventFields(self.context, None)
     if adapted:
         allday = adapted.allDay
     copycut = ''
     if self.copyDict and eventPhysicalPath == self.copyDict['url']:
         copycut = self.copyDict['op'] == 1 and ' event_cutted' or ' event_copied'
     typeClass = ' type-'+self.context.portal_type
     colorIndex = getColorIndex(self.context, self.request, eventPhysicalPath)
     extraClass = self.getExtraClass()
     return {"status": "ok",
             "id": "UID_%s" % (self.context.UID()), 
             "title": self.context.Title(),
             "description": self.context.Description(),
             "start": self.context.start().rfc822(),
             "end": self.context.end().rfc822(),
             "url": self.context.absolute_url(),
             "editable": editable,
             "allDay": allday, 
             "className": "contextualContentMenuEnabled state-" + str(state) + (editable and " editable" or "")+copycut+typeClass+colorIndex+extraClass}
Exemplo n.º 2
0
 def __call__(self):
     eventPhysicalPath = '/'.join(self.context.getPhysicalPath())
     wft = getToolByName(self.context, 'portal_workflow')
     state = wft.getInfoFor(self.context, 'review_state')
     member = self.context.portal_membership.getAuthenticatedMember()
     memberid = member.id
     if member.has_permission('Modify portal content', self.context):
         editable = True
     if self.context.end() - self.context.start() > 1.0:
         allday = True
     else:
         allday = False
     adapted = ISFBaseEventFields(self.context, None)
     if adapted:
         allday = adapted.allDay
     copycut = ''
     if self.copyDict and eventPhysicalPath == self.copyDict['url']:
         copycut = self.copyDict[
             'op'] == 1 and ' event_cutted' or ' event_copied'
     typeClass = ' type-' + self.context.portal_type
     colorIndex = getColorIndex(self.context, self.request,
                                eventPhysicalPath)
     extraClass = self.getExtraClass()
     return {
         "status":
         "ok",
         "id":
         "UID_%s" % (self.context.UID()),
         "title":
         self.context.Title(),
         "description":
         self.context.Description(),
         "start":
         self.context.start().rfc822(),
         "end":
         self.context.end().rfc822(),
         "url":
         self.context.absolute_url(),
         "editable":
         editable,
         "allDay":
         allday,
         "className":
         "contextualContentMenuEnabled state-" + str(state) +
         (editable and " editable" or "") + copycut + typeClass +
         colorIndex + extraClass
     }
Exemplo n.º 3
0
    def dictFromBrain(self, brain, args):
        eventsFilter = queryAdapter( self.context, ISolgemaFullcalendarEditableFilter )
        editpaths = eventsFilter.filterEvents(args)
        member = self.context.portal_membership.getAuthenticatedMember()
        memberid = member.id

        #Scheduler changes
        if brain.getObject().portal_type == "collective.dexterity.appointments.timeslot" or brain.getObject().portal_type == "collective.dexterity.appointments.person":
            start = DateTime(brain.getObject().start)
            end = DateTime(brain.getObject().end)
        else:
            start = brain.start
            end = brain.end

        #End Scheduler changes

        if memberid in brain.Creator:
            editable = True
        else:
            editable = False
        if brain.getURL() in editpaths:
            editable = True
        else:
            editable = False
        if end - start > 1.0:
            allday = True
        else:
            allday = False
        if getattr(brain, 'SFAllDay', None) in [False,True]:
            allday = brain.SFAllDay
        copycut = ''
        if self.copyDict and brain.getPath() == self.copyDict['url']:
            copycut = self.copyDict['op'] == 1 and ' event_cutted' or ' event_copied'
        typeClass = ' type-'+brain.portal_type
        colorIndex = getColorIndex(self.context, self.request, brain=brain)
        extraClass = self.getExtraClass(brain)
        return {"id": "UID_%s" % (brain.UID), 
                "title": brain.Title, 
                "description": brain.Description,
                "start": start.rfc822(),
                "end": end.rfc822(),
                "url": brain.getURL(),
                "editable": editable,
                "allDay": allday, 
                "className": "contextualContentMenuEnabled state-" + str(brain.review_state) + (editable and " editable" or "")+copycut+typeClass+colorIndex+extraClass}
Exemplo n.º 4
0
    def dictFromBrain(self, brain, args):
        eventsFilter = queryAdapter(self.context,
                                    ISolgemaFullcalendarEditableFilter)
        editpaths = eventsFilter.filterEvents(args)
        member = self.context.portal_membership.getAuthenticatedMember()
        memberid = member.id

        #Scheduler changes
        if brain.getObject(
        ).portal_type == "collective.dexterity.appointments.timeslot" or brain.getObject(
        ).portal_type == "collective.dexterity.appointments.person":
            start = DateTime(brain.getObject().start)
            end = DateTime(brain.getObject().end)
        else:
            start = brain.start
            end = brain.end

        #End Scheduler changes

        if memberid in brain.Creator:
            editable = True
        else:
            editable = False
        if brain.getURL() in editpaths:
            editable = True
        else:
            editable = False
        if end - start > 1.0:
            allday = True
        else:
            allday = False
        if getattr(brain, 'SFAllDay', None) in [False, True]:
            allday = brain.SFAllDay
        copycut = ''
        if self.copyDict and brain.getPath() == self.copyDict['url']:
            copycut = self.copyDict[
                'op'] == 1 and ' event_cutted' or ' event_copied'
        typeClass = ' type-' + brain.portal_type
        colorIndex = getColorIndex(self.context, self.request, brain=brain)
        extraClass = self.getExtraClass(brain)
        return {
            "id":
            "UID_%s" % (brain.UID),
            "title":
            brain.Title,
            "description":
            brain.Description,
            "start":
            start.rfc822(),
            "end":
            end.rfc822(),
            "url":
            brain.getURL(),
            "editable":
            editable,
            "allDay":
            allday,
            "className":
            "contextualContentMenuEnabled state-" + str(brain.review_state) +
            (editable and " editable" or "") + copycut + typeClass +
            colorIndex + extraClass
        }