Inheritance: WhiteCore.Framework.Modules.IDataTransferable
Ejemplo n.º 1
0
 private string GetTranslatedString(ITranslator translator, string name, GridPage page, bool isTooltip)
 {
     string retVal = translator.GetTranslatedString(name);
     if (retVal == "UNKNOWN CHARACTER")
         return isTooltip ? page.MenuToolTip : page.MenuTitle;
     return retVal;
 }
 public void ReplacePage(string MenuItem, GridPage replacePage)
 {
     foreach (var page in this.Children)
     {
         if (page.MenuID == MenuItem)
         {
             page.FromOSD(replacePage.ToOSD());
             return;
         }
         else if (page.Children.Count > 0)
         {
             var p = GetPage(MenuItem, page);
             if (p != null)
             {
                 p.FromOSD(replacePage.ToOSD());
                 return;
             }
         }
     }
 }
        private static void InitializeDefaults()
        {
            _rootPage = new GridPage();

            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           MenuID = "home",
                                           Location = "home.html",
                                           MenuPosition = 0,
                                           MenuTitle = "MenuHome",
                                           MenuToolTip = "TooltipsMenuHome"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           MenuID = "news",
                                           Location = "news_list.html",
                                           MenuPosition = 1,
                                           MenuTitle = "MenuNews",
                                           MenuToolTip = "TooltipsMenuNews"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           MenuID = "world",
                                           Location = "world.html",
                                           MenuPosition = 2,
                                           MenuTitle = "MenuWorld",
                                           MenuToolTip = "TooltipsMenuWorld",
                                           Children = new List<GridPage>
                                                          {
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "world",
                                                                      Location = "world.html",
                                                                      MenuPosition = 2,
                                                                      MenuTitle = "MenuWorldMap",
                                                                      MenuToolTip = "TooltipsMenuWorldMap"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "region_search",
                                                                      Location = "region_search.html",
                                                                      MenuPosition = 2,
                                                                      MenuTitle = "MenuRegionSearch",
                                                                      MenuToolTip = "TooltipsMenuRegionSearch"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "region_list",
                                                                      Location = "region_list.html",
                                                                      MenuPosition = 2,
                                                                      MenuTitle = "MenuRegion",
                                                                      MenuToolTip = "TooltipsMenuRegion"
                                                                  }
                                                          }
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           MenuID = "users",
                                           Location = "user_search.html",
                                           MenuPosition = 3,
                                           MenuTitle = "MenuUser",
                                           MenuToolTip = "TooltipsMenuUser",
                                           Children = new List<GridPage>
                                                          {
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      LoggedInRequired = true,
                                                                      MenuID = "change_user_information",
                                                                      Location = "change_user_information.html",
                                                                      MenuPosition = 1,
                                                                      MenuTitle = "MenuChangeUserInformation",
                                                                      MenuToolTip = "TooltipsMenuChangeUserInformation"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "online_users",
                                                                      Location = "online_users.html",
                                                                      MenuPosition = 2,
                                                                      MenuTitle = "MenuOnlineUsers",
                                                                      MenuToolTip = "TooltipsMenuOnlineUsers"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "user_search",
                                                                      Location = "user_search.html",
                                                                      MenuPosition = 3,
                                                                      MenuTitle = "MenuUserSearch",
                                                                      MenuToolTip = "TooltipsMenuUserSearch"
                                                                  }
                                                          }
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           MenuID = "help",
                                           Location = "help.html",
                                           MenuPosition = 5,
                                           MenuTitle = "MenuHelp",
                                           MenuToolTip = "TooltipsMenuHelp",
                                           Children = new List<GridPage>
                                                          {
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "help",
                                                                      Location = "help.html",
                                                                      MenuPosition = 1,
                                                                      MenuTitle = "MenuViewerHelp",
                                                                      MenuToolTip = "TooltipsMenuViewerHelp"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "chat",
                                                                      Location = "chat.html",
                                                                      MenuPosition = 2,
                                                                      MenuTitle = "MenuChat",
                                                                      MenuToolTip = "TooltipsMenuChat"
                                                                  }
                                                          }
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           LoggedInRequired = true,
                                           MenuID = "logout",
                                           Location = "logout.html",
                                           MenuPosition = 7,
                                           MenuTitle = "MenuLogout",
                                           MenuToolTip = "TooltipsMenuLogout"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           LoggedOutRequired = true,
                                           MenuID = "register",
                                           Location = "register.html",
                                           MenuPosition = 7,
                                           MenuTitle = "MenuRegister",
                                           MenuToolTip = "TooltipsMenuRegister"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           LoggedOutRequired = true,
                                           MenuID = "login",
                                           Location = "login.html",
                                           MenuPosition = 8,
                                           MenuTitle = "MenuLogin",
                                           MenuToolTip = "TooltipsMenuLogin",
                                           Children = new List<GridPage>
                                                          {
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      MenuID = "forgot_pass",
                                                                      Location = "forgot_pass.html",
                                                                      MenuPosition = 1,
                                                                      MenuTitle = "MenuForgotPass",
                                                                      MenuToolTip = "TooltipsMenuForgotPass"
                                                                  }
                                                          }
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = true,
                                           AdminRequired = true,
                                           MenuID = "manager",
                                           Location = "admin/manager.html",
                                           MenuPosition = 9,
                                           MenuTitle = "MenuManager",
                                           MenuToolTip = "TooltipsMenuManager",
                                           Children = new List<GridPage>
                                                          {
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "news_manager",
                                                                      Location = "admin/news_manager.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuNewsManager",
                                                                      MenuToolTip = "TooltipsMenuNewsManager"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "user_search",
                                                                      Location = "user_search.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuUserManager",
                                                                      MenuToolTip = "TooltipsMenuUserManager"
                                                                  },
                                                               new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "new_user",
                                                                      Location = "register.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuRegister",
                                                                      MenuToolTip = "TooltipsMenuRegister"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "factory_reset",
                                                                      Location = "admin/factory_reset.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuFactoryReset",
                                                                      MenuToolTip = "TooltipsMenuFactoryReset"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "page_manager",
                                                                      Location = "admin/page_manager.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuPageManager",
                                                                      MenuToolTip = "TooltipsMenuPageManager"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "settings_manager",
                                                                      Location = "admin/settings_manager.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuSettingsManager",
                                                                      MenuToolTip = "TooltipsMenuSettingsManager"
                                                                  },
                                                              new GridPage
                                                                  {
                                                                      ShowInMenu = true,
                                                                      AdminRequired = true,
                                                                      MenuID = "welcomescreen_manager",
                                                                      Location = "admin/welcomescreen_manager.html",
                                                                      MenuPosition = 8,
                                                                      MenuTitle = "MenuWelcomeScreenManager",
                                                                      MenuToolTip = "TooltipsMenuWelcomeScreenManager"
                                                                  }
                                                          }
                                       });

            _rootPage.Children.Add(new GridPage
                                       {
                                           MenuID = "add_news",
                                           ShowInMenu = false,
                                           AdminRequired = true,
                                           MenuPosition = 8,
                                           Location = "admin/add_news.html"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           MenuID = "edit_news",
                                           ShowInMenu = false,
                                           AdminRequired = true,
                                           MenuPosition = 8,
                                           Location = "admin/edit_news.html"
                                       });
            _rootPage.Children.Add(new GridPage
                                       {
                                           MenuID = "edit_user",
                                           ShowInMenu = false,
                                           AdminRequired = true,
                                           MenuPosition = 8,
                                           Location = "admin/edit_user.html"
                                       });

            _rootPage.Children.Add(new GridPage
                                       {
                                           ShowInMenu = false,
                                           MenuID = "news_info",
                                           Location = "news.html"
                                       });

            //Things added, but not used
            /*pages.Add(new Dictionary<string, object> { { "MenuItemID", "tweets" },
                { "ShowInMenu", false },
                { "MenuItemLocation", "tweets.html" },
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuTweets") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuTweets") } });

            pages.Add(new Dictionary<string, object> { { "MenuItemID", "agent_info" },
                { "ShowInMenu", false },
                { "MenuItemLocation", "agent_info.html" },
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuAgentInfo") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuAgentInfo") } });

            pages.Add(new Dictionary<string, object> { { "MenuItemID", "region_info" },
                { "ShowInMenu", false },
                { "MenuItemLocation", "region_info.html" },
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuRegionInfo") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuRegionInfo") } });
            pages.Add(new Dictionary<string, object> { { "MenuItemID", "add_news" },
                { "ShowInMenu", false },
                { "MenuItemLocation", "admin/add_news.html" },
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuNewsManager") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuNewsManager") } });
            pages.Add(new Dictionary<string, object> { { "MenuItemID", "edit_news" },
                { "ShowInMenu", false },
                { "MenuItemLocation", "admin/edit_news.html" },
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuNewsManager") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuNewsManager") } });*/
        }
 public GridPage GetParent(GridPage item, GridPage toCheck)
 {
     if (toCheck == null)
         toCheck = this;
     foreach (var p in toCheck.Children)
     {
         if (item.Location == p.Location)
             return toCheck;
         else if (p.Children.Count > 0)
         {
             var pp = GetParent(item, p);
             if (pp != null)
                 return pp;
         }
     }
     return null;
 }
 public void RemovePageByLocation(string MenuLocation, GridPage replacePage)
 {
     GridPage foundPage = null;
     foreach (var page in this.Children)
     {
         if (page.Location == MenuLocation)
         {
             foundPage = page;
             break;
         }
         else if (page.Children.Count > 0)
         {
             var p = GetPageByLocation(MenuLocation, page);
             if (p != null)
             {
                 page.Children.Remove(p);
                 return;
             }
         }
     }
     if (foundPage != null)
         this.Children.Remove(foundPage);
 }
 public GridPage GetPageByLocation(string item, GridPage rootPage)
 {
     if (rootPage == null)
         rootPage = this;
     foreach (var page in rootPage.Children)
     {
         if (page.Location == item)
             return page;
         else if (page.Children.Count > 0)
         {
             var p = GetPageByLocation(item, page);
             if (p != null)
                 return p;
         }
     }
     return null;
 }
 public GridPage GetParent(GridPage page)
 {
     return GetParent(page, null);
 }
Ejemplo n.º 8
0
        public GridPage GetPage (string item, GridPage rootPage)
        {
            if (rootPage == null)
                rootPage = this;
            foreach (var page in rootPage.Children) {
                if (page.MenuID == item)
                    return page;

                if (page.Children.Count > 0) {
                    var p = GetPage (item, page);
                    if (p != null)
                        return p;
                }
            }
            return null;
        }
Ejemplo n.º 9
0
        internal GridPage GetGridPages ()
        {
            if (webPages == null) {
                IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector> ();
                GridPage rootPage = generics.GetGeneric<GridPage> (UUID.Zero, "WebPages", "Root");
                if (rootPage == null)
                    rootPage = new GridPage ();

                return rootPage;
            }

            return webPages;
        }
Ejemplo n.º 10
0
        public void RemovePage (string MenuID, GridPage replacePage)
        {
            GridPage foundPage = null;
            foreach (var page in Children) {
                if (page.MenuID == MenuID) {
                    foundPage = page;
                    break;
                }

                if (page.Children.Count > 0) {
                    var p = GetPage (MenuID, page);
                    if (p != null) {
                        page.Children.Remove (p);
                        return;
                    }
                }
            }
            if (foundPage != null)
                Children.Remove (foundPage);
        }
Ejemplo n.º 11
0
        public Dictionary<string, object> Fill(WebInterface webInterface, string filename, OSHttpRequest httpRequest,
                                               OSHttpResponse httpResponse, Dictionary<string, object> requestParameters,
                                               ITranslator translator, out string response)
        {
            response = null;
            var vars = new Dictionary<string, object>();

            #region Find pages

            List<Dictionary<string, object>> pages = new List<Dictionary<string, object>>();

            IGenericsConnector generics = Framework.Utilities.DataManager.RequestPlugin<IGenericsConnector>();
            GridPage rootPage = generics.GetGeneric<GridPage>(UUID.Zero, "WebPages", "Root");
            if (rootPage == null)
                return null;            // major bummer !!
            
            rootPage.Children.Sort((a, b) => a.MenuPosition.CompareTo(b.MenuPosition));
            List<GridPage> allPages = new List<GridPage>(rootPage.Children);
            foreach (GridPage page in rootPage.Children)
                allPages.AddRange(page.Children);
            allPages.RemoveAll((a) => !a.ShowInMenu);

            string MenuItem = requestParameters.ContainsKey("MenuItem")
                                  ? requestParameters["MenuItem"].ToString()
                                  : "";
            foreach (GridPage page in allPages)
            {
                pages.Add(new Dictionary<string, object>
                              {
                                  {"Value", page.Location},
                                  {"Name", page.Location},
                                  {
                                      "PageSelected", MenuItem == page.Location
                                                          ? "selected=\"selected\""
                                                          : ""
                                  }
                              });
            }
            vars.Add("PagesList", pages);

            #endregion

            if (requestParameters.ContainsKey("DeleteItem"))
            {
                rootPage.RemovePageByLocation(MenuItem, null);
                generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD());
                response = "<h3>Successfully updated menu</h3>" +
                           "<script language=\"javascript\">" +
                           "setTimeout(function() {window.location.href = \"index.html\";}, 0);" +
                           "</script>";
                return null;
            }
            if (requestParameters.ContainsKey("AddItem"))
            {
                //generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD());
                vars.Add("EdittingPageID", -2);
                vars.Add("DisplayEdit", true);
            }
            if (requestParameters.ContainsKey("SelectItem"))
            {
                GridPage page = rootPage.GetPageByLocation(MenuItem);

                vars.Add("PageTitle", page.MenuTitle);
                vars.Add("PageTooltip", page.MenuToolTip);
                vars.Add("PageID", page.MenuID);
                vars.Add("PagePosition", page.MenuPosition);
                vars.Add("PageLocation", page.Location);
                vars.Add("EdittingPageID", page.MenuID);
                vars.Add("RequiresLoginYes", page.LoggedInRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresLoginNo", !page.LoggedInRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresLogoutYes", page.LoggedOutRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresLogoutNo", !page.LoggedOutRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresAdminYes", page.AdminRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresAdminNo", !page.AdminRequired ? "selected=\"selected\"" : "");
                vars.Add("RequiresAdminLevel", page.AdminLevelRequired);
                vars.Add("DisplayInMenuYes", page.ShowInMenu ? "selected=\"selected\"" : "");
                vars.Add("DisplayInMenuNo", !page.ShowInMenu ? "selected=\"selected\"" : "");
                vars.Add("DisplayEdit", true);

                pages = new List<Dictionary<string, object>>
                            {
                                new Dictionary<string, object>
                                    {
                                        {"Value", "Top Level"},
                                        {"Name", translator.GetTranslatedString("TopLevel")},
                                        {"PageSelected", ""}
                                    }
                            };
                GridPage parent = rootPage.GetParent(page);
                foreach (GridPage p in allPages)
                {
                    pages.Add(new Dictionary<string, object>
                                  {
                                      {"Value", p.Location},
                                      {"Name", p.Location},
                                      {
                                          "PageSelected", parent.Location == p.Location
                                                              ? "selected=\"selected\""
                                                              : ""
                                      }
                                  });
                }
                vars.Add("ParentPagesList", pages);
            }

            if (requestParameters.ContainsKey("AddItem"))
            {
                vars.Add("PageTitle", "");
                vars.Add("PageTooltip", "");
                vars.Add("PageID", "");
                vars.Add("PagePosition", "");
                vars.Add("PageLocation", "");
                if (!vars.ContainsKey("EdittingPageID"))
                    vars.Add("EdittingPageID", "");
                vars.Add("RequiresLoginYes", "");
                vars.Add("RequiresLoginNo", "");
                vars.Add("RequiresLogoutYes", "");
                vars.Add("RequiresLogoutNo", "");
                vars.Add("RequiresAdminYes", "");
                vars.Add("RequiresAdminNo", "");
                vars.Add("RequiresAdminLevel", "1");

                pages = new List<Dictionary<string, object>>
                            {
                                new Dictionary<string, object>
                                    {
                                        {"Value", "Top Level"},
                                        {"Name", translator.GetTranslatedString("TopLevel")},
                                        {"PageSelected", ""}
                                    }
                            };
                foreach (GridPage p in allPages)
                {
                    pages.Add(new Dictionary<string, object>
                                  {
                                      {"Value", p.Location},
                                      {"Name", p.Location},
                                      {"PageSelected", ""}
                                  });
                }
                vars.Add("ParentPagesList", pages);
            }

            if (requestParameters.ContainsKey("SaveMenuItem"))
            {
                string edittingPageID = requestParameters["EdittingPageID"].ToString();
                string PageTitle = requestParameters["PageTitle"].ToString();
                string PageTooltip = requestParameters["PageTooltip"].ToString();
                string PagePosition = requestParameters["PagePosition"].ToString();
                string PageID = requestParameters["PageID"].ToString();
                string PageLocation = requestParameters["PageLocation"].ToString();
                bool RequiresLogin = bool.Parse(requestParameters["RequiresLogin"].ToString());
                bool RequiresLogout = bool.Parse(requestParameters["RequiresLogout"].ToString());
                bool RequiresAdmin = bool.Parse(requestParameters["RequiresAdmin"].ToString());
                bool DisplayInMenu = bool.Parse(requestParameters["DisplayInMenu"].ToString());
                string ParentMenuItem = requestParameters["ParentMenuItem"].ToString();
                int RequiredAdminLevel = int.Parse(requestParameters["RequiredAdminLevel"].ToString());
                GridPage page = rootPage.GetPage(edittingPageID);
                bool add = page == null;
                if (page == null)
                    page = new GridPage {MenuID = PageLocation, ShowInMenu = true};

                page.Location = PageLocation;
                page.MenuID = PageID;
                page.MenuPosition = int.Parse(PagePosition);
                page.MenuTitle = PageTitle;
                page.MenuToolTip = PageTooltip;
                page.LoggedInRequired = RequiresLogin;
                page.LoggedOutRequired = RequiresLogout;
                page.AdminRequired = RequiresAdmin;
                page.AdminLevelRequired = RequiredAdminLevel;
                page.ShowInMenu = DisplayInMenu;

                GridPage parent = rootPage.GetPageByLocation(ParentMenuItem);

                if (parent != page)
                {
                    if (!add)
                        rootPage.RemovePage(edittingPageID, page);

                    if (parent != null)
                        parent.Children.Add(page);
                    else //Top Level
                        rootPage.Children.Add(page);

                    response = "<h3>Successfully updated menu</h3>" +
                               "<script language=\"javascript\">" +
                               "setTimeout(function() {window.location.href = \"index.html\";}, 0);" +
                               "</script>";
                }
                else
                    response = "<h3>" + translator.GetTranslatedString("CannotSetParentToChild") + "</h3>";

                generics.AddGeneric(UUID.Zero, "WebPages", "Root", rootPage.ToOSD());
                return null;
            }

            vars.Add("PageTitleText", translator.GetTranslatedString("PageTitleText"));
            vars.Add("PageTooltipText", translator.GetTranslatedString("PageTooltipText"));
            vars.Add("PagePositionText", translator.GetTranslatedString("PagePositionText"));
            vars.Add("PageIDText", translator.GetTranslatedString("PageIDText"));
            vars.Add("PageLocationText", translator.GetTranslatedString("PageLocationText"));
            vars.Add("SaveMenuItemChanges", translator.GetTranslatedString("SaveMenuItemChanges"));
            vars.Add("RequiresLoginText", translator.GetTranslatedString("RequiresLoginText"));
            vars.Add("RequiresLogoutText", translator.GetTranslatedString("RequiresLogoutText"));
            vars.Add("RequiresAdminText", translator.GetTranslatedString("RequiresAdminText"));
            vars.Add("RequiresAdminLevelText", translator.GetTranslatedString("RequiresAdminLevelText"));
            vars.Add("DisplayInMenu", translator.GetTranslatedString("DisplayInMenu"));
            vars.Add("SelectItem", translator.GetTranslatedString("SelectItem"));
            vars.Add("DeleteItem", translator.GetTranslatedString("DeleteItem"));
            vars.Add("AddItem", translator.GetTranslatedString("AddItem"));
            vars.Add("PageManager", translator.GetTranslatedString("PageManager"));
            vars.Add("ParentText", translator.GetTranslatedString("ParentText"));
            vars.Add("Yes", translator.GetTranslatedString("Yes"));
            vars.Add("No", translator.GetTranslatedString("No"));

            return vars;
        }
Ejemplo n.º 12
0
        static void InitializeDefaults ()
        {
            _rootPage = new GridPage ();

            // home
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                MenuID = "home",
                Location = "home.html",
                MenuPosition = 0,
                MenuTitle = "MenuHome",
                MenuToolTip = "TooltipsMenuHome"
            });

            // news
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                MenuID = "news",
                Location = "news_list.html",
                MenuPosition = 1,
                MenuTitle = "MenuNews",
                MenuToolTip = "TooltipsMenuNews"
            });

            // world map
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                MenuID = "world",
                Location = "world.html",
                MenuPosition = 2,
                MenuTitle = "MenuWorld",
                MenuToolTip = "TooltipsMenuWorld",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        MenuID = "world",
                        Location = "world.html",
                        MenuPosition = 0,
                        MenuTitle = "MenuWorldMap",
                        MenuToolTip = "TooltipsMenuWorldMap"
                    },
                    /* removed as region list now provides search capabilitie
                     new GridPage {
                        ShowInMenu = true,
                        MenuID = "region_search",
                        Location = "region_search.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuRegionSearch",
                        MenuToolTip = "TooltipsMenuRegionSearch"
                    }, */
                    new GridPage {
                        ShowInMenu = true,
                        MenuID = "region_list",
                        Location = "region_list.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuRegion",
                        MenuToolTip = "TooltipsMenuRegion"
                    }
                }
            });

            // events
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedInRequired = false,
                MenuID = "events",
                Location = "events/events.html",
                MenuPosition = 3,
                MenuTitle = "MenuEvents",
                MenuToolTip = "TooltipsMenuEvents"
            });

            // classifieds
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedInRequired = false,
                MenuID = "classifieds",
                Location = "classifieds.html",
                MenuPosition = 4,
                MenuTitle = "MenuClassifieds",
                MenuToolTip = "TooltipsMenuClassifieds"
            });

            // users
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedInRequired = true,
                MenuID = "users",
                Location = "user_profile.html",
                MenuPosition = 5,
                MenuTitle = "MenuUser",
                MenuToolTip = "TooltipsMenuUser",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "online_users",
                        Location = "online_users.html",
                        MenuPosition = 0,
                        MenuTitle = "MenuOnlineUsers",
                        MenuToolTip = "TooltipsMenuOnlineUsers"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_search",
                        Location = "user_search.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuUserSearch",
                        MenuToolTip = "TooltipsMenuUserSearch"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_purchases",
                        Location = "user/user_purchases.html",
                        MenuPosition = 2,
                        MenuTitle = "MenuMyPurchases",
                        MenuToolTip = "TooltipsMenuPurchases"

                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_transactions",
                        Location = "user/user_transactions.html",
                        MenuPosition = 3,
                        MenuTitle = "MenuMyTransactions",
                        MenuToolTip = "TooltipsMenuTransactions"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_events",
                        Location = "user/events.html",
                        MenuPosition = 4,
                        MenuTitle = "MenuMyEvents",
                        MenuToolTip = "TooltipsMenuEvents"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_regionmanager",
                        Location = "user/region_manager.html",
                        MenuPosition = 5,
                        MenuTitle = "MenuRegionManager",
                        MenuToolTip = "TooltipsMenuRegionManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "user_estatemanager",
                        Location = "user/estate_manager.html",
                        MenuPosition = 6,
                        MenuTitle = "MenuEstateManager",
                        MenuToolTip = "TooltipsMenuEstateManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        LoggedInRequired = true,
                        MenuID = "change_user_information",
                        Location = "change_user_information.html",
                        MenuPosition = 7,
                        MenuTitle = "MenuChangeUserInformation",
                        MenuToolTip = "TooltipsMenuChangeUserInformation"
                    }
                }
            });

            // help
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                MenuID = "help",
                Location = "help.html",
                MenuPosition = 6,
                MenuTitle = "MenuHelp",
                MenuToolTip = "TooltipsMenuHelp",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        MenuID = "help",
                        Location = "help.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuViewerHelp",
                        MenuToolTip = "TooltipsMenuViewerHelp"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        MenuID = "chat",
                        Location = "chat.html",
                        MenuPosition = 2,
                        MenuTitle = "MenuChat",
                        MenuToolTip = "TooltipsMenuChat"
                    }
                }
            });


            // Management
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                AdminRequired = true,
                MenuID = "manager",
                Location = "admin/manager.html",
                MenuPosition = 7,
                MenuTitle = "MenuManager",
                MenuToolTip = "TooltipsMenuManager",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "new_user",
                        Location = "register.html",
                        MenuPosition = 0,
                        MenuTitle = "MenuRegister",
                        MenuToolTip = "TooltipsMenuRegister"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "user_search",
                        Location = "user_search.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuUserManager",
                        MenuToolTip = "TooltipsMenuUserManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "news_manager",
                        Location = "admin/news_manager.html",
                        MenuPosition = 2,
                        MenuTitle = "MenuNewsManager",
                        MenuToolTip = "TooltipsMenuNewsManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "region_manager",
                        Location = "admin/region_manager.html",
                        MenuPosition = 3,
                        MenuTitle = "MenuRegionManager",
                        MenuToolTip = "TooltipsMenuRegionManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "estate_manager",
                        Location = "admin/estate_manager.html",
                        MenuPosition = 4,
                        MenuTitle = "MenuEstateManager",
                        MenuToolTip = "TooltipsMenuEstateManager"
                    },
                    new GridPage {
                        ShowInMenu = false,
                        AdminRequired = true,
                        MenuID = "sim_console",
                        Location = "admin/sim_console.html",
                        MenuPosition = 5,
                        MenuTitle = "MenuManagerSimConsole",
                        MenuToolTip = "TooltipsMenuManagerSimConsole"

                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "admin_purchases",
                        Location = "admin/purchases.html",
                        MenuPosition = 6,
                        MenuTitle = "MenuPurchases",
                        MenuToolTip = "TooltipsMenuPurchases"

                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "admin_abuse",
                        Location = "admin/abuse_list.html",
                        MenuPosition = 7,
                        MenuTitle = "MenuAbuse",
                        MenuToolTip = "TooltipsMenuAbuse"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "admin_transactions",
                        Location = "admin/transactions.html",
                        MenuPosition = 8,
                        MenuTitle = "MenuTransactions",
                        MenuToolTip = "TooltipsMenuTransactions"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "Statistics",
                        Location = "admin/statistics.html",
                        MenuPosition = 9,
                        MenuTitle = "MenuStatistics",
                        MenuToolTip = "TooltipsMenuStatistics"
                    }
                }
            });

            // admin settings
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                AdminRequired = true,
                MenuID = "manager",
                Location = "admin/settings.html",
                MenuPosition = 8,
                MenuTitle = "MenuSettings",
                MenuToolTip = "TooltipsMenuSettingsManager",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "gridsettings_manager",
                        Location = "admin/gridsettings_manager.html",
                        MenuPosition = 0,
                        MenuTitle = "MenuGridSettings",
                        MenuToolTip = "TooltipsMenuGridSettings"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "settings_manager",
                        Location = "admin/settings_manager.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuSettingsManager",
                        MenuToolTip = "TooltipsMenuSettingsManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "page_manager",
                        Location = "admin/page_manager.html",
                        MenuPosition = 2,
                        MenuTitle = "MenuPageManager",
                        MenuToolTip = "TooltipsMenuPageManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "welcomescreen_manager",
                        Location = "admin/welcomescreen_manager.html",
                        MenuPosition = 3,
                        MenuTitle = "MenuWelcomeScreenManager",
                        MenuToolTip = "TooltipsMenuWelcomeScreenManager"
                    },
                    new GridPage {
                        ShowInMenu = true,
                        AdminRequired = true,
                        MenuID = "factory_reset",
                        Location = "admin/factory_reset.html",
                        MenuPosition = 4,
                        MenuTitle = "MenuFactoryReset",
                        MenuToolTip = "TooltipsMenuFactoryReset"
                    }
                }
            });


            // register
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedOutRequired = true,
                MenuID = "register",
                Location = "register.html",
                MenuPosition = 9,
                MenuTitle = "MenuRegister",
                MenuToolTip = "TooltipsMenuRegister"
            });

            // Login
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedOutRequired = true,
                MenuID = "login",
                Location = "login.html",
                MenuPosition = 10,
                MenuTitle = "MenuLogin",
                MenuToolTip = "TooltipsMenuLogin",
                Children = new List<GridPage> {
                    new GridPage {
                        ShowInMenu = true,
                        MenuID = "forgot_pass",
                        Location = "forgot_pass.html",
                        MenuPosition = 1,
                        MenuTitle = "MenuForgotPass",
                        MenuToolTip = "TooltipsMenuForgotPass"
                    }
                }
            });

            // logout
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = true,
                LoggedInRequired = true,
                MenuID = "logout",
                Location = "logout.html",
                MenuPosition = 10,
                MenuTitle = "MenuLogout",
                MenuToolTip = "TooltipsMenuLogout"
            });


            // these are non menu, indivual pages that can be called
            _rootPage.Children.Add (new GridPage {
                ShowInMenu = false,
                MenuID = "news_info",
                Location = "news.html"
            });

            // admin
            _rootPage.Children.Add (new GridPage {
                MenuID = "add_news",
                ShowInMenu = false,
                AdminRequired = true,
                MenuPosition = 8,
                Location = "admin/add_news.html"
            });
            _rootPage.Children.Add (new GridPage {
                MenuID = "edit_news",
                ShowInMenu = false,
                AdminRequired = true,
                MenuPosition = 8,
                Location = "admin/edit_news.html"
            });
            _rootPage.Children.Add (new GridPage {
                MenuID = "edit_user",
                ShowInMenu = false,
                AdminRequired = true,
                MenuPosition = 8,
                Location = "admin/edit_user.html"
            });

            _rootPage.Children.Add (new GridPage {
                MenuID = "abuse_report",
                ShowInMenu = false,
                AdminRequired = true,
                MenuPosition = 8,
                Location = "admin/abuse_report.html"
            });

            _rootPage.Children.Add (new GridPage {
                MenuID = "region_edit",
                ShowInMenu = false,
                LoggedInRequired = true,
                MenuPosition = 8,
                Location = "admin/region_edit.html"
            });

            _rootPage.Children.Add (new GridPage {
                MenuID = "estate_edit",
                ShowInMenu = false,
                LoggedInRequired = true,
                MenuPosition = 8,
                Location = "admin/estate_edit.html"
            });

            // user
            _rootPage.Children.Add (new GridPage {
                MenuID = "add_event",
                ShowInMenu = false,
                LoggedInRequired = true,
                AdminRequired = false,
                MenuPosition = 8,
                Location = "events/add_event.html"
            });
            _rootPage.Children.Add (new GridPage {
                MenuID = "edit_event",
                ShowInMenu = false,
                LoggedInRequired = true,
                MenuPosition = 8,
                Location = "user/edit_event.html"
            });
            _rootPage.Children.Add (new GridPage {
                MenuID = "user_regionedit",
                ShowInMenu = false,
                LoggedInRequired = true,
                MenuPosition = 8,
                Location = "user/region_edit.html"
            });
            _rootPage.Children.Add (new GridPage {
                MenuID = "user_estateedit",
                ShowInMenu = false,
                LoggedInRequired = true,
                MenuPosition = 8,
                Location = "user/estate_edit.html"
            });

            //Things added, but not used
            /*pages.Add(new Dictionary<string, object> { { "MenuItemID", "tweets" }, 
                { "ShowInMenu", false },
                { "MenuItemLocation", "tweets.html" }, 
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuTweets") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuTweets") } });

            pages.Add(new Dictionary<string, object> { { "MenuItemID", "agent_info" }, 
                { "ShowInMenu", false },
                { "MenuItemLocation", "agent_info.html" }, 
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuAgentInfo") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuAgentInfo") } });

            pages.Add(new Dictionary<string, object> { { "MenuItemID", "region_info" }, 
                { "ShowInMenu", false },
                { "MenuItemLocation", "region_info.html" }, 
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuRegionInfo") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuRegionInfo") } });
            pages.Add(new Dictionary<string, object> { { "MenuItemID", "add_news" }, 
                { "ShowInMenu", false },
                { "MenuItemLocation", "admin/add_news.html" }, 
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuNewsManager") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuNewsManager") } });
            pages.Add(new Dictionary<string, object> { { "MenuItemID", "edit_news" }, 
                { "ShowInMenu", false },
                { "MenuItemLocation", "admin/edit_news.html" }, 
                { "MenuItemTitleHelp", translator.GetTranslatedString("TooltipsMenuNewsManager") },
                { "MenuItemTitle", translator.GetTranslatedString("MenuNewsManager") } });*/
        }