public List <WidgetSearchResultItem> GetListToPushToTheIndex(List <Widget> widgets)
        {
            const string EnglishSectionName = "Widgets";
            const string DutchSectionName   = "Dingetjes";

            // Get the site id for the site, otherwise the items will not be found in the search.
            var site   = _siteDefinitionRepository.Get("FindCustomObjects");
            var siteId = site?.Id.ToString();

            var cultureInfoNl = new CultureInfo("nl");
            var cultureInfoEn = new CultureInfo("en");

            var cultureInfoArrayNl = new[] { cultureInfoNl };
            var cultureInfoArrayEn = new[] { cultureInfoEn };

            var listOfItemsToPush = new List <WidgetSearchResultItem>();

            foreach (var widget in widgets)
            {
                var widgetSearchResultItemNl = GetWidgetSearchResultItem(widget, ref cultureInfoNl, ref cultureInfoArrayNl, ref siteId, DutchSectionName, widget.WidgetDescriptionNl);

                listOfItemsToPush.Add(widgetSearchResultItemNl);

                // Workaround for finding the items when searching from the English search page:
                // push the same item again, with MasterLanguage English
                // and a different ID!!!

                var employeeSearchResultItemEn = GetWidgetSearchResultItem(widget, ref cultureInfoEn, ref cultureInfoArrayEn, ref siteId, EnglishSectionName, widget.WidgetDescriptionEn);

                listOfItemsToPush.Add(employeeSearchResultItemEn);
            }

            return(listOfItemsToPush);
        }
Пример #2
0
        /// <summary>
        /// Returns an audit of page/block type usages within the site
        /// </summary>
        /// <param name="siteDefo"></param>
        /// <returns></returns>
        public SiteAudit GetSiteAudit(Guid siteGuid)
        {
            var siteDefo  = _siteDefinitionRepository.Get(siteGuid);
            var siteAudit = new SiteAudit
            {
                SiteDefo = siteDefo
            };

            // Do start page
            AddPageContentTypeToList(siteDefo.StartPage, siteAudit.ContentTypes, null);

            return(siteAudit);
        }
Пример #3
0
        private static void DefineSite(ISiteDefinitionRepository siteDefinitionRepository, string siteName, ContentReference startPage, string siteUrl)
        {
            var existingSite = siteDefinitionRepository.Get(siteName);

            if (existingSite != null)
            {
                return;
            }

            // Define our site
            var siteDefinition = new SiteDefinition
            {
                Name      = siteName,
                SiteUrl   = new Uri($"http://{siteUrl}/", UriKind.Absolute),
                StartPage = startPage
            };

            siteDefinitionRepository.Save(siteDefinition);
        }