/// <summary> /// Retourne des informations sur les images de texte riche disponibles pour le contenu /// actuellement en création/modification /// </summary> /// <param name="path">Inutile</param> /// <returns>Instance d'un JsonResult contenant les info des images dispos</returns> public JsonResult Read(string path) { IEnumerable<Media> l_medias = MediaCollection.LoadRichTextAvailableImages(SessionHelper.ContenuInModificationId); List<ImageBrowserEntry> l_entries = new List<ImageBrowserEntry>(); ImageBrowserEntry l_entry; foreach (Media l_media in l_medias) { l_entry = new ImageBrowserEntry() { Size = l_media.Fichier.Size, Name = l_media.Id.ToString() }; l_entries.Add(l_entry); } return Json(l_entries); }
public virtual ActionResult Create(string path, ImageBrowserEntry entry) { path = NormalizePath(path); var name = entry.Name; if (name.HasValue() && AuthorizeCreateDirectory(path, name)) { var physicalPath = Path.Combine(Server.MapPath(path), name); if (!Directory.Exists(physicalPath)) { Directory.CreateDirectory(physicalPath); } return(Json(entry)); } throw new HttpException(403, "Forbidden"); }
public virtual ActionResult Destroy(string path, ImageBrowserEntry entry) { path = NormalizePath(path); if (entry != null) { path = pathProvider.CombinePaths(path, entry.Name); if (entry.EntryType == ImageBrowserEntryType.File) { DeleteFile(path); } else { DeleteDirectory(path); } return(Json(null)); } throw new HttpException(404, "File Not Found"); }
public virtual ActionResult Destroy(string path, ImageBrowserEntry entry) { path = NormalizePath(path); if (entry != null) { path = pathProvider.CombinePaths(path, entry.Name); if (entry.EntryType == ImageBrowserEntryType.File) { DeleteFile(path); } else { DeleteDirectory(path); } return Json(new object[0]); } throw new HttpException(404, "File Not Found"); }
public virtual ActionResult Create(string path, ImageBrowserEntry entry) { path = NormalizePath(path); var name = entry.Name; if (name.HasValue() && AuthorizeCreateDirectory(path, name)) { var physicalPath = Path.Combine(Server.MapPath(path), name); if (!Directory.Exists(physicalPath)) { Directory.CreateDirectory(physicalPath); } return Json(entry); } throw new HttpException(403, "Forbidden"); }