Beispiel #1
0
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            GalleryImage galleryImage = (GalleryImage)sender;

            if (e.IsDeleted)
            {
                SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();
                if (siteSettings == null)
                {
                    return;
                }
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(galleryImage.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    RemoveGalleryImageIndexItem(
                        siteSettings.SiteId,
                        pageModule.PageId,
                        galleryImage.ModuleId,
                        galleryImage.ItemId);
                }
            }
            else
            {
                IndexItem(galleryImage);
            }
        }
Beispiel #2
0
        public static void RemoveForumIndexItem(object oForumThread)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (!(oForumThread is KalturaVideoNotification))
            {
                return;
            }

            KalturaVideoNotification forumThread = oForumThread as KalturaVideoNotification;
            // get list of pages where this module is published
            List <PageModule> pageModules = PageModule.GetPageModulesByModule(forumThread.ModuleID);

            // must update index for all pages containing this module
            foreach (PageModule pageModule in pageModules)
            {
                IndexItem indexItem = new IndexItem();
                // note we are just assigning the properties needed to derive the key so it can be found and deleted from the index
                indexItem.SiteId   = forumThread.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.ModuleId = forumThread.ModuleID;
                indexItem.ItemId   = forumThread.KalturaVideoID;
                IndexHelper.RemoveIndex(indexItem);
            }
            if (debugLog)
            {
                log.Debug("Removed Index ");
            }
        }
        public override void ContentChangedHandler(object sender, ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            Item item = (Item)sender;

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                Module            module      = new Module(item.ModuleGuid);
                List <PageModule> pageModules = PageModule.GetPageModulesByModule(module.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        module.ModuleId,
                        item.ItemID);
                }
            }
            else
            {
                IndexItem(item);
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            Link link = (Link)sender;

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(link.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    mojoPortal.SearchIndex.IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        link.ModuleId,
                        link.ItemId);
                }
            }
            else
            {
                IndexItem(link);
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SharedFile sharedFile = (SharedFile)sender;

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(sharedFile.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        sharedFile.ModuleId,
                        sharedFile.ItemId);
                }
            }
            else
            {
                IndexItem(sharedFile);
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);

            if (disableSearchIndex)
            {
                return;
            }

            if (sender == null)
            {
                return;
            }
            if (!(sender is HtmlContent))
            {
                return;
            }

            HtmlContent  content      = (HtmlContent)sender;
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            content.SiteId          = siteSettings.SiteId;
            content.SearchIndexPath = IndexHelper.GetSearchIndexPath(siteSettings.SiteId);

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(content.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        content.ModuleId,
                        content.ItemId);
                }
            }
            else
            {
                if (ThreadPool.QueueUserWorkItem(new WaitCallback(IndexItem), content))
                {
                    if (debugLog)
                    {
                        log.Debug("HtmlContentIndexBuilderProvider.IndexItem queued");
                    }
                }
                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Failed to queue a thread for HtmlContentIndexBuilderProvider.IndexItem");
                    }
                }
                //IndexItem(content);
            }
        }
Beispiel #7
0
        private void IndexItem(Item item)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("SuperFlexi object passed to SuperFlexi. IndexItem was null");
                }

                return;
            }

            if (item == null)
            {
                return;
            }

            Module module = new Module(item.ModuleGuid);

            // get list of pages where this module is published
            List <PageModule> pageModules = PageModule.GetPageModulesByModule(module.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings = new PageSettings(siteSettings.SiteId, pageModule.PageId);
                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                log.InfoFormat("RebuildIndex indexing content [{0}]", module.ModuleTitle);
                IndexItem indexItem = GetIndexItem(pageSettings, module.ModuleId, item);
                if (indexItem == null)
                {
                    continue;
                }
                indexItem.ModuleViewRoles  = module.ViewRoles;
                indexItem.ModuleId         = module.ModuleId;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                IndexHelper.RebuildIndex(indexItem);

                if (debugLog)
                {
                    log.Debug("Indexed SuperFlexi Item " + indexItem.Title);
                }
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (sender == null)
            {
                return;
            }
            if (!(sender is Blog))
            {
                return;
            }

            Blog         blog         = (Blog)sender;
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            blog.SiteId          = siteSettings.SiteId;
            blog.SearchIndexPath = IndexHelper.GetSearchIndexPath(siteSettings.SiteId);


            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(blog.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        blog.ModuleId,
                        blog.ItemId);
                }
            }
            else
            {
                if (ThreadPool.QueueUserWorkItem(new WaitCallback(IndexItem), blog))
                {
                    if (log.IsDebugEnabled)
                    {
                        log.Debug("BlogIndexBuilderProvider.IndexItem queued");
                    }
                }
                else
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("Failed to queue a topic for BlogIndexBuilderProvider.IndexItem");
                    }
                }
                //IndexItem(blog);
            }
        }
Beispiel #9
0
        public static void RemoveForumIndexItem(
            int moduleId,
            int itemId,
            int threadId,
            int postId)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                log.Error("siteSettings object retrieved in BrowseCoursesIndexBuilderProvider.RemoveForumIndexItem was null");
                return;
            }

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(moduleId);

            // must update index for all pages containing
            // this module
            foreach (PageModule pageModule in pageModules)
            {
                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                // note we are just assigning the properties
                // needed to derive the key so it can be found and
                // deleted from the index
                indexItem.SiteId   = siteSettings.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.ModuleId = moduleId;
                indexItem.ItemId   = itemId;

                //if ((ForumConfiguration.AggregateSearchIndexPerThread) || (postId == -1))
                //{
                //    indexItem.QueryStringAddendum = "&thread=" + threadId.ToInvariantString();
                //}
                //else
                //{

                //    indexItem.QueryStringAddendum = "&thread="
                //        + threadId.ToInvariantString()
                //        + "&postid=" + postId.ToInvariantString();
                //}

                mojoPortal.SearchIndex.IndexHelper.RemoveIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Removed Index ");
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (sender == null)
            {
                return;
            }
            if (!(sender is Offer))
            {
                return;
            }

            Offer offer = sender as Offer;

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            offer.SiteId          = siteSettings.SiteId;
            offer.SearchIndexPath = mojoPortal.SearchIndex.IndexHelper.GetSearchIndexPath(siteSettings.SiteId);

            if (e.IsDeleted)
            {
                Store store = new Store(offer.StoreGuid);
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(store.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    mojoPortal.SearchIndex.IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        store.ModuleId,
                        offer.Guid.ToString());
                }
            }
            else
            {
                if (ThreadPool.QueueUserWorkItem(new WaitCallback(IndexItem), offer))
                {
                    if (debugLog)
                    {
                        log.Debug("OfferSearchIndexBuilder.IndexItem queued");
                    }
                }
                else
                {
                    log.Error("Failed to queue a thread for OfferSearchIndexBuilder.IndexItem");
                }
            }
        }
Beispiel #11
0
        public static void RemoveGroupIndexItem(object oGroupTopic)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (!(oGroupTopic is GroupTopic))
            {
                return;
            }

            GroupTopic groupTopic = oGroupTopic as GroupTopic;

            //SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            //if (siteSettings == null)
            //{
            //    if (log.IsErrorEnabled)
            //    {
            //        log.Error("siteSettings object retrieved in GroupTopicIndexBuilderProvider.RemoveGroupIndexItem was null");
            //    }
            //    return;
            //}

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(groupTopic.ModuleId);

            // must update index for all pages containing
            // this module
            foreach (PageModule pageModule in pageModules)
            {
                IndexItem indexItem = new IndexItem();
                // note we are just assigning the properties
                // needed to derive the key so it can be found and
                // deleted from the index
                indexItem.SiteId              = groupTopic.SiteId;
                indexItem.PageId              = pageModule.PageId;
                indexItem.ModuleId            = groupTopic.ModuleId;
                indexItem.ItemId              = groupTopic.GroupId;
                indexItem.QueryStringAddendum = "&topic="
                                                + groupTopic.TopicId.ToString(CultureInfo.InvariantCulture)
                                                + "&postid=" + groupTopic.PostId.ToString(CultureInfo.InvariantCulture);

                IndexHelper.RemoveIndex(indexItem);
            }

            if (log.IsDebugEnabled)
            {
                log.Debug("Removed Index ");
            }
        }
        public override void ContentChangedHandler(
            object sender,
            ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (sender == null)
            {
                return;
            }
            if (!(sender is CalendarEvent))
            {
                return;
            }

            CalendarEvent calendarEvent = (CalendarEvent)sender;
            SiteSettings  siteSettings  = CacheHelper.GetCurrentSiteSettings();

            calendarEvent.SiteId          = siteSettings.SiteId;
            calendarEvent.SearchIndexPath = mojoPortal.SearchIndex.IndexHelper.GetSearchIndexPath(siteSettings.SiteId);

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                List <PageModule> pageModules
                    = PageModule.GetPageModulesByModule(calendarEvent.ModuleId);

                foreach (PageModule pageModule in pageModules)
                {
                    mojoPortal.SearchIndex.IndexHelper.RemoveIndexItem(
                        pageModule.PageId,
                        calendarEvent.ModuleId,
                        calendarEvent.ItemId);
                }
            }
            else
            {
                if (ThreadPool.QueueUserWorkItem(new WaitCallback(IndexItem), calendarEvent))
                {
                    if (debugLog)
                    {
                        log.Debug("CalendarEventIndexBuilderProvider.IndexItem queued");
                    }
                }
                else
                {
                    log.Error("Failed to queue a thread for CalendarEventIndexBuilderProvider.IndexItem");
                }
                //IndexItem(calendarEvent);
            }
        }
Beispiel #13
0
        public static void RemoveForumIndexItem(object oForumThread)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (!(oForumThread is CourseModule))
            {
                return;
            }

            CourseModule forumThread = oForumThread as CourseModule;

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(forumThread.ModuleId);

            // must update index for all pages containing
            // this module
            foreach (PageModule pageModule in pageModules)
            {
                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                // note we are just assigning the properties
                // needed to derive the key so it can be found and
                // deleted from the index
                indexItem.SiteId   = forumThread.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.ModuleId = forumThread.ModuleId;
                indexItem.ItemId   = forumThread.CourseId;

                //if (ForumConfiguration.AggregateSearchIndexPerThread)
                //{
                //    indexItem.QueryStringAddendum = "&thread=" + forumThread.ThreadId.ToInvariantString();
                //}
                //else
                //{

                //    indexItem.QueryStringAddendum = "&thread="
                //        + forumThread.ThreadId.ToInvariantString()
                //        + "&postid=" + forumThread.PostId.ToInvariantString();
                //}

                mojoPortal.SearchIndex.IndexHelper.RemoveIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Removed Index ");
            }
        }
Beispiel #14
0
        private void RemoveIndexedBlogPost(Blog blog)
        {
            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(blog.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                mojoPortal.SearchIndex.IndexHelper.RemoveIndexItem(
                    pageModule.PageId,
                    blog.ModuleId,
                    blog.ItemId);
            }
        }
Beispiel #15
0
        public static void RemoveForumIndexItem(
            int moduleId,
            int itemId,
            int threadId,
            int postId)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                log.Error("siteSettings object retrieved in ForumThreadIndexBuilderProvider.RemoveForumIndexItem was null");
                return;
            }

            // get list of pages where this module is published
            List <PageModule> pageModules = PageModule.GetPageModulesByModule(moduleId);

            // must update index for all pages containing this module
            foreach (PageModule pageModule in pageModules)
            {
                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                // note we are just assigning the properties needed to derive the key so it can be found and deleted from the index
                indexItem.SiteId   = siteSettings.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.ModuleId = moduleId;
                indexItem.ItemId   = itemId;
                IndexHelper.RemoveIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Removed Index ");
            }
        }
Beispiel #16
0
        /// <summary> Contents the changed handler. </summary>
        /// <param name="sender"> The sender. </param>
        /// <param name="e"> The <see cref="ContentChangedEventArgs"/> instance containing the event data. </param>
        public override void ContentChangedHandler(object sender, ContentChangedEventArgs e)
        {
            if (WebConfigSettings.DisableSearchIndex || !(sender is ReservationEvent))
            {
                return;
            }

            var reservationEvent = (ReservationEvent)sender;
            var siteSettings     = CacheHelper.GetCurrentSiteSettings();

            reservationEvent.SiteId          = siteSettings.SiteId;
            reservationEvent.SearchIndexPath = IndexHelper.GetSearchIndexPath(siteSettings.SiteId);

            if (e.IsDeleted)
            {
                // get list of pages where this module is published
                var pageModules = PageModule.GetPageModulesByModule(reservationEvent.ModuleId);

                foreach (var pageModule in pageModules)
                {
                    IndexHelper.RemoveIndexItem(pageModule.PageId, reservationEvent.ModuleId, reservationEvent.ItemId);
                }
            }
            else
            {
                if (ThreadPool.QueueUserWorkItem(IndexItem, reservationEvent))
                {
                    if (Log.IsDebugEnabled)
                    {
                        Log.Debug("ReservationEventIndexBuilderProvider.IndexItem queued");
                    }
                }
                else
                {
                    Log.Error("Failed to queue a thread for ReservationEventIndexBuilderProvider.IndexItem");
                }
            }
        }
Beispiel #17
0
        public static void ReplaceStaticTokens(
            StringBuilder stringBuilder,
            ModuleConfiguration config,
            bool isEditable,
            SuperFlexiDisplaySettings displaySettings,
            int moduleId,
            PageSettings pageSettings,
            SiteSettings siteSettings,
            out StringBuilder sb)
        {
            sb = stringBuilder;
            string featuredImageUrl       = String.IsNullOrWhiteSpace(config.InstanceFeaturedImage) ? string.Empty : WebUtils.GetApplicationRoot() + config.InstanceFeaturedImage;
            string jsonObjName            = "sflexi" + moduleId.ToString() + (config.IsGlobalView ? "Modules" : "Items");
            string currentSkin            = string.Empty;
            string siteRoot               = SiteUtils.GetNavigationSiteRoot();
            bool   publishedOnCurrentPage = true;

            if (HttpContext.Current != null && HttpContext.Current.Request.Params.Get("skin") != null)
            {
                currentSkin = SiteUtils.SanitizeSkinParam(HttpContext.Current.Request.Params.Get("skin")) + "/";
            }

            if (isEditable)
            {
                var pageModules = PageModule.GetPageModulesByModule(moduleId);
                if (pageModules.Where(pm => pm.PageId == pageSettings.PageId).ToList().Count() == 0)
                {
                    publishedOnCurrentPage = false;
                }
            }

            Module module = new Module(moduleId);

            if (module != null)
            {
                sb.Replace("$_ModuleTitle_$", module.ShowTitle ? String.Format(displaySettings.ModuleTitleFormat, module.ModuleTitle) : string.Empty);
                sb.Replace("$_RawModuleTitle_$", module.ModuleTitle);
                sb.Replace("$_ModuleGuid_$", module.ModuleGuid.ToString());
                if (String.IsNullOrWhiteSpace(config.ModuleFriendlyName))
                {
                    sb.Replace("$_FriendlyName_$", module.ModuleTitle);
                }

                siteSettings = new SiteSettings(module.SiteGuid);
            }
            if (!String.IsNullOrWhiteSpace(config.ModuleFriendlyName))
            {
                sb.Replace("$_FriendlyName_$", config.ModuleFriendlyName);
            }
            sb.Replace("$_FeaturedImageUrl_$", featuredImageUrl);
            sb.Replace("$_ModuleID_$", moduleId.ToString());
            sb.Replace("$_PageID_$", pageSettings.PageId.ToString());
            sb.Replace("$_PageUrl_$", siteRoot + pageSettings.Url.Replace("~/", ""));
            sb.Replace("$_PageName_$", siteRoot + pageSettings.PageName);
            //sb.Replace("$_ModuleLinks_$", isEditable ? SuperFlexiHelpers.GetModuleLinks(config, displaySettings, moduleId, pageSettings.PageId) : string.Empty);
            sb.Replace("$_ModuleLinks_$", isEditable ? SuperFlexiHelpers.GetModuleLinks(config, displaySettings, moduleId, publishedOnCurrentPage ? pageSettings.PageId : -1) : string.Empty);
            sb.Replace("$_JSONNAME_$", jsonObjName);
            sb.Replace("$_ModuleClass_$", SiteUtils.IsMobileDevice() && !String.IsNullOrWhiteSpace(config.MobileInstanceCssClass) ? config.MobileInstanceCssClass : config.InstanceCssClass);
            sb.Replace("$_ModuleTitleElement_$", module.HeadElement);
            sb.Replace("$_SiteID_$", siteSettings.SiteId.ToString());
            sb.Replace("$_SiteRoot_$", String.IsNullOrWhiteSpace(siteRoot) ? "/" : siteRoot);
            sb.Replace("$_SitePath_$", String.IsNullOrWhiteSpace(siteRoot) ? "/" : WebUtils.GetApplicationRoot() + "/Data/Sites/" + CacheHelper.GetCurrentSiteSettings().SiteId.ToInvariantString());
            sb.Replace("$_SkinPath_$", SiteUtils.DetermineSkinBaseUrl(currentSkin));
            sb.Replace("$_CustomSettings_$", config.CustomizableSettings); //this needs to be enhanced, a lot, right now we just dump the 'settings' where ever this token exists.
            sb.Replace("$_EditorType_$", siteSettings.EditorProviderName);
            sb.Replace("$_EditorSkin_$", siteSettings.EditorSkin.ToString());
            sb.Replace("$_EditorBasePath_$", WebUtils.ResolveUrl(ConfigurationManager.AppSettings["CKEditor:BasePath"]));
            sb.Replace("$_EditorConfigPath_$", WebUtils.ResolveUrl(ConfigurationManager.AppSettings["CKEditor:ConfigPath"]));
            sb.Replace("$_EditorToolbarSet_$", mojoPortal.Web.Editor.ToolBar.FullWithTemplates.ToString());
            sb.Replace("$_EditorTemplatesUrl_$", siteRoot + "/Services/CKeditorTemplates.ashx?cb=" + Guid.NewGuid().ToString());
            sb.Replace("$_EditorStylesUrl_$", siteRoot + "/Services/CKeditorStyles.ashx?cb=" + Guid.NewGuid().ToString().Replace("-", string.Empty));
            sb.Replace("$_DropFileUploadUrl_$", siteRoot + "/Services/FileService.ashx?cmd=uploadfromeditor&rz=true&ko=" + WebConfigSettings.KeepFullSizeImagesDroppedInEditor.ToString().ToLower()
                       + "&t=" + Global.FileSystemToken.ToString());
            sb.Replace("$_FileBrowserUrl_$", siteRoot + WebConfigSettings.FileDialogRelativeUrl);
            sb.Replace("$_HeaderContent_$", config.HeaderContent);
            sb.Replace("$_FooterContent_$", config.FooterContent);
            sb.Replace("$_SkinVersionGuid_$", siteSettings.SkinVersion.ToString());
        }
        private static void IndexItem(GalleryImage galleryImage)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if ((siteSettings == null) ||
                (galleryImage == null))
            {
                return;
            }

            Guid             galleryFeatureGuid = new Guid("165517FD-461B-44d0-8897-3E5FA1A62097");
            ModuleDefinition galleryFeature     = new ModuleDefinition(galleryFeatureGuid);
            Module           module             = new Module(galleryImage.ModuleId);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(galleryImage.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          siteSettings.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                IndexItem indexItem = new IndexItem();
                indexItem.SiteId              = siteSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.FeatureId           = galleryFeatureGuid.ToString();
                indexItem.FeatureName         = galleryFeature.FeatureName;
                indexItem.FeatureResourceFile = galleryFeature.ResourceFile;

                indexItem.ItemId   = galleryImage.ItemId;
                indexItem.ModuleId = galleryImage.ModuleId;

                indexItem.QueryStringAddendum = "&ItemID"
                                                + galleryImage.ModuleId.ToString()
                                                + "=" + galleryImage.ItemId.ToString();

                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = galleryImage.Caption;
                indexItem.Content          = galleryImage.Description;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                IndexHelper.RebuildIndex(indexItem);

                if (log.IsDebugEnabled)
                {
                    log.Debug("Indexed " + galleryImage.Caption);
                }
            }
        }
        private static void IndexItem(HtmlContent content)
        {
            bool disableSearchIndex = ConfigHelper.GetBoolProperty("DisableSearchIndex", false);

            if (disableSearchIndex)
            {
                return;
            }

            Module module = new Module(content.ModuleId);


            Guid htmlFeatureGuid
                = new Guid("881e4e00-93e4-444c-b7b0-6672fb55de10");
            ModuleDefinition htmlFeature
                = new ModuleDefinition(htmlFeatureGuid);


            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(content.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          content.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                IndexItem indexItem = new IndexItem();
                if (content.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = content.SearchIndexPath;
                }
                indexItem.SiteId = content.SiteId;
                indexItem.ExcludeFromRecentContent = content.ExcludeFromRecentContent;
                indexItem.PageId          = pageModule.PageId;
                indexItem.PageName        = pageSettings.PageName;
                indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles = module.ViewRoles;
                if (pageSettings.UseUrl)
                {
                    indexItem.ViewPage             = pageSettings.Url.Replace("~/", string.Empty);
                    indexItem.UseQueryStringParams = false;
                }

                // generally we should not include the page meta because it can result in duplicate results
                // one for each instance of html content on the page because they all use the smae page meta.
                // since page meta should reflect the content of the page it is sufficient to just index the content
                if ((ConfigurationManager.AppSettings["IndexPageMeta"] != null) && (ConfigurationManager.AppSettings["IndexPageMeta"] == "true"))
                {
                    indexItem.PageMetaDescription = pageSettings.PageMetaDescription;
                    indexItem.PageMetaKeywords    = pageSettings.PageMetaKeyWords;
                }

                indexItem.FeatureId           = htmlFeatureGuid.ToString();
                indexItem.FeatureName         = htmlFeature.FeatureName;
                indexItem.FeatureResourceFile = htmlFeature.ResourceFile;

                indexItem.ItemId           = content.ItemId;
                indexItem.ModuleId         = content.ModuleId;
                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = content.Title;
                indexItem.Content          = SecurityHelper.RemoveMarkup(content.Body);
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                if ((content.CreatedByFirstName.Length > 0) && (content.CreatedByLastName.Length > 0))
                {
                    indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                                                     Resource.FirstLastFormat, content.CreatedByFirstName, content.CreatedByLastName);
                }
                else
                {
                    indexItem.Author = content.CreatedByName;
                }

                indexItem.CreatedUtc = content.CreatedDate;
                indexItem.LastModUtc = content.LastModUtc;

                if (!module.IncludeInSearch)
                {
                    indexItem.RemoveOnly = true;
                }

                IndexHelper.RebuildIndex(indexItem);
            }

            log.Debug("Indexed " + content.Title);
        }
        private static void IndexItem(Link link)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (siteSettings == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Link object passed to Links.IndexItem was null");
                }

                return;
            }

            if (link == null)
            {
                return;
            }

            Guid             linksFeatureGuid = new Guid("74bdbcc2-0e79-47ff-bcd4-a159270bf36e");
            ModuleDefinition linksFeature     = new ModuleDefinition(linksFeatureGuid);
            Module           module           = new Module(link.ModuleId);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(link.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          siteSettings.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                indexItem.SiteId              = siteSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.FeatureId           = linksFeatureGuid.ToString();
                indexItem.FeatureName         = linksFeature.FeatureName;
                indexItem.FeatureResourceFile = linksFeature.ResourceFile;

                indexItem.ItemId           = link.ItemId;
                indexItem.ModuleId         = link.ModuleId;
                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = link.Title;
                indexItem.Content          = link.Description;
                indexItem.CreatedUtc       = link.CreatedDate;
                indexItem.LastModUtc       = link.CreatedDate;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Indexed " + link.Title);
            }
        }
Beispiel #21
0
        private static void IndexItem(CourseModule courseModule)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }


            if (courseModule == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("forumThread object passed in BrowseCoursesIndexBuilderProvider.IndexItem was null");
                }
                return;
            }

            CourseModule     courMod             = new CourseModule(courseModule.CourseId);
            Module           module              = new Module(courseModule.ModuleId);
            Guid             scheduleFeatureGuid = new Guid("dc873d76-5bf2-4ac5-bff7-434a86a3fc9e");
            ModuleDefinition forumFeature        = new ModuleDefinition(scheduleFeatureGuid);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(courseModule.ModuleId);

            // must update index for all pages containing
            // this module
            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          courseModule.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }


                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                if (courseModule.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = courseModule.SearchIndexPath;
                }
                indexItem.SiteId   = courseModule.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.PageName = pageSettings.PageName;
                // permissions are kept in sync in search index
                // so that results are filtered by role correctly
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.ItemId              = courseModule.CourseId;
                indexItem.ModuleId            = courseModule.ModuleId;
                indexItem.ModuleTitle         = module.ModuleTitle;
                indexItem.FeatureId           = scheduleFeatureGuid.ToString();
                indexItem.FeatureName         = forumFeature.FeatureName;
                indexItem.FeatureResourceFile = forumFeature.ResourceFile;
                indexItem.Title = courseModule.CourseName;

                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                indexItem.ViewPage         = WebConfigSettings.CourseSearchUrl; //"browse-course";
                indexItem.Content          = courseModule.Description + " " + courseModule.Metatags + " " + courseModule.LeadInstructor;
                //indexItem.CreatedUtc = courseModule.CreatedOn;
                //indexItem.LastModUtc = courseModule.UpdatedOn;


                //older implementation

                //indexItem.Content = scheduleThread.PostMessage;


                //indexItem.QueryStringAddendum = "&thread="
                //    + forumThread.ThreadId.ToString()
                //    + "&postid=" + forumThread.PostId.ToString();



                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);

                if (debugLog)
                {
                    log.Debug("Indexed " + courseModule.CourseName);
                }
            }
        }
Beispiel #22
0
        private static void IndexItem(GalleryImage galleryImage)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if ((siteSettings == null) ||
                (galleryImage == null))
            {
                return;
            }

            Guid             galleryFeatureGuid = new Guid("d572f6b4-d0ed-465d-ad60-60433893b401");
            ModuleDefinition galleryFeature     = new ModuleDefinition(galleryFeatureGuid);
            Module           module             = new Module(galleryImage.ModuleId);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(galleryImage.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          siteSettings.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                indexItem.SiteId              = siteSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.FeatureId           = galleryFeatureGuid.ToString();
                indexItem.FeatureName         = galleryFeature.FeatureName;
                indexItem.FeatureResourceFile = galleryFeature.ResourceFile;
                indexItem.CreatedUtc          = galleryImage.UploadDate;
                indexItem.LastModUtc          = galleryImage.UploadDate;

                indexItem.ItemId   = galleryImage.ItemId;
                indexItem.ModuleId = galleryImage.ModuleId;

                indexItem.QueryStringAddendum = "&ItemID"
                                                + galleryImage.ModuleId.ToString()
                                                + "=" + galleryImage.ItemId.ToString();

                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = galleryImage.Caption;
                indexItem.Content          = galleryImage.Description;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);

                if (debugLog)
                {
                    log.Debug("Indexed " + galleryImage.Caption);
                }
            }
        }
Beispiel #23
0
        private static void IndexItem(KalturaVideoNotification video)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (video == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("forumThread object passed in KalturaIndexBuilderProvider.IndexItem was null");
                }
                return;
            }

            Module           module       = new Module(video.ModuleID);
            Guid             FeatureGuid  = new Guid("40C79626-E229-4CBA-B9B1-52745734FE44");
            ModuleDefinition forumFeature = new ModuleDefinition(FeatureGuid);

            // get list of pages where this module is published
            List <PageModule> pageModules = PageModule.GetPageModulesByModule(video.ModuleID);

            // must update index for all pages contained in this module
            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings = new PageSettings(video.SiteId, pageModule.PageId);
                if (pageSettings.IsPending)
                {
                    continue;
                }

                IndexItem indexItem = new IndexItem();
                if (video.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = video.SearchIndexPath;
                }
                indexItem.SiteId   = video.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.PageName = pageSettings.PageName;

                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.ModuleId            = video.ModuleID;
                indexItem.ModuleTitle         = module.ModuleTitle;
                indexItem.FeatureId           = FeatureGuid.ToString();
                indexItem.FeatureName         = forumFeature.FeatureName;
                indexItem.FeatureResourceFile = forumFeature.ResourceFile;

                indexItem.ItemId       = video.KalturaVideoID;
                indexItem.Title        = video.Name;
                indexItem.Content      = video.Description + " --&gt; " + video.Tags;
                indexItem.OtherContent = video.ThumnailURL;
                indexItem.ViewPage     = "/play-video?mediaId=" + video.EntryId;

                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;

                IndexHelper.RebuildIndex(indexItem);

                if (debugLog)
                {
                    log.Debug("Indexed " + video.Name);
                }
            }
        }
Beispiel #24
0
        protected override void RenderContents(HtmlTextWriter output)
        {
            DataSet dsBlogs = null;

            // Check for Featured Post, if it exists grab one less post to keep the count correct
            if (blogConfig.FeaturedPostId == 0)
            {
                dsBlogs = Blog.GetPageDataSet(config.BlogModuleId, DateTime.UtcNow, pageNumber, pageSize, out totalPages);
            }
            else
            {
                dsBlogs = Blog.GetPageDataSet(config.BlogModuleId, DateTime.UtcNow, pageNumber, (pageSize - 1), out totalPages);
            }

            DataRow featuredRow = dsBlogs.Tables["Posts"].NewRow();

            if (blogConfig.FeaturedPostId != 0 && pageNumber == 1)
            {
                using (IDataReader reader = Blog.GetSingleBlog(blogConfig.FeaturedPostId))
                {
                    while (reader.Read())
                    {
                        featuredRow["ItemID"]               = Convert.ToInt32(reader["ItemID"]);
                        featuredRow["ModuleID"]             = Convert.ToInt32(reader["ModuleID"]);
                        featuredRow["BlogGuid"]             = reader["BlogGuid"].ToString();
                        featuredRow["CreatedDate"]          = Convert.ToDateTime(reader["CreatedDate"]);
                        featuredRow["Heading"]              = reader["Heading"].ToString();
                        featuredRow["SubTitle"]             = reader["SubTitle"].ToString();
                        featuredRow["StartDate"]            = Convert.ToDateTime(reader["StartDate"]);
                        featuredRow["Description"]          = reader["Description"].ToString();
                        featuredRow["Abstract"]             = reader["Abstract"].ToString();
                        featuredRow["ItemUrl"]              = reader["ItemUrl"].ToString();
                        featuredRow["Location"]             = reader["Location"].ToString();
                        featuredRow["MetaKeywords"]         = reader["MetaKeywords"].ToString();
                        featuredRow["MetaDescription"]      = reader["MetaDescription"].ToString();
                        featuredRow["LastModUtc"]           = Convert.ToDateTime(reader["LastModUtc"]);
                        featuredRow["IsPublished"]          = true;
                        featuredRow["IncludeInFeed"]        = Convert.ToBoolean(reader["IncludeInFeed"]);
                        featuredRow["CommentCount"]         = Convert.ToInt32(reader["CommentCount"]);
                        featuredRow["CommentCount"]         = 0;
                        featuredRow["UserID"]               = Convert.ToInt32(reader["UserID"]);
                        featuredRow["UserID"]               = -1;
                        featuredRow["Name"]                 = reader["Name"].ToString();
                        featuredRow["FirstName"]            = reader["FirstName"].ToString();
                        featuredRow["LastName"]             = reader["LastName"].ToString();
                        featuredRow["LoginName"]            = reader["LoginName"].ToString();
                        featuredRow["Email"]                = reader["Email"].ToString();
                        featuredRow["AvatarUrl"]            = reader["AvatarUrl"].ToString();
                        featuredRow["AuthorBio"]            = reader["AuthorBio"].ToString();
                        featuredRow["AllowCommentsForDays"] = Convert.ToInt32(reader["AllowCommentsForDays"]);

                        if (reader["ShowAuthorName"] != DBNull.Value)
                        {
                            featuredRow["ShowAuthorName"] = Convert.ToBoolean(reader["ShowAuthorName"]);
                        }
                        else
                        {
                            featuredRow["ShowAuthorName"] = true;
                        }

                        if (reader["ShowAuthorAvatar"] != DBNull.Value)
                        {
                            featuredRow["ShowAuthorAvatar"] = Convert.ToBoolean(reader["ShowAuthorAvatar"]);
                        }
                        else
                        {
                            featuredRow["ShowAuthorAvatar"] = true;
                        }

                        if (reader["ShowAuthorBio"] != DBNull.Value)
                        {
                            featuredRow["ShowAuthorBio"] = Convert.ToBoolean(reader["ShowAuthorBio"]);
                        }
                        else
                        {
                            featuredRow["ShowAuthorBio"] = true;
                        }

                        if (reader["UseBingMap"] != DBNull.Value)
                        {
                            featuredRow["UseBingMap"] = Convert.ToBoolean(reader["UseBingMap"]);
                        }
                        else
                        {
                            featuredRow["UseBingMap"] = false;
                        }

                        featuredRow["MapHeight"] = reader["MapHeight"].ToString();
                        featuredRow["MapWidth"]  = reader["MapWidth"].ToString();
                        featuredRow["MapType"]   = reader["MapType"].ToString();

                        if (reader["MapZoom"] != DBNull.Value)
                        {
                            featuredRow["MapZoom"] = Convert.ToInt32(reader["MapZoom"]);
                        }
                        else
                        {
                            featuredRow["MapZoom"] = 13;
                        }

                        if (reader["ShowMapOptions"] != DBNull.Value)
                        {
                            featuredRow["ShowMapOptions"] = Convert.ToBoolean(reader["ShowMapOptions"]);
                        }
                        else
                        {
                            featuredRow["ShowMapOptions"] = false;
                        }

                        if (reader["ShowZoomTool"] != DBNull.Value)
                        {
                            featuredRow["ShowZoomTool"] = Convert.ToBoolean(reader["ShowZoomTool"]);
                        }
                        else
                        {
                            featuredRow["ShowZoomTool"] = false;
                        }

                        if (reader["ShowLocationInfo"] != DBNull.Value)
                        {
                            featuredRow["ShowLocationInfo"] = Convert.ToBoolean(reader["ShowLocationInfo"]);
                        }
                        else
                        {
                            featuredRow["ShowLocationInfo"] = false;
                        }

                        if (reader["UseDrivingDirections"] != DBNull.Value)
                        {
                            featuredRow["UseDrivingDirections"] = Convert.ToBoolean(reader["UseDrivingDirections"]);
                        }
                        else
                        {
                            featuredRow["UseDrivingDirections"] = false;
                        }

                        if (reader["ShowDownloadLink"] != DBNull.Value)
                        {
                            featuredRow["ShowDownloadLink"] = Convert.ToBoolean(reader["ShowDownloadLink"]);
                        }
                        else
                        {
                            featuredRow["ShowDownloadLink"] = false;
                        }

                        featuredRow["HeadlineImageUrl"] = reader["HeadlineImageUrl"].ToString();

                        if (reader["IncludeImageInExcerpt"] != DBNull.Value)
                        {
                            featuredRow["IncludeImageInExcerpt"] = Convert.ToBoolean(reader["IncludeImageInExcerpt"]);
                        }
                        else
                        {
                            featuredRow["IncludeImageInExcerpt"] = true;
                        }

                        if (reader["IncludeImageInPost"] != DBNull.Value)
                        {
                            featuredRow["IncludeImageInPost"] = Convert.ToBoolean(reader["IncludeImageInPost"]);
                        }
                        else
                        {
                            featuredRow["IncludeImageInPost"] = true;
                        }
                    }
                }
            }

            //look for featured post in datable
            DataRow found = dsBlogs.Tables["Posts"].Rows.Find(blogConfig.FeaturedPostId);

            if (found != null)
            {
                //remove featured post from datatable so we can insert it at the top if we're on "page" number 1
                dsBlogs.Tables["Posts"].Rows.Remove(found);
            }

            if (blogConfig.FeaturedPostId != 0 && pageNumber == 1)
            {
                //insert the featured post into the datatable at the top
                //we only want to do this if the current "page" is number 1, don't want the featured post on other pages.
                dsBlogs.Tables["Posts"].Rows.InsertAt(featuredRow, 0);
            }

            List <PageModule> pageModules = PageModule.GetPageModulesByModule(config.BlogModuleId);

            string blogPageUrl = string.Empty;

            if (pageModules.Count > 0)
            {
                blogPageUrl = pageModules[0].PageUrl;
            }

            List <BlogPostModel> models = new List <BlogPostModel>();

            foreach (DataRow postRow in dsBlogs.Tables["posts"].Rows)
            {
                BlogPostModel model = new BlogPostModel();

                if (useFriendlyUrls && (postRow["ItemUrl"].ToString().Length > 0))
                {
                    model.ItemUrl = navigationSiteRoot + postRow["ItemUrl"].ToString().Replace("~", string.Empty);
                }
                else
                {
                    model.ItemUrl = postRow["ItemID"].ToString() + "&mid=" + postRow["ModuleID"].ToString();
                }

                if (blogConfig.FeaturedPostId == Convert.ToInt32(postRow["ItemID"]) && pageNumber == 1)
                {
                    model.FeaturedPost = true;
                }
                else
                {
                    model.FeaturedPost = false;
                }

                model.Title             = postRow["Heading"].ToString();
                model.SubTitle          = postRow["SubTitle"].ToString();
                model.Body              = postRow["Description"].ToString();
                model.AuthorAvatar      = postRow["AvatarUrl"].ToString();
                model.AuthorDisplayName = postRow["Name"].ToString();
                model.AuthorFirstName   = postRow["FirstName"].ToString();
                model.AuthorLastName    = postRow["LastName"].ToString();
                model.AuthorBio         = postRow["AuthorBio"].ToString();
                model.Excerpt           = postRow["Abstract"].ToString();
                model.PostDate          = Convert.ToDateTime(postRow["StartDate"].ToString());
                model.HeadlineImageUrl  = postRow["HeadlineImageUrl"].ToString();
                model.CommentCount      = Convert.ToInt32(postRow["CommentCount"]);

                model.AllowCommentsForDays = Convert.ToInt32(postRow["AllowCommentsForDays"]);
                model.ShowAuthorName       = Convert.ToBoolean(postRow["ShowAuthorName"]);
                model.ShowAuthorAvatar     = Convert.ToBoolean(postRow["ShowAuthorAvatar"]);
                model.ShowAuthorBio        = Convert.ToBoolean(postRow["ShowAuthorBio"]);
                model.AuthorUserId         = Convert.ToInt32(postRow["UserID"]);

                models.Add(model);
            }

            PostListModel postListObject = new PostListModel();

            if (module != null)
            {
                postListObject.ModuleTitle = module.ModuleTitle;
                postListObject.Module      = module;
            }
            else
            {
                postListObject.ModuleTitle = "";
            }

            //postListObject.ModuleTitle = module == null ? "" : module.ModuleTitle;
            postListObject.ModulePageUrl = Page.ResolveUrl(blogPageUrl);
            postListObject.Posts         = models;

            string text = string.Empty;

            try
            {
                text = RazorBridge.RenderPartialToString(config.Layout, postListObject, "Blog");
            }
            //catch (System.Web.HttpException ex)
            //{
            //	renderDefaultView(ex.ToString());
            //}
            //catch (ArgumentNullException ex)
            //{
            //	renderDefaultView(ex.ToString());
            //}
            catch (Exception ex)
            {
                renderDefaultView(ex.ToString());
            }

            void renderDefaultView(string error = "")
            {
                if (!string.IsNullOrWhiteSpace(error))
                {
                    log.ErrorFormat(
                        "chosen layout ({0}) for _BlogPostList was not found in skin {1}. perhaps it is in a different skin. Error was: {2}",
                        config.Layout,
                        SiteUtils.GetSkinBaseUrl(true, Page),
                        error
                        );
                }

                text = RazorBridge.RenderPartialToString("_BlogPostList", postListObject, "Blog");
            }

            output.Write(text);
        }
        private static void IndexItem(ForumThread forumThread)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }


            if (forumThread == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("forumThread object passed in ForumThreadIndexBuilderProvider.IndexItem was null");
                }
                return;
            }

            Forum            forum            = new Forum(forumThread.ForumId);
            Module           module           = new Module(forum.ModuleId);
            Guid             forumFeatureGuid = new Guid("38aa5a84-9f5c-42eb-8f4c-105983d419fb");
            ModuleDefinition forumFeature     = new ModuleDefinition(forumFeatureGuid);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(forum.ModuleId);

            // must update index for all pages containing
            // this module
            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          forumThread.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }


                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                if (forumThread.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = forumThread.SearchIndexPath;
                }
                indexItem.SiteId   = forumThread.SiteId;
                indexItem.PageId   = pageModule.PageId;
                indexItem.PageName = pageSettings.PageName;
                // permissions are kept in sync in search index
                // so that results are filtered by role correctly
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.ItemId              = forumThread.ForumId;
                indexItem.ModuleId            = forum.ModuleId;
                indexItem.ModuleTitle         = module.ModuleTitle;
                indexItem.FeatureId           = forumFeatureGuid.ToString();
                indexItem.FeatureName         = forumFeature.FeatureName;
                indexItem.FeatureResourceFile = forumFeature.ResourceFile;
                indexItem.Title = forumThread.Subject;

                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                indexItem.ViewPage         = "Forums/Thread.aspx";

                indexItem.CreatedUtc = forumThread.ThreadDate;
                indexItem.LastModUtc = forumThread.MostRecentPostDate;

                if (ForumConfiguration.AggregateSearchIndexPerThread)
                {
                    indexItem.PublishBeginDate = forumThread.MostRecentPostDate;
                    StringBuilder threadContent = new StringBuilder();

                    DataTable threadPosts = ForumThread.GetPostsByThread(forumThread.ThreadId);

                    foreach (DataRow r in threadPosts.Rows)
                    {
                        threadContent.Append(r["Post"].ToString());
                    }

                    //aggregate contents of posts into one indexable content item
                    indexItem.Content = threadContent.ToString();

                    if (ForumConfiguration.CombineUrlParams)
                    {
                        indexItem.ViewPage = "Forums/Thread.aspx?pageid=" + pageModule.PageId.ToInvariantString()
                                             + "&t=" + forumThread.ThreadId.ToInvariantString() + "~1";
                        indexItem.UseQueryStringParams = false;
                    }

                    indexItem.QueryStringAddendum = "&thread=" + forumThread.ThreadId.ToInvariantString();
                }
                else
                {
                    //older implementation

                    indexItem.Content = forumThread.PostMessage;


                    indexItem.QueryStringAddendum = "&thread="
                                                    + forumThread.ThreadId.ToString()
                                                    + "&postid=" + forumThread.PostId.ToString();
                }



                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);

                if (debugLog)
                {
                    log.Debug("Indexed " + forumThread.Subject);
                }
            }
        }
        public override string HandleRequestAndReturnUrlForRedirect(
            HttpContext context,
            string payPalToken,
            string payPalPayerId,
            PayPalLog setExpressCheckoutLog)
        {
            string redirectUrl = string.Empty;

            if ((payPalToken == null) || (payPalToken.Length == 0))
            {
                log.Error("WebStorePayPalReturnHandler received empty payPalToken");
                return(redirectUrl);
            }

            if (setExpressCheckoutLog == null)
            {
                log.Error("WebStorePayPalReturnHandler received null setExpressCheckoutLog for payPalToken " + payPalToken);
                return(redirectUrl);
            }

            if (setExpressCheckoutLog.SerializedObject.Length == 0)
            {
                log.Error("WebStorePayPalReturnHandler cart was not previously serialized for payPalToken " + payPalToken);
                return(redirectUrl);
            }

            if (setExpressCheckoutLog.CreatedUtc.AddHours(4) < DateTime.UtcNow)
            {
                log.Error("payPalToken " + payPalToken + " was more than 4 hours old, it should expire after 3 hours ");
                return(redirectUrl);
            }

            CommerceConfiguration commerceConfig = SiteUtils.GetCommerceConfig();

            PayPalExpressGateway gateway
                = new PayPalExpressGateway(
                      commerceConfig.PayPalAPIUsername,
                      commerceConfig.PayPalAPIPassword,
                      commerceConfig.PayPalAPISignature,
                      commerceConfig.PayPalStandardEmailAddress);

            gateway.UseTestMode   = commerceConfig.PaymentGatewayUseTestMode;
            gateway.PayPalToken   = payPalToken;
            gateway.PayPalPayerId = payPalPayerId;


            Cart savedCart = (Cart)SerializationHelper.DeserializeFromString(typeof(Cart), setExpressCheckoutLog.SerializedObject);

            savedCart.DeSerializeCartOffers();

            string siteRoot = SiteUtils.GetNavigationSiteRoot();

            gateway.MerchantCartId = savedCart.CartGuid.ToString();
            gateway.ChargeTotal    = savedCart.OrderTotal;
            gateway.ReturnUrl      = siteRoot + "/Services/PayPalReturnHandler.ashx";
            gateway.CancelUrl      = siteRoot;
            //gateway.PayPalPayerId = payPalPayerId;

            gateway.CallGetExpressCheckoutDetails();


            PayPalLog payPalLog = new PayPalLog();

            payPalLog.ProviderName     = WebStorePayPalReturnHandler.ProviderName;
            payPalLog.SerializedObject = setExpressCheckoutLog.SerializedObject;
            payPalLog.ReturnUrl        = setExpressCheckoutLog.ReturnUrl;
            payPalLog.RawResponse      = gateway.RawResponse;
            payPalLog.TransactionId    = gateway.TransactionId;
            payPalLog.CurrencyCode     = gateway.CurrencyCode;
            // TODO: add versions to gateways
            //log.ApiVersion = gateway.
            payPalLog.CartGuid = savedCart.CartGuid;

            Store store = new Store(savedCart.StoreGuid);

            payPalLog.Token       = payPalToken;
            payPalLog.PayerId     = payPalPayerId;
            payPalLog.RequestType = "GetExpressCheckoutDetails";
            payPalLog.SiteGuid    = store.SiteGuid;
            payPalLog.StoreGuid   = store.Guid;
            payPalLog.UserGuid    = savedCart.UserGuid;

            // update the order with customer shipping info
            savedCart.OrderInfo.DeliveryCompany    = gateway.ShipToCompanyName;
            savedCart.OrderInfo.DeliveryAddress1   = gateway.ShipToAddress;
            savedCart.OrderInfo.DeliveryAddress2   = gateway.ShipToAddress2;
            savedCart.OrderInfo.DeliveryCity       = gateway.ShipToCity;
            savedCart.OrderInfo.DeliveryFirstName  = gateway.ShipToFirstName;
            savedCart.OrderInfo.DeliveryLastName   = gateway.ShipToLastName;
            savedCart.OrderInfo.DeliveryPostalCode = gateway.ShipToPostalCode;
            savedCart.OrderInfo.DeliveryState      = gateway.ShipToState;
            savedCart.OrderInfo.DeliveryCountry    = gateway.ShipToCountry;

            //Note that PayPal only returns a phone number if your Merchant accounts is configured to require the
            // buyer to provide it.
            if (gateway.ShipToPhone.Length > 0)
            {
                savedCart.OrderInfo.CustomerTelephoneDay = gateway.ShipToPhone;
            }

            if (gateway.BuyerEmail.Length > 0)
            {
                savedCart.OrderInfo.CustomerEmail = gateway.BuyerEmail;
            }

            // if customer and billing aren't populated already, user was anonymous when checkout began, make them the same as shipping
            //if (savedCart.UserGuid == Guid.Empty)
            //{
            //2013-12-23 since all we get is shipping address this can be considered as the same thing as billing address for paypal purposes so always use it
            // especially because we may need to calculate tax for express checkout
            // based on the address provided by paypal
            savedCart.CopyShippingToBilling();
            savedCart.CopyShippingToCustomer();
            //}

            GeoCountry country = new GeoCountry(savedCart.OrderInfo.DeliveryCountry);
            GeoZone    taxZone = GeoZone.GetByCode(country.Guid, savedCart.OrderInfo.DeliveryState);

            savedCart.OrderInfo.TaxZoneGuid = taxZone.Guid;

            savedCart.OrderInfo.Save();

            // refresh totals to calculate tax or shipping now that we have an address
            savedCart.RefreshTotals();
            savedCart.Save();

            savedCart.SerializeCartOffers();
            payPalLog.SerializedObject = SerializationHelper.SerializeToString(savedCart);

            payPalLog.Save();

            if (gateway.Response == PaymentGatewayResponse.Error)
            {
                redirectUrl = siteRoot + "/WebStore/PayPalGatewayError.aspx?plog=" + payPalLog.RowGuid.ToString();
                return(redirectUrl);
            }

            if (gateway.PayPalPayerId.Length == 0)
            {
                redirectUrl = siteRoot + "/WebStore/PayPalGatewayError.aspx?plog=" + payPalLog.RowGuid.ToString();
                return(redirectUrl);
            }


            int pageId = -1;

            List <PageModule> pageModules = PageModule.GetPageModulesByModule(store.ModuleId);

            foreach (PageModule pm in pageModules)
            {
                // use first pageid found, really a store should only
                // be on one page
                pageId = pm.PageId;
                break;
            }

            // after the CallGetExpressCheckoutDetails
            // we have the option of directing to a final review page before
            // calling CallDoExpressCheckoutPayment

            redirectUrl = siteRoot +
                          "/WebStore/PayPalExpressCheckout.aspx?pageid="
                          + pageId.ToString(CultureInfo.InvariantCulture)
                          + "&mid=" + store.ModuleId.ToString(CultureInfo.InvariantCulture)
                          + "&plog=" + payPalLog.RowGuid.ToString();

            return(redirectUrl);
        }
Beispiel #27
0
        private static void IndexItem(SharedFile sharedFile)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (
                (sharedFile == null) ||
                (siteSettings == null)
                )
            {
                return;
            }

            Guid             sharedFilesFeatureGuid = new Guid("dc873d76-5bf2-4ac5-bff7-434a87a3fc8e");
            ModuleDefinition sharedFilesFeature     = new ModuleDefinition(sharedFilesFeatureGuid);

            Module module = new Module(sharedFile.ModuleId);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(sharedFile.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          siteSettings.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                indexItem.SiteId              = siteSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.FeatureId           = sharedFilesFeatureGuid.ToString();
                indexItem.FeatureName         = sharedFilesFeature.FeatureName;
                indexItem.FeatureResourceFile = sharedFilesFeature.ResourceFile;
                indexItem.CreatedUtc          = sharedFile.UploadDate;
                indexItem.LastModUtc          = sharedFile.UploadDate;

                indexItem.ItemId           = sharedFile.ItemId;
                indexItem.ModuleId         = sharedFile.ModuleId;
                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = sharedFile.FriendlyName.Replace("_", " ").Replace("-", " ").Replace(".", " ");
                indexItem.Content          = sharedFile.Description;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                // make the search results a download link
                indexItem.ViewPage = "SharedFiles/Download.aspx?pageid=" + indexItem.PageId.ToInvariantString()
                                     + "&fileid=" + indexItem.ItemId.ToInvariantString()
                                     + "&mid=" + indexItem.ModuleId.ToInvariantString();
                indexItem.UseQueryStringParams = false;

                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Indexed " + sharedFile.FriendlyName);
            }
        }
Beispiel #28
0
        private static void IndexItem(Blog blog)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            if (blog == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("blog object passed to BlogIndexBuilderProvider.IndexItem was null");
                }
                return;
            }

            if (!blog.IncludeInSearch)
            {
                return;
            }

            Module           module          = new Module(blog.ModuleId);
            Guid             blogFeatureGuid = new Guid("026cbead-2b80-4491-906d-b83e37179ccf");
            ModuleDefinition blogFeature     = new ModuleDefinition(blogFeatureGuid);

            // get comments so  they can be indexed too
            StringBuilder stringBuilder = new StringBuilder();

            using (IDataReader comments = Blog.GetBlogComments(blog.ModuleId, blog.ItemId))
            {
                while (comments.Read())
                {
                    stringBuilder.Append("  " + comments["Comment"].ToString());
                    stringBuilder.Append("  " + comments["Name"].ToString());

                    if (debugLog)
                    {
                        log.Debug("BlogIndexBuilderProvider.IndexItem add comment ");
                    }
                }
            }

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(blog.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          blog.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                if (blog.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = blog.SearchIndexPath;
                }
                indexItem.SiteId = blog.SiteId;
                indexItem.ExcludeFromRecentContent = blog.ExcludeFromRecentContent;
                indexItem.PageId          = pageSettings.PageId;
                indexItem.PageName        = pageSettings.PageName;
                indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles = module.ViewRoles;

                indexItem.PageMetaDescription = blog.MetaDescription;
                indexItem.PageMetaKeywords    = blog.MetaKeywords;
                indexItem.ItemId              = blog.ItemId;
                indexItem.ModuleId            = blog.ModuleId;
                indexItem.ModuleTitle         = module.ModuleTitle;
                indexItem.Title               = blog.Title;
                indexItem.Content             = blog.Description + " " + blog.MetaDescription + " " + blog.MetaKeywords;
                indexItem.ContentAbstract     = blog.Excerpt;
                indexItem.FeatureId           = blogFeatureGuid.ToString();
                indexItem.FeatureName         = blogFeature.FeatureName;
                indexItem.FeatureResourceFile = blogFeature.ResourceFile;

                indexItem.OtherContent = stringBuilder.ToString();

                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                if (blog.StartDate > pageModule.PublishBeginDate)
                {
                    indexItem.PublishBeginDate = blog.StartDate;
                }

                indexItem.PublishEndDate = pageModule.PublishEndDate;
                if (blog.EndDate < pageModule.PublishEndDate)
                {
                    indexItem.PublishEndDate = blog.EndDate;
                }

                if ((blog.UserFirstName.Length > 0) && (blog.UserLastName.Length > 0))
                {
                    indexItem.Author = string.Format(CultureInfo.InvariantCulture,
                                                     BlogResources.FirstLastFormat, blog.UserFirstName, blog.UserLastName);
                }
                else
                {
                    indexItem.Author = blog.UserName;
                }

                indexItem.CreatedUtc = blog.StartDate;
                indexItem.LastModUtc = blog.LastModUtc;

                if ((!WebConfigSettings.UseUrlReWriting) || (!BlogConfiguration.UseFriendlyUrls(indexItem.ModuleId)))
                {
                    indexItem.ViewPage = "Blog/ViewPost.aspx?pageid="
                                         + indexItem.PageId.ToInvariantString()
                                         + "&mid=" + indexItem.ModuleId.ToInvariantString()
                                         + "&ItemID=" + indexItem.ItemId.ToInvariantString()
                    ;
                }
                else
                {
                    indexItem.ViewPage = blog.ItemUrl.Replace("~/", string.Empty);
                }

                indexItem.UseQueryStringParams = false;



                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Indexed " + blog.Title);
            }
        }
        private static void IndexItem(Offer offer)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }
            if (offer == null)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("product object passed to OfferSearchIndexBuilder.IndexItem was null");
                }
                return;
            }

            Store store = new Store(offer.StoreGuid);

            Module           module = new Module(store.ModuleId);
            Guid             webStoreFeatureGuid = new Guid("0cefbf18-56de-11dc-8f36-bac755d89593");
            ModuleDefinition webStoreFeature     = new ModuleDefinition(webStoreFeatureGuid);

            //// get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(store.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          offer.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                mojoPortal.SearchIndex.IndexItem indexItem = new mojoPortal.SearchIndex.IndexItem();
                if (offer.SearchIndexPath.Length > 0)
                {
                    indexItem.IndexPath = offer.SearchIndexPath;
                }
                indexItem.SiteId          = offer.SiteId;
                indexItem.PageId          = pageSettings.PageId;
                indexItem.PageName        = pageSettings.PageName;
                indexItem.ViewRoles       = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles = module.ViewRoles;
                if (offer.Url.Length > 0)
                {
                    indexItem.ViewPage             = offer.Url.Replace("~/", string.Empty);
                    indexItem.UseQueryStringParams = false;
                }
                else
                {
                    indexItem.ViewPage = "/WebStore/OfferDetail.aspx";
                }
                indexItem.ItemKey             = offer.Guid.ToString();
                indexItem.ModuleId            = store.ModuleId;
                indexItem.ModuleTitle         = module.ModuleTitle;
                indexItem.Title               = offer.Name;
                indexItem.PageMetaDescription = offer.MetaDescription;
                indexItem.PageMetaKeywords    = offer.MetaKeywords;

                indexItem.CreatedUtc = offer.Created;
                indexItem.LastModUtc = offer.LastModified;

                indexItem.Content
                    = offer.Teaser
                      + " " + offer.Description.Replace(tabScript, string.Empty)
                      + " " + offer.MetaDescription
                      + " " + offer.MetaKeywords;

                indexItem.FeatureId           = webStoreFeatureGuid.ToString();
                indexItem.FeatureName         = webStoreFeature.FeatureName;
                indexItem.FeatureResourceFile = webStoreFeature.ResourceFile;
                indexItem.PublishBeginDate    = pageModule.PublishBeginDate;
                indexItem.PublishEndDate      = pageModule.PublishEndDate;

                mojoPortal.SearchIndex.IndexHelper.RebuildIndex(indexItem);
            }

            if (debugLog)
            {
                log.Debug("Indexed " + offer.Name);
            }
        }
        private static void IndexItem(SharedFile sharedFile)
        {
            if (WebConfigSettings.DisableSearchIndex)
            {
                return;
            }

            SiteSettings siteSettings = CacheHelper.GetCurrentSiteSettings();

            if (
                (sharedFile == null) ||
                (siteSettings == null)
                )
            {
                return;
            }

            Guid             sharedFilesFeatureGuid = new Guid("2BCF0FF5-226A-480b-9795-2F343593365C");
            ModuleDefinition sharedFilesFeature     = new ModuleDefinition(sharedFilesFeatureGuid);

            Module module = new Module(sharedFile.ModuleId);

            // get list of pages where this module is published
            List <PageModule> pageModules
                = PageModule.GetPageModulesByModule(sharedFile.ModuleId);

            foreach (PageModule pageModule in pageModules)
            {
                PageSettings pageSettings
                    = new PageSettings(
                          siteSettings.SiteId,
                          pageModule.PageId);

                //don't index pending/unpublished pages
                if (pageSettings.IsPending)
                {
                    continue;
                }

                IndexItem indexItem = new IndexItem();
                indexItem.SiteId              = siteSettings.SiteId;
                indexItem.PageId              = pageSettings.PageId;
                indexItem.PageName            = pageSettings.PageName;
                indexItem.ViewRoles           = pageSettings.AuthorizedRoles;
                indexItem.ModuleViewRoles     = module.ViewRoles;
                indexItem.FeatureId           = sharedFilesFeatureGuid.ToString();
                indexItem.FeatureName         = sharedFilesFeature.FeatureName;
                indexItem.FeatureResourceFile = sharedFilesFeature.ResourceFile;

                indexItem.ItemId           = sharedFile.ItemId;
                indexItem.ModuleId         = sharedFile.ModuleId;
                indexItem.ModuleTitle      = module.ModuleTitle;
                indexItem.Title            = sharedFile.FriendlyName;
                indexItem.Content          = sharedFile.Description;
                indexItem.PublishBeginDate = pageModule.PublishBeginDate;
                indexItem.PublishEndDate   = pageModule.PublishEndDate;
                // make the search results a download link
                indexItem.ViewPage = "SharedFiles/Download.aspx?pageid=" + indexItem.PageId.ToInvariantString()
                                     + "&fileid=" + indexItem.ItemId.ToInvariantString()
                                     + "&mid=" + indexItem.ModuleId.ToInvariantString();
                indexItem.UseQueryStringParams = false;

                IndexHelper.RebuildIndex(indexItem);
            }

            if (log.IsDebugEnabled)
            {
                log.Debug("Indexed "
                          + sharedFile.FriendlyName);
            }
        }