Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/css/eurovision.css
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/css/eurovision.css	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/css/eurovision.css	(revision 34911)
@@ -11,9 +11,18 @@
     font-size: 110%;
     font-weight: bold;
-    padding-top: 6px;
+    padding-top: 3px;
+    padding-bottom: 3px;
+    margin-top: 10px;    
+    border-top: 1px solid white;
+    border-bottom: 1px solid white;
+    background-color: rgba(255,255,255,0.2);
+}
+
+.voting-points-div {
+    border-bottom: 1px solid white;
 }
 
 .voting-country {
-    width: 150px;
+    width: 180px;
 }
 
@@ -23,2 +32,7 @@
     text-align: right;
 }
+
+#find-more-content {
+    padding-top: 12px;
+}
+
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/etc/collectionConfig.xml
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/etc/collectionConfig.xml	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/etc/collectionConfig.xml	(revision 34911)
@@ -66,7 +66,6 @@
 	</gsf:switch>
       </xsl:if>
-      
+
     </gsf:template>
-
 
     
@@ -93,5 +92,5 @@
     <index name="Year">
       <displayItem name="name" key="Year.buttonname" dictionary="collectionConfig"/>
-    </index>      
+    </index>      o
 
     <sort name="rank"/>
@@ -160,5 +159,7 @@
       </plugin>
       <plugin name="MetadataXMLPlugin"/>
-      <plugin name="MetadataJSONPlugin"/>
+      <plugin name="MetadataJSONPlugin">
+	<option name="process_exp" value="metadata(-.*)?\.json$" />
+      </plugin>
       <plugin name="ArchivesInfPlugin"/>
       <plugin name="DirectoryPlugin"/>
@@ -197,12 +198,4 @@
 	  </td>
 	  <td valign="top">
-	    <gsf:link type="source">
-              <gsf:choose-metadata>
-		<gsf:metadata name="thumbicon"/>
-		<gsf:metadata name="srcicon"/>
-              </gsf:choose-metadata>
-	    </gsf:link>
-	  </td>
-	  <td valign="top">
 	    <gsf:link type="document">
               <!-- Defined in header.xsl -->
@@ -230,12 +223,4 @@
 	  </td>
 	  <td valign="top">
-	    <gsf:link type="source">
-              <gsf:choose-metadata>
-		<gsf:metadata name="thumbicon"/>
-		<gsf:metadata name="srcicon"/>
-              </gsf:choose-metadata>
-	    </gsf:link>
-	  </td>
-	  <td valign="top">
 	    <gsf:link type="document">
               <!-- Defined in header.xsl -->
@@ -277,12 +262,4 @@
 	  </td>
 	  <td valign="top">
-	    <gsf:link type="source">
-              <gsf:choose-metadata>
-		<gsf:metadata name="thumbicon"/>
-		<gsf:metadata name="srcicon"/>
-              </gsf:choose-metadata>
-	    </gsf:link>
-	  </td>
-	  <td valign="top">
 	    <gsf:link type="document">
               <!-- Defined in header.xsl -->
@@ -324,14 +301,5 @@
 	  </td>
 	  <td valign="top">
-	    <gsf:link type="source">
-          <gsf:choose-metadata>
-            <gsf:metadata name="thumbicon"/>
-            <gsf:metadata name="srcicon"/>
-          </gsf:choose-metadata>
-	    </gsf:link>
-	  </td>
-	  <td valign="top">
-	    <gsf:link type="document">
-              <!-- Defined in header.xsl -->
+	    <gsf:link type="document">
               <xsl:call-template name="choose-title"/>
 	    </gsf:link>
@@ -341,5 +309,53 @@
       </format>            
     </classifier>
-    
+
+
+    <classifier name="AZCompactList">
+      <option name="-metadata" value="FromCountry"/>
+      <option name="-buttonname" value="Voting"/>
+      <option name="-no_metadata_formatting" />
+      <option name="-sort" value="FromCountryYear"/>
+      <format>
+		
+	<gsf:template match="classifierNode[@classifierStyle = 'VList']">
+	  <td valign="top" style="width: 30px; text-align: right; margin-right: 4px;">
+	    <gsf:link type="classifier">
+	      [<gsf:metadata name="numleafdocs" />]
+	    </gsf:link>
+	  </td>
+	  <td valign="top">
+	    <gsf:link type="classifier">
+	      <gsf:metadata name="Title"/>
+	    </gsf:link>
+	  </td>
+	</gsf:template>
+
+	<gsf:template match="documentNode">
+	  <td valign="top">
+	    <gsf:link type="document">
+              <gsf:icon type="document"/>
+	    </gsf:link>
+	  </td>
+	  <td valign="top">
+	    <gsf:link type="document">
+	      <gsf:metadata name="FromCountryYear"/>
+
+	      <gsf:switch>
+		<gsf:metadata name='FromCountryType'/>	
+		<gsf:when test="equals" test-value="J">
+		  (Jury)
+		</gsf:when>
+		<gsf:otherwise>
+		  (Televotes)
+		</gsf:otherwise>
+	      </gsf:switch>
+	      
+	    </gsf:link>
+	  </td>
+	</gsf:template>
+	
+      </format>
+    </classifier>
+	
     <!--
     <classifier name="Hierarchy">
@@ -432,4 +448,13 @@
       
       <gsf:headMetaTags>
+
+	<gsf:metadata name="FromCountry"/>
+	<gsf:metadata name="FromCountryType"/>
+	<gsf:metadata name="FromCountryYear"/>
+	<gsf:metadata name="VotesCountryJSON-J" />
+	<gsf:metadata name="VotesCountryJSON-T" />
+	<gsf:metadata name="VotesPointsJSON-J" />
+	<gsf:metadata name="VotesPointsJSON-T" />
+
 	<gsf:metadata name="dc.Title"/>
 	<gsf:metadata name="dc.Subject"/>
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js	(revision 34911)
@@ -1,4 +1,21 @@
+// The following needs to be kept in sync with the .voting-countries & .voting-points widths in css/eurovision.css
+var glob_voting_country_and_points_width = (180+35); 
 
-function append_from_country_votes(vote_label, votes_json_type, votes_type_total)
+function transpose_i(i,num_cols, num_rows)
+{
+    // Map 'i' to (x,y) position in grid layout
+    var x = (i % num_cols);
+    var y = Math.floor(i / num_cols); // affect int division
+    
+    // Transpose, and then reverse engineer what value of 'i' the transposed position needs to be
+    var trans_x = y;
+    var trans_y = x;
+    
+    var trans_i = trans_y * num_rows + trans_x;
+
+    return trans_i;
+}
+
+function append_to_country_votes(vote_label, votes_json_type, votes_type_total)
 {
     // TODO
@@ -6,25 +23,123 @@
 
     if (gs.documentMetadata[votes_json_type]) {
+	var all_votes_div_width  = $('#to-country-votes').width();
+	
+	var $vote_label_div = $('<div>').attr("class","voting-label").append(vote_label);
+	$vote_label_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")");
+	$('#to-country-votes').append($vote_label_div);
+
+	var $vote_points_div = $('<div>').attr("class","voting-points-div");
+	
+	var VotesJSON = eval(gs.documentMetadata[votes_json_type]);
+	var num_countries = VotesJSON.length;
+
+	var num_cols = Math.floor(all_votes_div_width / glob_voting_country_and_points_width);
+	var num_rows = Math.ceil(num_countries / num_cols);
+	var num_cells = num_cols * num_rows;
+	
+	VotesJSON.sort();
+
+	for (var i=0; i<num_cells; i++) {
+	    var trans_i = transpose_i(i,num_cols, num_rows);
+
+	    // By default, they country and points are set to be empty divs
+	    var $to_country_name = $('<div>').attr("class","voting voting-country").append("");
+	    var $to_country_points = $('<div>').attr("class","voting voting-points").append("");
+
+	    // check to see if trans_i position is within array, otherwise default to filler
+	    if (trans_i < num_countries) {
+		var from_country  = VotesJSON[trans_i];
+		var from_country_points = gs.documentMetadata[from_country];
+		
+		if (typeof from_country_points !== 'undefined') {
+		    var pp_from_country = from_country.replace(/-(T|J)$/,"");
+		    
+		    $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":");
+		    $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points);		    
+		}
+	    }
+	    
+	    $('#to-country-votes')
+		.append($from_country_name)
+		.append($from_country_points);
+		
+	}
+
+	$('#to-country-votes').append($vote_points_div);
+
+    }
+}
+	  
+
+function compare_countries(a,b)
+{
+    if (a.Country < b.Country) {
+	return -1;
+    }
+    if (a.Country > b.Country) {
+	return 1;
+    }
+
+    // names must be equal
+    return 0;
+}
+
+function compare_points(a,b)
+{
+    return a.Points - b.Points;
+}
+
+function append_from_country_votes(from_country_year_id,vote_type)
+{
+    if (vote_type != "") {
+	var all_votes_div_width  = $('#from-country-votes').width();
+	
+	var votes_country_json_type = "VotesCountryJSON-" + vote_type;
+	var votes_points_json_type = "VotesPointsJSON-" + vote_type;
+	var vote_label = (vote_type == "J") ? "Jury votes" : "Televotes";
+	
 	var $vote_div = $('<div>').attr("class","voting-label").append(vote_label);
-	$vote_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")");
 	$('#from-country-votes').append($vote_div);
 	
-	var JuryVotesJSON = eval(gs.documentMetadata[votes_json_type]);
-	var num_countries = JuryVotesJSON.length;
+	var VotesCountryJSON = eval(gs.documentMetadata[votes_country_json_type]); // map JSON string into data-structure
+	var VotesPointsJSON = eval(gs.documentMetadata[votes_points_json_type]);   // map JSON string into data-structure
 
+	var num_countries = VotesCountryJSON.length;
+	
+	var num_cols = Math.floor(all_votes_div_width / glob_voting_country_and_points_width);
+	var num_rows = Math.ceil(num_countries / num_cols);
+	var num_cells = num_cols * num_rows;
+	
+	var from_country_votes = [];
+	
 	for (var i=0; i<num_countries; i++) {
-	    var from_country  = JuryVotesJSON[i];	
-	    var from_country_points = gs.documentMetadata[from_country];
+	    from_country_votes.push({ "Country" : VotesCountryJSON[i], "Points" : VotesPointsJSON[i]})
+	}
+
+	from_country_votes.sort(compare_countries);
+
+	for (var i=0; i<num_cells; i++) {
+
+	    var trans_i = transpose_i(i,num_cols, num_rows);
+
+	    var $to_country_name = $('<div>').attr("class","voting voting-country").append("");
+	    var $to_country_points = $('<div>').attr("class","voting voting-points").append("");
+
+	    // check to see if trans_i position is within array, otherwise default to filler	    
+	    if (trans_i < num_countries) {
+		var to_country  = from_country_votes[trans_i].Country;
+		var to_country_points = from_country_votes[trans_i].Points;
+		
+		if (typeof to_country_points !== 'undefined') {
+		    
+		    $to_country_name = $('<div>').attr("class","voting voting-country").append(to_country + ":");
+		    $to_country_points = $('<div>').attr("class","voting voting-points").append(to_country_points);		    
+		}
+	    }
 	    
-	    if (typeof from_country_points !== 'undefined') {
-		var pp_from_country = from_country.replace(/-(T|J)$/,"");
-		
-		var $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":");
-		var $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points);
-		
-		$('#from-country-votes')
-		    .append($from_country_name)
-		    .append($from_country_points);
-	    }
+	    $('#from-country-votes')
+		.append($to_country_name)
+		.append($to_country_points);
+
 	}
     }
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/03-GEN-VOTING-METADATA.sh
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/03-GEN-VOTING-METADATA.sh	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/03-GEN-VOTING-METADATA.sh	(revision 34911)
@@ -12,8 +12,54 @@
     exit 1
 fi
-   
+
+if [ ! -d "$prep_dir/metadata-votes" ] ; then
+    echo "Creating directory:"
+    echo "  $prep_dir/metadata-votes"
+    
+    mkdir "$prep_dir/metadata-votes"
+fi
+exit_status=0
+
+
 source  $prep_dir/my-python-env/bin/activate
 
-$prep_dir/xlsx-to-jsonmetadata.py $prep_dir/eurovision_song_contest_1975_2019.xlsx  $prep_dir/metadata.json
+$prep_dir/xlsx-fromcountry-jsonmetadata.py \
+    --votingtype "J" \
+    $prep_dir/eurovision_song_contest_1975_2019.xlsx  \
+    $prep_dir/metadata-votes/metadata-votes-fromcountry-jury.json
+
+
+if [ $? = 0 ] ; then
+    $prep_dir/xlsx-fromcountry-jsonmetadata.py \
+	--votingtype "T" \
+	$prep_dir/eurovision_song_contest_1975_2019.xlsx  \
+	$prep_dir/metadata-votes/metadata-votes-fromcountry-tele.json
+
+    if [ $? = 0 ] ; then
+	$prep_dir/xlsx-tocountry-jsonmetadata.py $prep_dir/eurovision_song_contest_1975_2019.xlsx  $prep_dir/metadata-votes-tocountry.json
+
+	if [ $? != 0 ] ; then
+	    echo "!!!!" 1>&2
+	    echo "! Error enountered generating to-country metadata-json" 1>&2
+	    echo "!!!!" 1>&2
+	    exit_status=1
+	fi
+    else
+	echo "!!!!" 1>&2
+	echo "! Error enountered generating from-country Televoting metadata-json" 1>&2
+	echo "!!!!" 1>&2
+	exit_status=1
+    fi
+else
+    echo "!!!!" 1>&2
+    echo "! Error enountered generate from-country Jury metadata-json" 1>&2
+    echo "!!!!" 1>&2
+    exit_status=1
+fi
+
 
 deactivate
+
+if [ $exit_status != 0 ] ; then
+    exit $exit_status
+fi
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/04-COPY-VOTING-METADATA-TO-IMPORT.sh
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/04-COPY-VOTING-METADATA-TO-IMPORT.sh	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/04-COPY-VOTING-METADATA-TO-IMPORT.sh	(revision 34911)
@@ -11,5 +11,12 @@
     fi
 done
-    
+
+
+echo ""
+echo "Copying:"
+
+echo "  voting-excel/metadata-votes/* ../import/fromcountry-metadata-votes/."
+/bin/rm -rf "../import/fromcountry-metadata-votes"
+/bin/cp -r voting-excel/metadata-votes ../import/fromcountry-metadata-votes
 
 echo ""
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl	(revision 34911)
@@ -31,9 +31,10 @@
 	    Contest</a> is a live-broadcast televised multi-national
 	    competition with a collaborative mission, much like the
-	    Olympics.  A help to shore up a post war Europe in 1956 it
+	    Olympics.  <i>A help to shore up a post war Europe in 1956 it
 	    all began, where there were only seven countries and one
-	    camera man! The contest has grown significantly from
+	    camera man!</i> The contest has grown significantly from
 	    there, with 43 countries competing most yearsâeven
-	    Australia takes part now. It's an annual celebration of
+	    Australia takes part now, through a specially
+	    arranged invitation. It's an annual celebration of
 	    European culture and the highlight of many people's
 	    year.
@@ -57,21 +58,34 @@
 	    all the performances are over, artists wait
 	    nervously as via the Internet the show's hosts visit each
-	    of the 43 countries in turn collecting all points cast.
-	    The scoring comprises votes from a combination of country appointed juries and
-	    &quot;the popular vote&quot;âincluding the all important
-	    top score that can be cast, 12 points (Douze Points!)âuntil a new winner is crowned.
+	    of the 43 countries in turn collecting all points cast
+	    by the country appointed juries.  This includes
+	    the all important top score that can be cast, 12 points
+	    (douze points!), a double-increment up from the
+	    10 points awarded to the song a country ranks second,
+	    followed by 8, 7, 6 âŠ 1 points awarded.
+	    Next comes the &quot;the popular vote&quot;
+	    where fans, still grouped by country, have
+	    the votes they cast by phone, SMS or the Eurovision app
+	    tallied and mapped into the same format of 12 points for 1st
+	    place, and so on.
+	    This all culminates in a new winner being crowned, with
+	    the competition typically being hosted the following year
+	    by that country. 
 	  </p>
 	  
 	  <p>	    
-	    The (unoffical) website has been developed by a group of Digital Library
-	    researchers who, unsurprisingly, turn out to be also <i>huge</i>
-	    fans of Eurovision.
-	    We wish to share both our love for the competition,
-	    and to demonstrate what is possible when (harnessing some of
-	    that passion!) the techniques of
-	    Linked Open Data are applied to the Open Source
+	    This (unoffical) website has been developed by a small
+	    team of dedicated Digital Library researchers who also
+	    happen to be <i>huge</i> fans of Eurovision.  We wish to
+	    share our love for the competition, and at the same time
+	    demonstrate what is possible whenâharnessing some of that
+	    passion!âthe techniques of
+	    <a href="https://en.wikipedia.org/wiki/Linked_data">Linked
+	    Open Data</a> are applied
+	    to the Open Source
 	    <a href="https://www.greenstone.org">Greenstone3</a>
 	    Digital Library platform.
 	  </p>
+
 	  <p>
 	    We suggest you initially
Index: /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl
===================================================================
--- /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl	(revision 34910)
+++ /main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl	(revision 34911)
@@ -18,5 +18,15 @@
     
     <span style="font-weight:bold; font-size: 120%;">
-      <xsl:call-template name="choose-title"/>
+      <gsf:switch>
+        <gsf:metadata name='FromCountry'/>	
+        <gsf:when test='exists'>
+	  <gsf:metadata name='FromCountry'/>
+	  voting in
+	  <gsf:metadata name='FromCountryYear'/>
+	</gsf:when>
+	<gsf:otherwise>
+	  <xsl:call-template name="choose-title"/>
+	</gsf:otherwise>
+      </gsf:switch>
     </span>
 
@@ -39,8 +49,49 @@
     
     <table class="esc-metadata">
-
+      
+      <gsf:switch>
+        <gsf:metadata name='FromCountry'/>
+        <gsf:when test='exists'>
+	  <tr>
+	    <td>
+	      Voting Type:
+	    </td>
+	    <td>
+	      <gsf:switch>
+		<gsf:metadata name='FromCountryType'/>	
+		<gsf:when test="equals" test-value="J">
+		  Jury
+		</gsf:when>
+		<gsf:otherwise>
+		  Televotes
+		</gsf:otherwise>
+	      </gsf:switch>
+	    </td>
+	  </tr>	  
+	  <tr>
+	    <td>
+	      Votes cast by:
+	    </td>
+	    <td>
+	      <gsf:metadata name="FromCountry" highlight="highlight" />
+	    </td>
+	  </tr>
+	  <tr>
+	    <td>
+	      Year:
+	    </td>
+	    <td>
+	      <gsf:metadata name="FromCountryYear" highlight="highlight" />
+	    </td>
+	  </tr>
+	</gsf:when>
+	<gsf:otherwise>
+<!--	  
+      </gsf:switch>
+      
       <gsf:switch>
         <gsf:metadata name='Title'/>
         <gsf:when test='exists'>
+-->
 	  <tr>
 	    <td>
@@ -69,5 +120,8 @@
 	    </td>
 	  </tr>
-	</gsf:when>
+<!--	  
+	</gsf:when>
+-->
+	</gsf:otherwise>
       </gsf:switch>
 
@@ -118,7 +172,13 @@
   </xsl:template>
 
-
-  <xsl:template name="documentContent">
-
+  <xsl:template name="documentContentFromCountry">
+    <div id="from-country-votes">
+      <gsf:script>	
+	append_from_country_votes(gs.documentMetadata["Identifier"],gs.documentMetadata["FromCountryType"]);
+      </gsf:script>
+    </div>    
+  </xsl:template>
+  
+  <xsl:template name="documentContentEntry">
     <gsf:switch>
       <gsf:metadata name='Abstract_en'/>
@@ -130,13 +190,13 @@
     </gsf:switch>
 
-    <div id="from-country-votes">
+    <div id="to-country-votes">
       <gsf:script>
-	append_from_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal");
-	append_from_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal");
+	append_to_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal");
+	append_to_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal");
       </gsf:script>
 
     </div>
-    
-    <div>
+
+    <div id="find-more-content">
       Find more content about this Eurovision entry on-line:
       <ul>
@@ -204,4 +264,18 @@
     
   </xsl:template>
+  
+  <xsl:template name="documentContent">
+
+    <gsf:switch>
+      <gsf:metadata name='FromCountry'/>
+      <gsf:when test='exists'>
+	<xsl:call-template name="documentContentFromCountry"/>
+      </gsf:when>
+      <gsf:otherwise>
+	<xsl:call-template name="documentContentEntry"/>
+      </gsf:otherwise>
+    </gsf:switch>
+
+  </xsl:template>
 
 </xsl:stylesheet>
