# -*- coding: utf-8
# $Id$
#
# Copyright 2001, 2002 by IVA Team and contributors
#
# This file is part of IVA.
#
# IVA 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.
#
# IVA 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 IVA; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
__version__ = "$Revision$"[11:-2]
import AccessControl
import OFS, Globals
import types
import YlTest
#import TestiYlesanne
from OFS import SimpleItem
from TraversableWrapper import Traversable
from Globals import Persistent
from AccessControl import ClassSecurityInfo
from Cruft import Cruft
from common import translate
class YlVahendus(
Persistent,
OFS.SimpleItem.Item,
Traversable,
AccessControl.Role.RoleManager,
Cruft
):
"Ülesannete import/eksport, loomine"
ylesanneteTyybid=("ValikYlesanne","TekstivastusegaYlesanne",
"YksikvalikYlesanne", "MitmikvalikYlesanne",
"OigeTekstivastusegaYlesanne", "ArvuvahemikuliseVastusegaYlesanne",
"ProtsentYlesanne", "VastavusYlesanne")
def ylesanneteTolkegaTyybid(self, REQUEST):
"Tüübid tõlgituna, ZPT tarbeks"
tulemus={
"ValikYlesanne": "Yes/No",
"TekstivastusegaYlesanne": "Paragraph",
"YksikvalikYlesanne": "Multiple choice",
"MitmikvalikYlesanne": "Mark all correct", # see on vale?"Multiple choice",
"OigeTekstivastusegaYlesanne": "Short answer",
"ArvuvahemikuliseVastusegaYlesanne": "Numerical",
"ProtsentYlesanne": "Percent",
"VastavusYlesanne": "Matching"
}
return tulemus
def tekstistYlesanneteLaadimiseVorm(self, REQUEST):
"Tekstiala sisestuseks"
tulemus="
"
for x in self.ylesanneteTyybid:
tulemus=tulemus+"\n"+\
("%s " % (x, x))
return tulemus
def ylesanneteTyybidValikuna(self, REQUEST):
"Valikmenüü ülesannete lisamiseks"
#XXX: not used?
andmed=self.ylesanneteTolkegaTyybid(REQUEST)
tulemus="
"+translate(self, 'editing quiz')+"
"
return tulemus
def lisaUusYlesanne(self, REQUEST, tyyp):
"Ülesande uus eksemplar"
import YlTyybid
from YlTyybid import *
if tyyp=='ValikYlesanne':
return ValikYlesanne(translate(self, 'Question text'))
if tyyp=='TekstivastusegaYlesanne':
return TekstivastusegaYlesanne(translate(self, 'Question text'))
if tyyp=='YksikvalikYlesanne':
return YksikvalikYlesanne(translate(self, 'Question text'))
if tyyp=='OigeTekstivastusegaYlesanne':
return OigeTekstivastusegaYlesanne(translate(self, "Question text"))
if tyyp=='MitmikvalikYlesanne':
return MitmikvalikYlesanne(translate(self, "Question text"))
if tyyp=='ArvuvahemikuliseVastusegaYlesanne':
return ArvuvahemikuliseVastusegaYlesanne(translate(self, "Question text"))
if tyyp=='ProtsentYlesanne':
return ProtsentYlesanne(translate(self, "Find the missing component"))
if tyyp=='VastavusYlesanne':
return VastavusYlesanne(translate(self, "Match the pairs"))
Globals.InitializeClass(YlVahendus)
Globals.default__class_init__(YlVahendus)