Binary file engine/sonyengine/mosatags.sonyengine.war has changed
--- a/web/thdProject/apps/frontend/modules/homepage/templates/_tagList.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/homepage/templates/_tagList.php Fri Apr 30 05:18:17 2010 +0200
@@ -3,7 +3,7 @@
<ul class="item-list tag-list">
<?php
foreach($tagCloud as $tag): ?>
- <li class="tag-score-<?php echo $tag['count']; ?>"><a href=""><?php echo $tag['tag']; ?></a>
+ <li class="tag-score-<?php echo $tag['count']; ?>"><a href="<?php echo url_for("@tagging?tag=".$tag['tag']); ?>"><?php echo $tag['tag']; ?></a>
</li>
<?php endforeach; ?>
</ul>
--- a/web/thdProject/apps/frontend/modules/reflex/actions/actions.class.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/reflex/actions/actions.class.php Fri Apr 30 05:18:17 2010 +0200
@@ -27,22 +27,69 @@
$this->distance = $this->distance * ($this->direction=='more'?1.0:-1.0) / 100.0;
- $sonyengine = SonyengineClient::getInstance();
- $result = $client->engineFind($this->film_uniqueid,$this->tag,$this->distance,true);
+ $client = SonyengineClient::getInstance();
+ $results = $client->engineFind($this->film_uniqueid,$this->tag,$this->distance,true);
foreach($results as $res)
{
$primaryKeys[] = $res['id'];
}
+
+ if(!empty($primaryKeys))
+ {
+ $resultFilm = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
+ }
+ else
+ {
+ $resultFilm = array();
+ }
+
+ if(count($resultFilm) > 0) {
+ $this->film = $resultFilm[0];
+ }
+ else {
+ $this->film = null;
+ }
+
+ $pageNb = (int) $this->getRequestParameter('page_nb', 1);
+ $this->pageIndex = $pageNb -1;
+ $this->pageNbItems = 10;
+ $this->indexNbItems = 2;
+
+
+
+ $solr = uvmcSolrServicesManager::getInstance()->getService();
+ $response = $solr->search("tags:".$this->tag, $this->pageIndex * $this->pageNbItems, $this->pageNbItems);
+
+ $results = unserialize($response->getRawResponse());
+
+ $primaryKeys = array();
+ foreach($results['response']['docs'] as $doc)
+ {
+ $primaryKeys[] = $doc['id'];
+ }
if(!empty($primaryKeys))
{
- $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
+ $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
}
else
{
$this->mostTaggedFilms = array();
}
+
+ if(count($this->mostTaggedFilms) > 0) {
+
+ $taggedfilms = array();
+ foreach($this->mostTaggedFilms as $film) {
+ if($this->film == null || $this->film.id != $film.id) {
+ $taggedfilms[] = $film;
+ }
+ }
+ $this->mostTaggedFilms = $taggedfilms;
+ }
+
+
return sfView::SUCCESS;
}
}
--- a/web/thdProject/apps/frontend/modules/reflex/actions/components.class.php Thu Apr 29 11:57:20 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-<?php
-
-class reflexComponents extends sfComponents
-{
-
- public function executeTagNavigator() {
- $ref = '058000';
-
- // retrieve infos in database
- $query = Doctrine_Query::create()
- ->from('ThdFilm F')
- ->leftJoin('F.images I ')
- ->leftJoin('F.videos V')
- ->where("F.ref='{$ref}'");
- //$this->film = $query->execute();
- // if (!$this->film) return sfView::NONE;
-
- // retrieve tags infos
- // $film = $this->film();
-
-
- return sfView::SUCCESS;
-
- }
-
- public function executePlayer() {
- $this->film_uniqueid = (string) $request->getParameter('film_uniqueid');
- // retrieve infos in database
-
- $query = Doctrine_Query::create()
- ->from('ThdFilm F')
- ->leftJoin('F.images I ')
- ->leftJoin('F.videos V')
- ->where("F.uniqueid='{$film_uniqueid}'");
- $this->film = $query->execute()->getFirst();
- if (!$this->film) return sfView::NONE;
-
- // retrieve video infos
- $videos = $this->film->getVideos();
- $this->filmVideo = ($videos) ? $videos[0] : null;
-
- return sfView::SUCCESS;
- }
-
-
-}
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/reflex/config/view.yml Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/reflex/config/view.yml Fri Apr 30 05:18:17 2010 +0200
@@ -4,7 +4,4 @@
javascripts: [ /js/flowplayer/flowplayer-3.1.0.min.js, /js/flowplayer/uc.flowplayer.config.js]
-
- components:
- sideBar: [ tag, tagNavigator ]
-
\ No newline at end of file
+
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/reflex/templates/_player.php Thu Apr 29 11:57:20 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-<script type="text/javascript">
- // Charge le player
- flowplayer("player", "<?php echo flash_path('flowplayer-3.1.2.swf') ?>",
- {
- clip: {url: "<?php echo video_path($filmVideo['file']); ?>",
- autoPlay: false,
- autoBuffering: true,
- onSeek: function() {
- playerSeek();
- }
- },
-
- plugins: {
-
- content: {url: "<?php echo flash_path('flowplayer.content-3.1.0.swf') ?>",
- backgroundColor: 'transparent',
- display: 'none',
- style: {p: {fontSize: 15}}
- }
-
- },
-
- onLoad: function() {
- playerLoaded(this);
- },
-
- onUnload: function() {
- playerUnloaded(this);
- },
- onError: function(code,msg) {
- alert(msg);
- },
- });
-
-
- function loadSegments() {
-
- if ($f().getClip() == undefined) {
- window.setTimeout("loadSegments()",2000);
- return false;
- }
-
- var duration = Math.round($f().getClip().fullDuration*10) * 100;
-
-
- var segments = tagTool.segments;
-
- for (seg in segments) {
- var segd = segments[seg].sout - segments[seg].sin;
- var percent = Math.round(segd * 100 / duration);
- var offset = Math.round(segments[seg].sin * 100 / duration);
- var c = $('#seg_container_template').clone().removeAttr("id");
- $("#segments").append(c);
- $("span", c).html('<strong>' + tagTool.segments[seg].tag +'</strong> 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);
- tagTool.playSegment(seg_id, $("#pauseAfter").val());
- });
- c.show();
- }
- }
-
-
- function playerSeek() {
- tagTool.rebuildCurrentTags(tagTool.player.getTime() * 1000);
- }
-
-
- function playerLoaded(player) {
-
- // Charge les tags
-
-
- tagTool.player = $f("player");
- tagTool.showTagInPage = false;
-
- }
- </script>
-<div id="editor">
- <h1><?php
-
- echo $film->getTitle();
- // original title if exist
-
- if($film->getOriginalTitle()!= null)
- {
- echo " <span class=\"ost\">{".$film->getOriginalTitle()."}</span>";
- }
- ?>
- <span class="film-infos">De <?php echo thd_render_flat_list($film->getDirectorsArray(), 'name'); ?></span></h1>
- <div class="section">
- <div id="player" class="player-ba"></div>
- <div class="tag-action"><a href="" class="link-button">Tagger le film</a></div>
- </div>
-</div>
--- a/web/thdProject/apps/frontend/modules/reflex/templates/_suggestionFilmList.php Thu Apr 29 11:57:20 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-
-<div id="suggestionFilm-list">
- <h3 class="head">Les films suivants</h3>
- <ul>
-
- <?php
- foreach($mostTaggedFilms as $item): ?>
- <li>
- <?php include_component('partials', 'filmItem', Array('film' => $item, 'actionUri' => $tagFilmUri)); ?>
- </li>
- <?php endforeach; ?>
- </ul>
-</div>
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/reflex/templates/indexSuccess.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/reflex/templates/indexSuccess.php Fri Apr 30 05:18:17 2010 +0200
@@ -1,3 +1,10 @@
-<h3 class="head">Résultats de la recherche reflexonomique</i></h3>
-<?php include_component( "tag", "player" ) ?>
-<?php include_partial('tag/suggestionFilmList', array('filter' => 'all', 'filmCount' => '10', 'mostTaggedFilms' => $mostTaggedFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems)); ?>
+<?php slot('sideBar'); ?>
+<?php include_component( 'tag', 'tagNavigator', array("film"=>$film, "tag"=>$tag)); ?>
+<?php end_slot(); ?>
+<?php if ($film):?>
+<h3 class="head">Résultats de la recherche reflexonomique</h3>
+<?php include_component( "tag", "player", array("film"=>$film, "tag"=>$tag)); ?>
+<?php else:?>
+<h3 class="head">Pas de résultats de la recherche reflexonomique pour le tag <?php echo $tag; ?></h3>
+<?php endif; ?>
+<?php include_partial('tag/suggestionFilmList', array('filter' => 'all', 'filmCount' => '10', 'mostTaggedFilms' => $mostTaggedFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems, "tag"=>$tag)); ?>
--- a/web/thdProject/apps/frontend/modules/tag/actions/components.class.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/actions/components.class.php Fri Apr 30 05:18:17 2010 +0200
@@ -4,41 +4,24 @@
{
public function executeTagNavigator() {
- $ref = '058000';
-
- // retrieve infos in database
- $query = Doctrine_Query::create()
- ->from('ThdFilm F')
- ->leftJoin('F.images I ')
- ->leftJoin('F.videos V')
- ->where("F.ref='{$ref}'");
- $this->film = $query->execute();
- if (!$this->film) return sfView::NONE;
- // retrieve tags infos
- $film = $this->film;
-
- return sfView::SUCCESS;
+ if($this->film)
+ return sfView::SUCCESS;
+ else
+ return sfView::NONE;
}
public function executePlayer() {
- $ref = '058000';
-
- // retrieve infos in database
- $query = Doctrine_Query::create()
- ->from('ThdFilm F')
- ->leftJoin('F.images I ')
- ->leftJoin('F.videos V')
- ->where("F.ref='{$ref}'");
- $this->film = $query->execute()->getFirst();
- if (!$this->film) return sfView::NONE;
-
- // retrieve video infos
- $film = $this->film;
- $videos = $this->film->getVideos();
- $this->filmVideo = ($videos) ? $videos[0] : null;
-
- return sfView::SUCCESS;
+
+ if($this->film) {
+ $videos = $this->film->getVideos();
+ $this->filmVideo = ($videos) ? $videos[0] : null;
+
+ return sfView::SUCCESS;
+ }
+ else
+ return sfView::NONE;
+
}
--- a/web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/actions/viewTagListAction.class.php Fri Apr 30 05:18:17 2010 +0200
@@ -26,13 +26,27 @@
if(!empty($primaryKeys))
{
- $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
+ $this->mostTaggedFilms = Doctrine::getTable('ThdFilm')->findByScoredId($primaryKeys);
}
else
{
$this->mostTaggedFilms = array();
}
+ if(count($this->mostTaggedFilms) > 0) {
+
+ $taggedfilms = array();
+ foreach($this->mostTaggedFilms as $film) {
+ if(!isset($this->film)) {
+ $this->film = $film;
+ }
+ else {
+ $taggedfilms[] = $film;
+ }
+ }
+ $this->mostTaggedFilms = $taggedfilms;
+ }
+
return sfView::SUCCESS;
}
}
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/tag/config/view.yml Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/config/view.yml Fri Apr 30 05:18:17 2010 +0200
@@ -6,5 +6,5 @@
components:
- sideBar: [ tag, tagNavigator ]
+# sideBar: [ tag, tagNavigator ]
\ No newline at end of file
--- a/web/thdProject/apps/frontend/modules/tag/templates/_player.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/templates/_player.php Fri Apr 30 05:18:17 2010 +0200
@@ -1,98 +1,3 @@
-<script type="text/javascript">
- // Charge le player
- flowplayer("player", "<?php echo flash_path('flowplayer-3.1.2.swf') ?>",
- {
- clip: {url: "<?php echo film_video_path($filmVideo['file']); ?>",
- autoPlay: false,
- autoBuffering: true,
- onSeek: function() {
- playerSeek();
- }
- },
-
- plugins: {
-
- content: {url: "<?php echo flash_path('flowplayer.content-3.1.0.swf') ?>",
- backgroundColor: 'transparent',
- display: 'none',
- style: {p: {fontSize: 15}}
- }
-
- },
-
- onLoad: function() {
- playerLoaded(this);
- },
-
- onUnload: function() {
- playerUnloaded(this);
- },
- onError: function(code,msg) {
- alert(msg);
- },
- });
-
-
- function loadSegments() {
-
- if ($f().getClip() == undefined) {
- window.setTimeout("loadSegments()",2000);
- return false;
- }
-
- var duration = Math.round($f().getClip().fullDuration*10) * 100;
-
-
- var segments = tagTool.segments;
-
- for (seg in segments) {
- var segd = segments[seg].sout - segments[seg].sin;
- var percent = Math.round(segd * 100 / duration);
- var offset = Math.round(segments[seg].sin * 100 / duration);
- var c = $('#seg_container_template').clone().removeAttr("id");
- $("#segments").append(c);
- $("span", c).html('<strong>' + tagTool.segments[seg].tag +'</strong> 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);
- tagTool.playSegment(seg_id, $("#pauseAfter").val());
- });
- c.show();
- }
- }
-
-
- function playerSeek() {
- tagTool.rebuildCurrentTags(tagTool.player.getTime() * 1000);
- }
-
-
- function playerLoaded(player) {
-
- // Charge les tags
-
-
- tagTool.player = $f("player");
- tagTool.showTagInPage = false;
-
- }
- </script>
-<div id="editor">
- <h1><?php
-
- echo $film->getTitle();
- // original title if exist
-
- if($film->getOriginalTitle()!= null)
- {
- echo " <span class=\"ost\">{".$film->getOriginalTitle()."}</span>";
- }
- ?>
- <span class="film-infos">De <?php echo thd_render_flat_list($film->getDirectorsArray(), 'name'); ?></span></h1>
- <div class="section">
- <div id="player" class="player-ba"></div>
- <div class="tag-action"><a href="" class="link-button">Tagger le film</a></div>
- </div>
+<div id="player">
+ <?php include_component('partials', 'filmItem', Array('film' => $film, 'size' => 'big')); ?>
</div>
--- a/web/thdProject/apps/frontend/modules/tag/templates/_suggestionFilmList.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/templates/_suggestionFilmList.php Fri Apr 30 05:18:17 2010 +0200
@@ -1,14 +1,13 @@
<div id="suggestionFilm-list">
- <h3 class="head">Les films suivants</h3>
+ <h3 class="head">Autre films associés au tag <?php echo "$tag"; ?></h3>
<ul>
<?php
foreach($mostTaggedFilms as $item):
- $tagFilmUri = url_for('@editor?ref='.$item->getRef().'&film_slug='.$item->getSlugUrl());
+ $tagFilmUri = url_for('@editVideoSegment?film_slug='.$item->getSlugUrl());
?>
<li>
<?php include_component('partials', 'filmItem', Array('film' => $item, 'actionUri' => $tagFilmUri)); ?>
- <div class="tag-action"><a href="<?php echo $tagFilmUri ?>" class="link-button">Tagger le film</a></div>
</li>
<?php endforeach; ?>
</ul>
--- a/web/thdProject/apps/frontend/modules/tag/templates/_tagNavigator.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/templates/_tagNavigator.php Fri Apr 30 05:18:17 2010 +0200
@@ -1,14 +1,16 @@
<div id="tagNavigator-list">
+<?php if($film):?>
<h3>Tags associés à cet extrait</h3>
<ul>
- <?php
- $tag = "jalousietest";
- $uniqueId = "8b4c6c4e-47ef-11df-8746-6d6f73617461";
- ?>
+ <?php foreach($film->getDistinctTags() as $tag):?>
<li>
- <div class="tagActivated"><a href="<?php echo url_for('@searchReflex?film_uniqueid='.$uniqueId.'&tag='.$tag.'&direction=less&distance=5'); ?>">-</a></div>
+ <div class="tagActivated"><a href="<?php echo url_for('@searchReflex?film_uniqueid='.$film->uniqueid.'&tag='.$tag.'&direction=less&distance=5'); ?>">-</a></div>
<div class="tag"><?php echo $tag; ?></div>
- <div class="tagActivated"><a href="<?php echo url_for('@searchReflex?film_uniqueid='.$uniqueId.'&tag='.$tag.'&direction=more&distance=5'); ?>">+</a><div></div>
- </li>
-</ul>
-</div>
\ No newline at end of file
+ <div class="tagActivated"><a href="<?php echo url_for('@searchReflex?film_uniqueid='.$film->uniqueid.'&tag='.$tag.'&direction=more&distance=5'); ?>">+</a><div></div>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+<?php else:?>
+ <h3>Pas de tags associés</h3>
+<?php endif;?>
+</div>
--- a/web/thdProject/apps/frontend/modules/tag/templates/viewTagListSuccess.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/modules/tag/templates/viewTagListSuccess.php Fri Apr 30 05:18:17 2010 +0200
@@ -1,3 +1,6 @@
+<?php slot('sideBar'); ?>
+<?php include_component( 'tag', 'tagNavigator', array("film"=>$film)); ?>
+<?php end_slot(); ?>
<h3 class="head">Résultats pour : <i><?php echo $tag; ?></i></h3>
-<?php include_component( 'tag', 'player'); ?>
-<?php include_partial('tag/suggestionFilmList', array('filter' => 'all', 'filmCount' => '10', 'mostTaggedFilms' => $mostTaggedFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems)); ?>
+<?php include_component( 'tag', 'player', array("film"=>$film)); ?>
+<?php include_partial('tag/suggestionFilmList', array('filter' => 'all', 'filmCount' => '10', 'mostTaggedFilms' => $mostTaggedFilms, 'pageIndex' => $pageIndex, 'pageNbItems' => $pageNbItems, 'tag' => $tag)); ?>
--- a/web/thdProject/apps/frontend/templates/layout.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/apps/frontend/templates/layout.php Fri Apr 30 05:18:17 2010 +0200
@@ -19,12 +19,19 @@
<?php include_partial('partials/header')?>
<?php include_component('partials', 'navigation'); ?>
</div>
- <div id="content-wrapper"<?php if ($hasSideBar) echo ' class="sidebar"' ;?>>
- <?php if ($hasSideBar): ?>
- <div id="sidebar">
- <?php include_component_slot('sideBar'); ?>
- </div>
+ <?php if (has_slot('sideBar')): ?>
+ <div id="content-wrapper" class="sidebar" >
+ <div id="sidebar">
+ <?php include_slot('sideBar'); ?>
+ </div>
+ <?php else: ?>
+ <div id="content-wrapper"<?php if ($hasSideBar) echo ' class="sidebar"' ;?>>
+ <?php if ($hasSideBar): ?>
+ <div id="sidebar">
+ <?php include_component_slot('sideBar'); ?>
+ </div>
<?php endif; ?>
+ <?php endif; ?>
<div id="content">
<?php echo $sf_content ?>
</div>
--- a/web/thdProject/lib/core/ThdUtil.php Thu Apr 29 11:57:20 2010 +0200
+++ b/web/thdProject/lib/core/ThdUtil.php Fri Apr 30 05:18:17 2010 +0200
@@ -79,26 +79,16 @@
static public function getGlobalTagCloud($limit=10) {
$tags = Array();
- // Create query
- $query = Doctrine_Query::create()
- ->select("count(T.id), T.tag")
- ->from('ThdTag T')
- ->leftJoin('T.segment_tags ST')
- ->groupBy("T.id")
- ->orderBy("count(T.id) DESC")
- ->limit($limit);
-
//facet=true&facet.limit=-1&facet.field=tags
- //$parameters = Array('facet'=>'true', 'facet.limit'=>"$limit", 'facet.field'=>'tags' );
+ $parameters = Array('facet'=>'true', 'facet.limit'=>"$limit", 'facet.field'=>'tags' );
- //$solr = uvmcSolrServicesManager::getInstance()->getService();
- //$response = $solr->search("hello", 0, 10);
- //$result = unserialize($response->getRawResponse());
- //sfContext::getInstance()->getLogger()->info("SOLR FACET QUERY " . print_r($result,true));
+ $solr = uvmcSolrServicesManager::getInstance()->getService();
+ $response = $solr->search("*:*", 0, 0, $parameters);
+ $result = unserialize($response->getRawResponse());
- foreach ($query->execute() as $item) {
- $tags[] = Array('tag' => $item->getTag(), 'count' => (int) $item->count);
+ foreach ($result["facet_counts"]["facet_fields"]["tags"] as $tag_name => $count) {
+ $tags[] = Array('tag' => $tag_name, 'count' => (int) $count);
}
return $tags;