From da18060bb217647c09ad22013f620f474fb867d0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:14:28 +0200 Subject: Adding upstream version 0.0.1+20160321. Signed-off-by: Daniel Baumann --- application/forms/Config/SettingConfigForm.php | 137 +++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 application/forms/Config/SettingConfigForm.php (limited to 'application/forms') diff --git a/application/forms/Config/SettingConfigForm.php b/application/forms/Config/SettingConfigForm.php new file mode 100644 index 0000000..3e26b04 --- /dev/null +++ b/application/forms/Config/SettingConfigForm.php @@ -0,0 +1,137 @@ +setName('form_config_boxydash_settings'); + $this->setSubmitLabel($this->translate('Save Changes')); + } + + public function createElements(array $formData) + { + $this->addElement( + 'text', + 'setting_refresh', + array( + 'label' => $this->translate('Dashboard Refresh'), + 'description' => $this->translate('How quickly the dashboard should refresh (between 1 second and 20 minutes)'), + 'value' => '10', + 'validators' => array( + array( + 'Between', + false, + array( + 'min' => '1', + 'max' => '1200', + 'inclusive' => true, + ) + ) + ) + ) + ); + $this->addElement( + 'text', + 'setting_boxsize', + array( + 'label' => $this->translate('Box Size'), + 'description' => $this->translate('The size of displayed boxes in pixels'), + 'value' => '10', + 'validators' => array( + array( + 'Regex', + false, + array( + 'pattern' => '/^[\d]+$/', + 'messages' => array( + 'regexNotMatch' => $this->translate( + 'The application prefix must be a positive integer.' + ) + ) + ) + ) + ) + ) + ); + $this->addElement( + 'checkbox', + 'include_softstate', + array( + 'required' => true, + 'value' => true, + 'label' => $this->translate('Include Soft Status'), + 'description' => $this->translate('Enable this to have soft status included') + ) + ); + $this->addElement( + 'checkbox', + 'requires_authentication', + array( + 'required' => true, + 'value' => true, + 'label' => $this->translate('Require Authentication?'), + 'description' => $this->translate('Does Boxydash require Authentication? Warning, this may expose sensitive network information.') + ) + ); + $this->addElement( + 'checkbox', + 'show_legend', + array( + 'required' => true, + 'value' => true, + 'label' => $this->translate('Show the Legend'), + 'description' => $this->translate('Do you want to show the legend?') + ) + ); + $this->addElement( + 'text', + 'path_prefix', + array( + 'label' => $this->translate('URL path prefix'), + 'description' => $this->translate('Prefix prepended to all links, eg "/icingaweb2". Required in case Icinga Web 2 is installed in a subfolder (eg "http://your-domain.tld/icingaweb2").'), + 'value' => '', + ) + ); + + } + + public function onSuccess() + { + $this->config->setSection('settings', $this->getValues()); + + if ($this->save()) { + Notification::success($this->translate('New setings have successfully been stored')); + } else { + return false; + } + } + + /** + * @see Form::onRequest() + */ + public function onRequest() + { + $this->populate($this->config->getSection('settings')->toArray()); + } + + + +} -- cgit v1.2.3