From: riccardo Date: Fri, 28 Jan 2011 17:39:39 +0000 (+0100) Subject: added markers functionality, marker edit panels and synchronization with the rule... X-Git-Tag: 1.1~474^2~1 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=1eb6b4fde77893fc78c4a36f5bd6fd1f7115a1e2;p=telemeta.git added markers functionality, marker edit panels and synchronization with the rule panel. Still to be implemented the http request --- diff --git a/telemeta/htdocs/timeside/src/controller.js b/telemeta/htdocs/timeside/src/controller.js index ba0870be..7de3a121 100644 --- a/telemeta/htdocs/timeside/src/controller.js +++ b/telemeta/htdocs/timeside/src/controller.js @@ -7,23 +7,25 @@ TimeSide(function($N) { -$N.Class.create("Controller", $N.Core, { - - initialize: function($super, cfg) { - $super(); - this.configure(cfg, { - player: null, - soundProvider: null, - map: null - }); - if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) { - this.cfg.player = new $N.Player(this.cfg.player); - } - this._setupPlayer(); - }, + $N.Class.create("Controller", $N.Core, { + + initialize: function($super, cfg) { + $super(); + this.configure(cfg, { + player: null, + soundProvider: null, + map: null, + markersDiv: document.getElementById("markers_div_id") + }); + if (this.cfg.player && !$N.isInstanceOf(this.cfg.player, 'Player')) { + this.cfg.player = new $N.Player(this.cfg.player); + } + this._setupPlayer(); + }, - _setupPlayer: function() { - this.cfg.player + _setupPlayer: function() { + this.attach(this.updateMarkersDiv); + this.cfg.player .setSoundProvider(this.cfg.soundProvider) .setMarkerMap(this.cfg.map) .observe('play', $N.attachFunction(this.cfg.soundProvider, this.cfg.soundProvider.play)) @@ -31,27 +33,116 @@ $N.Class.create("Controller", $N.Core, { .observe('move', this.attach(this._onMove)) .observe('markeradd', this.attach(this._onMarkerAdd)) .observe('markermove', this.attach(this._onMarkerMove)) + .observe('markeradd2',this.attach(this._onMarkerAdd2)) .draw(); - }, + + }, - _onMove: function(e, data) { - this.cfg.soundProvider.seek(data.offset); - }, + _onMarkerAdd2: function(e,data){ + if (this.cfg.map) { + alert(this.cfg.map._toString()); + } + }, - _onMarkerMove: function(e, data) { - if (this.cfg.map) { - this.cfg.map.move(this.cfg.map.byId(data.id), data.offset); - } - }, + _onMove: function(e, data) { + this.cfg.soundProvider.seek(data.offset); + }, + + + updateMarkersDiv: function(nonNullMarkersMap, selectedMarkOffset){ + var div = this.cfg.markersDiv; + var m = nonNullMarkersMap.markers; + var l = m.length; + if(div){ + var d = new Date(); + var textWithFocus; + div.style.display = "block"; + var doc = document; + var divChildren = div.childNodes; + var round = Math.round; + for(var i=0; i"; +// } + }); diff --git a/telemeta/htdocs/timeside/src/markermap.js b/telemeta/htdocs/timeside/src/markermap.js index 543fb2e5..29ade71f 100644 --- a/telemeta/htdocs/timeside/src/markermap.js +++ b/telemeta/htdocs/timeside/src/markermap.js @@ -114,7 +114,20 @@ $N.Class.create("MarkerMap", $N.Core, { each: function(callback) { $J(this.markers).each(callback); + }, + + _toString: function() { + var s = "\n\n"; + for (var i in this.markers) { + marker = this.markers[i]; + s+="\n\t"; //+marker._toString(); + s+="" + } + s+="\n\n"; + return s; } + }); $N.notifyScriptLoad(); diff --git a/telemeta/htdocs/timeside/src/player.js b/telemeta/htdocs/timeside/src/player.js index 04df2f62..a43baec3 100644 --- a/telemeta/htdocs/timeside/src/player.js +++ b/telemeta/htdocs/timeside/src/player.js @@ -18,7 +18,8 @@ $N.Class.create("Player", $N.Core, { }, 'div.control': { 'div.layout': { - 'div.playback': ['a.play', 'a.pause', 'a.rewind', 'a.forward', 'a.set-marker'] + 'div.playback': ['a.play', 'a.pause', 'a.rewind', 'a.forward', 'a.set-marker', 'a.set-marker2'] + //,'input.textMarker'] } }/*, 'div.marker-control': ['a.set-marker']*/ @@ -28,7 +29,9 @@ $N.Class.create("Player", $N.Core, { pause: 'Pause', rewind: 'Rewind', forward: 'Forward', - 'set-marker': 'Set marker' + 'set-marker': 'Set marker', + 'set-marker2': 'Set marker2' + //,'text-marker' : 'textmarker' }, elements: {}, ruler: null, @@ -93,11 +96,13 @@ $N.Class.create("Player", $N.Core, { // IE apparently doesn't send the second mousedown on double click: var jump = $J.browser.msie ? 'mousedown dblclick' : 'mousedown'; this.elements.rewind.attr('href', '#').bind(jump, this.attach(this._onRewind)) - .click(function() {return false; }); + .click(function() {return false;}); this.elements.forward.attr('href', '#').bind(jump, this.attach(this._onForward)) - .click(function() {return false; }); + .click(function() {return false;}); this.elements.pause.attr('href', '#').bind('click', this.attach(this._onPause)); this.elements.play.attr('href', '#').bind('click', this.attach(this._onPlay)); + + //assigning title string to all anchors??????? this.elements.control.find('a').add(this.elements.setMarker) .attr('href', '#') .each(function(i, a){ @@ -108,7 +113,12 @@ $N.Class.create("Player", $N.Core, { //this.elements.markerControl.find('a').attr('href', '#'); if (this.map) { + //configureMarkersDiv(); this.elements.setMarker.bind('click', this.attach(this._onSetMarker)); + this.elements.setMarker2.bind('click', this.attach(this._onSetMarker2)); + //this.elements.textMarker.attr('type', 'text'); + //this.elements.textMarker.bind('click', this.attach(this._onSetMarker2)); + } else { this.elements.setMarker.remove(); } @@ -133,6 +143,13 @@ $N.Class.create("Player", $N.Core, { //this.container.resize(this.attach(this.resize)); // Can loop ? }, + _onSetMarker2: function() { + if (this.map) { + this.fire('markeradd2', {offset: this.soundProvider.getPosition()}); + } + return false; + }, + resize: function(overrideHeight) { this.debug("resizing"); var height; diff --git a/telemeta/templates/telemeta_default/mediaitem_detail.html b/telemeta/templates/telemeta_default/mediaitem_detail.html index 4133495e..44cc3460 100644 --- a/telemeta/templates/telemeta_default/mediaitem_detail.html +++ b/telemeta/templates/telemeta_default/mediaitem_detail.html @@ -61,6 +61,7 @@ load_player({{ item.approx_duration.as_seconds }}); +
- {% if audio_export_enabled %}

{% trans "Download:" %}