source: branches/2.6/admin/themes/default/template/rating.tpl @ 26838

Revision 26838, 2.8 KB checked in by rvelices, 6 years ago (diff)

merge -r26837 from trunk to branch 2.6
admin rating improvements

  • use web service for deletion
  • use datatables for rating by user
  • use fontello icons
  • Property svn:eol-style set to LF
Line 
1<h2>{$NB_ELEMENTS} {'Photos'|@translate}</h2>
2
3<form action="{$F_ACTION}" method="GET" class="filter">
4  <fieldset>
5    <legend>{'Filter'|@translate}</legend>
6
7    <label>
8      {'Sort by'|@translate}
9      <select name="order_by">
10        {html_options options=$order_by_options selected=$order_by_options_selected}
11      </select>
12    </label>
13
14    <label>
15      {'Users'|@translate}
16      <select name="users">
17        {html_options options=$user_options selected=$user_options_selected}
18      </select>
19    </label>
20
21    <label>
22      {'Number of items'|@translate}
23      <input type="text" name="display" size="2" value="{$DISPLAY}">
24    </label>
25
26    <label>
27      &nbsp;
28    <input class="submit" type="submit" value="{'Submit'|@translate}">
29    </label>
30    <input type="hidden" name="page" value="rating">
31  </fieldset>
32</form>
33
34{if !empty($navbar) }{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
35
36<table width="99%">
37<tr class="throw">
38  <td>{'File'|@translate}</td>
39  <td>{'Number of rates'|@translate}</td>
40        <td>{'Rating score'|@translate}</td>
41  <td>{'Average rate'|@translate}</td>
42  <td>{'Sum of rates'|@translate}</td>
43  <td>{'Rate'|@translate}/{'Username'|@translate}/{'Rate date'|@translate}</td>
44  <td></td>
45</tr>
46{foreach from=$images item=image name=image}
47<tr valign="top" class="{if $smarty.foreach.image.index is odd}row1{else}row2{/if}">
48        <td><a href="{$image.U_URL}"><img src="{$image.U_THUMB}" alt="{$image.FILE}" title="{$image.FILE}"></a></td>
49        <td><strong>{$image.NB_RATES}/{$image.NB_RATES_TOTAL}</strong></td>
50        <td><strong>{$image.SCORE_RATE}</strong></td>
51        <td><strong>{$image.AVG_RATE}</strong></td>
52        <td style="border-right:1px solid" ><strong>{$image.SUM_RATE}</strong></td>
53        <td>
54                <table style="width:100%">
55{foreach from=$image.rates item=rate name=rate}
56<tr>
57        <td>{$rate.rate}</td>
58        <td><b>{$rate.USER}</b></td>
59        <td>{$rate.date}</td>
60        <td><a onclick="return del(this,{$image.id},{$rate.user_id}{if !empty({$rate.anonymous_id})},'{$rate.anonymous_id}'{/if})" class="icon-trash"> </a></td>
61</tr>
62{/foreach}{*rates*}
63                </table>
64        </td>
65</tr>
66{/foreach}{*images*}
67</table>
68{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
69{footer_script}
70function del(node,id,uid,aid){
71        var tr = jQuery(node).parents("tr").first().fadeTo(1000, 0.4),
72                data = {
73                        image_id: id,
74                        user_id: uid
75                };
76        if (aid)
77                data.anonymous_id = aid;
78
79        (new PwgWS('{$ROOT_URL|@escape:javascript}')).callService(
80                'pwg.rates.delete', data,
81                {
82                        method: 'POST',
83                        onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
84                        onSuccess: function(result){
85                                if (result)
86                                        tr.remove();
87                                else
88                                        alert(result);
89                        }
90                }
91        );
92        return false;
93}
94{/footer_script}
95
96{if !empty($navbar)}{include file='navigation_bar.tpl'|@get_extent:'navbar'}{/if}
Note: See TracBrowser for help on using the repository browser.