# -*- coding: utf-8
# Copyright 2006 by Meelis Mets
from Products.Archetypes.public import BaseSchema, Schema
from Products.Archetypes.public import BooleanField, ImageField, StringField, FileField, TextField
from Products.Archetypes.public import BooleanWidget, ImageWidget, StringWidget, SelectionWidget, FileWidget, RichWidget
from Products.Archetypes.public import BaseContent, registerType
from Globals import InitializeClass
from Products.CMFCore.utils import getToolByName
from AccessControl import ClassSecurityInfo, Unauthorized
from config import PROJECT_NAME
from BaseFunctions import BaseFunctions
from BaseTest import BaseTask
schema = BaseSchema + BaseTask.schema.copy() + Schema((
FileField('testSoundFile',
accessor = 'getTestSoundFile',
required = 0,
widget = FileWidget(
label = 'Test sound file',
description = 'Upload test sound file here, or default sound file will be used',
label_mgsid = 'label_sound_file',
description_msgid = 'desc_sound_file',
i18n_domain = 'psyhvel',
visible = {'view':'invisible', 'edit':'visible'}
),
),
))
schema.delField('multipleChoice')
schema.delField('answerRequired')
schema.delField('time')
class SoundTesting(BaseContent, BaseFunctions):
""" Psyhvel sound testing"""
meta_type = "SoundTesting"
archetype_name = "Sound Testing"
global_allow = 0
exclude_from_nav = True
filter_content_types = True
allowed_content_types = ()
security = ClassSecurityInfo()
schema = schema
actions = (
{
'id':'view',
'name':'View',
'action':'string:${object_url}/sound_testing',
'permissions': ('View',),
},
{
'id':'edit',
'name':'Configuration',
'action':'string:${object_url}/base_edit',
'permissions': ('Modify portal content',),
},
{
'id':'metadata',
'name':'Info',
'action':'string:${object_url}/base_metadata',
'permissions': ('Modify portal content',),
},
)
def getObjectsXML(self, files):
"""special xml"""
xml = self.getBaseXML()
snd = self.getField('testSoundFile')
fname = snd.getFilename(self)
soundfile = snd.getBaseUnit(self)
xml += '\n'
xml += '\n'
xml += ''
files.append({'filename':fname, 'file':str(soundfile)})
return [xml, files]
registerType(SoundTesting, PROJECT_NAME)