/* * Copyright 2007-2011 Charles du Jeu * This file is part of AjaXplorer. * * AjaXplorer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * AjaXplorer 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with AjaXplorer. If not, see . * * The latest code can be found at . */ Class.create("AudioPreviewer", AbstractEditor, { fullscreenMode: false, initialize: function($super, oFormObject){ }, getPreview : function(ajxpNode, rich){ if(rich){ var escapedFilename = base64_encode(ajxpNode.getPath()); var player = 'dewplayer-bubble.swf'; var flashVars = 'mp3='+ajxpBootstrap.parameters.get('ajxpServerAccess')+'%26get_action=audio_proxy%26file='+escapedFilename+'&showtime=1'; var playerWidth = '250'; var playerHeight = '65'; var containerStyle = 'padding:5 0px; margin-bottom: 5px;'; if(!rich){ player = 'dewplayer.swf'; flashVars = 'mp3='+ajxpBootstrap.parameters.get('ajxpServerAccess')+'%26get_action=audio_proxy%26file='+escapedFilename+'&nopointer=1'; playerWidth = '40'; playerHeight = '20'; containerStyle = ''; } var div = new Element('div', {id:"mp3_container", style:"text-align:center;"+containerStyle}); var content = ''; content += ''; content += ''; content += ''; content += ''; div.update(content); if(rich){ div.resizePreviewElement = function(dimensionObject){}; }else{ div.resizePreviewElement = function(dimensionObject){ var imgDim = {width:800, height:400}; var styleObj = fitRectangleToDimension(imgDim, dimensionObject); // fix width artificially if(div.getOffsetParent()){ styleObj.width = div.getOffsetParent().getWidth()-2 + 'px'; } div.setStyle(styleObj); }; } return div; }else{ return new Element('img', {src:resolveImageSource(ajxpNode.getIcon(),'/images/mimes/ICON_SIZE',64),align:"absmiddle"}); } }, getThumbnailSource : function(ajxpNode){ return resolveImageSource(ajxpNode.getIcon(),'/images/mimes/ICON_SIZE',64); }, createFolderPlayer : function(ajxpNode){ var template = new Template('#{window_title}
#{window_title}
#{reading_folder}: #{current_folder}
'); var newWin = window.open('#', '_blank', 'width=260,height=270,directories=no,location=no,menubar=no,resizeable=yes,scrollbars=no,status=no,toolbar=no'); try{ var playlist_url = ajxpBootstrap.parameters.get('ajxpServerAccess')+'%26get_action=ls%26skip_history=true%26playlist=true%26dir='+base64_encode(ajxpNode.getPath()); newWin.document.write(template.evaluate({ window_title : "AjaXplorer MP3 Player", reading_folder : MessageHash[141], playlist_url:playlist_url, current_folder:ajxpNode.getLabel() })); newWin.document.close(); }catch(e){ alert(e); } } });