public async Task <ActionResult> Index(CancellationToken cancellationToken) { var pages = _pageRetriever.Retrieve <TreeNode>(query => query .Path("/", PathTypeEnum.Children)); var aboutUsPage = pages.FirstOrDefault(e => DocumentURLProvider.GetAbsoluteUrl(e).ToLower().Contains("/myblog/about")); _pageDataContextInitializer.Initialize(aboutUsPage); //var aboutUs = _dataRetriever.Retrieve<AboutUs>().Page; //var sideStories = await aboutUsRepository.GetSideStoriesAsync(aboutUs.NodeAliasPath, cancellationToken); //var reference = (await referenceRepository.GetReferencesAsync($"{aboutUs.NodeAliasPath}/References", cancellationToken, 1)).FirstOrDefault(); var sideStories = new List <AboutUsSection> (); var documentQueryHome = AboutUsProvider.GetAboutUs(NodeGuid, "en-US", "BlogPost"); var data = documentQueryHome.FirstOrDefault(); AboutUsViewModel mode = new AboutUsViewModel() { ID = data.AboutUsID, Title = data.AboutUsText, Desc = data.AboutUsDesc }; return(View(mode)); }
public async Task <IViewComponentResult> InvokeAsync(string NavigationParentPath, string CurrentPage = null) { // Use ViewBag to set current Path if (!string.IsNullOrWhiteSpace(CurrentPage)) { if (CurrentPage == "/Home") { // Special case for Home since the Link is just "/" CurrentPage = "/"; } } else { if (DataRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { CurrentPage = UrlHelper.Content(DocumentURLProvider.GetUrl(Context.Page)); } } NavigationParentPath = !string.IsNullOrWhiteSpace(NavigationParentPath) ? NavigationParentPath : "/MasterPage/Navigation"; var NavItems = await NavigationRepository.GetNavItemsAsync(NavigationParentPath); var model = new NavigationViewModel() { NavItems = NavItems.ToList(), CurrentPagePath = CurrentPage }; return(View(model)); }
/// <summary> /// Setups live site link. /// </summary> private void SetupLiveSiteLink() { // Initialize variables from query string int nodeId = QueryHelper.GetInteger("nodeid", 0); string culture = QueryHelper.GetText("culture", null); string liveSiteUrl = "~"; // Set URL to node from which administration was opened if ((nodeId > 0) && !String.IsNullOrEmpty(culture)) { var treeProvider = new TreeProvider(MembershipContext.AuthenticatedUser); var node = treeProvider.SelectSingleNode(nodeId, culture, false, false); if (node != null) { liveSiteUrl = DocumentURLProvider.GetPresentationUrl(node, RequestContext.FullDomain); } } // Resolve URL and add live site view mode liveSiteUrl = ResolveUrl(liveSiteUrl); liveSiteUrl = URLHelper.AddParameterToUrl(liveSiteUrl, "viewmode", ((int)ViewModeEnum.LiveSite).ToString()); liveSiteUrl = EnsureViewModeParam(liveSiteUrl, "viewmode"); lnkLiveSite.NavigateUrl = liveSiteUrl; lnkLiveSite.Text = GetString("general.livesite"); lnkLiveSite.ToolTip = GetString("applicationlist.livesite"); plcLiveSite.Visible = true; }
/// <summary> /// Handles the UniGrid's OnExternalDataBound event. /// </summary> private object boardSubscriptions_OnExternalDataBound(object sender, string sourceName, object parameter) { switch (sourceName.ToLowerCSafe()) { case "displayname": DataRowView dr = (DataRowView)parameter; string url = ResolveUrl(DocumentURLProvider.GetUrl(ValidationHelper.GetString(dr["NodeAliasPath"], ""), null, mSiteName)); string lang = ValidationHelper.GetString(dr["DocumentCulture"], ""); if (!String.IsNullOrEmpty(lang)) { url += "?" + URLHelper.LanguageParameterName + "=" + lang; } return("<a target=\"_blank\" href=\"" + url + "\">" + HTMLHelper.HTMLEncode(ValidationHelper.GetString(dr["BoardDisplayName"], "")) + "</a>"); case "approved": return(UniGridFunctions.ColoredSpanYesNo(parameter, true)); case "approve": CMSGridActionButton button = ((CMSGridActionButton)sender); if (button != null) { bool isApproved = ValidationHelper.GetBoolean(((DataRowView)((GridViewRow)parameter).DataItem).Row["SubscriptionApproved"], true); if (isApproved) { button.Visible = false; } } break; } return(parameter); }
/// <summary> /// Init event handler. /// </summary> protected override void OnInit(EventArgs e) { ucUIToolbar.ModuleName = MODULE_NAME; ucUIToolbar.ElementName = ELEMENT_NAME; // Set the viewmode according the the URL param if (ViewMode.IsLiveSite() && QueryHelper.Contains("viewmode")) { ViewModeEnum queryStringViewMode = ViewModeCode.GetPageEnumFromString(QueryHelper.GetString("viewmode", "livesite")); if (queryStringViewMode.IsEditLive()) { SetViewMode(queryStringViewMode); } } if (ViewMode.IsEditLive()) { // Check if there is required a redirect to the specific document if (QueryHelper.Contains("onsitenodeid")) { int nodeId = QueryHelper.GetInteger("onsitenodeid", 0); TreeProvider treeProvider = new TreeProvider(); TreeNode node = treeProvider.SelectSingleNode(nodeId); string url = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(node.NodeAliasPath, string.Empty /* ensure getting the link (not the linked document) */, node.NodeSiteName, RequestContext.CurrentURLLangPrefix)); URLHelper.Redirect(url); } } base.OnInit(e); }
public async Task <IViewComponentResult> InvokeAsync(string NodeAliasPath, int Level, bool LevelIsRelative = true, int MinimumAbsoluteLevel = 2, string CurrentPage = null) { // Use ViewBag to set current Path if (!string.IsNullOrWhiteSpace(CurrentPage)) { if (CurrentPage == "/Home") { // Special case for Home since the Link is just "/" CurrentPage = "/"; } } else { if (PageDataContextRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { CurrentPage = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(Context.Page)); } } var AncestorPath = await NavigationRepository.GetAncestorPathAsync(NodeAliasPath, Level, LevelIsRelative, MinimumAbsoluteLevel); var NavItems = await NavigationRepository.GetSecondaryNavItemsAsync(AncestorPath, Enums.PathSelectionEnum.ParentAndChildren); var model = new NavigationViewModel() { NavItems = NavItems.ToList(), CurrentPagePath = CurrentPage }; return(View(model)); }
/// <summary> /// Sets the view mode. /// </summary> /// <param name="viewMode">The view mode</param> private void SetViewMode(ViewModeEnum viewMode) { if (PortalHelper.IsOnSiteEditingEnabled(SiteContext.CurrentSiteName) && AuthenticationHelper.IsAuthenticated()) { // Remove the "viewmode" param from url and redirect string returnUrl = URLHelper.RemoveParameterFromUrl(RequestContext.CurrentURL, "viewmode"); PortalContext.ViewMode = viewMode; // Switch view mode if (viewMode.IsEditLive()) { // Handle default alias path if (URLRewritingContext.CurrentPageInfoSource == PageInfoSource.DefaultAliasPath) { string aliasPath = PageInfoProvider.GetDefaultAliasPath(RequestContext.CurrentDomain, SiteContext.CurrentSiteName); if (!String.IsNullOrEmpty(aliasPath)) { string query = URLHelper.GetQuery(returnUrl); returnUrl = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(aliasPath)); returnUrl = URLHelper.AppendQuery(returnUrl, query); } } } else if (is404) { // Redirect to the root document when page not found returnUrl = ResolveUrl("~/"); } // Redirect to the URL URLHelper.Redirect(returnUrl); } }
public override void ButtonBackClickAction() { // Clean current order payment result when editing existing order and payment was skipped //if (this.ShoppingCartControl.CheckoutProcessType == CheckoutProcessEnum.CMSDeskOrderItems) //{ // CleanUpOrderPaymentResult(); //} // Payment was skipped ShoppingCartControl.RaisePaymentSkippedEvent(); // Remove current shopping cart data from session and from database ShoppingCartControl.CleanUpShoppingCart(); // Live site - skip payment if (!ShoppingCartControl.IsInternalOrder) { string url = ""; if (ShoppingCartControl.RedirectAfterPurchase != "") { url = DocumentURLProvider.GetUrl(ShoppingCartControl.RedirectAfterPurchase); } else { url = DocumentURLProvider.GetUrl("/"); } URLHelper.Redirect(url); } }
/// <summary> /// Redirect to group page. /// </summary> /// <param name="group">Group info</param> private static void RedirectToGroupPage(GroupInfo group) { if ((group != null) && PortalContext.ViewMode.IsLiveSite()) { URLHelper.Redirect(DocumentURLProvider.GetUrl(GroupInfoProvider.GetGroupProfilePath(group.GroupName, SiteContext.CurrentSiteName))); } }
public override void ButtonNextClickAction() { // Standard action - Process payment base.ButtonNextClickAction(); if (ShoppingCartControl.PaymentGatewayProvider.IsPaymentCompleted) { // Remove current shopping cart data from session and from database ShoppingCartControl.CleanUpShoppingCart(); // Live site if (!ShoppingCartControl.IsInternalOrder) { string url = ""; if (ShoppingCartControl.RedirectAfterPurchase != "") { url = DocumentURLProvider.GetUrl(ShoppingCartControl.RedirectAfterPurchase); } else { url = DocumentURLProvider.GetUrl("/"); } URLHelper.Redirect(url); } } }
public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { if (!string.IsNullOrWhiteSpace(CurrentPagePath)) { if (CurrentPagePath == "/Home") { // Special case for Home since the Link is just "/" CurrentPagePath = "/"; } } else { if (DataRetriever.TryRetrieve(out IPageDataContext <TreeNode> Context)) { CurrentPagePath = UrlHelper.Content(DocumentURLProvider.GetUrl(Context.Page)); } } output.TagName = "script"; output.TagMode = TagMode.StartTagAndEndTag; output.Attributes.Add("type", "text/javascript"); string Javascript = "" + $"var elem = document.querySelector(\".{ParentClass} li[data-navhref='{CurrentPagePath?.ToLower()}']\");" + $"elem = elem || document.querySelector(\".{ParentClass} li[data-navpath='{CurrentPagePath?.ToLower()}']\");" + "if (elem)" + "{" + " elem.classList.add('active');" + "}"; output.Content.SetHtmlContent(Javascript); }
private void DocumentManager_OnAfterAction(object sender, DocumentManagerEventArgs e) { txtAlias.Text = Node.NodeAlias; // Check if alias was changed if (Node.NodeAliasPath != mOldAliasPath) { // Update all related MVTests ModuleCommands.OnlineMarketingMoveMVTests(Node.NodeAliasPath, mOldAliasPath, SiteContext.CurrentSiteID); } // Load the URL path LoadURLPath(Node); UniGridAlias.ReloadData(); if ((!pnlUIAlias.IsHidden || !pnlUIPath.IsHidden) && aliasChanged && (PortalContext.ViewMode == ViewModeEnum.EditLive)) { // Get the updated document url string url = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(Node)); // Register redirect script string reloadScript = "if (parent.parent.frames['header'] != null) { parent.parent.frames['header'].reloadPageUrl =" + ScriptHelper.GetString(url) + "; }"; ScriptHelper.RegisterStartupScript(this, typeof(string), "reloadScript", reloadScript, true); } }
public AutoMapperMaps() { CreateMap <TreeNode, Breadcrumb>() .ForMember(dest => dest.LinkText, opt => opt.MapFrom(src => src.DocumentName)) .ForMember(dest => dest.LinkUrl, opt => opt.MapFrom(src => DocumentURLProvider.GetUrl(src))); // Used for when we get a NavItem from cache so the List of it is not the same CreateMap <NavigationItem, NavigationItem>() .ForMember(dest => dest.Children, opt => opt.Ignore()); // Page to Navigation Item CreateMap <TreeNode, NavigationItem>() .BeforeMap((s, d) => d.LinkTarget = "_self") .ForMember(dest => dest.Children, opt => opt.Ignore()) .ForMember(dest => dest.LinkText, opt => opt.MapFrom(src => src.DocumentName)) .ForMember(dest => dest.LinkHref, opt => opt.MapFrom(src => DocumentURLProvider.GetUrl(src))) .ForMember(dest => dest.LinkPagePath, opt => opt.MapFrom(src => src.NodeAliasPath)) .ForMember(dest => dest.LinkPageGuid, opt => opt.MapFrom(src => src.NodeGUID)) .ForMember(dest => dest.LinkPageID, opt => opt.MapFrom(src => src.NodeID)) .ForMember(dest => dest.LinkDocumentID, opt => opt.MapFrom(src => src.DocumentID)) .ForMember(dest => dest.LinkDocumentGuid, opt => opt.MapFrom(src => src.DocumentGUID)); CreateMap <BasicUser, UserInfo>() .ForMember(dest => dest.Email, opt => opt.MapFrom(src => src.UserEmail)); }
private static string GetFileLinkHtml(string relativeUrl, SiteInfoIdentifier site) { var absoluteUrl = DocumentURLProvider.GetAbsoluteUrl(relativeUrl, site); var path = new Uri(absoluteUrl).PathAndQuery; return(String.Format("<span class=\"form-control-text\"><a href=\"{0}\" target=\"_blank\">{1}</a></span>", absoluteUrl, path)); }
/// <summary> /// Loads summary box in the right upper corner. /// </summary> private void LoadSummaryBox() { lnkTest.HRef = DocumentURLProvider.GetUrl(ABTest.ABTestOriginalPage); lnkTest.InnerText = ShortenUrl(ABTest.ABTestOriginalPage, MAX_LINK_LENGTH); lnkTest.Target = "_blank"; // If Visitors conversion methodology selected, use "Visitors" instead of "Visits" if (drpCountingMethodology.SelectedValue == "absessionconversionfirst") { lblVisits.ResourceString = "abtesting.overview.summary.visitors"; } lblStatus.Text = ABTestStatusEvaluator.GetFormattedStatus(TestStatus).ToString(); int visits = VariantsStatisticsData.Sum(d => d.Value.Visits); int conversions = VariantsStatisticsData.Sum(d => d.Value.ConversionsCount); lblTotalVisitors.Text = String.Format("{0:N0}", visits); lblTotalConversions.Text = String.Format("{0:N0}", conversions); if (TestStatus == ABTestStatusEnum.Finished) { txtDuration.ResourceString = "abtesting.daysrun"; } DateTime start = ABTest.ABTestOpenFrom; DateTime finish = GetFinishDateOrToday(); lblDuration.Text = (finish - start).Days.ToString(); }
/// <summary> /// Init event handler. /// </summary> protected override void OnInit(EventArgs e) { ucUIToolbar.ModuleName = MODULE_NAME; ucUIToolbar.ElementName = ELEMENT_NAME; // Set the viewmode according the the URL param if (ViewMode.IsLiveSite() && QueryHelper.Contains("viewmode")) { ViewModeEnum queryStringViewMode = ViewModeCode.GetPageEnumFromString(QueryHelper.GetString("viewmode", "livesite")); if (queryStringViewMode.IsEditLive()) { SetViewMode(queryStringViewMode); } } if (ViewMode.IsEditLive()) { // Check if there is required a redirect to the specific document if (QueryHelper.Contains("onsitenodeid")) { var nodeId = QueryHelper.GetInteger("onsitenodeid", 0); var treeProvider = new TreeProvider(); var node = treeProvider.SelectSingleNode(nodeId); var url = UrlResolver.ResolveUrl(DocumentURLProvider.GetUrl(node)); URLHelper.Redirect(url); } } base.OnInit(e); }
protected void Page_Load(object sender, EventArgs e) { // Redirect to the web site root by default string returnUrl = URLHelper.ResolveUrl("~/"); // Check whether on-site editing is enabled if (PortalHelper.IsOnSiteEditingEnabled(CMSContext.CurrentSiteName)) { CurrentUserInfo cui = CMSContext.CurrentUser; // Check the permissions if ((cui != null) && cui.IsEditor && cui.IsAuthorizedPerResource("cms.content", "ExploreTree") && cui.IsAuthorizedPerResource("cms.content", "Read")) { // Set edit-live view mode PortalContext.SetViewMode(ViewModeEnum.EditLive); } else { // Redirect to access denied page when the current user does not have permissions for the OnSite editing CMSPage.RedirectToUINotAvailable(); } // Try get return URL string queryUrl = QueryHelper.GetString("returnurl", String.Empty); if (!String.IsNullOrEmpty(queryUrl) && (queryUrl.StartsWith("~/") || queryUrl.StartsWith("/"))) { // Remove return url duplication if exist int commaIndex = queryUrl.IndexOfCSafe(",", 0, false); if (commaIndex > 0) { queryUrl = queryUrl.Substring(0, commaIndex); } returnUrl = URLHelper.ResolveUrl(queryUrl); } // Use default alias path if return url isn't defined else { string aliasPath = PageInfoProvider.GetDefaultAliasPath(URLHelper.GetCurrentDomain(), CMSContext.CurrentSiteName); if (!String.IsNullOrEmpty(aliasPath)) { // Get the document which will be displayed for the default alias path TreeProvider tr = new TreeProvider(); TreeNode node = tr.SelectSingleNode(CMSContext.CurrentSiteName, aliasPath, CMSContext.PreferredCultureCode, true); if (node != null) { aliasPath = node.NodeAliasPath; } returnUrl = DocumentURLProvider.GetUrl(aliasPath); returnUrl = URLHelper.ResolveUrl(returnUrl); } } // Remove view mode value from query string returnUrl = URLHelper.RemoveParameterFromUrl(returnUrl, "viewmode"); } // Redirect to the requested page URLHelper.Redirect(returnUrl); }
private string GetNormalizedUrl(string url, SiteInfo site) { if (DocumentURLProvider.TryUnresolveUrl(url, site.SiteID, out var path)) { return(path); } return(url); }
private string GetSitePresentationUrl(string cultureCode) { if (!mSitePresentationUrls.ContainsKey(cultureCode)) { mSitePresentationUrls[cultureCode] = DocumentURLProvider.GetPresentationUrl(Node.NodeSiteID, cultureCode) + "/"; } return(mSitePresentationUrls[cultureCode]); }
/// <summary> /// Reload data. /// </summary> public override void ReloadData() { requestedGroupId = ValidationHelper.GetInteger(ContextMenu.Parameter, 0); DataTable table = new DataTable(); table.Columns.Add("ActionDisplayName"); table.Columns.Add("ActionScript"); // Add only if community is present if (CommunityPresent) { // Get resource strings prefix string resourcePrefix = ContextMenu.ResourcePrefix; // View group profile string profileUrl = ""; // Get group profile URL GeneralizedInfo infoObj = ModuleCommands.CommunityGetGroupInfo(requestedGroupId); if (infoObj != null) { profileUrl = ResolveUrl(DocumentURLProvider.GetUrl(ModuleCommands.CommunityGetGroupProfilePath(infoObj.ObjectCodeName, SiteContext.CurrentSiteName))); } table.Rows.Add(new object[] { ResHelper.GetString(resourcePrefix + ".viewgroup|group.viewgroup"), "window.location.replace('" + profileUrl + "');" }); if (!currentUser.IsGroupMember(requestedGroupId)) { table.Rows.Add(new object[] { ResHelper.GetString(resourcePrefix + ".joingroup|group.joingroup"), !currentUser.IsPublic() ? "ContextJoinTheGroup(GetContextMenuParameter('" + ContextMenu.MenuID + "'))" : "ContextRedirectToSignInUrl()" }); } else { table.Rows.Add(new object[] { ResHelper.GetString(resourcePrefix + ".leavegroup|group.leavegroup"), !currentUser.IsPublic() ? "ContextLeaveTheGroup(GetContextMenuParameter('" + ContextMenu.MenuID + "'))" : "ContextRedirectToSignInUrl()" }); } if (infoObj != null) { // Display Manage the group link if user is logged as group administrator and user is visiting a group page if (currentUser.IsGroupAdministrator(requestedGroupId) || currentUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin)) { string managementUrl = ResolveUrl(DocumentURLProvider.GetUrl(ModuleCommands.CommunityGetGroupManagementPath(infoObj.ObjectCodeName, SiteContext.CurrentSiteName))); table.Rows.Add(new object[] { ResHelper.GetString(resourcePrefix + ".managegroup|group.managegroup"), !currentUser.IsPublic() ? " window.location.replace('" + managementUrl + "');" : "ContextRedirectToSignInUrl()" }); } } } // Add count column DataColumn countColumn = new DataColumn(); countColumn.ColumnName = "Count"; countColumn.DefaultValue = table.Rows.Count; table.Columns.Add(countColumn); repItem.DataSource = table; repItem.DataBind(); }
/// <summary> /// Converts the ITreeNode into an SitemapNode with absolute Url. /// </summary> /// <param name="Node">The Node</param> /// <param name="SiteName">The SiteName</param> /// <returns>The SitemapNode</returns> public SitemapNode ConvertNodeToSiteMapUrl(TreeNode Node, string SiteName) { string Url = URLHelper.GetAbsoluteUrl(Node.RelativeURL, DocumentURLProvider.EnsureDomainPrefix(RequestContext.CurrentDomain, SiteName)); SitemapNode SiteMapItem = new SitemapNode(Url) { LastModificationDate = Node.DocumentModifiedWhen }; return(SiteMapItem); }
/// <summary> /// Converts the realtive Url and possible Datetime into an SitemapNode with an absolute Url /// </summary> /// <param name="RelativeURL">The Relative Url</param> /// <param name="SiteName">The SiteName</param> /// <param name="ModifiedLast">The last modified date</param> /// <returns>The SitemapNode</returns> private SitemapNode ConvertToSiteMapUrl(string RelativeURL, string SiteName, DateTime?ModifiedLast) { string Url = URLHelper.GetAbsoluteUrl(RelativeURL, DocumentURLProvider.EnsureDomainPrefix(RequestContext.CurrentDomain, SiteName)); SitemapNode SiteMapItem = new SitemapNode(Url); if (ModifiedLast.HasValue) { SiteMapItem.LastModificationDate = ModifiedLast; } return(SiteMapItem); }
protected void Page_Load(object sender, EventArgs e) { // Initialization productId = QueryHelper.GetInteger("productId", 0); skuGuid = QueryHelper.GetGuid("skuguid", Guid.Empty); currentSite = SiteContext.CurrentSite; SKUInfo skuObj = SKUInfoProvider.GetSKUInfo(productId); if ((skuObj != null) && skuObj.IsProductVariant) { // Get parent product of variant SKUInfo parent = skuObj.Parent as SKUInfo; if (parent != null) { productId = parent.SKUID; skuGuid = parent.SKUGUID; } } string where = null; if (productId > 0) { where = "NodeSKUID = " + productId; } else if (skuGuid != Guid.Empty) { where = "SKUGUID = '" + skuGuid + "'"; } if ((where != null) && (currentSite != null)) { TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); DataSet ds = tree.SelectNodes(currentSite.SiteName, "/%", TreeProvider.ALL_CULTURES, true, "", where); if (!DataHelper.DataSourceIsEmpty(ds)) { // Ger specified product url url = DocumentURLProvider.GetUrl(Convert.ToString(ds.Tables[0].Rows[0]["NodeAliasPath"])); } } if ((url != "") && (currentSite != null)) { // Redirect to specified product URLHelper.RedirectPermanent(url, currentSite.SiteName); } else { // Display error message lblInfo.Visible = true; lblInfo.Text = GetString("GetProduct.NotFound"); } }
/// <summary> /// Sets up the control. /// </summary> protected override void SetupControl() { if (StopProcessing) { // Do nothing } else { // Get page's URL string pageUrl = String.Empty; if (string.IsNullOrEmpty(Url)) { if (DocumentContext.CurrentDocument != null) { TreeNode node = DocumentContext.CurrentDocument; pageUrl = DocumentURLProvider.GetUrl(node.NodeAliasPath, node.DocumentUrlPath, SiteContext.CurrentSiteName); } else { pageUrl = RequestContext.CurrentURL; } } else { pageUrl = ResolveUrl(Url); } pageUrl = URLHelper.GetAbsoluteUrl(HTMLHelper.HTMLEncode(pageUrl)); string fbApiKey = FacebookConnectHelper.GetFacebookApiKey(SiteContext.CurrentSiteName); if (String.IsNullOrEmpty(fbApiKey)) { ShowError(lblErrorMessage, "socialnetworking.facebook.apikeynotset"); } // Register Facebook javascript SDK ScriptHelper.RegisterFacebookJavascriptSDK(Page, LocalizationContext.PreferredCultureCode, fbApiKey); // Get FB code StringBuilder sb = new StringBuilder(); if (UseHTML5) { sb.Append("<div class=\"fb-send\" data-href=\"", pageUrl, "\" data-colorscheme=\"", ColorScheme, "\""); if (!string.IsNullOrEmpty(Font)) { sb.Append(" data-font=\"", Font, "\""); } sb.Append("></div>"); } else { sb.Append("<fb:send href=\"", pageUrl, "\" font=\"", Font, "\" colorscheme=\"", ColorScheme, "\"></fb:send>"); } ltlSendButtonCode.Text = sb.ToString(); } }
/// <summary> /// Returns URL of the media item according site settings. /// </summary> /// <param name="nodeGuid">Node GUID of the current attachment node</param> /// <param name="documentUrlPath">URL path of the current attachment document</param> /// <param name="nodeAlias">Node alias of the current attachment node</param> /// <param name="nodeAliasPath">Node alias path of the current attachment node</param> /// <param name="nodeIsLink">Indicates if node is linked node.</param> /// <param name="height">Height of the attachment</param> /// <param name="width">Width of the attachment</param> /// <param name="maxSideSize">Maximum dimension for images displayed for thumbnails view</param> /// <param name="notAttachment">Indicates if item is not attachment</param> /// <param name="documentExtension">Document extension</param> public string GetContentItemUrl(Guid nodeGuid, string documentUrlPath, string nodeAlias, string nodeAliasPath, bool nodeIsLink, int height, int width, int maxSideSize, bool notAttachment, string documentExtension) { string result; if (documentExtension.Contains(";")) { documentExtension = documentExtension.Split(';')[0]; } // Generate URL if (UsePermanentUrls) { bool isLink = ((OutputFormat == OutputFormatEnum.BBLink) || (OutputFormat == OutputFormatEnum.HTMLLink)) || ((OutputFormat == OutputFormatEnum.URL) && (SelectableContent == SelectableContentEnum.AllContent)); if (String.IsNullOrEmpty(nodeAlias)) { nodeAlias = "default"; } if (notAttachment || isLink) { result = DocumentURLProvider.GetPermanentDocUrl(nodeGuid, nodeAlias, SiteObj.SiteName, null, documentExtension); } else { result = AttachmentInfoProvider.GetPermanentAttachmentUrl(nodeGuid, nodeAlias, documentExtension); } } else { string docUrlPath = nodeIsLink ? null : documentUrlPath; // Ensure live site view mode for URLs edited in on-site edit mode if (PortalContext.ViewMode.IsEditLive()) { PortalContext.SetRequestViewMode(ViewModeEnum.LiveSite); } result = DocumentURLProvider.GetUrl(nodeAliasPath, docUrlPath, SiteObj.SiteName, null, documentExtension); } // Make URL absolute if required int currentSiteId = SiteContext.CurrentSiteID; if (Config.UseFullURL || (currentSiteId != SiteObj.SiteID) || (currentSiteId != GetCurrentSiteId())) { result = URLHelper.GetAbsoluteUrl(result, SiteObj.DomainName, URLHelper.GetApplicationUrl(SiteObj.DomainName), null); } return(AddURLDimensionsAndResolve(result, height, width, maxSideSize)); }
private string BuildStartupScript() { txtChatUserLoginRelogNickname.WatermarkText = ChatHelper.GuestPrefixSetting; string redirectURLLogout = RedirectURLLogout.Length > 0 ? RedirectURLLogout : ChatHelper.RedirectURLLogoutSetting; if (redirectURLLogout.Length > 0) { redirectURLLogout = DocumentURLProvider.GetUrl(redirectURLLogout); } string redirectURLLogin = RedirectURLEnter.Length > 0 ? RedirectURLEnter : ChatHelper.RedirectURLLoginSetting; if (redirectURLLogin.Length > 0) { redirectURLLogin = DocumentURLProvider.GetUrl(redirectURLLogin); } // Set onclick events btnChatUserLoggedInChangeNickname.OnClientClick = "ChatManager.Login.DisplayChangeNicknameForm('" + ClientID + "'); return false;"; btnChatUserChangeNicknameButton.OnClientClick = "ChatManager.Login.ChangeNickname(jQuery('#" + txtChatUserChangeNicknameInput.ClientID + "').val(), '" + ClientID + "'); return false;"; btnChangeNicknameCancel.OnClientClick = "ChatManager.Login.ChangeNickname(null, null, true); return false;"; JavaScriptSerializer sr = new JavaScriptSerializer(); string json = sr.Serialize( new { pnlChatUserLoggedIn = pnlChatUserLoggedIn.ClientID, pnlChatUserChangeNicknameForm = pnlChatUserChangeNicknameForm.ClientID, lblChatUserLoggedInInfoValue = lblChatUserLoggedInInfoValue.ClientID, btnChatUserChangeNicknameButton = btnChatUserChangeNicknameButton.ClientID, pnlChatUserLoginError = pnlChatUserLoginError.ClientID, lblChatUserLoginErrorText = lblChatUserLoginErrorText.ClientID, txtChatUserChangeNicknameInput = txtChatUserChangeNicknameInput.ClientID, clientID = ClientID, pnlChatUserLoginRelog = pnlChatUserLoginRelog.ClientID, btnLogout = btnChatUserLoggedInLogout.ClientID, resStrLogout = ResHelper.GetString("chat.login.resStrLogoutAnonym"), txtChatUserLoginRelogNickname = txtChatUserLoginRelogNickname.ClientID, lblChatUserLoginRelogNickname = lblChatUserLoginRelogNickname.ClientID, lblChatUserLoginRelogText = lblChatUserLoginRelogText.ClientID, redirectURLLogout = redirectURLLogout, redirectURLEnter = redirectURLLogin, resStrLogAsAnonym = ResHelper.GetString("chat.login.logasanonym"), resStrLogAsCMS = ResHelper.GetString("chat.login.logascms"), btnChatUserLoginRelog = btnChatUserLoginRelog.ClientID, resStrNoService = ResHelper.GetString("chat.servicenotavailable") } ); return(String.Format("InitChatLogin({0});", json)); }
protected void btnCreateDocument_Click(object sender, EventArgs e) { if (radCopy.Checked) { string sourceCulture = copyCulturesElem.Value.ToString(); TreeNode sourceNode = DocumentHelper.GetDocument(NodeID, sourceCulture, Tree); if (sourceNode != null) { if (chkSaveBeforeEditing.Checked && (node != null)) { // Create the version first TreeNode newCulture = TreeNode.New(node.ClassName); DocumentHelper.CopyNodeData(sourceNode, newCulture, new CopyNodeDataSettings(true, null)); NewCultureDocumentSettings settings = new NewCultureDocumentSettings { Node = newCulture, CultureCode = RequiredCulture, CopyAttachments = true, CopyCategories = true }; DocumentHelper.InsertNewCultureVersion(settings); // Refresh page if (RequiresDialog) { string url = URLHelper.ResolveUrl(DocumentURLProvider.GetUrl(newCulture.NodeAliasPath) + "?" + URLHelper.LanguageParameterName + "=" + RequiredCulture); ScriptHelper.RegisterStartupScript(this, typeof(string), "NewCultureRefreshAction", ScriptHelper.GetScript(" wopener.location = " + ScriptHelper.GetString(url) + "; CloseDialog();")); } else { ScriptHelper.RegisterStartupScript(this, typeof(string), "NewCultureRefreshAction", ScriptHelper.GetScript("if (FramesRefresh) { FramesRefresh(" + node.NodeID + "); }")); } } else { var url = GetEditUrl(node); url = URLHelper.AddParameterToUrl(url, "sourcedocumentid", sourceNode.DocumentID.ToString()); Response.Redirect(url); } } else { ShowError(GetString("transman.notallowedcreate")); } } else { var url = GetEditUrl(node); Response.Redirect(url); } }
/// <summary> /// Loads summary box in the right upper corner. /// </summary> private void LoadSummaryBox() { var selectionParameters = new NodeSelectionParameters { AliasPath = ABTest.ABTestOriginalPage, CultureCode = ABTest.ABTestCulture, SiteName = SiteContext.CurrentSiteName, SelectOnlyPublished = true, CombineWithDefaultCulture = false }; var node = new TreeProvider().SelectSingleNode(selectionParameters); var shortUrl = ShortenUrl(ABTest.ABTestOriginalPage); var encodedShortUrl = HTMLHelper.HTMLEncode(shortUrl); if (node == null) { lblTest.Text = encodedShortUrl; lblTest.Visible = true; } else { lnkTest.HRef = DocumentURLProvider.GetAbsoluteLiveSiteURL(node); lnkTest.InnerText = encodedShortUrl; lnkTest.Target = "_blank"; lnkTest.Visible = true; } // If Visitors conversion methodology selected, use "Visitors" instead of "Visits" if (drpCountingMethodology.SelectedValue == ABTestConstants.ABSESSIONCONVERSION_FIRST) { lblVisits.ResourceString = "abtesting.overview.summary.visitors"; } lblStatus.Text = ABTestStatusEvaluator.GetFormattedStatus(TestStatus).ToString(); int visits = VariantsStatisticsData.Sum(d => d.Value.Visits); int conversions = VariantsStatisticsData.Sum(d => d.Value.ConversionsCount); lblTotalVisitors.Text = String.Format("{0:N0}", visits); lblTotalConversions.Text = String.Format("{0:N0}", conversions); if (TestStatus == ABTestStatusEnum.Finished) { txtDuration.ResourceString = "abtesting.daysrun"; } DateTime start = ABTest.ABTestOpenFrom; DateTime finish = GetFinishDate(); lblDuration.Text = (finish - start).Days.ToString(); }
/// <summary> /// Page Load. /// </summary> protected void Page_Load(object sender, EventArgs e) { Guid userGuid = QueryHelper.GetGuid("userguid", Guid.Empty); // If StopProcessing flag is set or userguid is empty, do nothing if (StopProcessing || (userGuid == Guid.Empty)) { Visible = false; return; } // Validate hash var settings = new HashSettings { UserSpecific = false }; if (!QueryHelper.ValidateHash("hash", "aliaspath", settings)) { URLHelper.Redirect(UIHelper.GetErrorPageUrl("dialogs.badhashtitle", "dialogs.badhashtext")); } // Get registered user RegisteredUser = UserInfoProvider.GetUserInfoByGUID(userGuid); // Get default alias path where user will be redirected to string defaultAliasPath = SettingsKeyInfoProvider.GetValue(SiteContext.CurrentSiteName + ".CMSDefaultAliasPath"); string url = DocumentURLProvider.GetUrl(defaultAliasPath); // Set default url DefaultUrl = ResolveUrl(DataHelper.GetNotEmpty(url, "~/")); bool controlPb = false; if (RequestHelper.IsPostBack()) { Control pbCtrl = ControlsHelper.GetPostBackControl(Page); if (pbCtrl == btnConfirm) { controlPb = true; } } SetupControls(!controlPb); if (!controlPb) { CheckUserStatus(); } }
public override void ButtonBackClickAction() { // Payment was skipped ShoppingCartControl.RaisePaymentSkippedEvent(); // Remove current shopping cart data from session and from database ShoppingCartControl.CleanUpShoppingCart(); // Live site - skip payment if (!ShoppingCartControl.IsInternalOrder) { string url = DocumentURLProvider.GetUrl(ShoppingCartControl.RedirectAfterPurchase != "" ? ShoppingCartControl.RedirectAfterPurchase : "/"); URLHelper.Redirect(UrlResolver.ResolveUrl(url)); } }