var ajaxify,buildrows,disable_links,pagination,replacelink;disable_links=function(e){if(exports.inprogress){e.preventDefault();return 1;}};pagination=function(data,action){var html,linkpage,rows,tmpl,_i,_len,_ref;if(data.items.length){rows=[];data.action=action;if(data.next_page!==data.first_page&&data.page!==data.first_page)rows.push('<span><a href="/messages/{{action}}/{{order_by}}/{{direction}}/{{first_page}}"><img src="{{media_url}}/imgs/first_pager.png" alt="first" title="first" /></a></span><span>...</span>');if(data.previous_page)rows.push('<span><a href="/messages/{{action}}/{{order_by}}/{{direction}}/{{previous_page}}"><img src="{{media_url}}/imgs/previous_pager.png" alt="prev" title="prev" /></a></span>');_ref=data.page_nums;for(_i=0,_len=_ref.length;_i<_len;_i++){linkpage=_ref[_i];if(linkpage===data.page)rows.push('<span class="curpage">{{page}}</span>');else rows.push('<span><a href="/messages/{{action}}/{{order_by}}/{{direction}}/'+linkpage+'">'+linkpage+'</a></span>');}if(data.next_page)rows.push('<span><a href="/messages/{{action}}/{{order_by}}/{{direction}}/{{next_page}}"><img src="{{media_url}}/imgs/next_pager.png" alt="next" title="next" /></a></span>');if(data.next_page!==data.page_count&&data.page!==data.page_count&&data.page_count!==0)rows.push('<span>...</span><span><a href="/messages/{{action}}/{{order_by}}/{{direction}}/{{last_page}}"><img src="{{media_url}}/imgs/last_pager.png" alt="last" title="last" /></a></span>');tmpl=rows.join('\n');html=$.mustache(tmpl,data);}else html='-';return html;};ajaxify=function(e,url){e.preventDefault();$.address.value(url.replace(/\.json/,''));$.address.history($.address.baseURL()+url);ajaxrequest(url);return 1;};replacelink=function(html,style){$(style).html(html);return 1;};buildrows=function(items,action){var replacement,row,rows;row='<tr class="{{style}}_row"><td class="date_td">'+'<a href="/messages/{{action}}/{{id}}">{{timestamp}}</a></td>'+'<td class="from_td"><a href="/messages/{{action}}/{{id}}">{{from_address}}</a></td>'+'<td class="to_td"><a href="/messages/{{action}}/{{id}}">{{to_address}}</a></td>'+'<td class="subject_td"><a href="/messages/{{action}}/{{id}}">{{{subject}}}</a></td>'+'<td class="size_td"><a href="/messages/{{action}}/{{id}}">{{size}}</a></td>'+'<td class="score_td"><a href="/messages/{{action}}/{{id}}">{{sascore}}</a></td>'+'<td class="status_td"><a href="/messages/{{action}}/{{id}}">{{status}}</a></td></tr>';if(items.length){rows=[];$.each(items,function(i,n){var html;n.action=action;n.timestamp=BaruwaDateString(n.timestamp);html=$.mustache(row,n);return rows.push(html);});replacement=rows.join('');}else replacement='<tr><td colspan="7" class="spanrow">'+gettext('No messages found')+'</td></tr>';$('tbody').empty().append(replacement);return 1;};