Ejemplo n.º 1
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 ) );
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 跳转页面到指定 action
 /// </summary>
 /// <param name="action"></param>
 /// <param name="id"></param>
 public void redirect(string action, long id)
 {
     redirectUrl(Link.To(ctx.owner.obj, LinkHelper.GetControllerName(base.GetType()), action, id));
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 跳转页面到指定 action
 /// </summary>
 /// <param name="action"></param>
 public void redirect(aAction action)
 {
     redirectUrl(Link.To(action));
 }
Ejemplo n.º 4
0
 public String T2(aActionWithId action, int id)
 {
     return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, id, 0));
 }
Ejemplo n.º 5
0
        //---------------------------------------------------------------------------

        public String T2(aAction action)
        {
            return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, 0, 0));
        }
Ejemplo n.º 6
0
 public String To(aAction action, int appId)
 {
     return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, -1, appId));
 }
Ejemplo n.º 7
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 ) );
            }
        }
Ejemplo n.º 8
0
 public String To(aActionWithId action, long id, long appId)
 {
     return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, id, appId));
 }