Merge remote-tracking branch 'origin/1.10' into dev

This commit is contained in:
Sipke Schoorstra 2016-03-06 18:19:19 +01:00
commit cb0fe9da31
15 changed files with 40 additions and 23 deletions

View File

@ -30,7 +30,7 @@
<section class="preset-custom-section" data-bind="visible: isExpanded"> <section class="preset-custom-section" data-bind="visible: isExpanded">
<label>@T("Custom encoding preset XML")</label> <label>@T("Custom encoding preset XML")</label>
<textarea data-bind="value: customXml, attr: { id: 'EncodingSettings_WamsEncodingPresets_' + $index().CustomXml, name: 'EncodingSettings.WamsEncodingPresets[' + $index() + '].CustomXml'}"></textarea> <textarea data-bind="value: customXml, attr: { id: 'EncodingSettings_WamsEncodingPresets_' + $index().CustomXml, name: 'EncodingSettings.WamsEncodingPresets[' + $index() + '].CustomXml'}"></textarea>
<p class="hint">@T("Leave empty if this is standard preset (in which case the name must match a standard Microsoft Azure Media Services encoding preset name.")</p> <p class="hint">@T("Leave empty if this is a standard preset (in which case the name must match a standard Microsoft Azure Media Services encoding preset name).")</p>
</section> </section>
</td> </td>
<td> <td>

View File

@ -1,8 +1,11 @@
@using Orchard.ContentManagement @using Orchard.ContentManagement
@using Orchard.Utility.Extensions @using Orchard.Utility.Extensions
@using Orchard.ContentManagement.Aspects;
@{ @{
ContentItem customForm = Model.ContentItem; ContentItem customForm = Model.ContentItem;
string returnUrl = Model.ReturnUrl; string returnUrl = Model.ReturnUrl;
var metadata = customForm.ContentManager.GetItemMetadata(customForm);
var displayText = metadata != null ? MvcHtmlString.Create(metadata.DisplayText) : null;
Html.AddPageClassNames("edit-" + customForm.ContentType.HtmlClassify()); Html.AddPageClassNames("edit-" + customForm.ContentType.HtmlClassify());
@ -12,7 +15,7 @@
var submitButtonText = String.IsNullOrEmpty(Model.ContentItem.CustomFormPart.SubmitButtonText) ? T("Submit").Text : Model.ContentItem.CustomFormPart.SubmitButtonText; var submitButtonText = String.IsNullOrEmpty(Model.ContentItem.CustomFormPart.SubmitButtonText) ? T("Submit").Text : Model.ContentItem.CustomFormPart.SubmitButtonText;
} }
@Display(New.Parts_Title().Title(Html.ItemDisplayText(customForm))) @Display(New.Parts_Title().Title(displayText))
@using (Html.BeginFormAntiForgeryPost(returnUrl)) { @using (Html.BeginFormAntiForgeryPost(returnUrl)) {
@Html.ValidationSummary() @Html.ValidationSummary()

View File

@ -263,7 +263,7 @@ namespace Orchard.DynamicForms.Services {
ReadElementValues(element, context); ReadElementValues(element, context);
var value = context.Output[element.Name]; var value = context.Output[element.Name];
var bindingSettings = element.Data.GetModel<FormBindingSettings>(null); var bindingSettings = element.Data.GetModel<FormBindingSettings>();
if (bindingSettings != null) { if (bindingSettings != null) {
foreach (var partBindingSettings in bindingSettings.Parts) { foreach (var partBindingSettings in bindingSettings.Parts) {

View File

@ -33,14 +33,13 @@ namespace Orchard.Indexing {
} }
} }
return 2; return 4; // Returns 4 instead of 2 due to the modified/deleted migrations in UpdateFrom2-3.
} }
public int UpdateFrom2() { public int UpdateFrom2() {
// A table for a custom job implementation was here, but since we use JobsQueue that table is deprecated. // A table for a custom job implementation was here, but since we use JobsQueue that table is deprecated.
return 3; return 4; // See the comment in UpdateFrom1.
} }
public int UpdateFrom3() { public int UpdateFrom3() {

View File

@ -56,11 +56,13 @@ namespace Orchard.MediaLibrary.Controllers {
explorer.Weld(new MediaLibraryExplorerPart()); explorer.Weld(new MediaLibraryExplorerPart());
var explorerShape = Services.ContentManager.BuildDisplay(explorer); var explorerShape = Services.ContentManager.BuildDisplay(explorer);
var rootMediaFolderPath = rootMediaFolder == null ? null : rootMediaFolder.MediaPath;
var viewModel = new MediaManagerIndexViewModel { var viewModel = new MediaManagerIndexViewModel {
DialogMode = dialog, DialogMode = dialog,
FolderPath = folderPath, FolderPath = folderPath,
ChildFoldersViewModel = new MediaManagerChildFoldersViewModel{Children = _mediaLibraryService.GetMediaFolders(rootMediaFolder == null ? null : rootMediaFolder.MediaPath)}, RootFolderPath = rootMediaFolderPath,
ChildFoldersViewModel = new MediaManagerChildFoldersViewModel { Children = _mediaLibraryService.GetMediaFolders(rootMediaFolderPath) },
MediaTypes = _mediaLibraryService.GetMediaTypes(), MediaTypes = _mediaLibraryService.GetMediaTypes(),
CustomActionsShapes = explorerShape.Actions, CustomActionsShapes = explorerShape.Actions,
CustomNavigationShapes = explorerShape.Navigation, CustomNavigationShapes = explorerShape.Navigation,
@ -158,8 +160,8 @@ namespace Orchard.MediaLibrary.Controllers {
var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder(); var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder();
var rootMediaFolderPath = rootMediaFolder == null ? null : rootMediaFolder.MediaPath; var rootMediaFolderPath = rootMediaFolder == null ? null : rootMediaFolder.MediaPath;
var mediaParts = _mediaLibraryService.GetMediaContentItems(rootMediaFolderPath, skip, count, order, mediaType); var mediaParts = _mediaLibraryService.GetMediaContentItemsRecursive(rootMediaFolderPath, skip, count, order, mediaType);
var mediaPartsCount = _mediaLibraryService.GetMediaContentItemsCount(rootMediaFolderPath, mediaType); var mediaPartsCount = _mediaLibraryService.GetMediaContentItemsCountRecursive(rootMediaFolderPath, mediaType);
var mediaItems = mediaParts.Select(x => new MediaManagerMediaItemViewModel { var mediaItems = mediaParts.Select(x => new MediaManagerMediaItemViewModel {

View File

@ -165,7 +165,7 @@ namespace Orchard.MediaLibrary.Controllers {
foreach (var media in Services.ContentManager.Query().ForPart<MediaPart>().ForContentItems(mediaItemIds).List()) { foreach (var media in Services.ContentManager.Query().ForPart<MediaPart>().ForContentItems(mediaItemIds).List()) {
// don't try to rename the file if there is no associated media file // don't try to rename the file if there is no associated media file
if (!String.IsNullOrEmpty(media.FileName)) { if (!string.IsNullOrEmpty(media.FileName)) {
var uniqueFilename = _mediaLibraryService.GetUniqueFilename(folderPath, media.FileName); var uniqueFilename = _mediaLibraryService.GetUniqueFilename(folderPath, media.FileName);
_mediaLibraryService.MoveFile(media.FolderPath, media.FileName, folderPath, uniqueFilename); _mediaLibraryService.MoveFile(media.FolderPath, media.FileName, folderPath, uniqueFilename);
media.FileName = uniqueFilename; media.FileName = uniqueFilename;
@ -179,7 +179,10 @@ namespace Orchard.MediaLibrary.Controllers {
private bool IsRootFolder(string folderPath) { private bool IsRootFolder(string folderPath) {
var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder(); var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder();
return String.Equals(rootMediaFolder.MediaPath, folderPath, StringComparison.OrdinalIgnoreCase);
return rootMediaFolder == null ?
string.IsNullOrEmpty(folderPath) :
string.Equals(rootMediaFolder.MediaPath, folderPath, StringComparison.OrdinalIgnoreCase);
} }
} }
} }

View File

@ -434,7 +434,7 @@ $(function () {
ko.applyBindings(viewModel); ko.applyBindings(viewModel);
if (settings.hasFolderPath) { if (settings.hasFolderPath && settings.folderPath != settings.rootFolderPath) {
viewModel.displayFolder(settings.folderPath); viewModel.displayFolder(settings.folderPath);
//fetch displayed folder structure //fetch displayed folder structure

View File

@ -13,8 +13,10 @@ namespace Orchard.MediaLibrary.Services {
IContentQuery<MediaPart, MediaPartRecord> GetMediaContentItems(VersionOptions versionOptions = null); IContentQuery<MediaPart, MediaPartRecord> GetMediaContentItems(VersionOptions versionOptions = null);
IEnumerable<MediaPart> GetMediaContentItems(string folderPath, int skip, int count, string order, string mediaType, VersionOptions versionOptions = null); IEnumerable<MediaPart> GetMediaContentItems(string folderPath, int skip, int count, string order, string mediaType, VersionOptions versionOptions = null);
IEnumerable<MediaPart> GetMediaContentItems(int skip, int count, string order, string mediaType, VersionOptions versionOptions = null); IEnumerable<MediaPart> GetMediaContentItems(int skip, int count, string order, string mediaType, VersionOptions versionOptions = null);
IEnumerable<MediaPart> GetMediaContentItemsRecursive(string folderPath, int skip, int count, string order, string mediaType, VersionOptions versionOptions = null);
int GetMediaContentItemsCount(string folderPath, string mediaType, VersionOptions versionOptions = null); int GetMediaContentItemsCount(string folderPath, string mediaType, VersionOptions versionOptions = null);
int GetMediaContentItemsCount(string mediaType, VersionOptions versionOptions = null); int GetMediaContentItemsCount(string mediaType, VersionOptions versionOptions = null);
int GetMediaContentItemsCountRecursive(string folderPath, string mediaType, VersionOptions versionOptions = null);
MediaPart ImportMedia(string relativePath, string filename); MediaPart ImportMedia(string relativePath, string filename);
MediaPart ImportMedia(string relativePath, string filename, string contentType); MediaPart ImportMedia(string relativePath, string filename, string contentType);
MediaPart ImportMedia(Stream stream, string relativePath, string filename); MediaPart ImportMedia(Stream stream, string relativePath, string filename);

View File

@ -59,6 +59,11 @@ namespace Orchard.MediaLibrary.Services {
return GetMediaContentItems(null, skip, count, order, mediaType, versionOptions); return GetMediaContentItems(null, skip, count, order, mediaType, versionOptions);
} }
public IEnumerable<MediaPart> GetMediaContentItemsRecursive(string folderPath, int skip, int count, string order, string mediaType, VersionOptions versionOptions = null) {
return BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, true, order, mediaType, versionOptions)
.Slice(skip, count);
}
public int GetMediaContentItemsCount(string folderPath, string mediaType, VersionOptions versionOptions = null) { public int GetMediaContentItemsCount(string folderPath, string mediaType, VersionOptions versionOptions = null) {
return BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, mediaType: mediaType, versionOptions: versionOptions) return BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, mediaType: mediaType, versionOptions: versionOptions)
.Count(); .Count();
@ -68,6 +73,11 @@ namespace Orchard.MediaLibrary.Services {
return GetMediaContentItemsCount(null, mediaType, versionOptions); return GetMediaContentItemsCount(null, mediaType, versionOptions);
} }
public int GetMediaContentItemsCountRecursive(string folderPath, string mediaType, VersionOptions versionOptions = null) {
return BuildGetMediaContentItemsQuery(_orchardServices.ContentManager, folderPath, true, mediaType: mediaType, versionOptions: versionOptions)
.Count();
}
private static IContentQuery<MediaPart> BuildGetMediaContentItemsQuery( private static IContentQuery<MediaPart> BuildGetMediaContentItemsQuery(
IContentManager contentManager, string folderPath = null, bool recursive = false, string order = null, string mediaType = null, VersionOptions versionOptions = null) { IContentManager contentManager, string folderPath = null, bool recursive = false, string order = null, string mediaType = null, VersionOptions versionOptions = null) {

View File

@ -6,6 +6,7 @@ namespace Orchard.MediaLibrary.ViewModels {
public class MediaManagerIndexViewModel { public class MediaManagerIndexViewModel {
public MediaManagerChildFoldersViewModel ChildFoldersViewModel { get; set; } public MediaManagerChildFoldersViewModel ChildFoldersViewModel { get; set; }
public string FolderPath { get; set; } public string FolderPath { get; set; }
public string RootFolderPath { get; set; }
public bool DialogMode { get; set; } public bool DialogMode { get; set; }
public IEnumerable<ContentTypeDefinition> MediaTypes { get; set; } public IEnumerable<ContentTypeDefinition> MediaTypes { get; set; }
public dynamic CustomActionsShapes { get; set; } public dynamic CustomActionsShapes { get; set; }

View File

@ -96,8 +96,9 @@ var mediaLibrarySettings = {
moveActionUrl: '@Url.Action("Move", "Folder", new {area = "Orchard.MediaLibrary"})', moveActionUrl: '@Url.Action("Move", "Folder", new {area = "Orchard.MediaLibrary"})',
deleteActionUrl: '@Url.Action("Delete", "Admin", new {area = "Orchard.MediaLibrary"})', deleteActionUrl: '@Url.Action("Delete", "Admin", new {area = "Orchard.MediaLibrary"})',
cloneActionUrl: '@Url.Action("Clone", "Admin", new {area = "Orchard.MediaLibrary"})', cloneActionUrl: '@Url.Action("Clone", "Admin", new {area = "Orchard.MediaLibrary"})',
hasFolderPath: @(viewModel.FolderPath != null ? "true" : "false"), hasFolderPath: @(!string.IsNullOrEmpty(viewModel.FolderPath) ? "true" : "false"),
folderPath: '@HttpUtility.JavaScriptStringEncode(viewModel.FolderPath)', folderPath: '@HttpUtility.JavaScriptStringEncode(viewModel.FolderPath)',
rootFolderPath: '@HttpUtility.JavaScriptStringEncode(viewModel.RootFolderPath ?? "")',
deleteConfirmationMessage: '@HttpUtility.JavaScriptStringEncode(T("Are you sure you want to delete these media items ?").Text)', deleteConfirmationMessage: '@HttpUtility.JavaScriptStringEncode(T("Are you sure you want to delete these media items ?").Text)',
cloneConfirmationMessage: '@HttpUtility.JavaScriptStringEncode(T("Are you sure you want to clone this media item ?").Text)', cloneConfirmationMessage: '@HttpUtility.JavaScriptStringEncode(T("Are you sure you want to clone this media item ?").Text)',
errorMessage: '@HttpUtility.JavaScriptStringEncode(T("An unexpected error occured, please refresh the page and try again.").Text)', errorMessage: '@HttpUtility.JavaScriptStringEncode(T("An unexpected error occured, please refresh the page and try again.").Text)',
@ -110,7 +111,7 @@ var mediaLibrarySettings = {
<li> <li>
<div class="media-library-folder" data-bind="css: { 'in-progress': $root.pendingRequest() }"> <div class="media-library-folder" data-bind="css: { 'in-progress': $root.pendingRequest() }">
<div class="media-library-folder-title" data-bind="click: folderClicked, attr: { 'data-media-path': folderPath() }, css: {selected: isSelected()}"> <div class="media-library-folder-title" data-bind="click: folderClicked, attr: { 'data-media-path': folderPath() }, css: {selected: isSelected()}">
<a href="#" class="media-library-navigation-folder-link"><i data-bind=" css: {'icon-folder-open-alt': isExpanded(), 'icon-folder-close-alt': !isExpanded()}"></i><span data-bind=" text: name"></span></a> <a href="#" class="media-library-navigation-folder-link"><i class="fa" data-bind=" css: {'fa-folder-open-o': isExpanded(), 'fa-folder-o': !isExpanded()}"></i><span data-bind=" text: name"></span></a>
</div> </div>
<ul data-bind="template: { name: 'media-folder-template', foreach: childFolders, afterRender: afterRenderMediaFolderTemplate}, visible: isExpanded()"> <ul data-bind="template: { name: 'media-folder-template', foreach: childFolders, afterRender: afterRenderMediaFolderTemplate}, visible: isExpanded()">
</ul> </ul>

View File

@ -53,10 +53,10 @@
<fieldset> <fieldset>
<legend>@T("Please enter the URL of the embeddable media you want to integrate (requires an oEmbed compatible media provider such as YouTube):")</legend> <legend>@T("Please enter the URL of the embeddable media you want to integrate (requires an oEmbed compatible media provider such as YouTube):")</legend>
<div id="icon"> <div id="icon">
<button type="submit" class="icon-download">@T("Preview")</button> <button type="submit" class="fa fa-download">@T("Preview")</button>
</div> </div>
<div id="query"> <div id="query">
<input name="url" type="text" autofocus=autofocus autofocus=autofocus placeholder="@T("media url")" value="@Model.Url" /> <input name="url" type="text" autofocus placeholder="@T("media url")" value="@Model.Url" />
</div> </div>
</fieldset> </fieldset>
<fieldset> <fieldset>

View File

@ -1,6 +1 @@
@using Orchard.MediaLibrary.ViewModels <li><a href="#" data-bind="click: selectRecent, css: { selected: !displayed() }" id="button-recent"><i class="fa fa-clock-o"></i>@T("Recent")</a>
@{
MediaManagerIndexViewModel viewModel = Model.MediaManagerIndexViewModel;
}
<li><a href="#" data-bind="click: selectRecent, css: { selected: !displayed() }" id="button-recent"><i class="icon-time"></i>@T("Recent")</a>

View File

@ -37,7 +37,7 @@
<form data-bind="submit: doSearch"> <form data-bind="submit: doSearch">
<div class="query-container"> <div class="query-container">
<div id="icon"> <div id="icon">
<button type="submit" class="icon-search"></button> <button type="submit" class="fa fa-search"></button>
</div> </div>
<div id="query"> <div id="query">
<input type="text" autofocus placeholder="@T("search")"/> <input type="text" autofocus placeholder="@T("search")"/>

View File

@ -35,6 +35,7 @@ namespace Orchard.Mvc.ViewEngines.Razor {
// enable /Views/"EditorTemplates/+{templateName} // enable /Views/"EditorTemplates/+{templateName}
var partialViewLocationFormats = new[] { var partialViewLocationFormats = new[] {
parameters.VirtualPath + "/Views/{0}.cshtml", parameters.VirtualPath + "/Views/{0}.cshtml",
parameters.VirtualPath + "/Views/{1}/{0}.cshtml",
}; };
//Logger.Debug("PartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", partialViewLocationFormats)); //Logger.Debug("PartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", partialViewLocationFormats));