public string GetAllData(string product, string text) { if (string.IsNullOrEmpty(text)) { return(string.Empty); } var productID = new Guid(product); var handlers = SearchHandlerManager.GetHandlersExForProductModule(productID, Guid.Empty); var searchResultsData = GetSearchresultByHandlers(handlers, text); searchResultsData = GroupSearchresult(productID, searchResultsData); if (searchResultsData.Count <= 0) { return(string.Empty); } var control = searchResultsData[0].PresentationControl ?? new CommonResultsView(); control.Items = new List <SearchResultItem>(); foreach (var searchResult in searchResultsData) { control.Items.AddRange(searchResult.Items); } control.MaxCount = int.MaxValue; control.Text = control.Text ?? text; var stringWriter = new StringWriter(); var htmlWriter = new HtmlTextWriter(stringWriter); control.RenderControl(htmlWriter); return(stringWriter.ToString()); }
public static void Configure() { DbRegistry.Configure(); PrepareRedisSessionProvider(); if (HttpContext.Current != null && HttpContext.Current.Request != null) { var url = HttpContext.Current.Request.GetUrlRewriter(); CommonLinkUtility.Initialize(new UriBuilder(url.Scheme, url.Host, url.Port).Uri.ToString()); } ConfigureWebApi(); if (DBResourceManager.ResourcesFromDataBase) { DBResourceManager.WhiteLableEnabled = true; DBResourceManager.PatchAssemblies(); } AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions; AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainOnAssemblyResolve; //try //{ // AmiPublicDnsSyncService.Synchronize(); //} //catch { } NotifyConfiguration.Configure(); WebItemManager.Instance.LoadItems(); SearchHandlerManager.Registry(new StudioSearchHandler()); StorageFactory.InitializeHttpHandlers(); BundleConfig.Configure(); WhiteLabelHelper.ApplyPartnerWhiteLableSettings(); LdapNotifyHelper.RegisterAll(); try { new S3UploadGuard().DeleteExpiredUploadsAsync(TimeSpan.FromDays(1));//todo: } catch (Exception) { } try { Core.WarmUp.Instance.Start(); } catch (Exception ex) { LogManager.GetLogger("ASC").Error("Start Warmup", ex); } }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", DefaultSortOrder = 30, SubscriptionManager = new ProductSubscriptionManager(), SpaceUsageStatManager = new CRMSpaceUsageStatManager(), AdminOpportunities = () => CRMCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => CRMCommonResource.ProductUserOpportunities.Split('|').ToList(), }; if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common")) { FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider()); } if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "opportunity")) { FilesIntegration.RegisterFileSecurityProvider("crm", "opportunity", new FileSecurityProvider()); } SearchHandlerManager.Registry(new SearchHandler()); }
protected void Page_Load(object sender, EventArgs e) { AjaxPro.Utility.RegisterTypeForAjax(GetType()); Master.DisabledSidePanel = true; Title = HeaderStringHelper.GetPageTitle(Resource.Search); var productID = !String.IsNullOrEmpty(Request["productID"]) ? new Guid(Request["productID"]) : Guid.Empty; var moduleID = !String.IsNullOrEmpty(Request["moduleID"]) ? new Guid(Request["moduleID"]) : Guid.Empty; SearchText = Request["search"] ?? ""; var searchResultsData = new List <SearchResult>(); if (!string.IsNullOrEmpty(SearchText)) { List <ISearchHandlerEx> handlers = null; var products = !String.IsNullOrEmpty(Request["products"]) ? Request["products"] : string.Empty; if (!string.IsNullOrEmpty(products)) { try { var productsStr = products.Split(new[] { ',' }); var productsGuid = productsStr.Select(p => new Guid(p)).ToArray(); handlers = SearchHandlerManager.GetHandlersExForProductModule(productsGuid); } catch { } } if (handlers == null) { handlers = SearchHandlerManager.GetHandlersExForProductModule(productID, moduleID); } searchResultsData = GetSearchresultByHandlers(handlers, SearchText); } if (searchResultsData.Count <= 0) { var emptyScreenControl = new EmptyScreenControl { ImgSrc = WebImageSupplier.GetAbsoluteWebPath("empty_search.png"), Header = Resource.SearchNotFoundMessage, Describe = Resource.SearchNotFoundDescript }; SearchContent.Controls.Add(emptyScreenControl); } else { searchResultsData = GroupSearchresult(productID, searchResultsData); var oSearchView = (SearchResults)LoadControl(SearchResults.Location); oSearchView.SearchResultsData = searchResultsData; SearchContent.Controls.Add(oSearchView); } }
public static void Configure(HttpApplication application) { XmlConfigurator.Configure(); DbRegistry.Configure(); ConfigureWebApi(); if (ConfigurationManager.AppSettings["resources.from-db"] == "true") { AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies()); AppDomain.CurrentDomain.AssemblyLoad += (sender, args) => AssemblyWork.UploadResourceData(AppDomain.CurrentDomain.GetAssemblies()); } AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions; try { AmiPublicDnsSyncService.Synchronize(); } catch { } NotifyConfiguration.Configure(); WebItemManager.Instance.LoadItems(); SearchHandlerManager.Registry(new StudioSearchHandler()); StorageFactory.InitializeHttpHandlers(); (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1)); BundleConfig.Configure(); }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", DefaultSortOrder = 30, SubscriptionManager = new ProductSubscriptionManager(), SpaceUsageStatManager = new CRMSpaceUsageStatManager(), AdminOpportunities = () => CRMCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => CRMCommonResource.ProductUserOpportunities.Split('|').ToList(), }; if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common")) { FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider()); } if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "opportunity")) { FilesIntegration.RegisterFileSecurityProvider("crm", "opportunity", new FileSecurityProvider()); } SearchHandlerManager.Registry(new SearchHandler()); GlobalConfiguration.Configuration.Routes.MapHttpRoute( name: "Twilio", routeTemplate: "twilio/{action}", defaults: new { controller = "Twilio", action = "index" }); ClientScriptLocalization = new ClientLocalizationResources(); DIHelper.Register(); }
public bool RegistryItem(IWebItem webitem) { lock (items) { if (webitem != null && this[webitem.ID] == null) { if (webitem is IAddon) { ((IAddon)webitem).Init(); } if (webitem is IProduct) { ((IProduct)webitem).Init(); } if (webitem is IModule) { var module = (IModule)webitem; if (module.Context != null && module.Context.SearchHandler != null) { SearchHandlerManager.Registry(module.Context.SearchHandler); } } items.Add(webitem.ID, webitem); return(true); } return(false); } }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.svg", SubscriptionManager = new ProductSubscriptionManager(), DefaultSortOrder = 20, SpaceUsageStatManager = new ProjectsSpaceUsageStatManager(), AdminOpportunities = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(), HasComplexHierarchyOfAccessRights = true, }; FileEngine.RegisterFileSecurityProvider(); SearchHandlerManager.Registry(new SearchHandler()); NotifyClient.RegisterSecurityInterceptor(); ClientScriptLocalization = new ClientLocalizationResources(); DIHelper.Register(); Mapper.Initialize(cfg => { cfg.CreateMap <Task, TasksWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); cfg.CreateMap <Message, DiscussionsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); cfg.CreateMap <Milestone, MilestonesWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); cfg.CreateMap <Project, ProjectsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); cfg.CreateMap <Subtask, SubtasksWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); cfg.CreateMap <Comment, CommentsWrapper>().ForMember(r => r.TenantId, opt => opt.MapFrom(r => GetCurrentTenant())); }); }
public override void Init() { Global.Init(); Func <List <string> > adminOpportunities = () => (CoreContext.Configuration.CustomMode ? CustomModeResource.ProductAdminOpportunitiesCustomMode : FilesCommonResource.ProductAdminOpportunities).Split('|').ToList(); Func <List <string> > userOpportunities = () => (CoreContext.Configuration.CustomMode ? CustomModeResource.ProductUserOpportunitiesCustomMode : FilesCommonResource.ProductUserOpportunities).Split('|').ToList(); _productContext = new ProductContext { MasterPageFile = FilesLinkUtility.FilesBaseVirtualPath + "Masters/BasicTemplate.master", DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.svg", DefaultSortOrder = 10, SubscriptionManager = new SubscriptionManager(), SpaceUsageStatManager = new FilesSpaceUsageStatManager(), AdminOpportunities = adminOpportunities, UserOpportunities = userOpportunities, CanNotBeDisabled = true, }; SearchHandlerManager.Registry(new SearchHandler()); GlobalConfiguration.Configuration.Routes.MapHttpRoute( name: "FileStorageService", routeTemplate: "products/files/services/wcfservice/service.svc/{action}", defaults: new { controller = "FileStorageService" }); GlobalConfiguration.Configuration.Formatters.JsonFormatter.UseDataContractJsonSerializer = true; }
public override void Init(ProductContext productContext) { productContext.ThemesFolderVirtualPath = String.Concat(PathProvider.BaseVirtualPath, "App_Themes"); productContext.ImageFolder = "images"; productContext.MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"); productContext.DisabledIconFileName = "product_disabled_logo.png"; productContext.IconFileName = "product_logo.png"; productContext.LargeIconFileName = "product_logolarge.png"; productContext.UserActivityPublishers = new List <IUserActivityPublisher>() { new TimeLinePublisher() }; productContext.DefaultSortOrder = 20; productContext.SubscriptionManager = new ProductSubscriptionManager(); productContext.SpaceUsageStatManager = new CRMSpaceUsageStatManager(); productContext.AdminOpportunities = GetAdminOpportunities; productContext.UserOpportunities = GetUserOpportunities; if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common")) { FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider()); } _productContext = productContext; SearchHandlerManager.Registry(new SearchHandler()); }
protected void RenderSearchProducts() { var handlers = SearchHandlerManager.GetAllHandlersEx(); SearchProducts = handlers .Select(sh => sh.ProductID) .Distinct() .Select(productID => WebItemManager.Instance[productID]) .Where(product => product != null && !product.IsDisabled()); }
protected void Application_Start(object sender, EventArgs e) { XmlConfigurator.Configure(); DbRegistry.Configure(); InitializeDbResources(); AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions; NotifyConfiguration.Configure(); WebItemManager.Instance.LoadItems(); SearchHandlerManager.Registry(new StudioSearchHandler()); SearchHandlerManager.Registry(new EmployeeSearchHendler()); }
public override void Init() { _context = new ProductContext { MasterPageFile = "~/products/people/PeopleBaseTemplate.Master", DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", DefaultSortOrder = 50, }; SearchHandlerManager.Registry(new SearchHandler()); }
private void RegisterProduct(IProduct product, Assembly assembly) { try { var productContext = new ProductContext { AssemblyName = assembly.FullName }; product.Init(productContext); ProductContexts.Add(product.ID, productContext); WebItemManager.Instance.RegistryItem(product); if (productContext.GlobalHandler != null) { GlobalHandlers.Add(productContext.GlobalHandler); } foreach (var module in product.Modules) { try { if (module.Context != null && module.Context.UserActivityPublishers != null) { module.Context.UserActivityPublishers.ForEach(p => p.DoUserActivity += DoUserActivityHandler); } if (module.Context != null && module.Context.SearchHandler != null) { SearchHandlerManager.Registry(module.Context.SearchHandler); } } catch (Exception exc) { log.Error(string.Format("Couldn't load module activity publisher {0}", module.Name), exc); } } if (product.Context.UserActivityPublishers != null) { product.Context.UserActivityPublishers.ForEach(p => p.DoUserActivity += DoUserActivityHandler); } Products.Add(product); Products.Sort((p1, p2) => p1.Context.DefaultSortOrder.CompareTo(p2.Context.DefaultSortOrder)); log.DebugFormat("product {0} loaded", product.Name); } catch (Exception exc) { log.Error(string.Format("Couldn't load product {0}", product.Name), exc); } }
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); }
public override void Init() { _context = new ProductContext { MasterPageFile = "~/products/people/PeopleBaseTemplate.Master", DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", DefaultSortOrder = 50, AdminOpportunities = () => PeopleResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => PeopleResource.ProductUserOpportunities.Split('|').ToList() }; SearchHandlerManager.Registry(new SearchHandler()); }
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 Application_StartDelayed(object sender, EventArgs e) { XmlConfigurator.Configure(); DbRegistry.Configure(); InitializeDbResources(); AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions; try { AmiPublicDnsSyncService.Synchronize(); } catch { } NotifyConfiguration.Configure(); WebItemManager.Instance.LoadItems(); SearchHandlerManager.Registry(new StudioSearchHandler()); (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1)); BundleConfig.Configure(); }
private List <SearchResult> SearchByModules(Guid productID, string _searchText) { var searchResults = new List <SearchResult>(); if (String.IsNullOrEmpty(_searchText)) { return(searchResults); } var handlers = productID.Equals(Guid.Empty) ? SearchHandlerManager.GetAllHandlersEx() : SearchHandlerManager.GetHandlersExForCertainProduct(productID); foreach (var sh in handlers) { var module = WebItemManager.Instance[sh.ModuleID]; if (module != null && module.IsDisabled()) { continue; } var items = sh.Search(_searchText); if (items.Length == 0) { continue; } var searchResult = new SearchResult { ModuleID = sh.ModuleID, ProductID = sh.ProductID, PresentationControl = (ItemSearchControl)sh.Control }; BuildName(searchResult, sh, module); BuildLogo(searchResult, sh, module); BuildMoreUrl(searchResult, sh, ref productID); searchResult.PresentationControl.Text = _searchText; searchResult.PresentationControl.MaxCount = 7; searchResult.Items.AddRange(items); searchResults.Add(searchResult); } return(searchResults); }
public static void Configure() { XmlConfigurator.Configure(); DbRegistry.Configure(); PrepareRedisSessionProvider(); if (HttpContext.Current != null && HttpContext.Current.Request != null) { var url = HttpContext.Current.Request.GetUrlRewriter(); CommonLinkUtility.Initialize(new UriBuilder(url.Scheme, url.Host, url.Port).Uri.ToString()); } ConfigureWebApi(); if (ConfigurationManager.AppSettings["resources.from-db"] == "true") { DBResourceManager.PatchAssemblies(); } AjaxSecurityChecker.Instance.CheckMethodPermissions += AjaxCheckMethodPermissions; try { AmiPublicDnsSyncService.Synchronize(); } catch { } NotifyConfiguration.Configure(); WebItemManager.Instance.LoadItems(); SearchHandlerManager.Registry(new StudioSearchHandler()); StorageFactory.InitializeHttpHandlers(); (new S3UploadGuard()).DeleteExpiredUploads(TimeSpan.FromDays(1)); BundleConfig.Configure(); if (CoreContext.Configuration.Standalone) { WarmUp.Instance.Start(); } }
public override void Init() { _productContext = new ProductContext { MasterPageFile = CommonLinkUtility.FilesBaseVirtualPath + "masters/basictemplate.master", DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", DefaultSortOrder = 10, SubscriptionManager = new SubscriptionManager(), SpaceUsageStatManager = new FilesSpaceUsageStatManager(), AdminOpportunities = () => FilesCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => FilesCommonResource.ProductUserOpportunities.Split('|').ToList(), CanNotBeDisabled = true, }; SearchHandlerManager.Registry(new SearchHandler()); }
public override void Init(ProductContext productContext) { if (!DbRegistry.IsDatabaseRegistered(Global.DB_ID)) { DbRegistry.RegisterDatabase(Global.DB_ID, WebConfigurationManager.ConnectionStrings[Global.DB_ID]); } new SearchHandler(); ConfigurationManager.Configure(ID, PathProvider.BaseVirtualPath, String.Empty, Global.FileStorageModule); productContext.ThemesFolderVirtualPath = String.Concat(PathProvider.BaseVirtualPath, "App_Themes"); productContext.ImageFolder = "images"; productContext.MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"); productContext.DisabledIconFileName = "product_disabled_logo.png"; productContext.IconFileName = "product_logo.png"; productContext.LargeIconFileName = "product_logolarge.png"; productContext.SubscriptionManager = new ProductSubscriptionManager(); productContext.UserActivityControlLoader = new ProjectActivity(); productContext.WhatsNewHandler = new WhatsNewHandler(); productContext.UserActivityPublishers = new List <IUserActivityPublisher>() { new TimeLinePublisher() }; productContext.DefaultSortOrder = 10; productContext.SpaceUsageStatManager = new ProjectsSpaceUsageStatManager(); productContext.AdminOpportunities = GetAdminOpportunities; productContext.UserOpportunities = GetUserOpportunities; productContext.HasComplexHierarchyOfAccessRights = true; context = productContext; NotifyClient.Instance.Client.RegisterSendMethod(SendMsgMilestoneDeadline, TimeSpan.FromDays(1), DateTime.UtcNow.Date.AddHours(7)); NotifyClient.Instance.Client.RegisterSendMethod(ReportHelper.SendAutoReports, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour)); NotifyClient.Instance.Client.RegisterSendMethod(TaskHelper.SendAutoReminderAboutTask, TimeSpan.FromHours(1), DateTime.UtcNow.Date.AddHours(DateTime.UtcNow.Hour)); NotifyClient.Instance.Client.AddInterceptor(InterceptorSecurity); UserActivityManager.AddFilter(new WhatsNewHandler()); FilesIntegration.RegisterFileSecurityProvider("projects", "project", new SecurityAdapterProvider()); SearchHandlerManager.Registry(new SearchHandler()); }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_logo_disabled.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logo_large.svg", DefaultSortOrder = 100, SubscriptionManager = null, SpaceUsageStatManager = null, AdminOpportunities = () => SampleResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => SampleResource.ProductUserOpportunities.Split('|').ToList(), }; SearchHandlerManager.Registry(new SampleSearchHandler()); ClientScriptLocalization = new ClientLocalizationResources(); }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", SubscriptionManager = new ProductSubscriptionManager(), DefaultSortOrder = 20, SpaceUsageStatManager = new ProjectsSpaceUsageStatManager(), AdminOpportunities = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(), HasComplexHierarchyOfAccessRights = true, }; FileEngine.RegisterFileSecurityProvider(); SearchHandlerManager.Registry(new SearchHandler()); NotifyClient.RegisterSecurityInterceptor(); ClientScriptLocalization = new ClientLocalizationResources(); DIHelper.Register(); }
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 }
public override void Init() { context = new ProductContext { MasterPageFile = String.Concat(PathProvider.BaseVirtualPath, "Masters/BasicTemplate.Master"), DisabledIconFileName = "product_disabled_logo.png", IconFileName = "product_logo.png", LargeIconFileName = "product_logolarge.png", SubscriptionManager = new ProductSubscriptionManager(), DefaultSortOrder = 20, SpaceUsageStatManager = new ProjectsSpaceUsageStatManager(), AdminOpportunities = () => ProjectsCommonResource.ProductAdminOpportunities.Split('|').ToList(), UserOpportunities = () => ProjectsCommonResource.ProductUserOpportunities.Split('|').ToList(), HasComplexHierarchyOfAccessRights = true, }; FileEngine.RegisterFileSecurityProvider(); SearchHandlerManager.Registry(new SearchHandler()); var securityInterceptor = new SendInterceptorSkeleton( "ProjectInterceptorSecurity", InterceptorPlace.DirectSend, InterceptorLifetime.Global, (r, p) => { try { var data = r.ObjectID.Split('_'); var entityType = data[0]; var entityId = Convert.ToInt32(data[1]); var projectId = 0; if (data.Length == 3) { projectId = Convert.ToInt32(r.ObjectID.Split('_')[2]); } switch (entityType) { case "Task": var task = Global.EngineFactory.TaskEngine.GetByID(entityId, false); if (task == null && projectId != 0) { var project = Global.EngineFactory.ProjectEngine.GetByID(projectId, false); return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID))); } return(!ProjectSecurity.CanRead(task, new Guid(r.Recipient.ID))); case "Message": var discussion = Global.EngineFactory.MessageEngine.GetByID(entityId, false); if (discussion == null && projectId != 0) { var project = Global.EngineFactory.ProjectEngine.GetByID(projectId, false); return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID))); } return(!ProjectSecurity.CanRead(discussion, new Guid(r.Recipient.ID))); case "Milestone": var milestone = Global.EngineFactory.MilestoneEngine.GetByID(entityId, false); if (milestone == null && projectId != 0) { var project = Global.EngineFactory.ProjectEngine.GetByID(projectId, false); return(!ProjectSecurity.CanRead(project, new Guid(r.Recipient.ID))); } return(!ProjectSecurity.CanRead(milestone, new Guid(r.Recipient.ID))); } } catch (Exception ex) { LogManager.GetLogger("ASC.Projects.Tasks").Error("Send", ex); } return(false); }); NotifyClient.Instance.Client.AddInterceptor(securityInterceptor); }