# -*- coding: utf-8 # Copyright 2006 by Meelis Mets from Products.Archetypes.public import BaseSchema, Schema from Products.Archetypes.public import BooleanField, ImageField, StringField, FileField from Products.Archetypes.public import BooleanWidget, ImageWidget, StringWidget, SelectionWidget, FileWidget 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 BaseTest import BaseStimulus schema = BaseStimulus.schema.copy() + Schema(( BooleanField('displayAllPictures', accessor = 'getDisplayAllPictures', widget = BooleanWidget( label = 'Display all pictures', label_msgid='label_display_all_pictures', description = 'Check if you want to dispaly all pictures in same time, other way pictures are shown separatly', description_msgid = 'desc_display_all_pictures', i18n_domain="psyhvel", visible = {'view': 'invisible', 'edit':'visible'}, ), ), StringField('tableWidth', accessor = 'getTableWidth', vocabulary = 'getNumbers', default = '4', widget = SelectionWidget( format = 'select', label = 'Table width', label_msgid='label_table_width', description = 'How many objects are in table by horizontally', description_msgid = 'desc_table_width', i18n_domain="psyhvel", visible = {'view': 'invisible', 'edit':'visible'}, ), ), StringField('tableHeight', accessor = 'getTableHeight', vocabulary = 'getNumbers', default = '4', widget = SelectionWidget( format = 'select', label = 'Table height', label_msgid='label_table_height', description = 'How many objects are in table by vertically', description_msgid = 'desc_table_height', i18n_domain="psyhvel", visible = {'view': 'invisible', 'edit':'visible'}, ), ), BooleanField('tableHasBorder', accessor = 'getTableHasBorder', widget = BooleanWidget( label = 'Objects in table have border', label_msgid='label_table_has_border', description = 'Check if you want to add border to objects', description_msgid = 'desc_table_has_border', i18n_domain="psyhvel", visible = {'view': 'invisible', 'edit':'visible'}, ), ), )) schema.moveField('time', pos='bottom') class MultiPictureStimulus(BaseStimulus): """ Multi Picture stimulus""" meta_type = "MultiPictureStimulus" archetype_name = "Multi Picture Stimulus" global_allow = 0 exclude_from_nav = True filter_content_types = True allowed_content_types = ('ChoiceObject',) security = ClassSecurityInfo() schema = schema actions = ( { 'id':'view', 'name':'View', 'action':'string:${object_url}/multi_picture_stimulus', 'permissions': ('View',), }, { 'id':'edit', 'name':'Configuration', 'action':'string:${object_url}/base_edit', 'permissions': ('Modify portal content',), }, { 'id':'choices', 'name':'Choices', 'action':'string:${object_url}/objects_view', '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() xml += '\n' xml += '\n' xml += '\n' xml += '\n' xml += '\n' xml += '\n' xml += '' return [xml, files] registerType(MultiPictureStimulus, PROJECT_NAME)