コード例 #1
0
        public ActionResult New(string tabId, int parentId, int id)
        {
            var folder = SiteFolderService.New(parentId, id);
            var model  = SiteFolderViewModel.Create(folder, tabId, parentId);

            return(JsonHtml("FolderProperties", model));
        }
コード例 #2
0
        public ActionResult RemoveFile(int parentId, string id)
        {
            string[] ids    = { id };
            var      result = SiteFolderService.RemoveFiles(parentId, ids);

            return(Json(result));
        }
コード例 #3
0
        public ActionResult FileProperties(string tabId, int parentId, string id, string successfulActionCode)
        {
            var file  = SiteFolderService.GetFile(parentId, id);
            var model = FileViewModel.Create(file, tabId, parentId, true);

            model.SuccesfulActionCode = successfulActionCode;
            return(JsonHtml("FileProperties", model));
        }
コード例 #4
0
        public ActionResult Properties(string tabId, int parentId, int id, string successfulActionCode)
        {
            var folder = SiteFolderService.Read(id);
            var model  = SiteFolderViewModel.Create(folder, tabId, parentId);

            model.SuccesfulActionCode = successfulActionCode;
            return(JsonHtml("FolderProperties", model));
        }
コード例 #5
0
ファイル: SiteController.cs プロジェクト: QuantumArt/QP
        public JsonResult _FolderPath(int folderId)
        {
            var folder = SiteFolderService.GetById(folderId);

            return(Json(new
            {
                success = true,
                path = folder.PathInfo.Path,
                url = folder.PathInfo.Url,
                libraryPath = folder.OsSpecificPath
            }));
        }
コード例 #6
0
        public ActionResult FileProperties(string tabId, int parentId, string id, FormCollection collection)
        {
            var file  = SiteFolderService.GetFile(parentId, id);
            var model = FileViewModel.Create(file, tabId, parentId, true);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                SiteFolderService.SaveFile(model.File);
                return(Redirect("FileProperties", new { tabId, parentId, id = model.Id, successfulActionCode = ActionCode.UpdateSiteFile }));
            }

            return(JsonHtml("FileProperties", model));
        }
コード例 #7
0
        public ActionResult Properties(string tabId, int parentId, int id, FormCollection collection)
        {
            var folder = SiteFolderService.ReadForUpdate(id);
            var model  = SiteFolderViewModel.Create(folder, tabId, parentId);

            TryUpdateModel(model);
            model.Validate(ModelState);
            if (ModelState.IsValid)
            {
                model.Data = SiteFolderService.Update(model.Data);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.UpdateSite }));
            }

            return(JsonHtml("FolderProperties", model));
        }
コード例 #8
0
        public JsonResult _FolderPath(int folderId)
        {
            var folder = SiteFolderService.GetById(folderId);

            return(new JsonResult
            {
                Data = new
                {
                    success = true,
                    path = folder.PathInfo.Path,
                    url = folder.PathInfo.Url,
                    libraryPath = folder.Path
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
コード例 #9
0
ファイル: SiteFolderController.cs プロジェクト: QuantumArt/QP
        public async Task <ActionResult> New(string tabId, int parentId, int id, IFormCollection collection)
        {
            var folder = SiteFolderService.NewForSave(parentId, id);
            var model  = SiteFolderViewModel.Create(folder, tabId, parentId);

            await TryUpdateModelAsync(model);

            if (ModelState.IsValid)
            {
                model.Data = SiteFolderService.Save(model.Data);
                PersistResultId(model.Data.Id);
                return(Redirect("Properties", new { tabId, parentId, id = model.Data.Id, successfulActionCode = ActionCode.SaveSiteFolder }));
            }

            return(await JsonHtml("FolderProperties", model));
        }
コード例 #10
0
        /// <summary>
        /// Делает невидимыми некоторые элементы контекстного меню для корневого Site Folder
        /// </summary>
        public static IEnumerable <BackendActionStatus> ResolveStatusesForSiteFolder(this IEnumerable <BackendActionStatus> statuses, int entityId)
        {
            var folder = SiteFolderService.GetById(entityId);

            if (!folder.ParentId.HasValue)
            {
                var codes = new[] { ActionCode.SiteFolderProperties, ActionCode.RemoveSiteFolder };
                foreach (var status in statuses)
                {
                    if (codes.Contains(status.Code))
                    {
                        status.Visible = false;
                    }
                }
            }

            return(statuses);
        }
コード例 #11
0
        public ActionResult MultipleRemoveFiles(int parentId, string[] IDs)
        {
            var result = SiteFolderService.RemoveFiles(parentId, IDs);

            return(Json(result));
        }
コード例 #12
0
ファイル: ThumbnailController.cs プロジェクト: QuantumArt/QP
 public FileResult _SiteFileThumbnail(int folderId, string fileName)
 {
     return(GetThumbnailResult(SiteFolderService.GetPath(folderId, fileName)));
 }
コード例 #13
0
ファイル: SiteFolderController.cs プロジェクト: QuantumArt/QP
        public ActionResult MultipleRemoveFiles(int parentId, [FromBody] SelectedStringItemsViewModel selModel)
        {
            var result = SiteFolderService.RemoveFiles(parentId, selModel.Ids);

            return(Json(result));
        }
コード例 #14
0
ファイル: LibraryController.cs プロジェクト: AuthorProxy/QP
        public JsonResult TestLibraryFileDownload(int id, string fileName, string entityTypeCode)
        {
            var pathInfo = entityTypeCode == EntityTypeCode.ContentFile ? ContentFolderService.GetPathInfo(id) : SiteFolderService.GetPathInfo(id);

            if (pathInfo == null)
            {
                var formatString = entityTypeCode == EntityTypeCode.ContentFile ? LibraryStrings.ContentFolderNotExists : LibraryStrings.SiteFolderNotExists;
                return(Json(new { proceed = false, msg = string.Format(formatString, id) }, JsonRequestBehavior.AllowGet));
            }

            return(GetTestFileDownloadResult(pathInfo, fileName, false));
        }
コード例 #15
0
ファイル: LibraryController.cs プロジェクト: AuthorProxy/QP
        public JsonResult GetLibraryImageProperties(int id, string fileName, string entityTypeCode)
        {
            var pathInfo = entityTypeCode == EntityTypeCode.ContentFile ? ContentFolderService.GetPathInfo(id) : SiteFolderService.GetPathInfo(id);

            return(GetFileProperties(pathInfo, fileName, new FilePropertiesOptions()));
        }
コード例 #16
0
        public ActionResult Remove(int id)
        {
            var result = SiteFolderService.Remove(id);

            return(JsonMessageResult(result));
        }
コード例 #17
0
 public ActionResult RemovePreAction(int parentId, int id) => Json(SiteFolderService.RemovePreAction(id));