Skip to content

Commit fb2d2fd

Browse files
committed
New Config Form only for Win Drive Letter services
Updates & Fixes
1 parent 34cfd4b commit fb2d2fd

11 files changed

Lines changed: 589 additions & 50 deletions

composer.lock

Lines changed: 462 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nbproject/private/private.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ copy.src.on.open=false
55
copy.src.target=/var/www/IcingaEditor
66
index.file=src/index.php
77
run.as=LOCAL
8-
url=http://localhost/IcingaEditor/
8+
url=http://localhost/VitexSoftware/icinga_configurator/

nbproject/private/private.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<group name="Monitoring">
1111
<file>file:/home/vitex/Projects/VitexSoftware/iciedit/src/includes/Configure.php</file>
1212
</group>
13-
<group/>
13+
<group>
14+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/NavBarSearchBox.php</file>
15+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/PageTop.php</file>
16+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/TWBSwitch.php</file>
17+
</group>
1418
</open-files>
1519
</project-private>

src/classes/NSCPConfigBatGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
* @author vitex
88
*/
9-
class NSCPConfigBatGenerator extends EaseAtom
9+
class NSCPConfigBatGenerator extends \Ease\Atom
1010
{
1111
/**
1212
* Objekt hostu
@@ -66,7 +66,7 @@ public function __construct($host)
6666
$this->host = $host;
6767
$this->setPlatform($host->getDataValue('platform'));
6868

69-
$preferences = new Engine\IEPreferences;
69+
$preferences = new Preferences();
7070
$this->prefs = $preferences->getPrefs();
7171
$this->cfgInit();
7272
$this->cfgGeneralSet();

src/includes/IEInit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
}
3030
}
3131
setlocale(LC_ALL, $locale);
32-
bind_textdomain_codeset('skelicz', 'UTF-8');
32+
bind_textdomain_codeset('iciedit', 'UTF-8');
3333
putenv("LC_ALL=$locale");
3434
if (file_exists('../locale')) {
3535
bindtextdomain('messages', '../locale');

src/modules/CheckDriveSize.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @author vitex
1616
*/
17-
class CheckDriveSize extends IEServiceConfigurator
17+
class CheckDriveSize extends \Icinga\Editor\UI\ServiceConfigurator
1818
{
1919

2020
/**

src/modules/CheckMem.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @author vitex
1616
*/
17-
class CheckMem extends IEServiceConfigurator
17+
class CheckMem extends \Icinga\Editor\UI\ServiceConfigurator
1818
{
1919

2020
/**

src/modules/DriveLetter.inc.php

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?php
2+
3+
/**
4+
* Formulář pro vyber pismene Disku windows
5+
*
6+
* @package IcingaEditor
7+
* @subpackage plugins
8+
* @author Vitex <vitex@hippy.cz>
9+
* @copyright 2014 Vitex@hippy.cz (G)
10+
*/
11+
12+
namespace Icinga\Editor\modules;
13+
14+
/**
15+
* Description of ping
16+
*
17+
* @author vitex
18+
*/
19+
class DriveLetter extends \Icinga\Editor\UI\ServiceConfigurator {
20+
21+
/**
22+
*
23+
*/
24+
public function form() {
25+
$config = [
26+
'Drive' => null
27+
];
28+
foreach (explode(' ', $this->commandParams[0]) as $cfg) {
29+
if (strstr($cfg, '=')) {
30+
list($key, $value) = explode('=', $cfg);
31+
$config[$key] = $value;
32+
} else {
33+
$config[$cfg] = null;
34+
}
35+
}
36+
37+
$drives = array_combine(range('a', 'z'), range('A', 'Z'));
38+
39+
unset($drives[1]);
40+
foreach ($drives as $did => $dname) {
41+
$drives[$did] = $drives[$did] . ':';
42+
}
43+
44+
45+
46+
if (strstr($config['Drive'], '\\\\')) {
47+
$this->form->addInput(new \Ease\Html\Select('Drive', $drives, '\\\\'), _('Disk'), 'X:', _('Volba písmene sledované diskové jednotky'));
48+
} else {
49+
$this->form->addInput(new \Ease\Html\Select('Drive', $drives, str_replace(':', '', $config['Drive'])), _('Disk'), 'X:', _('Volba písmene sledované diskové jednotky'));
50+
}
51+
}
52+
53+
/**
54+
* Zpracování formuláře
55+
*
56+
* @return boolean
57+
*/
58+
public function reconfigureService() {
59+
$config = [];
60+
$page = \Ease\Shared::webPage();
61+
62+
foreach ($page->getRequestValues() as $key => $value) {
63+
switch ($key) {
64+
case 'Drive':
65+
66+
if (strlen(trim($value)) && ($value != '\\\\')) {
67+
$config['Drive'] = $value . ':';
68+
$this->tweaker->service->setDataValue($this->tweaker->service->nameColumn, _('Disk') . ' ' . strtoupper($value) . ':');
69+
$this->tweaker->service->setDataValue('display_name', sprintf(_('Volné místo disku %s: '), strtoupper($value)));
70+
}
71+
72+
break;
73+
74+
default:
75+
break;
76+
}
77+
}
78+
79+
80+
81+
if (count($config)) {
82+
83+
$this->tweaker->service->setDataValue('check_command-params', implode(' ', $config));
84+
85+
return parent::reconfigureService();
86+
}
87+
88+
return FALSE;
89+
}
90+
91+
}

src/modules/check_smart.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* @author vitex
1616
*/
17-
class check_smart extends IEServiceConfigurator
17+
class check_smart extends \Icinga\Editor\UI\ServiceConfigurator
1818
{
1919

2020
/**

src/modules/web_content.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
* @author vitex
1717
*/
18-
class web_content extends IEServiceConfigurator
18+
class web_content extends \Icinga\Editor\UI\ServiceConfigurator
1919
{
2020

2121
function init()

0 commit comments

Comments
 (0)