/// <summary> /// Facebook button. /// </summary> /// <param name="helper">The helper.</param> /// <param name="showCount">if set to <c>true</c> shows count.</param> /// <param name="isLarge">if set to <c>true</c> is large.</param> /// <param name="addText">if set to <c>true</c> [add text].</param> /// <returns>FacebookButton Html</returns> public static System.Web.Mvc.MvcHtmlString FacebookButton(this System.Web.Mvc.HtmlHelper helper, bool showCount, bool isLarge, bool addText) { var currentNode = SiteMapBase.GetCurrentProvider().CurrentNode; var shareUrl = string.Empty; var siteMapNode = SiteMapBase.GetCurrentProvider().CurrentNode; if (currentNode != null && currentNode.Url != null && siteMapNode != null) { shareUrl = RouteHelper.GetAbsoluteUrl(siteMapNode.Url); } string buttonTypeAttribute; if (showCount) { buttonTypeAttribute = "data-type='button_count'"; } else if (isLarge || addText) { buttonTypeAttribute = "data-type='button'"; } else { buttonTypeAttribute = "data-type='icon'"; } var htmlString = string.Format(System.Globalization.CultureInfo.InvariantCulture, @"<div class='fb-share-button' data-href='{0}' {1}></div>", shareUrl, buttonTypeAttribute); var scriptString = @"<div id='fb-root'></div><script>(function(d, s, id) {var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_EN/all.js#xfbml=1'; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>"; return(new System.Web.Mvc.MvcHtmlString(htmlString + scriptString)); }
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); }
/// <summary> /// Executes checks which need to run for every request e.g. notifyLogin if CMS is running the session and extending the session if Gigya is managing it. /// </summary> /// <param name="context"></param> /// <param name="settings"></param> public static void ProcessRequestChecks(HttpContext context, IGigyaModuleSettings settings = null) { var currentNode = SiteMapBase.GetCurrentNode(); if (currentNode != null && currentNode.IsBackend) { return; } // don't need to do anything if the user is editing content in the CMS var identity = ClaimsManager.GetCurrentIdentity(); if (identity.IsBackendUser) { return; } if (context.Items.Contains(_executedProcessRequestKey)) { return; } context.Items[_executedProcessRequestKey] = true; var settingsHelper = new GigyaSettingsHelper(); var logger = LoggerFactory.Instance(); var membershipHelper = new GigyaMembershipHelper(new GigyaApiHelper(settingsHelper, logger), logger); var accountHelper = new GigyaAccountHelper(settingsHelper, logger, membershipHelper, settings); accountHelper.LoginToGigyaIfRequired(); accountHelper.UpdateSessionExpirationCookieIfRequired(context); }
private string GetBaseUrl() { var url = this.BaseUrl; if (string.IsNullOrEmpty(url)) { var siteMap = SiteMapBase.GetCurrentProvider(); if (siteMap == null || (siteMap != null && siteMap.CurrentNode == null)) { return(string.Empty); } url = siteMap.CurrentNode.Url; } if (string.IsNullOrEmpty(url)) { throw new ArgumentNullException("BaseUrl property could not be resolved."); } if (VirtualPathUtility.IsAppRelative(url)) { url = VirtualPathUtility.ToAbsolute(url); } return(url); }
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); }
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); }
/// <summary> /// Initializes a new instance of the <see cref="PageRelativePathContextRegion"/> class. /// </summary> /// <param name="context">The context.</param> public PageRelativePathContextRegion(HttpContextBase context) { if (context == null) { throw new ArgumentNullException("context"); } this.context = context; this.originalPath = context.Request.AppRelativeCurrentExecutionFilePath; var originalWithSlash = VirtualPathUtility.AppendTrailingSlash(this.originalPath); var currentNode = SiteMapBase.GetCurrentNode(); if (currentNode != null) { var nodeUrl = currentNode.Url.StartsWith("~/", StringComparison.Ordinal) ? RouteHelper.ResolveUrl(currentNode.Url, UrlResolveOptions.ApplicationRelative | UrlResolveOptions.AppendTrailingSlash) : currentNode.Url; if (originalWithSlash.StartsWith(nodeUrl, StringComparison.OrdinalIgnoreCase)) { var newPath = originalWithSlash.Right(originalWithSlash.Length - nodeUrl.Length); if (newPath.Equals("Action/Edit/", StringComparison.OrdinalIgnoreCase)) { newPath = string.Empty; } this.context.RewritePath("~/" + newPath); } } else { this.context.RewritePath("~/"); } }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="PageRelativePathContextRegion"/> class. /// </summary> /// <param name="context">The context.</param> public PageRelativePathContextRegion(HttpContextBase context) { if (context == null) { throw new ArgumentNullException("context"); } this.context = context; this.originalPath = context.Request.AppRelativeCurrentExecutionFilePath; var originalWithSlash = VirtualPathUtility.AppendTrailingSlash(this.originalPath); bool?isFrontendPageEdit = context.Items["IsFrontendPageEdit"] as bool?; var currentNode = SiteMapBase.GetCurrentNode(); if (currentNode != null && !(isFrontendPageEdit.HasValue && isFrontendPageEdit.Value)) { var nodeUrl = currentNode.Url.StartsWith("~/", StringComparison.Ordinal) ? RouteHelper.ResolveUrl(currentNode.Url, UrlResolveOptions.ApplicationRelative | UrlResolveOptions.AppendTrailingSlash) : currentNode.Url; if (originalWithSlash.StartsWith(nodeUrl, StringComparison.OrdinalIgnoreCase)) { var newPath = originalWithSlash.Right(originalWithSlash.Length - nodeUrl.Length); this.context.RewritePath("~/" + newPath); } else if (currentNode.IsHomePage() && RouteHelper.ResolveUrl(SystemManager.CurrentContext.CurrentSite.GetUri().AbsolutePath, UrlResolveOptions.ApplicationRelative | UrlResolveOptions.AppendTrailingSlash) == originalWithSlash) { // The request is to the root of the site this.context.RewritePath("~/"); } } else { this.context.RewritePath("~/"); } }
public static string GetPageNodeUrl(Guid pageNodeId) { var nodeUrl = string.Empty; var siteMapProvider = SiteMapBase.GetCurrentProvider(); if (siteMapProvider != null && pageNodeId != Guid.Empty) { var pageProvider = Telerik.Sitefinity.Modules.Pages.PageManager.GetManager().Provider; bool suppressedChecks = pageProvider.SuppressSecurityChecks; pageProvider.SuppressSecurityChecks = true; var node = siteMapProvider.FindSiteMapNodeFromKey(pageNodeId.ToString()); pageProvider.SuppressSecurityChecks = suppressedChecks; if (node == null) { throw new ArgumentException("Invalid details page specified: \"{0}\".".Arrange(pageNodeId)); } var pageSiteNode = node as PageSiteNode; if (pageSiteNode != null) { nodeUrl = pageSiteNode.UrlWithoutExtension; } } return(nodeUrl); }
/// <summary> /// Creates the link button. /// </summary> /// <param name="addText">if set to <c>true</c> adds text.</param> /// <param name="baseUrl">The base URL.</param> /// <param name="linkText">The link text.</param> /// <param name="tooltipText">The tooltip text.</param> /// <param name="cssClass">The CSS class.</param> /// <returns> /// CreateLinkButton Html /// </returns> private static string CreateLinkButton(bool addText, string baseUrl, string linkText, string tooltipText, string cssClass) { var shareUrl = string.Empty; var currentNode = SiteMapBase.GetCurrentProvider().CurrentNode; var title = string.Empty; if (currentNode != null && currentNode.Url != null) { shareUrl = RouteHelper.GetAbsoluteUrl(currentNode.Url); title = currentNode.Title; } var url = string.Format(System.Globalization.CultureInfo.InvariantCulture, baseUrl, Uri.EscapeUriString(shareUrl), Uri.EscapeUriString(title)); var clickScript = string.Format(System.Globalization.CultureInfo.InvariantCulture, @"window.open('{0}', '{1}','toolbar=no,width=550,height=550'); return false", url, linkText); var text = string.Empty; if (addText) { text = linkText; } var htmlString = string.Format(System.Globalization.CultureInfo.InvariantCulture, @"<a onclick=""{0}"" title=""{1}""><span class=""{3}""></span>{2}</a>", clickScript, tooltipText, text, cssClass); return(htmlString); }
public PageTitleModel GetModel(string title = "", string subTitle = "") { var model = new PageTitleModel(); if (!String.IsNullOrEmpty(title)) { this.Title = title; } if (!String.IsNullOrEmpty(subTitle)) { this.SubTitle = subTitle; } if (String.IsNullOrEmpty(this.Title)) { var currentNode = SiteMapBase.GetCurrentNode(); if (currentNode == null) { model.Title = "Page Title"; } else { model.Title = SiteMapBase.GetCurrentNode().Title; } } else { model.Title = this.Title; } model.SubTitle = this.SubTitle; return(model); }
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); } } }
/// <summary> /// LinkedIn button /// </summary> /// <param name="helper">The helper.</param> /// <param name="showCount">if set to <c>true</c> shows count.</param> /// <returns> /// LinkedInButton Html /// </returns> public static System.Web.Mvc.MvcHtmlString LinkedInButton(this System.Web.Mvc.HtmlHelper helper, bool showCount) { var shareUrl = string.Empty; var currentNode = SiteMapBase.GetCurrentProvider().CurrentNode; if (currentNode != null && currentNode.Url != null) { shareUrl = RouteHelper.GetAbsoluteUrl(currentNode.Url); } var countAttribute = string.Empty; if (showCount) { countAttribute = "data-counter='right'"; } var scriptString = string.Format( System.Globalization.CultureInfo.InvariantCulture, @"<script src='//platform.linkedin.com/in.js' type='text/javascript'>lang: en_US</script><script type='IN/Share' data-url='{0}' {1}></script>", shareUrl, countAttribute); return(new System.Web.Mvc.MvcHtmlString(scriptString)); }
/// <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; } }
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; }
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; } }
/// <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(); }
/// <inheritDoc/> public virtual FormViewModel GetViewModel() { if (this.FormId == Guid.Empty) { return(null); } var viewModel = new FormViewModel() { ViewMode = this.ViewMode, CssClass = this.CssClass, UseAjaxSubmit = this.UseAjaxSubmit, FormId = this.FormId.ToString("D"), IsMultiStep = this.IsMultiStep, FormCollection = this.FormCollection }; if (this.FormData != null && this.AllowRenderForm()) { viewModel.FormRules = this.GetFormRulesViewModel(this.FormData); if (viewModel.UseAjaxSubmit) { string baseUrl; if (this.AjaxSubmitUrl.IsNullOrEmpty()) { var currentNode = SiteMapBase.GetCurrentNode(); baseUrl = currentNode != null ? currentNode.Url + "/AjaxSubmit" : string.Empty; } else { baseUrl = this.AjaxSubmitUrl; } viewModel.AjaxSubmitUrl = baseUrl.StartsWith("~/") ? RouteHelper.ResolveUrl(baseUrl, UrlResolveOptions.Rooted) : baseUrl; viewModel.SuccessMessage = this.GetSubmitMessage(SubmitStatus.Success); if (this.NeedsRedirect) { viewModel.RedirectUrl = this.GetRedirectPageUrl(); if (viewModel.RedirectUrl.StartsWith("~/")) { viewModel.RedirectUrl = RouteHelper.ResolveUrl(viewModel.RedirectUrl, UrlResolveOptions.Rooted); } } } } else { viewModel.Error = Res.Get <FormsResources>().TheSpecifiedFormNoLongerExists; } return(viewModel); }
protected void Page_Load(object sender, EventArgs e) { var provider = SiteMapBase.GetCurrentProvider() as SiteMapBase; var siteNode = provider.CurrentNode as PageSiteNode; if (siteNode != null) { var bodyClass = siteNode.GetCustomFieldValue("BodyClass").ToString(); this.bodyTag.Attributes.Add("class", bodyClass); } }
/// <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); } }
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); }
/// <summary> /// Gets the page by URL. /// </summary> /// <param name="value">The value.</param> /// <param name="includeChildren">(Optional) if set to <c>true</c> [include children].</param> /// <param name="includeRelatedData">(Optional) true to include, false to exclude the related data.</param> /// <returns> /// The by URL. /// </returns> public virtual PageModel GetByUrl(string value, bool includeChildren = true, bool includeRelatedData = true) { if (string.IsNullOrWhiteSpace(value)) { return(null); } var siteMapNodeByUrl = SiteMapBase.GetCurrentProvider() .FindSiteMapNode(_virtualPathUtility.ToAbsolute("~/" + value.TrimStart('~', '/'))); return(_pageModelFactory.Create(siteMapNodeByUrl, true, includeChildren, includeRelatedData)); }
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); }
/// <summary> /// Gets the page by id. /// </summary> /// <param name="id">The id.</param> /// <param name="includeChildren">(Optional) if set to <c>true</c> [include children].</param> /// <param name="includeRelatedData">(Optional) true to include, false to exclude the related data.</param> /// <returns> /// The by identifier. /// </returns> public virtual PageModel GetById(Guid id, bool includeChildren = true, bool includeRelatedData = true) { if (id == Guid.Empty) { return(null); } var siteMapNodeById = SiteMapBase.GetCurrentProvider() .FindSiteMapNodeFromKey(id.ToString()); return(_pageModelFactory.Create(siteMapNodeById, true, includeChildren, includeRelatedData)); }
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)); }
/// <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); }
/// <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); }
private static Guid GetPageWidgetId(PageManager pageManager, string controlId) { // pages var pageId = SiteMapBase.GetCurrentNode().PageId; var page = pageManager.GetPageData(pageId); if (page.Template != null) { var templateControl = GetControl(page.Template.Controls, controlId); if (templateControl != null) { return(templateControl.Id); } } if (SystemManager.IsDesignMode || SystemManager.IsPreviewMode) { var pageDraft = page.Drafts.FirstOrDefault(p => p.IsTempDraft); // Draft, if page is created page template is null, only draft is available if (page.Template == null && pageDraft.TemplateId != Guid.Empty) { var template = pageManager.GetTemplate(pageDraft.TemplateId); if (template != null) { var templateControl = GetControl(template.Controls, controlId); if (templateControl != null) { return(templateControl.Id); } } } var control = GetControl(pageDraft.Controls, controlId); if (control != null) { return(control.Id); } } else { var control = GetControl(page.Controls, controlId); if (control != null) { return(control.Id); } } return(Guid.Empty); }