private function build_form()
    {
        $form = new HTMLForm(__CLASS__);
        $fieldset = new FormFieldsetHTML('configuration', LangLoader::get_message('configuration', 'admin-common'));
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldNumberEditor('items_number_per_page', $this->lang['config.items_number_per_page'], $this->config->get_items_number_per_page(), array('min' => 1, 'max' => 50, 'required' => true), array(new FormFieldConstraintIntegerRange(1, 50))));
        $fieldset->add_field(new FormFieldCheckbox('max_messages_number_enabled', $this->lang['config.max_messages_number_enabled'], $this->config->is_max_messages_number_enabled(), array('events' => array('click' => '
				if (HTMLForms.getField("max_messages_number_enabled").getValue()) {
					HTMLForms.getField("max_messages_number").enable();
				} else {
					HTMLForms.getField("max_messages_number").disable();
				}'))));
        $fieldset->add_field(new FormFieldNumberEditor('max_messages_number', $this->lang['config.max_messages_number'], $this->config->get_max_messages_number(), array('min' => 5, 'max' => 1000, 'required' => true, 'hidden' => !$this->config->is_max_messages_number_enabled()), array(new FormFieldConstraintIntegerRange(5, 1000))));
        $fieldset->add_field(new FormFieldCheckbox('max_links_number_per_message_enabled', $this->lang['config.max_links_number_per_message_enabled'], $this->config->is_max_links_number_per_message_enabled(), array('events' => array('click' => '
				if (HTMLForms.getField("max_links_number_per_message_enabled").getValue()) {
					HTMLForms.getField("max_links_number_per_message").enable();
				} else {
					HTMLForms.getField("max_links_number_per_message").disable();
				}'))));
        $fieldset->add_field(new FormFieldNumberEditor('max_links_number_per_message', $this->lang['config.max_links_number_per_message'], $this->config->get_max_links_number_per_message(), array('min' => 1, 'max' => 20, 'required' => true, 'hidden' => !$this->config->is_max_links_number_per_message_enabled()), array(new FormFieldConstraintIntegerRange(1, 20))));
        $fieldset->add_field(new FormFieldMultipleSelectChoice('forbidden_formatting_tags', LangLoader::get_message('config.forbidden-tags', 'admin-common'), $this->config->get_forbidden_formatting_tags(), $this->generate_forbidden_formatting_tags_option(), array('size' => 10)));
        $fieldset = new FormFieldsetHTML('configuration', $this->lang['config.shoutbox_menu']);
        $form->add_fieldset($fieldset);
        $fieldset->add_field(new FormFieldCheckbox('automatic_refresh_enabled', $this->lang['config.automatic_refresh_enabled'], $this->config->is_automatic_refresh_enabled(), array('events' => array('click' => '
				if (HTMLForms.getField("automatic_refresh_enabled").getValue()) {
					HTMLForms.getField("refresh_delay").enable();
				} else {
					HTMLForms.getField("refresh_delay").disable();
				}'))));
        $fieldset->add_field(new FormFieldDecimalNumberEditor('refresh_delay', $this->lang['config.refresh_delay'], $this->config->get_refresh_delay() / 60000, array('min' => 0, 'max' => 60, 'step' => 0.5, 'description' => $this->lang['config.refresh_delay.explain'], 'required' => true, 'hidden' => !$this->config->is_automatic_refresh_enabled())));
        $fieldset->add_field(new FormFieldCheckbox('date_displayed', $this->lang['config.date_displayed'], $this->config->is_date_displayed()));
        $fieldset->add_field(new FormFieldCheckbox('shout_max_messages_number_enabled', $this->lang['config.shout_max_messages_number_enabled'], $this->config->is_shout_max_messages_number_enabled(), array('events' => array('click' => '
				if (HTMLForms.getField("shout_max_messages_number_enabled").getValue()) {
					HTMLForms.getField("shout_max_messages_number").enable();
				} else {
					HTMLForms.getField("shout_max_messages_number").disable();
				}'))));
        $fieldset->add_field(new FormFieldNumberEditor('shout_max_messages_number', $this->lang['config.shout_max_messages_number'], $this->config->get_shout_max_messages_number(), array('min' => 5, 'max' => 1000, 'required' => true, 'hidden' => !$this->config->is_shout_max_messages_number_enabled()), array(new FormFieldConstraintIntegerRange(5, 1000))));
        if (ModulesManager::is_module_installed('BBCode')) {
            $fieldset->add_field(new FormFieldCheckbox('shout_bbcode_enabled', $this->lang['config.shout_bbcode_enabled'], $this->config->is_shout_bbcode_enabled()));
        }
        $fieldset->add_field(new FormFieldCheckbox('validation_onkeypress_enter_enabled', $this->lang['config.validation_onkeypress_enter_enabled'], $this->config->is_validation_onkeypress_enter_enabled()));
        $common_lang = LangLoader::get('common');
        $fieldset_authorizations = new FormFieldsetHTML('authorizations', $common_lang['authorizations']);
        $form->add_fieldset($fieldset_authorizations);
        $auth_settings = new AuthorizationsSettings(array(new ActionAuthorization($common_lang['authorizations.read'], ShoutboxAuthorizationsService::READ_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.write'], ShoutboxAuthorizationsService::WRITE_AUTHORIZATIONS), new ActionAuthorization($common_lang['authorizations.moderation'], ShoutboxAuthorizationsService::MODERATION_AUTHORIZATIONS)));
        $auth_setter = new FormFieldAuthorizationsSetter('authorizations', $auth_settings);
        $auth_settings->build_from_auth_array($this->config->get_authorizations());
        $fieldset_authorizations->add_field($auth_setter);
        $this->submit_button = new FormButtonDefaultSubmit();
        $form->add_button($this->submit_button);
        $form->add_button(new FormButtonReset());
        $this->form = $form;
    }