コード例 #1
0
        private void SubmitInfo_Click(object sender, EventArgs e)
        {
            #region 提交同级版块

            if (this.CheckCookie())
            {
                if (DNTRequest.GetString("fid") != "")
                {
                    __foruminfo              = AdminForums.GetForumInfomation(DNTRequest.GetInt("fid", 0));
                    __foruminfo.Name         = name.Text.Trim();
                    __foruminfo.Displayorder = Convert.ToInt32(displayorder.Text);
                    __foruminfo.Status       = Convert.ToInt16(status.SelectedValue);

                    if (colcount.SelectedValue == "1") //传统模式[默认]
                    {
                        __foruminfo.Colcount = 1;
                    }
                    else
                    {
                        if (Convert.ToInt16(colcountnumber.Text) < 1 || Convert.ToInt16(colcountnumber.Text) > 9)
                        {
                            base.RegisterStartupScript("", "<script>alert('列值必须在2~9范围内');</script>");
                            return;
                        }
                        __foruminfo.Colcount = Convert.ToInt16(colcountnumber.Text);
                    }

                    __foruminfo.Templateid = (Convert.ToInt32(templateid.SelectedValue) == config.Templateid ? 0 : Convert.ToInt32(templateid.SelectedValue));
                    __foruminfo.Allowhtml  = 0;
                    __foruminfo.Allowblog  = 0;
                    //__foruminfo.Istrade = 0;
                    //__foruminfo.Allowpostspecial = 0; //需要作与运算如下
                    //__foruminfo.Allowspecialonly = 0; //需要作与运算如下
                    ////$allow辩论 = allowpostspecial & 16;
                    ////$allow悬赏 = allowpostspecial & 4;
                    ////$allow投票 = allowpostspecial & 1;

                    __foruminfo.Alloweditrules = 0;
                    __foruminfo.Allowsmilies   = BoolToInt(setting.Items[0].Selected);
                    __foruminfo.Allowrss       = BoolToInt(setting.Items[1].Selected);
                    __foruminfo.Allowbbcode    = BoolToInt(setting.Items[2].Selected);
                    __foruminfo.Allowimgcode   = BoolToInt(setting.Items[3].Selected);
                    __foruminfo.Recyclebin     = BoolToInt(setting.Items[4].Selected);
                    __foruminfo.Modnewposts    = BoolToInt(setting.Items[5].Selected);
                    //__foruminfo.Jammer = BoolToInt(setting.Items[6].Selected);
                    __foruminfo.Disablewatermark = BoolToInt(setting.Items[6].Selected);
                    __foruminfo.Inheritedmod     = BoolToInt(setting.Items[7].Selected);
                    __foruminfo.Allowthumbnail   = BoolToInt(setting.Items[8].Selected);
                    __foruminfo.Allowtag         = BoolToInt(setting.Items[9].Selected);
                    //__foruminfo.Istrade = BoolToInt(setting.Items[11].Selected);
                    int temppostspecial = 0;
                    //temppostspecial = setting.Items[11].Selected ? temppostspecial | 1 : temppostspecial & ~1;
                    //temppostspecial = setting.Items[12].Selected ? temppostspecial | 16 : temppostspecial & ~16;
                    //temppostspecial = setting.Items[13].Selected ? temppostspecial | 4 : temppostspecial & ~4;
                    __foruminfo.Allowpostspecial = temppostspecial;
                    __foruminfo.Allowspecialonly = Convert.ToInt16(allowspecialonly.SelectedValue);

                    if (autocloseoption.SelectedValue == "0")
                    {
                        __foruminfo.Autoclose = 0;
                    }
                    else
                    {
                        __foruminfo.Autoclose = Convert.ToInt32(autocloseday.Text);
                    }

                    __foruminfo.Description      = description.Text;
                    __foruminfo.Password         = password.Text;
                    __foruminfo.Icon             = icon.Text;
                    __foruminfo.Redirect         = redirect.Text;
                    __foruminfo.Attachextensions = attachextensions.GetSelectString(",");

                    AdminForums.CompareOldAndNewModerator(__foruminfo.Moderators, moderators.Text.Replace("\r\n", ","), DNTRequest.GetInt("fid", 0));

                    __foruminfo.Moderators     = moderators.Text.Replace("\r\n", ",");
                    __foruminfo.Rules          = rules.Text;
                    __foruminfo.Topictypes     = topictypes.Text;
                    __foruminfo.Viewperm       = Request.Form["viewperm"];
                    __foruminfo.Postperm       = Request.Form["postperm"];
                    __foruminfo.Replyperm      = Request.Form["replyperm"];
                    __foruminfo.Getattachperm  = Request.Form["getattachperm"];
                    __foruminfo.Postattachperm = Request.Form["postattachperm"];

                    __foruminfo.Applytopictype  = Convert.ToInt32(applytopictype.SelectedValue);
                    __foruminfo.Postbytopictype = Convert.ToInt32(postbytopictype.SelectedValue);
                    __foruminfo.Viewbytopictype = Convert.ToInt32(viewbytopictype.SelectedValue);
                    __foruminfo.Topictypeprefix = Convert.ToInt32(topictypeprefix.SelectedValue);
                    __foruminfo.Topictypes      = GetTopicType();

                    __foruminfo.Permuserlist = GetPermuserlist();

                    Discuz.Aggregation.AggregationFacade.ForumAggregation.ClearDataBind();
                    string result = AdminForums.SaveForumsInf(__foruminfo).Replace("'", "’");
                    AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "编辑论坛版块", "编辑论坛版块,名称为:" + name.Text.Trim());

                    GeneralConfigInfo __configinfo = GeneralConfigs.Deserialize(Server.MapPath("../../config/general.config"));
                    __configinfo.Specifytemplate = DatabaseProvider.GetInstance().GetSpecifyForumTemplateCount() > 0 ? 1: 0;
                    GeneralConfigs.Serialiaze(__configinfo, Server.MapPath("../../config/general.config"));
                    if (result == "")
                    {
                        Response.Redirect("forum_ForumsTree.aspx");
                    }
                    else
                    {
                        Response.Write("<script>alert('用户:" + result + "不存在或因为它们所属组为\"游客\",\"等待验证会员\",因为无法设为版主');window.location.href='forum_ForumsTree.aspx';</script>");
                        Response.End();
                    }
                }
            }

            #endregion
        }