mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Implemented new type: mail
* display and link clientside mails to other types and events * fixed favorites menu for new types * fixed sorting column triggered spells in enchantment listview * some misc cleanups
This commit is contained in:
97
template/listviews/mail.tpl.php
Normal file
97
template/listviews/mail.tpl.php
Normal file
@@ -0,0 +1,97 @@
|
||||
Listview.templates.mail = {
|
||||
sort: [1],
|
||||
searchable: 1,
|
||||
filtrable: 1,
|
||||
|
||||
columns: [
|
||||
{
|
||||
id: 'id',
|
||||
name: 'ID',
|
||||
width: '5%',
|
||||
value: 'id',
|
||||
compute: function(data, td) {
|
||||
if (data.id) {
|
||||
$WH.ae(td, $WH.ct(data.id));
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'subject',
|
||||
name: LANG.subject,
|
||||
type: 'text',
|
||||
align: 'left',
|
||||
value: 'subject',
|
||||
compute: function(mail, td, tr) {
|
||||
var wrapper = $WH.ce('div');
|
||||
|
||||
var a = $WH.ce('a');
|
||||
a.style.fontFamily = 'Verdana, sans-serif';
|
||||
a.href = this.getItemLink(mail);
|
||||
if (!mail.subject){
|
||||
mail.subject = 'Untitled Mail'
|
||||
a.className = 'q0';
|
||||
}
|
||||
|
||||
$WH.ae(a, $WH.ct(mail.subject));
|
||||
$WH.ae(wrapper, a);
|
||||
$WH.ae(td, wrapper);
|
||||
},
|
||||
sortFunc: function(a, b, col) {
|
||||
return $WH.strcmp(a.subject, b.subject);
|
||||
},
|
||||
getVisibleText: function(mail) {
|
||||
return mail.subject;
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'body',
|
||||
name: LANG.text,
|
||||
type: 'text',
|
||||
align: 'left',
|
||||
value: 'body',
|
||||
compute: function(mail, td, tr) {
|
||||
td.innerText = mail.body;
|
||||
},
|
||||
sortFunc: function(a, b, col) {
|
||||
return $WH.strcmp(a.body, b.body);
|
||||
},
|
||||
getVisibleText: function(mail) {
|
||||
return mail.body;
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'attachments',
|
||||
name: 'Attachments',
|
||||
type: 'text',
|
||||
compute: function(mail, td) {
|
||||
if (!mail.attachments.length)
|
||||
return;
|
||||
|
||||
mail.attachments.forEach(function(item, idx, arr) {
|
||||
if (g_items && g_items[item]) {
|
||||
i = Icon.create(g_items[item].icon, 0, false, '?item=' + item, 0, 0, false, false, true);
|
||||
if (idx !== arr.length - 1)
|
||||
i.style.paddingLeft = '5px';
|
||||
$WH.ae(td, i);
|
||||
}
|
||||
});
|
||||
},
|
||||
getVisibleText: function(mail) {
|
||||
if (!mail.attachments.length)
|
||||
return null; // no attachments
|
||||
|
||||
var itemId = $(mail.attachments).first()[0];
|
||||
if (g_items && g_items[itemId])
|
||||
return g_items[itemId]['name_' + Locale.getName()];
|
||||
|
||||
return ''; // unk item
|
||||
},
|
||||
sortFunc: function(a, b, col) {
|
||||
return $WH.strcmp(this.getVisibleText(a), this.getVisibleText(b));
|
||||
}
|
||||
}
|
||||
],
|
||||
getItemLink: function(mail) {
|
||||
return '?mail=' + mail.id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user