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

Last change on this file since 26838 was 26838, checked in by rvelices, 10 years ago

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
File size: 4.0 KB
Line 
1{combine_script id='jquery.dataTables' load='footer' path='themes/default/js/plugins/jquery.dataTables.js'}
2{html_style}
3.sorting { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_both.png) no-repeat center right; cursor:pointer; }
4.sorting_asc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc.png) no-repeat center right; }
5.sorting_desc { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc.png) no-repeat center right; }
6
7.sorting, .sorting_asc, .sorting_desc {
8        padding: 3px 18px 3px 10px;
9}
10.sorting_asc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_asc_disabled.png) no-repeat center right; }
11.sorting_desc_disabled { background: url({$ROOT_URL}themes/default/js/plugins/datatables/images/sort_desc_disabled.png) no-repeat center right; }
12
13.dtBar {
14        text-align:left;
15        padding-left: 20px;
16}
17{/html_style}
18
19<h2>{$ratings|@count} {'Users'|@translate}</h2>
20
21<form action="{$F_ACTION}" method="GET">
22<fieldset>
23<noscript>
24        <label>{'Sort by'|@translate}
25                <select name="order_by">
26                        {html_options options=$order_by_options selected=$order_by_options_selected}
27                </select>
28        </label>
29</noscript>
30        <label>{'Number of rates'|@translate}&gt;
31        <input type="text" size="5" name="f_min_rates" value="{$F_MIN_RATES}">
32        </label>
33        <input type="submit" value="{'Submit'|@translate}">
34        </label>
35        <input type="hidden" name="page" value="rating_user">
36</fieldset>
37</form>
38
39{combine_script id='core.scripts' load='async' path='themes/default/js/scripts.js'}
40{footer_script}
41var oTable = jQuery('#rateTable').dataTable({
42        sDom : '<"dtBar"f>rt',
43        bPaginate: false,
44        aaSorting: [[4,'desc']],
45        aoColumnDefs: [
46                {
47                        aTargets: ["dtc_user"],
48                },
49                {
50                        aTargets: ["dtc_stat"],
51                        asSorting: ["desc","asc"],
52                        bSearchable: false
53                },
54                {
55                        aTargets: ["dtc_rate"],
56                        asSorting: ["desc","asc"],
57                        bSearchable: false
58                },
59                {
60                        aTargets: ["dtc_del"],
61                        bSortable: false,
62                        bSearchable: false
63                }
64        ]
65});
66
67function del(elt,uid,aid){
68        if (!confirm('{'Are you sure?'|@translate|@escape:'javascript'}'))
69                return false;
70        var tr = elt;
71        while ( tr.nodeName != "TR") tr = tr.parentNode;
72        tr = jQuery(tr).fadeTo(1000, 0.4);
73
74        (new PwgWS('{$ROOT_URL|@escape:javascript}')).callService(
75                'pwg.rates.delete', { user_id:uid, anonymous_id:aid},
76                {
77                        method: 'POST',
78                        onFailure: function(num, text) { tr.stop(); tr.fadeTo(0,1); alert(num + " " + text); },
79                        onSuccess: function(result){
80                                if (result)
81                                        oTable.fnDeleteRow(tr[0]);
82                                else
83                                        alert(result);
84                        }
85                }
86        );
87       
88        return false;
89}
90{/footer_script}
91<table id="rateTable">
92<thead>
93<tr class="throw">
94        <td class="dtc_user">{'Username'|@translate}</td>
95        <td class="dtc_stat">{'Number of rates'|@translate}</td>
96        <td class="dtc_stat">{'Average rate'|@translate}</td>
97        <td class="dtc_stat">{'Variation'|@translate}</td>
98        <td class="dtc_stat">{'Consensus deviation'|@translate|@replace:' ':'<br>'}</td>
99{foreach from=$available_rates item=rate}
100        <td class="dtc_rate">{$rate}</td>
101{/foreach}
102        <td class="dtc_del"></td>
103</tr>
104</thead>
105{foreach from=$ratings item=rating key=user}
106<tr>
107        <td>{$user}</td>
108        <td>{$rating.count}</td>
109        <td>{$rating.avg|@number_format:2}</td>
110        <td>{$rating.cv|@number_format:3}</td>
111        <td>{$rating.cd|@number_format:3}</td>
112        {foreach from=$rating.rates item=rates key=rate}
113        <td>{if !empty($rates)}
114                {capture assign=rate_over}{foreach from=$rates item=rate_arr}<img src="{$image_urls[$rate_arr.id].tn}" alt="thumb-{$rate_arr.id}" title="{$rate_arr.date}"></img>
115                {/foreach}{/capture}
116                <a class="cluetip" title="|{$rate_over|@htmlspecialchars}">{$rates|@count}</a>
117                {/if}</td>
118        {/foreach}
119        <td><a onclick="return del(this,{$rating.uid},'{$rating.aid}');" class="icon-trash"></a></td>
120</tr>
121{/foreach}
122</table>
123
124{combine_script id='jquery.cluetip' load='footer' require='jquery' path='themes/default/js/plugins/jquery.cluetip.js'}
125{footer_script require='jquery.cluetip'}
126jQuery(document).ready(function(){ldelim}
127        jQuery('.cluetip').cluetip({ldelim}
128                width: {$TN_WIDTH}, showTitle:false, splitTitle: '|'
129        });
130})
131{/footer_script}
Note: See TracBrowser for help on using the repository browser.