Beispiel #1
0
 public AdminController(
     IOrchardServices orchardServices,
     ISearchService searchService,
     IPrefixedEditorManager prefixedEditorManager,
     ISeoSettingsManager seoSettingsManager,
     ISeoService seoService)
     : base(orchardServices, prefixedEditorManager, seoSettingsManager, seoService)
 {
     _searchService = searchService;
 }
        /// <summary>
        /// Updates contents whose editor was previously built with IPrefixedEditorManager with the updater
        /// </summary>
        /// <param name="contents">The content objects to use</param>
        /// <param name="updater">The updater to update the contents with</param>
        /// <param name="groupId">Optional editor group ID</param>
        /// <returns>The updated editor shapes</returns>
        public static IEnumerable <dynamic> UpdateEditors(this IPrefixedEditorManager prefixedEditorManager, IEnumerable <IContent> contents, IUpdateModel updater, string groupId = "")
        {
            var shapes = new List <dynamic>();

            foreach (var content in contents)
            {
                shapes.Add(prefixedEditorManager.UpdateEditor(content, updater, groupId));
            }

            return(shapes);
        }
        /// <summary>
        /// Updates contents whose editor was previously built with IPrefixedEditorManager with the updater
        /// </summary>
        /// <param name="contents">The content objects to use</param>
        /// <param name="prefixedParents">To be used if the contents' editor was wrapped into the prefixed editor of parents. Specify all the parents, starting from the outer most for each item.</param>
        /// <param name="updater">The updater to update the contents with</param>
        /// <param name="groupId">Optional editor group ID</param>
        /// <returns>The updated editor shapes</returns>
        public static IEnumerable <dynamic> UpdateEditors(this IPrefixedEditorManager prefixedEditorManager, IEnumerable <IContent> contents, IEnumerable <IEnumerable <IPrefixedParent> > prefixedParents, IUpdateModel updater, string groupId = "")
        {
            var shapes  = new List <dynamic>();
            var parents = prefixedParents.ToList();

            if (contents.Count() != parents.Count)
            {
                throw new InvalidOperationException("The number of contents and parents should be the same.");
            }

            int i = 0;

            foreach (var content in contents)
            {
                shapes.Add(prefixedEditorManager.UpdateEditor(content, parents[i++], updater, groupId));
            }

            return(shapes);
        }
Beispiel #4
0
        protected AdminControllerBase(
            IOrchardServices orchardServices,
            IPrefixedEditorManager prefixedEditorManager,
            ISeoSettingsManager seoSettingsManager,
            ISeoService seoService)
        {
            _orchardServices    = orchardServices;
            _authorizer         = orchardServices.Authorizer;
            _contentManager     = orchardServices.ContentManager;
            _shapeFactory       = orchardServices.New;
            _workContext        = orchardServices.WorkContext;
            _transactionManager = orchardServices.TransactionManager;

            _prefixedEditorManager = prefixedEditorManager;
            _seoSettingsManager    = seoSettingsManager;
            _seoService            = seoService;

            T = NullLocalizer.Instance;
        }
Beispiel #5
0
        public AdminController(
            IOrchardServices orchardServices,
            ISearchService searchService,
            ISiteService siteService,
            IPrefixedEditorManager prefixedEditorManager,
            ISeoSettingsManager seoSettingsManager,
            ISeoService seoService)
        {
            _orchardServices = orchardServices;
            _authorizer      = orchardServices.Authorizer;
            _contentManager  = orchardServices.ContentManager;
            _shapeFactory    = _orchardServices.New;
            _searchService   = searchService;

            _prefixedEditorManager = prefixedEditorManager;
            _siteService           = siteService;
            _seoSettingsManager    = seoSettingsManager;
            _seoService            = seoService;

            T = NullLocalizer.Instance;
        }
 /// <summary>
 /// Builds content shapes that contain the necessary prefix
 /// </summary>
 /// <param name="contents">The content objects to use</param>
 /// <param name="shapeFactory">Factory delegate to create the editor shape for the content objects</param>
 /// <returns>The prefixed shapes (multiple such shapes can be used on the same page)</returns>
 public static IEnumerable <dynamic> BuildShapes(this IPrefixedEditorManager prefixedEditorManager, IEnumerable <IContent> contents, Func <IContent, dynamic> shapeFactory)
 {
     return(contents.Select(content => prefixedEditorManager.BuildShape(content, shapeFactory)));;
 }