/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

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