Пример #1
0
        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();
        }
Пример #2
0
        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('{0}', false);", 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.Id > 0 ? redirectNode.Name : UrlTrackerResources.RedirectNodeUnpublished;
            lnkRedirectNode.ToolTip = UrlTrackerResources.SyncTree;
            lnkRedirectNode.NavigateUrl = string.Format("javascript:parent.UmbClientMgr.mainTree().syncTree('{0}', false);", 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();
        }
Пример #3
0
 public static string GetName(UrlTrackerDomain domain)
 {
     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(string.Format("{0} ({1})", domain.Node.Name, domain.Name));
     }
 }