mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-02 04:15:05 +02:00
feature 2384: improve average rating calculation (final)
git-svn-id: http://piwigo.org/svn/trunk@11839 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -69,6 +69,7 @@ function updateRating(e)
|
||||
onSuccess: function(result) {
|
||||
gUserRating = rateButton.initialRateValue;
|
||||
for (var i=0; i<gRatingButtons.length; i++) gRatingButtons[i].disabled=false;
|
||||
if (gRatingOptions.onSuccess) gRatingOptions.onSuccess(result);
|
||||
if (gRatingOptions.updateRateElement) gRatingOptions.updateRateElement.innerHTML = gRatingOptions.updateRateText;
|
||||
if (gRatingOptions.ratingSummaryElement)
|
||||
{
|
||||
|
||||
@@ -196,13 +196,12 @@ y.callService(
|
||||
|
||||
{if $display_info.average_rate and isset($rate_summary)}
|
||||
<tr id="Average">
|
||||
<td class="label">{'Rating'|@translate}</td>
|
||||
<td class="value" id="ratingSummary">
|
||||
<td class="label">{'Rating score'|@translate}</td>
|
||||
<td class="value">
|
||||
{if $rate_summary.count}
|
||||
{assign var='rate_text' value='%.2f (rated %d times)'|@translate}
|
||||
{$pwg->sprintf($rate_text, $rate_summary.score, $rate_summary.count, $rate_summary.average)}
|
||||
<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>
|
||||
{else}
|
||||
{'no rate'|@translate}
|
||||
<span id="ratingScore">{'no rate'|@translate}</span> <span id="ratingCount"></span>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -228,8 +227,14 @@ y.callService(
|
||||
{footer_script}
|
||||
var _pwgRatingAutoQueue = _pwgRatingAutoQueue||[];
|
||||
_pwgRatingAutoQueue.push( {ldelim}rootUrl: '{$ROOT_URL}', image_id: {$current.id},
|
||||
updateRateText: "{'Update your rating'|@translate|@escape:'javascript'}", updateRateElement: document.getElementById("updateRate"),
|
||||
ratingSummaryText: "{'%.2f (rated %d times)'|@translate|@escape:'javascript'}", ratingSummaryElement: document.getElementById("ratingSummary"){rdelim} );
|
||||
onSuccess : function(rating) {ldelim}
|
||||
var e = document.getElementById("updateRate");
|
||||
if (e) e.innerHTML = "{'Update your rating'|@translate|@escape:'javascript'}";
|
||||
e = document.getElementById("ratingScore");
|
||||
if (e) e.innerHTML = rating.score;
|
||||
e = document.getElementById("ratingCount");
|
||||
if (e) e.innerHTML = "({'%d rates'|@translate|@escape:'javascript'})".replace( "%d", rating.count);
|
||||
{rdelim}{rdelim} );
|
||||
{/footer_script}
|
||||
{/strip}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user