Example #1
0
        public void SaveMember()
        {
            Group group = ctx.owner.obj as Group;

            String action = ctx.Post("action");
            String ids    = ctx.Post("choice");

            if ((strUtil.IsNullOrEmpty(action) || !cvt.IsIdListValid(ids)))
            {
                echoText("error");
                return;
            }

            if (action.Equals("pass"))
            {
                mgrService.ApproveUser(ctx.owner.obj as Group, ids);
                log(SiteLogString.ApproveUser(), group, ids);
                echoAjaxOk();
            }

            else if (action.Equals("deletetrue"))
            {
                mgrService.DeleteUser(ctx.owner.obj as Group, ids);
                log(SiteLogString.DeleteUser(), group, ids);
                echoAjaxOk();
            }
            else if (action.Equals("addadmin"))
            {
                mgrService.AddOfficer(ctx.owner.obj as Group, ids);
                log(SiteLogString.AddOfficer(), group, ids);
                echoAjaxOk();
            }
            else if (action.Equals("deleteadmin"))
            {
                if (mgrService.GetOfficer(ctx.owner.Id).Count == 1)
                {
                    echoError(lang("exDeleteOnlyGroupAdmin"));
                    return;
                }

                mgrService.RemoveOfficer(ctx.owner.obj as Group, ids);
                log(SiteLogString.RemoveOfficer(), group, ids);
                echoAjaxOk();
            }
            else
            {
                content("error");
            }
        }