public ForumCacheRemove( IForumBoardService bds, IForumTopicService topicService, ControllerBase ctx )
 {
     this.controller = ctx;
     this.boardService = bds;
     this.owner = ctx.ctx.owner.obj;
     this.topicService = topicService;
 }
Beispiel #2
0
        public static void loadTemplate( ControllerBase controller, ContentSection s, IContentCustomTemplateService ctService )
        {
            if (s.CustomTemplateId <= 0) return;

            ContentCustomTemplate ct = ctService.GetById( s.CustomTemplateId, controller.ctx.owner.Id );
            if (ct == null) return;

            controller.viewContent( ct.Content );
        }
        public static Boolean Check( ControllerBase controller, ISecurity objSecurity ) {
            MvcContext ctx = controller.ctx;
            if (!hasAction( objSecurity, ctx )) {
                controller.echo( lang.get( "exNoPermission" ) );
                return false;
            }

            return true;
        }
Beispiel #4
0
        public static void BindPhotoList(ControllerBase controller, DataPage<PhotoPost> list, long userId) {

            IBlock block = controller.getBlock( "list" );

            List<long> likedIds = GetLikedIds( list.Results, userId );

            foreach (PhotoPost x in list.Results) {
                PhotoBinder.BindPostSingle( controller.ctx, block, x, likedIds );
                block.Next();
            }

            controller.set( "page", list.PageBar );
        }
Beispiel #5
0
        private static CacheInfo InitLayout( MvcContext ctx, ControllerBase controller, Boolean isLayout )
        {
            CacheInfo ci = new CacheInfo();

            if (MvcConfig.Instance.IsActionCache == false) return ci;

            // 模拟的context环境下,不缓存
            if (ctx.web.GetType() != typeof( WebContext )) return ci;

            ci._actionName = isLayout ? "Layout" : ctx.route.action;

            IActionCache actionCache = ControllerMeta.GetActionCache( controller.GetType(), ci._actionName );
            ci.initCacheKey( actionCache, ctx );

            return ci;
        }
        private static ActionCacheChecker initPrivate( MvcContext ctx, ControllerBase controller, Boolean isLayout )
        {
            ActionCacheChecker x = new ActionCacheChecker();

            if (MvcConfig.Instance.IsActionCache == false) return x;

            // 模拟的context环境下,不缓存
            if (ctx.web.GetType() != typeof( WebContext )) return x;

            x._actionName = isLayout ? "Layout" : ctx.route.action;

            ActionCache actionCache = ControllerMeta.GetActionCacheAttr( controller.GetType(), x._actionName );
            x.initCacheKey( actionCache, ctx );

            return x;
        }
Beispiel #7
0
 public static CacheInfo InitLayout( MvcContext ctx, ControllerBase controller )
 {
     return InitLayout( ctx, controller, true );
 }
Beispiel #8
0
 /// <summary>
 /// 合并需要隐藏的 LayoutController
 /// </summary>
 /// <param name="hidedCcontroller"></param>
 internal void addHidedLayouts(ControllerBase hidedCcontroller)
 {
     controller.hidedLayouts.AddRange(hidedCcontroller.hidedLayouts);
 }
 public ForumCacheRemove( IForumBoardService bds, ControllerBase controller )
 {
     this.controller = controller;
     this.boardService = bds;
     this.owner = controller.ctx.owner.obj;
 }
Beispiel #10
0
 public BlogCache( ControllerBase controller )
 {
     base.controller = controller;
     base.owner = controller.ctx.owner.obj;
 }
Beispiel #11
0
 public ControllerCore( ControllerBase c )
 {
     controller = c;
     ctx = c.ctx;
 }
Beispiel #12
0
 /// <summary>
 /// 合并需要隐藏的 LayoutController
 /// </summary>
 /// <param name="hidedCcontroller"></param>
 internal void addHidedLayouts( ControllerBase hidedCcontroller )
 {
     controller.hidedLayouts.AddRange( hidedCcontroller.hidedLayouts );
 }
Beispiel #13
0
 public ControllerCore(ControllerBase c)
 {
     controller = c;
     ctx        = c.ctx;
 }
Beispiel #14
0
 /// <summary>
 /// 1.8以前的旧方法,暂时保留。新版请直接使用 ctx.Page.SetTitle( item1, item2 ) 设值
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="item1"></param>
 /// <param name="item2"></param>
 public static void pageTitle( ControllerBase controller, String item1, String item2 ) {
     controller.ctx.Page.SetTitle( item1, item2 );
 }
Beispiel #15
0
 public void setController(ControllerBase controller)
 {
     _controller = controller;
 }
 public ContentCacheRemove( ControllerBase controller )
 {
     base.controller = controller;
     base.owner = controller.ctx.owner.obj;
 }
Beispiel #17
0
 /// <summary>
 /// 根据容器配置,将依赖关系注入到已有对象中
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="ctx"></param>
 public static void InjectController( ControllerBase controller, MvcContext ctx )
 {
     if (controller == null) return;
     ObjectContext.Inject( controller );
     controller.setContext( ctx );
     setControllerAppInfo( controller.GetType(), controller );
 }
 public static ActionCacheChecker InitLayout( MvcContext ctx, ControllerBase controller )
 {
     return initPrivate( ctx, controller, true );
 }
Beispiel #19
0
 public static void pageTitle( ControllerBase controller, String item1, String item2 )
 {
     controller.Page.Title = item1 + pageTitleSeparator + item2 + pageTitleSeparator + pageTitlePostfix( controller.ctx );
 }
Beispiel #20
0
 public static void pageTitle( ControllerBase controller, String title )
 {
     controller.Page.Title = title + pageTitleSeparator + pageTitlePostfix( controller.ctx );
 }
Beispiel #21
0
 public static CacheInfo InitLayout(MvcContext ctx, ControllerBase controller)
 {
     return(InitLayout(ctx, controller, true));
 }
Beispiel #22
0
 private static void setControllerAppInfo( Type type, ControllerBase controller )
 {
     // TODO 缓存起app批注
     AppAttribute attribute = ReflectionUtil.GetAttribute( type, typeof( AppAttribute ) ) as AppAttribute;
     if (attribute != null) {
         controller.utils.setAppType( attribute.AppType );
     }
 }
Beispiel #23
0
 /// <summary>
 /// 1.8以前的旧方法,暂时保留。新版请直接使用 ctx.Page.Title = title 设值
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="title"></param>
 public static void pageTitle( ControllerBase controller, String title ) {
     controller.ctx.Page.Title = title;
 }
Beispiel #24
0
 /// <summary>
 /// 设置当前控制器 controller
 /// </summary>
 /// <param name="controller"></param>
 public void setController( ControllerBase controller )
 {
     _currentController = controller;
 }
Beispiel #25
0
 public static ActionCacheChecker InitLayout(MvcContext ctx, ControllerBase controller)
 {
     return(initPrivate(ctx, controller, true));
 }