def _create_eionet_survey(container): portal_map = container.getGeoMapTool() meeting_type = portal_map.getSymbolTitle(container.geo_type) survey_details = EIONET_SURVEYS[meeting_type] manage_addMegaSurvey(container, survey_details['id'], survey_details['title']) eionet_survey = container._getOb(survey_details['id']) eionet_survey.meeting_eionet_survey = True eionet_survey.allow_anonymous = 1 eionet_survey._p_changed = True for question in survey_details['questions']: eionet_survey.addWidget(**question) for widget in eionet_survey.objectValues(): widget.locked = True widget._p_changed = True if meeting_type == 'NRC meeting': # Create validation_html and validation_onsubmit for custom validation validation_onsubmit = os.path.join( os.path.dirname(__file__), 'eionet_survey', 'validation_onsubmit_NRC_meeting.txt') manage_addPythonScript(eionet_survey, 'validation_onsubmit') script_content = open(validation_onsubmit, 'rb').read() params = 'datamodel, errors' script_title = 'Custom validation logic' eionet_survey._getOb('validation_onsubmit').ZPythonScript_edit( params, script_content) eionet_survey._getOb('validation_onsubmit').ZPythonScript_setTitle( script_title) validation_html = os.path.join(os.path.dirname(__file__), 'eionet_survey', 'validation_html_NRC_meeting.txt') validation_title = "Custom questionnaire HTML" manage_addPageTemplate(eionet_survey, 'validation_html', validation_title, open(validation_html).read())
def setUp(self): super(WidgetFunctionalTest, self).setUp() self.portal.gl_add_site_language('fr', 'French') addNyFolder(self.portal, 'myfolder', contributor='admin', submitted=1) releasedate = (date.today() - timedelta(days=1)).strftime('%d/%m/%Y') expirationdate = (date.today() + timedelta(days=10)).strftime('%d/%m/%Y') manage_addMegaSurvey(self.portal.myfolder, title="Test survey", releasedate=releasedate, expirationdate=expirationdate, allow_anonymous=0, contributor='admin', submitted=0) self.survey = self.portal.myfolder['test-survey'] self.diverted_mail = divert_mail() self.survey_url = 'http://localhost/portal/myfolder/test-survey' transaction.commit()
def setUp(self): super(SurveyTestCase, self).setUp() addNyFolder(self.portal, 'myfolder', contributor='admin', submitted=1) releasedate = (date.today() - timedelta(days=1)).strftime('%d/%m/%Y') expirationdate = (date.today() + timedelta(days=10)).strftime('%d/%m/%Y') manage_addMegaSurvey(self.portal.myfolder, title="Test survey", releasedate=releasedate, expirationdate=expirationdate, allow_anonymous=1, contributor='admin', submitted=1) self.survey = self.portal.myfolder['test-survey'] self.survey.addWidget(title="Question", meta_type="Naaya String Widget") manage_addSurveyAnswer(self.survey, respondent='admin', datamodel={'w_question': 'String answer...'}, anonymous_answer=True) self.survey.generateFullReport(title='Full report') self.diverted_mail = divert_mail() self.survey_url = 'http://localhost/portal/myfolder/test-survey' transaction.commit()
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)
def afterSetUp(self): self.login() id = manage_addMegaSurvey(self.portal, title='Testing survey') self.survey = self.portal._getOb(id) self.portal.manage_install_pluggableitem('Naaya Mega Survey')
def afterSetUp(self): id = manage_addMegaSurvey(self.portal, title="Testing survey") self.survey = self.portal._getOb(id) self.portal.manage_install_pluggableitem("Naaya Mega Survey")