protected string ProcessViewJS(string templatePath)
        {
            var sw = new StringWriter();

            ControllerContext.LayoutNames          = Layouts;
            EngineContext.CurrentControllerContext = ControllerContext;
            var engineManager = new DefaultViewEngineManager();

            engineManager.RegisterEngineForView(VelocityViewEngine);
            engineManager.RegisterEngineForExtesionLookup((VelocityViewEngine));
            var codeGenerator =
                new JSCodeGenerator(EngineContext.Server,
                                    engineManager,
                                    EngineContext, null, ControllerContext, EngineContext.Services.UrlBuilder);

            IJSGenerator jsGen = new PrototypeGenerator(codeGenerator);

            codeGenerator.JSGenerator = jsGen;

            var info = new JSCodeGeneratorInfo(codeGenerator, jsGen,
                                               new object[] { new ScriptaculousExtension(codeGenerator) },
                                               new object[] { new ScriptaculousExtension(codeGenerator) });

            VelocityViewEngine.GenerateJS(templatePath, sw, info, EngineContext, null, ControllerContext);
            lastOutput = sw.ToString();
            return(lastOutput);
        }
		protected string ProcessViewJS(string templatePath)
		{
			var sw = new StringWriter();
			ControllerContext.LayoutNames = Layouts;
			EngineContext.CurrentControllerContext = ControllerContext;
			var engineManager = new DefaultViewEngineManager();
			engineManager.RegisterEngineForView(VelocityViewEngine);
			engineManager.RegisterEngineForExtesionLookup((VelocityViewEngine));
			var codeGenerator =
				new JSCodeGenerator(EngineContext.Server,
				                    engineManager,
				                    EngineContext, null, ControllerContext, EngineContext.Services.UrlBuilder);

			IJSGenerator jsGen = new PrototypeGenerator(codeGenerator);

			codeGenerator.JSGenerator = jsGen;

			var info = new JSCodeGeneratorInfo(codeGenerator, jsGen,
			                                   new object[] {new ScriptaculousExtension(codeGenerator)},
			                                   new object[] {new ScriptaculousExtension(codeGenerator)});

			VelocityViewEngine.GenerateJS(templatePath, sw, info, EngineContext, null, ControllerContext);
			lastOutput = sw.ToString();
			return lastOutput;
		}
Beispiel #3
0
 public void Init()
 {
     codeGen   = new JSCodeGenerator();
     generator = new PrototypeGenerator(codeGen);
 }