public ActionResult FileActionDefault([FromBody] FileExplorerParams args) { switch (args.ActionType) { case "Read": return(Json(operation.Read(args.Path, args.ExtensionsAllow))); case "CreateFolder": return(Json(operation.CreateFolder(args.Path, args.Name))); case "Paste": return(Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles))); case "Remove": return(Json(operation.Remove(args.Names, args.Path, args.SelectedItems))); case "Rename": return(Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles))); case "GetDetails": return(Json(operation.GetDetails(args.Path, args.Names))); case "Search": return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive))); } return(Json("")); }
public ActionResult FileActionDefault(FileExplorerParams args) { FileExplorerOperations opeartion = new FileExplorerOperations(); switch (args.ActionType) { case "Read": return(Json(opeartion.Read(args.Path, args.ExtensionsAllow))); case "CreateFolder": return(Json(opeartion.CreateFolder(args.Path, args.Name))); case "Paste": return(Json(opeartion.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles))); case "Rename": return(Json(opeartion.Rename(args.Path, args.Name, args.NewName, args.CommonFiles))); case "GetDetails": return(Json(opeartion.GetDetails(args.Path, args.Names))); case "Download": opeartion.Download(args.Path, args.Names); break; case "Upload": opeartion.Upload(args.FileUpload, args.Path); break; case "Search": return(Json(opeartion.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive))); } return(Json("")); }
public ActionResult FileActionThumbnailCompress(FileExplorerParams args) { try { FileExplorerOperations opeartion = new FileExplorerOperations(); if (args.ActionType != "Paste" && args.ActionType != "GetDetails") { var FilePath = opeartion.GetPhysicalPath(opeartion.ToAbsolute(args.Path)); if (!FilePath.ToLower().Contains("fileexplorercontent")) { throw new ArgumentException("'" + FilePath + "' is not accessible. Access is denied."); } } switch (args.ActionType) { case "Read": return(Json(opeartion.Read(args.Path, args.ExtensionsAllow))); //case "CreateFolder": // return Json(opeartion.CreateFolder(args.Path, args.Name)); //case "Paste": // return Json(opeartion.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles)); //case "Remove": // return Json(opeartion.Remove(args.Names, args.Path)); //case "Rename": // return Json(opeartion.Rename(args.Path, args.Name, args.NewName, args.CommonFiles)); case "GetDetails": return(Json(opeartion.GetDetails(args.Path, args.Names))); case "Download": opeartion.Download(args.Path, args.Names); break; //case "Upload": // opeartion.Upload(args.FileUpload, args.Path); // break; case "Search": return(Json(opeartion.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive))); case "GetImage": //Helps to reduce thumbnail image size before loading it into FileExplorer opeartion.GetImage(args.Path, args.CanCompress); break; //provide restriction to modify data in our online samples default: return(new HttpStatusCodeResult(403, "Restricted to modify data in online demo.")); } return(Json("")); } catch (Exception e) { FileExplorerResponse Response = new FileExplorerResponse(); Response.error = e.GetType().FullName + ", " + e.Message; return(Json(Response)); } }
public virtual ActionResult FileAction(FileExplorerParams args) { try { EventPublisher.Publish(new FileExplorerActionEvent(args)); var operation = new FileExplorerOperations(); switch (args.ActionType) { case "Read": return(Json(operation.Read(args.Path, args.ExtensionsAllow), JsonRequestBehavior.AllowGet)); case "CreateFolder": return(Json(operation.CreateFolder(args.Path, args.Name), JsonRequestBehavior.AllowGet)); case "Paste": return(Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles), JsonRequestBehavior.AllowGet)); case "Remove": return(Json(operation.Remove(args.Names, args.Path), JsonRequestBehavior.AllowGet)); case "Rename": return(Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles), JsonRequestBehavior.AllowGet)); case "GetDetails": return(Json(operation.GetDetails(args.Path, args.Names), JsonRequestBehavior.AllowGet)); case "Download": operation.Download(args.Path, args.Names); break; case "Upload": operation.Upload(args.FileUpload, args.Path); break; case "Search": return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive), JsonRequestBehavior.AllowGet)); case "GetImage": operation.GetImage(args.Path, args.CanCompress, args.ImageSize, args.SelectedItems); break; } return(Json("", JsonRequestBehavior.AllowGet)); } catch (Exception e) { var response = new FileExplorerResponse { error = e.GetType().FullName + ", " + e.Message }; return(Json(response, JsonRequestBehavior.AllowGet)); } }
public ActionResult FileActionDefault([FromBody] FileExplorerParams args) { try { if (args.ActionType != "Paste" && args.ActionType != "GetDetails") { var FilePath = operation.GetPhysicalPath(args.Path); if (!FilePath.ToLower().Contains("fileexplorercontent")) { throw new ArgumentException(FilePath + "is not accessible. Access is denied."); } } switch (args.ActionType) { case "Read": return(Json(operation.Read(args.Path, args.ExtensionsAllow))); //case "CreateFolder": // return Json(operation.CreateFolder(args.Path, args.Name)); //case "Paste": // return Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles)); //case "Remove": // return Json(operation.Remove(args.Names, args.Path, args.SelectedItems)); //case "Rename": // return Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles)); case "GetDetails": return(Json(operation.GetDetails(args.Path, args.Names))); case "Search": return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive))); //provide restriction to modify data in our online samples default: throw new Exception("Restricted to modify data in this demo"); } return(Json("")); } catch (Exception e) { FileExplorerResponse Response = new FileExplorerResponse(); Response.error = e.GetType().FullName + ", " + e.Message; return(Json(Response)); } }
// GET: Explorador public ActionResult Explorador(FileExplorerParams args) { FileExplorerOperations operation = new FileExplorerOperations(); switch (args.ActionType) { case "Read": return(Json(operation.Read(args.Path, args.ExtensionsAllow))); case "CreateFolder": return(Json(operation.CreateFolder(args.Path, args.Name))); case "Paste": return(Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles))); case "Remove": return(Json(operation.Remove(args.Names, args.Path))); case "Rename": return(Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles))); case "GetDetails": return(Json(operation.GetDetails(args.Path, args.Names))); case "Download": operation.Download(args.Path, args.Names); break; case "Upload": RedirectToAction("Account/Register"); operation.Upload(args.FileUpload, args.Path); break; case "Search": return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive), JsonRequestBehavior.AllowGet)); } //return Json("", JsonRequestBehavior.AllowGet); ViewBag.MyExplorer = operation; return(View(operation)); }
public ActionResult FileActionDefault([FromBody] FileExplorerParams args) { string startPath = "https://filebrowsercontent.blob.core.windows.net/blob1/"; if (args.Path != null) { args.Path = args.Path.Replace(startPath, ""); } if (args.LocationFrom != null) { args.LocationFrom = args.LocationFrom.Replace(startPath, ""); } if (args.LocationTo != null) { args.LocationTo = args.LocationTo.Replace(startPath, ""); } switch (args.ActionType) { case "Read": return(Json(operation.Read(args.Path, args.ExtensionsAllow))); case "CreateFolder": return(Json(operation.CreateFolder(args.Path, args.Name))); case "Paste": return(Json(operation.Paste(args.LocationFrom, args.LocationTo, args.Names, args.Action, args.CommonFiles, args.SelectedItems))); case "Remove": return(Json(operation.Remove(args.Names, args.Path, args.SelectedItems))); case "Rename": return(Json(operation.Rename(args.Path, args.Name, args.NewName, args.CommonFiles, args.SelectedItems))); case "GetDetails": return(Json(operation.GetDetails(args.Path, args.Names, args.SelectedItems))); case "Search": return(Json(operation.Search(args.Path, args.ExtensionsAllow, args.SearchString, args.CaseSensitive))); } return(Json("")); }
public ActionResult GetImage(FileExplorerParams args) { return(operation.GetImage(args.Path)); }
public ActionResult Upload(FileExplorerParams args) { operation.Upload(args.FileUpload, args.Path); return(Json("")); }
public ActionResult Download(FileExplorerParams args) { return(operation.Download(args.Path, args.Names)); }
public ActionResult Upload(FileExplorerParams args) { //operation.Upload(args.FileUpload, args.Path); //return Json(""); throw new Exception("Restricted to modify data in this demo"); }
public FileExplorerActionEvent(FileExplorerParams fileExplorerParams) { FileExplorerParams = fileExplorerParams; }
public ActionResult GetImage(FileExplorerParams args) { operation.GetImage(args.Path); return(Json("")); }
public ActionResult FileActionDefault(FileExplorerParams args) { switch (args.ActionType) { case "Read": //need to check whether user have permission on project //input: project ID, user ID //if not authorized -> return Json("") //umbraco.helper.GetCurrentUmbracoUser().Id -> project permission table //return Json(FileExplorerOperations.Read(args.Path, args.ExtensionsAllow)); return Json(Read(args.Path, args.ExtensionsAllow)); case "CreateFolder": return Json(FileExplorerOperations.CreateFolder(args.Path, args.Name)); case "Paste": FileExplorerOperations.Paste(args.LocationFrom, args.LocationTo, args.Name.Split(','), args.Action, args.CommonFiles); break; case "Delete": FileExplorerOperations.Delete(args.Name.Split(','), args.Path); break; case "Rename": FileExplorerOperations.Rename(args.Path, args.PreviousName, args.NewName, args.Type, args.CommonFiles); break; case "GetDetails": return Json(GetDetails(args.Path, args.Name, args.Type)); //return Json(FileExplorerOperations.GetDetails(args.Path, args.Name, args.Type)); case "Download": FileExplorerOperations.Download(args.Path); break; case "Upload": foreach(var uf in args.FileUpload) { var f = Services.MediaService.CreateMedia(args.Path, 1001, global::Umbraco.Core.Constants.Conventions.MediaTypes.File); f.SetValue(global::Umbraco.Core.Constants.Conventions.Media.File, (Stream)uf.InputStream); Services.MediaService.Save(f); } FileExplorerOperations.Upload(args.FileUpload, args.Path); break; case "Safety": return Json(GetDetails(args.Path, args.Name, args.Type)); } return Json(""); }