Пример #1
0
        public bool IsValidArticleDocument()
        {
            if (string.IsNullOrEmpty(_metadataParser.Title))
            {
                MessageBox.Show(@"Please enter an article title.", ArticleDocumentValidator.MESSAGEBOX_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(false);
            }

            if (IsTitleTooLong_WithNotification(_metadataParser.Title.Trim().Length))
            {
                return(false);
            }

            if (_metadataParser.TitleCount > 1)
            {
                if (AllowMultipleTitles() == false)
                {
                    return(false);
                }
            }

            int maxLengthLongSummary = SitecoreClient.GetMaxLengthLongSummary();

            if (_metadataParser.ExecutiveSummary.Length > maxLengthLongSummary)
            {
                if (AllowTruncatingExceededCharacterLimit("Summary", maxLengthLongSummary) == false)
                {
                    return(false);
                }
            }

            InvalidStylesHighlighter highlighter = InvalidStylesHighlighter.GetParser();
            //bool hasInvalidStyles = highlighter.HighlightAllInvalidStyles(Globals.SitecoreAddin.Application.ActiveDocument);
            bool hasInvalidStyles = highlighter.HighlightAllInvalidStyles(_document);

            if (hasInvalidStyles && AllowInvalidStyle() == false)
            {
                return(false);
            }

            return(true);
        }
 public static InvalidStylesHighlighter GetParser()
 {
     return(_parser ?? (_parser = new InvalidStylesHighlighter()));
 }