Inheritance: ViewEngineBase, IBooViewEngine
		public void Execute(IWikiRepository repository, WikiBuilderTask task, IConsoleLogHost logger) {
			this.brail = new BooViewEngine();
			brail.Options = new MonoRailViewEngineOptions();
			brail.Options.BaseType = "Castle.MonoRail.Views.Brail.WikiBrailBase";
			this.render = new WikiRender();
			var srcpages = new List<WikiPage>();
			foreach (var src in task.Sources)
			{
				foreach (var p in repository.Search(src))
				{
					srcpages.Add(p);
				}

			}
			foreach (var target in task.Targets) {
				var outfile = myapp.files.Resolve(target,false);
				
				var parameters = new Dictionary<string, object>()
				                 	{
				                 		{"task", task},
				                 		{"logger", logger},
				                 		{"repository", repository},
				                 		{"render", render},
				                 		{"pages", srcpages.ToArray()},
				                 	};
				var sw = new StringWriter();
				 brail.Process(task.View,task.Layout,sw, parameters);
				File.WriteAllText(outfile,sw.ToString());

			}
		}
示例#2
0
		/// <summary>
		/// Initializes a new instance of the <see cref="BrailBase"/> class.
		/// </summary>
		/// <param name="viewEngine">The view engine.</param>
		/// <param name="output">The output.</param>
		/// <param name="context">The context.</param>
		/// <param name="__controller">The controller.</param>
		public BrailBase(BooViewEngine viewEngine, TextWriter output, IRailsEngineContext context, Controller __controller)
		{
			this.viewEngine = viewEngine;
			this.outputStream = output;
			this.context = context;
			this.__controller = __controller;
			InitProperties(context, __controller);
		}
示例#3
0
		/// <summary>
		/// Initializes a new instance of the <see cref="BrailBase"/> class.
		/// </summary>
		/// <param name="viewEngine">The view engine.</param>
		/// <param name="output">The output.</param>
		/// <param name="context">The context.</param>
		/// <param name="__controller">The controller.</param>
		/// <param name="__controllerContext">The __controller context.</param>
		public BrailBase(BooViewEngine viewEngine, TextWriter output,
		                 IEngineContext context, IController __controller, IControllerContext __controllerContext)
		{
			this.viewEngine = viewEngine;
			outputStream = output;
			this.context = context;
			this.__controller = __controller;
			this.__controllerContext = __controllerContext;
			InitProperties(context, __controller, __controllerContext);
		}
示例#4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BrailBase"/> class.
 /// </summary>
 /// <param name="viewEngine">The view engine.</param>
 /// <param name="output">The output.</param>
 /// <param name="context">The context.</param>
 /// <param name="__controller">The controller.</param>
 /// <param name="__controllerContext">The __controller context.</param>
 public BrailBase(BooViewEngine viewEngine, TextWriter output,
                  IEngineContext context, IController __controller, IControllerContext __controllerContext)
 {
     this.viewEngine          = viewEngine;
     outputStream             = output;
     this.context             = context;
     this.__controller        = __controller;
     this.__controllerContext = __controllerContext;
     InitProperties(context, __controller, __controllerContext);
 }
示例#5
0
 public void RenderLayouts(BooViewEngine booViewEngine, BrailBase view)
 {
     foreach (var layout in layouts)
     {
         try
         {
             layout.SetParent(view);
             layout.Run();
             view = layout;
         }
         catch (Exception e)
         {
             booViewEngine.HandleException(layout.ViewFileName, layout, e);
         }
     }
 }
        protected BooViewEngine getBrail(Controller controller){
            if (null == Engine){
                var eng = new BooViewEngine(); eng.Initialize();
                eng.Options.SaveToDisk = false;
				eng.Options.BaseType = typeof(BrailBase).FullName;
                eng.Options.CommonScriptsDirectory = "CommonScripts";
                eng.Options.SaveDirectory = controller.Context.Server.MapPath("~/tmp/ioc.getreport");
                eng.ViewFactory = new MONORAILBrailTypeFactory(new BrailSourceResolver {Identity = "reportpreparator"},eng.Options);

                var source = new FileAssemblyViewSourceLoader(controller.Context.Server.MapPath("~/usr/views"));

                source.AddPathSource(controller.Context.Server.MapPath("~/mod/views"));
                source.AddPathSource(controller.Context.Server.MapPath("~/sys/views"));


                eng.SetViewSourceLoader(source);
                eng.Initialize();

                source.ViewChanged += _ViewChanged;
                Engine = eng;
            }
            return Engine;
        }
示例#7
0
			public void RenderLayouts(BooViewEngine booViewEngine, BrailBase view)
			{
				foreach(BrailBase layout in layouts)
				{
					try
					{
						layout.SetParent(view);
						layout.Run();
						view = layout;
					}
					catch(Exception e)
					{
						booViewEngine.HandleException(layout.ViewFileName, layout, e);
					}
				}
			}
		public BooViewEngineAdapterForQWeb() {
			this.engine = new BooViewEngine();
		}
		public BrailPreProcessor(BooViewEngine booViewEngine)
		{
			this.booViewEngine = booViewEngine;
		}
示例#10
0
	    public BooViewEngine()
		{
            //think about trusted env
            //TODO: AVOID OBSOLETE
			useFastCreateInstance = true; //SecurityManager.IsGranted(new SecurityPermission(SecurityPermissionFlag.SerializationFormatter));
            this.Statistics = new ViewStatisticsCollection();
            if(null==FirstInstance) {
                FirstInstance = this;
            }
	        UseFactory = true;
	    }
示例#11
0
 public DummySubView(BooViewEngine viewEngine, TextWriter output, IEngineContext context, Controller controller, IControllerContext controllerContext) : base(viewEngine, output, context, controller, controllerContext)
 {
 }
示例#12
0
 public BrailPreProcessor(BooViewEngine booViewEngine)
 {
     this.booViewEngine = booViewEngine;
 }
示例#13
0
 public MyBrailBase(BooViewEngine viewEngine, TextWriter output, IEngineContext context, IController __controller, IControllerContext __controllerContext) : base(viewEngine, output, context, __controller, __controllerContext) {}