def afterSetUp(self):
        self.portal.manage_install_pluggableitem('Naaya Meeting')
        from naaya.content.meeting.meeting import addNyMeeting
        location = {'geo_location.address': 'Kogens Nytorv 6, 1050 Copenhagen K, Denmark'}
        addNyMeeting(self.portal.info, 'mymeeting', contributor='contributor', submitted=1,
            title='MyMeeting',
            releasedate='16/06/2010', start_date='20/06/2010', end_date='25/06/2010',
            contact_person='My Name', contact_email='*****@*****.**', **location)
        self.portal.info.mymeeting.approveThis()
        self.portal.recatalogNyObject(self.portal.info.mymeeting)

        addPortalMeetingParticipant(self.portal)
        import transaction; transaction.commit()
Beispiel #2
0
    def test_releasedate(self):
        from naaya.content.meeting.meeting import addNyMeeting
        from naaya.content.meeting.meeting import handle_meeting_add
        from DateTime import DateTime

        extra_args = {
            'geo_location.address':
            'Kogens Nytorv 6, 1050 Copenhagen K, Denmark',
            'interval.start_date': '20/06/2010',
            'interval.end_date': '25/06/2010',
            'interval.all_day': True
        }

        class DummyEvent:
            def __init__(self, context):
                self.context = context

        addNyMeeting(self.portal.info,
                     'mymeeting',
                     contributor='contributor',
                     submitted=1,
                     title='MyMeeting',
                     max_participants='2',
                     releasedate='16/06/2010',
                     contact_person='My Name',
                     contact_email='*****@*****.**',
                     allow_register=True,
                     restrict_items=True,
                     **extra_args)

        meeting = self.portal['info']['mymeeting']

        # Automatically unapprove on add when release date is in the future
        meeting.approved = True
        meeting.releasedate = DateTime() + 10
        handle_meeting_add(DummyEvent(meeting))
        assert bool(meeting.approved) == False

        # Automatically approve on add when release date is in the past
        meeting.approved = False
        meeting.releasedate = DateTime() - 10
        handle_meeting_add(DummyEvent(meeting))
        assert bool(meeting.approved) == True

        # Automatically approve on attribute access when release date is in past
        meeting.approved = False
        assert bool(meeting.restrictedTraverse('approved')) == True

        # Automatically unapprove on attribute access when release date is in future
        meeting.releasedate = DateTime() + 10
        assert bool(meeting.restrictedTraverse('approved')) == False
    def test_releasedate(self):
        from naaya.content.meeting.meeting import addNyMeeting
        from naaya.content.meeting.meeting import handle_meeting_add
        from DateTime import DateTime

        extra_args = {'geo_location.address': 'Kogens Nytorv 6, 1050 Copenhagen K, Denmark',
                      'interval.start_date': '20/06/2010',
                      'interval.end_date': '25/06/2010',
                      'interval.all_day': True}

        class DummyEvent:
            def __init__(self, context):
                self.context = context

        addNyMeeting(self.portal.info, 'mymeeting', contributor='contributor', submitted=1,
            title='MyMeeting', max_participants='2', releasedate='16/06/2010',
            contact_person='My Name', contact_email='*****@*****.**',
            allow_register=True, restrict_items=True, **extra_args)

        meeting = self.portal['info']['mymeeting']

        # Automatically unapprove on add when release date is in the future
        meeting.approved = True
        meeting.releasedate = DateTime() + 10
        handle_meeting_add(DummyEvent(meeting))
        assert bool(meeting.approved) == False

        # Automatically approve on add when release date is in the past
        meeting.approved = False
        meeting.releasedate = DateTime() - 10
        handle_meeting_add(DummyEvent(meeting))
        assert bool(meeting.approved) == True

        # Automatically approve on attribute access when release date is in past
        meeting.approved = False
        assert bool(meeting.restrictedTraverse('approved')) == True

        # Automatically unapprove on attribute access when release date is in future
        meeting.releasedate = DateTime() + 10
        assert bool(meeting.restrictedTraverse('approved')) == False
    def afterSetUp(self):
        self.portal.manage_install_pluggableitem('Naaya Meeting')
        from naaya.content.meeting.meeting import addNyMeeting
        location = {'geo_location.address': 'Kogens Nytorv 6, 1050 Copenhagen K, Denmark'}
        addNyMeeting(self.portal.info, 'mymeeting', contributor='contributor', submitted=1,
            title='MyMeeting',
            releasedate='16/06/2010', start_date='20/06/2010', end_date='25/06/2010',
            contact_person='My Name', contact_email='*****@*****.**', **location)
        self.portal.info.mymeeting.approveThis()
        self.portal.recatalogNyObject(self.portal.info.mymeeting)

        addPortalMeetingParticipant(self.portal)
        self.portal.info.mymeeting.participants._add_user('test_participant')

        try:
            manage_addSurveyTool(self.portal)
        except:
            pass
        meeting = self.portal.info.mymeeting
        manage_addMegaSurvey(meeting, title='MySurvey')
        meeting.survey_pointer = 'info/mymeeting/mysurvey'
        import transaction; transaction.commit()
    def admin_view_webex_email(self, filename, REQUEST=None, RESPONSE=None):
        """ Display a specfic saved webex request email """

        if REQUEST and REQUEST.method == 'POST':
            meeting_info = json.loads(REQUEST.form['webex'])
            # get the initial requester of the webex meeting
            requester_auth_user = str(meeting_info['auth_user'])
            del meeting_info['auth_user']

            # automatically add meeting using info from email
            # and some default data
            extra_args = {
                'geo_location.address':
                    'Kongens Nytorv 6, 1050 Copenhagen K, Denmark',
                'geo_location.lat': u'55.681365',
                'geo_location.lon': u'12.586484',
                'geo_type': u'symbol326',
                'sortorder': u'100',
                'releasedate': datetime.utcnow().strftime("%d/%m/%Y"),
                'max_participants': '25',
                'restrict_items': True,
                'submitted': 1
            }

            args = dict(meeting_info, **extra_args)

            try:
                ob_id = addNyMeeting(self.getSite().library,
                                     contributor=requester_auth_user,
                                     **args)
            except Exception:
                self.setSessionErrorsTrans("Error in adding a new meeting.")
                REQUEST.RESPONSE.redirect('%s/library' % self.absolute_url())
            else:
                self.setSessionInfoTrans('Successfully added meeting')

            REQUEST.RESPONSE.redirect('%s/library/%s' % (self.absolute_url(),
                                                         ob_id))
            return

        email = get_bulk_email(self, filename, where_to_read='sent-webex')
        return self.getFormsTool().getContent({'here': self, 'email': email},
                                              'site_admin_webex_mail_view')
Beispiel #6
0
    def admin_view_webex_email(self, filename, REQUEST=None, RESPONSE=None):
        """ Display a specfic saved webex request email """

        if REQUEST and REQUEST.method == 'POST':
            meeting_info = json.loads(REQUEST.form['webex'])
            # get the initial requester of the webex meeting
            requester_auth_user = str(meeting_info['auth_user'])
            del meeting_info['auth_user']

            # automatically add meeting using info from email
            # and some default data
            extra_args = {
                'geo_location.address':
                'Kongens Nytorv 6, 1050 Copenhagen K, Denmark',
                'geo_location.lat': u'55.681365',
                'geo_location.lon': u'12.586484',
                'geo_type': u'symbol326',
                'sortorder': u'100',
                'releasedate': datetime.utcnow().strftime("%d/%m/%Y"),
                'max_participants': '25',
                'restrict_items': True,
                'submitted': 1
            }

            args = dict(meeting_info, **extra_args)

            try:
                ob_id = addNyMeeting(self.getSite().library,
                                     contributor=requester_auth_user,
                                     **args)
            except Exception, e:
                self.setSessionErrorsTrans("Error in adding a new meeting.")
                REQUEST.RESPONSE.redirect('%s/library' % self.absolute_url())
            else:
                self.setSessionInfoTrans('Successfully added meeting')

            REQUEST.RESPONSE.redirect('%s/library/%s' %
                                      (self.absolute_url(), ob_id))
            return