def renderMagnifier(self, imageFile, magnifierFile): """ Renders the magnifier flash thingie """ field = self.field flashVars = { 'file': imageFile, 'width': field.width, 'height': field.height, 'borderWidth': '12', 'glassSize': field.glassSize, 'initialZoomSize': field.initialZSize, 'maxZoomSize': field.maxZSize, 'targetColor': '#FF0000'} flashVars = '&'.join( ['%s=%s' % (name, value) for name, value in flashVars.items()]) return common.flash(magnifierFile, field.width, field.height, id='magnifier%s' % self.id, params = { 'movie': magnifierFile, 'quality': 'high', 'scale': 'noscale', 'salign': 'lt', 'bgcolor': '#888888', 'FlashVars': flashVars})
def renderView(self): """ Returns an XHTML string for viewing this flash """ if self.field.flashResource: flashFile = self.field.flashResource.storageName else: flashFile = "" html = common.flash(flashFile, self.field.width, self.field.height) return html
def renderPreview(self): """ Returns an XHTML string for previewing this image """ if self.field.flashResource: flashFile = 'resources/' + self.field.flashResource.storageName else: flashFile = "" html = common.flash(flashFile, self.field.width, self.field.height) return html
def renderManifier(self, imageFile, magnifierFile): """ Renders the magnifier flash thingie """ field = self.field flashVars = ( u'value="file=%s' % imageFile, u'&width=%s&height=%s' % (field.width, field.height), u'&borderWidth=12&glassSize=%s' % self.field.glassSize, u'&initialZoomSize=%s' % field.initialZSize, u'&maxZoomSize=%s' % field.maxZSize, u'&targetColor=#FF0000" />\n') return common.flash(magnifierFile, field.width, field.height, id='magnifier%s' % self.id, params = { 'movie': magnifierFile, 'quality': 'high', 'scale': 'noscale', 'salign': 'lt', 'bgcolor': '#888888', 'FlashVars': flashVars})
def renderMP3(self, filename, mp3player): path = Path(filename) fileExtension =path.ext.lower() mp3Str_mat = common.flash(filename, self.field.width, self.field.height, id="mp3player", params = { 'movie': '%s?song_url=%s&song_title=%s' % (mp3player, filename, self.field.idevice.caption), 'quality': 'high', 'bgcolor': '#E6E6E6'}) mp3Str = """ <object class="mediaplugin mp3" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab id="mp3player" height="15" width="400"> <param name="movie" value="%(mp3player)s?song_url=%(url)s&song_title=%(caption)s"> <param name="quality" value="high"> <param name="bgcolor" value="#ffffff"> <embed src="%(mp3player)s?song_url=%(url)s&song_title=%(caption)s" quality="high" bgcolor="#FFFFFF" name="mp3player" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="15" width="400"> </object> """ % {'mp3player': mp3player, 'url': filename, 'caption': self.field.idevice.caption} wmvStr = common.flash(filename, self.field.width, self.field.height, id="mp3player", params = { 'Filename': filename, 'ShowControls': 'true', 'AutoRewind': 'true', 'AutoStart': 'false', 'AutoSize': 'true', 'EnableContextMenu': 'true', 'TransparentAtStart': 'false', 'AnimationAtStart': 'false', 'ShowGotoBar': 'false', 'EnableFullScreenControls': 'true'}) wmvStr = """ <p class="mediaplugin"> <object classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." id="msplayer" align="" type="application/x-oleobject"> <param name="Filename" value="%s"> <param name="ShowControls" value=true /> <param name="AutoRewind" value=true /> <param name="AutoStart" value=false /> <param name="Autosize" value=true /> <param name="EnableContextMenu" value=true /> <param name="TransparentAtStart" value=false /> <param name="AnimationAtStart" value=false /> <param name="ShowGotoBar" value=false /> <param name="EnableFullScreenControls" value=true /> <embed src="%s" name="msplayer" type="video/x-ms-wmv" ShowControls="1" AutoRewind="1" AutoStart="0" Autosize="0" EnableContextMenu="1" TransparentAtStart="0" AnimationAtStart="0" ShowGotoBar="0" EnableFullScreenControls="1" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"> </embed> </object></p> """ %(filename, filename) aviStr = """ <p class="mediaplugin"><object width="240" height="180"> <param name="src" value="%s"> <param name="controller" value="true"> <param name="autoplay" value="false"> <embed src="%s" width="240" height="180" controller="true" autoplay="false"> </embed> </object></p> """ % (filename, filename) mpgStr = """ <p class="mediaplugin"><object width="240" height="180"> <param name="src" value="%s"> <param name="controller" value="true"> <param name="autoplay" value="false"> <embed src="%s" width="240" height="180" controller="true" autoplay="false"> </embed> </object></p> """ % (filename, filename) wavStr = r""" <input type="button" value="Hear it" OnClick="document.getElementById('dummy_%s').innerHTML='<embed src=%s hidden=true loop=false>'" <div id="dummy_%s"></div> """ % (self.id, filename, self.id) movStr = """ <p class="mediaplugin"><object classid="CLSID:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="300" width="400" id="quicktime" align="" type="application/x-oleobject"> <param name="src" value="%s" /> <param name="autoplay" value=false /> <param name="loop" value=true /> <param name="controller" value=true /> <param name="scale" value="aspect" /> <embed src="%s" name="quicktime" type="video/quicktime" height="300" width="400" scale="aspect" autoplay="false" controller="true" loop="true" pluginspage="http://quicktime.apple.com/"> </embed> </object></p> """ %(filename, filename) mpgStr = """ <p class="mediaplugin"><object width="240" height="180"> <param name="src" value="%s"> <param name="controller" value="true"> <param name="autoplay" value="false"> <embed src="%s" width="240" height="180" controller="true" autoplay="false"> </embed> </object></p> """ if fileExtension == ".mp3": return mp3Str elif fileExtension == ".wav": return wavStr elif fileExtension == ".wmv" or fileExtension == ".wma": return wmvStr elif fileExtension == ".mov": return movStr elif fileExtension == ".avi": return aviStr else: return ""