# HG changeset patch # User clebeaupin # Date 1272458209 -7200 # Node ID 4ddb2636237b89aefd9e2e5635dd630540b3f71b # Parent 315aef7270fcfef4364c0290edd3221728021e1c Add my tags, Fix js on IE, List segments on player diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/config/routing.yml --- a/web/thdProject/apps/frontend/config/routing.yml Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/apps/frontend/config/routing.yml Wed Apr 28 14:36:49 2010 +0200 @@ -3,6 +3,10 @@ url: / param: { module: homepage, action: index } +######## +# ACCOUNT +######## + loginUser: url: /connexion param: { module: account, action: loginUser} @@ -14,6 +18,10 @@ openidLogin: url: /open-id/connexion param: { module: account, action: openidLogin} + +viewMyTagList: + url: /mes-tags + param: { module: account, action: viewMyTagList} ######## #SEGMENT EDITOR @@ -28,8 +36,8 @@ param: { module: editor, action: editVideoSegment } segmentListJson: - url: /editeur/:film_slug/list-segment - param: { module: editor, action: segmentListJson} + url: /editeur/:film_slug/segments + param: { module: editor, action: viewVideoSegmentList } requirements: {ref: \d+} diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/account/actions/viewMyTagListAction.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/account/actions/viewMyTagListAction.class.php Wed Apr 28 14:36:49 2010 +0200 @@ -0,0 +1,28 @@ +getRequestParameter('page_nb', 1); + $this->pageIndex = $pageNb -1; + $this->pageNbItems = 10; + $this->routeUri = '@viewMyTagList'; + + // Initialize query + $query = Doctrine_Query::create() + ->from('ThdFilm F') + ->leftJoin('F.videos V') + ->leftJoin('V.segments S') + ->leftJoin('S.ThdUser U') + ->where("U.uniqueid = '{$this->getUser()->getUid()}'") + ->orderBy('S.creation_date DESC'); + $this->itemCount = $query->count(); + $this->pageCount = (int) ceil($this->itemCount/$this->pageNbItems); + $this->films = $query->offset($this->pageIndex*$this->pageNbItems)->limit($this->pageNbItems)->execute(); + + if ($this->pageIndex*$this->pageNbItems > $this->itemCount) { + $this->forward404(); + } + } +} \ No newline at end of file diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/account/config/view.yml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/account/config/view.yml Wed Apr 28 14:36:49 2010 +0200 @@ -0,0 +1,4 @@ +viewMyTagListSuccess: + components: + sideBar: [ homepage, sideBar ] + diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/account/templates/loginUserForm.php --- a/web/thdProject/apps/frontend/modules/account/templates/loginUserForm.php Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/account/templates/loginUserForm.php Wed Apr 28 14:36:49 2010 +0200 @@ -1,5 +1,5 @@
-

Pas encore inscrit ?

+

Pas encore inscrit ?

Bienvenue dans le projet UniversCiné THD.

Ce site entre dans le cadre d'un projet de recherche sur le très haut débit réunissant trois acteurs autour de ce site :
UniversCiné, l'iri, Sony CSL et Cap digital
diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/account/templates/viewMyTagListSuccess.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/account/templates/viewMyTagListSuccess.php Wed Apr 28 14:36:49 2010 +0200 @@ -0,0 +1,2 @@ +

Mes films taggés ()

+ $films, 'pageIndex' => $pageIndex, 'pageCount' => $pageCount, 'itemCount' => $itemCount, 'routeUri' => $routeUri)); ?> diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/editor/actions/segmentListJsonAction.class.php --- a/web/thdProject/apps/frontend/modules/editor/actions/segmentListJsonAction.class.php Wed Apr 28 14:00:37 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -ref = $this->getRequestParameter('ref'); - $this->film_slug = $this->getRequestParameter('film_slug'); - - // Get File segmentation Path - $this->path = sfConfig::get('app_storage_uploads'); - $this->format = sfConfig::get('app_storage_format'); - $file = $this->path.$this->ref."_".$this->film_slug.$this->format; - - - //Check if file exist - if (file_exists($file)) { - $fp = fopen($file, "r"); - while (($data = fgetcsv($fp)) != FALSE) { - $line = "{sin: " . $data[0] . - ",sout: " . $data[1] . - ",tag: '" . $data[2] . "'" . - ",user: '" . $data[3] . "'}"; - - $lines[] = $line; - } - $segments = "[" . join($lines,',') . "]"; - } - - // Render json - echo $segments; - } -} \ No newline at end of file diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/editor/actions/viewVideoSegmentListAction.class.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/thdProject/apps/frontend/modules/editor/actions/viewVideoSegmentListAction.class.php Wed Apr 28 14:36:49 2010 +0200 @@ -0,0 +1,34 @@ +filmSlug = $this->getRequestParameter('film_slug'); + + // Get segments + $query = Doctrine_Query::create() + ->from('ThdSegment S') + ->leftJoin('S.ThdVideo V') + ->leftJoin('V.ThdFilm F') + ->where("F.slug_url = '{$this->filmSlug}'") + ->orderBy('S.creation_date DESC'); + + + //Check if file exist + $segments = Array(); + + foreach ($query->execute() as $segment) { + $segments[] = Array( + 'in' => $segment->getStart(), 'out' => $segment->getEnd(), + 'tags' => $segment->getTags(), 'user' => $segment->getThdUser()->getUniqueid() + ); + } + + // Render json + $this->getResponse()->setHttpHeader('Content-type', 'application/json'); + $this->getResponse()->setHttpHeader('Cache-Control', 'no-cache, no-store, max-age=0'); + return $this->renderText(json_encode($segments)); + + } +} \ No newline at end of file diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/editor/templates/_player.php --- a/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/editor/templates/_player.php Wed Apr 28 14:36:49 2010 +0200 @@ -28,7 +28,7 @@ }, onError: function(code,msg) { alert(msg); - }, + } }); @@ -44,19 +44,22 @@ var segments = tagTool.segments; - for (seg in segments) { - var segd = segments[seg].sout - segments[seg].sin; + for (var seg in segments) { + var segd = parseInt(segments[seg]['out']) - parseInt(segments[seg]['in']); var percent = Math.round(segd * 100 / duration); - var offset = Math.round(segments[seg].sin * 100 / duration); + var offset = Math.round(parseInt(segments[seg]['in']) * 100 / duration); var c = $('#seg_container_template').clone().removeAttr("id"); $("#segments").append(c); - $("span", c).html('' + tagTool.segments[seg].tag +' par ' + segments[seg].user); - $("#seg_0", c).css({'margin-left': offset+'%', 'width': percent+'%'}) - .attr('id', 'seg_' + seg) - .click(function() { - seg_id = $(this).attr("id"); - seg_id = seg_id.substr(seg_id.indexOf('_') + 1); + $("span", c).html('' + tagTool.segments[seg].tags.join(', ') +' par ' + segments[seg].user); + $("#seg_0", c).css({'margin-left': offset+'%', 'width': percent+'%'}); + c.attr('id', 'seg_' + seg); + + + $(".segtimeline", c).each(function() { + var seg_id = seg; + $(this).click(function() { tagTool.playSegment(seg_id, $("#pauseAfter").val()); + }); }); c.show(); } @@ -73,7 +76,7 @@ // Charge les tags $("#segmentMarkerButtons").css("opacity",1); $("#btMarkIn").removeAttr("disabled"); - $.getJSON("getRef()}&film_slug={$film->getSlugUrl()}");?>", "", function(data) { + $.getJSON("getSlugUrl()}");?>", "", function(data) { tagTool.segments = data; tagTool.setupHandlers($f("player")); window.setTimeout("loadSegments()", 2000); diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/editor/templates/_segmentList.php --- a/web/thdProject/apps/frontend/modules/editor/templates/_segmentList.php Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/editor/templates/_segmentList.php Wed Apr 28 14:36:49 2010 +0200 @@ -7,7 +7,7 @@
diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/editor/templates/segmentListJsonSuccess.php --- a/web/thdProject/apps/frontend/modules/editor/templates/segmentListJsonSuccess.php Wed Apr 28 14:00:37 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ - diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/apps/frontend/modules/partials/templates/_userPanel.php --- a/web/thdProject/apps/frontend/modules/partials/templates/_userPanel.php Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/apps/frontend/modules/partials/templates/_userPanel.php Wed Apr 28 14:36:49 2010 +0200 @@ -4,7 +4,7 @@ Bienvenue sur UniversCine THD
diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/web/js/segmentation/tagtool.js --- a/web/thdProject/web/js/segmentation/tagtool.js Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/web/js/segmentation/tagtool.js Wed Apr 28 14:36:49 2010 +0200 @@ -11,11 +11,11 @@ stopOnSegment: false, playSegment: function(seg, pause) { - - if (pause == "on") - this.stopOnSegment = this.segments[seg].sout; - - this.player.seek(this.segments[seg].sin / 1000); + if (pause == "on") { + this.stopOnSegment = parseInt(this.segments[seg]['out']); + } + + this.player.seek(parseInt(this.segments[seg]['in']) / 1000); }, displayTags: function() { @@ -51,8 +51,8 @@ rebuildCurrentTags: function(position) { this.currentTags = new Array(); for (seg in this.segments) { - if (this.segments[seg].sin < position && this.segments[seg].sout > position) { - this.currentTags.push(this.segments[seg].tag); + if (parseInt(this.segments[seg]['in']) < position && parseInt(this.segments[seg]['out']) > position) { + this.currentTags.push(this.segments[seg]['tags'].join(', ')); } } this.displayTags(); @@ -62,9 +62,9 @@ cuepoints = new Array(); for (seg in this.segments) { - cuepoint = {time: this.segments[seg].sin, tag: this.segments[seg].tag}; + cuepoint = {time: parseInt(this.segments[seg]['in']), tag: this.segments[seg]['tags'].join(', ')}; cuepoints.push(cuepoint); - cuepoint = {time: this.segments[seg].sout, tag: this.segments[seg].tag, out: 'true'}; + cuepoint = {time: parseInt(this.segments[seg]['out']), tag: this.segments[seg]['tags'].join(', '), out: 'true'}; cuepoints.push(cuepoint); } player.onCuepoint(cuepoints, function(clip, cuepoint) { diff -r 315aef7270fc -r 4ddb2636237b web/thdProject/web/js/uc.common.js --- a/web/thdProject/web/js/uc.common.js Wed Apr 28 14:00:37 2010 +0200 +++ b/web/thdProject/web/js/uc.common.js Wed Apr 28 14:36:49 2010 +0200 @@ -3,8 +3,7 @@ //Ajaxify content uc.common.ajaxify = function (timeout) { - if (timeout == null) timeout = 0; - + if (timeout == null) timeout = 0; uc.utils.ajaxifyLink(jQuery('a.ajax-post'), 'POST', function() {uc.common.ajaxify();}); uc.utils.ajaxifyLink(jQuery('a.ajax'), 'GET', function() {uc.common.ajaxify();}); uc.utils.ajaxifyLink(jQuery('.ajax a'), 'GET', function() {uc.common.ajaxify();}); @@ -32,7 +31,7 @@ clip: { autoPlay: true, autoBuffering: true, - scaling: 'fit', + scaling: 'fit' }, // setup controlbar to use skins plugins: {