public FileResult Display(int id) { var o = OrgContentInfo.GetOc(id); var image = o.image; return(File(image.Bits, image.Mimetype)); }
public ActionResult Update(int id, string Html) { var o = OrgContentInfo.Get(CurrentDatabase, id); o.Html = Html; return(Redirect("/OrgContent/" + id)); }
public ActionResult Update(int OrgId, string Html) { var o = OrgContentInfo.Get(OrgId); o.Html = Html; ImageData.DbUtil.Db.SubmitChanges(); return(Redirect("/OrgContent/Index/" + OrgId)); }
public ActionResult Index(int id, int?pid) { var o = OrgContentInfo.Get(id); if (o == null) { return(Content("<h2>Not an Organization</h2>")); } if (!Util.UserPeopleId.HasValue) { return(Redirect("/OrgContent/Login/" + id)); } if (o.TryRunPython(pid ?? Util.UserPeopleId.Value)) { return(View("ScriptResults", o)); } var org = CurrentDatabase.LoadOrganizationById(o.OrgId); // Try to load a template specific to this org type var template = CurrentDatabase.ContentHtml($"OrgContent-{org.OrganizationType?.Description}", null); // Try to fall back on a standard template if (template == null) { template = CurrentDatabase.ContentHtml("OrgContent", null); } if (template != null) { template = template.Replace("{content}", o.Html ?? string.Empty) .Replace("{location}", org.Location ?? string.Empty) .Replace("{type}", org.OrganizationType?.Description ?? string.Empty) .Replace("{division}", org.Division?.Name ?? string.Empty) .Replace("{campus}", org.Campu?.Description ?? string.Empty) .Replace("{orgid}", org.OrganizationId.ToString()) .Replace("{name}", org.OrganizationName ?? string.Empty); org.GetOrganizationExtras() .ForEach( ev => { template = template.Replace($"{{{ev.Field}}}", ev.Data ?? ev.StrValue ?? string.Empty); }); if (template.Contains("{directory}")) { ViewBag.qid = CurrentDatabase.NewOrgFilter(id).QueryId; } ViewBag.template = template; return(View(o)); } return(View(o)); }
public ActionResult Edit(int id) { var o = OrgContentInfo.Get(id); if (o == null || o.Inactive || !Util.UserPeopleId.HasValue || !o.CanEdit) { return(Redirect("/OrgContent/Index/" + id)); } return(View(o)); }
public ActionResult Index(int id) { var o = OrgContentInfo.Get(id); if (o == null) { return(Content("<h2>Not an Organization</h2>")); } if (!Util.UserPeopleId.HasValue) { return(Redirect("/OrgContent/Login/" + id)); } return(View(o)); }