mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 18:24:49 +08:00
Added sequential upload parameter to fileupload() parameters when importing media (#8650)
* Added sequential upload parameter to fileupload() parameters when importing media. * Added setting to limit concurrent uploads
This commit is contained in:
parent
7bf78ef852
commit
babe1d665d
@ -13,6 +13,11 @@ namespace Orchard.MediaLibrary.Models {
|
|||||||
set { this.Store(x => x.UploadAllowedFileTypeWhitelist, value); }
|
set { this.Store(x => x.UploadAllowedFileTypeWhitelist, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int LimitConcurrentUploads {
|
||||||
|
get { return this.Retrieve(x => x.LimitConcurrentUploads); }
|
||||||
|
set { this.Store(x => x.LimitConcurrentUploads, value); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsFileAllowed(string filename) {
|
public bool IsFileAllowed(string filename) {
|
||||||
|
|
||||||
var allowedExtensions = (UploadAllowedFileTypeWhitelist ?? "")
|
var allowedExtensions = (UploadAllowedFileTypeWhitelist ?? "")
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
@model Orchard.MediaLibrary.ViewModels.ImportMediaViewModel
|
@using Orchard.MediaLibrary.Models;
|
||||||
|
@using Orchard.ContentManagement;
|
||||||
|
|
||||||
|
@model Orchard.MediaLibrary.ViewModels.ImportMediaViewModel
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
@ -12,6 +15,8 @@
|
|||||||
|
|
||||||
Script.Require("jQueryFileUpload").AtFoot();
|
Script.Require("jQueryFileUpload").AtFoot();
|
||||||
Script.Require("Knockout").AtFoot();
|
Script.Require("Knockout").AtFoot();
|
||||||
|
|
||||||
|
var settings = WorkContext.CurrentSite.As<MediaLibrarySettingsPart>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Display.Metas()
|
@Display.Metas()
|
||||||
@ -23,7 +28,7 @@
|
|||||||
<div id="clientstorage-main">
|
<div id="clientstorage-main">
|
||||||
<div id="message">@T("Click here, Drop files or Paste images")</div>
|
<div id="message">@T("Click here, Drop files or Paste images")</div>
|
||||||
<div id="fileupload">
|
<div id="fileupload">
|
||||||
<input type="file" name="files[]" @if(Model.Replace == null) { <text>multiple="multiple"</text> } >
|
<input type="file" name="files[]" @if (Model.Replace == null) {<text>multiple="multiple" </text>} />
|
||||||
<ul id="fileupload-transfers" data-bind="foreach: transfers">
|
<ul id="fileupload-transfers" data-bind="foreach: transfers">
|
||||||
<li data-bind="css: status()" class="transfer">
|
<li data-bind="css: status()" class="transfer">
|
||||||
<div class="media-thumbnail" data-bind="html: thumbnail(), visible: status() == 'success'"></div>
|
<div class="media-thumbnail" data-bind="html: thumbnail(), visible: status() == 'success'"></div>
|
||||||
@ -36,9 +41,9 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@using (Script.Foot()) {
|
@using (Script.Foot()) {
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|
||||||
@ -80,6 +85,7 @@
|
|||||||
// Add drag-n-drop HTML5 support
|
// Add drag-n-drop HTML5 support
|
||||||
$('#fileupload').fileupload({
|
$('#fileupload').fileupload({
|
||||||
autoUpload: true,
|
autoUpload: true,
|
||||||
|
@((settings.LimitConcurrentUploads != null && settings.LimitConcurrentUploads > 0) ? "limitConcurrentUploads:" + settings.LimitConcurrentUploads + "," : "")
|
||||||
@if(Model.Replace == null) {
|
@if(Model.Replace == null) {
|
||||||
<text>
|
<text>
|
||||||
url: '@Url.Action("Upload")',
|
url: '@Url.Action("Upload")',
|
||||||
@ -170,9 +176,9 @@
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|
||||||
@Display.FootScripts()
|
@Display.FootScripts()
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -6,5 +6,8 @@
|
|||||||
<label for="@Html.IdFor(m => m.UploadAllowedFileTypeWhitelist)">@T("Accepted file extensions")</label>
|
<label for="@Html.IdFor(m => m.UploadAllowedFileTypeWhitelist)">@T("Accepted file extensions")</label>
|
||||||
@Html.TextBoxFor(m => m.UploadAllowedFileTypeWhitelist, new { @class = "text large"})
|
@Html.TextBoxFor(m => m.UploadAllowedFileTypeWhitelist, new { @class = "text large"})
|
||||||
<span class="hint">@T("A comma separated list of file extensions, e.g., \".jpg, .avi, .txt\". Leave empty to accept any file types.")</span>
|
<span class="hint">@T("A comma separated list of file extensions, e.g., \".jpg, .avi, .txt\". Leave empty to accept any file types.")</span>
|
||||||
|
<label for="@Html.IdFor(m => m.LimitConcurrentUploads)">@T("Concurrent uploads limit")</label>
|
||||||
|
@Html.TextBoxFor(m => m.LimitConcurrentUploads, new { @class = "text medium"})
|
||||||
|
<span class="hint">@T("To limit the number of concurrent uploads, set this value to an integer greater than 0")</span>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
Loading…
Reference in New Issue
Block a user