Added pending actions list to main dashboard
This commit is contained in:
parent
18d63485c2
commit
85e9916e27
@ -31,6 +31,19 @@ function modpol.interactions.dashboard(user)
|
||||
end
|
||||
end
|
||||
|
||||
-- pending list
|
||||
local user_pending = {}
|
||||
local user_pending_count = 0
|
||||
for k,v in ipairs(modpol.orgs.array) do
|
||||
if v.pending and v.pending[user] then
|
||||
modpol.msg(v.name)
|
||||
table.insert(user_pending, v.name)
|
||||
user_pending_count = user_pending_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
print('Pending actions in: '..table.concat(user_pending,', '))
|
||||
|
||||
print('All users: ' .. table.concat(all_users, ', '))
|
||||
print()
|
||||
|
||||
|
@ -48,6 +48,17 @@ function modpol.interactions.dashboard(user)
|
||||
local all_orgs = modpol.orgs.list_all()
|
||||
local user_orgs = modpol.orgs.user_orgs(user)
|
||||
local all_users = modpol.instance:list_members()
|
||||
-- pending list
|
||||
local user_pending = {"View..."}
|
||||
local user_pending_count = 0
|
||||
for k,v in ipairs(modpol.orgs.array) do
|
||||
if v.pending and v.pending[user] then
|
||||
modpol.msg(v.name)
|
||||
table.insert(user_pending, v.name)
|
||||
user_pending_count = user_pending_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- set up formspec
|
||||
local formspec = {
|
||||
"formspec_version[4]",
|
||||
@ -59,6 +70,8 @@ function modpol.interactions.dashboard(user)
|
||||
"dropdown[2,2.5;7,0.8;user_orgs;"..formspec_list(user_orgs)..";;]",
|
||||
"label[0.5,4;All users:]",
|
||||
"dropdown[2,3.5;7,0.8;all_users;"..formspec_list(all_users)..";;]",
|
||||
"label[0.5,5;Pending ("..user_pending_count.."):]",
|
||||
"dropdown[2,4.5;7,0.8;pending;"..formspec_list(user_pending)..";;]",
|
||||
"button[0.5,7;1,0.8;refresh;Refresh]",
|
||||
"button_exit[8.5,7;1,0.8;close;Close]",
|
||||
}
|
||||
@ -76,8 +89,8 @@ minetest.register_on_player_receive_fields(function (player, formname, fields)
|
||||
elseif fields.refresh then
|
||||
modpol.interactions.dashboard(pname)
|
||||
-- Put all dropdowns at the end
|
||||
elseif fields.all_orgs or fields.user_orgs then
|
||||
local org_name = fields.all_orgs or fields.user_orgs
|
||||
elseif fields.all_orgs or fields.user_orgs or fields.pending then
|
||||
local org_name = fields.all_orgs or fields.user_orgs or fields.pending
|
||||
modpol.interactions.org_dashboard(pname, org_name)
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user