diff --git a/knowledge/README.txt b/knowledge/README.txt index fdcc130..1617034 100644 --- a/knowledge/README.txt +++ b/knowledge/README.txt @@ -190,6 +190,8 @@ Survey >>> from loops.knowledge.tests import importSurvey >>> importSurvey(loopsRoot) + >>> from loops.knowledge.survey.browser import SurveyView + Fin de partie ============= diff --git a/knowledge/data/survey_de.dmp b/knowledge/data/survey_de.dmp index 1ace35b..a094261 100644 --- a/knowledge/data/survey_de.dmp +++ b/knowledge/data/survey_de.dmp @@ -1,5 +1,5 @@ # survey types -type(u'questionnaire', u'Fragebogen', viewName=u'', +type(u'questionnaire', u'Fragebogen', viewName=u'survey.html', typeInterface=u'loops.knowledge.survey.interfaces.IQuestionnaire', options=u'action.portlet:create_subtype,edit_concept') type(u'questiongroup', u'Fragengruppe', viewName=u'', diff --git a/knowledge/survey/base.py b/knowledge/survey/base.py index fe6c05d..c156d7e 100644 --- a/knowledge/survey/base.py +++ b/knowledge/survey/base.py @@ -25,7 +25,7 @@ from zope.interface import implementer, implements from cybertools.knowledge.survey.questionnaire import Questionnaire, \ QuestionGroup, Question, FeedbackItem -from loops.common import AdapterBase +from loops.common import adapted, AdapterBase from loops.knowledge.survey.interfaces import IQuestionnaire, \ IQuestionGroup, IQuestion, IFeedbackItem from loops.type import TypeInterfaceSourceList @@ -44,6 +44,17 @@ class Questionnaire(AdapterBase, Questionnaire): 'questionGroups', 'questions', 'responses',) _noexportAttributes = _adapterAttributes + @property + def questionGroups(self): + return [adapted(c) for c in self.context.getChildren()] + + @property + def questions(self): + for qug in self.questionGroups: + for qu in qug.questions: + qu.questionnaire = self + yield qu + class QuestionGroup(AdapterBase, QuestionGroup): @@ -54,6 +65,14 @@ class QuestionGroup(AdapterBase, QuestionGroup): 'questionnaire', 'questions', 'feedbackItems',) _noexportAttributes = _adapterAttributes + @property + def subobjects(self): + return [adapted(c) for c in self.context.getChildren()] + + @property + def questions(self): + return [obj for obj in self.subobjects if IQuestion.providedBy(obj)] + class Question(AdapterBase, Question): @@ -64,6 +83,10 @@ class Question(AdapterBase, Question): 'text', 'questionnaire', 'answerRange', 'feedbackItems',) _noexportAttributes = _adapterAttributes + @property + def text(self): + return self.context.description + class FeedbackItem(AdapterBase, FeedbackItem): diff --git a/knowledge/survey/browser.py b/knowledge/survey/browser.py new file mode 100644 index 0000000..57072dc --- /dev/null +++ b/knowledge/survey/browser.py @@ -0,0 +1,40 @@ +# +# Copyright (c) 2013 Helmut Merz helmutm@cy55.de +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +""" +Definition of view classes and other browser related stuff for +surveys and self-assessments. +""" + +from zope.app.pagetemplate import ViewPageTemplateFile +from zope.cachedescriptors.property import Lazy + +from loops.browser.concept import ConceptView +from loops.organize.party import getPersonForUser + + +template = ViewPageTemplateFile('view_macros.pt') + +class SurveyView(ConceptView): + + tabview = 'index.html' + + @Lazy + def macro(self): + return template.macros['survey'] + diff --git a/knowledge/survey/configure.zcml b/knowledge/survey/configure.zcml index d682b51..81c33d3 100644 --- a/knowledge/survey/configure.zcml +++ b/knowledge/survey/configure.zcml @@ -3,6 +3,8 @@ xmlns:browser="http://namespaces.zope.org/browser" i18n_domain="loops"> + + @@ -19,4 +21,14 @@ factory="loops.knowledge.survey.base.FeedbackItem" provides="loops.knowledge.survey.interfaces.IFeedbackItem" /> + + + + diff --git a/knowledge/survey/view_macros.pt b/knowledge/survey/view_macros.pt new file mode 100644 index 0000000..44198bc --- /dev/null +++ b/knowledge/survey/view_macros.pt @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + +
+ + + + + +
Does not applyFully applies
+
+ +   +   + +
+
+ + + diff --git a/locales/de/LC_MESSAGES/loops.mo b/locales/de/LC_MESSAGES/loops.mo index 79c436f..b9a8f3d 100644 Binary files a/locales/de/LC_MESSAGES/loops.mo and b/locales/de/LC_MESSAGES/loops.mo differ diff --git a/locales/de/LC_MESSAGES/loops.po b/locales/de/LC_MESSAGES/loops.po index 4a6cfed..22a1519 100644 --- a/locales/de/LC_MESSAGES/loops.po +++ b/locales/de/LC_MESSAGES/loops.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: 0.13.0\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n" -"PO-Revision-Date: 2013-02-26 12:00 CET\n" +"PO-Revision-Date: 2013-03-07 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -184,6 +184,12 @@ msgstr "Negativbewertung" msgid "Value inversion: High selection means low value." msgstr "Invertierung der Bewertung: Hohe gewählte Stufe bedeutet niedriger Wert." +msgid "Does not apply" +msgstr "Trifft nicht zu" + +msgid "Fully applies" +msgstr "Trifft voll zu" + # competence (qualification) msgid "Validity Period (Months)" diff --git a/organize/tracking/browser.py b/organize/tracking/browser.py index f5743ea..c2f3b69 100644 --- a/organize/tracking/browser.py +++ b/organize/tracking/browser.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2008 Helmut Merz helmutm@cy55.de +# Copyright (c) 2013 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,9 +17,7 @@ # """ -View class(es) for change tracks. - -$Id$ +View classes for tracks. """ from zope import component