Ejemplo n.º 1
0
        public virtual void CreateRank()
        {
            String target = ctx.Post("Name");

            if (strUtil.IsNullOrEmpty(target))
            {
                errors.Add(lang("exName"));
                run(AddRank);
                return;
            }

            int             credit   = ctx.PostInt("Credit");
            List <SiteRank> ranks    = roleService.GetRankAll();
            SiteRank        lastRank = ranks[ranks.Count - 1];

            if (credit <= lastRank.Credit)
            {
                String msg = lang("exRankError");
                errors.Add(string.Format(msg, KeyCurrency.Instance.Name, lastRank.Credit));
                run(AddRank);
                return;
            }

            SiteRank rank = new SiteRank();

            rank.Name   = target;
            rank.Credit = credit;
            roleService.InsertRank(rank);
            log(SiteLogString.InsertSiteRank(), rank);

            echoToParentPart(lang("opok"));
        }
Ejemplo n.º 2
0
        public virtual void Admin()
        {
            String ids = ctx.Post("choice");
            String cmd = ctx.Post("action");

            if (strUtil.IsNullOrEmpty(cmd) || cvt.IsIdListValid(ids) == false)
            {
                echoText(lang("exCmd"));
                return;
            }


            if ("delete".Equals(cmd))
            {
                postService.Delete(ids);
                log(SiteLogString.SystemDeleteContentPost(), ids);
                echoAjaxOk();
            }
            else if ("deletetrue".Equals(cmd))
            {
                postService.DeleteTrue(ids);
                log(SiteLogString.SystemDeleteContentPost(), ids);
                echoAjaxOk();
            }
            else
            {
                echoText(lang("exUnknowCmd"));
            }
        }
Ejemplo n.º 3
0
        public virtual void Update(long id)
        {
            IMenu menu = menuService.FindById(ctx.owner.Id, id);

            if (menu == null)
            {
                echoRedirect(lang("exDataNotFound"));
                return;
            }

            menu = validateMenu(menu);

            if (ctx.HasErrors)
            {
                run(Edit, id);
                return;
            }

            Result result = menuService.Update(menu);

            if (result.HasErrors)
            {
                errors.Join(result);
                run(Edit, id);
                return;
            }

            log(SiteLogString.UpdateMenu(), menu);

            ctx.SetItem("currentMenu", menu);

            echoToParentPart(lang("opok"));
        }
Ejemplo n.º 4
0
        public void Create(int id)
        {
            Page data = validate(new Page());

            if (ctx.HasErrors)
            {
                run(Add, id); return;
            }

            data.Category = new PageCategory {
                Id = id
            };

            populateOwner(data);

            pageService.Insert(data);

            if (ctx.HasErrors)
            {
                run(Add, id); return;
            }


            log(SiteLogString.AddPage(), data);

            golist(data.Category.Id);
        }
Ejemplo n.º 5
0
        public void SavePwd()
        {
            // 1、验证密码是否正确
            String pwd = ctx.Post("Pwd");

            // 2、修改密码
            String      idsStr = ctx.PostIdList("UserIds");
            List <User> users  = userService.GetByIds(idsStr);

            if (users.Count == 0)
            {
                echoRedirectPart(lang("exUserNotFound"));
                return;
            }

            foreach (User user in users)
            {
                userService.UpdatePwd(user, pwd);
                logUser(SiteLogString.UpdateUserPwd(), user);
            }

            // 3、发送到邮箱
            Boolean isSendMail = (ctx.PostIsCheck("chkSendEmail") == 1);

            if (isSendMail)
            {
                sendPwdToEmail(users, pwd);
            }
            else
            {
                echoRedirectPart(lang("pwdUpdated"), to(Index));
            }
        }
Ejemplo n.º 6
0
 public void SavePermissionAdminAll()
 {
     string[] actionIds = ctx.web.postValuesByKey(typeof(SiteAdminOperation).Name);
     getSecurityTool().SaveActionAll(actionIds);
     log(SiteLogString.UpdateAdminPermission(), typeof(SiteAdminOperation));
     echoRedirect(lang("saved"));
 }
Ejemplo n.º 7
0
        public void Create()
        {
            String name = ctx.Post("Name");

            if (strUtil.IsNullOrEmpty(name))
            {
                errors.Add(lang("exName"));
                run(Add);
                return;
            }

            Group friend = groupService.GetByName(name);

            if (friend == null)
            {
                errors.Add(lang("exFriendGroupNotFound"));
                run(Add);
                return;
            }

            Result result = gfService.AddFriend(ctx.owner.obj, name);

            if (result.HasErrors)
            {
                errors.Join(result);
                run(Add);
            }
            else
            {
                log(SiteLogString.AddFriendGroup(), friend);
                echoToParentPart(lang("opok"));
            }
        }
Ejemplo n.º 8
0
        public void CreateSubPage(int id)
        {
            Page page = pageService.GetPostById(id, ctx.owner.obj);

            if (page == null)
            {
                echoRedirect(lang("exParentPageNotFound"));
                return;
            }

            Page data = validate(new Page());

            if (ctx.HasErrors)
            {
                run(AddSubPage, id); return;
            }

            data.ParentId = id;
            data.Category = new PageCategory {
                Id = page.Category.Id
            };

            populateOwner(data);

            pageService.Insert(data);

            log(SiteLogString.AddPage(), data);

            golist(data.Category.Id);
        }
Ejemplo n.º 9
0
        public void EmailSave()
        {
            String  SmtpUrl       = ctx.Post("SmtpUrl");
            String  SmtpUser      = ctx.Post("SmtpUser");
            String  SmtpPwd       = ctx.Post("SmtpPwd");
            Boolean SmtpEnableSsl = ctx.PostInt("SmtpEnableSsl") == 1 ? true : false;

            //if (strUtil.IsNullOrEmpty( SmtpUrl )) errors.Add( lang( "exServer" ) );
            //if (strUtil.IsNullOrEmpty( SmtpUser )) errors.Add( lang( "exUserName" ) );
            //if (strUtil.IsNullOrEmpty( SmtpPwd )) errors.Add( lang( "exPwd" ) );

            if (ctx.HasErrors)
            {
                echoError();
            }
            else
            {
                config.Instance.Site.SmtpUrl       = SmtpUrl; config.Instance.Site.Update("SmtpUrl", SmtpUrl);
                config.Instance.Site.SmtpUser      = SmtpUser; config.Instance.Site.Update("SmtpUser", SmtpUser);
                config.Instance.Site.SmtpPwd       = SmtpPwd; config.Instance.Site.Update("SmtpPwd", SmtpPwd);
                config.Instance.Site.SmtpEnableSsl = SmtpEnableSsl; config.Instance.Site.Update("SmtpEnableSsl", SmtpEnableSsl);

                log(SiteLogString.EditSiteSettingEmail());

                echoRedirect(lang("opok"));
            }
        }
Ejemplo n.º 10
0
        public void Update(int id)
        {
            Page data = pageService.GetPostById(id, ctx.owner.obj);

            if (data == null)
            {
                echoRedirect(lang("exDataNotFound"));
                return;
            }

            data = validate(data);
            if (ctx.HasErrors)
            {
                run(Edit, id); return;
            }

            int ParentId = ctx.PostInt("ParentId");

            data.ParentId = ParentId;

            pageService.Update(data);

            log(SiteLogString.UpdatePage(), data);

            golist(data.Category.Id);
        }
Ejemplo n.º 11
0
        public virtual void SetRanksByOther(long id)
        {
            SiteRankOther otherRank = roleService.GetRankOtherById(id);

            roleService.UpdateRankByOther(otherRank);
            log(SiteLogString.SetRanksByOther());

            echoToParentPart(lang("opok"));
        }
Ejemplo n.º 12
0
        public void UpdateKeyRule(int ruleId)
        {
            KeyIncomeRule rule = currencyService.GetKeyRuleById(ruleId);

            rule.Income = ctx.PostInt("Income");
            rule.update();
            log(SiteLogString.UpdateKeyCurrencyRule(), typeof(KeyIncomeRule));
            echoToParentPart(lang("saved"));
        }
Ejemplo n.º 13
0
        public virtual void UpdateKeyInit()
        {
            KeyCurrency c = KeyCurrency.Instance;

            c.InitValue = ctx.PostInt("InitValue");
            c.update();
            log(SiteLogString.UpdateKeyCurrencyInit(), typeof(KeyCurrency));
            echoToParentPart(lang("saved"));
        }
Ejemplo n.º 14
0
        public virtual void UpdateInit(long currencyId)
        {
            Currency c = currencyService.GetCurrencyById(currencyId);

            c.InitValue = ctx.PostInt("InitValue");
            c.update();
            log(SiteLogString.UpdateCurrencyInit(), typeof(Currency));
            echoToParentPart(lang("saved"));
        }
Ejemplo n.º 15
0
        public virtual void Delete(long id)
        {
            Group g = groupService.GetById(id);

            groupService.Delete(id);
            log(SiteLogString.DeleteGroup(), g);

            echoRedirect(lang("deleted"));
        }
Ejemplo n.º 16
0
        public virtual void UpdateRule(long ruleId)
        {
            IncomeRule rule = currencyService.GetRuleById(ruleId);

            rule.Income = ctx.PostInt("Income");
            rule.update();
            log(SiteLogString.UpdateIncomeRule(), typeof(IncomeRule));
            echoToParentPart(lang("saved"));
        }
Ejemplo n.º 17
0
        public virtual void Start(long id)
        {
            IMemberApp app    = getApp(id);
            String     appUrl = UrlConverter.clearUrl(app, ctx);

            userAppService.Start(app, appUrl);
            log(SiteLogString.StartApp(), app);

            echoRedirectPart(lang("opok"), to(Index), 0);
        }
Ejemplo n.º 18
0
        public virtual void Delete(long id)
        {
            IMemberApp app    = getApp(id);
            String     appUrl = UrlConverter.clearUrl(app, ctx);

            userAppService.Delete(app, appUrl);

            log(SiteLogString.DeleteApp(), app);

            echoRedirect(lang("opok"), Index);
        }
Ejemplo n.º 19
0
        public void Delete( int id )
        {
            BlogSysCategory c = categoryService.GetById( id );
            if (c == null) {
                echoRedirect( lang( "exDataNotFound" ) );
                return;
            }
            db.delete( c );
            log( SiteLogString.DeleteBlogSysCategory(), c );

            redirect( List );
        }
Ejemplo n.º 20
0
        public virtual void Delete(long currencyId)
        {
            currencyService.GetCurrencyById(currencyId).delete();
            IList incomeRules = currencyService.GetIncomeRules(currencyId);

            foreach (IncomeRule rule in incomeRules)
            {
                rule.delete();
            }
            log(SiteLogString.DeleteCurrency(), typeof(Currency));
            echoRedirectPart(lang("deleted"));
        }
Ejemplo n.º 21
0
        public virtual void Admin()
        {
            String ids        = ctx.Post("choice");
            String cmd        = ctx.Post("action");
            long   categoryId = ctx.PostLong("categoryId");

            if (strUtil.IsNullOrEmpty(cmd) || cvt.IsIdListValid(ids) == false)
            {
                content(lang("exCmd"));
                return;
            }

            String condition = string.Format("Id in ({0}) ", ids);

            if ("pick".Equals(cmd))
            {
                pickedService.PickPost(ids);
                log(SiteLogString.PickPhotoPost(), ids);

                echoAjaxOk();
            }

            else if ("delete".Equals(cmd))
            {
                PhotoPost.updateBatch("set SaveStatus=" + SaveStatus.SysDelete, condition);
                log(SiteLogString.DeleteSysPhotoPost(), ids);
                echoAjaxOk();
            }

            else if ("category".Equals(cmd))
            {
                if (categoryId < 0)
                {
                    content(lang("exCategoryNotFound"));
                    return;
                }

                if (categoryId == zeroCatId)
                {
                    categoryId = 0;
                }

                PhotoPost.updateBatch("set SysCategoryId=" + categoryId, condition);
                log(SiteLogString.MovePhotoPost(), ids);

                echoAjaxOk();
            }
            else
            {
                content(lang("exCmd"));
            }
        }
Ejemplo n.º 22
0
        public void Admin()
        {
            String ids = ctx.PostIdList("choice");
            String cmd = ctx.Post("action");

            if (strUtil.IsNullOrEmpty(cmd))
            {
                echoText(lang("exCmd"));
                return;
            }

            if (strUtil.IsNullOrEmpty(ids))
            {
                echoText(lang("plsSelect"));
                return;
            }

            if ("pick".Equals(cmd))
            {
                pickedService.PickPost(ids);
                log(SiteLogString.PickBlogPost(), ids);
                echoAjaxOk();
            }
            else if ("unpick".Equals(cmd))
            {
                pickedService.UnPickPost(ids);
                log(SiteLogString.UnPickBlogPost(), ids);
                echoAjaxOk();
            }
            else if ("delete".Equals(cmd))
            {
                sysblogService.Delete(ids);
                log(SiteLogString.DeleteBlogPost(), ids);
                echoAjaxOk();
            }
            else if ("undelete".Equals(cmd))
            {
                sysblogService.UnDelete(ids);
                log(SiteLogString.UnDeleteBlogPost(), ids);
                echoAjaxOk();
            }
            else if ("deletetrue".Equals(cmd))
            {
                sysblogService.DeleteTrue(ids);
                log(SiteLogString.DeleteBlogPostTrue(), ids);
                echoAjaxOk();
            }
            else
            {
                echoText(lang("exUnknowCmd"));
            }
        }
Ejemplo n.º 23
0
        public void UnDelete(int id)
        {
            BlogPost post = postService.GetById_ForAdmin(id);

            if (post == null)
            {
                echoRedirect(lang("exDataNotFound")); return;
            }

            sysblogService.SystemUnDelete(post);
            log(SiteLogString.SystemUnDeleteBlogPost(), post);
            redirect(Trash);
        }
Ejemplo n.º 24
0
        public virtual void UnDelete(long id)
        {
            ContentPost post = postService.GetById_ForAdmin(id);

            if (post == null)
            {
                echoRedirect(lang("exDataNotFound")); return;
            }

            postService.UnDelete(post);
            log(SiteLogString.SystemUnDeleteContentPost(), post);
            redirect(Trash);
        }
Ejemplo n.º 25
0
        public void Create()
        {
            BlogSysCategory c = validate( null );
            if (ctx.HasErrors) {
                run( Add );
                return;
            }

            db.insert( c );
            log( SiteLogString.InsertBlogSysCategory(), c );

            echoToParentPart( lang("opok") );
        }
Ejemplo n.º 26
0
        public virtual void Update(long id)
        {
            IMemberApp app    = getApp(id);
            String     appUrl = UrlConverter.clearUrl(app, ctx);

            String name = ctx.Post("Name");

            userAppService.Update(app, name, appUrl);

            log(SiteLogString.UpdateApp(), app);

            echoToParentPart(lang("opok"), to(Index), 0);
        }
Ejemplo n.º 27
0
        public void Operation()
        {
            String userIds = ctx.PostIdList("choice");

            if (strUtil.IsNullOrEmpty(userIds))
            {
                redirect(Index);
                return;
            }

            String condition = "Id in (" + userIds + ") ";

            String cmd    = ctx.Post("action");
            String action = "";

            if ("pick" == cmd)
            {
                action = "set Status=" + MemberStatus.Pick;
            }
            else if ("unpick" == cmd)
            {
                action = "set Status=" + MemberStatus.Normal;
            }
            else if ("approve" == cmd)
            {
                action = "set Status=" + MemberStatus.Normal;
            }
            else if ("delete" == cmd)
            {
                action = "set Status=" + MemberStatus.Deleted;
            }
            else if ("undelete" == cmd)
            {
                action = "set Status=" + MemberStatus.Normal;
            }
            else if ("deletetrue" == cmd)
            {
                User.deleteBatch(condition);
                redirect(Index);
                return;
            }
            else if ("category" == cmd)
            {
                int roleId = ctx.PostInt("categoryId");
                action = "set RoleId=" + roleId;
            }

            User.updateBatch(action, condition);
            logUser(SiteLogString.AdminUser(cmd), userIds);
            content("ok");
        }
Ejemplo n.º 28
0
        public void FilterSave()
        {
            String BadWordsStr         = ctx.Post("BadWords");
            String BadWordsReplacement = ctx.Post("BadWordsReplacement");

            config.Instance.Site.BadWords = SiteSetting.GetArrayValueByString(BadWordsStr);
            config.Instance.Site.Update("BadWords", BadWordsStr);

            config.Instance.Site.BadWordsReplacement = BadWordsReplacement;
            config.Instance.Site.Update("BadWordsReplacement", BadWordsReplacement);
            log(SiteLogString.EditSiteSettingFilter());

            echoRedirect(lang("opok"));
        }
Ejemplo n.º 29
0
        public void SaveInfo()
        {
            //String target = ctx.Post( "Name" );
            //String url = ctx.Post( "Url" );
            int    categoryId  = ctx.PostInt("Category");
            int    accessId    = ctx.PostInt("AccessStatus");
            String description = ctx.Post("Description");

            //if (strUtil.IsNullOrEmpty( target )) errors.Add( lang( "exGroupName" ) );
            //if (strUtil.IsNullOrEmpty( url )) errors.Add( lang( "exGroupUrl" ) );
            //if (strUtil.HasText( target ) && (target.Length > 30)) errors.Add( lang( "exGroupNameMaxLength" ) );
            if (categoryId <= 0)
            {
                errors.Add(lang("exGroupCategory"));
            }
            if (accessId < 0)
            {
                errors.Add(lang("exGroupSecurity"));
            }
            if (strUtil.IsNullOrEmpty(description))
            {
                errors.Add(lang("exGroupDescription"));
            }

            if (errors.HasErrors)
            {
                run(Index); return;
            }

            Group group = ctx.owner.obj as Group;

            group.Category     = new GroupCategory(categoryId);
            group.AccessStatus = accessId;
            group.Description  = description;

            group.IsCloseJoinCmd = ctx.PostIsCheck("IsCloseJoinCmd");

            Result result = db.update(group);

            if (result.IsValid)
            {
                log(SiteLogString.UpdateGroupInfo(), group);
                echoRedirect(lang("opok"), Index);
            }
            else
            {
                errors.Join(result);
                run(Index);
            }
        }
Ejemplo n.º 30
0
        public virtual void Stop(long id)
        {
            IMemberApp app    = getApp(id);
            String     appUrl = UrlConverter.clearUrl(app, ctx);

            logger.Info("stoped app url : " + appUrl);

            userAppService.Stop(app, appUrl);
            log(SiteLogString.StopApp(), app);

            //redirect( Index );
            //echoRedirect( lang( "opok" ), Index );
            echoRedirectPart(lang("opok"), to(Index), 0);
        }