public InitContentEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     m_pugpigDataSet = new PugpigDataset(new PropertyEditorFactory(), requestContext.Application.Hive.FrameworkContext, new DefaultAttributeTypeRegistry());
     Hive = requestContext.Application.Hive;
     FrameworkContext = requestContext.Application.Hive.FrameworkContext;
 }
 public TemplateEditorController(IBackOfficeRequestContext requestContext) : base(requestContext)
 {
     _hive = BackOfficeRequestContext
         .Application
         .Hive
         .GetWriter<IFileStore>(new Uri("storage://templates"));
 }
Пример #3
0
        public MemberGroupEditorController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {
            _hive = BackOfficeRequestContext.Application.Hive.GetWriter(new Uri("security://member-groups"));

            Mandate.That(_hive != null, x => new NullReferenceException("Could not find hive provider for route security://member-groups"));
        }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 public DefaultController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _editorControllers = requestContext.RegisteredComponents.EditorControllers;
     _menuItems         = requestContext.RegisteredComponents.MenuItems;
     _trees             = requestContext.RegisteredComponents.TreeControllers;
 }
        public MemberGroupEditorController(IBackOfficeRequestContext requestContext) 
            : base(requestContext)
        {
            _hive = BackOfficeRequestContext.Application.Hive.GetWriter(new Uri("security://member-groups"));

            Mandate.That(_hive != null, x => new NullReferenceException("Could not find hive provider for route security://member-groups"));
        }
Пример #6
0
 public InstallController(IBackOfficeRequestContext requestContext)
 {
     _requestContext = requestContext;
     //set the custom installer action invoker
     ActionInvoker = new RebelInstallActionInvoker(requestContext);
     _packageInstallUtility = new PackageInstallUtility(requestContext);
 }
 public TemplateEditorController(IBackOfficeRequestContext requestContext) : base(requestContext)
 {
     _hive = BackOfficeRequestContext
             .Application
             .Hive
             .GetWriter <IFileStore>(new Uri("storage://templates"));
 }
Пример #8
0
 public InstallController(IBackOfficeRequestContext requestContext)
 {
     _requestContext = requestContext;
     //set the custom installer action invoker
     ActionInvoker          = new RebelInstallActionInvoker(requestContext);
     _packageInstallUtility = new PackageInstallUtility(requestContext);
 }
        /// <summary>
        /// This is the method that will execute in order to return the code snippet that will be compiled by the BuildManager
        /// </summary>
        /// <param name="backOfficeRequestContext"></param>
        /// <param name="delegateParam"></param>
        /// <param name="virtualPathId"></param>
        /// <param name="codeWrapper"></param>
        /// <returns></returns>
        private static string GetCodeBlock(
            IBackOfficeRequestContext backOfficeRequestContext,
            object delegateParam,
            string virtualPathId,
            Func <NodeSelectorPreValueModel, string, string> codeWrapper)
        {
            //first we need to cast the delegateParam into the object it actually is...
            //we can guarantee it is castable since we are setting it above.
            var dp = (Tuple <HiveId, CSharpCodeBlockType>)delegateParam;

            using (var uow = backOfficeRequestContext.Application.Hive.OpenReader <IContentStore>())
            {
                var dt = uow.Repositories.Schemas.Get <AttributeType>(true, dp.Item1).SingleOrDefault();
                if (dt == null)
                {
                    throw new InvalidOperationException("Could not find AttributeType with id " + dp.Item1);
                }
                var dataTypeViewModel = backOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map <AttributeType, DataTypeEditorModel>(dt)
                                        .PreValueEditorModel as NodeSelectorPreValueModel;
                if (dataTypeViewModel == null)
                {
                    throw new InvalidOperationException("The AttributeType must have a " + typeof(NodeSelectorEditor).Name + " type as its PropertyEditor");
                }

                return(codeWrapper(dataTypeViewModel, virtualPathId));
            }
        }
 public ImplementSectionEditorController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 {
     _templateStore = BackOfficeRequestContext
         .Application
         .Hive
         .GetReader<IFileStore>(new Uri("storage://templates"));
 }
 public StylesheetEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _hive = BackOfficeRequestContext
             .Application
             .Hive
             .GetWriter <IFileStore>(new Uri("storage://stylesheets"));
 }
 public InsertPartialEditorController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 {
     _partialsStore = BackOfficeRequestContext
         .Application
         .Hive
         .GetReader<IFileStore>(new Uri("storage://partials"));
 }
 public StylesheetEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _hive = BackOfficeRequestContext
         .Application
         .Hive
         .GetWriter<IFileStore>(new Uri("storage://stylesheets"));
 }
Пример #14
0
 public ImplementSectionEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _templateStore = BackOfficeRequestContext
                      .Application
                      .Hive
                      .GetReader <IFileStore>(new Uri("storage://templates"));
 }
 public MacroPartialsEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _hive = BackOfficeRequestContext
         .Application
         .Hive
         .GetWriter<IFileStore>(new Uri("storage://macro-partials"));
 }
Пример #16
0
        public ContentEditorController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {
            _hive         = BackOfficeRequestContext.Application.Hive.GetWriter <IContentStore>();
            _readonlyHive = BackOfficeRequestContext.Application.Hive.GetReader <IContentStore>();

            Mandate.That(_hive != null, x => new NullReferenceException("Could not find hive provider for route content://"));
        }
 public InsertPartialEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _partialsStore = BackOfficeRequestContext
                      .Application
                      .Hive
                      .GetReader <IFileStore>(new Uri("storage://partials"));
 }
Пример #18
0
        /// <summary>
        /// 
        /// </summary>
        public DefaultController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {

            _editorControllers = requestContext.RegisteredComponents.EditorControllers;
            _menuItems = requestContext.RegisteredComponents.MenuItems;
            _trees = requestContext.RegisteredComponents.TreeControllers;
        }
 public MacroPartialsEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _hive = BackOfficeRequestContext
             .Application
             .Hive
             .GetWriter <IFileStore>(new Uri("storage://macro-partials"));
 }
Пример #20
0
 public UploadEditorModel(UploadPreValueModel preValueModel, IBackOfficeRequestContext backOfficeRequestContext,
                          HiveId contentId, string propertyAlias)
     : base(preValueModel)
 {
     _backOfficeRequestContext = backOfficeRequestContext;
     _hive          = _backOfficeRequestContext.Application.Hive.GetWriter <IFileStore>(new Uri("storage://file-uploader"));
     _contentId     = contentId;
     _propertyAlias = propertyAlias;
 }
 public DataTypeEditorController(
     IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _propertyEditors = requestContext.RegisteredComponents.PropertyEditors;
     //exclude internal ones and only include ones made for editing content
     _sortedEditors = _propertyEditors
         .Where(x => !x.Metadata.IsInternalRebelEditor && x.Metadata.IsContentPropertyEditor)
         .Select(x => x.Metadata).OrderBy(x => x.Name).ToArray();
 }
 public DataTypeEditorController(
     IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
     _propertyEditors = requestContext.RegisteredComponents.PropertyEditors;
     //exclude internal ones and only include ones made for editing content
     _sortedEditors = _propertyEditors
                      .Where(x => !x.Metadata.IsInternalRebelEditor && x.Metadata.IsContentPropertyEditor)
                      .Select(x => x.Metadata).OrderBy(x => x.Name).ToArray();
 }
Пример #23
0
 public NodeSelectorContentTreeControllerHelper(
     Func <HiveId, FormCollection, ReadonlyGroupUnitFactory> getHiveProvider,
     Action ensureInitialized,
     Func <TypedEntity, string> getTreeNodeAlias,
     IBackOfficeRequestContext backOfficeRequestContext)
 {
     _getHiveProvider          = getHiveProvider;
     _ensureInitialized        = ensureInitialized;
     _getTreeNodeAlias         = getTreeNodeAlias;
     _backOfficeRequestContext = backOfficeRequestContext;
 }
 public NodeSelectorContentTreeControllerHelper(
     Func<HiveId, FormCollection, ReadonlyGroupUnitFactory> getHiveProvider,
     Action ensureInitialized,
     Func<TypedEntity, string> getTreeNodeAlias,
     IBackOfficeRequestContext backOfficeRequestContext)
 {
     _getHiveProvider = getHiveProvider;
     _ensureInitialized = ensureInitialized;
     _getTreeNodeAlias = getTreeNodeAlias;
     _backOfficeRequestContext = backOfficeRequestContext;
 }
Пример #25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NodeSelectorEditorModel"/> class.
 /// </summary>
 /// <param name="preValueModel"> </param>
 /// <param name="backOfficeRequestContext">The back office request context.</param>
 /// <param name="contentId">The current id of the content item being rendered.</param>
 /// <param name="propertyAlias">The current alias of the property being rendered.</param>
 /// <param name="dataTypeId"> </param>
 public NodeSelectorEditorModel(
     NodeSelectorPreValueModel preValueModel,
     IBackOfficeRequestContext backOfficeRequestContext,
     HiveId contentId,
     string propertyAlias,
     HiveId dataTypeId)
     : base(preValueModel)
 {
     _backOfficeRequestContext = backOfficeRequestContext;
     _contentId     = contentId;
     _propertyAlias = propertyAlias;
     DataTypeId     = dataTypeId;
 }
Пример #26
0
        public PackageInstallation(IBackOfficeRequestContext context, HttpContextBase httpContext, IPackage package)
        {
            _context = context;
            _package = package;
            _httpContext = httpContext;

            var packageFolderName = _context.PackageContext.LocalPathResolver.GetPackageDirectory(_package);
            var packageFolderPath = Path.Combine(_context.Application.Settings.PluginConfig.PluginsPath, "Packages", packageFolderName);
            _absolutePackagePath = _httpContext.Server.MapPath(packageFolderPath);
            _absoluteRootedPath = _httpContext.Server.MapPath("~/");

            Mandate.That(Directory.Exists(_absolutePackagePath), x => new FileNotFoundException("The package directory " + _absolutePackagePath + " could not be found"));
        }
        /// <summary>
        /// Get the result of the CSharp code for the node filter
        /// </summary>
        /// <param name="dataTypeId"> </param>
        /// <param name="ds"></param>
        /// <param name="nodeId"></param>
        /// <param name="backOfficeRequestContext"> </param>
        /// <returns></returns>
        internal static bool GetNodeFilterResult(IBackOfficeRequestContext backOfficeRequestContext, HiveId dataTypeId, INodeSelectorDataSource ds, HiveId nodeId)
        {
            var virtualPathId = SetupCodeDelegateForFilter(backOfficeRequestContext, dataTypeId);

            var instance = GetClassInstance <AbstractNodeFilter>(virtualPathId);

            if (instance != null)
            {
                var entity = ds.GetEntity(nodeId);
                return(instance.IsMatch(backOfficeRequestContext, entity));
            }
            return(true);
        }
Пример #28
0
 /// <summary>
 /// Returns the names of each ChildAction that can be used as a Macro
 /// </summary>
 /// <param name="backOfficeRequestContext"></param>
 /// <returns></returns>
 public override IEnumerable <SelectListItem> GetMacroItems(IBackOfficeRequestContext backOfficeRequestContext)
 {
     return((from s in backOfficeRequestContext.RegisteredComponents.SurfaceControllers
             .Where(x => x.Metadata.HasChildActionMacros)
             let childActions = s.Metadata.ComponentType.GetMethods()
                                .Where(a => a.GetCustomAttributes(typeof(ChildActionOnlyAttribute), false).Any())
                                from action in childActions
                                select(!s.Metadata.PluginDefinition.HasRoutablePackageArea() ? "" : s.Metadata.PluginDefinition.PackageName + "-")
                                + s.Metadata.ControllerName + "." + action.Name)
            .ToArray()
            .Select(x => new SelectListItem {
         Text = x, Value = x
     }));
 }
Пример #29
0
        public PackageInstallation(IBackOfficeRequestContext context, HttpContextBase httpContext, IPackage package)
        {
            _context     = context;
            _package     = package;
            _httpContext = httpContext;

            var packageFolderName = _context.PackageContext.LocalPathResolver.GetPackageDirectory(_package);
            var packageFolderPath = Path.Combine(_context.Application.Settings.PluginConfig.PluginsPath, "Packages", packageFolderName);

            _absolutePackagePath = _httpContext.Server.MapPath(packageFolderPath);
            _absoluteRootedPath  = _httpContext.Server.MapPath("~/");

            Mandate.That(Directory.Exists(_absolutePackagePath), x => new FileNotFoundException("The package directory " + _absolutePackagePath + " could not be found"));
        }
        /// <summary>
        /// Get the result of the CSharp code for the start node query
        /// </summary>
        /// <param name="dataTypeId"> </param>
        /// <param name="ds"></param>
        /// <param name="nodeId"></param>
        /// <param name="backOfficeRequestContext"> </param>
        /// <returns></returns>
        internal static HiveId GetStartNodeQueryResult(IBackOfficeRequestContext backOfficeRequestContext, HiveId dataTypeId, INodeSelectorDataSource ds, HiveId nodeId)
        {
            var virtualPathId = SetupCodeDelegateForQuery(backOfficeRequestContext, dataTypeId);

            var instance = GetClassInstance <AbstractStartNodeQuery>(virtualPathId);

            if (instance != null)
            {
                var entity = ds.GetEntity(nodeId);
                var root   = ds.GetEntity(ds.GetRootNodeId());
                return(instance.StartNodeId(backOfficeRequestContext, entity, root));
            }
            return(HiveId.Empty);
        }
        protected AbstractEditorController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {
            //Locate the editor attribute
            var editorAttributes = GetType()
                .GetCustomAttributes(typeof(EditorAttribute), false)
                .OfType<EditorAttribute>();

            if (!editorAttributes.Any())
            {
                throw new InvalidOperationException("The Editor controller is missing the " + typeof(EditorAttribute).FullName + " attribute");
            }

            //assign the properties of this object to those of the metadata attribute
            var attr = editorAttributes.First();
            EditorId = attr.Id;           
        }
Пример #32
0
        public PackageLogger(IBackOfficeRequestContext context, HttpContextBase httpContext, IPackage package,
            bool autoHydrate = false)
        {
            _context = context;
            _httpContext = httpContext;
            _package = package;

            var packageFolderName = _context.PackageContext.LocalPathResolver.GetPackageDirectory(_package);
            var packageFolderPath = Path.Combine(_context.Application.Settings.PluginConfig.PluginsPath, "Packages", packageFolderName);
            var logFilePath = Path.Combine(packageFolderPath, "Log.json");
            _absoluteLogFilePath = _httpContext.Server.MapPath(logFilePath);

            _entries = new List<PackageLogEntry>();

            if(autoHydrate)
                Hydrate();
        }
        protected AbstractEditorController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {
            //Locate the editor attribute
            var editorAttributes = GetType()
                                   .GetCustomAttributes(typeof(EditorAttribute), false)
                                   .OfType <EditorAttribute>();

            if (!editorAttributes.Any())
            {
                throw new InvalidOperationException("The Editor controller is missing the " + typeof(EditorAttribute).FullName + " attribute");
            }

            //assign the properties of this object to those of the metadata attribute
            var attr = editorAttributes.First();

            EditorId = attr.Id;
        }
Пример #34
0
        public PackageLogger(IBackOfficeRequestContext context, HttpContextBase httpContext, IPackage package,
                             bool autoHydrate = false)
        {
            _context     = context;
            _httpContext = httpContext;
            _package     = package;

            var packageFolderName = _context.PackageContext.LocalPathResolver.GetPackageDirectory(_package);
            var packageFolderPath = Path.Combine(_context.Application.Settings.PluginConfig.PluginsPath, "Packages", packageFolderName);
            var logFilePath       = Path.Combine(packageFolderPath, "Log.json");

            _absoluteLogFilePath = _httpContext.Server.MapPath(logFilePath);

            _entries = new List <PackageLogEntry>();

            if (autoHydrate)
            {
                Hydrate();
            }
        }
Пример #35
0
        protected TreeController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {

            //Locate the tree attribute
            var treeAttributes = GetType()
                .GetCustomAttributes(typeof(TreeAttribute), false)
                .OfType<TreeAttribute>();

            if (!treeAttributes.Any())
            {
                throw new InvalidOperationException("The Tree controller is missing the " + typeof(TreeAttribute).FullName + " attribute");
            }

            //assign the properties of this object to those of the metadata attribute
            var attr = treeAttributes.First();
            TreeId = attr.Id;
            NodeDisplayName = attr.TreeTitle;
            NodeCollection = new TreeNodeCollection();
        }
Пример #36
0
        protected TreeController(IBackOfficeRequestContext requestContext)
            : base(requestContext)
        {
            //Locate the tree attribute
            var treeAttributes = GetType()
                                 .GetCustomAttributes(typeof(TreeAttribute), false)
                                 .OfType <TreeAttribute>();

            if (!treeAttributes.Any())
            {
                throw new InvalidOperationException("The Tree controller is missing the " + typeof(TreeAttribute).FullName + " attribute");
            }

            //assign the properties of this object to those of the metadata attribute
            var attr = treeAttributes.First();

            TreeId          = attr.Id;
            NodeDisplayName = attr.TreeTitle;
            NodeCollection  = new TreeNodeCollection();
        }
        public override IEnumerable<MacroParameter> GetMacroParameters(
            IBackOfficeRequestContext backOfficeRequestContext, 
            MacroDefinition macroDefinition)
        {
            MethodInfo childAction;
            var surfaceController = macroDefinition.GetSurfaceMacroChildAction(backOfficeRequestContext.RegisteredComponents, out childAction);
            //now we need to get all of the parameters from the method info object
            var parameters = childAction.GetParameters();
            if (parameters.Any(x => x.IsOut || x.IsRetval || x.IsLcid))
            {
                //localize this exception since it wil be displayed in the UI
                throw new InvalidOperationException("Macro.ParamsFailedSurfaceAction.Message".Localize());
            }

            return childAction.GetParameters()
                                            .OrderBy(x => x.Position)
                                            .Select(x => new MacroParameter()
                                            {
                                                ParameterName = x.Name
                                                //TODO: Figure out how to automatically select which macro parameter editor to use
                                            });
        }
Пример #38
0
        /// <summary>
        /// Returns the PartialView Macro parameters
        /// </summary>
        /// <param name="backOfficeRequestContext"></param>
        /// <param name="macroDefinition"></param>
        /// <returns></returns>
        /// <remarks>
        /// Partial view macro parameters are determined by getting an instance of the partial view and looking for it's publicly declared
        /// properties which are done by declaring a region in Razor like so:
        /// @functions {
        ///   public int Age {get;set;}
        /// }
        /// </remarks>
        public override IEnumerable <MacroParameter> GetMacroParameters(IBackOfficeRequestContext backOfficeRequestContext, MacroDefinition macroDefinition)
        {
            using (var uow = backOfficeRequestContext.Application.Hive.OpenReader <IFileStore>(new Uri("storage://templates")))
            {
                var partialView = uow.Repositories.Get <File>(new HiveId("MacroPartials/" + macroDefinition.SelectedItem));
                if (partialView == null)
                {
                    //localize this exception since it wil be displayed in the UI
                    throw new InvalidOperationException("Macro.ParamsFailedPartialView.Message".Localize());
                }

                var partialMacro = BuildManager.CreateInstanceFromVirtualPath(partialView.RootRelativePath, typeof(PartialViewMacroPage));

                return(partialMacro.GetType()
                       .GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
                       .Select(x => new MacroParameter
                {
                    ParameterName = x.Name
                                    //TODO: Implement way of detecting which macro param editor to use
                }));
            }
        }
Пример #39
0
        public override IEnumerable <MacroParameter> GetMacroParameters(
            IBackOfficeRequestContext backOfficeRequestContext,
            MacroDefinition macroDefinition)
        {
            MethodInfo childAction;
            var        surfaceController = macroDefinition.GetSurfaceMacroChildAction(backOfficeRequestContext.RegisteredComponents, out childAction);
            //now we need to get all of the parameters from the method info object
            var parameters = childAction.GetParameters();

            if (parameters.Any(x => x.IsOut || x.IsRetval || x.IsLcid))
            {
                //localize this exception since it wil be displayed in the UI
                throw new InvalidOperationException("Macro.ParamsFailedSurfaceAction.Message".Localize());
            }

            return(childAction.GetParameters()
                   .OrderBy(x => x.Position)
                   .Select(x => new MacroParameter()
            {
                ParameterName = x.Name
                                //TODO: Figure out how to automatically select which macro parameter editor to use
            }));
        }
        /// <summary>
        /// Ensures that the code delegate for the filter is in the CodeDelegatesCollection
        /// </summary>
        /// <param name="backOfficeRequestContext"></param>
        /// <param name="dataTypeId"></param>
        /// <param name="blockType"></param>
        /// <param name="codedelegate"> </param>
        /// <returns></returns>
        private static string SetupCodeDelegate(
            IBackOfficeRequestContext backOfficeRequestContext,
            HiveId dataTypeId,
            CSharpCodeBlockType blockType,
            Func <object, string, string> codedelegate)
        {
            var delegateParameter = new Tuple <HiveId, CSharpCodeBlockType>(dataTypeId, blockType);

            //first, check if we have this registered (multiple ids may exist for the same delegate, but in thsi case it will never be true)
            var ids = CodeDelegateVirtualPath.GetVirtualPathIdsForDelegate(delegateParameter).ToArray();

            if (ids.Any())
            {
                return(ids.First());
            }

            //need to lookup the data type to get its alias as we'll use this for the path
            using (var uow = backOfficeRequestContext.Application.Hive.OpenReader <IContentStore>())
            {
                var dt = uow.Repositories.Schemas.Get <AttributeType>(true, dataTypeId).SingleOrDefault();
                if (dt == null)
                {
                    throw new InvalidOperationException("Could not find AttributeType with id " + dataTypeId);
                }
                //create a unique path for our object which will be used in the virtual path creation, if we don't set this
                //then the ToString of the object key will be used which is much harder to debug.
                var path = dt.Alias + "_" + delegateParameter.Item2 + "_"
                           + delegateParameter.GetHashCode().ToString().Replace("-", "0"); //only alphanumeric chars allowed
                var virtualPathId = CodeDelegateVirtualPath.GetOrCreateVirtualPathId(delegateParameter, path);

                //add the delegate to the collection
                CodeDelegatesCollection.TryAdd(virtualPathId, codedelegate);

                return(virtualPathId);
            }
        }
 public InsertMediaController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
 public DefineSectionEditorController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 { }
 public SystemInfoEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
Пример #44
0
 public LanguageTreeController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
 protected SupportsEditorTreeController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
Пример #46
0
 public BlahSurfaceController(IBackOfficeRequestContext routableRequestContext)
     : base(routableRequestContext) { }
 public LanguageEditorController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 { }
Пример #48
0
 protected BackOfficeController(IBackOfficeRequestContext requestContext)
 {
     BackOfficeRequestContext = requestContext;
     Notifications = new ClientNotifications(ControllerContext);
     ActionInvoker = new RebelBackOfficeActionInvoker(requestContext);
 }
 public DocumentTypeEditorController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
Пример #50
0
 public TemplateTreeController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 { }
Пример #51
0
 public SortController(IBackOfficeRequestContext backOfficeRequestContext)
     : base(backOfficeRequestContext)
 {
 }
Пример #52
0
        /// <summary>
        /// Returns all of the PartialViews that can be used for Macros, including all partial views existing in the standard
        /// Umbraco partials folder and also the ones found inside of packages.
        /// </summary>
        /// <param name="backOfficeRequestContext"></param>
        /// <returns></returns>
        /// <remarks>
        /// Package PartialViews will be prefixed with the Package name '.'
        /// </remarks>
        public override IEnumerable <SelectListItem> GetMacroItems(IBackOfficeRequestContext backOfficeRequestContext)
        {
            using (var uow = backOfficeRequestContext.Application.Hive.OpenReader <IFileStore>(new Uri("storage://macro-partials")))
            {
                //Get all the partial views in the standard Umbraco partials folder
                var partialViews = uow.Repositories.GetLazyDescendentRelations(new HiveId(new Uri("storage://macro-partials"), "", new HiveIdValue("")), FixedRelationTypes.DefaultRelationType)
                                   .Where(x => !((File)x.Destination).IsContainer)
                                   .Select(x => new
                {
                    RootRelativePath = ((File)x.Destination).RootRelativePath,
                    Value            = ((File)x.Destination).GetFilePathWithoutExtension(),
                    Name             = ((File)x.Destination).GetFilePathForDisplay(),
                    PackageName      = ""
                })
                                   .ToList();

                var views = new Dictionary <string, string>();

                //Now find all the partial views in the Packages folder's
                var packageFolders = backOfficeRequestContext.PackageContext.LocalPackageManager.FileSystem.GetDirectories(
                    backOfficeRequestContext.PackageContext.LocalPackageManager.LocalRepository.Source)
                                     .ToArray();
                foreach (var p in packageFolders)
                {
                    var partialsPath = Path.Combine(p, "Views", "MacroPartials");
                    if (backOfficeRequestContext.PackageContext.LocalPackageManager.FileSystem.DirectoryExists(partialsPath))
                    {
                        foreach (var v in backOfficeRequestContext.PackageContext.LocalPackageManager.FileSystem.GetFiles(partialsPath, "*.cshtml"))
                        {
                            var viewName = Path.GetFileNameWithoutExtension(v);
                            var viewPath = backOfficeRequestContext.Application.Settings.PluginConfig.PluginsPath.TrimEnd('/')
                                           + "/" + PluginManager.PackagesFolderName + "/" + v.Replace("\\", "/");
                            //prefix the view name with the package name (area)
                            partialViews.Add(new
                            {
                                RootRelativePath = viewPath,
                                Value            = string.Format("{0}-{1}", p, viewName),
                                Name             = string.Format("{0}-{1}", p, viewName),
                                PackageName      = p
                            });
                        }
                    }
                }

                foreach (var p in partialViews)
                {
                    try
                    {
                        var partialMacro = BuildManager.CreateInstanceFromVirtualPath(p.RootRelativePath, typeof(PartialViewMacroPage));
                        views.Add(p.Name, p.Value);
                    }
                    catch (HttpException)
                    {
                        //swallow this exception, this occurs when the partial view doesn't inherit from PartialViewMacro
                    }
                }

                return(views.ToArray().Select(x => new SelectListItem {
                    Text = x.Key, Value = x.Value
                }));
            }
        }
Пример #53
0
 public abstract bool IsMatch(IBackOfficeRequestContext requestContext, TypedEntity entity);
  public InsertMacroEditorController(IBackOfficeRequestContext requestContext) 
     : base(requestContext)
 { }
 public DataTypeTreeController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {
 }
Пример #56
0
 protected AbstractUserGroupTree(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 { }
Пример #57
0
 public MediaTreeController(IBackOfficeRequestContext requestContext)
     : base(requestContext) { }
Пример #58
0
 public PublicAccessController(IBackOfficeRequestContext backOfficeRequestContext)
     : base(backOfficeRequestContext)
 { }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectedTemplateEditor"/> class.
 /// </summary>
 /// <param name="backOfficeRequestContext">The back office request context.</param>
 public SelectedTemplateEditor(IBackOfficeRequestContext backOfficeRequestContext)
 {
     Mandate.ParameterNotNull(backOfficeRequestContext, "backOfficeRequestContext");
     _backOfficeRequestContext = backOfficeRequestContext;
 }
Пример #60
0
 /// <summary>
 /// 
 /// </summary>
 public DefaultController(IBackOfficeRequestContext requestContext)
     : base(requestContext)
 {            
     _menuItems = requestContext.RegisteredComponents.MenuItems;         
 }