Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
        }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
 }