diff --git a/src/Umbraco.Core/Models/DataTypeDefinition.cs b/src/Umbraco.Core/Models/DataTypeDefinition.cs
index 1b7c9254f2..ba36c88a2a 100644
--- a/src/Umbraco.Core/Models/DataTypeDefinition.cs
+++ b/src/Umbraco.Core/Models/DataTypeDefinition.cs
@@ -3,9 +3,11 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.Serialization;
+using Umbraco.Core.Logging;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Persistence;
using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
namespace Umbraco.Core.Models
{
@@ -34,8 +36,15 @@ namespace Umbraco.Core.Models
public DataTypeDefinition(int parentId, Guid controlId)
{
_parentId = parentId;
- _propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, true);
-
+
+ _propertyEditorAlias = LegacyPropertyEditorIdToAliasConverter.GetAliasFromLegacyId(controlId, false);
+ if (_propertyEditorAlias == null)
+ {
+ //convert to Label!
+ LogHelper.Warn("Could not find a GUID -> Alias mapping for the legacy property editor with id " + controlId + ". The DataType has been converted to a Label.");
+ _propertyEditorAlias = Constants.PropertyEditors.NoEditAlias;
+ }
+
_additionalData = new Dictionary();
}
public DataTypeDefinition(int parentId, string propertyEditorAlias)
diff --git a/src/Umbraco.Core/Models/PreValue.cs b/src/Umbraco.Core/Models/PreValue.cs
index 3d5f13f5ee..05b7a5f5df 100644
--- a/src/Umbraco.Core/Models/PreValue.cs
+++ b/src/Umbraco.Core/Models/PreValue.cs
@@ -9,7 +9,11 @@
{
Value = value;
Id = id;
+ }
+ public PreValue(string value)
+ {
+ Value = value;
}
///
diff --git a/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs b/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs
new file mode 100644
index 0000000000..10450568b0
--- /dev/null
+++ b/src/Umbraco.Core/Packaging/PackageBinaryInspector.cs
@@ -0,0 +1,178 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Security;
+using System.Security.Permissions;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web;
+
+namespace Umbraco.Core.Packaging
+{
+ internal class PackageBinaryInspector : MarshalByRefObject
+ {
+ ///
+ /// Entry point to call from your code
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Will perform the assembly scan in a separate app domain
+ ///
+ public static IEnumerable ScanAssembliesForTypeReference(string dllPath, out string[] errorReport)
+ {
+ var appDomain = GetTempAppDomain();
+ var type = typeof(PackageBinaryInspector);
+ try
+ {
+ var value = (PackageBinaryInspector)appDomain.CreateInstanceAndUnwrap(
+ type.Assembly.FullName,
+ type.FullName);
+ var result = value.PerformScan(dllPath, out errorReport);
+ return result;
+ }
+ finally
+ {
+ AppDomain.Unload(appDomain);
+ }
+ }
+
+ ///
+ /// Performs the assembly scanning
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// This method is executed in a separate app domain
+ ///
+ internal IEnumerable PerformScan(string dllPath, out string[] errorReport)
+ {
+ if (Directory.Exists(dllPath) == false)
+ {
+ throw new DirectoryNotFoundException("Could not find directory " + dllPath);
+ }
+
+ var files = Directory.GetFiles(dllPath, "*.dll");
+ var dllsWithReference = new List();
+ var errors = new List();
+ var assembliesWithErrors = new List();
+
+ //we need this handler to resolve assembly dependencies below
+ AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += (s, e) =>
+ {
+ var a = Assembly.ReflectionOnlyLoadFrom(GetAssemblyPath(Assembly.ReflectionOnlyLoad(e.Name)));
+ if (a == null) throw new TypeLoadException("Could not load assembly " + e.Name);
+ return a;
+ };
+
+ //First load each dll file into the context
+ foreach (var f in files) Assembly.ReflectionOnlyLoadFrom(f);
+
+ //Then load each referenced assembly into the context
+ foreach (var f in files)
+ {
+ var reflectedAssembly = Assembly.ReflectionOnlyLoadFrom(f);
+ foreach (var assemblyName in reflectedAssembly.GetReferencedAssemblies())
+ {
+ try
+ {
+ Assembly.ReflectionOnlyLoadFrom(GetAssemblyPath(Assembly.ReflectionOnlyLoad(assemblyName.FullName)));
+ }
+ catch (FileNotFoundException)
+ {
+ //if an exception occurs it means that a referenced assembly could not be found
+ errors.Add(
+ string.Concat("This package references the assembly '",
+ assemblyName.Name,
+ "' which was not found, this package may have problems running"));
+ assembliesWithErrors.Add(f);
+ }
+ }
+ }
+
+ var contractType = GetLoadFromContractType();
+
+ //now that we have all referenced types into the context we can look up stuff
+ foreach (var f in files.Except(assembliesWithErrors))
+ {
+ //now we need to see if they contain any type 'T'
+ var reflectedAssembly = Assembly.ReflectionOnlyLoadFrom(f);
+
+ var found = reflectedAssembly.GetExportedTypes()
+ .Where(contractType.IsAssignableFrom);
+
+ if (found.Any())
+ {
+ dllsWithReference.Add(reflectedAssembly.FullName);
+ }
+ }
+
+ errorReport = errors.ToArray();
+ return dllsWithReference;
+ }
+
+ ///
+ /// In order to compare types, the types must be in the same context, this method will return the type that
+ /// we are checking against but from the LoadFrom context.
+ ///
+ ///
+ ///
+ private static Type GetLoadFromContractType()
+ {
+ var contractAssemblyLoadFrom = Assembly.ReflectionOnlyLoadFrom(
+ GetAssemblyPath(Assembly.ReflectionOnlyLoad(typeof (T).Assembly.FullName)));
+
+ var contractType = contractAssemblyLoadFrom.GetExportedTypes()
+ .FirstOrDefault(x => x.FullName == typeof(T).FullName && x.Assembly.FullName == typeof(T).Assembly.FullName);
+
+ if (contractType == null)
+ {
+ throw new InvalidOperationException("Could not find type " + typeof(T) + " in the LoadFrom assemblies");
+ }
+ return contractType;
+ }
+
+ ///
+ /// Create an app domain
+ ///
+ ///
+ private static AppDomain GetTempAppDomain()
+ {
+ //copy the current app domain setup but don't shadow copy files
+ var appName = "TempDomain" + Guid.NewGuid();
+ var domainSetup = new AppDomainSetup
+ {
+ ApplicationName = appName,
+ ShadowCopyFiles = "false",
+ ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
+ ConfigurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile,
+ DynamicBase = AppDomain.CurrentDomain.SetupInformation.DynamicBase,
+ LicenseFile = AppDomain.CurrentDomain.SetupInformation.LicenseFile,
+ LoaderOptimization = AppDomain.CurrentDomain.SetupInformation.LoaderOptimization,
+ PrivateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath,
+ PrivateBinPathProbe = AppDomain.CurrentDomain.SetupInformation.PrivateBinPathProbe
+ };
+
+ //create new domain with full trust
+ return AppDomain.CreateDomain(
+ appName,
+ AppDomain.CurrentDomain.Evidence,
+ domainSetup,
+ new PermissionSet(PermissionState.Unrestricted));
+ }
+
+ private static string GetAssemblyPath(Assembly a)
+ {
+ var codeBase = a.CodeBase;
+ var uri = new Uri(codeBase);
+ return uri.LocalPath;
+ }
+
+ }
+}
diff --git a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs
index 3f25171063..a62ef7b838 100644
--- a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs
+++ b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs
@@ -1,203 +1,203 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Reflection;
-using Newtonsoft.Json;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-
-namespace Umbraco.Core.PropertyEditors
-{
- ///
- /// Defines a pre-value editor
- ///
- ///
- /// A pre-value editor is made up of multiple pre-value fields, each field defines a key that the value is stored against.
- /// Each field can have any editor and the value from each field can store any data such as a simple string or a json structure.
- ///
- /// The Json serialization attributes are required for manifest property editors to work.
- ///
- public class PreValueEditor
- {
- public PreValueEditor()
- {
- var fields = new List();
-
- //the ctor checks if we have PreValueFieldAttributes applied and if so we construct our fields from them
- var props = TypeHelper.CachedDiscoverableProperties(GetType())
- .Where(x => x.Name != "Fields");
- foreach (var p in props)
- {
- var att = p.GetCustomAttributes(typeof (PreValueFieldAttribute), false).OfType().SingleOrDefault();
- if (att != null)
- {
- if (att.PreValueFieldType != null)
- {
- //try to create it
- try
- {
- var instance = (PreValueField) Activator.CreateInstance(att.PreValueFieldType);
- //overwrite values if they are assigned
- if (!att.Key.IsNullOrWhiteSpace())
- {
- instance.Key = att.Key;
- }
- //if the key is still empty then assign it to be the property name
- if (instance.Key.IsNullOrWhiteSpace())
- {
- instance.Key = p.Name;
- }
-
- if (!att.Name.IsNullOrWhiteSpace())
- instance.Name = att.Name;
- if (!att.View.IsNullOrWhiteSpace())
- instance.View = att.View;
- if (!att.Description.IsNullOrWhiteSpace())
- instance.Description = att.Description;
- if (att.HideLabel)
- instance.HideLabel = att.HideLabel;
-
- //add the custom field
- fields.Add(instance);
- }
- catch (Exception ex)
- {
- LogHelper.WarnWithException("Could not create an instance of " + att.PreValueFieldType, ex);
- }
- }
- else
- {
- fields.Add(MapAttributeToField(att, p));
- }
- }
- }
-
- Fields = fields;
- }
-
- private static PreValueField MapAttributeToField(PreValueFieldAttribute att, PropertyInfo prop)
- {
- return new PreValueField
- {
- //set the key to the property name if it is empty
- Key = att.Key.IsNullOrWhiteSpace() ? prop.Name : att.Key,
- Name = att.Name,
- Description = att.Description,
- HideLabel = att.HideLabel,
- View = att.View
- };
- }
-
- ///
- /// A collection of pre-value fields to be edited
- ///
- ///
- /// If fields are specified then the master View and Validators will be ignored
- ///
- [JsonProperty("fields")]
- public List Fields { get; private set; }
-
- ///
- /// A method to format the posted values from the editor to the values to be persisted
- ///
- ///
- ///
- /// The current value that has been persisted to the database for this pre-value editor. This value may be usesful for
- /// how the value then get's deserialized again to be re-persisted. In most cases it will probably not be used.
- ///
- ///
- ///
- /// By default this will just return the Posted editorValue.
- ///
- /// This can be overridden if perhaps you have a comma delimited string posted value but want to convert those to individual rows, or to convert
- /// a json structure to multiple rows.
- ///
- public virtual IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
- {
- //convert to a string based value to be saved in the db
- return editorValue.ToDictionary(x => x.Key, x => x.Value == null ? null : x.Value.ToString());
- }
-
- ///
- /// This can be used to re-format the currently saved pre-values that will be passed to the editor,
- /// by default this returns the merged default and persisted pre-values.
- ///
- ///
- /// The default/static pre-vals for the property editor
- ///
- ///
- /// The persisted pre-vals for the property editor
- ///
- ///
- ///
- /// This is generally not going to be used by anything unless a property editor wants to change the merging
- /// functionality or needs to convert some legacy persisted data, or convert the string values to strongly typed values in json (i.e. booleans)
- ///
- public virtual IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
- {
- if (defaultPreVals == null)
- {
- defaultPreVals = new Dictionary();
- }
-
- if (persistedPreVals.IsDictionaryBased)
- {
- //we just need to merge the dictionaries now, the persisted will replace default.
- foreach (var item in persistedPreVals.PreValuesAsDictionary)
- {
- //The persisted dictionary contains values of type PreValue which contain the ID and the Value, we don't care
- // about the Id, just the value so ignore the id.
- defaultPreVals[item.Key] = item.Value.Value;
- }
- //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
- // so they can be consumed as real json in angular!
- ConvertItemsToJsonIfDetected(defaultPreVals);
-
- return defaultPreVals;
- }
-
- //it's an array so need to format it
- var result = new Dictionary();
- var asArray = persistedPreVals.PreValuesAsArray.ToArray();
- for (var i = 0; i < asArray.Length; i++)
- {
- //each item is of type PreValue but we don't want the ID, just the value so ignore the ID
- result.Add(i.ToInvariantString(), asArray[i].Value);
- }
-
- //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
- // so they can be consumed as real json in angular!
- ConvertItemsToJsonIfDetected(result);
-
- return result;
- }
-
- private void ConvertItemsToJsonIfDetected(IDictionary result)
- {
- //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
- // so they can be consumed as real json in angular!
-
- var keys = result.Keys.ToArray();
- for (var i = 0; i < keys.Length; i++)
- {
- if (result[keys[i]] is string)
- {
- var asString = result[keys[i]].ToString();
- if (asString.DetectIsJson())
- {
- try
- {
- var json = JsonConvert.DeserializeObject(asString);
- result[keys[i]] = json;
- }
- catch
- {
- //swallow this exception, we thought it was json but it really isn't so continue returning a string
- }
- }
- }
- }
- }
-
- }
-}
\ No newline at end of file
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+using Newtonsoft.Json;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+
+namespace Umbraco.Core.PropertyEditors
+{
+ ///
+ /// Defines a pre-value editor
+ ///
+ ///
+ /// A pre-value editor is made up of multiple pre-value fields, each field defines a key that the value is stored against.
+ /// Each field can have any editor and the value from each field can store any data such as a simple string or a json structure.
+ ///
+ /// The Json serialization attributes are required for manifest property editors to work.
+ ///
+ public class PreValueEditor
+ {
+ public PreValueEditor()
+ {
+ var fields = new List();
+
+ //the ctor checks if we have PreValueFieldAttributes applied and if so we construct our fields from them
+ var props = TypeHelper.CachedDiscoverableProperties(GetType())
+ .Where(x => x.Name != "Fields");
+ foreach (var p in props)
+ {
+ var att = p.GetCustomAttributes(typeof (PreValueFieldAttribute), false).OfType().SingleOrDefault();
+ if (att != null)
+ {
+ if (att.PreValueFieldType != null)
+ {
+ //try to create it
+ try
+ {
+ var instance = (PreValueField) Activator.CreateInstance(att.PreValueFieldType);
+ //overwrite values if they are assigned
+ if (!att.Key.IsNullOrWhiteSpace())
+ {
+ instance.Key = att.Key;
+ }
+ //if the key is still empty then assign it to be the property name
+ if (instance.Key.IsNullOrWhiteSpace())
+ {
+ instance.Key = p.Name;
+ }
+
+ if (!att.Name.IsNullOrWhiteSpace())
+ instance.Name = att.Name;
+ if (!att.View.IsNullOrWhiteSpace())
+ instance.View = att.View;
+ if (!att.Description.IsNullOrWhiteSpace())
+ instance.Description = att.Description;
+ if (att.HideLabel)
+ instance.HideLabel = att.HideLabel;
+
+ //add the custom field
+ fields.Add(instance);
+ }
+ catch (Exception ex)
+ {
+ LogHelper.WarnWithException("Could not create an instance of " + att.PreValueFieldType, ex);
+ }
+ }
+ else
+ {
+ fields.Add(MapAttributeToField(att, p));
+ }
+ }
+ }
+
+ Fields = fields;
+ }
+
+ private static PreValueField MapAttributeToField(PreValueFieldAttribute att, PropertyInfo prop)
+ {
+ return new PreValueField
+ {
+ //set the key to the property name if it is empty
+ Key = att.Key.IsNullOrWhiteSpace() ? prop.Name : att.Key,
+ Name = att.Name,
+ Description = att.Description,
+ HideLabel = att.HideLabel,
+ View = att.View
+ };
+ }
+
+ ///
+ /// A collection of pre-value fields to be edited
+ ///
+ ///
+ /// If fields are specified then the master View and Validators will be ignored
+ ///
+ [JsonProperty("fields")]
+ public List Fields { get; private set; }
+
+ ///
+ /// A method to format the posted values from the editor to the values to be persisted
+ ///
+ ///
+ ///
+ /// The current value that has been persisted to the database for this pre-value editor. This value may be usesful for
+ /// how the value then get's deserialized again to be re-persisted. In most cases it will probably not be used.
+ ///
+ ///
+ ///
+ /// By default this will just return the Posted editorValue.
+ ///
+ /// This can be overridden if perhaps you have a comma delimited string posted value but want to convert those to individual rows, or to convert
+ /// a json structure to multiple rows.
+ ///
+ public virtual IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
+ {
+ //convert to a string based value to be saved in the db
+ return editorValue.ToDictionary(x => x.Key, x => new PreValue(x.Value == null ? null : x.Value.ToString()));
+ }
+
+ ///
+ /// This can be used to re-format the currently saved pre-values that will be passed to the editor,
+ /// by default this returns the merged default and persisted pre-values.
+ ///
+ ///
+ /// The default/static pre-vals for the property editor
+ ///
+ ///
+ /// The persisted pre-vals for the property editor
+ ///
+ ///
+ ///
+ /// This is generally not going to be used by anything unless a property editor wants to change the merging
+ /// functionality or needs to convert some legacy persisted data, or convert the string values to strongly typed values in json (i.e. booleans)
+ ///
+ public virtual IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
+ {
+ if (defaultPreVals == null)
+ {
+ defaultPreVals = new Dictionary();
+ }
+
+ if (persistedPreVals.IsDictionaryBased)
+ {
+ //we just need to merge the dictionaries now, the persisted will replace default.
+ foreach (var item in persistedPreVals.PreValuesAsDictionary)
+ {
+ //The persisted dictionary contains values of type PreValue which contain the ID and the Value, we don't care
+ // about the Id, just the value so ignore the id.
+ defaultPreVals[item.Key] = item.Value.Value;
+ }
+ //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
+ // so they can be consumed as real json in angular!
+ ConvertItemsToJsonIfDetected(defaultPreVals);
+
+ return defaultPreVals;
+ }
+
+ //it's an array so need to format it
+ var result = new Dictionary();
+ var asArray = persistedPreVals.PreValuesAsArray.ToArray();
+ for (var i = 0; i < asArray.Length; i++)
+ {
+ //each item is of type PreValue but we don't want the ID, just the value so ignore the ID
+ result.Add(i.ToInvariantString(), asArray[i].Value);
+ }
+
+ //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
+ // so they can be consumed as real json in angular!
+ ConvertItemsToJsonIfDetected(result);
+
+ return result;
+ }
+
+ private void ConvertItemsToJsonIfDetected(IDictionary result)
+ {
+ //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects
+ // so they can be consumed as real json in angular!
+
+ var keys = result.Keys.ToArray();
+ for (var i = 0; i < keys.Length; i++)
+ {
+ if (result[keys[i]] is string)
+ {
+ var asString = result[keys[i]].ToString();
+ if (asString.DetectIsJson())
+ {
+ try
+ {
+ var json = JsonConvert.DeserializeObject(asString);
+ result[keys[i]] = json;
+ }
+ catch
+ {
+ //swallow this exception, we thought it was json but it really isn't so continue returning a string
+ }
+ }
+ }
+ }
+ }
+
+ }
+}
diff --git a/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs b/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs
index 36b4b2a370..40a5764abf 100644
--- a/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs
+++ b/src/Umbraco.Core/Security/UmbracoBackOfficeIdentity.cs
@@ -1,4 +1,5 @@
using System;
+using System.Runtime.Serialization;
using System.Web;
using System.Web.Security;
using Newtonsoft.Json;
@@ -11,6 +12,7 @@ namespace Umbraco.Core.Security
///
/// All values are lazy loaded for performance reasons as the constructor is called for every single request
///
+ [Serializable]
public class UmbracoBackOfficeIdentity : FormsIdentity
{
public UmbracoBackOfficeIdentity(FormsAuthenticationTicket ticket)
@@ -104,5 +106,6 @@ namespace Umbraco.Core.Security
HttpContext.Current.Items[typeof (UmbracoBackOfficeIdentity)] = DeserializedData;
}
}
+
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Security/UserData.cs b/src/Umbraco.Core/Security/UserData.cs
index 5f96143fe4..903d85851f 100644
--- a/src/Umbraco.Core/Security/UserData.cs
+++ b/src/Umbraco.Core/Security/UserData.cs
@@ -1,4 +1,5 @@
-using System.Runtime.Serialization;
+using System;
+using System.Runtime.Serialization;
namespace Umbraco.Core.Security
{
@@ -6,6 +7,7 @@ namespace Umbraco.Core.Security
/// Data structure used to store information in the authentication cookie
///
[DataContract(Name = "userData", Namespace = "")]
+ [Serializable]
internal class UserData
{
public UserData()
diff --git a/src/Umbraco.Core/Services/DataTypeService.cs b/src/Umbraco.Core/Services/DataTypeService.cs
index 230d01cbde..0ea5250ea8 100644
--- a/src/Umbraco.Core/Services/DataTypeService.cs
+++ b/src/Umbraco.Core/Services/DataTypeService.cs
@@ -217,6 +217,7 @@ namespace Umbraco.Core.Services
///
/// Id of the DataTypeDefinition to save PreValues for
/// List of string values to save
+ [Obsolete("This should no longer be used, use the alternative SavePreValues or SaveDataTypeAndPreValues methods instead. This will only insert pre-values without keys")]
public void SavePreValues(int id, IEnumerable values)
{
//TODO: Should we raise an event here since we are really saving values for the data type?
@@ -255,9 +256,10 @@ namespace Umbraco.Core.Services
///
///
///
- /// We will actually just remove all pre-values and re-insert them in one transaction
+ /// We need to actually look up each pre-value and maintain it's id if possible - this is because of silly property editors
+ /// like 'dropdown list publishing keys'
///
- internal void SavePreValues(int id, IDictionary values)
+ public void SavePreValues(int id, IDictionary values)
{
//TODO: Should we raise an event here since we are really saving values for the data type?
@@ -267,22 +269,7 @@ namespace Umbraco.Core.Services
{
using (var transaction = uow.Database.GetTransaction())
{
- uow.Database.Execute("DELETE FROM cmsDataTypePreValues WHERE datatypeNodeId = @DataTypeId", new { DataTypeId = id });
-
- var sortOrder = 1;
- foreach (var value in values)
- {
- var dto = new DataTypePreValueDto
- {
- DataTypeNodeId = id,
- Value = value.Value,
- SortOrder = sortOrder,
- Alias = value.Key
- };
- uow.Database.Insert(dto);
- sortOrder++;
- }
-
+ AddOrUpdatePreValues(id, values, uow);
transaction.Complete();
}
}
@@ -295,7 +282,7 @@ namespace Umbraco.Core.Services
///
///
///
- public void SaveDataTypeAndPreValues(IDataTypeDefinition dataTypeDefinition, IDictionary values, int userId = 0)
+ public void SaveDataTypeAndPreValues(IDataTypeDefinition dataTypeDefinition, IDictionary values, int userId = 0)
{
if (Saving.IsRaisedEventCancelled(new SaveEventArgs(dataTypeDefinition), this))
return;
@@ -309,25 +296,7 @@ namespace Umbraco.Core.Services
repository.AddOrUpdate(dataTypeDefinition);
//complete the transaction, but run the delegate before the db transaction is finalized
- uow.Commit(database =>
- {
- //Execute this before the transaction is completed!
- database.Execute("DELETE FROM cmsDataTypePreValues WHERE datatypeNodeId = @DataTypeId", new { DataTypeId = dataTypeDefinition.Id });
-
- var sortOrder = 1;
- foreach (var value in values)
- {
- var dto = new DataTypePreValueDto
- {
- DataTypeNodeId = dataTypeDefinition.Id,
- Value = value.Value,
- SortOrder = sortOrder,
- Alias = value.Key
- };
- database.Insert(dto);
- sortOrder++;
- }
- });
+ uow.Commit(database => AddOrUpdatePreValues(dataTypeDefinition.Id, values, uow));
Saved.RaiseEvent(new SaveEventArgs(dataTypeDefinition, false), this);
}
@@ -336,6 +305,56 @@ namespace Umbraco.Core.Services
Audit.Add(AuditTypes.Save, string.Format("Save DataTypeDefinition performed by user"), userId, dataTypeDefinition.Id);
}
+ private void AddOrUpdatePreValues(int id, IDictionary preValueCollection, IDatabaseUnitOfWork uow)
+ {
+ //first just get all pre-values for this data type so we can compare them to see if we need to insert or update or replace
+ var sql = new Sql().Select("*")
+ .From()
+ .Where(dto => dto.DataTypeNodeId == id)
+ .OrderBy(dto => dto.SortOrder);
+ var currentVals = uow.Database.Fetch(sql).ToArray();
+
+ //already existing, need to be updated
+ var valueIds = preValueCollection.Where(x => x.Value.Id > 0).Select(x => x.Value.Id).ToArray();
+ var existingByIds = currentVals.Where(x => valueIds.Contains(x.Id)).ToArray();
+
+ //These ones need to be removed from the db, they no longer exist in the new values
+ var deleteById = currentVals.Where(x => valueIds.Contains(x.Id) == false);
+
+ foreach (var d in deleteById)
+ {
+ uow.Database.Execute(
+ "DELETE FROM cmsDataTypePreValues WHERE datatypeNodeId = @DataTypeId AND id=@Id",
+ new { DataTypeId = id, Id = d.Id });
+ }
+
+ var sortOrder = 1;
+
+ foreach (var pre in preValueCollection)
+ {
+ var existing = existingByIds.FirstOrDefault(valueDto => valueDto.Id == pre.Value.Id);
+ if (existing != null)
+ {
+ existing.Value = pre.Value.Value;
+ existing.SortOrder = sortOrder;
+ uow.Database.Update(existing);
+ }
+ else
+ {
+ var dto = new DataTypePreValueDto
+ {
+ DataTypeNodeId = id,
+ Value = pre.Value.Value,
+ SortOrder = sortOrder,
+ Alias = pre.Key
+ };
+ uow.Database.Insert(dto);
+ }
+
+ sortOrder++;
+ }
+ }
+
///
/// Deletes an
///
diff --git a/src/Umbraco.Core/Services/IDataTypeService.cs b/src/Umbraco.Core/Services/IDataTypeService.cs
index 9b6f23bce3..e57d9016e4 100644
--- a/src/Umbraco.Core/Services/IDataTypeService.cs
+++ b/src/Umbraco.Core/Services/IDataTypeService.cs
@@ -10,8 +10,6 @@ namespace Umbraco.Core.Services
///
public interface IDataTypeService : IService
{
- void SaveDataTypeAndPreValues(IDataTypeDefinition dataTypeDefinition, IDictionary values, int userId = 0);
-
///
/// Gets a by its Id
///
@@ -107,8 +105,24 @@ namespace Umbraco.Core.Services
///
/// Id of the DataTypeDefinition to save PreValues for
/// List of string values to save
+ [Obsolete("This should no longer be used, use the alternative SavePreValues or SaveDataTypeAndPreValues methods instead. This will only insert pre-values without keys")]
void SavePreValues(int id, IEnumerable values);
+ ///
+ /// Saves a list of PreValues for a given DataTypeDefinition
+ ///
+ /// Id of the DataTypeDefinition to save PreValues for
+ /// List of key/value pairs to save
+ void SavePreValues(int id, IDictionary values);
+
+ ///
+ /// Saves the data type and it's prevalues
+ ///
+ ///
+ ///
+ ///
+ void SaveDataTypeAndPreValues(IDataTypeDefinition dataTypeDefinition, IDictionary values, int userId = 0);
+
///
/// Gets a specific PreValue by its Id
///
diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj
index 7e547d0988..0ded0c0d5e 100644
--- a/src/Umbraco.Core/Umbraco.Core.csproj
+++ b/src/Umbraco.Core/Umbraco.Core.csproj
@@ -326,6 +326,7 @@
+
@@ -1083,7 +1084,6 @@
-
diff --git a/src/Umbraco.Tests/PluginManagerTests.cs b/src/Umbraco.Tests/PluginManagerTests.cs
index df7ede9de5..6f72b9d5ef 100644
--- a/src/Umbraco.Tests/PluginManagerTests.cs
+++ b/src/Umbraco.Tests/PluginManagerTests.cs
@@ -306,13 +306,6 @@ namespace Umbraco.Tests
Assert.AreEqual(7, apps.Count());
}
- [Test]
- public void Resolves_Action_Handlers()
- {
- var types = PluginManager.Current.ResolveActionHandlers();
- Assert.AreEqual(1, types.Count());
- }
-
[Test]
public void Resolves_DataTypes()
{
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js
index c39b56a5e9..9de4e0c541 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/umbrequesthelper.service.js
@@ -32,7 +32,7 @@ function umbRequestHelper($http, $q, umbDataFormatter, angularHelper, dialogServ
if (key === null || val === null) {
throw "The object in the array was not formatted as a key/value pair";
}
- return key + "=" + val;
+ return encodeURIComponent(key) + "=" + encodeURIComponent(val);
}).join("&");
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/datatype/edit.html b/src/Umbraco.Web.UI.Client/src/views/datatype/edit.html
index cf34e6c003..7e2484c0f4 100644
--- a/src/Umbraco.Web.UI.Client/src/views/datatype/edit.html
+++ b/src/Umbraco.Web.UI.Client/src/views/datatype/edit.html
@@ -59,4 +59,4 @@
-
\ No newline at end of file
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js
index bdddef9af4..c8d3c3c4a5 100644
--- a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/multivalues.controller.js
@@ -10,7 +10,10 @@ angular.module("umbraco").controller("Umbraco.Editors.MultiValuesController",
//make an array from the dictionary
var items = [];
for (var i in $scope.model.value) {
- items.push({value: $scope.model.value[i]});
+ items.push({
+ value: $scope.model.value[i],
+ id: i
+ });
}
//now make the editor model the array
$scope.model.value = items;
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_archive.png b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_archive.png
deleted file mode 100644
index 8443c23eb9..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_archive.png and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_datasource.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_datasource.gif
deleted file mode 100644
index eff4528415..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_datasource.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_entries.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_entries.gif
deleted file mode 100644
index dcf36d972e..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_entries.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_exportform.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_exportform.gif
deleted file mode 100644
index 385e077d65..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_exportform.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_form.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_form.gif
deleted file mode 100644
index 2b49b1eb22..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_form.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_importform.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_importform.gif
deleted file mode 100644
index ac86897f75..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_importform.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_prevaluesource.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_prevaluesource.gif
deleted file mode 100644
index d40f332f55..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_prevaluesource.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_workflow.gif b/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_workflow.gif
deleted file mode 100644
index befcf396d3..0000000000
Binary files a/src/Umbraco.Web.UI/Umbraco/Images/umbraco/icon_workflow.gif and /dev/null differ
diff --git a/src/Umbraco.Web.UI/Umbraco/xslt/templates/Schema2/UmbracoContourListComments.xslt b/src/Umbraco.Web.UI/Umbraco/xslt/templates/Schema2/UmbracoContourListComments.xslt
deleted file mode 100644
index 606a171ebe..0000000000
--- a/src/Umbraco.Web.UI/Umbraco/xslt/templates/Schema2/UmbracoContourListComments.xslt
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No comments
-
-
- 1 comment
-
-
- comments
-
-
-
-
-
-
-
-
-
-
-
-
-
- Says:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/Umbraco/xslt/templates/UmbracoContourListComments.xslt b/src/Umbraco.Web.UI/Umbraco/xslt/templates/UmbracoContourListComments.xslt
deleted file mode 100644
index e08ee63b4f..0000000000
--- a/src/Umbraco.Web.UI/Umbraco/xslt/templates/UmbracoContourListComments.xslt
+++ /dev/null
@@ -1,59 +0,0 @@
-
- ]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- No comments
-
-
- 1 comment
-
-
- comments
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/config/applications.config b/src/Umbraco.Web.UI/config/applications.config
index b0b3ed2300..2a6da37bae 100644
--- a/src/Umbraco.Web.UI/config/applications.config
+++ b/src/Umbraco.Web.UI/config/applications.config
@@ -7,5 +7,4 @@
-
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI/config/splashes/noNodes.aspx b/src/Umbraco.Web.UI/config/splashes/noNodes.aspx
index 6a71a740cb..be53c864fa 100644
--- a/src/Umbraco.Web.UI/config/splashes/noNodes.aspx
+++ b/src/Umbraco.Web.UI/config/splashes/noNodes.aspx
@@ -85,7 +85,7 @@
So get rid of this page by starting umbraco and publishing some content. You can do this by clicking the "set up your new website" button below.
diff --git a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
index d1934d069b..c5e973f06e 100644
--- a/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/create/UI.xml
@@ -338,4 +338,4 @@
-
+
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
index 6654ba0f28..d47adfef15 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml
@@ -661,7 +661,7 @@ Mange hilsner fra umbraco robotten
Download XML DTD
Felter
Inkluder undersider
-
Hej %0%. Dette er en automatisk mail sendt for at informere dig om at dokumentet '%1' har en forespørgsel omkring oversættelse til '%5%' af %2%. Gå til http://%3%/umbraco/translation/details.aspx?id=%4% for at redigere. Eller log ind i umbraco for at få en oversigt over dine oversættelsesopgaver: http://%3%/umbraco/umbraco.aspx Hav en god dag! Mange hilsner umbraco-robotten
+
Hej %0%. Dette er en automatisk mail sendt for at informere dig om at dokumentet '%1' har en forespørgsel omkring oversættelse til '%5%' af %2%. Gå til http://%3%/umbraco/translation/details.aspx?id=%4% for at redigere. Eller log ind i umbraco for at få en oversigt over dine oversættelsesopgaver: http://%3%/umbraco Hav en god dag! Mange hilsner umbraco-robotten
[%0%] Oversættelsesopgave for %1%
Ingen oversættelsesbrugere er fundet. Opret venligst en oversættelsesbruger før du begynder at sende indhold til oversættelse
Opgaver oprettet af dig
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/de.xml b/src/Umbraco.Web.UI/umbraco/config/lang/de.xml
index ad26262d2e..d2a16639ad 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/de.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/de.xml
@@ -754,7 +754,7 @@ das Dokument '%1%' wurde von '%2%' zur Übersetzung in '%5%' freigegeben.
Zum Bearbeiten verwenden Sie bitte diesen Link: http://%3%/umbraco/translation/details.aspx?id=%4%.
-Sie können sich auch alle anstehenden Übersetzungen gesammelt im Umbraco-Verwaltungsbereich anzeigen lassen: http://%3%/umbraco/umbraco.aspx
+Sie können sich auch alle anstehenden Übersetzungen gesammelt im Umbraco-Verwaltungsbereich anzeigen lassen: http://%3%/umbraco
Einen schönen Tag wünscht
Ihr freundlicher Umbraco-Robot
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml
index bbd044cb4c..8adf63406e 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml
@@ -880,7 +880,7 @@ To manage your website, simply open the umbraco back office and start adding con
Go to http://%3%/translation/details.aspx?id=%4% to edit.
Or log into umbraco to get an overview of your translation tasks
- http://%3%/umbraco.aspx
+ http://%3%
Have a nice day!
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
index d622cf8f19..37d514652b 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
@@ -907,7 +907,7 @@ To manage your website, simply open the umbraco back office and start adding con
Go to http://%3%/translation/details.aspx?id=%4% to edit.
Or log into umbraco to get an overview of your translation tasks
- http://%3%/umbraco.aspx
+ http://%3%
Have a nice day!
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml
index c69b42522c..30bc95d93c 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml
@@ -658,7 +658,7 @@ However, Runway offers an easy foundation based on best practices to get you sta
Descargar xml DTD
Campos
Incluir subpáginas
-
Hola %0%. Este email se ha generado automáticamente para informale que %2% ha solicitado que el documento '%1%' sea traducido en '%5%'. Para editarlo, vaya a la dirección http://%3%/umbraco/translation/details.aspx?id=%4% o inicie la sesión en umbraco y vaya a http://%3%/umbraco/umbraco.aspx para ver las tareas pendientes de traducir. Espero que tenga un buen dia. Saludos de parte de el robot de umbraco
+
Hola %0%. Este email se ha generado automáticamente para informale que %2% ha solicitado que el documento '%1%' sea traducido en '%5%'. Para editarlo, vaya a la dirección http://%3%/umbraco/translation/details.aspx?id=%4% o inicie la sesión en umbraco y vaya a http://%3%/umbraco para ver las tareas pendientes de traducir. Espero que tenga un buen dia. Saludos de parte de el robot de umbraco
Tarea para tradudir [%0%] por %1%
No se encontraron usuarios traductores. Por favor, crea un usuario traductor antes de empezar a mandar contenido para su traducción
Tareas creadas por ti
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/he.xml b/src/Umbraco.Web.UI/umbraco/config/lang/he.xml
index 21c6cfe9f0..201001ffbc 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/he.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/he.xml
@@ -775,7 +775,7 @@ To manage your website, simply open the umbraco back office and start adding con
לעריכה, לחץ על הלינק הבא: http://%3%/translation/details.aspx?id=%4% .
באפשרותך גם להיכנס למערכת על מנת לראות את כל משימות התירגום
- http://%3%/umbraco.aspx
+ http://%3%
המשך יום נעים.
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/it.xml b/src/Umbraco.Web.UI/umbraco/config/lang/it.xml
index 8cecd7bbb7..10a670378a 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/it.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/it.xml
@@ -747,7 +747,7 @@ Per gestire il tuo sito web, è sufficiente aprire il back office di Umbraco e i
Vai al http://%3%/translation/details.aspx?id=%4% per effettuare la modifica.
Oppure effettua il login in Umbraco per avere una panoramica delle attività di traduzione
- http://%3%/umbraco.aspx
+ http://%3%
Buona giornata!
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml
index 330886f493..2cea7d7838 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml
@@ -787,7 +787,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
編集はこちらから: http://%3%/translation/details.aspx?id=%4%
- また、翻訳タスクの概況はこちらから: http://%3%/umbraco.aspx
+ また、翻訳タスクの概況はこちらから: http://%3%
早々
@@ -887,4 +887,4 @@ Runwayをインストールして作られた新しいウェブサイトがど
ユーザーの種類
投稿者
-
+
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml
index 0212898dff..0a7ba87cff 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml
@@ -752,7 +752,7 @@
편집하시려면 http://%3%/translation/details.aspx?id=%4% 로
번역작업을 전반적으로 보시려면 Umbraco에 로그인 하세요
- http://%3%/umbraco.aspx
+ http://%3%
좋은 하루 되세요!
]]>
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml
index 65ecae12a3..6db3d9e2a5 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml
@@ -651,7 +651,7 @@ Miłego dnia!]]>
Pobierz XML DTD
Pola
Włączając podstrony
-
to jest automatyczny mail informujący że dokument %1% został zgłoszony jako wymagający tłumaczenia na '%5%' przez %2%. Wejdź na http://%3%/translation/details.aspx?id=%4% aby edytować. Lub zaloguj się do umbraco aby zobaczyć wszystkie zadania do tłumaczenia http://%3%/umbraco.aspx.
Życzę miłego dnia! Umbraco robot]]>
+
to jest automatyczny mail informujący że dokument %1% został zgłoszony jako wymagający tłumaczenia na '%5%' przez %2%. Wejdź na http://%3%/translation/details.aspx?id=%4% aby edytować. Lub zaloguj się do umbraco aby zobaczyć wszystkie zadania do tłumaczenia http://%3%.
Życzę miłego dnia! Umbraco robot]]>
[%0%] Tłumaczeń dla %1%
Nie znaleziono tłumaczy. Proszę utwórz tłumacza przed wysłaniem zawartości do tłumaczenia
Zadania stworzone przez Ciebie
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml
index f795e16d3c..ec10a7bdce 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml
@@ -737,7 +737,7 @@ Para fechar a tarefa de tradução vá até os detalhes e clique no botão "Fech
Vá para http://%3%/translation/details.aspx?id=%4% para editar.
Ou visite o umbraco para ter uma visão geral das tarefas de tradução
- http://%3%/umbraco.aspx
+ http://%3%
Tenha um bom dia!
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
index 2bbadf234a..d21847c9f8 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml
@@ -819,7 +819,7 @@
Перейдите по ссылке http://%3%/translation/details.aspx?id=%4% для редактирования.
Или авторизуйтесь для общего обзора Ваших заданий по переводу
- http://%3%/umbraco.aspx.
+ http://%3%.
Удачи!
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml b/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml
index 99f34163b5..4c57efb4bb 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml
@@ -684,7 +684,7 @@
Ladda hem DTD för XML
Fält
Inkludera undersidor
-
Hej %0%. Detta är ett automatisk mail skickat for att informera dig om att det finns en översättningsförfrågan på dokument '%1' till '{5}' skickad av {2}. För att redigere, besök http://{3}/translation/details.aspx?id={4}. För att få en översikt över dina översättningsuppgigter loggar du in i umbraco på: http://{3}/umbraco.aspx
+
Hej %0%. Detta är ett automatisk mail skickat for att informera dig om att det finns en översättningsförfrågan på dokument '%1' till '{5}' skickad av {2}. För att redigere, besök http://{3}/translation/details.aspx?id={4}. För att få en översikt över dina översättningsuppgigter loggar du in i umbraco på: http://{3}
[%0%] Översättningsuppgit för %1%
Hittade inga användare som är översättare. Vänligen skapa en användare som är översättare innan du börjar skicka innehåll för översättning
Arbetsuppgifter som du har skapat
diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml
index 49213b98c9..abe7e71f97 100644
--- a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml
+++ b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml
@@ -784,7 +784,7 @@
转到 http://%3%/translation/details.aspx?id=%4% 进行编辑
- 或登录http://%3%/umbraco.aspx查看任务
+ 或登录http://%3%查看任务
祝好运!]]>
[%0%]翻译任务:%1%
diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/installer.aspx b/src/Umbraco.Web.UI/umbraco/developer/Packages/installer.aspx
index e271bf7413..a6e4dd873c 100644
--- a/src/Umbraco.Web.UI/umbraco/developer/Packages/installer.aspx
+++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/installer.aspx
@@ -18,6 +18,12 @@
else
b.attr("disabled", true);
}
+
+ $(document).ready(function () {
+ $('.toggle-report').click(function () {
+ $(this).next().toggle();
+ });
+ });
@@ -112,10 +118,8 @@
Binary files in the package!
-
- Read more...
-
-
+
Read more...
+
This package contains .NET code. This is not unusual as .NET code
is used for any advanced functionality on an Umbraco powered website.
@@ -132,14 +136,47 @@
+
+
+
+ Legacy Property editors detected
+
Read more...
+
+
+ This package contains legacy property editors which are not compatible with Umbraco 7
+
+ This package may not function correctly if the package developer has not indicated that
+ it is compatible with version 7. Any DataTypes this package creates that do not have
+ a Version 7 compatible property editor will be converted to use a Label/NoEdit property editor.
+
+
+
+
+
+
+
+ Binary file errors detected
+
Read more...
+
+
+ This package contains .NET binary files that might not be compatible with this version of Umbraco.
+ If you aren't sure what these errors mean or why they are listed please contact the package creator.
+
+
+ Error report
+
+
+
+
+
Macro Conflicts in the package!
-
- Read more...
-
-
+
Read more...
+
This package contains one or more macros which have the same alias as an existing one on your site, based on the Macro Alias.
@@ -159,10 +196,8 @@
Template Conflicts in the package!
-
- Read more...
-
-
+
Read more...
+
This package contains one or more templates which have the same alias as an existing one on your site, based on the Template Alias.
@@ -182,10 +217,8 @@
Stylesheet Conflicts in the package!
-
- Read more...
-
-
+
Read more...
+
This package contains one or more stylesheets which have the same alias as an existing one on your site, based on the Stylesheet Name.
@@ -212,25 +245,6 @@
OnClick="startInstall">
-
diff --git a/src/Umbraco.Web/Models/ContentEditing/PreValueFieldDisplay.cs b/src/Umbraco.Web/Models/ContentEditing/PreValueFieldDisplay.cs
index 64a88af37f..1e8a7ba088 100644
--- a/src/Umbraco.Web/Models/ContentEditing/PreValueFieldDisplay.cs
+++ b/src/Umbraco.Web/Models/ContentEditing/PreValueFieldDisplay.cs
@@ -8,11 +8,6 @@ namespace Umbraco.Web.Models.ContentEditing
[DataContract(Name = "preValue", Namespace = "")]
public class PreValueFieldDisplay : PreValueFieldSave
{
- /////
- ///// The id of the pre-value field
- /////
- //[DataMember(Name = "id", IsRequired = true)]
- //public int Id { get; set; }
///
/// The name to display for this pre-value field
diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
index 8f230cd9c5..b236d55984 100644
--- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs
@@ -1,182 +1,182 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Xml;
-using Newtonsoft.Json.Linq;
-using Umbraco.Core;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Configuration.UmbracoSettings;
-using Umbraco.Core.IO;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.PropertyEditors;
-using Umbraco.Core.Services;
-
-namespace Umbraco.Web.PropertyEditors
-{
- [PropertyEditor(Constants.PropertyEditors.UploadFieldAlias, "File upload", "fileupload")]
- public class FileUploadPropertyEditor : PropertyEditor
- {
- ///
- /// We're going to bind to the MediaService Saving event so that we can populate the umbracoFile size, type, etc... label fields
- /// if we find any attached to the current media item.
- ///
- ///
- /// I think this kind of logic belongs on this property editor, I guess it could exist elsewhere but it all has to do with the upload field.
- ///
- static FileUploadPropertyEditor()
- {
- MediaService.Saving += MediaServiceSaving;
- MediaService.Creating += MediaServiceCreating;
- }
-
- ///
- /// Creates our custom value editor
- ///
- ///
- protected override PropertyValueEditor CreateValueEditor()
- {
- //TODO: Ensure we assign custom validation for uploaded file types!
-
- var baseEditor = base.CreateValueEditor();
-
- return new FileUploadPropertyValueEditor
- {
- View = baseEditor.View
- };
- }
-
- protected override PreValueEditor CreatePreValueEditor()
- {
- return new FileUploadPreValueEditor();
- }
-
- static void MediaServiceCreating(IMediaService sender, Core.Events.NewEventArgs e)
- {
- AutoFillProperties(e.Entity);
- }
-
- static void MediaServiceSaving(IMediaService sender, Core.Events.SaveEventArgs e)
- {
- foreach (var m in e.SavedEntities)
- {
- AutoFillProperties(m);
- }
- }
-
- static void AutoFillProperties(IContentBase model)
- {
- foreach (var p in model.Properties)
- {
- var uploadFieldConfigNode =
- UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties
- .FirstOrDefault(x => x.Alias == p.Alias);
-
- if (uploadFieldConfigNode != null)
- {
- //now we need to check if there is a value
- if (p.Value is string && ((string) p.Value).IsNullOrWhiteSpace() == false)
- {
- //there might be multiple, we can only process the first one!
- var split = ((string) p.Value).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
- if (split.Any())
- {
- var umbracoFile = new UmbracoMediaFile(IOHelper.MapPath(split[0]));
- FillProperties(uploadFieldConfigNode, model, umbracoFile);
- }
- }
- else
- {
- //there's no value so need to reset to zero
- ResetProperties(uploadFieldConfigNode, model);
- }
- }
- }
- }
-
- private static void ResetProperties(IImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content)
- {
- if (content.Properties.Contains(uploadFieldConfigNode.WidthFieldAlias))
- content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = string.Empty;
-
- if (content.Properties.Contains(uploadFieldConfigNode.HeightFieldAlias))
- content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = string.Empty;
-
- if (content.Properties.Contains(uploadFieldConfigNode.LengthFieldAlias))
- content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = string.Empty;
-
- if (content.Properties.Contains(uploadFieldConfigNode.ExtensionFieldAlias))
- content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = string.Empty;
- }
-
- private static void FillProperties(IImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content, UmbracoMediaFile um)
- {
- var size = um.SupportsResizing ? (Size?)um.GetDimensions() : null;
-
- if (content.Properties.Contains(uploadFieldConfigNode.WidthFieldAlias))
- content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = size.HasValue ? size.Value.Width.ToInvariantString() : string.Empty;
-
- if (content.Properties.Contains(uploadFieldConfigNode.HeightFieldAlias))
- content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = size.HasValue ? size.Value.Height.ToInvariantString() : string.Empty;
-
- if (content.Properties.Contains(uploadFieldConfigNode.LengthFieldAlias))
- content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = um.Length;
-
- if (content.Properties.Contains(uploadFieldConfigNode.ExtensionFieldAlias))
- content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = um.Extension;
- }
-
- ///
- /// A custom pre-val editor to ensure that the data is stored how the legacy data was stored in
- ///
- internal class FileUploadPreValueEditor : ValueListPreValueEditor
- {
- ///
- /// Format the persisted value to work with our multi-val editor.
- ///
- ///
- ///
- ///
- public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
- {
- var result = new Dictionary();
-
- //the pre-values just take up one field with a semi-colon delimiter so we'll just parse
- var dictionary = persistedPreVals.FormatAsDictionary();
- if (dictionary.Any())
- {
- //there should only be one val
- var delimited = dictionary.First().Value.Value.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
- for (var index = 0; index < delimited.Length; index++)
- {
- result.Add(index.ToInvariantString(), delimited[index]);
- }
- }
-
- //the items list will be a dictionary of it's id -> value we need to use the id for persistence for backwards compatibility
- return new Dictionary { { "items", result } };
- }
-
- ///
- /// Take the posted values and convert them to a semi-colon separated list so that its backwards compatible
- ///
- ///
- ///
- ///
- public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
- {
- var result = base.ConvertEditorToDb(editorValue, currentValue);
-
- //this should just be a dictionary of values, we want to re-format this so that it is just one value in the dictionary that is
- // semi-colon delimited
- var values = result.Select(item => item.Value).ToList();
-
- result.Clear();
- result.Add("thumbs", string.Join(";", values));
- return result;
- }
- }
-
- }
-}
\ No newline at end of file
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Xml;
+using Newtonsoft.Json.Linq;
+using Umbraco.Core;
+using Umbraco.Core.Configuration;
+using Umbraco.Core.Configuration.UmbracoSettings;
+using Umbraco.Core.IO;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+using Umbraco.Core.PropertyEditors;
+using Umbraco.Core.Services;
+
+namespace Umbraco.Web.PropertyEditors
+{
+ [PropertyEditor(Constants.PropertyEditors.UploadFieldAlias, "File upload", "fileupload")]
+ public class FileUploadPropertyEditor : PropertyEditor
+ {
+ ///
+ /// We're going to bind to the MediaService Saving event so that we can populate the umbracoFile size, type, etc... label fields
+ /// if we find any attached to the current media item.
+ ///
+ ///
+ /// I think this kind of logic belongs on this property editor, I guess it could exist elsewhere but it all has to do with the upload field.
+ ///
+ static FileUploadPropertyEditor()
+ {
+ MediaService.Saving += MediaServiceSaving;
+ MediaService.Creating += MediaServiceCreating;
+ }
+
+ ///
+ /// Creates our custom value editor
+ ///
+ ///
+ protected override PropertyValueEditor CreateValueEditor()
+ {
+ //TODO: Ensure we assign custom validation for uploaded file types!
+
+ var baseEditor = base.CreateValueEditor();
+
+ return new FileUploadPropertyValueEditor
+ {
+ View = baseEditor.View
+ };
+ }
+
+ protected override PreValueEditor CreatePreValueEditor()
+ {
+ return new FileUploadPreValueEditor();
+ }
+
+ static void MediaServiceCreating(IMediaService sender, Core.Events.NewEventArgs e)
+ {
+ AutoFillProperties(e.Entity);
+ }
+
+ static void MediaServiceSaving(IMediaService sender, Core.Events.SaveEventArgs e)
+ {
+ foreach (var m in e.SavedEntities)
+ {
+ AutoFillProperties(m);
+ }
+ }
+
+ static void AutoFillProperties(IContentBase model)
+ {
+ foreach (var p in model.Properties)
+ {
+ var uploadFieldConfigNode =
+ UmbracoConfig.For.UmbracoSettings().Content.ImageAutoFillProperties
+ .FirstOrDefault(x => x.Alias == p.Alias);
+
+ if (uploadFieldConfigNode != null)
+ {
+ //now we need to check if there is a value
+ if (p.Value is string && ((string) p.Value).IsNullOrWhiteSpace() == false)
+ {
+ //there might be multiple, we can only process the first one!
+ var split = ((string) p.Value).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
+ if (split.Any())
+ {
+ var umbracoFile = new UmbracoMediaFile(IOHelper.MapPath(split[0]));
+ FillProperties(uploadFieldConfigNode, model, umbracoFile);
+ }
+ }
+ else
+ {
+ //there's no value so need to reset to zero
+ ResetProperties(uploadFieldConfigNode, model);
+ }
+ }
+ }
+ }
+
+ private static void ResetProperties(IImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content)
+ {
+ if (content.Properties.Contains(uploadFieldConfigNode.WidthFieldAlias))
+ content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = string.Empty;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.HeightFieldAlias))
+ content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = string.Empty;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.LengthFieldAlias))
+ content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = string.Empty;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.ExtensionFieldAlias))
+ content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = string.Empty;
+ }
+
+ private static void FillProperties(IImagingAutoFillUploadField uploadFieldConfigNode, IContentBase content, UmbracoMediaFile um)
+ {
+ var size = um.SupportsResizing ? (Size?)um.GetDimensions() : null;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.WidthFieldAlias))
+ content.Properties[uploadFieldConfigNode.WidthFieldAlias].Value = size.HasValue ? size.Value.Width.ToInvariantString() : string.Empty;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.HeightFieldAlias))
+ content.Properties[uploadFieldConfigNode.HeightFieldAlias].Value = size.HasValue ? size.Value.Height.ToInvariantString() : string.Empty;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.LengthFieldAlias))
+ content.Properties[uploadFieldConfigNode.LengthFieldAlias].Value = um.Length;
+
+ if (content.Properties.Contains(uploadFieldConfigNode.ExtensionFieldAlias))
+ content.Properties[uploadFieldConfigNode.ExtensionFieldAlias].Value = um.Extension;
+ }
+
+ ///
+ /// A custom pre-val editor to ensure that the data is stored how the legacy data was stored in
+ ///
+ internal class FileUploadPreValueEditor : ValueListPreValueEditor
+ {
+ ///
+ /// Format the persisted value to work with our multi-val editor.
+ ///
+ ///
+ ///
+ ///
+ public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
+ {
+ var result = new Dictionary();
+
+ //the pre-values just take up one field with a semi-colon delimiter so we'll just parse
+ var dictionary = persistedPreVals.FormatAsDictionary();
+ if (dictionary.Any())
+ {
+ //there should only be one val
+ var delimited = dictionary.First().Value.Value.Split(new[] {';'}, StringSplitOptions.RemoveEmptyEntries);
+ for (var index = 0; index < delimited.Length; index++)
+ {
+ result.Add(index.ToInvariantString(), delimited[index]);
+ }
+ }
+
+ //the items list will be a dictionary of it's id -> value we need to use the id for persistence for backwards compatibility
+ return new Dictionary { { "items", result } };
+ }
+
+ ///
+ /// Take the posted values and convert them to a semi-colon separated list so that its backwards compatible
+ ///
+ ///
+ ///
+ ///
+ public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
+ {
+ var result = base.ConvertEditorToDb(editorValue, currentValue);
+
+ //this should just be a dictionary of values, we want to re-format this so that it is just one value in the dictionary that is
+ // semi-colon delimited
+ var values = result.Select(item => item.Value).ToList();
+
+ result.Clear();
+ result.Add("thumbs", new PreValue(string.Join(";", values)));
+ return result;
+ }
+ }
+
+ }
+}
diff --git a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
index 879b232d3c..2948e4c520 100644
--- a/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/MultipleTextStringPropertyEditor.cs
@@ -1,180 +1,180 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Collections;
-using System.Collections.Generic;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.Models.Editors;
-using Umbraco.Core.PropertyEditors;
-
-namespace Umbraco.Web.PropertyEditors
-{
- [PropertyEditor(Constants.PropertyEditors.MultipleTextstringAlias, "Multiple Textbox", "multipletextbox", ValueType = "TEXT")]
- public class MultipleTextStringPropertyEditor : PropertyEditor
- {
- protected override PropertyValueEditor CreateValueEditor()
- {
- return new MultipleTextStringPropertyValueEditor(base.CreateValueEditor());
- }
-
- protected override PreValueEditor CreatePreValueEditor()
- {
- return new MultipleTextStringPreValueEditor();
- }
-
- ///
- /// A custom pre-value editor class to deal with the legacy way that the pre-value data is stored.
- ///
- internal class MultipleTextStringPreValueEditor : PreValueEditor
- {
- public MultipleTextStringPreValueEditor()
- {
- //create the fields
- Fields.Add(new PreValueField(new IntegerValidator())
- {
- Description = "Enter the minimum amount of text boxes to be displayed",
- Key = "min",
- View = "requiredfield",
- Name = "Minimum"
- });
- Fields.Add(new PreValueField(new IntegerValidator())
- {
- Description = "Enter the maximum amount of text boxes to be displayed, enter -1 for unlimited",
- Key = "max",
- View = "requiredfield",
- Name = "Maximum"
- });
- }
-
- ///
- /// Need to change how we persist the values so they are compatible with the legacy way we store values
- ///
- ///
- ///
- ///
- public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
- {
- //the values from the editor will be min/max fieds and we need to format to json in one field
- var min = (editorValue.ContainsKey("min") ? editorValue["min"].ToString() : "0").TryConvertTo();
- var max = (editorValue.ContainsKey("max") ? editorValue["max"].ToString() : "0").TryConvertTo();
-
- var json = JObject.FromObject(new {Minimum = min.Success ? min.Result : 0, Maximum = max.Success ? max.Result : 0});
-
- return new Dictionary {{"0", json.ToString(Formatting.None)}};
- }
-
- ///
- /// Need to deal with the legacy way of storing pre-values and turn them into nice values for the editor
- ///
- ///
- ///
- ///
- public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
- {
- var preVals = persistedPreVals.FormatAsDictionary();
- var stringVal = preVals.Any() ? preVals.First().Value.Value : "";
- var returnVal = new Dictionary { { "min", 0 }, { "max", 0 } };
- if (stringVal.IsNullOrWhiteSpace() == false)
- {
- try
- {
- var json = JsonConvert.DeserializeObject(stringVal);
- if (json["Minimum"] != null)
- {
- //by default pre-values are sent out with an id/value pair
- returnVal["min"] = json["Minimum"].Value();
- }
- if (json["Maximum"] != null)
- {
- returnVal["max"] = json["Maximum"].Value();
- }
- }
- catch (Exception e)
- {
- //this shouldn't happen unless there's already a bad formatted pre-value
- LogHelper.WarnWithException("Could not deserialize value to json " + stringVal, e);
- return returnVal;
- }
- }
-
- return returnVal;
- }
- }
-
- ///
- /// Custom value editor so we can format the value for the editor and the database
- ///
- internal class MultipleTextStringPropertyValueEditor : PropertyValueEditorWrapper
- {
- public MultipleTextStringPropertyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
- {
- }
-
- ///
- /// The value passed in from the editor will be an array of simple objects so we'll need to parse them to get the string
- ///
- ///
- ///
- ///
- ///
- /// We will also check the pre-values here, if there are more items than what is allowed we'll just trim the end
- ///
- public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue)
- {
- var asArray = editorValue.Value as JArray;
- if (asArray == null)
- {
- return null;
- }
-
- var preVals = editorValue.PreValues.FormatAsDictionary();
- var max = -1;
- if (preVals.Any())
- {
- try
- {
- var json = JsonConvert.DeserializeObject(preVals.First().Value.Value);
- max = int.Parse(json["Maximum"].ToString());
- }
- catch (Exception)
- {
- //swallow
- max = -1;
- }
- }
-
- //The legacy property editor saved this data as new line delimited! strange but we have to maintain that.
- var array = asArray.OfType()
- .Where(x => x["value"] != null)
- .Select(x => x["value"].Value());
-
- //only allow the max
- return string.Join(Environment.NewLine, array.Take(max));
- }
-
- ///
- /// We are actually passing back an array of simple objects instead of an array of strings because in angular a primitive (string) value
- /// cannot have 2 way binding, so to get around that each item in the array needs to be an object with a string.
- ///
- ///
- ///
- ///
- /// The legacy property editor saved this data as new line delimited! strange but we have to maintain that.
- ///
- public override object ConvertDbToEditor(object dbValue)
- {
- return dbValue == null
- ? new JObject[] {}
- : dbValue.ToString().Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
- .Select(x => JObject.FromObject(new {value = x}));
-
-
- }
-
- }
- }
-}
\ No newline at end of file
+using System;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Collections;
+using System.Collections.Generic;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Umbraco.Core;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+using Umbraco.Core.Models.Editors;
+using Umbraco.Core.PropertyEditors;
+
+namespace Umbraco.Web.PropertyEditors
+{
+ [PropertyEditor(Constants.PropertyEditors.MultipleTextstringAlias, "Multiple Textbox", "multipletextbox", ValueType = "TEXT")]
+ public class MultipleTextStringPropertyEditor : PropertyEditor
+ {
+ protected override PropertyValueEditor CreateValueEditor()
+ {
+ return new MultipleTextStringPropertyValueEditor(base.CreateValueEditor());
+ }
+
+ protected override PreValueEditor CreatePreValueEditor()
+ {
+ return new MultipleTextStringPreValueEditor();
+ }
+
+ ///
+ /// A custom pre-value editor class to deal with the legacy way that the pre-value data is stored.
+ ///
+ internal class MultipleTextStringPreValueEditor : PreValueEditor
+ {
+ public MultipleTextStringPreValueEditor()
+ {
+ //create the fields
+ Fields.Add(new PreValueField(new IntegerValidator())
+ {
+ Description = "Enter the minimum amount of text boxes to be displayed",
+ Key = "min",
+ View = "requiredfield",
+ Name = "Minimum"
+ });
+ Fields.Add(new PreValueField(new IntegerValidator())
+ {
+ Description = "Enter the maximum amount of text boxes to be displayed, enter -1 for unlimited",
+ Key = "max",
+ View = "requiredfield",
+ Name = "Maximum"
+ });
+ }
+
+ ///
+ /// Need to change how we persist the values so they are compatible with the legacy way we store values
+ ///
+ ///
+ ///
+ ///
+ public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
+ {
+ //the values from the editor will be min/max fieds and we need to format to json in one field
+ var min = (editorValue.ContainsKey("min") ? editorValue["min"].ToString() : "0").TryConvertTo();
+ var max = (editorValue.ContainsKey("max") ? editorValue["max"].ToString() : "0").TryConvertTo();
+
+ var json = JObject.FromObject(new {Minimum = min.Success ? min.Result : 0, Maximum = max.Success ? max.Result : 0});
+
+ return new Dictionary { { "0", new PreValue(json.ToString(Formatting.None)) } };
+ }
+
+ ///
+ /// Need to deal with the legacy way of storing pre-values and turn them into nice values for the editor
+ ///
+ ///
+ ///
+ ///
+ public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
+ {
+ var preVals = persistedPreVals.FormatAsDictionary();
+ var stringVal = preVals.Any() ? preVals.First().Value.Value : "";
+ var returnVal = new Dictionary { { "min", 0 }, { "max", 0 } };
+ if (stringVal.IsNullOrWhiteSpace() == false)
+ {
+ try
+ {
+ var json = JsonConvert.DeserializeObject(stringVal);
+ if (json["Minimum"] != null)
+ {
+ //by default pre-values are sent out with an id/value pair
+ returnVal["min"] = json["Minimum"].Value();
+ }
+ if (json["Maximum"] != null)
+ {
+ returnVal["max"] = json["Maximum"].Value();
+ }
+ }
+ catch (Exception e)
+ {
+ //this shouldn't happen unless there's already a bad formatted pre-value
+ LogHelper.WarnWithException("Could not deserialize value to json " + stringVal, e);
+ return returnVal;
+ }
+ }
+
+ return returnVal;
+ }
+ }
+
+ ///
+ /// Custom value editor so we can format the value for the editor and the database
+ ///
+ internal class MultipleTextStringPropertyValueEditor : PropertyValueEditorWrapper
+ {
+ public MultipleTextStringPropertyValueEditor(PropertyValueEditor wrapped) : base(wrapped)
+ {
+ }
+
+ ///
+ /// The value passed in from the editor will be an array of simple objects so we'll need to parse them to get the string
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// We will also check the pre-values here, if there are more items than what is allowed we'll just trim the end
+ ///
+ public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue)
+ {
+ var asArray = editorValue.Value as JArray;
+ if (asArray == null)
+ {
+ return null;
+ }
+
+ var preVals = editorValue.PreValues.FormatAsDictionary();
+ var max = -1;
+ if (preVals.Any())
+ {
+ try
+ {
+ var json = JsonConvert.DeserializeObject(preVals.First().Value.Value);
+ max = int.Parse(json["Maximum"].ToString());
+ }
+ catch (Exception)
+ {
+ //swallow
+ max = -1;
+ }
+ }
+
+ //The legacy property editor saved this data as new line delimited! strange but we have to maintain that.
+ var array = asArray.OfType()
+ .Where(x => x["value"] != null)
+ .Select(x => x["value"].Value());
+
+ //only allow the max
+ return string.Join(Environment.NewLine, array.Take(max));
+ }
+
+ ///
+ /// We are actually passing back an array of simple objects instead of an array of strings because in angular a primitive (string) value
+ /// cannot have 2 way binding, so to get around that each item in the array needs to be an object with a string.
+ ///
+ ///
+ ///
+ ///
+ /// The legacy property editor saved this data as new line delimited! strange but we have to maintain that.
+ ///
+ public override object ConvertDbToEditor(object dbValue)
+ {
+ return dbValue == null
+ ? new JObject[] {}
+ : dbValue.ToString().Split(new[] {Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries)
+ .Select(x => JObject.FromObject(new {value = x}));
+
+
+ }
+
+ }
+ }
+}
diff --git a/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs
index 717dd4e53f..ca26bd1a57 100644
--- a/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs
+++ b/src/Umbraco.Web/PropertyEditors/ValueListPreValueEditor.cs
@@ -1,143 +1,149 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using Umbraco.Core.PropertyEditors;
-using umbraco;
-
-namespace Umbraco.Web.PropertyEditors
-{
- ///
- /// Pre-value editor used to create a list of items
- ///
- ///
- /// This pre-value editor is shared with editors like drop down, checkbox list, etc....
- ///
- internal class ValueListPreValueEditor : PreValueEditor
- {
-
- public ValueListPreValueEditor()
- {
- Fields.AddRange(CreatePreValueFields());
- }
-
- ///
- /// Creates the pre-value fields
- ///
- ///
- protected List CreatePreValueFields()
- {
- return new List
- {
- new PreValueField(new EnsureUniqueValuesValidator())
- {
- Description = "Add and remove values for the list",
- //we're going to call this 'items' because we are going to override the
- //serialization of the pre-values to ensure that each one gets saved with it's own key
- //(new db row per pre-value, thus to maintain backwards compatibility)
-
- //It's also important to note that by default the dropdown angular controller is expecting the
- // config options to come in with a property called 'items'
- Key = "items",
- Name = ui.Text("editdatatype", "addPrevalue"),
- View = "multivalues"
- }
- };
- }
-
- ///
- /// The editor is expecting a json array for a field with a key named "items" so we need to format the persisted values
- /// to this format to be used in the editor.
- ///
- ///
- ///
- ///
- public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
- {
- var dictionary = persistedPreVals.FormatAsDictionary();
- var arrayOfVals = dictionary.Select(item => item.Value).ToList();
-
- //the items list will be a dictionary of it's id -> value we need to use the id for persistence for backwards compatibility
- return new Dictionary { { "items", arrayOfVals.ToDictionary(x => x.Id, x => x.Value) } };
- }
-
- ///
- /// Need to format the delimited posted string to individual values
- ///
- ///
- ///
- ///
- /// A string/string dictionary since all values that need to be persisted in the database are strings.
- ///
- ///
- /// This is mostly because we want to maintain compatibility with v6 drop down property editors that store their prevalues in different db rows.
- ///
- public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
- {
- var val = editorValue["items"] as JArray;
- var result = new Dictionary();
-
- if (val == null)
- {
- return result;
- }
-
- try
- {
- var index = 0;
-
- //get all values in the array that are not empty
- foreach (var asString in val.OfType()
- .Where(jItem => jItem["value"] != null)
- .Select(jItem => jItem["value"].ToString())
- .Where(asString => asString.IsNullOrWhiteSpace() == false))
- {
- result.Add(index.ToInvariantString(), asString);
- index++;
- }
- }
- catch (Exception ex)
- {
- LogHelper.Error("Could not deserialize the posted value: " + val, ex);
- }
-
- return result;
- }
-
- ///
- /// A custom validator to ensure that all values in the list are unique
- ///
- internal class EnsureUniqueValuesValidator : IPropertyValidator
- {
- public IEnumerable Validate(object value, PreValueCollection preValues, PropertyEditor editor)
- {
- var json = value as JArray;
- if (json == null) yield break;
-
- //get all values in the array that are not empty (we'll remove empty values when persisting anyways)
- var groupedValues = json.OfType()
- .Where(jItem => jItem["value"] != null)
- .Select((jItem, index) => new {value = jItem["value"].ToString(), index = index})
- .Where(asString => asString.value.IsNullOrWhiteSpace() == false)
- .GroupBy(x => x.value);
-
- foreach (var g in groupedValues.Where(g => g.Count() > 1))
- {
- yield return new ValidationResult("The value " + g.Last().value + " must be unique", new[]
- {
- //we'll make the server field the index number of the value so it can be wired up to the view
- "item_" + g.Last().index.ToInvariantString()
- });
- }
-
-
- }
- }
- }
-}
\ No newline at end of file
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text.RegularExpressions;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using Umbraco.Core;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+using Umbraco.Core.PropertyEditors;
+using umbraco;
+
+namespace Umbraco.Web.PropertyEditors
+{
+ ///
+ /// Pre-value editor used to create a list of items
+ ///
+ ///
+ /// This pre-value editor is shared with editors like drop down, checkbox list, etc....
+ ///
+ internal class ValueListPreValueEditor : PreValueEditor
+ {
+
+ public ValueListPreValueEditor()
+ {
+ Fields.AddRange(CreatePreValueFields());
+ }
+
+ ///
+ /// Creates the pre-value fields
+ ///
+ ///
+ protected List CreatePreValueFields()
+ {
+ return new List
+ {
+ new PreValueField(new EnsureUniqueValuesValidator())
+ {
+ Description = "Add and remove values for the list",
+ //we're going to call this 'items' because we are going to override the
+ //serialization of the pre-values to ensure that each one gets saved with it's own key
+ //(new db row per pre-value, thus to maintain backwards compatibility)
+
+ //It's also important to note that by default the dropdown angular controller is expecting the
+ // config options to come in with a property called 'items'
+ Key = "items",
+ Name = ui.Text("editdatatype", "addPrevalue"),
+ View = "multivalues"
+ }
+ };
+ }
+
+ ///
+ /// The editor is expecting a json array for a field with a key named "items" so we need to format the persisted values
+ /// to this format to be used in the editor.
+ ///
+ ///
+ ///
+ ///
+ public override IDictionary ConvertDbToEditor(IDictionary defaultPreVals, PreValueCollection persistedPreVals)
+ {
+ var dictionary = persistedPreVals.FormatAsDictionary();
+ var arrayOfVals = dictionary.Select(item => item.Value).ToList();
+
+ //the items list will be a dictionary of it's id -> value we need to use the id for persistence for backwards compatibility
+ return new Dictionary { { "items", arrayOfVals.ToDictionary(x => x.Id, x => x.Value) } };
+ }
+
+ ///
+ /// Need to format the delimited posted string to individual values
+ ///
+ ///
+ ///
+ ///
+ /// A string/string dictionary since all values that need to be persisted in the database are strings.
+ ///
+ ///
+ /// This is mostly because we want to maintain compatibility with v6 drop down property editors that store their prevalues in different db rows.
+ ///
+ public override IDictionary ConvertEditorToDb(IDictionary editorValue, PreValueCollection currentValue)
+ {
+ var val = editorValue["items"] as JArray;
+ var result = new Dictionary();
+
+ if (val == null)
+ {
+ return result;
+ }
+
+ try
+ {
+ var index = 0;
+
+ //get all values in the array that are not empty
+ foreach (var item in val.OfType()
+ .Where(jItem => jItem["value"] != null)
+ .Select(jItem => new
+ {
+ idAsString = jItem["id"] == null ? "0" : jItem["id"].ToString(),
+ valAsString = jItem["value"].ToString()
+ })
+ .Where(x => x.valAsString.IsNullOrWhiteSpace() == false))
+ {
+ var id = 0;
+ int.TryParse(item.idAsString, out id);
+ result.Add(index.ToInvariantString(), new PreValue(id, item.valAsString));
+ index++;
+ }
+ }
+ catch (Exception ex)
+ {
+ LogHelper.Error("Could not deserialize the posted value: " + val, ex);
+ }
+
+ return result;
+ }
+
+ ///
+ /// A custom validator to ensure that all values in the list are unique
+ ///
+ internal class EnsureUniqueValuesValidator : IPropertyValidator
+ {
+ public IEnumerable Validate(object value, PreValueCollection preValues, PropertyEditor editor)
+ {
+ var json = value as JArray;
+ if (json == null) yield break;
+
+ //get all values in the array that are not empty (we'll remove empty values when persisting anyways)
+ var groupedValues = json.OfType()
+ .Where(jItem => jItem["value"] != null)
+ .Select((jItem, index) => new {value = jItem["value"].ToString(), index = index})
+ .Where(asString => asString.value.IsNullOrWhiteSpace() == false)
+ .GroupBy(x => x.value);
+
+ foreach (var g in groupedValues.Where(g => g.Count() > 1))
+ {
+ yield return new ValidationResult("The value " + g.Last().value + " must be unique", new[]
+ {
+ //we'll make the server field the index number of the value so it can be wired up to the view
+ "item_" + g.Last().index.ToInvariantString()
+ });
+ }
+
+
+ }
+ }
+ }
+}
diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs
index ae2e539d9b..a96fc8cdbd 100644
--- a/src/Umbraco.Web/Trees/ContentTreeController.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeController.cs
@@ -155,8 +155,17 @@ namespace Umbraco.Web.Trees
FilterUserAllowedMenuItems(nodeMenu, allowedMenuItems);
- //set the default to create
- nodeMenu.DefaultMenuAlias = ActionNew.Instance.Alias;
+ //if the media item is in the recycle bin, don't have a default menu, just show the regular menu
+ if (item.Path.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString()))
+ {
+ nodeMenu.DefaultMenuAlias = null;
+ }
+ else
+ {
+ //set the default to create
+ nodeMenu.DefaultMenuAlias = ActionNew.Instance.Alias;
+ }
+
return nodeMenu;
}
diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
index be80bba0b2..352f0c3521 100644
--- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
+++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs
@@ -71,7 +71,7 @@ namespace Umbraco.Web.Trees
if (!IsDialog(queryStrings))
{
nodes.Add(CreateTreeNode(
- Constants.System.RecycleBinContent.ToInvariantString(),
+ RecycleBinId.ToInvariantString(),
queryStrings,
ui.GetText("general", "recycleBin"),
"icon-trash",
diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs
index 00281b3d92..fd85910c8f 100644
--- a/src/Umbraco.Web/Trees/MediaTreeController.cs
+++ b/src/Umbraco.Web/Trees/MediaTreeController.cs
@@ -34,7 +34,7 @@ namespace Umbraco.Web.Trees
protected override int RecycleBinId
{
- get { return Constants.System.RecycleBinContent; }
+ get { return Constants.System.RecycleBinMedia; }
}
protected override bool RecycleBinSmells
@@ -102,6 +102,13 @@ namespace Umbraco.Web.Trees
menu.Items.Add(ui.Text("actions", ActionDelete.Instance.Alias));
menu.Items.Add(ui.Text("actions", ActionSort.Instance.Alias)).ConvertLegacyMenuItem(null, "media", "media");
menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true);
+
+ //if the media item is in the recycle bin, don't have a default menu, just show the regular menu
+ if (item.Path.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString()))
+ {
+ menu.DefaultMenuAlias = null;
+ }
+
return menu;
}
diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj
index cf69164722..04e74bf30b 100644
--- a/src/Umbraco.Web/Umbraco.Web.csproj
+++ b/src/Umbraco.Web/Umbraco.Web.csproj
@@ -588,7 +588,6 @@
-
ASPXCodeBehind
@@ -936,9 +935,6 @@
Code
-
- Code
-
delete.aspx
ASPXCodeBehind
diff --git a/src/Umbraco.Web/umbraco.presentation/content.cs b/src/Umbraco.Web/umbraco.presentation/content.cs
index 9bf99a3b15..5ee06f01d3 100644
--- a/src/Umbraco.Web/umbraco.presentation/content.cs
+++ b/src/Umbraco.Web/umbraco.presentation/content.cs
@@ -523,8 +523,6 @@ namespace umbraco
var cachedFieldKeyStart = string.Format("{0}{1}_", CacheKeys.ContentItemCacheKey, d.Id);
ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch(cachedFieldKeyStart);
- Action.RunActionHandlers(d, ActionPublish.Instance);
-
FireAfterUpdateDocumentCache(d, e);
}
}
@@ -552,10 +550,6 @@ namespace umbraco
ClearContextCache();
}
- foreach (Document d in Documents)
- {
- Action.RunActionHandlers(d, ActionPublish.Instance);
- }
}
///
@@ -636,12 +630,6 @@ namespace umbraco
}
}
- if (x != null)
- {
- // Run Handler
- Action.RunActionHandlers(doc, ActionUnPublish.Instance);
- }
-
//SD: changed to fire event BEFORE running the sitemap!! argh.
FireAfterClearDocumentCache(doc, e);
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs
deleted file mode 100644
index 3b67907bd2..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/SimilarNodeNameComparer.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-namespace umbraco.ActionHandlers
-{
- ///
- /// Comparer that takes into account the duplicate index of a node name
- /// This is needed as a normal alphabetic sort would go Page (1), Page (10), Page (2) etc.
- ///
- [Obsolete("This class is no longer used and will be removed from the codebase in future versions")]
- public class SimilarNodeNameComparer : IComparer
- {
- public int Compare(string x, string y)
- {
- if (x.LastIndexOf(')') == x.Length - 1 && y.LastIndexOf(')') == y.Length - 1)
- {
- if (x.ToLower().Substring(0, x.LastIndexOf('(')) == y.ToLower().Substring(0, y.LastIndexOf('(')))
- {
- int xDuplicateIndex = ExtractDuplicateIndex(x);
- int yDuplicateIndex = ExtractDuplicateIndex(y);
-
- if (xDuplicateIndex != 0 && yDuplicateIndex != 0)
- {
- return xDuplicateIndex.CompareTo(yDuplicateIndex);
- }
- }
- }
- return x.ToLower().CompareTo(y.ToLower());
- }
-
- private int ExtractDuplicateIndex(string text)
- {
- int index = 0;
-
- if (text.LastIndexOf('(') != -1 && text.LastIndexOf('(') < text.Length - 2)
- {
- int startPos = text.LastIndexOf('(') + 1;
- int length = text.Length - 1 - startPos;
-
- int.TryParse(text.Substring(startPos, length), out index);
- }
-
- return index;
- }
- }
-}
\ No newline at end of file
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs
deleted file mode 100644
index 8a311aae44..0000000000
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/ActionHandlers/umbEnsureUniqueName.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using System;
-using System.Linq;
-using Umbraco.Core.Configuration;
-using Umbraco.Core.Logging;
-using umbraco.cms.businesslogic.web;
-using umbraco.BusinessLogic.Actions;
-
-namespace umbraco.ActionHandlers
-{
- ///
- /// umbEnsureUniqueName is a standard Umbraco action handler.
- /// It ensures that new content nodes gets a unique name, and thereby avoiding conflictiong URLs.
- /// It can be disabled in the umbracoSettings.config file.
- ///
- [Obsolete("This handler is no longer used")]
- public class umbEnsureUniqueName : IActionHandler
- {
- public umbEnsureUniqueName()
- {
- }
- #region IActionHandler Members
-
- ///
- /// Actionhandler name
- ///
- ///
- public string HandlerName()
- {
- return "umbEnsureUniqueName";
- }
-
- ///
- /// Executes on the current document object when the specified actions occur
- ///
- /// The document object.
- /// The action.
- /// Returns true if successfull, otherwise false
- public bool Execute(umbraco.cms.businesslogic.web.Document documentObject, interfaces.IAction action)
- {
-
- if (UmbracoConfig.For.UmbracoSettings().Content.EnsureUniqueNaming)
- {
- string currentName = documentObject.Text;
- int uniqueNumber = 1;
-
- // Check for all items underneath the parent to see if they match
- // as any new created documents are stored in the bottom, we can just
- // keep checking for other documents with a uniquenumber from
-
- //store children array here because iterating over an Array property object is very inneficient.
- var c = Document.GetChildrenBySearch(documentObject.ParentId, currentName + "%");
-
- // must sort the list or else duplicate name will exist if pages are out out sequence
- //e.g. Page (1), Page (3), Page (2)
- var results = c.OrderBy(x => x.Text, new SimilarNodeNameComparer());
- foreach (Document d in results)
- {
- if (d.Id != documentObject.Id && d.Text.ToLower() == currentName.ToLower())
- {
- currentName = documentObject.Text + " (" + uniqueNumber.ToString() + ")";
- uniqueNumber++;
- }
- }
-
- // if name has been changed, update the documentobject
- if (currentName != documentObject.Text)
- {
- // add name change to the log
- LogHelper.Debug("Title changed from '" + documentObject.Text + "' to '" + currentName + "' for document id" + documentObject.Id);
-
- documentObject.Text = currentName;
-
- return true;
- }
- }
-
- return false;
- }
-
- ///
- /// Returns a collection of Iactions this handler reacts on.
- /// The umbEnsureUniqueName handler reacts on ActionNew() actions by default.
- ///
- ///
- public interfaces.IAction[] ReturnActions()
- {
- interfaces.IAction[] _retVal = { };
- return _retVal;
- }
-
- #endregion
- }
-}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs
index 3f2b466345..696aa8534a 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs
@@ -60,24 +60,6 @@ namespace umbraco.presentation.developer.packages {
Umbraco.Core.SystemUtilities.GetCurrentTrustLevel());
}
- #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);
- }
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent() {
-
- }
- #endregion
}
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs
index bdf76d2b9b..e18d46c625 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs
@@ -148,7 +148,7 @@ namespace umbraco.presentation.developer.packages
Panel1.Text = "Installing the package: " + _installer.Name;
- if (_installer.ContainsUnsecureFiles && _repo == null)
+ if (_installer.ContainsUnsecureFiles)
{
pp_unsecureFiles.Visible = true;
foreach (string str in _installer.UnsecureFiles)
@@ -157,6 +157,20 @@ namespace umbraco.presentation.developer.packages
}
}
+ if (_installer.ContainsLegacyPropertyEditors)
+ {
+ LegacyPropertyEditorPanel.Visible = true;
+ }
+
+ if (_installer.ContainsBinaryFileErrors)
+ {
+ BinaryFileErrorsPanel.Visible = true;
+ foreach (var str in _installer.BinaryFileErrors)
+ {
+ BinaryFileErrorReport.Text += "" + str + "";
+ }
+ }
+
if (_installer.ContainsMacroConflict)
{
pp_macroConflicts.Visible = true;
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.designer.cs
index fcd09e7c9b..abe1f67506 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.designer.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.designer.cs
@@ -299,6 +299,10 @@ namespace umbraco.presentation.developer.packages {
/// To modify move field declaration from designer file to code-behind file.
///
protected global::umbraco.uicontrols.PropertyPanel pp_templateConflicts;
+
+ protected global::umbraco.uicontrols.PropertyPanel BinaryFileErrorsPanel;
+ protected global::umbraco.uicontrols.PropertyPanel LegacyPropertyEditorPanel;
+ protected global::System.Web.UI.WebControls.Literal BinaryFileErrorReport;
///
/// ltrTemplateAlias control.
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
index da69599d44..208b2a9780 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs
@@ -32,8 +32,8 @@ namespace umbraco.dialogs
int docId;
if (int.TryParse(Request.QueryString["id"], out docId))
{
- var document = new Document(docId);
- BusinessLogic.Actions.Action.RunActionHandlers(document, ActionToPublish.Instance);
+
+ //TODO Send to publish!!
}
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
index 9a9ccbd467..00d1cd76f4 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs
@@ -27,7 +27,7 @@ namespace umbraco.presentation.translation
{
public _default()
{
- CurrentApp = BusinessLogic.DefaultApps.translation.ToString();
+ CurrentApp = DefaultApps.translation.ToString();
}
protected void Page_Load(object sender, EventArgs e)
@@ -118,7 +118,7 @@ namespace umbraco.presentation.translation
{
try
{
- foreach (Task translation in importTranslatationFile(translationFileXml.FullName))
+ foreach (Task translation in ImportTranslatationFile(translationFileXml.FullName))
{
sb.Append("" + translation.Node.Text + " " + ui.Text("preview") + "");
@@ -142,7 +142,7 @@ namespace umbraco.presentation.translation
else
{
StringBuilder sb = new StringBuilder();
- List l = importTranslatationFile(tempFileName);
+ List l = ImportTranslatationFile(tempFileName);
if (l.Count == 1)
{
@@ -167,12 +167,7 @@ namespace umbraco.presentation.translation
}
}
- private void hideAll()
- {
- pane_uploadFile.Visible = false;
- pane_tasks.Visible = false;
- }
- private List importTranslatationFile(string tempFileName)
+ private List ImportTranslatationFile(string tempFileName)
{
try
{
@@ -200,9 +195,8 @@ namespace umbraco.presentation.translation
{
// update node contents
- Document d = new Document(t.Node.Id);
+ var d = new Document(t.Node.Id);
Document.Import(d.ParentId, getUser(), (XmlElement)taskNode);
- BusinessLogic.Actions.Action.RunActionHandlers(d, ActionTranslate.Instance);
/* d.Text = taskNode.Attributes.GetNamedItem("nodeName").Value.Trim();
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
index b18e34292f..a6e2d7e402 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs
@@ -160,8 +160,6 @@ namespace umbraco.presentation.webservices
if (parentNode != null)
content.SortNodes(ref parentNode);
- // fire actionhandler, check for content
- BusinessLogic.Actions.Action.RunActionHandlers(new Document(parentId), ActionSort.Instance);
}
catch (Exception ex)
{
diff --git a/src/umbraco.cms/Actions/Action.cs b/src/umbraco.cms/Actions/Action.cs
index e29546d8ca..a4e7c097ce 100644
--- a/src/umbraco.cms/Actions/Action.cs
+++ b/src/umbraco.cms/Actions/Action.cs
@@ -33,7 +33,7 @@ namespace umbraco.BusinessLogic.Actions
[Obsolete("Actions and ActionHandlers are obsolete and should no longer be used")]
public class Action
{
- private static readonly List ActionHandlers = new List();
+
private static readonly Dictionary ActionJs = new Dictionary();
private static readonly object Lock = new object();
@@ -58,81 +58,14 @@ namespace umbraco.BusinessLogic.Actions
{
//TODO: Based on the above, this is a big hack as types should all be cleared on package install!
ActionsResolver.Reset(false); // and do NOT reset the whole resolution!
- ActionHandlers.Clear();
//TODO: Based on the above, this is a big hack as types should all be cleared on package install!
ActionsResolver.Current = new ActionsResolver(
() => TypeFinder.FindClassesOfType(PluginManager.Current.AssembliesToScan));
-
- RegisterIActionHandlers();
}
}
}
- ///
- /// Stores all IActionHandlers that have been loaded into memory into a list
- ///
- private static void RegisterIActionHandlers()
- {
- if (ActionHandlers.Count == 0)
- {
- ActionHandlers.AddRange(
- PluginManager.Current.CreateInstances(
- PluginManager.Current.ResolveActionHandlers()));
- }
-
- }
-
- ///
- /// Whenever an action is performed upon a document/media/member, this method is executed, ensuring that
- /// all registered handlers will have an oppotunity to handle the action.
- ///
- /// The document being operated on
- /// The action triggered
- public static void RunActionHandlers(Document d, IAction action)
- {
- foreach (IActionHandler ia in ActionHandlers)
- {
- try
- {
- foreach (IAction a in ia.ReturnActions())
- {
- if (a.Alias == action.Alias)
- {
- // Uncommented for auto publish support
- // System.Web.HttpContext.Current.Trace.Write("BusinessLogic.Action.RunActionHandlers", "Running " + ia.HandlerName() + " (matching action: " + a.Alias + ")");
- ia.Execute(d, action);
- }
- }
- }
- catch (Exception iaExp)
- {
- LogHelper.Error(string.Format("Error loading actionhandler '{0}'", ia.HandlerName()), iaExp);
- }
- }
-
- // Run notification
- // Find current user
- User u;
- try
- {
- u = User.GetCurrent();
- }
- catch
- {
- u = User.GetUser(0);
- }
- if (u == null)
- {
- //GE 2012-02-29
- //user will be null when using distributed calls
- //can't easily get the real publishing user to bubble all the way through the distributed call framework
- //so just check for it and set it to admin, so at least the notification gets sent
- u = User.GetUser(0);
- }
- Notification.GetNotifications(d, u, action);
- }
-
///
/// Jacascript for the contextmenu
/// Suggestion: this method should be moved to the presentation layer.
diff --git a/src/umbraco.cms/Actions/IActionHandler.cs b/src/umbraco.cms/Actions/IActionHandler.cs
deleted file mode 100644
index cc4fecd51c..0000000000
--- a/src/umbraco.cms/Actions/IActionHandler.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using umbraco.cms.businesslogic.web;
-using umbraco.interfaces;
-
-namespace umbraco.BusinessLogic.Actions
-{
- ///
- /// Implement the IActionHandler interface in order to automatically get code
- /// run whenever a document, member or media changed, deleted, created etc.
- /// The Clases implementing IActionHandler are loaded at runtime which means
- /// that there are no other setup when creating a custom actionhandler.
- ///
- ///
- ///
- ///
- [Obsolete("Legacy! Use events instead")]
- public interface IActionHandler
- {
- bool Execute(Document documentObject, IAction action);
- IAction[] ReturnActions();
- string HandlerName();
- }
-}
diff --git a/src/umbraco.cms/PluginManagerExtensions.cs b/src/umbraco.cms/PluginManagerExtensions.cs
index b0d50a7276..a51c0b3af0 100644
--- a/src/umbraco.cms/PluginManagerExtensions.cs
+++ b/src/umbraco.cms/PluginManagerExtensions.cs
@@ -15,16 +15,6 @@ namespace umbraco.cms
public static class PluginManagerExtensions
{
- ///
- /// Returns all available IActionHandler in application
- ///
- ///
- ///
- internal static IEnumerable ResolveActionHandlers(this PluginManager resolver)
- {
- return resolver.ResolveTypes();
- }
-
///
/// Returns all available IActions in application
///
diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs
index cd6096eb60..01dc2522bf 100644
--- a/src/umbraco.cms/businesslogic/Packager/Installer.cs
+++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs
@@ -1,22 +1,21 @@
using System;
-using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Xml;
-using System.Runtime.CompilerServices;
using System.Linq;
using ICSharpCode.SharpZipLib.Zip;
using Umbraco.Core;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
+using Umbraco.Core.Packaging;
using umbraco.cms.businesslogic.web;
using umbraco.cms.businesslogic.propertytype;
using umbraco.BusinessLogic;
-using umbraco.DataLayer;
using System.Diagnostics;
using umbraco.cms.businesslogic.macro;
using umbraco.cms.businesslogic.template;
+using umbraco.interfaces;
namespace umbraco.cms.businesslogic.packager
{
@@ -37,69 +36,69 @@ namespace umbraco.cms.businesslogic.packager
{
private const string PackageServer = "packages.umbraco.org";
- private string _name;
- private string _version;
- private string _url;
- private string _license;
- private string _licenseUrl;
- private int _reqMajor;
- private int _reqMinor;
- private int _reqPatch;
- private string _authorName;
- private string _authorUrl;
- private string _readme;
- private string _control;
- private bool _containUnsecureFiles = false;
- private List _unsecureFiles = new List();
- private bool _containsMacroConflict = false;
- private Dictionary _conflictingMacroAliases = new Dictionary();
- private bool _containsTemplateConflict = false;
- private Dictionary _conflictingTemplateAliases = new Dictionary();
- private bool _containsStyleSheetConflict = false;
- private Dictionary _conflictingStyleSheetNames = new Dictionary();
+ private readonly List _unsecureFiles = new List();
+ private readonly Dictionary _conflictingMacroAliases = new Dictionary();
+ private readonly Dictionary _conflictingTemplateAliases = new Dictionary();
+ private readonly Dictionary _conflictingStyleSheetNames = new Dictionary();
- private ArrayList _macros = new ArrayList();
- private XmlDocument _packageConfig;
+ private readonly List _binaryFileErrors = new List();
- public string Name { get { return _name; } }
- public string Version { get { return _version; } }
- public string Url { get { return _url; } }
- public string License { get { return _license; } }
- public string LicenseUrl { get { return _licenseUrl; } }
- public string Author { get { return _authorName; } }
- public string AuthorUrl { get { return _authorUrl; } }
- public string ReadMe { get { return _readme; } }
- public string Control { get { return _control; } }
+ public string Name { get; private set; }
+ public string Version { get; private set; }
+ public string Url { get; private set; }
+ public string License { get; private set; }
+ public string LicenseUrl { get; private set; }
+ public string Author { get; private set; }
+ public string AuthorUrl { get; private set; }
+ public string ReadMe { get; private set; }
+ public string Control { get; private set; }
- public bool ContainsMacroConflict { get { return _containsMacroConflict; } }
+ public bool ContainsMacroConflict { get; private set; }
public IDictionary ConflictingMacroAliases { get { return _conflictingMacroAliases; } }
- public bool ContainsUnsecureFiles { get { return _containUnsecureFiles; } }
+ public bool ContainsUnsecureFiles { get; private set; }
public List UnsecureFiles { get { return _unsecureFiles; } }
- public bool ContainsTemplateConflicts { get { return _containsTemplateConflict; } }
+ public bool ContainsTemplateConflicts { get; private set; }
public IDictionary ConflictingTemplateAliases { get { return _conflictingTemplateAliases; } }
- public bool ContainsStyleSheeConflicts { get { return _containsStyleSheetConflict; } }
+ ///
+ /// Indicates that the package contains assembly reference errors
+ ///
+ public bool ContainsBinaryFileErrors { get; private set; }
+
+ ///
+ /// List each assembly reference error
+ ///
+ public List BinaryFileErrors { get { return _binaryFileErrors; } }
+
+ ///
+ /// Indicates that the package contains legacy property editors
+ ///
+ public bool ContainsLegacyPropertyEditors { get; private set; }
+
+ public bool ContainsStyleSheeConflicts { get; private set; }
public IDictionary ConflictingStyleSheetNames { get { return _conflictingStyleSheetNames; } }
- public int RequirementsMajor { get { return _reqMajor; } }
- public int RequirementsMinor { get { return _reqMinor; } }
- public int RequirementsPatch { get { return _reqPatch; } }
+ public int RequirementsMajor { get; private set; }
+ public int RequirementsMinor { get; private set; }
+ public int RequirementsPatch { get; private set; }
///
/// The xmldocument, describing the contents of a package.
///
- public XmlDocument Config
- {
- get { return _packageConfig; }
- }
+ public XmlDocument Config { get; private set; }
///
/// Constructor
///
public Installer()
{
+ ContainsBinaryFileErrors = false;
+ ContainsTemplateConflicts = false;
+ ContainsUnsecureFiles = false;
+ ContainsMacroConflict = false;
+ ContainsStyleSheeConflicts = false;
}
///
@@ -119,32 +118,27 @@ namespace umbraco.cms.businesslogic.packager
/// The name of the usercontrol used to configure the package after install
public Installer(string Name, string Version, string Url, string License, string LicenseUrl, string Author, string AuthorUrl, int RequirementsMajor, int RequirementsMinor, int RequirementsPatch, string Readme, string Control)
{
- _name = Name;
- _version = Version;
- _url = Url;
- _license = License;
- _licenseUrl = LicenseUrl;
- _reqMajor = RequirementsMajor;
- _reqMinor = RequirementsMinor;
- _reqPatch = RequirementsPatch;
- _authorName = Author;
- _authorUrl = AuthorUrl;
- _readme = Readme;
- _control = Control;
+ ContainsBinaryFileErrors = false;
+ ContainsTemplateConflicts = false;
+ ContainsUnsecureFiles = false;
+ ContainsMacroConflict = false;
+ ContainsStyleSheeConflicts = false;
+ this.Name = Name;
+ this.Version = Version;
+ this.Url = Url;
+ this.License = License;
+ this.LicenseUrl = LicenseUrl;
+ this.RequirementsMajor = RequirementsMajor;
+ this.RequirementsMinor = RequirementsMinor;
+ this.RequirementsPatch = RequirementsPatch;
+ this.Author = Author;
+ this.AuthorUrl = AuthorUrl;
+ ReadMe = Readme;
+ this.Control = Control;
}
#region Public Methods
- ///
- /// Adds the macro to the package
- ///
- /// Macro to add
- [Obsolete("This method does nothing but add the macro to an ArrayList that is never used, so don't call this method.")]
- public void AddMacro(Macro MacroToAdd)
- {
- _macros.Add(MacroToAdd);
- }
-
///
/// Imports the specified package
///
@@ -156,10 +150,10 @@ namespace umbraco.cms.businesslogic.packager
() => "Importing package file " + InputFile,
() => "Package file " + InputFile + "imported"))
{
- string tempDir = "";
+ var tempDir = "";
if (File.Exists(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile)))
{
- FileInfo fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile));
+ var fi = new FileInfo(IOHelper.MapPath(SystemDirectories.Data + Path.DirectorySeparatorChar + InputFile));
// Check if the file is a valid package
if (fi.Extension.ToLower() == ".umb")
{
@@ -185,38 +179,38 @@ namespace umbraco.cms.businesslogic.packager
public int CreateManifest(string tempDir, string guid, string repoGuid)
{
//This is the new improved install rutine, which chops up the process into 3 steps, creating the manifest, moving files, and finally handling umb objects
- string _packName = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
- string _packAuthor = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
- string _packAuthorUrl = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website"));
- string _packVersion = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/version"));
- string _packReadme = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
- string _packLicense = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license "));
- string _packUrl = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/url "));
+ var packName = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
+ var packAuthor = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
+ var packAuthorUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website"));
+ var packVersion = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/version"));
+ var packReadme = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
+ var packLicense = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license "));
+ var packUrl = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/url "));
- bool _enableSkins = false;
- string _skinRepoGuid = "";
+ var enableSkins = false;
+ var skinRepoGuid = "";
- if (_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/enableSkins") != null)
+ if (Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins") != null)
{
- XmlNode _skinNode = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/enableSkins");
- _enableSkins = bool.Parse(xmlHelper.GetNodeValue(_skinNode));
- if (_skinNode.Attributes["repository"] != null && !string.IsNullOrEmpty(_skinNode.Attributes["repository"].Value))
- _skinRepoGuid = _skinNode.Attributes["repository"].Value;
+ var skinNode = Config.DocumentElement.SelectSingleNode("/umbPackage/enableSkins");
+ enableSkins = bool.Parse(XmlHelper.GetNodeValue(skinNode));
+ if (skinNode.Attributes["repository"] != null && string.IsNullOrEmpty(skinNode.Attributes["repository"].Value) == false)
+ skinRepoGuid = skinNode.Attributes["repository"].Value;
}
//Create a new package instance to record all the installed package adds - this is the same format as the created packages has.
//save the package meta data
- packager.InstalledPackage insPack = packager.InstalledPackage.MakeNew(_packName);
- insPack.Data.Author = _packAuthor;
- insPack.Data.AuthorUrl = _packAuthorUrl;
- insPack.Data.Version = _packVersion;
- insPack.Data.Readme = _packReadme;
- insPack.Data.License = _packLicense;
- insPack.Data.Url = _packUrl;
+ var insPack = InstalledPackage.MakeNew(packName);
+ insPack.Data.Author = packAuthor;
+ insPack.Data.AuthorUrl = packAuthorUrl;
+ insPack.Data.Version = packVersion;
+ insPack.Data.Readme = packReadme;
+ insPack.Data.License = packLicense;
+ insPack.Data.Url = packUrl;
//skinning
- insPack.Data.EnableSkins = _enableSkins;
- insPack.Data.SkinRepoGuid = string.IsNullOrEmpty(_skinRepoGuid) ? Guid.Empty : new Guid(_skinRepoGuid);
+ insPack.Data.EnableSkins = enableSkins;
+ insPack.Data.SkinRepoGuid = string.IsNullOrEmpty(skinRepoGuid) ? Guid.Empty : new Guid(skinRepoGuid);
insPack.Data.PackageGuid = guid; //the package unique key.
insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged.
@@ -232,23 +226,23 @@ namespace umbraco.cms.businesslogic.packager
() => "Package file installation complete for package id " + packageId))
{
//retrieve the manifest to continue installation
- packager.InstalledPackage insPack = packager.InstalledPackage.GetById(packageId);
+ var insPack = InstalledPackage.GetById(packageId);
// Move files
//string virtualBasePath = System.Web.HttpContext.Current.Request.ApplicationPath;
string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file"))
{
//we enclose the whole file-moving to ensure that the entire installer doesn't crash
try
{
- String destPath = GetFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
- String sourceFile = GetFileName(tempDir, xmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
- String destFile = GetFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
+ var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
+ var sourceFile = GetFileName(tempDir, XmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
+ var destFile = GetFileName(destPath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
// Create the destination directory if it doesn't exist
- if (!Directory.Exists(destPath))
+ if (Directory.Exists(destPath) == false)
Directory.CreateDirectory(destPath);
//If a file with this name exists, delete it
else if (File.Exists(destFile))
@@ -258,7 +252,7 @@ namespace umbraco.cms.businesslogic.packager
File.Move(sourceFile, destFile);
//PPH log file install
- insPack.Data.Files.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
+ insPack.Data.Files.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
}
catch (Exception ex)
{
@@ -291,9 +285,11 @@ namespace umbraco.cms.businesslogic.packager
}
//Xml as XElement which is used with the new PackagingService
- var rootElement = _packageConfig.DocumentElement.GetXElement();
+ var rootElement = Config.DocumentElement.GetXElement();
var packagingService = ApplicationContext.Current.Services.PackagingService;
+ //Perhaps it would have been a good idea to put the following into methods eh?!?
+
#region DataTypes
var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault();
if(dataTypeElement != null)
@@ -320,7 +316,7 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Languages
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("//Language"))
{
language.Language newLang = language.Language.Import(n);
@@ -335,7 +331,7 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Dictionary items
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem"))
{
Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
@@ -350,7 +346,7 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Macros
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//macro"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("//macro"))
{
Macro m = Macro.Import(n);
@@ -396,8 +392,8 @@ namespace umbraco.cms.businesslogic.packager
// is a lot of excess database calls happening here.
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
{
- string master = xmlHelper.GetNodeValue(n.SelectSingleNode("Master"));
- Template t = Template.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Alias")));
+ string master = XmlHelper.GetNodeValue(n.SelectSingleNode("Master"));
+ Template t = Template.GetByAlias(XmlHelper.GetNodeValue(n.SelectSingleNode("Alias")));
if (master.Trim() != "")
{
var masterTemplate = Template.GetByAlias(master);
@@ -418,7 +414,7 @@ namespace umbraco.cms.businesslogic.packager
// Master templates can only be generated when their master is known
if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages)
{
- t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
+ t.ImportDesign(XmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
t.SaveMasterPageFile(t.Design);
}
}*/
@@ -455,13 +451,13 @@ namespace umbraco.cms.businesslogic.packager
// Add documenttype structure
foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
{
- DocumentType dt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
+ DocumentType dt = DocumentType.GetByAlias(XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
if (dt != null)
{
ArrayList allowed = new ArrayList();
foreach (XmlNode structure in n.SelectNodes("Structure/DocumentType"))
{
- DocumentType dtt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(structure));
+ DocumentType dtt = DocumentType.GetByAlias(XmlHelper.GetNodeValue(structure));
if (dtt != null)
allowed.Add(dtt.Id);
}
@@ -481,7 +477,7 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Stylesheets
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
{
StyleSheet s = StyleSheet.Import(n, currentUser);
@@ -507,7 +503,7 @@ namespace umbraco.cms.businesslogic.packager
#endregion
#region Package Actions
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("Actions/Action"))
{
if (n.Attributes["undo"] == null || n.Attributes["undo"].Value == "true")
{
@@ -549,260 +545,6 @@ namespace umbraco.cms.businesslogic.packager
Directory.Delete(tempDir, true);
}
}
-
- ///
- /// Invoking this method installs the entire current package
- ///
- /// Temporary folder where the package's content are extracted to
- ///
- ///
- public void Install(string tempDir, string guid, string repoGuid)
- {
- //PPH added logging of installs, this adds all install info in the installedPackages config file.
- string packName = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/name"));
- string packAuthor = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name"));
- string packAuthorUrl = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website"));
- string packVersion = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/version"));
- string packReadme = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
- string packLicense = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license "));
-
-
- //Create a new package instance to record all the installed package adds - this is the same format as the created packages has.
- //save the package meta data
- var insPack = InstalledPackage.MakeNew(packName);
- insPack.Data.Author = packAuthor;
- insPack.Data.AuthorUrl = packAuthorUrl;
- insPack.Data.Version = packVersion;
- insPack.Data.Readme = packReadme;
- insPack.Data.License = packLicense;
- insPack.Data.PackageGuid = guid; //the package unique key.
- insPack.Data.RepositoryGuid = repoGuid; //the repository unique key, if the package is a file install, the repository will not get logged.
-
- // Get current user, with a fallback
- var currentUser = new User(0);
- if (string.IsNullOrEmpty(BasePages.UmbracoEnsuredPage.umbracoUserContextID) == false)
- {
- if (BasePages.UmbracoEnsuredPage.ValidateUserContextID(BasePages.UmbracoEnsuredPage.umbracoUserContextID))
- {
- currentUser = User.GetCurrent();
- }
- }
-
- //Xml as XElement which is used with the new PackagingService
- var rootElement = _packageConfig.DocumentElement.GetXElement();
- var packagingService = ApplicationContext.Current.Services.PackagingService;
-
- #region DataTypes
- var dataTypeElement = rootElement.Descendants("DataTypes").FirstOrDefault();
- if(dataTypeElement != null)
- {
- var dataTypeDefinitions = packagingService.ImportDataTypeDefinitions(dataTypeElement, currentUser.Id);
- foreach (var dataTypeDefinition in dataTypeDefinitions)
- {
- insPack.Data.DataTypes.Add(dataTypeDefinition.Id.ToString(CultureInfo.InvariantCulture));
- }
- }
- #endregion
-
- #region Install Languages
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//Language"))
- {
- language.Language newLang = language.Language.Import(n);
-
- if (newLang != null)
- insPack.Data.Languages.Add(newLang.id.ToString());
- }
- #endregion
-
- #region Install Dictionary Items
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("./DictionaryItems/DictionaryItem"))
- {
- Dictionary.DictionaryItem newDi = Dictionary.DictionaryItem.Import(n);
-
- if (newDi != null)
- insPack.Data.DictionaryItems.Add(newDi.id.ToString());
- }
- #endregion
-
- #region Install Macros
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//macro"))
- {
- Macro m = Macro.Import(n);
-
- if (m != null)
- insPack.Data.Macros.Add(m.Id.ToString());
- }
- #endregion
-
- #region Move files
- string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file"))
- {
- String destPath = GetFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
- String sourceFile = GetFileName(tempDir, xmlHelper.GetNodeValue(n.SelectSingleNode("guid")));
- String destFile = GetFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
-
- // Create the destination directory if it doesn't exist
- if (!Directory.Exists(destPath))
- Directory.CreateDirectory(destPath);
- // If a file with this name exists, delete it
- else if (File.Exists(destFile))
- File.Delete(destFile);
- // Move the file
- File.Move(sourceFile, destFile);
-
- //PPH log file install
- insPack.Data.Files.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")) + "/" + xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
- }
- #endregion
-
- #region Install Templates
- var templateElement = rootElement.Descendants("Templates").FirstOrDefault();
- if (templateElement != null)
- {
- var templates = packagingService.ImportTemplates(templateElement, currentUser.Id);
- foreach (var template in templates)
- {
- insPack.Data.Templates.Add(template.Id.ToString(CultureInfo.InvariantCulture));
- }
- }
- /*foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
- {
- Template t = Template.MakeNew(xmlHelper.GetNodeValue(n.SelectSingleNode("Name")), currentUser);
- t.Alias = xmlHelper.GetNodeValue(n.SelectSingleNode("Alias"));
-
- t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
-
- insPack.Data.Templates.Add(t.Id.ToString());
- }
-
- // Add master templates
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
- {
- string master = xmlHelper.GetNodeValue(n.SelectSingleNode("Master"));
- Template t = Template.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Alias")));
- if (master.Trim() != "")
- {
- Template masterTemplate = Template.GetByAlias(master);
- if (masterTemplate != null)
- {
- t.MasterTemplate = Template.GetByAlias(master).Id;
- if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages)
- t.SaveMasterPageFile(t.Design);
- }
- }
- // Master templates can only be generated when their master is known
- if (UmbracoConfiguration.Current.UmbracoSettings.Templates.UseAspNetMasterPages)
- {
- t.ImportDesign(xmlHelper.GetNodeValue(n.SelectSingleNode("Design")));
- t.SaveMasterPageFile(t.Design);
- }
- }*/
- #endregion
-
- #region Install DocumentTypes
- //Check whether the root element is a doc type rather then a complete package
- var docTypeElement = rootElement.Name.LocalName.Equals("DocumentType") ||
- rootElement.Name.LocalName.Equals("DocumentTypes")
- ? rootElement
- : rootElement.Descendants("DocumentTypes").FirstOrDefault();
- if (docTypeElement != null)
- {
- var contentTypes = packagingService.ImportContentTypes(docTypeElement, currentUser.Id);
- foreach (var contentType in contentTypes)
- {
- insPack.Data.Documenttypes.Add(contentType.Id.ToString(CultureInfo.InvariantCulture));
- }
- }
- /*foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
- {
- ImportDocumentType(n, currentUser, false);
- }
-
- // Add documenttype structure
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("DocumentTypes/DocumentType"))
- {
- DocumentType dt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
- if (dt != null)
- {
- ArrayList allowed = new ArrayList();
- foreach (XmlNode structure in n.SelectNodes("Structure/DocumentType"))
- {
- DocumentType dtt = DocumentType.GetByAlias(xmlHelper.GetNodeValue(structure));
- allowed.Add(dtt.Id);
- }
- int[] adt = new int[allowed.Count];
- for (int i = 0; i < allowed.Count; i++)
- adt[i] = (int)allowed[i];
- dt.AllowedChildContentTypeIDs = adt;
-
- //PPH we log the document type install here.
- insPack.Data.Documenttypes.Add(dt.Id.ToString());
- }
- }*/
- #endregion
-
- #region Install Stylesheets
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
- {
- StyleSheet s = StyleSheet.MakeNew(
- currentUser,
- xmlHelper.GetNodeValue(n.SelectSingleNode("Name")),
- xmlHelper.GetNodeValue(n.SelectSingleNode("FileName")),
- xmlHelper.GetNodeValue(n.SelectSingleNode("Content")));
-
- foreach (XmlNode prop in n.SelectNodes("Properties/Property"))
- {
- StylesheetProperty sp = StylesheetProperty.MakeNew(
- xmlHelper.GetNodeValue(prop.SelectSingleNode("Name")),
- s,
- currentUser);
- sp.Alias = xmlHelper.GetNodeValue(prop.SelectSingleNode("Alias"));
- sp.value = xmlHelper.GetNodeValue(prop.SelectSingleNode("Value"));
- }
- s.saveCssToFile();
- s.Save();
-
- insPack.Data.Stylesheets.Add(s.Id.ToString());
- }
- #endregion
-
- #region Install Documents
- var documentElement = rootElement.Descendants("DocumentSet").FirstOrDefault();
- if(documentElement != null)
- {
- var content = packagingService.ImportContent(documentElement, -1, currentUser.Id);
-
- var firstContentItem = content.First();
- insPack.Data.ContentNodeId = firstContentItem.Id.ToString(CultureInfo.InvariantCulture);
- }
- /*foreach (XmlElement n in _packageConfig.DocumentElement.SelectNodes("Documents/DocumentSet [@importMode = 'root']/*"))
- {
- Document.Import(-1, currentUser, n);
-
- //PPH todo log document install...
- }*/
- #endregion
-
- #region Install Actions
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@runat != 'uninstall']"))
- {
- try
- {
- PackageAction.RunPackageAction(packName, n.Attributes["alias"].Value, n);
- }
- catch { }
- }
-
- //saving the uninstall actions untill the package is uninstalled.
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Actions/Action [@undo != false()]"))
- {
- insPack.Data.Actions += n.OuterXml;
- }
- #endregion
-
- insPack.Save();
- }
///
/// Reads the configuration of the package from the configuration xmldocument
@@ -810,47 +552,72 @@ namespace umbraco.cms.businesslogic.packager
/// The folder to which the contents of the package is extracted
public void LoadConfig(string tempDir)
{
- _packageConfig = new XmlDocument();
- _packageConfig.Load(tempDir + Path.DirectorySeparatorChar + "package.xml");
+ Config = new XmlDocument();
+ Config.Load(tempDir + Path.DirectorySeparatorChar + "package.xml");
- _name = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/name").FirstChild.Value;
- _version = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/version").FirstChild.Value;
- _url = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/url").FirstChild.Value;
- _license = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").FirstChild.Value;
- _licenseUrl = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").Attributes.GetNamedItem("url").Value;
- _reqMajor = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/major").FirstChild.Value);
- _reqMinor = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/minor").FirstChild.Value);
- _reqPatch = int.Parse(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value);
- _authorName = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value;
- _authorUrl = _packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value;
+ Name = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/name").FirstChild.Value;
+ Version = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/version").FirstChild.Value;
+ Url = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/url").FirstChild.Value;
+ License = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").FirstChild.Value;
+ LicenseUrl = Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/license").Attributes.GetNamedItem("url").Value;
+ RequirementsMajor = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/major").FirstChild.Value);
+ RequirementsMinor = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/minor").FirstChild.Value);
+ RequirementsPatch = int.Parse(Config.DocumentElement.SelectSingleNode("/umbPackage/info/package/requirements/patch").FirstChild.Value);
+ Author = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/name").FirstChild.Value;
+ AuthorUrl = Config.DocumentElement.SelectSingleNode("/umbPackage/info/author/website").FirstChild.Value;
- string basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
+ var basePath = System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath;
+ var dllBinFiles = new List();
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//file"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("//file"))
{
- bool badFile = false;
- string destPath = GetFileName(basePath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
- string destFile = GetFileName(destPath, xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
+ var badFile = false;
+ var destPath = GetFileName(basePath, XmlHelper.GetNodeValue(n.SelectSingleNode("orgPath")));
+ var orgName = XmlHelper.GetNodeValue(n.SelectSingleNode("orgName"));
+ var destFile = GetFileName(destPath, orgName);
if (destPath.ToLower().Contains(IOHelper.DirSepChar + "app_code"))
+ {
badFile = true;
-
+ }
+
if (destPath.ToLower().Contains(IOHelper.DirSepChar + "bin"))
- badFile = true;
+ {
+ badFile = true;
+ }
if (destFile.ToLower().EndsWith(".dll"))
+ {
badFile = true;
+ dllBinFiles.Add(Path.Combine(tempDir, orgName));
+ }
if (badFile)
{
- _containUnsecureFiles = true;
- _unsecureFiles.Add(xmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
+ ContainsUnsecureFiles = true;
+ _unsecureFiles.Add(XmlHelper.GetNodeValue(n.SelectSingleNode("orgName")));
+ }
+ }
+
+ if (ContainsUnsecureFiles)
+ {
+ //Now we want to see if the DLLs contain any legacy data types since we want to warn people about that
+ string[] assemblyErrors;
+ var assembliesWithReferences = PackageBinaryInspector.ScanAssembliesForTypeReference(tempDir, out assemblyErrors).ToArray();
+ if (assemblyErrors.Any())
+ {
+ ContainsBinaryFileErrors = true;
+ BinaryFileErrors.AddRange(assemblyErrors);
+ }
+ if (assembliesWithReferences.Any())
+ {
+ ContainsLegacyPropertyEditors = true;
}
}
//this will check for existing macros with the same alias
//since we will not overwrite on import it's a good idea to inform the user what will be overwritten
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("//macro"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("//macro"))
{
var alias = n.SelectSingleNode("alias").InnerText;
if (!string.IsNullOrEmpty(alias))
@@ -858,14 +625,14 @@ namespace umbraco.cms.businesslogic.packager
try
{
var m = new Macro(alias);
- this._containsMacroConflict = true;
+ this.ContainsMacroConflict = true;
this._conflictingMacroAliases.Add(m.Name, alias);
}
catch (IndexOutOfRangeException) { } //thrown when the alias doesn't exist in the DB, ie - macro not there
}
}
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Templates/Template"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("Templates/Template"))
{
var alias = n.SelectSingleNode("Alias").InnerText;
if (!string.IsNullOrEmpty(alias))
@@ -873,13 +640,13 @@ namespace umbraco.cms.businesslogic.packager
var t = Template.GetByAlias(alias);
if (t != null)
{
- this._containsTemplateConflict = true;
+ this.ContainsTemplateConflicts = true;
this._conflictingTemplateAliases.Add(t.Text, alias);
}
}
}
- foreach (XmlNode n in _packageConfig.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
+ foreach (XmlNode n in Config.DocumentElement.SelectNodes("Stylesheets/Stylesheet"))
{
var alias = n.SelectSingleNode("Name").InnerText;
if (!string.IsNullOrEmpty(alias))
@@ -887,7 +654,7 @@ namespace umbraco.cms.businesslogic.packager
var s = StyleSheet.GetByName(alias);
if (s != null)
{
- this._containsStyleSheetConflict = true;
+ this.ContainsStyleSheeConflicts = true;
this._conflictingStyleSheetNames.Add(s.Text, alias);
}
}
@@ -895,13 +662,13 @@ namespace umbraco.cms.businesslogic.packager
try
{
- _readme = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
+ ReadMe = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/info/readme"));
}
catch { }
try
{
- _control = xmlHelper.GetNodeValue(_packageConfig.DocumentElement.SelectSingleNode("/umbPackage/control"));
+ Control = XmlHelper.GetNodeValue(Config.DocumentElement.SelectSingleNode("/umbPackage/control"));
}
catch { }
}
@@ -914,7 +681,7 @@ namespace umbraco.cms.businesslogic.packager
public string Fetch(Guid Package)
{
// Check for package directory
- if (!Directory.Exists(IOHelper.MapPath(SystemDirectories.Packages)))
+ if (Directory.Exists(IOHelper.MapPath(SystemDirectories.Packages)) == false)
Directory.CreateDirectory(IOHelper.MapPath(SystemDirectories.Packages));
var wc = new System.Net.WebClient();
@@ -927,24 +694,7 @@ namespace umbraco.cms.businesslogic.packager
}
#endregion
-
- #region Public Static Methods
-
- [Obsolete("This method is empty, so calling it will have no effect whatsoever.")]
- public static void updatePackageInfo(Guid Package, int VersionMajor, int VersionMinor, int VersionPatch, User User)
- {
- //Why does this even exist?
- }
-
- [Obsolete("Use ApplicationContext.Current.Services.PackagingService.ImportContentTypes instead")]
- public static void ImportDocumentType(XmlNode n, User u, bool ImportStructure)
- {
- var element = n.GetXElement();
- var contentTypes = ApplicationContext.Current.Services.PackagingService.ImportContentTypes(element, ImportStructure, u.Id);
- }
-
- #endregion
-
+
#region Private Methods
///
@@ -955,7 +705,7 @@ namespace umbraco.cms.businesslogic.packager
/// The path.
/// Name of the file.
/// The name of the file in the specified path.
- private static String GetFileName(String path, string fileName)
+ private static string GetFileName(string path, string fileName)
{
// virtual dir support
fileName = IOHelper.FindFile(fileName);
@@ -990,38 +740,29 @@ namespace umbraco.cms.businesslogic.packager
if (!fileNameStartsWithSlash)
// No double slash, just concatenate
return path + fileName;
- else
- // Double slash, exclude that of the file
- return path + fileName.Substring(1);
+ return path + fileName.Substring(1);
}
- else
- {
- if (fileNameStartsWithSlash)
- // Required slash specified, just concatenate
- return path + fileName;
- else
- // Required slash missing, add it
- return path + Path.DirectorySeparatorChar + fileName;
- }
- }
-
- private static int FindDataTypeDefinitionFromType(ref Guid dtId)
- {
- int dfId = 0;
- foreach (datatype.DataTypeDefinition df in datatype.DataTypeDefinition.GetAll())
- if (df.DataType.Id == dtId)
- {
- dfId = df.Id;
- break;
- }
- return dfId;
+ if (fileNameStartsWithSlash)
+ // Required slash specified, just concatenate
+ return path + fileName;
+ return path + Path.DirectorySeparatorChar + fileName;
}
private static string UnPack(string zipName)
{
// Unzip
- string tempDir = IOHelper.MapPath(SystemDirectories.Data) + Path.DirectorySeparatorChar + Guid.NewGuid().ToString();
- Directory.CreateDirectory(tempDir);
+
+ //the temp directory will be the package GUID - this keeps it consistent!
+ //the zipName is always the package Guid.umb
+
+ var packageFileName = Path.GetFileNameWithoutExtension(zipName);
+ var packageId = Guid.NewGuid();
+ Guid.TryParse(packageFileName, out packageId);
+
+ string tempDir = IOHelper.MapPath(SystemDirectories.Data) + Path.DirectorySeparatorChar + packageId.ToString();
+ //clear the directory if it exists
+ if (Directory.Exists(tempDir)) Directory.Delete(tempDir, true);
+ Directory.CreateDirectory(tempDir);
var s = new ZipInputStream(File.OpenRead(zipName));
@@ -1064,181 +805,4 @@ namespace umbraco.cms.businesslogic.packager
#endregion
}
-
- public class Package
- {
- protected static ISqlHelper SqlHelper
- {
- get { return Application.SqlHelper; }
- }
-
- public Package()
- {
- }
-
- ///
- /// Initialize package install status object by specifying the internal id of the installation.
- /// The id is specific to the local umbraco installation and cannot be used to identify the package in general.
- /// Use the Package(Guid) constructor to check whether a package has been installed
- ///
- /// The internal id.
- public Package(int Id)
- {
- initialize(Id);
- }
-
- public Package(Guid Id)
- {
- int installStatusId = SqlHelper.ExecuteScalar(
- "select id from umbracoInstalledPackages where package = @package and upgradeId = 0",
- SqlHelper.CreateParameter("@package", Id));
-
- if (installStatusId > 0)
- initialize(installStatusId);
- else
- throw new ArgumentException("Package with id '" + Id.ToString() + "' is not installed");
- }
-
- private void initialize(int id)
- {
-
- IRecordsReader dr =
- SqlHelper.ExecuteReader(
- "select id, uninstalled, upgradeId, installDate, userId, package, versionMajor, versionMinor, versionPatch from umbracoInstalledPackages where id = @id",
- SqlHelper.CreateParameter("@id", id));
-
- if (dr.Read())
- {
- Id = id;
- Uninstalled = dr.GetBoolean("uninstalled");
- UpgradeId = dr.GetInt("upgradeId");
- InstallDate = dr.GetDateTime("installDate");
- User = User.GetUser(dr.GetInt("userId"));
- PackageId = dr.GetGuid("package");
- VersionMajor = dr.GetInt("versionMajor");
- VersionMinor = dr.GetInt("versionMinor");
- VersionPatch = dr.GetInt("versionPatch");
- }
- dr.Close();
- }
-
- [MethodImpl(MethodImplOptions.Synchronized)]
- public void Save()
- {
-
- IParameter[] values = {
- SqlHelper.CreateParameter("@uninstalled", Uninstalled),
- SqlHelper.CreateParameter("@upgradeId", UpgradeId),
- SqlHelper.CreateParameter("@installDate", InstallDate),
- SqlHelper.CreateParameter("@userId", User.Id),
- SqlHelper.CreateParameter("@versionMajor", VersionMajor),
- SqlHelper.CreateParameter("@versionMinor", VersionMinor),
- SqlHelper.CreateParameter("@versionPatch", VersionPatch),
- SqlHelper.CreateParameter("@id", Id)
- };
-
- // check if package status exists
- if (Id == 0)
- {
- // The method is synchronized
- SqlHelper.ExecuteNonQuery("INSERT INTO umbracoInstalledPackages (uninstalled, upgradeId, installDate, userId, versionMajor, versionMinor, versionPatch) VALUES (@uninstalled, @upgradeId, @installDate, @userId, @versionMajor, @versionMinor, @versionPatch)", values);
- Id = SqlHelper.ExecuteScalar("SELECT MAX(id) FROM umbracoInstalledPackages");
- }
-
- SqlHelper.ExecuteNonQuery(
- "update umbracoInstalledPackages set " +
- "uninstalled = @uninstalled, " +
- "upgradeId = @upgradeId, " +
- "installDate = @installDate, " +
- "userId = @userId, " +
- "versionMajor = @versionMajor, " +
- "versionMinor = @versionMinor, " +
- "versionPatch = @versionPatch " +
- "where id = @id",
- values);
- }
-
- private bool _uninstalled;
-
- public bool Uninstalled
- {
- get { return _uninstalled; }
- set { _uninstalled = value; }
- }
-
-
- private User _user;
-
- public User User
- {
- get { return _user; }
- set { _user = value; }
- }
-
-
- private DateTime _installDate;
-
- public DateTime InstallDate
- {
- get { return _installDate; }
- set { _installDate = value; }
- }
-
-
- private int _id;
-
- public int Id
- {
- get { return _id; }
- set { _id = value; }
- }
-
-
- private int _upgradeId;
-
- public int UpgradeId
- {
- get { return _upgradeId; }
- set { _upgradeId = value; }
- }
-
-
- private Guid _packageId;
-
- public Guid PackageId
- {
- get { return _packageId; }
- set { _packageId = value; }
- }
-
-
- private int _versionPatch;
-
- public int VersionPatch
- {
- get { return _versionPatch; }
- set { _versionPatch = value; }
- }
-
-
- private int _versionMinor;
-
- public int VersionMinor
- {
- get { return _versionMinor; }
- set { _versionMinor = value; }
- }
-
-
- private int _versionMajor;
-
- public int VersionMajor
- {
- get { return _versionMajor; }
- set { _versionMajor = value; }
- }
-
-
-
- }
}
diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs
index 0bf1160b59..547c338ca6 100644
--- a/src/umbraco.cms/businesslogic/web/Document.cs
+++ b/src/umbraco.cms/businesslogic/web/Document.cs
@@ -323,9 +323,6 @@ namespace umbraco.cms.businesslogic.web
// Log
LogHelper.Info(string.Format("New document {0}", d.Id));
- // Run Handler
- BusinessLogic.Actions.Action.RunActionHandlers(d, ActionNew.Instance);
-
// Save doc
d.Save();
@@ -761,9 +758,7 @@ namespace umbraco.cms.businesslogic.web
FireBeforeSendToPublish(e);
if (!e.Cancel)
{
- BusinessLogic.Log.Add(BusinessLogic.LogTypes.SendToPublish, u, this.Id, "");
-
- BusinessLogic.Actions.Action.RunActionHandlers(this, ActionToPublish.Instance);
+ Log.Add(LogTypes.SendToPublish, u, this.Id, "");
FireAfterSendToPublish(e);
return true;
@@ -1161,8 +1156,6 @@ namespace umbraco.cms.businesslogic.web
var content = ApplicationContext.Current.Services.ContentService.Copy(Content, CopyTo, RelateToOrignal, u.Id);
newDoc = new Document(content);
- // Have to run the ActionNew handler to do umbEnsureUniqueName (for example)
- BusinessLogic.Actions.Action.RunActionHandlers(newDoc, ActionNew.Instance);
// Then save to preserve any changes made by action handlers
newDoc.Save();
@@ -1578,7 +1571,6 @@ namespace umbraco.cms.businesslogic.web
if (!e.Cancel)
{
- umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance);
if (Content != null)
{
ApplicationContext.Current.Services.ContentService.Delete(Content);
@@ -1609,7 +1601,6 @@ namespace umbraco.cms.businesslogic.web
if (!e.Cancel)
{
- umbraco.BusinessLogic.Actions.Action.RunActionHandlers(this, ActionDelete.Instance);
UnPublish();
if (Content != null)
{
diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj
index 502acdff59..8ffb190744 100644
--- a/src/umbraco.cms/umbraco.cms.csproj
+++ b/src/umbraco.cms/umbraco.cms.csproj
@@ -207,7 +207,6 @@
Code
-