diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js
index f101450705..d04c707b25 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/content/content.create.controller.js
@@ -7,86 +7,103 @@
* The controller for the content creation dialog
*/
function contentCreateController($scope,
- $routeParams,
- contentTypeResource,
- iconHelper,
- $location,
- navigationService,
- blueprintConfig) {
-
- var mainCulture = $routeParams.mculture ? $routeParams.mculture : null;
+ $routeParams,
+ contentTypeResource,
+ iconHelper,
+ $location,
+ navigationService,
+ blueprintConfig,
+ authResource,
+ contentResource) {
- function initialize() {
- $scope.allowedTypes = null;
- contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function (data) {
- $scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
- });
+ var mainCulture = $routeParams.mculture ? $routeParams.mculture : null;
- $scope.selectContentType = true;
- $scope.selectBlueprint = false;
- $scope.allowBlank = blueprintConfig.allowBlank;
- }
+ function initialize() {
+ $scope.allowedTypes = null;
+ contentTypeResource.getAllowedTypes($scope.currentNode.id).then(function (data) {
+ $scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
+ });
- function close() {
- navigationService.hideMenu();
- }
+ if ($scope.currentNode.id > -1) {
+ authResource.getCurrentUser().then(function(currentUser) {
+ if (currentUser.allowedSections.indexOf("settings") > -1) {
+ $scope.hasSettingsAccess = true;
+ contentResource.getById($scope.currentNode.id).then(function(data) {
+ $scope.contentTypeId = data.contentTypeId;
+ });
+ }
+ });
+ }
- function createBlank(docType) {
- $location
- .path("/content/content/edit/" + $scope.currentNode.id)
- .search("doctype", docType.alias)
- .search("create", "true")
- /* when we create a new node we want to make sure it uses the same
- language as what is selected in the tree */
- .search("cculture", mainCulture);
- close();
- }
-
- function createOrSelectBlueprintIfAny(docType) {
- // map the blueprints into a collection that's sortable in the view
- var blueprints = _.map(_.pairs(docType.blueprints || {}), function (pair) {
- return {
- id: pair[0],
- name: pair[1]
- };
- });
- $scope.docType = docType;
- if (blueprints.length) {
- if (blueprintConfig.skipSelect) {
- createFromBlueprint(blueprints[0].id);
- } else {
- $scope.selectContentType = false;
- $scope.selectBlueprint = true;
- $scope.selectableBlueprints = blueprints;
- }
- } else {
- createBlank(docType);
+ $scope.selectContentType = true;
+ $scope.selectBlueprint = false;
+ $scope.allowBlank = blueprintConfig.allowBlank;
}
- }
- function createFromBlueprint(blueprintId) {
- $location
- .path("/content/content/edit/" + $scope.currentNode.id)
- .search("doctype", $scope.docType.alias)
- .search("create", "true")
- .search("blueprintId", blueprintId);
- close();
- }
+ function close() {
+ navigationService.hideMenu();
+ }
- $scope.closeDialog = function(showMenu) {
- navigationService.hideDialog(showMenu);
- };
+ function createBlank(docType) {
+ $location
+ .path("/content/content/edit/" + $scope.currentNode.id)
+ .search("doctype", docType.alias)
+ .search("create", "true")
+ /* when we create a new node we want to make sure it uses the same
+ language as what is selected in the tree */
+ .search("cculture", mainCulture);
+ close();
+ }
- $scope.createBlank = createBlank;
- $scope.createOrSelectBlueprintIfAny = createOrSelectBlueprintIfAny;
- $scope.createFromBlueprint = createFromBlueprint;
+ function createOrSelectBlueprintIfAny(docType) {
+ // map the blueprints into a collection that's sortable in the view
+ var blueprints = _.map(_.pairs(docType.blueprints || {}), function (pair) {
+ return {
+ id: pair[0],
+ name: pair[1]
+ };
+ });
+ $scope.docType = docType;
+ if (blueprints.length) {
+ if (blueprintConfig.skipSelect) {
+ createFromBlueprint(blueprints[0].id);
+ } else {
+ $scope.selectContentType = false;
+ $scope.selectBlueprint = true;
+ $scope.selectableBlueprints = blueprints;
+ }
+ } else {
+ createBlank(docType);
+ }
+ }
- // the current node changes behind the scenes when the context menu is clicked without closing
- // the default menu first, so we must watch the current node and re-initialize accordingly
- var unbindModelWatcher = $scope.$watch("currentNode", initialize);
- $scope.$on('$destroy', function () {
- unbindModelWatcher();
- });
+ function createFromBlueprint(blueprintId) {
+ $location
+ .path("/content/content/edit/" + $scope.currentNode.id)
+ .search("doctype", $scope.docType.alias)
+ .search("create", "true")
+ .search("blueprintId", blueprintId);
+ close();
+ }
+
+ $scope.close = function() {
+ close();
+ }
+
+ $scope.closeDialog = function (showMenu) {
+ navigationService.hideDialog(showMenu);
+ };
+
+ $scope.createBlank = createBlank;
+ $scope.createOrSelectBlueprintIfAny = createOrSelectBlueprintIfAny;
+ $scope.createFromBlueprint = createFromBlueprint;
+
+ // the current node changes behind the scenes when the context menu is clicked without closing
+ // the default menu first, so we must watch the current node and re-initialize accordingly
+ var unbindModelWatcher = $scope.$watch("currentNode", initialize);
+ $scope.$on('$destroy', function () {
+ unbindModelWatcher();
+ });
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/content/create.html b/src/Umbraco.Web.UI.Client/src/views/content/create.html
index 94299f6a54..97306e0ea8 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/create.html
+++ b/src/Umbraco.Web.UI.Client/src/views/content/create.html
@@ -6,9 +6,15 @@
Create a page under {{currentNode.name}}
Select a blueprint
-
-
-
+
@@ -56,4 +62,4 @@
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.controller.js
index 7c1f996931..5ceb5f01f2 100644
--- a/src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/documenttypes/edit.controller.js
@@ -56,7 +56,7 @@
function onInit() {
// get init values from model when in infinite mode
- if(infiniteMode) {
+ if (infiniteMode) {
documentTypeId = $scope.model.id;
create = $scope.model.create;
noTemplate = $scope.model.notemplate;
@@ -89,8 +89,7 @@
"name": vm.labels.design,
"alias": "design",
"icon": "icon-document-dashed-line",
- "view": "views/documenttypes/views/design/design.html",
- "active": true
+ "view": "views/documenttypes/views/design/design.html"
},
{
"name": vm.labels.listview,
@@ -291,6 +290,28 @@
});
vm.page.navigation = buttons;
+ initializeActiveNavigationPanel();
+ }
+
+ function initializeActiveNavigationPanel() {
+ // Initialise first loaded panel based on page route paramater
+ // i.e. ?view=design|listview|permissions
+ var initialViewSetFromRouteParams = false;
+ var view = $routeParams.view;
+ if (view) {
+ var viewPath = "views/documenttypes/views/" + view + "/" + view + ".html";
+ for (var i = 0; i < vm.page.navigation.length; i++) {
+ if (vm.page.navigation[i].view === viewPath) {
+ vm.page.navigation[i].active = true;
+ initialViewSetFromRouteParams = true;
+ break;
+ }
+ }
+ }
+
+ if (initialViewSetFromRouteParams === false) {
+ vm.page.navigation[0].active = true;
+ }
}
/* ---------- SAVE ---------- */
diff --git a/src/Umbraco.Web.UI.Client/src/views/media/create.html b/src/Umbraco.Web.UI.Client/src/views/media/create.html
index 13c12f3c9a..d93d4f0e30 100644
--- a/src/Umbraco.Web.UI.Client/src/views/media/create.html
+++ b/src/Umbraco.Web.UI.Client/src/views/media/create.html
@@ -4,9 +4,15 @@
Create under {{currentNode.name}}
-
-
-
+
@@ -38,7 +44,7 @@
diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.create.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.create.controller.js
index 487f53a5ba..b1fddb8928 100644
--- a/src/Umbraco.Web.UI.Client/src/views/media/media.create.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/media/media.create.controller.js
@@ -6,13 +6,24 @@
* @description
* The controller for the media creation dialog
*/
-function mediaCreateController($scope, $routeParams, $location, mediaTypeResource, iconHelper, navigationService) {
+function mediaCreateController($scope, $location, mediaTypeResource, iconHelper, navigationService, authResource, mediaResource) {
function initialize() {
$scope.allowedTypes = null;
mediaTypeResource.getAllowedTypes($scope.currentNode.id).then(function(data) {
$scope.allowedTypes = iconHelper.formatContentTypeIcons(data);
});
+
+ if ($scope.currentNode.id > -1) {
+ authResource.getCurrentUser().then(function(currentUser) {
+ if (currentUser.allowedSections.indexOf("settings") > -1) {
+ $scope.hasSettingsAccess = true;
+ mediaResource.getById($scope.currentNode.id).then(function (data) {
+ $scope.mediaTypeId = data.contentType.id;
+ });
+ }
+ });
+ }
}
$scope.createMediaItem = function(docType) {
@@ -21,6 +32,10 @@ function mediaCreateController($scope, $routeParams, $location, mediaTypeResourc
};
$scope.close = function() {
+ navigationService.hideMenu();
+ };
+
+ $scope.closeDialog = function () {
const showMenu = true;
navigationService.hideDialog(showMenu);
};
diff --git a/src/Umbraco.Web.UI.Client/src/views/mediatypes/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/mediatypes/edit.controller.js
index a0da3d0ea8..0acb87f42e 100644
--- a/src/Umbraco.Web.UI.Client/src/views/mediatypes/edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/mediatypes/edit.controller.js
@@ -12,7 +12,7 @@
function MediaTypesEditController($scope, $routeParams, mediaTypeResource,
dataTypeResource, editorState, contentEditingHelper, formHelper,
navigationService, iconHelper, contentTypeHelper, notificationsService,
- $filter, $q, localizationService, overlayHelper, eventsService, angularHelper) {
+ $q, localizationService, overlayHelper, eventsService, angularHelper) {
var vm = this;
var evts = [];
@@ -36,7 +36,7 @@
function onInit() {
// get init values from model when in infinite mode
- if(infiniteMode) {
+ if (infiniteMode) {
mediaTypeId = $scope.model.id;
create = $scope.model.create;
vm.saveButtonKey = "buttons_saveAndClose";
@@ -81,8 +81,7 @@
"name": vm.labels.design,
"alias": "design",
"icon": "icon-document-dashed-line",
- "view": "views/mediatypes/views/design/design.html",
- "active": true
+ "view": "views/mediatypes/views/design/design.html"
},
{
"name": vm.labels.listview,
@@ -153,8 +152,31 @@
]
}
];
+
+ initializeActiveNavigationPanel();
});
+ function initializeActiveNavigationPanel() {
+ // Initialise first loaded page based on page route paramater
+ // i.e. ?view=design|listview|permissions
+ var initialViewSetFromRouteParams = false;
+ var view = $routeParams.view;
+ if (view) {
+ var viewPath = "views/mediatypes/views/" + view + "/" + view + ".html";
+ for (var i = 0; i < vm.page.navigation.length; i++) {
+ if (vm.page.navigation[i].view === viewPath) {
+ vm.page.navigation[i].active = true;
+ initialViewSetFromRouteParams = true;
+ break;
+ }
+ }
+ }
+
+ if (initialViewSetFromRouteParams === false) {
+ vm.page.navigation[0].active = true;
+ }
+ }
+
contentTypeHelper.checkModelsBuilderStatus().then(function (result) {
vm.page.modelsBuilder = result;
if (result) {
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
index aba67ff2b1..8ba84dd74c 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en.xml
@@ -329,8 +329,12 @@
Select the document type you want to make a content template for
Enter a folder name
Choose a type and a title
- "document types".]]>
- "media types".]]>
+ Document Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
+ The selected page in the content tree doesn't allow for any pages to be created below it.
+ Edit permissions for this document type
+ Media Types Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
+ The selected media in the tree doesn't allow for any other media to be created below it.
+ Edit permissions for this media type
Document Type without a template
New folder
New data type
diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
index 6b9392ff3e..d15c32f74e 100644
--- a/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI/Umbraco/config/lang/en_us.xml
@@ -334,9 +334,12 @@
Select the document type you want to make a content template for
Enter a folder name
Choose a type and a title
- "document types".]]>
- "media types".]]>
- Document Type without a template
+ Document Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
+ The selected page in the content tree doesn't allow for any pages to be created below it.
+ Edit permissions for this document type
+ Media Types Types within the Settings section, by editing the Allowed child node types under Permissions.]]>
+ The selected media in the tree doesn't allow for any other media to be created below it.
+ Edit permissions for this media type Document Type without a template
New folder
New data type
New JavaScript file
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
index dc72b0a81f..d4156d6db5 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemBasic.cs
@@ -38,6 +38,8 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "updater")]
public UserProfile Updater { get; set; }
+ public int ContentTypeId { get; set; }
+
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string ContentTypeAlias { get; set; }
diff --git a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
index 80358bfc7a..b6a90a93c3 100644
--- a/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/ContentItemDisplay.cs
@@ -108,6 +108,9 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "treeNodeUrl")]
public string TreeNodeUrl { get; set; }
+ [DataMember(Name = "contentTypeId")]
+ public int ContentTypeId { get; set; }
+
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string ContentTypeAlias { get; set; }
diff --git a/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
index 2b30b0ac5a..dc0df4ca96 100644
--- a/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/ContentMapDefinition.cs
@@ -73,6 +73,7 @@ namespace Umbraco.Web.Models.Mapping
target.AllowedActions = GetActions(source);
target.AllowedTemplates = GetAllowedTemplates(source);
target.ContentApps = _commonMapper.GetContentApps(source);
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.ContentTypeName = _localizedTextService.UmbracoDictionaryTranslate(source.ContentType.Name);
target.DocumentType = _commonMapper.GetContentType(source, context);
@@ -117,6 +118,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll -Alias
private void Map(IContent source, ContentItemBasic target, MapperContext context)
{
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.CreateDate = source.CreateDate;
target.Edited = source.Edited;
diff --git a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
index 3da61bc9c0..05c006ec41 100644
--- a/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/MediaMapDefinition.cs
@@ -50,6 +50,7 @@ namespace Umbraco.Web.Models.Mapping
{
target.ContentApps = _commonMapper.GetContentApps(source);
target.ContentType = _commonMapper.GetContentType(source, context);
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.ContentTypeName = source.ContentType.Name;
target.CreateDate = source.CreateDate;
@@ -75,6 +76,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll -Edited -Updater -Alias
private void Map(IMedia source, ContentItemBasic target, MapperContext context)
{
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.CreateDate = source.CreateDate;
target.Icon = source.ContentType.Icon;
diff --git a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
index b230dcfe15..1c781255e7 100644
--- a/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
+++ b/src/Umbraco.Web/Models/Mapping/MemberMapDefinition.cs
@@ -76,6 +76,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll -Trashed -IsContainer -VariesByCulture
private void Map(IMember source, MemberDisplay target, MapperContext context)
{
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.ContentTypeName = source.ContentType.Name;
target.CreateDate = source.CreateDate;
@@ -101,6 +102,7 @@ namespace Umbraco.Web.Models.Mapping
// Umbraco.Code.MapAll -Trashed -Edited -Updater -Alias -VariesByCulture
private void Map(IMember source, MemberBasic target, MapperContext context)
{
+ target.ContentTypeId = source.ContentType.Id;
target.ContentTypeAlias = source.ContentType.Alias;
target.CreateDate = source.CreateDate;
target.Email = source.Email;
@@ -121,7 +123,7 @@ namespace Umbraco.Web.Models.Mapping
//TODO: SD: I can't remember why this mapping is here?
// Umbraco.Code.MapAll -Udi -Properties -ParentId -Path -SortOrder -Edited -Updater
- // Umbraco.Code.MapAll -Trashed -Alias -ContentTypeAlias -VariesByCulture
+ // Umbraco.Code.MapAll -Trashed -Alias -ContentTypeId -ContentTypeAlias -VariesByCulture
private void Map(MembershipUser source, MemberBasic target, MapperContext context)
{
target.CreateDate = source.CreationDate;