protected void statusesList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var       dataItem           = e.Item.DataItem as EUDossierStatusModel;
                HyperLink statusLink         = e.Item.FindControl("dossierStatusLink") as HyperLink;
                var       pageUrl            = SiteMapBase.GetActualCurrentNode().GetUrl(Thread.CurrentThread.CurrentCulture);
                var       urlParams          = this.GetUrlParameters();
                var       statusUrlComponent = Regex.Replace(dataItem.Attributes.uni_displayname.ToLower(), urlRegex, hyphen);

                statuses.Add(new StatusItem
                {
                    statusName = dataItem.Attributes.uni_displayname,
                    statusURL  = statusUrlComponent,
                });

                if (urlParams == null || urlParams.Count() == 1)
                {
                    statusLink.NavigateUrl = string.Format("{0}/{1}", pageUrl, statusUrlComponent);
                }
                else if (urlParams != null)
                {
                    if (urlParams.Count() > 2)
                    {
                        //removes old status from url and applies the new one
                        urlParams = urlParams.Take(urlParams.Count() - 1).ToArray();
                    }
                    statusLink.NavigateUrl = string.Format("{0}/{1}/{2}", pageUrl,
                                                           string.Join("/", urlParams), statusUrlComponent);
                }
            }
        }
Exemplo n.º 2
0
        internal virtual string GetDefaultCanonicalUrl(IDataItem item)
        {
            IManager manager = null;

            if (!ManagerBase.TryGetMappedManager(item.GetType(), string.Empty, out manager))
            {
                return(null);
            }

            var locationsService = SystemManager.GetContentLocationService();

            if (item is ILifecycleDataItemGeneric lifecycleDataItem &&
                lifecycleDataItem.Status != GenericContent.Model.ContentLifecycleStatus.Master &&
                manager is ILifecycleManager lifecycleManager)
            {
                item = lifecycleManager.Lifecycle.GetMaster(lifecycleDataItem);
            }

            var location = locationsService.GetItemDefaultLocation(item);

            if (location != null)
            {
                return(location.ItemAbsoluteUrl);
            }

            var page         = this.HttpContext.CurrentHandler.GetPageHandler();
            var pageNode     = SiteMapBase.GetActualCurrentNode();
            var canonicalUrl = page.GetCanonicalUrlForPage(pageNode);

            return(canonicalUrl);
        }
Exemplo n.º 3
0
        /// <inheritdoc />
        protected override void Render(HtmlTextWriter writer)
        {
            var isMvcDetailsView = (string)(this.Controller.RouteData.Values["action"]) == "Details";

            this.personalizedViewWrapper.RaiseEvents = !isMvcDetailsView;

            if (this.Page.Items["ScriptSourcesLoaded"] == null)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode != null && currentNode.Framework == PageTemplateFramework.Mvc)
                {
                    var registeredScripts = SystemManager.CurrentHttpContext.Items[ResourceHelper.JsRegisterName] as Dictionary <string, List <string> >;
                    if (registeredScripts != null)
                    {
                        this.personalizedViewWrapper.LoadedScripts = registeredScripts.SelectMany(p => p.Value);
                    }
                }
                else
                {
                    var scriptManager = ScriptManager.GetCurrent(this.Page);
                    if (scriptManager != null && scriptManager.Scripts != null && scriptManager.Scripts.Count > 0)
                    {
                        var scriptRef = scriptManager.Scripts.Select(r => new ResourceHelper.MvcScriptReference(r));
                        this.personalizedViewWrapper.LoadedScripts = scriptRef.Select(r => r.GetResourceUrl());
                    }
                }

                this.Page.Items["ScriptSourcesLoaded"] = true;
            }

            this.personalizedViewWrapper.RenderControl(writer);
        }
        private string GetCategoryUrl(Ucommerce.EntitiesV2.Category category)
        {
            var baseUrl = string.Empty;

            if (this.categoryPageId == Guid.Empty)
            {
                baseUrl = UrlResolver.GetCurrentPageNodeUrl();
            }
            else
            {
                baseUrl = UrlResolver.GetPageNodeUrl(this.categoryPageId);
            }

            var    searchCategory = CatalogLibrary.GetCategory(category.Guid);
            var    catUrl         = GetCategoryPath(searchCategory);
            string relativeUrl    = string.Concat(VirtualPathUtility.RemoveTrailingSlash(baseUrl), "/", catUrl);
            string url;

            if (SystemManager.CurrentHttpContext.Request.Url != null)
            {
                url = UrlPath.ResolveUrl(relativeUrl, true);
            }
            else
            {
                url = UrlResolver.GetAbsoluteUrl(SiteMapBase.GetActualCurrentNode().Url);
            }

            return(url);
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        protected override void Render(HtmlTextWriter writer)
        {
            var isMvcDetailsView = (string)(this.Controller.RouteData.Values["action"]) == "Details";

            this.personalizedViewWrapper.RaiseEvents = !isMvcDetailsView;
            this.personalizedViewWrapper.RenderControl(writer);

            if (this.Page.Items["ScriptSourcesLoaded"] == null)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode != null && currentNode.Framework == PageTemplateFramework.Mvc)
                {
                    var registeredScripts = SystemManager.CurrentHttpContext.Items[ResourceHelper.JsRegisterName] as Dictionary <string, List <string> >;
                    if (registeredScripts != null)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
                        writer.RenderBeginTag(HtmlTextWriterTag.Script);
                        writer.Write(this.CreateScriptsObject(registeredScripts.SelectMany(p => p.Value)));
                        writer.RenderEndTag();
                    }
                }
                else
                {
                    var scriptManager = ScriptManager.GetCurrent(this.Page);
                    if (scriptManager != null && scriptManager.Scripts != null && scriptManager.Scripts.Count > 0)
                    {
                        var scriptRef = scriptManager.Scripts.Select(r => new ResourceHelper.MvcScriptReference(r));
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "sf_loaded_scripts", this.CreateScriptsObject(scriptRef.Select(r => r.GetResourceUrl())), true);
                    }
                }

                this.Page.Items["ScriptSourcesLoaded"] = true;
            }
        }
Exemplo n.º 6
0
        public virtual PageBannerViewModel GetViewModel()
        {
            var currentSiteNode = SiteMapBase.GetActualCurrentNode();

            var viewModel = new PageBannerViewModel()
            {
                Heading                = this.DisableHeading ? string.Empty : this.GetHeading(currentSiteNode),
                HeadingHtmlElement     = this.HeadingHtmlElement.IsNullOrWhitespace() ? "div" : this.HeadingHtmlElement,
                Description            = this.DisableDescription ? string.Empty : this.GetDescription(currentSiteNode),
                DescriptionHtmlElement = this.DescriptionHtmlElement.IsNullOrWhitespace() ? "div" : this.DescriptionHtmlElement,
                CssClass               = String.Format("{0} {1}", this.DefaultCssClass, this.CssClass).Trim(),
                DefaultCssClass        = this.DefaultCssClass,
                IsHomepage             = this.DetermineHomepage(currentSiteNode)
            };

            SfImage image;

            if (this.ImageId != Guid.Empty)
            {
                image              = this.GetImage();
                viewModel.Image    = image;
                viewModel.ImageUrl = ImageHelper.GetImageUrl(image, this.ThumbnailName);
            }

            return(viewModel);
        }
Exemplo n.º 7
0
        public ActionResult IndexPost(SearchCriteria criteria)
        {
            log.InfoFormat("postToResourceLibrary:{0}", criteria == null);
            var queryString = criteria.ToQueryString();
            var requestUrl  = SiteMapBase.GetActualCurrentNode().Url;

            return(Redirect(requestUrl + "?" + queryString));
        }
        /// <summary>
        /// Initializes the ListView bag.
        /// </summary>
        /// <param name="redirectPageUrl">The redirect page URL.</param>
        protected virtual void InitializeListViewBag(string redirectPageUrl)
        {
            var timezoneInfo = UserManager.GetManager().GetUserTimeZone();

            this.ViewBag.WidgetId       = EventSchedulerHelper.GetWidgetId(this);
            this.ViewBag.DetailsPageId  = this.DetailsPageId == Guid.Empty ? (SiteMapBase.GetActualCurrentNode() == null ? Guid.Empty : SiteMapBase.GetActualCurrentNode().Id) : this.DetailsPageId;
            this.ViewBag.UiCulture      = SystemManager.CurrentContext.AppSettings.Multilingual ? CultureInfo.CurrentUICulture.ToString() : string.Empty;
            this.ViewBag.TimeZoneOffset = timezoneInfo.BaseUtcOffset.TotalMilliseconds.ToString();
            this.ViewBag.TimeZoneId     = timezoneInfo.Id;
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            // update "Edit" hyperlink column
            var linkColumn = TestimonialsGrid.MasterTableView.Columns.FindByUniqueName("ID") as GridHyperLinkColumn;

            linkColumn.DataNavigateUrlFormatString = string.Concat(this.ResolveUrl(SiteMapBase.GetActualCurrentNode().Url), "/Edit/{0}");

            // retrieve and bind testimonials
            TestimonialsGrid.DataSource = this.context.Testimonials;
            TestimonialsGrid.DataBind();
        }
        private void Initialize(CommentsInputModel commentsInputModel, bool useReviews)
        {
            const string ReviewsSuffix = "_review";

            if (commentsInputModel == null)
            {
                return;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadType))
            {
                this.ThreadType = commentsInputModel.ThreadType;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadKey))
            {
                this.ThreadKey = commentsInputModel.ThreadKey;
            }
            else if (string.IsNullOrEmpty(this.ThreadKey))
            {
                if (SiteMapBase.GetActualCurrentNode() != null)
                {
                    this.ThreadKey = ControlUtilities.GetLocalizedKey(SiteMapBase.GetActualCurrentNode().Id, null, CommentsBehaviorUtilities.GetLocalizedKeySuffix(this.ThreadType));
                }
                else
                {
                    this.ThreadKey = string.Empty;
                }
            }

            if (useReviews && !this.ThreadKey.EndsWith(ReviewsSuffix))
            {
                this.ThreadKey = this.ThreadKey + ReviewsSuffix;
            }
            else if (!useReviews && this.ThreadKey.EndsWith(ReviewsSuffix))
            {
                this.ThreadKey = this.ThreadKey.Left(this.ThreadKey.Length - ReviewsSuffix.Length);
            }

            if (!string.IsNullOrEmpty(commentsInputModel.ThreadTitle))
            {
                this.ThreadTitle = commentsInputModel.ThreadTitle;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.GroupKey))
            {
                this.GroupKey = commentsInputModel.GroupKey;
            }

            if (!string.IsNullOrEmpty(commentsInputModel.DataSource))
            {
                this.DataSource = commentsInputModel.DataSource;
            }
        }
        private TrackedList <Guid> GetCurrentPageCategoryID()
        {
            var currentNode = SiteMapBase.GetActualCurrentNode();
            var result      = new TrackedList <Guid>();

            if (currentNode != null)
            {
                result.AddRange(currentNode.GetCustomFieldValue("Category") as TrackedList <Guid>);
            }

            return(result);
        }
        private ISearchJobsResponse GetJobSearchResultsResponse(JobSearchResultsFilterModel filterModel)
        {
            if (!this.PageSize.HasValue || this.PageSize.Value <= 0)
            {
                this.PageSize = PageSizeDefaultValue;
            }

            JXTNext_SearchJobsRequest request = JobSearchResultsFilterModel.ProcessInputToSearchRequest(filterModel, this.PageSize, PageSizeDefaultValue);

            string sortingBy = this.Sorting;

            if (filterModel != null && !filterModel.SortBy.IsNullOrEmpty())
            {
                sortingBy = filterModel.SortBy;
            }

            request.SortBy    = JobSearchResultsFilterModel.GetSortEnumFromString(sortingBy);
            ViewBag.SortOrder = JobSearchResultsFilterModel.GetSortStringFromEnum(request.SortBy);

            ISearchJobsResponse        response       = _BLConnector.SearchJobs(request);
            JXTNext_SearchJobsResponse jobResultsList = response as JXTNext_SearchJobsResponse;


            ViewBag.Request     = JsonConvert.SerializeObject(filterModel);
            ViewBag.FilterModel = JsonConvert.SerializeObject(filterModel);
            ViewBag.PageSize    = (int)this.PageSize;
            ViewBag.CssClass    = this.CssClass;
            if (jobResultsList != null)
            {
                ViewBag.TotalCount = jobResultsList.Total;
            }

            ViewBag.JobResultsPageUrl = SfPageHelper.GetPageUrlById(ResultsPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(ResultsPageId));
            ViewBag.CurrentPageUrl    = SfPageHelper.GetPageUrlById(SiteMapBase.GetActualCurrentNode().Id);
            ViewBag.JobDetailsPageUrl = SfPageHelper.GetPageUrlById(DetailsPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(DetailsPageId));
            ViewBag.EmailJobPageUrl   = SfPageHelper.GetPageUrlById(EmailJobPageId.IsNullOrWhitespace() ? Guid.Empty : new Guid(EmailJobPageId));
            ViewBag.HidePushStateUrl  = this.HidePushStateUrl;
            ViewBag.PageFullUrl       = SfPageHelper.GetPageUrlById(SiteMapBase.GetActualCurrentNode().Id);
            ViewBag.IsMember          = SitefinityHelper.IsUserLoggedIn("Member");

            var currentIdentity = ClaimsManager.GetCurrentIdentity();

            if (currentIdentity.IsAuthenticated)
            {
                var currUser = SitefinityHelper.GetUserById(currentIdentity.UserId);
                if (currUser != null)
                {
                    ViewBag.Email = currUser.Email;
                }
            }

            return(response);
        }
Exemplo n.º 13
0
 /// <inheritDoc/>
 public virtual string GetPageUrl(Guid?pageId)
 {
     if (pageId.HasValue)
     {
         return(HyperLinkHelpers.GetFullPageUrl(pageId.Value));
     }
     else
     {
         var currentNode = SiteMapBase.GetActualCurrentNode();
         return(currentNode != null?HyperLinkHelpers.GetFullPageUrl(currentNode.Id) : null);
     }
 }
        /// <summary>
        /// Constructs the status URL.
        /// </summary>
        /// <param name="statusName">Name of the status.</param>
        /// <param name="navigateUrl">The navigate URL.</param>
        public static void ConstructStatusUrl(string statusName, out string navigateUrl)
        {
            var pageUrl = SiteMapBase.GetActualCurrentNode().GetUrl(Thread.CurrentThread.CurrentCulture);

            if (pageUrl.Contains("detail"))
            {
                pageUrl = pageUrl.Substring(0, pageUrl.IndexOf("/detail"));
            }
            var fullPageUrl        = VirtualPathUtility.ToAbsolute(pageUrl);
            var statusUrlComponent = Regex.Replace(statusName.ToLower(), urlRegex, hyphen);

            navigateUrl = string.Format("{0}/{1}", fullPageUrl, statusUrlComponent);
        }
Exemplo n.º 15
0
        public ActionResult IndexPost(ContentListSearchCriteria criteria)
        {
            if (!(String.IsNullOrEmpty(criteria.StartDateMonth) && String.IsNullOrEmpty(criteria.StartDateDay) && String.IsNullOrEmpty(criteria.StartDateYear)))
            {
                criteria.StartDate = String.Format("{0}/{1}/{2}", criteria.StartDateMonth, criteria.StartDateDay, criteria.StartDateYear);
            }

            criteria.StartDateMonth = criteria.StartDateDay = criteria.StartDateYear = null;
            var queryString = criteria.ToQueryString();
            var requestUrl  = SiteMapBase.GetActualCurrentNode().Url;

            return(Redirect(requestUrl + "?" + queryString));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Gets the view models for each culture of the given site.
        /// </summary>
        /// <param name="site">The site.</param>
        /// <returns></returns>
        protected virtual IList <SiteViewModel> GetMultilingualSiteViewModels(ISite site)
        {
            var  result          = new List <SiteViewModel>();
            bool addToDataSource = true;

            foreach (var culture in site.PublicContentCultures)
            {
                string siteUrl       = string.Empty;
                bool   isCurrentSite = false;

                // Handle current site URLs from page node
                if (site.Id == this.currentSiteId)
                {
                    var actualSitemapNode = SiteMapBase.GetActualCurrentNode();
                    if (actualSitemapNode != null)
                    {
                        var actualPageNode = PageManager.GetManager().GetPageNode(actualSitemapNode.Id);
                        addToDataSource =
                            actualPageNode.AvailableCultures.Contains(culture);

                        if (addToDataSource)
                        {
                            if (CultureInfo.CurrentUICulture.Name == culture.Name)
                            {
                                isCurrentSite = true;
                            }

                            siteUrl = this.ResolveDefaultSiteUrl(actualPageNode, culture);
                        }
                    }
                }
                else
                {
                    // Remove the reflection when SiteRegion become public.
                    var sitefinityAssembly    = typeof(ISite).Assembly;
                    var siteRegionType        = sitefinityAssembly.GetType("Telerik.Sitefinity.Multisite.SiteRegion");
                    var siteRegionConstructor = siteRegionType.GetConstructor(new Type[] { typeof(ISite) });
                    using ((IDisposable)siteRegionConstructor.Invoke(new object[] { site }))
                    {
                        siteUrl = this.UrlService.ResolveUrl(this.GetSiteUrl(site), culture);
                    }
                }

                if (addToDataSource)
                {
                    result.Add(this.GetSiteViewModel(site, culture, isCurrentSite, siteUrl));
                }
            }

            return(result);
        }
Exemplo n.º 17
0
        /// <inheritDoc/>
        public virtual ForgotPasswordViewModel SendResetPasswordEmail(string email)
        {
            var viewModel = new ForgotPasswordViewModel();

            viewModel.Email     = email;
            viewModel.EmailSent = false;


            var manager = UserManager.GetManager(this.MembershipProvider);
            var user    = manager.GetUserByEmail(email);

            if (user != null)
            {
                if (!UserManager.ShouldSendPasswordEmail(user, manager.Provider.GetType()))
                {
                    viewModel.Error = "Not supported";
                }
                else
                {
                    var currentNode = SiteMapBase.GetActualCurrentNode();
                    if (currentNode != null)
                    {
                        var resetPassUrl = Url.Combine(currentNode.Url, "resetpassword");

                        try
                        {
                            UserManager.SendRecoveryPasswordMail(UserManager.GetManager(user.ProviderName), email, resetPassUrl);

                            viewModel.EmailSent = true;
                        }
                        catch (Exception ex)
                        {
                            if (Exceptions.HandleException(ex, ExceptionPolicyName.IgnoreExceptions))
                            {
                                throw ex;
                            }

                            viewModel.Error = ex.Message;
                        }
                    }
                }
            }
            else
            {
                viewModel.EmailNotFound = true;
            }

            return(viewModel);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Gets the current site map node id.
        /// </summary>
        /// <returns>
        /// The current site map node identifier.
        /// </returns>
        public virtual Guid GetCurrentSiteMapNodeId()
        {
            //DECLARE VARIABLES
            var  currentPage = SiteMapBase.GetActualCurrentNode();
            Guid pageId      = Guid.Empty;

            //GET ID FROM CURRENT PAGE IF APPLICABLE
            if (currentPage != null)
            {
                Guid.TryParse(currentPage.Key, out pageId);
            }

            //RETURN PAGE ID
            return(pageId);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            RouteHelper.SetUrlParametersResolved();

            if (!IsPostBack)
            {
                BindNavigationWidget();

                var currentUrl = SiteMapBase.GetActualCurrentNode().GetUrl(Thread.CurrentThread.CurrentCulture);
                if (currentUrl.Contains("detail"))
                {
                    PreselectActivePolicyAreaAndCategory();
                }
            }
        }
Exemplo n.º 20
0
        /// <inheritDoc/>
        public string GetPageUrl(Guid?pageId)
        {
            if (!pageId.HasValue)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode == null)
                {
                    return(null);
                }

                pageId = currentNode.Id;
            }

            return(HyperLinkHelpers.GetFullPageUrl(pageId.Value));
        }
Exemplo n.º 21
0
        /// <summary>
        /// Gets the view models for each culture of the given site.
        /// </summary>
        /// <param name="site">The site.</param>
        /// <returns></returns>
        protected virtual IList <SiteViewModel> GetMultilingualSiteViewModels(ISite site)
        {
            var  result          = new List <SiteViewModel>();
            bool addToDataSource = true;

            foreach (var culture in site.PublicContentCultures)
            {
                string siteUrl       = string.Empty;
                bool   isCurrentSite = false;

                // Handle current site URLs from page node
                if (site.Id == this.currentSiteId)
                {
                    var actualSitemapNode = SiteMapBase.GetActualCurrentNode();
                    if (actualSitemapNode != null)
                    {
                        var actualPageNode = PageManager.GetManager().GetPageNode(actualSitemapNode.Id);
                        addToDataSource =
                            actualPageNode.AvailableCultures.Contains(culture);

                        if (addToDataSource)
                        {
                            if (CultureInfo.CurrentUICulture.Name == culture.Name)
                            {
                                isCurrentSite = true;
                            }

                            siteUrl = this.ResolveDefaultSiteUrl(actualPageNode, culture);
                        }
                    }
                }
                else
                {
                    using (SiteRegion.FromSiteId(site.Id))
                    {
                        siteUrl = this.ResolveSiteHomePage(site, culture);
                    }
                }

                if (addToDataSource)
                {
                    result.Add(this.GetSiteViewModel(site, culture, isCurrentSite, siteUrl));
                }
            }

            return(result);
        }
Exemplo n.º 22
0
        /// <summary>
        /// Gets the template.
        /// </summary>
        /// <param name="isVirtualPath">The is virtual path.</param>
        /// <param name="isHtmlTemplate">The is HTML template.</param>
        /// <param name="layout">The layout.</param>
        /// <returns></returns>
        protected virtual ITemplate GetTemplate(bool isVirtualPath, bool isHtmlTemplate, string layout)
        {
            if (isVirtualPath && isHtmlTemplate)
            {
                if (!HostingEnvironment.VirtualPathProvider.FileExists(layout))
                {
                    throw new ArgumentException(Res.Get <InfrastructureResources>("CannotFindTemplateMvcForm", layout));
                }

                using (var reader = new StreamReader(HostingEnvironment.VirtualPathProvider.GetFile(layout).Open()))
                {
                    layout = reader.ReadToEnd();
                }
            }
            else if (isVirtualPath)
            {
                return(ControlUtilities.GetTemplate(layout, null, null, null));
            }
            else if (layout != null && layout.EndsWith(".ascx", StringComparison.Ordinal))
            {
                Type assemblyInfo;

                if (string.IsNullOrEmpty(this.AssemblyInfo))
                {
                    assemblyInfo = Config.Get <ControlsConfig>().ResourcesAssemblyInfo;
                }
                else
                {
                    assemblyInfo = TypeResolutionService.ResolveType(this.AssemblyInfo, true);
                }

                return(ControlUtilities.GetTemplate(null, layout, assemblyInfo, null));
            }

            // Add sf_cols wrapper for back end pages and email campaigns.
            var currentNode         = SiteMapBase.GetActualCurrentNode();
            var rootNode            = currentNode != null ? currentNode.RootNode as PageSiteNode : null;
            var ensureSfColsWrapper = (this.IsBackend() && !SystemManager.IsPreviewMode) ||
                                      rootNode == null ||
                                      rootNode.Id == NewslettersModule.standardCampaignRootNodeId ||
                                      System.Web.HttpContext.Current.Items[SiteMapBase.CurrentNodeKey] == null;

            layout = this.ProcessLayoutString(layout, ensureSfColsWrapper);

            return(ControlUtilities.GetTemplate(null, layout.GetHashCode().ToString(System.Globalization.CultureInfo.InvariantCulture), null, layout));
        }
Exemplo n.º 23
0
        /// <summary>
        /// Gets the package from the page template or from the Current PageSiteNode.
        /// </summary>
        /// <returns></returns>
        private string GetPackageFromPageInfo()
        {
            string packageName = null;
            var    context     = SystemManager.CurrentHttpContext;

            if (context.Items.Contains("IsTemplate") && (bool)context.Items["IsTemplate"])
            {
                var templateId = PackageManager.GetEditedContainerKey(context);
                packageName = this.GetPackageFromTemplateId(templateId);
            }
            else if (context.Request.Path.Contains("/Sitefinity/SFNwslttrs"))
            {
                var pageNodeId = PackageManager.GetEditedContainerKey(context);
                packageName = this.GetPackageFromNodeId(pageNodeId);
            }
            else if (context.Request.Path.Contains("/Sitefinity/Versioning"))
            {
                var pageNodeId = new Guid(context.Request.RequestContext.RouteData.Values["itemId"].ToString());
                var page       = PageManager.GetManager().GetPageData(pageNodeId);

                if (page.NavigationNodeId != Guid.Empty)
                {
                    packageName = this.GetPackageFromNodeId(page.NavigationNodeId.ToString());
                }

                if (packageName == null)
                {
                    packageName = this.GetPackageFromTemplate(page.Template);
                }
            }
            else
            {
                var requestContext = context.Request.RequestContext;
                var currentNode    = requestContext.RouteData.DataTokens["SiteMapNode"] as PageSiteNode;

                if (currentNode == null)
                {
                    currentNode = SiteMapBase.GetActualCurrentNode();
                }

                packageName = currentNode != null?this.GetPackageFromNodeId(currentNode.Id.ToString()) : null;
            }

            return(packageName);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Gets the package from the page template or from the Current PageSiteNode.
        /// </summary>
        /// <returns></returns>
        public string GetPackageFromPageInfo()
        {
            string packageName;
            var    context = SystemManager.CurrentHttpContext;

            if (context.Items.Contains("IsTemplate") &&
                (bool)context.Items["IsTemplate"])
            {
                var keys       = context.Request.RequestContext.RouteData.Values["Params"] as string[];
                var templateId = keys != null && keys.Length > 0 ? keys[0] : null;
                packageName = this.GetPackageFromTemplateId(templateId);
            }
            else
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                packageName = currentNode != null?this.GetPackageFromNodeId(currentNode.Id.ToString()) : null;
            }
            return(packageName);
        }
Exemplo n.º 25
0
        /// <inheritDoc/>
        public virtual string GetRedirectPageUrl()
        {
            if (!this.UseCustomConfirmation && !string.IsNullOrEmpty(this.FormData.RedirectPageUrl))
            {
                return(this.FormData.RedirectPageUrl);
            }
            else if (this.CustomConfirmationPageId == Guid.Empty)
            {
                var currentNode = SiteMapBase.GetActualCurrentNode();
                if (currentNode == null)
                {
                    return(null);
                }

                this.CustomConfirmationPageId = currentNode.Id;
            }

            return(HyperLinkHelpers.GetFullPageUrl(this.CustomConfirmationPageId));
        }
        private string GetPagingUrlTemplate(Ucommerce.Search.Models.Category category)
        {
            string url;

            if (SystemManager.CurrentHttpContext.Request.Url != null)
            {
                var queryParams = HttpUtility.ParseQueryString(SystemManager.CurrentHttpContext.Request.Url.Query);
                queryParams[PAGER_QUERY_STRING_KEY] = "{0}";

                var queryParamsRaw = HttpUtility.UrlDecode(queryParams.ToQueryString(true));
                url = string.Concat(SystemManager.CurrentHttpContext.Request.Url.LocalPath, queryParamsRaw);
            }
            else
            {
                url = UrlResolver.GetAbsoluteUrl(SiteMapBase.GetActualCurrentNode().Url + "?{0}");
            }

            return(url);
        }
Exemplo n.º 27
0
        /// <summary>
        /// Hits on page visit
        /// </summary>
        /// <param name="e"></param>
        public void OnPagePreRenderCompleteEventHandler(IPagePreRenderCompleteEvent e)
        {
            if (!IsActive)
            {
                return;
            }

            //Ensure the model is as new.
            openGraphModel = new OpenGraphModel();

            if (SiteMapBase.GetActualCurrentNode() != null)
            {
                Guid currentPageId = SiteMapBase.GetActualCurrentNode().Id;

                PageNode page = _pageManager.GetPageNode(currentPageId);

                //Validate current page
                if (page == null)
                {
                    return;
                }
                if (page.IsBackend)
                {
                    return;
                }

                openGraphModel.SetActivePage(page);
            }
            else
            {
                //Invalid
                return;
            }

            if (!IsValid)
            {
                _logiszLogger.LogException("Failed to enable opengraph due an error:" + GetErrorMessage());
                return;
            }

            Index();
        }
        private string GetCurrentCulture()
        {
            var actualSiteMapNode   = SiteMapBase.GetActualCurrentNode();
            var localization        = new Dictionary <string, string>();
            var siteMapProvider     = SiteMapBase.GetCurrentProvider();
            var currentPageSiteNode = siteMapProvider.CurrentNode as PageSiteNode;

            if (actualSiteMapNode != null)
            {
                if (currentPageSiteNode != null)
                {
                    foreach (var availableLanguage in currentPageSiteNode.AvailableLanguages)
                    {
                        localization.Add(availableLanguage.Name, currentPageSiteNode.GetUrl(availableLanguage));
                    }
                }
            }

            return(JsonConvert.SerializeObject(localization, Formatting.Indented));
        }
        protected virtual IEnumerable <CultureInfo> GetLanguagesToDisplay()
        {
            ////This is the current node - may be a group page node
            ////var sitemapNode = SiteMapBase.GetCurrentNode();
            ////This is the real node - may be the same as sitemapNode, but is never a group page node
            var actualSitemapNode = SiteMapBase.GetActualCurrentNode();

            PageManager pm = PageManager.GetManager();

            var homePageId = SystemManager.CurrentContext.CurrentSite.HomePageId;
            IEnumerable <CultureInfo> availableLanguages = null;

            Guid nodeId;

            if (actualSitemapNode != null)
            {
                nodeId = actualSitemapNode.Id;
            }
            else
            {
                nodeId = homePageId;
            }

            ////This is used for generating links to language versions - we want it to be the current node, not the "real node".
            this.node = pm.GetPageNode(nodeId);

            if (actualSitemapNode != null)
            {
                availableLanguages = actualSitemapNode.AvailableLanguages;
            }
            else
            {
                availableLanguages = this.node.AvailableCultures;
            }

            this.usedLanguages = this.GetLanguagesForPage(actualSitemapNode, availableLanguages);

            IEnumerable <CultureInfo> shownLanguages = this.GetLanguagesList(pm, homePageId, actualSitemapNode);

            return(shownLanguages);
        }
Exemplo n.º 30
0
        protected string DetailsPageUrl()
        {
            // check for custom details page
            var currentPageUrl = SiteMapBase.GetActualCurrentNode().Url;

            if (this.DetailsPageID == Guid.Empty)
            {
                return(currentPageUrl);
            }

            // make sure page exists
            var page = App.WorkWith().Pages().Where(p => p.Id == this.DetailsPageID).Get().FirstOrDefault();

            if (page == null)
            {
                return(currentPageUrl);
            }

            // return page url
            return(page.GetFullUrl());
        }