diff --git a/application/controllers/GroupController.php b/application/controllers/GroupController.php index ee692e109..0f0e9514d 100644 --- a/application/controllers/GroupController.php +++ b/application/controllers/GroupController.php @@ -131,7 +131,7 @@ class GroupController extends AuthBackendController $removeForm->addElement('button', 'btn_submit', array( 'escape' => false, 'type' => 'submit', - 'class' => 'link-like', + 'class' => 'link-like spinner', 'value' => 'btn_submit', 'decorators' => array('ViewHelper'), 'label' => $this->view->icon('trash'), diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 46c1b5381..a5fec106a 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -137,7 +137,7 @@ class UserController extends AuthBackendController $removeForm->addElement('button', 'btn_submit', array( 'escape' => false, 'type' => 'submit', - 'class' => 'link-like', + 'class' => 'link-like spinner', 'value' => 'btn_submit', 'decorators' => array('ViewHelper'), 'label' => $this->view->icon('trash'), diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index f7bae3d1b..9646046f6 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -27,6 +27,7 @@ class LoginForm extends Form $this->setRequiredCue(null); $this->setName('form_login'); $this->setSubmitLabel($this->translate('Login')); + $this->setProgressLabel($this->translate('Logging in')); } /** diff --git a/application/forms/Config/General/ApplicationConfigForm.php b/application/forms/Config/General/ApplicationConfigForm.php index 618178344..4e431aab2 100644 --- a/application/forms/Config/General/ApplicationConfigForm.php +++ b/application/forms/Config/General/ApplicationConfigForm.php @@ -25,6 +25,20 @@ class ApplicationConfigForm extends Form */ public function createElements(array $formData) { + $this->addElement( + 'checkbox', + 'global_show_stacktraces', + array( + 'required' => true, + 'value' => true, + 'label' => $this->translate('Show Stacktraces'), + 'description' => $this->translate( + 'Set whether to show an exception\'s stacktrace by default. This can also' + . ' be set in a user\'s preferences with the appropriate permission.' + ) + ) + ); + $this->addElement( 'text', 'global_module_path', diff --git a/application/forms/Config/Resource/LdapResourceForm.php b/application/forms/Config/Resource/LdapResourceForm.php index c6e452d2c..d20ec55af 100644 --- a/application/forms/Config/Resource/LdapResourceForm.php +++ b/application/forms/Config/Resource/LdapResourceForm.php @@ -81,22 +81,6 @@ class LdapResourceForm extends Form ) ); - if (isset($formData['encryption']) && $formData['encryption'] !== 'none') { - // TODO(jom): Do not show this checkbox unless the connection is actually failing due to certificate errors - $this->addElement( - 'checkbox', - 'reqcert', - array( - 'required' => true, - 'label' => $this->translate('Require Certificate'), - 'description' => $this->translate( - 'When checked, the LDAP server must provide a valid and known (trusted) certificate.' - ), - 'value' => 1 - ) - ); - } - $this->addElement( 'text', 'root_dn', diff --git a/application/forms/Config/ResourceConfigForm.php b/application/forms/Config/ResourceConfigForm.php index 51e1b1bff..db951e67a 100644 --- a/application/forms/Config/ResourceConfigForm.php +++ b/application/forms/Config/ResourceConfigForm.php @@ -344,9 +344,10 @@ class ResourceConfigForm extends ConfigForm 'submit', 'resource_validation', array( - 'ignore' => true, - 'label' => $this->translate('Validate Configuration'), - 'decorators' => array('ViewHelper') + 'ignore' => true, + 'label' => $this->translate('Validate Configuration'), + 'data-progress-label' => $this->translate('Validation In Progress'), + 'decorators' => array('ViewHelper') ) ); $this->addDisplayGroup( diff --git a/application/forms/Config/UserBackendConfigForm.php b/application/forms/Config/UserBackendConfigForm.php index 5ee4674bb..1183ae724 100644 --- a/application/forms/Config/UserBackendConfigForm.php +++ b/application/forms/Config/UserBackendConfigForm.php @@ -464,9 +464,10 @@ class UserBackendConfigForm extends ConfigForm 'submit', 'backend_validation', array( - 'ignore' => true, - 'label' => $this->translate('Validate Configuration'), - 'decorators' => array('ViewHelper') + 'ignore' => true, + 'label' => $this->translate('Validate Configuration'), + 'data-progress-label' => $this->translate('Validation In Progress'), + 'decorators' => array('ViewHelper') ) ); $this->addDisplayGroup( diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index b329ae1d4..e9aca1d26 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -5,6 +5,7 @@ namespace Icinga\Forms; use Exception; use DateTimeZone; +use Icinga\Application\Config; use Icinga\Application\Logger; use Icinga\Authentication\Auth; use Icinga\User\Preferences; @@ -178,6 +179,19 @@ class PreferenceForm extends Form ) ); + if (Auth::getInstance()->hasPermission('application/stacktraces')) { + $this->addElement( + 'checkbox', + 'show_stacktraces', + array( + 'required' => true, + 'value' => $this->getDefaultShowStacktraces(), + 'label' => $this->translate('Show Stacktraces'), + 'description' => $this->translate('Set whether to show an exception\'s stacktrace.') + ) + ); + } + $this->addElement( 'checkbox', 'show_benchmark', @@ -220,8 +234,20 @@ class PreferenceForm extends Form ) ); + $this->setAttrib('data-progress-element', 'preferences-progress'); + $this->addElement( + 'note', + 'preferences-progress', + array( + 'decorators' => array( + 'ViewHelper', + array('Spinner', array('id' => 'preferences-progress')) + ) + ) + ); + $this->addDisplayGroup( - array('btn_submit_preferences', 'btn_submit_session'), + array('btn_submit_preferences', 'btn_submit_session', 'preferences-progress'), 'submit_buttons', array( 'decorators' => array( @@ -257,4 +283,14 @@ class PreferenceForm extends Form $locale = Translator::getPreferredLocaleCode($_SERVER['HTTP_ACCEPT_LANGUAGE']); return $locale; } + + /** + * Return the default global setting for show_stacktraces + * + * @return bool + */ + protected function getDefaultShowStacktraces() + { + return Config::app()->get('global', 'show_stacktraces', true); + } } diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index dba7ebe9f..212776bac 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -20,35 +20,7 @@ class RoleForm extends ConfigForm * * @var array */ - protected $providedPermissions = array( - '*' => 'Allow everything (*)', - 'config/*' => 'Allow config access (config/*)', -/* - // [tg] seems excessive for me, hidden for rc1, tbd - 'config/application/*' => 'config/application/*', - 'config/application/general' => 'config/application/general', - 'config/application/resources' => 'config/application/resources', - 'config/application/userbackend' => 'config/application/userbackend', - 'config/application/usergroupbackend' => 'config/application/usergroupbackend', - 'config/authentication/*' => 'config/authentication/*', - 'config/authentication/users/*' => 'config/authentication/users/*', - 'config/authentication/users/show' => 'config/authentication/users/show', - 'config/authentication/users/add' => 'config/authentication/users/add', - 'config/authentication/users/edit' => 'config/authentication/users/edit', - 'config/authentication/users/remove' => 'config/authentication/users/remove', - 'config/authentication/groups/*' => 'config/authentication/groups/*', - 'config/authentication/groups/show' => 'config/authentication/groups/show', - 'config/authentication/groups/add' => 'config/authentication/groups/add', - 'config/authentication/groups/edit' => 'config/authentication/groups/edit', - 'config/authentication/groups/remove' => 'config/authentication/groups/remove', - 'config/authentication/roles/*' => 'config/authentication/roles/*', - 'config/authentication/roles/show' => 'config/authentication/roles/show', - 'config/authentication/roles/add' => 'config/authentication/roles/add', - 'config/authentication/roles/edit' => 'config/authentication/roles/edit', - 'config/authentication/roles/remove' => 'config/authentication/roles/remove', - 'config/modules' => 'config/modules' -*/ - ); + protected $providedPermissions; /** * Provided restrictions by currently loaded modules @@ -62,6 +34,40 @@ class RoleForm extends ConfigForm */ public function init() { + $this->providedPermissions = array( + '*' => $this->translate('Allow everything') . ' (*)', + 'application/stacktraces' => $this->translate( + 'Allow to adjust in the preferences whether to show stacktraces' + ) . ' (application/stacktraces)', + 'config/*' => $this->translate('Allow config access') . ' (config/*)', +/* + // [tg] seems excessive for me, hidden for rc1, tbd + 'config/application/*' => 'config/application/*', + 'config/application/general' => 'config/application/general', + 'config/application/resources' => 'config/application/resources', + 'config/application/userbackend' => 'config/application/userbackend', + 'config/application/usergroupbackend' => 'config/application/usergroupbackend', + 'config/authentication/*' => 'config/authentication/*', + 'config/authentication/users/*' => 'config/authentication/users/*', + 'config/authentication/users/show' => 'config/authentication/users/show', + 'config/authentication/users/add' => 'config/authentication/users/add', + 'config/authentication/users/edit' => 'config/authentication/users/edit', + 'config/authentication/users/remove' => 'config/authentication/users/remove', + 'config/authentication/groups/*' => 'config/authentication/groups/*', + 'config/authentication/groups/show' => 'config/authentication/groups/show', + 'config/authentication/groups/add' => 'config/authentication/groups/add', + 'config/authentication/groups/edit' => 'config/authentication/groups/edit', + 'config/authentication/groups/remove' => 'config/authentication/groups/remove', + 'config/authentication/roles/*' => 'config/authentication/roles/*', + 'config/authentication/roles/show' => 'config/authentication/roles/show', + 'config/authentication/roles/add' => 'config/authentication/roles/add', + 'config/authentication/roles/edit' => 'config/authentication/roles/edit', + 'config/authentication/roles/remove' => 'config/authentication/roles/remove', + 'config/modules' => 'config/modules' +*/ + ); + + $helper = new Zend_Form_Element('bogus'); $mm = Icinga::app()->getModuleManager(); foreach ($mm->listInstalledModules() as $moduleName) { diff --git a/application/views/scripts/form/reorder-authbackend.phtml b/application/views/scripts/form/reorder-authbackend.phtml index ec1cf7810..4edc7e06f 100644 --- a/application/views/scripts/form/reorder-authbackend.phtml +++ b/application/views/scripts/form/reorder-authbackend.phtml @@ -39,7 +39,7 @@ 0): ?> -