BeginBulkUpdate() public static method

Begins a bulk update session.
public static BeginBulkUpdate ( ) : void
return void
Ejemplo n.º 1
0
        protected void btnSaveDefaultProviders_Click(object sender, EventArgs e)
        {
            Log.LogEntry("Default providers change requested", EntryType.General, SessionFacade.CurrentUsername);

            Settings.BeginBulkUpdate();
            Settings.DefaultPagesProvider = lstPagesProvider.SelectedProvider;
            Settings.DefaultUsersProvider = lstUsersProvider.SelectedProvider;
            Settings.DefaultFilesProvider = lstFilesProvider.SelectedProvider;
            Settings.DefaultCacheProvider = lstCacheProvider.SelectedProvider;
            Settings.EndBulkUpdate();

            lblDefaultProvidersResult.CssClass = "resultok";
            lblDefaultProvidersResult.Text     = Properties.Messages.DefaultProvidersSaved;

            ResetEditor();
            rptProviders.DataBind();
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblResult.CssClass = "";
            lblResult.Text     = "";

            Page.Validate();

            if (!Page.IsValid)
            {
                return;
            }

            Log.LogEntry("Wiki Configuration change requested", EntryType.General, SessionFacade.CurrentUsername);

            Settings.BeginBulkUpdate();

            // Save general configuration
            Settings.WikiTitle    = txtWikiTitle.Text;
            Settings.MainUrl      = txtMainUrl.Text;
            Settings.ContactEmail = txtContactEmail.Text;
            Settings.SenderEmail  = txtSenderEmail.Text;
            Settings.ErrorsEmails = GetErrorsEmails();
            Settings.SmtpServer   = txtSmtpServer.Text;

            txtSmtpPort.Text = txtSmtpPort.Text.Trim();
            if (txtSmtpPort.Text.Length > 0)
            {
                Settings.SmtpPort = int.Parse(txtSmtpPort.Text);
            }
            else
            {
                Settings.SmtpPort = -1;
            }
            if (txtUsername.Text.Length > 0)
            {
                Settings.SmtpUsername = txtUsername.Text;
                Settings.SmtpPassword = txtPassword.Text;
            }
            else
            {
                Settings.SmtpUsername = "";
                Settings.SmtpPassword = "";
            }
            Settings.SmtpSsl = chkEnableSslForSmtp.Checked;

            // Save content configuration
            Settings.SetTheme(null, lstRootTheme.SelectedValue);
            Settings.DefaultPage               = lstMainPage.SelectedValue;
            Settings.DateTimeFormat            = txtDateTimeFormat.Text;
            Settings.DefaultLanguage           = lstDefaultLanguage.SelectedValue;
            Settings.DefaultTimezone           = int.Parse(lstDefaultTimeZone.SelectedValue);
            Settings.MaxRecentChangesToDisplay = int.Parse(txtMaxRecentChangesToDisplay.Text);
            Settings.RssFeedsMode              = (RssFeedsMode)Enum.Parse(typeof(RssFeedsMode), lstRssFeedsMode.SelectedValue);
            Settings.EnableDoubleClickEditing  = chkEnableDoubleClickEditing.Checked;
            Settings.EnableSectionEditing      = chkEnableSectionEditing.Checked;
            Settings.EnableSectionAnchors      = chkEnableSectionAnchors.Checked;
            Settings.EnablePageToolbar         = chkEnablePageToolbar.Checked;
            Settings.EnableViewPageCodeFeature = chkEnableViewPageCode.Checked;
            Settings.EnablePageInfoDiv         = chkEnablePageInfoDiv.Checked;
            Settings.DisableBreadcrumbsTrail   = !chkEnableBreadcrumbsTrail.Checked;
            Settings.AutoGeneratePageNames     = chkAutoGeneratePageNames.Checked;
            Settings.ProcessSingleLineBreaks   = chkProcessSingleLineBreaks.Checked;
            Settings.UseVisualEditorAsDefault  = chkUseVisualEditorAsDefault.Checked;
            if (txtKeptBackupNumber.Text == "")
            {
                Settings.KeptBackupNumber = -1;
            }
            else
            {
                Settings.KeptBackupNumber = int.Parse(txtKeptBackupNumber.Text);
            }
            Settings.DisplayGravatars = chkDisplayGravatars.Checked;
            Settings.ListSize         = int.Parse(txtListSize.Text);

            // Save security configuration
            Settings.UsersCanRegister = chkAllowUsersToRegister.Checked;
            Settings.UsernameRegex    = txtUsernameRegEx.Text;
            Settings.PasswordRegex    = txtPasswordRegEx.Text;
            AccountActivationMode mode = AccountActivationMode.Email;

            switch (lstAccountActivationMode.SelectedValue.ToLowerInvariant())
            {
            case "email":
                mode = AccountActivationMode.Email;
                break;

            case "admin":
                mode = AccountActivationMode.Administrator;
                break;

            case "auto":
                mode = AccountActivationMode.Auto;
                break;
            }
            Settings.AccountActivationMode    = mode;
            Settings.UsersGroup               = lstDefaultUsersGroup.SelectedValue;
            Settings.AdministratorsGroup      = lstDefaultAdministratorsGroup.SelectedValue;
            Settings.AnonymousGroup           = lstDefaultAnonymousGroup.SelectedValue;
            Settings.DisableCaptchaControl    = !chkEnableCaptchaControl.Checked;
            Settings.DisableConcurrentEditing = chkPreventConcurrentEditing.Checked;

            if (rdoNoModeration.Checked)
            {
                Settings.ChangeModerationMode = ChangeModerationMode.None;
            }
            else if (rdoRequirePageViewingPermissions.Checked)
            {
                Settings.ChangeModerationMode = ChangeModerationMode.RequirePageViewingPermissions;
            }
            else if (rdoRequirePageEditingPermissions.Checked)
            {
                Settings.ChangeModerationMode = ChangeModerationMode.RequirePageEditingPermissions;
            }

            Settings.AllowedFileTypes = GetAllowedFileExtensions();

            Settings.FileDownloadCountFilterMode = (FileDownloadCountFilterMode)Enum.Parse(typeof(FileDownloadCountFilterMode), lstFileDownloadCountFilterMode.SelectedValue);
            Settings.FileDownloadCountFilter     = txtFileDownloadCountFilter.Text.Replace(" ", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            Settings.MaxFileSize       = int.Parse(txtMaxFileSize.Text);
            Settings.ScriptTagsAllowed = chkAllowScriptTags.Checked;
            LoggingLevel level = LoggingLevel.AllMessages;

            if (rdoAllMessages.Checked)
            {
                level = LoggingLevel.AllMessages;
            }
            else if (rdoWarningsAndErrors.Checked)
            {
                level = LoggingLevel.WarningsAndErrors;
            }
            else if (rdoErrorsOnly.Checked)
            {
                level = LoggingLevel.ErrorsOnly;
            }
            else
            {
                level = LoggingLevel.DisableLog;
            }
            Settings.LoggingLevel = level;
            Settings.MaxLogSize   = int.Parse(txtMaxLogSize.Text);
            Settings.IpHostFilter = txtIpHostFilter.Text;

            // Save advanced configuration
            Settings.DisableAutomaticVersionCheck = !chkEnableAutomaticUpdateChecks.Checked;
            Settings.DisableCache = chkDisableCache.Checked;
            Settings.CacheSize    = int.Parse(txtCacheSize.Text);
            Settings.CacheCutSize = int.Parse(txtCacheCutSize.Text);
            Settings.EnableViewStateCompression = chkEnableViewStateCompression.Checked;
            Settings.EnableHttpCompression      = chkEnableHttpCompression.Checked;

            Settings.EndBulkUpdate();

            Content.InvalidateAllPages();
            Content.ClearPseudoCache();

            lblResult.CssClass = "resultok";
            lblResult.Text     = Properties.Messages.ConfigSaved;
        }
Ejemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblResult.CssClass = "";
            lblResult.Text     = "";

            Page.Validate();

            if (!Page.IsValid)
            {
                return;
            }

            Log.LogEntry("Wiki Configuration change requested", EntryType.General, SessionFacade.CurrentUsername, currentWiki);

            Settings.BeginBulkUpdate(currentWiki);

            // Save general configuration
            Settings.SetWikiTitle(currentWiki, txtWikiTitle.Text);
            Settings.SetMainUrl(currentWiki, txtMainUrl.Text);

            // Save content configuration
            Settings.SetTheme(currentWiki, null, ThemeRootSelector.SelectedProvider + "|" + ThemeRootSelector.SelectedThemes);
            Settings.SetDefaultPage(currentWiki, lstMainPage.SelectedValue);
            Settings.SetDateTimeFormat(currentWiki, txtDateTimeFormat.Text);
            Settings.SetDefaultLanguage(currentWiki, lstDefaultLanguage.SelectedValue);
            Settings.SetDefaultTimezone(currentWiki, lstDefaultTimeZone.SelectedValue);
            Settings.SetMaxRecentChangesToDisplay(currentWiki, int.Parse(txtMaxRecentChangesToDisplay.Text));
            Settings.SetRssFeedsMode(currentWiki, (RssFeedsMode)Enum.Parse(typeof(RssFeedsMode), lstRssFeedsMode.SelectedValue));
            Settings.SetEnableDoubleClickEditing(currentWiki, chkEnableDoubleClickEditing.Checked);
            Settings.SetEnableSectionEditing(currentWiki, chkEnableSectionEditing.Checked);
            Settings.SetEnableSectionAnchors(currentWiki, chkEnableSectionAnchors.Checked);
            Settings.SetEnablePageToolbar(currentWiki, chkEnablePageToolbar.Checked);
            Settings.SetEnableViewPageCodeFeature(currentWiki, chkEnableViewPageCode.Checked);
            Settings.SetEnablePageInfoDiv(currentWiki, chkEnablePageInfoDiv.Checked);
            Settings.SetDisableBreadcrumbsTrail(currentWiki, !chkEnableBreadcrumbsTrail.Checked);
            Settings.SetAutoGeneratePageNames(currentWiki, chkAutoGeneratePageNames.Checked);
            Settings.SetProcessSingleLineBreaks(currentWiki, chkProcessSingleLineBreaks.Checked);
            Settings.SetUseVisualEditorAsDefault(currentWiki, chkUseVisualEditorAsDefault.Checked);
            if (txtKeptBackupNumber.Text == "")
            {
                Settings.SetKeptBackupNumber(currentWiki, -1);
            }
            else
            {
                Settings.SetKeptBackupNumber(currentWiki, int.Parse(txtKeptBackupNumber.Text));
            }
            Settings.SetDisplayGravatars(currentWiki, chkDisplayGravatars.Checked);
            Settings.SetListSize(currentWiki, int.Parse(txtListSize.Text));

            // Save security configuration
            Settings.SetUsersCanRegister(currentWiki, chkAllowUsersToRegister.Checked);
            AccountActivationMode mode = AccountActivationMode.Email;

            switch (lstAccountActivationMode.SelectedValue.ToLowerInvariant())
            {
            case "email":
                mode = AccountActivationMode.Email;
                break;

            case "admin":
                mode = AccountActivationMode.Administrator;
                break;

            case "auto":
                mode = AccountActivationMode.Auto;
                break;
            }
            Settings.SetAccountActivationMode(currentWiki, mode);
            Settings.SetUsersGroup(currentWiki, lstDefaultUsersGroup.SelectedValue);
            Settings.SetAdministratorsGroup(currentWiki, lstDefaultAdministratorsGroup.SelectedValue);
            Settings.SetAnonymousGroup(currentWiki, lstDefaultAnonymousGroup.SelectedValue);
            Settings.SetDisableCaptchaControl(currentWiki, !chkEnableCaptchaControl.Checked);
            Settings.SetDisableConcurrentEditing(currentWiki, chkPreventConcurrentEditing.Checked);

            if (rdoNoModeration.Checked)
            {
                Settings.SetModerationMode(currentWiki, ChangeModerationMode.None);
            }
            else if (rdoRequirePageViewingPermissions.Checked)
            {
                Settings.SetModerationMode(currentWiki, ChangeModerationMode.RequirePageViewingPermissions);
            }
            else if (rdoRequirePageEditingPermissions.Checked)
            {
                Settings.SetModerationMode(currentWiki, ChangeModerationMode.RequirePageEditingPermissions);
            }

            Settings.SetAllowedFileTypes(currentWiki, GetAllowedFileExtensions());

            Settings.SetFileDownloadCountFilterMode(currentWiki, (FileDownloadCountFilterMode)Enum.Parse(typeof(FileDownloadCountFilterMode), lstFileDownloadCountFilterMode.SelectedValue));
            Settings.SetFileDownloadCountFilter(currentWiki, txtFileDownloadCountFilter.Text.Replace(" ", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

            Settings.SetScriptTagsAllowed(currentWiki, chkAllowScriptTags.Checked);
            Settings.SetIpHostFilter(currentWiki, txtIpHostFilter.Text);

            Settings.EndBulkUpdate(currentWiki);

            lblResult.CssClass = "resultok";
            lblResult.Text     = Properties.Messages.ConfigSaved;
        }