Пример #1
0
        protected void InitControls()
        {
            var searchHandler = (BaseSearchHandlerEx)(SearchHandlerManager.GetHandlersExForProduct(ProductEntryPoint.ID)).Find(sh => sh is SearchHandler);

            if (searchHandler != null)
            {
                searchHandler.AbsoluteSearchURL = VirtualPathUtility.ToAbsolute(PathProvider.BaseVirtualPath + "/search.aspx");
            }

            RenderHeader();

            var bottomNavigator = new BottomNavigator();

            _bottomNavigatorPlaceHolder.Controls.Add(bottomNavigator);
        }
Пример #2
0
        protected void InitControls()
        {
            var searchHandler = (BaseSearchHandlerEx)(SearchHandlerManager.GetHandlersExForProduct(ProductEntryPoint.ID)).Find(sh => sh is SearchHandler);

            if (String.IsNullOrEmpty(Request[UrlConstant.ProjectID]))
            {
                searchHandler.AbsoluteSearchURL = (VirtualPathUtility.ToAbsolute(PathProvider.BaseVirtualPath + "/search.aspx"));
            }
            else
            {
                searchHandler.AbsoluteSearchURL = (VirtualPathUtility.ToAbsolute(PathProvider.BaseVirtualPath + "/search.aspx") + "?prjID=" + Request[UrlConstant.ProjectID]);
            }

            _aboutContainer.ImageURL     = WebImageSupplier.GetAbsoluteWebPath("navigation.png");
            _aboutContainer.Title        = ProjectsCommonResource.About;
            _aboutContainer.BodyCSSClass = "studioSideBoxBodyAbout";
            _aboutContainer.Visible      = false;

            RenderHeader();

            var bottomNavigator = new BottomNavigator();

            _bottomNavigatorPlaceHolder.Controls.Add(bottomNavigator);

            var onlineUsersControl = (OnlineUsers)LoadControl(OnlineUsers.Location);

            onlineUsersControl.ProductId = ProductEntryPoint.ID;
            phOnlineUsers.Controls.Add(onlineUsersControl);


            if (Page.GetType() == typeof(Dashboard) && HaveProjects())
            {
                _commonContainer.Visible = false;
            }

            //RSS
            //all interested projects
            //
            InterestedProjectsFeedControl.ContainerId = GetUserInterestedProjects();
            if (RequestContext.IsInConcreteProject())
            {
                //this project feed
                //
                ConcreteProjectFeedControl.Visible     = true;
                ConcreteProjectFeedControl.ContainerId = RequestContext.GetCurrentProjectId().ToString();
                ConcreteProjectFeedControl.Title       = RequestContext.GetCurrentProject().HtmlTitle.HtmlEncode();
            }
        }
        private void RegisterSearchHandlers(bool fullSearch)
        {
            #region search scripts
            StringBuilder sb = new StringBuilder();

            string searchText    = Page.Request["search"];
            var    activeHandler = SearchHandlerManager.GetActiveHandlerEx();

            var allHandlers = SearchHandlerManager.GetHandlersExForProduct(_currentProductID);

            if (_currentProductID.Equals(Guid.Empty) || !allHandlers.Exists(sh => !sh.ProductID.Equals(Guid.Empty)))
            {
                if (!fullSearch)
                {
                    allHandlers.RemoveAll(sh => sh is StudioSearchHandler);
                }
                else
                {
                    allHandlers.RemoveAll(sh => !(sh is StudioSearchHandler));
                }

                _singleSearch = true;
            }

            if (SingleSearchHandlerType != null)
            {
                allHandlers.RemoveAll(sh => !sh.GetType().Equals(SingleSearchHandlerType));
                _singleSearch = true;
            }


            bool isFirst = true;
            foreach (var sh in allHandlers)
            {
                if (sh == null)
                {
                    continue;
                }

                var module = WebItemManager.Instance[sh.ModuleID];
                if (module != null && module.IsDisabled())
                {
                    continue;
                }

                var shi = new SearchHandlerItem()
                {
                    Handler = sh,
                    LogoURL = (sh.Logo != null) ? WebImageSupplier.GetAbsoluteWebPath(sh.Logo.ImageFileName, sh.Logo.PartID) : "",
                    Active  = String.IsNullOrEmpty(searchText) ? (sh.GetType().Equals(typeof(StudioSearchHandler)) || _singleSearch) :
                              (sh.Equals(activeHandler) || (activeHandler == null && isFirst))
                };

                _handlerItems.Add(shi);



                string absoluteSearchURL = sh.AbsoluteSearchURL;

                if (sh.ProductID.Equals(Guid.Empty) && !this._currentProductID.Equals(Guid.Empty))
                {
                    absoluteSearchURL = absoluteSearchURL + (absoluteSearchURL.IndexOf("?") != -1 ? "&" : "?") + CommonLinkUtility.GetProductParamsPair(this._currentProductID);
                }


                sb.Append(" Searcher.AddHandler(new SearchHandler('" + shi.ID + "','" + sh.SearchName.Replace("'", "\\'") + "','" + shi.LogoURL + "'," + (shi.Active ? "true" : "false") + ",'" + absoluteSearchURL + "')); ");

                isFirst = false;
            }


            _handlerItems.Sort((h1, h2) =>
            {
                return(h1.CompareTo(h2));
            });


            //script
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "topnavpanel_init_script", sb.ToString(), true);
            #endregion
        }