diff --git a/application/controllers/GroupController.php b/application/controllers/GroupController.php index 88b2b754c..c91c033a2 100644 --- a/application/controllers/GroupController.php +++ b/application/controllers/GroupController.php @@ -46,7 +46,7 @@ class GroupController extends AuthBackendController } $this->view->backendSelection = new Form(); - $this->view->backendSelection->setAttrib('class', 'backend-selection'); + $this->view->backendSelection->setAttrib('class', 'backend-selection icinga-controls'); $this->view->backendSelection->setUidDisabled(); $this->view->backendSelection->setMethod('GET'); $this->view->backendSelection->setTokenDisabled(); @@ -128,6 +128,7 @@ class GroupController extends AuthBackendController if ($this->hasPermission('config/authentication/groups/edit') && $backend instanceof Reducible) { $removeForm = new Form(); $removeForm->setUidDisabled(); + $removeForm->setAttrib('class', 'inline'); $removeForm->setAction( Url::fromPath('group/removemember', array('backend' => $backend->getName(), 'group' => $groupName)) ); diff --git a/application/controllers/NavigationController.php b/application/controllers/NavigationController.php index e7088ce4e..6bcdee76a 100644 --- a/application/controllers/NavigationController.php +++ b/application/controllers/NavigationController.php @@ -167,6 +167,7 @@ class NavigationController extends Controller $removeForm = new Form(); $removeForm->setUidDisabled(); + $removeForm->setAttrib('class', 'inline'); $removeForm->addElement('hidden', 'name', array( 'decorators' => array('ViewHelper') )); diff --git a/application/controllers/UserController.php b/application/controllers/UserController.php index 7ef07534d..cdf2b77da 100644 --- a/application/controllers/UserController.php +++ b/application/controllers/UserController.php @@ -45,7 +45,7 @@ class UserController extends AuthBackendController } $this->view->backendSelection = new Form(); - $this->view->backendSelection->setAttrib('class', 'backend-selection'); + $this->view->backendSelection->setAttrib('class', 'backend-selection icinga-controls'); $this->view->backendSelection->setUidDisabled(); $this->view->backendSelection->setMethod('GET'); $this->view->backendSelection->setTokenDisabled(); @@ -141,6 +141,7 @@ class UserController extends AuthBackendController if ($this->hasPermission('config/authentication/groups/edit')) { $removeForm = new Form(); $removeForm->setUidDisabled(); + $removeForm->setAttrib('class', 'inline'); $removeForm->addElement('hidden', 'user_name', array( 'isArray' => true, 'value' => $userName, diff --git a/application/forms/AcknowledgeApplicationStateMessageForm.php b/application/forms/AcknowledgeApplicationStateMessageForm.php index 6fe0dd37c..61f5824f6 100644 --- a/application/forms/AcknowledgeApplicationStateMessageForm.php +++ b/application/forms/AcknowledgeApplicationStateMessageForm.php @@ -13,7 +13,7 @@ class AcknowledgeApplicationStateMessageForm extends Form public function init() { $this->setAction(Url::fromPath('application-state/acknowledge-message')); - $this->setAttrib('class', 'form-inline application-state-acknowledge-message-control'); + $this->setAttrib('class', 'application-state-acknowledge-message-control'); $this->setRedirectUrl('application-state/summary'); } diff --git a/application/forms/Announcement/AcknowledgeAnnouncementForm.php b/application/forms/Announcement/AcknowledgeAnnouncementForm.php index 4dce5df7a..85fecdc0b 100644 --- a/application/forms/Announcement/AcknowledgeAnnouncementForm.php +++ b/application/forms/Announcement/AcknowledgeAnnouncementForm.php @@ -17,7 +17,7 @@ class AcknowledgeAnnouncementForm extends Form public function init() { $this->setAction(Url::fromPath('announcements/acknowledge')); - $this->setAttrib('class', 'form-inline acknowledge-announcement-control'); + $this->setAttrib('class', 'acknowledge-announcement-control'); $this->setRedirectUrl('layout/announcements'); } diff --git a/application/forms/Announcement/AnnouncementForm.php b/application/forms/Announcement/AnnouncementForm.php index 2ac3b5023..4da47e2f1 100644 --- a/application/forms/Announcement/AnnouncementForm.php +++ b/application/forms/Announcement/AnnouncementForm.php @@ -92,6 +92,7 @@ class AnnouncementForm extends RepositoryForm { $this->setTitle(sprintf($this->translate('Remove announcement %s?'), $this->getIdentifier())); $this->setSubmitLabel($this->translate('Yes')); + $this->setAttrib('class', 'icinga-controls'); } /** diff --git a/application/forms/Authentication/LoginForm.php b/application/forms/Authentication/LoginForm.php index e8f053846..868302f96 100644 --- a/application/forms/Authentication/LoginForm.php +++ b/application/forms/Authentication/LoginForm.php @@ -16,6 +16,8 @@ use Icinga\Web\Url; */ class LoginForm extends Form { + const DEFAULT_CLASSES = 'icinga-controls'; + /** * Redirect URL */ diff --git a/application/forms/Config/User/UserForm.php b/application/forms/Config/User/UserForm.php index 6decec52f..e0cffb519 100644 --- a/application/forms/Config/User/UserForm.php +++ b/application/forms/Config/User/UserForm.php @@ -114,6 +114,7 @@ class UserForm extends RepositoryForm { $this->setTitle(sprintf($this->translate('Remove user %s?'), $this->getIdentifier())); $this->setSubmitLabel($this->translate('Yes')); + $this->setAttrib('class', 'icinga-controls'); } /** diff --git a/application/forms/Config/UserGroup/UserGroupForm.php b/application/forms/Config/UserGroup/UserGroupForm.php index 3214a3495..a590524de 100644 --- a/application/forms/Config/UserGroup/UserGroupForm.php +++ b/application/forms/Config/UserGroup/UserGroupForm.php @@ -64,6 +64,7 @@ class UserGroupForm extends RepositoryForm . ' have their membership cleared automatically.' )); $this->setSubmitLabel($this->translate('Yes')); + $this->setAttrib('class', 'icinga-form icinga-controls'); } /** diff --git a/application/forms/ConfirmRemovalForm.php b/application/forms/ConfirmRemovalForm.php index a1cd75f34..39fc66154 100644 --- a/application/forms/ConfirmRemovalForm.php +++ b/application/forms/ConfirmRemovalForm.php @@ -10,6 +10,8 @@ use Icinga\Web\Form; */ class ConfirmRemovalForm extends Form { + const DEFAULT_CLASSES = 'icinga-controls'; + /** * {@inheritdoc} */ diff --git a/application/forms/Control/LimiterControlForm.php b/application/forms/Control/LimiterControlForm.php index bd90ed16d..dee834696 100644 --- a/application/forms/Control/LimiterControlForm.php +++ b/application/forms/Control/LimiterControlForm.php @@ -15,7 +15,7 @@ class LimiterControlForm extends Form * * @var string */ - const CSS_CLASS_LIMITER = 'limiter-control'; + const CSS_CLASS_LIMITER = 'limiter-control icinga-controls'; /** * Default limit @@ -37,6 +37,11 @@ class LimiterControlForm extends Form 500 => '500' ); + public static $defaultElementDecorators = [ + ['Label', ['tag' => 'span', 'separator' => '']], + ['ViewHelper', ['separator' => '']], + ]; + /** * Default limit for this instance * diff --git a/application/forms/PreferenceForm.php b/application/forms/PreferenceForm.php index 836befadb..2ceb44973 100644 --- a/application/forms/PreferenceForm.php +++ b/application/forms/PreferenceForm.php @@ -302,7 +302,8 @@ class PreferenceForm extends Form array( 'ignore' => true, 'label' => $this->translate('Save to the Preferences'), - 'decorators' => array('ViewHelper') + 'decorators' => array('ViewHelper'), + 'class' => 'btn-primary' ) ); } @@ -335,7 +336,7 @@ class PreferenceForm extends Form array( 'decorators' => array( 'FormElements', - array('HtmlTag', array('tag' => 'div', 'class' => 'control-group')) + array('HtmlTag', array('tag' => 'div', 'class' => 'control-group form-controls')) ) ) ); diff --git a/application/forms/Security/RoleForm.php b/application/forms/Security/RoleForm.php index 829c78389..cb517f178 100644 --- a/application/forms/Security/RoleForm.php +++ b/application/forms/Security/RoleForm.php @@ -37,39 +37,50 @@ class RoleForm extends RepositoryForm public function init() { + $this->setAttrib('class', self::DEFAULT_CLASSES . ' role-form'); + $helper = new Zend_Form_Element('bogus'); + $view = $this->getView(); $this->providedPermissions['application'] = [ $helper->filterName('application/share/navigation') => [ - 'label' => $this->translate('Allow to share navigation items'), - 'name' => 'application/share/navigation' + 'name' => 'application/share/navigation', + 'description' => $this->translate('Allow to share navigation items') ], - $helper->filterName('application/stacktraces') => [ - 'label' => $this->translate('Allow to adjust in the preferences whether to show stacktraces'), - 'name' => 'application/stacktraces' + $helper->filterName('application/stacktraces') => [ + 'name' => 'application/stacktraces', + 'description' => $this->translate( + 'Allow to adjust in the preferences whether to show stacktraces' + ) ], - $helper->filterName('application/log') => [ - 'label' => $this->translate('Allow to view the application log'), - 'name' => 'application/log' + $helper->filterName('application/log') => [ + 'name' => 'application/log', + 'description' => $this->translate('Allow to view the application log') ], - $helper->filterName('admin') => [ - 'label' => $this->translate('Grant admin permissions, e.g. manage announcements'), - 'name' => 'admin' + $helper->filterName('admin') => [ + 'name' => 'admin', + 'description' => $this->translate( + 'Grant admin permissions, e.g. manage announcements' + ) ], - $helper->filterName('config/*') => [ - 'label' => $this->translate('Allow config access'), - 'name' => 'config/*' + $helper->filterName('config/*') => [ + 'name' => 'config/*', + 'description' => $this->translate('Allow config access') ] ]; $this->providedRestrictions['application'] = [ $helper->filterName('application/share/users') => [ - 'label' => $this->translate('Restrict which users this role can share items and information with'), - 'name' => 'application/share/users' + 'name' => 'application/share/users', + 'description' => $this->translate( + 'Restrict which users this role can share items and information with' + ) ], $helper->filterName('application/share/groups') => [ - 'label' => $this->translate('Restrict which groups this role can share items and information with'), - 'name' => 'application/share/groups' + 'name' => 'application/share/groups', + 'description' => $this->translate( + 'Restrict which groups this role can share items and information with' + ) ] ]; @@ -77,34 +88,43 @@ class RoleForm extends RepositoryForm foreach ($mm->listInstalledModules() as $moduleName) { $modulePermission = Manager::MODULE_PERMISSION_NS . $moduleName; $this->providedPermissions[$moduleName][$helper->filterName($modulePermission)] = [ - 'label' => sprintf($this->translate('Allow access to module %s'), $moduleName), + 'isUsagePerm' => true, 'name' => $modulePermission, - 'isUsagePerm' => true + 'label' => $view->escape($this->translate('General Module Access')), + 'description' => sprintf($this->translate('Allow access to module %s'), $moduleName) ]; $module = $mm->getModule($moduleName, false); $permissions = $module->getProvidedPermissions(); - if (count($permissions) > 1) { - $this->providedPermissions[$moduleName][$helper->filterName($moduleName . '/*')] = [ - 'label' => $this->translate('Full Access'), - 'name' => $moduleName . '/*', - 'isFullPerm' => true - ]; - } + $this->providedPermissions[$moduleName][$helper->filterName($moduleName . '/*')] = [ + 'isFullPerm' => true, + 'name' => $moduleName . '/*', + 'label' => $view->escape($this->translate('Full Module Access')) + ]; foreach ($permissions as $permission) { /** @var object $permission */ $this->providedPermissions[$moduleName][$helper->filterName($permission->name)] = [ - 'label' => $permission->description, - 'name' => $permission->name + 'name' => $permission->name, + 'label' => preg_replace( + '~^(\w+)(\/.*)~', + '$1$2', + $view->escape($permission->name) + ), + 'description' => $permission->description ]; } foreach ($module->getProvidedRestrictions() as $restriction) { $this->providedRestrictions[$moduleName][$helper->filterName($restriction->name)] = [ - 'label' => $restriction->description, - 'name' => $restriction->name + 'name' => $restriction->name, + 'label' => preg_replace( + '~^(\w+)(\/.*)~', + '$1$2', + $view->escape($restriction->name) + ), + 'description' => $restriction->description ]; } } @@ -156,7 +176,24 @@ class RoleForm extends RepositoryForm foreach ($this->providedPermissions as $moduleName => $permissionList) { $this->sortPermissions($permissionList); - $elements = []; + $elements = [$moduleName . '_header']; + $this->addElement( + 'note', + $moduleName . '_header', + [ + 'decorators' => ['ViewHelper'], + 'value' => '