Bug 551386 - Scorecard and index page improvements

Change-Id: Icbe84216e1586c9022d8a8e7af184c9d6a6749b2
Signed-off-by: droy <denis.roy@eclipse-foundation.org>
diff --git a/classes/system/scoreboard.class.php b/classes/system/scoreboard.class.php
index 8909a79..fe79fb1 100644
--- a/classes/system/scoreboard.class.php
+++ b/classes/system/scoreboard.class.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2008 Eclipse Foundation and others.
+ * Copyright (c) 2008-2019 Eclipse Foundation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -27,9 +27,9 @@
 
 			# rebuilding the scoreboard takes time ... dump stuff to tmp
 			mysqli_query($dbh, "CREATE TEMPORARY TABLE _tmp_scoreboard LIKE scoreboard");
-			$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LANGPR', IF(ISNULL(b.locale),b.name,CONCAT(b.name, CONCAT(' (', CONCAT(b.locale, ')')))), count(a.string_id) as cnt from translations as a inner join languages as b on b.language_id = a.language_id where a.created_on > (NOW() - INTERVAL 1 YEAR) and a.value <> '' and a.is_active = 1 group by a.language_id order by cnt desc limit 20";
+			$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LANGPR', IF(ISNULL(b.locale),b.name,CONCAT(b.name, CONCAT(' (', CONCAT(b.locale, ')')))) AS language,  COUNT(t.string_id) / COUNT(s.string_id)*100 as tr_pct FROM strings as s inner join languages as b  left join translations as t ON s.string_id = t.string_id AND t.is_active and t.language_id = b.language_id where s.created_on > (NOW() - INTERVAL 1 YEAR) and s.value <> '' and s.is_active = 1 group by b.language_id order by tr_pct desc limit 20";
 			mysqli_query($dbh, $sql);
-			$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'TOPTR', CONCAT(first_name, IF(ISNULL(last_name),'',CONCAT(' ', last_name))), count(t.string_id) as cnt from translations as t inner join users as u on u.userid = t.userid where t.created_on > (NOW() - INTERVAL 1 YEAR) and t.value <> '' and t.is_active=1 group by first_name, last_name order by cnt desc limit 20";
+			$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'TOPTR', CONCAT(first_name, IF(ISNULL(last_name),'',CONCAT(' ', last_name))) AS name, count(t.string_id) as cnt from translations as t inner join users as u on u.userid = t.userid where t.created_on > (NOW() - INTERVAL 1 YEAR) and t.value <> '' and t.is_active=1 group by first_name, last_name having name <> 'Babel Syncup' order by cnt desc limit 20";
 			mysqli_query($dbh, $sql);
 
 			$sql = "INSERT INTO _tmp_scoreboard SELECT NULL, 'LASGEN', 'Scoreboard Last Generated', MAX(translation_id) FROM translations";
diff --git a/html/babel.css b/html/babel.css
index c9f3c39..6eed467 100644
--- a/html/babel.css
+++ b/html/babel.css
@@ -1124,7 +1124,7 @@
 	text-align: center;
 }
 #trans-progress-area dl{
-	width: 150px;
+	width: 230px;
 	height: 8em;
 	overflow-y: auto;
 	overflow-x: hidden;	
@@ -1135,13 +1135,13 @@
 #trans-progress-area dt,
 #trans-progress-area dd{
 	float: left;
-	width: 30px;
+	width: 75px;
 	border: 0px solid blue;
 	padding: 0px;
 	margin: 0px;
 }
 #trans-progress-area dt{
-	width: 70px;
+	width: 125px;
 }
 #trans-progress-area dd{
 	clear: right;
@@ -1172,7 +1172,7 @@
 	text-align: center;
 }
 #top-translators-area dl{
-	width: 150px;
+	width: 230px;
 	height: 8em;
 	overflow-y: auto;
 	overflow-x: hidden;	
@@ -1189,7 +1189,7 @@
 	margin: 0px;
 }
 #top-translators-area dt{
-	width: 70px;
+	width: 125px;
 }
 #top-translators-area dd{
 	clear: right;
diff --git a/html/fragments/language_progress.php b/html/fragments/language_progress.php
index c919beb..f2bf280 100644
--- a/html/fragments/language_progress.php
+++ b/html/fragments/language_progress.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2008 Eclipse Foundation and others.
+ * Copyright (c) 2008-2019 Eclipse Foundation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -20,7 +20,7 @@
 
 ?>
 <div id="trans-progress-area">
-	<h2>Translation Progress</h2>
+	<h2>Translation Progress %</h2>
 	<dl>
 	<?php
 		while($row = mysqli_fetch_assoc($res)){
diff --git a/html/index.php b/html/index.php
index 369a916..3a5b7fe 100644
--- a/html/index.php
+++ b/html/index.php
@@ -1,6 +1,6 @@
 <?php
 /*******************************************************************************
- * Copyright (c) 2007-2008 Eclipse Foundation and others.
+ * Copyright (c) 2007-2019 Eclipse Foundation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -21,7 +21,7 @@
 ?>
 <h1 id="page-message">Welcome to the Babel Project</h1>
 <?php include("fragments/motd.php");?>
-<div id="index-page" style='width: 510px; padding-right: 190px;'>
+<div id="index-page" style='width: 610px; padding-right: 190px;'>
 	  <div style='float: right;height: 290px; border: 0px solid red;'>
 	      <?php include("fragments/language_progress.php");?>
 		  <?php include("fragments/top_translators.php");?>	  
@@ -32,20 +32,20 @@
 	      <br style='clear: both;'>
 		  <p><a href="http://www.eclipse.org/babel/downloads.php">Download a language pack</a> in one of many different languages.</p>
 		  <p><a href="languages.php">Languages</a> supported by Babel</p>.
-	         
+
 		  <a href="translate.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/accessories-text-editor.png"><h2>Help Translate Eclipse</h2></a>
 	      <br style='clear: both;'>
 		  <p>Eclipse needs help from everyone in the community to <a href="translate.php">speak in many tongues</a>.</p>
-	      
+
 		  <a href="map_files.php"><img src="<?php echo imageRoot() ?>/large_icons/apps/system-users.png"><h2>Add an Existing Eclipse Project to Babel</h2></a>
 	      <br style='clear: both;'>
 		  <p>Eclipse committers, find out how simple it is to include any existing Eclipse.org project <a href="map_files.php">in Babel</a>.</p>
-		  
+
 		  <a href="help_babel.php"><img src="<?php echo imageRoot() ?>/large_icons/categories/preferences-desktop-peripherals.png"><h2>Become a Babel Team Player</h2></a>
 	      <br style='clear: both;'>
 		  <p>The Babel project has lots of ideas and we need your help to take this project to the <a href="help_babel.php">next level</a>.</p>
 
-	  </div>	  
+	  </div>
 	  <br class='clearing'>
 </div>