public ActionResult SWIGetReportDetail(string path) { try { SWIFolder folder = getParentFolder(path); if (folder.right == 0) throw new Exception("Error: no right on this folder"); string newPath = getFullPath(path); if (!System.IO.File.Exists(newPath)) throw new Exception("Report path not found"); Repository repository = Repository; Report report = Report.LoadFromFile(newPath, repository); SWIReportDetail result = new SWIReportDetail(); result.views = (from i in report.Views select new SWIView() { guid = i.GUID, name = i.Name, displayName = report.TranslateViewName(i.Name) }).ToArray(); result.outputs = (from i in report.Outputs select new SWIOutput() { guid = i.GUID, name = i.Name, displayName = report.TranslateOutputName(i.Name) }).ToArray(); return Json(result); } catch (Exception ex) { return handleSWIException(ex); } }
public ActionResult SWIGetReportDetail(string path) { try { if (WebUser == null || !WebUser.IsAuthenticated) throw new Exception("Error: user is not authenticated"); if (string.IsNullOrEmpty(path)) throw new Exception("Error: path must be supplied"); string newPath = Repository.ReportsFolder + path; if (!System.IO.File.Exists(newPath)) throw new Exception("Report path not found"); SecurityFolder securityFolder = WebUser.FindSecurityFolder(Path.GetDirectoryName(newPath)); if (securityFolder == null) throw new Exception("Error: this folder is not published"); Repository repository = Repository; Report report = Report.LoadFromFile(newPath, repository); SWIReportDetail result = new SWIReportDetail(); result.views = (from i in report.Views select new SWIView() { guid = i.GUID, name = i.Name, displayName = report.TranslateViewName(i.Name) }).ToArray(); result.outputs= (from i in report.Outputs select new SWIOutput() { guid = i.GUID, name = i.Name, displayName = report.TranslateOutputName(i.Name) }).ToArray(); return Json(result); } catch (Exception ex) { return Json(new { error = ex.Message }); } }