web/client.php
changeset 229 74c9ddc3640b
parent 200 df98bc033a67
child 231 1006d8050b22
--- a/web/client.php	Mon Jul 18 13:40:06 2011 +0200
+++ b/web/client.php	Mon Jul 25 18:50:20 2011 +0200
@@ -1,10 +1,15 @@
 <?php
 
-/**
- * include some common code (like we did in the 90s)
- * People still do this? ;)
- */
-include_once './common.php';
+if(!isset($_REQUEST['rep'])) {
+	include_once dirname(__FILE__).'/config.php';
+	header('Location: ' . URL_ROOT . "$C_default_rep/client.php" );
+	exit();
+}
+
+$rep = $_REQUEST['rep'];
+include_once dirname(__FILE__).'/'.$rep.'/config.php';
+
+include_once 'common.php';
 
 /**
  * Do we already have a valid Access Token or need to go get one?
@@ -24,6 +29,16 @@
 }
 
 
+$big_visual_url = URL_ROOT."/$rep/images/big_visuel_rsln_mb.jpg";
+if(isset($config['client_visual']) && $config['client_visual'] != null ) {
+	$big_visual_url = URL_ROOT."$rep/".$config['client_visual'];
+}
+
+$head_logo = URL_ROOT."$rep/images/head_logo.gif";
+if(isset($config['head_logo']) && $config['head_logo'] != null ) {
+	$head_logo = URL_ROOT."$rep/".$config['head_logo'];
+}
+
 ?>
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
@@ -36,25 +51,25 @@
 	<meta http-equiv="X-UA-Compatible" content="IE=8" /> 
 
     <!-- Framework CSS -->
-    <link rel="stylesheet" href="res/blueprint/screen.css" type="text/css" media="screen, projection">
-    <link rel="stylesheet" href="res/blueprint/print.css" type="text/css" media="print">
-    <!--[if lt IE 8]><link rel="stylesheet" href="blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
-	<link rel="stylesheet" href="res/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">
-	<link rel="stylesheet" href="res/css/custom.css" type="text/css" media="screen, projection">
-	<link rel="stylesheet" type="text/css" href="res/jquery.fancybox/fancybox/jquery.fancybox-1.3.4.css" media="screen">
-	<link rel="stylesheet" type="text/css" href="res/niceforms/niceforms-custom.css" media="screen" >
+    <link rel="stylesheet" href="<?php echo(URL_ROOT); ?>res/blueprint/screen.css" type="text/css" media="screen, projection">
+    <link rel="stylesheet" href="<?php echo(URL_ROOT); ?>res/blueprint/print.css" type="text/css" media="print">
+    <!--[if lt IE 8]><link rel="stylesheet" href="<?php echo(URL_ROOT); ?>res/blueprint/ie.css" type="text/css" media="screen, projection"><![endif]-->
+	<link rel="stylesheet" href="<?php echo(URL_ROOT); ?>res/blueprint/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">
+	<link rel="stylesheet" href="<?php echo(URL_ROOT); ?>res/css/custom.css" type="text/css" media="screen, projection">
+	<link rel="stylesheet" type="text/css" href="<?php echo(URL_ROOT); ?>res/jquery.fancybox/fancybox/jquery.fancybox-1.3.4.css" media="screen">
+	<link rel="stylesheet" type="text/css" href="<?php echo(URL_ROOT); ?>res/niceforms/niceforms-custom.css" media="screen" >
 
 	<!-- JAVASCRIPT --> 
-	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.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/metadataplayer/res/js/jquery.tools.min.js"></script>
-	<script type="text/javascript" src="res/niceforms/niceforms.js"></script>
-	<script src="http://widgets.twimg.com/j/2/widget.js"></script>
+	<script type="text/javascript" src="<?php echo(registry_url('jquery','js'))?>"></script>
+	<script type="text/javascript" src="<?php echo(registry_url('fancybox','js'))?>"></script>
+	<script type="text/javascript" src="<?php echo(registry_url('jquery-tools','js'))?>"></script>
+	<script type="text/javascript" src="<?php echo(registry_url('niceforms','js'))?>"></script>
+	<script type="text/javascript" src="<?php echo(registry_url('tw-widget','js'))?>"></script>
 	
 	<!-- FONT -->
-	<link href='http://fonts.googleapis.com/css?family=PT+Sans+Narrow&subset=latin' rel='stylesheet' type='text/css'>
-	<link href='http://fonts.googleapis.com/css?family=PT+Sans&subset=latin' rel='stylesheet' type='text/css'>
-	<link href='http://fonts.googleapis.com/css?family=Geo&subset=latin' rel='stylesheet' type='text/css'>
+	<link href='<?php echo(registry_url('PT-Sans_Narrow','font'))?>' rel='stylesheet' type='text/css'>
+	<link href='<?php echo(registry_url('PT-Sans','font'))?>' rel='stylesheet' type='text/css'>
+	<link href='<?php echo(registry_url('Geo','font'))?>' rel='stylesheet' type='text/css'>
 
 	<script type="text/javascript">	
 	$(document).ready(function() {
@@ -62,32 +77,33 @@
 			doTimer();
 			//$("txt").hide();
 			$(".loginbutton").click(function() {
-				document.location.href="<?php URL_ROOT ?>?CONNECT=true";
+				document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
 			});
 			$("#IDENTIFIER").click(function() {
-				document.location.href="<?php URL_ROOT ?>?CONNECT=true";
+				document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
 			});
 			
 			$("#messageSuccess").hide();
 			$("#messageFailed").hide();
-			$("#txt").hide();
+
+
+			function add_grammar(value) {
+				$('#status').val($('#status').val()+value+" ");
+				$('#status').change();
+			}
 			
 			// BUTTONS
 			$("#positive").click(function(){
-				var MyValue = $('#status').attr("value");
-				 $('#status').attr("value",MyValue+"++ ");
+				add_grammar("++");
 			});
 			$("#negative").click(function(){
-				var MyValue = $('#status').attr("value");
-				$('#status').attr("value",MyValue+"-- ");
+				add_grammar("--");
 			});
 			$("#reference").click(function(){
-				var MyValue = $('#status').attr("value");
-				$('#status').attr("value",MyValue+"== ");
+				add_grammar("==");
 			});
 			$("#question").click(function(){
-				var MyValue = $('#status').attr("value");
-				$('#status').attr("value",MyValue+"?? ");
+				add_grammar("??");
 			});
 			
 			// SEND TWEETS 
@@ -99,7 +115,7 @@
 					if(data=="true"){
 						$("#messageSuccess").show('fast');
 						$("#messageSuccess").delay(800).hide('slow');
-						$('#status').attr("value","<?php echo($C_hashtag); ?>");
+						$('#status').attr("value","<?php echo($config['hashtag']); ?>");
 					}else{
 						$("#error").text(data);
 						$("#messageFailed").show('fast');
@@ -108,7 +124,18 @@
 					
 				});
 				
-			});			
+			});	
+
+			$("#status").bind("change keyup paste blur focus",function() {
+				newval = 140-$("#status").val().length;
+				$('#tweetCounter').val(newval);
+				if(newval < 0) {
+					$('#tweetCounter').addClass("tweetCounterNegative");
+				}
+				else {
+					$('#tweetCounter').removeClass("tweetCounterNegative");
+				}				
+			});		
 			
 			$(".timeFrame").tooltip();
 			/*
@@ -153,14 +180,13 @@
 		
 		
 		<!-- LIMIT TEXTAREA:
-		function imposemax(Object)
-		{
-		  return (Object.value.length <= 140);
+		function imposemax(Object) {
+            return (Object.value.length <= 140);
 		}
 		// End -->
 		
 		<!-- TIMER 
-		var c=0;
+	    var c=0;
 		var t;
 		var timer_is_on=0;
 
@@ -229,12 +255,12 @@
   </head>
   <body>
     <div class="container">
-      <img src="<?php echo($C_REP); ?>/images/head_logo.gif" class="Producteur logo">
+      <img src="<?php echo($head_logo); ?>" class="Producteur logo">
 		<div id="minilogo" style="margin-left:85px;height:5px;top:5px;"></div>
 	  <ul class="menu"> 
-	  <li class="menuUnderline"><a href="index.php" class="menuLink">
+	  <li class="menuUnderline"><a href="<?php echo(URL_ROOT); ?>" class="menuLink">
 	  	<?php print $translate->_("Accueil"); ?> </a></li>
-	  <li class="menuUnderline" ><a href="<?php echo($C_link); ?>" class="menuLink" target="_blank" id='Program'> 
+	  <li class="menuUnderline" ><a href="<?php echo($config['link']); ?>" class="menuLink" target="_blank" id='Program'> 
 	  	<?php print $translate->_("Programme"); ?></a></li>
 	  <li ><a href="about.php" class="menuLink" >
 	  	<?php print $translate->_("A propos"); ?></a></li>
@@ -242,38 +268,38 @@
 	  </ul>
 	  
 	  	  <ul class="menu" > 
-	  <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;'"); } ?> />
+	  <li class="menuUnderline"><a href="<?php URL_ROOT ?>client.php?lang=ja_JP" class="menuLink" >
+	       <img src='<?php echo(URL_ROOT); ?>images/flag_jp.gif'<?php if($actual!="ja_JP"){echo("style='opacity: .5;'"); } ?> />
 	        <?php print $translate->_("Japonais"); ?></a></li>
-	  <li class="menuUnderline"><a href="<?php URL_ROOT ?>?lang=fr" class="menuLink">
-	       <img src='images/flag_fr.gif' <?php if($actual!="fr"){echo("style='opacity: .5;'"); } ?> />
+	  <li class="menuUnderline"><a href="<?php URL_ROOT ?>client.php?lang=fr" class="menuLink">
+	       <img src='<?php echo(URL_ROOT); ?>images/flag_fr.gif' <?php if($actual!="fr"){echo("style='opacity: .5;'"); } ?> />
 	       <?php print $translate->_("Français"); ?></a></li>
-	  <li ><a href="<?php URL_ROOT ?>?lang=en" class="menuLink">
-	       <img src='images/flag_en.gif' <?php if($actual!="en"){echo("style='opacity: .5;'"); } ?> />
+	  <li ><a href="<?php URL_ROOT ?>client.php?lang=en" class="menuLink">
+	       <img src='<?php echo(URL_ROOT); ?>images/flag_en.gif' <?php if($actual!="en"){echo("style='opacity: .5;'"); } ?> />
 	       <?php print $translate->_("Anglais"); ?></a></li>
 	  </ul>
 
 	  
 	  <div class="videoLive">
-	  <?php if ($C_islive):?>
+	  <?php if ($config['islive']):?>
 	  <div class="videoLivePlayer">
 			<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="500" height="375"> 
-				<param name="movie" value="res/mediaplayer/player.swf" /> 
+				<param name="movie" value="<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf" /> 
 				<param name="allowfullscreen" value="true" /> 
 				<param name="allowscriptaccess" value="always" /> 
 				<param name="wmode" value="transparent" />
-				<param name="flashvars" value="autostart=true&live=true&image=<?php echo($C_REP); ?>/images/big_visuel_rsln_mb.jpg&provider=rtmp&streamer=rtmp://media.iri.centrepompidou.fr/ddc_player/&file=livestream&controlbar=none&autostart=true" /> 
+				<param name="flashvars" value="autostart=true&live=true&image=<?php echo($big_visual_url); ?>&provider=rtmp&streamer=rtmp://media.iri.centrepompidou.fr/ddc_player/&file=livestream&controlbar=none&autostart=true" /> 
 				<embed 
 					type="application/x-shockwave-flash"
 					id="player2"
 					name="player2"
-					src="res/mediaplayer/player.swf" 
+					src="<?php echo(URL_ROOT); ?>res/mediaplayer/player.swf" 
 					width="500" 
 					height="375"
 					allowscriptaccess="always" 
 					allowfullscreen="true"
 					wmode="transparent"
-					flashvars="autostart=true&live=true&provider=rtmp&streamer=rtmp://media.iri.centrepompidou.fr/ddc_player/&file=livestream&image=<?php echo($C_REP); ?>/images/big_visuel_rsln_mb.jpg&controlbar=none&autostart=true" 
+					flashvars="autostart=true&live=true&provider=rtmp&streamer=rtmp://media.iri.centrepompidou.fr/ddc_player/&file=livestream&image=<?php echo($big_visual_url); ?>&controlbar=none&autostart=true" 
 					
 				/> 
 			</object> 
@@ -282,7 +308,7 @@
 	  	<?php else: ?>
 	  
 		<div class="videoLivePlayer">
-			<img src="<?php echo($C_REP); ?>/images/big_visuel_rsln_mb.jpg" width="500"  height="375" />
+			<img src="<?php echo($big_visual_url); ?>" width="500"  height="375" />
 		</div>
 		<?php endif; ?>
 		
@@ -294,9 +320,9 @@
 			<div class="arrow"> </div>
 		</div>
 		<div class="videoLiveProgramTitle">
-			<b><?php echo($C_title); ?></b></div>
+			<b><?php echo($config['title']); ?></b></div>
 		<div class="videoLiveProgramDescription">
-			<br><?php echo($C_description); ?></div>
+			<br><?php echo($config['description']); ?></div>
 		
 		
 	</div>
@@ -305,10 +331,10 @@
 		<h3 class="tweetWriterTitle"><?php print $translate->_("ClientTitle1 :"); ?></h3>
 		<form  action="tweet.php" method="post" id="statusform" >
 		<?php if (!isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
-				echo("<div class='loginbutton' ><a href='".URL_ROOT."?CONNECT=true' class='loginlink'>
+				echo("<div class='loginbutton' ><a href='".URL_ROOT."$rep/client.php?CONNECT=true' class='loginlink'>
 				".$translate->_("Vous n'êtes pas connecté.")."</a></div>");
 			  }else{
-				echo("<textarea name='status' id='status' rows='3' cols='50' onkeypress='return imposemax(this);'>".$C_hashtag."</textarea>");
+				echo("<textarea name='status' id='status' rows='3' cols='50' onkeypress='return imposemax(this);'>$config[hashtag]</textarea>");
 			  }
 		?>
 
@@ -324,9 +350,13 @@
 			  
 			
 			<a class="button_w" href="#"  id="sendTweet" style="float:right;margin-right:15px;margin-left:35px;width:70px;" >
-			<span><?php print $translate->_("Envoyer"); ?></span></a> 
+				<span><?php print $translate->_("Envoyer"); ?></span>
+			</a> 
 			<!--<button name="s" type="button" id="sendTweet"
 					style="float:right;margin-right:15px;margin-left:35px;width:70px;"  >Envoyer</button>-->
+			<?php if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])): ?>
+			<input id="tweetCounter" value="<?php echo(140-strlen($config[hashtag]));?>" disabled="disabled" size="3"/>
+			<?php endif;?>
 			<a 
 					
 					id="positive"
@@ -355,7 +385,7 @@
 				new TWTR.Widget({
 				  version: 2,
 				  type: 'search',
-				  search: '<?php echo($C_hashtag); ?>',
+				  search: '<?php echo($config['hashtag']); ?>',
 				  interval: 3000,
 				  title: '',
 				  subject: '',
@@ -389,13 +419,13 @@
       <div class="footer">
 		<hr>
 		 <?php 
-				echo($C_partenaires);
+				echo($config['partenaires']);
 				
 				if (isset($_SESSION['TWITTER_ACCESS_TOKEN'])){
 					echo("| 	<a href='clear.php'  class='footerLink'>".$translate->_("D&eacute;connexion")."</a>");
 				}
 		 ?>
-		  <input type="text" id="txt" size="3"/>
+		  <input type="hidden" id="txt"/>
 		  
 	  </div>