Skip to content

Commit 6eae60d

Browse files
committed
Fixed Scripts Edit/Upload
Switching strings to English
1 parent aef37c2 commit 6eae60d

10 files changed

Lines changed: 60 additions & 43 deletions

File tree

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
/nbproject/private/
44
/nbproject/
55
/test/build/
6-
/vendor/
6+
/vendor/
7+
/debian/icinga-editor.postrm.debhelper
8+
/debian/icinga-editor.substvars

debian/changelog

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
icinga-editor (1.0-12) UNRELEASED; urgency=medium
1+
icinga-editor (1.1.2-13) UNRELEASED; urgency=medium
22

33
[ dvorak ]
44
* Initial release. (Closes: #XXXXXX)
@@ -103,5 +103,7 @@ icinga-editor (1.0-12) UNRELEASED; urgency=medium
103103
* Fixed config files import during debian package install process
104104
* Fixed config files import during debian package install process
105105
* Better README
106+
* Fixed search path Fixed composer package version for debian
107+
Switching string to English
106108

107-
-- vitex <vitex@developer.kancl.brevnov.czf> Tue, 02 Aug 2016 11:20:14 +0200
109+
-- vitex <vitex@developer.kancl.brevnov.czf> Tue, 02 Aug 2016 14:55:12 +0200

debian/conf/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vitexsoftware/icinga-editor",
33
"description": "Editor of Icinga Configuration files (debianized)",
4-
"version": "1.1.2",
4+
"version": "1.1.2.13",
55
"license": "GPL-2.0",
66
"authors": [
77
{

debian/lastversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0
1+
1.1.2

debian/revison

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12
1+
0

debian/version

Lines changed: 0 additions & 1 deletion
This file was deleted.

nbproject/private/private.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
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/PageBottom.php</file>
15+
<file>file:/home/vitex/Projects/VitexSoftware/icinga_configurator/src/index.php</file>
16+
</group>
1417
</open-files>
1518
</project-private>

src/classes/Script.php

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@
1515
*/
1616
class Script extends engine\Configurator
1717
{
18-
public $myTable = 'script';
19-
public $myKeyColumn = 'script_id';
20-
public $nameColumn = 'filename';
21-
public $keyword = 'script';
18+
public $myTable = 'script';
19+
public $myKeyColumn = 'script_id';
20+
public $nameColumn = 'filename';
21+
public $keyword = 'script';
22+
public $myCreateColumn = 'DatCreate';
23+
public $myLastModifiedColumn = 'DatSave';
2224

2325
/**
24-
* Přidat položky register a use ?
26+
* Add register a use fields ?
2527
* @var boolean
2628
*/
2729
public $allowTemplating = false;
2830

2931
/**
30-
* Položky
32+
* Fields
3133
* @var array
3234
*/
3335
public $useKeywords = [
@@ -45,19 +47,19 @@ class Script extends engine\Configurator
4547
public $keywordsInfo = [
4648
'filename' => [
4749
'severity' => 'mandatory',
48-
'title' => 'název příkazu', 'required' => true],
50+
'title' => 'Command Name', 'required' => true],
4951
'body' => [
5052
'severity' => 'mandatory',
51-
'title' => 'tělo skriptu', 'required' => true],
53+
'title' => 'Script body', 'required' => true],
5254
'user_id' => [
5355
'severity' => 'advanced',
54-
'title' => 'vlastník příkazu', 'required' => false],
56+
'title' => 'Comand owner', 'required' => false],
5557
'public' => [
5658
'severity' => 'advanced',
57-
'title' => 'přístupnost'],
59+
'title' => 'Publicity'],
5860
'platform' => [
5961
'severity' => 'basic',
60-
'title' => 'Platforma', 'mandatory' => true]
62+
'title' => 'Platform', 'mandatory' => true]
6163
];
6264

6365
/**
@@ -85,15 +87,15 @@ public function __construct($itemID = null)
8587
*/
8688
public function getAllUserData()
8789
{
88-
$AllData = parent::getAllUserData();
89-
foreach ($AllData as $ADkey => $AD) {
90-
unset($AllData[$ADkey]['deploy']);
91-
unset($AllData[$ADkey]['script_type']);
92-
unset($AllData[$ADkey]['script_local']);
93-
unset($AllData[$ADkey]['script_remote']);
90+
$allData = parent::getAllUserData();
91+
foreach ($allData as $ADkey => $AD) {
92+
unset($allData[$ADkey]['deploy']);
93+
unset($allData[$ADkey]['script_type']);
94+
unset($allData[$ADkey]['script_local']);
95+
unset($allData[$ADkey]['script_remote']);
9496
}
9597

96-
return $AllData;
98+
return $allData;
9799
}
98100

99101
/**
@@ -123,7 +125,7 @@ public function getAllData()
123125
*/
124126
public function deleteButton($name = null, $addUrl = '')
125127
{
126-
return parent::deleteButton(_('skript'), $addUrl);
128+
return parent::deleteButton(_('Script'), $addUrl);
127129
}
128130

129131
/**
@@ -135,6 +137,11 @@ public function deleteButton($name = null, $addUrl = '')
135137
*/
136138
public function takeData($data, $dataPrefix = null)
137139
{
140+
if (array_key_exists('public', $data)) {
141+
$data['public'] = 1;
142+
} else {
143+
$data['public'] = 0;
144+
}
138145
return parent::takeData($data, $dataPrefix);
139146
}
140147

src/classes/engine/Configurator.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,13 @@ public function saveToSQL($data = null, $searchForID = false)
786786
} else {
787787
foreach ($data as $fieldName => $value) {
788788
if (!is_null($value)) {
789-
$data[$fieldName] = $this->dblink->addSlashes($value);
789+
if (is_string($value)) {
790+
$data[$fieldName] = $this->dblink->addSlashes($value);
791+
} else {
792+
if (is_bool($value)) {
793+
$data[$fieldName] = intval($value);
794+
}
795+
}
790796
}
791797
}
792798
$result = parent::saveToSQL($data, $searchForID);

src/script.php

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @package IcingaEditor
99
* @subpackage WebUI
1010
* @author Vitex <vitex@hippy.cz>
11-
* @copyright 2012 Vitex@hippy.cz (G)
11+
* @copyright 2012-2016 Vitex@hippy.cz (G)
1212
*/
1313
require_once 'includes/IEInit.php';
1414

@@ -30,20 +30,20 @@
3030
}
3131
$script->setDataValue('body',
3232
file_get_contents($_FILES['upload']['tmp_name']));
33-
$script->addStatusMessage(_('Skript byl nahran na server'),
33+
$script->addStatusMessage(_('Script was uploaded to server'),
3434
'success');
3535
}
3636

3737

3838
if (!$script->getName()) {
39-
$oUser->addStatusMessage(_('Není zadán název'), 'warning');
39+
$oUser->addStatusMessage(_('Script name missing'), 'warning');
4040
}
4141
$scriptID = $script->saveToSQL();
4242

4343
if (is_null($scriptID)) {
44-
$oUser->addStatusMessage(_('Skript nebyl uložen'), 'warning');
44+
$oUser->addStatusMessage(_('Skript was not saved'), 'warning');
4545
} else {
46-
$oUser->addStatusMessage(_('Skript byl uložen'), 'success');
46+
$oUser->addStatusMessage(_('Skript was saved'), 'success');
4747
}
4848
}
4949
}
@@ -55,15 +55,15 @@
5555
$oPage->redirect('scripts.php');
5656
}
5757

58-
$oPage->addItem(new UI\PageTop(_('Editace skriptu').' '.$script->getName()));
58+
$oPage->addItem(new UI\PageTop(_('Script Editor').' '.$script->getName()));
5959

6060

6161
switch ($oPage->getRequestValue('action')) {
6262
case 'delete':
6363
$form = new \Ease\Container;
6464
$form->addItem(new \Ease\Html\H2Tag($script->getName()));
6565

66-
$confirmator = $form->addItem(new \Ease\TWB\Panel(_('Opravdu smazat ?')),
66+
$confirmator = $form->addItem(new \Ease\TWB\Panel(_('Script removal: Are you sure ?')),
6767
'danger');
6868

6969
$confirmator->addItem(new \Ease\TWB\Well(nl2br($script->getDataValue('body'))));
@@ -82,20 +82,20 @@
8282
['class' => 'form-horizontal', 'enctype' => 'multipart/form-data']);
8383

8484
$form->addInput(new \Ease\Html\InputFileTag('upload'),
85-
_('Odeslat soubor'), 'script.sh', _('(Textarea bude prepsana)'));
85+
_('Odeslat soubor'), 'script.sh', _('(Textarea will overwrited)'));
8686

8787
if (!$script->getId()) {
88-
$form->addItem(new \Ease\TWB\SubmitButton(_('Založit'), 'success'));
88+
$form->addItem(new \Ease\TWB\SubmitButton(_('Create'), 'success'));
8989
} else {
90-
$form->addItem(new \Ease\TWB\SubmitButton(_('Uložit'), 'success'));
90+
$form->addItem(new \Ease\TWB\SubmitButton(_('Save'), 'success'));
9191
}
9292
break;
9393
}
9494
$oPage->addItem(new UI\PageBottom());
9595

9696

9797
$infopanel = new UI\InfoBox($script);
98-
$tools = new \Ease\TWB\Panel(_('Nástroje'), 'warning');
98+
$tools = new \Ease\TWB\Panel(_('Tools'), 'warning');
9999
if ($script->getId()) {
100100
$tools->addItem($script->deleteButton());
101101
$tools->addItem(new \Ease\TWB\Panel(_('Transfer'), 'warning',
@@ -108,9 +108,7 @@
108108
$command->getMyKeyColumn());
109109

110110
if (count($usages)) {
111-
$usedBy = new \Ease\TWB\Panel(_('Používající příkazy'));
112-
113-
111+
$usedBy = new \Ease\TWB\Panel(_('Used by commands'));
114112

115113
$listing = new \Ease\Html\UlTag(null, ['class' => 'list-group']);
116114
foreach ($usages as $usage) {
@@ -136,7 +134,7 @@
136134
$pageRow = new \Ease\TWB\Row();
137135
$pageRow->addColumn(2, $infopanel);
138136
$pageRow->addColumn(6,
139-
new \Ease\TWB\Panel(_('Skript').' <strong>'.$script->getName().'</strong>',
137+
new \Ease\TWB\Panel(_('Script').' <strong>'.$script->getName().'</strong>',
140138
'default', $form));
141139
$pageRow->addColumn(4, $tools);
142140
$oPage->container->addItem($pageRow);

0 commit comments

Comments
 (0)