示例#1
0
        private IEnumerable <KeyValuePair <string, string> > GetCreateUserEmailSubstitutions(long tenantId, string email, string alias, Token confirmToken)
        {
            UrlParameters urlParameters = _authenticationUrlService.GetConfirmSetPasswordUrlParameters(tenantId, confirmToken);
            string        confirmUrl    = _webHelperService.GetUrl(urlParameters);
            Dictionary <string, string> substitutions = new Dictionary <string, string>();

            substitutions.Add(AliasKeyword, alias);
            substitutions.Add(EmailKeyword, email);
            substitutions.Add(ConfirmUrl, confirmUrl);
            substitutions.Add(ConfirmExpires, confirmToken.Expiry.ToString("dd MMMM yyyy HH:mm:ss") + " GMT");
            return(substitutions);
        }
        /// <summary>
        /// Gets view model for page search.
        /// </summary>
        /// <param name="tenantId">Identifies website whose pages are searched.</param>
        /// <param name="page">1-based page index (null if not specified).</param>
        /// <param name="search">Search terms.</param>
        /// <returns>View model for page search.</returns>
        public AdminPageViewModel <Grid> GetSearchViewModel(long tenantId, int?page, string search)
        {
            // Get breadcrumbs
            List <NavigationItemViewModel> breadcrumbs = new List <NavigationItemViewModel>();

            breadcrumbs.Add(new NavigationItemViewModel
            {
                Name = PageResource.SearchPagesBreadcrumbLabel,
                Url  = _webHelperService.GetUrl(new UrlParameters {
                    ControllerName = "pages", ActionName = "search"
                })
            });

            // Construct UI navigation
            NavigationViewModel navigation = new NavigationViewModel
            {
                ActionItems     = GetActionItems(DataAction.Search, null),
                BreadcrumbItems = breadcrumbs,
                HamburgerItems  = _administrationPortalService.GetHamburgerItems(AdministrationArea.Page)
            };

            // Construct model to return
            AdminPageViewModel <Grid> viewModel = new AdminPageViewModel <Grid>
            {
                Model      = GetSearchGrid(tenantId, page, search),
                Navigation = navigation
            };

            // Return result
            return(viewModel);
        }
示例#3
0
        /// <summary>
        /// Returns navigation items for actions available for the current page.
        /// </summary>
        /// <param name="action">Action being performed.</param>
        /// <param name="masterPage">Master page model (null if no master page).</param>
        /// <returns>List of navigation items.</returns>
        private List <NavigationItemViewModel> GetActionItems(DataAction action, MasterPage masterPage)
        {
            List <NavigationItemViewModel> navigationItems = new List <NavigationItemViewModel>();

            switch (action)
            {
            case DataAction.Search:
                navigationItems.Add(new NavigationItemViewModel {
                    Name = MasterPageResource.CreateMasterPageActionLabel, Icon = Icon.Create, Url = _webHelperService.GetUrl(new UrlParameters {
                        ControllerName = "masterpages", ActionName = "create"
                    })
                });
                break;

            case DataAction.Read:
            case DataAction.Update:
            case DataAction.Delete:
                object routeValues = new { masterpageid = masterPage.MasterPageId };
                if (action != DataAction.Read)
                {
                    navigationItems.Add(new NavigationItemViewModel {
                        Name = string.Format(MasterPageResource.ReadMasterPageActionLabel, masterPage.Name), Icon = Icon.Read, Url = _webHelperService.GetUrl(new UrlParameters {
                            ControllerName = "masterpages", ActionName = "read", RouteValues = routeValues
                        })
                    });
                }
                if (action != DataAction.Update)
                {
                    navigationItems.Add(new NavigationItemViewModel {
                        Name = string.Format(MasterPageResource.UpdateMasterPageActionLabel, masterPage.Name), Icon = Icon.Update, Url = _webHelperService.GetUrl(new UrlParameters {
                            ControllerName = "masterpages", ActionName = "update", RouteValues = routeValues
                        })
                    });
                }
                if (action != DataAction.Delete)
                {
                    navigationItems.Add(new NavigationItemViewModel {
                        Name = string.Format(MasterPageResource.DeleteMasterPageActionLabel, masterPage.Name), Icon = Icon.Delete, Url = _webHelperService.GetUrl(new UrlParameters {
                            ControllerName = "masterpages", ActionName = "delete", RouteValues = routeValues
                        })
                    });
                }
                break;
            }
            return(navigationItems);
        }
        private IEnumerable <KeyValuePair <string, string> > GetCreatePostSubstitutions(string email, string alias, long postId, int?page, string subject, string postAlias)
        {
            UrlParameters urlParameters = _forumUrlService.GetCreatePostUrlParameters(postId, page);
            string        forumUrl      = _webHelperService.GetUrl(urlParameters);
            Dictionary <string, string> substitutions = new Dictionary <string, string>();

            substitutions.Add(ALIAS_KEYWORD, alias);
            substitutions.Add(EMAIL_KEYWORD, email);
            substitutions.Add(FORUM_URL, forumUrl);
            substitutions.Add(THREAD_SUBJECT, subject);
            substitutions.Add(POST_ALIAS, postAlias);
            return(substitutions);
        }
        public static string GetUrl(this IUrlHelper urlHelper, UrlParameters urlParameters, object routeValues)
        {
            IWebHelperService webHelperService = (IWebHelperService)urlHelper.ActionContext.HttpContext.RequestServices.GetService(typeof(IWebHelperService));

            return(webHelperService.GetUrl(urlParameters, routeValues));
        }
        public List <HamburgerItem> GetHamburgerItems(AdministrationArea area)
        {
            List <HamburgerItem> items = new List <HamburgerItem>();

            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerWebsitesLabel, Icon = "fa-tachometer", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "webs"
                }), Active = area == AdministrationArea.Web
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerDomainsLabel, Icon = "fa-globe", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "domains"
                }), Active = area == AdministrationArea.Domain
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerZonesLabel, Icon = "fa-th", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "zones"
                }), Active = area == AdministrationArea.Zone
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerLayoutsLabel, Icon = "fa-object-group", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "layouts"
                }), Active = area == AdministrationArea.Layout
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerPagesLabel, Icon = "fa-files-o", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "pages"
                }), Active = area == AdministrationArea.Page
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerUsersLabel, Icon = "fa-users", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "users"
                }), Active = area == AdministrationArea.User
            });
            items.Add(new HamburgerItem {
                Name = AdministrationResource.HamburgerAccountLabel, Icon = "fa-user", Url = _webHelperService.GetUrl(new UrlParameters {
                    ActionName = "search", ControllerName = "accounts"
                }), Active = area == AdministrationArea.Account
            });
            return(items);
        }