diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
index 0634471df1..e8e729fd72 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
@@ -82,7 +82,8 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $
statusMessage: args.statusMessage,
saveMethod: args.saveMethod,
scope: $scope,
- content: $scope.content
+ content: $scope.content,
+ action: args.action
}).then(function (data) {
//success
init($scope.content);
@@ -195,15 +196,15 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $
};
$scope.sendToPublish = function () {
- return performSave({ saveMethod: contentResource.sendToPublish, statusMessage: "Sending..." });
+ return performSave({ saveMethod: contentResource.sendToPublish, statusMessage: "Sending...", action: "sendToPublish" });
};
$scope.saveAndPublish = function () {
- return performSave({ saveMethod: contentResource.publish, statusMessage: "Publishing..." });
+ return performSave({ saveMethod: contentResource.publish, statusMessage: "Publishing...", action: "publish" });
};
$scope.save = function () {
- return performSave({ saveMethod: contentResource.save, statusMessage: "Saving..." });
+ return performSave({ saveMethod: contentResource.save, statusMessage: "Saving...", action: "save" });
};
$scope.preview = function (content) {
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.controller.js
new file mode 100644
index 0000000000..c666a2159c
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.controller.js
@@ -0,0 +1,63 @@
+angular.module("umbraco")
+.controller("Umbraco.Editors.DocumentTypes.CopyController",
+ function ($scope, contentTypeResource, treeService, navigationService, notificationsService, appState, eventsService) {
+ var dialogOptions = $scope.dialogOptions;
+ $scope.dialogTreeEventHandler = $({});
+
+ function nodeSelectHandler(ev, args) {
+ args.event.preventDefault();
+ args.event.stopPropagation();
+
+ if ($scope.target) {
+ //un-select if there's a current one selected
+ $scope.target.selected = false;
+ }
+
+ $scope.target = args.node;
+ $scope.target.selected = true;
+ }
+
+ $scope.copy = function () {
+
+ $scope.busy = true;
+ $scope.error = false;
+
+ contentTypeResource.copy({ parentId: $scope.target.id, id: dialogOptions.currentNode.id })
+ .then(function (path) {
+ $scope.error = false;
+ $scope.success = true;
+ $scope.busy = false;
+
+ //get the currently edited node (if any)
+ var activeNode = appState.getTreeState("selectedNode");
+
+ //we need to do a double sync here: first sync to the copied content - but don't activate the node,
+ //then sync to the currenlty edited content (note: this might not be the content that was copied!!)
+
+ navigationService.syncTree({ tree: "documentTypes", path: path, forceReload: true, activate: false }).then(function (args) {
+ if (activeNode) {
+ var activeNodePath = treeService.getPath(activeNode).join();
+ //sync to this node now - depending on what was copied this might already be synced but might not be
+ navigationService.syncTree({ tree: "documentTypes", path: activeNodePath, forceReload: false, activate: true });
+ }
+ });
+
+ }, function (err) {
+ $scope.success = false;
+ $scope.error = err;
+ $scope.busy = false;
+ //show any notifications
+ if (angular.isArray(err.data.notifications)) {
+ for (var i = 0; i < err.data.notifications.length; i++) {
+ notificationsService.showNotification(err.data.notifications[i]);
+ }
+ }
+ });
+ };
+
+ $scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
+
+ $scope.$on('$destroy', function () {
+ $scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
+ });
+ });
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.html b/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.html
new file mode 100644
index 0000000000..db1a0db640
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/copy.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ Select the folder to copy {{currentNode.name}} to in the tree structure below
+
+
+
+
+
+
{{error.errorMsg}}
+
{{error.data.message}}
+
+
+
+
+ {{currentNode.name}} was copied underneath {{target.name}}
+
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.controller.js b/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.controller.js
new file mode 100644
index 0000000000..2a1b2463f8
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.controller.js
@@ -0,0 +1,63 @@
+angular.module("umbraco")
+.controller("Umbraco.Editors.MediaTypes.CopyController",
+ function ($scope, mediaTypeResource, treeService, navigationService, notificationsService, appState, eventsService) {
+ var dialogOptions = $scope.dialogOptions;
+ $scope.dialogTreeEventHandler = $({});
+
+ function nodeSelectHandler(ev, args) {
+ args.event.preventDefault();
+ args.event.stopPropagation();
+
+ if ($scope.target) {
+ //un-select if there's a current one selected
+ $scope.target.selected = false;
+ }
+
+ $scope.target = args.node;
+ $scope.target.selected = true;
+ }
+
+ $scope.copy = function () {
+
+ $scope.busy = true;
+ $scope.error = false;
+
+ mediaTypeResource.copy({ parentId: $scope.target.id, id: dialogOptions.currentNode.id })
+ .then(function (path) {
+ $scope.error = false;
+ $scope.success = true;
+ $scope.busy = false;
+
+ //get the currently edited node (if any)
+ var activeNode = appState.getTreeState("selectedNode");
+
+ //we need to do a double sync here: first sync to the copied content - but don't activate the node,
+ //then sync to the currenlty edited content (note: this might not be the content that was copied!!)
+
+ navigationService.syncTree({ tree: "mediaTypes", path: path, forceReload: true, activate: false }).then(function (args) {
+ if (activeNode) {
+ var activeNodePath = treeService.getPath(activeNode).join();
+ //sync to this node now - depending on what was copied this might already be synced but might not be
+ navigationService.syncTree({ tree: "mediaTypes", path: activeNodePath, forceReload: false, activate: true });
+ }
+ });
+
+ }, function (err) {
+ $scope.success = false;
+ $scope.error = err;
+ $scope.busy = false;
+ //show any notifications
+ if (angular.isArray(err.data.notifications)) {
+ for (var i = 0; i < err.data.notifications.length; i++) {
+ notificationsService.showNotification(err.data.notifications[i]);
+ }
+ }
+ });
+ };
+
+ $scope.dialogTreeEventHandler.bind("treeNodeSelect", nodeSelectHandler);
+
+ $scope.$on('$destroy', function () {
+ $scope.dialogTreeEventHandler.unbind("treeNodeSelect", nodeSelectHandler);
+ });
+ });
diff --git a/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.html b/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.html
new file mode 100644
index 0000000000..319e59c4cc
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+ Select the folder to copy {{currentNode.name}} to in the tree structure below
+
+
+
+
+
+
{{error.errorMsg}}
+
{{error.data.message}}
+
+
+
+
+ {{currentNode.name}} was copied underneath {{target.name}}
+
+
+
+
+
+
+
+
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js
index 1891e628c6..422f761851 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/boolean/boolean.controller.js
@@ -4,6 +4,11 @@ function booleanEditorController($scope, $rootScope, assetsService) {
$scope.renderModel = {
value: false
};
+
+ if ($scope.model.config && $scope.model.config.default && $scope.model.config.default.toString() === "1" && $scope.model && !$scope.model.value) {
+ $scope.renderModel.value = true;
+ }
+
if ($scope.model && $scope.model.value && ($scope.model.value.toString() === "1" || angular.lowercase($scope.model.value) === "true")) {
$scope.renderModel.value = true;
}
@@ -14,7 +19,7 @@ function booleanEditorController($scope, $rootScope, assetsService) {
$scope.$watch("renderModel.value", function (newVal) {
$scope.model.value = newVal === true ? "1" : "0";
});
-
+
//here we declare a special method which will be called whenever the value has changed from the server
//this is instead of doing a watch on the model.value = faster
$scope.model.onValueChanged = function (newVal, oldVal) {
@@ -23,4 +28,4 @@ function booleanEditorController($scope, $rootScope, assetsService) {
};
}
-angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
\ No newline at end of file
+angular.module("umbraco").controller("Umbraco.PropertyEditors.BooleanController", booleanEditorController);
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js
index cce8dc2e7c..1e8db1a24b 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js
@@ -5,6 +5,7 @@ angular.module('umbraco')
function ($rootScope, $routeParams, $scope, $log, mediaHelper, cropperHelper, $timeout, editorState, umbRequestHelper, fileManager, angularHelper) {
var config = angular.copy($scope.model.config);
+ $scope.imageIsLoaded = false;
//move previously saved value to the editor
if ($scope.model.value) {
@@ -71,6 +72,10 @@ angular.module('umbraco')
}
};
+ $scope.imageLoaded = function() {
+ $scope.imageIsLoaded = true;
+ };
+
//on image selected, update the cropper
$scope.$on("filesSelected", function (ev, args) {
$scope.model.value = config;
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html
index 29148b32eb..e274249b42 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html
@@ -16,10 +16,10 @@
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
index 6c2a49ba5b..5aade0cac0 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js
@@ -1,4 +1,4 @@
-function listViewController($rootScope, $scope, $routeParams, $injector, $cookieStore, notificationsService, iconHelper, dialogService, editorState, localizationService, $location, appState, $timeout, $q, mediaResource, listViewHelper) {
+function listViewController($rootScope, $scope, $routeParams, $injector, $cookieStore, notificationsService, iconHelper, dialogService, editorState, localizationService, $location, appState, $timeout, $q, mediaResource, listViewHelper, userService) {
//this is a quick check to see if we're in create mode, if so just exit - we cannot show children for content
// that isn't created yet, if we continue this will use the parent id in the route params which isn't what
@@ -58,8 +58,66 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie
totalPages: 0,
items: []
};
+
+ //when this is null, we don't check permissions
+ $scope.buttonPermissions = null;
+
+ //When we are dealing with 'content', we need to deal with permissions on child nodes.
+ // Currently there is no real good way to
+ if ($scope.entityType === "content") {
+
+ var idsWithPermissions = null;
+
+ $scope.buttonPermissions = {
+ canCopy: true,
+ canCreate: true,
+ canDelete: true,
+ canMove: true,
+ canPublish: true,
+ canUnpublish: true
+ };
+
+ $scope.$watch(function() {
+ return $scope.selection.length;
+ }, function(newVal, oldVal) {
+
+ if ((idsWithPermissions == null && newVal > 0) || (idsWithPermissions != null)) {
+
+ //get all of the selected ids
+ var ids = _.map($scope.selection, function(i) {
+ return i.id.toString();
+ });
+
+ //remove the dictionary items that don't have matching ids
+ var filtered = {};
+ _.each(idsWithPermissions, function (value, key, list) {
+ if (_.contains(ids, key)) {
+ filtered[key] = value;
+ }
+ });
+ idsWithPermissions = filtered;
+
+ //find all ids that we haven't looked up permissions for
+ var existingIds = _.keys(idsWithPermissions);
+ var missingLookup = _.map(_.difference(ids, existingIds), function (i) {
+ return Number(i);
+ });
+
+ if (missingLookup.length > 0) {
+ contentResource.getPermissions(missingLookup).then(function(p) {
+ $scope.buttonPermissions = listViewHelper.getButtonPermissions(p, idsWithPermissions);
+ });
+ }
+ else {
+ $scope.buttonPermissions = listViewHelper.getButtonPermissions({}, idsWithPermissions);
+ }
+ }
+ });
+
+ }
$scope.options = {
+ displayAtTabNumber: $scope.model.config.displayAtTabNumber ? $scope.model.config.displayAtTabNumber : 1,
pageSize: $scope.model.config.pageSize ? $scope.model.config.pageSize : 10,
pageNumber: ($routeParams.page && Number($routeParams.page) != NaN && Number($routeParams.page) > 0) ? $routeParams.page : 1,
filter: '',
@@ -165,9 +223,8 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie
getListResultsCallback(id, $scope.options).then(function(data) {
$scope.actionInProgress = false;
-
$scope.listViewResultSet = data;
-
+
//update all values for display
if ($scope.listViewResultSet.items) {
_.each($scope.listViewResultSet.items, function(e, index) {
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
index 0f8014529e..904939b75f 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.html
@@ -10,7 +10,7 @@