/// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.PageLinks.AddRoot();
            this.PageLinks.AddLink(
                this.GetText("ADMIN_ADMIN", "Administration"),
                YafBuildLink.GetLink(ForumPages.admin_admin));

            this.PageLinks.AddLink(this.GetText("ADMIN_USERS", "TITLE"), YafBuildLink.GetLink(ForumPages.admin_users));

            // current page label (no link)
            this.PageLinks.AddLink(this.GetText("ADMIN_REGUSER", "TITLE"), string.Empty);

            this.Page.Header.Title = "{0} - {1} - {2}".FormatWith(
                this.GetText("ADMIN_ADMIN", "Administration"),
                this.GetText("ADMIN_USERS", "TITLE"),
                this.GetText("ADMIN_REGUSER", "TITLE"));

            this.ForumRegister.Text = this.GetText("ADMIN_REGUSER", "REGISTER");
            this.cancel.Text        = this.GetText("COMMON", "CANCEL");

            this.TimeZones.DataSource = StaticDataHelper.TimeZones();
            this.DataBind();
        }
Exemple #2
0
        /// <summary>
        /// Initializes the forum.
        /// </summary>
        /// <param name="forumName">The forum name.</param>
        /// <param name="timeZone">The time zone.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="forumEmail">The forum email.</param>
        /// <param name="forumBaseUrlMask">The forum base URL mask.</param>
        /// <param name="adminUserName">The admin user name.</param>
        /// <param name="adminEmail">The admin email.</param>
        /// <param name="adminProviderUserKey">The admin provider user key.</param>
        public void InitializeForum(
            string forumName,
            string timeZone,
            string culture,
            string forumEmail,
            string forumBaseUrlMask,
            string adminUserName,
            string adminEmail,
            object adminProviderUserKey)
        {
            var cult     = StaticDataHelper.Cultures();
            var langFile = "english.xml";

            cult.Rows.Cast <DataRow>().Where(drow => drow["CultureTag"].ToString() == culture)
            .ForEach(drow => langFile = (string)drow["CultureFile"]);

            this.GetRepository <Board>().SystemInitialize(
                forumName,
                timeZone,
                culture,
                langFile,
                forumEmail,
                forumBaseUrlMask,
                string.Empty,
                adminUserName,
                adminEmail,
                adminProviderUserKey,
                Config.CreateDistinctRoles && Config.IsAnyPortal ? "YAF " : string.Empty);

            this.GetRepository <Registry>().Save("version", YafForumInfo.AppVersion.ToString());
            this.GetRepository <Registry>().Save("versionname", YafForumInfo.AppVersionName);

            this.ImportStatics();
        }
Exemple #3
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            var forumId = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefaultAsInt("fa")
                          ?? this.Get <HttpRequestBase>().QueryString.GetFirstOrDefaultAsInt("copy");

            this.CategoryList.DataSource = this.GetRepository <Category>().List();
            this.CategoryList.DataBind();

            if (forumId.HasValue)
            {
                this.AccessList.DataSource = this.GetRepository <ForumAccess>().GetForumAccessList(forumId.Value);
                this.AccessList.DataBind();
            }

            // Load forum's combo
            this.BindParentList();

            // Load forum's themes
            var listheader = new ListItem
            {
                Text = this.GetText("ADMIN_EDITFORUM", "CHOOSE_THEME"), Value = string.Empty
            };

            this.AccessMaskID.DataBind();

            this.ThemeList.DataSource = StaticDataHelper.Themes();
            this.ThemeList.DataBind();
            this.ThemeList.Items.Insert(0, listheader);
        }
Exemple #4
0
        /// <summary>
        /// Initializes the forum.
        /// </summary>
        /// <param name="forumName">The forum name.</param>
        /// <param name="timeZone">The time zone.</param>
        /// <param name="culture">The culture.</param>
        /// <param name="forumEmail">The forum email.</param>
        /// <param name="forumBaseUrlMask">The forum base URL mask.</param>
        /// <param name="adminUserName">The admin user name.</param>
        /// <param name="adminEmail">The admin email.</param>
        /// <param name="adminProviderUserKey">The admin provider user key.</param>
        public void InitializeForum(
            string forumName, int timeZone, string culture, string forumEmail, string forumBaseUrlMask, string adminUserName, string adminEmail, object adminProviderUserKey)
        {
            var cult     = StaticDataHelper.Cultures();
            var langFile = "english.xml";

            foreach (DataRow drow in cult.Rows.Cast <DataRow>().Where(drow => drow["CultureTag"].ToString() == culture))
            {
                langFile = (string)drow["CultureFile"];
            }

            LegacyDb.system_initialize(
                forumName,
                timeZone,
                culture,
                langFile,
                forumEmail,
                forumBaseUrlMask,
                string.Empty,
                adminUserName,
                adminEmail,
                adminProviderUserKey,
                Config.CreateDistinctRoles && Config.IsAnyPortal ? "YAF " : string.Empty);

            LegacyDb.system_updateversion(YafForumInfo.AppVersion, YafForumInfo.AppVersionName);

            // vzrus: uncomment it to not keep install/upgrade objects in db for a place and better security
            // YAF.Classes.Data.DB.system_deleteinstallobjects();
            this.ImportStatics();
        }
Exemple #5
0
        /// <summary>
        /// The bind data.
        /// </summary>
        private void BindData()
        {
            int forumId = 0;

            this.CategoryList.DataSource = DB.category_list(PageContext.PageBoardID, null);
            this.CategoryList.DataBind();

            if (Request.QueryString.GetFirstOrDefault("f") != null && int.TryParse(Request.QueryString.GetFirstOrDefault("f"), out forumId))
            {
                this.AccessList.DataSource = DB.forumaccess_list(forumId);
                this.AccessList.DataBind();
            }

            // Load forum's combo
            this.BindParentList();

            // Load forum's themes
            var listheader = new ListItem();

            listheader.Text  = "Choose a theme";
            listheader.Value = string.Empty;

            this.AccessMaskID.DataBind();

            this.ThemeList.DataSource     = StaticDataHelper.Themes();
            this.ThemeList.DataTextField  = "Theme";
            this.ThemeList.DataValueField = "FileName";
            this.ThemeList.DataBind();
            this.ThemeList.Items.Insert(0, listheader);
        }
Exemple #6
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on post-backs
            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            var ci = this.Get <ILocalization>().Culture;

            if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text     = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays).ToString("yyyy-MM-dd");
                this.SinceDate.TextMode = TextBoxMode.Date;

                this.ToDate.Text     = DateTime.UtcNow.Date.ToString("yyyy-MM-dd");
                this.ToDate.TextMode = TextBoxMode.Date;
            }

            // bind data to controls
            this.BindData();
        }
Exemple #7
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            this.WasMentioned.Text   = this.GetText("WAS_MENTIONED");
            this.ReceivedThanks.Text = this.GetText("RECEIVED_THANKS");
            this.WasQuoted.Text      = this.GetText("WAS_QUOTED");

            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            var previousPageSize = this.Get <ISession>().UserActivityPageSize;

            if (previousPageSize.HasValue)
            {
                // look for value previously selected
                var sinceItem = this.PageSize.Items.FindByValue(previousPageSize.Value.ToString());

                // and select it if found
                if (sinceItem != null)
                {
                    this.PageSize.SelectedIndex = this.PageSize.Items.IndexOf(sinceItem);
                }
            }

            this.BindData();
        }
Exemple #8
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            var forumId = this.Get <HttpRequestBase>().QueryString.GetFirstOrDefaultAsInt("fa")
                          ?? this.Get <HttpRequestBase>().QueryString.GetFirstOrDefaultAsInt("copy");

            this.CategoryList.DataSource = this.GetRepository <Category>().List();
            this.CategoryList.DataBind();

            if (forumId.HasValue)
            {
                this.AccessList.DataSource = this.GetRepository <ForumAccess>().GetForumAccessList(forumId.Value).Select(
                    i => new { GroupID = i.Item2.ID, GroupName = i.Item2.Name, i.Item1.AccessMaskID });
                this.AccessList.DataBind();
            }
            else
            {
                this.AccessList.DataSource = BoardContext.Current.GetRepository <Group>().GetByBoardId()
                                             .Select(i => new { GroupID = i.ID, GroupName = i.Name, AccessMaskID = 0 });
                this.AccessList.DataBind();
            }

            // Load forum's combo
            this.BindParentList();

            // Load forum's themes
            var listItem = new ListItem
            {
                Text = this.GetText("ADMIN_EDITFORUM", "CHOOSE_THEME"), Value = string.Empty
            };

            this.ThemeList.DataSource = StaticDataHelper.Themes();
            this.ThemeList.DataBind();
            this.ThemeList.Items.Insert(0, listItem);
        }
Exemple #9
0
        public DmMenuModel(DM_Menu entity, UserInfo user)
        {
            // var allowRoles = "," + entity.ListRole + ",";
            Id             = entity.Id;
            Name           = entity.Name;
            Status         = entity.Status;
            ParentId       = entity.ParentId;
            Loai           = entity.Loai;
            ListRole       = entity.ListRole;
            Code           = entity.Code;
            ControllerName = entity.ControllerName;
            ListAction     = new List <DM_Menu>();
            var listActionAll = StaticDataHelper.GetCacheDataMenuRole().Where(x => x.Loai.Equals("ACTION") && x.ParentId == entity.Id).ToList();

            foreach (var item in listActionAll)
            {
                var allowRoles = "," + item.ListRole + ",";
                if (user.Roles != null)
                {
                    if (user.Roles.Any(x => allowRoles.Contains("," + x.Code + ",")))
                    {
                        ListAction.Add(item);
                    }
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on post-backs
            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            var ci = this.Get <ILocalization>().Culture;

            if (this.PageContext.BoardSettings.UseFarsiCalender && ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.PageContext.BoardSettings.EventLogMaxDays).ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
                this.ToDate.Text = DateTime.UtcNow.Date.ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
            }

            this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            // bind data to controls
            this.BindData();
        }
Exemple #11
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            this.CreatedTopic.Text = this.GetText("CREATED_TOPIC");
            this.CreatedReply.Text = this.GetText("CREATED_REPLY");
            this.GivenThanks.Text  = this.GetText("GIVEN_THANKS");

            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            var previousPageSize = this.Get <ISession>().UserActivityPageSize;

            if (previousPageSize.HasValue)
            {
                // look for value previously selected
                var sinceItem = this.PageSize.Items.FindByValue(previousPageSize.Value.ToString());

                // and select it if found
                if (sinceItem != null)
                {
                    this.PageSize.SelectedIndex = this.PageSize.Items.IndexOf(sinceItem);
                }
            }

            this.BindData();
        }
Exemple #12
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.PageSizeUnverified.DataSource     = StaticDataHelper.PageEntries();
            this.PageSizeUnverified.DataTextField  = "Name";
            this.PageSizeUnverified.DataValueField = "Value";
            this.PageSizeUnverified.DataBind();

            this.BoardStatsSelect.Visible = this.PageContext.User.UserFlags.IsHostAdmin;

            // bind data
            this.BindBoardsList();

            this.BindData();

            this.ShowUpgradeMessage();
        }
Exemple #13
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.PageLinks.AddRoot();
            this.PageLinks.AddLink(
                this.GetText("ADMIN_ADMIN", "Administration"),
                YafBuildLink.GetLink(ForumPages.admin_admin));

            this.PageLinks.AddLink(this.GetText("ADMIN_USERS", "TITLE"), YafBuildLink.GetLink(ForumPages.admin_users));

            // current page label (no link)
            this.PageLinks.AddLink(this.GetText("ADMIN_REGUSER", "TITLE"), string.Empty);

            this.Page.Header.Title = "{0} - {1} - {2}".FormatWith(
                this.GetText("ADMIN_ADMIN", "Administration"),
                this.GetText("ADMIN_USERS", "TITLE"),
                this.GetText("ADMIN_REGUSER", "TITLE"));

            this.ForumRegister.Text = "<i class=\"fa fa-user-plus fa-fw\"></i>&nbsp;{0}".FormatWith(this.GetText("ADMIN_REGUSER", "REGISTER"));
            this.cancel.Text        = "<i class=\"fa fa-times fa-fw\"></i>&nbsp;{0}".FormatWith(this.GetText("CANCEL"));

            this.TimeZones.DataSource = StaticDataHelper.TimeZones();
            this.DataBind();
            this.TimeZones.Items.FindByValue("0").Selected = true;
        }
Exemple #14
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (!this.PageContext.ForumModeratorAccess)
            {
                BuildLink.AccessDenied();
            }

            if (!this.PageContext.IsForumModerator || !this.PageContext.IsAdmin)
            {
                this.ModerateUsersHolder.Visible = false;
            }

            if (!this.IsPostBack)
            {
                var showMoved = this.Get <BoardSettings>().ShowMoved;

                // Ederon : 7/14/2007 - by default, leave pointer is set on value defined on host level
                this.LeavePointer.Checked = showMoved;

                this.trLeaveLink.Visible     = showMoved;
                this.trLeaveLinkDays.Visible = showMoved;

                if (showMoved)
                {
                    this.LinkDays.Text = "1";
                }
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.BindData();
        }
Exemple #15
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            var forumId = this.GetQueryStringAsInt("fa") ?? this.GetQueryStringAsInt("copy");

            this.CategoryList.DataSource = this.GetRepository <Category>().List();
            this.CategoryList.DataBind();

            if (forumId.HasValue)
            {
                this.AccessList.DataSource = LegacyDb.forumaccess_list(forumId.Value);
                this.AccessList.DataBind();
            }

            // Load forum's combo
            this.BindParentList();

            // Load forum's themes
            var listheader = new ListItem
            {
                Text  = this.GetText("ADMIN_EDITFORUM", "CHOOSE_THEME"),
                Value = string.Empty
            };

            this.AccessMaskID.DataBind();

            this.ThemeList.DataSource     = StaticDataHelper.Themes();
            this.ThemeList.DataTextField  = "Theme";
            this.ThemeList.DataValueField = "FileName";
            this.ThemeList.DataBind();
            this.ThemeList.Items.Insert(0, listheader);
        }
Exemple #16
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            this.UserSearchName.Focus();

            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.ViewState["SortNameField"]      = 1;
            this.ViewState["SortRankNameField"]  = 0;
            this.ViewState["SortJoinedField"]    = 0;
            this.ViewState["SortNumPostsField"]  = 0;
            this.ViewState["SortLastVisitField"] = 0;

            this.PageLinks.AddRoot().AddLink(this.GetText("TITLE"));

            this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSEQUAL"), "1"));
            this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSLESSOREQUAL"), "2"));
            this.NumPostDDL.Items.Add(new ListItem(this.GetText("MEMBERS", "NUMPOSTSMOREOREQUAL"), "3"));

            this.NumPostDDL.DataBind();

            // get list of user ranks for filtering
            var ranks = this.GetRepository <Rank>().GetByBoardId().OrderBy(r => r.SortOrder).ToList();

            ranks.Insert(0, new Rank {
                Name = this.GetText("ALL"), ID = 0
            });

            ranks.RemoveAll(r => r.Name == "Guest");

            this.Ranks.DataSource     = ranks;
            this.Ranks.DataTextField  = "Name";
            this.Ranks.DataValueField = "ID";
            this.Ranks.DataBind();

            // get list of user ranks for filtering
            var groups = this.GetRepository <Group>().GetByBoardId().OrderBy(r => r.SortOrder).ToList();

            groups.Insert(0, new Group {
                Name = this.GetText("ALL"), ID = 0
            });

            groups.RemoveAll(r => r.Name == "Guests");

            this.Group.DataSource     = groups;
            this.Group.DataTextField  = "Name";
            this.Group.DataValueField = "ID";
            this.Group.DataBind();

            this.BindData();
        }
Exemple #17
0
        /// <summary>
        /// Save Current board / Create new Board
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void SaveClick([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.BoardId == null && this.CreateAdminUser.Checked)
            {
                if (this.UserPass1.Text != this.UserPass2.Text)
                {
                    this.PageContext.AddLoadMessage(
                        this.GetText("ADMIN_EDITBOARD", "MSG_PASS_MATCH"),
                        MessageTypes.warning);
                    return;
                }
            }

            if (this.BoardId != null)
            {
                var cult     = StaticDataHelper.Cultures();
                var langFile = "en-US";

                cult
                .Where(dataRow => dataRow.CultureTag == this.Culture.SelectedValue)
                .ForEach(row => langFile = row.CultureFile);

                // Save current board settings
                this.GetRepository <Board>().Save(
                    this.BoardId ?? 0,
                    this.Name.Text.Trim(),
                    langFile,
                    this.Culture.SelectedItem.Value);
            }
            else
            {
                // Create board
                if (this.CreateAdminUser.Checked)
                {
                    this.CreateBoard(
                        this.UserName.Text.Trim(),
                        this.UserPass1.Text,
                        this.UserEmail.Text.Trim(),
                        this.Name.Text.Trim(),
                        true);
                }
                else
                {
                    // create admin user from logged in user...
                    this.CreateBoard(
                        null,
                        null,
                        null,
                        this.Name.Text.Trim(),
                        false);
                }
            }

            // Done
            this.PageContext.BoardSettings = null;

            this.Get <LinkBuilder>().Redirect(ForumPages.Admin_Boards);
        }
Exemple #18
0
        /// <summary>
        /// Save the Board Settings
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void SaveClick([NotNull] object sender, [NotNull] EventArgs e)
        {
            var languageFile = "english.xml";

            var cultures = StaticDataHelper.Cultures()
                           .Where(c => c.CultureTag.Equals(this.Culture.SelectedValue)).ToList();

            if (cultures.Any())
            {
                languageFile = cultures.FirstOrDefault().CultureFile;
            }

            this.GetRepository <Board>().Save(
                this.PageContext.PageBoardID,
                this.Name.Text,
                languageFile,
                this.Culture.SelectedValue);

            // save poll group
            var boardSettings = this.Get <BoardSettings>();

            boardSettings.Language = languageFile;
            boardSettings.Culture  = this.Culture.SelectedValue;
            boardSettings.Theme    = this.Theme.SelectedValue;

            // allow null/empty as a mobile theme many not be desired.
            boardSettings.ShowTopicsDefault = this.ShowTopic.SelectedValue.ToType <int>();
            boardSettings.NotificationOnUserRegisterEmailList = this.NotificationOnUserRegisterEmailList.Text.Trim();

            boardSettings.EmailModeratorsOnModeratedPost = this.EmailModeratorsOnModeratedPost.Checked;
            boardSettings.EmailModeratorsOnReportedPost  = this.EmailModeratorsOnReportedPost.Checked;
            boardSettings.AllowDigestEmail           = this.AllowDigestEmail.Checked;
            boardSettings.DefaultSendDigestEmail     = this.DefaultSendDigestEmail.Checked;
            boardSettings.DefaultNotificationSetting =
                this.DefaultNotificationSetting.SelectedValue.ToEnum <UserNotificationSetting>();

            boardSettings.ForumEmail = this.ForumEmail.Text;

            if (this.BoardLogo.SelectedIndex > 0)
            {
                boardSettings.ForumLogo = this.BoardLogo.SelectedItem.Text;
            }

            boardSettings.BaseUrlMask = this.ForumBaseUrlMask.Text;
            boardSettings.CopyrightRemovalDomainKey = this.CopyrightRemovalKey.Text.Trim();
            boardSettings.DigestSendEveryXHours     = this.DigestSendEveryXHours.Text.ToType <int>();

            // save the settings to the database
            ((LoadBoardSettings)boardSettings).SaveRegistry();

            // Reload forum settings
            this.PageContext.BoardSettings = null;

            // Clearing cache with old users permissions data to get new default styles...
            this.Get <IDataCache>().Remove(x => x.StartsWith(Constants.Cache.ActiveUserLazyData));

            BuildLink.Redirect(ForumPages.Admin_Admin);
        }
Exemple #19
0
        /// <summary>
        /// Handles the Click event of the Search control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Search_Click(object sender, EventArgs e)
        {
            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.BindData();
        }
Exemple #20
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            if (Config.IsAnyPortal)
            {
                this.ImportUsers.Visible = false;
                this.SyncUsers.Visible   = false;
            }

            // initialize since filter items
            this.InitSinceDropdown();

            // set since filter to last item "All time"
            this.Since.SelectedIndex = this.Since.Items.Count - 1;

            // get list of user groups for filtering
            var groups = this.GetRepository <Group>().List(boardId: this.PageContext.PageBoardID);

            groups.Insert(0, new Group {
                Name = this.GetText("FILTER_NO"), ID = 0
            });

            this.group.DataTextField  = "Name";
            this.group.DataValueField = "ID";
            this.group.DataSource     = groups;

            this.group.DataBind();

            // get list of user ranks for filtering
            var ranks = this.GetRepository <Rank>().GetByBoardId().OrderBy(r => r.SortOrder).ToList();

            // add empty for for no filtering
            ranks.Insert(0, new Rank {
                Name = this.GetText("FILTER_NO"), ID = 0
            });

            this.rank.DataSource     = ranks;
            this.rank.DataTextField  = "Name";
            this.rank.DataValueField = "ID";
            this.rank.DataBind();

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.PagerTop.PageSize = this.PageSize.SelectedValue.ToType <int>();

            // Hide "New User" & Sync Button on DotNetNuke
            this.ImportAndSyncHolder.Visible = !Config.IsDotNetNuke;

            this.BindData();
        }
        /// <summary>
        /// The save_ click.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Save_Click([NotNull] object sender, [NotNull] EventArgs e)
        {
            string languageFile = "english.xml";

            var cultures =
                StaticDataHelper.Cultures().AsEnumerable().Where(
                    c => c.Field <string>("CultureTag").Equals(this.Culture.SelectedValue));

            if (cultures.Any())
            {
                languageFile = cultures.First().Field <string>("CultureFile");
            }

            DB.board_save(
                this.PageContext.PageBoardID,
                languageFile,
                this.Culture.SelectedValue,
                this.Name.Text,
                this.AllowThreaded.Checked);

            // save poll group
            this.PageContext.BoardSettings.BoardPollID = this.PollGroupListDropDown.SelectedIndex.ToType <int>() > 0
                                                     ? this.PollGroupListDropDown.SelectedValue.ToType <int>()
                                                     : 0;

            this.PageContext.BoardSettings.Language = languageFile;
            this.PageContext.BoardSettings.Culture  = this.Culture.SelectedValue;
            this.PageContext.BoardSettings.Theme    = this.Theme.SelectedValue;

            // allow null/empty as a mobile theme many not be desired.
            this.PageContext.BoardSettings.MobileTheme = this.MobileTheme.SelectedValue ?? String.Empty;

            this.PageContext.BoardSettings.ShowTopicsDefault       = this.ShowTopic.SelectedValue.ToType <int>();
            this.PageContext.BoardSettings.AllowThemedLogo         = this.AllowThemedLogo.Checked;
            this.PageContext.BoardSettings.FileExtensionAreAllowed = this.FileExtensionAllow.SelectedValue.ToType <int>() == 0
                                                                 ? true
                                                                 : false;
            this.PageContext.BoardSettings.NotificationOnUserRegisterEmailList =
                this.NotificationOnUserRegisterEmailList.Text.Trim();

            this.PageContext.BoardSettings.EmailModeratorsOnModeratedPost = this.EmailModeratorsOnModeratedPost.Checked;
            this.PageContext.BoardSettings.AllowDigestEmail           = this.AllowDigestEmail.Checked;
            this.PageContext.BoardSettings.DefaultSendDigestEmail     = this.DefaultSendDigestEmail.Checked;
            this.PageContext.BoardSettings.DefaultNotificationSetting =
                this.DefaultNotificationSetting.SelectedValue.ToEnum <UserNotificationSetting>();

            // save the settings to the database
            ((YafLoadBoardSettings)this.PageContext.BoardSettings).SaveRegistry();

            // Reload forum settings
            this.PageContext.BoardSettings = null;

            // Clearing cache with old users permissions data to get new default styles...
            this.PageContext.Cache.Remove((x) => x.StartsWith(YafCache.GetBoardCacheKey(Constants.Cache.ActiveUserLazyData)));
            YafBuildLink.Redirect(ForumPages.admin_admin);
        }
Exemple #22
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.Culture.DataSource =
                StaticDataHelper.Cultures()
                .AsEnumerable()
                .OrderBy(x => x.Field <string>("CultureNativeName"))
                .CopyToDataTable();
            this.Culture.DataValueField = "CultureTag";
            this.Culture.DataTextField  = "CultureNativeName";

            this.BindData();

            if (this.Culture.Items.Count > 0)
            {
                this.Culture.Items.FindByValue(this.Get <YafBoardSettings>().Culture).Selected = true;
            }

            if (this.BoardId != null)
            {
                this.CreateNewAdminHolder.Visible = false;

                using (var dt = this.GetRepository <Board>().List(this.BoardId))
                {
                    var row = dt.Rows[0];
                    this.Name.Text             = (string)row["Name"];
                    this.AllowThreaded.Checked = Convert.ToBoolean(row["AllowThreaded"]);

                    var membershipAppName = row["MembershipAppName"].ToString();

                    if (membershipAppName.IsSet())
                    {
                        this.BoardMembershipAppName.Text    = row["MembershipAppName"].ToString();
                        this.BoardMembershipAppName.Enabled = false;
                    }
                    else
                    {
                        this.BoardMembershipAppNameHolder.Visible = false;
                    }
                }
            }
            else
            {
                this.UserName.Text  = this.User.UserName;
                this.UserEmail.Text = this.User.Email;
            }

            if (Config.IsDotNetNuke)
            {
                this.CreateNewAdminHolder.Visible = false;
            }
        }
Exemple #23
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.TimeZones.DataSource = StaticDataHelper.TimeZones();
            this.DataBind();
        }
Exemple #24
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.TimeZones.DataSource = StaticDataHelper.TimeZones();
            this.DataBind();
            this.TimeZones.Items.FindByValue("0").Selected = true;
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.Culture.DataSource =
                StaticDataHelper.Cultures()
                .AsEnumerable()
                .OrderBy(x => x.Field <string>("CultureNativeName"))
                .CopyToDataTable();
            this.Culture.DataValueField = "CultureTag";
            this.Culture.DataTextField  = "CultureNativeName";

            this.BindData();

            if (this.Culture.Items.Count > 0)
            {
                this.Culture.Items.FindByValue(this.Get <YafBoardSettings>().Culture).Selected = true;
            }

            if (this.BoardId != null)
            {
                this.CreateNewAdminHolder.Visible = false;

                var board = this.GetRepository <Board>().GetById(this.BoardId.Value);

                this.Name.Text             = board.Name;
                this.AllowThreaded.Checked = board.AllowThreaded;

                var membershipAppName = board.MembershipAppName;

                if (membershipAppName.IsSet())
                {
                    this.BoardMembershipAppName.Text    = membershipAppName;
                    this.BoardMembershipAppName.Enabled = false;
                }
                else
                {
                    this.BoardMembershipAppNameHolder.Visible = false;
                }
            }
            else
            {
                this.UserName.Text  = this.User.UserName;
                this.UserEmail.Text = this.User.Email;
            }

            if (Config.IsDotNetNuke)
            {
                this.CreateNewAdminHolder.Visible = false;
            }
        }
Exemple #26
0
    /// <summary>
    /// Binds the data.
    /// </summary>
    private void BindData()
    {
        var baseSize = this.PageSize.SelectedValue.ToType <int>();

        this.PagerTop.PageSize = baseSize;

        var cultures = StaticDataHelper.LanguageFiles().ToList().GetPaged(this.PagerTop);

        this.List.DataSource = cultures;

        this.DataBind();
    }
Exemple #27
0
        /// <summary>
        /// The page_ load.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.PageLinks.AddLink(PageContext.BoardSettings.Name, YafBuildLink.GetLink(ForumPages.forum));
                this.PageLinks.AddLink("Administration", YafBuildLink.GetLink(ForumPages.admin_admin));
                this.PageLinks.AddLink("Users", string.Empty);

                this.TimeZones.DataSource = StaticDataHelper.TimeZones();
                DataBind();
                this.TimeZones.Items.FindByValue("0").Selected = true;
            }
        }
Exemple #28
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            var cultureTable = StaticDataHelper.Cultures();

            this.List.DataSource = cultureTable;

            YafContext.Current.PageElements.RegisterJsBlock(
                "tablesorterLoadJs",
                JavaScriptBlocks.LoadTableSorter(
                    "#language-table",
                    cultureTable.HasRows() ? "headers: { 4: { sorter: false }}" : null));

            this.DataBind();
        }
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            if (this.IsPostBack)
            {
                return;
            }

            this.PageSize.DataSource     = StaticDataHelper.PageEntries();
            this.PageSize.DataTextField  = "Name";
            this.PageSize.DataValueField = "Value";
            this.PageSize.DataBind();

            this.BindData();
        }
        /// <summary>
        /// Sets the theme class up for usage
        /// </summary>
        /// <exception cref="CantLoadThemeException"><c>CantLoadThemeException</c>.</exception>
        private void InitTheme()
        {
            if (this._initTheme)
            {
                return;
            }

            if (this.BeforeInit != null)
            {
                this.BeforeInit(this, new EventArgs());
            }

            string themeFile;

            if (YafContext.Current.Page != null && YafContext.Current.Page["ThemeFile"] != null &&
                YafContext.Current.BoardSettings.AllowUserTheme)
            {
                // use user-selected theme
                themeFile = YafContext.Current.Page["ThemeFile"].ToString();
            }
            else if (YafContext.Current.Page != null && YafContext.Current.Page["ForumTheme"] != null)
            {
                themeFile = YafContext.Current.Page["ForumTheme"].ToString();
            }
            else
            {
                themeFile = YafContext.Current.BoardSettings.Theme;
            }

            if (!YafTheme.IsValidTheme(themeFile))
            {
                themeFile = StaticDataHelper.Themes().Rows[0][1].ToString();
            }

            // create the theme class
            this.Theme = new YafTheme(themeFile);

            // make sure it's valid again...
            if (!YafTheme.IsValidTheme(this.Theme.ThemeFile))
            {
                // can't load a theme... throw an exception.
                throw new CantLoadThemeException(
                          @"Unable to find a theme to load. Last attempted to load ""{0}"" but failed.".FormatWith(themeFile));
            }

            if (this.AfterInit != null)
            {
                this.AfterInit(this, new EventArgs());
            }
        }