mirror of
https://github.com/mt-mods/mail.git
synced 2025-04-30 08:21:44 -04:00
Fixes
This commit is contained in:
parent
8d9e4e0160
commit
e18512675a
4 changed files with 16 additions and 12 deletions
|
@ -40,9 +40,9 @@ function mail.show_drafts(name)
|
||||||
formspec[#formspec + 1] = S("(No subject)")
|
formspec[#formspec + 1] = S("(No subject)")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mail.selected_idxs.sent[name] then
|
if mail.selected_idxs.drafts[name] then
|
||||||
formspec[#formspec + 1] = ";"
|
formspec[#formspec + 1] = ";"
|
||||||
formspec[#formspec + 1] = tostring(mail.selected_idxs.sent[name] + 1)
|
formspec[#formspec + 1] = tostring(mail.selected_idxs.drafts[name] + 1)
|
||||||
end
|
end
|
||||||
formspec[#formspec + 1] = "]"
|
formspec[#formspec + 1] = "]"
|
||||||
else
|
else
|
||||||
|
|
|
@ -23,6 +23,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
local inboxsortfield = ({"from","subject","time"})[sortfieldindex]
|
local inboxsortfield = ({"from","subject","time"})[sortfieldindex]
|
||||||
local outboxsortfield = ({"to","subject","time"})[sortfieldindex]
|
local outboxsortfield = ({"to","subject","time"})[sortfieldindex]
|
||||||
|
|
||||||
|
-- Be sure that inbox/outbox selected idxs aren't nil
|
||||||
|
mail.selected_idxs.inbox[name] = mail.selected_idxs.inbox[name] or {}
|
||||||
|
mail.selected_idxs.sent[name] = mail.selected_idxs.sent[name] or {}
|
||||||
|
|
||||||
-- Store common player configuration for reuse
|
-- Store common player configuration for reuse
|
||||||
mail.selected_idxs.sortfield[name] = sortfieldindex
|
mail.selected_idxs.sortfield[name] = sortfieldindex
|
||||||
mail.selected_idxs.sortdirection[name] = sortdirection
|
mail.selected_idxs.sortdirection[name] = sortdirection
|
||||||
|
@ -31,6 +35,12 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
mail.selected_idxs.multipleselection[name] = fields.multipleselection == "true"
|
mail.selected_idxs.multipleselection[name] = fields.multipleselection == "true"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Avoid several selected after disabling the multiple selection
|
||||||
|
if not mail.selected_idxs.multipleselection[name] then
|
||||||
|
mail.selected_idxs.inbox[name] = { mail.selected_idxs.inbox[name][#mail.selected_idxs.inbox[name]] }
|
||||||
|
mail.selected_idxs.sent[name] = { mail.selected_idxs.sent[name][#mail.selected_idxs.sent[name]] }
|
||||||
|
end
|
||||||
|
|
||||||
-- split inbox and sent msgs for different tests
|
-- split inbox and sent msgs for different tests
|
||||||
local entry = mail.get_storage_entry(name)
|
local entry = mail.get_storage_entry(name)
|
||||||
local messagesDrafts = entry.drafts
|
local messagesDrafts = entry.drafts
|
||||||
|
|
|
@ -6,10 +6,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
||||||
sortfieldindex = tonumber(sortfieldindex or mail.selected_idxs.sortfield[name]) or 3
|
sortfieldindex = tonumber(sortfieldindex or mail.selected_idxs.sortfield[name]) or 3
|
||||||
sortdirection = sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
sortdirection = sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
||||||
filter = mail.selected_idxs.filter[name] or filter or ""
|
filter = mail.selected_idxs.filter[name] or filter or ""
|
||||||
local nb_selected = 0
|
mail.selected_idxs.inbox[name] = mail.selected_idxs.inbox[name] or {}
|
||||||
if mail.selected_idxs.inbox[name] then
|
|
||||||
nb_selected = #mail.selected_idxs.inbox[name]
|
|
||||||
end
|
|
||||||
|
|
||||||
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
local inbox_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
||||||
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;1;false;false]
|
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;1;false;false]
|
||||||
|
@ -36,7 +33,7 @@ function mail.show_inbox(name, sortfieldindex, sortdirection, filter)
|
||||||
|
|
||||||
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
|
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
|
||||||
tostring(mail.selected_idxs.multipleselection[name]) .. [[]
|
tostring(mail.selected_idxs.multipleselection[name]) .. [[]
|
||||||
label[0,9.65;]] .. tostring(nb_selected) .. " " .. S("selected") .. [[]
|
label[0,9.65;]] .. tostring(#mail.selected_idxs.inbox[name]) .. " " .. S("selected") .. [[]
|
||||||
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
|
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
|
||||||
|
|
||||||
tablecolumns[color;text;text]
|
tablecolumns[color;text;text]
|
||||||
|
|
|
@ -6,10 +6,7 @@ function mail.show_sent(name, sortfieldindex, sortdirection, filter)
|
||||||
sortfieldindex = tonumber(sortfieldindex or mail.selected_idxs.sortfield[name]) or 3
|
sortfieldindex = tonumber(sortfieldindex or mail.selected_idxs.sortfield[name]) or 3
|
||||||
sortdirection = sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
sortdirection = sortdirection or mail.selected_idxs.sortdirection[name] or "1"
|
||||||
filter = mail.selected_idxs.filter[name] or filter or ""
|
filter = mail.selected_idxs.filter[name] or filter or ""
|
||||||
local nb_selected = 0
|
mail.selected_idxs.sent[name] = mail.selected_idxs.sent[name] or {}
|
||||||
if mail.selected_idxs.sent[name] then
|
|
||||||
nb_selected = #mail.selected_idxs.sent[name]
|
|
||||||
end
|
|
||||||
|
|
||||||
local sent_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
local sent_formspec = "size[8.5,10;]" .. mail.theme .. [[
|
||||||
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;2;false;false]
|
tabheader[0.3,1;boxtab;]] .. S("Inbox") .. "," .. S("Sent messages").. "," .. S("Drafts") .. [[;2;false;false]
|
||||||
|
@ -34,7 +31,7 @@ function mail.show_sent(name, sortfieldindex, sortdirection, filter)
|
||||||
|
|
||||||
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
|
checkbox[0,9.1;multipleselection;]] .. S("Allow multiple selection") .. [[;]] ..
|
||||||
tostring(mail.selected_idxs.multipleselection[name]) .. [[]
|
tostring(mail.selected_idxs.multipleselection[name]) .. [[]
|
||||||
label[0,9.65;]] .. tostring(nb_selected) .. " " .. S("selected") .. [[]
|
label[0,9.65;]] .. tostring(#mail.selected_idxs.sent[name]) .. " " .. S("selected") .. [[]
|
||||||
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
|
button[3.5,9.5;2.5,0.5;selectall;]] .. S("(Un)select all") .. [[]
|
||||||
|
|
||||||
tablecolumns[color;text;text]
|
tablecolumns[color;text;text]
|
||||||
|
|
Loading…
Add table
Reference in a new issue