Adhering to Umbraco's Coding Standards
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -9,85 +9,85 @@ using Umbraco.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
public interface IContentRepository : IRepositoryVersionable<int, IContent>, IRecycleBinRepository<IContent>, IDeleteMediaFilesRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the count of published items
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// We require this on the repo because the IQuery{IContent} cannot supply the 'newest' parameter
|
||||
/// </remarks>
|
||||
int CountPublished();
|
||||
public interface IContentRepository : IRepositoryVersionable<int, IContent>, IRecycleBinRepository<IContent>, IDeleteMediaFilesRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the count of published items
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// We require this on the repo because the IQuery{IContent} cannot supply the 'newest' parameter
|
||||
/// </remarks>
|
||||
int CountPublished();
|
||||
|
||||
/// <summary>
|
||||
/// Used to bulk update the permissions set for a content item. This will replace all permissions
|
||||
/// assigned to an entity with a list of user id & permission pairs.
|
||||
/// </summary>
|
||||
/// <param name="permissionSet"></param>
|
||||
void ReplaceContentPermissions(EntityPermissionSet permissionSet);
|
||||
/// <summary>
|
||||
/// Used to bulk update the permissions set for a content item. This will replace all permissions
|
||||
/// assigned to an entity with a list of user id & permission pairs.
|
||||
/// </summary>
|
||||
/// <param name="permissionSet"></param>
|
||||
void ReplaceContentPermissions(EntityPermissionSet permissionSet);
|
||||
|
||||
/// <summary>
|
||||
/// Clears the published flag for a content.
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
void ClearPublished(IContent content);
|
||||
/// <summary>
|
||||
/// Clears the published flag for a content.
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
void ClearPublished(IContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all published Content by the specified query
|
||||
/// </summary>
|
||||
/// <param name="query">Query to execute against published versions</param>
|
||||
/// <returns>An enumerable list of <see cref="IContent"/></returns>
|
||||
IEnumerable<IContent> GetByPublishedVersion(IQuery<IContent> query);
|
||||
/// <summary>
|
||||
/// Gets all published Content by the specified query
|
||||
/// </summary>
|
||||
/// <param name="query">Query to execute against published versions</param>
|
||||
/// <returns>An enumerable list of <see cref="IContent"/></returns>
|
||||
IEnumerable<IContent> GetByPublishedVersion(IQuery<IContent> query);
|
||||
|
||||
/// <summary>
|
||||
/// Assigns a single permission to the current content item for the specified user ids
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="permission"></param>
|
||||
/// <param name="userIds"></param>
|
||||
void AssignEntityPermission(IContent entity, char permission, IEnumerable<int> userIds);
|
||||
/// <summary>
|
||||
/// Assigns a single permission to the current content item for the specified user ids
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <param name="permission"></param>
|
||||
/// <param name="userIds"></param>
|
||||
void AssignEntityPermission(IContent entity, char permission, IEnumerable<int> userIds);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of permissions for the content item
|
||||
/// </summary>
|
||||
/// <param name="entityId"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<EntityPermission> GetPermissionsForEntity(int entityId);
|
||||
/// <summary>
|
||||
/// Gets the list of permissions for the content item
|
||||
/// </summary>
|
||||
/// <param name="entityId"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<EntityPermission> GetPermissionsForEntity(int entityId);
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IContent content, Func<IContent, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IContent content, Func<IContent, XElement> xml);
|
||||
|
||||
/// <summary>
|
||||
/// Used to remove the content xml for a content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
void DeleteContentXml(IContent content);
|
||||
/// <summary>
|
||||
/// Used to remove the content xml for a content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
void DeleteContentXml(IContent content);
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IContent content, Func<IContent, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IContent content, Func<IContent, XElement> xml);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged content results
|
||||
/// </summary>
|
||||
/// <param name="query">Query to excute</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IContent> GetPagedResultsByQuery(IQuery<IContent> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets paged content results
|
||||
/// </summary>
|
||||
/// <param name="query">Query to excute</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IContent> GetPagedResultsByQuery(IQuery<IContent> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
}
|
||||
}
|
||||
@@ -7,36 +7,36 @@ using Umbraco.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
public interface IMediaRepository : IRepositoryVersionable<int, IMedia>, IRecycleBinRepository<IMedia>, IDeleteMediaFilesRepository
|
||||
{
|
||||
public interface IMediaRepository : IRepositoryVersionable<int, IMedia>, IRecycleBinRepository<IMedia>, IDeleteMediaFilesRepository
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the media item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IMedia content, Func<IMedia, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the media item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IMedia content, Func<IMedia, XElement> xml);
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IMedia content, Func<IMedia, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IMedia content, Func<IMedia, XElement> xml);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged media results
|
||||
/// </summary>
|
||||
/// <param name="query">Query to excute</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedResultsByQuery(IQuery<IMedia> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets paged media results
|
||||
/// </summary>
|
||||
/// <param name="query">Query to excute</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedResultsByQuery(IQuery<IMedia> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
}
|
||||
}
|
||||
@@ -9,70 +9,70 @@ using Umbraco.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Core.Persistence.Repositories
|
||||
{
|
||||
public interface IMemberRepository : IRepositoryVersionable<int, IMember>, IDeleteMediaFilesRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Finds members in a given role
|
||||
/// </summary>
|
||||
/// <param name="roleName"></param>
|
||||
/// <param name="usernameToMatch"></param>
|
||||
/// <param name="matchType"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> FindMembersInRole(string roleName, string usernameToMatch, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
public interface IMemberRepository : IRepositoryVersionable<int, IMember>, IDeleteMediaFilesRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Finds members in a given role
|
||||
/// </summary>
|
||||
/// <param name="roleName"></param>
|
||||
/// <param name="usernameToMatch"></param>
|
||||
/// <param name="matchType"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> FindMembersInRole(string roleName, string usernameToMatch, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
|
||||
/// <summary>
|
||||
/// Get all members in a specific group
|
||||
/// </summary>
|
||||
/// <param name="groupName"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> GetByMemberGroup(string groupName);
|
||||
/// <summary>
|
||||
/// Get all members in a specific group
|
||||
/// </summary>
|
||||
/// <param name="groupName"></param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> GetByMemberGroup(string groupName);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a member with the username exists
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <returns></returns>
|
||||
bool Exists(string username);
|
||||
/// <summary>
|
||||
/// Checks if a member with the username exists
|
||||
/// </summary>
|
||||
/// <param name="username"></param>
|
||||
/// <returns></returns>
|
||||
bool Exists(string username);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the count of items based on a complex query
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
int GetCountByQuery(IQuery<IMember> query);
|
||||
/// <summary>
|
||||
/// Gets the count of items based on a complex query
|
||||
/// </summary>
|
||||
/// <param name="query"></param>
|
||||
/// <returns></returns>
|
||||
int GetCountByQuery(IQuery<IMember> query);
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged member results
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <param name="pageIndex">Index of the page.</param>
|
||||
/// <param name="pageSize">Size of the page.</param>
|
||||
/// <param name="totalRecords">The total records.</param>
|
||||
/// <param name="orderBy">The order by column</param>
|
||||
/// <param name="orderDirection">The order direction.</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search query</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> GetPagedResultsByQuery(IQuery<IMember> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
/// <summary>
|
||||
/// Gets paged member results
|
||||
/// </summary>
|
||||
/// <param name="query">The query.</param>
|
||||
/// <param name="pageIndex">Index of the page.</param>
|
||||
/// <param name="pageSize">Size of the page.</param>
|
||||
/// <param name="totalRecords">The total records.</param>
|
||||
/// <param name="orderBy">The order by column</param>
|
||||
/// <param name="orderDirection">The order direction.</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search query</param>
|
||||
/// <returns></returns>
|
||||
IEnumerable<IMember> GetPagedResultsByQuery(IQuery<IMember> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField, string filter = "");
|
||||
|
||||
//IEnumerable<IMember> GetPagedResultsByQuery<TDto>(
|
||||
// Sql sql, int pageIndex, int pageSize, out int totalRecords,
|
||||
// Func<IEnumerable<TDto>, int[]> resolveIds);
|
||||
//IEnumerable<IMember> GetPagedResultsByQuery<TDto>(
|
||||
// Sql sql, int pageIndex, int pageSize, out int totalRecords,
|
||||
// Func<IEnumerable<TDto>, int[]> resolveIds);
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the media item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IMember content, Func<IMember, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update published xml for the media item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdateContentXml(IMember content, Func<IMember, XElement> xml);
|
||||
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IMember content, Func<IMember, XElement> xml);
|
||||
/// <summary>
|
||||
/// Used to add/update preview xml for the content item
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
void AddOrUpdatePreviewXml(IMember content, Func<IMember, XElement> xml);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,79 +6,79 @@ using Umbraco.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines an SqlSyntaxProvider
|
||||
/// </summary>
|
||||
public interface ISqlSyntaxProvider
|
||||
{
|
||||
string EscapeString(string val);
|
||||
/// <summary>
|
||||
/// Defines an SqlSyntaxProvider
|
||||
/// </summary>
|
||||
public interface ISqlSyntaxProvider
|
||||
{
|
||||
string EscapeString(string val);
|
||||
|
||||
string GetWildcardPlaceholder();
|
||||
string GetStringColumnEqualComparison(string column, int paramIndex, TextColumnType columnType);
|
||||
string GetStringColumnWildcardComparison(string column, int paramIndex, TextColumnType columnType);
|
||||
string GetWildcardPlaceholder();
|
||||
string GetStringColumnEqualComparison(string column, int paramIndex, TextColumnType columnType);
|
||||
string GetStringColumnWildcardComparison(string column, int paramIndex, TextColumnType columnType);
|
||||
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnEqualComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnStartsWithComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnEndsWithComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnContainsComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnWildcardComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnEqualComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnStartsWithComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnEndsWithComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnContainsComparison(string column, string value, TextColumnType columnType);
|
||||
[Obsolete("Use the overload with the parameter index instead")]
|
||||
string GetStringColumnWildcardComparison(string column, string value, TextColumnType columnType);
|
||||
|
||||
string GetQuotedTableName(string tableName);
|
||||
string GetQuotedColumnName(string columnName);
|
||||
string GetQuotedName(string name);
|
||||
bool DoesTableExist(Database db, string tableName);
|
||||
string GetIndexType(IndexTypes indexTypes);
|
||||
string GetSpecialDbType(SpecialDbTypes dbTypes);
|
||||
string CreateTable { get; }
|
||||
string DropTable { get; }
|
||||
string AddColumn { get; }
|
||||
string DropColumn { get; }
|
||||
string AlterColumn { get; }
|
||||
string RenameColumn { get; }
|
||||
string RenameTable { get; }
|
||||
string CreateSchema { get; }
|
||||
string AlterSchema { get; }
|
||||
string DropSchema { get; }
|
||||
string CreateIndex { get; }
|
||||
string DropIndex { get; }
|
||||
string InsertData { get; }
|
||||
string UpdateData { get; }
|
||||
string DeleteData { get; }
|
||||
string TruncateTable { get; }
|
||||
string CreateConstraint { get; }
|
||||
string DeleteConstraint { get; }
|
||||
string CreateForeignKeyConstraint { get; }
|
||||
string DeleteDefaultConstraint { get; }
|
||||
string FormatDateTime(DateTime date, bool includeTime = true);
|
||||
string Format(TableDefinition table);
|
||||
string Format(IEnumerable<ColumnDefinition> columns);
|
||||
List<string> Format(IEnumerable<IndexDefinition> indexes);
|
||||
List<string> Format(IEnumerable<ForeignKeyDefinition> foreignKeys);
|
||||
string FormatPrimaryKey(TableDefinition table);
|
||||
string GetQuotedValue(string value);
|
||||
string Format(ColumnDefinition column);
|
||||
string Format(IndexDefinition index);
|
||||
string Format(ForeignKeyDefinition foreignKey);
|
||||
string FormatColumnRename(string tableName, string oldName, string newName);
|
||||
string FormatTableRename(string oldName, string newName);
|
||||
bool SupportsClustered();
|
||||
bool SupportsIdentityInsert();
|
||||
bool? SupportsCaseInsensitiveQueries(Database db);
|
||||
string GetQuotedTableName(string tableName);
|
||||
string GetQuotedColumnName(string columnName);
|
||||
string GetQuotedName(string name);
|
||||
bool DoesTableExist(Database db, string tableName);
|
||||
string GetIndexType(IndexTypes indexTypes);
|
||||
string GetSpecialDbType(SpecialDbTypes dbTypes);
|
||||
string CreateTable { get; }
|
||||
string DropTable { get; }
|
||||
string AddColumn { get; }
|
||||
string DropColumn { get; }
|
||||
string AlterColumn { get; }
|
||||
string RenameColumn { get; }
|
||||
string RenameTable { get; }
|
||||
string CreateSchema { get; }
|
||||
string AlterSchema { get; }
|
||||
string DropSchema { get; }
|
||||
string CreateIndex { get; }
|
||||
string DropIndex { get; }
|
||||
string InsertData { get; }
|
||||
string UpdateData { get; }
|
||||
string DeleteData { get; }
|
||||
string TruncateTable { get; }
|
||||
string CreateConstraint { get; }
|
||||
string DeleteConstraint { get; }
|
||||
string CreateForeignKeyConstraint { get; }
|
||||
string DeleteDefaultConstraint { get; }
|
||||
string FormatDateTime(DateTime date, bool includeTime = true);
|
||||
string Format(TableDefinition table);
|
||||
string Format(IEnumerable<ColumnDefinition> columns);
|
||||
List<string> Format(IEnumerable<IndexDefinition> indexes);
|
||||
List<string> Format(IEnumerable<ForeignKeyDefinition> foreignKeys);
|
||||
string FormatPrimaryKey(TableDefinition table);
|
||||
string GetQuotedValue(string value);
|
||||
string Format(ColumnDefinition column);
|
||||
string Format(IndexDefinition index);
|
||||
string Format(ForeignKeyDefinition foreignKey);
|
||||
string FormatColumnRename(string tableName, string oldName, string newName);
|
||||
string FormatTableRename(string oldName, string newName);
|
||||
bool SupportsClustered();
|
||||
bool SupportsIdentityInsert();
|
||||
bool? SupportsCaseInsensitiveQueries(Database db);
|
||||
|
||||
string IsNull { get; }
|
||||
string ConvertIntegerToOrderableString { get; }
|
||||
string ConvertDateToOrderableString { get; }
|
||||
string IsNull { get; }
|
||||
string ConvertIntegerToOrderableString { get; }
|
||||
string ConvertDateToOrderableString { get; }
|
||||
|
||||
IEnumerable<string> GetTablesInSchema(Database db);
|
||||
IEnumerable<ColumnInfo> GetColumnsInSchema(Database db);
|
||||
IEnumerable<Tuple<string, string>> GetConstraintsPerTable(Database db);
|
||||
IEnumerable<Tuple<string, string, string>> GetConstraintsPerColumn(Database db);
|
||||
IEnumerable<string> GetTablesInSchema(Database db);
|
||||
IEnumerable<ColumnInfo> GetColumnsInSchema(Database db);
|
||||
IEnumerable<Tuple<string, string>> GetConstraintsPerTable(Database db);
|
||||
IEnumerable<Tuple<string, string, string>> GetConstraintsPerColumn(Database db);
|
||||
|
||||
IEnumerable<Tuple<string, string, string, bool>> GetDefinedIndexes(Database db);
|
||||
}
|
||||
IEnumerable<Tuple<string, string, string, bool>> GetDefinedIndexes(Database db);
|
||||
}
|
||||
}
|
||||
@@ -7,393 +7,393 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Persistence.SqlSyntax
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an SqlSyntaxProvider for MySql
|
||||
/// </summary>
|
||||
[SqlSyntaxProviderAttribute("MySql.Data.MySqlClient")]
|
||||
public class MySqlSyntaxProvider : SqlSyntaxProviderBase<MySqlSyntaxProvider>
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
/// <summary>
|
||||
/// Represents an SqlSyntaxProvider for MySql
|
||||
/// </summary>
|
||||
[SqlSyntaxProviderAttribute("MySql.Data.MySqlClient")]
|
||||
public class MySqlSyntaxProvider : SqlSyntaxProviderBase<MySqlSyntaxProvider>
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
public MySqlSyntaxProvider(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
public MySqlSyntaxProvider(ILogger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
|
||||
AutoIncrementDefinition = "AUTO_INCREMENT";
|
||||
IntColumnDefinition = "int(11)";
|
||||
BoolColumnDefinition = "tinyint(1)";
|
||||
DateTimeColumnDefinition = "TIMESTAMP";
|
||||
TimeColumnDefinition = "time";
|
||||
DecimalColumnDefinition = "decimal(38,6)";
|
||||
GuidColumnDefinition = "char(36)";
|
||||
AutoIncrementDefinition = "AUTO_INCREMENT";
|
||||
IntColumnDefinition = "int(11)";
|
||||
BoolColumnDefinition = "tinyint(1)";
|
||||
DateTimeColumnDefinition = "TIMESTAMP";
|
||||
TimeColumnDefinition = "time";
|
||||
DecimalColumnDefinition = "decimal(38,6)";
|
||||
GuidColumnDefinition = "char(36)";
|
||||
|
||||
DefaultValueFormat = "DEFAULT {0}";
|
||||
DefaultValueFormat = "DEFAULT {0}";
|
||||
|
||||
InitColumnTypeMap();
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> GetTablesInSchema(Database db)
|
||||
{
|
||||
List<string> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override IEnumerable<string> GetTablesInSchema(Database db)
|
||||
{
|
||||
List<string> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list = items.Select(x => x.TABLE_NAME).Cast<string>().ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list = items.Select(x => x.TABLE_NAME).Cast<string>().ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override IEnumerable<ColumnInfo> GetColumnsInSchema(Database db)
|
||||
{
|
||||
List<ColumnInfo> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override IEnumerable<ColumnInfo> GetColumnsInSchema(Database db)
|
||||
{
|
||||
List<ColumnInfo> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
items.Select(
|
||||
item =>
|
||||
new ColumnInfo(item.TABLE_NAME, item.COLUMN_NAME, int.Parse(item.ORDINAL_POSITION.ToString()), item.COLUMN_DEFAULT ?? "",
|
||||
item.IS_NULLABLE, item.DATA_TYPE)).ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
items.Select(
|
||||
item =>
|
||||
new ColumnInfo(item.TABLE_NAME, item.COLUMN_NAME, int.Parse(item.ORDINAL_POSITION.ToString()), item.COLUMN_DEFAULT ?? "",
|
||||
item.IS_NULLABLE, item.DATA_TYPE)).ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override IEnumerable<Tuple<string, string>> GetConstraintsPerTable(Database db)
|
||||
{
|
||||
List<Tuple<string, string>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override IEnumerable<Tuple<string, string>> GetConstraintsPerTable(Database db)
|
||||
{
|
||||
List<Tuple<string, string>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
//Does not include indexes and constraints are named differently
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list = items.Select(item => new Tuple<string, string>(item.TABLE_NAME, item.CONSTRAINT_NAME)).ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
//Does not include indexes and constraints are named differently
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list = items.Select(item => new Tuple<string, string>(item.TABLE_NAME, item.CONSTRAINT_NAME)).ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override IEnumerable<Tuple<string, string, string>> GetConstraintsPerColumn(Database db)
|
||||
{
|
||||
List<Tuple<string, string, string>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override IEnumerable<Tuple<string, string, string>> GetConstraintsPerColumn(Database db)
|
||||
{
|
||||
List<Tuple<string, string, string>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
//Does not include indexes and constraints are named differently
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
items.Select(
|
||||
item =>
|
||||
new Tuple<string, string, string>(item.TABLE_NAME, item.COLUMN_NAME, item.CONSTRAINT_NAME))
|
||||
.ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
//Does not include indexes and constraints are named differently
|
||||
var items =
|
||||
db.Fetch<dynamic>(
|
||||
"SELECT TABLE_NAME, COLUMN_NAME, CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_SCHEMA = @TableSchema",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
items.Select(
|
||||
item =>
|
||||
new Tuple<string, string, string>(item.TABLE_NAME, item.COLUMN_NAME, item.CONSTRAINT_NAME))
|
||||
.ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override IEnumerable<Tuple<string, string, string, bool>> GetDefinedIndexes(Database db)
|
||||
{
|
||||
List<Tuple<string, string, string, bool>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override IEnumerable<Tuple<string, string, string, bool>> GetDefinedIndexes(Database db)
|
||||
{
|
||||
List<Tuple<string, string, string, bool>> list;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
var indexes =
|
||||
db.Fetch<dynamic>(@"SELECT DISTINCT
|
||||
var indexes =
|
||||
db.Fetch<dynamic>(@"SELECT DISTINCT
|
||||
TABLE_NAME, INDEX_NAME, COLUMN_NAME, CASE NON_UNIQUE WHEN 1 THEN 0 ELSE 1 END AS `UNIQUE`
|
||||
FROM INFORMATION_SCHEMA.STATISTICS
|
||||
WHERE TABLE_SCHEMA = @TableSchema
|
||||
AND INDEX_NAME <> COLUMN_NAME AND INDEX_NAME <> 'PRIMARY'
|
||||
ORDER BY TABLE_NAME, INDEX_NAME",
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
indexes.Select(
|
||||
item =>
|
||||
new Tuple<string, string, string, bool>(item.TABLE_NAME, item.INDEX_NAME, item.COLUMN_NAME, item.UNIQUE == 1))
|
||||
.ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
new { TableSchema = db.Connection.Database });
|
||||
list =
|
||||
indexes.Select(
|
||||
item =>
|
||||
new Tuple<string, string, string, bool>(item.TABLE_NAME, item.INDEX_NAME, item.COLUMN_NAME, item.UNIQUE == 1))
|
||||
.ToList();
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public override bool DoesTableExist(Database db, string tableName)
|
||||
{
|
||||
long result;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
public override bool DoesTableExist(Database db, string tableName)
|
||||
{
|
||||
long result;
|
||||
try
|
||||
{
|
||||
//needs to be open to read the schema name
|
||||
db.OpenSharedConnection();
|
||||
|
||||
result =
|
||||
db.ExecuteScalar<long>("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " +
|
||||
"WHERE TABLE_NAME = @TableName AND " +
|
||||
"TABLE_SCHEMA = @TableSchema",
|
||||
new { TableName = tableName, TableSchema = db.Connection.Database });
|
||||
result =
|
||||
db.ExecuteScalar<long>("SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES " +
|
||||
"WHERE TABLE_NAME = @TableName AND " +
|
||||
"TABLE_SCHEMA = @TableSchema",
|
||||
new { TableName = tableName, TableSchema = db.Connection.Database });
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
|
||||
return result > 0;
|
||||
}
|
||||
return result > 0;
|
||||
}
|
||||
|
||||
public override bool SupportsClustered()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
public override bool SupportsClustered()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool SupportsIdentityInsert()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public override bool SupportsIdentityInsert()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This is used ONLY if we need to format datetime without using SQL parameters (i.e. during migrations)
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="includeTime"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// MySQL has a DateTime standard that is unambiguous and works on all servers:
|
||||
/// YYYYMMDDHHMMSS
|
||||
/// </remarks>
|
||||
public override string FormatDateTime(DateTime date, bool includeTime = true)
|
||||
{
|
||||
return includeTime ? date.ToString("yyyyMMddHHmmss") : date.ToString("yyyyMMdd");
|
||||
}
|
||||
/// <summary>
|
||||
/// This is used ONLY if we need to format datetime without using SQL parameters (i.e. during migrations)
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="includeTime"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// MySQL has a DateTime standard that is unambiguous and works on all servers:
|
||||
/// YYYYMMDDHHMMSS
|
||||
/// </remarks>
|
||||
public override string FormatDateTime(DateTime date, bool includeTime = true)
|
||||
{
|
||||
return includeTime ? date.ToString("yyyyMMddHHmmss") : date.ToString("yyyyMMdd");
|
||||
}
|
||||
|
||||
public override string GetQuotedTableName(string tableName)
|
||||
{
|
||||
return string.Format("`{0}`", tableName);
|
||||
}
|
||||
public override string GetQuotedTableName(string tableName)
|
||||
{
|
||||
return string.Format("`{0}`", tableName);
|
||||
}
|
||||
|
||||
public override string GetQuotedColumnName(string columnName)
|
||||
{
|
||||
return string.Format("`{0}`", columnName);
|
||||
}
|
||||
public override string GetQuotedColumnName(string columnName)
|
||||
{
|
||||
return string.Format("`{0}`", columnName);
|
||||
}
|
||||
|
||||
public override string GetQuotedName(string name)
|
||||
{
|
||||
return string.Format("`{0}`", name);
|
||||
}
|
||||
public override string GetQuotedName(string name)
|
||||
{
|
||||
return string.Format("`{0}`", name);
|
||||
}
|
||||
|
||||
public override string GetSpecialDbType(SpecialDbTypes dbTypes)
|
||||
{
|
||||
if (dbTypes == SpecialDbTypes.NCHAR)
|
||||
{
|
||||
return "CHAR";
|
||||
}
|
||||
else if (dbTypes == SpecialDbTypes.NTEXT)
|
||||
return "LONGTEXT";
|
||||
public override string GetSpecialDbType(SpecialDbTypes dbTypes)
|
||||
{
|
||||
if (dbTypes == SpecialDbTypes.NCHAR)
|
||||
{
|
||||
return "CHAR";
|
||||
}
|
||||
else if (dbTypes == SpecialDbTypes.NTEXT)
|
||||
return "LONGTEXT";
|
||||
|
||||
return "NVARCHAR";
|
||||
}
|
||||
return "NVARCHAR";
|
||||
}
|
||||
|
||||
public override string Format(TableDefinition table)
|
||||
{
|
||||
string primaryKey = string.Empty;
|
||||
var columnDefinition = table.Columns.FirstOrDefault(x => x.IsPrimaryKey);
|
||||
if (columnDefinition != null)
|
||||
{
|
||||
string columns = string.IsNullOrEmpty(columnDefinition.PrimaryKeyColumns)
|
||||
? GetQuotedColumnName(columnDefinition.Name)
|
||||
: string.Join(", ", columnDefinition.PrimaryKeyColumns
|
||||
.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(GetQuotedColumnName));
|
||||
public override string Format(TableDefinition table)
|
||||
{
|
||||
string primaryKey = string.Empty;
|
||||
var columnDefinition = table.Columns.FirstOrDefault(x => x.IsPrimaryKey);
|
||||
if (columnDefinition != null)
|
||||
{
|
||||
string columns = string.IsNullOrEmpty(columnDefinition.PrimaryKeyColumns)
|
||||
? GetQuotedColumnName(columnDefinition.Name)
|
||||
: string.Join(", ", columnDefinition.PrimaryKeyColumns
|
||||
.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(GetQuotedColumnName));
|
||||
|
||||
primaryKey = string.Format(", \nPRIMARY KEY {0} ({1})", columnDefinition.IsIndexed ? "CLUSTERED" : "NONCLUSTERED", columns);
|
||||
}
|
||||
primaryKey = string.Format(", \nPRIMARY KEY {0} ({1})", columnDefinition.IsIndexed ? "CLUSTERED" : "NONCLUSTERED", columns);
|
||||
}
|
||||
|
||||
var statement = string.Format(CreateTable, GetQuotedTableName(table.Name), Format(table.Columns), primaryKey);
|
||||
var statement = string.Format(CreateTable, GetQuotedTableName(table.Name), Format(table.Columns), primaryKey);
|
||||
|
||||
return statement;
|
||||
}
|
||||
return statement;
|
||||
}
|
||||
|
||||
public override string Format(IndexDefinition index)
|
||||
{
|
||||
string name = string.IsNullOrEmpty(index.Name)
|
||||
? string.Format("IX_{0}_{1}", index.TableName, index.ColumnName)
|
||||
: index.Name;
|
||||
public override string Format(IndexDefinition index)
|
||||
{
|
||||
string name = string.IsNullOrEmpty(index.Name)
|
||||
? string.Format("IX_{0}_{1}", index.TableName, index.ColumnName)
|
||||
: index.Name;
|
||||
|
||||
string columns = index.Columns.Any()
|
||||
? string.Join(",", index.Columns.Select(x => GetQuotedColumnName(x.Name)))
|
||||
: GetQuotedColumnName(index.ColumnName);
|
||||
string columns = index.Columns.Any()
|
||||
? string.Join(",", index.Columns.Select(x => GetQuotedColumnName(x.Name)))
|
||||
: GetQuotedColumnName(index.ColumnName);
|
||||
|
||||
return string.Format(CreateIndex,
|
||||
GetQuotedName(name),
|
||||
GetQuotedTableName(index.TableName),
|
||||
columns);
|
||||
}
|
||||
return string.Format(CreateIndex,
|
||||
GetQuotedName(name),
|
||||
GetQuotedTableName(index.TableName),
|
||||
columns);
|
||||
}
|
||||
|
||||
public override string Format(ForeignKeyDefinition foreignKey)
|
||||
{
|
||||
return string.Format(CreateForeignKeyConstraint,
|
||||
GetQuotedTableName(foreignKey.ForeignTable),
|
||||
GetQuotedColumnName(foreignKey.ForeignColumns.First()),
|
||||
GetQuotedTableName(foreignKey.PrimaryTable),
|
||||
GetQuotedColumnName(foreignKey.PrimaryColumns.First()),
|
||||
FormatCascade("DELETE", foreignKey.OnDelete),
|
||||
FormatCascade("UPDATE", foreignKey.OnUpdate));
|
||||
}
|
||||
public override string Format(ForeignKeyDefinition foreignKey)
|
||||
{
|
||||
return string.Format(CreateForeignKeyConstraint,
|
||||
GetQuotedTableName(foreignKey.ForeignTable),
|
||||
GetQuotedColumnName(foreignKey.ForeignColumns.First()),
|
||||
GetQuotedTableName(foreignKey.PrimaryTable),
|
||||
GetQuotedColumnName(foreignKey.PrimaryColumns.First()),
|
||||
FormatCascade("DELETE", foreignKey.OnDelete),
|
||||
FormatCascade("UPDATE", foreignKey.OnUpdate));
|
||||
}
|
||||
|
||||
public override string FormatPrimaryKey(TableDefinition table)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
public override string FormatPrimaryKey(TableDefinition table)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
protected override string FormatConstraint(ColumnDefinition column)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
protected override string FormatConstraint(ColumnDefinition column)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
protected override string FormatIdentity(ColumnDefinition column)
|
||||
{
|
||||
return column.IsIdentity ? AutoIncrementDefinition : string.Empty;
|
||||
}
|
||||
protected override string FormatIdentity(ColumnDefinition column)
|
||||
{
|
||||
return column.IsIdentity ? AutoIncrementDefinition : string.Empty;
|
||||
}
|
||||
|
||||
protected override string FormatDefaultValue(ColumnDefinition column)
|
||||
{
|
||||
if (column.DefaultValue == null)
|
||||
return string.Empty;
|
||||
protected override string FormatDefaultValue(ColumnDefinition column)
|
||||
{
|
||||
if (column.DefaultValue == null)
|
||||
return string.Empty;
|
||||
|
||||
//hack - probably not needed with latest changes
|
||||
if (column.DefaultValue.ToString().ToLower().Equals("getdate()".ToLower()))
|
||||
column.DefaultValue = SystemMethods.CurrentDateTime;
|
||||
//hack - probably not needed with latest changes
|
||||
if (column.DefaultValue.ToString().ToLower().Equals("getdate()".ToLower()))
|
||||
column.DefaultValue = SystemMethods.CurrentDateTime;
|
||||
|
||||
// see if this is for a system method
|
||||
if (column.DefaultValue is SystemMethods)
|
||||
{
|
||||
string method = FormatSystemMethods((SystemMethods)column.DefaultValue);
|
||||
if (string.IsNullOrEmpty(method))
|
||||
return string.Empty;
|
||||
// see if this is for a system method
|
||||
if (column.DefaultValue is SystemMethods)
|
||||
{
|
||||
string method = FormatSystemMethods((SystemMethods)column.DefaultValue);
|
||||
if (string.IsNullOrEmpty(method))
|
||||
return string.Empty;
|
||||
|
||||
return string.Format(DefaultValueFormat, method);
|
||||
}
|
||||
return string.Format(DefaultValueFormat, method);
|
||||
}
|
||||
|
||||
//needs quote
|
||||
return string.Format(DefaultValueFormat, string.Format("'{0}'", column.DefaultValue));
|
||||
}
|
||||
//needs quote
|
||||
return string.Format(DefaultValueFormat, string.Format("'{0}'", column.DefaultValue));
|
||||
}
|
||||
|
||||
protected override string FormatPrimaryKey(ColumnDefinition column)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
protected override string FormatPrimaryKey(ColumnDefinition column)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
protected override string FormatSystemMethods(SystemMethods systemMethod)
|
||||
{
|
||||
switch (systemMethod)
|
||||
{
|
||||
case SystemMethods.NewGuid:
|
||||
return null; // NOT SUPPORTED!
|
||||
//return "NEWID()";
|
||||
case SystemMethods.CurrentDateTime:
|
||||
return "CURRENT_TIMESTAMP";
|
||||
//case SystemMethods.NewSequentialId:
|
||||
// return "NEWSEQUENTIALID()";
|
||||
//case SystemMethods.CurrentUTCDateTime:
|
||||
// return "GETUTCDATE()";
|
||||
}
|
||||
protected override string FormatSystemMethods(SystemMethods systemMethod)
|
||||
{
|
||||
switch (systemMethod)
|
||||
{
|
||||
case SystemMethods.NewGuid:
|
||||
return null; // NOT SUPPORTED!
|
||||
//return "NEWID()";
|
||||
case SystemMethods.CurrentDateTime:
|
||||
return "CURRENT_TIMESTAMP";
|
||||
//case SystemMethods.NewSequentialId:
|
||||
// return "NEWSEQUENTIALID()";
|
||||
//case SystemMethods.CurrentUTCDateTime:
|
||||
// return "GETUTCDATE()";
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override string DeleteDefaultConstraint
|
||||
{
|
||||
get
|
||||
{
|
||||
return "ALTER TABLE {0} ALTER COLUMN {1} DROP DEFAULT";
|
||||
}
|
||||
}
|
||||
public override string DeleteDefaultConstraint
|
||||
{
|
||||
get
|
||||
{
|
||||
return "ALTER TABLE {0} ALTER COLUMN {1} DROP DEFAULT";
|
||||
}
|
||||
}
|
||||
|
||||
public override string AlterColumn { get { return "ALTER TABLE {0} MODIFY COLUMN {1}"; } }
|
||||
public override string AlterColumn { get { return "ALTER TABLE {0} MODIFY COLUMN {1}"; } }
|
||||
|
||||
//CREATE TABLE {0} ({1}) ENGINE = INNODB versus CREATE TABLE {0} ({1}) ENGINE = MYISAM ?
|
||||
public override string CreateTable { get { return "CREATE TABLE {0} ({1}{2})"; } }
|
||||
//CREATE TABLE {0} ({1}) ENGINE = INNODB versus CREATE TABLE {0} ({1}) ENGINE = MYISAM ?
|
||||
public override string CreateTable { get { return "CREATE TABLE {0} ({1}{2})"; } }
|
||||
|
||||
public override string CreateIndex { get { return "CREATE INDEX {0} ON {1} ({2})"; } }
|
||||
public override string CreateIndex { get { return "CREATE INDEX {0} ON {1} ({2})"; } }
|
||||
|
||||
public override string CreateForeignKeyConstraint { get { return "ALTER TABLE {0} ADD FOREIGN KEY ({1}) REFERENCES {2} ({3}){4}{5}"; } }
|
||||
public override string CreateForeignKeyConstraint { get { return "ALTER TABLE {0} ADD FOREIGN KEY ({1}) REFERENCES {2} ({3}){4}{5}"; } }
|
||||
|
||||
public override string DeleteConstraint { get { return "ALTER TABLE {0} DROP {1} {2}"; } }
|
||||
public override string DeleteConstraint { get { return "ALTER TABLE {0} DROP {1} {2}"; } }
|
||||
|
||||
public override string DropIndex { get { return "DROP INDEX {0} ON {1}"; } }
|
||||
public override string DropIndex { get { return "DROP INDEX {0} ON {1}"; } }
|
||||
|
||||
public override string RenameColumn { get { return "ALTER TABLE {0} CHANGE {1} {2}"; } }
|
||||
public override string IsNull { get { return "IFNULL({0},{1})"; } }
|
||||
public override string ConvertIntegerToOrderableString { get { return "LPAD({0}, 8, '0')"; } }
|
||||
public override string ConvertDateToOrderableString { get { return "DATE_FORMAT({0}, '%Y%m%d')"; } }
|
||||
public override string RenameColumn { get { return "ALTER TABLE {0} CHANGE {1} {2}"; } }
|
||||
public override string IsNull { get { return "IFNULL({0},{1})"; } }
|
||||
public override string ConvertIntegerToOrderableString { get { return "LPAD({0}, 8, '0')"; } }
|
||||
public override string ConvertDateToOrderableString { get { return "DATE_FORMAT({0}, '%Y%m%d')"; } }
|
||||
|
||||
public override bool? SupportsCaseInsensitiveQueries(Database db)
|
||||
{
|
||||
bool? supportsCaseInsensitiveQueries = null;
|
||||
public override bool? SupportsCaseInsensitiveQueries(Database db)
|
||||
{
|
||||
bool? supportsCaseInsensitiveQueries = null;
|
||||
|
||||
try
|
||||
{
|
||||
db.OpenSharedConnection();
|
||||
// Need 4 @ signs as it is regarded as a parameter, @@ escapes it once, @@@@ escapes it twice
|
||||
var lowerCaseTableNames = db.Fetch<int>("SELECT @@@@Global.lower_case_table_names");
|
||||
try
|
||||
{
|
||||
db.OpenSharedConnection();
|
||||
// Need 4 @ signs as it is regarded as a parameter, @@ escapes it once, @@@@ escapes it twice
|
||||
var lowerCaseTableNames = db.Fetch<int>("SELECT @@@@Global.lower_case_table_names");
|
||||
|
||||
if (lowerCaseTableNames.Any())
|
||||
supportsCaseInsensitiveQueries = lowerCaseTableNames.First() == 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error<MySqlSyntaxProvider>("Error querying for lower_case support", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
if (lowerCaseTableNames.Any())
|
||||
supportsCaseInsensitiveQueries = lowerCaseTableNames.First() == 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error<MySqlSyntaxProvider>("Error querying for lower_case support", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
db.CloseSharedConnection();
|
||||
}
|
||||
|
||||
// Could return null, which means testing failed,
|
||||
// add message to check with their hosting provider
|
||||
return supportsCaseInsensitiveQueries;
|
||||
}
|
||||
// Could return null, which means testing failed,
|
||||
// add message to check with their hosting provider
|
||||
return supportsCaseInsensitiveQueries;
|
||||
}
|
||||
|
||||
public override string EscapeString(string val)
|
||||
{
|
||||
return PetaPocoExtensions.EscapeAtSymbols(MySql.Data.MySqlClient.MySqlHelper.EscapeString(val));
|
||||
}
|
||||
}
|
||||
public override string EscapeString(string val)
|
||||
{
|
||||
return PetaPocoExtensions.EscapeAtSymbols(MySql.Data.MySqlClient.MySqlHelper.EscapeString(val));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,370 +7,370 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// A temporary interface until we are in v8, this is used to return a different result for the same method and this interface gets implemented
|
||||
/// explicitly. These methods will replace the normal ones in IContentService in v8 and this will be removed.
|
||||
/// </summary>
|
||||
public interface IMediaServiceOperations
|
||||
{
|
||||
//TODO: Remove this class in v8
|
||||
/// <summary>
|
||||
/// A temporary interface until we are in v8, this is used to return a different result for the same method and this interface gets implemented
|
||||
/// explicitly. These methods will replace the normal ones in IContentService in v8 and this will be removed.
|
||||
/// </summary>
|
||||
public interface IMediaServiceOperations
|
||||
{
|
||||
//TODO: Remove this class in v8
|
||||
|
||||
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
|
||||
//TODO: There's probably more that needs to be added like the EmptyRecycleBin, etc...
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an <see cref="IMedia"/> object by moving it to the Recycle Bin
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
Attempt<OperationStatus> MoveToRecycleBin(IMedia media, int userId = 0);
|
||||
/// <summary>
|
||||
/// Deletes an <see cref="IMedia"/> object by moving it to the Recycle Bin
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
Attempt<OperationStatus> MoveToRecycleBin(IMedia media, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Permanently deletes an <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that this method will completely remove the Media from the database,
|
||||
/// but current not from the file system.
|
||||
/// </remarks>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
Attempt<OperationStatus> Delete(IMedia media, int userId = 0);
|
||||
/// <summary>
|
||||
/// Permanently deletes an <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that this method will completely remove the Media from the database,
|
||||
/// but current not from the file system.
|
||||
/// </remarks>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
Attempt<OperationStatus> Delete(IMedia media, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
Attempt<OperationStatus> Save(IMedia media, int userId = 0, bool raiseEvents = true);
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
Attempt<OperationStatus> Save(IMedia media, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IMedia"/> objects
|
||||
/// </summary>
|
||||
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
Attempt<OperationStatus> Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
|
||||
}
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IMedia"/> objects
|
||||
/// </summary>
|
||||
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
Attempt<OperationStatus> Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the Media Service, which is an easy access to operations involving <see cref="IMedia"/>
|
||||
/// </summary>
|
||||
public interface IMediaService : IService
|
||||
{
|
||||
/// <summary>
|
||||
/// Rebuilds all xml content in the cmsContentXml table for all media
|
||||
/// </summary>
|
||||
/// <param name="contentTypeIds">
|
||||
/// Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures
|
||||
/// for all media
|
||||
/// </param>
|
||||
void RebuildXmlStructures(params int[] contentTypeIds);
|
||||
/// <summary>
|
||||
/// Defines the Media Service, which is an easy access to operations involving <see cref="IMedia"/>
|
||||
/// </summary>
|
||||
public interface IMediaService : IService
|
||||
{
|
||||
/// <summary>
|
||||
/// Rebuilds all xml content in the cmsContentXml table for all media
|
||||
/// </summary>
|
||||
/// <param name="contentTypeIds">
|
||||
/// Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures
|
||||
/// for all media
|
||||
/// </param>
|
||||
void RebuildXmlStructures(params int[] contentTypeIds);
|
||||
|
||||
int Count(string contentTypeAlias = null);
|
||||
int CountChildren(int parentId, string contentTypeAlias = null);
|
||||
int CountDescendants(int parentId, string contentTypeAlias = null);
|
||||
int Count(string contentTypeAlias = null);
|
||||
int CountChildren(int parentId, string contentTypeAlias = null);
|
||||
int CountDescendants(int parentId, string contentTypeAlias = null);
|
||||
|
||||
IEnumerable<IMedia> GetByIds(IEnumerable<int> ids);
|
||||
IEnumerable<IMedia> GetByIds(IEnumerable<int> ids);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0);
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMedia(string name, int parentId, string mediaTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Note that using this method will simply return a new IMedia without any identity
|
||||
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
|
||||
/// that does not invoke a save operation against the database.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object by Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Content to retrieve</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetById(int id);
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object by Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Content to retrieve</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetChildren(int id);
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetChildren(int id);
|
||||
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Children from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy = "Path", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy = "Path", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Descendants from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy = "Path", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Parent Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve Descendants from</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
IEnumerable<IMedia> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy = "Path", Direction orderDirection = Direction.Ascending, bool orderBySystemField = true, string filter = "");
|
||||
|
||||
/// <summary>
|
||||
/// Gets descendants of a <see cref="IMedia"/> object by its Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve descendants from</param>
|
||||
/// <returns>An Enumerable flat list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetDescendants(int id);
|
||||
/// <summary>
|
||||
/// Gets descendants of a <see cref="IMedia"/> object by its Id
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Parent to retrieve descendants from</param>
|
||||
/// <returns>An Enumerable flat list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetDescendants(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by the Id of the <see cref="IContentType"/>
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMediaType"/></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetMediaOfMediaType(int id);
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by the Id of the <see cref="IContentType"/>
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMediaType"/></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetMediaOfMediaType(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which reside at the first level / root
|
||||
/// </summary>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetRootMedia();
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which reside at the first level / root
|
||||
/// </summary>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetRootMedia();
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of an <see cref="IMedia"/> objects, which resides in the Recycle Bin
|
||||
/// </summary>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetMediaInRecycleBin();
|
||||
/// <summary>
|
||||
/// Gets a collection of an <see cref="IMedia"/> objects, which resides in the Recycle Bin
|
||||
/// </summary>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetMediaInRecycleBin();
|
||||
|
||||
/// <summary>
|
||||
/// Moves an <see cref="IMedia"/> object to a new location
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to move</param>
|
||||
/// <param name="parentId">Id of the Media's new Parent</param>
|
||||
/// <param name="userId">Id of the User moving the Media</param>
|
||||
void Move(IMedia media, int parentId, int userId = 0);
|
||||
/// <summary>
|
||||
/// Moves an <see cref="IMedia"/> object to a new location
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to move</param>
|
||||
/// <param name="parentId">Id of the Media's new Parent</param>
|
||||
/// <param name="userId">Id of the User moving the Media</param>
|
||||
void Move(IMedia media, int parentId, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an <see cref="IMedia"/> object by moving it to the Recycle Bin
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
void MoveToRecycleBin(IMedia media, int userId = 0);
|
||||
/// <summary>
|
||||
/// Deletes an <see cref="IMedia"/> object by moving it to the Recycle Bin
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
void MoveToRecycleBin(IMedia media, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Empties the Recycle Bin by deleting all <see cref="IMedia"/> that resides in the bin
|
||||
/// </summary>
|
||||
void EmptyRecycleBin();
|
||||
/// <summary>
|
||||
/// Empties the Recycle Bin by deleting all <see cref="IMedia"/> that resides in the bin
|
||||
/// </summary>
|
||||
void EmptyRecycleBin();
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all media of specified type. All children of deleted media is moved to Recycle Bin.
|
||||
/// </summary>
|
||||
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
|
||||
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional Id of the user deleting Media</param>
|
||||
void DeleteMediaOfType(int mediaTypeId, int userId = 0);
|
||||
/// <summary>
|
||||
/// Deletes all media of specified type. All children of deleted media is moved to Recycle Bin.
|
||||
/// </summary>
|
||||
/// <remarks>This needs extra care and attention as its potentially a dangerous and extensive operation</remarks>
|
||||
/// <param name="mediaTypeId">Id of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional Id of the user deleting Media</param>
|
||||
void DeleteMediaOfType(int mediaTypeId, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Permanently deletes an <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that this method will completely remove the Media from the database,
|
||||
/// but current not from the file system.
|
||||
/// </remarks>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
void Delete(IMedia media, int userId = 0);
|
||||
/// <summary>
|
||||
/// Permanently deletes an <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Please note that this method will completely remove the Media from the database,
|
||||
/// but current not from the file system.
|
||||
/// </remarks>
|
||||
/// <param name="media">The <see cref="IMedia"/> to delete</param>
|
||||
/// <param name="userId">Id of the User deleting the Media</param>
|
||||
void Delete(IMedia media, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
void Save(IMedia media, int userId = 0, bool raiseEvents = true);
|
||||
/// <summary>
|
||||
/// Saves a single <see cref="IMedia"/> object
|
||||
/// </summary>
|
||||
/// <param name="media">The <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
void Save(IMedia media, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IMedia"/> objects
|
||||
/// </summary>
|
||||
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
void Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
|
||||
/// <summary>
|
||||
/// Saves a collection of <see cref="IMedia"/> objects
|
||||
/// </summary>
|
||||
/// <param name="medias">Collection of <see cref="IMedia"/> to save</param>
|
||||
/// <param name="userId">Id of the User saving the Media</param>
|
||||
/// <param name="raiseEvents">Optional boolean indicating whether or not to raise events.</param>
|
||||
void Save(IEnumerable<IMedia> medias, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object by its 'UniqueId'
|
||||
/// </summary>
|
||||
/// <param name="key">Guid key of the Media to retrieve</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetById(Guid key);
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object by its 'UniqueId'
|
||||
/// </summary>
|
||||
/// <param name="key">Guid key of the Media to retrieve</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetById(Guid key);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Level
|
||||
/// </summary>
|
||||
/// <param name="level">The level to retrieve Media from</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetByLevel(int level);
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects by Level
|
||||
/// </summary>
|
||||
/// <param name="level">The level to retrieve Media from</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetByLevel(int level);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific version of an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="versionId">Id of the version to retrieve</param>
|
||||
/// <returns>An <see cref="IMedia"/> item</returns>
|
||||
IMedia GetByVersion(Guid versionId);
|
||||
/// <summary>
|
||||
/// Gets a specific version of an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="versionId">Id of the version to retrieve</param>
|
||||
/// <returns>An <see cref="IMedia"/> item</returns>
|
||||
IMedia GetByVersion(Guid versionId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of an <see cref="IMedia"/> objects versions by Id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetVersions(int id);
|
||||
/// <summary>
|
||||
/// Gets a collection of an <see cref="IMedia"/> objects versions by Id
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetVersions(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether an <see cref="IMedia"/> item has any children
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/></param>
|
||||
/// <returns>True if the media has any children otherwise False</returns>
|
||||
bool HasChildren(int id);
|
||||
/// <summary>
|
||||
/// Checks whether an <see cref="IMedia"/> item has any children
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/></param>
|
||||
/// <returns>True if the media has any children otherwise False</returns>
|
||||
bool HasChildren(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Permanently deletes versions from an <see cref="IMedia"/> object prior to a specific date.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> object to delete versions from</param>
|
||||
/// <param name="versionDate">Latest version date</param>
|
||||
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
|
||||
void DeleteVersions(int id, DateTime versionDate, int userId = 0);
|
||||
/// <summary>
|
||||
/// Permanently deletes versions from an <see cref="IMedia"/> object prior to a specific date.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> object to delete versions from</param>
|
||||
/// <param name="versionDate">Latest version date</param>
|
||||
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
|
||||
void DeleteVersions(int id, DateTime versionDate, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Permanently deletes specific version(s) from an <see cref="IMedia"/> object.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> object to delete a version from</param>
|
||||
/// <param name="versionId">Id of the version to delete</param>
|
||||
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
|
||||
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
|
||||
void DeleteVersion(int id, Guid versionId, bool deletePriorVersions, int userId = 0);
|
||||
/// <summary>
|
||||
/// Permanently deletes specific version(s) from an <see cref="IMedia"/> object.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> object to delete a version from</param>
|
||||
/// <param name="versionId">Id of the version to delete</param>
|
||||
/// <param name="deletePriorVersions">Boolean indicating whether to delete versions prior to the versionId</param>
|
||||
/// <param name="userId">Optional Id of the User deleting versions of a Content object</param>
|
||||
void DeleteVersion(int id, Guid versionId, bool deletePriorVersions, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object from the path stored in the 'umbracoFile' property.
|
||||
/// </summary>
|
||||
/// <param name="mediaPath">Path of the media item to retrieve (for example: /media/1024/koala_403x328.jpg)</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetMediaByPath(string mediaPath);
|
||||
/// <summary>
|
||||
/// Gets an <see cref="IMedia"/> object from the path stored in the 'umbracoFile' property.
|
||||
/// </summary>
|
||||
/// <param name="mediaPath">Path of the media item to retrieve (for example: /media/1024/koala_403x328.jpg)</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia GetMediaByPath(string mediaPath);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which are ancestors of the current media.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetAncestors(int id);
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which are ancestors of the current media.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetAncestors(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which are ancestors of the current media.
|
||||
/// </summary>
|
||||
/// <param name="media"><see cref="IMedia"/> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetAncestors(IMedia media);
|
||||
/// <summary>
|
||||
/// Gets a collection of <see cref="IMedia"/> objects, which are ancestors of the current media.
|
||||
/// </summary>
|
||||
/// <param name="media"><see cref="IMedia"/> to retrieve ancestors for</param>
|
||||
/// <returns>An Enumerable list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetAncestors(IMedia media);
|
||||
|
||||
/// <summary>
|
||||
/// Gets descendants of a <see cref="IMedia"/> object by its Id
|
||||
/// </summary>
|
||||
/// <param name="media">The Parent <see cref="IMedia"/> object to retrieve descendants from</param>
|
||||
/// <returns>An Enumerable flat list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetDescendants(IMedia media);
|
||||
/// <summary>
|
||||
/// Gets descendants of a <see cref="IMedia"/> object by its Id
|
||||
/// </summary>
|
||||
/// <param name="media">The Parent <see cref="IMedia"/> object to retrieve descendants from</param>
|
||||
/// <returns>An Enumerable flat list of <see cref="IMedia"/> objects</returns>
|
||||
IEnumerable<IMedia> GetDescendants(IMedia media);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent of the current media as an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> to retrieve the parent from</param>
|
||||
/// <returns>Parent <see cref="IMedia"/> object</returns>
|
||||
IMedia GetParent(int id);
|
||||
/// <summary>
|
||||
/// Gets the parent of the current media as an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the <see cref="IMedia"/> to retrieve the parent from</param>
|
||||
/// <returns>Parent <see cref="IMedia"/> object</returns>
|
||||
IMedia GetParent(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the parent of the current media as an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="media"><see cref="IMedia"/> to retrieve the parent from</param>
|
||||
/// <returns>Parent <see cref="IMedia"/> object</returns>
|
||||
IMedia GetParent(IMedia media);
|
||||
/// <summary>
|
||||
/// Gets the parent of the current media as an <see cref="IMedia"/> item.
|
||||
/// </summary>
|
||||
/// <param name="media"><see cref="IMedia"/> to retrieve the parent from</param>
|
||||
/// <returns>Parent <see cref="IMedia"/> object</returns>
|
||||
IMedia GetParent(IMedia media);
|
||||
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IMedia"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true);
|
||||
/// <summary>
|
||||
/// Sorts a collection of <see cref="IMedia"/> objects by updating the SortOrder according
|
||||
/// to the ordering of items in the passed in <see cref="IEnumerable{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="items"></param>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="raiseEvents"></param>
|
||||
/// <returns>True if sorting succeeded, otherwise False</returns>
|
||||
bool Sort(IEnumerable<IMedia> items, int userId = 0, bool raiseEvents = true);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, IMedia parent, string mediaTypeAlias, int userId = 0);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0);
|
||||
}
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
|
||||
/// that this Media should based on.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method returns an <see cref="IMedia"/> object that has been persisted to the database
|
||||
/// and therefor has an identity.
|
||||
/// </remarks>
|
||||
/// <param name="name">Name of the Media object</param>
|
||||
/// <param name="parentId">Id of Parent for the new Media item</param>
|
||||
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
|
||||
/// <param name="userId">Optional id of the user creating the media item</param>
|
||||
/// <returns><see cref="IMedia"/></returns>
|
||||
IMedia CreateMediaWithIdentity(string name, int parentId, string mediaTypeAlias, int userId = 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,214 +8,214 @@ using Umbraco.Core.Persistence.Querying;
|
||||
|
||||
namespace Umbraco.Core.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the MemberService, which is an easy access to operations involving (umbraco) members.
|
||||
/// </summary>
|
||||
public interface IMemberService : IMembershipMemberService
|
||||
{
|
||||
/// <summary>
|
||||
/// Rebuilds all xml content in the cmsContentXml table for all documents
|
||||
/// </summary>
|
||||
/// <param name="contentTypeIds">
|
||||
/// Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures
|
||||
/// for all content
|
||||
/// </param>
|
||||
void RebuildXmlStructures(params int[] contentTypeIds);
|
||||
/// <summary>
|
||||
/// Defines the MemberService, which is an easy access to operations involving (umbraco) members.
|
||||
/// </summary>
|
||||
public interface IMemberService : IMembershipMemberService
|
||||
{
|
||||
/// <summary>
|
||||
/// Rebuilds all xml content in the cmsContentXml table for all documents
|
||||
/// </summary>
|
||||
/// <param name="contentTypeIds">
|
||||
/// Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures
|
||||
/// for all content
|
||||
/// </param>
|
||||
void RebuildXmlStructures(params int[] contentTypeIds);
|
||||
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMember> GetAll(int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField = true, string memberTypeAlias = null, string filter = "");
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMember> GetAll(int pageIndex, int pageSize, out int totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField = true, string memberTypeAlias = null, string filter = "");
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of paged <see cref="IMember"/> objects
|
||||
/// </summary>
|
||||
/// <remarks>An <see cref="IMember"/> can be of type <see cref="IMember"/> </remarks>
|
||||
/// <param name="pageIndex">Current page index</param>
|
||||
/// <param name="pageSize">Size of the page</param>
|
||||
/// <param name="totalRecords">Total number of records found (out)</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="memberTypeAlias"></param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns><see cref="IEnumerable{T}"/></returns>
|
||||
IEnumerable<IMember> GetAll(long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField = true, string memberTypeAlias = null, string filter = "");
|
||||
/// <summary>
|
||||
/// Gets a list of paged <see cref="IMember"/> objects
|
||||
/// </summary>
|
||||
/// <remarks>An <see cref="IMember"/> can be of type <see cref="IMember"/> </remarks>
|
||||
/// <param name="pageIndex">Current page index</param>
|
||||
/// <param name="pageSize">Size of the page</param>
|
||||
/// <param name="totalRecords">Total number of records found (out)</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <param name="orderBySystemField">Flag to indicate when ordering by system field</param>
|
||||
/// <param name="memberTypeAlias"></param>
|
||||
/// <param name="filter">Search text filter</param>
|
||||
/// <returns><see cref="IEnumerable{T}"/></returns>
|
||||
IEnumerable<IMember> GetAll(long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection, bool orderBySystemField = true, string memberTypeAlias = null, string filter = "");
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMember"/> object without persisting it
|
||||
/// </summary>
|
||||
/// <remarks>This method is convenient for when you need to add properties to a new Member
|
||||
/// before persisting it in order to limit the amount of times its saved.
|
||||
/// Also note that the returned <see cref="IMember"/> will not have an Id until its saved.</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMember(string username, string email, string name, string memberTypeAlias);
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMember"/> object without persisting it
|
||||
/// </summary>
|
||||
/// <remarks>This method is convenient for when you need to add properties to a new Member
|
||||
/// before persisting it in order to limit the amount of times its saved.
|
||||
/// Also note that the returned <see cref="IMember"/> will not have an Id until its saved.</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMember(string username, string email, string name, string memberTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMember"/> object without persisting it
|
||||
/// </summary>
|
||||
/// <remarks>This method is convenient for when you need to add properties to a new Member
|
||||
/// before persisting it in order to limit the amount of times its saved.
|
||||
/// Also note that the returned <see cref="IMember"/> will not have an Id until its saved.</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberType">MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMember(string username, string email, string name, IMemberType memberType);
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IMember"/> object without persisting it
|
||||
/// </summary>
|
||||
/// <remarks>This method is convenient for when you need to add properties to a new Member
|
||||
/// before persisting it in order to limit the amount of times its saved.
|
||||
/// Also note that the returned <see cref="IMember"/> will not have an Id until its saved.</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberType">MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMember(string username, string email, string name, IMemberType memberType);
|
||||
|
||||
/// <summary>
|
||||
/// Creates and persists a Member
|
||||
/// </summary>
|
||||
/// <remarks>Using this method will persist the Member object before its returned
|
||||
/// meaning that it will have an Id available (unlike the CreateMember method)</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMemberWithIdentity(string username, string email, string name, string memberTypeAlias);
|
||||
/// <summary>
|
||||
/// Creates and persists a Member
|
||||
/// </summary>
|
||||
/// <remarks>Using this method will persist the Member object before its returned
|
||||
/// meaning that it will have an Id available (unlike the CreateMember method)</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMemberWithIdentity(string username, string email, string name, string memberTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Creates and persists a Member
|
||||
/// </summary>
|
||||
/// <remarks>Using this method will persist the Member object before its returned
|
||||
/// meaning that it will have an Id available (unlike the CreateMember method)</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberType">MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType);
|
||||
/// <summary>
|
||||
/// Creates and persists a Member
|
||||
/// </summary>
|
||||
/// <remarks>Using this method will persist the Member object before its returned
|
||||
/// meaning that it will have an Id available (unlike the CreateMember method)</remarks>
|
||||
/// <param name="username">Username of the Member to create</param>
|
||||
/// <param name="email">Email of the Member to create</param>
|
||||
/// <param name="name">Name of the Member to create</param>
|
||||
/// <param name="memberType">MemberType the Member should be based on</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember CreateMemberWithIdentity(string username, string email, string name, IMemberType memberType);
|
||||
|
||||
/// <summary>
|
||||
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method
|
||||
/// </summary>
|
||||
/// <remarks>This method exists so that Umbraco developers can use one entry point to create/update
|
||||
/// Members if they choose to. </remarks>
|
||||
/// <param name="member">The Member to save the password for</param>
|
||||
/// <param name="password">The password to encrypt and save</param>
|
||||
void SavePassword(IMember member, string password);
|
||||
/// <summary>
|
||||
/// This is simply a helper method which essentially just wraps the MembershipProvider's ChangePassword method
|
||||
/// </summary>
|
||||
/// <remarks>This method exists so that Umbraco developers can use one entry point to create/update
|
||||
/// Members if they choose to. </remarks>
|
||||
/// <param name="member">The Member to save the password for</param>
|
||||
/// <param name="password">The password to encrypt and save</param>
|
||||
void SavePassword(IMember member, string password);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the count of Members by an optional MemberType alias
|
||||
/// </summary>
|
||||
/// <remarks>If no alias is supplied then the count for all Member will be returned</remarks>
|
||||
/// <param name="memberTypeAlias">Optional alias for the MemberType when counting number of Members</param>
|
||||
/// <returns><see cref="System.int"/> with number of Members</returns>
|
||||
int Count(string memberTypeAlias = null);
|
||||
/// <summary>
|
||||
/// Gets the count of Members by an optional MemberType alias
|
||||
/// </summary>
|
||||
/// <remarks>If no alias is supplied then the count for all Member will be returned</remarks>
|
||||
/// <param name="memberTypeAlias">Optional alias for the MemberType when counting number of Members</param>
|
||||
/// <returns><see cref="System.int"/> with number of Members</returns>
|
||||
int Count(string memberTypeAlias = null);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a Member with the id exists
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Member</param>
|
||||
/// <returns><c>True</c> if the Member exists otherwise <c>False</c></returns>
|
||||
bool Exists(int id);
|
||||
/// <summary>
|
||||
/// Checks if a Member with the id exists
|
||||
/// </summary>
|
||||
/// <param name="id">Id of the Member</param>
|
||||
/// <returns><c>True</c> if the Member exists otherwise <c>False</c></returns>
|
||||
bool Exists(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Member by the unique key
|
||||
/// </summary>
|
||||
/// <remarks>The guid key corresponds to the unique id in the database
|
||||
/// and the user id in the membership provider.</remarks>
|
||||
/// <param name="id"><see cref="Guid"/> Id</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember GetByKey(Guid id);
|
||||
/// <summary>
|
||||
/// Gets a Member by the unique key
|
||||
/// </summary>
|
||||
/// <remarks>The guid key corresponds to the unique id in the database
|
||||
/// and the user id in the membership provider.</remarks>
|
||||
/// <param name="id"><see cref="Guid"/> Id</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember GetByKey(Guid id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a Member by its integer id
|
||||
/// </summary>
|
||||
/// <param name="id"><see cref="System.int"/> Id</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember GetById(int id);
|
||||
/// <summary>
|
||||
/// Gets a Member by its integer id
|
||||
/// </summary>
|
||||
/// <param name="id"><see cref="System.int"/> Id</param>
|
||||
/// <returns><see cref="IMember"/></returns>
|
||||
IMember GetById(int id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all Members for the specified MemberType alias
|
||||
/// </summary>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByMemberType(string memberTypeAlias);
|
||||
/// <summary>
|
||||
/// Gets all Members for the specified MemberType alias
|
||||
/// </summary>
|
||||
/// <param name="memberTypeAlias">Alias of the MemberType</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByMemberType(string memberTypeAlias);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all Members for the MemberType id
|
||||
/// </summary>
|
||||
/// <param name="memberTypeId">Id of the MemberType</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByMemberType(int memberTypeId);
|
||||
/// <summary>
|
||||
/// Gets all Members for the MemberType id
|
||||
/// </summary>
|
||||
/// <param name="memberTypeId">Id of the MemberType</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByMemberType(int memberTypeId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all Members within the specified MemberGroup name
|
||||
/// </summary>
|
||||
/// <param name="memberGroupName">Name of the MemberGroup</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByGroup(string memberGroupName);
|
||||
/// <summary>
|
||||
/// Gets all Members within the specified MemberGroup name
|
||||
/// </summary>
|
||||
/// <param name="memberGroupName">Name of the MemberGroup</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByGroup(string memberGroupName);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all Members with the ids specified
|
||||
/// </summary>
|
||||
/// <remarks>If no Ids are specified all Members will be retrieved</remarks>
|
||||
/// <param name="ids">Optional list of Member Ids</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetAllMembers(params int[] ids);
|
||||
/// <summary>
|
||||
/// Gets all Members with the ids specified
|
||||
/// </summary>
|
||||
/// <remarks>If no Ids are specified all Members will be retrieved</remarks>
|
||||
/// <param name="ids">Optional list of Member Ids</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetAllMembers(params int[] ids);
|
||||
|
||||
/// <summary>
|
||||
/// Delete Members of the specified MemberType id
|
||||
/// </summary>
|
||||
/// <param name="memberTypeId">Id of the MemberType</param>
|
||||
void DeleteMembersOfType(int memberTypeId);
|
||||
/// <summary>
|
||||
/// Delete Members of the specified MemberType id
|
||||
/// </summary>
|
||||
/// <param name="memberTypeId">Id of the MemberType</param>
|
||||
void DeleteMembersOfType(int memberTypeId);
|
||||
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, int pageIndex, int pageSize, out int totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
[Obsolete("Use the overload with 'long' parameter types instead")]
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, int pageIndex, int pageSize, out int totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
|
||||
/// <summary>
|
||||
/// Finds Members based on their display name
|
||||
/// </summary>
|
||||
/// <param name="displayNameToMatch">Display name to match</param>
|
||||
/// <param name="pageIndex">Current page index</param>
|
||||
/// <param name="pageSize">Size of the page</param>
|
||||
/// <param name="totalRecords">Total number of records found (out)</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.StartsWith"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
/// <summary>
|
||||
/// Finds Members based on their display name
|
||||
/// </summary>
|
||||
/// <param name="displayNameToMatch">Display name to match</param>
|
||||
/// <param name="pageIndex">Current page index</param>
|
||||
/// <param name="pageSize">Size of the page</param>
|
||||
/// <param name="totalRecords">Total number of records found (out)</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.StartsWith"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> FindMembersByDisplayName(string displayNameToMatch, long pageIndex, int pageSize, out long totalRecords, StringPropertyMatchType matchType = StringPropertyMatchType.StartsWith);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.string"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, string value, StringPropertyMatchType matchType = StringPropertyMatchType.Exact);
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.string"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, string value, StringPropertyMatchType matchType = StringPropertyMatchType.Exact);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.int"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, int value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.int"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, int value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.bool"/> Value to match</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, bool value);
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.bool"/> Value to match</param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.DateTime"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, DateTime value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets a list of Members based on a property search
|
||||
/// </summary>
|
||||
/// <param name="propertyTypeAlias">Alias of the PropertyType to search for</param>
|
||||
/// <param name="value"><see cref="System.DateTime"/> Value to match</param>
|
||||
/// <param name="matchType">The type of match to make as <see cref="StringPropertyMatchType"/>. Default is <see cref="StringPropertyMatchType.Exact"/></param>
|
||||
/// <returns><see cref="IEnumerable{IMember}"/></returns>
|
||||
IEnumerable<IMember> GetMembersByPropertyValue(string propertyTypeAlias, DateTime value, ValuePropertyMatchType matchType = ValuePropertyMatchType.Exact);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -20,124 +20,124 @@ using Version = Lucene.Net.Util.Version;
|
||||
|
||||
namespace Umbraco.Tests.UmbracoExamine
|
||||
{
|
||||
/// <summary>
|
||||
/// Used internally by test classes to initialize a new index from the template
|
||||
/// </summary>
|
||||
internal static class IndexInitializer
|
||||
{
|
||||
public static UmbracoContentIndexer GetUmbracoIndexer(
|
||||
Directory luceneDir,
|
||||
Analyzer analyzer = null,
|
||||
IDataService dataService = null,
|
||||
IContentService contentService = null,
|
||||
IMediaService mediaService = null,
|
||||
IDataTypeService dataTypeService = null,
|
||||
IMemberService memberService = null,
|
||||
IUserService userService = null)
|
||||
{
|
||||
if (dataService == null)
|
||||
{
|
||||
dataService = new TestDataService();
|
||||
}
|
||||
if (contentService == null)
|
||||
{
|
||||
contentService = Mock.Of<IContentService>();
|
||||
}
|
||||
if (userService == null)
|
||||
{
|
||||
userService = Mock.Of<IUserService>(x => x.GetProfileById(It.IsAny<int>()) == Mock.Of<IProfile>(p => p.Id == (object)0 && p.Name == "admin"));
|
||||
}
|
||||
if (mediaService == null)
|
||||
{
|
||||
long totalRecs;
|
||||
/// <summary>
|
||||
/// Used internally by test classes to initialize a new index from the template
|
||||
/// </summary>
|
||||
internal static class IndexInitializer
|
||||
{
|
||||
public static UmbracoContentIndexer GetUmbracoIndexer(
|
||||
Directory luceneDir,
|
||||
Analyzer analyzer = null,
|
||||
IDataService dataService = null,
|
||||
IContentService contentService = null,
|
||||
IMediaService mediaService = null,
|
||||
IDataTypeService dataTypeService = null,
|
||||
IMemberService memberService = null,
|
||||
IUserService userService = null)
|
||||
{
|
||||
if (dataService == null)
|
||||
{
|
||||
dataService = new TestDataService();
|
||||
}
|
||||
if (contentService == null)
|
||||
{
|
||||
contentService = Mock.Of<IContentService>();
|
||||
}
|
||||
if (userService == null)
|
||||
{
|
||||
userService = Mock.Of<IUserService>(x => x.GetProfileById(It.IsAny<int>()) == Mock.Of<IProfile>(p => p.Id == (object)0 && p.Name == "admin"));
|
||||
}
|
||||
if (mediaService == null)
|
||||
{
|
||||
long totalRecs;
|
||||
|
||||
var allRecs = dataService.MediaService.GetLatestMediaByXpath("//node")
|
||||
.Root
|
||||
.Elements()
|
||||
.Select(x => Mock.Of<IMedia>(
|
||||
m =>
|
||||
m.Id == (int)x.Attribute("id") &&
|
||||
m.ParentId == (int)x.Attribute("parentID") &&
|
||||
m.Level == (int)x.Attribute("level") &&
|
||||
m.CreatorId == 0 &&
|
||||
m.SortOrder == (int)x.Attribute("sortOrder") &&
|
||||
m.CreateDate == (DateTime)x.Attribute("createDate") &&
|
||||
m.UpdateDate == (DateTime)x.Attribute("updateDate") &&
|
||||
m.Name == (string)x.Attribute("nodeName") &&
|
||||
m.Path == (string)x.Attribute("path") &&
|
||||
m.Properties == new PropertyCollection() &&
|
||||
m.ContentType == Mock.Of<IMediaType>(mt =>
|
||||
mt.Alias == (string)x.Attribute("nodeTypeAlias") &&
|
||||
mt.Id == (int)x.Attribute("nodeType"))))
|
||||
.ToArray();
|
||||
var allRecs = dataService.MediaService.GetLatestMediaByXpath("//node")
|
||||
.Root
|
||||
.Elements()
|
||||
.Select(x => Mock.Of<IMedia>(
|
||||
m =>
|
||||
m.Id == (int)x.Attribute("id") &&
|
||||
m.ParentId == (int)x.Attribute("parentID") &&
|
||||
m.Level == (int)x.Attribute("level") &&
|
||||
m.CreatorId == 0 &&
|
||||
m.SortOrder == (int)x.Attribute("sortOrder") &&
|
||||
m.CreateDate == (DateTime)x.Attribute("createDate") &&
|
||||
m.UpdateDate == (DateTime)x.Attribute("updateDate") &&
|
||||
m.Name == (string)x.Attribute("nodeName") &&
|
||||
m.Path == (string)x.Attribute("path") &&
|
||||
m.Properties == new PropertyCollection() &&
|
||||
m.ContentType == Mock.Of<IMediaType>(mt =>
|
||||
mt.Alias == (string)x.Attribute("nodeTypeAlias") &&
|
||||
mt.Id == (int)x.Attribute("nodeType"))))
|
||||
.ToArray();
|
||||
|
||||
|
||||
mediaService = Mock.Of<IMediaService>(
|
||||
x => x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out totalRecs, It.IsAny<string>(), It.IsAny<Direction>(), It.IsAny<bool>(), It.IsAny<string>())
|
||||
==
|
||||
allRecs);
|
||||
}
|
||||
if (dataTypeService == null)
|
||||
{
|
||||
dataTypeService = Mock.Of<IDataTypeService>();
|
||||
}
|
||||
mediaService = Mock.Of<IMediaService>(
|
||||
x => x.GetPagedDescendants(
|
||||
It.IsAny<int>(), It.IsAny<long>(), It.IsAny<int>(), out totalRecs, It.IsAny<string>(), It.IsAny<Direction>(), It.IsAny<bool>(), It.IsAny<string>())
|
||||
==
|
||||
allRecs);
|
||||
}
|
||||
if (dataTypeService == null)
|
||||
{
|
||||
dataTypeService = Mock.Of<IDataTypeService>();
|
||||
}
|
||||
|
||||
if (memberService == null)
|
||||
{
|
||||
memberService = Mock.Of<IMemberService>();
|
||||
}
|
||||
if (memberService == null)
|
||||
{
|
||||
memberService = Mock.Of<IMemberService>();
|
||||
}
|
||||
|
||||
if (analyzer == null)
|
||||
{
|
||||
analyzer = new StandardAnalyzer(Version.LUCENE_29);
|
||||
}
|
||||
if (analyzer == null)
|
||||
{
|
||||
analyzer = new StandardAnalyzer(Version.LUCENE_29);
|
||||
}
|
||||
|
||||
var indexSet = new IndexSet();
|
||||
var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);
|
||||
var indexSet = new IndexSet();
|
||||
var indexCriteria = indexSet.ToIndexCriteria(dataService, UmbracoContentIndexer.IndexFieldPolicies);
|
||||
|
||||
var i = new UmbracoContentIndexer(indexCriteria,
|
||||
luceneDir, //custom lucene directory
|
||||
dataService,
|
||||
contentService,
|
||||
mediaService,
|
||||
dataTypeService,
|
||||
userService,
|
||||
analyzer,
|
||||
false);
|
||||
var i = new UmbracoContentIndexer(indexCriteria,
|
||||
luceneDir, //custom lucene directory
|
||||
dataService,
|
||||
contentService,
|
||||
mediaService,
|
||||
dataTypeService,
|
||||
userService,
|
||||
analyzer,
|
||||
false);
|
||||
|
||||
//i.IndexSecondsInterval = 1;
|
||||
//i.IndexSecondsInterval = 1;
|
||||
|
||||
i.IndexingError += IndexingError;
|
||||
i.IndexingError += IndexingError;
|
||||
|
||||
return i;
|
||||
}
|
||||
public static UmbracoExamineSearcher GetUmbracoSearcher(Directory luceneDir, Analyzer analyzer = null)
|
||||
{
|
||||
if (analyzer == null)
|
||||
{
|
||||
analyzer = new StandardAnalyzer(Version.LUCENE_29);
|
||||
}
|
||||
return new UmbracoExamineSearcher(luceneDir, analyzer);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
public static UmbracoExamineSearcher GetUmbracoSearcher(Directory luceneDir, Analyzer analyzer = null)
|
||||
{
|
||||
if (analyzer == null)
|
||||
{
|
||||
analyzer = new StandardAnalyzer(Version.LUCENE_29);
|
||||
}
|
||||
return new UmbracoExamineSearcher(luceneDir, analyzer);
|
||||
}
|
||||
|
||||
public static LuceneSearcher GetLuceneSearcher(Directory luceneDir)
|
||||
{
|
||||
return new LuceneSearcher(luceneDir, new StandardAnalyzer(Version.LUCENE_29));
|
||||
}
|
||||
public static LuceneSearcher GetLuceneSearcher(Directory luceneDir)
|
||||
{
|
||||
return new LuceneSearcher(luceneDir, new StandardAnalyzer(Version.LUCENE_29));
|
||||
}
|
||||
|
||||
public static MultiIndexSearcher GetMultiSearcher(Directory pdfDir, Directory simpleDir, Directory conventionDir, Directory cwsDir)
|
||||
{
|
||||
var i = new MultiIndexSearcher(new[] { pdfDir, simpleDir, conventionDir, cwsDir }, new StandardAnalyzer(Version.LUCENE_29));
|
||||
return i;
|
||||
}
|
||||
public static MultiIndexSearcher GetMultiSearcher(Directory pdfDir, Directory simpleDir, Directory conventionDir, Directory cwsDir)
|
||||
{
|
||||
var i = new MultiIndexSearcher(new[] { pdfDir, simpleDir, conventionDir, cwsDir }, new StandardAnalyzer(Version.LUCENE_29));
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
internal static void IndexingError(object sender, IndexingErrorEventArgs e)
|
||||
{
|
||||
throw new ApplicationException(e.Message, e.InnerException);
|
||||
}
|
||||
internal static void IndexingError(object sender, IndexingErrorEventArgs e)
|
||||
{
|
||||
throw new ApplicationException(e.Message, e.InnerException);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +1,71 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function TableDirective() {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
scope.clickItem = function (item, $event) {
|
||||
if (scope.onClick) {
|
||||
scope.onClick(item);
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
scope.selectItem = function (item, $index, $event) {
|
||||
if (scope.onSelect) {
|
||||
scope.onSelect(item, $index, $event);
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
scope.selectAll = function ($event) {
|
||||
if (scope.onSelectAll) {
|
||||
scope.onSelectAll($event);
|
||||
}
|
||||
};
|
||||
|
||||
scope.isSelectedAll = function () {
|
||||
if (scope.onSelectedAll && scope.items && scope.items.length > 0) {
|
||||
return scope.onSelectedAll();
|
||||
}
|
||||
};
|
||||
|
||||
scope.isSortDirection = function (col, direction) {
|
||||
if (scope.onSortingDirection) {
|
||||
return scope.onSortingDirection(col, direction);
|
||||
}
|
||||
};
|
||||
|
||||
scope.sort = function (field, allow, isSystem) {
|
||||
if (scope.onSort) {
|
||||
scope.onSort(field, allow, isSystem);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/umb-table.html',
|
||||
scope: {
|
||||
items: '=',
|
||||
itemProperties: '=',
|
||||
allowSelectAll: '=',
|
||||
onSelect: '=',
|
||||
onClick: '=',
|
||||
onSelectAll: '=',
|
||||
onSelectedAll: '=',
|
||||
onSortingDirection: '=',
|
||||
onSort: '='
|
||||
},
|
||||
link: link
|
||||
};
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('umbTable', TableDirective);
|
||||
|
||||
})();
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function TableDirective() {
|
||||
|
||||
function link(scope, el, attr, ctrl) {
|
||||
|
||||
scope.clickItem = function (item, $event) {
|
||||
if (scope.onClick) {
|
||||
scope.onClick(item);
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
scope.selectItem = function (item, $index, $event) {
|
||||
if (scope.onSelect) {
|
||||
scope.onSelect(item, $index, $event);
|
||||
$event.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
scope.selectAll = function ($event) {
|
||||
if (scope.onSelectAll) {
|
||||
scope.onSelectAll($event);
|
||||
}
|
||||
};
|
||||
|
||||
scope.isSelectedAll = function () {
|
||||
if (scope.onSelectedAll && scope.items && scope.items.length > 0) {
|
||||
return scope.onSelectedAll();
|
||||
}
|
||||
};
|
||||
|
||||
scope.isSortDirection = function (col, direction) {
|
||||
if (scope.onSortingDirection) {
|
||||
return scope.onSortingDirection(col, direction);
|
||||
}
|
||||
};
|
||||
|
||||
scope.sort = function (field, allow, isSystem) {
|
||||
if (scope.onSort) {
|
||||
scope.onSort(field, allow, isSystem);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
var directive = {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
templateUrl: 'views/components/umb-table.html',
|
||||
scope: {
|
||||
items: '=',
|
||||
itemProperties: '=',
|
||||
allowSelectAll: '=',
|
||||
onSelect: '=',
|
||||
onClick: '=',
|
||||
onSelectAll: '=',
|
||||
onSelectedAll: '=',
|
||||
onSortingDirection: '=',
|
||||
onSort: '='
|
||||
},
|
||||
link: link
|
||||
};
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
angular.module('umbraco.directives').directive('umbTable', TableDirective);
|
||||
|
||||
})();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,471 +5,471 @@
|
||||
**/
|
||||
function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
/** internal method process the saving of data and post processing the result */
|
||||
function saveMediaItem(content, action, files) {
|
||||
return umbRequestHelper.postSaveContent({
|
||||
restApiUrl: umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"PostSave"),
|
||||
content: content,
|
||||
action: action,
|
||||
files: files,
|
||||
dataFormatter: function (c, a) {
|
||||
return umbDataFormatter.formatMediaPostData(c, a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
getRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetRecycleBin")),
|
||||
'Failed to retrieve data for media recycle bin');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#sort
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Sorts all children below a given parent node id, based on a collection of node-ids
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* var ids = [123,34533,2334,23434];
|
||||
* mediaResource.sort({ sortedIds: ids })
|
||||
* .then(function() {
|
||||
* $scope.complete = true;
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Object} args arguments object
|
||||
* @param {Int} args.parentId the ID of the parent node
|
||||
* @param {Array} options.sortedIds array of node IDs as they should be sorted
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
sort: function (args) {
|
||||
if (!args) {
|
||||
throw "args cannot be null";
|
||||
}
|
||||
if (!args.parentId) {
|
||||
throw "args.parentId cannot be null";
|
||||
}
|
||||
if (!args.sortedIds) {
|
||||
throw "args.sortedIds cannot be null";
|
||||
/** internal method process the saving of data and post processing the result */
|
||||
function saveMediaItem(content, action, files) {
|
||||
return umbRequestHelper.postSaveContent({
|
||||
restApiUrl: umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"PostSave"),
|
||||
content: content,
|
||||
action: action,
|
||||
files: files,
|
||||
dataFormatter: function (c, a) {
|
||||
return umbDataFormatter.formatMediaPostData(c, a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostSort"),
|
||||
{
|
||||
parentId: args.parentId,
|
||||
idSortOrder: args.sortedIds
|
||||
}),
|
||||
'Failed to sort media');
|
||||
},
|
||||
return {
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#move
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Moves a node underneath a new parentId
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.move({ parentId: 1244, id: 123 })
|
||||
* .then(function() {
|
||||
* alert("node was moved");
|
||||
* }, function(err){
|
||||
* alert("node didnt move:" + err.data.Message);
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Object} args arguments object
|
||||
* @param {Int} args.idd the ID of the node to move
|
||||
* @param {Int} args.parentId the ID of the parent node to move to
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
move: function (args) {
|
||||
if (!args) {
|
||||
throw "args cannot be null";
|
||||
}
|
||||
if (!args.parentId) {
|
||||
throw "args.parentId cannot be null";
|
||||
}
|
||||
if (!args.id) {
|
||||
throw "args.id cannot be null";
|
||||
}
|
||||
getRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetRecycleBin")),
|
||||
'Failed to retrieve data for media recycle bin');
|
||||
},
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostMove"),
|
||||
{
|
||||
parentId: args.parentId,
|
||||
id: args.id
|
||||
}),
|
||||
'Failed to move media');
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#sort
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Sorts all children below a given parent node id, based on a collection of node-ids
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* var ids = [123,34533,2334,23434];
|
||||
* mediaResource.sort({ sortedIds: ids })
|
||||
* .then(function() {
|
||||
* $scope.complete = true;
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Object} args arguments object
|
||||
* @param {Int} args.parentId the ID of the parent node
|
||||
* @param {Array} options.sortedIds array of node IDs as they should be sorted
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
sort: function (args) {
|
||||
if (!args) {
|
||||
throw "args cannot be null";
|
||||
}
|
||||
if (!args.parentId) {
|
||||
throw "args.parentId cannot be null";
|
||||
}
|
||||
if (!args.sortedIds) {
|
||||
throw "args.sortedIds cannot be null";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostSort"),
|
||||
{
|
||||
parentId: args.parentId,
|
||||
idSortOrder: args.sortedIds
|
||||
}),
|
||||
'Failed to sort media');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#move
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Moves a node underneath a new parentId
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.move({ parentId: 1244, id: 123 })
|
||||
* .then(function() {
|
||||
* alert("node was moved");
|
||||
* }, function(err){
|
||||
* alert("node didnt move:" + err.data.Message);
|
||||
* });
|
||||
* </pre>
|
||||
* @param {Object} args arguments object
|
||||
* @param {Int} args.idd the ID of the node to move
|
||||
* @param {Int} args.parentId the ID of the parent node to move to
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
move: function (args) {
|
||||
if (!args) {
|
||||
throw "args cannot be null";
|
||||
}
|
||||
if (!args.parentId) {
|
||||
throw "args.parentId cannot be null";
|
||||
}
|
||||
if (!args.id) {
|
||||
throw "args.id cannot be null";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostMove"),
|
||||
{
|
||||
parentId: args.parentId,
|
||||
id: args.id
|
||||
}),
|
||||
'Failed to move media');
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getById
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getById(1234)
|
||||
* .then(function(media) {
|
||||
* var myMedia = media;
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of media item to return
|
||||
* @returns {Promise} resourcePromise object containing the media item.
|
||||
*
|
||||
*/
|
||||
getById: function (id) {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getById
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getById(1234)
|
||||
* .then(function(media) {
|
||||
* var myMedia = media;
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of media item to return
|
||||
* @returns {Promise} resourcePromise object containing the media item.
|
||||
*
|
||||
*/
|
||||
getById: function (id) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetById",
|
||||
[{ id: id }])),
|
||||
'Failed to retrieve data for media id ' + id);
|
||||
},
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetById",
|
||||
[{ id: id }])),
|
||||
'Failed to retrieve data for media id ' + id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#deleteById
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Deletes a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.deleteById(1234)
|
||||
* .then(function() {
|
||||
* alert('its gone!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of media item to delete
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
deleteById: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"DeleteById",
|
||||
[{ id: id }])),
|
||||
'Failed to delete item ' + id);
|
||||
},
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#deleteById
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Deletes a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.deleteById(1234)
|
||||
* .then(function() {
|
||||
* alert('its gone!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} id id of media item to delete
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
deleteById: function (id) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"DeleteById",
|
||||
[{ id: id }])),
|
||||
'Failed to delete item ' + id);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getByIds
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets an array of media items, given a collection of ids
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getByIds( [1234,2526,28262])
|
||||
* .then(function(mediaArray) {
|
||||
* var myDoc = contentArray;
|
||||
* alert('they are here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Array} ids ids of media items to return as an array
|
||||
* @returns {Promise} resourcePromise object containing the media items array.
|
||||
*
|
||||
*/
|
||||
getByIds: function (ids) {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getByIds
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets an array of media items, given a collection of ids
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getByIds( [1234,2526,28262])
|
||||
* .then(function(mediaArray) {
|
||||
* var myDoc = contentArray;
|
||||
* alert('they are here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Array} ids ids of media items to return as an array
|
||||
* @returns {Promise} resourcePromise object containing the media items array.
|
||||
*
|
||||
*/
|
||||
getByIds: function (ids) {
|
||||
|
||||
var idQuery = "";
|
||||
_.each(ids, function (item) {
|
||||
idQuery += "ids=" + item + "&";
|
||||
});
|
||||
var idQuery = "";
|
||||
_.each(ids, function (item) {
|
||||
idQuery += "ids=" + item + "&";
|
||||
});
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetByIds",
|
||||
idQuery)),
|
||||
'Failed to retrieve data for media ids ' + ids);
|
||||
},
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetByIds",
|
||||
idQuery)),
|
||||
'Failed to retrieve data for media ids ' + ids);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getScaffold
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Returns a scaffold of an empty media item, given the id of the media item to place it underneath and the media type alias.
|
||||
*
|
||||
* - Parent Id must be provided so umbraco knows where to store the media
|
||||
* - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
|
||||
*
|
||||
* The scaffold is used to build editors for media that has not yet been populated with data.
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getScaffold(1234, 'folder')
|
||||
* .then(function(scaffold) {
|
||||
* var myDoc = scaffold;
|
||||
* myDoc.name = "My new media item";
|
||||
*
|
||||
* mediaResource.save(myDoc, true)
|
||||
* .then(function(media){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} parentId id of media item to return
|
||||
* @param {String} alias mediatype alias to base the scaffold on
|
||||
* @returns {Promise} resourcePromise object containing the media scaffold.
|
||||
*
|
||||
*/
|
||||
getScaffold: function (parentId, alias) {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getScaffold
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Returns a scaffold of an empty media item, given the id of the media item to place it underneath and the media type alias.
|
||||
*
|
||||
* - Parent Id must be provided so umbraco knows where to store the media
|
||||
* - Media Type alias must be provided so umbraco knows which properties to put on the media scaffold
|
||||
*
|
||||
* The scaffold is used to build editors for media that has not yet been populated with data.
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getScaffold(1234, 'folder')
|
||||
* .then(function(scaffold) {
|
||||
* var myDoc = scaffold;
|
||||
* myDoc.name = "My new media item";
|
||||
*
|
||||
* mediaResource.save(myDoc, true)
|
||||
* .then(function(media){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} parentId id of media item to return
|
||||
* @param {String} alias mediatype alias to base the scaffold on
|
||||
* @returns {Promise} resourcePromise object containing the media scaffold.
|
||||
*
|
||||
*/
|
||||
getScaffold: function (parentId, alias) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetEmpty",
|
||||
[{ contentTypeAlias: alias }, { parentId: parentId }])),
|
||||
'Failed to retrieve data for empty media item type ' + alias);
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetEmpty",
|
||||
[{ contentTypeAlias: alias }, { parentId: parentId }])),
|
||||
'Failed to retrieve data for empty media item type ' + alias);
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
rootMedia: function () {
|
||||
rootMedia: function () {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetRootMedia")),
|
||||
'Failed to retrieve data for root media');
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetRootMedia")),
|
||||
'Failed to retrieve data for root media');
|
||||
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getChildren
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets children of a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
|
||||
* .then(function(contentArray) {
|
||||
* var children = contentArray;
|
||||
* alert('they are here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} parentid id of content item to return children of
|
||||
* @param {Object} options optional options object
|
||||
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
|
||||
* @param {Int} options.pageNumber if paging data, current page index, default = 0
|
||||
* @param {String} options.filter if provided, query will only return those with names matching the filter
|
||||
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
|
||||
* @param {String} options.orderBy property to order items by, default: `SortOrder`
|
||||
* @returns {Promise} resourcePromise object containing an array of content items.
|
||||
*
|
||||
*/
|
||||
getChildren: function (parentId, options) {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getChildren
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Gets children of a media item with a given id
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getChildren(1234, {pageSize: 10, pageNumber: 2})
|
||||
* .then(function(contentArray) {
|
||||
* var children = contentArray;
|
||||
* alert('they are here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Int} parentid id of content item to return children of
|
||||
* @param {Object} options optional options object
|
||||
* @param {Int} options.pageSize if paging data, number of nodes per page, default = 0
|
||||
* @param {Int} options.pageNumber if paging data, current page index, default = 0
|
||||
* @param {String} options.filter if provided, query will only return those with names matching the filter
|
||||
* @param {String} options.orderDirection can be `Ascending` or `Descending` - Default: `Ascending`
|
||||
* @param {String} options.orderBy property to order items by, default: `SortOrder`
|
||||
* @returns {Promise} resourcePromise object containing an array of content items.
|
||||
*
|
||||
*/
|
||||
getChildren: function (parentId, options) {
|
||||
|
||||
var defaults = {
|
||||
pageSize: 0,
|
||||
pageNumber: 0,
|
||||
filter: '',
|
||||
orderDirection: "Ascending",
|
||||
orderBy: "SortOrder",
|
||||
orderBySystemField: true
|
||||
var defaults = {
|
||||
pageSize: 0,
|
||||
pageNumber: 0,
|
||||
filter: '',
|
||||
orderDirection: "Ascending",
|
||||
orderBy: "SortOrder",
|
||||
orderBySystemField: true
|
||||
};
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
//overwrite the defaults if there are any specified
|
||||
angular.extend(defaults, options);
|
||||
//now copy back to the options we will use
|
||||
options = defaults;
|
||||
//change asc/desct
|
||||
if (options.orderDirection === "asc") {
|
||||
options.orderDirection = "Ascending";
|
||||
}
|
||||
else if (options.orderDirection === "desc") {
|
||||
options.orderDirection = "Descending";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetChildren",
|
||||
[
|
||||
{ id: parentId },
|
||||
{ pageNumber: options.pageNumber },
|
||||
{ pageSize: options.pageSize },
|
||||
{ orderBy: options.orderBy },
|
||||
{ orderDirection: options.orderDirection },
|
||||
{ orderBySystemField: options.orderBySystemField },
|
||||
{ filter: options.filter }
|
||||
])),
|
||||
'Failed to retrieve children for media item ' + parentId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#save
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation
|
||||
* if the media item needs to have files attached, they must be provided as the files param and passed separately
|
||||
*
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getById(1234)
|
||||
* .then(function(media) {
|
||||
* media.name = "I want a new name!";
|
||||
* mediaResource.save(media, false)
|
||||
* .then(function(media){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Object} media The media item object with changes applied
|
||||
* @param {Bool} isNew set to true to create a new item or to update an existing
|
||||
* @param {Array} files collection of files for the media item
|
||||
* @returns {Promise} resourcePromise object containing the saved media item.
|
||||
*
|
||||
*/
|
||||
save: function (media, isNew, files) {
|
||||
return saveMediaItem(media, "save" + (isNew ? "New" : ""), files);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#addFolder
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Shorthand for adding a media item of the type "Folder" under a given parent ID
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.addFolder("My gallery", 1234)
|
||||
* .then(function(folder) {
|
||||
* alert('New folder');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {string} name Name of the folder to create
|
||||
* @param {int} parentId Id of the media item to create the folder underneath
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
addFolder: function (name, parentId) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper
|
||||
.getApiUrl("mediaApiBaseUrl", "PostAddFolder"),
|
||||
{
|
||||
name: name,
|
||||
parentId: parentId
|
||||
}),
|
||||
'Failed to add folder');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getChildFolders
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Retrieves all media children with types used as folders.
|
||||
* Uses the convention of looking for media items with mediaTypes ending in
|
||||
* *Folder so will match "Folder", "bannerFolder", "secureFolder" etc,
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getChildFolders(1234)
|
||||
* .then(function(data) {
|
||||
* alert('folders');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {int} parentId Id of the media item to query for child folders
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getChildFolders: function (parentId) {
|
||||
if (!parentId) {
|
||||
parentId = -1;
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetChildFolders",
|
||||
[
|
||||
{ id: parentId }
|
||||
])),
|
||||
'Failed to retrieve child folders for media item ' + parentId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#emptyRecycleBin
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Empties the media recycle bin
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.emptyRecycleBin()
|
||||
* .then(function() {
|
||||
* alert('its empty!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
emptyRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"EmptyRecycleBin")),
|
||||
'Failed to empty the recycle bin');
|
||||
}
|
||||
};
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
//overwrite the defaults if there are any specified
|
||||
angular.extend(defaults, options);
|
||||
//now copy back to the options we will use
|
||||
options = defaults;
|
||||
//change asc/desct
|
||||
if (options.orderDirection === "asc") {
|
||||
options.orderDirection = "Ascending";
|
||||
}
|
||||
else if (options.orderDirection === "desc") {
|
||||
options.orderDirection = "Descending";
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetChildren",
|
||||
[
|
||||
{ id: parentId },
|
||||
{ pageNumber: options.pageNumber },
|
||||
{ pageSize: options.pageSize },
|
||||
{ orderBy: options.orderBy },
|
||||
{ orderDirection: options.orderDirection },
|
||||
{ orderBySystemField: options.orderBySystemField },
|
||||
{ filter: options.filter }
|
||||
])),
|
||||
'Failed to retrieve children for media item ' + parentId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#save
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation
|
||||
* if the media item needs to have files attached, they must be provided as the files param and passed separately
|
||||
*
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getById(1234)
|
||||
* .then(function(media) {
|
||||
* media.name = "I want a new name!";
|
||||
* mediaResource.save(media, false)
|
||||
* .then(function(media){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Object} media The media item object with changes applied
|
||||
* @param {Bool} isNew set to true to create a new item or to update an existing
|
||||
* @param {Array} files collection of files for the media item
|
||||
* @returns {Promise} resourcePromise object containing the saved media item.
|
||||
*
|
||||
*/
|
||||
save: function (media, isNew, files) {
|
||||
return saveMediaItem(media, "save" + (isNew ? "New" : ""), files);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#addFolder
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Shorthand for adding a media item of the type "Folder" under a given parent ID
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.addFolder("My gallery", 1234)
|
||||
* .then(function(folder) {
|
||||
* alert('New folder');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {string} name Name of the folder to create
|
||||
* @param {int} parentId Id of the media item to create the folder underneath
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
addFolder: function (name, parentId) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(umbRequestHelper
|
||||
.getApiUrl("mediaApiBaseUrl", "PostAddFolder"),
|
||||
{
|
||||
name: name,
|
||||
parentId: parentId
|
||||
}),
|
||||
'Failed to add folder');
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#getChildFolders
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Retrieves all media children with types used as folders.
|
||||
* Uses the convention of looking for media items with mediaTypes ending in
|
||||
* *Folder so will match "Folder", "bannerFolder", "secureFolder" etc,
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.getChildFolders(1234)
|
||||
* .then(function(data) {
|
||||
* alert('folders');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {int} parentId Id of the media item to query for child folders
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
getChildFolders: function (parentId) {
|
||||
if (!parentId) {
|
||||
parentId = -1;
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"GetChildFolders",
|
||||
[
|
||||
{ id: parentId }
|
||||
])),
|
||||
'Failed to retrieve child folders for media item ' + parentId);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.mediaResource#emptyRecycleBin
|
||||
* @methodOf umbraco.resources.mediaResource
|
||||
*
|
||||
* @description
|
||||
* Empties the media recycle bin
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* mediaResource.emptyRecycleBin()
|
||||
* .then(function() {
|
||||
* alert('its empty!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
emptyRecycleBin: function () {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"mediaApiBaseUrl",
|
||||
"EmptyRecycleBin")),
|
||||
'Failed to empty the recycle bin');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.resources').factory('mediaResource', mediaResource);
|
||||
|
||||
@@ -5,231 +5,231 @@
|
||||
**/
|
||||
function memberResource($q, $http, umbDataFormatter, umbRequestHelper) {
|
||||
|
||||
/** internal method process the saving of data and post processing the result */
|
||||
function saveMember(content, action, files) {
|
||||
/** internal method process the saving of data and post processing the result */
|
||||
function saveMember(content, action, files) {
|
||||
|
||||
return umbRequestHelper.postSaveContent({
|
||||
restApiUrl: umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"PostSave"),
|
||||
content: content,
|
||||
action: action,
|
||||
files: files,
|
||||
dataFormatter: function (c, a) {
|
||||
return umbDataFormatter.formatMemberPostData(c, a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
getPagedResults: function (memberTypeAlias, options) {
|
||||
|
||||
if (memberTypeAlias === 'all-members') {
|
||||
memberTypeAlias = null;
|
||||
return umbRequestHelper.postSaveContent({
|
||||
restApiUrl: umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"PostSave"),
|
||||
content: content,
|
||||
action: action,
|
||||
files: files,
|
||||
dataFormatter: function (c, a) {
|
||||
return umbDataFormatter.formatMemberPostData(c, a);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
pageSize: 25,
|
||||
pageNumber: 1,
|
||||
filter: '',
|
||||
orderDirection: "Ascending",
|
||||
orderBy: "LoginName",
|
||||
orderBySystemField: true
|
||||
return {
|
||||
|
||||
getPagedResults: function (memberTypeAlias, options) {
|
||||
|
||||
if (memberTypeAlias === 'all-members') {
|
||||
memberTypeAlias = null;
|
||||
}
|
||||
|
||||
var defaults = {
|
||||
pageSize: 25,
|
||||
pageNumber: 1,
|
||||
filter: '',
|
||||
orderDirection: "Ascending",
|
||||
orderBy: "LoginName",
|
||||
orderBySystemField: true
|
||||
};
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
//overwrite the defaults if there are any specified
|
||||
angular.extend(defaults, options);
|
||||
//now copy back to the options we will use
|
||||
options = defaults;
|
||||
//change asc/desct
|
||||
if (options.orderDirection === "asc") {
|
||||
options.orderDirection = "Ascending";
|
||||
}
|
||||
else if (options.orderDirection === "desc") {
|
||||
options.orderDirection = "Descending";
|
||||
}
|
||||
|
||||
var params = [
|
||||
{ pageNumber: options.pageNumber },
|
||||
{ pageSize: options.pageSize },
|
||||
{ orderBy: options.orderBy },
|
||||
{ orderDirection: options.orderDirection },
|
||||
{ orderBySystemField: options.orderBySystemField },
|
||||
{ filter: options.filter }
|
||||
];
|
||||
if (memberTypeAlias != null) {
|
||||
params.push({ memberTypeAlias: memberTypeAlias });
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetPagedResults",
|
||||
params)),
|
||||
'Failed to retrieve member paged result');
|
||||
},
|
||||
|
||||
getListNode: function (listName) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetListNodeDisplay",
|
||||
[{ listName: listName }])),
|
||||
'Failed to retrieve data for member list ' + listName);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#getByKey
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Gets a member item with a given key
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getByKey("0000-0000-000-00000-000")
|
||||
* .then(function(member) {
|
||||
* var mymember = member;
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Guid} key key of member item to return
|
||||
* @returns {Promise} resourcePromise object containing the member item.
|
||||
*
|
||||
*/
|
||||
getByKey: function (key) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetByKey",
|
||||
[{ key: key }])),
|
||||
'Failed to retrieve data for member id ' + key);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#deleteByKey
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Deletes a member item with a given key
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.deleteByKey("0000-0000-000-00000-000")
|
||||
* .then(function() {
|
||||
* alert('its gone!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Guid} key id of member item to delete
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
deleteByKey: function (key) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"DeleteByKey",
|
||||
[{ key: key }])),
|
||||
'Failed to delete item ' + key);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#getScaffold
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Returns a scaffold of an empty member item, given the id of the member item to place it underneath and the member type alias.
|
||||
*
|
||||
* - Member Type alias must be provided so umbraco knows which properties to put on the member scaffold
|
||||
*
|
||||
* The scaffold is used to build editors for member that has not yet been populated with data.
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getScaffold('client')
|
||||
* .then(function(scaffold) {
|
||||
* var myDoc = scaffold;
|
||||
* myDoc.name = "My new member item";
|
||||
*
|
||||
* memberResource.save(myDoc, true)
|
||||
* .then(function(member){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {String} alias membertype alias to base the scaffold on
|
||||
* @returns {Promise} resourcePromise object containing the member scaffold.
|
||||
*
|
||||
*/
|
||||
getScaffold: function (alias) {
|
||||
|
||||
if (alias) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetEmpty",
|
||||
[{ contentTypeAlias: alias }])),
|
||||
'Failed to retrieve data for empty member item type ' + alias);
|
||||
}
|
||||
else {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetEmpty")),
|
||||
'Failed to retrieve data for empty member item type ' + alias);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#save
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Saves changes made to a member, if the member is new, the isNew paramater must be passed to force creation
|
||||
* if the member needs to have files attached, they must be provided as the files param and passed separately
|
||||
*
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getBykey("23234-sd8djsd-3h8d3j-sdh8d")
|
||||
* .then(function(member) {
|
||||
* member.name = "Bob";
|
||||
* memberResource.save(member, false)
|
||||
* .then(function(member){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Object} media The member item object with changes applied
|
||||
* @param {Bool} isNew set to true to create a new item or to update an existing
|
||||
* @param {Array} files collection of files for the media item
|
||||
* @returns {Promise} resourcePromise object containing the saved media item.
|
||||
*
|
||||
*/
|
||||
save: function (member, isNew, files) {
|
||||
return saveMember(member, "save" + (isNew ? "New" : ""), files);
|
||||
}
|
||||
};
|
||||
if (options === undefined) {
|
||||
options = {};
|
||||
}
|
||||
//overwrite the defaults if there are any specified
|
||||
angular.extend(defaults, options);
|
||||
//now copy back to the options we will use
|
||||
options = defaults;
|
||||
//change asc/desct
|
||||
if (options.orderDirection === "asc") {
|
||||
options.orderDirection = "Ascending";
|
||||
}
|
||||
else if (options.orderDirection === "desc") {
|
||||
options.orderDirection = "Descending";
|
||||
}
|
||||
|
||||
var params = [
|
||||
{ pageNumber: options.pageNumber },
|
||||
{ pageSize: options.pageSize },
|
||||
{ orderBy: options.orderBy },
|
||||
{ orderDirection: options.orderDirection },
|
||||
{ orderBySystemField: options.orderBySystemField },
|
||||
{ filter: options.filter }
|
||||
];
|
||||
if (memberTypeAlias != null) {
|
||||
params.push({ memberTypeAlias: memberTypeAlias });
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetPagedResults",
|
||||
params)),
|
||||
'Failed to retrieve member paged result');
|
||||
},
|
||||
|
||||
getListNode: function (listName) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetListNodeDisplay",
|
||||
[{ listName: listName }])),
|
||||
'Failed to retrieve data for member list ' + listName);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#getByKey
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Gets a member item with a given key
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getByKey("0000-0000-000-00000-000")
|
||||
* .then(function(member) {
|
||||
* var mymember = member;
|
||||
* alert('its here!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Guid} key key of member item to return
|
||||
* @returns {Promise} resourcePromise object containing the member item.
|
||||
*
|
||||
*/
|
||||
getByKey: function (key) {
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetByKey",
|
||||
[{ key: key }])),
|
||||
'Failed to retrieve data for member id ' + key);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#deleteByKey
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Deletes a member item with a given key
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.deleteByKey("0000-0000-000-00000-000")
|
||||
* .then(function() {
|
||||
* alert('its gone!');
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Guid} key id of member item to delete
|
||||
* @returns {Promise} resourcePromise object.
|
||||
*
|
||||
*/
|
||||
deleteByKey: function (key) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"DeleteByKey",
|
||||
[{ key: key }])),
|
||||
'Failed to delete item ' + key);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#getScaffold
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Returns a scaffold of an empty member item, given the id of the member item to place it underneath and the member type alias.
|
||||
*
|
||||
* - Member Type alias must be provided so umbraco knows which properties to put on the member scaffold
|
||||
*
|
||||
* The scaffold is used to build editors for member that has not yet been populated with data.
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getScaffold('client')
|
||||
* .then(function(scaffold) {
|
||||
* var myDoc = scaffold;
|
||||
* myDoc.name = "My new member item";
|
||||
*
|
||||
* memberResource.save(myDoc, true)
|
||||
* .then(function(member){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {String} alias membertype alias to base the scaffold on
|
||||
* @returns {Promise} resourcePromise object containing the member scaffold.
|
||||
*
|
||||
*/
|
||||
getScaffold: function (alias) {
|
||||
|
||||
if (alias) {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetEmpty",
|
||||
[{ contentTypeAlias: alias }])),
|
||||
'Failed to retrieve data for empty member item type ' + alias);
|
||||
}
|
||||
else {
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.get(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"memberApiBaseUrl",
|
||||
"GetEmpty")),
|
||||
'Failed to retrieve data for empty member item type ' + alias);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.memberResource#save
|
||||
* @methodOf umbraco.resources.memberResource
|
||||
*
|
||||
* @description
|
||||
* Saves changes made to a member, if the member is new, the isNew paramater must be passed to force creation
|
||||
* if the member needs to have files attached, they must be provided as the files param and passed separately
|
||||
*
|
||||
*
|
||||
* ##usage
|
||||
* <pre>
|
||||
* memberResource.getBykey("23234-sd8djsd-3h8d3j-sdh8d")
|
||||
* .then(function(member) {
|
||||
* member.name = "Bob";
|
||||
* memberResource.save(member, false)
|
||||
* .then(function(member){
|
||||
* alert("Retrieved, updated and saved again");
|
||||
* });
|
||||
* });
|
||||
* </pre>
|
||||
*
|
||||
* @param {Object} media The member item object with changes applied
|
||||
* @param {Bool} isNew set to true to create a new item or to update an existing
|
||||
* @param {Array} files collection of files for the media item
|
||||
* @returns {Promise} resourcePromise object containing the saved media item.
|
||||
*
|
||||
*/
|
||||
save: function (member, isNew, files) {
|
||||
return saveMember(member, "save" + (isNew ? "New" : ""), files);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.resources').factory('memberResource', memberResource);
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
<div>
|
||||
<div class="umb-table" ng-if="items">
|
||||
<!-- Listviews head section -->
|
||||
<div class="umb-table-head">
|
||||
<div class="umb-table-row">
|
||||
<div class="umb-table-cell">
|
||||
<input class="umb-table__input" type="checkbox"
|
||||
ng-if="allowSelectAll"
|
||||
ng-click="selectAll($event)"
|
||||
ng-checked="isSelectedAll()">
|
||||
</div>
|
||||
<div class="umb-table-cell umb-table__name">
|
||||
<a class="umb-table-head__link sortable" href="#" ng-click="sort('Name', true)" prevent-default>
|
||||
<localize key="general_name">Name</localize>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': isSortDirection('Name', 'asc'), 'icon-navigation-down': isSortDirection('Name', 'desc')}"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="umb-table-cell" ng-repeat="column in itemProperties">
|
||||
<a class="umb-table-head__link" title="Sort by {{ column.header }}" href="#"
|
||||
ng-click="sort(column.alias, column.allowSorting, column.isSystem)"
|
||||
ng-class="{'sortable':column.allowSorting}" prevent-default>
|
||||
<span ng-bind="column.header"></span>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': isSortDirection(column.alias, 'asc'), 'icon-navigation-down': isSortDirection(column.alias, 'desc')}"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Listview body section -->
|
||||
<div class="umb-table-body">
|
||||
<div class="umb-table-row"
|
||||
ng-repeat="item in items"
|
||||
ng-class="{
|
||||
'-selected':item.selected,
|
||||
'-published':item.published,
|
||||
'-unpublished':!item.published
|
||||
}"
|
||||
ng-click="selectItem(item, $index, $event)">
|
||||
|
||||
<div class="umb-table-cell">
|
||||
<i class="umb-table-body__icon umb-table-body__fileicon {{item.icon}}" ng-class="getIcon(item)"></i>
|
||||
<i class="umb-table-body__icon umb-table-body__checkicon icon-check"></i>
|
||||
</div>
|
||||
<div class="umb-table-cell umb-table__name">
|
||||
<a title="{{ item.name }}" class="umb-table-body__link" href=""
|
||||
ng-click="clickItem(item, $event)"
|
||||
ng-bind="item.name">
|
||||
</a>
|
||||
</div>
|
||||
<div class="umb-table-cell" ng-repeat="column in itemProperties">
|
||||
<span title="{{column.header}}: {{item[column.alias]}}">{{item[column.alias]}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- If list is empty, then display -->
|
||||
<umb-empty-state ng-if="!items"
|
||||
position="center">
|
||||
<localize key="content_listViewNoItems">There are no items show in the list.</localize>
|
||||
</umb-empty-state>
|
||||
</div>
|
||||
<div>
|
||||
<div class="umb-table" ng-if="items">
|
||||
<!-- Listviews head section -->
|
||||
<div class="umb-table-head">
|
||||
<div class="umb-table-row">
|
||||
<div class="umb-table-cell">
|
||||
<input class="umb-table__input" type="checkbox"
|
||||
ng-if="allowSelectAll"
|
||||
ng-click="selectAll($event)"
|
||||
ng-checked="isSelectedAll()">
|
||||
</div>
|
||||
<div class="umb-table-cell umb-table__name">
|
||||
<a class="umb-table-head__link sortable" href="#" ng-click="sort('Name', true)" prevent-default>
|
||||
<localize key="general_name">Name</localize>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': isSortDirection('Name', 'asc'), 'icon-navigation-down': isSortDirection('Name', 'desc')}"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="umb-table-cell" ng-repeat="column in itemProperties">
|
||||
<a class="umb-table-head__link" title="Sort by {{ column.header }}" href="#"
|
||||
ng-click="sort(column.alias, column.allowSorting, column.isSystem)"
|
||||
ng-class="{'sortable':column.allowSorting}" prevent-default>
|
||||
<span ng-bind="column.header"></span>
|
||||
<i class="umb-table-head__icon icon" ng-class="{'icon-navigation-up': isSortDirection(column.alias, 'asc'), 'icon-navigation-down': isSortDirection(column.alias, 'desc')}"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Listview body section -->
|
||||
<div class="umb-table-body">
|
||||
<div class="umb-table-row"
|
||||
ng-repeat="item in items"
|
||||
ng-class="{
|
||||
'-selected':item.selected,
|
||||
'-published':item.published,
|
||||
'-unpublished':!item.published
|
||||
}"
|
||||
ng-click="selectItem(item, $index, $event)">
|
||||
|
||||
<div class="umb-table-cell">
|
||||
<i class="umb-table-body__icon umb-table-body__fileicon {{item.icon}}" ng-class="getIcon(item)"></i>
|
||||
<i class="umb-table-body__icon umb-table-body__checkicon icon-check"></i>
|
||||
</div>
|
||||
<div class="umb-table-cell umb-table__name">
|
||||
<a title="{{ item.name }}" class="umb-table-body__link" href=""
|
||||
ng-click="clickItem(item, $event)"
|
||||
ng-bind="item.name">
|
||||
</a>
|
||||
</div>
|
||||
<div class="umb-table-cell" ng-repeat="column in itemProperties">
|
||||
<span title="{{column.header}}: {{item[column.alias]}}">{{item[column.alias]}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- If list is empty, then display -->
|
||||
<umb-empty-state ng-if="!items"
|
||||
position="center">
|
||||
<localize key="content_listViewNoItems">There are no items show in the list.</localize>
|
||||
</umb-empty-state>
|
||||
</div>
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
(function() {
|
||||
"use strict";
|
||||
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location, mediaHelper) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
vm.nodeId = $scope.contentId;
|
||||
//vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes);
|
||||
//instead of passing in a whitelist, we pass in a blacklist by adding ! to the ext
|
||||
vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.disallowedUploadFiles).replace(/./g, "!.");
|
||||
vm.maxFileSize = Umbraco.Sys.ServerVariables.umbracoSettings.maxFileSize + "KB";
|
||||
vm.activeDrag = false;
|
||||
vm.isRecycleBin = $scope.contentId === '-21' || $scope.contentId === '-20';
|
||||
|
||||
vm.selectItem = selectItem;
|
||||
vm.clickItem = clickItem;
|
||||
vm.selectAll = selectAll;
|
||||
vm.isSelectedAll = isSelectedAll;
|
||||
vm.isSortDirection = isSortDirection;
|
||||
vm.sort = sort;
|
||||
vm.dragEnter = dragEnter;
|
||||
vm.dragLeave = dragLeave;
|
||||
vm.onFilesQueue = onFilesQueue;
|
||||
vm.onUploadComplete = onUploadComplete;
|
||||
|
||||
function selectAll($event) {
|
||||
listViewHelper.selectAllItems($scope.items, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function isSelectedAll() {
|
||||
return listViewHelper.isSelectedAll($scope.items, $scope.selection);
|
||||
}
|
||||
|
||||
function selectItem(selectedItem, $index, $event) {
|
||||
listViewHelper.selectHandler(selectedItem, $index, $scope.items, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function clickItem(item) {
|
||||
$location.path($scope.entityType + '/' + $scope.entityType + '/edit/' + item.id);
|
||||
}
|
||||
|
||||
function isSortDirection(col, direction) {
|
||||
return listViewHelper.setSortingDirection(col, direction, $scope.options);
|
||||
}
|
||||
|
||||
function sort(field, allow, isSystem) {
|
||||
if (allow) {
|
||||
$scope.options.orderBySystemField = isSystem;
|
||||
listViewHelper.setSorting(field, allow, $scope.options);
|
||||
$scope.getContent($scope.contentId);
|
||||
}
|
||||
}
|
||||
|
||||
// Dropzone upload functions
|
||||
function dragEnter(el, event) {
|
||||
vm.activeDrag = true;
|
||||
}
|
||||
|
||||
function dragLeave(el, event) {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onFilesQueue() {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onUploadComplete() {
|
||||
$scope.getContent($scope.contentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.ListView.ListLayoutController", ListViewListLayoutController);
|
||||
|
||||
})();
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function ListViewListLayoutController($scope, listViewHelper, $location, mediaHelper) {
|
||||
|
||||
var vm = this;
|
||||
|
||||
vm.nodeId = $scope.contentId;
|
||||
//vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes);
|
||||
//instead of passing in a whitelist, we pass in a blacklist by adding ! to the ext
|
||||
vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.disallowedUploadFiles).replace(/./g, "!.");
|
||||
vm.maxFileSize = Umbraco.Sys.ServerVariables.umbracoSettings.maxFileSize + "KB";
|
||||
vm.activeDrag = false;
|
||||
vm.isRecycleBin = $scope.contentId === '-21' || $scope.contentId === '-20';
|
||||
|
||||
vm.selectItem = selectItem;
|
||||
vm.clickItem = clickItem;
|
||||
vm.selectAll = selectAll;
|
||||
vm.isSelectedAll = isSelectedAll;
|
||||
vm.isSortDirection = isSortDirection;
|
||||
vm.sort = sort;
|
||||
vm.dragEnter = dragEnter;
|
||||
vm.dragLeave = dragLeave;
|
||||
vm.onFilesQueue = onFilesQueue;
|
||||
vm.onUploadComplete = onUploadComplete;
|
||||
|
||||
function selectAll($event) {
|
||||
listViewHelper.selectAllItems($scope.items, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function isSelectedAll() {
|
||||
return listViewHelper.isSelectedAll($scope.items, $scope.selection);
|
||||
}
|
||||
|
||||
function selectItem(selectedItem, $index, $event) {
|
||||
listViewHelper.selectHandler(selectedItem, $index, $scope.items, $scope.selection, $event);
|
||||
}
|
||||
|
||||
function clickItem(item) {
|
||||
$location.path($scope.entityType + '/' +$scope.entityType + '/edit/' +item.id);
|
||||
}
|
||||
|
||||
function isSortDirection(col, direction) {
|
||||
return listViewHelper.setSortingDirection(col, direction, $scope.options);
|
||||
}
|
||||
|
||||
function sort(field, allow, isSystem) {
|
||||
if (allow) {
|
||||
$scope.options.orderBySystemField = isSystem;
|
||||
listViewHelper.setSorting(field, allow, $scope.options);
|
||||
$scope.getContent($scope.contentId);
|
||||
}
|
||||
}
|
||||
|
||||
// Dropzone upload functions
|
||||
function dragEnter(el, event) {
|
||||
vm.activeDrag = true;
|
||||
}
|
||||
|
||||
function dragLeave(el, event) {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onFilesQueue() {
|
||||
vm.activeDrag = false;
|
||||
}
|
||||
|
||||
function onUploadComplete() {
|
||||
$scope.getContent($scope.contentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.PropertyEditors.ListView.ListLayoutController", ListViewListLayoutController);
|
||||
|
||||
}) ();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,54 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.Filters;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.WebApi.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures that the request is not cached by the browser
|
||||
/// </summary>
|
||||
public class DisableBrowserCacheAttribute : ActionFilterAttribute
|
||||
{
|
||||
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
|
||||
{
|
||||
//See: http://stackoverflow.com/questions/17755239/how-to-stop-chrome-from-caching-rest-response-from-webapi
|
||||
|
||||
base.OnActionExecuted(actionExecutedContext);
|
||||
if (actionExecutedContext == null || actionExecutedContext.Response == null ||
|
||||
actionExecutedContext.Response.Headers == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//NOTE: Until we upgraded to WebApi 2, this didn't work correctly and we had to revert to using
|
||||
// HttpContext.Current responses. I've changed this back to what it should be now since it works
|
||||
// and now with WebApi2, the HttpContext.Current responses dont! Anyways, all good now.
|
||||
actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
|
||||
{
|
||||
NoCache = true,
|
||||
NoStore = true,
|
||||
MaxAge = new TimeSpan(0),
|
||||
MustRevalidate = true
|
||||
};
|
||||
|
||||
actionExecutedContext.Response.Headers.Pragma.Add(new NameValueHeaderValue("no-cache"));
|
||||
if (actionExecutedContext.Response.Content != null)
|
||||
{
|
||||
actionExecutedContext.Response.Content.Headers.Expires =
|
||||
//Mon, 01 Jan 1990 00:00:00 GMT
|
||||
new DateTimeOffset(1990, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Web.Http.Controllers;
|
||||
using System.Web.Http.Filters;
|
||||
using Umbraco.Core;
|
||||
|
||||
namespace Umbraco.Web.WebApi.Filters
|
||||
{
|
||||
/// <summary>
|
||||
/// Ensures that the request is not cached by the browser
|
||||
/// </summary>
|
||||
public class DisableBrowserCacheAttribute : ActionFilterAttribute
|
||||
{
|
||||
public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
|
||||
{
|
||||
//See: http://stackoverflow.com/questions/17755239/how-to-stop-chrome-from-caching-rest-response-from-webapi
|
||||
|
||||
base.OnActionExecuted(actionExecutedContext);
|
||||
if (actionExecutedContext == null || actionExecutedContext.Response == null ||
|
||||
actionExecutedContext.Response.Headers == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//NOTE: Until we upgraded to WebApi 2, this didn't work correctly and we had to revert to using
|
||||
// HttpContext.Current responses. I've changed this back to what it should be now since it works
|
||||
// and now with WebApi2, the HttpContext.Current responses dont! Anyways, all good now.
|
||||
actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue()
|
||||
{
|
||||
NoCache = true,
|
||||
NoStore = true,
|
||||
MaxAge = new TimeSpan(0),
|
||||
MustRevalidate = true
|
||||
};
|
||||
|
||||
actionExecutedContext.Response.Headers.Pragma.Add(new NameValueHeaderValue("no-cache"));
|
||||
if (actionExecutedContext.Response.Content != null)
|
||||
{
|
||||
actionExecutedContext.Response.Content.Headers.Expires =
|
||||
//Mon, 01 Jan 1990 00:00:00 GMT
|
||||
new DateTimeOffset(1990, 1, 1, 0, 0, 0, TimeSpan.Zero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,207 +17,207 @@ using Lucene.Net.Analysis;
|
||||
namespace UmbracoExamine
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Custom indexer for members
|
||||
/// </summary>
|
||||
public class UmbracoMemberIndexer : UmbracoContentIndexer
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom indexer for members
|
||||
/// </summary>
|
||||
public class UmbracoMemberIndexer : UmbracoContentIndexer
|
||||
{
|
||||
|
||||
private readonly IMemberService _memberService;
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private readonly IMemberService _memberService;
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public UmbracoMemberIndexer() : base()
|
||||
{
|
||||
_dataTypeService = ApplicationContext.Current.Services.DataTypeService;
|
||||
_memberService = ApplicationContext.Current.Services.MemberService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public UmbracoMemberIndexer() : base()
|
||||
{
|
||||
_dataTypeService = ApplicationContext.Current.Services.DataTypeService;
|
||||
_memberService = ApplicationContext.Current.Services.MemberService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to allow for creating an indexer at runtime
|
||||
/// </summary>
|
||||
/// <param name="indexerData"></param>
|
||||
/// <param name="indexPath"></param>
|
||||
/// <param name="dataService"></param>
|
||||
/// <param name="analyzer"></param>
|
||||
[Obsolete("Use the overload that specifies the Umbraco services")]
|
||||
public UmbracoMemberIndexer(IIndexCriteria indexerData, DirectoryInfo indexPath, IDataService dataService, Analyzer analyzer, bool async)
|
||||
: base(indexerData, indexPath, dataService, analyzer, async)
|
||||
{
|
||||
_dataTypeService = ApplicationContext.Current.Services.DataTypeService;
|
||||
_memberService = ApplicationContext.Current.Services.MemberService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructor to allow for creating an indexer at runtime
|
||||
/// </summary>
|
||||
/// <param name="indexerData"></param>
|
||||
/// <param name="indexPath"></param>
|
||||
/// <param name="dataService"></param>
|
||||
/// <param name="analyzer"></param>
|
||||
[Obsolete("Use the overload that specifies the Umbraco services")]
|
||||
public UmbracoMemberIndexer(IIndexCriteria indexerData, DirectoryInfo indexPath, IDataService dataService, Analyzer analyzer, bool async)
|
||||
: base(indexerData, indexPath, dataService, analyzer, async)
|
||||
{
|
||||
_dataTypeService = ApplicationContext.Current.Services.DataTypeService;
|
||||
_memberService = ApplicationContext.Current.Services.MemberService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor to allow for creating an indexer at runtime
|
||||
/// </summary>
|
||||
/// <param name="indexerData"></param>
|
||||
/// <param name="indexPath"></param>
|
||||
/// <param name="dataService"></param>
|
||||
/// <param name="dataTypeService"></param>
|
||||
/// <param name="memberService"></param>
|
||||
/// <param name="analyzer"></param>
|
||||
/// <param name="async"></param>
|
||||
public UmbracoMemberIndexer(IIndexCriteria indexerData, DirectoryInfo indexPath, IDataService dataService,
|
||||
IDataTypeService dataTypeService,
|
||||
IMemberService memberService,
|
||||
Analyzer analyzer, bool async)
|
||||
: base(indexerData, indexPath, dataService, analyzer, async)
|
||||
{
|
||||
_dataTypeService = dataTypeService;
|
||||
_memberService = memberService;
|
||||
}
|
||||
/// <summary>
|
||||
/// Constructor to allow for creating an indexer at runtime
|
||||
/// </summary>
|
||||
/// <param name="indexerData"></param>
|
||||
/// <param name="indexPath"></param>
|
||||
/// <param name="dataService"></param>
|
||||
/// <param name="dataTypeService"></param>
|
||||
/// <param name="memberService"></param>
|
||||
/// <param name="analyzer"></param>
|
||||
/// <param name="async"></param>
|
||||
public UmbracoMemberIndexer(IIndexCriteria indexerData, DirectoryInfo indexPath, IDataService dataService,
|
||||
IDataTypeService dataTypeService,
|
||||
IMemberService memberService,
|
||||
Analyzer analyzer, bool async)
|
||||
: base(indexerData, indexPath, dataService, analyzer, async)
|
||||
{
|
||||
_dataTypeService = dataTypeService;
|
||||
_memberService = memberService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that the'_searchEmail' is added to the user fields so that it is indexed - without having to modify the config
|
||||
/// </summary>
|
||||
/// <param name="indexSet"></param>
|
||||
/// <returns></returns>
|
||||
protected override IIndexCriteria GetIndexerData(IndexSet indexSet)
|
||||
{
|
||||
var indexerData = base.GetIndexerData(indexSet);
|
||||
/// <summary>
|
||||
/// Ensures that the'_searchEmail' is added to the user fields so that it is indexed - without having to modify the config
|
||||
/// </summary>
|
||||
/// <param name="indexSet"></param>
|
||||
/// <returns></returns>
|
||||
protected override IIndexCriteria GetIndexerData(IndexSet indexSet)
|
||||
{
|
||||
var indexerData = base.GetIndexerData(indexSet);
|
||||
|
||||
if (CanInitialize())
|
||||
{
|
||||
//If the fields are missing a custom _searchEmail, then add it
|
||||
if (CanInitialize())
|
||||
{
|
||||
//If the fields are missing a custom _searchEmail, then add it
|
||||
|
||||
if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false)
|
||||
{
|
||||
var field = new IndexField { Name = "_searchEmail" };
|
||||
var policy = IndexFieldPolicies.FirstOrDefault(x => x.Name == "_searchEmail");
|
||||
if (policy != null)
|
||||
{
|
||||
field.Type = policy.Type;
|
||||
field.EnableSorting = policy.EnableSorting;
|
||||
}
|
||||
if (indexerData.UserFields.Any(x => x.Name == "_searchEmail") == false)
|
||||
{
|
||||
var field = new IndexField { Name = "_searchEmail" };
|
||||
var policy = IndexFieldPolicies.FirstOrDefault(x => x.Name == "_searchEmail");
|
||||
if (policy != null)
|
||||
{
|
||||
field.Type = policy.Type;
|
||||
field.EnableSorting = policy.EnableSorting;
|
||||
}
|
||||
|
||||
return new IndexCriteria(
|
||||
indexerData.StandardFields,
|
||||
indexerData.UserFields.Concat(new[] { field }),
|
||||
indexerData.IncludeNodeTypes,
|
||||
indexerData.ExcludeNodeTypes,
|
||||
indexerData.ParentNodeId
|
||||
);
|
||||
}
|
||||
}
|
||||
return new IndexCriteria(
|
||||
indexerData.StandardFields,
|
||||
indexerData.UserFields.Concat(new[] { field }),
|
||||
indexerData.IncludeNodeTypes,
|
||||
indexerData.ExcludeNodeTypes,
|
||||
indexerData.ParentNodeId
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return indexerData;
|
||||
}
|
||||
return indexerData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The supported types for this indexer
|
||||
/// </summary>
|
||||
protected override IEnumerable<string> SupportedTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[] { IndexTypes.Member };
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// The supported types for this indexer
|
||||
/// </summary>
|
||||
protected override IEnumerable<string> SupportedTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[] { IndexTypes.Member };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reindex all members
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
protected override void PerformIndexAll(string type)
|
||||
{
|
||||
//This only supports members
|
||||
if (SupportedTypes.Contains(type) == false)
|
||||
return;
|
||||
/// <summary>
|
||||
/// Reindex all members
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
protected override void PerformIndexAll(string type)
|
||||
{
|
||||
//This only supports members
|
||||
if (SupportedTypes.Contains(type) == false)
|
||||
return;
|
||||
|
||||
const int pageSize = 1000;
|
||||
var pageIndex = 0;
|
||||
const int pageSize = 1000;
|
||||
var pageIndex = 0;
|
||||
|
||||
IMember[] members;
|
||||
IMember[] members;
|
||||
|
||||
if (IndexerData.IncludeNodeTypes.Any())
|
||||
{
|
||||
//if there are specific node types then just index those
|
||||
foreach (var nodeType in IndexerData.IncludeNodeTypes)
|
||||
{
|
||||
do
|
||||
{
|
||||
long total;
|
||||
members = _memberService.GetAll(pageIndex, pageSize, out total, "LoginName"
|
||||
, Direction.Ascending, true, nodeType).ToArray();
|
||||
if (IndexerData.IncludeNodeTypes.Any())
|
||||
{
|
||||
//if there are specific node types then just index those
|
||||
foreach (var nodeType in IndexerData.IncludeNodeTypes)
|
||||
{
|
||||
do
|
||||
{
|
||||
long total;
|
||||
members = _memberService.GetAll(pageIndex, pageSize, out total, "LoginName"
|
||||
, Direction.Ascending, true, nodeType).ToArray();
|
||||
|
||||
AddNodesToIndex(GetSerializedMembers(members), type);
|
||||
AddNodesToIndex(GetSerializedMembers(members), type);
|
||||
|
||||
pageIndex++;
|
||||
} while (members.Length == pageSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//no node types specified, do all members
|
||||
do
|
||||
{
|
||||
int total;
|
||||
members = _memberService.GetAll(pageIndex, pageSize, out total).ToArray();
|
||||
pageIndex++;
|
||||
} while (members.Length == pageSize);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//no node types specified, do all members
|
||||
do
|
||||
{
|
||||
int total;
|
||||
members = _memberService.GetAll(pageIndex, pageSize, out total).ToArray();
|
||||
|
||||
AddNodesToIndex(GetSerializedMembers(members), type);
|
||||
AddNodesToIndex(GetSerializedMembers(members), type);
|
||||
|
||||
pageIndex++;
|
||||
} while (members.Length == pageSize);
|
||||
}
|
||||
}
|
||||
pageIndex++;
|
||||
} while (members.Length == pageSize);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<XElement> GetSerializedMembers(IEnumerable<IMember> members)
|
||||
{
|
||||
var serializer = new EntityXmlSerializer();
|
||||
return members.Select(member => serializer.Serialize(_dataTypeService, member));
|
||||
}
|
||||
private IEnumerable<XElement> GetSerializedMembers(IEnumerable<IMember> members)
|
||||
{
|
||||
var serializer = new EntityXmlSerializer();
|
||||
return members.Select(member => serializer.Serialize(_dataTypeService, member));
|
||||
}
|
||||
|
||||
protected override XDocument GetXDocument(string xPath, string type)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
protected override XDocument GetXDocument(string xPath, string type)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
protected override Dictionary<string, string> GetSpecialFieldsToIndex(Dictionary<string, string> allValuesForIndexing)
|
||||
{
|
||||
var fields = base.GetSpecialFieldsToIndex(allValuesForIndexing);
|
||||
protected override Dictionary<string, string> GetSpecialFieldsToIndex(Dictionary<string, string> allValuesForIndexing)
|
||||
{
|
||||
var fields = base.GetSpecialFieldsToIndex(allValuesForIndexing);
|
||||
|
||||
//adds the special path property to the index
|
||||
fields.Add("__key", allValuesForIndexing["__key"]);
|
||||
//adds the special path property to the index
|
||||
fields.Add("__key", allValuesForIndexing["__key"]);
|
||||
|
||||
return fields;
|
||||
return fields;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add the special __key and _searchEmail fields
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnGatheringNodeData(IndexingNodeDataEventArgs e)
|
||||
{
|
||||
base.OnGatheringNodeData(e);
|
||||
/// <summary>
|
||||
/// Add the special __key and _searchEmail fields
|
||||
/// </summary>
|
||||
/// <param name="e"></param>
|
||||
protected override void OnGatheringNodeData(IndexingNodeDataEventArgs e)
|
||||
{
|
||||
base.OnGatheringNodeData(e);
|
||||
|
||||
if (e.Node.Attribute("key") != null)
|
||||
{
|
||||
if (e.Fields.ContainsKey("__key") == false)
|
||||
e.Fields.Add("__key", e.Node.Attribute("key").Value);
|
||||
}
|
||||
if (e.Node.Attribute("key") != null)
|
||||
{
|
||||
if (e.Fields.ContainsKey("__key") == false)
|
||||
e.Fields.Add("__key", e.Node.Attribute("key").Value);
|
||||
}
|
||||
|
||||
if (e.Node.Attribute("email") != null)
|
||||
{
|
||||
//NOTE: the single underscore = it's not a 'special' field which means it will be indexed normally
|
||||
if (e.Fields.ContainsKey("_searchEmail") == false)
|
||||
e.Fields.Add("_searchEmail", e.Node.Attribute("email").Value.Replace(".", " ").Replace("@", " "));
|
||||
}
|
||||
if (e.Node.Attribute("email") != null)
|
||||
{
|
||||
//NOTE: the single underscore = it's not a 'special' field which means it will be indexed normally
|
||||
if (e.Fields.ContainsKey("_searchEmail") == false)
|
||||
e.Fields.Add("_searchEmail", e.Node.Attribute("email").Value.Replace(".", " ").Replace("@", " "));
|
||||
}
|
||||
|
||||
if (e.Fields.ContainsKey(IconFieldName) == false)
|
||||
e.Fields.Add(IconFieldName, (string)e.Node.Attribute("icon"));
|
||||
}
|
||||
if (e.Fields.ContainsKey(IconFieldName) == false)
|
||||
e.Fields.Add(IconFieldName, (string)e.Node.Attribute("icon"));
|
||||
}
|
||||
|
||||
private static XElement GetMemberItem(int nodeId)
|
||||
{
|
||||
//TODO: Change this so that it is not using the LegacyLibrary, just serialize manually!
|
||||
var nodes = LegacyLibrary.GetMember(nodeId);
|
||||
return XElement.Parse(nodes.Current.OuterXml);
|
||||
}
|
||||
}
|
||||
private static XElement GetMemberItem(int nodeId)
|
||||
{
|
||||
//TODO: Change this so that it is not using the LegacyLibrary, just serialize manually!
|
||||
var nodes = LegacyLibrary.GetMember(nodeId);
|
||||
return XElement.Parse(nodes.Current.OuterXml);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user