예제 #1
0
        private static String getLayoutCache(int appId, User objOwner)
        {
            MvcContext ctx     = MockContext.GetOne(objOwner, typeof(BlogApp), appId);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Blog.LayoutController().Layout);

            return(content);
        }
예제 #2
0
        private static String getLayoutCache(int appId, User objOwner)
        {
            MvcContext ctx     = MockContext.GetOne(objOwner, appId);
            String     content = ControllerRunner.Run("wojilu.Web.Controller.Blog.LayoutController", "Layout", ctx);

            return(content);
        }
예제 #3
0
        private static string getHomeCache(int appId, User owner)
        {
            MvcContext ctx     = MockContext.GetOne(owner, typeof(BlogApp), appId);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Blog.BlogController().Index);

            return(content);
        }
예제 #4
0
        private static string getMainCache(int appId)
        {
            MvcContext ctx     = MockContext.GetOne(Site.Instance, appId);
            String     content = ControllerRunner.Run("wojilu.Web.Controller.Blog.MainController", "Index", ctx);

            return(content);
        }
예제 #5
0
        private static string getIndexCache(IMember owner, int appId, String viewName)
        {
            MvcContext ctx     = MockContext.GetOne(owner, typeof(ForumApp), appId);
            String     content = ControllerRunner.Run(ctx, typeof(wojilu.Web.Controller.Forum.RecentController).FullName, viewName);

            return(content);
        }
예제 #6
0
        private static string getIndexCache(IMember owner, int appId)
        {
            MvcContext ctx     = MockContext.GetOne(owner, typeof(ForumApp), appId);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Forum.RecentController().Post);

            return(content);
        }
예제 #7
0
        private static string getIndexCache(int appId, IMember owner)
        {
            MvcContext ctx     = MockContext.GetOne(owner, typeof(ContentApp), appId);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Content.ContentController().Index);

            return(content);
        }
예제 #8
0
        private static string getMainCache(int appId)
        {
            MvcContext ctx     = MockContext.GetOne(Site.Instance, typeof(BlogApp), appId);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Blog.MainController().Index);

            return(content);
        }
예제 #9
0
        private static string getHomeCache(int appId, IMember owner)
        {
            MvcContext ctx     = MockContext.GetOne(owner, appId);
            String     content = ControllerRunner.Run(new wojilu.Web.Controller.Content.ContentController().Index, ctx);

            return(content);
        }
예제 #10
0
        private static string getHomeCache(int appId, User owner)
        {
            MvcContext ctx     = MockContext.GetOne(owner, appId);
            String     content = ControllerRunner.Run("wojilu.Web.Controller.Blog.BlogController", "Index", ctx);

            return(content);
        }
예제 #11
0
        /// <summary>
        /// 运行其他 action,并将运行结果作为当前 action 的内容
        /// </summary>
        /// <param name="action"></param>
        /// <param name="id"></param>
        protected void run(aActionWithId action, int id)
        {
            if (ctx.utils.isAjax)
            {
                if (ctx.HasErrors)
                {
                    echoError();
                }
                else
                {
                    echoAjaxOk();
                }
                return;
            }

            if (isSameType(action.Method))
            {
                setView(action.Method);
                action(id);
            }
            else
            {
                //ControllerBase mycontroller = ControllerFactory.FindController( action.Method.DeclaringType, ctx );
                //mycontroller.view( action.Method.Name );
                //action.Method.Invoke( mycontroller, new object[] { id } );
                //actionContent( mycontroller.utils.getActionResult() );

                content(ControllerRunner.Run(ctx, action, id));
            }
        }
예제 #12
0
        /// <summary>
        /// 获取某 action 的内容
        /// </summary>
        /// <param name="action"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public String loadHtml(aActionWithId action, int id)
        {
            String result;

            if (isSameType(action.Method))
            {
                String   actionName   = action.Method.Name;
                Template originalView = utils.getCurrentView();

                setView(action.Method);

                action(id);

                Template resultView = utils.getCurrentView();
                utils.setCurrentView(originalView);
                result = resultView.ToString();
            }
            else
            {
                //ControllerBase targetController = action.Target as ControllerBase;
                //ControllerFactory.InjectController( targetController, ctx );
                //targetController.view( action.Method.Name );
                //action( id );
                //result = targetController.utils.getCurrentView().ToString();

                result = ControllerRunner.Run(ctx, action, id);
            }

            return(result);
        }
예제 #13
0
        private static string getLayoutCache(IMember owner)
        {
            MvcContext ctx     = MockContext.GetOne(owner);
            String     content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.LayoutController().Layout);

            return(content);
        }
예제 #14
0
        private static string getIndexCache(IMember owner, int appId, int boardId, int pageId)
        {
            MvcContext ctx = MockContext.GetOne(owner, typeof(ForumApp), appId);

            ctx.route.setPage(pageId);
            String content = ControllerRunner.Run(ctx, new wojilu.Web.Controller.Forum.BoardController().Show, boardId);

            return(content);
        }
예제 #15
0
        /// <summary>
        /// 运行其他 action,并将运行结果作为当前 action 的内容
        /// </summary>
        /// <param name="action"></param>
        /// <param name="id"></param>
        protected void run(aActionWithId action, long id)
        {
            if (ctx.utils.isAjax)
            {
                if (ctx.HasErrors)
                {
                    echoError();
                }
                else
                {
                    echoAjaxOk();
                }
                return;
            }

            content(ControllerRunner.Run(this, action, id));
        }
예제 #16
0
        /// <summary>
        /// 运行其他 action,并将运行结果作为当前 action 的内容
        /// </summary>
        /// <param name="controllerType">被运行的 action 所属的 controller 类型</param>
        /// <param name="actionName">action 名称</param>
        /// <param name="args">需要的参数</param>
        protected void run(String controllerFullTypeName, String actionName, params object[] args)
        {
            Type controllerType = ObjectContext.Instance.TypeList[controllerFullTypeName];

            if (controllerType == base.GetType())
            {
                view(actionName);
                MethodInfo method = base.GetType().GetMethod(actionName);
                if (method == null)
                {
                    throw new Exception("action " + wojilu.lang.get("exNotFound"));
                }
                else
                {
                    method.Invoke(this, args);
                }
            }
            else
            {
                actionContent(ControllerRunner.Run(ctx, controllerFullTypeName, actionName, args));
            }
        }
예제 #17
0
 /// <summary>
 /// 获取某 action 的内容
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public String loadHtml(String controller, String action)
 {
     return(ControllerRunner.Run(ctx, controller, action));
 }
예제 #18
0
 /// <summary>
 /// 获取某 action 的内容
 /// </summary>
 /// <param name="action"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public string loadHtml(aActionWithId action, long id)
 {
     return(ControllerRunner.Run(this, action, id));
 }
예제 #19
0
 // TODO 在被load的action中,使用showEnd无效
 /// <summary>
 /// 获取某 action 的内容
 /// </summary>
 /// <param name="action"></param>
 /// <returns></returns>
 public String loadHtml(aAction action)
 {
     return(ControllerRunner.Run(this, action));
 }
예제 #20
0
 /// <summary>
 /// 获取某 action 的内容
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="action"></param>
 /// <param name="id"></param>
 /// <returns></returns>
 public string loadHtml(string controller, string action, long id)
 {
     return(ControllerRunner.Run(ctx, controller, action, id));
 }