diff --git a/src/Umbraco.Core/XmlHelper.cs b/src/Umbraco.Core/XmlHelper.cs
index d45f0cac3b..66dcae7358 100644
--- a/src/Umbraco.Core/XmlHelper.cs
+++ b/src/Umbraco.Core/XmlHelper.cs
@@ -17,6 +17,35 @@ namespace Umbraco.Core
///
public class XmlHelper
{
+ ///
+ /// Creates or sets an attribute on the XmlNode if an Attributes collection is available
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static void SetAttribute(XmlDocument xml, XmlNode n, string name, string value)
+ {
+ if (xml == null) throw new ArgumentNullException("xml");
+ if (n == null) throw new ArgumentNullException("n");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
+ if (n.Attributes == null)
+ {
+ return;
+ }
+ if (n.Attributes[name] == null)
+ {
+ var a = xml.CreateAttribute(name);
+ a.Value = value;
+ n.Attributes.Append(a);
+ }
+ else
+ {
+ n.Attributes[name].Value = value;
+ }
+ }
+
///
/// Gets a value indicating whether a specified string contains only xml whitespace characters.
///
@@ -338,6 +367,9 @@ namespace Umbraco.Core
/// a XmlAttribute
public static XmlAttribute AddAttribute(XmlDocument xd, string name, string value)
{
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (string.IsNullOrEmpty(name)) throw new ArgumentException("Value cannot be null or empty.", "name");
+
var temp = xd.CreateAttribute(name);
temp.Value = value;
return temp;
@@ -352,11 +384,37 @@ namespace Umbraco.Core
/// a XmlNode
public static XmlNode AddTextNode(XmlDocument xd, string name, string value)
{
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
var temp = xd.CreateNode(XmlNodeType.Element, name, "");
temp.AppendChild(xd.CreateTextNode(value));
return temp;
}
+ ///
+ /// Sets or Creates a text XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node value.
+ /// a XmlNode
+ public static XmlNode SetTextNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (parent == null) throw new ArgumentNullException("parent");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
+ var child = parent.SelectSingleNode(name);
+ if (child != null)
+ {
+ child.InnerText = value;
+ return child;
+ }
+ return AddTextNode(xd, name, value);
+ }
+
///
/// Creates a cdata XmlNode with the specified name and value
///
@@ -366,11 +424,37 @@ namespace Umbraco.Core
/// A XmlNode
public static XmlNode AddCDataNode(XmlDocument xd, string name, string value)
{
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
var temp = xd.CreateNode(XmlNodeType.Element, name, "");
temp.AppendChild(xd.CreateCDataSection(value));
return temp;
}
+ ///
+ /// Sets or Creates a cdata XmlNode with the specified name and value
+ ///
+ /// The xmldocument.
+ /// The node to set or create the child text node on
+ /// The node name.
+ /// The node value.
+ /// a XmlNode
+ public static XmlNode SetCDataNode(XmlDocument xd, XmlNode parent, string name, string value)
+ {
+ if (xd == null) throw new ArgumentNullException("xd");
+ if (parent == null) throw new ArgumentNullException("parent");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
+ var child = parent.SelectSingleNode(name);
+ if (child != null)
+ {
+ child.InnerXml = ""; ;
+ return child;
+ }
+ return AddCDataNode(xd, name, value);
+ }
+
///
/// Gets the value of a XmlNode
///
diff --git a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
index 561b9dd753..42ceb86964 100644
--- a/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/dashboard/dashboard.tabs.controller.js
@@ -22,22 +22,26 @@ function FormsController($scope, $route, $cookieStore, packageResource) {
$scope.state = "Installng package";
packageResource
.fetch("CD44CF39-3D71-4C19-B6EE-948E1FAF0525")
- .then(function(pack){
- $scope.state = "importing";
- return packageResource.import(pack);
- }, $scope.error)
- .then(function(pack){
- $scope.state = "Installing";
- return packageResource.installFiles(pack);
- }, $scope.error)
- .then(function(pack){
- $scope.state = "Restarting, please wait...";
- return packageResource.installData(pack);
- }, $scope.error)
- .then(function(pack){
- $scope.state = "All done, your browser will now refresh";
- return packageResource.cleanUp(pack);
- }, $scope.error)
+ .then(function(pack) {
+ $scope.state = "importing";
+ return packageResource.import(pack);
+ },
+ $scope.error)
+ .then(function(pack) {
+ $scope.state = "Installing";
+ return packageResource.installFiles(pack);
+ },
+ $scope.error)
+ .then(function(pack) {
+ $scope.state = "Restarting, please wait...";
+ return packageResource.installData(pack);
+ },
+ $scope.error)
+ .then(function(pack) {
+ $scope.state = "All done, your browser will now refresh";
+ return packageResource.cleanUp(pack);
+ },
+ $scope.error)
.then($scope.complete, $scope.error);
};
@@ -50,6 +54,8 @@ function FormsController($scope, $route, $cookieStore, packageResource) {
$scope.error = function(err){
$scope.state = undefined;
$scope.error = err;
+ //This will return a rejection meaning that the promise change above will stop
+ return $q.reject();
};
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
index c68b31038f..4d9f97718c 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/install-local.controller.js
@@ -1,7 +1,7 @@
(function () {
"use strict";
- function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, $cookieStore, $timeout) {
+ function PackagesInstallLocalController($scope, $route, $location, Upload, umbRequestHelper, packageResource, $cookieStore, $timeout, $q) {
var vm = this;
vm.state = "upload";
@@ -95,16 +95,11 @@
}
function installPackage() {
- vm.installState.status = "Installing";
+ vm.installState.status = "Importing";
//TODO: If any of these fail, will they keep calling the next one?
packageResource
- .installFiles(vm.localPackage)
- .then(function(pack) {
- vm.installState.status = "Importing...";
- return packageResource.import(pack);
- },
- installError)
+ .import(vm.localPackage)
.then(function(pack) {
vm.installState.status = "Installing...";
return packageResource.installFiles(pack);
@@ -116,7 +111,7 @@
},
installError)
.then(function(pack) {
- vm.installState.status = "All done, your browser will now refresh";
+ vm.installState.status = "All done, your browser will now refresh, please wait...";
return packageResource.cleanUp(pack);
},
installError)
@@ -135,9 +130,10 @@
},
installError);
}
-
+
function installError() {
- //TODO: Need to do something about this?
+ //This will return a rejection meaning that the promise change above will stop
+ return $q.reject();
}
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html
index 403406545c..7a445458f3 100644
--- a/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html
+++ b/src/Umbraco.Web.UI.Client/src/views/packager/views/installed.html
@@ -10,8 +10,8 @@
-
-
![]()
+
+