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 ) ); } }
/// <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)); }
/// <summary> /// 跳转页面到指定 action /// </summary> /// <param name="action"></param> public void redirect(aAction action) { redirectUrl(Link.To(action)); }
public String T2(aActionWithId action, int id) { return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, id, 0)); }
//--------------------------------------------------------------------------- public String T2(aAction action) { return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, 0, 0)); }
public String To(aAction action, int appId) { return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, -1, appId)); }
//-------------------------------- 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 ) ); } }
public String To(aActionWithId action, long id, long appId) { return(Link.To(_owner, getController(action.Target.GetType()), action.Method.Name, id, appId)); }