コード例 #1
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            var items = new SearchItemInfoCollection();

            // Add the devices to the search index.
            foreach (var item in Factory.ActiveProvider.Devices)
            {
                string guid = String.Format("DeviceID={0}",
                                            item.DeviceId);

                var device = new Device(item);

                items.Add(new SearchItemInfo(
                              device.HardwareCaption,
                              String.Format("{0} running {1} with browser {2}",
                                            device.HardwareCaption,
                                            device.SoftwareCaption,
                                            device.BrowserCaption),
                              ModInfo.CreatedByUserID,
                              Factory.ActiveProvider.PublishedDate,
                              ModInfo.ModuleID,
                              device.DeviceID,
                              device.Content,
                              guid));
            }

            // Add the properties to the search.
            foreach (var property in Factory.ActiveProvider.Properties)
            {
                items.Add(new SearchItemInfo(
                              property.Name,
                              property.Description,
                              ModInfo.CreatedByUserID,
                              Factory.ActiveProvider.PublishedDate,
                              ModInfo.ModuleID,
                              property.Name,
                              property.Description));
                foreach (var value in property.Values)
                {
                    string name = String.Format("{0} - {1}", property.Name, value.Name);
                    items.Add(new SearchItemInfo(
                                  name,
                                  value.Description,
                                  ModInfo.CreatedByUserID,
                                  Factory.ActiveProvider.PublishedDate,
                                  ModInfo.ModuleID,
                                  name,
                                  value.Description));
                }
            }

            return(items);
        }
コード例 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="modInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var searchItemCollection = new SearchItemInfoCollection();

            List <Article> colArticles = ArticleController.GetArticles(modInfo.ModuleID);

            foreach (Article objArticle in colArticles)
            {
                string rssDescription;
                if (modInfo.ModuleSettings.Contains("FullArticleText"))
                {
                    rssDescription = Convert.ToBoolean(modInfo.ModuleSettings["FullArticleText"]) ? objArticle.Body : objArticle.Description;
                }
                else
                {
                    rssDescription = objArticle.Description;
                }

                var rssContent = HttpUtility.HtmlDecode(rssDescription);
                if (modInfo.ModuleSettings.Contains("CleanRss"))
                {
                    if (Convert.ToBoolean(modInfo.ModuleSettings["CleanRss"]))
                    {
                        rssContent = DotNetNuke.Common.Utilities.HtmlUtils.StripTags(rssContent, false);
                    }
                }

                var searchItem = new SearchItemInfo(objArticle.Title, rssContent, objArticle.CreatedByUserID, objArticle.CreatedOnDate, modInfo.ModuleID, objArticle.ArticleId.ToString(CultureInfo.InvariantCulture), DotNetNuke.Common.Utilities.HtmlUtils.StripTags(HttpUtility.HtmlDecode(objArticle.Body), false), "aid=" + objArticle.ArticleId);
                searchItemCollection.Add(searchItem);
            }

            return(searchItemCollection);
        }
コード例 #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name = "ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            var          objWorkflow          = new WorkflowStateController();
            int          WorkflowID           = GetWorkflow(ModInfo.ModuleID, ModInfo.TabID, ModInfo.PortalID).Value;
            var          SearchItemCollection = new SearchItemInfoCollection();
            HtmlTextInfo objContent           = GetTopHtmlText(ModInfo.ModuleID, true, WorkflowID);

            if (objContent != null)
            {
                //content is encoded in the Database so Decode before Indexing
                string strContent = HttpUtility.HtmlDecode(objContent.Content);

                //Get the description string
                string strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(strContent, false), MAX_DESCRIPTION_LENGTH, "...");

                var SearchItem = new SearchItemInfo(ModInfo.ModuleTitle,
                                                    strDescription,
                                                    objContent.LastModifiedByUserID,
                                                    objContent.LastModifiedOnDate,
                                                    ModInfo.ModuleID,
                                                    "",
                                                    strContent,
                                                    "",
                                                    Null.NullInteger);
                SearchItemCollection.Add(SearchItem);
            }

            return(SearchItemCollection);
        }
コード例 #4
0
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            Hashtable moduleSettings    = Entities.Portals.PortalSettings.GetModuleSettings(ModInfo.ModuleID);
            int       descriptionLength = 100;

            if (Convert.ToString(moduleSettings["descriptionLength"]) != "")
            {
                descriptionLength = int.Parse(Convert.ToString(moduleSettings["descriptionLength"]));
                if (descriptionLength < 1)
                {
                    descriptionLength = 1950;
                    //max length of description is 2000 char, take a bit less to make sure it fits...
                }
            }

            var searchItemCollection = new SearchItemInfoCollection();

            IEnumerable <AnnouncementInfo> announcements = GetCurrentAnnouncements(ModInfo.ModuleID, Null.NullDate);

            foreach (AnnouncementInfo objAnnouncement in announcements)
            {
                var    tempVar        = objAnnouncement;
                string strContent     = System.Web.HttpUtility.HtmlDecode(tempVar.Title + " " + tempVar.Description);
                string strDescription =
                    HtmlUtils.Shorten(HtmlUtils.Clean(System.Web.HttpUtility.HtmlDecode(tempVar.Description), false),
                                      descriptionLength, "...");
                var searchItem = new SearchItemInfo(ModInfo.ModuleTitle + " - " + tempVar.Title, strDescription,
                                                    tempVar.CreatedByUserID, tempVar.PublishDate.Value, ModInfo.ModuleID,
                                                    tempVar.ItemID.ToString(CultureInfo.InvariantCulture), strContent,
                                                    "ItemID=" + tempVar.ItemID.ToString(CultureInfo.InvariantCulture));
                searchItemCollection.Add(searchItem);
            }

            return(searchItemCollection);
        }
コード例 #5
0
        /// <summary>
        /// Gets a collection of <see cref="SearchItemInfo"/> instances, describing the job openings that can be viewed in the given Job Details module.
        /// </summary>
        /// <param name="modInfo">Information about the module instance for which jobs should be returned.</param>
        /// <returns>A collection of <see cref="SearchItemInfo"/> instances</returns>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            if (modInfo == null)
            {
                throw new ArgumentNullException("modInfo", @"modInfo must not be null.");
            }

            var searchItems = new SearchItemInfoCollection();

            // only index the JobDetail module definition (since most of this information is only viewable there,
            // and because the Guid parameter on the SearchItemInfo ("jobid=" + jobid) gets put on the querystring to make it work all automagically).  BD
            if (ModuleDefinitionController.GetModuleDefinitionByFriendlyName(ModuleDefinition.JobDetail.ToString(), modInfo.DesktopModuleID).ModuleDefID == modInfo.ModuleDefID &&
                ModuleSettings.JobDetailEnableDnnSearch.GetValueAsBooleanFor(DesktopModuleName, modInfo, ModuleSettings.JobDetailEnableDnnSearch.DefaultValue))
            {
                int?jobGroupId = ModuleSettings.JobGroupId.GetValueAsInt32For(DesktopModuleName, modInfo, ModuleSettings.JobGroupId.DefaultValue);

                using (IDataReader jobs = DataProvider.Instance().GetJobs(jobGroupId, modInfo.PortalID))
                {
                    while (jobs.Read())
                    {
                        if (!(bool)jobs["IsFilled"])
                        {
                            string jobId             = ((int)jobs["JobId"]).ToString(CultureInfo.InvariantCulture);
                            string searchDescription = HtmlUtils.StripWhiteSpace(HtmlUtils.Clean((string)jobs["JobDescription"], false), true);
                            string searchItemTitle   = string.Format(
                                CultureInfo.CurrentCulture,
                                Utility.GetString("JobInLocation", LocalResourceFile, modInfo.PortalID),
                                (string)jobs["JobTitle"],
                                (string)jobs["LocationName"],
                                (string)jobs["StateName"]);

                            string searchedContent =
                                HtmlUtils.StripWhiteSpace(
                                    HtmlUtils.Clean(
                                        (string)jobs["JobTitle"] + " " + (string)jobs["JobDescription"] + " " + (string)jobs["RequiredQualifications"] +
                                        " " + (string)jobs["DesiredQualifications"],
                                        false),
                                    true);

                            searchItems.Add(
                                new SearchItemInfo(
                                    searchItemTitle,
                                    searchDescription,
                                    (int)jobs["RevisingUser"],
                                    (DateTime)jobs["RevisionDate"],
                                    modInfo.ModuleID,
                                    jobId,
                                    searchedContent,
                                    "jobid=" + jobId));
                        }
                    }
                }
            }

            return(searchItems);
        }
コード例 #6
0
        /// <summary>
        /// Allow products to be searched via the built-in DNN Search
        /// </summary>
        /// <param name="moduleInfo"></param>
        /// <returns></returns>
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo moduleInfo)
        {
            SearchItemInfoCollection searchItemCollection = new SearchItemInfoCollection();

            InitializeEntitySpaces();

            int portalId = moduleInfo.PortalID;
            int moduleId = moduleInfo.ModuleID;

            // We need to always use the same ModuleID because DNN calls this method for each instance of our module that exists.
            // If we did NOT do this, there would be duplicate Products in the search results
            List <TabModuleMatch> moduleTabs = DnnHelper.GetTabsWithModuleByModuleDefinitionName(portalId, ModuleDefs.MainDispatch.DefinitionName);

            if (moduleTabs.Count > 0)
            {
                moduleId = moduleTabs[0].ModuleId;
            }

            DataModel.Store store = DataModel.Store.GetStoreByPortalId(portalId);
            if (store != null)
            {
                List <Product> allProductsInStore = ProductCollection.GetAll(store.Id.Value, true);
                foreach (Product p in allProductsInStore)
                {
                    string description = "";
                    List <ProductDescriptor> descriptors = p.GetProductDescriptors();
                    if (descriptors.Count > 0)
                    {
                        description = descriptors[0].TextHtmlDecoded;
                    }

                    //string searchKey = p.Id.Value.ToString();
                    string searchKey     = "DNNspot-Store-Product-" + p.Id.Value.ToString();
                    string searchContent = p.Name + " " + description;

                    SearchItemInfo searchItem = new SearchItemInfo(
                        p.Name,
                        description.StripHtmlTags().ChopAtWithSuffix(200, "..."),
                        Null.NullInteger,
                        p.ModifiedOn.Value,
                        moduleId,
                        searchKey,
                        searchContent,
                        "product=" + p.Id.Value.ToString()
                        );

                    searchItemCollection.Add(searchItem);
                }
            }
            return(searchItemCollection);
        }
コード例 #7
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();

            List <DnnTestInfo> colDnnTests = GetDnnTests(ModInfo.ModuleID);

            foreach (DnnTestInfo objDnnTest in colDnnTests)
            {
                SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objDnnTest.Content, objDnnTest.CreatedByUser, objDnnTest.CreatedDate, ModInfo.ModuleID, objDnnTest.ItemId.ToString(), objDnnTest.Content, "ItemId=" + objDnnTest.ItemId.ToString());
                SearchItemCollection.Add(SearchItem);
            }

            return(SearchItemCollection);
        }
コード例 #8
0
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            SearchItemInfoCollection itmSearchColl = new SearchItemInfoCollection();
            MediaInfo itm = GetMedia(ModInfo.ModuleID);

            if (itm != null)
            {
                string content = string.Concat(itm.Alt, " :: ", StripTags(itm.MediaMessage));

                SearchItemInfo itmSearch = new SearchItemInfo(ModInfo.ModuleTitle, content, itm.LastUpdatedBy, itm.LastUpdatedDate, ModInfo.ModuleID, itm.ModuleID.ToString(), content);
                itmSearchColl.Add(itmSearch);
            }

            return(itmSearchColl);
        }
コード例 #9
0
        /// <summary>
        /// Implements the search interface required to allow DNN to index/search the content of your
        /// module
        /// </summary>
        /// <param name="modInfo"></param>
        /// <returns></returns>
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            SearchItemInfoCollection searchItems = new SearchItemInfoCollection();

            List <DetailTinTucInfo> infos = GetDetailTinTucs(modInfo.ModuleID);

            foreach (DetailTinTucInfo info in infos)
            {
                SearchItemInfo searchInfo = new SearchItemInfo(modInfo.ModuleTitle, info.Content, info.CreatedByUser, info.CreatedDate,
                                                               modInfo.ModuleID, info.ItemId.ToString(), info.Content, "Item=" + info.ItemId.ToString());
                searchItems.Add(searchInfo);
            }

            return(searchItems);
        }
コード例 #10
0
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List <NoticesInfo>       colNotices           = GetNoticess();

            foreach (NoticesInfo objNotices in colNotices)
            {
                if (objNotices != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objNotices.title, objNotices.editor, objNotices.notedate, ModInfo.ModuleID, objNotices.id.ToString(), objNotices.title, "ItemId=" + objNotices.id.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return(SearchItemCollection);
        }
コード例 #11
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List <SF_EventsMapInfo>  colSF_EventsMaps     = GetSF_EventsMaps(ModInfo.ModuleID);

            foreach (SF_EventsMapInfo objSF_EventsMap in colSF_EventsMaps)
            {
                if (objSF_EventsMap != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objSF_EventsMap.Content, objSF_EventsMap.CreatedByUser, objSF_EventsMap.CreatedDate, ModInfo.ModuleID, objSF_EventsMap.ItemId.ToString(), objSF_EventsMap.Content, "ItemId=" + objSF_EventsMap.ItemId.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return(SearchItemCollection);
        }
コード例 #12
0
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List <ProvinceInfo>      colProvinces         = GetProvinces();

            foreach (ProvinceInfo objProvince in colProvinces)
            {
                if (objProvince != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objProvince.Name, objProvince.CreatedByUser, objProvince.CreatedDate, ModInfo.ModuleID, objProvince.Id.ToString(), objProvince.Name, "ItemId=" + objProvince.Id.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return(SearchItemCollection);
        }
コード例 #13
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List <ATI_PeopleInfo>    colATI_Peoples       = GetATI_Peoples(ModInfo.ModuleID);

            foreach (ATI_PeopleInfo objATI_People in colATI_Peoples)
            {
                if (objATI_People != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objATI_People.Content, objATI_People.CreatedByUser, objATI_People.CreatedDate, ModInfo.ModuleID, objATI_People.ItemId.ToString(), objATI_People.Content, "ItemId=" + objATI_People.ItemId.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return(SearchItemCollection);
        }
コード例 #14
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            ProductController        pc = new ProductController();
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            List <ProductInfo>       colDnnCarts          = pc.GetProducts(ModInfo.ModuleID);

            foreach (ProductInfo objProduct in colDnnCarts)
            {
                if (objProduct != null)
                {
                    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objProduct.ShortDescription, objProduct.CreatedByUser, objProduct.CreatedDate, ModInfo.ModuleID, objProduct.ProductId.ToString(), objProduct.LongDescription, "ProductId=" + objProduct.ProductId.ToString());
                    SearchItemCollection.Add(SearchItem);
                }
            }

            return(SearchItemCollection);
        }
コード例 #15
0
        /// <summary>
        /// Implements the search interface required to allow DNN to index/search the content of your
        /// module
        /// </summary>
        /// <param name="modInfo"></param>
        /// <returns></returns>
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            SearchItemInfoCollection searchItems = new SearchItemInfoCollection();

            using (SelectedHotelsEntities db = new SelectedHotelsEntities())
            {
                IList <Product> products = (from p in db.Products
                                            where !p.IsDeleted
                                            select p).ToList();
                foreach (var product in products)
                {
                    SearchItemInfo searchInfo = new SearchItemInfo(product.Name, product.Description, product.CreatedByUser, product.CreatedDate,
                                                                   modInfo.ModuleID, product.Id.ToString(), product.Description, "Id=" + product.Id);
                    searchItems.Add(searchInfo);
                }
            }

            return(searchItems);
        }
コード例 #16
0
        /// <summary>
        /// Implements the search interface required to allow DNN to index/search the content of your
        /// module
        /// </summary>
        /// <param name="modInfo"></param>
        /// <returns></returns>
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            SearchItemInfoCollection searchItems = new SearchItemInfoCollection();

            using (SelectedHotelsEntities db = new SelectedHotelsEntities())
            {
                IList <Hotel> hotels = (from p in db.Products
                                        where !p.IsDeleted
                                        select p).OfType <Hotel>().ToList();
                foreach (var hotel in hotels)
                {
                    SearchItemInfo searchInfo = new SearchItemInfo(hotel.Name, hotel.Description, hotel.CreatedByUser, hotel.CreatedDate,
                                                                   modInfo.ModuleID, hotel.Id.ToString(), hotel.Description, "Id=" + hotel.Id);
                    searchItems.Add(searchInfo);
                }
            }

            return(searchItems);
        }
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo ModInfo)
        {
            var            SearchItemCollection = new SearchItemInfoCollection();
            SearchItemInfo SearchItem           = null;
            string         summary = null;
            string         title   = null;
            var            cdc     = new ContentDejourController();

            var objContents = cdc.GetContents(ModInfo.ModuleID, MonthArray.Null, DayArray.Null, DayofWeekArray.Null, DateInteger.Null, Null.NullInteger, Null.NullInteger, Null.NullInteger, "", false);

            foreach (ContentDejourInfo objContent in objContents)
            {
                title      = HttpUtility.HtmlDecode(objContent.Title);
                summary    = Utilities.GetSummary(objContent.DesktopSummary, objContent.DesktopHTML);
                SearchItem = new SearchItemInfo(ModInfo.ModuleTitle + " - " + title, summary, objContent.CreatedByUserID, objContent.CreatedOnDate, ModInfo.ModuleID, objContent.KeyID.ToString(), HttpUtility.HtmlDecode(objContent.DesktopHTML), "KeyID=" + objContent.KeyID.ToString());
                SearchItemCollection.Add(SearchItem);
            }
            return(SearchItemCollection);
        }
コード例 #18
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();

            List <Classes> colSchoolGradess = new List <Classes>();

            foreach (Classes e in new ClassController().GetClasses())
            {
                colSchoolGradess.Add(e);
            }

            foreach (Classes objSchoolGrades in colSchoolGradess)
            {
                SearchItemInfo SearchItem2 = new SearchItemInfo(ModInfo.ModuleTitle, objSchoolGrades.SubjectId.ToString(), objSchoolGrades.StudentId, System.DateTime.Now, ModInfo.ModuleID, objSchoolGrades.StudentId.ToString(), "SubId=" + objSchoolGrades.SubjectId.ToString());
                SearchItemCollection.Add(SearchItem2);
            }

            return(SearchItemCollection);

            //	throw new System.NotImplementedException("The method or operation is not implemented.");
        }
コード例 #19
0
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();
            LocaleCollection         lCollection          = Localization.GetEnabledLocales();

            foreach (Locale localeInfo in lCollection)
            {
                effority.Ealo.StringInfo objText;
                effority.Ealo.StringInfo objSummary;
                objText    = effority.Ealo.Controller.GetStringByQualifierAndStringName(Consts.DesktopHTMLQualifier, ModInfo.ModuleID.ToString(), localeInfo.Code, true);
                objSummary = effority.Ealo.Controller.GetStringByQualifierAndStringName(Consts.DesktopSummaryQualifier, ModInfo.ModuleID.ToString(), localeInfo.Code, true);
                if (!objText.StringTextIsNull)
                {
                    string         strDesktopHtml = HttpUtility.HtmlDecode(objText.StringText);
                    string         strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(strDesktopHtml, false), MAX_DESCRIPTION_LENGTH, "...");
                    SearchItemInfo SearchItem     = new SearchItemInfo(ModInfo.ModuleTitle, localeInfo.Text + " - " + strDescription, -1, DateTime.Now, ModInfo.ModuleID, "", objSummary.StringText + " " + strDesktopHtml, "", Null.NullInteger);
                    SearchItemCollection.Add(SearchItem);
                }
            }
            return(SearchItemCollection);
        }
コード例 #20
0
ファイル: FeatureController.cs プロジェクト: valadas/DNN.XML
        ///<summary>
        ///  DotNetNuke Search support
        ///</summary>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var controller = new XmlBaseController(modInfo);

            var portalId        = modInfo.PortalID;
            var administratorId = new PortalController().GetPortal(portalId).AdministratorId;

            var searchItemCollection = new SearchItemInfoCollection();

            if (MustAddContentToSearch(modInfo))
            {
                var sw = new StringWriter();
                controller.Render(sw);
                sw.Flush();
                var content = sw.ToString();
                var now     = DateTime.Now;
                searchItemCollection.Add(new SearchItemInfo(modInfo.ModuleTitle, content, administratorId, now, modInfo.ModuleID, "", content));
                var mc = new ModuleController();
                mc.UpdateModuleSetting(modInfo.ModuleID, Setting.LastIndexRun, DateTime.Now.ToString("s"));
            }
            return(searchItemCollection);
        }
コード例 #21
0
        /*
         * /// <summary>
         * /// Delete a given item from the database by ID
         * /// </summary>
         * /// <param name='itemId'></param>
         * public void DeleteObserverOfScience (int itemId)
         * {
         *      using (var ctx = DataContext.Instance())
         *      {
         *              var repo = ctx.GetRepository<ObserverOfScienceInfo> ();
         *              repo.Delete ("WHERE ObserverOfScienceID = @0", itemId);
         *      }
         * }
         */

        #endregion

        #region ISearchable members

        /// <summary>
        /// Implements the search interface required to allow DNN to index/search the content of your
        /// module
        /// </summary>
        /// <param name="modInfo"></param>
        /// <returns></returns>
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var searchItems = new SearchItemInfoCollection();
            var infos       = GetList <ObserverOfScienceInfo> (modInfo.ModuleID);

            foreach (ObserverOfScienceInfo info in infos)
            {
                searchItems.Add(
                    new SearchItemInfo(
                        modInfo.ModuleTitle,
                        "",
                        info.CreatedByUser,
                        info.CreatedOnDate,
                        modInfo.ModuleID,
                        info.ObserverOfScienceID.ToString(),
                        //   info.Content,
                        "Item=" + info.ObserverOfScienceID.ToString())
                    );
            }

            return(searchItems);
        }
コード例 #22
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   Implements the search interface for DotNetNuke
        /// </summary>
        /// -----------------------------------------------------------------------------
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            var searchItemCollection = new SearchItemInfoCollection();
            var udtController        = new UserDefinedTableController(modInfo);

            try
            {
                var dsUserDefinedRows = udtController.GetDataSet(withPreRenderedValues: false);

                //Get names of ChangedBy and ChangedAt columns
                var colnameChangedBy = udtController.ColumnNameByDataType(dsUserDefinedRows,
                                                                          DataTypeNames.UDT_DataType_ChangedBy);
                var colnameChangedAt = udtController.ColumnNameByDataType(dsUserDefinedRows,
                                                                          DataTypeNames.UDT_DataType_ChangedAt);

                var moduleController = new ModuleController();
                var settings         = moduleController.GetModuleSettings(modInfo.ModuleID);
                var includeInSearch  = !(settings[SettingName.ExcludeFromSearch].AsBoolean());

                if (includeInSearch)
                {
                    foreach (DataRow row in dsUserDefinedRows.Tables[DataSetTableName.Data].Rows)
                    {
                        var changedDate     = DateTime.Today;
                        var changedByUserId = 0;

                        if (colnameChangedAt != string.Empty && !Information.IsDBNull(row[colnameChangedAt]))
                        {
                            changedDate = Convert.ToDateTime(row[colnameChangedAt]);
                        }
                        if (colnameChangedBy != string.Empty && !Information.IsDBNull(row[colnameChangedBy]))
                        {
                            changedByUserId = ModuleSecurity.UserId(row[colnameChangedBy].ToString(), modInfo.PortalID);
                        }

                        var desc = string.Empty;
                        foreach (DataRow col in dsUserDefinedRows.Tables[DataSetTableName.Fields].Rows)
                        {
                            var fieldType  = col[FieldsTableColumn.Type].ToString();
                            var fieldTitle = col[FieldsTableColumn.Title].ToString();
                            var visible    = Convert.ToBoolean(col[FieldsTableColumn.Visible]);
                            if (visible &&
                                (fieldType.StartsWith("Text") || fieldType == DataTypeNames.UDT_DataType_String))
                            {
                                desc += string.Format("{0} &bull; ", Convert.ToString(row[fieldTitle]));
                            }
                        }
                        if (desc.EndsWith("<br/>"))
                        {
                            desc = desc.Substring(0, Convert.ToInt32(desc.Length - 5));
                        }
                        var searchItem = new SearchItemInfo(modInfo.ModuleTitle, desc, changedByUserId, changedDate,
                                                            modInfo.ModuleID, row[DataTableColumn.RowId].ToString(),
                                                            desc);
                        searchItemCollection.Add(searchItem);
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
            }

            return(searchItemCollection);
        }
コード例 #23
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        {
            var items = new SearchItemInfoCollection();

            // Add the devices to the search index.
            foreach (var item in Factory.ActiveProvider.Devices)
            {
                string guid = String.Format("DeviceID={0}",
                    item.DeviceId);

                var device = new Device(item);

                items.Add(new SearchItemInfo(
                    device.HardwareCaption,
                    String.Format("{0} running {1} with browser {2}",
                        device.HardwareCaption,
                        device.SoftwareCaption,
                        device.BrowserCaption),
                    ModInfo.CreatedByUserID,
                    Factory.ActiveProvider.PublishedDate,
                    ModInfo.ModuleID,
                    device.DeviceID,
                    device.Content,
                    guid));
            }

            // Add the properties to the search.
            foreach (var property in Factory.ActiveProvider.Properties)
            {
                items.Add(new SearchItemInfo(
                    property.Name,
                    property.Description,
                    ModInfo.CreatedByUserID,
                    Factory.ActiveProvider.PublishedDate,
                    ModInfo.ModuleID,
                    property.Name,
                    property.Description));
                foreach (var value in property.Values)
                {
                    string name = String.Format("{0} - {1}", property.Name, value.Name);
                    items.Add(new SearchItemInfo(
                        name,
                        value.Description,
                        ModInfo.CreatedByUserID,
                        Factory.ActiveProvider.PublishedDate,
                        ModInfo.ModuleID,
                        name,
                        value.Description));
                }
            }

            return items;
        }
コード例 #24
0
        private static void SearchArticleIndex(DataTable dt, SearchItemInfoCollection items, ModuleInfo modInfo)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                DataRow row             = dt.Rows[i];
                var     searchedContent = new StringBuilder(8192);
                //article name
                string name = HtmlUtils.Clean(row["Name"].ToString().Trim(), false);

                if (Utility.HasValue(name))
                {
                    searchedContent.AppendFormat("{0}{1}", name, " ");
                }
                else
                {
                    //do we bother with the rest?
                    continue;
                }

                //article text
                string articleText = row["ArticleText"].ToString().Trim();
                if (Utility.HasValue(articleText))
                {
                    searchedContent.AppendFormat("{0}{1}", articleText, " ");
                }

                //article description
                string description = row["Description"].ToString().Trim();
                if (Utility.HasValue(description))
                {
                    searchedContent.AppendFormat("{0}{1}", description, " ");
                }

                //article metakeyword
                string keyword = row["MetaKeywords"].ToString().Trim();
                if (Utility.HasValue(keyword))
                {
                    searchedContent.AppendFormat("{0}{1}", keyword, " ");
                }

                //article metadescription
                string metaDescription = row["MetaDescription"].ToString().Trim();
                if (Utility.HasValue(metaDescription))
                {
                    searchedContent.AppendFormat("{0}{1}", metaDescription, " ");
                }

                //article metatitle
                string metaTitle = row["MetaTitle"].ToString().Trim();
                if (Utility.HasValue(metaTitle))
                {
                    searchedContent.AppendFormat("{0}{1}", metaTitle, " ");
                }

                string itemId = row["ItemId"].ToString();
                var    item   = new SearchItemInfo
                {
                    Title       = name,
                    Description = HtmlUtils.Clean(description, false),
                    Author      = Convert.ToInt32(row["AuthorUserId"], CultureInfo.InvariantCulture),
                    PubDate     = Convert.ToDateTime(row["LastUpdated"], CultureInfo.InvariantCulture),
                    ModuleId    = modInfo.ModuleID,
                    SearchKey   = "Article-" + itemId,
                    Content     =
                        HtmlUtils.StripWhiteSpace(
                            HtmlUtils.Clean(searchedContent.ToString(), false), true),
                    GUID = "itemid=" + itemId
                };

                items.Add(item);

                //Check if the Portal is setup to enable venexus indexing
                if (ModuleBase.AllowVenexusSearchForPortal(modInfo.PortalID))
                {
                    string indexUrl = Utility.GetItemLinkUrl(Convert.ToInt32(itemId, CultureInfo.InvariantCulture), modInfo.PortalID, modInfo.TabID, modInfo.ModuleID);

                    //UpdateVenexusBraindump(IDbTransaction trans, string indexTitle, string indexContent, string indexWashedContent)
                    Data.DataProvider.Instance().UpdateVenexusBraindump(Convert.ToInt32(itemId, CultureInfo.InvariantCulture), name, articleText, HtmlUtils.Clean(articleText, false), modInfo.PortalID, indexUrl);
                }
                //}
            }
        }
コード例 #25
0
ファイル: FeatureController.cs プロジェクト: hnjm/DNN.Wiki
        /// <summary>
        /// Gets the search items.
        /// </summary>
        /// <param name="modInfo">The module information.</param>
        /// <returns>Topics that meet the search criteria.</returns>
        public SearchItemInfoCollection GetSearchItems(ModuleInfo modInfo)
        {
            using (UnitOfWork uOw = new UnitOfWork())
            {
                TopicBO topicBo = new TopicBO(uOw);

                SearchItemInfoCollection searchItemCollection = new SearchItemInfoCollection();
                var            topics = topicBo.GetAllByModuleID(modInfo.ModuleID);
                UserController uc     = new UserController();

                foreach (var topic in topics)
                {
                    SearchItemInfo searchItem = new SearchItemInfo();

                    string strContent     = null;
                    string strDescription = null;
                    string strTitle       = null;
                    if (!string.IsNullOrWhiteSpace(topic.Title))
                    {
                        strTitle = topic.Title;
                    }
                    else
                    {
                        strTitle = topic.Name;
                    }

                    if (topic.Cache != null)
                    {
                        strContent  = topic.Cache;
                        strContent += " " + topic.Keywords;
                        strContent += " " + topic.Description;

                        strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(HttpUtility.HtmlDecode(topic.Cache), false), 100,
                                                           Localization.GetString("Dots", this.mSharedResourceFile));
                    }
                    else
                    {
                        strContent  = topic.Content;
                        strContent += " " + topic.Keywords;
                        strContent += " " + topic.Description;

                        strDescription = HtmlUtils.Shorten(HtmlUtils.Clean(HttpUtility.HtmlDecode(topic.Content), false), 100,
                                                           Localization.GetString("Dots", this.mSharedResourceFile));
                    }

                    int userID = 0;

                    userID = Null.NullInteger;
                    if (topic.UpdatedByUserID != -9999)
                    {
                        userID = topic.UpdatedByUserID;
                    }

                    searchItem = new SearchItemInfo(strTitle, strDescription, userID, topic.UpdateDate, modInfo.ModuleID, topic.Name, strContent, "topic=" + WikiMarkup.EncodeTitle(topic.Name));

                    //// New SearchItemInfo(ModInfo.ModuleTitle & "-" & strTitle, strDescription,
                    //// userID, topic.UpdateDate, ModInfo.ModuleID, topic.Name, strContent, _
                    //// "topic=" & WikiMarkup.EncodeTitle(topic.Name))

                    searchItemCollection.Add(searchItem);
                }

                return(searchItemCollection);
            }
        }