Changeset 12531 for extensions/luciano


Ignore:
Timestamp:
Oct 31, 2011, 2:11:42 PM (13 years ago)
Author:
plg
Message:

compatibility with the new Rating Score instead of Average Rate

Location:
extensions/luciano
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/luciano/js/script.js

    r5921 r12531  
    143143}
    144144
    145 function setNewRate(average, count, stdev, newRating)
    146 {
    147         ratingSplitted = average.split('.');
     145function setNewRate(score, count, stdev, newRating)
     146{
     147        var score = score+"";
     148        ratingSplitted = score.split('.');
    148149        starFull = ratingSplitted[0];
    149150        starHalf = (ratingSplitted[1] > 49) ? true : false;
     
    190191                                gUserRating = rateButton.initialRateValue;
    191192                                for (var i=0; i<gRatingButtons.length; i++) gRatingButtons[i].disabled=false;
    192                                 setNewRate(result.average, result.count, result.stdev, rateButton.initialRateValue);
     193                                setNewRate(result.score, result.count, result.stdev, rateButton.initialRateValue);
    193194                                if (gRatingOptions.ratingSummaryElement)
    194195                                {
  • extensions/luciano/template/picture.tpl

    r11049 r12531  
    4141  </div>
    4242
    43   {if $display_info.average_rate and isset($rate_summary) }
     43  {if $display_info.rating_score and isset($rate_summary) }
    4444  <div id="imageInfoRight">
    4545    <div class="value" id="ratingSummary">
    46         {'Average rate'|@translate}:
    47                         {assign var='rate_text' value='%.2f (rated %d times)'|@translate }
    48                         {$pwg->sprintf($rate_text, $rate_summary.average, $rate_summary.count) }
     46        {'Rating score'|@translate}:
     47    {if $rate_summary.count}
     48        <span id="ratingScore">{$rate_summary.score}</span> <span id="ratingCount">({assign var='rate_text' value='%d rates'|@translate}{$pwg->sprintf($rate_text, $rate_summary.count)})</span>
     49    {else}
     50        <span id="ratingScore">{'no rate'|@translate}</span> <span id="ratingCount"></span>
     51    {/if}
    4952    </div>
    5053   
     
    5255    <form action="{$rating.F_ACTION}" method="post" id="rateForm">
    5356      <div>
    54       {assign var="ratingExploded" value=$rate_summary.average|@explode:'.'}
     57      {assign var="ratingExploded" value=$rate_summary.score|@explode:'.'}
    5558      {foreach from=$rating.marks item=mark name=rate_loop}
    5659        {if !$smarty.foreach.rate_loop.first} | {/if}
     
    7477  rootUrl: '{$ROOT_URL|@escape:"javascript"}',
    7578  image_id: {$current.id},
    76   ratingSummaryText: "{'Average rate'|@translate}: {'%.2f (rated %d times)'|@translate|@escape:'javascript'}",
     79  ratingSummaryText: "{'Rating score'|@translate}: %.2f ({'%d rates'|@translate|@escape:'javascript'})",
    7780  ratingSummaryElement: document.getElementById("ratingSummary")
    7881{rdelim});
Note: See TracChangeset for help on using the changeset viewer.