PageRenderTime 20ms CodeModel.GetById 16ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Aurora/Modules/Web/html/admin/factory_reset.cs

https://bitbucket.org/VirtualReality/software-testing
C# | 66 lines | 58 code | 8 blank | 0 comment | 2 complexity | 5cd221f50e2867ef1c3252adc14102a6 MD5 | raw file
 1using Aurora.Framework.Servers.HttpServer;
 2using System.Collections.Generic;
 3using Aurora.Framework.Servers.HttpServer.Implementation;
 4
 5namespace Aurora.Modules.Web
 6{
 7    public class FactoryResetPage : IWebInterfacePage
 8    {
 9        public string[] FilePath
10        {
11            get
12            {
13                return new[]
14                           {
15                               "html/admin/factory_reset.html"
16                           };
17            }
18        }
19
20        public bool RequiresAuthentication
21        {
22            get { return true; }
23        }
24
25        public bool RequiresAdminAuthentication
26        {
27            get { return true; }
28        }
29
30        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
31                                               OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
32                                               ITranslator translator, out string response)
33        {
34            response = null;
35            var vars = new Dictionary<string, object>();
36
37            if (requestParameters.ContainsKey("ResetMenu"))
38            {
39                PagesMigrator.ResetToDefaults();
40                response = translator.GetTranslatedString("ChangesSavedSuccessfully");
41                return null;
42            }
43            if (requestParameters.ContainsKey("ResetSettings"))
44            {
45                SettingsMigrator.ResetToDefaults();
46                response = translator.GetTranslatedString("ChangesSavedSuccessfully");
47                return null;
48            }
49
50            vars.Add("FactoryReset", translator.GetTranslatedString("FactoryReset"));
51            vars.Add("ResetMenuText", translator.GetTranslatedString("ResetMenuText"));
52            vars.Add("ResetSettingsText", translator.GetTranslatedString("ResetSettingsText"));
53            vars.Add("ResetMenuInfoText", translator.GetTranslatedString("ResetMenuText"));
54            vars.Add("ResetSettingsInfoText", translator.GetTranslatedString("ResetSettingsInfoText"));
55            vars.Add("Reset", translator.GetTranslatedString("Reset"));
56
57            return vars;
58        }
59
60        public bool AttemptFindPage(string filename, ref OSHttpResponse httpResponse, out string text)
61        {
62            text = "";
63            return false;
64        }
65    }
66}