Merge
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
syntax: regex
|
||||
syntax: regexp
|
||||
^src/packages/(?!repositories.config$)
|
||||
|
||||
syntax: glob
|
||||
|
||||
@@ -42,6 +42,11 @@ namespace Umbraco.Web.Routing
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsWildcardDomain(Domain d)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(d.Name) || d.Name.StartsWith("*");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds the domain that best matches the current uri, into an enumeration of domains.
|
||||
/// </summary>
|
||||
@@ -56,7 +61,7 @@ namespace Umbraco.Web.Routing
|
||||
// we need to order so example.com/foo matches before example.com/
|
||||
var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme;
|
||||
var domainsAndUris = domains
|
||||
.Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*")
|
||||
.Where(d => !IsWildcardDomain(d))
|
||||
.Select(d => new { Domain = d, UriString = UriUtility.EndPathWithSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
|
||||
.OrderByDescending(t => t.UriString)
|
||||
.Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) });
|
||||
@@ -96,7 +101,7 @@ namespace Umbraco.Web.Routing
|
||||
{
|
||||
var scheme = current == null ? Uri.UriSchemeHttp : current.Scheme;
|
||||
var domainsAndUris = domains
|
||||
.Where(d => !string.IsNullOrEmpty(d.Name) && d.Name != "*")
|
||||
.Where(d => !IsWildcardDomain(d))
|
||||
.Select(d => new { Domain = d, UriString = UriUtility.TrimPathEndSlash(UriUtility.StartWithScheme(d.Name, scheme)) })
|
||||
.OrderByDescending(t => t.UriString)
|
||||
.Select(t => new DomainAndUri { Domain = t.Domain, Uri = new Uri(t.UriString) });
|
||||
@@ -117,7 +122,7 @@ namespace Umbraco.Web.Routing
|
||||
.Reverse()
|
||||
.Select(id => int.Parse(id))
|
||||
.TakeWhile(id => id != current.RootNodeId)
|
||||
.Any(id => domains.Any(d => d.RootNodeId == id && !string.IsNullOrEmpty(d.Name) && d.Name != "*"));
|
||||
.Any(id => domains.Any(d => d.RootNodeId == id && !IsWildcardDomain(d)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -139,7 +144,7 @@ namespace Umbraco.Web.Routing
|
||||
|
||||
// supporting null or whitespace for backward compatibility,
|
||||
// although we should not allow ppl to create them anymore
|
||||
var domain = domains.Where(d => d.RootNodeId == nodeId && (string.IsNullOrWhiteSpace(d.Name) || d.Name == "*")).FirstOrDefault();
|
||||
var domain = domains.Where(d => d.RootNodeId == nodeId && IsWildcardDomain(d)).FirstOrDefault();
|
||||
if (domain != null)
|
||||
return domain;
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace umbraco.dialogs
|
||||
{
|
||||
Domain d = new Domain(editDomain);
|
||||
selectedLanguage = d.Language.id;
|
||||
DomainName.Text = d.Name;
|
||||
DomainName.Text = d.Name.StartsWith("*") ? "*" : d.Name;
|
||||
ok.Text = ui.Text("general", "update", base.getUser());
|
||||
}
|
||||
|
||||
@@ -82,7 +82,8 @@ namespace umbraco.dialogs
|
||||
allDomains.Text = "<table border=\"0\" cellspacing=\"10\">";
|
||||
|
||||
foreach (Domain d in domainList) {
|
||||
allDomains.Text += "<tr><td>" + d.Name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + currentID + "&editDomain=" +
|
||||
var name = d.Name.StartsWith("*") ? "*" : d.Name;
|
||||
allDomains.Text += "<tr><td>" + name + "</td><td>(" + d.Language.CultureAlias + ")</td><td><a href=\"?id=" + currentID + "&editDomain=" +
|
||||
d.Id.ToString() + "\">" + ui.Text("edit") + "</a></td><td><a href=\"?id=" + currentID +
|
||||
"&delDomain=" + d.Id.ToString() + "\" onClick=\"return confirm('" +
|
||||
ui.Text("defaultdialogs", "confirmdelete", base.getUser()) +
|
||||
@@ -120,11 +121,14 @@ namespace umbraco.dialogs
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if( !Domain.Exists(DomainName.Text.ToLower())) {
|
||||
Domain.MakeNew(DomainName.Text, currentID, int.Parse(Languages.SelectedValue));
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", DomainName.Text, base.getUser());
|
||||
// have to handle wildcard
|
||||
var domainName = DomainName.Text.Trim();
|
||||
domainName = domainName == "*" ? ("*" + currentID.ToString()) : domainName;
|
||||
|
||||
if (!Domain.Exists(domainName.ToLower()))
|
||||
{
|
||||
Domain.MakeNew(domainName, currentID, int.Parse(Languages.SelectedValue));
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainCreated", domainName, base.getUser());
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.success;
|
||||
|
||||
DomainName.Text = "";
|
||||
@@ -134,7 +138,7 @@ namespace umbraco.dialogs
|
||||
//this is probably the worst webform I've ever seen...
|
||||
Response.Redirect("AssignDomain.aspx?id=" + currentID.ToString());
|
||||
} else {
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text, base.getUser());
|
||||
FeedBackMessage.Text = ui.Text("assignDomain", "domainExists", DomainName.Text.Trim(), base.getUser());
|
||||
FeedBackMessage.type = umbraco.uicontrols.Feedback.feedbacktype.error;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user