Compare commits

...

6 Commits

Author SHA1 Message Date
Sebastiaan Janssen 5a07e34fb4 Bump version to 8.0.2 2019-04-26 15:15:17 +02:00
Stephan 1b5d614f5a Fix recycle bin moves
(cherry picked from commit 173df80e3d)

# Conflicts:
#	src/Umbraco.Core/Services/Implement/MediaService.cs
2019-04-26 15:03:09 +02:00
Sebastiaan Janssen abb08260eb v8: Imagepicker prevalue and grid setting/styles as infinite editor (#4971)
(cherry picked from commit f82dff597b)

# Conflicts:
#	src/Umbraco.Web.UI.Client/src/views/propertyeditors/grid/grid.controller.js
2019-04-25 13:43:03 +02:00
Stephan 57c567c570 Fix paging error in NuCache
(cherry picked from commit 5d0010a993)
2019-04-23 14:08:19 +02:00
Stephan 424f4601ae Merge commit 'a2a247b413' into v8/8.0 2019-04-23 13:51:29 +02:00
Shannon 6f17129364 Make DropDownFlexibleConfiguration class public to allow configuration to be set when creating a new data type 2019-04-17 15:23:35 +10:00
15 changed files with 189 additions and 122 deletions
+2 -2
View File
@@ -18,5 +18,5 @@ using System.Resources;
[assembly: AssemblyVersion("8.0.0")] [assembly: AssemblyVersion("8.0.0")]
// these are FYI and changed automatically // these are FYI and changed automatically
[assembly: AssemblyFileVersion("8.0.1")] [assembly: AssemblyFileVersion("8.0.2")]
[assembly: AssemblyInformationalVersion("8.0.1")] [assembly: AssemblyInformationalVersion("8.0.2")]
@@ -1,6 +1,6 @@
namespace Umbraco.Core.PropertyEditors namespace Umbraco.Core.PropertyEditors
{ {
internal class DropDownFlexibleConfiguration : ValueListConfiguration public class DropDownFlexibleConfiguration : ValueListConfiguration
{ {
[ConfigurationField("multiple", "Enable multiple choice", "boolean", Description = "When checked, the dropdown will be a select multiple / combo box style dropdown.")] [ConfigurationField("multiple", "Enable multiple choice", "boolean", Description = "When checked, the dropdown will be a select multiple / combo box style dropdown.")]
public bool Multiple { get; set; } public bool Multiple { get; set; }
@@ -1902,9 +1902,8 @@ namespace Umbraco.Core.Services.Implement
content.ParentId = parentId; content.ParentId = parentId;
// get the level delta (old pos to new pos) // get the level delta (old pos to new pos)
var levelDelta = parent == null // note that recycle bin (id:-20) level is 0!
? 1 - content.Level + (parentId == Constants.System.RecycleBinContent ? 1 : 0) var levelDelta = 1 - content.Level + (parent?.Level ?? 0);
: parent.Level + 1 - content.Level;
var paths = new Dictionary<int, string>(); var paths = new Dictionary<int, string>();
@@ -975,9 +975,8 @@ namespace Umbraco.Core.Services.Implement
media.ParentId = parentId; media.ParentId = parentId;
// get the level delta (old pos to new pos) // get the level delta (old pos to new pos)
var levelDelta = parent == null // note that recycle bin (id:-20) level is 0!
? 1 - media.Level + (parentId == Constants.System.RecycleBinMedia ? 1 : 0) var levelDelta = 1 - media.Level + (parent?.Level ?? 0);
: parent.Level + 1 - media.Level;
var paths = new Dictionary<int, string>(); var paths = new Dictionary<int, string>();
@@ -1024,6 +1023,7 @@ namespace Umbraco.Core.Services.Implement
/// <summary> /// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IMedia"/> that resides in the bin /// Empties the Recycle Bin by deleting all <see cref="IMedia"/> that resides in the bin
/// </summary> /// </summary>
/// <param name="userId">Optional Id of the User emptying the Recycle Bin</param>
public OperationResult EmptyRecycleBin() public OperationResult EmptyRecycleBin()
{ {
var nodeObjectType = Constants.ObjectTypes.Media; var nodeObjectType = Constants.ObjectTypes.Media;
@@ -112,6 +112,7 @@ When building a custom infinite editor view you can use the same components as a
type="button" type="button"
button-style="link" button-style="link"
label-key="general_close" label-key="general_close"
shortcut="esc"
action="vm.close()"> action="vm.close()">
</umb-button> </umb-button>
<umb-button <umb-button
@@ -1,21 +1,21 @@
function imageFilePickerController($scope) { function imageFilePickerController($scope, editorService) {
$scope.add = function() { $scope.add = function() {
$scope.mediaPickerOverlay = { var mediaPickerOptions = {
view: "mediapicker", view: "mediapicker",
multiPicker: false,
disableFolderSelect: true, disableFolderSelect: true,
onlyImages: true, onlyImages: true,
show: true,
submit: function (model) { submit: function (model) {
$scope.model.value = model.selection[0].image; $scope.model.value = model.selection[0].image;
$scope.mediaPickerOverlay.show = false;
$scope.mediaPickerOverlay = null; editorService.close();
}, },
close: function () { close: function () {
$scope.mediaPickerOverlay.show = false; editorService.close();
$scope.mediaPickerOverlay = null;
} }
}; };
editorService.mediaPicker(mediaPickerOptions);
}; };
$scope.remove = function () { $scope.remove = function () {
@@ -19,11 +19,4 @@
<i class="icon icon-add large"></i> <i class="icon icon-add large"></i>
</a> </a>
<umb-overlay
ng-if="mediaPickerOverlay.show"
model="mediaPickerOverlay"
view="mediaPickerOverlay.view"
position="right">
</umb-overlay>
</div> </div>
@@ -0,0 +1,22 @@
function ConfigController($scope) {
var vm = this;
vm.submit = submit;
vm.close = close;
function submit() {
if ($scope.model && $scope.model.submit) {
$scope.model.submit($scope.model);
}
}
function close() {
if ($scope.model.close) {
$scope.model.close();
}
}
}
angular.module("umbraco").controller("Umbraco.PropertyEditors.GridPrevalueEditor.ConfigController", ConfigController);
@@ -1,16 +1,61 @@
<div ng-if="model.config"> <div ng-controller="Umbraco.PropertyEditors.GridPrevalueEditor.ConfigController as vm">
<umb-property
property="configValue" <umb-editor-view>
ng-repeat="configValue in model.config">
<umb-property-editor model="configValue" is-pre-value="true"></umb-property-editor> <umb-editor-header
</umb-property> name="model.title"
</div> name-locked="true"
hide-alias="true"
hide-icon="true"
hide-description="true">
</umb-editor-header>
<umb-editor-container>
<ng-form name="gridItemConfigEditor" val-form-manager>
<umb-box ng-if="model.config">
<umb-box-header title-key="grid_settings" />
<umb-box-content>
<div>
<umb-property property="configValue"
ng-repeat="configValue in model.config">
<umb-property-editor model="configValue" is-pre-value="true"></umb-property-editor>
</umb-property>
</div>
</umb-box-content>
</umb-box>
<umb-box ng-if="model.styles">
<umb-box-header title-key="grid_styles" />
<umb-box-content>
<div>
<umb-property property="styleValue"
ng-repeat="styleValue in model.styles">
<umb-property-editor model="styleValue" is-pre-value="true"></umb-property-editor>
</umb-property>
</div>
</umb-box-content>
</umb-box>
</ng-form>
</umb-editor-container>
<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button type="button"
button-style="link"
label-key="general_close"
shortcut="esc"
action="vm.close()">
</umb-button>
<umb-button type="button"
button-style="success"
label-key="general_submit"
action="vm.submit()">
</umb-button>
</umb-editor-footer-content-right>
</umb-editor-footer>
</umb-editor-view>
<div ng-if="model.styles">
<h4>Style</h4>
<umb-property
property="styleValue"
ng-repeat="styleValue in model.styles">
<umb-property-editor model="styleValue" is-pre-value="true"></umb-property-editor>
</umb-property>
</div> </div>
@@ -1,16 +1,22 @@
function EditConfigController($scope) { function EditConfigController($scope) {
$scope.close = function() { var vm = this;
if($scope.model.close) {
vm.submit = submit;
vm.close = close;
function submit() {
if ($scope.model && $scope.model.submit) {
$scope.model.submit($scope.model);
}
}
function close() {
if ($scope.model.close) {
$scope.model.close(); $scope.model.close();
} }
} }
$scope.submit = function() {
if($scope.model && $scope.model.submit) {
$scope.model.submit($scope.model);
}
}
} }
angular.module("umbraco").controller("Umbraco.PropertyEditors.GridPrevalueEditor.EditConfigController", EditConfigController); angular.module("umbraco").controller("Umbraco.PropertyEditors.GridPrevalueEditor.EditConfigController", EditConfigController);
@@ -1,10 +1,8 @@
<div class="usky-grid usky-grid-configuration" ng-controller="Umbraco.PropertyEditors.GridPrevalueEditor.EditConfigController"> <div class="usky-grid usky-grid-configuration" ng-controller="Umbraco.PropertyEditors.GridPrevalueEditor.EditConfigController as vm">
<umb-editor-view>
<form novalidate name="EditConfigForm" val-form-manager>
<umb-editor-view>
<form novalidate name="EditConfigForm" val-form-manager>
<umb-editor-header <umb-editor-header
name="model.title" name="model.title"
@@ -18,44 +16,39 @@
<umb-box> <umb-box>
<umb-box-content> <umb-box-content>
<ng-form name="gridConfigEditor">
<h4>{{model.name}}</h4>
<p>Settings will only save if the entered json configuration is valid</p>
<textarea name="configSource"
validate-on="'blur'"
rows="20" class="umb-property-editor umb-textarea"
umb-raw-model="model.config"></textarea>
<form name="gridConfigEditor"> <div class="alert alert-error" ng-show="gridConfigEditor.$invalid === true">
This configuration is not valid json, and will not be saved.
</div>
<h4>{{model.name}}</h4> </ng-form>
<p>Settings will only save if the entered json configuration is valid</p>
<textarea name="configSource"
validate-on="'blur'"
rows="20" class="umb-property-editor umb-textarea"
umb-raw-model="model.config"></textarea>
<div class="alert alert-error" ng-show="gridConfigEditor.$invalid === true"> </umb-box-content>
This configuration is not valid json, and will not be saved. </umb-box>
</div> </umb-editor-container>
</form> <umb-editor-footer>
<umb-editor-footer-content-right>
</umb-box-content>
</umb-box>
</umb-editor-container>
<umb-editor-footer>
<umb-editor-footer-content-right>
<umb-button <umb-button
type="button" type="button"
button-style="link" button-style="link"
label-key="general_close" label-key="general_close"
shortcut="esc" shortcut="esc"
action="close()"> action="vm.close()">
</umb-button> </umb-button>
<umb-button <umb-button
type="button" type="button"
button-style="success" button-style="success"
label-key="general_submit" label-key="general_submit"
action="submit()"> action="vm.submit()">
</umb-button> </umb-button>
</umb-editor-footer-content-right> </umb-editor-footer-content-right>
</umb-editor-footer> </umb-editor-footer>
@@ -8,17 +8,20 @@ angular.module("umbraco")
umbRequestHelper, umbRequestHelper,
angularHelper, angularHelper,
$element, $element,
eventsService eventsService,
editorService
) { ) {
// Grid status variables // Grid status variables
var placeHolder = ""; var placeHolder = "";
var currentForm = angularHelper.getCurrentForm($scope); var currentForm = angularHelper.getCurrentForm($scope);
$scope.currentRow = null; $scope.currentRow = null;
$scope.currentCell = null; $scope.currentCell = null;
$scope.currentToolsControl = null; $scope.currentToolsControl = null;
$scope.currentControl = null; $scope.currentControl = null;
$scope.openRTEToolbarId = null; $scope.openRTEToolbarId = null;
$scope.hasSettings = false; $scope.hasSettings = false;
$scope.showRowConfigurations = true; $scope.showRowConfigurations = true;
@@ -238,8 +241,10 @@ angular.module("umbraco")
$scope.$apply(function () { $scope.$apply(function () {
var cell = event.target.getScope_HackForSortable().area; var cell = event.target.getScope_HackForSortable().area;
cell.hasActiveChild = hasActiveChild(cell, cell.controls); cell.hasActiveChild = hasActiveChild(cell, cell.controls);
cell.active = false; cell.active = false;
}); });
} }
@@ -273,7 +278,7 @@ angular.module("umbraco")
localizationService.localize("grid_insertControl").then(function(value){ localizationService.localize("grid_insertControl").then(function(value){
title = value; title = value;
$scope.editorOverlay = { $scope.editorOverlay = {
view: "itempicker", view: "itempicker",
filter: area.$allowedEditors.length > 15, filter: area.$allowedEditors.length > 15,
title: title, title: title,
availableItems: area.$allowedEditors, availableItems: area.$allowedEditors,
@@ -314,6 +319,7 @@ angular.module("umbraco")
$scope.clickOutsideRow = function(index, rows) { $scope.clickOutsideRow = function(index, rows) {
rows[index].active = false; rows[index].active = false;
}; };
function getAllowedLayouts(section) { function getAllowedLayouts(section) {
@@ -431,44 +437,46 @@ angular.module("umbraco")
}); });
} }
$scope.gridItemSettingsDialog = {}; var dialogOptions = {
$scope.gridItemSettingsDialog.view = "views/propertyeditors/grid/dialogs/config.html"; view: "views/propertyeditors/grid/dialogs/config.html",
$scope.gridItemSettingsDialog.title = "Settings"; size: "small",
$scope.gridItemSettingsDialog.styles = styles; styles: styles,
$scope.gridItemSettingsDialog.config = config; config: config,
submit: function (model) {
var styleObject = {};
var configObject = {};
$scope.gridItemSettingsDialog.show = true; _.each(model.styles, function (style) {
if (style.value) {
styleObject[style.key] = addModifier(style.value, style.modifier);
}
});
_.each(model.config, function (cfg) {
cfg.alias = cfg.key;
cfg.label = cfg.value;
$scope.gridItemSettingsDialog.submit = function(model) { if (cfg.value) {
configObject[cfg.key] = addModifier(cfg.value, cfg.modifier);
}
});
var styleObject = {}; gridItem.styles = styleObject;
var configObject = {}; gridItem.config = configObject;
gridItem.hasConfig = gridItemHasConfig(styleObject, configObject);
_.each(model.styles, function(style){ currentForm.$setDirty();
if(style.value){
styleObject[style.key] = addModifier(style.value, style.modifier); editorService.close();
},
close: function () {
editorService.close();
} }
});
_.each(model.config, function (cfg) {
if (cfg.value) {
configObject[cfg.key] = addModifier(cfg.value, cfg.modifier);
}
});
gridItem.styles = styleObject;
gridItem.config = configObject;
gridItem.hasConfig = gridItemHasConfig(styleObject, configObject);
currentForm.$setDirty();
$scope.gridItemSettingsDialog.show = false;
$scope.gridItemSettingsDialog = null;
}; };
$scope.gridItemSettingsDialog.close = function(oldModel) { localizationService.localize("general_settings").then(value => {
$scope.gridItemSettingsDialog.show = false; dialogOptions.title = value;
$scope.gridItemSettingsDialog = null; editorService.open(dialogOptions);
}; });
}; };
@@ -538,6 +546,7 @@ angular.module("umbraco")
// Control management functions // Control management functions
// ********************************************* // *********************************************
$scope.clickControl = function (index, controls, cell) { $scope.clickControl = function (index, controls, cell) {
controls[index].active = true; controls[index].active = true;
cell.hasActiveChild = true; cell.hasActiveChild = true;
}; };
@@ -305,11 +305,4 @@
position="target"> position="target">
</umb-overlay> </umb-overlay>
<umb-overlay
ng-if="gridItemSettingsDialog.show"
model="gridItemSettingsDialog"
view="gridItemSettingsDialog.view"
position="right">
</umb-overlay>
</div> </div>
+2 -2
View File
@@ -340,9 +340,9 @@
<WebProjectProperties> <WebProjectProperties>
<UseIIS>False</UseIIS> <UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort> <AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8010</DevelopmentServerPort> <DevelopmentServerPort>8020</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath> <DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8010</IISUrl> <IISUrl>http://localhost:8020</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication> <NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer> <UseCustomServer>False</UseCustomServer>
<CustomServerUrl> <CustomServerUrl>
@@ -1381,19 +1381,24 @@ WHERE cmsContentNu.nodeId IN (
long total; long total;
do do
{ {
// the tree is locked, counting and comparing to total is safe
var descendants = _documentRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path")); var descendants = _documentRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path"));
var items = new List<ContentNuDto>(); var items = new List<ContentNuDto>();
var count = 0;
foreach (var c in descendants) foreach (var c in descendants)
{ {
// always the edited version // always the edited version
items.Add(GetDto(c, false)); items.Add(GetDto(c, false));
// and also the published version if it makes any sense // and also the published version if it makes any sense
if (c.Published) if (c.Published)
items.Add(GetDto(c, true)); items.Add(GetDto(c, true));
count++;
} }
db.BulkInsertRecords(items); db.BulkInsertRecords(items);
processed += items.Count; processed += count;
} while (processed < total); } while (processed < total);
} }
@@ -1448,10 +1453,11 @@ WHERE cmsContentNu.nodeId IN (
long total; long total;
do do
{ {
// the tree is locked, counting and comparing to total is safe
var descendants = _mediaRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path")); var descendants = _mediaRepository.GetPage(query, pageIndex++, groupSize, out total, null, Ordering.By("Path"));
var items = descendants.Select(m => GetDto(m, false)).ToArray(); var items = descendants.Select(m => GetDto(m, false)).ToList();
db.BulkInsertRecords(items); db.BulkInsertRecords(items);
processed += items.Length; processed += items.Count;
} while (processed < total); } while (processed < total);
} }