diff --git a/modules/setup/application/views/scripts/form/setup-requirements.phtml b/modules/setup/application/views/scripts/form/setup-requirements.phtml index 9918df008..571a661b6 100644 --- a/modules/setup/application/views/scripts/form/setup-requirements.phtml +++ b/modules/setup/application/views/scripts/form/setup-requirements.phtml @@ -1,66 +1,35 @@ getRequirements(); -$iterator = new RecursiveIteratorIterator($requirements); +echo $requirements; ?> - - - - - - - - - - - - - - - -

getTitle(); ?>

- getDescriptions(); ?> - 1): ?> -
    - -
  • - -
- - - -
getStateText(); ?>
-
- translate('You may also need to restart the web-server for the changes to take effect!'); ?> - qlink( - $this->translate('Refresh'), - null, - null, - array( - 'class' => 'button-like', - 'title' => $title, - 'aria-label' => sprintf($this->translate('Refresh the page; %s'), $title) - ) - ); ?> -
-
+
+ translate('You may also need to restart the web-server for the changes to take effect!'); ?> + qlink( + $this->translate('Refresh'), + null, + null, + array( + 'class' => 'button-like', + 'title' => $title, + 'aria-label' => sprintf($this->translate('Refresh the page; %s'), $title) + ) + ); ?> +
getElement($form->getTokenElementName()); ?> getElement($form->getUidElementName()); ?> -
+
getElement(Wizard::BTN_PREV); ?> getElement(Wizard::BTN_NEXT); - if (false === $requirements->fulfilled()) { + if (! $requirements->fulfilled()) { $btn->setAttrib('disabled', 1); } echo $btn; ?>
- + \ No newline at end of file diff --git a/modules/setup/library/Setup/RequirementSet.php b/modules/setup/library/Setup/RequirementSet.php index 966cf98cc..8bb018d7b 100644 --- a/modules/setup/library/Setup/RequirementSet.php +++ b/modules/setup/library/Setup/RequirementSet.php @@ -319,4 +319,15 @@ class RequirementSet implements RecursiveIterator { next($this->requirements); } + + /** + * Return this set of requirements rendered as HTML + * + * @return string + */ + public function __toString() + { + $renderer = new RequirementsRenderer($this); + return (string) $renderer; + } } diff --git a/modules/setup/library/Setup/RequirementsRenderer.php b/modules/setup/library/Setup/RequirementsRenderer.php new file mode 100644 index 000000000..b768a1e86 --- /dev/null +++ b/modules/setup/library/Setup/RequirementsRenderer.php @@ -0,0 +1,83 @@ +tags[] = ''; + $this->tags[] = ''; + } + + public function endIteration() + { + $this->tags[] = ''; + $this->tags[] = '
'; + } + + public function beginChildren() + { + $this->tags[] = ''; + $currentSet = $this->getSubIterator(); + $state = $currentSet->getState() ? 'fulfilled' : ( + $currentSet->isOptional() ? 'not-available' : 'missing' + ); + $colSpanRequired = $this->hasSingleRequirements($this->getSubIterator($this->getDepth() - 1)); + $this->tags[] = ''; + $this->beginIteration(); + } + + public function endChildren() + { + $this->endIteration(); + $this->tags[] = ''; + $this->tags[] = ''; + } + + protected function hasSingleRequirements(RequirementSet $requirements) + { + $set = $requirements->getAll(); + foreach ($set as $entry) { + if ($entry instanceof Requirement) { + return true; + } + } + + return false; + } + + public function render() + { + foreach ($this as $requirement) { + $this->tags[] = ''; + $this->tags[] = '

' . $requirement->getTitle() . '

'; + $this->tags[] = ''; + $descriptions = $requirement->getDescriptions(); + if (count($descriptions) > 1) { + $this->tags[] = ''; + } elseif (! empty($descriptions)) { + $this->tags[] = $descriptions[0]; + } + $this->tags[] = ''; + $this->tags[] = '' . $requirement->getStateText() . ''; + $this->tags[] = ''; + } + + return implode("\n", $this->tags); + } + + public function __toString() + { + return $this->render(); + } +} diff --git a/public/css/icinga/setup.less b/public/css/icinga/setup.less index 66b08417e..31ecd205f 100644 --- a/public/css/icinga/setup.less +++ b/public/css/icinga/setup.less @@ -110,7 +110,8 @@ } #setup div.buttons { - margin: 1.5em 0; + margin-top: 1.5em; // Yes, -top and -bottom, keep it like that... + margin-bottom: 1.5em; .double { position: absolute; @@ -166,25 +167,53 @@ } } -#setup table.requirements { +form#setup_requirements { + padding-top: 0.5em; + border-top: 2px solid @colorPetrol; +} + +div.requirements-refresh { + width: 25%; + margin-left: 75%; + text-align: center; +} + +#setup > table.requirements { font-size: 0.9em; - margin: -1em -1em 2em; +} + +#setup table.requirements { + margin: -1em; border-spacing: 1em; border-collapse: separate; - border-bottom: 2px solid @colorPetrol; td { + padding: 0; + h2 { margin: 0 1em 0 0; } + table { + font-size: 102%; // Just a hack for webkit, remove this in case you can't see any difference or make it work without it + } + ul { margin: 0; padding-left: 1em; list-style-type: square; } + &.title { + width: 25%; + } + + &.desc { + width: 50%; + } + &.state { + width: 25%; color: white; padding: 0.4em;