Пример #1
0
        public override IEnumerable <Problem> Validate(Dictionary <Guid, SitecoreDeployInfo> projectItems, XDocument scprojDocument)
        {
            //loop through each item in the TDS project
            foreach (var item in projectItems)
            {
                //check that the item path starts with a value specified in the Additional Properties list
                //otherwise we just ignore the item
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var fld = item.Value.ParsedItem.Fields["Initial State"];


                    if (fld != null && fld == String.Empty)
                    {
                        //when a problem is found get the position of it in the TDS project file
                        ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                        //create a report which will be displayed in the Visual Studio Error List
                        Problem report = new Problem(this, position)
                        {
                            Message = string.Format("This workflow is missing an intial state: {0}", item.Value.ParsedItem.Path)
                        };

                        yield return(report);
                    }
                }
            }
        }
        public override IEnumerable <Problem> Validate(
            Dictionary <Guid, HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo> projectItems,
            System.Xml.Linq.XDocument scprojDocument)
        {
            foreach (var item in projectItems)
            {
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (item.Value.Item.TemplateId == "{AB86861A-6030-46C5-B394-E8F99E8B87DB}")
                    {
                        if (!string.IsNullOrEmpty(item.Value.ParsedItem.Name) && item.Value.ParsedItem.Name.Contains(" "))
                        {
                            ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                            Problem report = new Problem(this, position)
                            {
                                Message = string.Format("Template Name Contains Space {0}", item.Value.ParsedItem.Path)
                            };

                            yield return(report);
                        }
                    }
                }
            }
        }
        public override IEnumerable <Problem> Validate(Dictionary <Guid, SitecoreDeployInfo> projectItems, XDocument scprojDocument)
        {
            //loop through each item in the TDS project
            foreach (var item in projectItems)
            {
                //check that the item path starts with a value specified in the Additional Properties list
                //otherwise we just ignore the item
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var editable           = item.Value.ParsedItem.Fields["Editable"];
                    var datasourcelocation = item.Value.ParsedItem.Fields["Datasource Location"];

                    if (!string.IsNullOrEmpty(datasourcelocation) && editable != null && editable == String.Empty)
                    {
                        //when a problem is found get the position of it in the TDS project file
                        ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                        //create a report which will be displayed in the Visual Studio Error List
                        Problem report = new Problem(this, position)
                        {
                            Message =
                                string.Format("A datasource driven sublayout must have it's 'Editable' setting checked: {0}",
                                              item.Value.ParsedItem.Path)
                        };

                        yield return(report);
                    }
                }
            }
        }
        public override IEnumerable <Problem> Validate(Dictionary <Guid, SitecoreDeployInfo> projectItems, XDocument scprojDocument)
        {
            //loop through each item in the TDS project
            foreach (var item in projectItems)
            {
                //check that the item path starts with a value specified in the Additional Properties list
                //otherwise we just ignore the item
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    var templatename = item.Value.Item.TemplateName;

                    if (templatename.ToLower() == "template field")
                    {
                        //when a problem is found get the position of it in the TDS project file
                        ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                        //create a report which will be displayed in the Visual Studio Error List
                        Problem report = new Problem(this, position)
                        {
                            Message = string.Format("Fields are not permitted in this location: {0}", item.Value.ParsedItem.Path)
                        };

                        yield return(report);
                    }
                }
            }
        }
        public override IEnumerable <Problem> Validate(
            Dictionary <Guid, HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo> projectItems,
            System.Xml.Linq.XDocument scprojDocument)
        {
            foreach (var item in projectItems)
            {
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (item.Value.Item.TemplateId == "{0A98E368-CDB9-4E1E-927C-8E0C24A003FB}")
                    {
                        if (string.IsNullOrEmpty(item.Value.ParsedItem.Fields["__Thumbnail"]))
                        {
                            ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                            Problem report = new Problem(this, position)
                            {
                                Message = string.Format("Sublayout Doesn't Have Thumbnail Set {0}", item.Value.ParsedItem.Path)
                            };

                            yield return(report);
                        }
                    }
                }
            }
        }
Пример #6
0
        public override IEnumerable <Problem> Validate(
            Dictionary <Guid, HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo> projectItems,
            System.Xml.Linq.XDocument scprojDocument)
        {
            foreach (var item in projectItems)
            {
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (item.Value.Item.TemplateId == "{455A3E98-A627-4B40-8035-E683A0331AC7}")
                    {
                        if (!string.IsNullOrEmpty(item.Value.ParsedItem.Name) && !item.Value.ParsedItem.Name.Contains(" ") &&
                            item.Value.ParsedItem.Name.UpperCaseCharactersCount() > 1 && item.Value.ParsedItem.Name.LowerCaseCharactersCount() > 1)
                        {
                            string itemTitle = item.Value.ParsedItem.Fields["Title"];

                            if (string.IsNullOrEmpty(itemTitle))
                            {
                                ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                                Problem report = new Problem(this, position)
                                {
                                    Message =
                                        string.Format("Complex Template Field Name Must Have Title {0}",
                                                      item.Value.ParsedItem.Path)
                                };

                                yield return(report);
                            }
                        }
                    }
                }
            }
        }
        public override IEnumerable <Problem> Validate(
            Dictionary <Guid, HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo> projectItems,
            System.Xml.Linq.XDocument scprojDocument)
        {
            foreach (var item in projectItems)
            {
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (item.Value.Item.TemplateId == "{E269FBB5-3750-427A-9149-7AA950B49301}")
                    {
                        if (string.IsNullOrEmpty(item.Value.ParsedItem.Fields["__Icon"]))
                        {
                            ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                            Problem report = new Problem(this, position)
                            {
                                Message = string.Format("Template Section Doesn't Have An Icon {0}", item.Value.ParsedItem.Path)
                            };

                            yield return(report);
                        }
                    }
                }
            }
        }
Пример #8
0
        public override IEnumerable <Problem> Validate(Dictionary <Guid, SitecoreDeployInfo> projectItems, XDocument scprojDocument)
        {
            var states    = new List <SitecoreDeployInfo>();
            var workflows = new List <SitecoreDeployInfo>();

            //loop through each item in the TDS project
            foreach (var item in projectItems)
            {
                //check that the item path starts with a value specified in the Additional Properties list
                //otherwise we just ignore the item
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    //get the name of the item from the Sitecore Item Path
                    //var name = item.Value.Item.SitecoreItemPath.Split('/').Last();

                    var intialStateField = item.Value.ParsedItem.Fields["Initial State"];
                    var finalStateField  = item.Value.ParsedItem.Fields["Final"];


                    if (intialStateField != null)
                    {
                        workflows.Add(item.Value);
                    }
                    else if (finalStateField != null && finalStateField != String.Empty)
                    {
                        states.Add(item.Value);
                    }
                }
            }


            foreach (var workflow in workflows)
            {
                var finalstates = states.Where(x => x.Item.SitecoreItemPath.Contains(workflow.Item.SitecoreItemPath));

                if (!finalstates.Any())
                {
                    //when a problem is found get the position of it in the TDS project file
                    ProblemLocation position = GetItemPosition(scprojDocument, workflow.Item);

                    //create a report which will be displayed in the Visual Studio Error List
                    Problem report = new Problem(this, position)
                    {
                        Message =
                            string.Format("This workflow is missing a final state: {0}", workflow.ParsedItem.Path)
                    };

                    yield return(report);
                }
            }
        }
Пример #9
0
        public override IEnumerable <Problem> Validate(
            Dictionary <Guid, HedgehogDevelopment.SitecoreProject.Tasks.SitecoreDeployInfo> projectItems,
            System.Xml.Linq.XDocument scprojDocument)
        {
            foreach (var item in projectItems)
            {
                if (Settings.Properties.Any(
                        x => item.Value.Item.SitecoreItemPath.StartsWith(x, StringComparison.InvariantCultureIgnoreCase)))
                {
                    if (item.Value.Item.Children.Count > 30 && item.Value.ParsedItem.Fields["__Is Bucket"] != "1")
                    {
                        ProblemLocation position = GetItemPosition(scprojDocument, item.Value.Item);

                        Problem report = new Problem(this, position)
                        {
                            Message = string.Format("Item Must Be Bucket {0}", item.Value.ParsedItem.Path)
                        };

                        yield return(report);
                    }
                }
            }
        }