mirror of
https://github.com/mt-mods/mail.git
synced 2025-07-07 07:00:31 -04:00
Add sorters for inbox/outbox
This commit is contained in:
parent
def93bdd0f
commit
3e2d022c87
4 changed files with 105 additions and 36 deletions
45
ui/inbox.lua
45
ui/inbox.lua
|
@ -1,30 +1,39 @@
|
|||
-- translation
|
||||
local S = minetest.get_translator("mail")
|
||||
|
||||
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
||||
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;1;false;false]
|
||||
|
||||
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
|
||||
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]
|
||||
button[6,1.70;2.5,0.5;reply;]] .. S("Reply") .. [[]
|
||||
button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[]
|
||||
button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[]
|
||||
button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[]
|
||||
button[6,4.82;2.5,0.5;markread;]] .. S("Mark Read") .. [[]
|
||||
button[6,5.55;2.5,0.5;markunread;]] .. S("Mark Unread") .. [[]
|
||||
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
|
||||
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
|
||||
button[6,8.7;2.5,0.5;about;]] .. S("About") .. [[]
|
||||
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
|
||||
function mail.show_inbox(name, sortfield, sortdirection)
|
||||
if not sortfield or sortfield == "" or sortfield == "0" then
|
||||
sortfield = 3
|
||||
end
|
||||
if not sortdirection or sortdirection == "" or sortdirection == "0" then
|
||||
sortdirection = 1
|
||||
end
|
||||
|
||||
tablecolumns[color;text;text]
|
||||
table[0,0.7;5.75,9.35;inbox;#999,]] .. S("From") .. "," .. S("Subject")
|
||||
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
||||
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;1;false;false]
|
||||
|
||||
button[6,0.10;2.5,0.5;new;]] .. S("New") .. [[]
|
||||
button[6,0.95;2.5,0.5;read;]] .. S("Read") .. [[]
|
||||
button[6,1.70;2.5,0.5;reply;]] .. S("Reply") .. [[]
|
||||
button[6,2.45;2.5,0.5;replyall;]] .. S("Reply all") .. [[]
|
||||
button[6,3.20;2.5,0.5;forward;]] .. S("Forward") .. [[]
|
||||
button[6,3.95;2.5,0.5;delete;]] .. S("Delete") .. [[]
|
||||
button[6,4.82;2.5,0.5;markread;]] .. S("Mark Read") .. [[]
|
||||
button[6,5.55;2.5,0.5;markunread;]] .. S("Mark Unread") .. [[]
|
||||
button[6,6.8;2.5,0.5;contacts;]] .. S("Contacts") .. [[]
|
||||
button[6,7.6;2.5,0.5;maillists;]] .. S("Mail lists") .. [[]
|
||||
button[6,8.7;2.5,0.5;about;]] .. S("About") .. [[]
|
||||
button_exit[6,9.5;2.5,0.5;quit;]] .. S("Close") .. [[]
|
||||
|
||||
function mail.show_inbox(name)
|
||||
dropdown[0,9.4;2,0.5;sortfield;]] .. S("From") .. "," .. S("Subject") .. "," .. S("Date") .. [[;]] .. tostring(sortfield) .. [[;1]
|
||||
dropdown[2.2,9.4;2,0.5;sortdirection;]] .. S("Ascending") .. "," .. S("Descending") .. [[;]] .. tostring(sortdirection) .. [[;1]
|
||||
|
||||
tablecolumns[color;text;text]
|
||||
table[0,0.7;5.75,8.35;inbox;#999,]] .. S("From") .. "," .. S("Subject")
|
||||
local formspec = { inbox_formspec }
|
||||
local entry = mail.get_storage_entry(name)
|
||||
local messages = entry.inbox
|
||||
local messages = mail.sort_messages(entry.inbox, sortfield, sortdirection)
|
||||
|
||||
mail.message_drafts[name] = nil
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue