Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add removegroup handler for WebAdmin #207

Merged
merged 4 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ daniel0916
Etmix
Howaner
isavegas
iulian3144 (Iulian PAUN)
jamestait
jonfabe
LogicParrot
Expand Down
28 changes: 27 additions & 1 deletion web_ranks.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,32 @@ local function ShowAddGroupPage(a_Request)
"<p>Group added. <a href='/" ..
a_Request.Path ..
"?subpage=editgroups&RankName=" ..
cWebAdmin:GetURLEncodedString(RankName) ..
cUrlParser:UrlEncode(RankName) ..
"'>Return to list</a>."
end





--- Processes the RemoveGroup page, removing a group from the specified rank and redirecting back to rank's group list
local function ShowRemoveGroupPage(a_Request)
-- Check params:
local RankName = a_Request.PostParams["RankName"]
local GroupName = a_Request.PostParams["GroupName"]
if ((RankName == nil) or (GroupName == nil)) then
return HTMLError("Bad request, missing parameters.")
end

-- Remove the group:
cRankManager:RemoveGroupFromRank(GroupName, RankName)

-- Redirect the user:
return
"<p>Group removed. <a href='/" ..
a_Request.Path ..
"?subpage=editgroups&RankName=" ..
cUrlParser:UrlEncode(RankName) ..
"'>Return to list</a>."
end

Expand Down Expand Up @@ -481,6 +506,7 @@ local g_SubpageHandlers =
["editdefaultrank"] = ShowEditDefaultRankPage,
["editgroups"] = ShowEditGroupsPage,
["editvisuals"] = ShowEditVisualsPage,
["removegroup"] = ShowRemoveGroupPage,
["savevisuals"] = ShowSaveVisualsPage,
}

Expand Down