Exemplo n.º 1
0
        private IMenuConfig CreateMenu(XmlNode node)
        {
            IMenuConfig menu = null;

            if (node.Attributes["file"] != null)
            {
                menu = new MenuConfigByFile();
            }
            else if (node.Attributes["database"] != null)
            {
                menu = new MenuConfigByDb();
            }
            else
            {
                throw new PluginHostException("Corrupted menu config");
            }

            if (node.Attributes["type"] != null)
            {
                menu.Type = node.Attributes["type"].Value;
            }

            if (node.Attributes["file"] != null)
            {
                ((MenuConfigByFile)menu).ConfigFile = node.Attributes["file"].Value;
            }

            if (node.Attributes["database"] != null)
            {
                ((MenuConfigByDb)menu).ConfigString = node.Attributes["database"].Value;
            }

            return(menu);
        }
Exemplo n.º 2
0
        public IMenuConfig GetMainMenuConfig()
        {
            IMenuConfig main = GetMenuConfig(TypeMain);

            Debug.Assert(main != null, string.Format("Menu config {0} not found", TypeMain));

            return(main);
        }
 public OrthogonalController(IMenuConfig menuConfig,
         ISessionContext sessionContext,
     IRepository repository,
     IContainer container)
 {
     _menuConfig = menuConfig;
     _sessionContext = sessionContext;
     _repository = repository;
     _container = container;
 }
Exemplo n.º 4
0
        private IMenuConfig GetMenuConfig(string type)
        {
            IMenuConfig found = null;

            foreach (IMenuConfig menuConfig in MenuConfigs)
            {
                if (menuConfig.Type == type)
                {
                    found = menuConfig;
                    break;
                }
            }

            return(found);
        }
Exemplo n.º 5
0
        public PartialViewResult KnowYourTurfMenu()
        {
            var currentUser = _sessionContext.GetCurrentUser();
            var inAdminMode = _sessionContext.RetrieveSessionObject(WebLocalizationKeys.INADMINMODE.ToString());

            if (currentUser.UserRoles.IsNotEmpty() && currentUser.UserRoles.Contains(UserRole.Admin.ToString()) && (bool)inAdminMode)
            {
                IMenuConfig SetupMenuConfig = ObjectFactory.Container.GetInstance <IMenuConfig>("SetupMenu");
                return(PartialView(new MenuViewModel
                {
                    MenuItems = SetupMenuConfig.Build()
                }));
            }
            return(PartialView(new MenuViewModel
            {
                MenuItems = _menuConfig.Build()
            }));
        }
Exemplo n.º 6
0
        private Configuration CreateConfig(XmlNode node)
        {
            var config = new Configuration();

            config.Id = node.Attributes["id"].Value;

            if (node.Attributes["default"] != null)
            {
                config.Default = Convert.ToBoolean(node.Attributes["default"].Value);
            }

            XmlNodeList xmlMenus = node.SelectNodes("pa:menu", _nsmgr);

            foreach (XmlNode menuNode in xmlMenus)
            {
                IMenuConfig menu = CreateMenu(menuNode);
                config.MenuConfigs.Add(menu);
            }

            return(config);
        }
Exemplo n.º 7
0
 public OrthogonalController(IMenuConfig menuConfig, ISessionContext sessionContext)
 {
     _menuConfig = menuConfig;
     _sessionContext = sessionContext;
 }
Exemplo n.º 8
0
 public OrthogonalController(IMenuConfig menuConfig, ISessionContext sessionContext)
 {
     _menuConfig     = menuConfig;
     _sessionContext = sessionContext;
 }