diff --git a/src/Umbraco.Web/Redirects/RedirectTrackingEventHandler.cs b/src/Umbraco.Web/Redirects/RedirectTrackingEventHandler.cs
index 82c06ca7d5..39b3351aac 100644
--- a/src/Umbraco.Web/Redirects/RedirectTrackingEventHandler.cs
+++ b/src/Umbraco.Web/Redirects/RedirectTrackingEventHandler.cs
@@ -61,6 +61,9 @@ namespace Umbraco.Web.Redirects
///
protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
+ // don't let the event handlers kick in if Redirect Tracking is turned off in the config
+ if (UmbracoConfig.For.UmbracoSettings().WebRouting.DisableRedirectUrlTracking) return;
+
// events are weird
// on 'published' we 'could' get the old or the new route depending on event handlers order
// so it is not reliable. getting the old route in 'publishing' to be sure and storing in http
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs
index 05989ba28e..091996f7f0 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Web.UI;
using System.Web.UI.WebControls;
@@ -193,27 +194,35 @@ namespace umbraco.presentation.developer.packages
}
}
- protected void validateActions(object sender, ServerValidateEventArgs e) {
+ protected void validateActions(object sender, ServerValidateEventArgs e)
+ {
string actions = tb_actions.Text;
- if (!string.IsNullOrEmpty(actions)) {
+ if (!string.IsNullOrEmpty(actions))
+ {
actions = "" + actions + "";
-
- try {
+
+ try
+ {
//we try to load an xml document with the potential malformed xml to ensure that this is actual action xml...
XmlDocument xd = new XmlDocument();
xd.LoadXml(actions);
e.IsValid = true;
- } catch {
+ }
+ catch
+ {
e.IsValid = false;
}
- }else
+ }
+ else
e.IsValid = true;
}
- protected void saveOrPublish(object sender, CommandEventArgs e) {
+ protected void saveOrPublish(object sender, CommandEventArgs e)
+ {
- if (!Page.IsValid) {
+ if (!Page.IsValid)
+ {
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.error, "Saved failed.", "Some fields have not been filled-out correctly");
}
else
@@ -221,30 +230,38 @@ namespace umbraco.presentation.developer.packages
if (e.CommandName == "save")
SavePackage(true);
- if (e.CommandName == "publish") {
+ if (e.CommandName == "publish")
+ {
SavePackage(false);
int packageID = int.Parse(Request.QueryString["id"]);
//string packFileName = cms.businesslogic.packager. Publish.publishPackage(packageID);
createdPackage.Publish();
-
- if (!string.IsNullOrEmpty(pack.PackagePath)) {
+
+ if (!string.IsNullOrEmpty(pack.PackagePath))
+ {
packageUmbFile.Text = " Download";
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.success, "Package saved and published", "");
- } else {
+ }
+ else
+ {
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.error, "Save failed", "check your umbraco log.");
}
}
}
}
- protected void generateXML(object sender, EventArgs e) {
+ [Obsolete("This is not used")]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected void generateXML(object sender, EventArgs e)
+ {
}
- private void SavePackage(bool showNotification) {
+ private void SavePackage(bool showNotification)
+ {
pack.Author = packageAuthorName.Text;
pack.AuthorUrl = packageAuthorUrl.Text;
@@ -262,14 +279,15 @@ namespace umbraco.presentation.developer.packages
pack.ContentLoadChildNodes = packageContentSubdirs.Checked;
- if (!String.IsNullOrEmpty(cp.Value))
+ if (string.IsNullOrEmpty(cp.Value) == false)
pack.ContentNodeId = cp.Value;
else
pack.ContentNodeId = "";
string tmpStylesheets = "";
- foreach (ListItem li in stylesheets.Items) {
+ foreach (ListItem li in stylesheets.Items)
+ {
if (li.Selected)
tmpStylesheets += li.Value + ",";
}
@@ -277,7 +295,8 @@ namespace umbraco.presentation.developer.packages
string tmpDoctypes = "";
- foreach (ListItem li in documentTypes.Items) {
+ foreach (ListItem li in documentTypes.Items)
+ {
if (li.Selected)
tmpDoctypes += li.Value + ",";
}
@@ -285,7 +304,8 @@ namespace umbraco.presentation.developer.packages
string tmpMacros = "";
- foreach (ListItem li in macros.Items) {
+ foreach (ListItem li in macros.Items)
+ {
if (li.Selected)
tmpMacros += li.Value + ",";
}
@@ -293,40 +313,44 @@ namespace umbraco.presentation.developer.packages
string tmpLanguages = "";
- foreach (ListItem li in languages.Items) {
+ foreach (ListItem li in languages.Items)
+ {
if (li.Selected)
tmpLanguages += li.Value + ",";
}
pack.Languages = new List(tmpLanguages.Trim(',').Split(','));
string tmpDictionaries = "";
- foreach (ListItem li in dictionary.Items) {
+ foreach (ListItem li in dictionary.Items)
+ {
if (li.Selected)
tmpDictionaries += li.Value + ",";
}
pack.DictionaryItems = new List(tmpDictionaries.Trim(',').Split(','));
-
+
string tmpTemplates = "";
- foreach (ListItem li in templates.Items) {
+ foreach (ListItem li in templates.Items)
+ {
if (li.Selected)
tmpTemplates += li.Value + ",";
}
pack.Templates = new List(tmpTemplates.Trim(',').Split(','));
string tmpDataTypes = "";
- foreach (ListItem li in cbl_datatypes.Items) {
+ foreach (ListItem li in cbl_datatypes.Items)
+ {
if (li.Selected)
tmpDataTypes += li.Value + ",";
}
pack.DataTypes = new List(tmpDataTypes.Trim(',').Split(','));
-
+
pack.LoadControl = packageControlPath.Text;
-
+
createdPackage.Save();
- if(showNotification)
+ if (showNotification)
this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.save, "Package Saved", "");
}
@@ -355,7 +379,7 @@ namespace umbraco.presentation.developer.packages
TextBox filePathControl = (TextBox)((Control)sender).Parent.FindControl("packageFilePath");
filePathControl.Text = "";
- string tmpFilePathString = "";
+ string tmpFilePathString = "";
foreach (RepeaterItem rItem in packageFilesRepeater.Items)
{
string tmpFFFF = ((TextBox)rItem.FindControl("packageFilePath")).Text;
@@ -365,7 +389,7 @@ namespace umbraco.presentation.developer.packages
cms.businesslogic.packager.CreatedPackage createdPackage = cms.businesslogic.packager.CreatedPackage.GetById(int.Parse(Request.QueryString["id"]));
cms.businesslogic.packager.PackageInstance pack = createdPackage.Data;
-
+
pack.Files = new List(tmpFilePathString.Trim('¤').Split('¤'));
pack.Files.TrimExcess();
@@ -384,7 +408,7 @@ namespace umbraco.presentation.developer.packages
packageInfo.Controls.Add(Pane1_1);
packageInfo.Controls.Add(Pane1_2);
packageInfo.Controls.Add(Pane1_3);
-
+
packageContents = TabView1.NewTabPage("Package Contents");
packageContents.Controls.Add(Pane2);
@@ -417,11 +441,11 @@ namespace umbraco.presentation.developer.packages
saves.ButtonType = uicontrols.MenuButtonType.Primary;
saves.ID = "save";
-
-
+
+
base.OnInit(e);
}
-
+
}
}
diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs
index 71e2248e86..6b4f9edde2 100644
--- a/src/umbraco.cms/businesslogic/Packager/Installer.cs
+++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs
@@ -22,12 +22,6 @@ using umbraco.interfaces;
namespace umbraco.cms.businesslogic.packager
{
- public enum RequirementsType
- {
- Strict,
- Legacy
- }
-
///
/// The packager is a component which enables sharing of both data and functionality components between different umbraco installations.
///
diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs
index 3d9ef6a827..7e5becf61a 100644
--- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs
+++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs
@@ -248,8 +248,12 @@ namespace umbraco.cms.businesslogic.packager
var stylesheets = _packageManifest.CreateElement("Stylesheets");
foreach (var stylesheetName in pack.Stylesheets)
{
+ if (stylesheetName.IsNullOrWhiteSpace()) continue;
var stylesheetXmlNode = utill.Stylesheet(stylesheetName, true, _packageManifest);
- stylesheets.AppendChild(stylesheetXmlNode);
+ if (stylesheetXmlNode != null)
+ {
+ stylesheets.AppendChild(stylesheetXmlNode);
+ }
}
AppendElement(stylesheets);
diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs
index f31862b842..2780bb4423 100644
--- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs
+++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs
@@ -21,50 +21,57 @@ using ICSharpCode.SharpZipLib.Zip;
using Umbraco.Core;
using Umbraco.Core.IO;
-namespace umbraco.cms.businesslogic.packager {
+namespace umbraco.cms.businesslogic.packager
+{
///
/// A utillity class for working with packager data.
/// It provides basic methods for adding new items to a package manifest, moving files and other misc.
///
- public class utill {
-
+ public class utill
+ {
+
///
/// Creates a package manifest containing name, license, version and other meta data.
///
/// The packinstance.
/// The xml document.
///
- public static XmlNode PackageInfo(PackageInstance pack, XmlDocument doc) {
+ public static XmlNode PackageInfo(PackageInstance pack, XmlDocument doc)
+ {
XmlNode info = doc.CreateElement("info");
//Package info
XmlNode package = doc.CreateElement("package");
- package.AppendChild(_node("name", pack.Name, doc));
- package.AppendChild(_node("version", pack.Version, doc));
- package.AppendChild(_node("iconUrl", pack.IconUrl, doc));
+ package.AppendChild(CreateNode("name", pack.Name, doc));
+ package.AppendChild(CreateNode("version", pack.Version, doc));
+ package.AppendChild(CreateNode("iconUrl", pack.IconUrl, doc));
- XmlNode license = _node("license", pack.License, doc);
- license.Attributes.Append(_attribute("url", pack.LicenseUrl, doc));
+ XmlNode license = CreateNode("license", pack.License, doc);
+ license.Attributes.Append(CreateAttribute("url", pack.LicenseUrl, doc));
package.AppendChild(license);
-
- package.AppendChild(_node("url", pack.Url, doc));
- XmlNode Requirements = doc.CreateElement("requirements");
+ package.AppendChild(CreateNode("url", pack.Url, doc));
+
+ XmlNode requirements = doc.CreateElement("requirements");
//NOTE: The defaults are 3.0.0 - I'm just leaving that here since that's the way it's been //SD
- Requirements.AppendChild(_node("major", pack.UmbracoVersion == null ? "3" : pack.UmbracoVersion.Major.ToInvariantString(), doc));
- Requirements.AppendChild(_node("minor", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Minor.ToInvariantString(), doc));
- Requirements.AppendChild(_node("patch", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Build.ToInvariantString(), doc));
- package.AppendChild(Requirements);
+ requirements.AppendChild(CreateNode("major", pack.UmbracoVersion == null ? "3" : pack.UmbracoVersion.Major.ToInvariantString(), doc));
+ requirements.AppendChild(CreateNode("minor", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Minor.ToInvariantString(), doc));
+ requirements.AppendChild(CreateNode("patch", pack.UmbracoVersion == null ? "0" : pack.UmbracoVersion.Build.ToInvariantString(), doc));
+ if (pack.UmbracoVersion != null)
+ {
+ requirements.Attributes.Append(CreateAttribute("type", "strict", doc));
+ }
+ package.AppendChild(requirements);
info.AppendChild(package);
//Author
- XmlNode author = _node("author", "", doc);
- author.AppendChild(_node("name", pack.Author, doc));
- author.AppendChild(_node("website", pack.AuthorUrl, doc));
+ XmlNode author = CreateNode("author", "", doc);
+ author.AppendChild(CreateNode("name", pack.Author, doc));
+ author.AppendChild(CreateNode("website", pack.AuthorUrl, doc));
info.AppendChild(author);
- info.AppendChild(_node("readme", "", doc));
+ info.AppendChild(CreateNode("readme", "", doc));
return info;
}
@@ -76,18 +83,20 @@ namespace umbraco.cms.businesslogic.packager {
/// The template id.
/// The xml doc.
///
- public static XmlNode Template(int templateId, XmlDocument doc) {
+ public static XmlNode Template(int templateId, XmlDocument doc)
+ {
Template tmpl = new Template(templateId);
XmlNode template = doc.CreateElement("Template");
- template.AppendChild(_node("Name", tmpl.Text, doc));
- template.AppendChild(_node("Alias", tmpl.Alias, doc));
+ template.AppendChild(CreateNode("Name", tmpl.Text, doc));
+ template.AppendChild(CreateNode("Alias", tmpl.Alias, doc));
- if (tmpl.MasterTemplate != 0) {
- template.AppendChild(_node("Master", new Template(tmpl.MasterTemplate).Alias, doc));
+ if (tmpl.MasterTemplate != 0)
+ {
+ template.AppendChild(CreateNode("Master", new Template(tmpl.MasterTemplate).Alias, doc));
}
- template.AppendChild(_node("Design", "", doc));
+ template.AppendChild(CreateNode("Design", "", doc));
return template;
}
@@ -101,24 +110,27 @@ namespace umbraco.cms.businesslogic.packager {
///
public static XmlNode Stylesheet(string name, bool includeProperties, XmlDocument doc)
{
+ if (doc == null) throw new ArgumentNullException("doc");
+ if (string.IsNullOrWhiteSpace(name)) throw new ArgumentException("Value cannot be null or whitespace.", "name");
+
if (ApplicationContext.Current == null)
throw new NullReferenceException("ApplicationContext is null");
var fileService = ApplicationContext.Current.Services.FileService;
-
+
var sts = fileService.GetStylesheetByName(name);
var stylesheet = doc.CreateElement("Stylesheet");
- stylesheet.AppendChild(_node("Name", sts.Alias, doc));
- stylesheet.AppendChild(_node("FileName", sts.Name, doc));
- stylesheet.AppendChild(_node("Content", "", doc));
+ stylesheet.AppendChild(CreateNode("Name", sts.Alias, doc));
+ stylesheet.AppendChild(CreateNode("FileName", sts.Name, doc));
+ stylesheet.AppendChild(CreateNode("Content", "", doc));
if (includeProperties)
{
var properties = doc.CreateElement("Properties");
foreach (var ssP in sts.Properties)
{
var property = doc.CreateElement("Property");
- property.AppendChild(_node("Name", ssP.Name, doc));
- property.AppendChild(_node("Alias", ssP.Alias, doc));
- property.AppendChild(_node("Value", ssP.Value, doc));
+ property.AppendChild(CreateNode("Name", ssP.Name, doc));
+ property.AppendChild(CreateNode("Alias", ssP.Alias, doc));
+ property.AppendChild(CreateNode("Value", ssP.Value, doc));
}
stylesheet.AppendChild(properties);
}
@@ -133,11 +145,13 @@ namespace umbraco.cms.businesslogic.packager {
/// The package directory.
/// The doc.
///
- public static XmlNode Macro(int macroId, bool appendFile, string packageDirectory, XmlDocument doc) {
+ public static XmlNode Macro(int macroId, bool appendFile, string packageDirectory, XmlDocument doc)
+ {
Macro mcr = new Macro(macroId);
-
- if (appendFile) {
+
+ if (appendFile)
+ {
if (!string.IsNullOrEmpty(mcr.Xslt))
AppendFileToManifest(IOHelper.ResolveUrl(SystemDirectories.Xslt) + "/" + mcr.Xslt, packageDirectory, doc);
if (!string.IsNullOrEmpty(mcr.ScriptingFile))
@@ -157,43 +171,52 @@ namespace umbraco.cms.businesslogic.packager {
/// The path.
/// The package directory.
/// The doc.
- public static void AppendFileToManifest(string path, string packageDirectory, XmlDocument doc) {
+ public static void AppendFileToManifest(string path, string packageDirectory, XmlDocument doc)
+ {
if (!path.StartsWith("~/") && !path.StartsWith("/"))
path = "~/" + path;
-
+
string serverPath = IOHelper.MapPath(path);
- if (System.IO.File.Exists(serverPath)) {
+ if (System.IO.File.Exists(serverPath))
+ {
AppendFileXml(path, packageDirectory, doc);
-
- } else if(System.IO.Directory.Exists(serverPath)){
+
+ }
+ else if (System.IO.Directory.Exists(serverPath))
+ {
ProcessDirectory(path, packageDirectory, doc);
- }
+ }
}
-
+
//Process files in directory and add them to package
- private static void ProcessDirectory(string path, string packageDirectory, XmlDocument doc) {
+ private static void ProcessDirectory(string path, string packageDirectory, XmlDocument doc)
+ {
string serverPath = IOHelper.MapPath(path);
- if (System.IO.Directory.Exists(serverPath)) {
-
+ if (System.IO.Directory.Exists(serverPath))
+ {
+
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(serverPath);
-
- foreach (System.IO.FileInfo file in di.GetFiles()) {
+
+ foreach (System.IO.FileInfo file in di.GetFiles())
+ {
AppendFileXml(path + "/" + file.Name, packageDirectory, doc);
}
- foreach (System.IO.DirectoryInfo dir in di.GetDirectories()) {
+ foreach (System.IO.DirectoryInfo dir in di.GetDirectories())
+ {
ProcessDirectory(path + "/" + dir.Name, packageDirectory, doc);
}
}
}
- private static void AppendFileXml(string path, string packageDirectory, XmlDocument doc) {
+ private static void AppendFileXml(string path, string packageDirectory, XmlDocument doc)
+ {
string serverPath = IOHelper.MapPath(path);
@@ -201,7 +224,8 @@ namespace umbraco.cms.businesslogic.packager {
string orgName = path.Substring((path.LastIndexOf('/') + 1));
string newFileName = orgName;
- if (System.IO.File.Exists(packageDirectory + "/" + orgName)) {
+ if (System.IO.File.Exists(packageDirectory + "/" + orgName))
+ {
string fileGuid = System.Guid.NewGuid().ToString();
newFileName = fileGuid + "_" + newFileName;
}
@@ -213,9 +237,9 @@ namespace umbraco.cms.businesslogic.packager {
XmlNode files = doc.SelectSingleNode("/umbPackage/files");
XmlNode file = doc.CreateElement("file");
- file.AppendChild(_node("guid", newFileName, doc));
- file.AppendChild(_node("orgPath", orgPath == "" ? "/" : orgPath, doc));
- file.AppendChild(_node("orgName", orgName, doc));
+ file.AppendChild(CreateNode("guid", newFileName, doc));
+ file.AppendChild(CreateNode("orgPath", orgPath == "" ? "/" : orgPath, doc));
+ file.AppendChild(CreateNode("orgName", orgName, doc));
files.AppendChild(file);
}
@@ -228,18 +252,21 @@ namespace umbraco.cms.businesslogic.packager {
///
/// true if [is file in manifest]; otherwise, false.
///
- public static bool IsFileInManifest(string guid, XmlDocument doc) {
+ public static bool IsFileInManifest(string guid, XmlDocument doc)
+ {
return false;
}
-
- private static XmlNode _node(string name, string value, XmlDocument doc) {
- XmlNode node = doc.CreateElement(name);
+
+ private static XmlNode CreateNode(string name, string value, XmlDocument doc)
+ {
+ var node = doc.CreateElement(name);
node.InnerXml = value;
return node;
}
- private static XmlAttribute _attribute(string name, string value, XmlDocument doc) {
- XmlAttribute attribute = doc.CreateAttribute(name);
+ private static XmlAttribute CreateAttribute(string name, string value, XmlDocument doc)
+ {
+ var attribute = doc.CreateAttribute(name);
attribute.Value = value;
return attribute;
}
@@ -249,7 +276,8 @@ namespace umbraco.cms.businesslogic.packager {
///
/// The path.
/// The save path.
- public static void ZipPackage(string Path, string savePath) {
+ public static void ZipPackage(string Path, string savePath)
+ {
string OutPath = savePath;
ArrayList ar = GenerateFileList(Path);
@@ -304,7 +332,8 @@ namespace umbraco.cms.businesslogic.packager {
ar = null;
}
- private static ArrayList GenerateFileList(string Dir) {
+ private static ArrayList GenerateFileList(string Dir)
+ {
ArrayList mid = new ArrayList();
bool Empty = true;
@@ -315,7 +344,8 @@ namespace umbraco.cms.businesslogic.packager {
Empty = false;
}
- if (Empty) {
+ if (Empty)
+ {
if (Directory.GetDirectories(Dir).Length == 0) // if directory is completely empty, add it
{
mid.Add(Dir + @"/");
@@ -324,7 +354,8 @@ namespace umbraco.cms.businesslogic.packager {
foreach (string dirs in Directory.GetDirectories(Dir)) // do this recursively
{
- foreach (object obj in GenerateFileList(dirs)) {
+ foreach (object obj in GenerateFileList(dirs))
+ {
mid.Add(obj);
}
}
diff --git a/src/umbraco.cms/businesslogic/Packager/RequirementsType.cs b/src/umbraco.cms/businesslogic/Packager/RequirementsType.cs
new file mode 100644
index 0000000000..73022cda50
--- /dev/null
+++ b/src/umbraco.cms/businesslogic/Packager/RequirementsType.cs
@@ -0,0 +1,8 @@
+namespace umbraco.cms.businesslogic.packager
+{
+ public enum RequirementsType
+ {
+ Strict,
+ Legacy
+ }
+}
\ No newline at end of file
diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj
index 95b619b961..bdd6d1e5c0 100644
--- a/src/umbraco.cms/umbraco.cms.csproj
+++ b/src/umbraco.cms/umbraco.cms.csproj
@@ -259,6 +259,7 @@
+