mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-03 03:58:13 +08:00
Fixing media popup windows
--HG-- branch : 1.x extra : rebase_source : 15e4f7844a8c6fb35522c86aef4d2eb79cb2fe7b
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
<fieldset class="save-button">
|
||||
@using Orchard.Utility.Extensions
|
||||
<fieldset class="save-button">
|
||||
<button class="primaryAction" type="submit" name="submit.Save" value="submit.Save">@T("Save")</button>
|
||||
|
||||
@{
|
||||
var returnUrl = Request.QueryString["returnUrl"];
|
||||
}
|
||||
|
||||
@if (!String.IsNullOrWhiteSpace(returnUrl) && Request.IsLocalUrl(returnUrl)) {
|
||||
<a id="button-cancel" href="@returnUrl" class="button">@T("Cancel")</a>
|
||||
}
|
||||
</fieldset>
|
||||
@@ -64,10 +64,6 @@
|
||||
__RequestVerificationToken: $("input[name=__RequestVerificationToken]").val()
|
||||
})
|
||||
.done(function () {
|
||||
if (parent.$.colorbox) {
|
||||
parent.$.colorbox.close();
|
||||
};
|
||||
|
||||
window.location = $('#button-cancel').attr('href');
|
||||
});
|
||||
};
|
||||
@@ -76,9 +72,6 @@
|
||||
});
|
||||
|
||||
$('#button-cancel').click(function () {
|
||||
console.log('closing');
|
||||
parent.$.colorbox.close();
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Import(int id, bool dialog = false) {
|
||||
public ActionResult Import(int id) {
|
||||
var mediaProviderMenu = _navigationManager.BuildMenu("mediaproviders");
|
||||
var imageSets = _navigationManager.BuildImageSets("mediaproviders");
|
||||
|
||||
@@ -67,7 +67,6 @@ namespace Orchard.MediaLibrary.Controllers {
|
||||
|
||||
|
||||
var viewModel = new MediaManagerImportViewModel {
|
||||
DialogMode = dialog,
|
||||
Menu = mediaProviderMenu,
|
||||
Hierarchy = hierarchy.ToReadOnlyCollection(),
|
||||
ImageSets = imageSets,
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Mvc.Filters;
|
||||
using Orchard.UI.Resources;
|
||||
|
||||
namespace Orchard.MediaLibrary {
|
||||
public class ModalAdminFilter : FilterProvider, IResultFilter {
|
||||
private readonly IResourceManager _resourceManager;
|
||||
|
||||
public ModalAdminFilter(IResourceManager resourceManager) {
|
||||
_resourceManager = resourceManager;
|
||||
}
|
||||
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
// should only run on a full view rendering result
|
||||
if (!(filterContext.Result is ViewResult) || !UI.Admin.AdminFilter.IsApplied(filterContext.RequestContext))
|
||||
return;
|
||||
_resourceManager.Include("stylesheet", "~/Modules/Orchard.MediaLibrary/Styles/dialog-mode.css", null);
|
||||
_resourceManager.Include("script", "~/Modules/Orchard.MediaLibrary/Scripts/modal-window.js", null);
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,6 +69,7 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\modal-window.js" />
|
||||
<Content Include="Scripts\history.js" />
|
||||
<Content Include="Scripts\knockout-2.2.1.js" />
|
||||
<Content Include="Styles\menu.oembed-mediaproviders.css" />
|
||||
@@ -113,6 +114,7 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ModalAdminFilter.cs" />
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\ClientStorageController.cs" />
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
var w = document.defaultView || document.parentWindow;
|
||||
var frames = w.parent.document.getElementsByTagName('iframe');
|
||||
for (var i = frames.length; i-- > 0;) {
|
||||
var frame = frames[i];
|
||||
if (frame.className.indexOf('cboxIframe') > -1) {
|
||||
frame.contentWindow.document.documentElement.className += ' media-library-modal-window';
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,18 @@
|
||||
#header, #menu {
|
||||
.media-library-modal-window #header,
|
||||
.media-library-modal-window #menu,
|
||||
.media-library-modal-window #footer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#media-library-main-selection-select {
|
||||
.media-library-modal-window #media-library-main-selection-select {
|
||||
display: initial;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.media-library-modal-window #main {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.media-library-modal-window #layout-content {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,5 @@ namespace Orchard.MediaLibrary.ViewModels {
|
||||
public IEnumerable<MenuItem> Menu { get; set; }
|
||||
public IEnumerable<string> ImageSets { get; set; }
|
||||
public ICollection<MediaFolder> Hierarchy { get; set; }
|
||||
public bool DialogMode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,9 +4,6 @@
|
||||
Style.Require("MediaManagerAdmin");
|
||||
Layout.Title = T("Media Library");
|
||||
|
||||
if (Model.DialogMode) {
|
||||
Style.Include("dialog-mode.css");
|
||||
}
|
||||
|
||||
if (Model.ImageSets != null) {
|
||||
foreach (var imageSet in Model.ImageSets) {
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
Script.Include("knockout-2.2.1.js");
|
||||
Script.Include("history.js");
|
||||
Style.Require("FontAwesome");
|
||||
|
||||
if (Model.DialogMode) {
|
||||
Style.Include("dialog-mode.css");
|
||||
}
|
||||
|
||||
Layout.Title = T("Media Library");
|
||||
}
|
||||
|
||||
@@ -24,12 +24,12 @@
|
||||
href: url,
|
||||
iframe: true,
|
||||
reposition: true,
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
width: "90%",
|
||||
height: "90%",
|
||||
onLoad: function() {
|
||||
// hide the scrollbars from the main window
|
||||
$('html, body').css('overflow', 'hidden');
|
||||
$('#cboxClose').remove();
|
||||
//$('#cboxClose').remove();
|
||||
},
|
||||
onClosed: function() {
|
||||
$('html, body').css('overflow', '');
|
||||
|
||||
Reference in New Issue
Block a user