+ * dictionaryResource.exportItem(1234){
+ * .then(function() {
+ * Do stuff..
+ * });
+ *
+ *
+ * @param {Int} id the ID of the dictionary item so export
+ * @param {Bool?} includeChildren if children should also be exported
+ * @returns {Promise} resourcePromise object.
+ *
+ */
+ function exportItem(id, includeChildren) {
+ if (!id) {
+ throw "id cannot be null";
+ }
+
+ var url = umbRequestHelper.getApiUrl("dictionaryApiBaseUrl", "ExportDictionary", { id: id, includeChildren: includeChildren });
+
+ return umbRequestHelper.downloadFile(url).then(function () {
+ localizationService.localize("speechBubbles_dictionaryItemExportedSuccess").then(function(value) {
+ notificationsService.success(value);
+ });
+ }, function (data) {
+ localizationService.localize("speechBubbles_dictionaryItemExportedError").then(function(value) {
+ notificationsService.error(value);
+ });
+ });
+ }
+
+ /**
+ * @ngdoc method
+ * @name umbraco.resources.dictionaryResource#import
+ * @methodOf umbraco.resources.dictionaryResource
+ *
+ * @description
+ * Import a dictionary item from a file
+ *
+ * ##usage
+ *
+ * dictionaryResource.importItem("path to file"){
+ * .then(function() {
+ * Do stuff..
+ * });
+ *
+ *
+ * @param {String} file path of the file to import
+ * @param {Int?} parentId the int of the parent dictionary item to move incomming dictionary items to
+ * @returns {Promise} resourcePromise object.
+ *
+ */
+ function importItem(file, parentId) {
+ if (!file) {
+ throw "file cannot be null";
+ }
+
+ return umbRequestHelper.resourcePromise(
+ $http.post(umbRequestHelper.getApiUrl("dictionaryApiBaseUrl", "ImportDictionary", { file: file, parentId: parentId })),
+ "Failed to import dictionary item " + file
+ );
+ }
+
/**
* @ngdoc method
* @name umbraco.resources.dictionaryResource#getList
@@ -194,6 +265,8 @@ function dictionaryResource($q, $http, $location, umbRequestHelper, umbDataForma
getById: getById,
save: save,
move: move,
+ exportItem: exportItem,
+ importItem: importItem,
getList : getList
};
diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/export.controller.js b/src/Umbraco.Web.UI.Client/src/views/dictionary/export.controller.js
new file mode 100644
index 0000000000..df922e6d96
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/export.controller.js
@@ -0,0 +1,18 @@
+angular.module("umbraco")
+ .controller("Umbraco.Editors.Dictionary.ExportController",
+ function ($scope, dictionaryResource, navigationService) {
+ $scope.includeChildren = false;
+
+ $scope.toggleHandler = function () {
+ $scope.includeChildren = !$scope.includeChildren
+ };
+
+ $scope.export = function () {
+ dictionaryResource.exportItem($scope.currentNode.id, $scope.includeChildren);
+ navigationService.hideMenu();
+ };
+
+ $scope.cancel = function () {
+ navigationService.hideDialog();
+ };
+ });
diff --git a/src/Umbraco.Web.UI.Client/src/views/dictionary/export.html b/src/Umbraco.Web.UI.Client/src/views/dictionary/export.html
new file mode 100644
index 0000000000..c1f5c6b2da
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/views/dictionary/export.html
@@ -0,0 +1,17 @@
+