public TaxonomyNavigationProvider(
     IContentManager contentManager,
     ITaxonomyService taxonomyService)
 {
     _contentManager = contentManager;
     _taxonomyService = taxonomyService;
 }
示例#2
0
        public TermPartHandler(
            IRepository<TermPartRecord> repository, 
            ITaxonomyService taxonomyService,
            ITermPathConstraint termPathConstraint ) {
            Filters.Add(StorageFilter.For(repository));

            OnRemoved<IContent>(
                (context, tags) =>
                    taxonomyService.DeleteAssociatedTerms(context.ContentItem)
                );

            OnInitializing<TermPart>(
                (context, part) => 
                    part.Selectable = true
                );

            OnPublished<TermPart>(
                (context, part) => {
                    termPathConstraint.AddPath(part.Slug);
                    foreach (var child in taxonomyService.GetChildren(part)) {
                        termPathConstraint.AddPath(child.Slug);
                    }
                });

            OnUnpublishing<TermPart>(
                (context, part) =>
                    termPathConstraint.RemovePath(part.Slug)
                );
        }
示例#3
0
        public TermsPartHandler(
            IContentDefinitionManager contentDefinitionManager,
            IRepository<TermsPartRecord> repository,
            ITaxonomyService taxonomyService,
            IContentManager contentManager) {
            _contentDefinitionManager = contentDefinitionManager;
            _contentManager = contentManager;

            Filters.Add(StorageFilter.For(repository));

            OnPublished<TermsPart>((context, part) => RecalculateCount(contentManager, taxonomyService, part));
            OnUnpublished<TermsPart>((context, part) => RecalculateCount(contentManager, taxonomyService, part));
            OnRemoved<TermsPart>((context, part) => RecalculateCount(contentManager, taxonomyService, part));
            
            // tells how to load the field terms on demand
            OnLoaded<TermsPart>((context, part) => {
                foreach(var field in part.ContentItem.Parts.SelectMany(p => p.Fields).OfType<TaxonomyField>()) {
                    var tempField = field.Name;
                    var fieldTermRecordIds = part.Record.Terms.Where(t => t.Field == tempField).Select(tci => tci.TermRecord.Id);
                    field.Terms.Loader(value => fieldTermRecordIds.Select(id => _contentManager.Get<TermPart>(id)));
                }
            });

            OnIndexing<TermsPart>(
                (context, part) => {
                    foreach (var term in part.Terms) {
                        var value = context.ContentManager.Get(term.TermRecord.Id).As<TitlePart>().Title;
                        context.DocumentIndex.Add(term.Field, value).Analyze();
                        context.DocumentIndex.Add(term.Field + "-id", term.Id).Store();
                    }
                });
        }
示例#4
0
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     ITaxonomyService taxonomyService) {
     _taxonomyService = taxonomyService;
     Shape = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public CodeSamplesFilterController(ICommonDataService commonDataService, ITaxonomyService taxonomyService, IContentManager contentManager)
 {
     _commonDataService = commonDataService;
     _taxonomyService = taxonomyService;
     _contentManager = contentManager;
     Logger = NullLogger.Instance;
 }
 public TaxonomyImportService(ISiteService siteService, IContentManager contentManager, ITaxonomyService taxonomyService, IMembershipService membershipService)
 {
     _siteService = siteService;
     _contentManager = contentManager;
     _taxonomyService = taxonomyService;
     _membershipService = membershipService;
 }
        public TermsPartHandler(
            IContentDefinitionManager contentDefinitionManager,
            IRepository<TermsPartRecord> repository,
            ITaxonomyService taxonomyService,
            IContentManager contentManager,
            IProcessingEngine processingEngine,
            ShellSettings shellSettings,
            IShellDescriptorManager shellDescriptorManager) {
            _contentDefinitionManager = contentDefinitionManager;
            _contentManager = contentManager;

            Filters.Add(StorageFilter.For(repository));
            OnPublished<TermsPart>((context, part) => RecalculateCount(processingEngine, shellSettings, shellDescriptorManager, part));
            OnUnpublished<TermsPart>((context, part) => RecalculateCount(processingEngine, shellSettings, shellDescriptorManager, part));
            OnRemoved<TermsPart>((context, part) => RecalculateCount(processingEngine, shellSettings, shellDescriptorManager, part));

            // Tells how to load the field terms on demand, when a content item it loaded or when it has been created
            OnInitialized<TermsPart>((context, part) => InitializerTermsLoader(part));
            OnLoading<TermsPart>((context, part) => InitializerTermsLoader(part));
            OnUpdating<TermsPart>((context, part) => InitializerTermsLoader(part));

            OnIndexing<TermsPart>(
                (context, part) => {

                    foreach (var term in part.Terms) {
                        var termContentItem = context.ContentManager.Get(term.TermRecord.Id);
                        context.DocumentIndex.Add(term.Field, termContentItem.As<TitlePart>().Title).Analyze();
                        context.DocumentIndex.Add(term.Field + "-id", termContentItem.Id).Store();
                        // tag the current content item with all parent terms
                        foreach (var parent in taxonomyService.GetParents(termContentItem.As<TermPart>())) {
                            context.DocumentIndex.Add(term.Field + "-id", parent.Id).Store();
                        }
                    }
                });
        }
 public SameTermsFilter(ITaxonomyService taxonomyService,
     IWorkContextAccessor workContextAccessor)
 {
     _taxonomyService = taxonomyService;
     _workContextAccessor = workContextAccessor;
     T = NullLocalizer.Instance;
 }
示例#9
0
 public TermFeedQuery(
     IContentManager contentManager,
     ITaxonomyService taxonomyService)
 {
     _contentManager = contentManager;
     _taxonomyService = taxonomyService;
 }
示例#10
0
 public TorrentService(IImageService imageService,
                       IDocumentService documentService,
                       ITaxonomyService taxonomyService)
 {
     _imageService    = imageService;
     _documentService = documentService;
     _taxonomyService = taxonomyService;
 }
 /// <summary>
 /// Constructor to inject the view model dependencies
 /// </summary>
 /// <param name="wallPostRepository">Wall post data access</param>
 /// <param name="wallReplyRepository">Wall reply data access</param>
 /// <param name="taxonomyService">Taxonomy service</param>
 /// <param name="resourceLocator">Resource utility</param>
 /// <param name="log">Logging utility</param>
 public WallViewModel(IWallPostRepository wallPostRepository, IWallReplyRepository wallReplyRepository, ITaxonomyService taxonomyService, IResourceLocator resourceLocator, ILogger log)
 {
     this._wallPostRepository = wallPostRepository;
     this._wallReplyRepository = wallReplyRepository;
     this._taxonomyService = taxonomyService;
     this._resourceLocator = resourceLocator;
     this._log = log;
 }
        public DefaultTaxonomyUpdater(ITaxonomyService taxonomyService,
            ITaxonomyImportService taxonomyImportService)
        {
            _taxonomyService = taxonomyService;
            _taxonomyImportService = taxonomyImportService;

            Logger = NullLogger.Instance;
        }
示例#13
0
 public PostsController(IPostService postService, ITaxonomyService taxonomyService)
 {
     _postService     = postService;
     _taxonomyService = taxonomyService;
     pageSize         = 0;
     recordsPerPage   = 5;
     TotalItemCount   = 0;
 }
示例#14
0
 public GalleryFeatureHandler(ITaxonomyService taxonomyService, IOrchardServices services, IContentDefinitionManager contentDefinitionManager,
     IMembershipService membershipService, IUserkeyService userkeyService) {
     _taxonomyService = taxonomyService;
     _userkeyService = userkeyService;
     _membershipService = membershipService;
     _services = services;
     _contentDefinitionManager = contentDefinitionManager;
 }
 public TermRuleProvider(
     IWorkContextAccessor workContextAccessor,
     ITaxonomyService taxonomyService
 )
 {
     _workContextAccessor = workContextAccessor;
     _taxonomyService = taxonomyService;
 }
 public TermsFilterForms(
     IShapeFactory shapeFactory,
     ITaxonomyService taxonomyService)
 {
     _taxonomyService = taxonomyService;
     Shape            = shapeFactory;
     T = NullLocalizer.Instance;
 }
 public static async Task <TermModel> GetTermModelForTermInfoAsync <TContext>(
     this SpClientContext <TContext> clientContext,
     ITaxonomyService taxonomyService,
     TermInfo termInfo) where TContext : SpClientContext <TContext> =>
 termInfo != null ? await taxonomyService.GetTermAsync(
     clientContext.ClientContext,
     termInfo.TermSetId,
     termInfo.TermGuid) : null;
示例#18
0
 public AdminController(
     IOrchardServices services,
     ITaxonomyService taxonomyService)
 {
     Services         = services;
     _taxonomyService = taxonomyService;
     T = NullLocalizer.Instance;
 }
 public OEmbedController(
     ITaxonomyService taxonomyService, 
     IMediaLibraryService mediaManagerService, 
     IOrchardServices services) {
     _taxonomyService = taxonomyService;
     _mediaLibraryService = mediaManagerService;
     Services = services;
 }
示例#20
0
 public TaxonomyImportService(ISiteService siteService, IContentManager contentManager,
                              ITaxonomyService taxonomyService, IMembershipService membershipService)
 {
     _siteService       = siteService;
     _contentManager    = contentManager;
     _taxonomyService   = taxonomyService;
     _membershipService = membershipService;
 }
示例#21
0
 public CreateTorrentWidgetController(ITorrentService torrentService,
                                      ITaxonomyService taxonomyService,
                                      IModelStateValidatorService modelStateValidatorService)
 {
     _torrentService             = torrentService;
     _taxonomyService            = taxonomyService;
     _modelStateValidatorService = modelStateValidatorService;
 }
示例#22
0
        public SelectTermsFormForLines(
            IShapeFactory shapeFactory,
            ITaxonomyService taxonomyService)
        {
            _taxonomyService = taxonomyService;

            Shape = shapeFactory;
            T     = NullLocalizer.Instance;
        }
示例#23
0
        private static void RecalculateCount(IContentManager contentManager, ITaxonomyService taxonomyService, TermsPart part) {
            // submits any change to the db so that GetContentItemsCount is accurate
            contentManager.Flush();

            foreach (var term in part.Terms) {
                var termPart = taxonomyService.GetTerm(term.TermRecord.Id);
                term.TermRecord.Count = (int)taxonomyService.GetContentItemsCount(termPart);
            }
        }
 public CartHasProductWithTermCouponLineCriteria(
     IWorkContextAccessor workContextAccessor,
     ICacheManager cacheManager,
     ISignals signals,
     ITaxonomyService taxonomyService)
     : base(workContextAccessor, cacheManager, signals)
 {
     _taxonomyService = taxonomyService;
 }
示例#25
0
 public ImportUtil(IOrchardServices orchardServices)
 {
     _orchardServices      = orchardServices;
     _contentManager       = _orchardServices.ContentManager;
     _communicationService = _orchardServices.WorkContext.Resolve <ICommunicationService>();
     _repositoryCommunicationEmailRecord = _orchardServices.WorkContext.Resolve <IRepository <CommunicationEmailRecord> >();
     _repositoryCommunicationSmsRecord   = _orchardServices.WorkContext.Resolve <IRepository <CommunicationSmsRecord> >();
     _taxonomyService = _orchardServices.WorkContext.Resolve <ITaxonomyService>();
 }
示例#26
0
 public ProductService(IContentManager contentManager, 
     IContentDefinitionManager contentDefinitionManager, 
     ITaxonomyService taxonomyService, IAuthorizationService authorizationService, IOrchardServices orchardServices) {
     _contentManager = contentManager;
     _contentDefinitionManager = contentDefinitionManager;
     _taxonomyService = taxonomyService;
     _authorizationService = authorizationService;
     _orchardServices = orchardServices;
 }
示例#27
0
 public TaxonomyFieldDriver(
     IOrchardServices services,
     ITaxonomyService taxonomyService,
     IRepository <TermContentItem> repository)
 {
     _taxonomyService = taxonomyService;
     Services         = services;
     T = NullLocalizer.Instance;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TargetingProfileTaxonomySyncService" /> class.
 /// </summary>
 /// <param name="taxonomyService">The taxonomy service.</param>
 /// <param name="userProfilePropertyHelper">The user profile property helper.</param>
 /// <param name="logger">The logger.</param>
 public TargetingProfileTaxonomySyncService(
     ITaxonomyService taxonomyService, 
     IUserProfilePropertyHelper userProfilePropertyHelper,
     ILogger logger)
 {
     this.taxonomyService = taxonomyService;
     this.userProfilePropertyHelper = userProfilePropertyHelper;
     this.logger = logger;
 }
        public static async Task <TermSetModel> GetTermSetModelForFieldAsync <TContext, TEntity>(
            this SpClientContext <TContext> clientContext,
            ITaxonomyService taxonomyService,
            Expression <Func <TContext, ISpList <TEntity> > > listSelector,
            Expression <Func <TEntity, object> > propertySelector) where TContext : SpClientContext <TContext>
        {
            var metaField = clientContext.GetMetaFieldForProperty(listSelector, propertySelector);

            return(await taxonomyService.GetTermSetAsync(clientContext.ClientContext, metaField.TermSetId.ToString()));
        }
示例#30
0
 public MovieService(IRepository<ActorRecord> actorRepository, IRepository<MovieActorRecord> movieActorReposiory, 
     IRepository<MoviePartRecord> moviePartRepository, IOrchardServices orchardServices, ITaxonomyService taxonomyService)
 {
     _actorRepository = actorRepository;
     _movieActorRepository = movieActorReposiory;
     _moviePartRepository = moviePartRepository;
     _orchardServices = orchardServices;
     _taxonomyService = taxonomyService;
     _tmdbApi = new Lazy<TmdbApi>(() => new TmdbApi(_orchardServices.WorkContext.CurrentSite.As<MovieSettingsPart>().TMDB_ApiKey));
 }
示例#31
0
        public TagsController(
            ITaxonomyService taxonomyService,
            IContentManager contentManager,
			IAuthorizer authorizer) {
            _taxonomyService = taxonomyService;
            T = NullLocalizer.Instance;
            _contentManager = contentManager;
	        _authorizer = authorizer;
            Logger = NullLogger.Instance;
        }
示例#32
0
 public ArticleController(ISeoService seoService, IArticleService articleService, ICategoryService categoryService, ITagService tagService, ICloudService cloudService, ITaxonomyService taxonomyService, UserManager <User> userManager)
 {
     _articleService  = articleService;
     _categoryService = categoryService;
     _tagService      = tagService;
     _cloudService    = cloudService;
     _taxonomyService = taxonomyService;
     _userManager     = userManager;
     _seoService      = seoService;
 }
示例#33
0
 public TaxonomyTreeNodeProvider(
     ITaxonomyService taxonomyService,
     IContentManager contentManager,
     UrlHelper urlHelper)
 {
     _taxonomyService = taxonomyService;
     _contentManager = contentManager;
     _url = urlHelper;
     T = NullLocalizer.Instance;
 }
示例#34
0
 public TaxonomyTreeNodeProvider(
     ITaxonomyService taxonomyService,
     IContentManager contentManager,
     UrlHelper urlHelper)
 {
     _taxonomyService = taxonomyService;
     _contentManager  = contentManager;
     _url             = urlHelper;
     T = NullLocalizer.Instance;
 }
示例#35
0
 public TermPartDriver(
     ITaxonomyService taxonomyService,
     IContentManager contentManager,
     ITermPathConstraint termPathConstraint)
 {
     _taxonomyService    = taxonomyService;
     _contentManager     = contentManager;
     _termPathConstraint = termPathConstraint;
     T = NullLocalizer.Instance;
 }
 public MediaLibraryService(
     ITaxonomyService taxonomyService, 
     IContentManager contentManager, 
     IMimeTypeProvider mimeTypeProvider,
     IEnumerable<IMediaFactorySelector> mediaFactorySelectors ) {
     _taxonomyService = taxonomyService;
     _contentManager = contentManager;
     _mimeTypeProvider = mimeTypeProvider;
     _mediaFactorySelectors = mediaFactorySelectors;
 }
        public WidgetsContainerPartHandler(
            IContentManager contentManager,
            IWidgetManager widgetManager,
            ILocalizationService localizationService,
            ShellSettings shellSettings,
            ITaxonomyService taxonomyService)
        {
            _contentManager      = contentManager;
            _widgetManager       = widgetManager;
            _localizationService = localizationService;
            _shellSettings       = shellSettings;
            _taxonomyService     = taxonomyService;
            if (!string.IsNullOrEmpty(_shellSettings.RequestUrlPrefix))
            {
                _urlPrefix = new UrlPrefix(_shellSettings.RequestUrlPrefix);
            }
            T = NullLocalizer.Instance;

            OnRemoved <WidgetsContainerPart>((context, part) => {
                DeleteWidgets(part);
            });
            OnUpdateEditorShape <WidgetsContainerPart>((context, part) => {
                var lPart = part.ContentItem.As <LocalizationPart>();
                if (lPart != null)
                {
                    var settings = part.Settings.GetModel <WidgetsContainerSettings>();
                    if (settings.TryToLocalizeItems)
                    {
                        var culture = lPart.Culture;
                        var widgets = _widgetManager.GetWidgets(part.ContentItem.Id, part.ContentItem.IsPublished())
                                      .Where(p => p.ContentItem.Has <LocalizationPart>() &&
                                             p.ContentItem.Get <LocalizationPart>().Culture == null);
                        foreach (var widget in widgets)
                        {
                            var ci = widget.ContentItem;
                            _localizationService.SetContentCulture(ci, culture.Culture);
                            // manage taxonomy field out of the normal flow:
                            // gets translations of selected terms in taxonomy fields before BuildEditor()
                            var translatedTaxo = TranslateTaxonomies(ci, culture, _localizationService);

                            // simulates a user that opens in edit model the widget and saves it
                            // to trigger all handlers and drivers
                            var shapeWidget = _contentManager.BuildEditor(ci);
                            var shapeUpdate = _contentManager.UpdateEditor(ci, new CustomUpdater(shapeWidget, culture.Culture, Logger));

                            // sets translated terms in taxonomy fields after UpdateEditor()
                            ApplyTranslatedTaxonomies(ci, translatedTaxo, _taxonomyService);

                            ci.VersionRecord.Published = false;
                            _contentManager.Publish(ci);
                        }
                    }
                }
            });
        }
        private static void RecalculateCount(IContentManager contentManager, ITaxonomyService taxonomyService, TermsPart part)
        {
            // submits any change to the db so that GetContentItemsCount is accurate
            contentManager.Flush();

            foreach (var term in part.Terms)
            {
                var termPart = taxonomyService.GetTerm(term.TermRecord.Id);
                term.TermRecord.Count = (int)taxonomyService.GetContentItemsCount(termPart);
            }
        }
        public RegisteredPackageIdGetter(IUserkeyPackageService userkeyPackageService, IPackageService packageService, IOrchardServices orchardServices,
            IUserkeyService userkeyService, IGalleryPackageService galleryPackageService, ITaxonomyService taxonomyService) {
            _userkeyPackageService = userkeyPackageService;
            _packageService = packageService;
            _orchardServices = orchardServices;
            _userkeyService = userkeyService;
            _galleryPackageService = galleryPackageService;
            _taxonomyService = taxonomyService;

            _taxonomy = _taxonomyService.GetTaxonomyBySlug("PackageTypes");
        }
        public TaxonomyOrderAdminController(
			IOrchardServices services,
			IShapeFactory shapeFactory,
			ITaxonomyService taxonomyService)
        {
            _taxonomyService = taxonomyService;
            Services = services;
            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
 public LocalizedTaxonomyController(
     IContentDefinitionManager contentDefinitionManager,
     ILocalizationService localizationService,
     ITaxonomyService taxonomyService,
     ITaxonomyExtensionsService taxonomyExtensionsService)
 {
     _taxonomyService           = taxonomyService;
     _taxonomyExtensionsService = taxonomyExtensionsService;
     _contentDefinitionManager  = contentDefinitionManager;
     _localizationService       = localizationService;
 }
示例#42
0
        public TermAdminController(IOrchardServices services,
            ITaxonomyService taxonomyService,
            ISiteService siteService,
            IShapeFactory shapeFactory) {
            Services = services;
            _siteService = siteService;
            _taxonomyService = taxonomyService;

            T = NullLocalizer.Instance;
            Shape = shapeFactory;
        }
 public TaxonomyController(
     IUpgradeService upgradeService,
     IOrchardServices orchardServices,
     IFeatureManager featureManager,
     ITaxonomyService taxonomyService)
 {
     _upgradeService  = upgradeService;
     _orchardServices = orchardServices;
     _featureManager  = featureManager;
     _taxonomyService = taxonomyService;
 }
示例#44
0
        public TermWidgetPartDriver(
            IContentManager contentManager,
            ITaxonomyService taxonomyService,
            IContentDefinitionManager contentDefinitionManager)
        {
            _contentManager           = contentManager;
            _taxonomyService          = taxonomyService;
            _contentDefinitionManager = contentDefinitionManager;

            T = NullLocalizer.Instance;
        }
示例#45
0
        public PackagesController(IOrchardServices orchardServices, ITaxonomyService taxonomyService, IShapeFactory shapeFactory, ISiteService siteService,
            IIndexManager indexManager, ICategoryGetter categoryGetter)
        {
            _orchardServices = orchardServices;
            _taxonomyService = taxonomyService;
            _siteService = siteService;
            _indexManager = indexManager;
            _categoryGetter = categoryGetter;

            Shape = shapeFactory;
        }
 public FrontEndTagsController(
     ITaxonomyService taxonomyService,
     IContentManager contentManager,
     IAuthorizer authorizer)
 {
     _taxonomyService = taxonomyService;
     T = NullLocalizer.Instance;
     _contentManager = contentManager;
     _authorizer     = authorizer;
     Logger          = NullLogger.Instance;
 }
示例#47
0
        public Migrations(
            ITaxonomyService taxonomyService,
            IOrchardServices orchardServices,
            IContentManager contentManager)
        {
            _taxonomyService = taxonomyService;
            _orchardServices = orchardServices;
            _contentManager  = contentManager;

            T      = NullLocalizer.Instance;
            Logger = NullLogger.Instance;
        }
示例#48
0
        public PushMobileSettingsPartDriver(IOrchardServices orchardServices, ShellSettings shellSettings, ITaxonomyService taxonomyService)
        {
            _orchardServices = orchardServices;
            _shellSettings   = shellSettings;
            _taxonomyService = taxonomyService;
            string mobile_folder = HostingEnvironment.MapPath("~/") + @"App_Data\Sites\" + _shellSettings.Name + @"\Mobile\";

            if (!System.IO.Directory.Exists(mobile_folder))
            {
                System.IO.Directory.CreateDirectory(mobile_folder);
            }
        }
示例#49
0
        public ProductPartHandler(IRepository<ProductPartRecord> repository, 
            ITaxonomyService taxonomyService, IScheduledTaskManager scheduledTaskManager, IWorkContextAccessor workContextAccessor) {

            _taxonomyService = taxonomyService;
            _scheduledTaskManager = scheduledTaskManager;
            _workContextAccessor = workContextAccessor;

            Filters.Add(StorageFilter.For(repository));

            OnCreated<ProductPart>(SetCategory);
            OnPublished<ProductPart>(ScheduleUnpublish);
        }
示例#50
0
 public TaxonomyExtensionsService(
     IAutorouteService autorouteService,
     IContentManager contentManager,
     IContentDefinitionManager contentDefinitionManager,
     ITaxonomyService taxonomyService,
     ILocalizationService localizationService)
 {
     _autorouteService         = autorouteService;
     _contentManager           = contentManager;
     _contentDefinitionManager = contentDefinitionManager;
     _taxonomyService          = taxonomyService;
 }
示例#51
0
 public SkillsController(
     ILogger <SkillsController> logger,
     ISkillService skillService,
     ITaxonomyService taxonomyService,
     ISelfAssessmentService selfAssessmentService,
     IUserService userService)
 {
     _skillService          = skillService;
     _taxonomyService       = taxonomyService;
     _selfAssessmentService = selfAssessmentService;
     _userService           = userService;
     _logger = logger;
 }
        public CacheEvictorPartSettingsHook(
            IContentManager contentManager,
            IContentDefinitionManager contentDefinitionManager,
            IOrchardServices services,
            ITaxonomyService taxonomyService)
        {
            Services                  = services;
            _contentManager           = contentManager;
            _contentDefinitionManager = contentDefinitionManager;
            _taxonomyService          = taxonomyService;

            T = NullLocalizer.Instance;
        }
示例#53
0
 public ContentExtensionsServices(IContentManager contentManager
                                  , IRepository <StringFieldIndexRecord> stringFieldIndexRepository,
                                  IRepository <FieldIndexPartRecord> fieldIndexRepository,
                                  ITaxonomyService taxonomyService,
                                  IUtilsServices utilsServices)
 {
     _contentManager             = contentManager;
     _fieldIndexRepository       = fieldIndexRepository;
     _stringFieldIndexRepository = stringFieldIndexRepository;
     _taxonomyService            = taxonomyService;
     Log            = NullLogger.Instance;
     _utilsServices = utilsServices;
 }
示例#54
0
        public TaxonomyPartHandler(
            IRepository <TaxonomyPartRecord> repository,
            ITaxonomyService taxonomyService,
            IContentDefinitionManager contentDefinitionManager)
        {
            string previousName = null;

            Filters.Add(StorageFilter.For(repository));
            OnPublished <TaxonomyPart>((context, part) => {
                var previousTermTypeName = part.TermTypeName;

                if (previousName == null || part.Name == previousName)
                {
                    // is it a new taxonomy ?
                    taxonomyService.CreateTermContentType(part);
                }
                else
                {
                    // keep the previous term type name as it would otherwise force us
                    // to update all terms to use another type
                    part.TermTypeName = previousTermTypeName;

                    // update existing fields
                    foreach (var partDefinition in contentDefinitionManager.ListPartDefinitions())
                    {
                        foreach (var field in partDefinition.Fields)
                        {
                            if (field.FieldDefinition.Name == typeof(TaxonomyField).Name)
                            {
                                if (field.Settings.GetModel <TaxonomyFieldSettings>().Taxonomy == previousName)
                                {
                                    contentDefinitionManager.AlterPartDefinition(partDefinition.Name,
                                                                                 cfg => cfg.WithField(field.Name,
                                                                                                      builder => builder.WithSetting("TaxonomyFieldSettings.Taxonomy", part.Name)));
                                }
                            }
                        }
                    }
                }
            });

            OnLoading <TaxonomyPart>((context, part) => part.TermsField.Loader(x => taxonomyService.GetTerms(part.Id)));

            OnUpdating <TitlePart>((context, part) => {
                // if altering the title of a taxonomy, save the name
                if (part.As <TaxonomyPart>() != null)
                {
                    previousName = part.Title;
                }
            });
        }
示例#55
0
        public Migrations(IMenuService menuService,
                          IContentManager contentManager,
                          IQueryService queryService,
                          IWidgetsService widgetsService,
                          ITaxonomyService taxonomyService,
                            IProjectionManager projectionManager) {

            _menuService = menuService;
            _contentManager = contentManager;
            _queryService = queryService;
            _widgetsService = widgetsService;
            _taxonomyService = taxonomyService;
            _projectionManager = projectionManager;
        }
示例#56
0
        public AmiImportController(IContentManager contentManager, IFieldIndexService fieldIndexService, ITaxonomyService taxonomyService,
                                   IMediaLibraryService mediaLibraryService, IRepository <DecimalFieldIndexRecord> decimalFieldIndexRecord,
                                   IRepository <FieldIndexPartRecord> fieldIndexRecord, Lazy <IAutorouteService> autorouteService)
        {
            _contentManager          = contentManager;
            _fieldIndexService       = fieldIndexService;
            _mediaLibraryService     = mediaLibraryService;
            _decimalFieldIndexRecord = decimalFieldIndexRecord;
            _fieldIndexRecord        = fieldIndexRecord;
            _taxonomyService         = taxonomyService;
            _autorouteService        = autorouteService;

            Log = NullLogger.Instance;
        }
示例#57
0
        // Retrieve the number of associated content items, for the whole hierarchy
        private static void RecalculateCount(ITaxonomyService taxonomyService, TermsPart part) {
            foreach (var term in part.Terms) {
                var termPart = taxonomyService.GetTerm(term.TermRecord.Id);
                while (termPart != null) {
                    termPart.Count = (int)taxonomyService.GetContentItemsCount(termPart);

                    // compute count for the hierarchy too
                    if (termPart.Container != null) {
                        var parentTerm = termPart.Container.As<TermPart>();
                        termPart = parentTerm;
                    }
                }
            }
        }
 public JobFeatureEventhandler(IMenuService menuService,
                   IContentManager contentManager,
                   IQueryService queryService,
                   IWidgetsService widgetsService,
                   ITaxonomyService taxonomyService,
                     IProjectionManager projectionManager)
 {
     _menuService = menuService;
     _contentManager = contentManager;
     _queryService = queryService;
     _widgetsService = widgetsService;
     _taxonomyService = taxonomyService;
     _projectionManager = projectionManager;
 }
示例#59
0
        public TaxonomyPartHandler(
            IRepository<TaxonomyPartRecord> repository,
            ITaxonomyService taxonomyService
            )
        {
            Filters.Add(StorageFilter.For(repository));

            OnPublished<TaxonomyPart>(
                (context, part) => taxonomyService.CreateTermContentType(part));

            OnLoading<TaxonomyPart>(
                (context, part) =>
                    part._terms.Loader(x => taxonomyService.GetTerms(part.Id))
                );
        }
 public Migrations(
     IAutorouteService autorouteService,
     IMenuService menuService,
     IRepository<QueryPartRecord> queryRepository,
     IContentManager contentManager,
     IWidgetsService widgetService,
     ITaxonomyService taxonomyService
     ) {
     _autorouteService = autorouteService;
     _menuService = menuService;
     _contentManager = contentManager;
     _widgetsService = widgetService;
     _queryRepository = queryRepository;
     _taxonomyService = taxonomyService;
     _templateProvider = new FileSystemTemplateProvider();
 }