" + ui.Text("closeThisWindow") + "";
+ //NOTE: We ONLY support Copy on content not media for some reason.
+
+ Services.ContentService.Copy((IContent)currContent, Request.GetItemAs("copyTo"), RelateDocuments.Checked, getUser().Id);
+
+ feedback.Text = ui.Text("moveOrCopy", "copyDone", nodes, getUser()) + "
" + ui.Text("closeThisWindow") + "";
feedback.type = uicontrols.Feedback.feedbacktype.success;
- ClientTools.CopyNode(currentNode.Id.ToString(), newNode.Path);
+
+ // refresh tree
+ ClientTools.CopyNode(currContent.Id.ToString(), parentContent.Path);
}
}
}
}
+ ///
+ /// JsInclude1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
+
+ ///
+ /// feedback control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Feedback feedback;
+
+ ///
+ /// pane_form control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_form;
+
+ ///
+ /// JTree control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.controls.Tree.TreeControl JTree;
+
+ ///
+ /// pp_relate control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel pp_relate;
+
+ ///
+ /// RelateDocuments control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.CheckBox RelateDocuments;
+
+ ///
+ /// pane_form_notice control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.PlaceHolder pane_form_notice;
+
+ ///
+ /// pane_settings control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.Pane pane_settings;
+
+ ///
+ /// PropertyPanel1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
+
+ ///
+ /// masterType control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.ListBox masterType;
+
+ ///
+ /// rename control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.TextBox rename;
+
+ ///
+ /// RequiredFieldValidator1 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
+
+ ///
+ /// panel_buttons control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Panel panel_buttons;
+
+ ///
+ /// ok control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button ok;
+
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.designer.cs
deleted file mode 100644
index f7c669d1ea..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.designer.cs
+++ /dev/null
@@ -1,141 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// This code was generated by a tool.
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-//
-//------------------------------------------------------------------------------
-
-namespace umbraco.dialogs {
-
-
- public partial class moveOrCopy {
-
- ///
- /// JsInclude1 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::ClientDependency.Core.Controls.JsInclude JsInclude1;
-
- ///
- /// feedback control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Feedback feedback;
-
- ///
- /// pane_form control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_form;
-
- ///
- /// JTree control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.controls.Tree.TreeControl JTree;
-
- ///
- /// pp_relate control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel pp_relate;
-
- ///
- /// RelateDocuments control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.CheckBox RelateDocuments;
-
- ///
- /// pane_form_notice control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.PlaceHolder pane_form_notice;
-
- ///
- /// pane_settings control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.Pane pane_settings;
-
- ///
- /// PropertyPanel1 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1;
-
- ///
- /// masterType control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.ListBox masterType;
-
- ///
- /// rename control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.TextBox rename;
-
- ///
- /// RequiredFieldValidator1 control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;
-
- ///
- /// panel_buttons control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Panel panel_buttons;
-
- ///
- /// ok control.
- ///
- ///
- /// Auto-generated field.
- /// To modify move field declaration from designer file to code-behind file.
- ///
- protected global::System.Web.UI.WebControls.Button ok;
- }
-}
diff --git a/src/umbraco.businesslogic/BasePages/BasePage.cs b/src/umbraco.businesslogic/BasePages/BasePage.cs
index 25a09f9b25..78b321fa46 100644
--- a/src/umbraco.businesslogic/BasePages/BasePage.cs
+++ b/src/umbraco.businesslogic/BasePages/BasePage.cs
@@ -7,6 +7,7 @@ using System.Web.Routing;
using System.Web.Security;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
+using Umbraco.Core.Services;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
using Umbraco.Core;
@@ -53,6 +54,30 @@ namespace umbraco.BasePages
get { return umbraco.BusinessLogic.Application.SqlHelper; }
}
+ ///
+ /// Returns the current ApplicationContext
+ ///
+ public ApplicationContext ApplicationContext
+ {
+ get { return ApplicationContext.Current; }
+ }
+
+ ///
+ /// Returns a ServiceContext
+ ///
+ public ServiceContext Services
+ {
+ get { return ApplicationContext.Services; }
+ }
+
+ ///
+ /// Returns a DatabaseContext
+ ///
+ public DatabaseContext DatabaseContext
+ {
+ get { return ApplicationContext.DatabaseContext; }
+ }
+
///
/// Initializes a new instance of the class.
///
From 3618722574faf80a06e07f09421ba85986f3723e Mon Sep 17 00:00:00 2001
From: Shannon
Date: Thu, 20 Jun 2013 15:57:23 +1000
Subject: [PATCH 2/2] Fixed some merging issues.
---
src/Umbraco.Core/XmlExtensions.cs | 137 ++++++++++++++++--
.../PublishedContentCache.cs | 1 +
.../umbraco/dialogs/moveOrCopy.aspx.cs | 4 +-
.../BasePages/BasePage.cs | 26 +---
4 files changed, 130 insertions(+), 38 deletions(-)
diff --git a/src/Umbraco.Core/XmlExtensions.cs b/src/Umbraco.Core/XmlExtensions.cs
index ec53f0521a..4781871cc2 100644
--- a/src/Umbraco.Core/XmlExtensions.cs
+++ b/src/Umbraco.Core/XmlExtensions.cs
@@ -13,37 +13,132 @@ namespace Umbraco.Core
///
internal static class XmlExtensions
{
- static XPathNodeIterator Select(string expression, XPathNavigator source, params XPathVariable[] variables)
- {
- var expr = source.Compile(expression);
- var context = new DynamicContext();
- foreach (var variable in variables)
- context.AddVariable(variable.Name, variable.Value);
- expr.SetContext(context);
- return source.Select(expr);
- }
-
+ ///
+ /// Selects a list of XmlNode matching an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The list of XmlNode matching the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
public static XmlNodeList SelectNodes(this XmlNode source, string expression, IEnumerable variables)
{
var av = variables == null ? null : variables.ToArray();
return SelectNodes(source, expression, av);
}
+ ///
+ /// Selects a list of XmlNode matching an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The list of XmlNode matching the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
+ public static XmlNodeList SelectNodes(this XmlNode source, XPathExpression expression, IEnumerable variables)
+ {
+ var av = variables == null ? null : variables.ToArray();
+ return SelectNodes(source, expression, av);
+ }
+
+ ///
+ /// Selects a list of XmlNode matching an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The list of XmlNode matching the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
public static XmlNodeList SelectNodes(this XmlNode source, string expression, params XPathVariable[] variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
return source.SelectNodes(expression);
- var iterator = Select(expression, source.CreateNavigator(), variables);
+ var iterator = source.CreateNavigator().Select(expression, variables);
return XmlNodeListFactory.CreateNodeList(iterator);
}
+ ///
+ /// Selects a list of XmlNode matching an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The list of XmlNode matching the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
+ public static XmlNodeList SelectNodes(this XmlNode source, XPathExpression expression, params XPathVariable[] variables)
+ {
+ if (variables == null || variables.Length == 0 || variables[0] == null)
+ return source.SelectNodes(expression);
+
+ var iterator = source.CreateNavigator().Select(expression, variables);
+ return XmlNodeListFactory.CreateNodeList(iterator);
+ }
+
+ ///
+ /// Selects the first XmlNode that matches an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The first XmlNode that matches the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
public static XmlNode SelectSingleNode(this XmlNode source, string expression, IEnumerable variables)
{
var av = variables == null ? null : variables.ToArray();
return SelectSingleNode(source, expression, av);
}
+ ///
+ /// Selects the first XmlNode that matches an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The first XmlNode that matches the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
+ public static XmlNode SelectSingleNode(this XmlNode source, XPathExpression expression, IEnumerable variables)
+ {
+ var av = variables == null ? null : variables.ToArray();
+ return SelectSingleNode(source, expression, av);
+ }
+
+ ///
+ /// Selects the first XmlNode that matches an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The first XmlNode that matches the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
public static XmlNode SelectSingleNode(this XmlNode source, string expression, params XPathVariable[] variables)
{
if (variables == null || variables.Length == 0 || variables[0] == null)
@@ -52,6 +147,26 @@ namespace Umbraco.Core
return SelectNodes(source, expression, variables).Cast().FirstOrDefault();
}
+ ///
+ /// Selects the first XmlNode that matches an XPath expression.
+ ///
+ /// A source XmlNode.
+ /// An XPath expression.
+ /// A set of XPathVariables.
+ /// The first XmlNode that matches the XPath expression.
+ ///
+ /// If is null, or is empty, or contains only one single
+ /// value which itself is null, then variables are ignored.
+ /// The XPath expression should reference variables as $var.
+ ///
+ public static XmlNode SelectSingleNode(this XmlNode source, XPathExpression expression, params XPathVariable[] variables)
+ {
+ if (variables == null || variables.Length == 0 || variables[0] == null)
+ return source.SelectSingleNode(expression);
+
+ return SelectNodes(source, expression, variables).Cast().FirstOrDefault();
+ }
+
///
/// Converts from an XDocument to an XmlDocument
///
diff --git a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs
index 88c8f3801e..df143ed8e3 100644
--- a/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs
+++ b/src/Umbraco.Web/PublishedCache/XmlPublishedCache/PublishedContentCache.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Xml;
using System.Xml.XPath;
using Umbraco.Core.Logging;
+using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Xml;
using Umbraco.Web.Routing;
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs
index 2cff12eb51..ba48e944fa 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs
@@ -97,12 +97,12 @@ namespace umbraco.dialogs
if (Request.GetItemAsString("mode") == "cut")
{
- pane_form.Text = ui.Text("moveOrCopy", "moveTo", cmsNode.Text, UmbracoUser);
+ pane_form.Text = ui.Text("moveOrCopy", "moveTo", currContent.Name, UmbracoUser);
pp_relate.Visible = false;
}
else
{
- pane_form.Text = ui.Text("moveOrCopy", "copyTo", cmsNode.Text, UmbracoUser);
+ pane_form.Text = ui.Text("moveOrCopy", "copyTo", currContent.Name, UmbracoUser);
pp_relate.Visible = true;
}
diff --git a/src/umbraco.businesslogic/BasePages/BasePage.cs b/src/umbraco.businesslogic/BasePages/BasePage.cs
index ba48699705..99c1172b1c 100644
--- a/src/umbraco.businesslogic/BasePages/BasePage.cs
+++ b/src/umbraco.businesslogic/BasePages/BasePage.cs
@@ -56,31 +56,7 @@ namespace umbraco.BasePages
protected static ISqlHelper SqlHelper
{
get { return BusinessLogic.Application.SqlHelper; }
- }
-
- ///
- /// Returns the current ApplicationContext
- ///
- public ApplicationContext ApplicationContext
- {
- get { return ApplicationContext.Current; }
- }
-
- ///
- /// Returns a ServiceContext
- ///
- public ServiceContext Services
- {
- get { return ApplicationContext.Services; }
- }
-
- ///
- /// Returns a DatabaseContext
- ///
- public DatabaseContext DatabaseContext
- {
- get { return ApplicationContext.DatabaseContext; }
- }
+ }
///
/// Returns the current ApplicationContext