Subversion Repositories starrating

[/] [design/] [standard/] [templates/] [content/] [datatype/] [view/] [starrating.tpl] - Blame information for rev 1

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1 zabbie
{def $rating=$attribute.content
2
     $rating_url=concat('/starrating/collect/',$attribute.id,'/',$attribute.version,'/')}
3
 
4
<ul class="star-rating">
5
<li id="rating_percent_{$attribute.id}" class="current-rating" style="width:{$rating.rounded_average|div(5)|mul(100)}%;">Currently {$rating.rounded_average|wash}/5 Stars.</li>
6
{if $rating.has_rated|not}
7
{for 1 to 5 as $num}
8
<li><a href={concat($rating_url,$num)|ezurl} id="sr_{$attribute.id}_{$num}" title="Rate {$num} stars out of 5" class="stars-{$num}" rel="nofollow" onfocus="this.blur();">{$num}</a></li>
9
 
10
{/for}
11
{/if}
12
</ul>
13
 
14
Rating: <strong><span id="average_{$attribute.id}">{$rating.rounded_average|wash}</span></strong>/5 (<span id="total_{$attribute.id}">{$rating.number|wash}</span> votes cast)
15
<p id="has_rated_{$attribute.id}">{if $rating.has_rated}Thank you for your rating!{/if}</p>
16
{if $rating.has_rated|not}
17
{def $hasXajaxAccess=fetch('user','has_access_to',hash('module','xajax','function','all'))}
18
{if $hasXajaxAccess}{run-once}{xajax_javascript()}{/run-once}{/if}
19
{run-once}{xajax_javascript()}{/run-once}
20
<script type="text/javascript">
21
 
22
 function starrating_init_{$attribute.id}() {ldelim}
23
{for 1 to 5 as $num}
24
   YAHOO.util.Event.addListener("sr_{$attribute.id}_{$num}", "click", function(e){ldelim}
25
     YAHOO.util.Event.preventDefault(e);
26
     xajax_starrating({$attribute.id}, {$attribute.version}, {$num});
27
{rdelim});
28
 
29
{/for}
30
 {rdelim}
31
 
32
 YAHOO.util.Event.onDOMReady(starrating_init_{$attribute.id});
33
 
34
 function starrating_clear_{$attribute.id}() {ldelim}
35
{for 1 to 5 as $num}
36
   YAHOO.util.Event.removeListener("sr_{$attribute.id}_{$num}", "click");
37
 
38
{/for}
39
 {rdelim}
40
 
41
</script>
42
{/if}