Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/dope-layout-5543#2'
- Loading branch information
Showing
115 changed files
with
1,862 additions
and
2,157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
<?php | ||
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ | ||
|
||
namespace Icinga\Forms\Control; | ||
|
||
use Icinga\Web\Form; | ||
|
||
/** | ||
* Limiter control form | ||
*/ | ||
class LimiterControlForm extends Form | ||
{ | ||
/** | ||
* CSS class for the limiter control | ||
* | ||
* @var string | ||
*/ | ||
const CSS_CLASS_LIMITER = 'limiter-control'; | ||
|
||
/** | ||
* Default limit | ||
* | ||
* @var int | ||
*/ | ||
const DEFAULT_LIMIT = 50; | ||
|
||
/** | ||
* Selectable limits | ||
* | ||
* @var int[] | ||
*/ | ||
public static $limits = array( | ||
10 => '10', | ||
25 => '25', | ||
50 => '50', | ||
100 => '100', | ||
500 => '500' | ||
); | ||
|
||
/** | ||
* Default limit for this instance | ||
* | ||
* @var int|null | ||
*/ | ||
protected $defaultLimit; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function init() | ||
{ | ||
$this->setAttrib('class', static::CSS_CLASS_LIMITER); | ||
} | ||
|
||
/** | ||
* Get the default limit | ||
* | ||
* @return int | ||
*/ | ||
public function getDefaultLimit() | ||
{ | ||
return $this->defaultLimit !== null ? $this->defaultLimit : static::DEFAULT_LIMIT; | ||
} | ||
|
||
/** | ||
* Set the default limit | ||
* | ||
* @param int $defaultLimit | ||
* | ||
* @return $this | ||
*/ | ||
public function setDefaultLimit($defaultLimit) | ||
{ | ||
$this->defaultLimit = (int) $defaultLimit; | ||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getRedirectUrl() | ||
{ | ||
return $this->getRequest()->getUrl()->setParam('limit', $this->getElement('limit')->getValue()); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function createElements(array $formData) | ||
{ | ||
$this->addElement( | ||
'select', | ||
'limit', | ||
array( | ||
'autosubmit' => true, | ||
'escape' => false, | ||
'label' => '#', | ||
'multiOptions' => static::$limits, | ||
'value' => $this->getRequest()->getUrl()->getParam('limit', $this->getDefaultLimit()) | ||
) | ||
); | ||
} | ||
|
||
/** | ||
* Limiter control is always successful | ||
* | ||
* @return bool | ||
*/ | ||
public function onSuccess() | ||
{ | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,40 @@ | ||
<?php if (! $this->compact): ?> | ||
<div class="controls"> | ||
<?= $this->tabs; ?> | ||
<div class="grid dont-print"> | ||
<div class="col-1-3 text-left"> | ||
<?= $this->limiter ?> | ||
</div> | ||
<div class="col-1-3"> | ||
<?= $this->paginator ?> | ||
</div> | ||
<div class="col-1-3 text-right"> | ||
<?= $this->sortBox ?> | ||
</div> | ||
</div> | ||
<?= $this->filterEditor; ?> | ||
<?= $this->tabs ?> | ||
<?= $this->paginator ?> | ||
</div> | ||
<?php endif ?> | ||
<div class="content"> | ||
<table class="action-table listing-table" data-base-target="_next"> | ||
<table class="table-row-selectable common-table" data-base-target="_next"> | ||
<thead> | ||
<tr> | ||
<th><?= $this->translate('Module') ?></th> | ||
<th><?= $this->translate('Module') ?></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<?php foreach ($modules as $module): ?> | ||
<tr> | ||
<td> | ||
<?php if ($module->enabled && $module->loaded) { | ||
echo $this->icon('thumbs-up', sprintf($this->translate('Module %s is enabled'), $module->name)); | ||
} elseif (! $module->enabled) { | ||
echo $this->icon('block', sprintf($this->translate('Module %s is disabled'), $module->name)); | ||
} else { // ! $module->loaded | ||
echo $this->icon('block', sprintf($this->translate('Module %s has failed to load'), $module->name)); | ||
} | ||
<tr> | ||
<td> | ||
<?php if ($module->enabled && $module->loaded) { | ||
echo $this->icon('thumbs-up', sprintf($this->translate('Module %s is enabled'), $module->name)); | ||
} elseif (! $module->enabled) { | ||
echo $this->icon('block', sprintf($this->translate('Module %s is disabled'), $module->name)); | ||
} else { // ! $module->loaded | ||
echo $this->icon('block', sprintf($this->translate('Module %s has failed to load'), $module->name)); | ||
} | ||
|
||
echo $this->qlink( | ||
$module->name, | ||
'config/module/', | ||
array('name' => $module->name), | ||
array('title' => sprintf($this->translate('Show the overview of the %s module'), $module->name), 'class' => 'rowaction') | ||
); ?> | ||
</td> | ||
</tr> | ||
echo $this->qlink( | ||
$module->name, | ||
'config/module/', | ||
array('name' => $module->name), | ||
array( | ||
'class' => 'rowaction', | ||
'title' => sprintf($this->translate('Show the overview of the %s module'), $module->name) | ||
) | ||
); ?> | ||
</td> | ||
</tr> | ||
<?php endforeach ?> | ||
</tbody> | ||
</table> | ||
</table> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.