Esempio n. 1
0
        internal (ValidationError error, TemplateField field) SetListField(TemplateField field)
        {
            try
            {
                var match = validationRegexs[field.FieldType].Match(field.Value);

                if (!match.Success)
                {
                    field.Valid = false;
                    return(ValidationError.InvalidTag, field);
                }

                var lst = new TemplateLst
                {
                    Values = match.Groups[1].Value.Split(',').Select(x => x.TrimStart(' ').TrimEnd(' ')).ToList()
                };

                field.TemplateJson = JsonConvert.SerializeObject(lst);
                field.Valid        = true;
                return(ValidationError.None, field);
            }
            catch (Exception ex)
            {
                Log.Error($"Exception parsing {field.Value}. ex:{ex.Message}");
                Log.Debug(ex.StackTrace);
                field.Valid = false;
                return(ValidationError.InvalidTag, field);
            }
        }
Esempio n. 2
0
        private void LoadTemplateList()
        {
            TemplateLst.ClearSelection();
            TemplateLst.Items.Clear();

            //Get Templates Folder
            ArrayList templateFiles = Globals.GetFileList(PortalSettings.PortalId, "page.template", false, "Templates/");

            foreach (FileItem dnnFile in templateFiles)
            {
                var item = new ListItem(dnnFile.Text.Replace(".page.template", ""), dnnFile.Text);
                TemplateLst.Items.Add(item);
                if (item.Text == "Default")
                {
                    item.Selected = true;
                }
            }

            TemplateLst.Items.Insert(0, new ListItem(GetString("NoTemplate"), ""));
        }