Merge branch '1.9.x' into dev

Conflicts:
	src/Orchard.Web/Modules/Orchard.Taxonomies/Views/Admin/Index.cshtml
This commit is contained in:
Sebastien Ros
2016-01-15 09:01:39 -08:00
4 changed files with 21 additions and 1 deletions

View File

@@ -83,6 +83,12 @@ namespace Orchard.MediaLibrary.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
} }
// Shouldn't be able to rename the root folder
if (IsRootFolder(folderPath)) {
return new HttpUnauthorizedResult();
}
var viewModel = new MediaManagerFolderEditViewModel { var viewModel = new MediaManagerFolderEditViewModel {
FolderPath = folderPath, FolderPath = folderPath,
Name = folderPath.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Last() Name = folderPath.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Last()
@@ -104,6 +110,11 @@ namespace Orchard.MediaLibrary.Controllers {
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();
} }
// Shouldn't be able to rename the root folder
if(IsRootFolder(viewModel.FolderPath)) {
return new HttpUnauthorizedResult();
}
try { try {
_mediaLibraryService.RenameFolder(viewModel.FolderPath, viewModel.Name); _mediaLibraryService.RenameFolder(viewModel.FolderPath, viewModel.Name);
Services.Notifier.Information(T("Media folder renamed")); Services.Notifier.Information(T("Media folder renamed"));
@@ -165,5 +176,10 @@ namespace Orchard.MediaLibrary.Controllers {
return Json(true); return Json(true);
} }
private bool IsRootFolder(string folderPath) {
var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder();
return String.Equals(rootMediaFolder.MediaPath, folderPath, StringComparison.OrdinalIgnoreCase);
}
} }
} }

View File

@@ -609,5 +609,8 @@ $(function () {
}); });
return false; return false;
}); });
// Select recent folder when the page is initialized.
viewModel.selectRecent();
})(window.mediaLibrarySettings); })(window.mediaLibrarySettings);
}) })

View File

@@ -83,6 +83,7 @@ namespace Orchard.Taxonomies.Controllers {
return RedirectToAction("Index"); return RedirectToAction("Index");
} }
[HttpPost]
public ActionResult Delete(int id) { public ActionResult Delete(int id) {
if (!Services.Authorizer.Authorize(Permissions.CreateTaxonomy, T("Couldn't delete taxonomy"))) if (!Services.Authorizer.Authorize(Permissions.CreateTaxonomy, T("Couldn't delete taxonomy")))
return new HttpUnauthorizedResult(); return new HttpUnauthorizedResult();

View File

@@ -52,7 +52,7 @@
@if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) { @if (!taxonomyEntry.IsInternal || Authorizer.Authorize(Orchard.Security.StandardPermissions.SiteOwner)) {
@Html.ItemEditLink(T("Edit").Text, taxonomyEntry.ContentItem) <text>|</text> @Html.ItemEditLink(T("Edit").Text, taxonomyEntry.ContentItem) <text>|</text>
@Html.ActionLink(T("Terms").Text, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) <text>|</text> @Html.ActionLink(T("Terms").Text, "Index", "TermAdmin", new { taxonomyId = taxonomyEntry.Id }, new object { }) <text>|</text>
@Html.ActionLink(T("Delete").Text, "Delete", new { id = taxonomyEntry.Id }, new object { }) <text>|</text> @Html.ActionLink(T("Delete").Text, "Delete", new { id = taxonomyEntry.Id }, new { itemprop = "RemoveUrl UnsafeUrl" }) <text>|</text>
@Html.ActionLink(T("Import").Text, "Import", new { id = taxonomyEntry.Id }, new object { }) @Html.ActionLink(T("Import").Text, "Import", new { id = taxonomyEntry.Id }, new object { })
} }
</td> </td>