mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
var listItems = new[] { new SelectListItem { Text = T("(None)").Text, Value = "0" } }
|
||||
.Concat(containers.Select(x => new SelectListItem {
|
||||
Value = Convert.ToString(x.Id),
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + x.As<IRoutableAspect>().Title,
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + _contentManager.GetItemMetadata(x.ContentItem).DisplayText,
|
||||
Selected = x.Id == model.ContainerId,
|
||||
}))
|
||||
.ToList();
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace Lists.Controllers {
|
||||
// ensure the item can be in that container.
|
||||
if (!string.IsNullOrEmpty(itemContentType) && item.ContentType != itemContentType) {
|
||||
Services.TransactionManager.Cancel();
|
||||
Services.Notifier.Information(T("One or more items could not be moved to '{0}' because it is restricted to containing items of type '{1}'.", _contentManager.GetItemMetadata(targetContainer).DisplayText, itemContentType));
|
||||
Services.Notifier.Information(T("One or more items could not be moved to '{0}' because it is restricted to containing items of type '{1}'.", _contentManager.GetItemMetadata(targetContainer).DisplayText ?? targetContainer.ContentItem.ContentType, itemContentType));
|
||||
return true; // todo: transactions
|
||||
}
|
||||
|
||||
@@ -319,7 +319,7 @@ namespace Lists.Controllers {
|
||||
FixItemPath(item);
|
||||
}
|
||||
Services.Notifier.Information(T("Content successfully moved to <a href=\"{0}\">{1}</a>.",
|
||||
Url.Action("List", new { containerId = targetContainerId }), _contentManager.GetItemMetadata(targetContainer).DisplayText));
|
||||
Url.Action("List", new { containerId = targetContainerId }), _contentManager.GetItemMetadata(targetContainer).DisplayText ?? targetContainer.ContentItem.ContentType));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
|
||||
var targetContainers = ((IEnumerable<ContentItem>)Model.Containers).Select(
|
||||
contentItem => new SelectListItem {
|
||||
Text = T("Move to {0}", contentItem.ContentManager.GetItemMetadata(contentItem).DisplayText).ToString(),
|
||||
Text = T("Move to {0}", contentItem.ContentManager.GetItemMetadata(contentItem).DisplayText ?? contentItem.ContentType).ToString(),
|
||||
Value = contentItem.Id.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
Selected = contentItem.Id == targetContainerId
|
||||
}).ToList();
|
||||
|
||||
var sourceContainers = ((IEnumerable<ContentItem>)Model.Containers).Select(
|
||||
contentItem => new SelectListItem {
|
||||
Text = contentItem.ContentManager.GetItemMetadata(contentItem).DisplayText,
|
||||
Text = contentItem.ContentManager.GetItemMetadata(contentItem).DisplayText ?? contentItem.ContentType,
|
||||
Value = contentItem.Id.ToString(System.Globalization.CultureInfo.InvariantCulture),
|
||||
Selected = contentItem.Id == sourceContainerId
|
||||
}).ToList();
|
||||
|
||||
@@ -31,15 +31,16 @@
|
||||
</div>
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost()) {
|
||||
var options = (ContentOptions) Model.Options;
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="publishActions">@T("Actions:")</label>
|
||||
<select id="publishActions" name="Options.BulkAction">
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString())
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString())
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.Remove, T("Delete").ToString())
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.RemoveFromList, T("Remove from List").ToString())
|
||||
@Html.SelectOption((ContentsBulkAction)Model.Options.BulkAction, ContentsBulkAction.MoveToList, T("Move to List...").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.Remove, T("Delete").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.RemoveFromList, T("Remove from List").ToString())
|
||||
@Html.SelectOption(options.BulkAction, ContentsBulkAction.MoveToList, T("Move to List...").ToString())
|
||||
</select>
|
||||
@Html.DropDownList("TargetContainerId", lists, new { id = "TargetContainerId" })
|
||||
<button type="submit" name="submit.BulkEdit" value="yes">@T("Apply")</button>
|
||||
|
||||
@@ -233,16 +233,8 @@ namespace Orchard.Media.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
public ActionResult EditMedia(string name, DateTime lastUpdated, long size, string folderName, string mediaPath) {
|
||||
var model = new MediaItemEditViewModel();
|
||||
model.Name = name;
|
||||
// todo: reimplement
|
||||
//model.Caption = caption ?? String.Empty;
|
||||
model.LastUpdated = lastUpdated;
|
||||
model.Size = size;
|
||||
model.FolderName = folderName;
|
||||
model.MediaPath = mediaPath;
|
||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(mediaPath, name));
|
||||
public ActionResult EditMedia(MediaItemEditViewModel model) {
|
||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(model.MediaPath, model.Name));
|
||||
return View(model);
|
||||
}
|
||||
|
||||
@@ -293,9 +285,8 @@ namespace Orchard.Media.Controllers {
|
||||
mediaPath = viewModel.MediaPath });
|
||||
}
|
||||
catch (Exception exception) {
|
||||
this.Error(exception, T("Editing media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
|
||||
return View(viewModel);
|
||||
this.Error(exception, T("Editing media file failed."), Logger, Services.Notifier);
|
||||
return EditMedia(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,7 +140,10 @@ namespace Orchard.Media.Services {
|
||||
Argument.ThrowIfNullOrEmpty(newFileName, "newFileName");
|
||||
|
||||
if (!FileAllowed(newFileName, false)) {
|
||||
throw new ArgumentException(T("New file name {0} is not allowed", newFileName).ToString());
|
||||
if (string.IsNullOrEmpty(Path.GetExtension(newFileName))) {
|
||||
throw new ArgumentException(T("New file name \"{0}\" is not allowed. Please provide a file extension.", newFileName).ToString());
|
||||
}
|
||||
throw new ArgumentException(T("New file name \"{0}\" is not allowed.", newFileName).ToString());
|
||||
}
|
||||
|
||||
_storageProvider.RenameFile(_storageProvider.Combine(folderPath, currentFileName), _storageProvider.Combine(folderPath, newFileName));
|
||||
|
||||
Reference in New Issue
Block a user