public void LoadView() { UrlTrackerDomain domain = null; Node redirectRootNode = new Node(UrlTrackerModel.RedirectRootNodeId); List<UrlTrackerDomain> domains = UmbracoHelper.GetDomains(); domain = domains.FirstOrDefault(x => x.NodeId == redirectRootNode.Id); if (domain == null) domain = new UrlTrackerDomain(-1, redirectRootNode.Id, HttpContext.Current.Request.Url.Host); if (!domains.Any()) pnlRootNode.Visible = false; else { lnkRootNode.Text = string.Format("{0} ({1})", domain.Node.Name, domain.Name); lnkRootNode.ToolTip = UrlTrackerResources.SyncTree; lnkRootNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectRootNode.Id, redirectRootNode.Path); } lnkOldUrl.Text = string.Format("{0} <i class=\"icon-share\"></i>", UrlTrackerModel.CalculatedOldUrl); lnkOldUrl.NavigateUrl = UrlTrackerModel.CalculatedOldUrlWithDomain; Node redirectNode = new Node(UrlTrackerModel.RedirectNodeId.Value); lnkRedirectNode.Text = redirectNode.Name; lnkRedirectNode.ToolTip = UrlTrackerResources.SyncTree; lnkRedirectNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectNode.Id, redirectNode.Path); if (UrlTrackerModel.RedirectHttpCode == 301) rbPermanent.Checked = true; else if (UrlTrackerModel.RedirectHttpCode == 302) rbTemporary.Checked = true; cbRedirectPassthroughQueryString.Checked = UrlTrackerModel.RedirectPassThroughQueryString; lblNotes.Text = UrlTrackerModel.Notes; lblInserted.Text = UrlTrackerModel.Inserted.ToString(); }
public static string GetName(UrlTrackerDomain domain, bool includeDomian = true) { if (UrlTrackerSettings.HasDomainOnChildNode) { var result = string.Format("{0}", domain.Node.Parent == null ? domain.Node.Name : domain.Node.Parent.Name + "/" + domain.Node.Name); if (string.IsNullOrEmpty(result)) { result = "(root)"; } return result; } else { return includeDomian ? string.Format("{0} ({1})", domain.Node.Name, domain.Name) : domain.Node.Name; } }
public void LoadView() { UrlTrackerDomain domain = null; Node redirectRootNode = new Node(UrlTrackerModel.RedirectRootNodeId); List<UrlTrackerDomain> domains = UmbracoHelper.GetDomains(); domain = domains.FirstOrDefault(x => x.NodeId == redirectRootNode.Id); if (domain == null) domain = new UrlTrackerDomain(-1, redirectRootNode.Id, HttpContext.Current.Request.Url.Host); if (!domains.Any()) pnlRootNode.Visible = false; else { lnkRootNode.Text = string.Format("{0} ({1})", domain.Node.Name, domain.Name); lnkRootNode.ToolTip = UrlTrackerResources.SyncTree; lnkRootNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectRootNode.Id, redirectRootNode.Path); } Uri oldUri = new Uri(string.Concat(domain.UrlWithDomain, UrlTrackerModel.OldUrl)); lnkOldUrl.Text = string.Format("{0} <i class=\"icon-share\"></i>", oldUri.AbsolutePath.StartsWith("/") ? oldUri.AbsolutePath.Substring(1) : oldUri.AbsolutePath); lnkOldUrl.NavigateUrl = oldUri.ToString(); }