Changeset 34911
- Timestamp:
- 2021-02-22T23:39:42+13:00 (3 years ago)
- Location:
- main/trunk/model-sites-dev/eurovision-lod/collect/eurovision
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/css/eurovision.css
r34873 r34911 11 11 font-size: 110%; 12 12 font-weight: bold; 13 padding-top: 6px; 13 padding-top: 3px; 14 padding-bottom: 3px; 15 margin-top: 10px; 16 border-top: 1px solid white; 17 border-bottom: 1px solid white; 18 background-color: rgba(255,255,255,0.2); 19 } 20 21 .voting-points-div { 22 border-bottom: 1px solid white; 14 23 } 15 24 16 25 .voting-country { 17 width: 1 50px;26 width: 180px; 18 27 } 19 28 … … 23 32 text-align: right; 24 33 } 34 35 #find-more-content { 36 padding-top: 12px; 37 } 38 -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/etc/collectionConfig.xml
r34893 r34911 66 66 </gsf:switch> 67 67 </xsl:if> 68 68 69 69 </gsf:template> 70 71 70 72 71 … … 93 92 <index name="Year"> 94 93 <displayItem name="name" key="Year.buttonname" dictionary="collectionConfig"/> 95 </index> 94 </index> o 96 95 97 96 <sort name="rank"/> … … 160 159 </plugin> 161 160 <plugin name="MetadataXMLPlugin"/> 162 <plugin name="MetadataJSONPlugin"/> 161 <plugin name="MetadataJSONPlugin"> 162 <option name="process_exp" value="metadata(-.*)?\.json$" /> 163 </plugin> 163 164 <plugin name="ArchivesInfPlugin"/> 164 165 <plugin name="DirectoryPlugin"/> … … 197 198 </td> 198 199 <td valign="top"> 199 <gsf:link type="source">200 <gsf:choose-metadata>201 <gsf:metadata name="thumbicon"/>202 <gsf:metadata name="srcicon"/>203 </gsf:choose-metadata>204 </gsf:link>205 </td>206 <td valign="top">207 200 <gsf:link type="document"> 208 201 <!-- Defined in header.xsl --> … … 230 223 </td> 231 224 <td valign="top"> 232 <gsf:link type="source">233 <gsf:choose-metadata>234 <gsf:metadata name="thumbicon"/>235 <gsf:metadata name="srcicon"/>236 </gsf:choose-metadata>237 </gsf:link>238 </td>239 <td valign="top">240 225 <gsf:link type="document"> 241 226 <!-- Defined in header.xsl --> … … 277 262 </td> 278 263 <td valign="top"> 279 <gsf:link type="source">280 <gsf:choose-metadata>281 <gsf:metadata name="thumbicon"/>282 <gsf:metadata name="srcicon"/>283 </gsf:choose-metadata>284 </gsf:link>285 </td>286 <td valign="top">287 264 <gsf:link type="document"> 288 265 <!-- Defined in header.xsl --> … … 324 301 </td> 325 302 <td valign="top"> 326 <gsf:link type="source"> 327 <gsf:choose-metadata> 328 <gsf:metadata name="thumbicon"/> 329 <gsf:metadata name="srcicon"/> 330 </gsf:choose-metadata> 331 </gsf:link> 332 </td> 333 <td valign="top"> 334 <gsf:link type="document"> 335 <!-- Defined in header.xsl --> 303 <gsf:link type="document"> 336 304 <xsl:call-template name="choose-title"/> 337 305 </gsf:link> … … 341 309 </format> 342 310 </classifier> 343 311 312 313 <classifier name="AZCompactList"> 314 <option name="-metadata" value="FromCountry"/> 315 <option name="-buttonname" value="Voting"/> 316 <option name="-no_metadata_formatting" /> 317 <option name="-sort" value="FromCountryYear"/> 318 <format> 319 320 <gsf:template match="classifierNode[@classifierStyle = 'VList']"> 321 <td valign="top" style="width: 30px; text-align: right; margin-right: 4px;"> 322 <gsf:link type="classifier"> 323 [<gsf:metadata name="numleafdocs" />] 324 </gsf:link> 325 </td> 326 <td valign="top"> 327 <gsf:link type="classifier"> 328 <gsf:metadata name="Title"/> 329 </gsf:link> 330 </td> 331 </gsf:template> 332 333 <gsf:template match="documentNode"> 334 <td valign="top"> 335 <gsf:link type="document"> 336 <gsf:icon type="document"/> 337 </gsf:link> 338 </td> 339 <td valign="top"> 340 <gsf:link type="document"> 341 <gsf:metadata name="FromCountryYear"/> 342 343 <gsf:switch> 344 <gsf:metadata name='FromCountryType'/> 345 <gsf:when test="equals" test-value="J"> 346 (Jury) 347 </gsf:when> 348 <gsf:otherwise> 349 (Televotes) 350 </gsf:otherwise> 351 </gsf:switch> 352 353 </gsf:link> 354 </td> 355 </gsf:template> 356 357 </format> 358 </classifier> 359 344 360 <!-- 345 361 <classifier name="Hierarchy"> … … 432 448 433 449 <gsf:headMetaTags> 450 451 <gsf:metadata name="FromCountry"/> 452 <gsf:metadata name="FromCountryType"/> 453 <gsf:metadata name="FromCountryYear"/> 454 <gsf:metadata name="VotesCountryJSON-J" /> 455 <gsf:metadata name="VotesCountryJSON-T" /> 456 <gsf:metadata name="VotesPointsJSON-J" /> 457 <gsf:metadata name="VotesPointsJSON-T" /> 458 434 459 <gsf:metadata name="dc.Title"/> 435 460 <gsf:metadata name="dc.Subject"/> -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/js/eurovision.js
r34893 r34911 1 // The following needs to be kept in sync with the .voting-countries & .voting-points widths in css/eurovision.css 2 var glob_voting_country_and_points_width = (180+35); 1 3 2 function append_from_country_votes(vote_label, votes_json_type, votes_type_total) 4 function transpose_i(i,num_cols, num_rows) 5 { 6 // Map 'i' to (x,y) position in grid layout 7 var x = (i % num_cols); 8 var y = Math.floor(i / num_cols); // affect int division 9 10 // Transpose, and then reverse engineer what value of 'i' the transposed position needs to be 11 var trans_x = y; 12 var trans_y = x; 13 14 var trans_i = trans_y * num_rows + trans_x; 15 16 return trans_i; 17 } 18 19 function append_to_country_votes(vote_label, votes_json_type, votes_type_total) 3 20 { 4 21 // TODO … … 6 23 7 24 if (gs.documentMetadata[votes_json_type]) { 25 var all_votes_div_width = $('#to-country-votes').width(); 26 27 var $vote_label_div = $('<div>').attr("class","voting-label").append(vote_label); 28 $vote_label_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")"); 29 $('#to-country-votes').append($vote_label_div); 30 31 var $vote_points_div = $('<div>').attr("class","voting-points-div"); 32 33 var VotesJSON = eval(gs.documentMetadata[votes_json_type]); 34 var num_countries = VotesJSON.length; 35 36 var num_cols = Math.floor(all_votes_div_width / glob_voting_country_and_points_width); 37 var num_rows = Math.ceil(num_countries / num_cols); 38 var num_cells = num_cols * num_rows; 39 40 VotesJSON.sort(); 41 42 for (var i=0; i<num_cells; i++) { 43 var trans_i = transpose_i(i,num_cols, num_rows); 44 45 // By default, they country and points are set to be empty divs 46 var $to_country_name = $('<div>').attr("class","voting voting-country").append(""); 47 var $to_country_points = $('<div>').attr("class","voting voting-points").append(""); 48 49 // check to see if trans_i position is within array, otherwise default to filler 50 if (trans_i < num_countries) { 51 var from_country = VotesJSON[trans_i]; 52 var from_country_points = gs.documentMetadata[from_country]; 53 54 if (typeof from_country_points !== 'undefined') { 55 var pp_from_country = from_country.replace(/-(T|J)$/,""); 56 57 $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":"); 58 $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points); 59 } 60 } 61 62 $('#to-country-votes') 63 .append($from_country_name) 64 .append($from_country_points); 65 66 } 67 68 $('#to-country-votes').append($vote_points_div); 69 70 } 71 } 72 73 74 function compare_countries(a,b) 75 { 76 if (a.Country < b.Country) { 77 return -1; 78 } 79 if (a.Country > b.Country) { 80 return 1; 81 } 82 83 // names must be equal 84 return 0; 85 } 86 87 function compare_points(a,b) 88 { 89 return a.Points - b.Points; 90 } 91 92 function append_from_country_votes(from_country_year_id,vote_type) 93 { 94 if (vote_type != "") { 95 var all_votes_div_width = $('#from-country-votes').width(); 96 97 var votes_country_json_type = "VotesCountryJSON-" + vote_type; 98 var votes_points_json_type = "VotesPointsJSON-" + vote_type; 99 var vote_label = (vote_type == "J") ? "Jury votes" : "Televotes"; 100 8 101 var $vote_div = $('<div>').attr("class","voting-label").append(vote_label); 9 $vote_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")");10 102 $('#from-country-votes').append($vote_div); 11 103 12 var JuryVotesJSON = eval(gs.documentMetadata[votes_json_type]);13 var num_countries = JuryVotesJSON.length;104 var VotesCountryJSON = eval(gs.documentMetadata[votes_country_json_type]); // map JSON string into data-structure 105 var VotesPointsJSON = eval(gs.documentMetadata[votes_points_json_type]); // map JSON string into data-structure 14 106 107 var num_countries = VotesCountryJSON.length; 108 109 var num_cols = Math.floor(all_votes_div_width / glob_voting_country_and_points_width); 110 var num_rows = Math.ceil(num_countries / num_cols); 111 var num_cells = num_cols * num_rows; 112 113 var from_country_votes = []; 114 15 115 for (var i=0; i<num_countries; i++) { 16 var from_country = JuryVotesJSON[i]; 17 var from_country_points = gs.documentMetadata[from_country]; 116 from_country_votes.push({ "Country" : VotesCountryJSON[i], "Points" : VotesPointsJSON[i]}) 117 } 118 119 from_country_votes.sort(compare_countries); 120 121 for (var i=0; i<num_cells; i++) { 122 123 var trans_i = transpose_i(i,num_cols, num_rows); 124 125 var $to_country_name = $('<div>').attr("class","voting voting-country").append(""); 126 var $to_country_points = $('<div>').attr("class","voting voting-points").append(""); 127 128 // check to see if trans_i position is within array, otherwise default to filler 129 if (trans_i < num_countries) { 130 var to_country = from_country_votes[trans_i].Country; 131 var to_country_points = from_country_votes[trans_i].Points; 132 133 if (typeof to_country_points !== 'undefined') { 134 135 $to_country_name = $('<div>').attr("class","voting voting-country").append(to_country + ":"); 136 $to_country_points = $('<div>').attr("class","voting voting-points").append(to_country_points); 137 } 138 } 18 139 19 if (typeof from_country_points !== 'undefined') { 20 var pp_from_country = from_country.replace(/-(T|J)$/,""); 21 22 var $from_country_name = $('<div>').attr("class","voting voting-country").append(pp_from_country + ":"); 23 var $from_country_points = $('<div>').attr("class","voting voting-points").append(from_country_points); 24 25 $('#from-country-votes') 26 .append($from_country_name) 27 .append($from_country_points); 28 } 140 $('#from-country-votes') 141 .append($to_country_name) 142 .append($to_country_points); 143 29 144 } 30 145 } -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/03-GEN-VOTING-METADATA.sh
r34869 r34911 12 12 exit 1 13 13 fi 14 14 15 if [ ! -d "$prep_dir/metadata-votes" ] ; then 16 echo "Creating directory:" 17 echo " $prep_dir/metadata-votes" 18 19 mkdir "$prep_dir/metadata-votes" 20 fi 21 exit_status=0 22 23 15 24 source $prep_dir/my-python-env/bin/activate 16 25 17 $prep_dir/xlsx-to-jsonmetadata.py $prep_dir/eurovision_song_contest_1975_2019.xlsx $prep_dir/metadata.json 26 $prep_dir/xlsx-fromcountry-jsonmetadata.py \ 27 --votingtype "J" \ 28 $prep_dir/eurovision_song_contest_1975_2019.xlsx \ 29 $prep_dir/metadata-votes/metadata-votes-fromcountry-jury.json 30 31 32 if [ $? = 0 ] ; then 33 $prep_dir/xlsx-fromcountry-jsonmetadata.py \ 34 --votingtype "T" \ 35 $prep_dir/eurovision_song_contest_1975_2019.xlsx \ 36 $prep_dir/metadata-votes/metadata-votes-fromcountry-tele.json 37 38 if [ $? = 0 ] ; then 39 $prep_dir/xlsx-tocountry-jsonmetadata.py $prep_dir/eurovision_song_contest_1975_2019.xlsx $prep_dir/metadata-votes-tocountry.json 40 41 if [ $? != 0 ] ; then 42 echo "!!!!" 1>&2 43 echo "! Error enountered generating to-country metadata-json" 1>&2 44 echo "!!!!" 1>&2 45 exit_status=1 46 fi 47 else 48 echo "!!!!" 1>&2 49 echo "! Error enountered generating from-country Televoting metadata-json" 1>&2 50 echo "!!!!" 1>&2 51 exit_status=1 52 fi 53 else 54 echo "!!!!" 1>&2 55 echo "! Error enountered generate from-country Jury metadata-json" 1>&2 56 echo "!!!!" 1>&2 57 exit_status=1 58 fi 59 18 60 19 61 deactivate 62 63 if [ $exit_status != 0 ] ; then 64 exit $exit_status 65 fi -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/04-COPY-VOTING-METADATA-TO-IMPORT.sh
r34870 r34911 11 11 fi 12 12 done 13 13 14 15 echo "" 16 echo "Copying:" 17 18 echo " voting-excel/metadata-votes/* ../import/fromcountry-metadata-votes/." 19 /bin/rm -rf "../import/fromcountry-metadata-votes" 20 /bin/cp -r voting-excel/metadata-votes ../import/fromcountry-metadata-votes 14 21 15 22 echo "" -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl
r34890 r34911 31 31 Contest</a> is a live-broadcast televised multi-national 32 32 competition with a collaborative mission, much like the 33 Olympics. A help to shore up a post war Europe in 1956 it33 Olympics. <i>A help to shore up a post war Europe in 1956 it 34 34 all began, where there were only seven countries and one 35 camera man! The contest has grown significantly from35 camera man!</i> The contest has grown significantly from 36 36 there, with 43 countries competing most yearsâeven 37 Australia takes part now. It's an annual celebration of 37 Australia takes part now, through a specially 38 arranged invitation. It's an annual celebration of 38 39 European culture and the highlight of many people's 39 40 year. … … 57 58 all the performances are over, artists wait 58 59 nervously as via the Internet the show's hosts visit each 59 of the 43 countries in turn collecting all points cast. 60 The scoring comprises votes from a combination of country appointed juries and 61 "the popular vote"âincluding the all important 62 top score that can be cast, 12 points (Douze Points!)âuntil a new winner is crowned. 60 of the 43 countries in turn collecting all points cast 61 by the country appointed juries. This includes 62 the all important top score that can be cast, 12 points 63 (douze points!), a double-increment up from the 64 10 points awarded to the song a country ranks second, 65 followed by 8, 7, 6 ⊠1 points awarded. 66 Next comes the "the popular vote" 67 where fans, still grouped by country, have 68 the votes they cast by phone, SMS or the Eurovision app 69 tallied and mapped into the same format of 12 points for 1st 70 place, and so on. 71 This all culminates in a new winner being crowned, with 72 the competition typically being hosted the following year 73 by that country. 63 74 </p> 64 75 65 76 <p> 66 The (unoffical) website has been developed by a group of Digital Library 67 researchers who, unsurprisingly, turn out to be also <i>huge</i> 68 fans of Eurovision. 69 We wish to share both our love for the competition, 70 and to demonstrate what is possible when (harnessing some of 71 that passion!) the techniques of 72 Linked Open Data are applied to the Open Source 77 This (unoffical) website has been developed by a small 78 team of dedicated Digital Library researchers who also 79 happen to be <i>huge</i> fans of Eurovision. We wish to 80 share our love for the competition, and at the same time 81 demonstrate what is possible whenâharnessing some of that 82 passion!âthe techniques of 83 <a href="https://en.wikipedia.org/wiki/Linked_data">Linked 84 Open Data</a> are applied 85 to the Open Source 73 86 <a href="https://www.greenstone.org">Greenstone3</a> 74 87 Digital Library platform. 75 88 </p> 89 76 90 <p> 77 91 We suggest you initially -
main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl
r34893 r34911 18 18 19 19 <span style="font-weight:bold; font-size: 120%;"> 20 <xsl:call-template name="choose-title"/> 20 <gsf:switch> 21 <gsf:metadata name='FromCountry'/> 22 <gsf:when test='exists'> 23 <gsf:metadata name='FromCountry'/> 24 voting in 25 <gsf:metadata name='FromCountryYear'/> 26 </gsf:when> 27 <gsf:otherwise> 28 <xsl:call-template name="choose-title"/> 29 </gsf:otherwise> 30 </gsf:switch> 21 31 </span> 22 32 … … 39 49 40 50 <table class="esc-metadata"> 41 51 52 <gsf:switch> 53 <gsf:metadata name='FromCountry'/> 54 <gsf:when test='exists'> 55 <tr> 56 <td> 57 Voting Type: 58 </td> 59 <td> 60 <gsf:switch> 61 <gsf:metadata name='FromCountryType'/> 62 <gsf:when test="equals" test-value="J"> 63 Jury 64 </gsf:when> 65 <gsf:otherwise> 66 Televotes 67 </gsf:otherwise> 68 </gsf:switch> 69 </td> 70 </tr> 71 <tr> 72 <td> 73 Votes cast by: 74 </td> 75 <td> 76 <gsf:metadata name="FromCountry" highlight="highlight" /> 77 </td> 78 </tr> 79 <tr> 80 <td> 81 Year: 82 </td> 83 <td> 84 <gsf:metadata name="FromCountryYear" highlight="highlight" /> 85 </td> 86 </tr> 87 </gsf:when> 88 <gsf:otherwise> 89 <!-- 90 </gsf:switch> 91 42 92 <gsf:switch> 43 93 <gsf:metadata name='Title'/> 44 94 <gsf:when test='exists'> 95 --> 45 96 <tr> 46 97 <td> … … 69 120 </td> 70 121 </tr> 71 </gsf:when> 122 <!-- 123 </gsf:when> 124 --> 125 </gsf:otherwise> 72 126 </gsf:switch> 73 127 … … 118 172 </xsl:template> 119 173 120 121 <xsl:template name="documentContent"> 122 174 <xsl:template name="documentContentFromCountry"> 175 <div id="from-country-votes"> 176 <gsf:script> 177 append_from_country_votes(gs.documentMetadata["Identifier"],gs.documentMetadata["FromCountryType"]); 178 </gsf:script> 179 </div> 180 </xsl:template> 181 182 <xsl:template name="documentContentEntry"> 123 183 <gsf:switch> 124 184 <gsf:metadata name='Abstract_en'/> … … 130 190 </gsf:switch> 131 191 132 <div id=" from-country-votes">192 <div id="to-country-votes"> 133 193 <gsf:script> 134 append_ from_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal");135 append_ from_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal");194 append_to_country_votes("Jury Votes","JuryVotesJSON","JuryVotesTotal"); 195 append_to_country_votes("Televotes","TeleVotesJSON","TeleVotesTotal"); 136 196 </gsf:script> 137 197 138 198 </div> 139 140 <div >199 200 <div id="find-more-content"> 141 201 Find more content about this Eurovision entry on-line: 142 202 <ul> … … 204 264 205 265 </xsl:template> 266 267 <xsl:template name="documentContent"> 268 269 <gsf:switch> 270 <gsf:metadata name='FromCountry'/> 271 <gsf:when test='exists'> 272 <xsl:call-template name="documentContentFromCountry"/> 273 </gsf:when> 274 <gsf:otherwise> 275 <xsl:call-template name="documentContentEntry"/> 276 </gsf:otherwise> 277 </gsf:switch> 278 279 </xsl:template> 206 280 207 281 </xsl:stylesheet>
Note:
See TracChangeset
for help on using the changeset viewer.