public virtual void CreateSubmitter() { String name = strUtil.SqlClean(ctx.Post("Name"), 20); if (strUtil.IsNullOrEmpty(name)) { echoError("请填写用户名"); return; } User user = userService.GetByName(name); if (user == null) { echoError("用户不存在"); return; } ContentSubmitter s = new ContentSubmitter(); s.AppId = ctx.app.Id; s.User = user; s.RoleId = ContentSubmitterRole.SubmitterValue; s.insert(); msgService.SiteSend("恭喜您,您已成为本站记者", user.Name + ":<br/><br/>您好!您已被加为本站记者,可以直接投递,不用审核。<br/><br/>感谢您的参与。<br/><br/>" + config.Instance.Site.SiteName + " " + DateTime.Now.ToShortDateString(), user); echoToParentPart(lang("opok")); }
public void CreateSubmitter() { String name = strUtil.SqlClean( ctx.Post( "Name" ), 20 ); if (strUtil.IsNullOrEmpty( name )) { echoError( "请填写用户名" ); return; } User user = userService.GetByName( name ); if (user == null) { echoError( "用户不存在" ); return; } ContentSubmitter s = new ContentSubmitter(); s.AppId = ctx.app.Id; s.User = user; s.RoleId = ContentSubmitterRole.SubmitterValue; s.insert(); msgService.SiteSend( "恭喜您,您已成为本站记者", user.Name + ":<br/><br/>您好!您已被加为本站记者,可以直接投递,不用审核。<br/><br/>感谢您的参与。<br/><br/>" + config.Instance.Site.SiteName+ " " + DateTime.Now.ToShortDateString(), user ); echoToParentPart( lang( "opok" ) ); }
private Boolean shouldApprove(IUser objUser) { User user = (User)objUser; if (SiteRole.IsInAdminGroup(user.RoleId)) { return(false); } ContentSubmitter s = ContentSubmitter.find("User.Id=" + user.Id + " and AppId=" + ctx.app.Id).first(); return(s == null); }
public virtual void DeleteUser(long id) { ContentSubmitter s = ContentSubmitter.findById(id); if (s == null) { echoError(lang("exDataNotFound")); return; } s.delete(); redirect(List); }
// 记者和高级记者一览 public virtual void List() { ContentApp app = ctx.app.obj as ContentApp; ContentSubmitterRole roles = app.GetSubmitterRoleObj(); set("addUrl", to(Add)); DataPage <ContentSubmitter> list = ContentSubmitter.findPage("AppId=" + ctx.app.Id); IBlock block = getBlock("list"); foreach (ContentSubmitter s in list.Results) { block.Bind("s", s); block.Set("s.RoleName", roles.getName(s.RoleId)); block.Set("s.UserLink", toUser(s.User)); block.Set("s.DeleteLink", to(DeleteUser, s.Id)); block.Next(); } set("page", list.PageBar); }
private String getRoleName(int submitCount) { ContentApp app = ctx.app.obj as ContentApp; ContentSubmitterRole sr = app.GetSubmitterRoleObj(); if (SiteRole.IsInAdminGroup(ctx.viewer.obj.RoleId)) { return(sr.Editor); } ContentSubmitter s = ContentSubmitter.find("User.Id=" + ctx.viewer.Id + " and AppId=" + ctx.app.Id).first(); if (s != null) { return(sr.getName(s.RoleId)); } if (submitCount > 0) { return(sr.NeedApproval); } return("无"); }