local function HTML_Option( value, text, selected )
if( selected == true ) then
return [[]]
else
return [["]]
end
end
local function ShowUsersTable()
local Content = "
Users
"
local NumUsers = UsersIni:GetNumKeys()
Content = Content .. "
"
if( NumUsers > 0 ) then
Content = Content .. "
User
Groups
"
for i=0, NumUsers-1 do
local UserName = UsersIni:GetKeyName( i )
Content = Content .. "
"
return Content
end
local function HTML_Select_Group( name, defaultValue )
Groups = ""
for I=0, GroupsIni:GetNumKeys() - 1 do
Groups = Groups ..
HTML_Option(GroupsIni:KeyName(I), GroupsIni:KeyName(I), defaultValue == GroupsIni:KeyName(I) )
end
return [[]]
end
local function AddPlayers( Request )
local Content = "
Add or change Players
"
if( Request.PostParams["AddPlayerToGroup"] ~= nil ) then
if Request.PostParams["AddPlayer"] ~= "" then
if Request.PostParams["AddGroups"] ~= "" then
if GroupsIni:FindKey(Request.PostParams["AddGroup"]) == -1 then
return "Group does not exist"
end
UsersIni:DeleteKey(Request.PostParams["AddPlayer"])
UsersIni:GetValueSet(Request.PostParams["AddPlayer"], "Groups", Request.PostParams["AddGroup"])
UsersIni:WriteFile()
local loopPlayers = function( Player )
if Player:GetName() == Request.PostParams["AddPlayer"] then
Player:SendMessage( cChatColor.Green .. "You were moved to group " .. Request.PostParams["AddGroup"] )
Player:LoadPermissionsFromDisk()
end
end
local loopWorlds = function ( World )
World:ForEachPlayer( loopPlayers )
end
cRoot:Get():ForEachWorld( loopWorlds )
end
end
end
Content = Content .. [[