[Erp5-report] r43345 kazuhiko - in /erp5/trunk/products/ERP5Form: AudioField.py VideoField.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 15 12:11:14 CET 2011
Author: kazuhiko
Date: Tue Feb 15 12:11:14 2011
New Revision: 43345
URL: http://svn.erp5.org?rev=43345&view=rev
Log:
make autoplay, controls, loop and preload boolean so that we can enable/disable appropriately.
Modified:
erp5/trunk/products/ERP5Form/AudioField.py
erp5/trunk/products/ERP5Form/VideoField.py
Modified: erp5/trunk/products/ERP5Form/AudioField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/AudioField.py?rev=43345&r1=43344&r2=43345&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/AudioField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/AudioField.py [utf8] Tue Feb 15 12:11:14 2011
@@ -13,10 +13,10 @@ class AudioWidget(Widget.TextWidget):
['audio_controls', 'audio_error_message', 'audio_loop', \
'audio_preload', 'audio_autoplay', 'js_enabled', 'audio_player']
- audio_controls = fields.StringField('audio_controls',
+ audio_controls = fields.CheckBoxField('audio_controls',
title='Audio Controls',
description=("Controls to be used in Audio Player."),
- default='controls',
+ default=1,
required=0)
audio_error_message = fields.StringField('audio_error_message',
@@ -26,25 +26,25 @@ class AudioWidget(Widget.TextWidget):
default='Your browser does not support audio tag.',
required=0)
- audio_loop = fields.StringField('audio_loop',
+ audio_loop = fields.CheckBoxField('audio_loop',
title='Audio Loop',
description=("Specifies that the audio file \
will start over again, every time it is finished."),
- default='none',
+ default=0,
required=0)
- audio_preload = fields.StringField('audio_preload',
+ audio_preload = fields.CheckBoxField('audio_preload',
title='Audio Preload',
description=("Configure that you would like to \
start downloading the audio file as soon as possible."),
- default='preload',
+ default=1,
required=0)
- audio_autoplay = fields.StringField('audio_autoplay',
+ audio_autoplay = fields.CheckBoxField('audio_autoplay',
title='Audio Autoplay',
description=("Configure that you would like to \
start downloading and playing the audio file as soon as possible."),
- default='',
+ default=0,
required=0)
js_enabled = fields.CheckBoxField('js_enabled',
@@ -71,14 +71,20 @@ class AudioWidget(Widget.TextWidget):
return ''
audio_player = field.get_value('audio_player')
if audio_player == 'html5_audio':
+ extra_kw = {}
+ if field.get_value('audio_autoplay'):
+ extra_kw['autoplay']='autoplay'
+ if field.get_value('audio_controls'):
+ extra_kw['controls']='controls'
+ if field.get_value('audio_loop'):
+ extra_kw['loop']='loop'
+ if field.get_value('audio_preload'):
+ extra_kw['preload']='preload'
return Widget.render_element("audio",
src=value,
extra=field.get_value('extra'),
- controls=field.get_value('audio_controls'),
- loop=field.get_value('audio_loop'),
- preload=field.get_value('audio_preload'),
- autoplay=field.get_value('audio_autoplay'),
- contents=field.get_value('audio_error_message'))
+ contents=field.get_value('audio_error_message'),
+ **extra_kw)
elif audio_player == 'flowplayer':
a_element = Widget.render_element("a",
href="%s" % value,
Modified: erp5/trunk/products/ERP5Form/VideoField.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/VideoField.py?rev=43345&r1=43344&r2=43345&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/VideoField.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/VideoField.py [utf8] Tue Feb 15 12:11:14 2011
@@ -14,10 +14,10 @@ class VideoWidget(Widget.TextWidget):
'video_width', 'video_height', 'video_preload', \
'video_autoplay', 'js_enabled', 'video_player']
- video_controls = fields.StringField('video_controls',
+ video_controls = fields.CheckBoxField('video_controls',
title='Video Controls',
description=("Controls to be used in Video Player."),
- default='controls',
+ default=1,
required=0)
video_error_message = fields.StringField('video_error_message',
@@ -27,11 +27,11 @@ class VideoWidget(Widget.TextWidget):
default='Your browser does not support video tag.',
required=0)
- video_loop = fields.StringField('video_loop',
+ video_loop = fields.CheckBoxField('video_loop',
title='Video Loop',
description=("Specifies that the video file \
will start over again, every time it is finished."),
- default='none',
+ default=0,
required=0)
video_width = fields.IntegerField('video_width',
@@ -48,18 +48,18 @@ class VideoWidget(Widget.TextWidget):
default=85,
required=0)
- video_preload = fields.StringField('video_preload',
+ video_preload = fields.CheckBoxField('video_preload',
title='Video Preload',
description=("Configure that you would like to \
start downloading the video file as soon as possible."),
- default='preload',
+ default=1,
required=0)
- video_autoplay = fields.StringField('video_autoplay',
+ video_autoplay = fields.CheckBoxField('video_autoplay',
title='Video Autoplay',
description=("Configure that you would like to \
start downloading and playing the video file as soon as possible."),
- default='',
+ default=0,
required=0)
js_enabled = fields.CheckBoxField('js_enabled',
@@ -86,16 +86,22 @@ class VideoWidget(Widget.TextWidget):
return ''
video_player = field.get_value('video_player')
if video_player == 'html5_video':
+ extra_kw = {}
+ if field.get_value('video_autoplay'):
+ extra_kw['autoplay']='autoplay'
+ if field.get_value('video_controls'):
+ extra_kw['controls']='controls'
+ if field.get_value('video_loop'):
+ extra_kw['loop']='loop'
+ if field.get_value('video_preload'):
+ extra_kw['preload']='preload'
return Widget.render_element("video",
src=value,
extra=field.get_value('extra'),
- controls=field.get_value('video_controls'),
- loop=field.get_value('video_loop'),
width=field.get_value('video_width'),
height=field.get_value('video_height'),
- preload=field.get_value('video_preload'),
- autoplay=field.get_value('video_autoplay'),
- contents=field.get_value('video_error_message'))
+ contents=field.get_value('video_error_message'),
+ **extra_kw)
elif video_player == 'flowplayer':
a_element = Widget.render_element("a",
href="%s" % value,
More information about the Erp5-report
mailing list