Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 26c148dccc | |||
| 8497056185 | |||
| 5498e2c2bb | |||
| 602a8ce08c | |||
| 7e82524c4e | |||
| 783973b9da | |||
| 096cd1ef73 | |||
| 07b01fa318 | |||
| 0ba253c61d | |||
| 5da7f034e9 | |||
| 8eebd4ccae | |||
| c47e254efe | |||
| 3f35749619 | |||
| e818197365 | |||
| 1ffcc853e1 | |||
| 284e440b7e | |||
| 50597b5715 | |||
| 9d7519d591 | |||
| f35110309a | |||
| c73860d144 | |||
| 1842c78c5d | |||
| da39eb3ceb | |||
| baef12eb2a | |||
| 5389a018b3 | |||
| 00487c87fc | |||
| 44e76adbd1 | |||
| 01b3747956 |
@@ -3,37 +3,8 @@
|
||||
"browser": true
|
||||
},
|
||||
|
||||
"plugins": [
|
||||
"angular"
|
||||
],
|
||||
|
||||
"rules": {
|
||||
"eqeqeq": 2,
|
||||
"curly": 2,
|
||||
|
||||
"no-unused-vars": 1,
|
||||
"no-eval": 1,
|
||||
"no-delete-var": 1,
|
||||
"quotes": 1,
|
||||
"dot-notation": 1,
|
||||
|
||||
"no-use-before-define": 0,
|
||||
"angular/ng_controller_as": 1,
|
||||
"angular/ng_controller_as_vm": 1,
|
||||
|
||||
|
||||
"strict": 0,
|
||||
"no-irregular-whitespace": 0,
|
||||
"no-mixed-spaces-and-tabs": 0,
|
||||
"no-multi-spaces": 0,
|
||||
"key-spacing": 0,
|
||||
"semi-spacing": 0,
|
||||
"space-infix-ops": 0,
|
||||
"comma-spacing": 0,
|
||||
"no-trailing-spaces": 0,
|
||||
"eol-last": 0,
|
||||
"no-underscore-dangle": 0,
|
||||
"camelcase": 0
|
||||
"comma-dangle": ["error", "never"]
|
||||
},
|
||||
|
||||
"globals": {
|
||||
|
||||
@@ -12,6 +12,9 @@ const imagemin = require('gulp-imagemin');
|
||||
var _ = require('lodash');
|
||||
var MergeStream = require('merge-stream');
|
||||
|
||||
// js
|
||||
const eslint = require('gulp-eslint');
|
||||
|
||||
//Less + css
|
||||
var postcss = require('gulp-postcss');
|
||||
var less = require('gulp-less');
|
||||
@@ -30,6 +33,11 @@ Helper functions
|
||||
function processJs(files, out) {
|
||||
|
||||
return gulp.src(files)
|
||||
// check for js errors
|
||||
.pipe(eslint())
|
||||
// outputs the lint results to the console
|
||||
.pipe(eslint.format())
|
||||
// sort files in stream by path or any custom sort comparator
|
||||
.pipe(sort())
|
||||
.pipe(concat(out))
|
||||
.pipe(wrap('(function(){\n%= body %\n})();'))
|
||||
|
||||
+1381
-558
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-connect": "5.0.0",
|
||||
"gulp-eslint": "^5.0.0",
|
||||
"gulp-imagemin": "^4.1.0",
|
||||
"gulp-less": "^3.5.0",
|
||||
"gulp-ngdocs": "^0.3.0",
|
||||
|
||||
+1
-1
@@ -103,7 +103,7 @@
|
||||
backdropOpacity: "=?",
|
||||
highlightElement: "=?",
|
||||
highlightPreventClick: "=?",
|
||||
disableEventsOnClick: "=?",
|
||||
disableEventsOnClick: "=?"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+6
-26
@@ -107,7 +107,7 @@
|
||||
$scope.editors[s].content = initVariant(variant);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,16 +128,15 @@
|
||||
//if the variant list that defines the header drop down isn't assigned to the variant then assign it now
|
||||
if (!variant.variants) {
|
||||
variant.variants = _.map($scope.content.variants,
|
||||
function (v) {
|
||||
function(v) {
|
||||
return _.pick(v, "active", "language", "state");
|
||||
});
|
||||
}
|
||||
else {
|
||||
//merge the scope variants on top of the header variants collection (handy when needing to refresh)
|
||||
var orgVar = variant;
|
||||
angular.extend(variant.variants,
|
||||
_.map($scope.content.variants,
|
||||
function (v) {
|
||||
function(v) {
|
||||
return _.pick(v, "active", "language", "state");
|
||||
}));
|
||||
}
|
||||
@@ -151,25 +150,6 @@
|
||||
variant.variants[i].active = false;
|
||||
}
|
||||
}
|
||||
|
||||
// disables the active variant in the opposite editor language dropdown
|
||||
// to prevent same variant to be opened twice
|
||||
if ($scope.editors.length > 1) {
|
||||
for (var y = 0; y < $scope.editors.length; y++) {
|
||||
for (var $ = 0; $ < $scope.editors[y].content.variants.length; $++) {
|
||||
|
||||
var editorIndex = y === 0 ? 1 : 0;
|
||||
|
||||
if ($scope.editors[y].content.variants[$].active === true) {
|
||||
$scope.editors[editorIndex].content.variants[$].disabled = true;
|
||||
|
||||
} else {
|
||||
$scope.editors[editorIndex].content.variants[$].disabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//then assign the variant to a view model to the content app
|
||||
@@ -332,7 +312,7 @@
|
||||
$scope.page.buttonGroupState = "success";
|
||||
|
||||
eventsService.emit("content.saved", { content: $scope.content, action: args.action });
|
||||
|
||||
|
||||
return $q.when(data);
|
||||
},
|
||||
function (err) {
|
||||
@@ -342,7 +322,7 @@
|
||||
}
|
||||
|
||||
$scope.page.buttonGroupState = "error";
|
||||
|
||||
|
||||
return $q.reject(err);
|
||||
});
|
||||
}
|
||||
@@ -601,7 +581,7 @@
|
||||
$scope.saveAndCloseButtonState = "success";
|
||||
}).catch(angular.noop);;
|
||||
};
|
||||
|
||||
|
||||
function moveNode(node, target) {
|
||||
|
||||
contentResource.move({ "parentId": target.id, "id": node.id })
|
||||
|
||||
+4
-50
@@ -43,13 +43,10 @@
|
||||
});
|
||||
|
||||
var editor = {
|
||||
content: scope.initVariant({ variant: variant })
|
||||
content: scope.initVariant({ variant: variant})
|
||||
};
|
||||
|
||||
scope.editors.push(editor);
|
||||
|
||||
disableActiveVariant();
|
||||
|
||||
//TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular
|
||||
editor.collapsed = true;
|
||||
editor.loading = true;
|
||||
@@ -59,7 +56,6 @@
|
||||
}, 100);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Changes the currently selected variant
|
||||
* @param {any} variantDropDownItem
|
||||
@@ -75,7 +71,8 @@
|
||||
if (editorIndex === 0) {
|
||||
//if we've made it this far, then update the query string
|
||||
$location.search("cculture", variantDropDownItem.language.culture);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
//set all variant drop down items as inactive for this editor and then set the selected on as active
|
||||
for (var i = 0; i < scope.editor.content.variants.length; i++) {
|
||||
scope.editor.content.variants[i].active = false;
|
||||
@@ -88,64 +85,21 @@
|
||||
});
|
||||
scope.editor.content = scope.initVariant({ variant: variant });
|
||||
}
|
||||
|
||||
disableActiveVariant();
|
||||
};
|
||||
|
||||
/** Closes the split view */
|
||||
scope.closeSplitView = function () {
|
||||
|
||||
// if we close split view, then disabled to false on all active variants
|
||||
for (var i = 0; i < scope.editors.length; i++) {
|
||||
for (var c = 0; c < scope.editors[i].content.variants.length; c++) {
|
||||
if (scope.editors[1].content.variants[c].active === true) {
|
||||
|
||||
if (scope.editors[i].content.variants[c].hide) {
|
||||
scope.editors[i].content.variants[c].hide = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//TODO: hacking animation states - these should hopefully be easier to do when we upgrade angular
|
||||
scope.editor.loading = true;
|
||||
scope.editor.collapsed = true;
|
||||
$timeout(function () {
|
||||
var index = _.findIndex(scope.editors, function (e) {
|
||||
var index = _.findIndex(scope.editors, function(e) {
|
||||
return e === scope.editor;
|
||||
});
|
||||
scope.editors.splice(index, 1);
|
||||
}, 400);
|
||||
};
|
||||
|
||||
/*
|
||||
* Disables the active variant in the opposite editor language dropdown
|
||||
* to prevent same variant to be opened twice
|
||||
*/
|
||||
function disableActiveVariant() {
|
||||
for (var j = 0; j < scope.editors[0].content.variants.length; j++) {
|
||||
|
||||
if (scope.editors[1].content.variants[j].disabled) {
|
||||
scope.editors[1].content.variants[j].disabled = false;
|
||||
}
|
||||
|
||||
if (scope.editors[0].content.variants[j].active === true) {
|
||||
scope.editors[1].content.variants[j].disabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var c = 0; c < scope.editors[1].content.variants.length; c++) {
|
||||
if (scope.editors[0].content.variants[c].disabled) {
|
||||
scope.editors[0].content.variants[c].disabled = false;
|
||||
}
|
||||
|
||||
if (scope.editors[1].content.variants[c].active === true) {
|
||||
scope.editors[0].content.variants[c].disabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//set the content to dirty if the header changes
|
||||
scope.$watch("contentHeaderForm.$dirty",
|
||||
function (newValue, oldValue) {
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ angular.module("umbraco.directives")
|
||||
var $container = element.find(".crop-container");
|
||||
|
||||
//default constraints for drag n drop
|
||||
var constraints = {left: {max: scope.dimensions.margin, min: scope.dimensions.margin}, top: {max: scope.dimensions.margin, min: scope.dimensions.margin}, };
|
||||
var constraints = {left: {max: scope.dimensions.margin, min: scope.dimensions.margin}, top: {max: scope.dimensions.margin, min: scope.dimensions.margin} };
|
||||
scope.constraints = constraints;
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
transclude: true,
|
||||
templateUrl: 'views/components/umb-dropdown-item.html',
|
||||
templateUrl: 'views/components/umb-dropdown-item.html'
|
||||
};
|
||||
|
||||
return directive;
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@
|
||||
},
|
||||
stop: function(e, ui) {
|
||||
updateTabsSortOrder();
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
scope.sortableOptionsProperty = {
|
||||
|
||||
@@ -787,9 +787,91 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
),
|
||||
"Failed to create blueprint from content with id " + contentId
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#getAvailableContentTypesToChangeTo
|
||||
* @methodOf umbraco.resources.contentResource
|
||||
*
|
||||
* @description
|
||||
* Returns a list of available content types that it can be changed by checking against a nodeID
|
||||
*
|
||||
* @param {Int} id id of content item to query for available ContentTypes to change to
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getAvailableContentTypesToChangeTo: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetAvailableContentTypesToChangeTo",
|
||||
[{ currentNodeId: id }])),
|
||||
'Failed to get available content types to change to for item ' + id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#getAvailableProperties
|
||||
* @methodOf umbraco.resources.contentResource
|
||||
*
|
||||
* @description
|
||||
* Returns a list of available properties that a content types that it can be changed to
|
||||
*
|
||||
* @param {String} fromAlias alias of current ContentType
|
||||
* @param {String} toAlias alias of new ContentType changing to
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getAvailableProperties: function (fromAlias, toAlias) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"contentApiBaseUrl",
|
||||
"GetAvailableProperties",
|
||||
[{ fromPropertyAlias: fromAlias}, { toPropertyAlias: toAlias }])),
|
||||
'Failed to get available propeties for item ' + fromAlias);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.contentResource#postContentTypeChange
|
||||
* @methodOf umbraco.resources.contentResource
|
||||
*
|
||||
* @description
|
||||
* Sorts all children below a given parent node id, based on a collection of node-ids
|
||||
*
|
||||
* @param {Object} args arguments object
|
||||
* @param {Int} args.contentNodeId the ID of the current node to change doctype
|
||||
* @param {Int} args.newContentTypeId the ID of the pew ContentType to change to
|
||||
* @param {Int} args.newTemplateId the ID of the new Template to change to
|
||||
* @param {Array} args.fieldMap array of node IDs as they should be sorted
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
postContentTypeChange: function (args) {
|
||||
if (!args) {
|
||||
throw "args cannot be null";
|
||||
}
|
||||
if (!args.contentNodeId) {
|
||||
throw "args.contentNodeId cannot be null";
|
||||
}
|
||||
if (!args.newContentTypeId) {
|
||||
throw "args.newContentTypeId cannot be null";
|
||||
}
|
||||
if (!args.newTemplateId) {
|
||||
throw "args.newTemplateId cannot be null";
|
||||
}
|
||||
if (!args.fieldMap) {
|
||||
throw "args.fieldMap cannot be null";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("contentApiBaseUrl", "PostContentTypeChange"),
|
||||
args),
|
||||
'Failed to change content type content');
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -333,6 +333,17 @@ function contentTypeResource($q, $http, umbRequestHelper, umbDataFormatter, loca
|
||||
notificationsService.error(value);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
import: function (file) {
|
||||
if (!file) {
|
||||
throw "file cannot be null";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("contentTypeApiBaseUrl", "Import", { file: file })),
|
||||
"Failed to import document type " + file
|
||||
);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
$http.get(url),
|
||||
'Failed to retrieve content types'
|
||||
);
|
||||
},
|
||||
}
|
||||
};
|
||||
});
|
||||
@@ -329,7 +329,7 @@ angular.module('umbraco.services').factory("editorState", function() {
|
||||
},
|
||||
set: function (value) {
|
||||
throw "Use editorState.set to set the value of the current entity";
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
return state;
|
||||
|
||||
@@ -443,7 +443,7 @@ function contentEditingHelper(fileManager, $q, $location, $routeParams, notifica
|
||||
"removeDateMonth",
|
||||
"removeDateDayNumber",
|
||||
"removeDateDay",
|
||||
"removeDateTime",
|
||||
"removeDateTime"
|
||||
], function (i) {
|
||||
return i === propName;
|
||||
});
|
||||
|
||||
@@ -506,7 +506,7 @@
|
||||
canDelete: _.contains(intersectPermissions, 'D'), //Magic Char = D
|
||||
canMove: _.contains(intersectPermissions, 'M'), //Magic Char = M
|
||||
canPublish: _.contains(intersectPermissions, 'U'), //Magic Char = U
|
||||
canUnpublish: _.contains(intersectPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
|
||||
canUnpublish: _.contains(intersectPermissions, 'U') //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -602,7 +602,7 @@ function navigationService($rootScope, $route, $routeParams, $log, $location, $q
|
||||
|
||||
//These will show up on the dialog controller's $scope under dialogOptions
|
||||
currentNode: args.node,
|
||||
currentAction: args.action,
|
||||
currentAction: args.action
|
||||
});
|
||||
|
||||
//save the currently assigned dialog so it can be removed before a new one is created
|
||||
@@ -623,7 +623,7 @@ function navigationService($rootScope, $route, $routeParams, $log, $location, $q
|
||||
setMode("default");
|
||||
|
||||
if(showMenu){
|
||||
this.showMenu(undefined, { skipDefault: true, node: appState.getMenuState("currentNode") });
|
||||
this.showMenu({ skipDefault: true, node: appState.getMenuState("currentNode") });
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -168,17 +168,12 @@ a.umb-variant-switcher__toggle {
|
||||
border-left: 2px solid @turquoise;
|
||||
}
|
||||
|
||||
.umb-variant-switcher_item--disabled .umb-variant-switcher__name-wrapper-disabled {
|
||||
background-color: @gray-9;
|
||||
border-left: 2px solid @red;
|
||||
}
|
||||
|
||||
.umb-variant-switcher__item:hover,
|
||||
.umb-variant-switcher__item:focus,
|
||||
.umb-variant-switcher__name-wrapper:hover,
|
||||
.umb-variant-switcher__name-wrapper:focus {
|
||||
background-color: @gray-10;
|
||||
outline: none;
|
||||
background-color: @gray-10;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.umb-variant-switcher__item:hover .umb-variant-switcher__split-view {
|
||||
@@ -195,18 +190,9 @@ a.umb-variant-switcher__toggle {
|
||||
border-left: 2px solid transparent;
|
||||
}
|
||||
|
||||
.umb-variant-switcher__name-wrapper-disabled {
|
||||
font-size: 14px;
|
||||
flex: 1;
|
||||
cursor: not-allowed;
|
||||
padding-top: 6px !important;
|
||||
padding-bottom: 6px !important;
|
||||
border-left: 2px solid transparent;
|
||||
}
|
||||
|
||||
.umb-variant-switcher__name {
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.umb-variant-switcher__state {
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
modalClass: "login-overlay",
|
||||
animation: "slide",
|
||||
show: true,
|
||||
callback: callback,
|
||||
callback: callback
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ angular.module("umbraco")
|
||||
pageSize: 100,
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
filter: '',
|
||||
filter: ''
|
||||
};
|
||||
|
||||
//preload selected item
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@
|
||||
sort: {
|
||||
property: {
|
||||
alias: "",
|
||||
name: "",
|
||||
name: ""
|
||||
},
|
||||
direction: "ascending", //This is the value for sorting sent to server
|
||||
translation: {
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ angular.module("umbraco")
|
||||
pageSize: 100,
|
||||
totalItems: 0,
|
||||
totalPages: 0,
|
||||
filter: '',
|
||||
filter: ''
|
||||
};
|
||||
|
||||
//preload selected item
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
server-validation-field="Alias">
|
||||
</umb-generate-alias>
|
||||
|
||||
|
||||
<a ng-if="variants.length > 0 && hideChangeVariant !== true" class="umb-variant-switcher__toggle" href="" ng-click="vm.dropdownOpen = !vm.dropdownOpen">
|
||||
<span>{{vm.currentVariant.language.name}}</span>
|
||||
<ins class="umb-variant-switcher__expand" ng-class="{'icon-navigation-down': !vm.dropdownOpen, 'icon-navigation-up': vm.dropdownOpen}"> </ins>
|
||||
@@ -61,10 +60,8 @@
|
||||
</span>
|
||||
|
||||
<umb-dropdown ng-if="vm.dropdownOpen" style="width: 100%; max-height: 250px; overflow-y: scroll; margin-top: 5px;" on-close="vm.dropdownOpen = false" umb-keyboard-list>
|
||||
<umb-dropdown-item class="umb-variant-switcher__item" ng-class="{'umb-variant-switcher_item--current': variant.active, 'umb-variant-switcher_item--disabled': variant.disabled}" ng-repeat="variant in variants">
|
||||
|
||||
<!--Dropdown in nonsplit view-->
|
||||
<a ng-if="splitViewOpen !== true" href="" class="umb-variant-switcher__name-wrapper" ng-click="selectVariant($event, variant)" prevent-default>
|
||||
<umb-dropdown-item class="umb-variant-switcher__item" ng-class="{'umb-variant-switcher_item--current': variant.active}" ng-repeat="variant in variants">
|
||||
<a href="" class="umb-variant-switcher__name-wrapper" ng-click="selectVariant($event, variant)" prevent-default>
|
||||
<span class="umb-variant-switcher__name">{{variant.language.name}}</span>
|
||||
<span ng-switch="variant.state">
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="NotCreated"><localize key="content_notCreated"></localize></span>
|
||||
@@ -73,29 +70,9 @@
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="Published"><localize key="content_published"></localize></span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<!--Dropdown in split view -->
|
||||
<a ng-if="splitViewOpen === true && variant.disabled !== true" href="" class="umb-variant-switcher__name-wrapper" ng-click="selectVariant($event, variant)" prevent-default>
|
||||
<span class="umb-variant-switcher__name">{{variant.language.name}}</span>
|
||||
<span ng-switch="variant.state">
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="NotCreated"><localize key="content_notCreated"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="Draft"><localize key="content_unpublished"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="PublishedPendingChanges"><localize key="content_publishedPendingChanges"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="Published"><localize key="content_published"></localize></span>
|
||||
</span>
|
||||
</a>
|
||||
<a ng-if="splitViewOpen === true && variant.disabled === true" href="" class="umb-variant-switcher__name-wrapper-disabled" prevent-default>
|
||||
<span class="umb-variant-switcher__name">{{variant.language.name}}</span>
|
||||
<span ng-switch="variant.state">
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="NotCreated"><localize key="content_notCreated"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="Draft"><localize key="content_unpublished"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="PublishedPendingChanges"><localize key="content_publishedPendingChanges"></localize></span>
|
||||
<span class="umb-variant-switcher__state" ng-switch-when="Published"><localize key="content_published"></localize></span>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<div ng-if="splitViewOpen !== true && variant.active != true" class="umb-variant-switcher__split-view" ng-click="openInSplitView($event, variant)">Open in split view</div>
|
||||
|
||||
|
||||
<div ng-if="splitViewOpen !== true" class="umb-variant-switcher__split-view" ng-click="openInSplitView($event, variant)">Open in split view</div>
|
||||
|
||||
</umb-dropdown-item>
|
||||
</umb-dropdown>
|
||||
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
<div ng-controller="Umbraco.Editors.Content.ChangeDocTypeController as vm" ng-cloak>
|
||||
|
||||
<div class="umb-dialog-body with-footer">
|
||||
<div class="umb-pane">
|
||||
|
||||
<umb-load-indicator ng-show="vm.loading"></umb-load-indicator>
|
||||
|
||||
<div ng-if="!vm.loading">
|
||||
<div ng-if="vm.allowedContentTypes.length > 0" class="block-form">
|
||||
<p class="help"><localize key="changeDocType_changeDocTypeInstruction"></localize></p>
|
||||
|
||||
<div class="umb-el-wrap" style="margin-bottom: 15px;">
|
||||
<label class="control-label"><localize key="changeDocType_selectedContent"></localize></label>
|
||||
<div class="controls controls-row">{{ currentNode.name }}</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-el-wrap" style="margin-bottom: 15px;">
|
||||
<label class="control-label"><localize key="changeDocType_currentType"></localize></label>
|
||||
<div class="controls controls-row">{{ vm.currentContentType.name }}</div>
|
||||
</div>
|
||||
|
||||
<!-- Allowed Doctypes to switch to -->
|
||||
<div class="umb-el-wrap" style="margin-bottom: 15px;">
|
||||
<label class="control-label"><localize key="changeDocType_newType"></localize></label>
|
||||
<div class="controls controls-row">
|
||||
<select
|
||||
ng-change="vm.changeAllowedContentType(vm.newContentType)"
|
||||
ng-options="option.name for option in vm.allowedContentTypes"
|
||||
ng-model="vm.newContentType">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Allowed Templates to switch to -->
|
||||
<div ng-if="vm.allowedTemplates.length > 0" class="umb-el-wrap" style="margin-bottom: 15px;">
|
||||
<label class="control-label"><localize key="changeDocType_newTemplate"></localize></label>
|
||||
<div class="controls controls-row">
|
||||
<select
|
||||
ng-options="option.name for option in vm.allowedTemplates"
|
||||
ng-model="vm.newTemplate">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Map properties -->
|
||||
<table class="table table-condensed table-bordered" ng-if="vm.propertiesMap.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Current Property</th>
|
||||
<th>Map to Property</th>
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="currentProperty in vm.propertiesMap">
|
||||
<td>
|
||||
<span class="bold">{{currentProperty.name}}</span>
|
||||
</td>
|
||||
<td>
|
||||
<p ng-if="currentProperty.allowed.length === 0">None</p>
|
||||
<select
|
||||
ng-if="currentProperty.allowed.length > 0"
|
||||
style="margin-bottom: 0;"
|
||||
ng-options="option.alias as option.name for option in currentProperty.allowed"
|
||||
ng-model="selected"
|
||||
ng-change="vm.changeProperty(currentProperty, selected)">
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Display warning if no types available to swap to -->
|
||||
<umb-empty-state ng-if="vm.allowedContentTypes.length === 0" position="center">
|
||||
<localize key="changeDocType_docTypeCannotBeChanged"></localize>
|
||||
</umb-empty-state>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
|
||||
<umb-button
|
||||
type="button"
|
||||
button-style="link"
|
||||
action="nav.hideDialog()"
|
||||
label-key="general_cancel">
|
||||
</umb-button>
|
||||
<umb-button
|
||||
ng-if="vm.allowedContentTypes.length > 0"
|
||||
type="button"
|
||||
action="vm.save()"
|
||||
state="vm.saveButtonState"
|
||||
button-style="success"
|
||||
label-key="buttons_save">
|
||||
</umb-button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,84 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ChangeDocTypeController($scope, contentResource, navigationService) {
|
||||
|
||||
var vm = this;
|
||||
var id = $scope.currentNode.id;
|
||||
|
||||
vm.currentContentType = {};
|
||||
vm.allowedContentTypes = [];
|
||||
vm.allowedTemplates = [];
|
||||
vm.propertiesMap = [];
|
||||
|
||||
// the new models
|
||||
vm.newContentType = {};
|
||||
vm.newTemplate = {};
|
||||
|
||||
// bind function to view model
|
||||
vm.changeAllowedContentType = changeAllowedContentType;
|
||||
vm.changeProperty = changeProperty;
|
||||
vm.save = save;
|
||||
|
||||
function onInit() {
|
||||
vm.loading = true;
|
||||
contentResource.getAvailableContentTypesToChangeTo(id)
|
||||
.then(function(data){
|
||||
vm.currentContentType = data.currentContentType;
|
||||
vm.allowedContentTypes = data.contentTypes;
|
||||
vm.loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
function changeAllowedContentType(newContentType) {
|
||||
contentResource.getAvailableProperties(vm.currentContentType.alias, newContentType.alias)
|
||||
.then(function(data){
|
||||
vm.allowedTemplates = data.templates;
|
||||
vm.propertiesMap = data.currentProperties;
|
||||
});
|
||||
}
|
||||
|
||||
function changeProperty(currentProperty, selected) {
|
||||
currentProperty.selectedAlias = selected;
|
||||
}
|
||||
|
||||
function save() {
|
||||
|
||||
vm.saveButtonState = "busy";
|
||||
|
||||
var fieldMap = [];
|
||||
|
||||
angular.forEach(vm.propertiesMap, function(property) {
|
||||
if(property.selectedAlias) {
|
||||
var map = {};
|
||||
map.fromAlias = property.alias;
|
||||
map.toAlias = property.selectedAlias;
|
||||
fieldMap.push(map);
|
||||
}
|
||||
});
|
||||
|
||||
var args = {
|
||||
"contentNodeId": id,
|
||||
"newContentTypeId": vm.newContentType.id,
|
||||
"newTemplateId": vm.newTemplate.id,
|
||||
"fieldMap": fieldMap
|
||||
};
|
||||
|
||||
contentResource.postContentTypeChange(args).then(function(){
|
||||
|
||||
console.log('args', args);
|
||||
//Sync tree?
|
||||
//Reload node?
|
||||
vm.saveButtonState = "success";
|
||||
}, function(error) {
|
||||
vm.error = error;
|
||||
vm.saveButtonState = "error";
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
onInit();
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Content.ChangeDocTypeController", ChangeDocTypeController);
|
||||
})();
|
||||
@@ -28,7 +28,7 @@ function DataTypeEditController($scope, $routeParams, $location, appState, navig
|
||||
label: preVals[i].label,
|
||||
view: preVals[i].view,
|
||||
value: preVals[i].value,
|
||||
config: preVals[i].config,
|
||||
config: preVals[i].config
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.Editors.DocumentTypes.ImportController",
|
||||
function ($scope, contentTypeResource, navigationService, Upload, umbRequestHelper) {
|
||||
var vm = this;
|
||||
vm.serverErrorMessage = "";
|
||||
vm.state = "upload";
|
||||
vm.model = {};
|
||||
vm.uploadStatus = "";
|
||||
|
||||
$scope.handleFiles = function (files, event) {
|
||||
if (files && files.length > 0) {
|
||||
$scope.upload(files[0]);
|
||||
}
|
||||
};
|
||||
|
||||
$scope.upload = function (file) {
|
||||
Upload.upload({
|
||||
url: umbRequestHelper.getApiUrl("contentTypeApiBaseUrl", "Upload"),
|
||||
fields: {},
|
||||
file: file
|
||||
}).success(function (data, status, headers, config) {
|
||||
if (data.notifications && data.notifications.length > 0) {
|
||||
|
||||
// set error status on file
|
||||
vm.uploadStatus = "error";
|
||||
|
||||
// Throw message back to user with the cause of the error
|
||||
vm.serverErrorMessage = data.notifications[0].message;
|
||||
} else {
|
||||
|
||||
// set done status on file
|
||||
vm.uploadStatus = "done";
|
||||
vm.model = data;
|
||||
vm.state = "confirm";
|
||||
}
|
||||
}).error(function (evt, status, headers, config) {
|
||||
|
||||
// set status done
|
||||
$scope.uploadStatus = "error";
|
||||
|
||||
// If file not found, server will return a 404 and display this message
|
||||
if (status === 404) {
|
||||
$scope.serverErrorMessage = "File not found";
|
||||
}
|
||||
else if (status == 400) {
|
||||
//it's a validation error
|
||||
$scope.serverErrorMessage = evt.message;
|
||||
}
|
||||
else {
|
||||
//it's an unhandled error
|
||||
//if the service returns a detailed error
|
||||
if (evt.InnerException) {
|
||||
$scope.serverErrorMessage = evt.InnerException.ExceptionMessage;
|
||||
|
||||
//Check if its the common "too large file" exception
|
||||
if (evt.InnerException.StackTrace && evt.InnerException.StackTrace.indexOf("ValidateRequestEntityLength") > 0) {
|
||||
$scope.serverErrorMessage = "File too large to upload";
|
||||
}
|
||||
|
||||
} else if (evt.Message) {
|
||||
$scope.serverErrorMessage = evt.Message;
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$scope.import = function () {
|
||||
contentTypeResource.import(vm.model.tempFileName);
|
||||
vm.state = "done";
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
<div class="umb-dialog umb-pane" ng-controller="Umbraco.Editors.DocumentTypes.ImportController as vm">
|
||||
<div ng-if="vm.state === 'upload'">
|
||||
<p>
|
||||
<localize key="settings_importDocumentTypeHelp">
|
||||
To import a document type, find the '.udt' file on your computer by clicking the 'Browse' button and click 'Import' (you'll be asked for confirmation on the next screen)
|
||||
</localize>
|
||||
</p>
|
||||
|
||||
<form name="importDoctype">
|
||||
|
||||
<!-- Select files -->
|
||||
<button class="btn"
|
||||
name="file"
|
||||
ngf-select
|
||||
ng-model="filesHolder"
|
||||
ngf-change="handleFiles($files, $event)"
|
||||
ngf-multiple="true"
|
||||
ngf-pattern="*.udt">
|
||||
<localize key="general_import">Import</localize>
|
||||
</button>
|
||||
|
||||
<localize key="general_or">or</localize>
|
||||
|
||||
<a class="btn-link" ng-click="nav.hideDialog()">
|
||||
<localize key="cancel">Cancel</localize>
|
||||
</a>
|
||||
</form>
|
||||
|
||||
<div ng-if="importDoctype.file.$error.pattern">Please choose a .udt file to import</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
<div ng-if="vm.state === 'confirm'">
|
||||
<strong>
|
||||
<localize key="name">Name</localize>:
|
||||
</strong>
|
||||
{{vm.model.name}}
|
||||
<br />
|
||||
<strong>
|
||||
<localize key="alias">Alias</localize>:
|
||||
</strong>
|
||||
{{vm.model.alias}}
|
||||
<br />
|
||||
<br />
|
||||
<button class="btn btn-primary" ng-click="import()">
|
||||
<localize key="actions_importDocumentType">Import</localize>
|
||||
</button>
|
||||
</div>
|
||||
<div ng-if="vm.state === 'done'">
|
||||
{{vm.model.name}} has been imported!
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@
|
||||
var labelKeys = [
|
||||
"treeHeaders_languages",
|
||||
"general_mandatory",
|
||||
"general_default",
|
||||
"general_default"
|
||||
];
|
||||
|
||||
localizationService.localizeMany(labelKeys).then(function (values) {
|
||||
|
||||
@@ -355,7 +355,7 @@
|
||||
});
|
||||
},
|
||||
readOnly: true
|
||||
},
|
||||
}
|
||||
|
||||
]);
|
||||
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@
|
||||
templateUrl: 'views/propertyeditors/fileupload/fileupload.directive.html',
|
||||
controller: 'Umbraco.PropertyEditors.FileUploadController',
|
||||
scope: {
|
||||
model: "=",
|
||||
model: "="
|
||||
},
|
||||
link: function (scope, element, attrs, ctrl) {
|
||||
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ angular.module("umbraco")
|
||||
name: "1 column layout",
|
||||
sections: [
|
||||
{
|
||||
grid: 12,
|
||||
grid: 12
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -36,7 +36,7 @@ angular.module("umbraco")
|
||||
name: "2 column layout",
|
||||
sections: [
|
||||
{
|
||||
grid: 4,
|
||||
grid: 4
|
||||
},
|
||||
{
|
||||
grid: 8
|
||||
|
||||
@@ -76,7 +76,7 @@ function listViewController($rootScope, $scope, $routeParams, $injector, notific
|
||||
"canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D
|
||||
"canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M
|
||||
"canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U
|
||||
"canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
|
||||
"canUnpublish": _.contains(currentUserPermissions, 'U') //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ angular.module("umbraco")
|
||||
tagsHound.get(query, function (suggestions) {
|
||||
cb(removeCurrentTagsFromSuggestions(suggestions));
|
||||
});
|
||||
},
|
||||
}
|
||||
}).bind("typeahead:selected", function (obj, datum, name) {
|
||||
angularHelper.safeApply($scope, function () {
|
||||
addTag(datum["value"]);
|
||||
|
||||
@@ -159,7 +159,7 @@
|
||||
});
|
||||
},
|
||||
readOnly: true
|
||||
},
|
||||
}
|
||||
]);
|
||||
|
||||
// initial cursor placement
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
});
|
||||
},
|
||||
readOnly: true
|
||||
},
|
||||
}
|
||||
|
||||
]);
|
||||
|
||||
|
||||
@@ -361,7 +361,6 @@
|
||||
<Content Include="Umbraco\Developer\Packages\directoryBrowser.aspx" />
|
||||
<Content Include="Umbraco\Developer\Packages\editPackage.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\create.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\importDocumenttype.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\notifications.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\protectPage.aspx" />
|
||||
<Content Include="Umbraco\Dialogs\rollBack.aspx" />
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
@using System.Collections
|
||||
@using System.Net.Http
|
||||
@using System.Web.Mvc.Html
|
||||
@using Umbraco.Core
|
||||
@using Umbraco.Core
|
||||
@using ClientDependency.Core
|
||||
@using ClientDependency.Core.Mvc
|
||||
@using Microsoft.Owin.Security
|
||||
@using Newtonsoft.Json
|
||||
@using Newtonsoft.Json.Linq
|
||||
@using Umbraco.Core.IO
|
||||
@using Umbraco.Web
|
||||
@using Umbraco.Web.Editors
|
||||
@using umbraco
|
||||
@using Umbraco.Core.Configuration
|
||||
|
||||
@inherits System.Web.Mvc.WebViewPage<Umbraco.Web.Editors.BackOfficeModel>
|
||||
@inherits WebViewPage<Umbraco.Web.Editors.BackOfficeModel>
|
||||
|
||||
@{
|
||||
var isDebug = false;
|
||||
@@ -51,18 +43,25 @@
|
||||
new BasicPath("Umbraco", IOHelper.ResolveUrl(SystemDirectories.Umbraco)),
|
||||
new BasicPath("UmbracoClient", IOHelper.ResolveUrl(SystemDirectories.UmbracoClient)))
|
||||
</head>
|
||||
<noscript><h5><strong> JavaScript is disabled. Please enable to continue!</strong></h5></noscript>
|
||||
<body ng-class="{'touch':touchDevice, 'emptySection':emptySection, 'umb-drawer-is-visible':drawer.show}" ng-controller="Umbraco.MainController" id="umbracoMainPageBody">
|
||||
|
||||
<noscript>
|
||||
<div style="margin: 10px;">
|
||||
<h3><img src="assets/img/application/logo.png" alt="Umbraco logo" style="vertical-align: text-bottom;" /> Umbraco</h3>
|
||||
<p>For full functionality of Umbraco CMS it is necessary to enable JavaScript.</p>
|
||||
<p>Here are the <a href="https://www.enable-javascript.com/" target="_blank" style="text-decoration: underline;">instructions how to enable JavaScript in your web browser</a>.</p>
|
||||
</div>
|
||||
</noscript>
|
||||
|
||||
<div ng-hide="!authenticated" ng-cloak>
|
||||
|
||||
<div id="mainwrapper" class="clearfix" ng-click="closeDialogs($event)">
|
||||
|
||||
<div style="display: none;" id="mainwrapper" class="clearfix" ng-click="closeDialogs($event)">
|
||||
|
||||
<umb-app-header></umb-app-header>
|
||||
|
||||
<div class="umb-app-content">
|
||||
|
||||
<umb-navigation></umb-navigation>
|
||||
|
||||
<umb-navigation></umb-navigation>
|
||||
|
||||
<section id="contentwrapper">
|
||||
|
||||
@@ -70,18 +69,16 @@
|
||||
|
||||
<div class="umb-editor" ng-view></div>
|
||||
<div class="umb-editor__overlay" ng-if="editors.length > 0"></div>
|
||||
|
||||
<umb-editors></umb-editors>
|
||||
|
||||
<umb-editors></umb-editors>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
<umb-tour
|
||||
ng-if="tour.show"
|
||||
model="tour">
|
||||
<umb-tour ng-if="tour.show"
|
||||
model="tour">
|
||||
</umb-tour>
|
||||
|
||||
<umb-notifications></umb-notifications>
|
||||
@@ -90,45 +87,42 @@
|
||||
|
||||
<!-- help dialog controller by the help button - this also forces the backoffice UI to shift 400px -->
|
||||
<umb-drawer data-element="drawer" ng-if="drawer.show" model="drawer.model" view="drawer.view"></umb-drawer>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<umb-backdrop
|
||||
ng-if="backdrop.show"
|
||||
backdrop-opacity="backdrop.opacity"
|
||||
highlight-element="backdrop.element"
|
||||
highlight-prevent-click="backdrop.elementPreventClick"
|
||||
disable-events-on-click="backdrop.disableEventsOnClick">
|
||||
<umb-backdrop ng-if="backdrop.show"
|
||||
backdrop-opacity="backdrop.opacity"
|
||||
highlight-element="backdrop.element"
|
||||
highlight-prevent-click="backdrop.elementPreventClick"
|
||||
disable-events-on-click="backdrop.disableEventsOnClick">
|
||||
</umb-backdrop>
|
||||
|
||||
<umb-overlay
|
||||
ng-if="overlay.show"
|
||||
model="overlay"
|
||||
position="{{overlay.position}}"
|
||||
view="overlay.view">
|
||||
<umb-overlay ng-if="overlay.show"
|
||||
model="overlay"
|
||||
position="{{overlay.position}}"
|
||||
view="overlay.view">
|
||||
</umb-overlay>
|
||||
|
||||
<umb-overlay
|
||||
ng-if="ysodOverlay.show"
|
||||
model="ysodOverlay"
|
||||
position="right"
|
||||
view="ysodOverlay.view">
|
||||
<umb-overlay ng-if="ysodOverlay.show"
|
||||
model="ysodOverlay"
|
||||
position="right"
|
||||
view="ysodOverlay.view">
|
||||
</umb-overlay>
|
||||
|
||||
@Html.BareMinimumServerVariablesScript(Url, Url.Action("ExternalLogin", "BackOffice", new { area = ViewBag.UmbracoPath }), Model.Features, UmbracoConfig.For.GlobalSettings())
|
||||
|
||||
<script type="text/javascript">
|
||||
<script>
|
||||
|
||||
document.angularReady = function(app) {
|
||||
|
||||
@Html.AngularValueExternalLoginInfoScript((IEnumerable<string>)ViewBag.ExternalSignInError)
|
||||
@Html.AngularValueResetPasswordCodeInfoScript(ViewData["PasswordResetCode"])
|
||||
//required for the noscript trick
|
||||
document.getElementById("mainwrapper").style.display = "inherit";
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@*And finally we can load in our angular app*@
|
||||
<script type="text/javascript" src="lib/rgrove-lazyload/lazyload.js"></script>
|
||||
<script type="text/javascript" src="@Url.GetUrlWithCacheBust("Application", "BackOffice")"></script>
|
||||
<script src="lib/rgrove-lazyload/lazyload.js"></script>
|
||||
<script src="@Url.GetUrlWithCacheBust("Application", "BackOffice")"></script>
|
||||
|
||||
@if (isDebug)
|
||||
{
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<%@ Page MasterPageFile="../masterpages/umbracoDialog.Master" Language="c#" Codebehind="importDocumenttype.aspx.cs" AutoEventWireup="false"
|
||||
Inherits="umbraco.presentation.umbraco.dialogs.importDocumentType" %>
|
||||
|
||||
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="body">
|
||||
<input id="tempFile" type="hidden" name="tempFile" runat="server" />
|
||||
|
||||
<asp:Literal ID="FeedBackMessage" runat="server" />
|
||||
|
||||
<table class="propertyPane" id="Table1" cellspacing="0" cellpadding="4" width="360" border="0" runat="server">
|
||||
<tr>
|
||||
<td class="propertyContent" colspan="2">
|
||||
<asp:Panel ID="Wizard" runat="server" Visible="True">
|
||||
<p>
|
||||
<span class="guiDialogNormal">
|
||||
<%=Services.TextService.Localize("importDocumentTypeHelp")%>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input id="documentTypeFile" type="file" runat="server" />
|
||||
</p>
|
||||
|
||||
|
||||
<asp:Button ID="submit" runat="server"></asp:Button> <em><%= Services.TextService.Localize("or") %></em> <a href="#" onclick="UmbClientMgr.closeModalWindow(); return false;"><%= Services.TextService.Localize("cancel") %></a>
|
||||
</asp:Panel>
|
||||
|
||||
|
||||
<asp:Panel ID="Confirm" runat="server" Visible="False">
|
||||
<strong>
|
||||
<%=Services.TextService.Localize("name")%>
|
||||
:</strong>
|
||||
<asp:Literal ID="dtName" runat="server"></asp:Literal>
|
||||
<br />
|
||||
<strong>
|
||||
<%=Services.TextService.Localize("alias")%>
|
||||
:</strong>
|
||||
<asp:Literal ID="dtAlias" runat="server"></asp:Literal>
|
||||
<br />
|
||||
<br />
|
||||
<asp:Button ID="import" runat="server"></asp:Button>
|
||||
</asp:Panel>
|
||||
<asp:Panel ID="done" runat="server" Visible="False">
|
||||
<asp:Literal ID="dtNameConfirm" runat="server"></asp:Literal>
|
||||
has been imported!
|
||||
</asp:Panel>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</asp:Content>
|
||||
@@ -1539,5 +1539,196 @@ namespace Umbraco.Web.Editors
|
||||
Services.NotificationService.SetNotifications(Security.CurrentUser, content, notifyOptions);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public AvailableContentTypes GetAvailableContentTypesToChangeTo(int currentNodeId)
|
||||
{
|
||||
var content = Services.ContentService.GetById(currentNodeId);
|
||||
|
||||
// Start with all content types
|
||||
var contentTypes = Services.ContentTypeService.GetAll().ToArray();
|
||||
|
||||
//Remove invalid ones from list of potential alternatives
|
||||
//Remove CurrentDoctype
|
||||
contentTypes = contentTypes.Where(x => x.Id != content.ContentTypeId).ToArray();
|
||||
|
||||
//Remove Invalid Parent Doctypes
|
||||
if (content.ParentId == -1)
|
||||
{
|
||||
// Root content, only include those that have been selected as allowed at root
|
||||
contentTypes = contentTypes.Where(x => x.AllowedAsRoot).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Below root, so only include those allowed as sub-nodes for the parent
|
||||
var parentNode = Services.ContentService.GetById(content.ParentId);
|
||||
|
||||
contentTypes = contentTypes
|
||||
.Where(x => parentNode.ContentType.AllowedContentTypes
|
||||
.Select(y => y.Id.Value)
|
||||
.Contains(x.Id)).ToArray();
|
||||
}
|
||||
|
||||
//Remove invalid children doctypes
|
||||
var docTypeIdsOfChildren = content.Children(Services.ContentService)
|
||||
.Select(x => x.ContentType.Id)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
contentTypes = contentTypes
|
||||
.Where(x => x.AllowedContentTypes
|
||||
.Select(y => y.Id.Value)
|
||||
.ContainsAll(docTypeIdsOfChildren)).ToArray();
|
||||
|
||||
//Return a friendlier model down the wire
|
||||
var basicContentTypes = new List<ContentTypeBasic>();
|
||||
foreach (var type in contentTypes)
|
||||
{
|
||||
basicContentTypes.Add(Mapper.Map<IContentType, ContentTypeBasic>(type));
|
||||
}
|
||||
|
||||
return new AvailableContentTypes
|
||||
{
|
||||
ContentTypes = basicContentTypes,
|
||||
CurrentNodeName = content.Name,
|
||||
CurrentContentType = Mapper.Map<IContentType, ContentTypeBasic>(content.ContentType)
|
||||
};
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public AvailableProperties GetAvailableProperties(string fromPropertyAlias, string toPropertyAlias)
|
||||
{
|
||||
//Get the new property type we are changing to
|
||||
var newContentType = Services.ContentTypeService.Get(toPropertyAlias);
|
||||
|
||||
//Get the current property type that the content node is using
|
||||
var currentContentType = Services.ContentTypeService.Get(fromPropertyAlias);
|
||||
|
||||
var properties = new List<CurrentProperty>();
|
||||
|
||||
//Create a list of current properties the current doctype has
|
||||
//With each property in this list specifying what new properties from the doctype we are changing to
|
||||
//Ensuring they use the same underlying property editor alias
|
||||
foreach (var currentProp in currentContentType.PropertyTypes)
|
||||
{
|
||||
var propertyToAdd = new CurrentProperty
|
||||
{
|
||||
Name = currentProp.Name,
|
||||
Alias = currentProp.Alias
|
||||
};
|
||||
|
||||
var allowedProps = new List<NewProperty>();
|
||||
foreach (var newProp in newContentType.PropertyTypes.Where(x => x.PropertyEditorAlias == currentProp.PropertyEditorAlias))
|
||||
{
|
||||
var allowedProp = new NewProperty
|
||||
{
|
||||
Name = newProp.Name,
|
||||
Alias = newProp.Alias
|
||||
};
|
||||
|
||||
allowedProps.Add(allowedProp);
|
||||
}
|
||||
|
||||
propertyToAdd.Allowed = allowedProps;
|
||||
properties.Add(propertyToAdd);
|
||||
}
|
||||
|
||||
var templates = new List<TemplateDisplay>();
|
||||
foreach (var template in newContentType.AllowedTemplates)
|
||||
{
|
||||
templates.Add(Mapper.Map<ITemplate, TemplateDisplay>(template));
|
||||
}
|
||||
|
||||
return new AvailableProperties
|
||||
{
|
||||
Templates = templates,
|
||||
CurrentProperties = properties
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
{
|
||||
"contentNodeId": 1234,
|
||||
"newContentTypeId": 80,
|
||||
"newTemplateId": 40,
|
||||
"fieldMap": [
|
||||
{
|
||||
"fromAlias": "siteTitle",
|
||||
"toAlias": "newsTitle"
|
||||
},
|
||||
{
|
||||
"fromAlias": "bodyText",
|
||||
"toAlias": null
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
[HttpPost]
|
||||
public HttpResponseMessage PostContentTypeChange(ChangeContentType model)
|
||||
{
|
||||
var content = Services.ContentService.GetById(model.ContentNodeId);
|
||||
if (content == null)
|
||||
{
|
||||
//throw some ex
|
||||
return Request.CreateNotificationValidationErrorResponse("Content is null");
|
||||
}
|
||||
|
||||
//Check that field mappings (do not have something selected twice & is unique)
|
||||
if (model.FieldMap.GroupBy(x => x.ToAlias).Any(g => g.Count() > 1))
|
||||
{
|
||||
//Throw Error
|
||||
return Request.CreateNotificationValidationErrorResponse(Services.TextService.Localize("changeDocType/validationErrorPropertyWithMoreThanOneMapping"));
|
||||
}
|
||||
|
||||
// For all properties to be mapped, save the current values to a temporary list
|
||||
var propertyMappings = new List<FieldMapValue>();
|
||||
foreach (var map in model.FieldMap)
|
||||
{
|
||||
//If the ToAlias is not empty
|
||||
if (!string.IsNullOrEmpty(map.ToAlias))
|
||||
{
|
||||
// Mapping property, get current property value from alias
|
||||
var sourceAlias = map.FromAlias;
|
||||
var sourcePropertyValue = content.GetValue(sourceAlias);
|
||||
|
||||
// Add to list
|
||||
propertyMappings.Add(new FieldMapValue
|
||||
{
|
||||
ToAlias = map.ToAlias,
|
||||
CurrentValue = sourcePropertyValue
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Get flag for if content already published
|
||||
var wasPublished = content.Published;
|
||||
|
||||
// Change the document type passing flag to clear the properties
|
||||
var newContentType = Services.ContentTypeService.Get(model.NewContentTypeId);
|
||||
content.ChangeContentType(newContentType, true);
|
||||
|
||||
//Set the template if one has been selected
|
||||
content.Template = model.NewTemplateId > 0 ? Services.FileService.GetTemplate(model.NewTemplateId) : null;
|
||||
|
||||
// Port across the property values to the new properties
|
||||
foreach (var propertyMapping in propertyMappings)
|
||||
{
|
||||
content.SetValue(propertyMapping.ToAlias, propertyMapping.CurrentValue);
|
||||
}
|
||||
|
||||
// Save the changes
|
||||
var user = Security.CurrentUser;
|
||||
Services.ContentService.Save(content, user.Id);
|
||||
|
||||
// Publish if the content was already published
|
||||
if (wasPublished)
|
||||
{
|
||||
// no values to publish, really
|
||||
Services.ContentService.SaveAndPublish(content, userId: user.Id);
|
||||
}
|
||||
|
||||
//All OK - return a 200
|
||||
return Request.CreateNotificationSuccessResponse("DOCTYPE CHANGED");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
using AutoMapper;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Composing;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.UI;
|
||||
using Umbraco.Web.WebApi;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
|
||||
|
||||
namespace Umbraco.Web.Editors
|
||||
{
|
||||
@@ -454,5 +462,93 @@ namespace Umbraco.Web.Editors
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public HttpResponseMessage Import(string file)
|
||||
{
|
||||
var filePath = Path.Combine(IOHelper.MapPath(SystemDirectories.Data), file);
|
||||
if (string.IsNullOrEmpty(file) || !System.IO.File.Exists(filePath))
|
||||
{
|
||||
return Request.CreateResponse(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
var xd = new XmlDocument();
|
||||
xd.XmlResolver = null;
|
||||
xd.Load(filePath);
|
||||
|
||||
var userId = Security.GetUserId();
|
||||
var element = XElement.Parse(xd.InnerXml);
|
||||
Current.Services.PackagingService.ImportContentTypes(element, userId);
|
||||
|
||||
// Try to clean up the temporary file.
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Current.Logger.Error(typeof(ContentTypeController), "Error cleaning up temporary udt file in App_Data: " + ex.Message, ex);
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[FileUploadCleanupFilter(false)]
|
||||
public async Task<ContentTypeImportModel> Upload()
|
||||
{
|
||||
if (Request.Content.IsMimeMultipartContent() == false)
|
||||
{
|
||||
throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
|
||||
}
|
||||
|
||||
var root = IOHelper.MapPath("~/App_Data/TEMP/FileUploads");
|
||||
//ensure it exists
|
||||
Directory.CreateDirectory(root);
|
||||
var provider = new MultipartFormDataStreamProvider(root);
|
||||
var result = await Request.Content.ReadAsMultipartAsync(provider);
|
||||
|
||||
//must have a file
|
||||
if (result.FileData.Count == 0)
|
||||
{
|
||||
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
|
||||
}
|
||||
|
||||
var model = new ContentTypeImportModel();
|
||||
var file = result.FileData[0];
|
||||
var fileName = file.Headers.ContentDisposition.FileName.Trim('\"');
|
||||
var ext = fileName.Substring(fileName.LastIndexOf('.') + 1).ToLower();
|
||||
if (ext.InvariantEquals("udt"))
|
||||
{
|
||||
//TODO: Currently it has to be here, it's not ideal but that's the way it is right now
|
||||
var tempDir = IOHelper.MapPath(SystemDirectories.Data);
|
||||
|
||||
//ensure it's there
|
||||
Directory.CreateDirectory(tempDir);
|
||||
|
||||
model.TempFileName = "justDelete_" + Guid.NewGuid() + ".udt";
|
||||
var tempFileLocation = Path.Combine(tempDir, model.TempFileName);
|
||||
System.IO.File.Copy(file.LocalFileName, tempFileLocation, true);
|
||||
|
||||
var xd = new XmlDocument
|
||||
{
|
||||
XmlResolver = null
|
||||
};
|
||||
xd.Load(tempFileLocation);
|
||||
|
||||
model.Alias = xd.DocumentElement?.SelectSingleNode("//DocumentType/Info/Alias")?.FirstChild.Value;
|
||||
model.Name = xd.DocumentElement?.SelectSingleNode("//DocumentType/Info/Name")?.FirstChild.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
model.Notifications.Add(new Notification(
|
||||
Services.TextService.Localize("speechBubbles/operationFailedHeader"),
|
||||
Services.TextService.Localize("media/disallowedFileType"),
|
||||
SpeechBubbleIcon.Warning));
|
||||
}
|
||||
|
||||
return model;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "changeContentType", Namespace = "")]
|
||||
public class ChangeContentType
|
||||
{
|
||||
[DataMember(Name = "contentNodeId")]
|
||||
public int ContentNodeId { get; set; }
|
||||
|
||||
[DataMember(Name = "newContentTypeId")]
|
||||
public int NewContentTypeId { get; set; }
|
||||
|
||||
[DataMember(Name = "newTemplateId")]
|
||||
public int NewTemplateId { get; set; }
|
||||
|
||||
[DataMember(Name = "fieldMap")]
|
||||
public IEnumerable<FieldMap> FieldMap { get; set; }
|
||||
}
|
||||
|
||||
[DataContract(Name = "fieldMap", Namespace = "")]
|
||||
public class FieldMap
|
||||
{
|
||||
[DataMember(Name = "fromAlias")]
|
||||
public string FromAlias { get; set; }
|
||||
|
||||
[DataMember(Name = "toAlias")]
|
||||
public string ToAlias { get; set; }
|
||||
}
|
||||
|
||||
public class FieldMapValue
|
||||
{
|
||||
public string ToAlias { get; set; }
|
||||
|
||||
public object CurrentValue { get; set; }
|
||||
}
|
||||
|
||||
[DataContract(Name = "availableContentTypes", Namespace = "")]
|
||||
public class AvailableContentTypes
|
||||
{
|
||||
[DataMember(Name = "currentNodeName")]
|
||||
public string CurrentNodeName { get; set; }
|
||||
|
||||
[DataMember(Name = "currentContentType")]
|
||||
public ContentTypeBasic CurrentContentType { get; set; }
|
||||
|
||||
[DataMember(Name = "contentTypes")]
|
||||
public IEnumerable<ContentTypeBasic> ContentTypes { get; set; }
|
||||
}
|
||||
|
||||
[DataContract(Name = "availableProperties", Namespace = "")]
|
||||
public class AvailableProperties
|
||||
{
|
||||
[DataMember(Name = "templates")]
|
||||
public IEnumerable<TemplateDisplay> Templates { get; set; }
|
||||
|
||||
[DataMember(Name = "currentProperties")]
|
||||
public IEnumerable<CurrentProperty> CurrentProperties { get; set; }
|
||||
}
|
||||
|
||||
[DataContract(Name = "currentProperty", Namespace = "")]
|
||||
public class CurrentProperty
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "allowed")]
|
||||
public IEnumerable<NewProperty> Allowed { get; set; }
|
||||
}
|
||||
|
||||
[DataContract(Name = "newProperty", Namespace = "")]
|
||||
public class NewProperty
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
[DataContract(Name = "contentTypeImportModel")]
|
||||
public class ContentTypeImportModel : INotificationModel
|
||||
{
|
||||
public ContentTypeImportModel()
|
||||
{
|
||||
Notifications = new List<Notification>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "notifications")]
|
||||
public List<Notification> Notifications { get; }
|
||||
|
||||
[DataMember(Name = "tempFileName")]
|
||||
public string TempFileName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ namespace Umbraco.Web.Trees
|
||||
//need to ensure some of these are converted to the legacy system - until we upgrade them all to be angularized.
|
||||
AddActionNode<ActionMove>(item, menu, true);
|
||||
AddActionNode<ActionCopy>(item, menu);
|
||||
AddActionNode<ActionChangeDocType>(item, menu, convert: true);
|
||||
AddActionNode<ActionChangeDocType>(item, menu);
|
||||
|
||||
AddActionNode<ActionSort>(item, menu, true);
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ using System.Net.Http.Formatting;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
@@ -74,13 +73,7 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
// root actions
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize(string.Format("actions/{0}", ActionNew.Instance.Alias)));
|
||||
menu.Items.Add<ActionImport>(Services.TextService.Localize(string.Format("actions/{0}", ActionImport.Instance.Alias)), true).ConvertLegacyMenuItem(new EntitySlim
|
||||
{
|
||||
Id = int.Parse(id),
|
||||
Level = 1,
|
||||
ParentId = Constants.System.Root,
|
||||
Name = ""
|
||||
}, "documenttypes", "settings");
|
||||
menu.Items.Add<ActionImport>(Services.TextService.Localize(string.Format("actions/{0}", ActionImport.Instance.Alias)), true);
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias)), true);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@@ -211,58 +211,49 @@ namespace Umbraco.Web.Trees
|
||||
new LegacyUrlAction(
|
||||
"create.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/create")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionNewFolder()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"createFolder.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/create")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionProtect()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/protectPage.aspx?mode=cut&nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/protect")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionRollback()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/rollback.aspx?nodeId=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/rollback")));
|
||||
case "UmbClientMgr.appActions().actionNotify()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/notifications.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/notify")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionPublish()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/publish.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/publish")));
|
||||
case "UmbClientMgr.appActions().actionChangeDocType()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/ChangeDocType.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/changeDocType")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionToPublish()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/SendPublish.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/sendtopublish")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionRePublish()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/republish.aspx?rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/republish")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionSendToTranslate()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/sendToTranslation.aspx?id=" + nodeId + "&rnd=" + DateTime.UtcNow.Ticks,
|
||||
Current.Services.TextService.Localize("actions/sendToTranslate")));
|
||||
|
||||
case "UmbClientMgr.appActions().actionImport()":
|
||||
return Attempt.Succeed(
|
||||
new LegacyUrlAction(
|
||||
"dialogs/importDocumentType.aspx",
|
||||
Current.Services.TextService.Localize("actions/importDocumentType")));
|
||||
|
||||
}
|
||||
return Attempt<LegacyUrlAction>.Fail();
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@
|
||||
<Compile Include="Editors\BackOfficeAssetsController.cs" />
|
||||
<Compile Include="Editors\BackOfficeModel.cs" />
|
||||
<Compile Include="Editors\BackOfficeServerVariables.cs" />
|
||||
<Compile Include="Models\ContentEditing\ChangeContentType.cs" />
|
||||
<Compile Include="Models\ContentEditing\ContentSavedState.cs" />
|
||||
<Compile Include="WebApi\HttpActionContextExtensions.cs" />
|
||||
<Compile Include="Models\ContentEditing\IContentSave.cs" />
|
||||
@@ -246,6 +247,7 @@
|
||||
<Compile Include="Models\ContentEditing\UserProfile.cs" />
|
||||
<Compile Include="Models\ContentEditing\UserSave.cs" />
|
||||
<Compile Include="Models\ContentEditing\Language.cs" />
|
||||
<Compile Include="Models\ContentTypeImportModel.cs" />
|
||||
<Compile Include="Models\Mapping\ActionButtonsResolver.cs" />
|
||||
<Compile Include="Models\Mapping\AuditMapperProfile.cs" />
|
||||
<Compile Include="Models\Mapping\ContentAppResolver.cs" />
|
||||
@@ -1295,10 +1297,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\developer\Packages\editPackage.aspx.designer.cs">
|
||||
<DependentUpon>editPackage.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\importDocumenttype.aspx.cs">
|
||||
<DependentUpon>importDocumenttype.aspx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="umbraco.presentation\umbraco\dialogs\rollBack.aspx.cs">
|
||||
<DependentUpon>rollBack.aspx</DependentUpon>
|
||||
</Compile>
|
||||
@@ -1449,7 +1447,6 @@
|
||||
<Content Include="umbraco.presentation\umbraco\developer\Packages\editPackage.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\importDocumenttype.aspx" />
|
||||
<Content Include="umbraco.presentation\umbraco\dialogs\rollBack.aspx">
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Content>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Umbraco.Web._Legacy.Actions
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0}.actionChangeDocType()", ClientTools.Scripts.GetAppActions);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using Umbraco.Web.UI.Pages;
|
||||
|
||||
namespace Umbraco.Web._Legacy.Actions
|
||||
namespace Umbraco.Web._Legacy.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// This action is invoked when importing a document type
|
||||
@@ -32,7 +29,7 @@ namespace Umbraco.Web._Legacy.Actions
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format("{0}.actionImport()", ClientTools.Scripts.GetAppActions);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
<%@ Page MasterPageFile="../masterpages/umbracoDialog.Master" Language="c#" Codebehind="importDocumenttype.aspx.cs" AutoEventWireup="false"
|
||||
Inherits="umbraco.presentation.umbraco.dialogs.importDocumentType" %>
|
||||
|
||||
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="body">
|
||||
<input id="tempFile" type="hidden" name="tempFile" runat="server" />
|
||||
|
||||
<asp:Literal ID="FeedBackMessage" runat="server" />
|
||||
|
||||
<table class="propertyPane" id="Table1" cellspacing="0" cellpadding="4" width="360" border="0" runat="server">
|
||||
<tr>
|
||||
<td class="propertyContent" colspan="2">
|
||||
<asp:Panel ID="Wizard" runat="server" Visible="True">
|
||||
<p>
|
||||
<span class="guiDialogNormal">
|
||||
<%=Services.TextService.Localize("importDocumentTypeHelp")%>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input id="documentTypeFile" type="file" runat="server" />
|
||||
</p>
|
||||
|
||||
|
||||
<asp:Button ID="submit" runat="server"></asp:Button> <em><%= Services.TextService.Localize("or") %></em> <a href="#" onclick="UmbClientMgr.closeModalWindow(); return false;"><%= Services.TextService.Localize("cancel") %></a>
|
||||
</asp:Panel>
|
||||
|
||||
|
||||
<asp:Panel ID="Confirm" runat="server" Visible="False">
|
||||
<strong>
|
||||
<%=Services.TextService.Localize("name")%>
|
||||
:</strong>
|
||||
<asp:Literal ID="dtName" runat="server"></asp:Literal>
|
||||
<br />
|
||||
<strong>
|
||||
<%=Services.TextService.Localize("alias")%>
|
||||
:</strong>
|
||||
<asp:Literal ID="dtAlias" runat="server"></asp:Literal>
|
||||
<br />
|
||||
<br />
|
||||
<asp:Button ID="import" runat="server"></asp:Button>
|
||||
</asp:Panel>
|
||||
<asp:Panel ID="done" runat="server" Visible="False">
|
||||
<asp:Literal ID="dtNameConfirm" runat="server"></asp:Literal>
|
||||
has been imported!
|
||||
</asp:Panel>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</asp:Content>
|
||||
@@ -1,121 +0,0 @@
|
||||
using Umbraco.Core.Services;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Composing;
|
||||
|
||||
namespace umbraco.presentation.umbraco.dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for importDocumentType.
|
||||
/// </summary>
|
||||
public class importDocumentType : Umbraco.Web.UI.Pages.UmbracoEnsuredPage
|
||||
{
|
||||
public importDocumentType()
|
||||
{
|
||||
|
||||
CurrentApp = Constants.Applications.Settings.ToString();
|
||||
|
||||
}
|
||||
protected Literal FeedBackMessage;
|
||||
protected Literal jsShowWindow;
|
||||
protected Panel Wizard;
|
||||
protected HtmlTable Table1;
|
||||
protected HtmlInputHidden tempFile;
|
||||
protected HtmlInputFile documentTypeFile;
|
||||
protected Button submit;
|
||||
protected Panel Confirm;
|
||||
protected Literal dtName;
|
||||
protected Literal dtAlias;
|
||||
protected Button import;
|
||||
protected Literal dtNameConfirm;
|
||||
protected Panel done;
|
||||
private string tempFileName = "";
|
||||
|
||||
private void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
submit.Text = Services.TextService.Localize("import");
|
||||
import.Text = Services.TextService.Localize("import");
|
||||
}
|
||||
}
|
||||
|
||||
#region Web Form Designer generated code
|
||||
override protected void OnInit(EventArgs e)
|
||||
{
|
||||
//
|
||||
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
|
||||
//
|
||||
InitializeComponent();
|
||||
base.OnInit(e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.submit.Click += new System.EventHandler(this.submit_Click);
|
||||
this.import.Click += new System.EventHandler(this.import_Click);
|
||||
this.Load += new System.EventHandler(this.Page_Load);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void import_Click(object sender, EventArgs e)
|
||||
{
|
||||
var xd = new XmlDocument();
|
||||
xd.XmlResolver = null;
|
||||
xd.Load(tempFile.Value);
|
||||
|
||||
var userId = Security.GetUserId();
|
||||
|
||||
var element = XElement.Parse(xd.InnerXml);
|
||||
var importContentTypes = Current.Services.PackagingService.ImportContentTypes(element, userId);
|
||||
var contentType = importContentTypes.FirstOrDefault();
|
||||
if (contentType != null)
|
||||
dtNameConfirm.Text = contentType.Name;
|
||||
|
||||
// Try to clean up the temporary file.
|
||||
try
|
||||
{
|
||||
System.IO.File.Delete(tempFile.Value);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Current.Logger.Error(typeof(importDocumentType), "Error cleaning up temporary udt file in App_Data: " + ex.Message, ex);
|
||||
}
|
||||
|
||||
Wizard.Visible = false;
|
||||
Confirm.Visible = false;
|
||||
done.Visible = true;
|
||||
}
|
||||
|
||||
private void submit_Click(object sender, EventArgs e)
|
||||
{
|
||||
tempFileName = "justDelete_" + Guid.NewGuid().ToString() + ".udt";
|
||||
var fileName = IOHelper.MapPath(SystemDirectories.Data + "/" + tempFileName);
|
||||
tempFile.Value = fileName;
|
||||
|
||||
documentTypeFile.PostedFile.SaveAs(fileName);
|
||||
|
||||
var xd = new XmlDocument();
|
||||
xd.XmlResolver = null;
|
||||
xd.Load(fileName);
|
||||
dtName.Text = xd.DocumentElement.SelectSingleNode("//DocumentType/Info/Name").FirstChild.Value;
|
||||
dtAlias.Text = xd.DocumentElement.SelectSingleNode("//DocumentType/Info/Alias").FirstChild.Value;
|
||||
|
||||
Wizard.Visible = false;
|
||||
done.Visible = false;
|
||||
Confirm.Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user