Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 48786fcae1 | |||
| 28b4945d36 | |||
| 4a5314d8b9 | |||
| c67adcc43f | |||
| 0a43fea1c0 | |||
| a20b7f9303 | |||
| 5b9b6be383 | |||
| 40f6de950c | |||
| 916c350352 | |||
| 4186791d9a | |||
| 02cef43815 | |||
| 8d291efedd | |||
| a5c8052439 | |||
| 704169abab | |||
| 8ee8b52832 | |||
| 81819aa3b7 | |||
| 90ffae5526 | |||
| a3c99531bf | |||
| 1b6bf2f331 | |||
| fee217e8d7 | |||
| c05a28a901 | |||
| fa45cd1a88 | |||
| 6cb5331918 | |||
| fca865a743 | |||
| 1f313b9487 | |||
| 85d243508c | |||
| a74feab9eb | |||
| ae591d4883 | |||
| 71482f0fc9 | |||
| af5455a500 | |||
| be57692a62 | |||
| 460d884109 | |||
| 1a1a3c43ca | |||
| 6df6b87c4c |
@@ -16,7 +16,7 @@
|
||||
<tags>umbraco</tags>
|
||||
<dependencies>
|
||||
<dependency id="UmbracoCms.Core" version="[$version$]" />
|
||||
<dependency id="Newtonsoft.Json" version="[6.0.8, 9.0.0)" />
|
||||
<dependency id="Newtonsoft.Json" version="[6.0.8, 10.0.0)" />
|
||||
<dependency id="Umbraco.ModelsBuilder" version="[3.0.4, 4.0.0)" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
@@ -45,4 +45,4 @@
|
||||
<file src="tools\Views.Web.config.install.xdt" target="Views\Web.config.install.xdt" />
|
||||
<file src="build\**" target="build" />
|
||||
</files>
|
||||
</package>
|
||||
</package>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# Usage: on line 2 put the release version, on line 3 put the version comment (example: beta)
|
||||
7.5.1
|
||||
7.5.3
|
||||
+2
-2
@@ -11,5 +11,5 @@ using System.Resources;
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
[assembly: AssemblyFileVersion("7.5.1")]
|
||||
[assembly: AssemblyInformationalVersion("7.5.1")]
|
||||
[assembly: AssemblyFileVersion("7.5.3")]
|
||||
[assembly: AssemblyInformationalVersion("7.5.3")]
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration
|
||||
{
|
||||
public class UmbracoVersion
|
||||
{
|
||||
private static readonly Version Version = new Version("7.5.1");
|
||||
private static readonly Version Version = new Version("7.5.3");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current version of Umbraco.
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Services;
|
||||
|
||||
@@ -83,5 +80,19 @@ namespace Umbraco.Core.Models
|
||||
if (media == null) throw new ArgumentNullException("media");
|
||||
return HasPathAccess(media.Path, user.StartMediaId, Constants.System.RecycleBinMedia);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this user is an admin.
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <returns>
|
||||
/// <c>true</c> if this user is admin; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public static bool IsAdmin(this IUser user)
|
||||
{
|
||||
if (user == null) throw new ArgumentNullException("user");
|
||||
return user.UserType.Alias == "admin";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -413,6 +413,8 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
foreach (var property in entity.Properties)
|
||||
{
|
||||
if (keyDictionary.ContainsKey(property.PropertyTypeId) == false) continue;
|
||||
|
||||
property.Id = keyDictionary[property.PropertyTypeId];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -365,6 +365,8 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
foreach (var property in ((Member)entity).Properties)
|
||||
{
|
||||
if (keyDictionary.ContainsKey(property.PropertyTypeId) == false) continue;
|
||||
|
||||
property.Id = keyDictionary[property.PropertyTypeId];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ function packageResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"packageInstallApiBaseUrl",
|
||||
"Import"), package),
|
||||
'Failed to create package manifest for zip file ');
|
||||
'Failed to install package. Error during the step "Import" ');
|
||||
},
|
||||
|
||||
installFiles: function (package) {
|
||||
@@ -120,7 +120,7 @@ function packageResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"packageInstallApiBaseUrl",
|
||||
"InstallFiles"), package),
|
||||
'Failed to create package manifest for zip file ');
|
||||
'Failed to install package. Error during the step "InstallFiles" ');
|
||||
},
|
||||
|
||||
installData: function (package) {
|
||||
@@ -130,7 +130,7 @@ function packageResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"packageInstallApiBaseUrl",
|
||||
"InstallData"), package),
|
||||
'Failed to create package manifest for zip file ');
|
||||
'Failed to install package. Error during the step "InstallData" ');
|
||||
},
|
||||
|
||||
cleanUp: function (package) {
|
||||
@@ -140,7 +140,7 @@ function packageResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
umbRequestHelper.getApiUrl(
|
||||
"packageInstallApiBaseUrl",
|
||||
"CleanUp"), package),
|
||||
'Failed to create package manifest for zip file ');
|
||||
'Failed to install package. Error during the step "CleanUp" ');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -41,13 +41,13 @@
|
||||
'Failed to retrieve data for searching redirect urls');
|
||||
}
|
||||
|
||||
function isEnabled() {
|
||||
function getEnableState() {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"redirectUrlManagementApiBaseUrl",
|
||||
"IsEnabled")),
|
||||
"GetEnableState")),
|
||||
'Failed to retrieve data to check if the 301 redirect is enabled');
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
searchRedirectUrls: searchRedirectUrls,
|
||||
deleteRedirectUrl: deleteRedirectUrl,
|
||||
toggleUrlTracker: toggleUrlTracker,
|
||||
isEnabled: isEnabled
|
||||
getEnableState: getEnableState
|
||||
};
|
||||
|
||||
return resource;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<li class="span3" ng-repeat="pck in packages">
|
||||
<a href ng-click="setPackageAndContinue(pck.id)" class="thumbnail">
|
||||
<small>Loading...</small>
|
||||
<img ng-src="http://our.umbraco.org{{pck.thumbnail}}" alt="{{pck.name}}">
|
||||
<img ng-src="http://our.umbraco.org{{pck.thumbnail}}?width=170" alt="{{pck.name}}">
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -243,7 +243,7 @@ input.umb-table__input {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.umb-table-cell:first-of-type {
|
||||
.umb-table-cell:first-of-type:not(.not-fixed) {
|
||||
flex: 0 0 25px;
|
||||
|
||||
margin: 0 0 0 15px;
|
||||
|
||||
@@ -1,37 +1,96 @@
|
||||
/*
|
||||
|
||||
Flexbox
|
||||
|
||||
*/
|
||||
|
||||
.flex { display: flex; }
|
||||
.flex-inline { display: inline-flex; }
|
||||
|
||||
.flex { display: flex }
|
||||
.flex-column { flex-direction: column; }
|
||||
.flex-wrap { flex-wrap: wrap; }
|
||||
|
||||
.flex-column { flex-direction: column }
|
||||
.flex-wrap { flex-wrap: wrap }
|
||||
.items-start { align-items: flex-start; }
|
||||
.items-end { align-items: flex-end; }
|
||||
.items-center { align-items: center; }
|
||||
.items-baseline { align-items: baseline; }
|
||||
.items-stretch { align-items: stretch; }
|
||||
|
||||
.items-start { align-items: flex-start }
|
||||
.items-end { align-items: flex-end }
|
||||
.items-center { align-items: center }
|
||||
.items-baseline { align-items: baseline }
|
||||
.items-stretch { align-items: stretch }
|
||||
.self-start { align-self: flex-start; }
|
||||
.self-end { align-self: flex-end; }
|
||||
.self-center { align-self: center; }
|
||||
.self-baseline { align-self: baseline; }
|
||||
.self-stretch { align-self: stretch; }
|
||||
|
||||
.self-start { align-self: flex-start }
|
||||
.self-end { align-self: flex-end }
|
||||
.self-center { align-self: center }
|
||||
.self-baseline { align-self: baseline }
|
||||
.self-stretch { align-self: stretch }
|
||||
.justify-start { justify-content: flex-start; }
|
||||
.justify-end { justify-content: flex-end; }
|
||||
.justify-center { justify-content: center; }
|
||||
.justify-between { justify-content: space-between; }
|
||||
.justify-around { justify-content: space-around; }
|
||||
|
||||
.justify-start { justify-content: flex-start }
|
||||
.justify-end { justify-content: flex-end }
|
||||
.justify-center { justify-content: center }
|
||||
.justify-between { justify-content: space-between }
|
||||
.justify-around { justify-content: space-around }
|
||||
.content-start { align-content: flex-start; }
|
||||
.content-end { align-content: flex-end; }
|
||||
.content-center { align-content: center; }
|
||||
.content-between { align-content: space-between; }
|
||||
.content-around { align-content: space-around; }
|
||||
.content-stretch { align-content: stretch; }
|
||||
|
||||
.content-start { align-content: flex-start }
|
||||
.content-end { align-content: flex-end }
|
||||
.content-center { align-content: center }
|
||||
.content-between { align-content: space-between }
|
||||
.content-around { align-content: space-around }
|
||||
.content-stretch { align-content: stretch }
|
||||
.flx-i {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
|
||||
.flx-g0 {
|
||||
flex-grow: 0;
|
||||
}
|
||||
.flx-g1 {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.flx-s0 {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.flx-s1 {
|
||||
flex-shrink: 1;
|
||||
}
|
||||
|
||||
|
||||
.flx-b0 {
|
||||
flex-basis: 0%;
|
||||
}
|
||||
.flx-b1 {
|
||||
flex-basis: 10%;
|
||||
}
|
||||
.flx-b2 {
|
||||
flex-basis: 20%;
|
||||
}
|
||||
.flx-b3 {
|
||||
flex-basis: 30%;
|
||||
}
|
||||
.flx-b4 {
|
||||
flex-basis: 40%;
|
||||
}
|
||||
.flx-b5 {
|
||||
flex-basis: 50%;
|
||||
}
|
||||
.flx-b6 {
|
||||
flex-basis: 60%;
|
||||
}
|
||||
.flx-b7 {
|
||||
flex-basis: 70%;
|
||||
}
|
||||
.flx-b8 {
|
||||
flex-basis: 80%;
|
||||
}
|
||||
.flx-b9 {
|
||||
flex-basis: 90%;
|
||||
}
|
||||
.flx-b10 {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
.flx-ba {
|
||||
flex-basis: auto;
|
||||
}
|
||||
|
||||
/* 1. Fix for Chrome 44 bug. https://code.google.com/p/chromium/issues/detail?id=506893 */
|
||||
.flex-auto {
|
||||
@@ -40,4 +99,4 @@
|
||||
min-height: 0; /* 1 */
|
||||
}
|
||||
|
||||
.flex-none { flex: none }
|
||||
.flex-none { flex: none; }
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
</div>
|
||||
|
||||
<!-- List of uploading/uploaded files -->
|
||||
<ul class="file-list" ng-show="done.length > 0 || queue.length > 0 || rejected.length > 0">
|
||||
<ul class="file-list" ng-show="done.length > 0 || queue.length > 0 || rejected.length > 0 || filesHolder.length > 0">
|
||||
|
||||
<!-- make list sort order the same as photo grid. The last uploaded photo in the top -->
|
||||
<li class="file" ng-repeat="file in done">
|
||||
|
||||
+40
-35
@@ -1,7 +1,7 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
function RedirectUrlsController($scope, redirectUrlsResource, notificationsService, $q) {
|
||||
function RedirectUrlsController($scope, redirectUrlsResource, notificationsService, localizationService, $q) {
|
||||
//...todo
|
||||
//search by url or url part
|
||||
//search by domain
|
||||
@@ -14,7 +14,8 @@
|
||||
vm.dashboard = {
|
||||
searchTerm: "",
|
||||
loading: false,
|
||||
urlTrackerDisabled: false
|
||||
urlTrackerDisabled: false,
|
||||
userIsAdmin: false
|
||||
};
|
||||
|
||||
vm.pagination = {
|
||||
@@ -40,8 +41,9 @@
|
||||
|
||||
function checkEnabled() {
|
||||
vm.dashboard.loading = true;
|
||||
return redirectUrlsResource.isEnabled().then(function (response) {
|
||||
vm.dashboard.urlTrackerDisabled = response !== "true";
|
||||
return redirectUrlsResource.getEnableState().then(function (response) {
|
||||
vm.dashboard.urlTrackerDisabled = response.enabled !== true;
|
||||
vm.dashboard.userIsAdmin = response.userIsAdmin;
|
||||
vm.dashboard.loading = false;
|
||||
});
|
||||
}
|
||||
@@ -76,53 +78,56 @@
|
||||
}
|
||||
|
||||
function removeRedirect(redirectToDelete) {
|
||||
var toggleConfirm = confirm('Are you sure you want to remove the redirect from ' + '"' + redirectToDelete.originalUrl + '"' + " to " + '"' + redirectToDelete.destinationUrl + '"' + " ?");
|
||||
localizationService.localize("redirectUrls_confirmRemove", [redirectToDelete.originalUrl, redirectToDelete.destinationUrl]).then(function (value) {
|
||||
var toggleConfirm = confirm(value);
|
||||
|
||||
if (toggleConfirm) {
|
||||
redirectUrlsResource.deleteRedirectUrl(redirectToDelete.redirectId).then(function () {
|
||||
if (toggleConfirm) {
|
||||
redirectUrlsResource.deleteRedirectUrl(redirectToDelete.redirectId).then(function () {
|
||||
|
||||
var index = vm.redirectUrls.indexOf(redirectToDelete);
|
||||
vm.redirectUrls.splice(index, 1);
|
||||
notificationsService.success("Redirect Url Removed!", "Redirect Url has been deleted");
|
||||
var index = vm.redirectUrls.indexOf(redirectToDelete);
|
||||
vm.redirectUrls.splice(index, 1);
|
||||
notificationsService.success(localizationService.localize("redirectUrls_redirectRemoved"));
|
||||
|
||||
// check if new redirects needs to be loaded
|
||||
if(vm.redirectUrls.length === 0 && vm.pagination.totalPages > 1) {
|
||||
// check if new redirects needs to be loaded
|
||||
if (vm.redirectUrls.length === 0 && vm.pagination.totalPages > 1) {
|
||||
|
||||
// if we are not on the first page - get records from the previous
|
||||
if(vm.pagination.pageIndex > 0 ) {
|
||||
vm.pagination.pageIndex = vm.pagination.pageIndex - 1;
|
||||
vm.pagination.pageNumber = vm.pagination.pageNumber - 1;
|
||||
// if we are not on the first page - get records from the previous
|
||||
if (vm.pagination.pageIndex > 0) {
|
||||
vm.pagination.pageIndex = vm.pagination.pageIndex - 1;
|
||||
vm.pagination.pageNumber = vm.pagination.pageNumber - 1;
|
||||
}
|
||||
|
||||
search();
|
||||
}
|
||||
|
||||
search();
|
||||
}
|
||||
|
||||
}, function(error) {
|
||||
notificationsService.error("Redirect Url Error!", "Redirect Url was not deleted");
|
||||
});
|
||||
}
|
||||
}, function (error) {
|
||||
notificationsService.error(localizationService.localize("redirectUrls_redirectRemoveError"));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function disableUrlTracker() {
|
||||
var toggleConfirm = confirm("Are you sure you want to disable the URL tracker?");
|
||||
if (toggleConfirm) {
|
||||
localizationService.localize("redirectUrls_confirmDisable").then(function(value) {
|
||||
var toggleConfirm = confirm(value);
|
||||
if (toggleConfirm) {
|
||||
|
||||
redirectUrlsResource.toggleUrlTracker(true).then(function() {
|
||||
activate();
|
||||
notificationsService.success("URL Tracker has now been disabled");
|
||||
}, function(error) {
|
||||
notificationsService.warning("Error disabling the URL Tracker, more information can be found in your log file.");
|
||||
});
|
||||
redirectUrlsResource.toggleUrlTracker(true).then(function () {
|
||||
activate();
|
||||
notificationsService.success(localizationService.localize("redirectUrls_disabledConfirm"));
|
||||
}, function (error) {
|
||||
notificationsService.warning(localizationService.localize("redirectUrls_disableError"));
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function enableUrlTracker() {
|
||||
redirectUrlsResource.toggleUrlTracker(false).then(function() {
|
||||
activate();
|
||||
notificationsService.success("URL Tracker has now been enabled");
|
||||
notificationsService.success(localizationService.localize("redirectUrls_enabledConfirm"));
|
||||
}, function(error) {
|
||||
notificationsService.warning("Error enabling the URL Tracker, more information can be found in your log file.");
|
||||
notificationsService.warning(localizationService.localize("redirectUrls_enableError"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
<umb-editor-sub-header-content-right>
|
||||
|
||||
<umb-editor-sub-header-section>
|
||||
<umb-editor-sub-header-section ng-if="vm.dashboard.userIsAdmin === true">
|
||||
|
||||
<button
|
||||
ng-if="vm.dashboard.urlTrackerDisabled === false"
|
||||
type="button"
|
||||
class="umb-era-button umb-button--s"
|
||||
ng-click="vm.disableUrlTracker()">
|
||||
<span>Disable URL Tracker</span>
|
||||
<span><localize key="redirectUrls_disableUrlTracker">Disable URL Tracker</localize></span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
@@ -21,7 +21,7 @@
|
||||
type="button"
|
||||
class="umb-era-button umb-button--s -blue"
|
||||
ng-click="vm.enableUrlTracker()">
|
||||
<span>Enable URL Tracker</span>
|
||||
<span><localize key="redirectUrls_enableUrlTracker">Enable URL Tracker</localize></span>
|
||||
</button>
|
||||
|
||||
</umb-editor-sub-header-section>
|
||||
@@ -53,11 +53,9 @@
|
||||
|
||||
<div class="umb-table-head">
|
||||
<div class="umb-table-row">
|
||||
<div class="umb-table-cell"></div>
|
||||
<div class="umb-table-cell">Original Url</div>
|
||||
<div class="umb-table-cell">Redirected To</div>
|
||||
<div class="umb-table-cell">Date Created</div>
|
||||
<div class="umb-table-cell"></div>
|
||||
<div class="umb-table-cell not-fixed flx-s1 flx-g1 flx-b4"><localize key="redirectUrls_originalUrl">Original URL</localize></div>
|
||||
<div class="umb-table-cell flx-s0 flx-g0" style="flex-basis: 20px;"></div>
|
||||
<div class="umb-table-cell flx-s1 flx-g1 flx-b6"><localize key="redirectUrls_redirectedTo">Redirected To</localize></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,25 +63,21 @@
|
||||
|
||||
<div class="umb-table-row -solid" ng-repeat="redirectUrl in vm.redirectUrls">
|
||||
|
||||
<div class="umb-table-cell">
|
||||
<i class="umb-table-body__icon umb-table-body__fileicon icon-shuffle"></i>
|
||||
</div>
|
||||
|
||||
<div class="umb-table-cell">
|
||||
<div class="umb-table-cell not-fixed flx-s1 flx-g1 flx-b4">
|
||||
<a class="umb-table-body__link" href="{{redirectUrl.originalUrl}}" target="_blank" title="{{redirectUrl.originalUrl}}">{{redirectUrl.originalUrl}}</a>
|
||||
</div>
|
||||
|
||||
<div class="umb-table-cell">
|
||||
<a class="umb-table-body__link" href="{{redirectUrl.destinationUrl}}" target="_blank" title="{{redirectUrl.destinationUrl}}">{{redirectUrl.destinationUrl}}</a>
|
||||
<div class="umb-table-cell flx-s0 flx-g0" style="flex-basis: 20px;">
|
||||
<i class="umb-table-body__icon umb-table-body__fileicon icon-arrow-right" style="font-size: 12px; line-height: 1;"></i>
|
||||
</div>
|
||||
|
||||
<div class="umb-table-cell">
|
||||
{{redirectUrl.createDateUtc | date:'medium'}}
|
||||
</div>
|
||||
<div class="umb-table-cell flx-s1 flx-g1 flx-b6 items-center">
|
||||
<div class="flx-s1 flx-g1 flx-b0" style="margin-right: 20px;">
|
||||
<a class="umb-table-body__link" href="{{redirectUrl.destinationUrl}}" target="_blank" title="{{redirectUrl.destinationUrl}}">{{redirectUrl.destinationUrl}}</a>
|
||||
</div>
|
||||
|
||||
<div class="umb-table-cell justify-end">
|
||||
<a href="/umbraco/#/content/content/edit/{{redirectUrl.contentId}}" class="umb-era-button -gray umb-button--s" style="margin-right: 10px;">Edit</a>
|
||||
<button type="button" class="umb-era-button -gray umb-button--s" ng-click="vm.removeRedirect(redirectUrl)">Remove</button>
|
||||
<button type="button" class="umb-era-button -gray umb-button--s" ng-click="vm.removeRedirect(redirectUrl)"><localize key="redirectUrls_removeButton">Remove</localize></button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -95,8 +89,8 @@
|
||||
<umb-empty-state
|
||||
ng-if="vm.redirectUrls.length === 0 && vm.dashboard.searchTerm.length === 0 && !vm.dashboard.loading"
|
||||
position="center">
|
||||
<div>No redirects have been made</div>
|
||||
<small class="faded">When a published page gets renamed a redirect will automatically be made to the new page</small>
|
||||
<div><localize key="redirectUrls_noRedirects">No redirects have been made</localize></div>
|
||||
<small class="faded"><localize key="redirectUrls_noRedirectsDescription">When a published page gets renamed or moved a redirect will automatically be made to the new page</localize></small>
|
||||
</umb-empty-state>
|
||||
|
||||
<umb-empty-state
|
||||
|
||||
@@ -2412,9 +2412,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
|
||||
<WebProjectProperties>
|
||||
<UseIIS>True</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>7510</DevelopmentServerPort>
|
||||
<DevelopmentServerPort>7530</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>http://localhost:7510</IISUrl>
|
||||
<IISUrl>http://localhost:7530</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
|
||||
@@ -104,7 +104,7 @@
|
||||
</section>
|
||||
<section alias="RedirectUrlManagement">
|
||||
<areas>
|
||||
<area>developer</area>
|
||||
<area>content</area>
|
||||
</areas>
|
||||
<tab caption="Redirect URL Management">
|
||||
<control>
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
</section>
|
||||
<section alias="RedirectUrlManagement">
|
||||
<areas>
|
||||
<area>developer</area>
|
||||
<area>content</area>
|
||||
</areas>
|
||||
<tab caption="Redirect URL Management">
|
||||
<control>
|
||||
|
||||
@@ -1416,4 +1416,21 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="notificationEmailsCheckSuccessMessage"><![CDATA[Notification email has been set to <strong>%0%</strong>.]]></key>
|
||||
<key alias="notificationEmailsCheckErrorMessage"><![CDATA[Notification email is still set to the default value of <strong>%0%</strong>.]]></key>
|
||||
</area>
|
||||
<area alias="redirectUrls">
|
||||
<key alias="disableUrlTracker">Disable URL tracker</key>
|
||||
<key alias="enableUrlTracker">Enable URL tracker</key>
|
||||
<key alias="originalUrl">Original URL</key>
|
||||
<key alias="redirectedTo">Redirected To</key>
|
||||
<key alias="noRedirects">No redirects have been made</key>
|
||||
<key alias="noRedirectsDescription">When a published page gets renamed or moved a redirect will automatically be made to the new page.</key>
|
||||
<key alias="removeButton">Remove</key>
|
||||
<key alias="confirmRemove">Are you sure you want to remove the redirect from '%0%' to '%1%'?</key>
|
||||
<key alias="redirectRemoved">Redirect URL removed.</key>
|
||||
<key alias="redirectRemoveError">Error removing redirect URL.</key>
|
||||
<key alias="confirmDisable">Are you sure you want to disable the URL tracker?</key>
|
||||
<key alias="disabledConfirm">URL tracker has now been disabled.</key>
|
||||
<key alias="disableError">Error disabling the URL tracker, more information can be found in your log file.</key>
|
||||
<key alias="enabledConfirm">URL tracker has now been enabled.</key>
|
||||
<key alias="enableError">Error enabling the URL tracker, more information can be found in your log file.</key>
|
||||
</area>
|
||||
</language>
|
||||
|
||||
@@ -1420,4 +1420,21 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="notificationEmailsCheckSuccessMessage"><![CDATA[Notification email has been set to <strong>%0%</strong>.]]></key>
|
||||
<key alias="notificationEmailsCheckErrorMessage"><![CDATA[Notification email is still set to the default value of <strong>%0%</strong>.]]></key>
|
||||
</area>
|
||||
<area alias="redirectUrls">
|
||||
<key alias="disableUrlTracker">Disable URL tracker</key>
|
||||
<key alias="enableUrlTracker">Enable URL tracker</key>
|
||||
<key alias="originalUrl">Original URL</key>
|
||||
<key alias="redirectedTo">Redirected To</key>
|
||||
<key alias="noRedirects">No redirects have been made</key>
|
||||
<key alias="noRedirectsDescription">When a published page gets renamed or moved a redirect will automatically be made to the new page.</key>
|
||||
<key alias="removeButton">Remove</key>
|
||||
<key alias="confirmRemove">Are you sure you want to remove the redirect from '%0%' to '%1%'?</key>
|
||||
<key alias="redirectRemoved">Redirect URL removed.</key>
|
||||
<key alias="redirectRemoveError">Error removing redirect URL.</key>
|
||||
<key alias="confirmDisable">Are you sure you want to disable the URL tracker?</key>
|
||||
<key alias="disabledConfirm">URL tracker has now been disabled.</key>
|
||||
<key alias="disableError">Error disabling the URL tracker, more information can be found in your log file.</key>
|
||||
<key alias="enabledConfirm">URL tracker has now been enabled.</key>
|
||||
<key alias="enableError">Error enabling the URL tracker, more information can be found in your log file.</key>
|
||||
</area>
|
||||
</language>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
<umb:CssInclude ID="CssInclude2" runat="server" FilePath="css/permissionsEditor.css" PathNameAlias="UmbracoRoot" />
|
||||
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="css/umbracoGui.css" PathNameAlias="UmbracoRoot" />
|
||||
<umb:JsInclude ID="JsInclude1" runat="server" FilePath="PermissionsEditor.js" />
|
||||
<umb:JsInclude ID="JsInclude2" runat="server" FilePath="../lib/jquery-migrate/jquery-migrate.min.js" />
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
|
||||
@@ -122,7 +122,8 @@
|
||||
$(function () {
|
||||
$.tree.plugins.contextmenu.object.hide().appendTo("body");
|
||||
$("a", $.tree.plugins.contextmenu.object[0])
|
||||
.on("click", function (event) {
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("click", function (event) {
|
||||
if (!$(this).hasClass("disabled")) {
|
||||
$.tree.plugins.contextmenu.exec.apply(null, [$(this).attr("rel")]);
|
||||
$.tree.plugins.contextmenu.hide();
|
||||
|
||||
@@ -395,7 +395,8 @@
|
||||
//** THIS IS A MODIFICATION TO JSTREE, IN FIREFOX THE ORIGINAL CONTEXT OF THIS SELECTOR IS LOST IN THE TINY MCE OVERLAY
|
||||
//$("li", this.container.get(0))
|
||||
$("#" + this.container.attr("id") + " li")
|
||||
.on("click", function (event) { // WHEN CLICK IS ON THE ARROW
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("click", function (event) { // WHEN CLICK IS ON THE ARROW
|
||||
if (event.target.tagName != "LI") return true;
|
||||
_this.off_height();
|
||||
if (event.pageY - $(event.target).offset().top > _this.li_height) return true;
|
||||
@@ -404,7 +405,8 @@
|
||||
return false;
|
||||
});
|
||||
$("a", this.container.get(0))
|
||||
.on("click", function (event) { // WHEN CLICK IS ON THE TEXT OR ICON
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("click", function (event) { // WHEN CLICK IS ON THE TEXT OR ICON
|
||||
if (event.which && event.which == 3) return true;
|
||||
if (_this.locked) {
|
||||
event.preventDefault();
|
||||
@@ -417,7 +419,8 @@
|
||||
event.target.blur();
|
||||
return false;
|
||||
})
|
||||
.on("dblclick", function (event) { // WHEN DOUBLECLICK ON TEXT OR ICON
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("dblclick", function (event) { // WHEN DOUBLECLICK ON TEXT OR ICON
|
||||
if (_this.locked) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -429,14 +432,16 @@
|
||||
event.stopPropagation();
|
||||
event.target.blur();
|
||||
})
|
||||
.on("contextmenu", function (event) {
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("contextmenu", function (event) {
|
||||
if (_this.locked) {
|
||||
event.target.blur();
|
||||
return _this.error("LOCKED");
|
||||
}
|
||||
return _this.callback("onrgtclk", [_this.get_node(event.target).get(0), _this, event]);
|
||||
})
|
||||
.on("mouseover", function (event) {
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("mouseover", function (event) {
|
||||
if (_this.locked) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
@@ -448,7 +453,8 @@
|
||||
}
|
||||
_this.callback("onhover", [_this.get_node(event.target).get(0), _this]);
|
||||
})
|
||||
.on("mousedown", function (event) {
|
||||
//has to be .live, do not change to .on, it doesn't work
|
||||
.live("mousedown", function (event) {
|
||||
if (_this.settings.rules.drag_button == "left" && event.which && event.which != 1) return true;
|
||||
if (_this.settings.rules.drag_button == "right" && event.which && event.which != 3) return true;
|
||||
_this.focus.apply(_this);
|
||||
|
||||
@@ -226,7 +226,7 @@ namespace Umbraco.Web.Editors
|
||||
//API URLs
|
||||
{
|
||||
"redirectUrlManagementApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<RedirectUrlManagementController>(
|
||||
controller => controller.IsEnabled())
|
||||
controller => controller.GetEnableState())
|
||||
},
|
||||
{
|
||||
"embedApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl<RteEmbedController>(
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Http;
|
||||
using System.Xml;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using umbraco.businesslogic.Exceptions;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi;
|
||||
@@ -22,9 +24,11 @@ namespace Umbraco.Web.Editors
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public bool IsEnabled()
|
||||
public IHttpActionResult GetEnableState()
|
||||
{
|
||||
return UmbracoConfig.For.UmbracoSettings().WebRouting.DisableRedirectUrlTracking == false;
|
||||
var enabled = UmbracoConfig.For.UmbracoSettings().WebRouting.DisableRedirectUrlTracking == false;
|
||||
var userIsAdmin = Umbraco.UmbracoContext.Security.CurrentUser.IsAdmin();
|
||||
return Ok(new { enabled, userIsAdmin });
|
||||
}
|
||||
|
||||
//add paging
|
||||
@@ -65,6 +69,15 @@ namespace Umbraco.Web.Editors
|
||||
[HttpPost]
|
||||
public IHttpActionResult ToggleUrlTracker(bool disable)
|
||||
{
|
||||
var userIsAdmin = Umbraco.UmbracoContext.Security.CurrentUser.IsAdmin();
|
||||
if (userIsAdmin == false)
|
||||
{
|
||||
var errorMessage = string.Format("User of type {0} is not allowed to toggle the URL tracker",
|
||||
Umbraco.UmbracoContext.Security.CurrentUser.UserType.Alias);
|
||||
LogHelper.Debug<RedirectUrlManagementController>(errorMessage);
|
||||
throw new UserAuthorizationException(errorMessage);
|
||||
}
|
||||
|
||||
var httpContext = TryGetHttpContext();
|
||||
if (httpContext.Success == false) throw new InvalidOperationException("Cannot acquire HttpContext");
|
||||
var configFilePath = httpContext.Result.Server.MapPath("~/config/umbracoSettings.config");
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http.Filters;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Mvc;
|
||||
|
||||
@@ -20,7 +18,7 @@ namespace Umbraco.Web.Editors
|
||||
{
|
||||
var updChkCookie = Request.Headers.GetCookies("UMB_UPDCHK").FirstOrDefault();
|
||||
var updateCheckCookie = updChkCookie != null ? updChkCookie["UMB_UPDCHK"].Value : "";
|
||||
if (GlobalSettings.VersionCheckPeriod > 0 && string.IsNullOrEmpty(updateCheckCookie) && Security.CurrentUser.UserType.Alias == "admin")
|
||||
if (GlobalSettings.VersionCheckPeriod > 0 && string.IsNullOrEmpty(updateCheckCookie) && Security.CurrentUser.IsAdmin())
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -44,6 +44,10 @@ namespace Umbraco.Web.Install.Controllers
|
||||
|
||||
if (ApplicationContext.Current.IsUpgrading)
|
||||
{
|
||||
// Update ClientDependency version
|
||||
var clientDependencyConfig = new ClientDependencyConfiguration(ApplicationContext.Current.ProfilingLogger.Logger);
|
||||
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
|
||||
|
||||
var result = _umbracoContext.Security.ValidateCurrentUser(false);
|
||||
|
||||
switch (result)
|
||||
|
||||
@@ -49,10 +49,6 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
|
||||
// Update configurationStatus
|
||||
GlobalSettings.ConfigurationStatus = UmbracoVersion.GetSemanticVersion().ToSemanticString();
|
||||
|
||||
// Update ClientDependency version
|
||||
var clientDependencyConfig = new ClientDependencyConfiguration(_applicationContext.ProfilingLogger.Logger);
|
||||
var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber();
|
||||
|
||||
//reports the ended install
|
||||
ih.InstallStatus(true, "");
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using AutoMapper;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Mapping;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using umbraco.BusinessLogic;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
@@ -15,7 +18,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext)
|
||||
{
|
||||
config.CreateMap<IRedirectUrl, ContentRedirectUrl>()
|
||||
.ForMember(x => x.OriginalUrl, expression => expression.MapFrom(item => item.Url))
|
||||
.ForMember(x => x.OriginalUrl, expression => expression.MapFrom(item => UmbracoContext.Current.UrlProvider.GetUrlFromRoute(item.ContentId, item.Url)))
|
||||
.ForMember(x => x.DestinationUrl, expression => expression.Ignore())
|
||||
.ForMember(x => x.RedirectId, expression => expression.MapFrom(item => item.Key));
|
||||
|
||||
|
||||
@@ -52,7 +52,11 @@ namespace Umbraco.Web.Routing
|
||||
// will not use cache if previewing
|
||||
var route = umbracoContext.ContentCache.GetRouteById(id);
|
||||
|
||||
return GetUrlFromRoute(route, umbracoContext, id, current, mode);
|
||||
}
|
||||
|
||||
internal string GetUrlFromRoute(string route, UmbracoContext umbracoContext, int id, Uri current, UrlProviderMode mode)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(route))
|
||||
{
|
||||
LogHelper.Debug<DefaultUrlProvider>(
|
||||
@@ -75,7 +79,7 @@ namespace Umbraco.Web.Routing
|
||||
// route is /<path> or <domainRootId>/<path>
|
||||
var pos = route.IndexOf('/');
|
||||
var path = pos == 0 ? route : route.Substring(pos);
|
||||
var domainUri = pos == 0
|
||||
var domainUri = pos == 0
|
||||
? null
|
||||
: domainHelper.DomainForNode(int.Parse(route.Substring(0, pos)), current);
|
||||
|
||||
|
||||
@@ -589,13 +589,10 @@ namespace Umbraco.Web.Routing
|
||||
/// <summary>
|
||||
/// Gets or sets the <c>System.Web.HttpCacheability</c>
|
||||
/// </summary>
|
||||
/// <remarks>Is set to <c>System.Web.HttpCacheability.Private</c> by default, which is the ASP.NET default.</remarks>
|
||||
private HttpCacheability _cacheability = HttpCacheability.Private;
|
||||
internal HttpCacheability Cacheability
|
||||
{
|
||||
get { return _cacheability; }
|
||||
set { _cacheability = value; }
|
||||
}
|
||||
// Note: we used to set a default value here but that would then be the default
|
||||
// for ALL requests, we shouldn't overwrite it though if people are using [OutputCache] for example
|
||||
// see: https://our.umbraco.org/forum/using-umbraco-and-getting-started/79715-output-cache-in-umbraco-752
|
||||
internal HttpCacheability Cacheability { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a list of Extensions to append to the Response.Cache object
|
||||
|
||||
@@ -147,6 +147,15 @@ namespace Umbraco.Web.Routing
|
||||
return url ?? "#"; // legacy wants this
|
||||
}
|
||||
|
||||
internal string GetUrlFromRoute(int id, string route)
|
||||
{
|
||||
var provider = _urlProviders.OfType<DefaultUrlProvider>().FirstOrDefault();
|
||||
var url = provider == null
|
||||
? route // what else?
|
||||
: provider.GetUrlFromRoute(route, UmbracoContext.Current, id, _umbracoContext.CleanedUmbracoUrl, Mode);
|
||||
return url ?? "#";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GetOtherUrls
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace Umbraco.Web.UI.Bundles
|
||||
/// </summary>
|
||||
[ClientDependency(ClientDependencyType.Javascript, "ui/jquery.js", "UmbracoClient", Priority = 0, Group = 1)]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient", Priority = 1, Group = 1)]
|
||||
[ClientDependency(ClientDependencyType.Javascript, "lib/jquery-migrate/jquery-migrate.min.js", "UmbracoRoot", Priority = 2, Group = 1)]
|
||||
public class JsJQueryCore : Control
|
||||
{
|
||||
}
|
||||
|
||||
@@ -324,7 +324,8 @@ namespace Umbraco.Web
|
||||
() => pcr.IsRedirect ? (pcr.IsRedirectPermanent ? "permanent" : "redirect") : "none",
|
||||
() => pcr.Is404 ? "true" : "false", () => pcr.ResponseStatusCode);
|
||||
|
||||
response.Cache.SetCacheability(pcr.Cacheability);
|
||||
if(pcr.Cacheability != default(HttpCacheability))
|
||||
response.Cache.SetCacheability(pcr.Cacheability);
|
||||
|
||||
foreach (var cacheExtension in pcr.CacheExtensions)
|
||||
response.Cache.AppendCacheExtension(cacheExtension);
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<umbraco:TreeControl runat="server" ID="JTree" App="content"
|
||||
Mode="Checkbox" CssClass="clearfix"></umbraco:TreeControl>
|
||||
</div>
|
||||
<div id="permissionsPanel">
|
||||
|
||||
<div id="permissionsPanel" style="margin-top: -35px">
|
||||
<user:NodePermissions ID="nodePermissions" runat="server" />
|
||||
</div>
|
||||
|
||||
|
||||
@@ -184,9 +184,10 @@ namespace umbraco.BusinessLogic
|
||||
/// <returns>
|
||||
/// <c>true</c> if this user is admin; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
[Obsolete("Use Umbraco.Core.Models.IsAdmin extension method instead", false)]
|
||||
public bool IsAdmin()
|
||||
{
|
||||
return UserType.Alias == "admin";
|
||||
return UserEntity.IsAdmin();
|
||||
}
|
||||
|
||||
[Obsolete("Do not use this method to validate credentials, use the user's membership provider to do authentication. This method will not work if the password format is 'Encrypted'")]
|
||||
|
||||
@@ -12,10 +12,8 @@ using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Packaging;
|
||||
using umbraco.cms.businesslogic.web;
|
||||
using umbraco.cms.businesslogic.propertytype;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Diagnostics;
|
||||
using System.Security;
|
||||
using umbraco.cms.businesslogic.macro;
|
||||
using umbraco.cms.businesslogic.template;
|
||||
using umbraco.interfaces;
|
||||
@@ -188,8 +186,16 @@ namespace umbraco.cms.businesslogic.packager
|
||||
// Check if the file is a valid package
|
||||
if (fi.Extension.ToLower() == ".umb")
|
||||
{
|
||||
tempDir = UnPack(fi.FullName, deleteFile);
|
||||
LoadConfig(tempDir);
|
||||
try
|
||||
{
|
||||
tempDir = UnPack(fi.FullName, deleteFile);
|
||||
LoadConfig(tempDir);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Error<Installer>(string.Format("Error importing file {0}", fi.FullName), exception);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
else
|
||||
throw new Exception("Error - file isn't a package (doesn't have a .umb extension). Check if the file automatically got named '.zip' upon download.");
|
||||
@@ -272,24 +278,57 @@ namespace umbraco.cms.businesslogic.packager
|
||||
//string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath;
|
||||
string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
|
||||
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file"))
|
||||
try
|
||||
{
|
||||
var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
|
||||
var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
|
||||
var destFile = GetFileName(destPath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file"))
|
||||
{
|
||||
var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
|
||||
var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
|
||||
var destFile = GetFileName(destPath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
|
||||
|
||||
// Create the destination directory if it doesn't exist
|
||||
if (Directory.Exists(destPath) == false)
|
||||
Directory.CreateDirectory(destPath);
|
||||
//If a file with this name exists, delete it
|
||||
else if (File.Exists(destFile))
|
||||
File.Delete(destFile);
|
||||
// Create the destination directory if it doesn't exist
|
||||
if (Directory.Exists(destPath) == false)
|
||||
Directory.CreateDirectory(destPath);
|
||||
//If a file with this name exists, delete it
|
||||
else if (File.Exists(destFile))
|
||||
File.Delete(destFile);
|
||||
|
||||
// Move the file
|
||||
File.Move(sourceFile, destFile);
|
||||
// Copy the file
|
||||
// SJ: Note - this used to do a move but some packages included the same file to be
|
||||
// copied to multiple locations like so:
|
||||
//
|
||||
// <file>
|
||||
// <guid>my-icon.png</guid>
|
||||
// <orgPath>/umbraco/Images/</orgPath>
|
||||
// <orgName>my-icon.png</orgName>
|
||||
// </file>
|
||||
// <file>
|
||||
// <guid>my-icon.png</guid>
|
||||
// <orgPath>/App_Plugins/MyPlugin/Images</orgPath>
|
||||
// <orgName>my-icon.png</orgName>
|
||||
// </file>
|
||||
//
|
||||
// Since this file unzips as a flat list of files, moving the file the first time means
|
||||
// that when you try to do that a second time, it would result in a FileNotFoundException
|
||||
File.Copy(sourceFile, destFile);
|
||||
|
||||
//PPH log file install
|
||||
insPack.Data.Files.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
|
||||
//PPH log file install
|
||||
insPack.Data.Files.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
|
||||
|
||||
}
|
||||
|
||||
// Once we're done copying, remove all the files
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file"))
|
||||
{
|
||||
var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
|
||||
if (File.Exists(sourceFile))
|
||||
File.Delete(sourceFile);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Error<Installer>("Package install error", exception);
|
||||
throw;
|
||||
}
|
||||
|
||||
// log that a user has install files
|
||||
@@ -301,8 +340,6 @@ namespace umbraco.cms.businesslogic.packager
|
||||
}
|
||||
|
||||
insPack.Save();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,160 +349,169 @@ namespace umbraco.cms.businesslogic.packager
|
||||
() => "Installing business logic for package id " + packageId + " into temp folder " + tempDir,
|
||||
() => "Package business logic installation complete for package id " + packageId))
|
||||
{
|
||||
//retrieve the manifest to continue installation
|
||||
var insPack = InstalledPackage.GetById(packageId);
|
||||
//bool saveNeeded = false;
|
||||
|
||||
// Get current user, with a fallback
|
||||
var currentUser = new User(0);
|
||||
|
||||
//if there's a context, try to resolve the user - this will return null if there is a context but no
|
||||
// user found when there are old/invalid cookies lying around most likely during installation.
|
||||
// in that case we'll keep using the admin user
|
||||
if (string.IsNullOrEmpty(BasePages.UmbracoEnsuredPage.umbracoUserContextID) == false)
|
||||
InstalledPackage insPack;
|
||||
try
|
||||
{
|
||||
if (BasePages.UmbracoEnsuredPage.ValidateUserContextID(BasePages.UmbracoEnsuredPage.umbracoUserContextID))
|
||||
//retrieve the manifest to continue installation
|
||||
insPack = InstalledPackage.GetById(packageId);
|
||||
//bool saveNeeded = false;
|
||||
|
||||
// Get current user, with a fallback
|
||||
var currentUser = new User(0);
|
||||
|
||||
//if there's a context, try to resolve the user - this will return null if there is a context but no
|
||||
// user found when there are old/invalid cookies lying around most likely during installation.
|
||||
// in that case we'll keep using the admin user
|
||||
if (string.IsNullOrEmpty(BasePages.UmbracoEnsuredPage.umbracoUserContextID) == false)
|
||||
{
|
||||
var userById = User.GetCurrent();
|
||||
if (userById != null)
|
||||
currentUser = userById;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Xml as XElement which is used with the new PackagingService
|
||||
var rootElement = Config.DocumentElement.GetXElement();
|
||||
var packagingService = ApplicationContext.Current.Services.PackagingService;
|
||||
|
||||
//Perhaps it would have been a good idea to put the following into methods eh?!?
|
||||
|
||||
#region DataTypes
|
||||
var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault();
|
||||
if (dataTypeElement != null)
|
||||
{
|
||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement, currentUser.Id);
|
||||
foreach (var dataTypeDefinition in dataTypeDefinitions)
|
||||
{
|
||||
insPack.Data.DataTypes.Add(dataTypeDefinition.Id.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Languages
|
||||
var languageItemsElement = rootElement.Descendants("Languages").FirstOrDefault();
|
||||
if (languageItemsElement != null)
|
||||
{
|
||||
var insertedLanguages = packagingService.ImportLanguages(languageItemsElement);
|
||||
insPack.Data.Languages.AddRange(insertedLanguages.Select(l => l.Id.ToString()));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dictionary items
|
||||
var dictionaryItemsElement = rootElement.Descendants("DictionaryItems").FirstOrDefault();
|
||||
if (dictionaryItemsElement != null)
|
||||
{
|
||||
var insertedDictionaryItems = packagingService.ImportDictionaryItems(dictionaryItemsElement);
|
||||
insPack.Data.DictionaryItems.AddRange(insertedDictionaryItems.Select(d => d.Id.ToString()));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Macros
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("//macro"))
|
||||
{
|
||||
//TODO: Fix this, this should not use the legacy API
|
||||
Macro m = Macro.Import(n);
|
||||
|
||||
if (m != null)
|
||||
{
|
||||
insPack.Data.Macros.Add(m.Id.ToString(CultureInfo.InvariantCulture));
|
||||
//saveNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
//if (saveNeeded) { insPack.Save(); saveNeeded = false; }
|
||||
#endregion
|
||||
|
||||
#region Templates
|
||||
var templateElement = rootElement.Descendants("Templates").FirstOrDefault();
|
||||
if (templateElement != null)
|
||||
{
|
||||
var templates = packagingService.ImportTemplates(templateElement, currentUser.Id);
|
||||
foreach (var template in templates)
|
||||
{
|
||||
insPack.Data.Templates.Add(template.Id.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DocumentTypes
|
||||
//Check whether the root element is a doc type rather then a complete package
|
||||
var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
|
||||
rootElement.Name.LocalName.Equals("DocumentTypes")
|
||||
? rootElement
|
||||
: rootElement.Descendants("DocumentTypes").FirstOrDefault();
|
||||
|
||||
if (docTypeElement != null)
|
||||
{
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
insPack.Data.Documenttypes.Add(contentType.Id.ToString(CultureInfo.InvariantCulture));
|
||||
//saveNeeded = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Stylesheets
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
|
||||
{
|
||||
StyleSheet s = StyleSheet.Import(n, currentUser);
|
||||
|
||||
insPack.Data.Stylesheets.Add(s.Id.ToString());
|
||||
//saveNeeded = true;
|
||||
}
|
||||
|
||||
//if (saveNeeded) { insPack.Save(); saveNeeded = false; }
|
||||
#endregion
|
||||
|
||||
#region Documents
|
||||
var documentElement = rootElement.Descendants("DocumentSet").FirstOrDefault();
|
||||
if (documentElement != null)
|
||||
{
|
||||
var content = packagingService.ImportContent(documentElement, -1, currentUser.Id);
|
||||
var firstContentItem = content.First();
|
||||
insPack.Data.ContentNodeId = firstContentItem.Id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package Actions
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("Actions/Action"))
|
||||
{
|
||||
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true")
|
||||
{
|
||||
insPack.Data.Actions += n.OuterXml;
|
||||
}
|
||||
|
||||
//Run the actions tagged only for 'install'
|
||||
|
||||
if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install")
|
||||
{
|
||||
var alias = n.Attributes["alias"] != null ? n.Attributes["alias"].Value : "";
|
||||
|
||||
if (alias.IsNullOrWhiteSpace() == false)
|
||||
if (BasePages.UmbracoEnsuredPage.ValidateUserContextID(BasePages.UmbracoEnsuredPage.umbracoUserContextID))
|
||||
{
|
||||
PackageAction.RunPackageAction(insPack.Data.Name, alias, n);
|
||||
var userById = User.GetCurrent();
|
||||
if (userById != null)
|
||||
currentUser = userById;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Xml as XElement which is used with the new PackagingService
|
||||
var rootElement = Config.DocumentElement.GetXElement();
|
||||
var packagingService = ApplicationContext.Current.Services.PackagingService;
|
||||
|
||||
//Perhaps it would have been a good idea to put the following into methods eh?!?
|
||||
|
||||
#region DataTypes
|
||||
var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault();
|
||||
if (dataTypeElement != null)
|
||||
{
|
||||
var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement, currentUser.Id);
|
||||
foreach (var dataTypeDefinition in dataTypeDefinitions)
|
||||
{
|
||||
insPack.Data.DataTypes.Add(dataTypeDefinition.Id.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Languages
|
||||
var languageItemsElement = rootElement.Descendants("Languages").FirstOrDefault();
|
||||
if (languageItemsElement != null)
|
||||
{
|
||||
var insertedLanguages = packagingService.ImportLanguages(languageItemsElement);
|
||||
insPack.Data.Languages.AddRange(insertedLanguages.Select(l => l.Id.ToString()));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Dictionary items
|
||||
var dictionaryItemsElement = rootElement.Descendants("DictionaryItems").FirstOrDefault();
|
||||
if (dictionaryItemsElement != null)
|
||||
{
|
||||
var insertedDictionaryItems = packagingService.ImportDictionaryItems(dictionaryItemsElement);
|
||||
insPack.Data.DictionaryItems.AddRange(insertedDictionaryItems.Select(d => d.Id.ToString()));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Macros
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("//macro"))
|
||||
{
|
||||
//TODO: Fix this, this should not use the legacy API
|
||||
Macro m = Macro.Import(n);
|
||||
|
||||
if (m != null)
|
||||
{
|
||||
insPack.Data.Macros.Add(m.Id.ToString(CultureInfo.InvariantCulture));
|
||||
//saveNeeded = true;
|
||||
}
|
||||
}
|
||||
|
||||
//if (saveNeeded) { insPack.Save(); saveNeeded = false; }
|
||||
#endregion
|
||||
|
||||
#region Templates
|
||||
var templateElement = rootElement.Descendants("Templates").FirstOrDefault();
|
||||
if (templateElement != null)
|
||||
{
|
||||
var templates = packagingService.ImportTemplates(templateElement, currentUser.Id);
|
||||
foreach (var template in templates)
|
||||
{
|
||||
insPack.Data.Templates.Add(template.Id.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DocumentTypes
|
||||
//Check whether the root element is a doc type rather then a complete package
|
||||
var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
|
||||
rootElement.Name.LocalName.Equals("DocumentTypes")
|
||||
? rootElement
|
||||
: rootElement.Descendants("DocumentTypes").FirstOrDefault();
|
||||
|
||||
if (docTypeElement != null)
|
||||
{
|
||||
var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);
|
||||
foreach (var contentType in contentTypes)
|
||||
{
|
||||
insPack.Data.Documenttypes.Add(contentType.Id.ToString(CultureInfo.InvariantCulture));
|
||||
//saveNeeded = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Stylesheets
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
|
||||
{
|
||||
StyleSheet s = StyleSheet.Import(n, currentUser);
|
||||
|
||||
insPack.Data.Stylesheets.Add(s.Id.ToString());
|
||||
//saveNeeded = true;
|
||||
}
|
||||
|
||||
//if (saveNeeded) { insPack.Save(); saveNeeded = false; }
|
||||
#endregion
|
||||
|
||||
#region Documents
|
||||
var documentElement = rootElement.Descendants("DocumentSet").FirstOrDefault();
|
||||
if (documentElement != null)
|
||||
{
|
||||
var content = packagingService.ImportContent(documentElement, -1, currentUser.Id);
|
||||
var firstContentItem = content.First();
|
||||
insPack.Data.ContentNodeId = firstContentItem.Id.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Package Actions
|
||||
foreach (XmlNode n in Config.DocumentElement.SelectNodes("Actions/Action"))
|
||||
{
|
||||
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true")
|
||||
{
|
||||
insPack.Data.Actions += n.OuterXml;
|
||||
}
|
||||
|
||||
//Run the actions tagged only for 'install'
|
||||
|
||||
if (n.Attributes["runat"] != null && n.Attributes["runat"].Value == "install")
|
||||
{
|
||||
var alias = n.Attributes["alias"] != null ? n.Attributes["alias"].Value : "";
|
||||
|
||||
if (alias.IsNullOrWhiteSpace() == false)
|
||||
{
|
||||
PackageAction.RunPackageAction(insPack.Data.Name, alias, n);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// Trigger update of Apps / Trees config.
|
||||
// (These are ApplicationStartupHandlers so just instantiating them will trigger them)
|
||||
new ApplicationRegistrar();
|
||||
new ApplicationTreeRegistrar();
|
||||
|
||||
insPack.Save();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogHelper.Error<Installer>("Error installing businesslogic", exception);
|
||||
throw;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// Trigger update of Apps / Trees config.
|
||||
// (These are ApplicationStartupHandlers so just instantiating them will trigger them)
|
||||
new ApplicationRegistrar();
|
||||
new ApplicationTreeRegistrar();
|
||||
|
||||
insPack.Save();
|
||||
|
||||
OnPackageBusinessLogicInstalled(insPack);
|
||||
}
|
||||
@@ -504,15 +550,15 @@ namespace umbraco.cms.businesslogic.packager
|
||||
RequirementsPatch = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value);
|
||||
|
||||
var reqNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements");
|
||||
RequirementsType = reqNode != null && reqNode.Attributes != null && reqNode.Attributes["type"] != null
|
||||
? Enum<RequirementsType>.Parse(reqNode.Attributes["type"].Value, true)
|
||||
RequirementsType = reqNode != null && reqNode.Attributes != null && reqNode.Attributes["type"] != null
|
||||
? Enum<RequirementsType>.Parse(reqNode.Attributes["type"].Value, true)
|
||||
: RequirementsType.Legacy;
|
||||
var iconNode = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/iconUrl");
|
||||
if (iconNode != null && iconNode.FirstChild != null)
|
||||
{
|
||||
IconUrl = iconNode.FirstChild.Value;
|
||||
}
|
||||
|
||||
|
||||
Author = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value;
|
||||
AuthorUrl = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value;
|
||||
|
||||
@@ -630,7 +676,7 @@ namespace umbraco.cms.businesslogic.packager
|
||||
Control = XmlHelper.GetNodeValue(controlNode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This uses the old method of fetching and only supports the packages.umbraco.org repository.
|
||||
/// </summary>
|
||||
@@ -760,7 +806,7 @@ namespace umbraco.cms.businesslogic.packager
|
||||
{
|
||||
File.Delete(zipName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return tempDir;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user