Esempio n. 1
0
    /*==========================================================================================================================
    | CONSTRUCTOR
    \-------------------------------------------------------------------------------------------------------------------------*/
    /// <summary>
    ///   Initializes a new instance of <see cref="TopicViewEngine"/>.
    /// </summary>
    /// <remarks>
    ///   When instantiated, the <see cref="TopicViewEngine.TopicViewEngine"/> constructor will initialize location formats with
    ///   extensions intended to support organizing views by <see cref="Topic.ContentType"/>.
    /// </remarks>
    public TopicViewEngine(IViewPageActivator viewPageActivator = null) : base(viewPageActivator) {

      /*------------------------------------------------------------------------------------------------------------------------
      | Define view location
      >-------------------------------------------------------------------------------------------------------------------------
      | Supports the following replacement tokens: {0} Controller, {1} View, {2} Area, and {3} Content Type.
      \-----------------------------------------------------------------------------------------------------------------------*/
      var viewLocations = new[] {
        "~/Views/{3}/{1}.cshtml",
        "~/Views/ContentTypes/{3}.{1}.cshtml",
        "~/Views/ContentTypes/{1}.cshtml",
        "~/Views/Shared/{1}.cshtml",
      };

      /*------------------------------------------------------------------------------------------------------------------------
      | Set view locations
      \-----------------------------------------------------------------------------------------------------------------------*/
      ViewLocationFormats = ViewLocationFormats.Union(viewLocations).ToArray();
      MasterLocationFormats = MasterLocationFormats.Union(viewLocations).ToArray();
      PartialViewLocationFormats = PartialViewLocationFormats.Union(viewLocations).ToArray();

      /*------------------------------------------------------------------------------------------------------------------------
      | Update view locations for areas
      \-----------------------------------------------------------------------------------------------------------------------*/
      viewLocations = viewLocations.Select(v => v.Replace("~", "~/{2}/")).ToArray();

      /*------------------------------------------------------------------------------------------------------------------------
      | Set area view locations
      \-----------------------------------------------------------------------------------------------------------------------*/
      AreaViewLocationFormats = AreaViewLocationFormats.Union(viewLocations).ToArray();
      AreaMasterLocationFormats = AreaMasterLocationFormats.Union(viewLocations).ToArray();
      AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(viewLocations).ToArray();

    }
 public EpiserverFormsWebFormViewEngine()
 {
     AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(new[]
     {
         "~/Areas/{2}/Views/Shared/ElementBlocks/{0}.ascx"
     }).ToArray();
 }
Esempio n. 3
0
 public EPiServerViewEngine()
 {
     this.PartialViewLocationFormats     = PartialViewLocationFormats.Union(ViewFormats).ToArray();
     this.ViewLocationFormats            = ViewLocationFormats.Union(ViewFormats).ToArray();
     this.AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(AreaViewFormats).ToArray();
     this.AreaViewLocationFormats        = AreaViewLocationFormats.Union(AreaViewFormats).ToArray();
     this.AreaMasterLocationFormats      = AreaMasterViewFormats.Union(AreaMasterViewFormats).ToArray();
     this.MasterLocationFormats          = MasterLocationFormats.Union(MasterViewFormats).ToArray();
 }
        private void Initialize()
        {
            MasterLocationFormats      = MasterLocationFormats.CSharpHtmlOnly();
            ViewLocationFormats        = ViewLocationFormats.CSharpHtmlOnly();
            PartialViewLocationFormats = PartialViewLocationFormats.CSharpHtmlOnly();

            AreaMasterLocationFormats      = AreaMasterLocationFormats.CSharpHtmlOnly();
            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.CSharpHtmlOnly();
            AreaViewLocationFormats        = AreaViewLocationFormats.CSharpHtmlOnly();
        }
Esempio n. 5
0
 public CsRazorViewEngine(IViewPageActivator viewPageActivator)
     : base(viewPageActivator)
 {
     AreaViewLocationFormats        = AreaViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     AreaMasterLocationFormats      = AreaMasterLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     ViewLocationFormats            = ViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     MasterLocationFormats          = MasterLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     PartialViewLocationFormats     = PartialViewLocationFormats.Where(f => f.EndsWith("cshtml")).ToArray();
     FileExtensions = FileExtensions.Where(f => f.EndsWith("cshtml")).ToArray();
 }
        public SiteViewEngine()
        {
            PartialViewLocationFormats = PartialViewLocationFormats.Union(AdditionalPartialViewFormats).ToArray();

            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats
                                             .Union(new[]
            {
                "~/Areas/{2}/Views/Shared/{0}.cshtml",
                "~/Areas/{2}/Views/Shared/Blocks/{0}.cshtml"
            }).ToArray();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Employment.Web.Mvc.Infrastructure.ViewEngines.CsRazorViewEngine" /> class.
        /// </summary>
        public CsRazorViewEngine()
        {
            const string extension = "cshtml";

            // Only include the cshtml type in location formats and file extensions
            AreaViewLocationFormats        = AreaViewLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            AreaMasterLocationFormats      = AreaMasterLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            ViewLocationFormats            = ViewLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            MasterLocationFormats          = MasterLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            PartialViewLocationFormats     = PartialViewLocationFormats.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
            FileExtensions = FileExtensions.Where(s => s.EndsWith(extension, StringComparison.Ordinal)).ToArray();
        }
Esempio n. 8
0
        public L24ViewEngine()
        {
            var addLocations = new[]
            {
                "~/Areas/L24CM/Views/Shared/{0}.aspx",
                "~/Areas/L24CM/Views/Shared/{0}.ascx"
            };

            ViewLocationFormats        = ViewLocationFormats.Concat(addLocations).ToArray();
            PartialViewLocationFormats = PartialViewLocationFormats.Concat(addLocations).ToArray();

            AreaViewLocationFormats        = AreaViewLocationFormats.Concat(addLocations).ToArray();
            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Concat(addLocations).ToArray();
        }
Esempio n. 9
0
        public PartialsSubfolderViewEngine()
        {
            Contract.Assume(PartialViewLocationFormats != null);
            Contract.Assume(AreaPartialViewLocationFormats != null);

            var newLocationFormat = new[]
            {
                "~/Views/{1}/Partials/{0}.cshtml",
            };

            var newAreaLocationFormat = new[]
            {
                "~/Areas/{2}/Views/{1}/Partials/{0}.cshtml",
            };

            PartialViewLocationFormats     = PartialViewLocationFormats.Union(newLocationFormat).ToArray();
            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Union(newAreaLocationFormat).ToArray();
        }
Esempio n. 10
0
        public MyWebFormViewEngine()
            : base()
        {
            MasterLocationFormats = new[] {
                "~/Views/%1/{1}/{0}.master",
                "~/Views/%1/Shared/{0}.master"
            };

            AreaMasterLocationFormats = new[] {
                "~/Areas/{2}/Views/%1/{1}/{0}.master",
                "~/Areas/{2}/Views/%1/Shared/{0}.master",
            };

            ViewLocationFormats = new[] {
                "~/Views/%1/{1}/{0}.aspx",
                "~/Views/%1/{1}/{0}.ascx",
                "~/Views/%1/Shared/{0}.aspx",
                "~/Views/%1/Shared/{0}.ascx"
            };

            AreaViewLocationFormats = new[] {
                "~/Areas/{2}/Views/%1/{1}/{0}.aspx",
                "~/Areas/{2}/Views/%1/{1}/{0}.ascx",
                "~/Areas/{2}/Views/%1/Shared/{0}.aspx",
                "~/Areas/{2}/Views/%1/Shared/{0}.ascx",
            };

            PartialViewLocationFormats     = ViewLocationFormats;
            AreaPartialViewLocationFormats = AreaViewLocationFormats;

            var addLocations = new[]
            {
                "~/Views/%1/{0}.aspx",
                "~/Views/%1/{0}.ascx"
            };


            ViewLocationFormats        = ViewLocationFormats.Concat(addLocations).ToArray();
            PartialViewLocationFormats = PartialViewLocationFormats.Concat(addLocations).ToArray();

            AreaViewLocationFormats        = AreaViewLocationFormats.Concat(addLocations).ToArray();
            AreaPartialViewLocationFormats = AreaPartialViewLocationFormats.Concat(addLocations).ToArray();
        }