Changeset 34911


Ignore:
Timestamp:
2021-02-22T23:39:42+13:00 (3 years ago)
Author:
davidb
Message:

Changes after new 'from country' doc added in

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  
    1111    font-size: 110%;
    1212    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;
    1423}
    1524
    1625.voting-country {
    17     width: 150px;
     26    width: 180px;
    1827}
    1928
     
    2332    text-align: right;
    2433}
     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  
    6666    </gsf:switch>
    6767      </xsl:if>
    68      
     68
    6969    </gsf:template>
    70 
    7170
    7271   
     
    9392    <index name="Year">
    9493      <displayItem name="name" key="Year.buttonname" dictionary="collectionConfig"/>
    95     </index>     
     94    </index>      o
    9695
    9796    <sort name="rank"/>
     
    160159      </plugin>
    161160      <plugin name="MetadataXMLPlugin"/>
    162       <plugin name="MetadataJSONPlugin"/>
     161      <plugin name="MetadataJSONPlugin">
     162    <option name="process_exp" value="metadata(-.*)?\.json$" />
     163      </plugin>
    163164      <plugin name="ArchivesInfPlugin"/>
    164165      <plugin name="DirectoryPlugin"/>
     
    197198      </td>
    198199      <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">
    207200        <gsf:link type="document">
    208201              <!-- Defined in header.xsl -->
     
    230223      </td>
    231224      <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">
    240225        <gsf:link type="document">
    241226              <!-- Defined in header.xsl -->
     
    277262      </td>
    278263      <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">
    287264        <gsf:link type="document">
    288265              <!-- Defined in header.xsl -->
     
    324301      </td>
    325302      <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">
    336304              <xsl:call-template name="choose-title"/>
    337305        </gsf:link>
     
    341309      </format>           
    342310    </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   
    344360    <!--
    345361    <classifier name="Hierarchy">
     
    432448     
    433449      <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
    434459    <gsf:metadata name="dc.Title"/>
    435460    <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
     2var glob_voting_country_and_points_width = (180+35);
    13
    2 function append_from_country_votes(vote_label, votes_json_type, votes_type_total)
     4function 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
     19function append_to_country_votes(vote_label, votes_json_type, votes_type_total)
    320{
    421    // TODO
     
    623
    724    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
     74function 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
     87function compare_points(a,b)
     88{
     89    return a.Points - b.Points;
     90}
     91
     92function 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   
    8101    var $vote_div = $('<div>').attr("class","voting-label").append(vote_label);
    9     $vote_div.append(" (Total: " + gs.documentMetadata[votes_type_total] + ")");
    10102    $('#from-country-votes').append($vote_div);
    11103   
    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
    14106
     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   
    15115    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        }
    18139       
    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
    29144    }
    30145    }
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/03-GEN-VOTING-METADATA.sh

    r34869 r34911  
    1212    exit 1
    1313fi
    14    
     14
     15if [ ! -d "$prep_dir/metadata-votes" ] ; then
     16    echo "Creating directory:"
     17    echo "  $prep_dir/metadata-votes"
     18   
     19    mkdir "$prep_dir/metadata-votes"
     20fi
     21exit_status=0
     22
     23
    1524source  $prep_dir/my-python-env/bin/activate
    1625
    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
     32if [ $? = 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
     53else
     54    echo "!!!!" 1>&2
     55    echo "! Error enountered generate from-country Jury metadata-json" 1>&2
     56    echo "!!!!" 1>&2
     57    exit_status=1
     58fi
     59
    1860
    1961deactivate
     62
     63if [ $exit_status != 0 ] ; then
     64    exit $exit_status
     65fi
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/prepare/04-COPY-VOTING-METADATA-TO-IMPORT.sh

    r34870 r34911  
    1111    fi
    1212done
    13    
     13
     14
     15echo ""
     16echo "Copying:"
     17
     18echo "  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
    1421
    1522echo ""
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/about.xsl

    r34890 r34911  
    3131        Contest</a> is a live-broadcast televised multi-national
    3232        competition with a collaborative mission, much like the
    33         Olympics.  A help to shore up a post war Europe in 1956 it
     33        Olympics.  <i>A help to shore up a post war Europe in 1956 it
    3434        all began, where there were only seven countries and one
    35         camera man! The contest has grown significantly from
     35        camera man!</i> The contest has grown significantly from
    3636        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
    3839        European culture and the highlight of many people's
    3940        year.
     
    5758        all the performances are over, artists wait
    5859        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         &quot;the popular vote&quot;—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 &quot;the popular vote&quot;
     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.
    6374      </p>
    6475     
    6576      <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
    7386        <a href="https://www.greenstone.org">Greenstone3</a>
    7487        Digital Library platform.
    7588      </p>
     89
    7690      <p>
    7791        We suggest you initially
  • main/trunk/model-sites-dev/eurovision-lod/collect/eurovision/transform/pages/document.xsl

    r34893 r34911  
    1818   
    1919    <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>
    2131    </span>
    2232
     
    3949   
    4050    <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     
    4292      <gsf:switch>
    4393        <gsf:metadata name='Title'/>
    4494        <gsf:when test='exists'>
     95-->
    4596      <tr>
    4697        <td>
     
    69120        </td>
    70121      </tr>
    71     </gsf:when>
     122<!--     
     123    </gsf:when>
     124-->
     125    </gsf:otherwise>
    72126      </gsf:switch>
    73127
     
    118172  </xsl:template>
    119173
    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">
    123183    <gsf:switch>
    124184      <gsf:metadata name='Abstract_en'/>
     
    130190    </gsf:switch>
    131191
    132     <div id="from-country-votes">
     192    <div id="to-country-votes">
    133193      <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");
    136196      </gsf:script>
    137197
    138198    </div>
    139    
    140     <div>
     199
     200    <div id="find-more-content">
    141201      Find more content about this Eurovision entry on-line:
    142202      <ul>
     
    204264   
    205265  </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>
    206280
    207281</xsl:stylesheet>
Note: See TracChangeset for help on using the changeset viewer.