コード例 #1
0
ファイル: FolderController.cs プロジェクト: kanujhun/orchard
        public ActionResult Create(string folderPath) {
            if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaManagerFolderCreateViewModel {
                Hierarchy = _mediaLibraryService.GetMediaFolders(folderPath),
                FolderPath = folderPath
            };

            return View(viewModel);
        }
コード例 #2
0
        public ActionResult Create(int? id) {
            if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaManagerFolderCreateViewModel {
                Hierarchy = id.HasValue ? _mediaLibraryService.GetMediaFolderHierarchy(id.Value) : Enumerable.Empty<MediaFolder>(),
                ParentFolderId = id
            };

            return View(viewModel);
        }
コード例 #3
0
ファイル: FolderController.cs プロジェクト: Higea/Orchard
        public ActionResult Create(string folderPath) {
            if (!Services.Authorizer.Authorize(Permissions.ManageOwnMedia, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

            // If the user is trying to access a folder above his boundaries, redirect him to his home folder
            var rootMediaFolder = _mediaLibraryService.GetRootMediaFolder();
            if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent) && !_mediaLibraryService.CanManageMediaFolder(folderPath)) {
                return RedirectToAction("Create", new { folderPath = rootMediaFolder.MediaPath });
            }

            var viewModel = new MediaManagerFolderCreateViewModel {
                Hierarchy = _mediaLibraryService.GetMediaFolders(folderPath),
                FolderPath = folderPath
            };

            return View(viewModel);
        }
コード例 #4
0
ファイル: FolderController.cs プロジェクト: kanujhun/orchard
        public ActionResult Create() {
            if (!Services.Authorizer.Authorize(Permissions.ManageMediaContent, T("Couldn't create media folder")))
                return new HttpUnauthorizedResult();

            var viewModel = new MediaManagerFolderCreateViewModel();
            UpdateModel(viewModel);

            try {
                _mediaLibraryService.CreateFolder(viewModel.FolderPath, viewModel.Name);
                Services.Notifier.Information(T("Media folder created"));
            }
            catch (ArgumentException argumentException) {
                Services.Notifier.Error(T("Creating Folder failed: {0}", argumentException.Message));
                Services.TransactionManager.Cancel();
                return View(viewModel);
            }

            return RedirectToAction("Index", "Admin", new { area = "Orchard.MediaLibrary" });

        }