//public static List<MarkupScript> ParseScriptsFromXml(ModuleConfiguration config) //{ // List<MarkupScript> scripts = new List<MarkupScript>(); // string fullPath = string.Empty; // XmlDocument doc = new XmlDocument(); // if (DefinitionExists(config.FieldDefinitionSrc, out doc)) // { // XmlNode node = doc.DocumentElement.SelectSingleNode("/Fields/Scripts"); // if (node == null) return scripts; // try // { // scripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(node); // } // catch (System.Xml.XmlException ex) // { // log.Error(ex); // } // } // return scripts; //} /// <summary> /// Creates a list of Field from field definition xml file. /// </summary> /// <param name="fieldDefinitionSrc"></param> /// <returns>IList</returns> public static List <Field> ParseFieldDefinitionXml(ModuleConfiguration config, Guid siteGuid) { List <Field> fields = new List <Field>(); string fullPath = string.Empty; XmlDocument doc = new XmlDocument(); FileSystemProvider p = FileSystemManager.Providers[WebConfigSettings.FileSystemProvider]; if (p == null) { log.Error("File System Provider Could Not Be Loaded."); return(fields); } IFileSystem fileSystem = p.GetFileSystem(); if (fileSystem == null) { log.Error("File System Could Not Be Loaded."); return(fields); } //implemented "solutions" on 9/13/2017 (mojoPortal 2.6.0.0) which allows for markup definitions and field definitions to be wrapped up in a single folder //b/c of this, we added the ability to pull the field definition file from the location of the markup definition (.sfmarkup) file w/o needing to use the full path in the fieldDefinitionSrc property string solutionFieldDefSrc = string.Empty; if (config.FieldDefinitionSrc.StartsWith("~/")) { solutionFieldDefSrc = config.FieldDefinitionSrc; } else if (config.FieldDefinitionSrc.StartsWith("/")) { solutionFieldDefSrc = "~" + config.FieldDefinitionSrc; } //else if (File.Exists(System.Web.Hosting.HostingEnvironment.MapPath(config.MarkupDefinitionFile))) else { var sfMarkupFile = fileSystem.RetrieveFile(config.MarkupDefinitionFile); string sfFieldPath = fileSystem.CombinePath(sfMarkupFile.FolderVirtualPath, config.FieldDefinitionSrc); var sfFieldFile = fileSystem.RetrieveFile(sfFieldPath); //FileInfo fileInfo = new FileInfo(System.Web.Hosting.HostingEnvironment.MapPath(config.MarkupDefinitionFile)); //solutionFieldDefSrc = fileInfo.DirectoryName + "/" + config.FieldDefinitionSrc; solutionFieldDefSrc = sfFieldFile.VirtualPath; } if (DefinitionExists(solutionFieldDefSrc, out doc)) { XmlNode node = doc.DocumentElement.SelectSingleNode("/Fields"); if (node != null) { XmlAttributeCollection attribs = node.Attributes; string definitionName = string.Empty; Guid definitionGuid = Guid.NewGuid(); if (attribs["definitionName"] != null) { definitionName = attribs["definitionName"].Value; } if (attribs["definitionGuid"] != null) { definitionGuid = Guid.Parse(attribs["definitionGuid"].Value); } if (definitionGuid != config.FieldDefinitionGuid) { log.ErrorFormat(@" SuperFlexi Solution [{0}] located at [{1}] uses fieldDefinitionGuid = [{2}] but the field definition at [{3}] uses definitionGuid = [{4}]. Items will not display properly and may end up corrupted. " , config.MarkupDefinitionName, config.MarkupDefinitionFile, config.FieldDefinitionGuid.ToString(), solutionFieldDefSrc, definitionGuid); return(null); } foreach (XmlNode childNode in node) { if (childNode.Name == "Field") { try { Field field = new Field(); XmlAttributeCollection itemDefAttribs = childNode.Attributes; field.DefinitionName = definitionName; field.DefinitionGuid = definitionGuid; if (itemDefAttribs["name"] != null) { field.Name = itemDefAttribs["name"].Value; } if (itemDefAttribs["label"] != null) { field.Label = itemDefAttribs["label"].Value; } if (itemDefAttribs["defaultValue"] != null) { field.DefaultValue = itemDefAttribs["defaultValue"].Value; } if (itemDefAttribs["controlType"] != null) { field.ControlType = itemDefAttribs["controlType"].Value; } if (itemDefAttribs["controlSrc"] != null) { field.ControlSrc = itemDefAttribs["controlSrc"].Value; } field.SortOrder = XmlUtils.ParseInt32FromAttribute(itemDefAttribs, "sortOrder", field.SortOrder); if (itemDefAttribs["helpKey"] != null) { field.HelpKey = itemDefAttribs["helpKey"].Value; } field.Required = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "required", field.Required); if (itemDefAttribs["requiredMessageFormat"] != null) { field.RequiredMessageFormat = itemDefAttribs["requiredMessageFormat"].Value; } if (itemDefAttribs["regex"] != null) { field.Regex = itemDefAttribs["regex"].Value; } if (itemDefAttribs["regexMessageFormat"] != null) { field.RegexMessageFormat = itemDefAttribs["regexMessageFormat"].Value; } if (itemDefAttribs["token"] != null && !String.IsNullOrWhiteSpace(itemDefAttribs["token"].Value)) { field.Token = itemDefAttribs["token"].Value; } field.Searchable = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isSearchable", field.Searchable); if (itemDefAttribs["editPageControlWrapperCssClass"] != null) { field.EditPageControlWrapperCssClass = itemDefAttribs["editPageControlWrapperCssClass"].Value; } if (itemDefAttribs["editPageLabelCssClass"] != null) { field.EditPageLabelCssClass = itemDefAttribs["editPageLabelCssClass"].Value; } if (itemDefAttribs["editPageControlCssClass"] != null) { field.EditPageControlCssClass = itemDefAttribs["editPageControlCssClass"].Value; } field.DatePickerIncludeTimeForDate = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerIncludeTimeForDate", field.DatePickerIncludeTimeForDate); field.DatePickerShowMonthList = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerShowMonthList", field.DatePickerShowMonthList); field.DatePickerShowYearList = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerShowYearList", field.DatePickerShowYearList); if (itemDefAttribs["datePickerYearRange"] != null) { field.DatePickerYearRange = itemDefAttribs["datePickerYearRange"].Value; } if (itemDefAttribs["imageBrowserEmptyUrl"] != null) { field.ImageBrowserEmptyUrl = itemDefAttribs["imageBrowserEmptyUrl"].Value; } field.CheckBoxReturnBool = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "checkBoxReturnBool", field.CheckBoxReturnBool); if (itemDefAttribs["checkBoxReturnValueWhenTrue"] != null) { field.CheckBoxReturnValueWhenTrue = itemDefAttribs["checkBoxReturnValueWhenTrue"].Value; } if (itemDefAttribs["checkBoxReturnValueWhenFalse"] != null) { field.CheckBoxReturnValueWhenFalse = itemDefAttribs["checkBoxReturnValueWhenFalse"].Value; } if (itemDefAttribs["dateFormat"] != null) { field.DateFormat = itemDefAttribs["dateFormat"].Value; } if (itemDefAttribs["textBoxMode"] != null) { field.TextBoxMode = itemDefAttribs["textBoxMode"].Value; } field.IsDeleted = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isDeleted", field.IsDeleted); field.IsGlobal = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isGlobal", field.IsGlobal); if (itemDefAttribs["viewRoles"] != null) { string viewRoles = itemDefAttribs["viewRoles"].Value; if (String.IsNullOrWhiteSpace(viewRoles)) { viewRoles = "All Users;"; } field.ViewRoles = viewRoles; } if (itemDefAttribs["editRoles"] != null) { field.EditRoles = itemDefAttribs["editRoles"].Value; } StringBuilder options = new StringBuilder(); StringBuilder attributes = new StringBuilder(); foreach (XmlNode subNode in childNode) { switch (subNode.Name) { case "Options": options = XmlHelper.GetKeyValuePairsAsStringBuilder(subNode.ChildNodes); //GetKeyValuePairs(subNode.ChildNodes, out options); break; case "Attributes": attributes = XmlHelper.GetKeyValuePairsAsStringBuilder(subNode.ChildNodes); //GetKeyValuePairs(subNode.ChildNodes, out attributes); break; case "PreTokenString": field.PreTokenString = subNode.InnerText.Trim(); break; case "PostTokenString": field.PostTokenString = subNode.InnerText.Trim(); break; case "PreTokenStringWhenTrue": field.PreTokenStringWhenTrue = subNode.InnerText.Trim(); break; case "PostTokenStringWhenTrue": field.PostTokenStringWhenTrue = subNode.InnerText.Trim(); break; case "PreTokenStringWhenFalse": field.PreTokenStringWhenFalse = subNode.InnerText.Trim(); break; case "PostTokenStringWhenFalse": field.PostTokenStringWhenFalse = subNode.InnerText.Trim(); break; } } if (options.Length > 0) { field.Options = options.ToString(); } if (attributes.Length > 0) { field.Attributes = attributes.ToString(); } fields.Add(field); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "Scripts") { try { config.EditPageScripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(childNode); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "Styles") { try { config.EditPageCSS = SuperFlexiHelpers.ParseCssFromXmlNode(childNode); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "SearchDefinition") { try { SuperFlexiHelpers.ParseSearchDefinition(childNode, definitionGuid, siteGuid); } catch (XmlException ex) { log.Error(ex); } } } } } fields.Sort(); return(fields); }
private void MapDefinedMarkup(XmlNode node, bool isMobile = false) { if (node != null) { //bool desktopOnly = false; XmlAttributeCollection attrCollection = node.Attributes; if (attrCollection["name"] != null) { markupDefinitionName = attrCollection["name"].Value; } if (attrCollection["moduleClass"] != null) { if (isMobile) { mobileInstanceCssClass += " " + attrCollection["moduleClass"].Value; } else { instanceCssClass += " " + attrCollection["moduleClass"].Value; } } useStandardMarkupOnDesktopOnly = XmlUtils.ParseBoolFromAttribute(attrCollection, "desktopOnly", useStandardMarkupOnDesktopOnly); useHeader = XmlUtils.ParseBoolFromAttribute(attrCollection, "useHeader", useHeader); useFooter = XmlUtils.ParseBoolFromAttribute(attrCollection, "useFooter", useFooter); allowImport = XmlUtils.ParseBoolFromAttribute(attrCollection, "allowImport", allowImport); allowExport = XmlUtils.ParseBoolFromAttribute(attrCollection, "allowExport", allowExport); //renderModuleLinksWithModuleTitle = XmlUtils.ParseBoolFromAttribute(attrCollection, "renderModuleLinksWithModuleTitle", renderModuleLinksWithModuleTitle); if (attrCollection["editPageClass"] != null) { editPageCssClass += " " + attrCollection["editPageClass"].Value; } if (attrCollection["editPageTitle"] != null) { editPageTitle = attrCollection["editPageTitle"].Value; } if (attrCollection["editPageUpdateButtonText"] != null) { editPageUpdateButtonText = attrCollection["editPageUpdateButtonText"].Value; } if (attrCollection["editPageSaveButtonText"] != null) { editPageSaveButtonText = attrCollection["editPageSaveButtonText"].Value; } if (attrCollection["editPageDeleteButtonText"] != null) { editPageDeleteButtonText = attrCollection["editPageDeleteButtonText"].Value; } if (attrCollection["editPageCancelLinkText"] != null) { editPageCancelLinkText = attrCollection["editPageCancelLinkText"].Value; } if (attrCollection["editPageDeleteWarning"] != null) { editPageDeleteWarning = attrCollection["editPageDeleteWarning"].Value; } if (attrCollection["importPageTitle"] != null) { importPageTitle = attrCollection["importPageTitle"].Value; } if (attrCollection["exportPageTitle"] != null) { exportPageTitle = attrCollection["exportPageTitle"].Value; } if (attrCollection["importPageCancelLinkText"] != null) { importPageCancelLinkText = attrCollection["importPageCancelLinkText"].Value; } if (attrCollection["fieldDefinitionSrc"] != null) { fieldDefinitionSrc = attrCollection["fieldDefinitionSrc"].Value.Replace("$_SitePath_$", "/Data/Sites/" + siteId.ToInvariantString()); } if (attrCollection["fieldDefinitionGuid"] != null) { fieldDefinitionGuid = Guid.Parse(attrCollection["fieldDefinitionGuid"].Value); } if (attrCollection["jsonRenderLocation"] != null) { jsonRenderLocation = attrCollection["jsonRenderLocation"].Value; } if (attrCollection["jsonLabelObjects"] != null) { jsonLabelObjects = Convert.ToBoolean(attrCollection["jsonLabelObjects"].Value); } if (attrCollection["headerLocation"] != null) { headerLocation = attrCollection["headerLocation"].Value; } if (attrCollection["footerLocation"] != null) { footerLocation = attrCollection["footerLocation"].Value; } if (attrCollection["hideOuterWrapperPanel"] != null) { hideOuterWrapperPanel = Convert.ToBoolean(attrCollection["hideOuterWrapperPanel"].Value); } if (attrCollection["hideInnerWrapperPanel"] != null) { hideInnerWrapperPanel = Convert.ToBoolean(attrCollection["hideInnerWrapperPanel"].Value); } if (attrCollection["hideOuterBodyPanel"] != null) { hideOuterBodyPanel = Convert.ToBoolean(attrCollection["hideOuterBodyPanel"].Value); } if (attrCollection["hideInnerBodyPanel"] != null) { hideInnerBodyPanel = Convert.ToBoolean(attrCollection["hideInnerBodyPanel"].Value); } if (attrCollection["showSaveAsNewButton"] != null) { showSaveAsNew = Convert.ToBoolean(attrCollection["showSaveAsNewButton"].Value); } if (attrCollection["maxItems"] != null) { maxItems = Convert.ToInt32(attrCollection["maxItems"].Value); } if (attrCollection["processItems"] != null) { processItems = Convert.ToBoolean(attrCollection["processItems"].Value); } MarkupDefinition workingMarkupDefinition = new MarkupDefinition(); if (isMobile && !useStandardMarkupOnDesktopOnly) { // do this so mobile settings are added to desktop workingMarkupDefinition = (MarkupDefinition)markupDefinition.Clone(); } foreach (XmlNode childNode in node) { if (!String.IsNullOrWhiteSpace(childNode.InnerText) || !String.IsNullOrWhiteSpace(childNode.InnerXml)) { switch (childNode.Name) { case "ModuleTitleMarkup": workingMarkupDefinition.ModuleTitleMarkup = childNode.InnerText.Trim(); break; case "ModuleTitleFormat": workingMarkupDefinition.ModuleTitleFormat = childNode.InnerText.Trim(); break; case "ModuleLinksFormat": workingMarkupDefinition.ModuleLinksFormat = childNode.InnerText.Trim(); break; case "ModuleInstanceMarkupTop": workingMarkupDefinition.ModuleInstanceMarkupTop = childNode.InnerText.Trim(); break; case "ModuleInstanceMarkupBottom": workingMarkupDefinition.ModuleInstanceMarkupBottom = childNode.InnerText.Trim(); break; case "InstanceFeaturedImageFormat": workingMarkupDefinition.InstanceFeaturedImageFormat = childNode.InnerText.Trim(); break; case "HeaderContentFormat": workingMarkupDefinition.HeaderContentFormat = childNode.InnerText.Trim(); break; case "FooterContentFormat": workingMarkupDefinition.FooterContentFormat = childNode.InnerText.Trim(); break; case "ItemMarkup": workingMarkupDefinition.ItemMarkup = childNode.InnerText.Trim(); break; case "ItemsRepeaterMarkup": workingMarkupDefinition.ItemsRepeaterMarkup = childNode.InnerText.Trim(); XmlAttributeCollection repeaterAttribs = childNode.Attributes; if (repeaterAttribs["itemsPerGroup"] != null) { workingMarkupDefinition.ItemsPerGroup = XmlUtils.ParseInt32FromAttribute(repeaterAttribs, "itemsPerGroup", workingMarkupDefinition.ItemsPerGroup); } break; case "ItemsWrapperFormat": workingMarkupDefinition.ItemsWrapperFormat = childNode.InnerText.Trim(); break; case "ModuleSettingsLinkFormat": workingMarkupDefinition.ModuleSettingsLinkFormat = childNode.InnerText.Trim(); break; case "AddItemLinkFormat": workingMarkupDefinition.AddItemLinkFormat = childNode.InnerText.Trim(); break; case "EditHeaderLinkFormat": workingMarkupDefinition.EditHeaderLinkFormat = childNode.InnerText.Trim(); break; case "EditFooterLinkFormat": workingMarkupDefinition.EditFooterLinkFormat = childNode.InnerText.Trim(); break; case "ItemEditLinkFormat": workingMarkupDefinition.ItemEditLinkFormat = childNode.InnerText.Trim(); break; case "ImportInstructions": importInstructions = childNode.InnerText.Trim(); break; case "ExportInstructions": exportInstructions = childNode.InnerText.Trim(); break; case "ImportLinkFormat": workingMarkupDefinition.ImportLinkFormat = childNode.InnerText.Trim(); break; case "ExportLinkFormat": workingMarkupDefinition.ExportLinkFormat = childNode.InnerText.Trim(); break; case "GlobalViewMarkup": workingMarkupDefinition.GlobalViewMarkup = childNode.InnerText.Trim(); break; case "GlobalViewItemMarkup": workingMarkupDefinition.GlobalViewItemMarkup = childNode.InnerText.Trim(); break; case "CheckBoxListMarkup": case "RadioButtonListMarkup": CheckBoxListMarkup cblm = new CheckBoxListMarkup(); XmlAttributeCollection cblmAttribs = childNode.Attributes; if (cblmAttribs["field"] != null) { cblm.Field = cblmAttribs["field"].Value; } if (cblmAttribs["token"] != null) { cblm.Token = cblmAttribs["token"].Value; } foreach (XmlNode cblmNode in childNode) { switch (cblmNode.Name) { case "Separator": cblm.Separator = cblmNode.InnerText.Trim(); break; case "Content": cblm.Markup = cblmNode.InnerText.Trim(); break; } } checkBoxListMarkups.Add(cblm); break; case "Scripts": if (isMobile) { mobileMarkupScripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(childNode); } else { markupScripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(childNode); } //SetupDefinedScripts(childNode, isMobile); //rawScript = childNode.InnerText; break; case "Styles": markupCSS = SuperFlexiHelpers.ParseCssFromXmlNode(childNode); break; } } } if (isMobile) { mobileMarkupDefinition = workingMarkupDefinition; } else { markupDefinition = workingMarkupDefinition; } } }
//public static List<MarkupScript> ParseScriptsFromXml(ModuleConfiguration config) //{ // List<MarkupScript> scripts = new List<MarkupScript>(); // string fullPath = string.Empty; // XmlDocument doc = new XmlDocument(); // if (DefinitionExists(config.FieldDefinitionSrc, out doc)) // { // XmlNode node = doc.DocumentElement.SelectSingleNode("/Fields/Scripts"); // if (node == null) return scripts; // try // { // scripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(node); // } // catch (System.Xml.XmlException ex) // { // log.Error(ex); // } // } // return scripts; //} /// <summary> /// Creates a list of Field from field definition xml file. /// </summary> /// <param name="fieldDefinitionSrc"></param> /// <returns>IList</returns> public static List <Field> ParseFieldDefinitionXml(ModuleConfiguration config, Guid siteGuid) { List <Field> fields = new List <Field>(); string fullPath = string.Empty; XmlDocument doc = new XmlDocument(); if (DefinitionExists(config.FieldDefinitionSrc, out doc)) { XmlNode node = doc.DocumentElement.SelectSingleNode("/Fields"); if (node != null) { XmlAttributeCollection attribs = node.Attributes; string definitionName = string.Empty; Guid definitionGuid = Guid.NewGuid(); if (attribs["definitionName"] != null) { definitionName = attribs["definitionName"].Value; } if (attribs["definitionGuid"] != null) { definitionGuid = Guid.Parse(attribs["definitionGuid"].Value); } foreach (XmlNode childNode in node) { if (childNode.Name == "Field") { try { Field field = new Field(); XmlAttributeCollection itemDefAttribs = childNode.Attributes; field.DefinitionName = definitionName; field.DefinitionGuid = definitionGuid; if (itemDefAttribs["name"] != null) { field.Name = itemDefAttribs["name"].Value; } if (itemDefAttribs["label"] != null) { field.Label = itemDefAttribs["label"].Value; } if (itemDefAttribs["defaultValue"] != null) { field.DefaultValue = itemDefAttribs["defaultValue"].Value; } if (itemDefAttribs["controlType"] != null) { field.ControlType = itemDefAttribs["controlType"].Value; } if (itemDefAttribs["controlSrc"] != null) { field.ControlSrc = itemDefAttribs["controlSrc"].Value; } field.SortOrder = XmlUtils.ParseInt32FromAttribute(itemDefAttribs, "sortOrder", field.SortOrder); if (itemDefAttribs["helpKey"] != null) { field.HelpKey = itemDefAttribs["helpKey"].Value; } field.Required = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "required", field.Required); if (itemDefAttribs["requiredMessageFormat"] != null) { field.RequiredMessageFormat = itemDefAttribs["requiredMessageFormat"].Value; } if (itemDefAttribs["regex"] != null) { field.Regex = itemDefAttribs["regex"].Value; } if (itemDefAttribs["regexMessageFormat"] != null) { field.RegexMessageFormat = itemDefAttribs["regexMessageFormat"].Value; } if (itemDefAttribs["token"] != null && !String.IsNullOrWhiteSpace(itemDefAttribs["token"].Value)) { field.Token = itemDefAttribs["token"].Value; } field.Searchable = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isSearchable", field.Searchable); if (itemDefAttribs["editPageControlWrapperCssClass"] != null) { field.EditPageControlWrapperCssClass = itemDefAttribs["editPageControlWrapperCssClass"].Value; } if (itemDefAttribs["editPageLabelCssClass"] != null) { field.EditPageLabelCssClass = itemDefAttribs["editPageLabelCssClass"].Value; } if (itemDefAttribs["editPageControlCssClass"] != null) { field.EditPageControlCssClass = itemDefAttribs["editPageControlCssClass"].Value; } field.DatePickerIncludeTimeForDate = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerIncludeTimeForDate", field.DatePickerIncludeTimeForDate); field.DatePickerShowMonthList = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerShowMonthList", field.DatePickerShowMonthList); field.DatePickerShowYearList = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "datePickerShowYearList", field.DatePickerShowYearList); if (itemDefAttribs["datePickerYearRange"] != null) { field.DatePickerYearRange = itemDefAttribs["datePickerYearRange"].Value; } if (itemDefAttribs["imageBrowserEmptyUrl"] != null) { field.ImageBrowserEmptyUrl = itemDefAttribs["imageBrowserEmptyUrl"].Value; } field.CheckBoxReturnBool = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "checkBoxReturnBool", field.CheckBoxReturnBool); if (itemDefAttribs["checkBoxReturnValueWhenTrue"] != null) { field.CheckBoxReturnValueWhenTrue = itemDefAttribs["checkBoxReturnValueWhenTrue"].Value; } if (itemDefAttribs["checkBoxReturnValueWhenFalse"] != null) { field.CheckBoxReturnValueWhenFalse = itemDefAttribs["checkBoxReturnValueWhenFalse"].Value; } if (itemDefAttribs["dateFormat"] != null) { field.DateFormat = itemDefAttribs["dateFormat"].Value; } if (itemDefAttribs["textBoxMode"] != null) { field.TextBoxMode = itemDefAttribs["textBoxMode"].Value; } field.IsDeleted = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isDeleted", field.IsDeleted); field.IsGlobal = XmlUtils.ParseBoolFromAttribute(itemDefAttribs, "isGlobal", field.IsGlobal); StringBuilder options = new StringBuilder(); StringBuilder attributes = new StringBuilder(); foreach (XmlNode subNode in childNode) { switch (subNode.Name) { case "Options": GetKeyValuePairs(subNode.ChildNodes, out options); break; case "Attributes": GetKeyValuePairs(subNode.ChildNodes, out attributes); break; case "PreTokenString": field.PreTokenString = subNode.InnerText.Trim(); break; case "PostTokenString": field.PostTokenString = subNode.InnerText.Trim(); break; } } if (options.Length > 0) { field.Options = options.ToString(); } if (attributes.Length > 0) { field.Attributes = attributes.ToString(); } fields.Add(field); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "Scripts") { try { config.EditPageScripts = SuperFlexiHelpers.ParseScriptsFromXmlNode(childNode); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "Styles") { try { config.EditPageCSS = SuperFlexiHelpers.ParseCssFromXmlNode(childNode); } catch (System.Xml.XmlException ex) { log.Error(ex); } } else if (childNode.Name == "SearchDefinition") { try { SuperFlexiHelpers.ParseSearchDefinition(childNode, definitionGuid, siteGuid); } catch (XmlException ex) { log.Error(ex); } } } } } fields.Sort(); return(fields); }