Merge with 6.0.1

This commit is contained in:
Shannon Deminick
2013-02-01 06:52:27 +06:00
62 changed files with 1585 additions and 247 deletions

View File

@@ -201,6 +201,7 @@ namespace Umbraco.Core.Configuration
}
}
/// <summary>
/// Saves a setting into the configuration file.
/// </summary>

View File

@@ -0,0 +1,190 @@
using System.Configuration;
namespace Umbraco.Core.Configuration.InfrastructureSettings
{
public class Infrastructure : ConfigurationSection
{
private const string InfrastructureSectionName = "umbraco/infrastructure";
public static Infrastructure Instance
{
get { return (Infrastructure) ConfigurationManager.GetSection(InfrastructureSectionName); }
}
#region RepositoriesSection Property
internal const string RepositoriesPropertyName = "repositories";
[ConfigurationProperty(RepositoriesPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
public Repositories Repositories
{
get { return ((Repositories)base[RepositoriesPropertyName]); }
set { base[RepositoriesPropertyName] = value; }
}
#endregion
#region PublishingStrategy Property
internal const string PublishingStrategyPropertyName = "publishingStrategy";
[ConfigurationProperty(PublishingStrategyPropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
public PublishingProvider PublishingStrategy
{
get { return ((PublishingProvider)base[PublishingStrategyPropertyName]); }
set { base[PublishingStrategyPropertyName] = value; }
}
#endregion
}
public class Repositories : ConfigurationElement
{
[ConfigurationProperty("", IsDefaultCollection = true, IsRequired = true)]
public RepositoryElementCollection Repository
{
get { return ((RepositoryElementCollection)(base[""])); }
}
}
[ConfigurationCollection(typeof(Repository), CollectionType = ConfigurationElementCollectionType.BasicMapAlternate, AddItemName = RepositoryPropertyName)]
public class RepositoryElementCollection : ConfigurationElementCollection
{
internal const string RepositoryPropertyName = "repository";
public override ConfigurationElementCollectionType CollectionType
{
get
{
return ConfigurationElementCollectionType.BasicMapAlternate;
}
}
protected override string ElementName
{
get
{
return RepositoryPropertyName;
}
}
protected override bool IsElementName(string elementName)
{
return elementName == RepositoryPropertyName;
}
protected override object GetElementKey(ConfigurationElement element)
{
return ((Repository)element).InterfaceShortTypeName;
}
protected override ConfigurationElement CreateNewElement()
{
return new Repository();
}
#region Indexer
public Repository this[int index]
{
get { return (Repository)base.BaseGet(index); }
}
public Repository this[string interfaceShortTypeName]
{
get { return (Repository)base.BaseGet(interfaceShortTypeName); }
}
#endregion
#region Add
public void Add(Repository repository)
{
BaseAdd(repository);
}
#endregion
#region Remove
public void Remove(Repository repository)
{
BaseRemove(repository);
}
#endregion
#region GetItem
public Repository GetItemAt(int index)
{
return (Repository)BaseGet(index);
}
public Repository GetItemByKey(string interfaceShortTypeName)
{
return (Repository)BaseGet(interfaceShortTypeName);
}
#endregion
public bool ContainsKey(string interfaceShortName)
{
bool result = false;
object[] keys = this.BaseGetAllKeys();
foreach (object key in keys)
{
if ((string)key == interfaceShortName)
{
result = true;
break;
}
}
return result;
}
}
public class Repository : ConfigurationElement
{
internal const string InterfaceShortTypeNamePropertyName = "interfaceShortTypeName";
[ConfigurationPropertyAttribute(InterfaceShortTypeNamePropertyName, IsRequired = true, IsKey = true, IsDefaultCollection = false)]
public string InterfaceShortTypeName
{
get { return (string) base[InterfaceShortTypeNamePropertyName]; }
set { base[InterfaceShortTypeNamePropertyName] = value; }
}
internal const string RepositoryFullTypeNamePropertyName = "repositoryFullTypeName";
[ConfigurationPropertyAttribute(RepositoryFullTypeNamePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
public string RepositoryFullTypeName
{
get { return (string)base[RepositoryFullTypeNamePropertyName]; }
set { base[RepositoryFullTypeNamePropertyName] = value; }
}
internal const string CacheProviderFullTypeNamePropertyName = "cacheProviderFullTypeName";
[ConfigurationPropertyAttribute(CacheProviderFullTypeNamePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
public string CacheProviderFullTypeName
{
get { return (string)base[CacheProviderFullTypeNamePropertyName]; }
set { base[CacheProviderFullTypeNamePropertyName] = value; }
}
}
public class PublishingProvider : ConfigurationElement
{
internal const string TypePropertyName = "type";
[ConfigurationPropertyAttribute(TypePropertyName, IsRequired = true, IsKey = false, IsDefaultCollection = false)]
public string Type
{
get { return (string)base[TypePropertyName]; }
set { base[TypePropertyName] = value; }
}
}
}

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration
/// Gets the version comment (like beta or RC).
/// </summary>
/// <value>The version comment.</value>
public static string CurrentComment { get { return "RC"; } }
public static string CurrentComment { get { return ""; } }
// Get the version of the umbraco.dll by looking at a class in that dll
// Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx

View File

@@ -0,0 +1,34 @@
using System;
using System.Threading;
using Umbraco.Core.Configuration;
namespace Umbraco.Core.Persistence
{
/// <summary>
/// Provides access to the PetaPoco database as Singleton, so the database is created once in app lifecycle.
/// This is necessary for transactions to work properly
/// </summary>
public sealed class DatabaseFactory
{
#region Singleton
private static readonly Database _database = new Database(GlobalSettings.DbDsn);
private static readonly Lazy<DatabaseFactory> lazy = new Lazy<DatabaseFactory>(() => new DatabaseFactory());
public static DatabaseFactory Current { get { return lazy.Value; } }
private DatabaseFactory()
{
}
#endregion
/// <summary>
/// Returns an instance of the PetaPoco database
/// </summary>
public Database Database
{
get { return _database; }
}
}
}

View File

@@ -78,7 +78,9 @@ namespace Umbraco.Core.Persistence.Factories
}
else if (property.DataTypeDatabaseType == DataTypeDatabaseType.Date && property.Value != null && string.IsNullOrWhiteSpace(property.Value.ToString()) == false)
{
dto.Date = DateTime.Parse(property.Value.ToString());
DateTime date;
if(DateTime.TryParse(property.Value.ToString(), out date))
dto.Date = date;
}
else if (property.DataTypeDatabaseType == DataTypeDatabaseType.Ntext && property.Value != null)
{

View File

@@ -0,0 +1,86 @@
using System;
using System.Reflection;
using Umbraco.Core.Models;
namespace Umbraco.Core.Persistence.Mappers
{
internal class ModelDtoMapper : IMapper
{
public void GetTableInfo(Type t, TableInfo ti)
{ }
public bool MapPropertyToColumn(PropertyInfo pi, ref string columnName, ref bool resultColumn)
{
if (pi.DeclaringType == typeof(Content) || pi.DeclaringType == typeof(IContent))
{
switch (pi.Name)
{
case "Trashed":
columnName = "[umbracoNode].[trashed]";
return true;
case "ParentId":
columnName = "[umbracoNode].[parentID]";
return true;
case "UserId":
columnName = "[umbracoNode].[nodeUser]";
return true;
case "Level":
columnName = "[umbracoNode].[level]";
return true;
case "Path":
columnName = "[umbracoNode].[path]";
return true;
case "SortOrder":
columnName = "[umbracoNode].[sortOrder]";
return true;
case "NodeId":
columnName = "[umbracoNode].[id]";
return true;
case "Published":
columnName = "[cmsDocument].[published]";
return true;
case "Key":
columnName = "[umbracoNode].[uniqueID]";
return true;
case "CreateDate":
columnName = "[umbracoNode].[createDate]";
return true;
case "Name":
columnName = "[umbracoNode].[text]";
return true;
}
}
if (pi.DeclaringType == typeof(ContentType) || pi.DeclaringType == typeof(IContentType))
{
switch (pi.Name)
{
case "Alias":
columnName = "[cmsContentType].[alias]";
return true;
case "Icon":
columnName = "[cmsContentType].[icon]";
return true;
case "Thumbnail":
columnName = "[cmsContentType].[thumbnail]";
return true;
case "Description":
columnName = "[cmsContentType].[description]";
return true;
}
}
return true;
}
public Func<object, object> GetFromDbConverter(PropertyInfo pi, Type sourceType)
{
return null;
}
public Func<object, object> GetToDbConverter(Type sourceType)
{
return null;
}
}
}

View File

@@ -43,7 +43,7 @@ namespace Umbraco.Core.Persistence.Migrations
/// <returns><c>True</c> if migrations were applied, otherwise <c>False</c></returns>
public bool Execute(Database database, DatabaseProviders databaseProvider, bool isUpgrade = true)
{
LogHelper.Info<MigrationRunner>("Initializing database migration");
LogHelper.Info<MigrationRunner>("Initializing database migrations");
var foundMigrations = MigrationResolver.Current.Migrations;
@@ -61,10 +61,12 @@ namespace Umbraco.Core.Persistence.Migrations
if (isUpgrade)
{
migration.GetUpExpressions(context);
LogHelper.Info<MigrationRunner>(string.Format("Added UPGRADE migration '{0}' to context", migration.GetType().Name));
}
else
{
migration.GetDownExpressions(context);
LogHelper.Info<MigrationRunner>(string.Format("Added DOWNGRADE migration '{0}' to context", migration.GetType().Name));
}
}

View File

@@ -0,0 +1,572 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Umbraco.Core.Persistence.Mappers;
namespace Umbraco.Core.Persistence.Querying
{
internal class ExpressionHelper<T>
{
private string selectExpression = string.Empty;
private string whereExpression;
private string groupBy = string.Empty;
private string havingExpression;
private string orderBy = string.Empty;
IList<string> updateFields = new List<string>();
IList<string> insertFields = new List<string>();
private string sep = string.Empty;
private bool useFieldName = false;
private Database.PocoData pd;
public ExpressionHelper()
{
Database.Mapper = new ModelDtoMapper();
pd = new Database.PocoData(typeof(T));
}
protected internal virtual string Visit(Expression exp)
{
if (exp == null) return string.Empty;
switch (exp.NodeType)
{
case ExpressionType.Lambda:
return VisitLambda(exp as LambdaExpression);
case ExpressionType.MemberAccess:
return VisitMemberAccess(exp as MemberExpression);
case ExpressionType.Constant:
return VisitConstant(exp as ConstantExpression);
case ExpressionType.Add:
case ExpressionType.AddChecked:
case ExpressionType.Subtract:
case ExpressionType.SubtractChecked:
case ExpressionType.Multiply:
case ExpressionType.MultiplyChecked:
case ExpressionType.Divide:
case ExpressionType.Modulo:
case ExpressionType.And:
case ExpressionType.AndAlso:
case ExpressionType.Or:
case ExpressionType.OrElse:
case ExpressionType.LessThan:
case ExpressionType.LessThanOrEqual:
case ExpressionType.GreaterThan:
case ExpressionType.GreaterThanOrEqual:
case ExpressionType.Equal:
case ExpressionType.NotEqual:
case ExpressionType.Coalesce:
case ExpressionType.ArrayIndex:
case ExpressionType.RightShift:
case ExpressionType.LeftShift:
case ExpressionType.ExclusiveOr:
return "(" + VisitBinary(exp as BinaryExpression) + ")";
case ExpressionType.Negate:
case ExpressionType.NegateChecked:
case ExpressionType.Not:
case ExpressionType.Convert:
case ExpressionType.ConvertChecked:
case ExpressionType.ArrayLength:
case ExpressionType.Quote:
case ExpressionType.TypeAs:
return VisitUnary(exp as UnaryExpression);
case ExpressionType.Parameter:
return VisitParameter(exp as ParameterExpression);
case ExpressionType.Call:
return VisitMethodCall(exp as MethodCallExpression);
case ExpressionType.New:
return VisitNew(exp as NewExpression);
case ExpressionType.NewArrayInit:
case ExpressionType.NewArrayBounds:
return VisitNewArray(exp as NewArrayExpression);
default:
return exp.ToString();
}
}
protected virtual string VisitLambda(LambdaExpression lambda)
{
if (lambda.Body.NodeType == ExpressionType.MemberAccess && sep == " ")
{
MemberExpression m = lambda.Body as MemberExpression;
if (m.Expression != null)
{
string r = VisitMemberAccess(m);
return string.Format("{0}={1}", r, GetQuotedTrueValue());
}
}
return Visit(lambda.Body);
}
protected virtual string VisitBinary(BinaryExpression b)
{
string left, right;
var operand = BindOperant(b.NodeType); //sep= " " ??
if (operand == "AND" || operand == "OR")
{
MemberExpression m = b.Left as MemberExpression;
if (m != null && m.Expression != null)
{
string r = VisitMemberAccess(m);
left = string.Format("{0}={1}", r, GetQuotedTrueValue());
}
else
{
left = Visit(b.Left);
}
m = b.Right as MemberExpression;
if (m != null && m.Expression != null)
{
string r = VisitMemberAccess(m);
right = string.Format("{0}={1}", r, GetQuotedTrueValue());
}
else
{
right = Visit(b.Right);
}
}
else
{
left = Visit(b.Left);
right = Visit(b.Right);
}
if (operand == "=" && right == "null") operand = "is";
else if (operand == "<>" && right == "null") operand = "is not";
else if (operand == "=" || operand == "<>")
{
if (IsTrueExpression(right)) right = GetQuotedTrueValue();
else if (IsFalseExpression(right)) right = GetQuotedFalseValue();
if (IsTrueExpression(left)) left = GetQuotedTrueValue();
else if (IsFalseExpression(left)) left = GetQuotedFalseValue();
}
switch (operand)
{
case "MOD":
case "COALESCE":
return string.Format("{0}({1},{2})", operand, left, right);
default:
return left + sep + operand + sep + right;
}
}
protected virtual string VisitMemberAccess(MemberExpression m)
{
if (m.Expression != null &&
m.Expression.NodeType == ExpressionType.Parameter
&& m.Expression.Type == typeof(T))
{
string field = GetFieldName(pd, m.Member.Name);
return field;
}
if (m.Expression != null && m.Expression.NodeType != ExpressionType.Constant)
{
Database.Mapper = new ModelDtoMapper();
var def = new Database.PocoData(m.Expression.Type);
string field = GetFieldName(def, m.Member.Name);
return field;
}
var member = Expression.Convert(m, typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
var getter = lambda.Compile();
object o = getter();
return GetQuotedValue(o, o != null ? o.GetType() : null);
}
protected virtual string VisitNew(NewExpression nex)
{
// TODO : check !
var member = Expression.Convert(nex, typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
try
{
var getter = lambda.Compile();
object o = getter();
return GetQuotedValue(o, o.GetType());
}
catch (System.InvalidOperationException)
{ // FieldName ?
List<Object> exprs = VisitExpressionList(nex.Arguments);
var r = new StringBuilder();
foreach (Object e in exprs)
{
r.AppendFormat("{0}{1}",
r.Length > 0 ? "," : "",
e);
}
return r.ToString();
}
}
protected virtual string VisitParameter(ParameterExpression p)
{
return p.Name;
}
protected virtual string VisitConstant(ConstantExpression c)
{
if (c.Value == null)
return "null";
else if (c.Value.GetType() == typeof(bool))
{
object o = GetQuotedValue(c.Value, c.Value.GetType());
return string.Format("({0}={1})", GetQuotedTrueValue(), o);
}
else
return GetQuotedValue(c.Value, c.Value.GetType());
}
protected virtual string VisitUnary(UnaryExpression u)
{
switch (u.NodeType)
{
case ExpressionType.Not:
string o = Visit(u.Operand);
if (IsFieldName(o)) o = o + "=" + GetQuotedValue(true, typeof(bool));
return "NOT (" + o + ")";
default:
return Visit(u.Operand);
}
}
protected virtual string VisitMethodCall(MethodCallExpression m)
{
List<Object> args = this.VisitExpressionList(m.Arguments);
Object r;
if (m.Object != null)
r = Visit(m.Object);
else
{
r = args[0];
args.RemoveAt(0);
}
switch (m.Method.Name)
{
case "ToUpper":
return string.Format("upper({0})", r);
case "ToLower":
return string.Format("lower({0})", r);
case "StartsWith":
return string.Format("upper({0}) starting with {1} ", r, args[0].ToString().ToUpper());
case "EndsWith":
return string.Format("upper({0}) like '%{1}'", r, RemoveQuote(args[0].ToString()).ToUpper());
case "Contains":
return string.Format("upper({0}) like '%{1}%'", r, RemoveQuote(args[0].ToString()).ToUpper());
case "Substring":
var startIndex = Int32.Parse(args[0].ToString()) + 1;
if (args.Count == 2)
{
var length = Int32.Parse(args[1].ToString());
return string.Format("substring({0} from {1} for {2})",
r,
startIndex,
length);
}
else
return string.Format("substring({0} from {1})",
r,
startIndex);
case "Round":
case "Floor":
case "Ceiling":
case "Coalesce":
case "Abs":
case "Sum":
return string.Format("{0}({1}{2})",
m.Method.Name,
r,
args.Count == 1 ? string.Format(",{0}", args[0]) : "");
case "Concat":
var s = new StringBuilder();
foreach (Object e in args)
{
s.AppendFormat(" || {0}", e);
}
return string.Format("{0}{1}", r, s.ToString());
case "In":
var member = Expression.Convert(m.Arguments[1], typeof(object));
var lambda = Expression.Lambda<Func<object>>(member);
var getter = lambda.Compile();
var inArgs = getter() as object[];
var sIn = new StringBuilder();
foreach (Object e in inArgs)
{
if (e.GetType().ToString() != "System.Collections.Generic.List`1[System.Object]")
{
sIn.AppendFormat("{0}{1}",
sIn.Length > 0 ? "," : "",
GetQuotedValue(e, e.GetType()));
}
else
{
var listArgs = e as IList<Object>;
foreach (Object el in listArgs)
{
sIn.AppendFormat("{0}{1}",
sIn.Length > 0 ? "," : "",
GetQuotedValue(el, el.GetType()));
}
}
}
return string.Format("{0} {1} ({2})", r, m.Method.Name, sIn.ToString());
case "Desc":
return string.Format("{0} DESC", r);
case "Alias":
case "As":
return string.Format("{0} As {1}", r,
GetQuotedColumnName(RemoveQuoteFromAlias(RemoveQuote(args[0].ToString()))));
case "ToString":
return r.ToString();
default:
var s2 = new StringBuilder();
foreach (Object e in args)
{
s2.AppendFormat(",{0}", GetQuotedValue(e, e.GetType()));
}
return string.Format("{0}({1}{2})", m.Method.Name, r, s2.ToString());
}
}
protected virtual List<Object> VisitExpressionList(ReadOnlyCollection<Expression> original)
{
var list = new List<Object>();
for (int i = 0, n = original.Count; i < n; i++)
{
if (original[i].NodeType == ExpressionType.NewArrayInit ||
original[i].NodeType == ExpressionType.NewArrayBounds)
{
list.AddRange(VisitNewArrayFromExpressionList(original[i] as NewArrayExpression));
}
else
list.Add(Visit(original[i]));
}
return list;
}
protected virtual string VisitNewArray(NewArrayExpression na)
{
List<Object> exprs = VisitExpressionList(na.Expressions);
var r = new StringBuilder();
foreach (Object e in exprs)
{
r.Append(r.Length > 0 ? "," + e : e);
}
return r.ToString();
}
protected virtual List<Object> VisitNewArrayFromExpressionList(NewArrayExpression na)
{
List<Object> exprs = VisitExpressionList(na.Expressions);
return exprs;
}
protected virtual string BindOperant(ExpressionType e)
{
switch (e)
{
case ExpressionType.Equal:
return "=";
case ExpressionType.NotEqual:
return "<>";
case ExpressionType.GreaterThan:
return ">";
case ExpressionType.GreaterThanOrEqual:
return ">=";
case ExpressionType.LessThan:
return "<";
case ExpressionType.LessThanOrEqual:
return "<=";
case ExpressionType.AndAlso:
return "AND";
case ExpressionType.OrElse:
return "OR";
case ExpressionType.Add:
return "+";
case ExpressionType.Subtract:
return "-";
case ExpressionType.Multiply:
return "*";
case ExpressionType.Divide:
return "/";
case ExpressionType.Modulo:
return "MOD";
case ExpressionType.Coalesce:
return "COALESCE";
default:
return e.ToString();
}
}
public virtual string GetQuotedTableName(string tableName)
{
return string.Format("\"{0}\"", tableName);
}
public virtual string GetQuotedColumnName(string columnName)
{
return string.Format("\"{0}\"", columnName);
}
public virtual string GetQuotedName(string name)
{
return string.Format("\"{0}\"", name);
}
private string GetQuotedTrueValue()
{
return GetQuotedValue(true, typeof(bool));
}
private string GetQuotedFalseValue()
{
return GetQuotedValue(false, typeof(bool));
}
public virtual string GetQuotedValue(object value, Type fieldType)
{
if (value == null) return "NULL";
if (!fieldType.UnderlyingSystemType.IsValueType && fieldType != typeof(string))
{
//if (TypeSerializer.CanCreateFromString(fieldType))
//{
// return "'" + EscapeParam(TypeSerializer.SerializeToString(value)) + "'";
//}
throw new NotSupportedException(
string.Format("Property of type: {0} is not supported", fieldType.FullName));
}
if (fieldType == typeof(int))
return ((int)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(float))
return ((float)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(double))
return ((double)value).ToString(CultureInfo.InvariantCulture);
if (fieldType == typeof(decimal))
return ((decimal)value).ToString(CultureInfo.InvariantCulture);
return ShouldQuoteValue(fieldType)
? "'" + EscapeParam(value) + "'"
: value.ToString();
}
public virtual string EscapeParam(object paramValue)
{
return paramValue.ToString().Replace("'", "''");
}
public virtual bool ShouldQuoteValue(Type fieldType)
{
return true;
}
protected virtual string GetFieldName(Database.PocoData pocoData, string name)
{
var column = pocoData.Columns.FirstOrDefault(x => x.Value.PropertyInfo.Name == name);
return column.Value.ColumnName;
}
protected virtual string GetFieldName(string name)
{
if (useFieldName)
{
//FieldDefinition fd = modelDef.FieldDefinitions.FirstOrDefault(x => x.Name == name);
//string fn = fd != default(FieldDefinition) ? fd.FieldName : name;
//return OrmLiteConfig.DialectProvider.GetQuotedColumnName(fn);
return "[" + name + "]";
}
else
{
return name;
}
}
protected string RemoveQuote(string exp)
{
if (exp.StartsWith("'") && exp.EndsWith("'"))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
protected string RemoveQuoteFromAlias(string exp)
{
if ((exp.StartsWith("\"") || exp.StartsWith("`") || exp.StartsWith("'"))
&&
(exp.EndsWith("\"") || exp.EndsWith("`") || exp.EndsWith("'")))
{
exp = exp.Remove(0, 1);
exp = exp.Remove(exp.Length - 1, 1);
}
return exp;
}
private string GetTrueExpression()
{
object o = GetQuotedTrueValue();
return string.Format("({0}={1})", o, o);
}
private string GetFalseExpression()
{
return string.Format("({0}={1})",
GetQuotedTrueValue(),
GetQuotedFalseValue());
}
private bool IsTrueExpression(string exp)
{
return (exp == GetTrueExpression());
}
private bool IsFalseExpression(string exp)
{
return (exp == GetFalseExpression());
}
protected bool IsFieldName(string quotedExp)
{
return true;
}
}
}

View File

@@ -42,6 +42,7 @@ namespace Umbraco.Core.Persistence.Repositories
{
var sql = GetBaseQuery(false)
.Where(GetBaseWhereClause(), new { Id = id })
.Where<DocumentDto>(x => x.Newest)
.OrderByDescending<ContentVersionDto>(x => x.VersionDate);
var dto = Database.Fetch<DocumentDto, ContentVersionDto, ContentDto, NodeDto>(sql).FirstOrDefault();
@@ -49,21 +50,8 @@ namespace Umbraco.Core.Persistence.Repositories
if (dto == null)
return null;
//Get the ContentType that this Content is based on
var contentType = _contentTypeRepository.Get(dto.ContentVersionDto.ContentDto.ContentTypeId);
var content = CreateContentFromDto(dto, dto.ContentVersionDto.VersionId);
var factory = new ContentFactory(contentType, NodeObjectTypeId, id);
var content = factory.BuildEntity(dto);
//Check if template id is set on DocumentDto, and get ITemplate if it is.
if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0)
{
content.Template = _templateRepository.Get(dto.TemplateId.Value);
}
content.Properties = GetPropertyCollection(id, dto.ContentVersionDto.VersionId, contentType);
((ICanBeDirty)content).ResetDirtyProperties();
return content;
}
@@ -167,15 +155,9 @@ namespace Umbraco.Core.Persistence.Repositories
if (dto == null)
return null;
var content = CreateContentFromDto(dto, versionId);
var contentType = _contentTypeRepository.Get(dto.ContentVersionDto.ContentDto.ContentTypeId);
var factory = new ContentFactory(contentType, NodeObjectTypeId, dto.NodeId);
var content = factory.BuildEntity(dto);
content.Properties = GetPropertyCollection(dto.NodeId, versionId, contentType);
((ICanBeDirty)content).ResetDirtyProperties();
return content;
}
@@ -430,6 +412,31 @@ namespace Umbraco.Core.Persistence.Repositories
#endregion
/// <summary>
/// Private method to create a content object from a DocumentDto, which is used by Get and GetByVersion.
/// </summary>
/// <param name="dto"></param>
/// <param name="versionId"></param>
/// <returns></returns>
private IContent CreateContentFromDto(DocumentDto dto, Guid versionId)
{
var contentType = _contentTypeRepository.Get(dto.ContentVersionDto.ContentDto.ContentTypeId);
var factory = new ContentFactory(contentType, NodeObjectTypeId, dto.NodeId);
var content = factory.BuildEntity(dto);
//Check if template id is set on DocumentDto, and get ITemplate if it is.
if (dto.TemplateId.HasValue && dto.TemplateId.Value > 0)
{
content.Template = _templateRepository.Get(dto.TemplateId.Value);
}
content.Properties = GetPropertyCollection(dto.NodeId, versionId, contentType);
((ICanBeDirty)content).ResetDirtyProperties();
return content;
}
private PropertyCollection GetPropertyCollection(int id, Guid versionId, IContentType contentType)
{
var sql = new Sql();

View File

@@ -1054,6 +1054,22 @@ namespace Umbraco.Core.Services
return SaveAndPublishDo(content, omitCacheRefresh, userId, raiseEvents);
}
/// <summary>
/// Gets a collection of <see cref="IContent"/> descendants by the first Parent.
/// </summary>
/// <param name="content"><see cref="IContent"/> item to retrieve Descendants from</param>
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
internal IEnumerable<IContent> GetPublishedDescendants(IContent content)
{
using (var repository = _repositoryFactory.CreateContentRepository(_uowProvider.GetUnitOfWork()))
{
var query = Query<IContent>.Builder.Where(x => x.Id != content.Id && x.Path.StartsWith(content.Path) && x.Published == true && x.Trashed == false);
var contents = repository.GetByQuery(query);
return contents;
}
}
#endregion
#region Private Methods
@@ -1243,6 +1259,9 @@ namespace Umbraco.Core.Services
return false;
}
//Has this content item previously been published? If so, we don't need to refresh the children
var previouslyPublished = HasPublishedVersion(content.Id);
//Check if parent is published (although not if its a root node) - if parent isn't published this Content cannot be published
if (content.ParentId != -1 && content.ParentId != -20 && IsPublishable(content) == false)
{
@@ -1279,11 +1298,35 @@ namespace Umbraco.Core.Services
if (published)
{
var xml = content.ToXml();
var poco = new ContentXmlDto { NodeId = content.Id, Xml = xml.ToString(SaveOptions.None) };
var exists = uow.Database.FirstOrDefault<ContentXmlDto>("WHERE nodeId = @Id", new { Id = content.Id }) != null;
int result = exists
? uow.Database.Update(poco)
: Convert.ToInt32(uow.Database.Insert(poco));
//Content Xml
var contentPoco = new ContentXmlDto { NodeId = content.Id, Xml = xml.ToString(SaveOptions.None) };
var contentExists = uow.Database.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsContentXml WHERE nodeId = @Id", new { Id = content.Id }) != 0;
int contentResult = contentExists
? uow.Database.Update(contentPoco)
: Convert.ToInt32(uow.Database.Insert(contentPoco));
//Preview Xml
var previewPoco = new PreviewXmlDto
{
NodeId = content.Id,
Timestamp = DateTime.Now,
VersionId = content.Version,
Xml = xml.ToString(SaveOptions.None)
};
var previewExists =
uow.Database.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsPreviewXml WHERE nodeId = @Id AND versionId = @Version",
new {Id = content.Id, Version = content.Version}) != 0;
int previewResult = previewExists
? uow.Database.Update<PreviewXmlDto>(
"SET xml = @Xml, timestamp = @Timestamp WHERE nodeId = @Id AND versionId = @Version",
new
{
Xml = previewPoco.Xml,
Timestamp = previewPoco.Timestamp,
Id = previewPoco.NodeId,
Version = previewPoco.VersionId
})
: Convert.ToInt32(uow.Database.Insert(previewPoco));
}
}
@@ -1294,13 +1337,12 @@ namespace Umbraco.Core.Services
if (omitCacheRefresh == false)
_publishingStrategy.PublishingFinalized(content);
//We need to check if children and their publish state to ensure that we republish content that was previously published
if (omitCacheRefresh == false && HasChildren(content.Id))
//We need to check if children and their publish state to ensure that we 'republish' content that was previously published
if (omitCacheRefresh == false && previouslyPublished == false && HasChildren(content.Id))
{
var children = GetDescendants(content);
var shouldBeRepublished = children.Where(child => HasPublishedVersion(child.Id));
var descendants = GetPublishedDescendants(content);
_publishingStrategy.PublishingFinalized(shouldBeRepublished, false);
_publishingStrategy.PublishingFinalized(descendants, false);
}
Audit.Add(AuditTypes.Publish, "Save and Publish performed by user", userId, content.Id);
@@ -1334,6 +1376,30 @@ namespace Umbraco.Core.Services
repository.AddOrUpdate(content);
uow.Commit();
//Preview Xml
var xml = content.ToXml();
var previewPoco = new PreviewXmlDto
{
NodeId = content.Id,
Timestamp = DateTime.Now,
VersionId = content.Version,
Xml = xml.ToString(SaveOptions.None)
};
var previewExists =
uow.Database.ExecuteScalar<int>("SELECT COUNT(nodeId) FROM cmsPreviewXml WHERE nodeId = @Id AND versionId = @Version",
new { Id = content.Id, Version = content.Version }) != 0;
int previewResult = previewExists
? uow.Database.Update<PreviewXmlDto>(
"SET xml = @Xml, timestamp = @Timestamp WHERE nodeId = @Id AND versionId = @Version",
new
{
Xml = previewPoco.Xml,
Timestamp = previewPoco.Timestamp,
Id = previewPoco.NodeId,
Version = previewPoco.VersionId
})
: Convert.ToInt32(uow.Database.Insert(previewPoco));
}
if(raiseEvents)

View File

@@ -0,0 +1,32 @@
using System.Configuration;
using NUnit.Framework;
using Umbraco.Core.Configuration.InfrastructureSettings;
namespace Umbraco.Tests.Configurations
{
[TestFixture]
public class RepositorySettingsTests
{
[Test]
public void Can_Get_Repository_From_Config()
{
Infrastructure infrastructure = Infrastructure.Instance;
Repositories repositories = infrastructure.Repositories;
Repository repository = repositories.Repository["IContentRepository"];
Assert.That(repository, Is.Not.Null);
Assert.AreEqual(repository.InterfaceShortTypeName, "IContentRepository");
Assert.AreEqual(repository.RepositoryFullTypeName, "Umbraco.Core.Persistence.Repositories.ContentRepository, Umbraco.Core");
Assert.AreEqual(repository.CacheProviderFullTypeName, "Umbraco.Core.Persistence.Caching.RuntimeCacheProvider, Umbraco.Core");
}
[Test]
public void Can_Get_PublishingStrategy_From_Config()
{
Infrastructure infrastructure = Infrastructure.Instance;
PublishingProvider strategy = infrastructure.PublishingStrategy;
Assert.That(strategy.Type, Is.EqualTo("Umbraco.Web.Publishing.PublishingStrategy, Umbraco.Web"));
}
}
}

View File

@@ -0,0 +1,18 @@
using NUnit.Framework;
using Umbraco.Core.Persistence;
namespace Umbraco.Tests.Persistence
{
[TestFixture]
public class DatabaseFactoryTests
{
[Test]
public void Can_Verify_Single_Database_Instance()
{
var db1 = DatabaseFactory.Current.Database;
var db2 = DatabaseFactory.Current.Database;
Assert.AreSame(db1, db2);
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Rdbms;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Querying;
using Umbraco.Tests.TestHelpers;
@@ -78,5 +79,35 @@ namespace Umbraco.Tests.Persistence.Querying
Assert.That(strResult, Is.EqualTo(expectedResult));
Console.WriteLine(strResult);
}
[Test]
public void Can_Build_PublishedDescendants_Query_For_IContent()
{
// Arrange
var path = "-1,1046,1076,1089";
var id = 1046;
var nodeObjectTypeId = new Guid("C66BA18E-EAF3-4CFF-8A22-41B16D66A972");
var sql = new Sql();
sql.Select("*")
.From<DocumentDto>()
.InnerJoin<ContentVersionDto>()
.On<DocumentDto, ContentVersionDto>(left => left.VersionId, right => right.VersionId)
.InnerJoin<ContentDto>()
.On<ContentVersionDto, ContentDto>(left => left.NodeId, right => right.NodeId)
.InnerJoin<NodeDto>()
.On<ContentDto, NodeDto>(left => left.NodeId, right => right.NodeId)
.Where<NodeDto>(x => x.NodeObjectType == nodeObjectTypeId);
var query = Query<IContent>.Builder.Where(x => x.Path.StartsWith(path) && x.Id != id && x.Published == true && x.Trashed == false);
// Act
var translator = new SqlTranslator<IContent>(sql, query);
var result = translator.Translate();
var strResult = result.SQL;
// Assert
Console.WriteLine(strResult);
}
}
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence;
using Umbraco.Core.Persistence.Querying;
@@ -8,6 +9,8 @@ using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
using umbraco.editorControls.tinyMCE3;
using umbraco.interfaces;
namespace Umbraco.Tests.Persistence.Repositories
{
@@ -17,6 +20,20 @@ namespace Umbraco.Tests.Persistence.Repositories
[SetUp]
public override void Initialize()
{
//NOTE The DataTypesResolver is only necessary because we are using the Save method in the ContentService
//this ensures its reset
PluginManager.Current = new PluginManager();
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
PluginManager.Current.AssembliesToScan = new[]
{
typeof(IDataType).Assembly,
typeof(tinyMCE3dataType).Assembly
};
DataTypesResolver.Current = new DataTypesResolver(
() => PluginManager.Current.ResolveDataTypes());
base.Initialize();
CreateTestData();
@@ -25,6 +42,9 @@ namespace Umbraco.Tests.Persistence.Repositories
[TearDown]
public override void TearDown()
{
//reset the app context
DataTypesResolver.Reset();
base.TearDown();
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using NUnit.Framework;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Caching;
using Umbraco.Core.Persistence.Querying;
@@ -8,6 +9,8 @@ using Umbraco.Core.Persistence.Repositories;
using Umbraco.Core.Persistence.UnitOfWork;
using Umbraco.Tests.TestHelpers;
using Umbraco.Tests.TestHelpers.Entities;
using umbraco.editorControls.tinyMCE3;
using umbraco.interfaces;
namespace Umbraco.Tests.Persistence.Repositories
{
@@ -17,6 +20,20 @@ namespace Umbraco.Tests.Persistence.Repositories
[SetUp]
public override void Initialize()
{
//NOTE The DataTypesResolver is only necessary because we are using the Save method in the ContentService
//this ensures its reset
PluginManager.Current = new PluginManager();
//for testing, we'll specify which assemblies are scanned for the PluginTypeResolver
PluginManager.Current.AssembliesToScan = new[]
{
typeof(IDataType).Assembly,
typeof(tinyMCE3dataType).Assembly
};
DataTypesResolver.Current = new DataTypesResolver(
() => PluginManager.Current.ResolveDataTypes());
base.Initialize();
CreateTestData();
@@ -237,6 +254,9 @@ namespace Umbraco.Tests.Persistence.Repositories
[TearDown]
public override void TearDown()
{
//reset the app context
DataTypesResolver.Reset();
base.TearDown();
}

View File

@@ -69,7 +69,11 @@ namespace Umbraco.Tests.Routing
}
//test all template name styles to match the ActionName
[TestCase("home-page")]
[TestCase("home-\\234^^*32page")]
[TestCase("home-page")]
[TestCase("home-\\234^^*32page")]
[TestCase("home-page")]
[TestCase("home-page")]
[TestCase("Home-Page")]
[TestCase("HomePage")]
[TestCase("homePage")]
@@ -90,7 +94,9 @@ namespace Umbraco.Tests.Routing
handler.GetHandlerForRoute(routingContext.UmbracoContext.HttpContext.Request.RequestContext, docRequest);
Assert.AreEqual("CustomDocument", routeData.Values["controller"].ToString());
Assert.AreEqual("HomePage", routeData.Values["action"].ToString());
Assert.AreEqual(
global::umbraco.cms.helpers.Casing.SafeAlias(templateName),
routeData.Values["action"].ToString());
}

View File

@@ -20,7 +20,6 @@
<add application="developer" alias="datatype" title="Data Types" type="umbraco.loadDataTypes, umbraco" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="1" />
<add application="developer" alias="macros" title="Macros" type="umbraco.loadMacros, umbraco" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="2" />
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="3" />
<add application="developer" alias="packager" title="Packages" type="umbraco.loadPackager, umbraco" iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="3" />
<add application="developer" alias="packagerPackages" title="Packager Packages" type="umbraco.loadPackages, umbraco" iconClosed="folder.gif" iconOpen="folder_o.gif" initialize="false" sortOrder="3" />
<add application="developer" alias="relationTypes" title="Relation Types" type="umbraco.loadRelationTypes, umbraco" iconClosed=".sprTreeFolder" iconOpen=".sprTreeFolder_o" sortOrder="4" />
<add application="developer" alias="python" title="Scripting Files" type="umbraco.loadPython, umbraco" iconClosed="folder.gif" iconOpen="folder_o.gif" sortOrder="4" />

View File

@@ -11,7 +11,7 @@
<meta charset="utf-8">
<umb1:PageTitle runat="server" />
<link rel="icon" type="image/png" href="<%=umbraco.GlobalSettings.Path + "/images/pinnedIcons/umb.ico" %>" />
<link media="all" rel="stylesheet" href="../umbraco_client/installer/css/jquery-ui-1.8.6.custom.css" />
@@ -40,7 +40,11 @@
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server" />
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
<Services>
<asp:ServiceReference Path="../umbraco/webservices/CheckForUpgrade.asmx" />
</Services>
</asp:ScriptManager>
<!-- all page -->
<section id="wrapper">

View File

@@ -12,6 +12,9 @@ jQuery(document).ready(function () {
function (data) {
jQuery("#ajax-developervids").html(data);
});
umbraco.presentation.webservices.CheckForUpgrade.InstallStatus(true, navigator.userAgent, "");
});
</script>

View File

@@ -47,4 +47,9 @@
<asp:LinkButton ID="btnNext" CssClass="btn btn-get" runat="server" OnClick="gotoNextStep"><span>Let's get started!</span></asp:LinkButton>
</footer>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
umbraco.presentation.webservices.CheckForUpgrade.InstallStatus(false, navigator.userAgent, "");
});
</script>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<language alias="ja" intName="Japanese" localName="日本語" lcid="17" culture="ja-JP">
<creator>
<name>umbraco</name>
@@ -15,8 +15,6 @@
<key alias="disable">無効</key>
<key alias="emptyTrashcan">ごみ箱を空にする</key>
<key alias="exportDocumentType">ドキュメントタイプの書出</key>
<key alias="exportDocumentTypeAsCode">.NETの書き出し</key>
<key alias="exportDocumentTypeAsCode-Full">.NETの書き出し</key>
<key alias="importDocumentType">ドキュメントタイプの読込</key>
<key alias="importPackage">パッケージの読み込み</key>
<key alias="liveEdit">ライブ編集</key>
@@ -25,6 +23,7 @@
<key alias="notify">メール通知</key>
<key alias="protect">一般公開</key>
<key alias="publish">公開</key>
<key alias="unpublish">公開を止める</key>
<key alias="refreshNode">最新の情報に更新</key>
<key alias="republish">サイトのリフレッシュ</key>
<key alias="rights">アクセス権</key>
@@ -38,6 +37,7 @@
</area>
<area alias="assignDomain">
<key alias="addNew">ドメインの割り当て</key>
<key alias="invalidDomain">適当でないホスト名</key>
<key alias="domain">ドメイン</key>
<key alias="domainCreated">ドメイン '%0%' が新たに割り当てられました</key>
<key alias="domainDeleted">ドメイン '%0%' は削除されました</key>
@@ -71,6 +71,7 @@
<key alias="saveAndPublish">保存及び公開</key>
<key alias="saveToPublish">保存して承認に送る</key>
<key alias="showPage">プレビュー</key>
<key alias="showPageDisabled">テンプレートが指定されていないのでプレビューは無効になっています</key>
<key alias="styleChoose">スタイルの選択</key>
<key alias="styleShow">スタイルの表示</key>
<key alias="tableInsert">表の挿入</key>
@@ -90,6 +91,7 @@
<key alias="itemNotPublished">このページは公開されていません</key>
<key alias="lastPublished">公開日時</key>
<key alias="mediatype">メディアタイプ</key>
<key alias="mediaLinks">メディアの項目へのリンク</key>
<key alias="membergroup">メンバーグループ</key>
<key alias="memberrole">役割</key>
<key alias="membertype">メンバータイプ</key>
@@ -324,6 +326,7 @@
<key alias="welcome">ようこそ...</key>
<key alias="width"></key>
<key alias="yes">はい</key>
<key alias="folder">フォルダー</key>
</area>
<area alias="graphicheadline">
<key alias="backgroundcolor">背景色</key>
@@ -482,6 +485,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="notAllowedByContentType">現在のノードは、ドキュメントタイプの設定により選択されたノードの子になることはできません。</key>
<key alias="notAllowedByPath">ノードは、自分のサブページには移動できません</key>
<key alias="notValid">子ドキュメントで権限がないので、その操作はできません。</key>
<key alias="relateToOriginal">コピーしたものを元と関係づける</key>
</area>
<area alias="notifications">
<key alias="editNotifications">%0% への通知を編集</key>
@@ -586,8 +590,13 @@ Runwayをインストールして作られた新しいウェブサイトがど
</area>
<area alias="publish">
<key alias="contentPublishedFailedByEvent"><![CDATA[
サードパーティのエクステンションがキャンセルされたので、%0% は発行できませんでした。
サードパーティのエクステンションがキャンセルされたので、%0% は公開できませんでした。
]]></key>
<key alias="contentPublishedFailedByParent">
<![CDATA[
親ページが公開されていないので、%0% は公開できませんでした。
]]>
</key>
<key alias="includeUnpublished">非公開の子ページも含めます</key>
<key alias="inProgress">公開を進めています - 少々お待ちください...</key>
<key alias="inProgressCounter">%1% ページ中 %0% ページが公開されました...</key>
@@ -648,6 +657,9 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="tab">タブ</key>
<key alias="tabname">タブの名前</key>
<key alias="tabs">タブ</key>
<key alias="contentTypeEnabled">マスターコンテンツタイプが有効</key>
<key alias="contentTypeUses">このコンテンツタイプの使用</key>
<key alias="asAContentMasterType">マスターコンテンツタイプについては、マスターコンテンツタイプからのタブは表示されず、マスターコンテンツタイプでのみ編集することができます。</key>
</area>
<area alias="sort">
<key alias="sortDone">ソートが完了しました。</key>
@@ -682,6 +694,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="editTemplateSaved">テンプレートを保存しました</key>
<key alias="editUserError">ユーザーの保存時にエラーが発生しました (ログを確認してください)</key>
<key alias="editUserSaved">ユーザーを保存しました</key>
<key alias="editUserTypeSaved">ユーザータイプを保存しました</key>
<key alias="fileErrorHeader">ファイルは未保存です</key>
<key alias="fileErrorText">ファイルを保存できません。アクセス権を確認してください。</key>
<key alias="fileSavedHeader">ファイルを保存しました</key>
@@ -700,6 +713,11 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="xsltPermissionErrorText">XSLTを保存できません。アクセス権を確認してください。</key>
<key alias="xsltSavedHeader">XSLTを保存しました</key>
<key alias="xsltSavedText">XSLTにエラーはありません</key>
<key alias="contentUnpublished">コンテンツは公開されていません</key>
<key alias="partialViewSavedHeader">部分ビュー保存しました</key>
<key alias="partialViewSavedText">部分ビューをエラーなしで保存しました!</key>
<key alias="partialViewErrorHeader">部分ビューは保存されていません</key>
<key alias="partialViewErrorText">ファイルを保存するときにエラーが発生しました。</key>
</area>
<area alias="stylesheet">
<key alias="aliasHelp">CSSシンタックスを使用 例: h1, .redHeader, .blueTex</key>
@@ -727,6 +745,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="chooseField">フィールドの選択</key>
<key alias="convertLineBreaks">改行コードの変換</key>
<key alias="convertLineBreaksHelp">改行コードをhtmlタグ &amp;lt;br&amp;gt; に変換する</key>
<key alias="customFields">カスタムフィールド</key>
<key alias="dateOnly">日付のみ表示</key>
<key alias="formatAsDate">日付の形式</key>
<key alias="htmlEncode">HTMLエンコード</key>
@@ -740,6 +759,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="recursive">再帰的</key>
<key alias="removeParagraph">段落タグの消去</key>
<key alias="removeParagraphHelp">段落タグ &amp;lt;P&amp;gt; を消去します</key>
<key alias="standardFields">標準フィールド</key>
<key alias="uppercase">大文字変換</key>
<key alias="urlEncode">URLエンコード</key>
<key alias="urlEncodeHelp">文字列をURLで使用可能な文字列に変換する</key>
@@ -833,6 +853,8 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="administrators">管理者</key>
<key alias="categoryField">フィールドのカテゴリー</key>
<key alias="changePassword">パスワードの変更</key>
<key alias="newPassword">新パスワード</key>
<key alias="confirmNewPassword">新パスワードの確認</key>
<key alias="changePasswordDescription">Umbracoの管理画面にアクセスするためのパスワードを変更するには、以下のフォームに新しいパスワード入力して「パスワードの変更」ボタンをクリックしてください。</key>
<key alias="contentChannel">コンテントチャンネル</key>
<key alias="defaultToLiveEditing">ログオン後ライブ編集にリダイレクト</key>
@@ -851,6 +873,8 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="passwordConfirm">新しいパスワードの確認</key>
<key alias="passwordEnterNew">新しいパスワードの入力</key>
<key alias="passwordIsBlank">パスワードは空白にできません!</key>
<key alias="passwordCurrent">現在のパスワード</key>
<key alias="passwordInvalid">現在のパスワードが正しくない</key>
<key alias="passwordIsDifferent">新しいパスワードと確認のパスワードが一致しません。再度入力してください!</key>
<key alias="passwordMismatch">確認のパスワードは新しいパスワードと一致しません!</key>
<key alias="permissionReplaceChildren">子ノードのアクセス権を置き換える</key>
@@ -864,4 +888,4 @@ Runwayをインストールして作られた新しいウェブサイトがど
<key alias="userTypes">ユーザーの種類</key>
<key alias="writer">投稿者</key>
</area>
</language>
</language>

View File

@@ -501,13 +501,13 @@
<p>您好!这是一封自动发送的邮件,告诉您任务<strong>'%1%'</strong>已在<a href="%7%"><strong>'%2%'</strong></a>被用户<strong>'%3%'</strong>执行</p>
<div style="margin: 8px 0; padding: 8px; display: block;">
<br />
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%">&nbsp;&nbsp;PUBLISH&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;DELETE&nbsp;&nbsp;&nbsp;&nbsp;</a>
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%">&nbsp;&nbsp;发布&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;删除&nbsp;&nbsp;&nbsp;&nbsp;</a>
<br />
</div>
<p>
<h3>Update summary:</h3>
<h3>更新概况:</h3>
<table style="width: 100%;">
%6%
</table>
@@ -515,14 +515,14 @@
<div style="margin: 8px 0; padding: 8px; display: block;">
<br />
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%">&nbsp;&nbsp;PUBLISH&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EDIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;DELETE&nbsp;&nbsp;&nbsp;&nbsp;</a>
<a style="color: white; font-weight: bold; background-color: #66cc66; text-decoration : none; margin-right: 20px; border: 8px solid #66cc66; width: 150px;" href="http://%4%/actions/publish.aspx?id=%5%">&nbsp;&nbsp;发布&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #5372c3; text-decoration : none; margin-right: 20px; border: 8px solid #5372c3; width: 150px;" href="http://%4%/actions/editContent.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;编辑&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a> &nbsp;
<a style="color: white; font-weight: bold; background-color: #ca4a4a; text-decoration : none; margin-right: 20px; border: 8px solid #ca4a4a; width: 150px;" href="http://%4%/actions/delete.aspx?id=%5%">&nbsp;&nbsp;&nbsp;&nbsp;删除&nbsp;&nbsp;&nbsp;&nbsp;</a>
<br />
</div>
<p>Have a nice day!<br /><br />
Cheers from the umbraco robot
<p>祝您愉快!<br /><br />
该信息由系统自动发送
</p>
]]></key>
<key alias="mailSubject">在 %2%[%0%] 关于 %1% 的通告已执行。</key>

View File

@@ -1,11 +1,13 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Dashboard.ascx.cs" Inherits="Our.Umbraco.uGoLive.Web.Umbraco.Plugins.uGoLive.Dashboard" %>
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Dashboard.ascx.cs" Inherits="Our.Umbraco.uGoLive.Web.Umbraco.Plugins.uGoLive.Dashboard" %>
<%@ Import Namespace="umbraco.IO" %>
<%@ Import Namespace="Our.Umbraco.uGoLive.Web" %>
<link href="../umbraco_client/propertypane/style.css" rel="stylesheet" />
<link href="plugins/uGoLive/Dashboard.css" rel="stylesheet" />
<script type="text/javascript" src="plugins/uGoLive/jquery.tmpl.js"></script>
<script type="text/javascript" src="plugins/uGoLive/knockout-1.2.1.js"></script>
<script type="text/javascript" src="plugins/uGoLive/Dashboard.js"></script>
<%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="cdf" %>
<cdf:CssInclude ID="CssInclude1" runat="server" FilePath="propertypane/style.css" PathNameAlias="UmbracoClient" />
<cdf:CssInclude ID="CssInclude2" runat="server" FilePath="plugins/uGoLive/Dashboard.css" PathNameAlias="UmbracoRoot" />
<cdf:JsInclude ID="JsInclude2" runat="server" FilePath="UI/knockout.js" Priority="3" PathNameAlias="UmbracoClient" />
<cdf:JsInclude ID="JsInclude1" runat="server" FilePath="plugins/uGoLive/Dashboard.js" PathNameAlias="UmbracoRoot" />
<script type="text/javascript">
(function ($) {
@@ -24,7 +26,7 @@
</script>
<div class="uGoLive">
<div class="uGoLive" id="uGoLive">
<div class="propertypane">
<div>
<div class="propertyItem">

View File

@@ -274,7 +274,7 @@ namespace Umbraco.Web.Mvc
//the template Alias should always be already saved with a safe name.
//if there are hyphens in the name and there is a hijacked route, then the Action will need to be attributed
// with the action name attribute.
var templateName = publishedContentRequest.Template.Split('.')[0];
var templateName = global::umbraco.cms.helpers.Casing.SafeAlias(publishedContentRequest.Template.Alias.Split('.')[0]);
def.ActionName = templateName;
}

View File

@@ -30,4 +30,6 @@ using System.Security;
[assembly: InternalsVisibleTo("Umbraco.Tests")]
[assembly: InternalsVisibleTo("umbraco.MacroEngines")]
[assembly: InternalsVisibleTo("Umbraco.Web.UI")]
[assembly: InternalsVisibleTo("Umbraco.Courier.Persistence")]
[assembly: InternalsVisibleTo("Umbraco.Courier.Persistence")]
[assembly: InternalsVisibleTo("umbraco.webservices")]

View File

@@ -1915,7 +1915,9 @@
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\controls\Tree\TreeControl.ascx" />
<Content Include="umbraco.presentation\install\steps\license.ascx" />
<Content Include="umbraco.presentation\install\steps\license.ascx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\actions\delete.aspx" />
<Content Include="umbraco.presentation\umbraco\actions\editContent.aspx" />
<Content Include="umbraco.presentation\umbraco\actions\preview.aspx" />
@@ -2042,7 +2044,9 @@
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\dashboard.aspx" />
<Content Include="umbraco.presentation\umbraco\dashboard\LatestEdits.ascx" />
<Content Include="umbraco.presentation\umbraco\dashboard\LatestEdits.ascx">
<SubType>ASPXCodeBehind</SubType>
</Content>
<Content Include="umbraco.presentation\umbraco\Default.aspx" />
<Content Include="umbraco.presentation\umbraco\developer\Macros\assemblyBrowser.aspx" />
<Content Include="umbraco.presentation\umbraco\developer\autoDoc.aspx" />

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.544
// Runtime Version:4.0.30319.18033
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -9,27 +9,28 @@
//------------------------------------------------------------------------------
//
// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.544.
// This source code was auto-generated by Microsoft.VSDesigner, Version 4.0.30319.18033.
//
#pragma warning disable 1591
namespace umbraco.presentation.org.umbraco.update
{
namespace umbraco.presentation.org.umbraco.update {
using System;
using System.Web.Services;
using System.Diagnostics;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Xml.Serialization;
using System.ComponentModel;
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Web.Services.WebServiceBindingAttribute(Name="CheckForUpgradeSoap", Namespace="http://update.umbraco.org/")]
public partial class CheckForUpgrade : System.Web.Services.Protocols.SoapHttpClientProtocol {
private System.Threading.SendOrPostCallback InstallOperationCompleted;
private System.Threading.SendOrPostCallback CheckUpgradeOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
@@ -70,34 +71,85 @@ namespace umbraco.presentation.org.umbraco.update
}
}
/// <remarks/>
public event InstallCompletedEventHandler InstallCompleted;
/// <remarks/>
public event CheckUpgradeCompletedEventHandler CheckUpgradeCompleted;
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://update.umbraco.org/Install", RequestNamespace="http://update.umbraco.org/", ResponseNamespace="http://update.umbraco.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public void Install(System.Guid installId, bool isUpgrade, bool installCompleted, System.DateTime timestamp, int versionMajor, int versionMinor, int versionPatch, string versionComment, string error, string userAgent, string dbProvider) {
this.Invoke("Install", new object[] {
installId,
isUpgrade,
installCompleted,
timestamp,
versionMajor,
versionMinor,
versionPatch,
versionComment,
error,
userAgent,
dbProvider});
}
/// <remarks/>
public void InstallAsync(System.Guid installId, bool isUpgrade, bool installCompleted, System.DateTime timestamp, int versionMajor, int versionMinor, int versionPatch, string versionComment, string error, string userAgent, string dbProvider) {
this.InstallAsync(installId, isUpgrade, installCompleted, timestamp, versionMajor, versionMinor, versionPatch, versionComment, error, userAgent, dbProvider, null);
}
/// <remarks/>
public void InstallAsync(System.Guid installId, bool isUpgrade, bool installCompleted, System.DateTime timestamp, int versionMajor, int versionMinor, int versionPatch, string versionComment, string error, string userAgent, string dbProvider, object userState) {
if ((this.InstallOperationCompleted == null)) {
this.InstallOperationCompleted = new System.Threading.SendOrPostCallback(this.OnInstallOperationCompleted);
}
this.InvokeAsync("Install", new object[] {
installId,
isUpgrade,
installCompleted,
timestamp,
versionMajor,
versionMinor,
versionPatch,
versionComment,
error,
userAgent,
dbProvider}, this.InstallOperationCompleted, userState);
}
private void OnInstallOperationCompleted(object arg) {
if ((this.InstallCompleted != null)) {
System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
this.InstallCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://update.umbraco.org/CheckUpgrade", RequestNamespace="http://update.umbraco.org/", ResponseNamespace="http://update.umbraco.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public UpgradeResult CheckUpgrade(int VersionMajor, int VersionMinor, int VersionPatch, string versionComment) {
public UpgradeResult CheckUpgrade(int versionMajor, int versionMinor, int versionPatch, string versionComment) {
object[] results = this.Invoke("CheckUpgrade", new object[] {
VersionMajor,
VersionMinor,
VersionPatch,
versionMajor,
versionMinor,
versionPatch,
versionComment});
return ((UpgradeResult)(results[0]));
}
/// <remarks/>
public void CheckUpgradeAsync(int VersionMajor, int VersionMinor, int VersionPatch, string versionComment) {
this.CheckUpgradeAsync(VersionMajor, VersionMinor, VersionPatch, versionComment, null);
public void CheckUpgradeAsync(int versionMajor, int versionMinor, int versionPatch, string versionComment) {
this.CheckUpgradeAsync(versionMajor, versionMinor, versionPatch, versionComment, null);
}
/// <remarks/>
public void CheckUpgradeAsync(int VersionMajor, int VersionMinor, int VersionPatch, string versionComment, object userState) {
public void CheckUpgradeAsync(int versionMajor, int versionMinor, int versionPatch, string versionComment, object userState) {
if ((this.CheckUpgradeOperationCompleted == null)) {
this.CheckUpgradeOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCheckUpgradeOperationCompleted);
}
this.InvokeAsync("CheckUpgrade", new object[] {
VersionMajor,
VersionMinor,
VersionPatch,
versionMajor,
versionMinor,
versionPatch,
versionComment}, this.CheckUpgradeOperationCompleted, userState);
}
@@ -128,28 +180,18 @@ namespace umbraco.presentation.org.umbraco.update
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.450")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18033")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://update.umbraco.org/")]
public partial class UpgradeResult {
private UpgradeType upgradeTypeField;
private string commentField;
private string upgradeUrlField;
private UpgradeType upgradeTypeField;
/// <remarks/>
public UpgradeType UpgradeType {
get {
return this.upgradeTypeField;
}
set {
this.upgradeTypeField = value;
}
}
private string upgradeUrlField;
/// <remarks/>
public string Comment {
@@ -161,6 +203,16 @@ namespace umbraco.presentation.org.umbraco.update
}
}
/// <remarks/>
public UpgradeType UpgradeType {
get {
return this.upgradeTypeField;
}
set {
this.upgradeTypeField = value;
}
}
/// <remarks/>
public string UpgradeUrl {
get {
@@ -173,7 +225,7 @@ namespace umbraco.presentation.org.umbraco.update
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.450")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.18033")]
[System.SerializableAttribute()]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://update.umbraco.org/")]
public enum UpgradeType {
@@ -201,11 +253,15 @@ namespace umbraco.presentation.org.umbraco.update
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
public delegate void InstallCompletedEventHandler(object sender, System.ComponentModel.AsyncCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
public delegate void CheckUpgradeCompletedEventHandler(object sender, CheckUpgradeCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.1")]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.0.30319.17929")]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
public partial class CheckUpgradeCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://update.umbraco.org/checkforupgrade.asmx?disco" filename="checkforupgrade.disco" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://update.umbraco.org/checkforupgrade.asmx?wsdl" filename="checkforupgrade.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://update.umbraco.org/checkforupgrade.asmx?disco" filename="checkforupgrade.disco" />
</Results>
</DiscoveryClientResultsFile>

View File

@@ -1,13 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://update.umbraco.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://update.umbraco.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://update.umbraco.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s1="http://microsoft.com/wsdl/types/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://update.umbraco.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://update.umbraco.org/">
<s:import namespace="http://microsoft.com/wsdl/types/" />
<s:element name="Install">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="installId" type="s1:guid" />
<s:element minOccurs="1" maxOccurs="1" name="isUpgrade" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="installCompleted" type="s:boolean" />
<s:element minOccurs="1" maxOccurs="1" name="timestamp" type="s:dateTime" />
<s:element minOccurs="1" maxOccurs="1" name="versionMajor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="versionMinor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="versionPatch" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="versionComment" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="error" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="userAgent" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="dbProvider" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="InstallResponse">
<s:complexType />
</s:element>
<s:element name="CheckUpgrade">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="VersionMajor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="VersionMinor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="VersionPatch" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="versionMajor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="versionMinor" type="s:int" />
<s:element minOccurs="1" maxOccurs="1" name="versionPatch" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="versionComment" type="s:string" />
</s:sequence>
</s:complexType>
@@ -21,8 +42,8 @@
</s:element>
<s:complexType name="UpgradeResult">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="UpgradeType" type="tns:UpgradeType" />
<s:element minOccurs="0" maxOccurs="1" name="Comment" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="UpgradeType" type="tns:UpgradeType" />
<s:element minOccurs="0" maxOccurs="1" name="UpgradeUrl" type="s:string" />
</s:sequence>
</s:complexType>
@@ -38,7 +59,20 @@
</s:restriction>
</s:simpleType>
</s:schema>
<s:schema elementFormDefault="qualified" targetNamespace="http://microsoft.com/wsdl/types/">
<s:simpleType name="guid">
<s:restriction base="s:string">
<s:pattern value="[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}" />
</s:restriction>
</s:simpleType>
</s:schema>
</wsdl:types>
<wsdl:message name="InstallSoapIn">
<wsdl:part name="parameters" element="tns:Install" />
</wsdl:message>
<wsdl:message name="InstallSoapOut">
<wsdl:part name="parameters" element="tns:InstallResponse" />
</wsdl:message>
<wsdl:message name="CheckUpgradeSoapIn">
<wsdl:part name="parameters" element="tns:CheckUpgrade" />
</wsdl:message>
@@ -46,6 +80,10 @@
<wsdl:part name="parameters" element="tns:CheckUpgradeResponse" />
</wsdl:message>
<wsdl:portType name="CheckForUpgradeSoap">
<wsdl:operation name="Install">
<wsdl:input message="tns:InstallSoapIn" />
<wsdl:output message="tns:InstallSoapOut" />
</wsdl:operation>
<wsdl:operation name="CheckUpgrade">
<wsdl:input message="tns:CheckUpgradeSoapIn" />
<wsdl:output message="tns:CheckUpgradeSoapOut" />
@@ -53,6 +91,15 @@
</wsdl:portType>
<wsdl:binding name="CheckForUpgradeSoap" type="tns:CheckForUpgradeSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Install">
<soap:operation soapAction="http://update.umbraco.org/Install" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CheckUpgrade">
<soap:operation soapAction="http://update.umbraco.org/CheckUpgrade" style="document" />
<wsdl:input>
@@ -65,6 +112,15 @@
</wsdl:binding>
<wsdl:binding name="CheckForUpgradeSoap12" type="tns:CheckForUpgradeSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Install">
<soap12:operation soapAction="http://update.umbraco.org/Install" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CheckUpgrade">
<soap12:operation soapAction="http://update.umbraco.org/CheckUpgrade" style="document" />
<wsdl:input>

View File

@@ -580,40 +580,42 @@ namespace umbraco
ThreadPool.QueueUserWorkItem(delegate { UpdateDocumentCache(documentId); });
}
[Obsolete("Method obsolete in version 4.1 and later, please use ClearDocumentCache", true)]
/// <summary>
/// Clears the document cache async.
/// </summary>
/// <param name="documentId">The document id.</param>
[Obsolete("Method obsolete in version 4.1 and later, please use ClearDocumentCache", true)]
public virtual void ClearDocumentCacheAsync(int documentId)
{
ThreadPool.QueueUserWorkItem(delegate { ClearDocumentCache(documentId); });
}
public virtual void ClearDocumentCache(int documentId)
{
// Get the document
var d = new Document(documentId);
ClearDocumentCache(d);
}
/// <summary>
/// Clears the document cache and removes the document from the xml db cache.
/// This means the node gets unpublished from the website.
/// </summary>
/// <param name="documentId">The document id.</param>
public virtual void ClearDocumentCache(int documentId)
/// <param name="doc">The document</param>
internal void ClearDocumentCache(Document doc)
{
// Get the document
var d = new Document(documentId);
var e = new DocumentCacheEventArgs();
FireBeforeClearDocumentCache(d, e);
FireBeforeClearDocumentCache(doc, e);
if (!e.Cancel)
{
XmlNode x;
// remove from xml db cache
d.XmlRemoveFromDB();
doc.XmlRemoveFromDB();
// Check if node present, before cloning
x = XmlContentInternal.GetElementById(d.Id.ToString());
x = XmlContentInternal.GetElementById(doc.Id.ToString());
if (x == null)
return;
@@ -626,7 +628,7 @@ namespace umbraco
XmlDocument xmlContentCopy = CloneXmlDoc(XmlContentInternal);
// Find the document in the xml cache
x = xmlContentCopy.GetElementById(d.Id.ToString());
x = xmlContentCopy.GetElementById(doc.Id.ToString());
if (x != null)
{
// The document already exists in cache, so repopulate it
@@ -639,17 +641,17 @@ namespace umbraco
if (x != null)
{
// Run Handler
Action.RunActionHandlers(d, ActionUnPublish.Instance);
Action.RunActionHandlers(doc, ActionUnPublish.Instance);
}
// update sitemapprovider
if (SiteMap.Provider is UmbracoSiteMapProvider)
{
var prov = (UmbracoSiteMapProvider)SiteMap.Provider;
prov.RemoveNode(d.Id);
prov.RemoveNode(doc.Id);
}
FireAfterClearDocumentCache(d, e);
FireAfterClearDocumentCache(doc, e);
}
}

View File

@@ -9,7 +9,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
using umbraco.IO;
using Umbraco.Core.IO;
using umbraco.cms.businesslogic.installer;
using System.Collections.Generic;
@@ -36,7 +36,7 @@ namespace umbraco.presentation.install
private void loadContent(InstallerStep currentStep)
{
PlaceHolderStep.Controls.Clear();
PlaceHolderStep.Controls.Add(new System.Web.UI.UserControl().LoadControl(IOHelper.ResolveUrl(currentStep.UserControl)));
PlaceHolderStep.Controls.Add(LoadControl(IOHelper.ResolveUrl(currentStep.UserControl)));
step.Value = currentStep.Alias;
currentStepClass = currentStep.Alias;
}

View File

@@ -1,8 +1,9 @@
using System;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using umbraco.cms.businesslogic.installer;
using umbraco.IO;
namespace umbraco.presentation.install.steps.Definitions
{
@@ -26,10 +27,7 @@ namespace umbraco.presentation.install.steps.Definitions
public override bool MoveToNextStepAutomaticly
{
get
{
return true;
}
get { return true; }
}
//here we determine if the installer should skip this step...
@@ -49,7 +47,7 @@ namespace umbraco.presentation.install.steps.Definitions
var configuredVersion = new Version(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus);
var targetVersion = UmbracoVersion.Current;
return targetVersion < configuredVersion;
}
}

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Umbraco.Core.IO;
using umbraco.cms.businesslogic.installer;
namespace umbraco.presentation.install.steps.Definitions
@@ -20,7 +21,7 @@ namespace umbraco.presentation.install.steps.Definitions
public override string UserControl
{
get { return IO.SystemDirectories.Install + "/steps/validatepermissions.ascx"; }
get { return SystemDirectories.Install + "/steps/validatepermissions.ascx"; }
}
public override bool HideFromNavigation {

View File

@@ -12,6 +12,9 @@ jQuery(document).ready(function () {
function (data) {
jQuery("#ajax-developervids").html(data);
});
umbraco.presentation.webservices.CheckForUpgrade.InstallStatus(true, navigator.userAgent, "");
});
</script>

View File

@@ -47,4 +47,9 @@
<asp:LinkButton ID="btnNext" CssClass="btn btn-get" runat="server" OnClick="gotoNextStep"><span>Let's get started!</span></asp:LinkButton>
</footer>
</div>
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
umbraco.presentation.webservices.CheckForUpgrade.InstallStatus(false, navigator.userAgent, "");
});
</script>

View File

@@ -188,9 +188,7 @@ namespace umbraco
/// </summary>
/// <param name="DocumentId">The Id of the Document to be unpublished</param>
public static void UnPublishSingleNode(int DocumentId)
{
//PPH Added dispatcher support
{
if (UmbracoSettings.UseDistributedCalls)
dispatcher.Remove(
new Guid("27ab3022-3dfa-47b6-9119-5945bc88fd66"),
@@ -199,6 +197,21 @@ namespace umbraco
content.Instance.ClearDocumentCache(DocumentId);
}
/// <summary>
/// Unpublish a node, by removing it from the runtime xml index. Note, prior to this the Document should be
/// marked unpublished by setting the publish property on the document object to false
/// </summary>
/// <param name="document">The Document to be unpublished</param>
internal static void UnPublishSingleNode(Document document)
{
if (UmbracoSettings.UseDistributedCalls)
dispatcher.Remove(
new Guid("27ab3022-3dfa-47b6-9119-5945bc88fd66"),
document.Id);
else
content.Instance.ClearDocumentCache(document);
}
/// <summary>
/// Publishes a Document by adding it to the runtime xml index. Note, prior to this the Document should be
/// marked published by calling Publish(User u) on the document object.

View File

@@ -311,7 +311,7 @@ namespace umbraco
Model.CacheIdentifier = GetCacheIdentifier(Model, pageElements, pageId);
if (Model.CacheDuration > 0)
if (!UmbracoContext.Current.InPreviewMode && Model.CacheDuration > 0)
{
if (cacheMacroAsString(Model))
{

View File

@@ -38,7 +38,7 @@ namespace umbraco.presentation
d.ReleaseDate = DateTime.MinValue; //new DateTime(1, 1, 1); // Causes release date to be null
d.Publish(d.User);
library.UpdateDocumentCache(d.Id);
library.UpdateDocumentCache(d);
}
catch(Exception ee)

View File

@@ -132,7 +132,7 @@ namespace umbraco.presentation.LiveEditing.Modules.CreateModule
DocumentType typeToCreate = new DocumentType(Convert.ToInt32(m_AllowedDocTypesDropdown.SelectedValue));
Document newDoc = Document.MakeNew(m_NameTextBox.Text, typeToCreate, new global::umbraco.BusinessLogic.User(userid), (int)UmbracoContext.Current.PageId);
newDoc.Publish(new global::umbraco.BusinessLogic.User(userid));
library.UpdateDocumentCache(newDoc.Id);
library.UpdateDocumentCache(newDoc);
Page.Response.Redirect(library.NiceUrl(newDoc.Id), false);
break;
}

View File

@@ -35,7 +35,7 @@ namespace umbraco.cms.presentation.Trees
public BaseContentTree(string application) : base(application) { }
private User m_user;
private User _user;
/// <summary>
/// Returns the current User. This ensures that we don't instantiate a new User object
@@ -45,7 +45,7 @@ namespace umbraco.cms.presentation.Trees
{
get
{
return (m_user == null ? (m_user = UmbracoEnsuredPage.CurrentUser) : m_user);
return (_user == null ? (_user = UmbracoEnsuredPage.CurrentUser) : _user);
}
}
@@ -113,7 +113,7 @@ function openContent(id) {
node.OpenIcon = dd.ContentTypeIcon;
}
if (dd.HasPublishedVersion() == false)
if (!dd.Published)
node.Style.DimNode();
if (dd.HasPendingChanges())

View File

@@ -39,7 +39,7 @@ namespace umbraco.presentation.actions
confirm.Visible = false;
d.Publish(getUser());
library.UpdateDocumentCache(d.Id);
library.UpdateDocumentCache(d);
deleted.Text = ui.Text("editContentPublishedHeader") + " ('" + d.Text + "') " + ui.Text("editContentPublishedText") + "</p><p><a href=\"" + library.NiceUrl(d.Id) + "\"> " + ui.Text("view") + " " + d.Text + "</a>";
}

View File

@@ -84,7 +84,7 @@ namespace umbraco.presentation.channels
if (publish)
{
doc.Publish(new User(username));
library.UpdateDocumentCache(doc.Id);
library.UpdateDocumentCache(doc);
}
return true;
}
@@ -403,7 +403,7 @@ namespace umbraco.presentation.channels
if (publish)
{
doc.Publish(new User(username));
library.UpdateDocumentCache(doc.Id);
library.UpdateDocumentCache(doc);
}
return doc.Id.ToString();
}

View File

@@ -545,10 +545,14 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
var gpw = (GenericProperties.GenericPropertyWrapper)sender;
var alias = gpw.PropertyType.Alias;
gpw.GenricPropertyControl.PropertyType.delete();
//We have to ensure that the property type is removed from the underlying IContentType object
cType.ContentTypeItem.RemovePropertyType(alias);
cType.Save();
if (cType.ContentTypeItem != null)
{
cType.ContentTypeItem.RemovePropertyType(alias);
cType.Save();
}
gpw.GenricPropertyControl.PropertyType.delete();
cType = ContentType.GetContentType(cType.Id);
this.bindDataGenericProperties(true);

View File

@@ -93,7 +93,7 @@ namespace umbraco.dialogs
{
if (doc.Published)
{
library.UpdateDocumentCache(doc.Id);
library.UpdateDocumentCache(doc);
}
}
@@ -117,7 +117,7 @@ namespace umbraco.dialogs
{
if (d.PublishWithResult(base.getUser()))
{
library.UpdateDocumentCache(d.Id);
library.UpdateDocumentCache(d);
feedbackMsg.type = umbraco.uicontrols.Feedback.feedbacktype.success;
feedbackMsg.Text = ui.Text("publish", "nodePublish", d.Text, base.getUser()) + "</p><p><a href='#' onclick='" + ClientTools.Scripts.CloseModalWindow() + "'>" + ui.Text("closeThisWindow") + "</a>";
}
@@ -142,7 +142,7 @@ namespace umbraco.dialogs
{
// Needed for supporting distributed calls
if (UmbracoSettings.UseDistributedCalls)
library.UpdateDocumentCache(d.Id);
library.UpdateDocumentCache(d);
else
documents.Add(d);

View File

@@ -4,6 +4,7 @@ using System.Web.UI.WebControls;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Persistence.Caching;
using Umbraco.Core.Services;
using umbraco.BusinessLogic.Actions;
using umbraco.IO;
using umbraco.uicontrols.DatePicker;
@@ -316,6 +317,8 @@ namespace umbraco.cms.presentation
{
if (_document.Level == 1 || _document.PathPublished)
{
var previouslyPublished = _document.HasPublishedVersion();
Trace.Warn("before d.publish");
if (_document.PublishWithResult(base.getUser()))
@@ -330,15 +333,19 @@ namespace umbraco.cms.presentation
_documentHasPublishedVersion = _document.HasPublishedVersion();
var descendants = ApplicationContext.Current.Services.ContentService.GetDescendants(_document.Id);
var publishableDescendants = descendants.Where(descendant => descendant.HasPublishedVersion()).ToList();
if(publishableDescendants.Any())
if (previouslyPublished == false)
{
foreach (var descendant in publishableDescendants)
var descendants = ((ContentService) ApplicationContext.Current.Services.ContentService)
.GetPublishedDescendants(_document.Content).ToList();
if (descendants.Any())
{
library.UpdateDocumentCache(descendant.Id);
foreach (var descendant in descendants)
{
library.UpdateDocumentCache(descendant.Id);
}
library.RefreshContent();
}
library.RefreshContent();
}
}
else

View File

@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Security;
@@ -53,13 +55,30 @@ namespace umbraco.presentation.preview
// clone xml
XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();
// inject current document xml
int parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;
XmlContent = content.AppendDocumentXml(documentObject.Id, documentObject.Level, parentId, documentObject.ToPreviewXml(XmlContent), XmlContent);
var previewNodes = new List<Document>();
var parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;
while (parentId > 0 && XmlContent.GetElementById(parentId.ToString(CultureInfo.InvariantCulture)) == null)
{
var document = new Document(parentId);
previewNodes.Insert(0, document);
parentId = document.ParentId;
}
previewNodes.Add(documentObject);
foreach (var document in previewNodes)
{
//Inject preview xml
parentId = document.Level == 1 ? -1 : document.Parent.Id;
var previewXml = document.ToPreviewXml(XmlContent);
content.AppendDocumentXml(document.Id, document.Level, parentId, previewXml, XmlContent);
}
if (includeSubs)
{
foreach (CMSPreviewNode prevNode in documentObject.GetNodesForPreview(true))
foreach (var prevNode in documentObject.GetNodesForPreview(true))
{
XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml))), XmlContent);
}

View File

@@ -250,7 +250,7 @@ namespace umbraco
}
}
library.UpdateDocumentCache(document.Id);
library.UpdateDocumentCache(document);
return document;
}

View File

@@ -102,11 +102,11 @@ namespace umbraco.cms.presentation.user
/// <summary>
/// Returns the current user permissions for the node specified
/// </summary>
/// <param name="nodeID"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
public List<IAction> GetExistingNodePermission(int nodeID)
public List<IAction> GetExistingNodePermission(int nodeId)
{
string path = GetNodePath(nodeID);
var path = GetNodePath(nodeId);
if (path != "")
{
//get the user and their permissions
@@ -119,13 +119,13 @@ namespace umbraco.cms.presentation.user
/// <summary>
/// gets path attribute for node id passed
/// </summary>
/// <param name="iNodeID"></param>
/// <param name="iNodeId"></param>
/// <returns></returns>
private string GetNodePath(int iNodeID)
private static string GetNodePath(int iNodeId)
{
if (Document.IsDocument(iNodeID))
if (Document.IsDocument(iNodeId))
{
Document doc = new Document(iNodeID);
var doc = new Document(iNodeId);
return doc.Path;
}
@@ -135,14 +135,13 @@ namespace umbraco.cms.presentation.user
/// <summary>
/// Finds all child node IDs
/// </summary>
/// <param name="userID"></param>
/// <param name="nodeID"></param>
/// <param name="nodeId"></param>
/// <returns></returns>
private List<int> FindChildNodes(int nodeID)
private static IEnumerable<int> FindChildNodes(int nodeId)
{
Document[] docs = Document.GetChildrenForTree(nodeID);
List<int> nodeIds = new List<int>();
foreach (Document doc in docs)
var docs = Document.GetChildrenForTree(nodeId);
var nodeIds = new List<int>();
foreach (var doc in docs)
{
nodeIds.Add(doc.Id);
if (doc.HasChildren)
@@ -153,16 +152,16 @@ namespace umbraco.cms.presentation.user
return nodeIds;
}
private void InsertPermissions(int[] nodeIDs, IAction permission)
private void InsertPermissions(IEnumerable<int> nodeIDs, IAction permission)
{
foreach (int i in nodeIDs)
InsertPermission(i, permission);
}
private void InsertPermission(int nodeID, IAction permission)
private void InsertPermission(int nodeId, IAction permission)
{
//create a new CMSNode object but don't initialize (this prevents a db query)
CMSNode node = new CMSNode(nodeID, false);
var node = new CMSNode(nodeId, false);
Permission.MakeNew(m_user, node, permission.Letter);
}

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Web;
using System.Web.Services;
using System.Web.Script.Services;
using Umbraco.Core;
using Umbraco.Core.Configuration;
@@ -32,7 +33,54 @@ namespace umbraco.presentation.webservices
return new UpgradeResult(result.UpgradeType.ToString(), result.Comment, result.UpgradeUrl);
}
[WebMethod]
[ScriptMethod]
public void InstallStatus(bool isCompleted, string userAgent, string errorMsg)
{
bool isUpgrade = false;
// if it's an upgrade, you'll need to be logged in before we allow this call
if (!String.IsNullOrEmpty(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus))
{
isUpgrade = true;
legacyAjaxCalls.Authorize();
}
// Check for current install Id
Guid installId = Guid.NewGuid();
BusinessLogic.StateHelper.Cookies.Cookie installCookie =
new BusinessLogic.StateHelper.Cookies.Cookie("umb_installId", 1);
if (!String.IsNullOrEmpty(installCookie.GetValue()))
{
if (Guid.TryParse(installCookie.GetValue(), out installId))
{
// check that it's a valid Guid
if (installId == Guid.Empty)
installId = Guid.NewGuid();
}
}
installCookie.SetValue(installId.ToString());
string dbProvider = String.Empty;
if (!String.IsNullOrEmpty(Umbraco.Core.Configuration.GlobalSettings.ConfigurationStatus))
dbProvider = ApplicationContext.Current.DatabaseContext.DatabaseProvider.ToString();
org.umbraco.update.CheckForUpgrade check = new global::umbraco.presentation.org.umbraco.update.CheckForUpgrade();
check.Install(installId,
isUpgrade,
isCompleted,
DateTime.Now,
UmbracoVersion.Current.Major,
UmbracoVersion.Current.Minor,
UmbracoVersion.Current.Build,
UmbracoVersion.CurrentComment,
errorMsg,
userAgent,
dbProvider);
}
}
public class UpgradeResult
{
public string UpgradeType { get; set; }

View File

@@ -105,7 +105,9 @@
<!-- Prompts for the database password and fills it into the database scripts.
The SQL tag indicates it is a parameter required for SQL, the DbUserPassword tag indicates this is a Db password -->
<parameter name="Database Password" description="Password for the Database Username." tags="New, Password, SQL, DbUserPassword">
<parameter name="Database Password" description="Enter Password for the Database Username. Passwords will contain at least 1 upper case letter, at least 1 lower case letter, at least 1 number or special character, and be least 8 characters in length. "
tags="New, Password, SQL, DbUserPassword">
<parameterValidation type = "RegularExpression" validationString = "(?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$" />
<parameterEntry type="TextFile" scope="installSQL1.sql" match="PlaceHolderForPassword" />
<parameterEntry type="TextFile" scope="installSQL2.sql" match="PlaceHolderForPassword" />
</parameter>

View File

@@ -232,9 +232,6 @@ namespace umbraco.cms.businesslogic.media
foreach (var property in GenericProperties)
{
if (property.Value == null)
continue;
MediaItem.SetValue(property.PropertyType.Alias, property.Value);
}

View File

@@ -598,7 +598,10 @@ namespace umbraco.cms.businesslogic.member
}
else if (dbType.Equals("Date"))
{
poco.Date = DateTime.Parse(property.Value.ToString());
DateTime date;
if(DateTime.TryParse(property.Value.ToString(), out date))
poco.Date = date;
}
else if (dbType.Equals("Nvarchar"))
{

View File

@@ -378,10 +378,6 @@ namespace umbraco.cms.businesslogic.propertytype
// flush cache
FlushCache();
// clean all properties on inherited document types (if this propertytype is removed from a master)
CleanPropertiesOnDeletion(_contenttypeid);
// DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == _contenttypeid).ForEach(dt => cleanPropertiesOnDeletion(dt.Id));
// Delete all properties of propertytype
CleanPropertiesOnDeletion(_contenttypeid);
@@ -413,15 +409,15 @@ namespace umbraco.cms.businesslogic.propertytype
DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentTypes.Contains(contentTypeId)).ForEach(
dt => CleanPropertiesOnDeletion(dt.Id));
// then remove from the current doc type
Content[] objs = Content.getContentOfContentType(new ContentType(contentTypeId));
foreach (Content c in objs.ToList())
//Initially Content.getContentOfContentType() was called, but because this doesn't include members we resort to sql lookups and deletes
var tmp = new List<int>();
IRecordsReader dr = SqlHelper.ExecuteReader("SELECT nodeId FROM cmsContent INNER JOIN umbracoNode ON cmsContent.nodeId = umbracoNode.id WHERE ContentType = " + contentTypeId + " ORDER BY umbracoNode.text ");
while (dr.Read()) tmp.Add(dr.GetInt("nodeId"));
dr.Close();
foreach (var contentId in tmp)
{
Property prop = c.getProperty(this);
if (prop != null)
{
prop.delete();
}
SqlHelper.ExecuteNonQuery("DELETE FROM cmsPropertyData WHERE PropertyTypeId =" + this.Id + " AND contentNodeId = " + contentId);
}
// invalidate content type cache

View File

@@ -892,9 +892,6 @@ namespace umbraco.cms.businesslogic.web
foreach (var property in GenericProperties)
{
if (property.Value == null)
continue;
Content.SetValue(property.PropertyType.Alias, property.Value);
}
@@ -905,8 +902,6 @@ namespace umbraco.cms.businesslogic.web
ApplicationContext.Current.Services.ContentService.Save(Content, userId);
base.Save();
// update preview xml
SaveXmlPreview(new XmlDocument());
FireAfterSave(e);
}
@@ -935,8 +930,6 @@ namespace umbraco.cms.businesslogic.web
var result = ((ContentService)ApplicationContext.Current.Services.ContentService).SaveAndPublish(Content, true, u.Id);
base.Save();
// update preview xml
SaveXmlPreview(new XmlDocument());
FireAfterSave(e);

View File

@@ -5,7 +5,7 @@ using System.Text;
using System.Web.UI;
using ClientDependency.Core.Controls;
using ClientDependency.Core.FileRegistration.Providers;
using umbraco.IO;
using Umbraco.Core.IO;
namespace umbraco.uicontrols
{
@@ -22,7 +22,7 @@ namespace umbraco.uicontrols
public UmbracoClientDependencyLoader()
: base()
{
this.AddPath("UmbracoClient", IOHelper.ResolveUrl( SystemDirectories.Umbraco_client ));
this.AddPath("UmbracoClient", IOHelper.ResolveUrl( SystemDirectories.UmbracoClient ));
this.AddPath("UmbracoRoot", IOHelper.ResolveUrl( SystemDirectories.Umbraco ));
this.ProviderName = LoaderControlProvider.DefaultName;
@@ -32,7 +32,7 @@ namespace umbraco.uicontrols
{
if (ClientDependencyLoader.Instance == null)
{
UmbracoClientDependencyLoader loader = new UmbracoClientDependencyLoader();
var loader = new UmbracoClientDependencyLoader();
parent.Controls.Add(loader);
isNew = true;
return loader;

View File

@@ -259,45 +259,5 @@ namespace umbraco.DataLayer.Utility.Installer
#endregion
}
/// <summary>
/// A triple (Field, Table, Version) meaning:
/// if a <c>SELECT</c> statement of <c>Field FROM Table</c> succeeds,
/// the database version is at least <c>Version</c>.
/// </summary>
/// <remarks>
/// This also supports checking for a value in a table.
/// </remarks>
public struct VersionSpecs
{
/// <summary>The SQL statament to execute in order to test for the specified version</summary>
public readonly string Sql;
/// <summary>An integer identifying the expected row count from the Sql statement</summary>
public readonly int ExpectedRows;
/// <summary>The minimum version number of a database that contains the specified field.</summary>
public readonly DatabaseVersion Version;
/// <summary>
/// Initializes a new instance of the <see cref="VersionSpecs"/> struct.
/// </summary>
/// <param name="sql">The sql statement to execute.</param>
/// <param name="version">The version.</param>
public VersionSpecs(string sql, DatabaseVersion version)
: this(sql, -1, version)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="VersionSpecs"/> struct.
/// </summary>
/// <param name="sql">The sql statement to execute.</param>
/// <param name="expectedRows">The expected row count.</param>
/// <param name="version">The version.</param>
public VersionSpecs(string sql, int expectedRows, DatabaseVersion version)
{
Sql = sql;
ExpectedRows = expectedRows;
Version = version;
}
}
}

View File

@@ -0,0 +1,44 @@
namespace umbraco.DataLayer.Utility.Installer
{
/// <summary>
/// A triple (Field, Table, Version) meaning:
/// if a <c>SELECT</c> statement of <c>Field FROM Table</c> succeeds,
/// the database version is at least <c>Version</c>.
/// </summary>
/// <remarks>
/// This also supports checking for a value in a table.
/// </remarks>
public struct VersionSpecs
{
/// <summary>The SQL statament to execute in order to test for the specified version</summary>
public readonly string Sql;
/// <summary>An integer identifying the expected row count from the Sql statement</summary>
public readonly int ExpectedRows;
/// <summary>The minimum version number of a database that contains the specified field.</summary>
public readonly DatabaseVersion Version;
/// <summary>
/// Initializes a new instance of the <see cref="VersionSpecs"/> struct.
/// </summary>
/// <param name="sql">The sql statement to execute.</param>
/// <param name="version">The version.</param>
public VersionSpecs(string sql, DatabaseVersion version)
: this(sql, -1, version)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="VersionSpecs"/> struct.
/// </summary>
/// <param name="sql">The sql statement to execute.</param>
/// <param name="expectedRows">The expected row count.</param>
/// <param name="version">The version.</param>
public VersionSpecs(string sql, int expectedRows, DatabaseVersion version)
{
Sql = sql;
ExpectedRows = expectedRows;
Version = version;
}
}
}

View File

@@ -124,6 +124,7 @@
<Compile Include="Utility\BaseUtility.cs" />
<Compile Include="Utility\Installer\DatabaseVersion.cs" />
<Compile Include="Utility\Installer\DefaultInstallerUtility.cs" />
<Compile Include="Utility\Installer\VersionSpecs.cs" />
<Compile Include="Utility\Table\DefaultField.cs" />
<Compile Include="Utility\Table\DefaultTable.cs" />
<Compile Include="Utility\Table\FieldProperties.cs" />

View File

@@ -11,7 +11,7 @@ namespace umbraco.editorControls.datepicker
public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d)
{
if (Value.ToString() != "")
if (Value != null && Value.ToString() != "")
return d.CreateTextNode(((DateTime) Value).ToString("s"));
else
return d.CreateTextNode("");

View File

@@ -246,13 +246,13 @@ namespace umbraco.webservices.documents
case documentCarrier.EPublishAction.Publish:
if (doc.PublishWithResult(user))
{
umbraco.library.UpdateDocumentCache(doc.Id);
umbraco.library.UpdateDocumentCache(doc);
}
break;
case documentCarrier.EPublishAction.Unpublish:
if (doc.PublishWithResult(user))
{
umbraco.library.UnPublishSingleNode(doc.Id);
umbraco.library.UnPublishSingleNode(doc);
}
break;
case documentCarrier.EPublishAction.Ignore:
@@ -260,14 +260,14 @@ namespace umbraco.webservices.documents
{
if (doc.PublishWithResult(user))
{
umbraco.library.UpdateDocumentCache(doc.Id);
umbraco.library.UpdateDocumentCache(doc);
}
}
else
{
if (doc.PublishWithResult(user))
{
umbraco.library.UpdateDocumentCache(doc.Id);
umbraco.library.UpdateDocumentCache(doc);
}
}
break;