From: riccardo Date: Mon, 16 May 2011 18:13:11 +0000 (+0200) Subject: added: X-Git-Tag: 1.1~176 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=ac1195837b101bb460bbd0da311cd734ea9049c4;p=telemeta.git added: - markers "logged as" normal/user/superuser cases - marker url selects a marker fixed: - volume click on IE (fixed) --- diff --git a/telemeta/htdocs/js/application.js b/telemeta/htdocs/js/application.js index da7a2421..26f4bff1 100644 --- a/telemeta/htdocs/js/application.js +++ b/telemeta/htdocs/js/application.js @@ -279,12 +279,10 @@ function loadScripts(){ if(loadInSeries){ var load = function(index){ if(index').attr('tabindex','0').addClass("markerdiv").html('
'+ - ''+ - ''+ - ''+ - ''+ - 'EDIT'+ - ''+ - '
'+ - '
'+ - '
OK
'+ - '
'+gettrans('author')+': '+marker.author+'
'); //TODO: avoid text nodes + //create html content. Use array.join cause it is usually faster than string concatenation: + var html_ = ['
', //whitespace no wrap is really important to keep all content of first div on one line (without it, IE displays it on 2 lines) + '', + '', + '', + '', + 'EDIT', + '', + '
', + '
', + '
OK
', + '
'+gettrans('author')+': '+marker.author+'
'].join(""); + var div = this.$J('
').attr('tabindex','0').addClass("markerdiv").html(html_); //TODO: avoid text nodes div.find('a').attr('href','#'); //todo: remove markerlabel from css!!!!!!! //new RulerMarker(div.find('.markerlbl'),div.find('.markercanvas'),'marker',false); @@ -243,11 +237,7 @@ var MarkerMapDiv = TimesideArray.extend({ e_descriptionText.attr('readonly','readonly').addClass('markersdivUneditable').unbind('focus'); e_titleText.attr('readonly','readonly').addClass('markersdivUneditable').unbind('focus'); - //add to playlist always visible, provided that it is saved on server AND current user is logged - //(getCurrentUserName evaluates to true) - // if(!marker.isSavedOnServer || !this.getCurrentUserName()){ - // e_addplaylistButton.hide(); - // }else{ + e_addplaylistButton.unbind('click').bind('click',function(evtObj_){ if(!marker.isSavedOnServer){ return false; @@ -255,21 +245,19 @@ var MarkerMapDiv = TimesideArray.extend({ //make a request to the server to get the pk (id) //note that marker.id (client side) is marker.public_id (server side) json([marker.id],"telemeta.get_marker_id", function(data){ - consolelog('received'); - consolelog(data); var id = data.result; playlistUtils.showAddResourceToPlaylist(e_addplaylistButton,'marker',""+id,gettrans('marker added to the selected playlist')); }); return false; }); - if(!this.getCurrentUserName()){ + if(!marker.canBeAddedToPlaylist){ e_addplaylistButton.hide(); } - if(!marker.isEditable){ //marker is editable means that author == getCurrentUserName(). addToPlaylist - //visibility is skipped because it depends on other circumstances (see above) + if(!marker.isEditable){ //marker is editable means that author is superuser or author == getCurrentUserName(). + //addToPlaylist visibility is skipped because it depends on other circumstances (see above) e_editButton.hide(); e_deleteButton.hide(); //we unbind events to be sure diff --git a/telemeta/htdocs/timeside/js/markermap.js b/telemeta/htdocs/timeside/js/markermap.js index d088b30f..8132b6e4 100644 --- a/telemeta/htdocs/timeside/js/markermap.js +++ b/telemeta/htdocs/timeside/js/markermap.js @@ -12,7 +12,7 @@ */ var MarkerMap = TimesideArray.extend({ - init: function(itemId, currentUserName) { + init: function(itemId, currentUserName, isStaffOrSuperuser) { this._super(); var ui = uniqid; //defined in application.js (global vars and functions) this.uniqid = function(){ @@ -24,6 +24,9 @@ var MarkerMap = TimesideArray.extend({ this.getCurrentUserName = function(){ return currentUserName; } + this.isCurrentUserStaffOrSuperuser = function(){ + return isStaffOrSuperuser; + } var me = this; var confirmExit = function(){ @@ -33,7 +36,6 @@ var MarkerMap = TimesideArray.extend({ markerUnsaved++; } }); - consolelog(markerUnsaved); if(markerUnsaved>0){ return gettrans('there is at least one unsaved marker') +' ('+ markerUnsaved+ '). '+ gettrans('If you exit the page you will loose your changes'); @@ -80,8 +82,10 @@ var MarkerMap = TimesideArray.extend({ argument = pFloat(argument); } var currentUserName = this.getCurrentUserName(); + var isStaffOrSuperuser = this.isCurrentUserStaffOrSuperuser(); if(typeof argument == 'object'){ - var editable = currentUserName === argument.author; + var editable = isStaffOrSuperuser || currentUserName === argument.author; + var canBeAddedToPlaylist_ = currentUserName ? true : false; marker = { id: argument.public_id, offset: pFloat(argument.time), //IMPORTANT: IT IS A STRING!!!!!! @@ -89,6 +93,7 @@ var MarkerMap = TimesideArray.extend({ title: argument.title, author: argument.author, isEditable: editable, + canBeAddedToPlaylist: canBeAddedToPlaylist_, isSavedOnServer: true }; }else if(typeof argument == 'number'){ @@ -99,6 +104,7 @@ var MarkerMap = TimesideArray.extend({ title: "", author: currentUserName, isEditable: true, + canBeAddedToPlaylist: true, isSavedOnServer: false }; } @@ -125,10 +131,6 @@ var MarkerMap = TimesideArray.extend({ idx = this.insertionIndex(identifier); } if(idx<0 || idx>=this.length){ - this.each(function(i,m){ - consolelog(m); - }); - consolelog(identifier); //TODO: handle error this.debug('remove: marker not found'); return; diff --git a/telemeta/htdocs/timeside/js/player.js b/telemeta/htdocs/timeside/js/player.js index 3a9d8620..e69b94c5 100644 --- a/telemeta/htdocs/timeside/js/player.js +++ b/telemeta/htdocs/timeside/js/player.js @@ -2,7 +2,7 @@ var Player = TimesideClass.extend({ //sound duration is in milliseconds because the soundmanager has that unit, //player (according to timeside syntax) has durations in seconds - init: function(container, sound, soundDurationInMsec, itemId, visualizers, currentUserName) { + init: function(container, sound, soundDurationInMsec, itemId, visualizers, currentUserName, isStaffOrSuperUser) { this._super(); this.ready = false; var player = this; @@ -126,7 +126,7 @@ var Player = TimesideClass.extend({ ruler.movePointer(sPos); } - player.showMarkerPopup(currentMarkerIndex); + //player.showMarkerPopup(currentMarkerIndex); }, onfinish: function() { setPos(0); //reset position, not cursor, so that clicking play restarts from zero @@ -134,9 +134,7 @@ var Player = TimesideClass.extend({ }; //internal play function. Set all properties and play: var play_ = function(sound, positionInSec){ - //consolelog('position is '+positionInSec+' sec'); sound.setPosition(toMsec(positionInSec)); //TODO: remove??? - //consolelog('sound position is '+sound.position+' msec'); sound.setVolume(sound.volume); //workaround. Just to be sure. Sometimes it fails when we re-play playOptions.position = toMsec(positionInSec); //apparently THIS IS WORKING sound.play(playOptions); @@ -159,34 +157,31 @@ var Player = TimesideClass.extend({ }; //initializing markermap and markerui - var map = new MarkerMap(this.getItemId(), currentUserName); + var map = new MarkerMap(this.getItemId(), currentUserName, isStaffOrSuperUser); this.getMarkerMap = function(){ return map; } - var mapUI = new MarkerMapDiv(currentUserName); + var mapUI = new MarkerMapDiv(); this.getMarkersUI = function(){ return mapUI; } - this.getCurrentUserName = function(){ - return currentUserName; - } - //TODO: define setUpInterface here???? - }, - - - setupInterface: function() { + //sets up the player interface and loads the markers. There is theoretically no need of this method, as it might be included in + //the init constructor, it is separated for "historical" reasons: this method stems from the old _setupInterface, + //which was a separate method in the old player code. Future releases might include it in the init constructor + setupInterface: function(callback) { var sound = this.getSound(); - consolelog('player _setupInterface sound.readyState:'+sound.readyState); //handle also cases 0 and 2???? + this.debug('player _setupInterface sound.readyState:'+sound.readyState); //handle also cases 0 and 2???? var $J = this.$J; //defined in the super constructor var me=this; - //image source (see below) is given a src with a temporary 1x1 pixels transparent image + //build the innerHTML as array, then join it. This is usually faster than string concatenation in some browsers. + //Note that the player image (see below) is given a src with a temporary 1x1 pixels transparent image + //Basically, NOT specifying any src for image tags can be harmful, //see http://www.nczonline.net/blog/2009/11/30/empty-image-src-can-destroy-your-site/ and - //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx - //for details + //http://geekswithblogs.net/bcaraway/archive/2007/08/24/114945.aspx for details var html = ["
", "
", "
", @@ -251,14 +246,14 @@ var Player = TimesideClass.extend({ }); //volume: - function setVolume(event){ + function setVolume(event,volumeElement){ var ticks = [18,26,33,40,47]; - var vol = event.layerX; + var vol = event.pageX - volumeElement.offset().left; //using absolute coordinates allows us to + //avoid using layerX (not supported in all browsers) and clientX (which needs the window scrollLeft variable) for(var i=0; i=mPos-span && pos<=mPos+span){ - // consolelog('songpos: '+pos+' nextmarkerpos:'+mPos); // popup.attr('id','markerpopup'+markerIndex); // popup.find('.title').html(marker.title); // popup.find('.description').html(marker.desc); @@ -421,6 +415,7 @@ var Player = TimesideClass.extend({ elements.css('width', 'auto'); // for IE6 + if (!height){ height = 200; } @@ -430,6 +425,10 @@ var Player = TimesideClass.extend({ } elements.css(style); + image.css({ + 'width':'100%', + 'height':'100%' + }); // for IE7. Does not seem to hurt IE8, FF, Chrome //refreshing images: this.refreshImage(image); @@ -449,17 +448,23 @@ var Player = TimesideClass.extend({ select.add(imgWait).css('maxHeight',(maxHeight-2)+'px'); //at least a margin left and top of 1 px (see below) var span = (maxHeight-select.outerHeight())/2; //do not include margins in oputerHeight (we will set them to zero below) - select.css({'margin':'0px', 'marginTop':span+'px','marginLeft':span+'px'}); + select.css({ + 'margin':'0px', + 'marginTop':span+'px', + 'marginLeft':span+'px' + }); var span2 = (maxHeight - imgWait.outerHeight())/2; //do not include margins in oputerHeight (we will set them to zero below) - imgWait.css({'margin':'0px', 'marginTop':span2+'px','marginLeft':span+'px'}) + imgWait.css({ + 'margin':'0px', + 'marginTop':span2+'px', + 'marginLeft':span+'px' + }) return this; }, - // getImageUrl: function(){ - // return this.$J('#visualizer_id').get(0).value; - // }, + refreshImage: function(optionalImgJQueryElm){ var image; var container = this.getContainer(); @@ -477,11 +482,8 @@ var Player = TimesideClass.extend({ return _src_; }; var imageUrl = this.getVisualizers()[""+select.val()]; - //consolelog(this.getVisualizers()); - //alert(imageUrl); var imgSrc = funcImg(imageUrl, image.width(),image.height()); if(image.attr('src')==imgSrc){ - // consolelog('setting attrt'); return; } var w =select.width(); @@ -497,6 +499,7 @@ var Player = TimesideClass.extend({ select.show(); image.unbind('load'); }); + //this timeout is set in order to leave the time to hide show components above: //setTimeout(function(){ image.attr('src', imgSrc); @@ -516,7 +519,6 @@ var Player = TimesideClass.extend({ var offset = this.getSoundDuration(); var position = this.getSoundPosition(); //parseFloat(this.getSoundPosition()); var idx = map.insertionIndex(position); - //consolelog('current pointer position: '+position+' '+(typeof position)); if(idx<0){ idx = -idx-1; //cursor is not on a a marker, get the insertion index }else{ @@ -555,7 +557,7 @@ var Player = TimesideClass.extend({ offset = markers[idx].offset; } this.setSoundPosition(offset); - this.getRuler().movePointer(offset) + this.getRuler().movePointer(offset); return false; }, @@ -591,10 +593,10 @@ var Player = TimesideClass.extend({ }, - loadMarkers: function(){ + loadMarkers: function(callback){ //ruler.bind('markermoved',this.markerMoved,this); var $J = this.$J; //reference to jQuery - var isInteractive_ = this.getCurrentUserName() || false; + var itemId = this.getItemId(); var player = this; @@ -605,7 +607,7 @@ var Player = TimesideClass.extend({ map.clear(); mapUI.clear(); ruler.clear(); - + var showAddMarker = map.getCurrentUserName() || false; //building the onSuccess function var onSuccess = function(data) { var tabIndex = 0; @@ -635,7 +637,7 @@ var Player = TimesideClass.extend({ var setMarkerButton = player.getContainer().find('.ts-set-marker'); var tab = $J('#tab_markers'); if(setMarkerButton){ - if(isInteractive_){ + if(showAddMarker){ setMarkerButton.show().attr('href','#').unbind('click').bind('click', function(){ if(tab && tab.length){ tab.trigger('click'); @@ -716,15 +718,15 @@ var Player = TimesideClass.extend({ } }); - $J('#loading_span').empty().remove(); - //TODO: move this in load_player? - // setUpPlayerTabs([jQuery('#tab_analysis'), jQuery('#tab_markers')], - // [jQuery('#analyzer_div_id'), jQuery('#markers_div_id')], tabIndex, - // 'tab_selected','tab_unselected'); - setUpPlayerTabs($J('#tab_analysis').add($J('#tab_markers')), - [$J('#analyzer_div_id'), $J('#markers_div_id')], tabIndex, - 'tab_selected','tab_unselected'); + if(callback){ + callback(); + } }; - json([itemId],"telemeta.get_markers", onSuccess); + var onError = function(){ + if(callback){ + callback(); + } + } + json([itemId],"telemeta.get_markers", onSuccess, onError); } }); \ No newline at end of file diff --git a/telemeta/htdocs/timeside/js/playerLoader.js b/telemeta/htdocs/timeside/js/playerLoader.js index c6adb20c..c69363fe 100644 --- a/telemeta/htdocs/timeside/js/playerLoader.js +++ b/telemeta/htdocs/timeside/js/playerLoader.js @@ -13,7 +13,6 @@ var player; //global player variable function togglePlayerMaximization() { var $ = jQuery; - consolelog('entered togglePlayerMaximization'); var view = $('#player'); $('#player_maximized, #player_minimized').css('display', 'none'); var ctr; @@ -42,7 +41,7 @@ function togglePlayerMaximization() { -function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName){ +function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName, isStaffOrSuperuser){ var $J = jQuery; var playerDiv = $J('#player'); if (!playerDiv.length){ @@ -62,9 +61,7 @@ function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName) } - //consolelog('till here all ok1'); var msgElm = $J('#loading_span_text'); //element to show messages - //consolelog('till here all ok2'); if(msgElm){ msgElm.html('Loading analyzer...'); } @@ -82,17 +79,46 @@ function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName) loadScripts('/timeside/js/',['rulermarker.js','markermap.js', 'player.js', 'ruler.js','divmarker.js'], function() { - var p = new Player(jQuery('#player'), sound, durationInMsec, itemId, visualizers, currentUserName); - consolelog('initialized player'); - p.setupInterface(); + var p = new Player(jQuery('#player'), sound, durationInMsec, itemId, visualizers, currentUserName, isStaffOrSuperuser); + + var cbckAtEnd = function(){ + //this callback is executed at the end and does 3 things: + //1)sets up the marker tab + $J('#loading_span').empty().remove(); + // setUpPlayerTabs([jQuery('#tab_analysis'), jQuery('#tab_markers')], + // [jQuery('#analyzer_div_id'), jQuery('#markers_div_id')], tabIndex, + // 'tab_selected','tab_unselected'); + var map = p.getMarkerMap(); + var tabIndex = map.length ? 1 : 0; + setUpPlayerTabs($J('#tab_analysis').add($J('#tab_markers')), + [$J('#analyzer_div_id'), $J('#markers_div_id')], tabIndex, + 'tab_selected','tab_unselected'); + //2) and selects the current marker if it is present on the url + var url = window.location.href+""; + var lastPart = url.replace(/\/+$/,"").replace(/^.*\/([^\/]*)$/,"$1"); + var selOffs = -1; + map.each(function(i,marker){ + if(marker.id == lastPart){ + selOffs = marker.offset; + } + }); + if(selOffs >= 0){ + p.setSoundPosition(selOffs); + p.getRuler().movePointer(selOffs); + } + //3) assing a binding to the player maximization button: + $J('#player_maximized .toggle, #player_minimized .toggle').click(function() { + togglePlayerMaximization(); + //alert(this); + //this.blur(); + return false; + }); + } + p.setupInterface(cbckAtEnd); player = p; - $J('#player_maximized .toggle, #player_minimized .toggle').click(function() { - togglePlayerMaximization(); - this.blur(); - return false; - }); + }); }; @@ -112,7 +138,6 @@ function loadPlayer(analizerUrl, soundUrl, itemId, visualizers, currentUserName) } var duration = $J(data).find('#duration').attr('value'); duration = duration.split(":"); - consolelog('analyzer loaded, duration: '+duration); //format duration var pin = parseInt; var pfl = parseFloat; diff --git a/telemeta/htdocs/timeside/js/ruler.js b/telemeta/htdocs/timeside/js/ruler.js index 8a29fc3a..80d19f7b 100644 --- a/telemeta/htdocs/timeside/js/ruler.js +++ b/telemeta/htdocs/timeside/js/ruler.js @@ -1,14 +1,11 @@ var Ruler = TimesideArray.extend({ //init constructor: soundDuration is IN SECONDS!!! (float) - init: function(viewer, soundDuration, isInteractive){ + init: function(viewer, soundDuration){ this._super(); var cssPref = this.cssPrefix; - this.isInteractive = function(){ - return isInteractive; - }; - + this.getSoundDuration= function(){ return soundDuration; }; @@ -36,11 +33,6 @@ var Ruler = TimesideArray.extend({ this.getRulerContainer = function(){ return container; } - - - if(!isInteractive){ //is not interactive, skip all methods assignmenets below - return; - } }, resize : function(){ @@ -217,23 +209,6 @@ var Ruler = TimesideArray.extend({ pointer = this.getPointer(); } if(!pointer){ - //consolelog('QUALE CHAZZO E IL CONTAINER?????? ' + $J(layout.get(0)).attr('class')); - // pointer = new RulerMarker($J(layout.get(0)),this.getWaveContainer(),'pointer', true); - // pointer.setText(this.makeTimeLabel(0)); - // - // this.debug('WELL, '); - // consolelog(pointer); - // var me = this; - // pointer.getLabel().mousedown(function(evt) { - // var lbl = $J(evt.target); - // me.markerBeingClicked = { - // 'marker':pointer, - // 'offset':evt.pageX-(lbl.offset().left+lbl.outerWidth(true)/2) - // }; - // consolelog(evt.pageX-(lbl.offset().left+lbl.outerWidth(true)/2)); - // evt.stopPropagation(); //dont notify the ruler; - // return false; - // }); pointer = this.add(0); this.getPointer = function(){ return pointer; @@ -246,27 +221,6 @@ var Ruler = TimesideArray.extend({ rulermarker.refreshPosition(); }); - // if(!pointer){ - // this.debug("Creating pointer:"+layout); - // //this.createMarkerForRuler = function(rulerLayout,viewer,className, fontSize, optionalToolTip) - // pointer = this.createMarkerForRuler($J(layout.get(0)),waveContainer,'pointer',fontSize,'move pointer'); - // this.debug('pointerdisplay'+pointer.css('display')); - // } - - //TODO: move pointer?????? - //this._movePointer(sound.position/1000); - - - //TODO: draw markers? - // if (this.cfg.map) { - // $J(this.markers).each(function(i, m) { - // m.clear(); - // }); - // this.markers = new Array(); - // this.cfg.map.each(this.attach(function(i, m) { - // this.markers.push(this._drawMarker(m, i)); - // })); - // } }, //overridden: Note that the pointer is NOT cleared!!!!! @@ -285,7 +239,6 @@ var Ruler = TimesideArray.extend({ var rulermarker = this._super(index); rulermarker.remove(); this.each(index, function(i,rulermarker){ - consolelog(i); rulermarker.setIndex(i, true); }); }, @@ -311,11 +264,11 @@ var Ruler = TimesideArray.extend({ if(typeof markerObjOrOffset == 'number'){ soundPosition = markerObjOrOffset; - isMovable = true; //this.isInteractive(); + isMovable = true; markerClass='pointer'; }else{ soundPosition = markerObjOrOffset.offset; - isMovable = markerObjOrOffset.isEditable && this.isInteractive(); + isMovable = markerObjOrOffset.isEditable; markerClass='marker'; } @@ -406,7 +359,6 @@ var Ruler = TimesideArray.extend({ me.setPointerMovingFromMouse(false); } if(newPos == startPos){ - consolelog('NOT MOVED!!!!'); return false; } var data = { @@ -418,21 +370,7 @@ var Ruler = TimesideArray.extend({ return false; }; doc.bind('mouseup.'+eventId, mouseup); - //lbl.bind('mouseup.'+eventId, mouseup); - // doc.bind('mouseup.'+eventId, function(evt){ - // consolelog(newPos); - // doc.unbind('mousemove.'+eventId); - // doc.unbind('mouseup.'+eventId); - // - // //TODO: fire event marker moved (with the class name) - // var data = { - // 'markerElement':pointer, - // 'soundPosition': me.toSoundPosition.apply(me,[newPos]), - // 'markerClass':markerClass - // }; - // me.fire('markermoved',data); - // return false; - // }); + return false; }); diff --git a/telemeta/htdocs/timeside/js/rulermarker.js b/telemeta/htdocs/timeside/js/rulermarker.js index 171e4674..08643452 100644 --- a/telemeta/htdocs/timeside/js/rulermarker.js +++ b/telemeta/htdocs/timeside/js/rulermarker.js @@ -193,7 +193,6 @@ var RulerMarker = TimesideClass.extend({ } label.find('span').html(text); if(oldWidth != labelWidth && optionalUpdateLabelPosition){ - consolelog('refreshing label position'); this.refreshLabelPosition(); } } diff --git a/telemeta/htdocs/timeside/js/timeside.js b/telemeta/htdocs/timeside/js/timeside.js index 26f647bf..290d56d0 100644 --- a/telemeta/htdocs/timeside/js/timeside.js +++ b/telemeta/htdocs/timeside/js/timeside.js @@ -280,7 +280,7 @@ var TimesideClass = Class.extend({ fire : function(key, dataArgument){ var listenersMap = this.listenersMap; if(!(key in listenersMap)){ - this.debug(key+' fired but no binding associated to it'); + this.debug('"'+key+'" fired but no binding associated to it'); return; } var callbacks = listenersMap[key]; @@ -307,7 +307,6 @@ var TimesideArray = TimesideClass.extend({ //note that this method written here OVERRIDES the same method written outside init in the children!!!! this.toArray = function(returnACopy){ if(returnACopy){ - consolelog('copying array'); var ret = []; for(var i=0; i
\n'); + '$1;left:$2px;top:$3px;width:$4px;height:$5px">
\n'); } function _htmPrtRpc() @@ -131,7 +132,7 @@ function _htmPrtRpc() return this.htm.replace( _regex, '
\n'); + '$1;left:$2px;top:$3px;width:$4px;height:$5px;border-left:$4px solid $1">
\n'); } function _mkLin(x1, y1, x2, y2) @@ -747,7 +748,7 @@ function jsGraphics(cnv, wnd) | (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3)) | ((fAngA >= fAngZ) << 16), aBndA = new Array(b+1), aBndZ = new Array(b+1); - + // Set up radial boundary lines fAngA *= Math.PI/180.0; fAngZ *= Math.PI/180.0; @@ -937,7 +938,7 @@ text both horizontally (e.g. right) and vertically within that rectangle */ this._mkDiv(xl, yt, w, h); this._mkDiv(xl, yb, w, h); }; - + this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects) { var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w; @@ -1023,7 +1024,7 @@ text both horizontally (e.g. right) and vertically within that rectangle */ this.htm = ""; this.wnd = wnd || window; - if(!jg_ok) _chkDHTM(); + if(!jg_ok) _chkDHTM(this.wnd); if(jg_ok) { if(cnv) diff --git a/telemeta/templates/telemeta_default/mediaitem_detail.html b/telemeta/templates/telemeta_default/mediaitem_detail.html index 482bb90b..5821e615 100644 --- a/telemeta/templates/telemeta_default/mediaitem_detail.html +++ b/telemeta/templates/telemeta_default/mediaitem_detail.html @@ -23,7 +23,7 @@ soundManager.url = "{% url telemeta-timeside "swf/" %}"; soundManager.flashVersion = 9; soundManager.useMovieStar = true; // enable MP4/M4A/AAC - soundManager.debugMode = true; + soundManager.debugMode = false; soundManager.allowPolling = true; var setupPlaylist = function(){ @@ -56,7 +56,7 @@ } //warn on soundmanager error: soundManager.onerror = function() { - playerError('SoundManager error. If your browser does not support HTML5, Flash player (version 9+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences) and reload the page\n - Restart the browser'); + playerError('SoundManager error. If your browser does not support HTML5, Flash player (version '+soundManager.flashVersion+'+) must be installed.\nIf flash is installed, try to:\n - Reload the page\n - Empty the cache (see browser preferences/options/tools) and reload the page\n - Restart the browser'); }; setTimeout(function(){ @@ -80,7 +80,12 @@ soundManager.onready(function() { loadScripts(scripts, function(){ - loadPlayer('{% url telemeta-item-analyze-xml item.public_id %}',"{% url telemeta-item-export item.public_id,"mp3" %}", '{{item.id}}', visualizers, CURRENT_USER_NAME); + {% if user.is_staff or user.is_superuser %} + var superuser = true; + {% else %} + var superuser = false; + {% endif %} + loadPlayer('{% url telemeta-item-analyze-xml item.public_id %}',"{% url telemeta-item-export item.public_id,"mp3" %}", '{{item.id}}', visualizers, CURRENT_USER_NAME, superuser); setupPlaylist(); }); }); @@ -116,7 +121,7 @@ {% block content %}
{% if item.file %} - {% if public_access or user.is_staff %} + {% if public_access or user.is_staff or user.is_superuser %}