/// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="mapPath">A delegate method used to perform a Server.MapPath operation</param>
        public DefaultPackageContext(UmbracoSettings settings, Func<string, string> mapPath)
        {
            _settings = settings;

            _pluginInstallFolderPath = mapPath(_settings.PluginConfig.PluginsPath + "/Packages");
            _localPackageRepoFolderPath = mapPath(_settings.UmbracoFolders.LocalPackageRepositoryFolder);

            //create lazy instances of each
            _localPackageRepository = new Lazy<IPackageRepository>(
                () =>
                    {
                        //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers.
                        var packageFileSys = new PhysicalFileSystem(_localPackageRepoFolderPath);
                        var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false);
                        return new LocalPackageRepository(packagePathResolver, packageFileSys, true);
                    });

            _localPackageManager = new Lazy<IPackageManager>(
                () =>
                    {
                        //create a new path resolver with false as 'useSideBySidePaths' so that it doesn't install with version numbers.
                        var packageFileSys = new PhysicalFileSystem(_pluginInstallFolderPath);
                        var packagePathResolver = new DefaultPackagePathResolver(packageFileSys, false);
                        return new PackageManager(_localPackageRepository.Value, packagePathResolver, packageFileSys);
                    });
            
            // Public packages
            _publicPackageRepository = new Lazy<IPackageRepository>(
                () => PackageRepositoryFactory.Default.CreateRepository(_settings.PublicPackageRepository.RepositoryAddress));
            
            _publicPackageManager = new Lazy<IPackageManager>(
                () => new PackageManager(_publicPackageRepository.Value, mapPath(_settings.PluginConfig.PluginsPath + "/Packages")));

        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="renderModelFactory"></param>
        public RenderViewEngine(UmbracoSettings settings, IRenderModelFactory renderModelFactory)
        {
            // TODO: Resolve TwoLevelViewCache problems in release builds, as it seems to cache views without taking parent folder into account
            ViewLocationCache = DefaultViewLocationCache.Null;
            //if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled)
            //{
            //    ViewLocationCache = DefaultViewLocationCache.Null;
            //}
            //else
            //{
            //    //override the view location cache with our 2 level view location cache
            //    ViewLocationCache = new TwoLevelViewCache(ViewLocationCache);
            //}

            _settings = settings;

            var replaceWithUmbracoFolder = _supplementedViewLocations.ForEach(location => _settings.UmbracoFolders.TemplateFolder + location);
            var replacePartialWithUmbracoFolder = _supplementedPartialViewLocations.ForEach(location => _settings.UmbracoFolders.TemplateFolder + location);

            //The Render view engine doesn't support Area's so make those blank
            ViewLocationFormats = replaceWithUmbracoFolder.ToArray();
            PartialViewLocationFormats = replacePartialWithUmbracoFolder.ToArray();

            AreaPartialViewLocationFormats = new string[] {};
            AreaViewLocationFormats = new string[] {};
        }
 public CmsBootstrapper(UmbracoSettings settings,
     UmbracoAreaRegistration areaRegistration,
     InstallAreaRegistration installRegistration,
     IEnumerable<PackageAreaRegistration> componentAreas)
 {
     _areaRegistration = areaRegistration;
     _installRegistration = installRegistration;
     _componentAreas = componentAreas;
     _settings = settings;
     _attributeTypeRegistry = new DependencyResolverAttributeTypeRegistry();
 }
 public CmsBootstrapper(UmbracoSettings settings,
     UmbracoAreaRegistration areaRegistration,
     InstallAreaRegistration installRegistration,
     IEnumerable<PackageAreaRegistration> componentAreas,
     IAttributeTypeRegistry attributeTypeRegistry)
 {
     _areaRegistration = areaRegistration;
     _installRegistration = installRegistration;
     _componentAreas = componentAreas;
     _attributeTypeRegistry = attributeTypeRegistry;
     _settings = settings;
 }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="settings"></param>
        /// <param name="packageContext"></param>
        public PluginViewEngine(UmbracoSettings settings, IPackageContext packageContext)
        {
            _settings = settings;
            _packageContext = packageContext;

            // TODO: Resolve TwoLevelViewCache problems in release builds, as it seems to cache views without taking parent folder into account
            ViewLocationCache = DefaultViewLocationCache.Null;
            //if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled)
            //{
            //    ViewLocationCache = DefaultViewLocationCache.Null;
            //}
            //else
            //{
            //    //override the view location cache with our 2 level view location cache
            //    ViewLocationCache = new TwoLevelViewCache(ViewLocationCache);
            //}
            
            
            SetViewLocations();
        }
        public UmbracoApplicationContext(
            //ICmsHiveManager hive, 
            //HiveManager hive, 
            UmbracoSettings settings, 
            IFrameworkContext frameworkContext,
            ISecurityService securityService)
        {
            //Hive = hive;
            Settings = settings;
            FrameworkContext = frameworkContext;
            Security = securityService;
            //Hive2 = hive2;
            //Hive2 = DependencyResolver.Current.GetService<HiveManager>();

            //TODO: Use this cache mechanism! But in order to do so , we need triggers working from Hive providers, currently they are not setup

            //clear our status cache when any hive install status changes
            frameworkContext.TaskManager.AddDelegateTask(
                TaskTriggers.Hive.InstallStatusChanged, 
                x => _installStatuses = null);
        }
 public static UmbracoSettings GetSettings()
 {
     var settings = new UmbracoSettings();
     return settings;
 }
 public ApplicationIconFileResolver(HttpServerUtilityBase server, UmbracoSettings settings, UrlHelper url)
     : base(new DirectoryInfo(server.MapPath(settings.UmbracoFolders.ApplicationIconFolder)), url)
 {
 }
Beispiel #9
0
        public static UmbracoSettings GetSettings()
        {
            var settings = new UmbracoSettings();

            return(settings);
        }
        public static string GetEditorUrl(this UrlHelper url, string action, Guid editorId, object actionParams, ComponentRegistrations preResolvedComponentRegistrations, UmbracoSettings preResovledSettings)
        {
            
            var editorMetaData = preResolvedComponentRegistrations
                .EditorControllers
                .Where(x => x.Metadata.Id == editorId)
                .SingleOrDefault();

            if (editorMetaData == null)
                throw new InvalidOperationException("Could not find the editor controller with id " + editorId);
            
            var routeValDictionary = new RouteValueDictionary(actionParams);
            routeValDictionary["editorId"] = editorId.ToString("N");

            var area = preResovledSettings.UmbracoPaths.BackOfficePath;

            //now, need to figure out what area this editor belongs too...
            var pluginDefinition = editorMetaData.Metadata.PluginDefinition;            
            if (pluginDefinition.HasRoutablePackageArea())
            {
                area = pluginDefinition.PackageName;
            }

            //add the plugin area to our collection
            routeValDictionary["area"] = area;

            var resolvedUrl = url.Action(action, editorMetaData.Metadata.ControllerName, routeValDictionary);
            return resolvedUrl;
        }
 /// <summary>
 /// Returns the full unique url for an Editor
 /// </summary>
 /// <param name="url">The URL.</param>
 /// <param name="action">The action.</param>
 /// <param name="id">A HiveId object or null if no id is required</param>
 /// <param name="editorId">The editor id.</param>
 /// <param name="preResolvedComponentRegistrations">The pre resolved component registrations.</param>
 /// <param name="preResovledSettings"></param>
 /// <returns></returns>
 public static string GetEditorUrl(this UrlHelper url, string action, HiveId? id, Guid editorId, ComponentRegistrations preResolvedComponentRegistrations, UmbracoSettings preResovledSettings)
 {
     var idVal = GetIdVal(id);
     return url.GetEditorUrl(action, editorId, new { id = idVal }, preResolvedComponentRegistrations, preResovledSettings);
 }
 /// <summary>
 /// Returns the editor url using the default action
 /// </summary>
 /// <param name="url">The URL.</param>
 /// <param name="id">The id.</param>
 /// <param name="editorId">The editor id.</param>
 /// <param name="preResolvedComponentRegistrations">The pre resolved component registrations.</param>
 /// <param name="preResovledSettings"></param>
 /// <returns></returns>
 public static string GetEditorUrl(this UrlHelper url, HiveId id, Guid editorId, ComponentRegistrations preResolvedComponentRegistrations, UmbracoSettings preResovledSettings)
 {
     return url.GetEditorUrl("Edit", id, editorId, preResolvedComponentRegistrations, preResovledSettings);
 }
 public DocumentTypeThumbnailFileResolver(HttpServerUtilityBase server, UmbracoSettings settings, UrlHelper url)
     : base(new DirectoryInfo(server.MapPath(settings.UmbracoFolders.DocTypeThumbnailFolder)), url)
 {
 }
 public InstallAreaRegistration(UmbracoSettings umbracoSettings)
 {
     _umbracoSettings = umbracoSettings;            
 }