From 54253ee6643636ccf01a8cb9b7419dab0c44cb20 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 24 Feb 2013 16:23:41 +0100 Subject: [PATCH] class definitions for survey/self assessment basically working --- knowledge/data/survey_de.dmp | 7 ++++--- knowledge/survey/base.py | 12 ++++++++++++ knowledge/survey/interfaces.py | 22 +++++++++++++--------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/knowledge/data/survey_de.dmp b/knowledge/data/survey_de.dmp index db077af..1ace35b 100644 --- a/knowledge/data/survey_de.dmp +++ b/knowledge/data/survey_de.dmp @@ -4,13 +4,14 @@ type(u'questionnaire', u'Fragebogen', viewName=u'', options=u'action.portlet:create_subtype,edit_concept') type(u'questiongroup', u'Fragengruppe', viewName=u'', typeInterface=u'loops.knowledge.survey.interfaces.IQuestionGroup', - options=u'action.portlet:create_subtype,edit_concept') + options=u'action.portlet:create_subtype,edit_concept\nchildren_append\nshow_navigation') type(u'question', u'Frage', viewName=u'', typeInterface=u'loops.knowledge.survey.interfaces.IQuestion', - options=u'action.portlet:create_subtype,edit_concept') + options=u'action.portlet:edit_concept\nshow_navigation') + #options=u'action.portlet:create_subtype,edit_concept') type(u'feedbackitem', u'Feedback-Element', viewName=u'', typeInterface=u'loops.knowledge.survey.interfaces.IFeedbackItem', - options=u'action.portlet:edit_concept') + options=u'action.portlet:edit_concept\nshow_navigation') # subtypes #child(u'questionnaire', u'questionnaire', u'issubtype') diff --git a/knowledge/survey/base.py b/knowledge/survey/base.py index c67bd96..fe6c05d 100644 --- a/knowledge/survey/base.py +++ b/knowledge/survey/base.py @@ -40,6 +40,9 @@ class Questionnaire(AdapterBase, Questionnaire): implements(IQuestionnaire) _contextAttributes = list(IQuestionnaire) + _adapterAttributes = AdapterBase._adapterAttributes + ( + 'questionGroups', 'questions', 'responses',) + _noexportAttributes = _adapterAttributes class QuestionGroup(AdapterBase, QuestionGroup): @@ -47,6 +50,9 @@ class QuestionGroup(AdapterBase, QuestionGroup): implements(IQuestionGroup) _contextAttributes = list(IQuestionGroup) + _adapterAttributes = AdapterBase._adapterAttributes + ( + 'questionnaire', 'questions', 'feedbackItems',) + _noexportAttributes = _adapterAttributes class Question(AdapterBase, Question): @@ -54,6 +60,9 @@ class Question(AdapterBase, Question): implements(IQuestion) _contextAttributes = list(IQuestion) + _adapterAttributes = AdapterBase._adapterAttributes + ( + 'text', 'questionnaire', 'answerRange', 'feedbackItems',) + _noexportAttributes = _adapterAttributes class FeedbackItem(AdapterBase, FeedbackItem): @@ -61,4 +70,7 @@ class FeedbackItem(AdapterBase, FeedbackItem): implements(IFeedbackItem) _contextAttributes = list(IFeedbackItem) + _adapterAttributes = AdapterBase._adapterAttributes + ( + 'text',) + _noexportAttributes = _adapterAttributes diff --git a/knowledge/survey/interfaces.py b/knowledge/survey/interfaces.py index d32b2a4..ea15928 100644 --- a/knowledge/survey/interfaces.py +++ b/knowledge/survey/interfaces.py @@ -25,15 +25,18 @@ from zope import interface, component, schema from cybertools.knowledge.survey import interfaces from loops.interfaces import IConceptSchema +from loops.util import _ class IQuestionnaire(IConceptSchema, interfaces.IQuestionnaire): """ A collection of questions for setting up a survey. """ - defaultAnswerOptions = Attribute('A sequence of answer options to select from. ' - 'Default value used for questions that do not ' - 'explicitly provide the values attribute.') + defaultAnswerRange = schema.Int( + title=_(u'Answer Range'), + description=_(u'Number of items (answer options) to select from.'), + default=4, + required=True) class IQuestionGroup(IConceptSchema, interfaces.IQuestionGroup): @@ -45,8 +48,11 @@ class IQuestion(IConceptSchema, interfaces.IQuestion): """ A single question within a questionnaire. """ - text = Attribute('The question asked.') - answerOptions = Attribute('A sequence of answer options to select from.') + revertAnswerOptions = schema.Bool( + title=_(u'Negative'), + description=_(u'Value inversion: High selection means low value.'), + default=False, + required=False) class IFeedbackItem(IConceptSchema, interfaces.IFeedbackItem): @@ -54,8 +60,6 @@ class IFeedbackItem(IConceptSchema, interfaces.IFeedbackItem): that may be deduced from the res)ponses to a questionnaire. """ - text = Attribute('A text representing this result element.') - class IResponse(interfaces.IResponse): """ A set of response values given to the questions of a questionnaire @@ -64,6 +68,6 @@ class IResponse(interfaces.IResponse): class IResponses(Interface): - """ A container of manager of survey responses. + """ A container or manager of survey responses. """ - +