Skip to content

Commit 9e6321a

Browse files
committed
Updated to current EaseFramewoek
Codeception tests added Configuration switched to json
1 parent 180bac2 commit 9e6321a

24 files changed

+224
-214
lines changed

codeception.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
paths:
2+
tests: tests
3+
output: tests/_output
4+
data: tests/_data
5+
support: tests/_support
6+
envs: tests/_envs
7+
actor_suffix: Tester
8+
extensions:
9+
enabled:
10+
- Codeception\Extension\RunFailed

config.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"EASE_APPNAME": "IcingaEditor",
3+
"DB_TYPE": "mysql",
4+
"DB_HOST": "localhost",
5+
"DB_PORT": 3306,
6+
"DB_DATABASE": "icinga_editor",
7+
"DB_USERNAME": "icinga_editor",
8+
"DB_PASSWORD": "LojAstod9",
9+
"SEND_MAILS_FROM": "noreply@vitexsoftware.cz",
10+
"CFG_GENERATED": "/etc/icinga/generated/",
11+
"EMAIL_FROM": "monitor@v.s.cz",
12+
"SEND_INFO_TO": "info@vitexsoftware.cz",
13+
"EASE_LOGGER": "syslog"
14+
}

debian/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Priority: optional
77
Homepage: http://vitexsoftware.cz/monitoring.php
88

99
Package: icinga-editor
10-
Depends: ${misc:Depends},libjs-twitter-bootstrap, ease-framework, dbconfig-common , php-mail, php5-curl, icinga-common,monitoring-plugins-basic, mtr-tiny, php-image-graphviz, libjs-d3js, php5-cli, php5-intl, composer, libjs-twitter-bootstrap-switch, nsca, traceroute
10+
Depends: ${misc:Depends},libjs-twitter-bootstrap, ease-framework (>= 1.3), dbconfig-common , php-mail, php5-curl, icinga-common,monitoring-plugins-basic, mtr-tiny, php-image-graphviz, libjs-d3js, php5-cli, php5-intl, composer, libjs-twitter-bootstrap-switch, nsca, traceroute
1111
Recommends: mysql-server, graphicsmagick-imagemagick-compat, pnp4icinga,icinga-cgi,icinga-cgi-bin
1212
Pre-Depends: php-phinx,icinga-web,icinga-web-config-icinga
1313
Architecture: all

debian/install

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ debian/conf/composer.json usr/share/icinga-editor/
1717
debian/conf/icinga-editor.conf etc/apache2/conf-available
1818
debian/conf/icinga-editor.service etc/avahi/services
1919
debian/conf/icinga-editor etc/sudoers.d
20+
config.json etc/icinga-editor
2021
debian/plugins/* usr/lib/nagios/plugins
2122
src/iecfgimporter usr/bin
2223
bin/toicmdfile.sh usr/bin

debian/postinst

+13-30
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,18 @@
33

44
set -e
55

6-
IECFG="/usr/share/icinga-editor/includes/Configure.php"
7-
8-
9-
if [ ! -f $IECFG ]; then
10-
echo '<?php' > $IECFG
11-
fi
12-
136
#Replace Key Value in PhinX Config File
147
replaceYML() {
158
cfg="/var/lib/icinga-editor/phinx.yml"
169
sed -i "/${1}:/c\ ${1}: ${2}" $cfg
1710
}
1811

19-
replacePHP() {
20-
if [ `cat ${IECFG} | grep "define('${1}'," | wc -l` = "0" ]; then
21-
echo "define('${1}', '${2}');" >> ${IECFG}
22-
else
23-
sed -i "/${1}/c\define('${1}', '${2}');" ${IECFG}
24-
fi
12+
replaceJSON() {
13+
cfg="/etc/icinga-editor/config.json"
14+
sed -i "/${1}/c\ \"${1}\": \"${2}\"," $cfg
2515
}
2616

2717

28-
2918
. /usr/share/debconf/confmodule
3019

3120
db_input critical icinga-editor/SEND_MAILS_FROM || true
@@ -59,9 +48,9 @@ IW_SERVER_PASSWORD=`cat $IWCFG | grep dbc_dbpass= | awk -F\' '{print $2}'`
5948
IW_DATABASE=`cat $IWCFG | grep dbc_dbname= | awk -F\' '{print $2}'`
6049

6150

62-
replacePHP "DB_IW_SERVER_USERNAME" $IW_SERVER_USERNAME
63-
replacePHP "DB_IW_SERVER_PASSWORD" $IW_SERVER_PASSWORD
64-
replacePHP "DB_IW_DATABASE" $IW_DATABASE
51+
replaceJSON "DB_IW_SERVER_USERNAME" $IW_SERVER_USERNAME
52+
replaceJSON "DB_IW_SERVER_PASSWORD" $IW_SERVER_PASSWORD
53+
replaceJSON "DB_IW_DATABASE" $IW_DATABASE
6554

6655
if [ "$1" = "configure" ]; then
6756

@@ -98,19 +87,13 @@ composer --no-dev -o update
9887

9988
. /etc/icinga-editor/config-db.sh
10089

101-
replacePHP "DB_TYPE" "mysql"
102-
replacePHP "DB_SERVER_HOST" "localhost"
103-
replacePHP "DB_SERVER_USERNAME" $dbuser
104-
replacePHP "DB_SERVER_PASSWORD" $dbpass
105-
replacePHP "DB_DATABASE" $dbname
106-
replacePHP "DB_PREFIX" ""
107-
replacePHP "SEND_MAILS_FROM" $SEND_MAILS_FROM
108-
109-
#replacePHP "LOG_DIRECTORY" "/var/log/"
110-
#replacePHP "CFG_GENERATED" "/etc/icinga/generated/"
111-
#replacePHP "LOG_NAME" "IcingaEditor"
112-
#replacePHP "LOG_TYPE" "syslog"
113-
90+
replaceJSON "DB_TYPE" "mysql"
91+
replaceJSON "DB_HOST" "localhost"
92+
replaceJSON "DB_USERNAME" $dbuser
93+
replaceJSON "DB_PASSWORD" $dbpass
94+
replaceJSON "DB_DATABASE" $dbname
95+
replaceJSON "DB_PREFIX" ""
96+
replaceJSON "SEND_MAILS_FROM" $SEND_MAILS_FROM
11497

11598
replaceYML "adapter" "mysql"
11699
replaceYML "host" "localhost"

nbproject/private/private.xml

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/host.php</file>
1818
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/login.php</file>
1919
</group>
20-
<group/>
20+
<group>
21+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/host.php</file>
22+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/WebPage.php</file>
23+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/classes/UI/FXPreloader.php</file>
24+
</group>
2125
</open-files>
2226
</project-private>

src/classes/UI/PageBottom.php

+13-20
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
namespace Icinga\Editor\UI;
44

55
/**
6-
* Spodek stránky
6+
* Page Bottom
77
*
88
* @package VitexSoftware
9-
* @subpackage WebUI
109
* @author Vitex <vitex@hippy.cz>
1110
*/
12-
class PageBottom extends \Ease\TWB\Container
11+
class PageBottom extends \Ease\Html\FooterTag
1312
{
1413

1514
/**
@@ -24,23 +23,17 @@ public function finalize()
2423

2524
$appInfo = json_decode(file_get_contents($composer));
2625

27-
28-
if (!defined('HIDEFOOTER')) {
29-
$this->SetTagID('footer');
30-
$this->addItem('<hr>');
31-
$star = '<iframe src="https://ghbtns.com/github-btn.html?user=Vitexus&repo=icinga_configurator&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>';
32-
$footrow = new \Ease\TWB\Row();
33-
$footrow->addColumn(4,
34-
'<a href="https://github.com/VitexSoftware/Icinga-Editor">Icinga Editor</a> v.: '.$appInfo->version.'&nbsp;&nbsp; &copy; 2012-2016 <a href="http://vitexsoftware.cz/">Vitex Software</a>');
35-
$footrow->addColumn(4,
36-
'<a href="http://www.austro-bohemia.cz/"><img style="position: relative;top: -2px; left: -10px; height: 25px" align="right" style="border:0" src="images/austro-bohemia-logo.png" alt="ABSRO" title="Pasivní checky napsány pro společnost Austro Bohemia s.r.o." /></a>');
37-
$footrow->addColumn(4,
38-
'<a href="http://www.spoje.net"><img style="position: relative; top: -7px; left: -10px;" align="right" style="border:0" src="img/spojenet_small_white.gif" alt="SPOJE.NET" title="Housing zajišťují SPOJE.NET s.r.o." /></a>');
39-
$this->addItem($footrow);
26+
$container = $this->setTagID('footer');
27+
$this->addItem('<hr>');
28+
$star = '<iframe src="https://ghbtns.com/github-btn.html?user=Vitexus&repo=icinga_configurator&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px"></iframe>';
29+
$footrow = new \Ease\TWB\Row();
30+
$footrow->addColumn(4,
31+
'<a href="https://github.com/VitexSoftware/Icinga-Editor">Icinga Editor</a> v.: '.$appInfo->version.'&nbsp;&nbsp; &copy; 2012-2017 <a href="http://vitexsoftware.cz/">Vitex Software</a>');
32+
$footrow->addColumn(4,
33+
'<a href="http://www.austro-bohemia.cz/"><img style="position: relative;top: -2px; left: -10px; height: 25px" align="right" style="border:0" src="images/austro-bohemia-logo.png" alt="ABSRO" title="Pasivní checky napsány pro společnost Austro Bohemia s.r.o." /></a>');
34+
$footrow->addColumn(4,
35+
'<a href="http://www.spoje.net"><img style="position: relative; top: -7px; left: -10px;" align="right" style="border:0" src="img/spojenet_small_white.gif" alt="SPOJE.NET" title="Housing zajišťují SPOJE.NET s.r.o." /></a>');
36+
$this->addItem(new \Ease\TWB\Container($footrow));
4037
// $Foot->addItem('<a href="https://twitter.com/VSMonitoring" class="twitter-follow-button" data-show-count="true" data-lang="cs">Sledovat @VSMonitoring</a>');
41-
} else {
42-
$this->addItem('<hr>Icinga Editor v.: '.$appInfo->version);
43-
}
4438
}
45-
4639
}

src/classes/UI/WebPage.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,25 @@ class WebPage extends \Ease\TWB\WebPage
1313
{
1414
/**
1515
* Hlavní blok stránky
16-
* @var \Ease\Html\Div
16+
* @var \Ease\Html\DivTag
1717
*/
1818
public $container = NULL;
1919

2020
/**
2121
* První sloupec
22-
* @var \Ease\Html\Div
22+
* @var \Ease\Html\DivTag
2323
*/
2424
public $columnI = NULL;
2525

2626
/**
2727
* Druhý sloupec
28-
* @var \Ease\Html\Div
28+
* @var \Ease\Html\DivTag
2929
*/
3030
public $columnII = NULL;
3131

3232
/**
3333
* Třetí sloupec
34-
* @var \Ease\Html\Div
34+
* @var \Ease\Html\DivTag
3535
*/
3636
public $columnIII = NULL;
3737

@@ -59,7 +59,7 @@ public function __construct($pageTitle = null, &$userObject = null)
5959
$this->head->addItem('<link rel="apple-touch-icon-precomposed" href="img/vsmonitoring.png">');
6060
$this->head->addItem('<link rel="shortcut icon" type="image/png" href="img/vsmonitoring.png">');
6161
$this->addItem('<br>');
62-
$this->container = $this->addItem(new \Ease\Html\Div(null,
62+
$this->container = $this->addItem(new \Ease\Html\DivTag(null,
6363
['class' => 'container']));
6464
}
6565

@@ -68,14 +68,14 @@ public function __construct($pageTitle = null, &$userObject = null)
6868
*/
6969
function addPageColumns()
7070
{
71-
$row = $this->container->addItem(new \Ease\Html\Div(null,
71+
$row = $this->container->addItem(new \Ease\Html\DivTag(null,
7272
['class' => 'row']));
7373

74-
$this->columnI = $row->addItem(new \Ease\Html\Div(null,
74+
$this->columnI = $row->addItem(new \Ease\Html\DivTag(null,
7575
['class' => 'col-md-4']));
76-
$this->columnII = $row->addItem(new \Ease\Html\Div(null,
76+
$this->columnII = $row->addItem(new \Ease\Html\DivTag(null,
7777
['class' => 'col-md-4']));
78-
$this->columnIII = $row->addItem(new \Ease\Html\Div(null,
78+
$this->columnIII = $row->addItem(new \Ease\Html\DivTag(null,
7979
['class' => 'col-md-4']));
8080
}
8181

@@ -99,9 +99,10 @@ public function onlyForAdmin($loginPage = 'login.php')
9999
*
100100
* @param string $loginPage adresa přihlašovací stránky
101101
*/
102-
function onlyForLogged($loginPage = 'login.php')
102+
function onlyForLogged($loginPage = 'login.php', $message = null)
103103
{
104-
return parent::onlyForLogged($loginPage.'?backurl='.urlencode($_SERVER['REQUEST_URI']));
104+
return parent::onlyForLogged($loginPage.'?backurl='.urlencode($_SERVER['REQUEST_URI']),
105+
$message);
105106
}
106107

107108
}

src/includes/Configure.php

-57
This file was deleted.

src/includes/Configure.php.dist

-68
This file was deleted.

0 commit comments

Comments
 (0)