private string PersistLayoutElementInternal( IList <IDictionary <string, string> > layoutData, TemplatedItemPart templatedItem, LayoutTemplatePart layout, IUpdateModel updater, string prefix) { var doc = XDocument.Parse("<data></data>"); var layoutRoot = GetDefinitions(layout, templatedItem.DataDocument); var elementDescriptions = layoutRoot.Elements().ToList(); // Form field names are of the form // TemplatedItemData[element index][property index].Key // and TemplatedItemData[element index][property index].Value, // and get automatically bound to an IList<IDictionary<string, string>> // where the list is over the elements // and the dictionary is over the properties of that element. // Persist form values onto the XML description for the templated item, // walking the tree in the same order that the display was generated var docRoot = doc.Element("data"); Debug.Assert(docRoot != null, "The document should always have a root called data."); var editors = GetLayoutElementEditors( layoutRoot, new XElement("data"), "").ToList(); var context = _wca.GetContext().HttpContext; HtmlHelpers.ResetIndex(context, "LayoutEditorIndex"); PersistLayoutElementPrivate( context, layoutData, elementDescriptions, docRoot, editors, updater, prefix); return(doc.ToString(SaveOptions.DisableFormatting)); }
public void PersistLayoutElement( IList <IDictionary <string, string> > layoutData, TemplatedItemPart templatedItem, LayoutTemplatePart layout, IUpdateModel updater, string prefix) { templatedItem.Data = PersistLayoutElementInternal(layoutData, templatedItem, layout, updater, prefix); }
public IEnumerable <dynamic> GetLayoutElementDisplays( TemplatedItemPart templatedItem, LayoutTemplatePart layout, string displayType) { var contentItem = templatedItem.ContentItem; return(GetLayoutElementDisplays( GetDefinitions(layout, templatedItem.DataDocument), templatedItem.RootElement, contentItem, displayType)); }
public IEnumerable <dynamic> GetLayoutElementEditors(TemplatedItemPart templatedItem, LayoutTemplatePart layout, string prefix) { var definitions = GetDefinitions(layout, templatedItem.DataDocument); return(GetLayoutElementEditors(definitions, templatedItem.RootElement, prefix)); }