Skip to content

Commit a43f4ae

Browse files
committed
First wave of adaptation to new version Ease Framework using namespaces
1 parent 39b57e5 commit a43f4ae

160 files changed

Lines changed: 2321 additions & 2045 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
/logos/
33
/nbproject/private/
44
/nbproject/
5-
/test/build/
5+
/test/build/
6+
/vendor/

composer.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
}
99
],
1010
"require": {
11-
11+
"php": ">= 5.5.9",
12+
"vitexsoftware/ease-framework": "dev-master"
13+
},
14+
"autoload": {
15+
"psr-4": {
16+
"Icinga\\Editor\\Engine\\": "src/classes/",
17+
"Icinga\\Editor\\UI\\": "src/classes/UI"
18+
}
19+
},
20+
"require-dev": {
21+
"phpunit/php-token-stream": "~1.2",
22+
"robmorgan/phinx": "dev-master"
1223
}
24+
1325
}

nbproject/private/private.xml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/classes/IEContactSelector.php</file>
88
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/classes/IECfgEditor.php</file>
99
</group>
10-
<group>
11-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/classes/IEService.php</file>
12-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/css/default.css</file>
13-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/classes/IEUser.php</file>
14-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/apply.php</file>
15-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/createaccount.php</file>
16-
<file>file:/home/vitex/Projects/VitexSoftware/IcingaEditor/includes/IEInit.php</file>
17-
</group>
1810
<group name="Monitoring">
1911
<file>file:/home/vitex/Projects/VitexSoftware/iciedit/src/includes/Configure.php</file>
2012
</group>
13+
<group>
14+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/includes/IEInit.php</file>
15+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/IEBootstrapMenu.php</file>
16+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/composer.json</file>
17+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/IEMainMenu.php</file>
18+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/vendor/composer/autoload_psr4.php</file>
19+
</group>
2120
</open-files>
2221
</project-private>

src/apply.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace Icinga\Editor;
23

34
/**
45
* Icinga Editor - generování konfigurace
@@ -10,18 +11,17 @@
1011
*/
1112
require_once 'includes/IEInit.php';
1213

13-
require_once 'classes/IEImporter.php';
1414

1515
$oPage->onlyForLogged();
1616

17-
$oPage->addItem(new IEPageTop(_('Generování konfigurace')));
17+
$oPage->addItem(new UI\PageTop(_('Generování konfigurace')));
1818

1919

2020
if ($oUser->getSettingValue('admin')) {
2121
$forceUserID = $oPage->getRequestValue('force_user_id', 'int');
2222
if (!is_null($forceUserID)) {
2323
$originalUserID = $oUser->getUserID();
24-
EaseShared::user(new EaseUser($forceUserID));
24+
\Ease\Shared::user(new EaseUser($forceUserID));
2525
}
2626
}
2727

@@ -50,28 +50,28 @@
5050
$line_num++;
5151

5252
if (($line === false) && ($line_num == 1)) {
53-
$errorLine = $oPage->container->addItem(new EaseHtmlDivTag(null, '<span class="label label-important">' . _('Chyba:') . '</span>', array('class' => 'alert alert-danger')));
53+
$errorLine = $oPage->container->addItem(new \Ease\Html\Div( '<span class="label label-important">' . _('Chyba:') . '</span>', array('class' => 'alert alert-danger')));
5454
$oUser->addStatusMessage(_('Kontrola konfigurace nevrátila výsledek.'), 'error');
5555
$errorLine->addItem(_('Zkontroluj prosím zdlali nechybí potřebný fragment v /etc/sudoers:'));
56-
$errorLine->addItem(new EaseHtmlDivTag(null, 'User_Alias APACHE = www-data'));
57-
$errorLine->addItem(new EaseHtmlDivTag(null, 'Cmnd_Alias ICINGA = /usr/sbin/icinga, /etc/init.d/icinga'));
58-
$errorLine->addItem(new EaseHtmlDivTag(null, 'APACHE ALL = (ALL) NOPASSWD: ICINGA'));
56+
$errorLine->addItem(new \Ease\Html\Div( 'User_Alias APACHE = www-data'));
57+
$errorLine->addItem(new \Ease\Html\Div( 'Cmnd_Alias ICINGA = /usr/sbin/icinga, /etc/init.d/icinga'));
58+
$errorLine->addItem(new \Ease\Html\Div( 'APACHE ALL = (ALL) NOPASSWD: ICINGA'));
5959
break;
6060
}
6161

6262
if (strstr($line, 'Error:')) {
6363
$line = str_replace('Error:', '', $line);
64-
$errorLine = $oPage->container->addItem(new EaseHtmlDivTag(null, '<span class="label label-important">' . _('Chyba:') . '</span>', array('class' => 'alert alert-danger')));
64+
$errorLine = $oPage->container->addItem(new \Ease\Html\Div( '<span class="label label-important">' . _('Chyba:') . '</span>', array('class' => 'alert alert-danger')));
6565

6666
$keywords = preg_split("/['(.*)']+/", $line);
6767
switch (trim($keywords[0])) {
6868
case 'Service notification period':
6969
$errorLine->addItem(' <a href="timeperiods.php">' . _('Notifikační perioda') . '</a> služeb ');
70-
$errorLine->addItem(new EaseHtmlATag('timeperiod.php?timeperiod_name=' . $keywords[1], $keywords[1]));
70+
$errorLine->addItem(new \Ease\Html\ATag('timeperiod.php?timeperiod_name=' . $keywords[1], $keywords[1]));
7171
break;
7272
case 'Host notification period':
7373
$errorLine->addItem(' <a href="timeperiods.php">' . _('Notifikační perioda') . '</a> hostů');
74-
$errorLine->addItem(new EaseHtmlATag('timeperiod.php?timeperiod_name=' . $keywords[1], $keywords[1]));
74+
$errorLine->addItem(new \Ease\Html\ATag('timeperiod.php?timeperiod_name=' . $keywords[1], $keywords[1]));
7575
break;
7676

7777
default:
@@ -84,7 +84,7 @@
8484
case 'specified for contact':
8585
$errorLine->addItem(' specifikovaná pro kontakt ');
8686
$contact = new IEContact($keywords[3]);
87-
$errorLine->addItem(new EaseHtmlATag('contact.php?contact_id=' . $contact->getMyKey(), $keywords[3]));
87+
$errorLine->addItem(new \Ease\Html\ATag('contact.php?contact_id=' . $contact->getMyKey(), $keywords[3]));
8888
break;
8989

9090
default:
@@ -105,7 +105,7 @@
105105

106106
$line = str_replace('Warning:', '<span class="label label-error">' . _('Chyba v konfiguračním souboru') . '</span>', $line);
107107

108-
$oPage->container->addItem(new EaseHtmlDivTag(null, $line, array('class' => 'alert alert-danger')));
108+
$oPage->container->addItem(new \Ease\Html\Div( $line, array('class' => 'alert alert-danger')));
109109
$errorCount++;
110110
}
111111

@@ -123,7 +123,7 @@
123123
}
124124

125125
//Duplicate definition found for command 'check_ping' (config file '/etc/icinga/generated/command_check_ping_vitex.cfg', starting on line 1)
126-
$oPage->container->addItem(new EaseHtmlDivTag(null, $line, array('class' => 'alert alert-warning')));
126+
$oPage->container->addItem(new \Ease\Html\Div( $line, array('class' => 'alert alert-warning')));
127127
}
128128

129129
if (strstr($line, 'Total Warnings')) {
@@ -148,17 +148,17 @@
148148
if (!intval($errorCount) && !is_null($WarningCount)) {
149149
if (IECfg::reloadIcinga()) {
150150
$oPage->container->addItem(_('Všechny vaše konfigurační soubory byly přegenerovány'));
151-
$oPage->container->addItem(new EaseTWBLinkButton('main.php', _('Hotovo') . ' ' . EaseTWBPart::GlyphIcon('ok-sign'), 'success'));
152-
EaseShared::user()->setSettingValue('unsaved', false);
151+
$oPage->container->addItem(new \Ease\TWB\LinkButton('main.php', _('Hotovo') . ' ' . \Ease\TWB\Part::GlyphIcon('ok-sign'), 'success'));
152+
\Ease\Shared::user()->setSettingValue('unsaved', false);
153153
}
154154
}
155155
}
156156

157157
if ($oUser->getSettingValue('admin') && isset($originalUserID)) {
158-
EaseShared::user(new EaseUser($originalUserID));
159-
EaseShared::user()->loginSuccess();
158+
\Ease\Shared::user(new EaseUser($originalUserID));
159+
\Ease\Shared::user()->loginSuccess();
160160
}
161161

162-
$oPage->addItem(new IEPageBottom());
162+
$oPage->addItem(new UI\PageBottom());
163163

164164
$oPage->draw();

src/cfgconfirm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace Icinga\Editor;
23

34
/**
45
* Icinga Editor - potvrzení nasazení konfigurace

src/cfgfile.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace Icinga\Editor;
23

34
/**
45
* Icinga Editor - titulní strana
@@ -9,27 +10,20 @@
910
* @copyright 2012 Vitex@hippy.cz (G)
1011
*/
1112
require_once 'includes/IEInit.php';
12-
require_once 'classes/IEContact.php';
13-
require_once 'classes/IEContactgroup.php';
14-
require_once 'classes/IEHost.php';
15-
require_once 'classes/IEHostgroup.php';
16-
require_once 'classes/IETimeperiod.php';
17-
require_once 'classes/IECommand.php';
18-
require_once 'classes/IEServicegroup.php';
1913

2014
$oPage->onlyForLogged();
2115

2216
$file = $oPage->getRequestValue('file');
2317
$line = $oPage->getRequestValue('line');
2418

25-
$oPage->addItem(new IEPageTop(_('Icinga Editor')));
19+
$oPage->addItem(new UI\PageTop(_('Icinga Editor')));
2620
$oPage->addPageColumns();
2721

2822
$lines = file($file);
2923
foreach ($lines as $line) {
3024
$oPage->addItem($line . '<br>');
3125
}
3226

33-
$oPage->addItem(new IEPageBottom());
27+
$oPage->addItem(new UI\PageBottom());
3428

3529
$oPage->draw();

src/changepassword.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
namespace Icinga\Editor;
23

34
/**
45
* Změna hesla uživatele
@@ -8,9 +9,6 @@
89
* @subpackage WEBUI
910
*/
1011
require_once 'includes/IEInit.php';
11-
require_once 'Ease/EaseMail.php';
12-
require_once 'Ease/EaseHtmlForm.php';
13-
require_once 'Ease/EaseJQueryWidgets.php';
1412

1513
$oPage->onlyForLogged(); //Pouze pro přihlášené
1614
$formOK = true;
@@ -49,7 +47,7 @@
4947
}
5048
}
5149

52-
$oPage->addItem(new IEPageTop(_('Změna hesla uživatele')));
50+
$oPage->addItem(new UI\PageTop(_('Změna hesla uživatele')));
5351
$oPage->addPageColumns();
5452

5553
if ($formOK && $oPage->isPosted()) {
@@ -68,20 +66,20 @@
6866
$email->send();
6967
}
7068
} else {
71-
$loginForm = new EaseHtmlForm(NULL);
69+
$loginForm = new \Ease\Html\Form(NULL);
7270

7371
$loginForm->addItem(new EaseLabeledPasswordInput('CurrentPassword', NULL, _('Stávající heslo')));
7472

7573
$loginForm->addItem(new EaseLabeledPasswordStrongInput('password', NULL, _('Nové heslo') . ' *'));
7674
$loginForm->addItem(new EaseLabeledPasswordControlInput('passwordConfirm', NULL, _('potvrzení hesla') . ' *', array('id' => 'confirmation')));
7775

78-
$loginForm->addItem(new EaseJQuerySubmitButton('Ok', 'Změnit heslo'));
76+
$loginForm->addItem(new \Ease\JQuery\SubmitButton('Ok', 'Změnit heslo'));
7977

8078
$loginForm->fillUp($_POST);
8179

82-
$oPage->columnII->addItem(new EaseTWBPanel(_('změna hesla'), 'default', $loginForm));
80+
$oPage->columnII->addItem(new \Ease\TWB\Panel(_('změna hesla'), 'default', $loginForm));
8381
}
8482

85-
$oPage->addItem(new IEPageBottom());
83+
$oPage->addItem(new UI\PageBottom());
8684

8785
$oPage->draw();

src/classes/EaseTWBSwitch.php

Lines changed: 0 additions & 29 deletions
This file was deleted.

src/classes/IEBootstrapMenu.php

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)