public void LoadView() { UrlTrackerDomain domain = null; Node redirectRootNode = new Node(UrlTrackerModel.RedirectRootNodeId); List <UrlTrackerDomain> domains = UmbracoHelper.GetDomains(false); 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 = UrlTrackerHelper.GetName(domain); lnkRootNode.ToolTip = UrlTrackerResources.SyncTree; lnkRootNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{1}', false);", redirectRootNode.Id, redirectRootNode.Path); } Uri oldUri = new Uri(UrlTrackerModel.CalculatedOldUrlWithDomain); lnkOldUrl.Text = string.Format("{0} <i class=\"icon-share\"></i>", oldUri.AbsolutePath.StartsWith("/") ? oldUri.AbsolutePath.Substring(1) : oldUri.AbsolutePath); lnkOldUrl.NavigateUrl = oldUri.ToString(); }
/// <summary> /// Loads the view. /// </summary> public void LoadView() { List <UrlTrackerDomain> domains = UmbracoHelper.GetDomains(false); if (ddlRootNode.Items.Count == 1 && domains.Count > 1 || (domains.Count == 1 && new Uri(domains[0].UrlWithDomain).AbsolutePath != "/")) { // if there is only one site, but it is not with a root domain (ie: www.site.com but instead www.site.com/corporate) then also show the dropdown var list = domains.Select(x => new ListItem(UrlTrackerHelper.GetName(x), x.NodeId.ToString())).ToList(); list.Insert(0, new ListItem("/", "-1")); ddlRootNode.DataSource = list; ddlRootNode.AppendDataBoundItems = false; ddlRootNode.DataBind(); } else if (domains.Count <= 1) { pnlRootNode.Visible = false; } if (ddlRootNode.Items.Count > 1) { ddlRootNode.SelectedValue = UrlTrackerModel.RedirectRootNodeId.ToString(); } if (!string.IsNullOrEmpty(UrlTrackerModel.OldRegex) && string.IsNullOrEmpty(UrlTrackerModel.OldUrl)) { mvRedirectFrom.SetActiveView(vwRedirectFromRegex); tbOldRegex.Text = UrlTrackerModel.OldRegex; } else { mvRedirectFrom.SetActiveView(vwRedirectFromUrl); tbOldUrl.Text = UrlTrackerModel.OldUrl; tbOldUrlQueryString.Text = UrlTrackerModel.OldUrlQueryString; } mvRedirect.SetActiveView(UrlTrackerModel.RedirectNodeId.HasValue ? vwRedirectNode : vwRedirectUrl); if (UrlTrackerModel.RedirectNodeId.HasValue) { cpRedirectNode.Value = UrlTrackerModel.RedirectNodeId.Value.ToString(); } tbRedirectUrl.Text = UrlTrackerModel.RedirectUrl; if (UrlTrackerModel.RedirectHttpCode == 301) { rbPermanent.Checked = true; } else if (UrlTrackerModel.RedirectHttpCode == 302) { rbTemporary.Checked = true; } cbRedirectPassthroughQueryString.Checked = UrlTrackerModel.RedirectPassThroughQueryString; cbForceRedirect.Checked = UrlTrackerModel.ForceRedirect; tbNotes.Text = UrlTrackerModel.Notes; pnlReferrer.Visible = !string.IsNullOrEmpty(UrlTrackerModel.Referrer); lblReferrer.Text = UrlTrackerModel.Referrer; lblInserted.Text = UrlTrackerModel.Inserted.ToString(); }
public void LoadView() { List <UrlTrackerDomain> domains = UmbracoHelper.GetDomains(); if (ddlRootNode.Items.Count == 1 && domains.Count > 1) { ddlRootNode.DataSource = domains.Select(x => new ListItem(UrlTrackerHelper.GetName(x), x.NodeId.ToString())); ddlRootNode.DataBind(); } else if (domains.Count <= 1) { pnlRootNode.Visible = false; } if (ddlRootNode.Items.Count > 1) { ddlRootNode.SelectedValue = UrlTrackerModel.RedirectRootNodeId.ToString(); } if (!string.IsNullOrEmpty(UrlTrackerModel.OldRegex) && string.IsNullOrEmpty(UrlTrackerModel.OldUrl)) { tbOldRegex.Text = UrlTrackerModel.OldRegex; } else { tbOldUrl.Text = UrlTrackerModel.OldUrl; tbOldUrlQueryString.Text = UrlTrackerModel.OldUrlQueryString; } if (UrlTrackerModel.RedirectNodeId.HasValue) { cpRedirectNode.Value = UrlTrackerModel.RedirectNodeId.Value.ToString(); } tbRedirectUrl.Text = UrlTrackerModel.RedirectUrl; if (UrlTrackerModel.RedirectHttpCode == 301) { rbPermanent.Checked = true; } else if (UrlTrackerModel.RedirectHttpCode == 302) { rbTemporary.Checked = true; } cbRedirectPassthroughQueryString.Checked = UrlTrackerModel.RedirectPassThroughQueryString; cbForceRedirect.Checked = UrlTrackerModel.ForceRedirect; tbNotes.Text = UrlTrackerModel.Notes; pnlReferrer.Visible = !string.IsNullOrEmpty(UrlTrackerModel.Referrer); lblReferrer.Text = UrlTrackerModel.Referrer; lblInserted.Text = UrlTrackerModel.Inserted.ToString(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!_earlyErrorDetected) { IUrlTrackerView activeView = GetActiveView(); if (activeView != null) { activeView.UrlTrackerModel = icAdvancedView.UrlTrackerModel = UrlTrackerModel; } if (gvUrlTracker.PageSize != PageSize) { gvUrlTracker.PageSize = PageSize; } if (gvNotFound.PageSize != PageSize) { gvNotFound.PageSize = PageSize; } } List <UrlTrackerDomain> domains = UmbracoHelper.GetDomains(); if (ddlRootNode.Items.Count == 1 && domains.Count > 1 || (domains.Count == 1 && new Uri(domains[0].UrlWithDomain).AbsolutePath != "/")) { if (ddlRootNode.Items.Count <= 1) { // if there is only one site, but it is not with a root domain (ie: www.site.com but instead www.site.com/corporate) then also show the dropdown var list = domains.Select(x => new ListItem(UrlTrackerHelper.GetName(x), x.NodeId.ToString())).ToList(); list.Insert(0, new ListItem("/", "-1")); ddlRootNode.DataSource = list; ddlRootNode.AppendDataBoundItems = false; ddlRootNode.DataBind(); } } else if (domains.Count <= 1) { lblRootNode.Visible = false; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); List <UrlTrackerDomain> domains = UmbracoHelper.GetDomains(); if (ddlRootNode.Items.Count == 1 && domains.Count > 1 || (domains.Count == 1 && new Uri(domains[0].UrlWithDomain).AbsolutePath != "/")) { if (ddlRootNode.Items.Count <= 1) { // if there is only one site, but it is not with a root domain (ie: www.site.com but instead www.site.com/corporate) then also show the dropdown var list = domains.Select(x => new ListItem(UrlTrackerHelper.GetName(x), x.NodeId.ToString())).ToList(); list.Insert(0, new ListItem("/", "-1")); ddlRootNode.DataSource = list; ddlRootNode.AppendDataBoundItems = false; ddlRootNode.DataBind(); } } else if (domains.Count <= 1) { pnlRootNode.Visible = false; } }