Merge remote-tracking branch 'origin/dev-v7' into dev-v7.7

# Conflicts:
#	src/Umbraco.Web/PublishedContentExtensions.cs
This commit is contained in:
Shannon
2017-07-25 15:15:56 +10:00
17 changed files with 222 additions and 266 deletions

View File

@@ -26,7 +26,7 @@ namespace Umbraco.Core.PropertyEditors
public PropertyEditorAttribute(string alias, string name)
{
Mandate.ParameterNotNullOrEmpty(alias, "id");
Mandate.ParameterNotNullOrEmpty(alias, "alias");
Mandate.ParameterNotNullOrEmpty(name, "name");
Alias = alias;
@@ -82,4 +82,4 @@ namespace Umbraco.Core.PropertyEditors
/// </summary>
public string Group { get; set; }
}
}
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Tests.TestHelpers;
using Umbraco.Web;
@@ -16,8 +17,16 @@ namespace Umbraco.Tests.PublishedContent
private UmbracoContext ctx;
private string xmlContent = "";
private bool createContentTypes = true;
protected override string GetXmlContent(int templateId)
public override void Initialize()
{
base.Initialize();
// make sure we get them from the content service
PublishedContentType.GetPublishedContentTypeCallback = null;
}
protected override string GetXmlContent(int templateId)
{
return xmlContent;
}
@@ -57,7 +66,7 @@ namespace Umbraco.Tests.PublishedContent
var publishedContent = ctx.ContentCache.GetById(1100);
Assert.That(publishedContent.IsDocumentType("base", true));
}
[Test]
public void IsDocumentType_Recursive_InvalidBaseType_ReturnsFalse()
{
@@ -73,23 +82,23 @@ namespace Umbraco.Tests.PublishedContent
if (createContentTypes)
{
var contentTypeService = ctx.Application.Services.ContentTypeService;
var baseType = new ContentType(-1) {Alias = "base", Name = "Base"};
var baseType = new ContentType(-1) { Alias = "base", Name = "Base" };
const string contentTypeAlias = "inherited";
var inheritedType = new ContentType(baseType, contentTypeAlias) {Alias = contentTypeAlias, Name = "Inherited"};
var inheritedType = new ContentType(baseType, contentTypeAlias) { Alias = contentTypeAlias, Name = "Inherited" };
contentTypeService.Save(baseType);
contentTypeService.Save(inheritedType);
createContentTypes = false;
}
#region setup xml content
xmlContent = @"<?xml version=""1.0"" encoding=""utf-8""?>
<!DOCTYPE root[
<!DOCTYPE root[
<!ELEMENT inherited ANY>
<!ATTLIST inherited id ID #REQUIRED>
]>
<root id=""-1"">
<inherited id=""1100"" parentID=""-1"" level=""1"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""1"" sortOrder=""1"" createDate=""2012-06-12T14:13:17"" updateDate=""2012-07-20T18:50:43"" nodeName=""Home"" urlName=""home"" writerName=""admin"" creatorName=""admin"" path=""-1,1046"" isDoc=""""/>
</root>";
#endregion
}
}
}

View File

@@ -44,11 +44,11 @@ namespace Umbraco.Tests.PublishedContent
var propertyTypes = new[]
{
// AutoPublishedContentType will auto-generate other properties
new PublishedPropertyType("umbracoNaviHide", 0, Constants.PropertyEditors.TrueFalseAlias),
new PublishedPropertyType("selectedNodes", 0, "?"),
new PublishedPropertyType("umbracoUrlAlias", 0, "?"),
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEAlias),
new PublishedPropertyType("testRecursive", 0, "?"),
new PublishedPropertyType("umbracoNaviHide", 0, Constants.PropertyEditors.TrueFalseAlias),
new PublishedPropertyType("selectedNodes", 0, "?"),
new PublishedPropertyType("umbracoUrlAlias", 0, "?"),
new PublishedPropertyType("content", 0, Constants.PropertyEditors.TinyMCEAlias),
new PublishedPropertyType("testRecursive", 0, "?"),
};
var compositionAliases = new[] {"MyCompositionAlias"};
var type = new AutoPublishedContentType(0, "anything", compositionAliases, propertyTypes);
@@ -73,7 +73,7 @@ namespace Umbraco.Tests.PublishedContent
protected override string GetXmlContent(int templateId)
{
return @"<?xml version=""1.0"" encoding=""utf-8""?>
<!DOCTYPE root[
<!DOCTYPE root[
<!ELEMENT Home ANY>
<!ATTLIST Home id ID #REQUIRED>
<!ELEMENT CustomDocument ANY>
@@ -87,17 +87,17 @@ namespace Umbraco.Tests.PublishedContent
<testRecursive><![CDATA[This is the recursive val]]></testRecursive>
<Home id=""1173"" parentID=""1046"" level=""2"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""1"" createDate=""2012-07-20T18:06:45"" updateDate=""2012-07-20T19:07:31"" nodeName=""Sub1"" urlName=""sub1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173"" isDoc="""">
<content><![CDATA[<div>This is some content</div>]]></content>
<umbracoUrlAlias><![CDATA[page2/alias, 2ndpagealias]]></umbracoUrlAlias>
<umbracoUrlAlias><![CDATA[page2/alias, 2ndpagealias]]></umbracoUrlAlias>
<testRecursive><![CDATA[]]></testRecursive>
<Home id=""1174"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""1"" createDate=""2012-07-20T18:07:54"" updateDate=""2012-07-20T19:10:27"" nodeName=""Sub2"" urlName=""sub2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1174"" isDoc="""">
<content><![CDATA[]]></content>
<umbracoUrlAlias><![CDATA[only/one/alias]]></umbracoUrlAlias>
<creatorName><![CDATA[Custom data with same property name as the member name]]></creatorName>
<testRecursive><![CDATA[]]></testRecursive>
</Home>
</Home>
<CustomDocument id=""1177"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + templateId + @""" sortOrder=""2"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-18T14:23:35"" nodeName=""custom sub 1"" urlName=""custom-sub-1"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1177"" isDoc="""" />
<CustomDocument id=""1178"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1234"" template=""" + templateId + @""" sortOrder=""3"" createDate=""2012-07-16T15:26:59"" updateDate=""2012-07-16T14:23:35"" nodeName=""custom sub 2"" urlName=""custom-sub-2"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1178"" isDoc="""" />
<Home id=""1176"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""4"" createDate=""2012-07-20T18:08:08"" updateDate=""2012-07-20T19:10:52"" nodeName=""Sub 3"" urlName=""sub-3"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1176"" isDoc="""">
<Home id=""1176"" parentID=""1173"" level=""3"" writerID=""0"" creatorID=""0"" nodeType=""1044"" template=""" + templateId + @""" sortOrder=""4"" createDate=""2012-07-20T18:08:08"" updateDate=""2012-07-20T19:10:52"" nodeName=""Sub 3"" urlName=""sub-3"" writerName=""admin"" creatorName=""admin"" path=""-1,1046,1173,1176"" isDoc="""" key=""CDB83BBC-A83B-4BA6-93B8-AADEF67D3C09"">
<content><![CDATA[]]></content>
<umbracoNaviHide>1</umbracoNaviHide>
</Home>
@@ -211,8 +211,8 @@ namespace Umbraco.Tests.PublishedContent
[PublishedContentModel("Home")]
internal class Home : PublishedContentModel
{
public Home(IPublishedContent content)
: base(content)
public Home(IPublishedContent content)
: base(content)
{}
}
@@ -659,6 +659,28 @@ namespace Umbraco.Tests.PublishedContent
Assert.AreEqual((int)1178, (int)result.Id);
}
[Test]
public void GetKey()
{
var key = Guid.Parse("CDB83BBC-A83B-4BA6-93B8-AADEF67D3C09");
// doc is Home (a model) and GetKey unwraps and works
var doc = GetNode(1176);
Assert.IsInstanceOf<Home>(doc);
Assert.AreEqual(key, doc.GetKey());
// wrapped is PublishedContentWrapped and WithKey unwraps
var wrapped = new TestWrapped(doc);
Assert.AreEqual(key, wrapped.GetKey());
}
class TestWrapped : PublishedContentWrapped
{
public TestWrapped(IPublishedContent content)
: base(content)
{ }
}
[Test]
public void DetachedProperty1()
{

View File

@@ -15,7 +15,7 @@ namespace Umbraco.Tests.Scheduling
[Timeout(30000)]
public class BackgroundTaskRunnerTests
{
private ILogger _logger;
private ILogger _logger;
[TestFixtureSetUp]
public void InitializeFixture()
@@ -93,7 +93,7 @@ namespace Umbraco.Tests.Scheduling
{
runner.Add(new MyTask());
});
}
}
}
[Test]
@@ -242,7 +242,7 @@ namespace Umbraco.Tests.Scheduling
}
}
[Test]
public void Create_IsNotRunning()
{
@@ -252,16 +252,18 @@ namespace Umbraco.Tests.Scheduling
}
}
[Test]
public async void Create_AutoStart_IsRunning()
{
using (var runner = new BackgroundTaskRunner<IBackgroundTask>(new BackgroundTaskRunnerOptions
{
AutoStart = true
AutoStart = true,
KeepAlive = true // else stops!
}, _logger))
{
Assert.IsTrue(runner.IsRunning); // because AutoStart is true
runner.Stop(false); // keepalive = must be stopped
await runner.StoppedAwaitable; // runner stops, within test's timeout
}
}
@@ -296,7 +298,7 @@ namespace Umbraco.Tests.Scheduling
// so that we don't have a runaway task in tests, etc - but it does NOT terminate
// the runner - it really is NOT a nice way to end a runner - it's there for tests
}
[Test]
public void Startup_KeepAlive_IsRunning()
{
@@ -359,7 +361,7 @@ namespace Umbraco.Tests.Scheduling
}
}
[Test]
public async void WaitOnRunner_Tasks()
{
@@ -504,7 +506,7 @@ namespace Umbraco.Tests.Scheduling
//wait till the thread is done
await tManager.CurrentThreadingTask;
foreach (var task in tasks)
{
Assert.IsTrue(task.Ended != default(DateTime));
@@ -516,7 +518,7 @@ namespace Umbraco.Tests.Scheduling
}
}
[Test]
public void RecurringTaskTest()
{
@@ -532,7 +534,7 @@ namespace Umbraco.Tests.Scheduling
};
var task = new MyRecurringTask(runner, 200, 500);
runner.Add(task);
Assert.IsTrue(runner.IsRunning); // waiting on delay
@@ -577,7 +579,7 @@ namespace Umbraco.Tests.Scheduling
runner.Add(task);
Assert.IsTrue(runner.IsRunning);
Thread.Sleep(5000);
Assert.IsTrue(runner.IsRunning); // still waiting for the task to release
Assert.IsTrue(runner.IsRunning); // still waiting for the task to release
Assert.IsFalse(task.HasRun);
runner.Shutdown(false, false);
await runner.StoppedAwaitable; // wait for the entire runner operation to complete
@@ -585,7 +587,7 @@ namespace Umbraco.Tests.Scheduling
}
}
[Test]
public void LatchedRecurring()
{
@@ -842,7 +844,7 @@ namespace Umbraco.Tests.Scheduling
}
public override bool PerformRun()
{
{
Thread.Sleep(_runMilliseconds);
return true; // repeat
}
@@ -976,7 +978,7 @@ namespace Umbraco.Tests.Scheduling
public virtual Task RunAsync(CancellationToken token)
{
throw new NotImplementedException();
//return Task.Delay(500);
//return Task.Delay(500);
}
public virtual bool IsAsync

View File

@@ -10,5 +10,5 @@
<li>Find an add-on <a class="btn-link -underline href="http://our.umbraco.org/projects" target="_blank">package</a> to help you get going quickly</li>
<li>Watch our <a class="btn-link -underline href="http://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)</li>
<li>Find out about our <a class="btn-link -underline href="http://umbraco.org/products" target="_blank">productivity boosting tools and commercial support</a></li>
<li>Find out about real-life <a class="btn-link -underline href="http://umbraco.org/training/training-schedule" target="_blank">training and certification</a> opportunities</li>
<li>Find out about real-life <a class="btn-link -underline href="http://umbraco.org/training/" target="_blank">training and certification</a> opportunities</li>
</ul>

View File

@@ -10,5 +10,5 @@
<li>Ask a question in the <a class="btn-link -underline" href="https://our.umbraco.org/" target="_blank">Community Forum</a></li>
<li>Watch our <a class="btn-link -underline" href="http://umbraco.tv" target="_blank">tutorial videos</a> (some are free, some require a subscription)</li>
<li>Find out about our <a class="btn-link -underline" href="http://umbraco.com/products-and-support" target="_blank">productivity boosting tools and commercial support</a></li>
<li>Find out about real-life <a class="btn-link -underline" href="http://umbraco.com/products/training/schedule" target="_blank">training and certification</a> opportunities</li>
<li>Find out about real-life <a class="btn-link -underline" href="http://umbraco.com/training/" target="_blank">training and certification</a> opportunities</li>
</ul>

View File

@@ -90,7 +90,7 @@
<umb-editor-sub-header>
<umb-editor-sub-header-content-left>
<a class="umb-package-details__back-link" href="" ng-click="vm.state = 'upload'">&larr; <localize key="packager_cancelAndAnother">Cancel and upload another package</localize></a>
<a class="umb-package-details__back-link" href="" ng-click="vm.state = 'upload'">&larr; <localize key="packager_cancelAndUploadAnother">Cancel and upload another package</localize></a>
</umb-editor-sub-header-content-left>
</umb-editor-sub-header>

View File

@@ -177,6 +177,8 @@ także do obecnego węzła, o ile poniższa domena również do niego należy.]]
<key alias="target" version="7.0">Cel</key>
<key alias="scheduledPublishServerTime">Oznacza to następującą godzinę na serwerze:</key>
<key alias="scheduledPublishDocumentation"><![CDATA[<a href="https://our.umbraco.org/documentation/Getting-Started/Data/Scheduled-Publishing/#timezones" target="_blank">Co to oznacza?</a>]]></key>
<key alias="addTextBox">Dodaj kolejne pole tekstowe</key>
<key alias="removeTextBox">Usuń te pole tekstowe</key>
</area>
<area alias="media">
<key alias="clickToUpload">Kliknij, aby załadować plik</key>
@@ -304,6 +306,7 @@ także do obecnego węzła, o ile poniższa domena również do niego należy.]]
<key alias="linkToPage">Link do strony</key>
<key alias="openInNewWindow">Otwórz zlinkowany dokument w nowym oknie lub zakładce</key>
<key alias="linkToMedia">Link do mediów</key>
<key alias="linkToFile">Link do plików</key>
<key alias="selectMedia">Wybierz media</key>
<key alias="selectIcon">Wybierz ikonę</key>
<key alias="selectItem">Wybierz element</key>
@@ -323,6 +326,7 @@ także do obecnego węzła, o ile poniższa domena również do niego należy.]]
<key alias="unLinkYour">Odlinkuj swój</key>
<key alias="account">konto</key>
<key alias="selectEditor">Wybierz edytora</key>
<key alias="selectSnippet">Wybierz snippet</key>
</area>
<area alias="dictionaryItem">
<key alias="description"><![CDATA[
@@ -380,6 +384,13 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="rteRelatedStylesheets">Powiązane arkusze stylów</key>
<key alias="rteShowLabel">Pokaż etykietę</key>
<key alias="rteWidthAndHeight">Szerokość i wysokość</key>
<key alias="allPropTypes">Wszystkie typy właściwości &amp; dane właściwości</key>
<key alias="willBeDeleted">używające tego typu danych zostaną usunięte na zawsze, potwierdź, że chcesz je także usunąć</key>
<key alias="yesDelete">Tak, usuń</key>
<key alias="andAllRelated">i wszystkie typy właściwości &amp; dane właściwości używające tego typu danych/key>
<key alias="selectFolder">Wybierz folder do przeniesienia</key>
<key alias="inTheTree">do w strukturze drzewa poniżej</key>
<key alias="wasMoved">został przeniesiony poniżej</key>
</area>
<area alias="errorHandling">
<key alias="errorButDataWasSaved">Dane zostały zapisane, lecz wystąpiły błędy, które musisz poprawić przed publikacją strony:</key>
@@ -438,6 +449,7 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="closewindow">Zamknij okno</key>
<key alias="comment">Komentarz</key>
<key alias="confirm">Potwierdzenie</key>
<key alias="constrain">Zachowaj</key>
<key alias="constrainProportions">Zachowaj proporcje</key>
<key alias="continue">Kontynuuj</key>
<key alias="copy">Kopiuj</key>
@@ -449,6 +461,7 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="deleted">Usunięto</key>
<key alias="deleting">Usuwanie...</key>
<key alias="design">Wygląd</key>
<key alias="dictionary">Słownik</key>
<key alias="dimensions">Rozmiary</key>
<key alias="down">Dół</key>
<key alias="download">Pobierz</key>
@@ -458,6 +471,7 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="email">Email</key>
<key alias="error">Błąd</key>
<key alias="findDocument">Znajdź</key>
<key alias="first">Pierwszy</key>
<key alias="height">Wysokość</key>
<key alias="help">Pomoc</key>
<key alias="icon">Ikona</key>
@@ -468,7 +482,8 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="invalid">Nieprawidłowe</key>
<key alias="justify">Wyrównaj</key>
<key alias="language">Język</key>
<key alias="layout">układ</key>
<key alias="last">Ostatni</key>
<key alias="layout">Układ</key>
<key alias="loading">Ładowanie</key>
<key alias="locked">Zablokowany</key>
<key alias="login">Zaloguj</key>
@@ -495,9 +510,11 @@ Możesz dodać dodatkowe języki w menu "Języki" po lewej stronie.]]></key>
<key alias="reciept">E-mail, aby otrzymywać dane z formularzy</key>
<key alias="recycleBin">Kosz</key>
<key alias="remaining">Pozostało</key>
<key alias="remove">Usuń</key>
<key alias="rename">Zmień nazwę</key>
<key alias="renew">Odnów</key>
<key alias="required" version="7.0">Wymagany</key>
<key alias="retrieve">Odzyskaj</key>
<key alias="retry">Ponów próbę</key>
<key alias="rights">Uprawnienia</key>
<key alias="search">Szukaj</key>
@@ -806,6 +823,39 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
Wskaż pakiet z Twojego komputera, poprzez kliknięcie na przycisk "Przeglądaj"<br />
i wskaż gdzie jest zapisany. Pakiety Umbraco przeważnie posiadają rozszerzenie ".umb" lub ".zip".
]]></key>
<key alias="dropHere">Upuść, aby załadować</key>
<key alias="orClickHereToUpload">lub kliknij tutaj, aby wybrać pliki</key>
<key alias="uploadPackage">Załaduj pakiet</key>
<key alias="localPackageDescription">Zainstaluj lokalny pakiet poprzez wybranie go ze swojego komputera. Instaluj jedynie te pakiety, z zaufanych i znanych Tobie źródeł</key>
<key alias="uploadAnother">Załaduj kolejny pakiet</key>
<key alias="cancelAndUploadAnother">Anuluj i załaduj kolejny pakiet</key>
<key alias="packageLicense">Licencja</key>
<key alias="accept">Zgadzam się</key>
<key alias="termsOfUse">zasady użytkowania</key>
<key alias="packageInstall">Zainstaluj pakiet</key>
<key alias="installFinish">Zakończ</key>
<key alias="installedPackages">Zainstalowane pakiety</key>
<key alias="noPackages">Nie masz żadnych zainstalowanych pakietów</key>
<key alias="noPackagesDescription"><![CDATA[Nie masz żadnych zainstalowanych pakietów. Zainstaluj lokalny pakiet poprzez wybranie go ze swojego komputera lub przeglądaj dostępne pakiety, używając ikony <strong>'Pakiety'</strong> w prawym górnym rogu ekranu]]></key>
<key alias="packageSearch">Szukaj pakietów</key>
<key alias="packageSearchResults">Wyniki dla</key>
<key alias="packageNoResults">Nie mogliśmy znaleźć niczego dla</key>
<key alias="packageNoResultsDescription">Spróbuj wyszukać kolejny pakiet lub przeszukaj kategorie pakietów</key>
<key alias="packagesPopular">Popularne</key>
<key alias="packagesNew">Nowe wydania</key>
<key alias="packageHas">ma</key>
<key alias="packageKarmaPoints">punktów karmy</key>
<key alias="packageInfo">Informacja</key>
<key alias="packageOwner">Właściciel</key>
<key alias="packageContrib">Kontrybutor</key>
<key alias="packageCreated">Utworzone</key>
<key alias="packageCurrentVersion">Obecna wersja</key>
<key alias="packageNetVersion">wersja .NET</key>
<key alias="packageDownloads">Pobrania</key>
<key alias="packageLikes">Polubienia</key>
<key alias="packageCompatibility">Zgodność</key>
<key alias="packageCompatibilityDescription">Według raportów członków społeczności, ten pakiet jest zgodny z następującymi wersjami Umbraco. Pełna zgodność nie może być zagwarantowana dla wersji zaraportowanych poniżej 100%</key>
<key alias="packageExternalSources">Zewnętrzne źródła</key>
<key alias="packageAuthor">Autor</key>
<key alias="packageDemonstration">Demonstracja</key>
<key alias="packageDocumentation">Dokumentacja</key>
@@ -841,6 +891,7 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
<key alias="installStateRestarting">Restartowanie, proszę czekać...</key>
<key alias="installStateComplete">Wszystko skończone, Twoja przeglądarka się teraz odświeży, proszę czekać...</key>
<key alias="installStateCompleted">Proszę kliknąć Zakończ, aby zakończyć instalację i przeładować stronę.</key>
<key alias="installStateUploading">Wgrywanie pakietu...</key>
</area>
<area alias="paste">
<key alias="doNothing">Wklej z zachowaniem formatowania (Nie zalecane)</key>
@@ -908,6 +959,10 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
</area>
<area alias="imagecropper">
<key alias="reset">Resetuj</key>
<key alias="defineCrop">Zdefiniuj przycięcie</key>
<key alias="defineCropDescription">Ustaw alias dla przycięcia, a także jego domyślną szerokość i długość</key>
<key alias="saveCrop">Zapisz przycięcie</key>
<key alias="addCrop">Dodaj nowe przycięcie</key>
</area>
<area alias="rollback">
<key alias="currentVersion">Aktualna wersja</key>
@@ -1116,6 +1171,7 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
<key alias="queryBuilder">Konstruktor zapytań</key>
<key alias="buildQuery">Zbuduj zapytanie</key>
<key alias="itemsReturned">Element zwrócony, w</key>
<key alias="iWant">Chcę</key>
@@ -1261,25 +1317,36 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
</area>
<area alias="templateEditor">
<key alias="addFallbackField">Dodaj pole zastępcze</key>
<key alias="fallbackField">Pole zastępcze</key>
<key alias="addDefaultValue">Dodaj domyślną wartość</key>
<key alias="defaultValue">Domyślna wartość</key>
<key alias="alternativeField">Pole alternatywne</key>
<key alias="alternativeText">Tekst alternatywny</key>
<key alias="casing">Wielkość liter</key>
<key alias="encoding">Kodowanie</key>
<key alias="chooseField">Wybierz pole</key>
<key alias="convertLineBreaks">Konwertuj złamania wiersza</key>
<key alias="convertLineBreaksDescription">Tak, konwertuj złamania wiersza</key>
<key alias="convertLineBreaksHelp">Zamienia złamania wiersza na html-tag &amp;lt;br&amp;gt;</key>
<key alias="customFields">Niestandardowe Pola</key>
<key alias="dateOnly">Tak, tylko data</key>
<key alias="formatAndEncoding">Format i kodowanie</key>
<key alias="formatAsDate">Formatuj jako datę</key>
<key alias="formatAsDateDescr">Formatuj wartość jako datę lub jako datę i czas, zgodnie z aktywną kulturą</key>
<key alias="htmlEncode">Kodowanie HTML</key>
<key alias="htmlEncodeHelp">Zamienia znaki specjalne na ich odpowiedniki HTML</key>
<key alias="insertedAfter">Zostanie wstawione za wartością pola</key>
<key alias="insertedBefore">Zostanie wstawione przed wartością pola</key>
<key alias="lowercase">małe znaki</key>
<key alias="modifyOutput">Modyfikuj dane wyjściowe</key>
<key alias="none">Nic</key>
<key alias="outputSample">Próbka danych wyjściowych</key>
<key alias="postContent">Wstaw za polem</key>
<key alias="preContent">Wstaw przed polem</key>
<key alias="recursive">Rekurencyjne</key>
<key alias="recursiveDescr">Tak, spraw, aby było to rekurencyjne</key>
<key alias="separator">Separator</key>
<key alias="standardFields">Standardowe Pola</key>
<key alias="uppercase">Wielkie litery</key>
<key alias="urlEncode">Kodowanie URL</key>
@@ -1429,6 +1496,14 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
<key alias="validateAsUrl">Waliduj jako URL</key>
<key alias="enterCustomValidation">...lub wpisz niestandardową walidację</key>
<key alias="fieldIsMandatory">Pole jest wymagane</key>
<key alias="validationRegExp">Wprowadź wyrażenie regularne</key>
<key alias="minCount">Musisz dodać przynajmniej</key>
<key alias="maxCount">Możesz mieć jedynie</key>
<key alias="items">elementy</key>
<key alias="itemsSelected">wybrane elementy</key>
<key alias="invalidDate">Niepoprawna data</key>
<key alias="invalidNumber">To nie jest numer</key>
<key alias="invalidEmail">Niepoprawny e-mail</key>
</area>
<area alias="healthcheck">
<!-- Następujące klucze spowodują, że tokeny zostaną przekazane:
@@ -1472,8 +1547,10 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
<key alias="xmlDataIntegrityCheckMedia">Media - Suma XML: %0%, Suma: %1%, Suma niepoprawnych: %2%</key>
<key alias="xmlDataIntegrityCheckContent">Zawartość - Suma XML: %0%, Suma opublikowanych: %1%, Suma niepoprawnych: %2%</key>
<key alias="httpsCheckValidCertificate">Certifikat Twojej strony został oznaczony jako poprawny.</key>
<key alias="httpsCheckValidCertificate">Certifikat Twojej strony jest poprawny.</key>
<key alias="httpsCheckInvalidCertificate">Błąd walidacji certyfikatu: '%0%'</key>
<key alias="httpsCheckExpiredCertificate">Certyfikat SSL Twojej strony wygasł.</key>
<key alias="httpsCheckExpiringCertificate">Certyfikat SSL Twojej strony wygaśnie za %0% dni.</key>
<key alias="httpsCheckInvalidUrl">Błąd pingowania adresu URL %0% - '%1%'</key>
<key alias="httpsCheckIsCurrentSchemeHttps">Oglądasz %0% stronę używając HTTPS.</key>
<key alias="httpsCheckConfigurationRectifyNotPossible">appSetting 'umbracoUseSSL' został ustawiony na 'false' w Twoim pliku web.config. Po uzyskaniu dostępu do strony, używając HTTPS, powinieneś go ustawić na 'true'.</key>
@@ -1552,5 +1629,8 @@ Naciśnij przycisk <strong>instaluj</strong>, aby zainstalować bazę danych Umb
</area>
<area alias="emptyStates">
<key alias="emptyDictionaryTree">Brak elementów słownika do wyboru</key>
</area>
</area>
<area alias="textbox">
<key alias="characters_left">pozostało znaków</key>
</area>
</language>

View File

@@ -54,16 +54,17 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
/// </returns>
public override bool IsConverter(PublishedPropertyType propertyType)
{
if (UmbracoConfig.For.UmbracoSettings().Content.EnablePropertyValueConverters)
if (UmbracoConfig.For.UmbracoSettings().Content.EnablePropertyValueConverters && propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditors.MultipleMediaPickerAlias))
{
return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditors.MultipleMediaPickerAlias);
return true;
}
if (UmbracoConfig.For.UmbracoSettings().Content.EnablePropertyValueConverters)
if (UmbracoConfig.For.UmbracoSettings().Content.EnablePropertyValueConverters && propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditors.MediaPickerAlias))
{
// this is the double legacy media picker, it can pick only single media items
return propertyType.PropertyEditorAlias.Equals(Constants.PropertyEditors.MediaPickerAlias);
return true;
}
return false;
}
@@ -270,4 +271,4 @@ namespace Umbraco.Web.PropertyEditors.ValueConverters
Storages.Clear();
}
}
}
}

View File

@@ -10,6 +10,7 @@ using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.Services;
using Umbraco.Web.Models;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Web.Routing;
using ContentType = umbraco.cms.businesslogic.ContentType;
@@ -24,14 +25,24 @@ namespace Umbraco.Web
public static Guid GetKey(this IPublishedContent content)
{
var wrapped = content as PublishedContentWrapped;
while (wrapped != null)
{
content = wrapped.Unwrap();
wrapped = content as PublishedContentWrapped;
}
// fast
var contentWithKey = content as IPublishedContentWithKey;
return contentWithKey == null ? Guid.Empty : contentWithKey.Key;
if (contentWithKey != null) return contentWithKey.Key;
// try to unwrap (models...)
var contentWrapped = content as PublishedContentWrapped;
while (contentWrapped != null)
{
content = contentWrapped.Unwrap();
contentWrapped = content as PublishedContentWrapped;
}
// again
contentWithKey = content as IPublishedContentWithKey;
if (contentWithKey != null) return contentWithKey.Key;
LogHelper.Debug(typeof(PublishedContentExtensions), string.Format("Could not get key for IPublishedContent with id {0} of type {1}.", content.Id, content.GetType().FullName));
return Guid.Empty;
}
#endregion
@@ -628,23 +639,9 @@ namespace Umbraco.Web
/// <param name="recursive">When true, recurses up the content type tree to check inheritance; when false just calls IsDocumentType(this IPublishedContent content, string docTypeAlias).</param>
/// <returns>True if the content is of the specified content type or a derived content type; otherwise false.</returns>
public static bool IsDocumentType(this IPublishedContent content, string docTypeAlias, bool recursive)
{
if (content.IsDocumentType(docTypeAlias))
return true;
if (recursive)
return IsDocumentTypeRecursive(content, docTypeAlias);
return false;
}
private static bool IsDocumentTypeRecursive(IPublishedContent content, string docTypeAlias)
{
var contentTypeService = UmbracoContext.Current.Application.Services.ContentTypeService;
var type = contentTypeService.GetContentType(content.DocumentTypeAlias);
if (type.Alias.InvariantEquals(docTypeAlias) || content.IsComposedOf(docTypeAlias))
return true;
return false;
}
{
return content.DocumentTypeAlias.InvariantEquals(docTypeAlias) || (recursive && content.IsComposedOf(docTypeAlias));
}
public static bool IsNull(this IPublishedContent content, string alias, bool recurse)
{

View File

@@ -70,6 +70,7 @@ namespace Umbraco.Web.Routing
// test for collisions
var uri = new Uri(url.TrimEnd('/'), UriKind.RelativeOrAbsolute);
if (uri.IsAbsoluteUri == false) uri = uri.MakeAbsolute(UmbracoContext.Current.CleanedUmbracoUrl);
uri = UriUtility.UriToUmbraco(uri);
var pcr = new PublishedContentRequest(uri, UmbracoContext.Current.RoutingContext, UmbracoConfig.For.UmbracoSettings().WebRouting, s => Roles.Provider.GetRolesForUser(s));
pcr.Engine.TryRouteRequest();

View File

@@ -1,18 +1,21 @@
using System;
using System.IO;
using System.Linq;
using System.Net.Http.Formatting;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Web.Models.Trees;
using Umbraco.Core.Services;
using Umbraco.Web.Models.Trees;
using System.Web;
namespace Umbraco.Web.Trees
{
public abstract class FileSystemTreeController : TreeController
{
protected abstract string FilePath { get; }
protected abstract string FileSearchPattern { get; }
protected abstract IFileSystem2 FileSystem { get; }
protected abstract string[] Extensions { get; }
protected abstract string FileIcon { get; }
/// <summary>
/// Inheritors can override this method to modify the file node that is created.
@@ -28,64 +31,39 @@ namespace Umbraco.Web.Trees
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
var orgPath = "";
string path;
if (string.IsNullOrEmpty(id) == false && id != "-1")
{
orgPath = id;
path = IOHelper.MapPath(FilePath + "/" + orgPath);
orgPath += "/";
}
else
{
path = IOHelper.MapPath(FilePath);
}
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";
var dirInfo = new DirectoryInfo(path);
var dirInfos = dirInfo.GetDirectories();
var directories = FileSystem.GetDirectories(path);
var nodes = new TreeNodeCollection();
foreach (var dir in dirInfos)
foreach (var directory in directories)
{
if ((dir.Attributes & FileAttributes.Hidden) != 0)
continue;
var hasChildren = dir.GetFiles().Length > 0 || dir.GetDirectories().Length > 0;
var node = CreateTreeNode(orgPath + dir.Name, orgPath, queryStrings, dir.Name, "icon-folder", hasChildren);
var hasChildren = FileSystem.GetFiles(directory).Any() || FileSystem.GetDirectories(directory).Any();
var name = Path.GetFileName(directory);
var node = CreateTreeNode(HttpUtility.UrlEncode(directory), path, queryStrings, name, "icon-folder", hasChildren);
OnRenderFolderNode(ref node);
if (node != null)
if(node != null)
nodes.Add(node);
}
//this is a hack to enable file system tree to support multiple file extension look-up
//so the pattern both support *.* *.xml and xml,js,vb for lookups
var allowedExtensions = new string[0];
var filterByMultipleExtensions = FileSearchPattern.Contains(",");
FileInfo[] fileInfo;
if (filterByMultipleExtensions)
var files = FileSystem.GetFiles(path).Where(x =>
{
fileInfo = dirInfo.GetFiles();
allowedExtensions = FileSearchPattern.ToLower().Split(',');
}
else
fileInfo = dirInfo.GetFiles(FileSearchPattern);
var extension = Path.GetExtension(x);
return extension != null && Extensions.Contains(extension.Trim('.'), StringComparer.InvariantCultureIgnoreCase);
});
foreach (var file in fileInfo)
foreach (var file in files)
{
if ((file.Attributes & FileAttributes.Hidden) != 0)
continue;
if (filterByMultipleExtensions && Array.IndexOf(allowedExtensions, file.Extension.ToLower().Trim('.')) < 0)
continue;
var withoutExt = Path.GetFileNameWithoutExtension(file.Name);
if (withoutExt.IsNullOrWhiteSpace())
continue;
var node = CreateTreeNode(orgPath + file.Name, orgPath, queryStrings, file.Name, "icon-file", false);
var withoutExt = Path.GetFileNameWithoutExtension(file);
if (withoutExt.IsNullOrWhiteSpace()) continue;
var name = Path.GetFileName(file);
var node = CreateTreeNode(HttpUtility.UrlEncode(file), path, queryStrings, name, FileIcon, false);
OnRenderFileNode(ref node);
if (node != null)
nodes.Add(node);
@@ -111,27 +89,22 @@ namespace Umbraco.Web.Trees
return menu;
}
string path;
if (string.IsNullOrEmpty(id) == false)
{
var orgPath = System.Web.HttpUtility.UrlDecode(id);
path = IOHelper.MapPath(FilePath + "/" + orgPath);
}
else
{
path = IOHelper.MapPath(FilePath);
}
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";
var dirInfo = new DirectoryInfo(path);
//check if it's a directory
if (dirInfo.Attributes == FileAttributes.Directory)
var isFile = FileSystem.FileExists(path);
var isDirectory = FileSystem.DirectoryExists(path);
if (isDirectory)
{
//set the default to create
menu.DefaultMenuAlias = ActionNew.Instance.Alias;
//create action
menu.Items.Add<ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
var hasChildren = dirInfo.GetFiles().Length > 0 || dirInfo.GetDirectories().Length > 0;
var hasChildren = FileSystem.GetFiles(path).Any() || FileSystem.GetDirectories(path).Any();
//We can only delete folders if it doesn't have any children (folders or files)
if (hasChildren == false)
{
@@ -142,10 +115,9 @@ namespace Umbraco.Web.Trees
//refresh action
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
}
//if it's not a directory then we only allow to delete the item
else
else if (isFile)
{
//delete action
//if it's not a directory then we only allow to delete the item
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
}

View File

@@ -1,127 +0,0 @@
using System;
using System.IO;
using System.Linq;
using System.Net.Http.Formatting;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Core.Services;
using Umbraco.Web.Models.Trees;
using System.Web;
namespace Umbraco.Web.Trees
{
public abstract class FileSystemTreeController2 : TreeController
{
protected abstract IFileSystem2 FileSystem { get; }
protected abstract string[] Extensions { get; }
protected abstract string FileIcon { get; }
/// <summary>
/// Inheritors can override this method to modify the file node that is created.
/// </summary>
/// <param name="treeNode"></param>
protected virtual void OnRenderFileNode(ref TreeNode treeNode) { }
/// <summary>
/// Inheritors can override this method to modify the folder node that is created.
/// </summary>
/// <param name="treeNode"></param>
protected virtual void OnRenderFolderNode(ref TreeNode treeNode) { }
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
{
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";
var directories = FileSystem.GetDirectories(path);
var nodes = new TreeNodeCollection();
foreach (var directory in directories)
{
var hasChildren = FileSystem.GetFiles(directory).Any() || FileSystem.GetDirectories(directory).Any();
var name = Path.GetFileName(directory);
var node = CreateTreeNode(HttpUtility.UrlEncode(directory), path, queryStrings, name, "icon-folder", hasChildren);
OnRenderFolderNode(ref node);
if(node != null)
nodes.Add(node);
}
//this is a hack to enable file system tree to support multiple file extension look-up
//so the pattern both support *.* *.xml and xml,js,vb for lookups
var files = FileSystem.GetFiles(path).Where(x =>
{
var extension = Path.GetExtension(x);
return extension != null && Extensions.Contains(extension.Trim('.'), StringComparer.InvariantCultureIgnoreCase);
});
foreach (var file in files)
{
var withoutExt = Path.GetFileNameWithoutExtension(file);
if (withoutExt.IsNullOrWhiteSpace()) continue;
var name = Path.GetFileName(file);
var node = CreateTreeNode(HttpUtility.UrlEncode(file), path, queryStrings, name, FileIcon, false);
OnRenderFileNode(ref node);
if (node != null)
nodes.Add(node);
}
return nodes;
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
//if root node no need to visit the filesystem so lets just create the menu and return it
if (id == Constants.System.Root.ToInvariantString())
{
//set the default to create
menu.DefaultMenuAlias = ActionNew.Instance.Alias;
//create action
menu.Items.Add<ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
//refresh action
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
return menu;
}
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.Root.ToInvariantString()
? HttpUtility.UrlDecode(id).TrimStart("/")
: "";
var isFile = FileSystem.FileExists(path);
var isDirectory = FileSystem.DirectoryExists(path);
if (isDirectory)
{
//set the default to create
menu.DefaultMenuAlias = ActionNew.Instance.Alias;
//create action
menu.Items.Add<ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
var hasChildren = FileSystem.GetFiles(path).Any() || FileSystem.GetDirectories(path).Any();
//We can only delete folders if it doesn't have any children (folders or files)
if (hasChildren == false)
{
//delete action
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)), true);
}
//refresh action
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
}
else if (isFile)
{
//if it's not a directory then we only allow to delete the item
menu.Items.Add<ActionDelete>(Services.TextService.Localize(string.Format("actions/{0}", ActionDelete.Instance.Alias)));
}
return menu;
}
}
}

View File

@@ -8,7 +8,7 @@ namespace Umbraco.Web.Trees
/// Tree for displaying partial view macros in the developer app
/// </summary>
[Tree(Constants.Applications.Developer, "partialViewMacros", null, sortOrder: 6)]
public class PartialViewMacrosTreeController : FileSystemTreeController2
public class PartialViewMacrosTreeController : FileSystemTreeController
{
protected override IFileSystem2 FileSystem
{

View File

@@ -8,7 +8,7 @@ namespace Umbraco.Web.Trees
/// Tree for displaying partial views in the settings app
/// </summary>
[Tree(Constants.Applications.Settings, "partialViews", null, sortOrder: 2)]
public class PartialViewsTreeController : FileSystemTreeController2
public class PartialViewsTreeController : FileSystemTreeController
{
protected override IFileSystem2 FileSystem
{

View File

@@ -5,7 +5,7 @@ using Umbraco.Web.Models.Trees;
namespace Umbraco.Web.Trees
{
[Tree(Constants.Applications.Settings, "scripts", null, sortOrder: 4)]
public class ScriptTreeController : FileSystemTreeController2
public class ScriptTreeController : FileSystemTreeController
{
protected override IFileSystem2 FileSystem
{

View File

@@ -467,7 +467,6 @@
<Compile Include="SingletonHttpContextAccessor.cs" />
<Compile Include="Trees\ContentBlueprintTreeController.cs" />
<Compile Include="Trees\ContentTypeTreeController.cs" />
<Compile Include="Trees\FileSystemTreeController.cs" />
<Compile Include="Trees\PackagesTreeController.cs" />
<Compile Include="Trees\MediaTypeTreeController.cs" />
<Compile Include="Trees\MemberTypeTreeController.cs" />
@@ -722,7 +721,7 @@
<Compile Include="TagQuery.cs" />
<Compile Include="Trees\CoreTreeAttribute.cs" />
<Compile Include="Trees\DataTypeTreeController.cs" />
<Compile Include="Trees\FileSystemTreeController2.cs" />
<Compile Include="Trees\FileSystemTreeController.cs" />
<Compile Include="Trees\LanguageTreeController.cs" />
<Compile Include="Trees\LegacyBaseTreeAttribute.cs" />
<Compile Include="Trees\MemberTreeController.cs" />