web/mashup/polemicaltimeline.php
changeset 203 8124cde38141
parent 202 2bf0fd3432bf
child 205 dfda2d71838b
equal deleted inserted replaced
202:2bf0fd3432bf 203:8124cde38141
    96   		var metadata_key = url.fparam('metadata');
    96   		var metadata_key = url.fparam('metadata');
    97   		if(typeof metadata_key === "undefined" || metadata_key.length === 0) {
    97   		if(typeof metadata_key === "undefined" || metadata_key.length === 0) {
    98   			metadata_key = "<?php echo($first_key);?>";
    98   			metadata_key = "<?php echo($first_key);?>";
    99   		} 
    99   		} 
   100   		<?php else: ?>
   100   		<?php else: ?>
   101   		var metadatas = { metadata: {url: "<?php echo($config['metadata'])?>"} };
   101   		var metadatas = { metadata: {url: "<?php echo($config['metadata'])?>", duration: <?php echo($config['duration'])?>} };
   102   		var metadata_key = "metadata"; 
   102   		var metadata_key = "metadata"; 
   103   		<?php endif;?>
   103   		<?php endif;?>
   104   		
   104   		
   105 		var config = {
   105 		var config = {
   106 					target:"chartTimeline",
   106 					target:"chartTimeline",
   107 					x:8,
   107 					x:8,
   108 					y:418,
   108 					y:418,
   109 					width:<?php echo($player_width); ?>,
   109 					width:<?php echo($player_width); ?>,
   110 					height:<?php echo($player_height); ?>,
   110 					height:<?php echo($player_height); ?>,
   111 					heightmax:<?php echo($player_height); ?>,
   111 					heightmax:<?php echo($player_height); ?>,
   112 					duration:<?php echo($config['duration']); ?>,
   112 					duration:metadatas[metadata_key].duration,
   113 					metadata:metadatas[metadata_key].url
   113 					metadata:metadatas[metadata_key].url
   114 					};
   114 					};
   115   	</script>
   115   	</script>
   116 	<script type='text/javascript' src='../res/metadataplayer.polemic/src/js/polemic.js'></script>
   116 	<script type='text/javascript' src='../res/metadataplayer.polemic/src/js/polemic.js'></script>
   117 	<script type="text/javascript">
   117 	<script type="text/javascript">
   130 
   130 
   131 			
   131 			
   132 			jQuery("#mdselect_"+metadata_key).attr("selected","selected");
   132 			jQuery("#mdselect_"+metadata_key).attr("selected","selected");
   133 			jQuery("#mdselect").change(function() {
   133 			jQuery("#mdselect").change(function() {
   134 				var metadata_key = this.options[this.selectedIndex].value;
   134 				var metadata_key = this.options[this.selectedIndex].value;
   135 				var hashpart = window.location.hash;
   135 				window.location.hash = "#metadata="+metadata_key;
   136 				var window_location = window.location.href;
       
   137 				if(hashpart.length === 0) {
       
   138 					hashpart = "#metadata="+metadata_key;
       
   139 				}
       
   140 				else if (hashpart.indexOf("metadata=")>=0) {
       
   141 					hashpart = hashpart.replace(/metadata=[\w\d]*/, "metadata="+metadata_key)
       
   142 				}
       
   143 				else {
       
   144 					hashpart += "&metadata="+metadata_key;
       
   145 				}
       
   146 				window.location.hash = hashpart;
       
   147 				window.location.href = window.location.href;
   136 				window.location.href = window.location.href;
   148 				window.location.reload(true);
   137 				window.location.reload(true);
   149 			});
   138 			});
   150 		});
   139 		});
   151 	</script>	
   140 	</script>	
   179 		    <?php print $translate->_("Partager"); ?></a></li>
   168 		    <?php print $translate->_("Partager"); ?></a></li>
   180 		  <li >&nbsp;</li>
   169 		  <li >&nbsp;</li>
   181 	  </ul>
   170 	  </ul>
   182 	<?php if(is_array($config['metadata'])):?>
   171 	<?php if(is_array($config['metadata'])):?>
   183 	<ul id="content_select_ul" class="menu mdselect">
   172 	<ul id="content_select_ul" class="menu mdselect">
       
   173 	    <?php print $translate->_("changer de contenu"); ?><br/>
   184 	    <select id="mdselect">
   174 	    <select id="mdselect">
   185 	    	<?php foreach ($config['metadata'] as $key => $value):?>
   175 	    	<?php foreach ($config['metadata'] as $key => $value):?>
   186 	    	<option value="<?php echo($key); ?>" id="mdselect_<?php echo($key); ?>" ><?php echo($value['display']); ?></option>
   176 	    	<option value="<?php echo($key); ?>" id="mdselect_<?php echo($key); ?>" ><?php echo($value['display']); ?></option>
   187 	    	<?php endforeach;?>
   177 	    	<?php endforeach;?>
   188 	    </select>
   178 	    </select>