예제 #1
0
        public override void UpdateCache( MvcContext ctx )
        {
            String url = new Link( ctx ).T2( Site.Instance, new Blog.MainController().Index );

            logger.Info( "update blogMain page=" + url );

            base.updateAllUrl( url, ctx, Site.Instance );
        }
예제 #2
0
        private void initEditorUploadPath( MvcContext ctx )
        {
            if (ctx.viewer.IsLogin) {

                Link lnk = new Link( ctx );
                // 此处使用onwer,避免二级域名下的跨域问题
                ctx.SetItem( "editorUploadUrl", lnk.To( ctx.owner.obj, "Users/UserUpload", "UploadForm", -1, -1 ) );
                ctx.SetItem( "editorMyPicsUrl", lnk.To( ctx.owner.obj, "Users/UserUpload", "MyPics", -1, -1 ) );
            }
        }
예제 #3
0
 public override void UpdateCache( wojilu.Web.Context.MvcContext ctx )
 {
     String url = new Link( ctx ).T2( Site.Instance, new Photo.MainController().Index );
     base.updateAllUrl( url, ctx, Site.Instance );
 }
예제 #4
0
 internal void setContext( MvcContext wctx )
 {
     ctx = wctx;
     Link = new Link( wctx );
     errors = wctx.errors;
     _utils = new ControllerCore( this );
 }
예제 #5
0
        //-------------------------------- viewer ----------------------------------
        public void InitViewer( MvcContext ctx )
        {
            ctx.setCacheCondition( new CacheCondition() );

            CurrentRequest.setItem( "_user_factory", new UserFactory() );

            User user = this.getViewer( ctx );

            if (user.Id == UserFactory.Guest.Id && ctx.web.UserIsLogin) {
                signOut( ctx );
                return;
            }
            else if (user.Status == MemberStatus.Deleted || user.Status == MemberStatus.Approving) {
                signOut( ctx );
                return;
            }

            if (ctx.web.UserIsLogin) loginService.UpdateLastLogin( user, ctx.Ip );

            ViewerContext context = new ViewerContext();
            context.Id = user.Id;
            context.obj = user;
            context.IsLogin = ctx.web.UserIsLogin;
            ctx.utils.setViewerContext( context );

            // 编辑器
            if (context.IsLogin) {
                Link lnk = new Link( ctx );
                ctx.SetItem( "editorUploadUrl", lnk.To( user, "Users/Admin/UserUpload", "UploadForm", -1, -1 ) );
                ctx.SetItem( "editorMyPicsUrl", lnk.To( user, "Users/Admin/UserUpload", "MyPics", -1, -1 ) );
            }
        }