diff --git a/Plugins/Core/web_manageplugins.lua b/Plugins/Core/web_manageplugins.lua new file mode 100644 index 000000000..3030efc7a --- /dev/null +++ b/Plugins/Core/web_manageplugins.lua @@ -0,0 +1,93 @@ +local function Button_RemovePlugin( Name, Index ) + return "
" +end + +local function HandlePluginListChanges( Request, SettingsIni ) + local Content = "" + if( Request.PostParams["RemovePlugin"] ~= nil + and Request.PostParams["PluginName"] ~= nil + and Request.PostParams["PluginIndex"] ~= nil ) then -- Removing a plugin + + local KeyIdx = SettingsIni:FindKey("Plugins") + local PluginIdx = Request.PostParams["PluginIndex"] + + local PluginName = SettingsIni:GetValue( KeyIdx, PluginIdx ) + if( (PluginName == Request.PostParams["PluginName"]) and (SettingsIni:DeleteValueByID( KeyIdx, PluginIdx ) == true) ) then + SettingsIni:WriteFile() + Content = "Removed plugin '" .. PluginName .. "'" + else + Content = "Whoops! Something went wrong!" + end + + + elseif( Request.PostParams["AddPlugin"] ~= nil + and Request.PostParams["PluginName"] ~= nil ) then -- Add a plugin + + SettingsIni:SetValue("Plugins", "NewPlugin", Request.PostParams["PluginName"], true ) + SettingsIni:WriteFile() + + Content = "Added plugin '".. Request.PostParams["PluginName"] .."'" + + end + + if( #Content > 0 ) then + return "INFO: " .. Content .. "
" + else + return "" + end +end + +function HandleRequest_ManagePlugins( Request ) + local Content = "" + + if( Request.PostParams["reload"] ~= nil ) then + Content = Content .. "" + Content = Content .. "Reloading plugins... This can take a while depending on the plugins you're using.
" + cRoot:Get():GetPluginManager():ReloadPlugins() + return Content + end + + local PluginManager = cRoot:Get():GetPluginManager() + local PluginList = PluginManager:GetAllPlugins() + + Content = Content .. "| " .. Plugin:GetName() .. " V. " .. Plugin:GetVersion() .. " |
| " .. ValueName .. ": " .. PluginName .. " | " + Content = Content .. "" .. Button_RemovePlugin( PluginName, i ) .. " | " + Content = Content .. "