def testAddSurveyTool(self):
        """Add Survey Tool - manage_addSurveyTool"""
        id = manage_addSurveyTool(self.portal)
        self.assertEqual(id, SurveyTool.portal_id)
        ob = self.portal._getOb(id, None)
        self.assertNotEqual(ob, None)
        self.assert_(isinstance(ob, SurveyTool))

        # catalog
        indexes = self.portal.getCatalogTool().indexes()
        self.assert_('respondent' in indexes)
    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 afterSetUp(self):
     self.login()
     manage_addSurveyTool(self.portal)
     id = manage_addMegaSurvey(self.portal, title='Testing survey')
     self.survey = self.portal._getOb(id)
Esempio n. 4
0
 def _update(self):
     updates = self._list_updates()
     for update in updates:
         logger.debug('Added survey tool to %s' %
                      (update.absolute_url(1), ))
         manage_addSurveyTool(update)
 def _update(self):
     updates = self._list_updates()
     for update in updates:
         logger.debug('Added survey tool to %s' % (update.absolute_url(1),))
         manage_addSurveyTool(update)
    def loadDefaultData(self):
        """ """
        #set default 'Naaya' configuration
        NySite.__dict__['createPortalTools'](self)
        NySite.__dict__['loadDefaultData'](self)

        #remove Naaya default content
        layout_tool = self.getLayoutTool()
        naaya_skins = [skin.getId() for skin in
            layout_tool.objectValues('Naaya Skin')]
        logos = [image.getId() for image in
            layout_tool.objectValues('Image')]
        layout_tool.manage_delObjects(naaya_skins + logos)
        self.manage_delObjects('info')

        #load site skeleton - configuration
        self.loadSkeleton(ENVIROWINDOWS_PRODUCT_PATH)

        #custom indexes
        try:    self.getCatalogTool().manage_addIndex('resource_area', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_area_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_focus_exp', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass
        try:    self.getCatalogTool().manage_addIndex('resource_country', 'TextIndexNG2', extra={'default_encoding': 'utf-8', 'splitter_single_chars': 1})
        except: pass

        #default RDF Calendar settings
        manage_addRDFCalendar(self, id=ID_RDFCALENDAR, title=TITLE_RDFCALENDAR, week_day_len=1)
        rdfcalendar_ob = self._getOb(ID_RDFCALENDAR)
        #adding local_events Script (Python)
        manage_addPythonScript(rdfcalendar_ob, 'local_events')
        local_events_ob = rdfcalendar_ob._getOb('local_events')
        local_events_ob._params = 'year=None, month=None, day=None'
        local_events_ob.write(open(os.path.dirname(__file__) + '/skel/others/local_events.py', 'r').read())

        #Adding custom SchemaTool properties
        schema_tool = self.getSchemaTool()
        naaya_folder_schema = schema_tool.getSchemaForMetatype(METATYPE_FOLDER)
        widget_args = dict(
            label='Allow users enrolment here?',
            data_type='bool',
            widget_type='Checkbox',
            localized=True,
        )
        naaya_folder_schema.addWidget('show_contributor_request_role',
                                      **widget_args)

        naaya_consultation_schema = schema_tool.getSchemaForMetatype(
                                        'Naaya Consultation')
        if naaya_consultation_schema:
            naaya_consultation_schema.addWidget('show_contributor_request_role',
                                      **widget_args)

        naaya_simple_consultation_schema = schema_tool.getSchemaForMetatype(
                                        'Naaya Simple Consultation')
        if naaya_simple_consultation_schema:
            naaya_simple_consultation_schema.addWidget(
                'show_contributor_request_role', **widget_args)

        #add survey tool
        try:
            from Products.NaayaSurvey.SurveyTool import manage_addSurveyTool
            manage_addSurveyTool(self)
        except:
            pass

        self._install_link_checker()

        addNyFolder(self, id='events', title='Events', publicinterface=1)
        folder_meta_types = FolderMetaTypes(self._getOb('events'))
        folder_meta_types.set_values(['Naaya Event'])
        event_folder_custom_index = (
            "<metal:block use-macro=\"python:here.getFormsTool()."
            "getForm('event_folder_index').macros['page']\" />")
        self['events']['index'].pt_edit(text=event_folder_custom_index,
                                        content_type='')