Ejemplo n.º 1
0
        private void SubmitBatchSet_Click(object sender, EventArgs e)
        {
            #region 写入批量论坛设置信息

            string targetlist = DNTRequest.GetString("Forumtree1");

            if ((targetlist == "") || (targetlist == ",") || (targetlist == "0"))
            {
                base.RegisterStartupScript("", "<script>alert('您未选中任何版块, 系统无法提交! ');</script>");
                return;
            }

            __foruminfo = AdminForums.GetForumInfomation(DNTRequest.GetInt("fid", -1));
            __foruminfo.Allowsmilies     = BoolToInt(setting.Items[0].Selected);
            __foruminfo.Allowrss         = BoolToInt(setting.Items[1].Selected);
            __foruminfo.Allowhtml        = 0;
            __foruminfo.Allowbbcode      = BoolToInt(setting.Items[2].Selected);
            __foruminfo.Allowimgcode     = BoolToInt(setting.Items[3].Selected);
            __foruminfo.Allowblog        = 0;
            __foruminfo.Istrade          = 0;
            __foruminfo.Alloweditrules   = 0;
            __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[7].Selected);
            __foruminfo.Inheritedmod     = BoolToInt(setting.Items[8].Selected);
            __foruminfo.Allowthumbnail   = BoolToInt(setting.Items[9].Selected);
            __foruminfo.Password         = password.Text;
            __foruminfo.Attachextensions = attachextensions.GetSelectString(",");
            __foruminfo.Viewperm         = viewperm.GetSelectString(",");
            __foruminfo.Postperm         = postperm.GetSelectString(",");
            __foruminfo.Replyperm        = replyperm.GetSelectString(",");
            __foruminfo.Getattachperm    = getattachperm.GetSelectString(",");
            __foruminfo.Postattachperm   = postattachperm.GetSelectString(",");

            BatchSetParams bsp = new BatchSetParams();
            bsp.SetPassWord         = setpassword.Checked;
            bsp.SetAttachExtensions = setattachextensions.Checked;
            bsp.SetPostCredits      = setpostcredits.Checked;
            bsp.SetReplyCredits     = setreplycredits.Checked;
            bsp.SetSetting          = setsetting.Checked;
            bsp.SetViewperm         = setviewperm.Checked;
            bsp.SetPostperm         = setpostperm.Checked;
            bsp.SetReplyperm        = setreplyperm.Checked;
            bsp.SetGetattachperm    = setgetattachperm.Checked;
            bsp.SetPostattachperm   = setpostattachperm.Checked;

            if (AdminForums.BatchSetForumInf(__foruminfo, bsp, targetlist))
            {
                base.RegisterStartupScript("PAGE", "window.location.href='forum_ForumsTree.aspx';");
            }
            else
            {
                base.RegisterStartupScript("", "<script>alert('提交不成功!');window.location.href='forum_ForumsTree.aspx';</script>");
            }

            #endregion
        }
Ejemplo n.º 2
0
        public void LoadCurrentForumInfo(int fid)
        {
            #region 加载相关信息

            if (fid > 0)
            {
                __foruminfo = AdminForums.GetForumInfomation(fid);
            }
            else
            {
                return;
            }

            if (__foruminfo.Layer > 0)
            {
                tabPage2.Visible = true;
                tabPage6.Visible = true;
            }
            else
            {
                //删除掉"高级设置"属性页
                TabControl1.Items.Remove(tabPage2);
                tabPage2.Visible = false;

                //删除掉"特殊用户"属性页
                TabControl1.Items.Remove(tabPage4);
                tabPage4.Visible = false;

                //删除掉"主题分类"属性页
                TabControl1.Items.Remove(tabPage5);
                tabPage5.Visible = false;

                //删除掉"统计信息"属性页
                TabControl1.Items.Remove(tabPage6);
                tabPage6.Visible      = false;
                templatestyle.Visible = false;
            }

            forumname.Text    = __foruminfo.Name.Trim();
            name.Text         = __foruminfo.Name.Trim();
            displayorder.Text = __foruminfo.Displayorder.ToString();

            status.SelectedValue = __foruminfo.Status.ToString();

            if (__foruminfo.Colcount == 1)
            {
                showcolnum.Attributes.Add("style", "display:none");
                colcount.SelectedIndex = 0;
            }
            else
            {
                showcolnum.Attributes.Add("style", "display:block");
                colcount.SelectedIndex = 1;
            }
            colcount.Attributes.Add("onclick", "javascript:document.getElementById('" + showcolnum.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage1_colcount_0').checked ? 'none' : 'block');");
            colcountnumber.Text = __foruminfo.Colcount.ToString();

            templateid.SelectedValue = __foruminfo.Templateid.ToString();

            forumsstatic.Text = string.Format("主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}",
                                              __foruminfo.Topics.ToString(),
                                              __foruminfo.Posts.ToString(),
                                              __foruminfo.Todayposts.ToString(),
                                              __foruminfo.Lastpost.ToString());

            ViewState["forumsstatic"] = forumsstatic.Text;

            if (__foruminfo.Allowsmilies == 1)
            {
                setting.Items[0].Selected = true;
            }
            if (__foruminfo.Allowrss == 1)
            {
                setting.Items[1].Selected = true;
            }
            if (__foruminfo.Allowbbcode == 1)
            {
                setting.Items[2].Selected = true;
            }
            if (__foruminfo.Allowimgcode == 1)
            {
                setting.Items[3].Selected = true;
            }
            if (__foruminfo.Recyclebin == 1)
            {
                setting.Items[4].Selected = true;
            }
            if (__foruminfo.Modnewposts == 1)
            {
                setting.Items[5].Selected = true;
            }
            //if (__foruminfo.Jammer == 1) setting.Items[6].Selected = true;
            if (__foruminfo.Disablewatermark == 1)
            {
                setting.Items[6].Selected = true;
            }
            if (__foruminfo.Inheritedmod == 1)
            {
                setting.Items[7].Selected = true;
            }
            if (__foruminfo.Allowthumbnail == 1)
            {
                setting.Items[8].Selected = true;
            }
            if (__foruminfo.Allowtag == 1)
            {
                setting.Items[9].Selected = true;
            }
            //if (__foruminfo.Istrade == 1) setting.Items[11].Selected = true;
            //if ((__foruminfo.Allowpostspecial & 1) != 0) setting.Items[11].Selected = true;
            //if ((__foruminfo.Allowpostspecial & 16) != 0) setting.Items[12].Selected = true;
            //if ((__foruminfo.Allowpostspecial & 4) != 0) setting.Items[13].Selected = true;
            allowspecialonly.SelectedValue = __foruminfo.Allowspecialonly.ToString();

            if (__foruminfo.Autoclose == 0)
            {
                showclose.Attributes.Add("style", "display:none");
                autocloseoption.SelectedIndex = 0;
            }
            else
            {
                autocloseoption.SelectedIndex = 1;
            }
            autocloseoption.Attributes.Add("onclick", "javascript:document.getElementById('" + showclose.ClientID + "').style.display= (document.getElementById('TabControl1_tabPage2_autocloseoption_0').checked ? 'none' : 'block');");
            autocloseday.Text = __foruminfo.Autoclose.ToString();

            //提取高级信息
            description.Text = __foruminfo.Description.Trim();
            password.Text    = __foruminfo.Password.Trim();
            icon.Text        = __foruminfo.Icon.Trim();
            redirect.Text    = __foruminfo.Redirect.Trim();
            moderators.Text  = __foruminfo.Moderators.Trim();

            string strusername = "";
            foreach (DataRow dr in DatabaseProvider.GetInstance().GetModerators(fid))
            {
                strusername = strusername + dr["username"].ToString().Trim() + ",";
            }
            if (strusername != "")
            {
                inheritmoderators.Text = strusername.Substring(0, strusername.Length - 1);
            }

            rules.Text      = __foruminfo.Rules.Trim();
            topictypes.Text = __foruminfo.Topictypes.Trim();

            DataTable dt = DatabaseProvider.GetInstance().GetUserGroupsTitle();
            int       i  = 1;
            foreach (DataRow dr in dt.Rows)
            {
                HtmlTableRow  tr = new HtmlTableRow();
                HtmlTableCell td = new HtmlTableCell("td");
                if (i % 2 == 1)
                {
                    td.Attributes.Add("class", "td_alternating_item1");
                }
                else
                {
                    td.Attributes.Add("class", "td_alternating_item2");
                }
                td.Controls.Add(new LiteralControl("<input type='checkbox' id='r" + i + "' onclick='selectRow(" + i + ",this.checked)'>"));
                tr.Cells.Add(td);
                td = new HtmlTableCell("td");
                if (i % 2 == 1)
                {
                    td.Attributes.Add("class", "td_alternating_item1");
                }
                else
                {
                    td.Attributes.Add("class", "td_alternating_item2");
                }
                td.Controls.Add(new LiteralControl("<label for='r" + i + "'>" + dr["grouptitle"].ToString() + "</lable>"));
                tr.Cells.Add(td);
                tr.Cells.Add(GetTD("viewperm", __foruminfo.Viewperm.Trim(), dr["groupid"].ToString(), i));
                tr.Cells.Add(GetTD("postperm", __foruminfo.Postperm.Trim(), dr["groupid"].ToString(), i));
                tr.Cells.Add(GetTD("replyperm", __foruminfo.Replyperm.Trim(), dr["groupid"].ToString(), i));
                tr.Cells.Add(GetTD("getattachperm", __foruminfo.Getattachperm.Trim(), dr["groupid"].ToString(), i));
                tr.Cells.Add(GetTD("postattachperm", __foruminfo.Postattachperm.Trim(), dr["groupid"].ToString(), i));
                powerset.Rows.Add(tr);
                i++;
            }


            dt = DatabaseProvider.GetInstance().GetAttachTypes();
            attachextensions.SetSelectByID(__foruminfo.Attachextensions.Trim());

            if (fid > 0)
            {
                __foruminfo = AdminForums.GetForumInfomation(fid);
            }
            else
            {
                return;
            }
            applytopictype.SelectedValue  = __foruminfo.Applytopictype.ToString();
            postbytopictype.SelectedValue = __foruminfo.Postbytopictype.ToString();
            viewbytopictype.SelectedValue = __foruminfo.Viewbytopictype.ToString();
            topictypeprefix.SelectedValue = __foruminfo.Topictypeprefix.ToString();


            #endregion
        }
Ejemplo n.º 3
0
        private void RunForumStatic_Click(object sender, EventArgs e)
        {
            #region 运行论坛统计

            if (this.CheckCookie())
            {
                forumsstatic.Text = ViewState["forumsstatic"].ToString();

                int fid = DNTRequest.GetInt("fid", -1);
                if (fid > 0)
                {
                    __foruminfo = AdminForums.GetForumInfomation(fid);
                }
                else
                {
                    return;
                }

                int    topiccount   = 0;
                int    postcount    = 0;
                int    lasttid      = 0;
                string lasttitle    = "";
                string lastpost     = "";
                int    lastposterid = 0;
                string lastposter   = "";
                int    replypost    = 0;
                AdminForumStats.ReSetFourmTopicAPost(fid, out topiccount, out postcount, out lasttid, out lasttitle, out lastpost, out lastposterid, out lastposter, out replypost);

                runforumsstatic = string.Format("<br /><br />运行结果<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />主题总数:{0}<br />帖子总数:{1}<br />今日回帖数总数:{2}<br />最后提交日期:{3}",
                                                topiccount,
                                                postcount,
                                                replypost,
                                                lastpost);

                if ((__foruminfo.Topics == topiccount) && (__foruminfo.Posts == postcount) && (__foruminfo.Todayposts == replypost) && (__foruminfo.Lastpost.Trim() == lastpost))
                {
                    runforumsstatic += "<br /><br /><br />结果一致";
                }
                else
                {
                    runforumsstatic += "<br /><br /><br />比较<hr style=\"height:1px; width:600; color:#CCCCCC; background:#CCCCCC; border: 0; \" align=\"left\" />";
                    if (__foruminfo.Topics != topiccount)
                    {
                        runforumsstatic += "主题总数有差异<br />";
                    }
                    if (__foruminfo.Posts != postcount)
                    {
                        runforumsstatic += "帖子总数有差异<br />";
                    }
                    if (__foruminfo.Todayposts != replypost)
                    {
                        runforumsstatic += "今日回帖数总数有差异<br />";
                    }
                    if (__foruminfo.Lastpost != lastpost)
                    {
                        runforumsstatic += "最后提交日期有差异<br />";
                    }
                }
            }
            this.TabControl1.SelectedIndex = 5;
            DataGridBind("");
            BindTopicType();
            #endregion
        }
Ejemplo n.º 4
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
        }
Ejemplo n.º 5
0
        public void LoadCurrentForumInfo(int fid)
        {
            #region 提取基本信息

            if (fid > 0)
            {
                __foruminfo = AdminForums.GetForumInfomation(fid);
            }
            else
            {
                return;
            }

            if (__foruminfo.Allowsmilies == 1)
            {
                setting.Items[0].Selected = true;
            }
            if (__foruminfo.Allowrss == 1)
            {
                setting.Items[1].Selected = true;
            }
            if (__foruminfo.Allowbbcode == 1)
            {
                setting.Items[2].Selected = true;
            }
            if (__foruminfo.Allowimgcode == 1)
            {
                setting.Items[3].Selected = true;
            }
            if (__foruminfo.Recyclebin == 1)
            {
                setting.Items[4].Selected = true;
            }
            if (__foruminfo.Modnewposts == 1)
            {
                setting.Items[5].Selected = true;
            }
            if (__foruminfo.Jammer == 1)
            {
                setting.Items[6].Selected = true;
            }
            if (__foruminfo.Disablewatermark == 1)
            {
                setting.Items[7].Selected = true;
            }
            if (__foruminfo.Inheritedmod == 1)
            {
                setting.Items[8].Selected = true;
            }
            if (__foruminfo.Allowthumbnail == 1)
            {
                setting.Items[9].Selected = true;
            }

            DataTable dt = DatabaseProvider.GetInstance().GetUserGroupsTitle();
            viewperm.SetSelectByID(__foruminfo.Viewperm.Trim());
            postperm.SetSelectByID(__foruminfo.Postperm.Trim());
            replyperm.SetSelectByID(__foruminfo.Replyperm.Trim());
            getattachperm.SetSelectByID(__foruminfo.Getattachperm.Trim());
            postattachperm.SetSelectByID(__foruminfo.Postattachperm.Trim());

            dt = DatabaseProvider.GetInstance().GetAttachTypes();

            attachextensions.SetSelectByID(__foruminfo.Attachextensions.Trim());

            #endregion
        }