public static XhtmlDocument GetRenderingLayout(string formName) { if (HasCustomRenderingLayout(formName)) { var key = GetKey(formName); var layout = Localization.T(key); return(XhtmlDocument.Parse(layout)); } var model = ModelsFacade.GetModel(formName); if (model == null) { throw new ArgumentException($"Form '{formName}' not loaded"); } var doc = new XhtmlDocument(); foreach (var field in model.Fields.Where(f => f.Label != null)) { doc.Body.Add(new XElement(Namespaces.Xhtml + "p", $"%{field.Name}%")); } return(doc); }
public static IEnumerable <ModelSubmit> LoadSubmits(string name) { var model = ModelsFacade.GetModel(name); var dir = Path.Combine(ModelsFacade.RootPath, name, "Submits"); var files = Directory.GetFiles(dir, "*.xml"); return(files.Select(XElement.Load).Select(f => ModelSubmit.Parse(model, f))); }