web/mashup/polemicaltimeline.php
changeset 202 2bf0fd3432bf
parent 197 77e3207456b7
child 203 8124cde38141
--- a/web/mashup/polemicaltimeline.php	Tue Jun 28 12:23:36 2011 +0200
+++ b/web/mashup/polemicaltimeline.php	Tue Jun 28 22:23:56 2011 +0200
@@ -9,12 +9,14 @@
  // objet actuel 
 include_once 'config.php';
 
+$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
+
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html lang="<?php echo($actual); ?>">
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-    <title>Polemic tweet - <?php echo($config['title']); ?></title>
+    <title>Polemic tweet - <?php echo($config['title']); ?> - <?php echo($url); ?></title>
 	<meta name="keywords" content="<?php echo($config['keywords']); ?>"><!-- add timestampedmetadata -->
 	<!--<meta name="description" content="PoelmicTweet.fr : debate mapping, opinion, conference, video">-->
 	<meta name="description" content="<?php echo($config['description']); ?>">
@@ -23,9 +25,14 @@
 	<!-- ICI : <?php echo($_SERVER['DOCUMENT_ROOT']); ?> -->
 	<!-- JAVASCRIPT --> 
 	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+	<script type="text/javascript">	
+		$.noConflict();
+	</script>
 	<script type="text/javascript" src="../res/raphael/raphael-min.js"></script>
 	<script type="text/javascript" src="../res/jquery.fancybox/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
 	<script type="text/javascript" src="../res/niceforms/niceforms.js"></script>
+	<script type="text/javascript" src="../res/jquery.url/jquery.url.js"></script>
+	<script type='text/javascript' src='../res/metadataplayer/src/js/LdtPlayer.js'></script>
 		
 	<!-- Framework CSS -->
     <link rel="stylesheet" href="../res/blueprint/screen.css" type="text/css" media="screen, projection">
@@ -76,25 +83,43 @@
 			position : absolute;
 		}
 
-	</style>
+	</style>	
 	<script type="text/javascript">
-	
-	  var _gaq = _gaq || [];
-	  _gaq.push(['_setAccount', 'UA-23581291-1']);
-	  _gaq.push(['_setDomainName', '.iri.centrepompidou.fr']);
-	  _gaq.push(['_trackPageview']);
+  		// Configuration Polemical Timeline
+  		<?php
+  		if(is_array($config['metadata'])):
+  			reset($config['metadata']);
+  		    $first_key = key($config['metadata']);
+  		?>
+  		var metadatas = jQuery.parseJSON('<?php echo(json_encode($config['metadata'])); ?>');
+  		var url = jQuery.url();
+  		var metadata_key = url.fparam('metadata');
+  		if(typeof metadata_key === "undefined" || metadata_key.length === 0) {
+  			metadata_key = "<?php echo($first_key);?>";
+  		} 
+  		<?php else: ?>
+  		var metadatas = { metadata: {url: "<?php echo($config['metadata'])?>"} };
+  		var metadata_key = "metadata"; 
+  		<?php endif;?>
+  		
+		var config = {
+					target:"chartTimeline",
+					x:8,
+					y:418,
+					width:<?php echo($player_width); ?>,
+					height:<?php echo($player_height); ?>,
+					heightmax:<?php echo($player_height); ?>,
+					duration:<?php echo($config['duration']); ?>,
+					metadata:metadatas[metadata_key].url
+					};
+  	</script>
+	<script type='text/javascript' src='../res/metadataplayer.polemic/src/js/polemic.js'></script>
+	<script type="text/javascript">
+		jQuery.extend(__IriSP.lib,{jQueryToolTip:"../res/metadataplayer/res/js/jquery.tools.min.js"});
 
-	  (function() {
-	    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
-	    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-	    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
-	  })();
-	
-	</script>
-	<script type="text/javascript">
-		$(document).ready(function() {
+		jQuery(document).ready(function() {
 		
-			$("#Embeded").fancybox({
+			jQuery("#Embeded").fancybox({
 				'width'				: 360,
 				'height'			: 360,
 				'autoDimensions'	: false,
@@ -102,25 +127,40 @@
 				'transitionOut'		: 'none',
 				'type'				: 'iframe'
 			});
+
 			
+			jQuery("#mdselect_"+metadata_key).attr("selected","selected");
+			jQuery("#mdselect").change(function() {
+				var metadata_key = this.options[this.selectedIndex].value;
+				var hashpart = window.location.hash;
+				var window_location = window.location.href;
+				if(hashpart.length === 0) {
+					hashpart = "#metadata="+metadata_key;
+				}
+				else if (hashpart.indexOf("metadata=")>=0) {
+					hashpart = hashpart.replace(/metadata=[\w\d]*/, "metadata="+metadata_key)
+				}
+				else {
+					hashpart += "&metadata="+metadata_key;
+				}
+				window.location.hash = hashpart;
+				window.location.href = window.location.href;
+				window.location.reload(true);
+			});
 		});
+	</script>	
+	<script type="text/javascript">
+		var _gaq = _gaq || [];
+		_gaq.push(['_setAccount', 'UA-23581291-1']);
+		_gaq.push(['_trackPageview']);
+		
+		(function() {
+		    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
+		    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+		    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
+		})();
 	</script>
-	
   </head>
-  <script type="text/javascript">
-  	// Configuration Polemical Timeline
-	var config = {
-					target:"chartTimeline",
-					x:8,
-					y:418,
-					width:650,
-					height:480,
-					heightmax:480,
-					duration:<?php echo($config['duration']); ?>,
-					metadata:"<?php echo($config['metadata']); ?>"
-					};
-  </script>
-  <script type='text/javascript' src='../res/metadataplayer.polemic/src/js/polemic.js'></script>
   <body>
   
 
@@ -139,8 +179,18 @@
 		    <?php print $translate->_("Partager"); ?></a></li>
 		  <li >&nbsp;</li>
 	  </ul>
-	  
-	<ul class="menu lang" > 
+	<?php if(is_array($config['metadata'])):?>
+	<ul id="content_select_ul" class="menu mdselect">
+	    <select id="mdselect">
+	    	<?php foreach ($config['metadata'] as $key => $value):?>
+	    	<option value="<?php echo($key); ?>" id="mdselect_<?php echo($key); ?>" ><?php echo($value['display']); ?></option>
+	    	<?php endforeach;?>
+	    </select>
+	</ul>
+	<ul class="menu shortlang" >
+	<?php else:?>
+	<ul class="menu lang" >
+	<?php endif;?>	  
 	  <li class="menuUnderline"><a href="<?php URL_ROOT ?>?lang=ja_JP" class="menuLink" >
 	       <img src='../images/flag_jp.gif'<?php if($actual!="ja_JP"){echo("style='opacity: .5;'"); } ?> />
 	        <?php print $translate->_("Japonais"); ?></a></li>
@@ -171,43 +221,32 @@
 
 	  <div class="videoLive" >
 		<div class="videoLivePlayer">
-
-		<div id="chartTimeline"> </div>	
-		<script type="text/javascript">
-			var paper = Raphael(document.getElementById("chartTimeline"),config.width, config.height);
-		</script>
-		
-		<script type='text/javascript' src='../res/metadataplayer/src/js/LdtPlayer.js'></script>
-		<script type="text/javascript">
-			$.extend(__IriSP.lib,{jQueryToolTip:"../res/metadataplayer/res/js/jquery.tools.min.js"});
-		</script>
-		
-		<div id="player_project_13b0aa52-336b-11e0-b233-00145ea49a02_embed" class="iri_player_embed"> </div>
+			<div id="chartTimeline"> </div>
+			<script type="text/javascript">
+				var paper = Raphael(document.getElementById("chartTimeline"),config.width, config.height);
+			</script>
+			<div id="player_project_embed" class="iri_player_embed"></div>
 			<script type="text/javascript">
 				var configMP = {
-						/*metadata:{
-							format:'cinelab',
-							src:'metadata.json',
-							load:'json'},*/
 						metadata:{
 							format:'cinelab',
-							src:'<?php echo($config['metadata']); ?>',
+							src:config.metadata,
 							load:'jsonp'},
 						gui:{
-							width:650,
-							height:480,
+							width:config.width,
+							height:config.height,
 							mode:'video',
-							container:'player_project_13b0aa52-336b-11e0-b233-00145ea49a02_embed',
+							container:'player_project_embed',
 							debug:false,
 							css:'../res/css/LdtPlayer.css'},
-	
+			
 						player:{
 							type:'jwplayer',
-							src:'http://www.iri.centrepompidou.fr//dev/ldt/static/ldt/swf/player.swf'}
+							src:'../res/metadataplayer/res/swf/player.swf'}
 					};
-				__IriSP.init(configMP);     
+				__IriSP.init(configMP);
 			</script>
-		</div>	
+		</div>
 	  </div>