From 474b113b2f5cb43c360f504ac43141eba9b071ee Mon Sep 17 00:00:00 2001 From: "nielsbreu@gmail.com" Date: Mon, 6 May 2013 19:53:35 +0000 Subject: [PATCH] made the permission page more manageable. git-svn-id: http://mc-server.googlecode.com/svn/trunk@1453 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- MCServer/Plugins/Core/web_permissions.lua | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/MCServer/Plugins/Core/web_permissions.lua b/MCServer/Plugins/Core/web_permissions.lua index 962078bb2..5278767e7 100644 --- a/MCServer/Plugins/Core/web_permissions.lua +++ b/MCServer/Plugins/Core/web_permissions.lua @@ -1,3 +1,11 @@ +local function HTML_Option( value, text, selected ) + if( selected == true ) then + return [[]] + else + return [["]] + end +end + local function ShowUsersTable() local Content = "

Users

" @@ -59,8 +67,18 @@ local function ShowGroupsTable() 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 Players

" + local Content = "

Add or change Players

" if( Request.PostParams["AddPlayerToGroup"] ~= nil ) then if Request.PostParams["AddPlayer"] ~= "" then if Request.PostParams["AddGroups"] ~= "" then @@ -89,9 +107,10 @@ local function AddPlayers( Request ) Player:
Group: - + ]] .. HTML_Select_Group("AddGroup", GroupsIni:KeyName(0) ) .. [[ ]] + return Content end