# -*- coding: utf-8
# 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
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 ylesanneteTolkegaTyybid2(self, REQUEST):
"Ülesannete tüübid tõlgituna, vana koopia"
self.get_lang(('ivatests',), REQUEST)
tulemus={
"ValikYlesanne": REQUEST['L_it_check_exercise'],
"TekstivastusegaYlesanne": REQUEST['L_it_text_answer_exercise'],
"YksikvalikYlesanne": REQUEST['L_it_one_answer_exercise'],
"MitmikvalikYlesanne": REQUEST['L_it_multiple_choice_exercise'],
"OigeTekstivastusegaYlesanne": REQUEST['L_it_one_answer'],
"ArvuvahemikuliseVastusegaYlesanne": REQUEST["L_it_number_space_exercise"],
"ProtsentYlesanne": REQUEST["L_it_percent_excercise"] ,
"VastavusYlesanne": REQUEST["L_it_matching_exercise"],
}
return tulemus
def ylesanneteTolkegaTyybid(self, REQUEST):
"Tüübid tõlgituna, ZPT tarbeks"
tulemus={
"ValikYlesanne": translate(self, 'check_exercise', target=self.giveLanguage(REQUEST)),
"TekstivastusegaYlesanne": translate(self, 'text_answer_exercise', target=self.giveLanguage(REQUEST)),
"YksikvalikYlesanne": translate(self, 'one_answer_exercise', target=self.giveLanguage(REQUEST)),
"MitmikvalikYlesanne": translate(self, 'multiple choice', target=self.giveLanguage(REQUEST)),
"OigeTekstivastusegaYlesanne": translate(self, 'one answer', target=self.giveLanguage(REQUEST)),
"ArvuvahemikuliseVastusegaYlesanne": translate(self, 'number space', target=self.giveLanguage(REQUEST)),
"ProtsentYlesanne": translate(self, 'percent exercise', target=self.giveLanguage(REQUEST)),
"VastvusYlesanne": translate(self, 'matcing exercise', target=self.giveLanguage(REQUEST))
}
return tulemus
def tekstistYlesanneteLaadimiseVorm(self, REQUEST):
"Tekstiala sisestuseks"
tulemus=YlTest.leheAlgus(self, REQUEST)+\
"
"
for x in self.ylesanneteTyybid:
tulemus=tulemus+"\n"+\
("%s " % (x, x))
return tulemus
def ylesanneteTyybidValikuna(self, REQUEST):
"Valikmenüü ülesannete lisamiseks"
self.get_lang(('ivatests',), REQUEST)
andmed=self.ylesanneteTolkegaTyybid(REQUEST)
tulemus="