mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 23:44:11 +01:00
Compare commits
345 Commits
documentat
...
3.1.0-alph
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c4289a491 | ||
|
|
8940051c3d | ||
|
|
72dad5dd07 | ||
|
|
dc38db1c3d | ||
|
|
45df1002ec | ||
|
|
737388053f | ||
|
|
d0b000d125 | ||
|
|
1d0ce1862d | ||
|
|
c0589715c1 | ||
|
|
8b18fd7cc0 | ||
|
|
9f81e4875a | ||
|
|
33717b9610 | ||
|
|
b97a464bb1 | ||
|
|
58c0da7e87 | ||
|
|
4203382920 | ||
|
|
825e402dd6 | ||
|
|
fa75c8964a | ||
|
|
fc58c6f4ce | ||
|
|
ef4e38f6b9 | ||
|
|
4f102d764a | ||
|
|
dbd58cfeb6 | ||
|
|
1086eaaffe | ||
|
|
f7ee21f1d7 | ||
|
|
35b0b16e20 | ||
|
|
ca72ec736e | ||
|
|
e63d66aa5d | ||
|
|
2803f0be49 | ||
|
|
278b0d643f | ||
|
|
569045f675 | ||
|
|
25989bc00f | ||
|
|
fc60759db5 | ||
|
|
3a931ff79e | ||
|
|
f6bd380ad0 | ||
|
|
97c4ecf8bc | ||
|
|
5f4ef74d34 | ||
|
|
6184dbafff | ||
|
|
630c1dcdc8 | ||
|
|
cb84cbf7a8 | ||
|
|
b025f86b21 | ||
|
|
5a76175ec1 | ||
|
|
ce162f05da | ||
|
|
d358c9e8fa | ||
|
|
86a208a86d | ||
|
|
372888c7a7 | ||
|
|
547a520ab1 | ||
|
|
8bf788dcb9 | ||
|
|
a157e754a9 | ||
|
|
eae84ab399 | ||
|
|
4d4d3bd9a2 | ||
|
|
9f9630d011 | ||
|
|
de1c58a84c | ||
|
|
1fe9520b7e | ||
|
|
3fbc5e1ce0 | ||
|
|
786e7d647c | ||
|
|
99b7d66cf2 | ||
|
|
1768274aaf | ||
|
|
7cc1e33950 | ||
|
|
72a586e490 | ||
|
|
0cce58e0cf | ||
|
|
53b68f88b8 | ||
|
|
7fb10da013 | ||
|
|
0b1352fe37 | ||
|
|
e0cc00e772 | ||
|
|
002e52cc3e | ||
|
|
bbea978259 | ||
|
|
bddfa4cd7a | ||
|
|
12ef74ec42 | ||
|
|
cd1b441025 | ||
|
|
0f97b93617 | ||
|
|
b61c8ea4ca | ||
|
|
f48df74933 | ||
|
|
6fb00cbbf3 | ||
|
|
af2421a2cb | ||
|
|
0374e303e4 | ||
|
|
27bd78d76b | ||
|
|
bc3b43958c | ||
|
|
fd4a2f17d2 | ||
|
|
d741656028 | ||
|
|
f7e8bd31f5 | ||
|
|
1e37370789 | ||
|
|
5844717980 | ||
|
|
9437968d0e | ||
|
|
e72ed33a40 | ||
|
|
2a825c6ba0 | ||
|
|
6b8d9ea08d | ||
|
|
52d57293c9 | ||
|
|
40cebf1eb7 | ||
|
|
f1d6f3e5c2 | ||
|
|
834c4a2654 | ||
|
|
ed1a076ebb | ||
|
|
1dcf38f2ea | ||
|
|
2f034253e7 | ||
|
|
a10ac7fdcb | ||
|
|
3775ccea74 | ||
|
|
f743971c93 | ||
|
|
dd213df9c4 | ||
|
|
96825c646e | ||
|
|
1152b2f401 | ||
|
|
8f7003c694 | ||
|
|
fb1ceebaa4 | ||
|
|
9482139b5a | ||
|
|
7ea2315323 | ||
|
|
9487d63b9c | ||
|
|
3d9a85d577 | ||
|
|
b2397fc570 | ||
|
|
0d15b01b3f | ||
|
|
f7e87c1ea1 | ||
|
|
3ca4122673 | ||
|
|
f21f6aec30 | ||
|
|
c76d351379 | ||
|
|
efa20e77d0 | ||
|
|
effc4141c7 | ||
|
|
b4813de0a5 | ||
|
|
f75a51d59e | ||
|
|
8e3bad11ae | ||
|
|
13550fd643 | ||
|
|
44977d69b6 | ||
|
|
15f108152c | ||
|
|
9be167cf5e | ||
|
|
34688c2bf6 | ||
|
|
9dc54d6e4c | ||
|
|
640b1b9176 | ||
|
|
c1922e2b3f | ||
|
|
e1ffa65d8b | ||
|
|
cc2881a7b0 | ||
|
|
0d8a21f6ef | ||
|
|
3459dc5997 | ||
|
|
01d9d34118 | ||
|
|
de7c9d965e | ||
|
|
6549c95d4f | ||
|
|
da07fadfb3 | ||
|
|
b2c256e51e | ||
|
|
7305a30b50 | ||
|
|
4c127b6f61 | ||
|
|
61be903eb2 | ||
|
|
59792b2a3d | ||
|
|
19dda61d4f | ||
|
|
a50ed02057 | ||
|
|
0a7c8f9fd1 | ||
|
|
f65e14397c | ||
|
|
06a5d645da | ||
|
|
5d1852fe45 | ||
|
|
d7b94fb123 | ||
|
|
ced4f82585 | ||
|
|
de0110abc6 | ||
|
|
a53bea5eb9 | ||
|
|
47435869b3 | ||
|
|
80a9ded404 | ||
|
|
c696a81c3a | ||
|
|
e04ea2d178 | ||
|
|
42ce397e13 | ||
|
|
22162aa55f | ||
|
|
c693d03a77 | ||
|
|
b9ed00d53f | ||
|
|
29e0df9bbc | ||
|
|
c4508ea80c | ||
|
|
16390c9b00 | ||
|
|
1271a895d1 | ||
|
|
030f1e2463 | ||
|
|
ec90c0b6cd | ||
|
|
7b79da3f32 | ||
|
|
5729d6a9cd | ||
|
|
4d7bac89f3 | ||
|
|
a5efef900c | ||
|
|
c851a10982 | ||
|
|
845adf43c6 | ||
|
|
5916e4ea39 | ||
|
|
7f37de777e | ||
|
|
bcf880f327 | ||
|
|
b593beb8c7 | ||
|
|
57ab3a0336 | ||
|
|
4a54b2f8ff | ||
|
|
6aa9aa2831 | ||
|
|
9b47ee12e7 | ||
|
|
d177ee4a7f | ||
|
|
b354058eb5 | ||
|
|
fbc0a898ae | ||
|
|
36f8e58e25 | ||
|
|
6a7dbb06b0 | ||
|
|
43dd0b7df8 | ||
|
|
43d86ad8e2 | ||
|
|
d3d89b1ee2 | ||
|
|
15d3201a40 | ||
|
|
cf4616d9a1 | ||
|
|
5721a324c1 | ||
|
|
7de6c72154 | ||
|
|
c0cee02351 | ||
|
|
bb674fb873 | ||
|
|
6136eadd31 | ||
|
|
87cb73c038 | ||
|
|
11d8547cef | ||
|
|
0998c73a1a | ||
|
|
471f66649a | ||
|
|
e8bf9cf688 | ||
|
|
4f88a0e7d2 | ||
|
|
c6b0e273e6 | ||
|
|
d9539f9d01 | ||
|
|
a3e309acb5 | ||
|
|
c06cbfd4a9 | ||
|
|
1d7e4e1a42 | ||
|
|
083d19c688 | ||
|
|
4e9a34d8d8 | ||
|
|
524e65a29b | ||
|
|
25048ba0cc | ||
|
|
4f7a1ea9da | ||
|
|
a62a373f64 | ||
|
|
6b23171d65 | ||
|
|
09b69728a0 | ||
|
|
bc0dbc7860 | ||
|
|
a693c343e8 | ||
|
|
cd17eb484a | ||
|
|
259eb60f97 | ||
|
|
1afa3e2003 | ||
|
|
df7d7c877d | ||
|
|
4c4d7c12e8 | ||
|
|
97c3cacfaa | ||
|
|
98ec568788 | ||
|
|
626ba7ee66 | ||
|
|
3920f84f45 | ||
|
|
30d2557342 | ||
|
|
4bcad431aa | ||
|
|
f3cea730af | ||
|
|
5fe32aac15 | ||
|
|
88d9a29599 | ||
|
|
92a36dcfdd | ||
|
|
23b4d4cb6b | ||
|
|
b37e74b407 | ||
|
|
0fad249124 | ||
|
|
94d7d94bff | ||
|
|
48645dd519 | ||
|
|
9df9077595 | ||
|
|
756241918e | ||
|
|
f819fdae98 | ||
|
|
7127b192a2 | ||
|
|
1cac189077 | ||
|
|
0383fb124b | ||
|
|
f378fd3d72 | ||
|
|
44fac686f9 | ||
|
|
eff2afbc69 | ||
|
|
86b3129c08 | ||
|
|
bdd5741290 | ||
|
|
53091fc5df | ||
|
|
06db3561dc | ||
|
|
5cb2f19ea0 | ||
|
|
a668b92051 | ||
|
|
eda11e97e3 | ||
|
|
64146b6e1b | ||
|
|
7b85cb92b0 | ||
|
|
a28fcb7c8c | ||
|
|
f8ec180a0f | ||
|
|
0810a113c1 | ||
|
|
1b4a21fafa | ||
|
|
fae857175b | ||
|
|
9c21ca2ee6 | ||
|
|
ccdb5ec79f | ||
|
|
cb6232cc05 | ||
|
|
0d49c605e2 | ||
|
|
207d312b12 | ||
|
|
08d83478da | ||
|
|
8665f4ff06 | ||
|
|
6a5beb89cc | ||
|
|
3d09e3b57b | ||
|
|
6d47b0f4f8 | ||
|
|
27cf8159d0 | ||
|
|
314dd7d7ad | ||
|
|
6412f1ab23 | ||
|
|
32ee1a8226 | ||
|
|
e1c28a5c22 | ||
|
|
296ee019a0 | ||
|
|
fe997d1254 | ||
|
|
e38951ebae | ||
|
|
7c2f8f4d93 | ||
|
|
1f76ff940d | ||
|
|
fde6cac7a2 | ||
|
|
93209265f2 | ||
|
|
b50675fc29 | ||
|
|
deb6d1fd9a | ||
|
|
432579657c | ||
|
|
f09bd5fdff | ||
|
|
4f37a9e447 | ||
|
|
32297d93dd | ||
|
|
7083e1263d | ||
|
|
329d1a7c41 | ||
|
|
22749caeb4 | ||
|
|
baaa4474f9 | ||
|
|
af804a9dc1 | ||
|
|
899f4fdc0a | ||
|
|
8cced3a79e | ||
|
|
bb26e48d38 | ||
|
|
4eb45f1b34 | ||
|
|
c2f503e2ac | ||
|
|
e4e654100e | ||
|
|
3270c3f775 | ||
|
|
7f88a6aa1a | ||
|
|
26042b990f | ||
|
|
cf433f2f80 | ||
|
|
c02f84969a | ||
|
|
bdebea62b6 | ||
|
|
4a22361f39 | ||
|
|
025f8b9dc3 | ||
|
|
9defedb862 | ||
|
|
ae94e58a43 | ||
|
|
e4d8489292 | ||
|
|
f66692d5cf | ||
|
|
2b917f6647 | ||
|
|
cda017fa4f | ||
|
|
dad22f6f83 | ||
|
|
0579f1b1dc | ||
|
|
a551bf0499 | ||
|
|
4f36819ab2 | ||
|
|
26359cf1ee | ||
|
|
00a25f3e8b | ||
|
|
2d122448c8 | ||
|
|
e5d67d2219 | ||
|
|
4ac0de5fff | ||
|
|
dbe7fae82e | ||
|
|
98a53a46f0 | ||
|
|
e6946d33e6 | ||
|
|
9474f43d61 | ||
|
|
9077f7ba37 | ||
|
|
3548251997 | ||
|
|
4d365c8a44 | ||
|
|
957ff40f30 | ||
|
|
93e0dde1a1 | ||
|
|
7bb12c35ea | ||
|
|
aff9c7748b | ||
|
|
e518d34bc9 | ||
|
|
f02e95e8bf | ||
|
|
51a305b445 | ||
|
|
5577f4a62e | ||
|
|
f0141530b9 | ||
|
|
98bcfeb2ba | ||
|
|
669c69ff39 | ||
|
|
92a802947d | ||
|
|
ce5096a896 | ||
|
|
c5e00194b7 | ||
|
|
5efd45eafc | ||
|
|
23e0ed5e56 | ||
|
|
d412a52fcc | ||
|
|
ded2f8af9a | ||
|
|
084f3ec52b | ||
|
|
bedc8bbf46 | ||
|
|
cf5745b985 | ||
|
|
3e18ad590f | ||
|
|
b174aa9aeb |
@@ -3,14 +3,14 @@
|
||||
```mermaid
|
||||
%%{init: { 'logLevel': 'debug', 'theme': 'base', 'gitGraph': {'showBranches': true,'mainBranchName': 'develop','rotateCommitLabel': true}} }%%
|
||||
gitGraph
|
||||
commit id: "2016-07-06" tag: "2.3.0"
|
||||
commit id: "2016-07-06" tag: "2.3.0" type: HIGHLIGHT
|
||||
branch support/2.3 order: 900
|
||||
commit id: "2016-07-08" tag: "2.3.1"
|
||||
commit id: "2016-12-22" tag: "2.3.3"
|
||||
commit id: "2017-04-14" tag: "2.3.4"
|
||||
checkout develop
|
||||
commit id: "2017-07-12" tag: "2.4.0-beta" type: REVERSE
|
||||
commit id: "2017-11-16" tag: "2.4.0"
|
||||
commit id: "2017-11-16" tag: "2.4.0" type: HIGHLIGHT
|
||||
branch support/2.4 order: 890
|
||||
commit id: "2018-02-14" tag: "2.4.1"
|
||||
checkout develop
|
||||
@@ -18,10 +18,10 @@ gitGraph
|
||||
checkout support/2.4
|
||||
commit id: "2018-06-14" tag: "2.4.2"
|
||||
checkout develop
|
||||
commit id: "2018-06-27" tag: "2.5.0"
|
||||
commit id: "2018-06-27" tag: "2.5.0" type: HIGHLIGHT
|
||||
branch support/2.5 order: 880
|
||||
checkout develop
|
||||
commit id: "2019-01-09" tag: "2.6.0"
|
||||
commit id: "2019-01-09" tag: "2.6.0" type: HIGHLIGHT
|
||||
branch support/2.6 order: 870
|
||||
commit id: "2019-03-28" tag: "2.6.1"
|
||||
checkout develop
|
||||
@@ -32,11 +32,11 @@ gitGraph
|
||||
commit id: "2020-01-23" tag: "2.6.3"
|
||||
checkout develop
|
||||
commit id: "2020-01-29" tag: "2.7.0-beta2" type: REVERSE
|
||||
branch support/2.7 order: 860
|
||||
commit id: "2020-04-01" tag: "2.7.0-1"
|
||||
commit id: "2020-04-01" tag: "2.7.0-1" type: HIGHLIGHT
|
||||
checkout support/2.6
|
||||
commit id: "2020-04-22" tag: "2.6.4"
|
||||
checkout support/2.7
|
||||
checkout develop
|
||||
branch support/2.7 order: 860
|
||||
commit id: "2020-06-26" tag: "2.7.1"
|
||||
checkout support/2.7
|
||||
commit id: "2020-12-09" tag: "2.7.3"
|
||||
@@ -50,7 +50,7 @@ gitGraph
|
||||
checkout support/2.7
|
||||
commit id: "2021-12-17" tag: "2.7.6"
|
||||
checkout develop
|
||||
commit id: "2022-01-04" tag: "3.0.0"
|
||||
commit id: "2022-01-04" tag: "3.0.0" type: HIGHLIGHT
|
||||
branch support/3.0 order: 850
|
||||
commit id: "2022-04-08" tag: "3.0.1"
|
||||
checkout support/2.7
|
||||
@@ -58,4 +58,8 @@ gitGraph
|
||||
checkout support/3.0
|
||||
commit id: "2022-09-12" tag: "3.0.2-1"
|
||||
checkout develop
|
||||
checkout support/2.7
|
||||
commit id: "2022-12-28" tag: "2.7.8"
|
||||
```
|
||||
|
||||
To learn more, check the [iTop community versions history on the official wiki](https://www.itophub.io/wiki/page?id=latest:release:start).
|
||||
11
.gitignore
vendored
11
.gitignore
vendored
@@ -19,7 +19,7 @@
|
||||
|
||||
# composer reserver directory, from sources, populate/update using "composer install"
|
||||
vendor/*
|
||||
test/vendor/*
|
||||
tests/*/vendor/*
|
||||
|
||||
# all conf but listing prevention
|
||||
/conf/**
|
||||
@@ -46,7 +46,7 @@ test/vendor/*
|
||||
!/log/web.config
|
||||
|
||||
# PHPUnit cache file
|
||||
/test/.phpunit.result.cache
|
||||
/tests/php-unit-tests/.phpunit.result.cache
|
||||
|
||||
|
||||
# Jetbrains
|
||||
@@ -146,3 +146,10 @@ local.properties
|
||||
.cache-main
|
||||
.scala_dependencies
|
||||
.worksheet
|
||||
|
||||
# Mac
|
||||
.DS_Store
|
||||
|
||||
# Windows
|
||||
Thumbs.db
|
||||
|
||||
|
||||
@@ -6,12 +6,19 @@
|
||||
* Will update version in the following files :
|
||||
*
|
||||
* datamodels/2.x/.../datamodel.*.xml
|
||||
* application/*.xml
|
||||
* core/*.xml
|
||||
*
|
||||
* Usage :
|
||||
* `php .make\release\update-xml.php "1.7"`
|
||||
* `php .make\release\update-xml.php`
|
||||
*
|
||||
* If no parameter provided then the current XML version will be used as target version
|
||||
*
|
||||
* @since 2.7.0 simple version change using regexp (not doing conversion)
|
||||
* @since 3.1.0 N°5405 now does a real conversion
|
||||
* @since 3.1.0 N°5633 allow to use without parameter
|
||||
* @since 3.1.0 N°5633 add /application and /core XML files
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
@@ -23,10 +30,12 @@ require_once (__DIR__.DIRECTORY_SEPARATOR.'update.classes.inc.php');
|
||||
|
||||
if (count($argv) === 1)
|
||||
{
|
||||
echo '/!\ You must pass the new version as parameter';
|
||||
exit(1);
|
||||
echo '/!\ No version passed: assuming target XML version is current XML version ('.ITOP_DESIGN_LATEST_VERSION.")\n";
|
||||
$sVersionLabel = ITOP_DESIGN_LATEST_VERSION;
|
||||
} else {
|
||||
$sVersionLabel = $argv[1];
|
||||
}
|
||||
$sVersionLabel = $argv[1];
|
||||
|
||||
if (empty($sVersionLabel))
|
||||
{
|
||||
echo 'Version passed as parameter is empty !';
|
||||
|
||||
@@ -125,16 +125,31 @@ class iTopVersionFileUpdater extends AbstractSingleFileVersionUpdater
|
||||
|
||||
abstract class AbstractGlobFileVersionUpdater extends FileVersionUpdater
|
||||
{
|
||||
protected $sGlobPattern;
|
||||
/** @var array|string glob patterns to seek for files to modify */
|
||||
protected $globPattern;
|
||||
|
||||
public function __construct($sGlobPattern)
|
||||
public function __construct($globPattern)
|
||||
{
|
||||
$this->sGlobPattern = $sGlobPattern;
|
||||
$this->globPattern = $globPattern;
|
||||
}
|
||||
|
||||
public function GetFiles()
|
||||
{
|
||||
return glob($this->sGlobPattern);
|
||||
$aGlobPatterns = (is_array($this->globPattern))
|
||||
? $this->globPattern
|
||||
: [$this->globPattern];
|
||||
|
||||
$aFiles = [];
|
||||
foreach ($aGlobPatterns as $sGlobPattern) {
|
||||
$result = glob($sGlobPattern);
|
||||
if (false === $result) {
|
||||
continue;
|
||||
}
|
||||
/** @noinspection SlowArrayOperationsInLoopInspection */
|
||||
$aFiles = array_merge($aFiles, $result);
|
||||
}
|
||||
|
||||
return $aFiles;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +181,11 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(APPROOT.'datamodels/2.x/*/datamodel.*.xml');
|
||||
parent::__construct([
|
||||
APPROOT.'datamodels/2.x/*/datamodel.*.xml',
|
||||
APPROOT.'application/*.xml',
|
||||
APPROOT.'core/*.xml',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,6 +202,13 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
||||
$oFileXml->loadXML($sFileContent);
|
||||
|
||||
$oFileItopFormat = new iTopDesignFormat($oFileXml);
|
||||
|
||||
$sDesignVersionToSet = static::GetDesignVersionToSet($oFileItopFormat->GetVersion());
|
||||
if (false === is_null($sDesignVersionToSet)) {
|
||||
// N°5779 if same as target version, we will try to convert from version below
|
||||
$oFileItopFormat->GetITopDesignNode()->setAttribute('version', $sDesignVersionToSet);
|
||||
}
|
||||
|
||||
$bConversionResult = $oFileItopFormat->Convert($sVersionLabel);
|
||||
|
||||
if (false === $bConversionResult) {
|
||||
@@ -191,4 +217,16 @@ class DatamodelsXmlFiles extends AbstractGlobFileVersionUpdater
|
||||
|
||||
return $oFileItopFormat->GetXmlAsString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?string version to use : if file version is same as current version then return previous version, else return null
|
||||
* @since 3.1.0 N°5779
|
||||
*/
|
||||
protected static function GetDesignVersionToSet($sFileDesignVersion):?string {
|
||||
if ($sFileDesignVersion !== ITOP_DESIGN_LATEST_VERSION) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return iTopDesignFormat::GetPreviousDesignVersion(ITOP_DESIGN_LATEST_VERSION);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,15 +134,16 @@ Our tests are located in the `test/` directory, containing a PHPUnit config file
|
||||
|
||||
When your code is working, please:
|
||||
|
||||
* squash as much as possible your commits,
|
||||
* rebase your branch on our repo last commit,
|
||||
* create a pull request
|
||||
* mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option !
|
||||
|
||||
Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
|
||||
* Squash as much as possible your commits,
|
||||
* Rebase your branch on our repo last commit,
|
||||
* Create a pull request. _Detailed procedure to work on fork and create PR is available [in GitHub help pages](https://help.github.com/articles/creating-a-pull-request-from-a-fork/)_.
|
||||
* Pull request description: mind to add all the information useful to understand why you're suggesting this modification and anything necessary to dive into your work. Especially:
|
||||
- Bugfixes: exact steps to reproduce the bug (given/when/then), description of the bug cause and what solution is implemented
|
||||
- Enhancements: use cases, implementation details if needed
|
||||
* Mind to check the "[Allow edits from maintainers](https://docs.github.com/en/github-ae@latest/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)" option !
|
||||
|
||||
|
||||
### 🙏 We are thankful
|
||||
## 🙏 We are thankful
|
||||
|
||||
We are thankful for all your contributions to the iTop universe! As a thank you gift, we will send stickers to every iTop (& extensions) contributors!
|
||||
|
||||
|
||||
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@@ -1,6 +1,14 @@
|
||||
def infra
|
||||
|
||||
node(){
|
||||
properties([
|
||||
buildDiscarder(
|
||||
logRotator(
|
||||
daysToKeepStr: "28",
|
||||
numToKeepStr: "500")
|
||||
)
|
||||
])
|
||||
|
||||
checkout scm
|
||||
|
||||
infra = load '/var/lib/jenkins/workspace/itop-test-infra_master/src/Infra.groovy'
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
</a></p>
|
||||
|
||||
|
||||
iTop stands for IT Operations Portal. It is a complete open source and web based IT service management platform including a fully customizable CMDB, a helpdesk system and a document management tool. It is ITIL compliant and easily customizable and extensible thanks to a high number of adds-on and web services to integrate with your IT.
|
||||
iTop stands for IT Operations Portal. It is a complete open source and web-based IT service management platform, including a fully customizable CMDB, a helpdesk system, and a document management tool. It is ITIL compliant and easily customizable and extensible thanks to a high number of add-ons and web services to integrate with your IT.
|
||||
|
||||
iTop also offers mass import tools to help you being even more efficient.
|
||||
iTop also offers mass import tools to help you become even more efficient.
|
||||
|
||||
## Features
|
||||
- Fully configurable [Configuration Management (CMDB)][10]
|
||||
@@ -65,7 +65,7 @@ iTop also offers mass import tools to help you being even more efficient.
|
||||
|
||||
## About Us
|
||||
|
||||
iTop development is sponsored, led and supported by [Combodo][0].
|
||||
iTop development is sponsored, led, and supported by [Combodo][0].
|
||||
|
||||
[0]: https://www.combodo.com
|
||||
|
||||
|
||||
12
SECURITY.md
12
SECURITY.md
@@ -18,8 +18,7 @@ to [itop-security@combodo.com](mailto:itop-security@combodo.com).
|
||||
|
||||
|
||||
|
||||
## 📆 Disclosure Policy
|
||||
|
||||
## 🔍 Combodo acknowledgment and investigation
|
||||
Report sent to us will be acknowledged within the week.
|
||||
|
||||
Then, a Combodo developer will be assigned to the reported issue and will:
|
||||
@@ -34,3 +33,12 @@ Then, a Combodo developer will be assigned to the reported issue and will:
|
||||
Security issues always take precedence over bug fixes and feature work.
|
||||
|
||||
The assignee will keep you informed of the resolution progress, and may ask you for additional information or guidance.
|
||||
|
||||
|
||||
## 📆 Disclosure Policy
|
||||
Once the fix is done and acknowledged by every stakeholder, it will be included in the next iTop version.
|
||||
Mind we have at least 2 active branches (LTS and STS, see [iTop Community Releases [iTop Documentation]](https://www.itophub.io/wiki/page?id=latest:release:start))
|
||||
|
||||
The release communications will include the information of the vulnerability fix.
|
||||
|
||||
Corresponding GitHub advisories and CVE will be published 3 months after the iTop version release date so that iTop instances can be updated.
|
||||
|
||||
@@ -12,6 +12,7 @@ require_once(APPROOT.'/application/applicationcontext.class.inc.php');
|
||||
require_once(APPROOT.'/application/cmdbabstract.class.inc.php');
|
||||
require_once(APPROOT.'/application/displayblock.class.inc.php');
|
||||
require_once(APPROOT.'/application/audit.category.class.inc.php');
|
||||
require_once(APPROOT.'/application/audit.domain.class.inc.php');
|
||||
require_once(APPROOT.'/application/audit.rule.class.inc.php');
|
||||
require_once(APPROOT.'/application/query.class.inc.php');
|
||||
require_once(APPROOT.'/setup/moduleinstallation.class.inc.php');
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\iEventEnrolment;
|
||||
|
||||
class ApplicationEvents implements iEventEnrolment
|
||||
{
|
||||
// Startup events
|
||||
const APPLICATION_EVENT_REQUEST_RECEIVED = 'APPLICATION_EVENT_REQUEST_RECEIVED';
|
||||
const APPLICATION_EVENT_METAMODEL_STARTED = 'APPLICATION_EVENT_METAMODEL_STARTED';
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function InitEvents()
|
||||
{
|
||||
EventService::RegisterEvent(self::APPLICATION_EVENT_REQUEST_RECEIVED, [
|
||||
'description' => 'A request was received from the network, at this point only the session is started, the configuration is not even loaded',
|
||||
], 'application');
|
||||
EventService::RegisterEvent(self::APPLICATION_EVENT_METAMODEL_STARTED, [
|
||||
'description' => 'The MetaModel is fully started',
|
||||
], 'application');
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@
|
||||
/**
|
||||
* This class manages the audit "categories". Each category defines a set of objects
|
||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
||||
* inside the set
|
||||
* inside the set
|
||||
*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -48,13 +48,39 @@ class AuditCategory extends cmdbAbstractObject
|
||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeOQL("definition_set", array("allowed_values"=>null, "sql"=>"definition_set", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSet("rules_list", array("linked_class"=>"AuditRule", "ext_key_to_me"=>"category_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array(), "edit_mode" => LINKSET_EDITMODE_INPLACE, "tracking_level" => LINKSET_TRACKING_ALL)));
|
||||
MetaModel::Init_AddAttribute(new AttributeInteger("ok_error_tolerance", array("allowed_values"=>null, "sql"=>"ok_error_tolerance", "default_value"=>5, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeInteger("warning_error_tolerance", array("allowed_values"=>null, "sql"=>"warning_error_tolerance", "default_value"=>25, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("domains_list", array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "category_id", "ext_key_to_remote" => "domain_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
|
||||
|
||||
// Display lists
|
||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'rules_list')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'definition_set', 'ok_error_tolerance', 'warning_error_tolerance', 'rules_list', 'domains_list')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
|
||||
// Search criteria
|
||||
MetaModel::Init_SetZListItems('standard_search', array('description', 'definition_set')); // Criteria of the std search form
|
||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iTotal
|
||||
* @param int $iErrors
|
||||
*
|
||||
* @return string A semantic color name (eg. red, green, orange, success, failure, ... {@see css/backoffice/utils/variables/colors/_semantic-palette.scss}) to use for this category depending on its error count and tolerance
|
||||
* @throws \CoreException
|
||||
*
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function GetReportColor($iTotal, $iErrors)
|
||||
{
|
||||
$sResult = 'red';
|
||||
if ( ($iTotal == 0) || ($iErrors / $iTotal) <= ($this->Get('ok_error_tolerance') / 100) )
|
||||
{
|
||||
$sResult = 'green';
|
||||
}
|
||||
else if ( ($iErrors / $iTotal) <= ($this->Get('warning_error_tolerance') / 100) )
|
||||
{
|
||||
$sResult = 'orange';
|
||||
}
|
||||
return $sResult;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
99
application/audit.domain.class.inc.php
Normal file
99
application/audit.domain.class.inc.php
Normal file
@@ -0,0 +1,99 @@
|
||||
<?php
|
||||
// Copyright (C) 2010-2021 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
// iTop is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// iTop is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
|
||||
/**
|
||||
* This class manages the audit "categories". Each category defines a set of objects
|
||||
* to check and is linked to a set of rules that determine the valid or invalid objects
|
||||
* inside the set
|
||||
*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class AuditDomain extends cmdbAbstractObject
|
||||
{
|
||||
public static function Init()
|
||||
{
|
||||
$aParams = array
|
||||
(
|
||||
"category" => "application, grant_by_profile",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "name",
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('name'),
|
||||
"db_table" => "priv_auditdomain",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("description"=>"Short name for this category", "allowed_values"=>null, "sql"=>"name", "default_value"=>"", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeImage("icon", array("is_null_allowed"=>true, "depends_on"=>array(), "display_max_width"=>96, "display_max_height"=>96, "storage_max_width"=>256, "storage_max_height"=>256, "default_image"=>null, "always_load_in_tables"=>false)));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("categories_list", array("linked_class" => "lnkAuditCategoryToAuditDomain", "ext_key_to_me" => "domain_id", "ext_key_to_remote" => "category_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array())));
|
||||
|
||||
// Display lists
|
||||
MetaModel::Init_SetZListItems('details', array('name', 'description', 'icon', 'categories_list')); // Attributes to be displayed for the complete details
|
||||
MetaModel::Init_SetZListItems('list', array('description', )); // Attributes to be displayed for a list
|
||||
// Search criteria
|
||||
MetaModel::Init_SetZListItems('standard_search', array('description')); // Criteria of the std search form
|
||||
MetaModel::Init_SetZListItems('default_search', array('name', 'description')); // Criteria of the default search form
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class lnkAuditCategoryToAuditDomain extends cmdbAbstractObject
|
||||
{
|
||||
/**
|
||||
* @throws \CoreException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function Init()
|
||||
{
|
||||
$aParams = array
|
||||
(
|
||||
"category" => "application, grant_by_profile",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "",
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('category_id', 'domain_id'),
|
||||
"db_table" => "priv_link_audit_category_domain",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "",
|
||||
"is_link" => true,
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("category_id", array("targetclass" => "AuditCategory", "jointype" => '', "allowed_values" => null, "sql" => "category_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalField("category_name", array("allowed_values" => null, "extkey_attcode" => 'category_id', "target_attcode" => "name")));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalKey("domain_id", array("targetclass" => "AuditDomain", "jointype" => '', "allowed_values" => null, "sql" => "domain_id", "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeExternalField("domain_name", array("allowed_values" => null, "extkey_attcode" => 'domain_id', "target_attcode" => "name")));
|
||||
|
||||
// Display lists
|
||||
MetaModel::Init_SetZListItems('details', array('category_id', 'domain_id'));
|
||||
MetaModel::Init_SetZListItems('list', array('category_id', 'domain_id'));
|
||||
// Search criteria
|
||||
MetaModel::Init_SetZListItems('standard_search', array('category_id', 'domain_id'));
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1549,6 +1549,29 @@ JS
|
||||
return $this->sDefinitionFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDashboardFileRelative can also be an absolute path (compatibility with old URL)
|
||||
*
|
||||
* @return string full path to the Dashboard file
|
||||
* @throws \SecurityException if path isn't under approot
|
||||
* @uses utils::RealPath()
|
||||
* @since 2.7.8 3.0.3 3.1.0 N°4449 remove FPD
|
||||
*/
|
||||
public static function GetDashboardFileFromRelativePath($sDashboardFileRelative)
|
||||
{
|
||||
if (utils::RealPath($sDashboardFileRelative, APPROOT)) {
|
||||
// compatibility with old URL containing absolute path !
|
||||
return $sDashboardFileRelative;
|
||||
}
|
||||
|
||||
$sDashboardFile = APPROOT.$sDashboardFileRelative;
|
||||
if (false === utils::RealPath($sDashboardFile, APPROOT)) {
|
||||
throw new SecurityException('Invalid dashboard file !');
|
||||
}
|
||||
|
||||
return $sDashboardFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDefinitionFile
|
||||
*/
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
<menus>
|
||||
<menu id="WelcomeMenu" xsi:type="MenuGroup" _delta="define">
|
||||
<rank>10</rank>
|
||||
<style>
|
||||
<decoration_classes>fas fa-home</decoration_classes>
|
||||
</style>
|
||||
<style>
|
||||
<decoration_classes>fas fa-home</decoration_classes>
|
||||
</style>
|
||||
</menu>
|
||||
<menu id="WelcomeMenuPage" xsi:type="DashboardMenuNode" _delta="define">
|
||||
<rank>10</rank>
|
||||
@@ -151,9 +151,9 @@
|
||||
</menu>
|
||||
<menu id="ConfigurationTools" xsi:type="MenuGroup" _delta="define_if_not_exists">
|
||||
<rank>90</rank>
|
||||
<style>
|
||||
<decoration_classes>fas fa-cog</decoration_classes>
|
||||
</style>
|
||||
<style>
|
||||
<decoration_classes>fas fa-cog</decoration_classes>
|
||||
</style>
|
||||
</menu>
|
||||
<menu id="DataSources" xsi:type="OQLMenuNode" _delta="define">
|
||||
<rank>20</rank>
|
||||
@@ -172,29 +172,29 @@
|
||||
</menu>
|
||||
<menu id="AdminTools" xsi:type="MenuGroup" _delta="define">
|
||||
<rank>80</rank>
|
||||
<style>
|
||||
<decoration_classes>fas fa-tools</decoration_classes>
|
||||
</style>
|
||||
<style>
|
||||
<decoration_classes>fas fa-tools</decoration_classes>
|
||||
</style>
|
||||
</menu>
|
||||
<menu id="SystemTools" xsi:type="MenuGroup" _delta="define">
|
||||
<rank>100</rank>
|
||||
<enable_class>ResourceSystemMenu</enable_class>
|
||||
<enable_action>UR_ACTION_MODIFY</enable_action>
|
||||
<style>
|
||||
<decoration_classes>fas fa-terminal</decoration_classes>
|
||||
</style>
|
||||
<style>
|
||||
<decoration_classes>fas fa-terminal</decoration_classes>
|
||||
</style>
|
||||
</menu>
|
||||
</menus>
|
||||
<events>
|
||||
<event id="EVENT_SERVICE_DB_INSERT_REQUESTED" _delta="define">
|
||||
<description>An object insert in the database has been requested. All changes to the object will be persisted automatically.</description>
|
||||
<event id="EVENT_DB_CHECK_TO_WRITE" _delta="define">
|
||||
<description>Check an object before it is written into the database (no change possible). Call DBObject::AddCheckIssue() to signal an issue</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>DBObject::OnInsert</replaces>
|
||||
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object inserted</description>
|
||||
<description>The object to check</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
@@ -203,25 +203,8 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_ABOUT_TO_INSERT" _delta="define">
|
||||
<description>An object is about to be inserted in the database (no change possible)</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>DBObject::OnInsert</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object inserted</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_INSERT_DONE" _delta="define">
|
||||
<description>An object has been inserted into the database (but not reloaded). All changes to the object will be persisted automatically.</description>
|
||||
<event id="EVENT_DB_CREATE_DONE" _delta="define">
|
||||
<description>An object has been created into the database. The modifications can be propagated to other objects.</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
@@ -237,42 +220,8 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_UPDATE_REQUESTED" _delta="define">
|
||||
<description>An object update has been requested. All changes to the object will be persisted automatically.</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>DBObject::OnUpdate, DBObject::DoComputeValues</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object updated</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_ABOUT_TO_UPDATE" _delta="define">
|
||||
<description>An object is about to be updated in the database (no change possible)</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>DBObject::OnUpdate</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object updated</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_UPDATE_DONE" _delta="define">
|
||||
<description>An object has been updated into the database and reloaded. All changes to the object will be persisted automatically.</description>
|
||||
<event id="EVENT_DB_UPDATE_DONE" _delta="define">
|
||||
<description>An object has been updated into the database and reloaded.</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
@@ -288,15 +237,15 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_ABOUT_TO_DELETE" _delta="define">
|
||||
<description>An object is about to be deleted in the database</description>
|
||||
<event id="EVENT_DB_CHECK_TO_DELETE" _delta="define">
|
||||
<description>Check an object before it is deleted from the database. Call DBObject::AddDeleteIssue() to signal an issue</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>DBObject::OnDelete</replaces>
|
||||
<replaces>cmdbAbstractObject::DoCheckToDelete</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object deleted</description>
|
||||
<description>The object to check</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
@@ -305,7 +254,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_DELETE_DONE" _delta="define">
|
||||
<event id="EVENT_DB_DELETE_DONE" _delta="define">
|
||||
<description>An object has been deleted into the database</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -322,7 +271,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_BEFORE_APPLY_STIMULUS" _delta="define">
|
||||
<event id="EVENT_DB_BEFORE_APPLY_STIMULUS" _delta="define">
|
||||
<description>A stimulus is about to be applied to an object</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -354,7 +303,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_AFTER_APPLY_STIMULUS" _delta="define">
|
||||
<event id="EVENT_DB_AFTER_APPLY_STIMULUS" _delta="define">
|
||||
<description>A stimulus has been applied to an object</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -386,7 +335,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_APPLY_STIMULUS_FAILED" _delta="define">
|
||||
<event id="EVENT_DB_APPLY_STIMULUS_FAILED" _delta="define">
|
||||
<description>A stimulus has failed</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -422,7 +371,23 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_OBJECT_RELOAD" _delta="define">
|
||||
<event id="EVENT_DB_LINKS_CHANGED" _delta="define">
|
||||
<description>At least one link class was changed</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object where the link is or was pointing to</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_DB_OBJECT_RELOAD" _delta="define">
|
||||
<description>An object has been re-loaded from the database</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -438,7 +403,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_COMPUTE_VALUES" _delta="define">
|
||||
<event id="EVENT_DB_COMPUTE_VALUES" _delta="define">
|
||||
<description>An object needs to be recomputed after changes</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -455,49 +420,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_CHECK_TO_WRITE" _delta="define">
|
||||
<description>Check an object before it is written into the database (no change possible)</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>cmdbAbstractObject::DoCheckToWrite</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object to check</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="error_messages">
|
||||
<description>Array of strings where all the errors found during the object checking are added</description>
|
||||
<type>array</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_CHECK_TO_DELETE" _delta="define">
|
||||
<description>Check an object before it is deleted from the database (no change possible)</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<replaces>cmdbAbstractObject::DoCheckToDelete</replaces>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The object to check</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="error_messages">
|
||||
<description>Array of strings where all the errors found during the object checking are added</description>
|
||||
<type>array</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_ARCHIVE" _delta="define">
|
||||
<event id="EVENT_DB_ARCHIVE" _delta="define">
|
||||
<description>An object has been archived</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -513,7 +436,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DB_UNARCHIVE" _delta="define">
|
||||
<event id="EVENT_DB_UNARCHIVE" _delta="define">
|
||||
<description>An object has been unarchived</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
@@ -529,7 +452,43 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_DOWNLOAD_DOCUMENT" _delta="define">
|
||||
<event id="EVENT_DB_SET_ATTRIBUTES_FLAGS" _delta="define">
|
||||
<description>Set object attributes flags. Call cmdbAbstractObject::AddAttributeFlags() for all the attributes to be set for this target state.</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The current object</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="target_state">
|
||||
<description>The target state in which to evaluate the flags</description>
|
||||
<type>array</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_DB_SET_INITIAL_ATTRIBUTES_FLAGS" _delta="define">
|
||||
<description>Set object initial attributes flags. Call cmdbAbstractObject::AddInitialAttributeFlags() for all the initial attributes to be set initially.</description>
|
||||
<sources>
|
||||
<source id="cmdbAbstractObject">cmdbAbstractObject</source>
|
||||
</sources>
|
||||
<event_data>
|
||||
<event_datum id="object">
|
||||
<description>The current object</description>
|
||||
<type>DBObject</type>
|
||||
</event_datum>
|
||||
<event_datum id="debug_info">
|
||||
<description>Debug string</description>
|
||||
<type>string</type>
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_DOWNLOAD_DOCUMENT" _delta="define">
|
||||
<description>A document has been downloaded from the GUI</description>
|
||||
<sources>
|
||||
<source id="Document">Document</source>
|
||||
@@ -549,7 +508,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_LOGIN" _delta="define">
|
||||
<event id="EVENT_LOGIN" _delta="define">
|
||||
<description>Inform the listeners about the connection states</description>
|
||||
<event_data>
|
||||
<event_datum id="code">
|
||||
|
||||
@@ -272,6 +272,8 @@ class DisplayBlock
|
||||
'panel_title',
|
||||
/** string true if panel title should be displayed as html */
|
||||
'panel_title_is_html',
|
||||
/** string Description of the panel content, displayed as a hint on the title */
|
||||
'panel_title_tooltip',
|
||||
/** string class for panel block style */
|
||||
'panel_class',
|
||||
/** string class for panel block style */
|
||||
@@ -1045,9 +1047,18 @@ JS
|
||||
$aCount = $aCounts[$sStateValue];
|
||||
$sHyperlink = $aCount['link'];
|
||||
$sCountLabel = $aCount['label'];
|
||||
$oPill = PillFactory::MakeForState($sClass, $sStateValue)
|
||||
->SetTooltip($sStateLabel)
|
||||
->AddHtml("<span class=\"ibo-dashlet-header-dynamic--count\">$sCountLabel</span><span class=\"ibo-dashlet-header-dynamic--label ibo-text-truncated-with-ellipsis\">".utils::HtmlEntities($sStateLabel)."</span>");
|
||||
|
||||
$oPill = PillFactory::MakeForState($sClass, $sStateValue);
|
||||
// N°5849 - Unencode label for ExternalKey attribute because friendlyname is already html encoded thanks to DBObject::GetName() in AttributeExternalKey::GetAllowedValues(). (A fix in this function may have too much impact).
|
||||
if ($oAttDef instanceof AttributeExternalKey) {
|
||||
$sPillTooltip = htmlspecialchars_decode($sStateLabel, ENT_QUOTES | ENT_DISALLOWED | ENT_HTML5);
|
||||
$sPillLabel = $sStateLabel;
|
||||
} else {
|
||||
$sPillTooltip = $sStateLabel;
|
||||
$sPillLabel = utils::HtmlEntities($sStateLabel);
|
||||
}
|
||||
$oPill->SetTooltip($sPillTooltip)
|
||||
->AddHtml("<span class=\"ibo-dashlet-header-dynamic--count\">$sCountLabel</span><span class=\"ibo-dashlet-header-dynamic--label ibo-text-truncated-with-ellipsis\">".$sPillLabel."</span>");
|
||||
if ($sHyperlink != '-') {
|
||||
$oPill->SetUrl($sHyperlink);
|
||||
}
|
||||
@@ -1304,17 +1315,12 @@ JS
|
||||
}
|
||||
}
|
||||
if (count($aAuthorizedClasses) > 0) {
|
||||
if ($this->m_oSet->CountWithLimit(1) > 0) {
|
||||
if (empty($aExtraParams['currentId'])) {
|
||||
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
|
||||
} else {
|
||||
$iListId = $aExtraParams['currentId'];
|
||||
}
|
||||
$oBlock->AddSubBlock(DataTableUIBlockFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
|
||||
if (empty($aExtraParams['currentId'])) {
|
||||
$iListId = utils::GetUniqueId(); // Works only if not in an Ajax page !!
|
||||
} else {
|
||||
// Empty set
|
||||
$oBlock->bEmptySet = true;
|
||||
$iListId = $aExtraParams['currentId'];
|
||||
}
|
||||
$oBlock->AddSubBlock(DataTableUIBlockFactory::MakeForObject($oPage, $iListId, $this->m_oSet, $aExtraParams));
|
||||
} else {
|
||||
// Not authorized
|
||||
$oBlock->bNotAuthorized = true;
|
||||
@@ -1337,43 +1343,13 @@ JS
|
||||
}
|
||||
|
||||
// The list is made of only 1 class of objects, actions on the list are possible
|
||||
if (($this->m_oSet->CountWithLimit(1) > 0) && (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES)) {
|
||||
if (UserRights::IsActionAllowed($this->m_oSet->GetClass(), UR_ACTION_READ, $this->m_oSet) == UR_ALLOWED_YES) {
|
||||
$oBlock->AddSubBlock(cmdbAbstractObject::GetDisplaySetBlock($oPage, $this->m_oSet, $aExtraParams));
|
||||
} else {
|
||||
$oBlock->bEmptySet = true;
|
||||
$oBlock->sClass = $this->m_oFilter->GetClass();
|
||||
$oBlock->sClassLabel = MetaModel::GetName($oBlock->sClass);
|
||||
$bDisplayMenu = isset($aExtraParams['menu']) ? ($aExtraParams['menu'] == true) : true;
|
||||
if ($bDisplayMenu) {
|
||||
if ((UserRights::IsActionAllowed($oBlock->sClass, UR_ACTION_MODIFY) == UR_ALLOWED_YES)) {
|
||||
$oBlock->sLinkTarget = '';
|
||||
$oAppContext = new ApplicationContext();
|
||||
$oBlock->sParams = $oAppContext->GetForLink();
|
||||
// 1:n links, populate the target object as a default value when creating a new linked object
|
||||
if (isset($aExtraParams['target_attr'])) {
|
||||
$oBlock->sLinkTarget = ' target="_blank" ';
|
||||
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
|
||||
}
|
||||
if (!empty($aExtraParams['default'])) {
|
||||
foreach ($aExtraParams['default'] as $sKey => $sValue) {
|
||||
$oBlock->sDefault .= "&default[$sKey]=$sValue";
|
||||
}
|
||||
}
|
||||
$oBlock->bCreateNew = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($aExtraParams["surround_with_panel"]) && $aExtraParams["surround_with_panel"]) {
|
||||
$oPanel = PanelUIBlockFactory::MakeForClass($aExtraParams["panel_class"], $aExtraParams["panel_title"]);
|
||||
if(isset($aExtraParams["panel_icon"]) && strlen($aExtraParams["panel_icon"]) > 0){
|
||||
$oPanel->SetIcon($aExtraParams["panel_icon"]);
|
||||
}
|
||||
$oPanel->AddSubBlock($oBlock);
|
||||
|
||||
return $oPanel;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $oBlock;
|
||||
@@ -1753,9 +1729,14 @@ class MenuBlock extends DisplayBlock
|
||||
$this->m_sStyle = 'list';
|
||||
}
|
||||
|
||||
$sClass = $this->m_oFilter->GetClass();
|
||||
$oSet = new CMDBObjectSet($this->m_oFilter);
|
||||
$sClass = $this->GetFilter()->GetClass();
|
||||
$aSelectedClasses = $this->GetFilter()->GetSelectedClasses();
|
||||
$bIsForLinkset = isset($aExtraParams['target_attr']);
|
||||
$oSet = new CMDBObjectSet($this->GetFilter());
|
||||
$iSetCount = $oSet->Count();
|
||||
/** @var string $sRefreshAction JS snippet to run when clicking on the refresh button of the menu */
|
||||
$sRefreshAction = $aExtraParams['refresh_action'] ?? '';
|
||||
$bIsCreationInModalAllowed = isset($aExtraParams['creation_in_modal_is_allowed']) && $aExtraParams['creation_in_modal_is_allowed'] === true;
|
||||
|
||||
/** @var array $aRegularActions Any action other than a transition */
|
||||
$aRegularActions = [];
|
||||
@@ -1763,275 +1744,240 @@ class MenuBlock extends DisplayBlock
|
||||
$aTransitionActions = [];
|
||||
/** @var array $aToolkitActions Any "legacy" toolkit menu item, which are now displayed in the same menu as the $aRegularActions, after them */
|
||||
$aToolkitActions = [];
|
||||
if ((!isset($aExtraParams['selection_mode']) || $aExtraParams['selection_mode'] == "") && $this->m_sStyle != 'listInObject') {
|
||||
|
||||
if (!isset($aExtraParams['selection_mode']) || ($aExtraParams['selection_mode'] == "")) {
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sContext = $oAppContext->GetForLink();
|
||||
if (!empty($sContext)) {
|
||||
if (utils::IsNotNullOrEmptyString($sContext)) {
|
||||
$sContext = '&'.$sContext;
|
||||
}
|
||||
|
||||
$oReflectionClass = new ReflectionClass($sClass);
|
||||
$sFilter = $this->m_oFilter->serialize();
|
||||
$sFilter = $this->GetFilter()->serialize();
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
|
||||
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
||||
|
||||
// Common params that will be applied to actions
|
||||
$aActionParams = array();
|
||||
if (isset($aExtraParams['menu_actions_target'])) {
|
||||
$aActionParams['target'] = $aExtraParams['menu_actions_target'];
|
||||
}
|
||||
$aActionParams = $this->GetDefaultParamsForMenuAction();
|
||||
|
||||
// 1:n links, populate the target object as a default value when creating a new linked object
|
||||
if (isset($aExtraParams['target_attr'])) {
|
||||
if ($bIsForLinkset) {
|
||||
$aExtraParams['default'][$aExtraParams['target_attr']] = $aExtraParams['object_id'];
|
||||
}
|
||||
$sDefault = '';
|
||||
/** @var string $sDefaultValuesAsUrlParams Default values for the object to create, already formatted as URL params (eg. "&default[org_id]=3&default[title]=Foo") */
|
||||
$sDefaultValuesAsUrlParams = '';
|
||||
if (!empty($aExtraParams['default'])) {
|
||||
foreach ($aExtraParams['default'] as $sKey => $sValue) {
|
||||
$sDefault .= "&default[$sKey]=$sValue";
|
||||
$sDefaultValuesAsUrlParams .= "&default[$sKey]=$sValue";
|
||||
}
|
||||
}
|
||||
$bIsCreationAllowed = (UserRights::IsActionAllowed($sClass,
|
||||
UR_ACTION_CREATE) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
switch ($oSet->Count()) {
|
||||
case 0:
|
||||
// No object in the set, the only possible action is "new"
|
||||
if ($bIsCreationAllowed) {
|
||||
$aRegularActions['UI:Menu:New'] = array(
|
||||
'label' => Dict::S('UI:Menu:New'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
|
||||
) + $aActionParams;
|
||||
|
||||
// Check rights
|
||||
$bIsCreationAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_CREATE) === UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsModifyAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) === UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
|
||||
// Create in new tab
|
||||
if ($bIsCreationAllowed && !$bIsCreationInModalAllowed) {
|
||||
$this->AddNewObjectMenuAction($aRegularActions, $sClass, $sDefaultValuesAsUrlParams);
|
||||
}
|
||||
|
||||
// Any style actions
|
||||
// - Bulk actions on objects set
|
||||
if ($iSetCount > 1) {
|
||||
// Bulk actions for each selected classes (eg. "link" and "remote" on n:n relations)
|
||||
foreach ($aSelectedClasses as $sSelectedAlias => $sSelectedClass) {
|
||||
$sSelectedClassName = MetaModel::GetName($sSelectedClass);
|
||||
|
||||
// Check rights on class
|
||||
$bIsBulkModifyAllowed = (!MetaModel::IsAbstract($sSelectedClass)) && UserRights::IsActionAllowed($sSelectedClass, UR_ACTION_BULK_MODIFY, $oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsBulkDeleteAllowed = (bool) UserRights::IsActionAllowed($sSelectedClass, UR_ACTION_BULK_DELETE, $sSelectedClass);
|
||||
|
||||
// Refine filter on selected class so bullk actions occur on the right class
|
||||
$oSelectedClassFilter = $this->GetFilter()->DeepClone();
|
||||
$oSelectedClassFilter->SetSelectedClasses([$sSelectedAlias]);
|
||||
|
||||
// Action identifier is using the alias on purpose so they can be used as "shortcut actions" easily for "Link" or "Remote" aliases on linksets.
|
||||
// Action label dict code has a specific suffix for "Link" / "Remote" aliases to allow dedicated labels in linksets.
|
||||
$sActionLabelCodeSuffix = in_array($sSelectedAlias, ['Link', 'Remote']) ? $sSelectedAlias : 'Class';
|
||||
if ($bIsBulkModifyAllowed) {
|
||||
$this->AddBulkModifyObjectsMenuAction($aRegularActions, $sSelectedClass, $oSelectedClassFilter->serialize(), 'UI:Menu:ModifyAll:'.$sSelectedAlias, Dict::Format('UI:Menu:ModifyAll_'.$sActionLabelCodeSuffix, $sSelectedClassName));
|
||||
}
|
||||
break;
|
||||
if ($bIsBulkDeleteAllowed) {
|
||||
$this->AddBulkDeleteObjectsMenuAction($aRegularActions, $sSelectedClass, $oSelectedClassFilter->serialize(), 'UI:Menu:BulkDelete:'.$sSelectedAlias, Dict::Format('UI:Menu:BulkDelete_'.$sActionLabelCodeSuffix, $sSelectedClassName));
|
||||
}
|
||||
}
|
||||
|
||||
case 1:
|
||||
$oObj = $oSet->Fetch();
|
||||
if (is_null($oObj)) {
|
||||
if (!isset($aExtraParams['link_attr'])) {
|
||||
if ($bIsCreationAllowed) {
|
||||
$aRegularActions['UI:Menu:New'] = array(
|
||||
'label' => Dict::S('UI:Menu:New'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$id = $oObj->GetKey();
|
||||
if (empty($sRefreshAction) && utils::ReadParam('operation') == 'details') {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
$sRefreshAction = "window.location.reload();";
|
||||
} else {
|
||||
$sRefreshAction = "window.location.href='".ApplicationContext::MakeObjectUrl(get_class($oObj), $id)."';";
|
||||
}
|
||||
}
|
||||
// Stimuli
|
||||
$aStates = MetaModel::EnumStates($sClass);
|
||||
// Do not perform time-consuming computations if there are too many objects in the list
|
||||
$iLimit = MetaModel::GetConfig()->Get('complex_actions_limit');
|
||||
|
||||
$bLocked = false;
|
||||
if (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) {
|
||||
$aLockInfo = iTopOwnershipLock::IsLocked(get_class($oObj), $id);
|
||||
if ($aLockInfo['locked']) {
|
||||
$bLocked = true;
|
||||
//$this->AddMenuSeparator($aActions);
|
||||
//$aActions['concurrent_lock_unlock'] = array ('label' => Dict::S('UI:Menu:ReleaseConcurrentLock'), 'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}");
|
||||
}
|
||||
}
|
||||
$bRawModifiedAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsModifyAllowed = !$bLocked && $bRawModifiedAllowed;
|
||||
$bIsDeleteAllowed = !$bLocked && UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
|
||||
// Just one object in the set, possible actions are "new / clone / modify and delete"
|
||||
if (!isset($aExtraParams['link_attr'])) {
|
||||
if ($bIsModifyAllowed) {
|
||||
$aRegularActions['UI:Menu:Modify'] = array(
|
||||
'label' => Dict::S('UI:Menu:Modify'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?route=object.modify&class=$sClass&id=$id{$sContext}#",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsCreationAllowed) {
|
||||
$aRegularActions['UI:Menu:New'] = array(
|
||||
'label' => Dict::S('UI:Menu:New'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsDeleteAllowed) {
|
||||
$aRegularActions['UI:Menu:Delete'] = array(
|
||||
'label' => Dict::S('UI:Menu:Delete'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ((count($aStates) > 0) && (($iLimit == 0) || ($oSet->CountWithLimit($iLimit + 1) < $iLimit))) {
|
||||
// Life cycle actions may be available... if all objects are in the same state
|
||||
//
|
||||
// Group by <state>
|
||||
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
|
||||
$aGroupBy = array('__state__' => $oGroupByExp);
|
||||
$aQueryParams = array();
|
||||
if (isset($aExtraParams['query_params'])) {
|
||||
$aQueryParams = $aExtraParams['query_params'];
|
||||
}
|
||||
|
||||
// Transitions / Stimuli
|
||||
if (!$bLocked) {
|
||||
$aTransitions = $oObj->EnumTransitions();
|
||||
if (count($aTransitions)) {
|
||||
$aStimuli = Metamodel::EnumStimuli(get_class($oObj));
|
||||
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
|
||||
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sClass,
|
||||
$sStimulusCode, $oSet) : UR_ALLOWED_NO;
|
||||
switch ($iActionAllowed) {
|
||||
case UR_ALLOWED_YES:
|
||||
$aTransitionActions[$sStimulusCode] = array(
|
||||
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
||||
'url' => "{$sRootUrl}pages/UI.php?operation=stimulus&stimulus=$sStimulusCode&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Relations...
|
||||
$aRelations = MetaModel::EnumRelationsEx($sClass);
|
||||
if (count($aRelations)) {
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
|
||||
if (array_key_exists('down', $aRelationInfo)) {
|
||||
$aRegularActions[$sRelationCode.'_down'] = array(
|
||||
'label' => $aRelationInfo['down'],
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
|
||||
$sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy);
|
||||
$aRes = CMDBSource::QueryToArray($sSql);
|
||||
if (count($aRes) == 1) {
|
||||
// All objects are in the same state...
|
||||
$sState = $aRes[0]['__state__'];
|
||||
$aTransitions = Metamodel::EnumTransitions($sClass, $sState);
|
||||
if (count($aTransitions)) {
|
||||
$aStimuli = Metamodel::EnumStimuli($sClass);
|
||||
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
|
||||
$oSet->Rewind();
|
||||
// As soon as the user rights implementation will browse the object set,
|
||||
// then we might consider using OptimizeColumnLoad() here
|
||||
$iActionAllowed = UserRights::IsStimulusAllowed($sClass, $sStimulusCode, $oSet);
|
||||
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? $iActionAllowed : UR_ALLOWED_NO;
|
||||
switch ($iActionAllowed) {
|
||||
case UR_ALLOWED_YES:
|
||||
case UR_ALLOWED_DEPENDS:
|
||||
$aTransitionActions[$sStimulusCode] = array(
|
||||
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
||||
'url' => "{$sRootUrl}pages/UI.php?operation=select_bulk_stimulus&stimulus=$sStimulusCode&state=$sState&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if (array_key_exists('up', $aRelationInfo)) {
|
||||
$aRegularActions[$sRelationCode.'_up'] = array(
|
||||
'label' => $aRelationInfo['up'],
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add a special menu to kill the lock, but only to allowed users who can also modify this object
|
||||
if ($bLocked && $bRawModifiedAllowed) {
|
||||
/** @var array $aAllowedProfiles */
|
||||
$aAllowedProfiles = MetaModel::GetConfig()->Get('concurrent_lock_override_profiles');
|
||||
$bCanKill = false;
|
||||
|
||||
$oUser = UserRights::GetUserObject();
|
||||
$aUserProfiles = array();
|
||||
if (!is_null($oUser)) {
|
||||
$oProfileSet = $oUser->Get('profile_list');
|
||||
while ($oProfile = $oProfileSet->Fetch()) {
|
||||
$aUserProfiles[$oProfile->Get('profile')] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($aAllowedProfiles as $sProfile) {
|
||||
if (array_key_exists($sProfile, $aUserProfiles)) {
|
||||
$bCanKill = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($bCanKill) {
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
$aRegularActions['concurrent_lock_unlock'] = array(
|
||||
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
|
||||
);
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
|
||||
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
|
||||
$aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams;
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
// Check rights
|
||||
// New / Modify
|
||||
$bIsModifyAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY,
|
||||
$oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsBulkModifyAllowed = (!MetaModel::IsAbstract($sClass)) && UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_MODIFY,
|
||||
$oSet) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsBulkDeleteAllowed = UserRights::IsActionAllowed($sClass, UR_ACTION_BULK_DELETE, $oSet);
|
||||
if (isset($aExtraParams['link_attr'])) {
|
||||
$id = $aExtraParams['object_id'];
|
||||
$sTargetAttr = $aExtraParams['target_attr'];
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sTargetAttr);
|
||||
$sTargetClass = $oAttDef->GetTargetClass();
|
||||
if ($bIsModifyAllowed) {
|
||||
$aRegularActions['UI:Menu:Add'] = array(
|
||||
'label' => Dict::S('UI:Menu:Add'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=modify_links&class=$sClass&link_attr=".$aExtraParams['link_attr']."&target_class=$sTargetClass&id=$id&addObjects=true{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsBulkModifyAllowed) {
|
||||
$aRegularActions['UI:Menu:Manage'] = array(
|
||||
'label' => Dict::S('UI:Menu:Manage'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=modify_links&class=$sClass&link_attr=".$aExtraParams['link_attr']."&target_class=$sTargetClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
//if ($bIsBulkDeleteAllowed) { $aActions[] = array ('label' => 'Remove All...', 'url' => "#") + $aActionParams; }
|
||||
} else {
|
||||
// many objects in the set, possible actions are: new / modify all / delete all
|
||||
if ($bIsCreationAllowed) {
|
||||
$aRegularActions['UI:Menu:New'] = array(
|
||||
'label' => Dict::S('UI:Menu:New'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=new&class=$sClass{$sContext}{$sDefault}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsBulkModifyAllowed) {
|
||||
$aRegularActions['UI:Menu:ModifyAll'] = array(
|
||||
'label' => Dict::S('UI:Menu:ModifyAll'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=select_for_modify_all&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsBulkDeleteAllowed) {
|
||||
$aRegularActions['UI:Menu:BulkDelete'] = array(
|
||||
'label' => Dict::S('UI:Menu:BulkDelete'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=select_for_deletion&filter=".urlencode($sFilter)."{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
|
||||
// Stimuli
|
||||
$aStates = MetaModel::EnumStates($sClass);
|
||||
// Do not perform time consuming computations if there are too may objects in the list
|
||||
$iLimit = MetaModel::GetConfig()->Get('complex_actions_limit');
|
||||
|
||||
if ((count($aStates) > 0) && (($iLimit == 0) || ($oSet->CountWithLimit($iLimit + 1) < $iLimit))) {
|
||||
// Life cycle actions may be available... if all objects are in the same state
|
||||
//
|
||||
// Group by <state>
|
||||
$oGroupByExp = new FieldExpression(MetaModel::GetStateAttributeCode($sClass), $this->m_oFilter->GetClassAlias());
|
||||
$aGroupBy = array('__state__' => $oGroupByExp);
|
||||
$aQueryParams = array();
|
||||
if (isset($aExtraParams['query_params'])) {
|
||||
$aQueryParams = $aExtraParams['query_params'];
|
||||
// NOT "listInObject" style actions
|
||||
if ($this->m_sStyle !== 'listInObject') {
|
||||
switch ($iSetCount) {
|
||||
case 1:
|
||||
$oObj = $oSet->Fetch();
|
||||
if (false === is_null($oObj)) {
|
||||
$id = $oObj->GetKey();
|
||||
if (empty($sRefreshAction) && utils::ReadParam('operation') == 'details') {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
$sRefreshAction = "window.location.reload();";
|
||||
} else {
|
||||
$sRefreshAction = "window.location.href='".ApplicationContext::MakeObjectUrl(get_class($oObj), $id)."';";
|
||||
}
|
||||
}
|
||||
|
||||
$sSql = $this->m_oFilter->MakeGroupByQuery($aQueryParams, $aGroupBy);
|
||||
$aRes = CMDBSource::QueryToArray($sSql);
|
||||
if (count($aRes) == 1) {
|
||||
// All objects are in the same state...
|
||||
$sState = $aRes[0]['__state__'];
|
||||
$aTransitions = Metamodel::EnumTransitions($sClass, $sState);
|
||||
if (count($aTransitions)) {
|
||||
$aStimuli = Metamodel::EnumStimuli($sClass);
|
||||
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
|
||||
$oSet->Rewind();
|
||||
// As soon as the user rights implementation will browse the object set,
|
||||
// then we might consider using OptimizeColumnLoad() here
|
||||
$iActionAllowed = UserRights::IsStimulusAllowed($sClass, $sStimulusCode, $oSet);
|
||||
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? $iActionAllowed : UR_ALLOWED_NO;
|
||||
switch ($iActionAllowed) {
|
||||
case UR_ALLOWED_YES:
|
||||
case UR_ALLOWED_DEPENDS:
|
||||
$aTransitionActions[$sStimulusCode] = array(
|
||||
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
||||
'url' => "{$sRootUrl}pages/UI.php?operation=select_bulk_stimulus&stimulus=$sStimulusCode&state=$sState&class=$sClass&filter=".urlencode($sFilter)."{$sContext}",
|
||||
) + $aActionParams;
|
||||
break;
|
||||
$bLocked = false;
|
||||
if (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) {
|
||||
$aLockInfo = iTopOwnershipLock::IsLocked(get_class($oObj), $id);
|
||||
if ($aLockInfo['locked']) {
|
||||
$bLocked = true;
|
||||
}
|
||||
}
|
||||
$bRawModifiedAllowed = (UserRights::IsActionAllowed($sClass, UR_ACTION_MODIFY, $oSet) == UR_ALLOWED_YES) && ($oReflectionClass->IsSubclassOf('cmdbAbstractObject'));
|
||||
$bIsModifyAllowed = !$bLocked && $bRawModifiedAllowed;
|
||||
$bIsDeleteAllowed = !$bLocked && UserRights::IsActionAllowed($sClass, UR_ACTION_DELETE, $oSet);
|
||||
// Just one object in the set, possible actions are "new / clone / modify and delete"
|
||||
if (!isset($aExtraParams['link_attr'])) {
|
||||
if ($bIsModifyAllowed) {
|
||||
$aRegularActions['UI:Menu:Modify'] = array(
|
||||
'label' => Dict::S('UI:Menu:Modify'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?route=object.modify&class=$sClass&id=$id{$sContext}#",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if ($bIsDeleteAllowed) {
|
||||
$aRegularActions['UI:Menu:Delete'] = array(
|
||||
'label' => Dict::S('UI:Menu:Delete'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=delete&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
// Transitions / Stimuli
|
||||
if (!$bLocked) {
|
||||
$aTransitions = $oObj->EnumTransitions();
|
||||
if (count($aTransitions)) {
|
||||
$aStimuli = Metamodel::EnumStimuli(get_class($oObj));
|
||||
foreach ($aTransitions as $sStimulusCode => $aTransitionDef) {
|
||||
$iActionAllowed = (get_class($aStimuli[$sStimulusCode]) == 'StimulusUserAction') ? UserRights::IsStimulusAllowed($sClass,
|
||||
$sStimulusCode, $oSet) : UR_ALLOWED_NO;
|
||||
switch ($iActionAllowed) {
|
||||
case UR_ALLOWED_YES:
|
||||
$aTransitionActions[$sStimulusCode] = array(
|
||||
'label' => $aStimuli[$sStimulusCode]->GetLabel(),
|
||||
'url' => "{$sRootUrl}pages/UI.php?operation=stimulus&stimulus=$sStimulusCode&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
break;
|
||||
|
||||
default:
|
||||
// Do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Relations...
|
||||
$aRelations = MetaModel::EnumRelationsEx($sClass);
|
||||
if (count($aRelations)) {
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
foreach ($aRelations as $sRelationCode => $aRelationInfo) {
|
||||
if (array_key_exists('down', $aRelationInfo)) {
|
||||
$aRegularActions[$sRelationCode.'_down'] = array(
|
||||
'label' => $aRelationInfo['down'],
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=down&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
if (array_key_exists('up', $aRelationInfo)) {
|
||||
$aRegularActions[$sRelationCode.'_up'] = array(
|
||||
'label' => $aRelationInfo['up'],
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=view_relations&relation=$sRelationCode&direction=up&class=$sClass&id=$id{$sContext}",
|
||||
) + $aActionParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add a special menu to kill the lock, but only to allowed users who can also modify this object
|
||||
if ($bLocked && $bRawModifiedAllowed) {
|
||||
/** @var array $aAllowedProfiles */
|
||||
$aAllowedProfiles = MetaModel::GetConfig()->Get('concurrent_lock_override_profiles');
|
||||
$bCanKill = false;
|
||||
|
||||
$oUser = UserRights::GetUserObject();
|
||||
$aUserProfiles = array();
|
||||
if (!is_null($oUser)) {
|
||||
$oProfileSet = $oUser->Get('profile_list');
|
||||
while ($oProfile = $oProfileSet->Fetch()) {
|
||||
$aUserProfiles[$oProfile->Get('profile')] = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($aAllowedProfiles as $sProfile) {
|
||||
if (array_key_exists($sProfile, $aUserProfiles)) {
|
||||
$bCanKill = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($bCanKill) {
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
$aRegularActions['concurrent_lock_unlock'] = array(
|
||||
'label' => Dict::S('UI:Menu:KillConcurrentLock'),
|
||||
'url' => "{$sRootUrl}pages/$sUIPage?operation=kill_lock&class=$sClass&id=$id{$sContext}",
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
|
||||
$this->GetEnumAllowedActions($oSet, function ($sLabel, $data) use (&$aRegularActions, $aActionParams) {
|
||||
$aRegularActions[$sLabel] = array('label' => $sLabel, 'url' => $data) + $aActionParams;
|
||||
});
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->AddMenuSeparator($aRegularActions);
|
||||
@@ -2056,8 +2002,9 @@ class MenuBlock extends DisplayBlock
|
||||
$sRefreshAction = "window.location.reload();";
|
||||
}
|
||||
} else {
|
||||
//it's easier just display configure this list and MENU_OBJLIST_TOOLKIT
|
||||
// It's easier just display configure this list and MENU_OBJLIST_TOOLKIT
|
||||
}
|
||||
|
||||
$param = null;
|
||||
if (is_null($sId)) {
|
||||
$sId = uniqid();
|
||||
@@ -2070,14 +2017,7 @@ class MenuBlock extends DisplayBlock
|
||||
case 'listInObject':
|
||||
$oSet->Rewind();
|
||||
$param = $oSet;
|
||||
$bToolkitMenu = true;
|
||||
if (isset($aExtraParams['toolkit_menu'])) {
|
||||
$bToolkitMenu = (bool)$aExtraParams['toolkit_menu'];
|
||||
}
|
||||
if ($bToolkitMenu) {
|
||||
$sLabel = Dict::S('UI:ConfigureThisList');
|
||||
$aRegularActions['iTop::ConfigureList'] = ['label' => $sLabel, 'url' => '#', 'onclick' => "$('#datatable_dlg_datatable_{$sId}').dialog('open'); return false;"];
|
||||
}
|
||||
|
||||
utils::GetPopupMenuItemsBlock($oPopupMenuItemsBlock, iPopupMenuExtension::MENU_OBJLIST_ACTIONS, $param, $aRegularActions, $sId);
|
||||
utils::GetPopupMenuItemsBlock($oPopupMenuItemsBlock, iPopupMenuExtension::MENU_OBJLIST_TOOLKIT, $param, $aToolkitActions, $sId);
|
||||
break;
|
||||
@@ -2089,6 +2029,7 @@ class MenuBlock extends DisplayBlock
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if ($oPopupMenuItemsBlock->HasSubBlocks()) {
|
||||
$oRenderBlock->AddSubBlock($oPopupMenuItemsBlock);
|
||||
} else {
|
||||
@@ -2099,6 +2040,7 @@ class MenuBlock extends DisplayBlock
|
||||
$oRenderBlock->AddCssFileRelPath($sCssPath);
|
||||
}
|
||||
}
|
||||
|
||||
// Extract favorite actions from their menus
|
||||
$aFavoriteRegularActions = [];
|
||||
$aFavoriteTransitionActions = [];
|
||||
@@ -2184,12 +2126,16 @@ class MenuBlock extends DisplayBlock
|
||||
break;
|
||||
|
||||
case 'UI:Menu:ModifyAll':
|
||||
case 'UI:Menu:ModifyAll:Link': // Link class on linkset
|
||||
case 'UI:Menu:ModifyAll:Remote': // Remote class on linkset
|
||||
case 'UI:Menu:Modify':
|
||||
$sIconClass = 'fas fa-pen';
|
||||
$sLabel = '';
|
||||
break;
|
||||
|
||||
case 'UI:Menu:BulkDelete':
|
||||
case 'UI:Menu:BulkDelete:Link': // Link class on linkset
|
||||
case 'UI:Menu:BulkDelete:Remote': // Remote class on linkset
|
||||
case 'UI:Menu:Delete':
|
||||
$sIconClass = 'fas fa-trash';
|
||||
$sLabel = '';
|
||||
@@ -2222,8 +2168,28 @@ class MenuBlock extends DisplayBlock
|
||||
$oActionsToolbar->AddSubBlock($oActionButton);
|
||||
}
|
||||
|
||||
// - Creation in modal
|
||||
if ($bIsCreationInModalAllowed === true) {
|
||||
$oAddLinkActionButton = ButtonUIBlockFactory::MakeIconAction(
|
||||
'fas fa-plus',
|
||||
Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
|
||||
'UI:Links:New',
|
||||
'',
|
||||
false
|
||||
);
|
||||
|
||||
// - If we are used in a Datatable, 'datatable_' will be prefixed to our $sId, so we do the same here
|
||||
$sRealId = $sId;
|
||||
if(in_array($this->m_sStyle, ['list', 'links', 'listInObject'])){
|
||||
$sRealId = 'datatable_' . $sId;
|
||||
}
|
||||
$oAddLinkActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button'])
|
||||
->SetOnClickJsCode("$('#$sRealId').trigger('open_creation_modal.object.itop');");
|
||||
$oActionsToolbar->AddSubBlock($oAddLinkActionButton);
|
||||
}
|
||||
|
||||
// - Refresh
|
||||
if ($sRefreshAction != '') {
|
||||
if (utils::IsNotNullOrEmptyString($sRefreshAction)) {
|
||||
$oActionButton = ButtonUIBlockFactory::MakeAlternativeNeutral('', 'UI:Button:Refresh');
|
||||
$oActionButton->SetIconClass('fas fa-sync-alt')
|
||||
->SetOnClickJsCode($sRefreshAction)
|
||||
@@ -2233,7 +2199,7 @@ class MenuBlock extends DisplayBlock
|
||||
}
|
||||
|
||||
// - Search
|
||||
if ($this->m_sStyle == 'details') {
|
||||
if ($this->m_sStyle === 'details') {
|
||||
$oActionButton = ButtonUIBlockFactory::MakeIconLink('fas fa-search', Dict::Format('UI:SearchFor_Class', MetaModel::GetName($sClass)), "{$sRootUrl}pages/UI.php?operation=search_form&do_search=0&class=$sClass{$sContext}", '', 'UI:SearchFor_Class');
|
||||
$oActionButton->AddCSSClasses(['ibo-action-button', 'ibo-regular-action-button']);
|
||||
$oActionsToolbar->AddSubBlock($oActionButton);
|
||||
@@ -2258,6 +2224,12 @@ class MenuBlock extends DisplayBlock
|
||||
|
||||
// Toolkit actions
|
||||
if (!empty($aToolkitActions)) {
|
||||
// Add separator if necessary
|
||||
if (count($aRegularActions) > 0) {
|
||||
$oRegularActionsMenu->AddItem('separator-regular-actions-toolkit-actions', PopoverMenuItemFactory::MakeSeparator());
|
||||
}
|
||||
|
||||
// Add actions
|
||||
foreach ($aToolkitActions as $sActionId => $aActionData) {
|
||||
$oRegularActionsMenu->AddItem('toolkit-actions', PopoverMenuItemFactory::MakeFromApplicationPopupMenuItemData($sActionId, $aActionData));
|
||||
}
|
||||
@@ -2338,5 +2310,106 @@ class MenuBlock extends DisplayBlock
|
||||
$aActions['sep_'.(count($aActions)-1)] = array('label' => $sSeparator, 'url' => '');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a create action (to $aActions) for an $sClass object
|
||||
*
|
||||
* @param array &$aActions Pointer to the array in which the action will be added
|
||||
* @param string $sClass Datamodel class concerned by the action
|
||||
* @param string $sDefaultValuesAsUrlParams Default values for the new object form,
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
* @internal
|
||||
*/
|
||||
protected function AddNewObjectMenuAction(array &$aActions, string $sClass, string $sDefaultValuesAsUrlParams = ''): void
|
||||
{
|
||||
$aActions['UI:Menu:New'] = [
|
||||
'label' => Dict::Format('UI:ClickToCreateNew', MetaModel::GetName($sClass)),
|
||||
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=new&class=$sClass{$sDefaultValuesAsUrlParams}"),
|
||||
] + $this->GetDefaultParamsForMenuAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bulk modify action (to $aActions) on objects defined by $sFilter
|
||||
*
|
||||
* @param array &$aActions Pointer to the array in which the action will be added
|
||||
* @param string $sClass Datamodel class concerned by the action
|
||||
* @param string $sFilter OQL of the objects to propose for bulk modify
|
||||
* @param string $sActionIdentifier Unique identifier for the action. Default if 'UI:Menu:ModifyAll'
|
||||
* @param string $sActionLabel Label for the action, can be either a dict code to translate or an hardcoded label. Default is 'UI:Menu:ModifyAll'.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
* @internal
|
||||
*/
|
||||
protected function AddBulkModifyObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:ModifyAll', $sActionLabel = 'UI:Menu:ModifyAll'): void
|
||||
{
|
||||
$aActions[$sActionIdentifier] = [
|
||||
'label' => Dict::S($sActionLabel),
|
||||
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_modify_all&class=$sClass&filter=".urlencode($sFilter)),
|
||||
] + $this->GetDefaultParamsForMenuAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a bulk delete action (to $aActions) on objects defined by $sFilter
|
||||
*
|
||||
* @param array &$aActions Pointer to the array in which the action will be added
|
||||
* @param string $sClass Datamodel class concerned by the action
|
||||
* @param string $sFilter OQL of the objects to propose for bulk deletion
|
||||
* @param string $sActionIdentifier Unique identifier for the action. Default if 'UI:Menu:BulkDelete'
|
||||
* @param string $sActionLabel Label for the action, can be either a dict code to translate or an hardcoded label. Default is 'UI:Menu:BulkDelete'.
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
* @internal
|
||||
*/
|
||||
protected function AddBulkDeleteObjectsMenuAction(array &$aActions, string $sClass, string $sFilter, string $sActionIdentifier = 'UI:Menu:BulkDelete', $sActionLabel = 'UI:Menu:BulkDelete')
|
||||
{
|
||||
$aActions[$sActionIdentifier] = array(
|
||||
'label' => Dict::S($sActionLabel),
|
||||
'url' => $this->PrepareUrlForStandardMenuAction($sClass, "operation=select_for_deletion&filter=".urlencode($sFilter)),
|
||||
) + $this->GetDefaultParamsForMenuAction();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array Default parameters of a menu action
|
||||
* @since 3.1.0
|
||||
* @internal
|
||||
*/
|
||||
private function GetDefaultParamsForMenuAction(): array
|
||||
{
|
||||
$aDefaultParams = [];
|
||||
|
||||
if (isset($aExtraParams['menu_actions_target'])) {
|
||||
$aDefaultParams['target'] = $aExtraParams['menu_actions_target'];
|
||||
}
|
||||
|
||||
return $aDefaultParams;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass Datamodel class for which the URL is prepared
|
||||
* @param string $sUrlParams URL parameters to add to the URL, must already be concatenated as a string (eg. "foo=bar&some=thing&third=param")
|
||||
*
|
||||
* @return string An absolute URL for a menu action on the $sClass class with $sUrlParams
|
||||
* @throws \Exception
|
||||
* @internal
|
||||
*/
|
||||
private function PrepareUrlForStandardMenuAction(string $sClass, string $sUrlParams)
|
||||
{
|
||||
$sRootUrl = utils::GetAbsoluteUrlAppRoot();
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($sClass);
|
||||
|
||||
$sUrl = "{$sRootUrl}pages/{$sUIPage}?{$sUrlParams}";
|
||||
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sContext = $oAppContext->GetForLink();
|
||||
if (utils::IsNotNullOrEmptyString($sContext)) {
|
||||
$sUrl .= '&'.$sContext;
|
||||
}
|
||||
|
||||
return $sUrl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
|
||||
class CoreException extends Exception
|
||||
{
|
||||
protected $m_sIssue;
|
||||
protected $m_sImpact;
|
||||
protected $m_aContextData;
|
||||
|
||||
/**
|
||||
* CoreException constructor.
|
||||
*
|
||||
|
||||
@@ -59,7 +59,6 @@ class LoginBasic extends AbstractLoginFSMExtension
|
||||
list($sAuthUser, $sAuthPwd) = $this->GetAuthUserAndPassword();
|
||||
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
|
||||
{
|
||||
$_SESSION['auth_user'] = $sAuthUser;
|
||||
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
|
||||
return LoginWebPage::LOGIN_FSM_ERROR;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ class LoginExternal extends AbstractLoginFSMExtension
|
||||
$sAuthUser = $this->GetAuthUser();
|
||||
if (!UserRights::CheckCredentials($sAuthUser, '', Session::Get('login_mode'), 'external'))
|
||||
{
|
||||
$_SESSION['auth_user'] = $sAuthUser;
|
||||
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
|
||||
return LoginWebPage::LOGIN_FSM_ERROR;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,6 @@ class LoginForm extends AbstractLoginFSMExtension implements iLoginUIExtension
|
||||
$sAuthPwd = utils::ReadPostedParam('auth_pwd', null, 'raw_data');
|
||||
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
|
||||
{
|
||||
$_SESSION['auth_user'] = $sAuthUser;
|
||||
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
|
||||
return LoginWebPage::LOGIN_FSM_ERROR;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ class LoginURL extends AbstractLoginFSMExtension
|
||||
$sAuthPwd = utils::ReadParam('auth_pwd', null, false, 'raw_data');
|
||||
if (!UserRights::CheckCredentials($sAuthUser, $sAuthPwd, Session::Get('login_mode'), 'internal'))
|
||||
{
|
||||
$_SESSION['auth_user'] = $sAuthUser;
|
||||
$iErrorCode = LoginWebPage::EXIT_CODE_WRONGCREDENTIALS;
|
||||
return LoginWebPage::LOGIN_FSM_ERROR;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
use Combodo\iTop\Application\Branding;
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
use Combodo\iTop\Service\EventData;
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\Events\EventData;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
|
||||
/**
|
||||
* Web page used for displaying the login form
|
||||
@@ -481,13 +481,13 @@ class LoginWebPage extends NiceWebPage
|
||||
$iResponse = $oLoginFSMExtensionInstance->LoginAction($sLoginState, $iErrorCode);
|
||||
if ($iResponse == self::LOGIN_FSM_RETURN)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
Session::WriteClose();
|
||||
return $iErrorCode; // Asked to exit FSM, generally login OK
|
||||
}
|
||||
if ($iResponse == self::LOGIN_FSM_ERROR)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['code' => $iErrorCode, 'state' => $sLoginState]));
|
||||
$sLoginState = self::LOGIN_STATE_SET_ERROR; // Next state will be error
|
||||
// An error was detected, skip the other plugins turn
|
||||
break;
|
||||
@@ -501,7 +501,7 @@ class LoginWebPage extends NiceWebPage
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_LOGIN, null, ['state' => $_SESSION['login_state']]));
|
||||
EventService::FireEvent(new EventData(EVENT_LOGIN, null, ['state' => $_SESSION['login_state']]));
|
||||
IssueLog::Error($e->getTraceAsString());
|
||||
static::ResetSession();
|
||||
die($e->getMessage());
|
||||
|
||||
@@ -291,7 +291,17 @@ class ApplicationMenu
|
||||
* @param string $sMenuGroupIdx
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @return array
|
||||
* @return array{
|
||||
* array{
|
||||
* sId: string,
|
||||
* sTitle: string,
|
||||
* sLabel: string,
|
||||
* bHasCount: boolean,
|
||||
* sUrl: string,
|
||||
* bOpenInNewWindow: boolean,
|
||||
* aSubMenuNodes: array
|
||||
* }
|
||||
* } The aSubMenuNodes key contains the same structure recursively
|
||||
* @throws \DictExceptionMissingString
|
||||
* @throws \Exception
|
||||
* @since 3.0.0
|
||||
@@ -320,12 +330,13 @@ class ApplicationMenu
|
||||
}
|
||||
|
||||
$aSubMenuNodes[] = [
|
||||
'sId' => $oSubMenuNode->GetMenuId(),
|
||||
'sTitle' => $oSubMenuNode->GetTitle(),
|
||||
'bHasCount' => $oSubMenuNode->HasCount(),
|
||||
'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
|
||||
'sId' => $oSubMenuNode->GetMenuId(),
|
||||
'sTitle' => $oSubMenuNode->GetTitle(),
|
||||
'sLabel' => $oSubMenuNode->GetLabel(),
|
||||
'bHasCount' => $oSubMenuNode->HasCount(),
|
||||
'sUrl' => $oSubMenuNode->GetHyperlink($aExtraParams),
|
||||
'bOpenInNewWindow' => $oSubMenuNode->IsHyperLinkInNewWindow(),
|
||||
'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
|
||||
'aSubMenuNodes' => static::GetSubMenuNodes($sSubMenuItemIdx, $aExtraParams),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -746,7 +757,7 @@ abstract class MenuNode
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return string The "+" dictionary entry for this menu if exists, otherwise the Title (if we have a parent title, will output parentTitle / currentTitle)
|
||||
*/
|
||||
public function GetLabel()
|
||||
{
|
||||
@@ -758,7 +769,6 @@ abstract class MenuNode
|
||||
} else {
|
||||
$sRet = $this->GetTitle();
|
||||
}
|
||||
//$sRet = $this->GetTitle();
|
||||
}
|
||||
return $sRet;
|
||||
}
|
||||
@@ -1101,6 +1111,7 @@ class OQLMenuNode extends MenuNode
|
||||
*/
|
||||
public function RenderContent(WebPage $oPage, $aExtraParams = array())
|
||||
{
|
||||
ContextTag::AddContext(ContextTag::TAG_OBJECT_SEARCH);
|
||||
ApplicationMenu::CheckMenuIdEnabled($this->GetMenuId());
|
||||
OQLMenuNode::RenderOQLSearch
|
||||
(
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
use Combodo\iTop\Application\EventRegister\ApplicationEvents;
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
use Combodo\iTop\Service\EventData;
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\Events\EventData;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
|
||||
require_once(APPROOT.'core/cmdbobject.class.inc.php');
|
||||
require_once(APPROOT.'application/utils.inc.php');
|
||||
@@ -71,9 +72,6 @@ $oKPI = new ExecutionKPI();
|
||||
Session::Start();
|
||||
$oKPI->ComputeAndReport("Session Start");
|
||||
|
||||
EventService::InitService();
|
||||
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_REQUEST_RECEIVED));
|
||||
|
||||
$sSwitchEnv = utils::ReadParam('switch_env', null);
|
||||
$bAllowCache = true;
|
||||
if (($sSwitchEnv != null) && file_exists(APPCONF.$sSwitchEnv.'/'.ITOP_CONFIG_FILE) &&( Session::Get('itop_env') !== $sSwitchEnv))
|
||||
@@ -105,4 +103,6 @@ else
|
||||
}
|
||||
$sConfigFile = APPCONF.$sEnv.'/'.ITOP_CONFIG_FILE;
|
||||
MetaModel::Startup($sConfigFile, false /* $bModelOnly */, $bAllowCache, false /* $bTraceSourceFiles */, $sEnv);
|
||||
// Event service must be initialized after the MetaModel startup, otherwise it cannot discover classes implementing the iEventServiceSetup interface
|
||||
EventService::InitService();
|
||||
EventService::FireEvent(new EventData(ApplicationEvents::APPLICATION_EVENT_METAMODEL_STARTED));
|
||||
|
||||
@@ -685,15 +685,15 @@ JS
|
||||
}
|
||||
$oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode);
|
||||
$oBlock = new DisplayBlock($oFilter, 'search', false, $aParams);
|
||||
$oPage->AddUiBlock($oBlock->GetDisplay($oPage, $this->iId,
|
||||
$oPage->AddUiBlock($oBlock->GetDisplay($oPage, 'dtc_'.$this->iId,
|
||||
array(
|
||||
'menu' => false,
|
||||
'currentId' => $this->iId,
|
||||
'table_id' => "dr_{$this->iId}",
|
||||
'menu' => false,
|
||||
'currentId' => $this->iId,
|
||||
'table_id' => "dr_{$this->iId}",
|
||||
'table_inner_id' => "{$this->iId}_results",
|
||||
'selection_mode' => true,
|
||||
'selection_type' => 'single',
|
||||
'cssCount' => '#count_'.$this->iId.'_results',
|
||||
'cssCount' => '#count_'.$this->iId.'_results',
|
||||
)
|
||||
));
|
||||
$sCancel = Dict::S('UI:Button:Cancel');
|
||||
|
||||
@@ -19,6 +19,7 @@ class UILinksWidgetDirect
|
||||
protected $sAttCode;
|
||||
protected $sInputid;
|
||||
protected $sNameSuffix;
|
||||
protected $aZlist;
|
||||
protected $sLinkedClass;
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,15 +171,10 @@ class UILinksWidget
|
||||
$oCurrentObj->PrefillForm('search', $aPrefillFormParam);
|
||||
}
|
||||
|
||||
$sLinkedSetId = "{$this->m_sAttCode}{$this->m_sNameSuffix}";
|
||||
|
||||
$oBlock = new BlockObjectPickerDialog($this);
|
||||
$oPage->AddUiBlock($oBlock);
|
||||
|
||||
$oBlock->sLinkedSetId = $sLinkedSetId;
|
||||
$oBlock->iInputId = $this->m_sInputId;
|
||||
$oBlock->sLinkedClassName = MetaModel::GetName($this->m_sLinkedClass);
|
||||
$oBlock->sClassName = MetaModel::GetName($this->m_sClass);
|
||||
$sLinkedSetId = $oBlock->oUILinksWidget->GetLinkedSetId();
|
||||
|
||||
$oDisplayBlock = new DisplayBlock($oFilter, 'search', false);
|
||||
$oBlock->AddSubBlock($oDisplayBlock->GetDisplay($oPage, "SearchFormToAdd_{$sLinkedSetId}",
|
||||
|
||||
@@ -874,11 +874,50 @@ class utils
|
||||
*/
|
||||
public static function DateTimeFormatToPHP($sOldDateTimeFormat)
|
||||
{
|
||||
$aSearch = array('%d', '%m', '%y', '%Y', '%H', '%i', '%s');
|
||||
$aReplacement = array('d', 'm', 'y', 'Y', 'H', 'i', 's');
|
||||
$aSearch = ['%d', '%m', '%y', '%Y', '%H', '%i', '%s'];
|
||||
$aReplacement = ['d', 'm', 'y', 'Y', 'H', 'i', 's'];
|
||||
return str_replace($aSearch, $aReplacement, $sOldDateTimeFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert an old strtime() date/time format specification {@link https://www.php.net/manual/fr/function.strftime.php}
|
||||
* to a format compatible with \DateTime::format {@link https://www.php.net/manual/fr/datetime.format.php}
|
||||
*
|
||||
* Example: '%Y-%m-%d %H:%M:%S' => 'Y-m-d H:i:s'
|
||||
*
|
||||
* Note: Not all strftime() formats can be converted, in which case they will be present in the returned string (eg. '%U' or '%W')
|
||||
*
|
||||
* @param string $sOldStrftimeFormat
|
||||
*
|
||||
* @return string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public static function StrftimeFormatToDateTimeFormat(string $sOldStrftimeFormat): string
|
||||
{
|
||||
$aSearch = [
|
||||
'%d', '%m', '%y', '%Y', '%H', '%M', '%S', // Most popular formats
|
||||
'%a', '%A', '%e', '%j', '%u', '%w', // Day formats
|
||||
'%U', '%V', '%W', // Week formats
|
||||
'%b', '%B', '%h', // Month formats
|
||||
'%C', '%g', '%G', // Year formats
|
||||
'%k', '%I', '%l', '%p', '%P', '%r', '%R', '%T', '%X', '%z', '%Z', // Time formats
|
||||
'%c', '%D', '%F', '%s', '%x', // Datetime formats
|
||||
'%n', '%t', '%%', // Misc. formats
|
||||
];
|
||||
$aReplacement = [
|
||||
'd', 'm', 'y', 'Y', 'H', 'i', 's',
|
||||
'D', 'l', 'j', 'z', 'N', 'w',
|
||||
'%U', 'W', '%W',
|
||||
'M', 'F', 'M',
|
||||
'%C', 'y', 'Y',
|
||||
'G', 'h', 'g', 'A', 'a', 'h:i:s A', 'H:i', 'H:i:s', '%X', 'O', 'T',
|
||||
'%c', 'm/d/y', 'Y-m-d', 'U', '%x',
|
||||
'%n', '%t', '%',
|
||||
];
|
||||
|
||||
return str_replace($aSearch, $aReplacement, $sOldStrftimeFormat);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allow to set cached config. Useful when running with {@link Parameters} for example.
|
||||
* @param \Config $oConfig
|
||||
@@ -1410,71 +1449,83 @@ class utils
|
||||
*/
|
||||
public static function GetPopupMenuItemsBlock(iUIBlock &$oContainerBlock, $iMenuId, $param, &$aActions, $sDataTableId = null)
|
||||
{
|
||||
$aResult = [];
|
||||
|
||||
// 1st - add standard built-in menu items
|
||||
//
|
||||
switch($iMenuId)
|
||||
{
|
||||
case iPopupMenuExtension::MENU_OBJLIST_TOOLKIT:
|
||||
// $param is a DBObjectSet
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sContext = $oAppContext->GetForLink();
|
||||
$sDataTableId = is_null($sDataTableId) ? '' : $sDataTableId;
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($param->GetFilter()->GetClass());
|
||||
$sOQL = addslashes($param->GetFilter()->ToOQL(true));
|
||||
$sFilter = urlencode($param->GetFilter()->serialize());
|
||||
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
case iPopupMenuExtension::MENU_OBJLIST_ACTIONS:
|
||||
// No native action there yet
|
||||
break;
|
||||
|
||||
$aResult = array();
|
||||
if (strlen($sUrl) < SERVER_MAX_URL_LENGTH)
|
||||
{
|
||||
$aResult[] = new SeparatorPopupMenuItem();
|
||||
// Static menus: Email this page, CSV Export & Add to Dashboard
|
||||
$aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'),
|
||||
"mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook
|
||||
);
|
||||
}
|
||||
|
||||
if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) != UR_ALLOWED_NO)
|
||||
{
|
||||
// Bulk export actions
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '$sDataTableId', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")");
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '$sDataTableId', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")");
|
||||
if (extension_loaded('gd'))
|
||||
{
|
||||
// PDF export requires GD
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('$sOQL', '$sDataTableId', 'pdf', ".json_encode(Dict::S('UI:Menu:ExportPDF')).")");
|
||||
case iPopupMenuExtension::MENU_OBJLIST_TOOLKIT:
|
||||
/** @var \DBObjectSet $param */
|
||||
$oAppContext = new ApplicationContext();
|
||||
$sContext = $oAppContext->GetForLink();
|
||||
$sDataTableId = is_null($sDataTableId) ? '' : $sDataTableId;
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($param->GetFilter()->GetClass());
|
||||
$sOQL = addslashes($param->GetFilter()->ToOQL(true));
|
||||
$sFilter = urlencode($param->GetFilter()->serialize());
|
||||
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
|
||||
// Configure this list on datatables
|
||||
if (utils::IsNotNullOrEmptyString($sDataTableId)) {
|
||||
$aResult[] = new JSPopupMenuItem(
|
||||
'iTop::ConfigureList',
|
||||
Dict::S('UI:ConfigureThisList'),
|
||||
"$('#datatable_dlg_datatable_{$sDataTableId}').dialog('open'); return false;"
|
||||
);
|
||||
$aResult[] = new SeparatorPopupMenuItem();
|
||||
}
|
||||
}
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')");
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')");
|
||||
|
||||
break;
|
||||
|
||||
if (strlen($sUrl) < SERVER_MAX_URL_LENGTH) {
|
||||
// Static menus: Email this page, CSV Export & Add to Dashboard
|
||||
$aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'),
|
||||
"mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook
|
||||
);
|
||||
}
|
||||
|
||||
if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) != UR_ALLOWED_NO) {
|
||||
// Bulk export actions
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '$sDataTableId', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")");
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '$sDataTableId', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")");
|
||||
if (extension_loaded('gd'))
|
||||
{
|
||||
// PDF export requires GD
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ExportPDF', Dict::S('UI:Menu:ExportPDF'), "ExportListDlg('$sOQL', '$sDataTableId', 'pdf', ".json_encode(Dict::S('UI:Menu:ExportPDF')).")");
|
||||
}
|
||||
}
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:AddToDashboard', Dict::S('UI:Menu:AddToDashboard'), "DashletCreationDlg('$sOQL', '$sContext')");
|
||||
$aResult[] = new JSPopupMenuItem('UI:Menu:ShortcutList', Dict::S('UI:Menu:ShortcutList'), "ShortcutListDlg('$sOQL', '$sDataTableId', '$sContext')");
|
||||
|
||||
break;
|
||||
|
||||
case iPopupMenuExtension::MENU_OBJDETAILS_ACTIONS:
|
||||
// $param is a DBObject
|
||||
$oObj = $param;
|
||||
$sOQL = "SELECT ".get_class($oObj)." WHERE id=".$oObj->GetKey();
|
||||
$sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
|
||||
$aResult = array(
|
||||
new SeparatorPopupMenuItem(),
|
||||
// Static menus: Email this page & CSV Export
|
||||
new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook
|
||||
new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"),
|
||||
new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
|
||||
new SeparatorPopupMenuItem(),
|
||||
new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
|
||||
);
|
||||
break;
|
||||
/** @var \DBObject $param */
|
||||
$oObj = $param;
|
||||
$sOQL = "SELECT ".get_class($oObj)." WHERE id=".$oObj->GetKey();
|
||||
$sUrl = ApplicationContext::MakeObjectUrl(get_class($oObj), $oObj->GetKey());
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
$oContainerBlock->AddJsFileRelPath('js/tabularfieldsselector.js');
|
||||
$oContainerBlock->AddJsFileRelPath('js/jquery.dragtable.js');
|
||||
$oContainerBlock->AddCssFileRelPath('css/dragtable.css');
|
||||
|
||||
$aResult = array(
|
||||
new SeparatorPopupMenuItem(),
|
||||
// Static menus: Email this page & CSV Export
|
||||
new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?subject=".urlencode($oObj->GetRawName())."&body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook
|
||||
new JSPopupMenuItem('UI:Menu:CSVExport', Dict::S('UI:Menu:CSVExport'), "ExportListDlg('$sOQL', '', 'csv', ".json_encode(Dict::S('UI:Menu:CSVExport')).")"),
|
||||
new JSPopupMenuItem('UI:Menu:ExportXLSX', Dict::S('ExcelExporter:ExportMenu'), "ExportListDlg('$sOQL', '', 'xlsx', ".json_encode(Dict::S('ExcelExporter:ExportMenu')).")"),
|
||||
new SeparatorPopupMenuItem(),
|
||||
new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $sUrl.'&printable=1', '_blank'),
|
||||
);
|
||||
break;
|
||||
|
||||
case iPopupMenuExtension::MENU_DASHBOARD_ACTIONS:
|
||||
// $param is a Dashboard
|
||||
@@ -1482,19 +1533,19 @@ class utils
|
||||
$oDashboard = $param;
|
||||
$sDashboardId = $oDashboard->GetId();
|
||||
$sDashboardFile = $oDashboard->GetDefinitionFile();
|
||||
$sDashboardFileRelative = utils::LocalPath($sDashboardFile);
|
||||
$sDlgTitle = addslashes(Dict::S('UI:ImportDashboardTitle'));
|
||||
$sDlgText = addslashes(Dict::S('UI:ImportDashboardText'));
|
||||
$sCloseBtn = addslashes(Dict::S('UI:Button:Cancel'));
|
||||
$sDashboardFileJS = addslashes($sDashboardFile);
|
||||
$sDashboardFileURL = urlencode($sDashboardFile);
|
||||
$sDashboardFileJS = addslashes($sDashboardFileRelative);
|
||||
$sDashboardFileURL = urlencode($sDashboardFileRelative);
|
||||
$sUploadDashboardTransactId = utils::GetNewTransactionId();
|
||||
$aResult = array(
|
||||
new SeparatorPopupMenuItem(),
|
||||
new URLPopupMenuItem('UI:ExportDashboard', Dict::S('UI:ExportDashBoard'), utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php?operation=export_dashboard&id='.$sDashboardId.'&file='.$sDashboardFileURL),
|
||||
new JSPopupMenuItem('UI:ImportDashboard', Dict::S('UI:ImportDashBoard'), "UploadDashboard({dashboard_id: '$sDashboardId', file: '$sDashboardFileJS', title: '$sDlgTitle', text: '$sDlgText', close_btn: '$sCloseBtn', transaction: '$sUploadDashboardTransactId' })"),
|
||||
);
|
||||
if ($oDashboard->GetReloadURL())
|
||||
{
|
||||
if ($oDashboard->GetReloadURL()) {
|
||||
$aResult[] = new SeparatorPopupMenuItem();
|
||||
$aResult[] = new URLPopupMenuItem('UI:Menu:PrintableVersion', Dict::S('UI:Menu:PrintableVersion'), $oDashboard->GetReloadURL().'&printable=1', '_blank');
|
||||
}
|
||||
@@ -1503,34 +1554,25 @@ class utils
|
||||
|
||||
default:
|
||||
// Unknown type of menu, do nothing
|
||||
$aResult = array();
|
||||
}
|
||||
foreach ($aResult as $oMenuItem)
|
||||
{
|
||||
foreach ($aResult as $oMenuItem) {
|
||||
$aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
|
||||
}
|
||||
|
||||
// Invoke the plugins
|
||||
//
|
||||
/** @var \iPopupMenuExtension $oExtensionInstance */
|
||||
foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance)
|
||||
{
|
||||
if (is_object($param) && !($param instanceof DBObject))
|
||||
{
|
||||
foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) {
|
||||
if (is_object($param) && !($param instanceof DBObject)) {
|
||||
$tmpParam = clone $param; // In case the parameter is an DBObjectSet, clone it to prevent alterations
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$tmpParam = $param;
|
||||
}
|
||||
foreach($oExtensionInstance->EnumItems($iMenuId, $tmpParam) as $oMenuItem)
|
||||
{
|
||||
if (is_object($oMenuItem))
|
||||
{
|
||||
foreach ($oExtensionInstance->EnumItems($iMenuId, $tmpParam) as $oMenuItem) {
|
||||
if (is_object($oMenuItem)) {
|
||||
$aActions[$oMenuItem->GetUID()] = $oMenuItem->GetMenuItem();
|
||||
|
||||
foreach($oMenuItem->GetLinkedScripts() as $sLinkedScript)
|
||||
{
|
||||
|
||||
foreach ($oMenuItem->GetLinkedScripts() as $sLinkedScript) {
|
||||
$oContainerBlock->AddJsFileRelPath($sLinkedScript);
|
||||
}
|
||||
}
|
||||
@@ -1538,6 +1580,136 @@ class utils
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We cannot use iMenuId (corresponding values in {@see \iPopupMenuExtension} constants) as value is always {@see \iPopupMenuExtension::MENU_OBJLIST_TOOLKIT}
|
||||
* whenever we are in a datatable, whereas it is included in a object tab, a dashlet or a search.
|
||||
*
|
||||
* So a {@see \ContextTag} is set on the corresponding calls.
|
||||
*
|
||||
* @return bool true if we are in a search page context, either directly or by the datatable ajax call
|
||||
*
|
||||
* @since 3.1.0 N°3200
|
||||
*
|
||||
* @uses \ContextTag::TAG_OBJECT_SEARCH
|
||||
*/
|
||||
public static function IsCurrentPageASearch(): bool
|
||||
{
|
||||
if (ContextTag::Check(ContextTag::TAG_OBJECT_SEARCH)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DBObjectSearch $oFilter object list
|
||||
* @param array $aExtraParams
|
||||
*
|
||||
* @return string|null null if we are already in a search, otherwise the URL to open this list in a search
|
||||
*
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @uses utils::IsCurrentPageASearch()
|
||||
*
|
||||
* @since 3.1.0 N°3200
|
||||
*/
|
||||
public static function GetDataTableSearchUrl(DBSearch $oFilter, array $aExtraParams): ?string
|
||||
{
|
||||
if (static::IsCurrentPageASearch()) {
|
||||
// we don't want to add the link when already in a search page !
|
||||
return null;
|
||||
}
|
||||
|
||||
$bIsObjectRelation = isset($aExtraParams['object_id'], $aExtraParams['target_attr']);
|
||||
if ($bIsObjectRelation) {
|
||||
[$oDataTableSearchFilter, $aParams] = static::GetDataTableSearchForRelations($oFilter, $aExtraParams);
|
||||
} else {
|
||||
$oDataTableSearchFilter = $oFilter;
|
||||
$aParams = [];
|
||||
}
|
||||
|
||||
if (isset($aExtraParams['table_id'])) {
|
||||
$aParams['table_id'] = $aExtraParams['table_id'];
|
||||
}
|
||||
$sParams = json_encode($aParams);
|
||||
|
||||
$sAppRootUrl = static::GetAbsoluteUrlAppRoot();
|
||||
$oAppContext = new ApplicationContext();
|
||||
|
||||
$sUrl = $sAppRootUrl
|
||||
.'pages/UI.php?operation=search&'
|
||||
.$oAppContext->GetForLink()
|
||||
.'&filter='.rawurlencode($oDataTableSearchFilter->serialize());
|
||||
$sUrl .= '&aParams='.rawurlencode($sParams); // Not working... yet, cause not handled by UI.php
|
||||
|
||||
return $sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewrites filter for object relations, so that in the search page we will have the correct criteria and will be able to use "configure this list"
|
||||
*
|
||||
* @param \DBSearch $oFilter object list
|
||||
* @param array{link_attr: string, target_attr: string, object_id: string} $aExtraParams
|
||||
*
|
||||
* @return array{\DBObjectSearch, string[]}
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*
|
||||
* @since 3.1.0 N°3200
|
||||
*/
|
||||
private static function GetDataTableSearchForRelations(DBSearch $oFilter, array $aExtraParams): array
|
||||
{
|
||||
$sObjectId = $aExtraParams['object_id'];
|
||||
$bIsLinkedSetIndirect = isset($aExtraParams['link_attr']);
|
||||
if ($bIsLinkedSetIndirect) {
|
||||
//--- AttributeLinkedSetIndirect (n,n => lnk class)
|
||||
$sLnkClass = $oFilter->GetClass();
|
||||
$sExtKeyToObjectClass = $aExtraParams['link_attr'];
|
||||
$sExtKeyToRemoteClass = $aExtraParams['target_attr'];
|
||||
|
||||
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
|
||||
$oLnkExtKeyToRemote = MetaModel::GetAttributeDef($sLnkClass, $sExtKeyToRemoteClass);
|
||||
$sRemoteClass = $oLnkExtKeyToRemote->GetTargetClass();
|
||||
|
||||
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
|
||||
$oLnkExtKeyToObject = MetaModel::GetAttributeDef($sLnkClass, $sExtKeyToObjectClass);
|
||||
$sObjectClass = $oLnkExtKeyToObject->GetTargetClass();
|
||||
|
||||
/** @var \AttributeExternalKey $oLnkExtKeyToRemote */
|
||||
$oObjectExtKeyToLnk = $oLnkExtKeyToObject->GetMirrorLinkAttribute();
|
||||
$sObjectExtKeyToLnkClass = $oObjectExtKeyToLnk->GetCode();
|
||||
|
||||
$sRemoteClassAliasName = ormLinkSet::REMOTE_ALIAS;
|
||||
$sLnkClassAliasName = ormLinkSet::LINK_ALIAS;
|
||||
$sOql = <<<SQL
|
||||
SELECT {$sRemoteClassAliasName},{$sLnkClassAliasName}
|
||||
FROM {$sRemoteClass} AS {$sRemoteClassAliasName}
|
||||
JOIN {$sLnkClass} AS {$sLnkClassAliasName} ON {$sLnkClassAliasName}.$sExtKeyToRemoteClass = {$sRemoteClassAliasName}.id
|
||||
WHERE {$sLnkClassAliasName}.$sExtKeyToObjectClass = $sObjectId
|
||||
SQL;
|
||||
|
||||
$aAttCodesToDisplay = MetaModel::GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay($sObjectClass, $sObjectExtKeyToLnkClass, $sRemoteClass, $sExtKeyToRemoteClass);
|
||||
/** @noinspection PhpUnnecessaryLocalVariableInspection */
|
||||
$sAttCodesToDisplay = implode(',', $aAttCodesToDisplay);
|
||||
$aParams = [
|
||||
'zlist' => false,
|
||||
'extra_fields' => $sAttCodesToDisplay,
|
||||
];
|
||||
} else {
|
||||
//--- AttributeLinkedSet (1,n => AttributeExternalKey)
|
||||
$sClass = $oFilter->GetClass();
|
||||
$sExtKeyCode = $aExtraParams['target_attr'];
|
||||
|
||||
$sOql = "SELECT $sClass WHERE $sExtKeyCode = $sObjectId";
|
||||
|
||||
$aParams = [];
|
||||
}
|
||||
|
||||
$oDataTableSearchFilter = DBSearch::FromOQL($sOql);
|
||||
|
||||
return [$oDataTableSearchFilter, $aParams];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEnvironment
|
||||
*
|
||||
@@ -1545,10 +1717,10 @@ class utils
|
||||
*/
|
||||
public static function GetConfigFilePath($sEnvironment = null)
|
||||
{
|
||||
if (is_null($sEnvironment))
|
||||
{
|
||||
if (is_null($sEnvironment)) {
|
||||
$sEnvironment = self::GetCurrentEnvironment();
|
||||
}
|
||||
|
||||
return APPCONF.$sEnvironment.'/'.ITOP_CONFIG_FILE;
|
||||
}
|
||||
|
||||
@@ -2714,7 +2886,7 @@ HTML;
|
||||
* @return array
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function GetClassesForInterface(string $sInterface, string $sClassNameFilter = '', $aExcludedPath = ['[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]']): array
|
||||
public static function GetClassesForInterface(string $sInterface, string $sClassNameFilter = '', $aExcludedPath = []): array
|
||||
{
|
||||
$aMatchingClasses = [];
|
||||
|
||||
@@ -2765,12 +2937,18 @@ HTML;
|
||||
$bSkipped = true;
|
||||
}
|
||||
else {
|
||||
foreach ($aExcludedPath as $sExcludedPath) {
|
||||
// Note: We use '#' as delimiters as usual '/' is often used in paths.
|
||||
if ($sExcludedPath !== '' && preg_match('#'.$sExcludedPath.'#', $sPHPFile) === 1) {
|
||||
$bSkipped = true;
|
||||
break;
|
||||
$sPHPFile = self::LocalPath($sPHPFile);
|
||||
if ($sPHPFile !== false) {
|
||||
$sPHPFile = '/'.$sPHPFile; // for regex
|
||||
foreach ($aExcludedPath as $sExcludedPath) {
|
||||
// Note: We use '#' as delimiters as usual '/' is often used in paths.
|
||||
if ($sExcludedPath !== '' && preg_match('#'.$sExcludedPath.'#', $sPHPFile) === 1) {
|
||||
$bSkipped = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$bSkipped = true; // file not found
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2808,7 +2986,7 @@ HTML;
|
||||
$aResultPref = [];
|
||||
$aShortcutPrefs = appUserPreferences::GetPref('keyboard_shortcuts', []);
|
||||
// Note: Mind the 4 blackslashes, see utils::GetClassesForInterface()
|
||||
$aShortcutClasses = utils::GetClassesForInterface('iKeyboardShortcut', '', array('[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]'));
|
||||
$aShortcutClasses = utils::GetClassesForInterface('iKeyboardShortcut', '', array('[\\\\/]lib[\\\\/]', '[\\\\/]node_modules[\\\\/]', '[\\\\/]test[\\\\/]', '[\\\\/]tests[\\\\/]'));
|
||||
|
||||
foreach ($aShortcutClasses as $cShortcutPlugin) {
|
||||
$sTriggeredElement = $cShortcutPlugin::GetShortcutTriggeredElementSelector();
|
||||
@@ -3035,18 +3213,35 @@ HTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a snake_case $sInput into a CamelCase string
|
||||
*
|
||||
* @param string $sInput
|
||||
*
|
||||
* @return string
|
||||
* @return string Camel case representation of $sInput (eg. "something_new" becomes "SomethingNew")
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public static function ToCamelCase($sInput)
|
||||
public static function ToCamelCase($sInput): string
|
||||
{
|
||||
return str_replace(' ', '', ucwords(strtr($sInput, '_-', ' ')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sInput
|
||||
*
|
||||
* @return string Snake case representation of $sInput (eg. "SomethingNew" becomes "something_new")
|
||||
* @since 3.1.0
|
||||
* @link https://stackoverflow.com/a/19533226/2710325
|
||||
*/
|
||||
public static function ToSnakeCase(string $sInput): string
|
||||
{
|
||||
// Remove special chars to join words
|
||||
$sOutput = preg_replace('/(\W)/', '_', $sInput);
|
||||
// Transform camel case words to snake case
|
||||
$sOutput = preg_replace('/[A-Z]([A-Z](?![a-z]))*/', '_$0', $sOutput);
|
||||
// Lowercase everything
|
||||
$sOutput = mb_strtolower($sOutput);
|
||||
// Trim outer underscores
|
||||
return trim($sOutput, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sInput
|
||||
*
|
||||
@@ -3205,9 +3400,4 @@ HTML;
|
||||
{
|
||||
return in_array($sTrait, self::TraitsUsedByClass($sClass, true));
|
||||
}
|
||||
|
||||
public static function GetUniqId()
|
||||
{
|
||||
return hash('sha256', uniqid(sprintf('%x', rand()), true).sprintf('%x', rand()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,16 +60,20 @@ class WizardHelper
|
||||
// special handling for lists
|
||||
// assumes this is handled as an array of objects
|
||||
// thus encoded in json like: [ { name:'link1', 'id': 123}, { name:'link2', 'id': 124}...]
|
||||
$aData = json_decode($value, true); // true means decode as a hash array (not an object)
|
||||
if (!is_array($value)) {
|
||||
$aData = json_decode($value, true); // true means decode as a hash array (not an object)
|
||||
} else {
|
||||
$aData = $value;
|
||||
}
|
||||
|
||||
// Check what are the meaningful attributes
|
||||
$aFields = $this->GetLinkedWizardStructure($oAttDef);
|
||||
$sLinkedClass = $oAttDef->GetLinkedClass();
|
||||
$aLinkedObjectsArray = array();
|
||||
if (!is_array($aData))
|
||||
{
|
||||
echo ("aData: '$aData' (value: '$value')\n");
|
||||
if (!is_array($aData)) {
|
||||
echo("aData: '$aData' (value: '$value')\n");
|
||||
}
|
||||
foreach($aData as $aLinkedObject)
|
||||
foreach ($aData as $aLinkedObject)
|
||||
{
|
||||
$oLinkedObj = MetaModel::NewObject($sLinkedClass);
|
||||
foreach($aFields as $sLinkedAttCode)
|
||||
|
||||
12
composer.lock
generated
12
composer.lock
generated
@@ -4974,16 +4974,16 @@
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.4.2",
|
||||
"version": "v3.4.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077"
|
||||
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
|
||||
"reference": "e07cdd3d430cd7e453c31b36eb5ad6c0c5e43077",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/c38fd6b0b7f370c198db91ffd02e23b517426b58",
|
||||
"reference": "c38fd6b0b7f370c198db91ffd02e23b517426b58",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5034,7 +5034,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.4.2"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.4.3"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5046,7 +5046,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2022-08-12T06:47:24+00:00"
|
||||
"time": "2022-09-28T08:42:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
||||
@@ -43,22 +43,24 @@ abstract class Action extends cmdbAbstractObject
|
||||
{
|
||||
$aParams = array
|
||||
(
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "name",
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('name'),
|
||||
"db_table" => "priv_action",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "realclass",
|
||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-in-transit.svg'),
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "name",
|
||||
"complementary_name_attcode" => array('finalclass', 'description'),
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('name'),
|
||||
"db_table" => "priv_action",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "realclass",
|
||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-in-transit.svg'),
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
//MetaModel::Init_InheritAttributes();
|
||||
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values"=>null, "sql"=>"name", "default_value"=>null, "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values"=>null, "sql"=>"description", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values"=>new ValueSetEnum(array('test'=>'Being tested' ,'enabled'=>'In production', 'disabled'=>'Inactive')), "sql"=>"status", "default_value"=>"test", "is_null_allowed"=>false, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("trigger_list", array("linked_class"=>"lnkTriggerAction", "ext_key_to_me"=>"action_id", "ext_key_to_remote"=>"trigger_id", "allowed_values"=>null, "count_min"=>0, "count_max"=>0, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values" => new ValueSetEnum(array('test' => 'Being tested', 'enabled' => 'In production', 'disabled' => 'Inactive')), "sql" => "status", "default_value" => "test", "is_null_allowed" => false, "depends_on" => array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("trigger_list",
|
||||
array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "action_id", "ext_key_to_remote" => "trigger_id", "allowed_values" => null, "count_min" => 0, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
|
||||
|
||||
// Display lists
|
||||
// - Attributes to be displayed for the complete details
|
||||
|
||||
@@ -181,7 +181,7 @@ abstract class AsyncTask extends DBObject
|
||||
if (is_array($aRetries) && array_key_exists(get_class($this), $aRetries))
|
||||
{
|
||||
$aConfig = $aRetries[get_class($this)];
|
||||
$bExponential = (bool)$aConfig['exponential_delay'] ?? $bExponential;
|
||||
$bExponential = (bool) ($aConfig['exponential_delay'] ?? $bExponential);
|
||||
}
|
||||
return $bExponential;
|
||||
}
|
||||
|
||||
@@ -5,12 +5,15 @@
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\FieldBadge\FieldBadgeUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Links\Indirect\BlockLinksSetDisplayAsProperty;
|
||||
use Combodo\iTop\Form\Field\LabelField;
|
||||
use Combodo\iTop\Form\Field\TextAreaField;
|
||||
use Combodo\iTop\Form\Form;
|
||||
use Combodo\iTop\Form\Validator\NotEmptyExtKeyValidator;
|
||||
use Combodo\iTop\Form\Validator\Validator;
|
||||
use Combodo\iTop\Renderer\BlockRenderer;
|
||||
use Combodo\iTop\Renderer\Console\ConsoleBlockRenderer;
|
||||
use Combodo\iTop\Service\Links\LinkSetModel;
|
||||
|
||||
require_once('MyHelpers.class.inc.php');
|
||||
require_once('ormdocument.class.inc.php');
|
||||
@@ -92,6 +95,9 @@ define('LINKSET_EDITMODE_ADDREMOVE', 4); // The "linked" objects can be added/re
|
||||
define('LINKSET_RELATIONTYPE_PROPERTY', 'property');
|
||||
define('LINKSET_RELATIONTYPE_LINK', 'link');
|
||||
|
||||
define('LINKSET_DISPLAY_STYLE_PROPERTY', 'property');
|
||||
define('LINKSET_DISPLAY_STYLE_TAB', 'tab');
|
||||
|
||||
/**
|
||||
* Attributes implementing this interface won't be accepted as `group by` field
|
||||
*
|
||||
@@ -140,6 +146,15 @@ abstract class AttributeDefinition
|
||||
|
||||
abstract public function GetEditClass();
|
||||
|
||||
/**
|
||||
* @return array Css classes
|
||||
* @since 3.1.0 N°3190
|
||||
*/
|
||||
public function GetCssClasses(): array
|
||||
{
|
||||
return $this->aCSSClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the search widget type corresponding to this attribute
|
||||
*
|
||||
@@ -361,6 +376,18 @@ abstract class AttributeDefinition
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the attribute can be used in bulk modify.
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.1.0 N°3190
|
||||
*
|
||||
*/
|
||||
public static function IsBulkModifyCompatible(): bool
|
||||
{
|
||||
return static::IsScalar();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the attribute value is a set of related objects (1-N or N-N)
|
||||
*
|
||||
@@ -624,6 +651,16 @@ abstract class AttributeDefinition
|
||||
return $sLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool True if the attribute has a description {@see \AttributeDefinition::GetDescription()}
|
||||
* @throws \Exception
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function HasDescription(): bool
|
||||
{
|
||||
return utils::IsNotNullOrEmptyString($this->GetDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|null $sDefault
|
||||
*
|
||||
@@ -1417,6 +1454,7 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
public function __construct($sCode, $aParams)
|
||||
{
|
||||
parent::__construct($sCode, $aParams);
|
||||
$this->aCSSClasses[] = 'attribute-set';
|
||||
}
|
||||
|
||||
public static function ListExpectedParams()
|
||||
@@ -1430,6 +1468,12 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
return "LinkedSet";
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public static function IsBulkModifyCompatible(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function IsWritable()
|
||||
{
|
||||
return true;
|
||||
@@ -1447,7 +1491,26 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
|
||||
public function GetValuesDef()
|
||||
{
|
||||
return $this->Get("allowed_values");
|
||||
$oValSetDef = $this->Get("allowed_values");
|
||||
if (!$oValSetDef) {
|
||||
// Let's propose every existing value
|
||||
$oValSetDef = new ValueSetObjects('SELECT '.LinkSetModel::GetTargetClass($this));
|
||||
}
|
||||
|
||||
return $oValSetDef;
|
||||
}
|
||||
|
||||
public function GetEditValue($value, $oHostObj = null)
|
||||
{
|
||||
/** @var ormLinkSet $value * */
|
||||
if ($value->Count() === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
/** Return linked objects key as string **/
|
||||
$aValues = $value->GetValues();
|
||||
|
||||
return implode(' ', $aValues);
|
||||
}
|
||||
|
||||
public function GetPrerequisiteAttributes($sClass = null)
|
||||
@@ -1515,12 +1578,12 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 3.1.0 N°5563 this attribute is no longer used
|
||||
* @return string see LINKSET_EDITMODE_* constants
|
||||
* @since 3.1.0 N°5563 relations are edited using new attributes in details mode, but as nothing changed in edit mode we are still using edit_mode attribute
|
||||
*/
|
||||
public function GetEditMode()
|
||||
{
|
||||
return $this->GetOptional('legacy_edit_mode', LINKSET_EDITMODE_ACTIONS);
|
||||
return $this->GetOptional('edit_mode', LINKSET_EDITMODE_ACTIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1532,6 +1595,15 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
return $this->GetOptional('relation_type', LINKSET_RELATIONTYPE_LINK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string see LINKSET_DISPLAY_STYLE_* constants
|
||||
* @since 3.1.0 N°3190
|
||||
*/
|
||||
public function GetDisplayStyle()
|
||||
{
|
||||
return $this->GetOptional('display_style', LINKSET_DISPLAY_STYLE_TAB);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @since 3.1.0 N°5563
|
||||
@@ -1566,49 +1638,30 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sValue
|
||||
* @param \DBObject $oHostObject
|
||||
* @param bool $bLocalize
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
/** @inheritDoc * */
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true): string
|
||||
{
|
||||
if (is_object($sValue) && ($sValue instanceof ormLinkSet))
|
||||
{
|
||||
$sValue->Rewind();
|
||||
$aItems = array();
|
||||
while ($oObj = $sValue->Fetch())
|
||||
{
|
||||
// Show only relevant information (hide the external key to the current object)
|
||||
$aAttributes = array();
|
||||
foreach(MetaModel::ListAttributeDefs($this->GetLinkedClass()) as $sAttCode => $oAttDef)
|
||||
{
|
||||
if ($sAttCode == $this->GetExtKeyToMe())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ($oAttDef->IsExternalField())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$sAttValue = $oObj->GetAsHTML($sAttCode);
|
||||
if (strlen($sAttValue) > 0)
|
||||
{
|
||||
$aAttributes[] = $sAttValue;
|
||||
}
|
||||
}
|
||||
$sAttributes = implode(', ', $aAttributes);
|
||||
$aItems[] = $sAttributes;
|
||||
try {
|
||||
|
||||
/** @var ormLinkSet $sValue */
|
||||
if ($sValue->Count() === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return implode('<br/>', $aItems);
|
||||
}
|
||||
$oLinkSetBlock = new BlockLinksSetDisplayAsProperty($this->GetCode(), $this, $sValue);
|
||||
|
||||
return null;
|
||||
return ConsoleBlockRenderer::RenderBlockTemplates($oLinkSetBlock);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$sMessage = "Error while displaying attribute {$this->GetCode()}";
|
||||
IssueLog::Error($sMessage, IssueLog::CHANNEL_DEFAULT, [
|
||||
'host_object_class' => $this->GetHostClass(),
|
||||
'host_object_key' => $oHostObject->GetKey(),
|
||||
'attribute' => $this->GetCode(),
|
||||
]);
|
||||
|
||||
return $sMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2361,6 +2414,13 @@ class AttributeLinkedSetIndirect extends AttributeLinkedSet
|
||||
|
||||
return $oRet;
|
||||
}
|
||||
|
||||
/** @inheritDoc */
|
||||
public static function IsBulkModifyCompatible(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,6 +21,7 @@ MetaModel::IncludeModule('application/menunode.class.inc.php');
|
||||
MetaModel::IncludeModule('application/user.preferences.class.inc.php');
|
||||
MetaModel::IncludeModule('application/user.dashboard.class.inc.php');
|
||||
MetaModel::IncludeModule('application/audit.rule.class.inc.php');
|
||||
MetaModel::IncludeModule('application/audit.domain.class.inc.php');
|
||||
MetaModel::IncludeModule('application/query.class.inc.php');
|
||||
MetaModel::IncludeModule('setup/moduleinstallation.class.inc.php');
|
||||
|
||||
|
||||
@@ -1160,136 +1160,112 @@ class BulkChange
|
||||
}
|
||||
$iPreviousTimeLimit = ini_get('max_execution_time');
|
||||
$iLoopTimeLimit = MetaModel::GetConfig()->Get('max_execution_time_per_loop');
|
||||
foreach($this->m_aData as $iRow => $aRowData)
|
||||
{
|
||||
set_time_limit(intval($iLoopTimeLimit));
|
||||
if (isset($aResult[$iRow]["__STATUS__"]))
|
||||
{
|
||||
// An issue at the earlier steps - skip the rest
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
$oReconciliationFilter = new DBObjectSearch($this->m_sClass);
|
||||
$bSkipQuery = false;
|
||||
foreach($this->m_aReconcilKeys as $sAttCode)
|
||||
{
|
||||
$valuecondition = null;
|
||||
if (array_key_exists($sAttCode, $this->m_aExtKeys))
|
||||
{
|
||||
if ($this->IsNullExternalKeySpec($aRowData, $sAttCode))
|
||||
{
|
||||
$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
|
||||
if ($oExtKey->IsNullAllowed())
|
||||
{
|
||||
$valuecondition = $oExtKey->GetNullValue();
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_NullIssue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The value has to be found or verified
|
||||
|
||||
/** var DBObjectSearch $oReconFilter */
|
||||
list($oReconFilter, $aMatches) = $this->ResolveExternalKey($aRowData, $sAttCode, $aResult[$iRow]);
|
||||
// Avoid too many events
|
||||
cmdbAbstractObject::SetEventDBLinksChangedBlocked(true);
|
||||
try {
|
||||
foreach ($this->m_aData as $iRow => $aRowData) {
|
||||
set_time_limit(intval($iLoopTimeLimit));
|
||||
if (isset($aResult[$iRow]["__STATUS__"])) {
|
||||
// An issue at the earlier steps - skip the rest
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
$oReconciliationFilter = new DBObjectSearch($this->m_sClass);
|
||||
$bSkipQuery = false;
|
||||
foreach ($this->m_aReconcilKeys as $sAttCode) {
|
||||
$valuecondition = null;
|
||||
if (array_key_exists($sAttCode, $this->m_aExtKeys)) {
|
||||
if ($this->IsNullExternalKeySpec($aRowData, $sAttCode)) {
|
||||
$oExtKey = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
|
||||
if ($oExtKey->IsNullAllowed()) {
|
||||
$valuecondition = $oExtKey->GetNullValue();
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oExtKey->GetNullValue());
|
||||
} else {
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_NullIssue();
|
||||
}
|
||||
} else {
|
||||
// The value has to be found or verified
|
||||
|
||||
if (count($aMatches) == 1)
|
||||
{
|
||||
$oRemoteObj = reset($aMatches); // first item
|
||||
$valuecondition = $oRemoteObj->GetKey();
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oRemoteObj->GetKey());
|
||||
/** var DBObjectSearch $oReconFilter */
|
||||
list($oReconFilter, $aMatches) = $this->ResolveExternalKey($aRowData, $sAttCode, $aResult[$iRow]);
|
||||
|
||||
if (count($aMatches) == 1) {
|
||||
$oRemoteObj = reset($aMatches); // first item
|
||||
$valuecondition = $oRemoteObj->GetKey();
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Void($oRemoteObj->GetKey());
|
||||
} elseif (count($aMatches) == 0) {
|
||||
$oCellStatus_SearchIssue = $this->GetCellSearchIssue($oReconFilter);
|
||||
$aResult[$iRow][$sAttCode] = $oCellStatus_SearchIssue;
|
||||
} else {
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Ambiguous(null, count($aMatches), $oReconFilter->serialize());
|
||||
}
|
||||
}
|
||||
elseif (count($aMatches) == 0)
|
||||
{
|
||||
$oCellStatus_SearchIssue = $this->GetCellSearchIssue($oReconFilter);
|
||||
$aResult[$iRow][$sAttCode] = $oCellStatus_SearchIssue;
|
||||
}
|
||||
else
|
||||
{
|
||||
$aResult[$iRow][$sAttCode] = new CellStatus_Ambiguous(null, count($aMatches), $oReconFilter->serialize());
|
||||
} else {
|
||||
// The value is given in the data row
|
||||
$iCol = $this->m_aAttList[$sAttCode];
|
||||
if ($sAttCode == 'id') {
|
||||
$valuecondition = $aRowData[$iCol];
|
||||
} else {
|
||||
$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
|
||||
$valuecondition = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// The value is given in the data row
|
||||
$iCol = $this->m_aAttList[$sAttCode];
|
||||
if ($sAttCode == 'id')
|
||||
{
|
||||
$valuecondition = $aRowData[$iCol];
|
||||
}
|
||||
else
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef($this->m_sClass, $sAttCode);
|
||||
$valuecondition = $oAttDef->MakeValueFromString($aRowData[$iCol], $this->m_bLocalizedValues);
|
||||
if (is_null($valuecondition)) {
|
||||
$bSkipQuery = true;
|
||||
} else {
|
||||
$oReconciliationFilter->AddCondition($sAttCode, $valuecondition, '=');
|
||||
}
|
||||
}
|
||||
if (is_null($valuecondition))
|
||||
{
|
||||
$bSkipQuery = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$oReconciliationFilter->AddCondition($sAttCode, $valuecondition, '=');
|
||||
if ($bSkipQuery) {
|
||||
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Reconciliation'));
|
||||
} else {
|
||||
$oReconciliationSet = new CMDBObjectSet($oReconciliationFilter);
|
||||
switch ($oReconciliationSet->Count()) {
|
||||
case 0:
|
||||
$oTargetObj = $this->CreateObject($aResult, $iRow, $aRowData, $oChange);
|
||||
// $aResult[$iRow]["__STATUS__"]=> set in CreateObject
|
||||
$aVisited[] = $oTargetObj->GetKey();
|
||||
break;
|
||||
case 1:
|
||||
$oTargetObj = $oReconciliationSet->Fetch();
|
||||
$this->UpdateObject($aResult, $iRow, $oTargetObj, $aRowData, $oChange);
|
||||
// $aResult[$iRow]["__STATUS__"]=> set in UpdateObject
|
||||
if (!is_null($this->m_sSynchroScope)) {
|
||||
$aVisited[] = $oTargetObj->GetKey();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Found several matches, ambiguous
|
||||
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Ambiguous'));
|
||||
$aResult[$iRow]["id"] = new CellStatus_Ambiguous(0, $oReconciliationSet->Count(), $oReconciliationFilter->serialize());
|
||||
$aResult[$iRow]["finalclass"] = 'n/a';
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$aResult[$iRow]["__STATUS__"] = new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-Internal', get_class($e), $e->getMessage()));
|
||||
}
|
||||
if ($bSkipQuery)
|
||||
{
|
||||
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Reconciliation'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$oReconciliationSet = new CMDBObjectSet($oReconciliationFilter);
|
||||
switch($oReconciliationSet->Count())
|
||||
{
|
||||
case 0:
|
||||
$oTargetObj = $this->CreateObject($aResult, $iRow, $aRowData, $oChange);
|
||||
// $aResult[$iRow]["__STATUS__"]=> set in CreateObject
|
||||
$aVisited[] = $oTargetObj->GetKey();
|
||||
break;
|
||||
case 1:
|
||||
$oTargetObj = $oReconciliationSet->Fetch();
|
||||
$this->UpdateObject($aResult, $iRow, $oTargetObj, $aRowData, $oChange);
|
||||
// $aResult[$iRow]["__STATUS__"]=> set in UpdateObject
|
||||
if (!is_null($this->m_sSynchroScope))
|
||||
{
|
||||
$aVisited[] = $oTargetObj->GetKey();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Found several matches, ambiguous
|
||||
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::S('UI:CSVReport-Row-Issue-Ambiguous'));
|
||||
$aResult[$iRow]["id"]= new CellStatus_Ambiguous(0, $oReconciliationSet->Count(), $oReconciliationFilter->serialize());
|
||||
$aResult[$iRow]["finalclass"]= 'n/a';
|
||||
}
|
||||
|
||||
if (!is_null($this->m_sSynchroScope)) {
|
||||
// Compute the delta between the scope and visited objects
|
||||
$oScopeSearch = DBObjectSearch::FromOQL($this->m_sSynchroScope);
|
||||
$oScopeSet = new DBObjectSet($oScopeSearch);
|
||||
while ($oObj = $oScopeSet->Fetch()) {
|
||||
$iObj = $oObj->GetKey();
|
||||
if (!in_array($iObj, $aVisited)) {
|
||||
set_time_limit(intval($iLoopTimeLimit));
|
||||
$iRow++;
|
||||
$this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
$aResult[$iRow]["__STATUS__"]= new RowStatus_Issue(Dict::Format('UI:CSVReport-Row-Issue-Internal', get_class($e), $e->getMessage()));
|
||||
}
|
||||
} finally {
|
||||
// Send all the retained events for further computations
|
||||
cmdbAbstractObject::SetEventDBLinksChangedBlocked(false);
|
||||
cmdbAbstractObject::FireEventDbLinksChangedForAllObjects();
|
||||
}
|
||||
|
||||
if (!is_null($this->m_sSynchroScope))
|
||||
{
|
||||
// Compute the delta between the scope and visited objects
|
||||
$oScopeSearch = DBObjectSearch::FromOQL($this->m_sSynchroScope);
|
||||
$oScopeSet = new DBObjectSet($oScopeSearch);
|
||||
while ($oObj = $oScopeSet->Fetch())
|
||||
{
|
||||
$iObj = $oObj->GetKey();
|
||||
if (!in_array($iObj, $aVisited))
|
||||
{
|
||||
set_time_limit(intval($iLoopTimeLimit));
|
||||
$iRow++;
|
||||
$this->UpdateMissingObject($aResult, $iRow, $oObj, $oChange);
|
||||
}
|
||||
}
|
||||
}
|
||||
set_time_limit(intval($iPreviousTimeLimit));
|
||||
|
||||
// Fill in the blanks - the result matrix is expected to be 100% complete
|
||||
|
||||
@@ -1611,4 +1611,22 @@ class CMDBSource
|
||||
|
||||
return 'ALTER DATABASE'.CMDBSource::GetSqlStringColumnDefinition().';';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check which mysql client option (--ssl or --ssl-mode) to be used for encrypted connection
|
||||
*
|
||||
* @return bool true if --ssl-mode should be used, false otherwise
|
||||
* @throws \MySQLException
|
||||
*
|
||||
* @link https://dev.mysql.com/doc/refman/5.7/en/connection-options.html#encrypted-connection-options "Command Options for Encrypted Connections"
|
||||
*/
|
||||
public static function IsSslModeDBVersion()
|
||||
{
|
||||
if (static::GetDBVendor() === static::ENUM_DB_VENDOR_MYSQL)
|
||||
{
|
||||
//Mysql 5.7.0 and upper deprecated --ssl and uses --ssl-mode instead
|
||||
return version_compare(static::GetDBVersion(), '5.7.11', '>=');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,15 +131,15 @@ class Config
|
||||
],
|
||||
'event_service.debug.filter_events' => [
|
||||
'type' => 'array',
|
||||
'description' => 'Filter Event Service debug by events',
|
||||
'default' => '',
|
||||
'description' => 'List of events name to filter Event Service debug messages',
|
||||
'default' => [],
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'event_service.debug.filter_sources' => [
|
||||
'type' => 'array',
|
||||
'description' => 'Filter Event Service debug by event sources',
|
||||
'description' => 'List of event sources to filter Event Service debug messages',
|
||||
'default' => '',
|
||||
'value' => '',
|
||||
'source_of_value' => '',
|
||||
@@ -342,11 +342,11 @@ class Config
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'allow_menu_on_linkset' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'Display Action menus in view mode on any LinkedSet with edit_mode != none',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'type' => 'bool',
|
||||
'description' => 'Display Action menus in view mode on any LinkedSet with edit_mode != none',
|
||||
'default' => true,
|
||||
'value' => true,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'allow_target_creation' => [
|
||||
@@ -592,13 +592,29 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'email_css' => [
|
||||
'type' => 'string',
|
||||
'description' => 'CSS that will override the standard stylesheet used for the notifications',
|
||||
'default' => "",
|
||||
'value' => "",
|
||||
'email_transport_smtp.allow_self_signed' => array(
|
||||
'type' => 'bool',
|
||||
'description' => 'Allow self signed peer certificates',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'email_transport_smtp.verify_peer' => array(
|
||||
'type' => 'bool',
|
||||
'description' => 'Verify peer certificate',
|
||||
'default' => true,
|
||||
'value' => true,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
),
|
||||
'email_css' => [
|
||||
'type' => 'string',
|
||||
'description' => 'CSS that will override the standard stylesheet used for the notifications',
|
||||
'default' => "",
|
||||
'value' => "",
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'email_default_sender_address' => [
|
||||
'type' => 'string',
|
||||
@@ -1529,11 +1545,11 @@ class Config
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'security.hide_administrators' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'If true, non-administrator users will not be able to see the administrator accounts, the Administrator profile and the links between the administrator accounts and their profiles.',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'type' => 'bool',
|
||||
'description' => 'If true, non-administrator users will not be able to see the administrator accounts, the Administrator profile and the links between the administrator accounts and their profiles.',
|
||||
'default' => true,
|
||||
'value' => true,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'behind_reverse_proxy' => [
|
||||
@@ -1576,6 +1592,14 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'audit.enable_selection_landing_page' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'If true audit categories must be selected before results are computed (use this setting in case of a lot of audit categories)',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
];
|
||||
|
||||
public function IsProperty($sPropCode)
|
||||
@@ -2453,10 +2477,15 @@ class Config
|
||||
/**
|
||||
* Helper function to initialize a configuration from the page arguments
|
||||
*
|
||||
* @see \Parameters::GetParamForConfigArray() to get aParamValues from {@see Parameters} object hierarchy in setup
|
||||
* @see \WizardController::GetParamForConfigArray() to get aParamValues from {@see \WizardController} object hierarchy in setup
|
||||
*
|
||||
* @param array $aParamValues
|
||||
* @param string|null $sModulesDir
|
||||
* @param ?string $sModulesDir
|
||||
* @param bool $bPreserveModuleSettings
|
||||
*
|
||||
* @return void The current object is modified directly
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
*/
|
||||
|
||||
@@ -52,17 +52,23 @@
|
||||
*/
|
||||
class ContextTag
|
||||
{
|
||||
const TAG_PORTAL = 'GUI:Portal';
|
||||
const TAG_CRON = 'CRON';
|
||||
const TAG_CONSOLE = 'GUI:Console';
|
||||
const TAG_SETUP = 'Setup';
|
||||
const TAG_SYNCHRO = 'Synchro';
|
||||
const TAG_REST = 'REST/JSON';
|
||||
public const TAG_PORTAL = 'GUI:Portal';
|
||||
public const TAG_CRON = 'CRON';
|
||||
public const TAG_CONSOLE = 'GUI:Console';
|
||||
public const TAG_SETUP = 'Setup';
|
||||
public const TAG_SYNCHRO = 'Synchro';
|
||||
public const TAG_REST = 'REST/JSON';
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.0 N°3200
|
||||
*/
|
||||
public const TAG_OBJECT_SEARCH = 'ObjectSearch';
|
||||
|
||||
protected static $aStack = array();
|
||||
|
||||
/**
|
||||
* Store a context tag on the stack
|
||||
*
|
||||
* @param string $sTag
|
||||
*/
|
||||
public function __construct($sTag)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Core\MetaModel\FriendlyNameType;
|
||||
use Combodo\iTop\Service\EventData;
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\Events\EventData;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
|
||||
/**
|
||||
* All objects to be displayed in the application (either as a list or as details)
|
||||
@@ -156,6 +156,18 @@ abstract class DBObject implements iDisplay
|
||||
/** @var \DBObject Source object when updating links */
|
||||
protected $m_oLinkHostObject = null;
|
||||
|
||||
/**
|
||||
* @var array List all the CRUD stack in progress
|
||||
*
|
||||
* The array contains instances of
|
||||
* ['type' => 'type of CRUD operation (INSERT, UPDATE, DELETE)',
|
||||
* 'class' => 'class of the object in the CRUD process',
|
||||
* 'id' => 'id of the object in the CRUD process']
|
||||
*
|
||||
* @since 3.1.0 N°5906
|
||||
*/
|
||||
protected static array $m_aCrudStack = [];
|
||||
|
||||
/**
|
||||
* DBObject constructor.
|
||||
*
|
||||
@@ -180,7 +192,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->m_bFullyLoaded = $this->IsFullyLoaded();
|
||||
$this->m_aTouchedAtt = array();
|
||||
$this->m_aModifiedAtt = array();
|
||||
$this->m_sObjectUniqId = get_class($this).'::'.$this->GetKey().'_'.utils::GetUniqId();
|
||||
$this->m_sObjectUniqId = get_class($this).'::'.$this->GetKey().'_'.uniqId('', true);
|
||||
$this->RegisterEventListeners();
|
||||
return;
|
||||
}
|
||||
@@ -203,7 +215,7 @@ abstract class DBObject implements iDisplay
|
||||
|
||||
$this->UpdateMetaAttributes();
|
||||
|
||||
$this->m_sObjectUniqId = get_class($this).'::0'.'_'.utils::GetUniqId();
|
||||
$this->m_sObjectUniqId = get_class($this).'::0'.'_'.uniqId('', true);
|
||||
$this->RegisterEventListeners();
|
||||
}
|
||||
|
||||
@@ -355,7 +367,7 @@ abstract class DBObject implements iDisplay
|
||||
public function Reload($bAllowAllData = false)
|
||||
{
|
||||
assert($this->m_bIsInDB);
|
||||
$this->FireEvent(EVENT_SERVICE_DB_OBJECT_RELOAD);
|
||||
$this->FireEvent(EVENT_DB_OBJECT_RELOAD);
|
||||
$aRow = MetaModel::MakeSingleRow(get_class($this), $this->m_iKey, false /* must be found */, true /* AllowAllData */);
|
||||
if (empty($aRow))
|
||||
{
|
||||
@@ -411,6 +423,8 @@ abstract class DBObject implements iDisplay
|
||||
$this->m_aOrigValues = array();
|
||||
$this->m_aLoadedAtt = array();
|
||||
$this->m_bCheckStatus = true;
|
||||
$this->m_aCheckIssues = [];
|
||||
$this->m_bSecurityIssue = [];
|
||||
|
||||
// Get the key
|
||||
//
|
||||
@@ -1082,7 +1096,7 @@ abstract class DBObject implements iDisplay
|
||||
if ($aCallInfo["function"] != "ComputeValues") continue;
|
||||
return; //skip!
|
||||
}
|
||||
$this->EventComputeValues();
|
||||
$this->FireEventComputeValues();
|
||||
$this->ComputeValues();
|
||||
}
|
||||
|
||||
@@ -1750,7 +1764,7 @@ abstract class DBObject implements iDisplay
|
||||
*
|
||||
* @param string $sAttCode $sAttCode The code of the attribute
|
||||
* @param array $aReasons To store the reasons why the attribute is read-only (info about the synchro replicas)
|
||||
* @param string $sTargetState The target state in which to evalutate the flags, if empty the current state will be used
|
||||
* @param string $sTargetState The target state in which to evaluate the flags, if empty the current state will be used
|
||||
*
|
||||
* @return integer the binary combination of flags for the given attribute in the given state of the object.
|
||||
* Values can be one of the OPT_ATT_HIDDEN, OPT_ATT_READONLY, OPT_ATT_MANDATORY, ... (see define in metamodel.class.php)
|
||||
@@ -1793,7 +1807,8 @@ abstract class DBObject implements iDisplay
|
||||
$iSynchroFlags |= OPT_ATT_READONLY;
|
||||
}
|
||||
}
|
||||
return $iFlags | $iSynchroFlags; // Combine both sets of flags
|
||||
$iExtensionsFlags = $this->GetExtensionsAttributeFlags($sAttCode, $aReasons, $sTargetState);
|
||||
return $iFlags | $iSynchroFlags | $iExtensionsFlags; // Combine both sets of flags
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1910,7 +1925,9 @@ abstract class DBObject implements iDisplay
|
||||
$sStateAttCode = MetaModel::GetStateAttributeCode($sClass);
|
||||
$iFlags = MetaModel::GetInitialStateAttributeFlags($sClass, $this->Get($sStateAttCode), $sAttCode);
|
||||
}
|
||||
return $iFlags; // No need to care about the synchro flags since we'll be creating a new object anyway
|
||||
|
||||
$iExtensionsFlags = $this->GetExtensionsInitialStateAttributeFlags($sAttCode, $aReasons);
|
||||
return $iFlags | $iExtensionsFlags; // No need to care about the synchro flags since we'll be creating a new object anyway
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2354,8 +2371,9 @@ abstract class DBObject implements iDisplay
|
||||
$this->DoComputeValues();
|
||||
}
|
||||
|
||||
$this->SetReadOnly('No modification allowed during CheckToWrite');
|
||||
$this->EventCheckToWrite(['error_messages' => &$this->m_aCheckIssues]);
|
||||
// Ultimate check - ensure DB integrity
|
||||
$this->SetReadOnly('No modification allowed during CheckToCreate');
|
||||
$this->FireEventCheckToWrite();
|
||||
$this->SetReadWrite();
|
||||
|
||||
$this->DoCheckToWrite();
|
||||
@@ -2385,10 +2403,6 @@ abstract class DBObject implements iDisplay
|
||||
*/
|
||||
protected function DoCheckToDelete(&$oDeletionPlan)
|
||||
{
|
||||
$this->m_aDeleteIssues = array(); // Ok
|
||||
|
||||
$this->EventCheckToDelete(['error_messages' => &$this->m_aDeleteIssues]);
|
||||
|
||||
if ($this->InSyncScope())
|
||||
{
|
||||
|
||||
@@ -2816,7 +2830,7 @@ abstract class DBObject implements iDisplay
|
||||
* @throws \OQLException
|
||||
* @throws \Exception
|
||||
*
|
||||
* @internal
|
||||
* @api
|
||||
*
|
||||
*/
|
||||
public function DBInsert()
|
||||
@@ -2950,150 +2964,161 @@ abstract class DBObject implements iDisplay
|
||||
public function DBInsertNoReload()
|
||||
{
|
||||
$sClass = get_class($this);
|
||||
if (MetaModel::DBIsReadOnly())
|
||||
{
|
||||
$sErrorMessage = "Cannot Insert object of class '$sClass' because of an ongoing maintenance: the database is in ReadOnly mode";
|
||||
|
||||
IssueLog::Error("$sErrorMessage\n".MyHelpers::get_callstack_text(1));
|
||||
throw new CoreException("$sErrorMessage (see the log for more information)");
|
||||
}
|
||||
$this->AddCurrentObjectInCrudStack('INSERT');
|
||||
|
||||
if ($this->m_bIsInDB) {
|
||||
throw new CoreException('The object already exists into the Database, you may want to use the clone function');
|
||||
}
|
||||
try {
|
||||
if (MetaModel::DBIsReadOnly())
|
||||
{
|
||||
$sErrorMessage = "Cannot Insert object of class '$sClass' because of an ongoing maintenance: the database is in ReadOnly mode";
|
||||
|
||||
$sClass = get_class($this);
|
||||
$sRootClass = MetaModel::GetRootClass($sClass);
|
||||
IssueLog::Error("$sErrorMessage\n".MyHelpers::get_callstack_text(1));
|
||||
throw new CoreException("$sErrorMessage (see the log for more information)");
|
||||
}
|
||||
|
||||
// Ensure the update of the values (we are accessing the data directly)
|
||||
$this->DoComputeValues();
|
||||
$this->EventInsertRequested();
|
||||
$this->OnInsert();
|
||||
|
||||
if ($this->m_iKey < 0) {
|
||||
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
|
||||
$this->m_iKey = null;
|
||||
}
|
||||
|
||||
// If not automatically computed, then check that the key is given by the caller
|
||||
if (!MetaModel::IsAutoIncrementKey($sRootClass)) {
|
||||
if (empty($this->m_iKey)) {
|
||||
throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', array('class' => $sRootClass));
|
||||
if ($this->m_bIsInDB) {
|
||||
throw new CoreException('The object already exists into the Database, you may want to use the clone function');
|
||||
}
|
||||
}
|
||||
|
||||
// Ultimate check - ensure DB integrity
|
||||
list($bRes, $aIssues) = $this->CheckToWrite(false);
|
||||
if (!$bRes) {
|
||||
throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey()));
|
||||
}
|
||||
$this->ComputeStopWatchesDeadline(true);
|
||||
$sClass = get_class($this);
|
||||
$sRootClass = MetaModel::GetRootClass($sClass);
|
||||
|
||||
$this->SetReadOnly('No modification allowed during The Event :'.EVENT_SERVICE_DB_ABOUT_TO_INSERT);
|
||||
$this->EventInsertBefore();
|
||||
$this->SetReadWrite();
|
||||
|
||||
$iTransactionRetry = 1;
|
||||
$bIsTransactionEnabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled');
|
||||
if ($bIsTransactionEnabled) {
|
||||
// TODO Deep clone this object before the transaction (to use it in case of rollback)
|
||||
// $iTransactionRetryCount = MetaModel::GetConfig()->Get('db_core_transactions_retry_count');
|
||||
$iTransactionRetryCount = 1;
|
||||
$iTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
|
||||
$iTransactionRetry = $iTransactionRetryCount;
|
||||
}
|
||||
while ($iTransactionRetry > 0) {
|
||||
try {
|
||||
$iTransactionRetry--;
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('START TRANSACTION');
|
||||
// Ensure the update of the values (we are accessing the data directly)
|
||||
$this->DoComputeValues();
|
||||
$this->OnInsert();
|
||||
if ($this->m_iKey < 0) {
|
||||
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
|
||||
$this->m_iKey = null;
|
||||
$this->UpdateCurrentObjectInCrudStack();
|
||||
}
|
||||
// If not automatically computed, then check that the key is given by the caller
|
||||
if (!MetaModel::IsAutoIncrementKey($sRootClass)) {
|
||||
if (empty($this->m_iKey)) {
|
||||
throw new CoreWarning('Missing key for the object to write - This class is supposed to have a user defined key, not an autonumber', array('class' => $sRootClass));
|
||||
}
|
||||
}
|
||||
|
||||
// First query built upon on the root class, because the ID must be created first
|
||||
$this->m_iKey = $this->DBInsertSingleTable($sRootClass);
|
||||
list($bRes, $aIssues) = $this->CheckToWrite(false);
|
||||
if (!$bRes) {
|
||||
throw new CoreCannotSaveObjectException(array('issues' => $aIssues, 'class' => get_class($this), 'id' => $this->GetKey()));
|
||||
}
|
||||
|
||||
// Then do the leaf class, if different from the root class
|
||||
if ($sClass != $sRootClass) {
|
||||
$this->DBInsertSingleTable($sClass);
|
||||
}
|
||||
if ($this->m_iKey < 0) {
|
||||
// This was a temporary "memory" key: discard it so that DBInsertSingleTable will not try to use it!
|
||||
$this->m_iKey = null;
|
||||
}
|
||||
|
||||
// Then do the other classes
|
||||
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
|
||||
if ($sParentClass == $sRootClass) {
|
||||
continue;
|
||||
$this->ComputeStopWatchesDeadline(true);
|
||||
|
||||
$iTransactionRetry = 1;
|
||||
$bIsTransactionEnabled = MetaModel::GetConfig()->Get('db_core_transactions_enabled');
|
||||
if ($bIsTransactionEnabled) {
|
||||
// TODO Deep clone this object before the transaction (to use it in case of rollback)
|
||||
// $iTransactionRetryCount = MetaModel::GetConfig()->Get('db_core_transactions_retry_count');
|
||||
$iTransactionRetryCount = 1;
|
||||
$iTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
|
||||
$iTransactionRetry = $iTransactionRetryCount;
|
||||
}
|
||||
while ($iTransactionRetry > 0) {
|
||||
try {
|
||||
$iTransactionRetry--;
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('START TRANSACTION');
|
||||
}
|
||||
$this->DBInsertSingleTable($sParentClass);
|
||||
}
|
||||
|
||||
$this->OnObjectKeyReady();
|
||||
// First query built upon on the root class, because the ID must be created first
|
||||
$this->m_iKey = $this->DBInsertSingleTable($sRootClass);
|
||||
|
||||
$this->DBWriteLinks();
|
||||
$this->WriteExternalAttributes();
|
||||
// Then do the leaf class, if different from the root class
|
||||
if ($sClass != $sRootClass) {
|
||||
$this->DBInsertSingleTable($sClass);
|
||||
}
|
||||
|
||||
// Write object creation history within the transaction
|
||||
$this->RecordObjCreation();
|
||||
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('COMMIT');
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
IssueLog::Error($e->getMessage());
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('ROLLBACK');
|
||||
if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) {
|
||||
// Deadlock found when trying to get lock; try restarting transaction (only in main transaction)
|
||||
if ($iTransactionRetry > 0) {
|
||||
// wait and retry
|
||||
IssueLog::Error('Insert TRANSACTION Retrying...');
|
||||
usleep(random_int(1, 5) * 1000 * $iTransactionRetryDelay * ($iTransactionRetryCount - $iTransactionRetry));
|
||||
// Then do the other classes
|
||||
foreach (MetaModel::EnumParentClasses($sClass) as $sParentClass) {
|
||||
if ($sParentClass == $sRootClass) {
|
||||
continue;
|
||||
} else {
|
||||
IssueLog::Error('Insert Deadlock TRANSACTION prevention failed.');
|
||||
}
|
||||
$this->DBInsertSingleTable($sParentClass);
|
||||
}
|
||||
|
||||
$this->OnObjectKeyReady();
|
||||
$this->UpdateCurrentObjectInCrudStack();
|
||||
|
||||
$this->DBWriteLinks();
|
||||
$this->WriteExternalAttributes();
|
||||
|
||||
// Write object creation history within the transaction
|
||||
$this->RecordObjCreation();
|
||||
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('COMMIT');
|
||||
}
|
||||
break;
|
||||
}
|
||||
catch (Exception $e) {
|
||||
IssueLog::Error($e->getMessage());
|
||||
if ($bIsTransactionEnabled) {
|
||||
CMDBSource::Query('ROLLBACK');
|
||||
if (!CMDBSource::IsInsideTransaction() && CMDBSource::IsDeadlockException($e)) {
|
||||
// Deadlock found when trying to get lock; try restarting transaction (only in main transaction)
|
||||
if ($iTransactionRetry > 0) {
|
||||
// wait and retry
|
||||
IssueLog::Error('Insert TRANSACTION Retrying...');
|
||||
usleep(random_int(1, 5) * 1000 * $iTransactionRetryDelay * ($iTransactionRetryCount - $iTransactionRetry));
|
||||
continue;
|
||||
} else {
|
||||
IssueLog::Error('Insert Deadlock TRANSACTION prevention failed.');
|
||||
}
|
||||
}
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
$this->m_bIsInDB = true;
|
||||
$this->m_bDirty = false;
|
||||
foreach ($this->m_aCurrValues as $sAttCode => $value) {
|
||||
if (is_object($value)) {
|
||||
$value = clone $value;
|
||||
$this->m_bIsInDB = true;
|
||||
$this->m_bDirty = false;
|
||||
foreach ($this->m_aCurrValues as $sAttCode => $value) {
|
||||
if (is_object($value)) {
|
||||
$value = clone $value;
|
||||
}
|
||||
$this->m_aOrigValues[$sAttCode] = $value;
|
||||
}
|
||||
$this->m_aOrigValues[$sAttCode] = $value;
|
||||
}
|
||||
|
||||
// Prevent DBUpdate at this point (reentrance protection)
|
||||
MetaModel::StartReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
|
||||
// Prevent DBUpdate at this point (reentrance protection)
|
||||
MetaModel::StartReentranceProtection($this);
|
||||
|
||||
$this->EventInsertAfter();
|
||||
$this->AfterInsert();
|
||||
|
||||
// Activate any existing trigger
|
||||
$sClass = get_class($this);
|
||||
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), array(), $aParams);
|
||||
while ($oTrigger = $oSet->Fetch()) {
|
||||
/** @var \Trigger $oTrigger */
|
||||
try {
|
||||
$oTrigger->DoActivate($this->ToArgs('this'));
|
||||
$this->FireEventCreateDone();
|
||||
$this->AfterInsert();
|
||||
|
||||
// Activate any existing trigger
|
||||
$sClass = get_class($this);
|
||||
$aParams = array('class_list' => MetaModel::EnumParentClasses($sClass, ENUM_PARENT_CLASSES_ALL));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT TriggerOnObjectCreate AS t WHERE t.target_class IN (:class_list)'), array(), $aParams);
|
||||
while ($oTrigger = $oSet->Fetch()) {
|
||||
/** @var \Trigger $oTrigger */
|
||||
try {
|
||||
$oTrigger->DoActivate($this->ToArgs('this'));
|
||||
}
|
||||
catch (Exception $e) {
|
||||
utils::EnrichRaisedException($oTrigger, $e);
|
||||
}
|
||||
}
|
||||
|
||||
// - TriggerOnObjectMention
|
||||
$this->ActivateOnMentionTriggers(true);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
utils::EnrichRaisedException($oTrigger, $e);
|
||||
finally {
|
||||
MetaModel::StopReentranceProtection($this);
|
||||
}
|
||||
|
||||
if ($this->IsModified()) {
|
||||
$this->DBUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
// - TriggerOnObjectMention
|
||||
$this->ActivateOnMentionTriggers(true);
|
||||
|
||||
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
|
||||
|
||||
if ($this->IsModified()) {
|
||||
$this->DBUpdate();
|
||||
finally {
|
||||
$this->RemoveCurrentObjectInCrudStack();
|
||||
}
|
||||
|
||||
return $this->m_iKey;
|
||||
@@ -3161,17 +3186,17 @@ abstract class DBObject implements iDisplay
|
||||
// Protect against reentrance (e.g. cascading the update of ticket logs)
|
||||
$sClass = get_class($this);
|
||||
$sKey = $this->GetKey();
|
||||
if (!MetaModel::StartReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this)) {
|
||||
if (!MetaModel::StartReentranceProtection($this)) {
|
||||
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Rejected (reentrance)", LogChannels::DM_CRUD);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$this->AddCurrentObjectInCrudStack('UPDATE');
|
||||
|
||||
try {
|
||||
$this->DoComputeValues();
|
||||
$this->ComputeStopWatchesDeadline(false);
|
||||
$this->EventUpdateRequested();
|
||||
$this->OnUpdate();
|
||||
|
||||
// Freeze the changes at this point
|
||||
@@ -3180,16 +3205,12 @@ abstract class DBObject implements iDisplay
|
||||
if (count($aChanges) == 0)
|
||||
{
|
||||
// Attempting to update an unchanged object
|
||||
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
|
||||
IssueLog::Debug("CRUD: DBUpdate $sClass::$sKey Aborted (no change)", LogChannels::DM_CRUD);
|
||||
|
||||
return $this->m_iKey;
|
||||
}
|
||||
|
||||
// Ultimate check - ensure DB integrity
|
||||
$this->SetReadOnly('No modification allowed during CheckToWrite');
|
||||
list($bRes, $aIssues) = $this->CheckToWrite(false);
|
||||
$this->SetReadWrite();
|
||||
if (!$bRes)
|
||||
{
|
||||
throw new CoreCannotSaveObjectException(['issues' => $aIssues, 'class' => $sClass, 'id' => $this->GetKey()]);
|
||||
@@ -3226,9 +3247,6 @@ abstract class DBObject implements iDisplay
|
||||
$iIsTransactionRetryDelay = MetaModel::GetConfig()->Get('db_core_transactions_retry_delay_ms');
|
||||
$iTransactionRetry = $iTransactionRetryCount;
|
||||
}
|
||||
$this->SetReadOnly('No modification allowed during The Event :'.EVENT_SERVICE_DB_ABOUT_TO_UPDATE);
|
||||
$this->EventUpdateBefore();
|
||||
$this->SetReadWrite();
|
||||
|
||||
while ($iTransactionRetry > 0)
|
||||
{
|
||||
@@ -3356,10 +3374,12 @@ abstract class DBObject implements iDisplay
|
||||
$this->m_bDirty = false;
|
||||
$this->m_aTouchedAtt = array();
|
||||
$this->m_aModifiedAtt = array();
|
||||
|
||||
$bModifiedByUpdateDone = false;
|
||||
try {
|
||||
$this->EventUpdateAfter(['changes' => $aChanges]);
|
||||
$this->FireEventUpdateDone($aChanges);
|
||||
$this->AfterUpdate();
|
||||
// Save the status as it is reset just after...
|
||||
$bModifiedByUpdateDone = $this->IsModified();
|
||||
|
||||
// Reset original values although the object has not been reloaded
|
||||
foreach ($this->m_aLoadedAtt as $sAttCode => $bLoaded) {
|
||||
@@ -3396,10 +3416,11 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
finally
|
||||
{
|
||||
MetaModel::StopReentranceProtection(Metamodel::REENTRANCE_TYPE_UPDATE, $this);
|
||||
MetaModel::StopReentranceProtection($this);
|
||||
$this->RemoveCurrentObjectInCrudStack();
|
||||
}
|
||||
|
||||
if ($this->IsModified()) {
|
||||
if ($this->IsModified() || $bModifiedByUpdateDone) {
|
||||
// Controlled reentrance
|
||||
$this->DBUpdate();
|
||||
}
|
||||
@@ -3607,7 +3628,6 @@ abstract class DBObject implements iDisplay
|
||||
return;
|
||||
}
|
||||
|
||||
$this->EventDeleteBefore();
|
||||
$this->OnDelete();
|
||||
|
||||
// Activate any existing trigger
|
||||
@@ -3718,7 +3738,7 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
}
|
||||
|
||||
$this->EventDeleteAfter();
|
||||
$this->FireEventDeleteDone();
|
||||
$this->AfterDelete();
|
||||
|
||||
|
||||
@@ -3767,7 +3787,7 @@ abstract class DBObject implements iDisplay
|
||||
if ($oDeletionPlan->FoundStopper())
|
||||
{
|
||||
$aIssues = $oDeletionPlan->GetIssues();
|
||||
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
|
||||
throw new DeleteException('Found issue(s)', array('target_class' => get_class($this), 'target_id' => $this->GetKey(), 'issues' => implode(', ', $aIssues)));
|
||||
}
|
||||
|
||||
|
||||
@@ -3788,7 +3808,14 @@ abstract class DBObject implements iDisplay
|
||||
if ($oToDelete->m_bIsInDB)
|
||||
{
|
||||
set_time_limit(intval($iLoopTimeLimit));
|
||||
$oToDelete->DBDeleteSingleObject();
|
||||
|
||||
$oToDelete->AddCurrentObjectInCrudStack('DELETE');
|
||||
try {
|
||||
$oToDelete->DBDeleteSingleObject();
|
||||
}
|
||||
finally {
|
||||
$oToDelete->RemoveCurrentObjectInCrudStack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3922,7 +3949,7 @@ abstract class DBObject implements iDisplay
|
||||
'new_state' => $sNewState,
|
||||
'save_object' => !$bDoNotWrite,
|
||||
];
|
||||
$this->FireEvent(EVENT_SERVICE_DB_BEFORE_APPLY_STIMULUS, $aEventData);
|
||||
$this->FireEvent(EVENT_DB_BEFORE_APPLY_STIMULUS, $aEventData);
|
||||
|
||||
// $aTransitionDef is an
|
||||
// array('target_state'=>..., 'actions'=>array of handlers procs, 'user_restriction'=>TBD
|
||||
@@ -4037,7 +4064,7 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
}
|
||||
|
||||
$this->FireEvent(EVENT_SERVICE_DB_AFTER_APPLY_STIMULUS, $aEventData);
|
||||
$this->FireEvent(EVENT_DB_AFTER_APPLY_STIMULUS, $aEventData);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4047,7 +4074,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->m_aCurrValues[$sAttCode] = $aBackupValues[$sAttCode];
|
||||
}
|
||||
$aEventData['action'] = $sActionDesc;
|
||||
$this->FireEvent(EVENT_SERVICE_DB_APPLY_STIMULUS_FAILED, $aEventData);
|
||||
$this->FireEvent(EVENT_DB_APPLY_STIMULUS_FAILED, $aEventData);
|
||||
}
|
||||
return $bSuccess;
|
||||
}
|
||||
@@ -4854,6 +4881,8 @@ abstract class DBObject implements iDisplay
|
||||
return;
|
||||
}
|
||||
// Check the node itself
|
||||
$this->m_aDeleteIssues = array(); // Ok
|
||||
$this->FireEventCheckToDelete($oDeletionPlan);
|
||||
$this->DoCheckToDelete($oDeletionPlan);
|
||||
$oDeletionPlan->SetDeletionIssues($this, $this->m_aDeleteIssues, $this->m_bSecurityIssue);
|
||||
|
||||
@@ -5609,7 +5638,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->DBWriteArchiveFlag(true);
|
||||
$this->m_aCurrValues['archive_flag'] = true;
|
||||
$this->m_aOrigValues['archive_flag'] = true;
|
||||
$this->EventArchive();
|
||||
$this->FireEventArchive();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5623,7 +5652,7 @@ abstract class DBObject implements iDisplay
|
||||
$this->m_aOrigValues['archive_flag'] = false;
|
||||
$this->m_aCurrValues['archive_date'] = null;
|
||||
$this->m_aOrigValues['archive_date'] = null;
|
||||
$this->EventUnarchive();
|
||||
$this->FireEventUnArchive();
|
||||
}
|
||||
|
||||
|
||||
@@ -5819,13 +5848,70 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sEvent
|
||||
* @api
|
||||
* @param string $sIssue
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
final public function AddCheckIssue(string $sIssue)
|
||||
{
|
||||
$this->m_aCheckIssues[] = $sIssue;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sIssue
|
||||
* @param bool $bIsSecurityIssue
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
final public function AddDeleteIssue(string $sIssue, bool $bIsSecurityIssue = false)
|
||||
{
|
||||
$this->m_aDeleteIssues[] = $sIssue;
|
||||
if ($bIsSecurityIssue) {
|
||||
$this->m_bSecurityIssue = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sAttCode
|
||||
* @param array $aReasons
|
||||
* @param string $sTargetState
|
||||
*
|
||||
* @return int
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function GetExtensionsAttributeFlags(string $sAttCode, array &$aReasons, string $sTargetState): int
|
||||
{
|
||||
return OPT_ATT_NORMAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @api
|
||||
* @param string $sAttCode
|
||||
* @param array $aReasons
|
||||
*
|
||||
* @return int
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function GetExtensionsInitialStateAttributeFlags(string $sAttCode, array &$aReasons): int
|
||||
{
|
||||
return OPT_ATT_NORMAL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEvent
|
||||
* @param array $aEventData
|
||||
* @return void
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \Exception
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function FireEvent($sEvent, $aEventData = array())
|
||||
public function FireEvent(string $sEvent, array $aEventData = array()): void
|
||||
{
|
||||
if (EventService::IsEventRegistered($sEvent)) {
|
||||
$aEventData['debug_info'] = 'from: '.get_class($this).':'.$this->GetKey();
|
||||
@@ -5838,57 +5924,182 @@ abstract class DBObject implements iDisplay
|
||||
}
|
||||
}
|
||||
|
||||
protected function EventInsertRequested()
|
||||
//////////////////
|
||||
/// CREATE
|
||||
///
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventCheckToWrite(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventInsertBefore()
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventCreateDone(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventInsertAfter()
|
||||
/////////////
|
||||
/// UPDATE
|
||||
///
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventUpdateDone(array $aChanges): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventComputeValues()
|
||||
//////////////
|
||||
/// DELETE
|
||||
///
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventCheckToDelete(DeletionPlan $oDeletionPlan): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventCheckToWrite(array $aEventData)
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventDeleteDone(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventCheckToDelete(array $aEventData)
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventComputeValues(): void
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventUpdateRequested()
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventUpdateBefore()
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventUpdateAfter(array $aEventData)
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventDeleteBefore()
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventDeleteAfter()
|
||||
{
|
||||
}
|
||||
|
||||
protected function EventArchive()
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventArchive(): void
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected function EventUnarchive()
|
||||
/**
|
||||
* @return void
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected function FireEventUnArchive(): void
|
||||
{
|
||||
}
|
||||
|
||||
//////////////
|
||||
/// CRUD stack in progress
|
||||
///
|
||||
|
||||
/**
|
||||
* Check if an object is currently involved in CRUD operation
|
||||
*
|
||||
* @param string $sClass
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
final public static function IsObjectCurrentlyInCrud(string $sClass, ?string $sId): bool
|
||||
{
|
||||
// during insert key is reset from -1 to null
|
||||
// so we need to handle null values (will give empty string after conversion)
|
||||
$sConvertedId = (string)$sId;
|
||||
|
||||
foreach (self::$m_aCrudStack as $aCrudStackEntry) {
|
||||
if (($sClass === $aCrudStackEntry['class'])
|
||||
&& ($sConvertedId === $aCrudStackEntry['id'])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an object of the given class is currently involved in CRUD operation
|
||||
*
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
final public static function IsClassCurrentlyInCrud(string $sClass): bool
|
||||
{
|
||||
foreach (self::$m_aCrudStack as $aCrudStackEntry) {
|
||||
if ($sClass === $aCrudStackEntry['class']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the current object to the CRUD stack
|
||||
*
|
||||
* @param string $sCrudType
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
private function AddCurrentObjectInCrudStack(string $sCrudType): void
|
||||
{
|
||||
self::$m_aCrudStack[] = [
|
||||
'type' => $sCrudType,
|
||||
'class' => get_class($this),
|
||||
'id' => (string)$this->GetKey(), // GetKey() doesn't have type hinting, so forcing type to avoid getting an int
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the last entry of the CRUD stack with the information of the current object
|
||||
* This is calls during DBInsert since the object id changes
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
private function UpdateCurrentObjectInCrudStack(): void
|
||||
{
|
||||
$aCurrentCrudStack = array_pop(self::$m_aCrudStack);
|
||||
$aCurrentCrudStack['id'] = (string)$this->GetKey();
|
||||
self::$m_aCrudStack[] = $aCurrentCrudStack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the last entry of the CRUD stack
|
||||
*
|
||||
* @return void
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
private function RemoveCurrentObjectInCrudStack(): void
|
||||
{
|
||||
array_pop(self::$m_aCrudStack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if there are objects in the CRUD stack
|
||||
*
|
||||
* @return bool
|
||||
* @since 3.1.0 N°5609
|
||||
*/
|
||||
final protected function IsCrudStackEmpty(): bool
|
||||
{
|
||||
return count(self::$m_aCrudStack) === 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,18 @@ class DBObjectSet implements iDBObjectSetIterator
|
||||
* @var array
|
||||
*/
|
||||
protected $m_aAttToLoad;
|
||||
/**
|
||||
* @var null|array
|
||||
*/
|
||||
protected $m_aExtendedDataSpec;
|
||||
/**
|
||||
* @var int Maximum number of elements to retrieve
|
||||
*/
|
||||
protected $m_iLimitCount;
|
||||
/**
|
||||
* @var int Offset from which elements should be retrieved
|
||||
*/
|
||||
protected $m_iLimitStart;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
|
||||
@@ -773,14 +773,14 @@ abstract class DBSearch
|
||||
* @see DBSearch::ToOQL()
|
||||
*
|
||||
* @param string $sQuery The OQL to convert to a DBSearch
|
||||
* @param mixed[string] $aParams array of <mixed> params index by <string> name
|
||||
* @param array $aParams array of <mixed> params index by <string> name
|
||||
* @param ModelReflection|null $oMetaModel The MetaModel to use when checking the consistency of the OQL
|
||||
*
|
||||
* @return DBObjectSearch|DBUnionSearch
|
||||
*
|
||||
* @throws OQLException
|
||||
*/
|
||||
static public function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel=null)
|
||||
public static function FromOQL($sQuery, $aParams = null, ModelReflection $oMetaModel=null)
|
||||
{
|
||||
if (empty($sQuery))
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ use DOMDocument;
|
||||
use DOMFormatException;
|
||||
use IssueLog;
|
||||
use LogAPI;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
* Class \Combodo\iTop\DesignDocument
|
||||
|
||||
@@ -110,7 +110,7 @@ class Dict
|
||||
*
|
||||
* @param string $sStringCode The code identifying the dictionary entry
|
||||
* @param string $sDefault Default value if there is no match in the dictionary
|
||||
* @param bool $bUserLanguageOnly True to allow the use of the default language as a fallback, false otherwise
|
||||
* @param bool $bUserLanguageOnly False to allow the use of the default language as a fallback, true otherwise
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -174,7 +174,7 @@ class Dict
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function Format($sFormatCode /*, ... arguments ....*/)
|
||||
public static function Format($sFormatCode /*, ... arguments ... */)
|
||||
{
|
||||
$sLocalizedFormat = self::S($sFormatCode);
|
||||
$aArguments = func_get_args();
|
||||
|
||||
@@ -134,7 +134,7 @@ abstract class DOMSanitizer extends HTMLSanitizer
|
||||
public function DoSanitize($sHTML)
|
||||
{
|
||||
$this->oDoc = new DOMDocument();
|
||||
$this->oDoc->preserveWhitespace = true;
|
||||
$this->oDoc->preserveWhiteSpace = true;
|
||||
|
||||
// MS outlook implements empty lines by the mean of <p><o:p></o:p></p>
|
||||
// We have to transform that into <p><br></p> (which is how Thunderbird implements empty lines)
|
||||
@@ -286,8 +286,8 @@ class HTMLDOMSanitizer extends DOMSanitizer
|
||||
'strong' => array(),
|
||||
'img' => array('src', 'style', 'alt', 'title'),
|
||||
'ul' => array('style'),
|
||||
'ol' => array('style'),
|
||||
'li' => array('style'),
|
||||
'ol' => array('reversed', 'start', 'style', 'type'),
|
||||
'li' => array('style', 'value'),
|
||||
'h1' => array('style'),
|
||||
'h2' => array('style'),
|
||||
'h3' => array('style'),
|
||||
@@ -402,7 +402,7 @@ class HTMLDOMSanitizer extends DOMSanitizer
|
||||
public function LoadDoc($sHTML)
|
||||
{
|
||||
@$this->oDoc->loadHTML('<?xml encoding="UTF-8"?>'.$sHTML); // For loading HTML chunks where the character set is not specified
|
||||
$this->oDoc->preserveWhitespace = true;
|
||||
$this->oDoc->preserveWhiteSpace = true;
|
||||
}
|
||||
|
||||
public function PrintDoc()
|
||||
|
||||
@@ -551,6 +551,12 @@ class LogChannels
|
||||
*/
|
||||
public const NOTIFICATIONS = 'notifications';
|
||||
|
||||
/**
|
||||
* @var string Everything related to the backup / restore
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public const BACKUP = 'backup';
|
||||
|
||||
/**
|
||||
* @since 3.0.0
|
||||
*/
|
||||
@@ -570,6 +576,12 @@ class LogChannels
|
||||
|
||||
public const CORE = 'core';
|
||||
|
||||
/**
|
||||
* @var string Everything related to the datatable component
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public const DATATABLE = 'Datatable';
|
||||
|
||||
public const DEADLOCK = 'DeadLock';
|
||||
|
||||
public const INLINE_IMAGE = 'InlineImage';
|
||||
@@ -577,11 +589,15 @@ class LogChannels
|
||||
public const PORTAL = 'portal';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.0 specific channel for event service
|
||||
* @var string Everything related to the event service
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public const EVENT_SERVICE = 'EventService';
|
||||
|
||||
/**
|
||||
* @var string Everything related to the datamodel CRUD
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public const DM_CRUD = 'DMCRUD';
|
||||
}
|
||||
|
||||
@@ -1035,6 +1051,7 @@ class DeprecatedCallsLog extends LogAPI
|
||||
public const ENUM_CHANNEL_FILE = 'deprecated-file';
|
||||
public const CHANNEL_DEFAULT = self::ENUM_CHANNEL_PHP_METHOD;
|
||||
|
||||
/** @var string Warning this constant won't be used directly ! To see the real default level check {@see GetLevelDefault()} */
|
||||
public const LEVEL_DEFAULT = self::LEVEL_ERROR;
|
||||
|
||||
/** @var \FileLog we want our own instance ! */
|
||||
@@ -1109,7 +1126,12 @@ class DeprecatedCallsLog extends LogAPI
|
||||
}
|
||||
|
||||
$aStack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 4);
|
||||
$iStackDeprecatedMethodLevel = 2; // level 0 = current method, level 1 = @trigger_error, level 2 = method containing the `trigger_error` call
|
||||
$iStackDeprecatedMethodLevel = 2; // level 0 = current method, level 1 = @trigger_error, level 2 = method containing the `trigger_error` call (can be either 'trigger_deprecation' or the faulty method), level 3 = In some cases, method containing the 'trigger_deprecation' call
|
||||
// In case current level is actually a 'trigger_deprecation' call, try to go one level further to get the real deprecated method
|
||||
if (array_key_exists($iStackDeprecatedMethodLevel, $aStack) && ($aStack[$iStackDeprecatedMethodLevel]['function'] === 'trigger_deprecation') && array_key_exists($iStackDeprecatedMethodLevel + 1, $aStack)) {
|
||||
$iStackDeprecatedMethodLevel++;
|
||||
}
|
||||
|
||||
$sDeprecatedObject = $aStack[$iStackDeprecatedMethodLevel]['class'];
|
||||
$sDeprecatedMethod = $aStack[$iStackDeprecatedMethodLevel]['function'];
|
||||
if (($sDeprecatedObject === __CLASS__) && ($sDeprecatedMethod === 'Log')) {
|
||||
@@ -1154,7 +1176,6 @@ class DeprecatedCallsLog extends LogAPI
|
||||
* - else call parent method
|
||||
*
|
||||
* In other words, when in dev mode all deprecated calls will be logged to file
|
||||
*
|
||||
*/
|
||||
protected static function GetLevelDefault(string $sConfigKey)
|
||||
{
|
||||
|
||||
@@ -128,9 +128,17 @@ abstract class MetaModel
|
||||
/** @var string */
|
||||
protected static $m_sEnvironment = 'production';
|
||||
|
||||
public const REENTRANCE_TYPE_UPDATE = 'update';
|
||||
|
||||
protected static $m_aReentranceProtection = [];
|
||||
/**
|
||||
* Objects currently created/updated.
|
||||
*
|
||||
* if an object is already being updated, then this method will return this object instead of recreating a new one.
|
||||
* At this point the method DBUpdate of a new object with the same class and id won't do anything due to reentrance protection,
|
||||
* so to ensure that the potential modifications are correctly saved, the object currently being updated is returned.
|
||||
* DBUpdate() method then will take care that all the modifications will be saved.
|
||||
*
|
||||
* [class][key] -> object
|
||||
*/
|
||||
protected static array $m_aReentranceProtection = [];
|
||||
|
||||
/**
|
||||
* MetaModel constructor.
|
||||
@@ -342,7 +350,7 @@ abstract class MetaModel
|
||||
{
|
||||
self::_check_subclass($sClass);
|
||||
|
||||
return $sClass::GetClassName($sClass);
|
||||
return call_user_func([$sClass, 'GetClassName'], $sClass);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,7 +434,7 @@ abstract class MetaModel
|
||||
{
|
||||
self::_check_subclass($sClass);
|
||||
|
||||
return $sClass::GetClassDescription($sClass);
|
||||
return call_user_func([$sClass, 'GetClassDescription'], $sClass);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2064,6 +2072,43 @@ abstract class MetaModel
|
||||
return $aAttCodesToPrint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sObjectClass class of the object containing the AttributeLinkedSetIndirect (eg: Team)
|
||||
* @param string $sObjectLinkedSetIndirectAttCode code of the AttributeLinkedSetIndirect in the sObjectClass (eg: persons_list in the Team class, pointing to lnkPersonToTeam lnk class)
|
||||
* @param string $sRemoteClass remote class pointed by the lnk class (eg: Person pointed by lnkPersonToTeam)
|
||||
* @param string $sLnkExternalKeyToRemoteClassAttCode in the lnk class, external key to the remote class (eg: person_id in lnkPersonToTeam, pointing to a Person instance)
|
||||
*
|
||||
* @return string[] attcodes to display, containing aliases
|
||||
* @throws \CoreException
|
||||
*
|
||||
* @since 3.0.0 N°2334 added code for n-n relations in {@see BlockIndirectLinksViewTable::GetAttCodesToDisplay}
|
||||
* @since 3.1.0 N°3200 method creation so that it can be used elsewhere
|
||||
*/
|
||||
public static function GetAttributeLinkedSetIndirectDatatableAttCodesToDisplay(string $sObjectClass, string $sObjectLinkedSetIndirectAttCode, string $sRemoteClass, string $sLnkExternalKeyToRemoteClassAttCode):array
|
||||
{
|
||||
$aLnkAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectLinkClass($sObjectClass, $sObjectLinkedSetIndirectAttCode);
|
||||
$aRemoteAttDefsToDisplay = MetaModel::GetZListAttDefsFilteredForIndirectRemoteClass($sRemoteClass);
|
||||
$aLnkAttCodesToDisplay = array_map(
|
||||
function ($oLnkAttDef) {
|
||||
return ormLinkSet::LINK_ALIAS.'.'.$oLnkAttDef->GetCode();
|
||||
},
|
||||
$aLnkAttDefsToDisplay
|
||||
);
|
||||
if (!in_array(ormLinkSet::LINK_ALIAS.'.'.$sLnkExternalKeyToRemoteClassAttCode, $aLnkAttCodesToDisplay)) {
|
||||
// we need to display a link to the remote class instance !
|
||||
$aLnkAttCodesToDisplay[] = ormLinkSet::LINK_ALIAS.'.'.$sLnkExternalKeyToRemoteClassAttCode;
|
||||
}
|
||||
$aRemoteAttCodesToDisplay = array_map(
|
||||
function ($oRemoteAttDef) {
|
||||
return ormLinkSet::REMOTE_ALIAS.'.'.$oRemoteAttDef->GetCode();
|
||||
},
|
||||
$aRemoteAttDefsToDisplay
|
||||
);
|
||||
$aAttCodesToDisplay = array_merge($aLnkAttCodesToDisplay, $aRemoteAttCodesToDisplay);
|
||||
|
||||
return $aAttCodesToDisplay;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sClass
|
||||
* @param string $sListCode
|
||||
@@ -5081,9 +5126,9 @@ abstract class MetaModel
|
||||
|
||||
if (!empty(self::$m_sTablePrefix))
|
||||
{
|
||||
foreach(CMDBSource::EnumTables() as $sTable)
|
||||
foreach(self::DBEnumTables() as $sTable)
|
||||
{
|
||||
// perform a case insensitive test because on Windows the table names become lowercase :-(
|
||||
// perform a case-insensitive test because on Windows the table names become lowercase :-(
|
||||
if (strtolower(substr($sTable, 0, strlen(self::$m_sTablePrefix))) == strtolower(self::$m_sTablePrefix))
|
||||
{
|
||||
CMDBSource::DropTable($sTable);
|
||||
@@ -6796,7 +6841,7 @@ abstract class MetaModel
|
||||
// DBUpdate() method then will take care that all the modifications will be saved.
|
||||
if (array_key_exists($sClassAlias.'id', $aRow)) {
|
||||
$iKey = $aRow[$sClassAlias."id"];
|
||||
$oObject = self::GetReentranceObject(Metamodel::REENTRANCE_TYPE_UPDATE, $sClass, $iKey);
|
||||
$oObject = self::GetReentranceObject($sClass, $iKey);
|
||||
if ($oObject !== false) {
|
||||
return $oObject;
|
||||
}
|
||||
@@ -7561,33 +7606,32 @@ abstract class MetaModel
|
||||
return $oAttDef->GetStyle($sValue);
|
||||
}
|
||||
|
||||
protected static function GetReentranceObject($sType, $sClass, $sKey)
|
||||
protected static function GetReentranceObject($sClass, $sKey)
|
||||
{
|
||||
if (isset(self::$m_aReentranceProtection[$sType][$sClass][$sKey])) {
|
||||
return self::$m_aReentranceProtection[$sType][$sClass][$sKey];
|
||||
if (isset(self::$m_aReentranceProtection[$sClass][$sKey])) {
|
||||
return self::$m_aReentranceProtection[$sClass][$sKey];
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sType
|
||||
* @param \DBObject $oObject
|
||||
*
|
||||
* @return bool true if reentry possible
|
||||
*/
|
||||
public static function StartReentranceProtection($sType, DBObject $oObject)
|
||||
public static function StartReentranceProtection(DBObject $oObject)
|
||||
{
|
||||
if (isset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()])) {
|
||||
if (isset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()])) {
|
||||
return false;
|
||||
}
|
||||
self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()] = $oObject;
|
||||
self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()] = $oObject;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function StopReentranceProtection($sType, DBObject $oObject)
|
||||
public static function StopReentranceProtection(DBObject $oObject)
|
||||
{
|
||||
if (isset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()])) {
|
||||
unset(self::$m_aReentranceProtection[$sType][get_class($oObject)][$oObject->GetKey()]);
|
||||
if (isset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()])) {
|
||||
unset(self::$m_aReentranceProtection[get_class($oObject)][$oObject->GetKey()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2860,9 +2860,26 @@ class FunctionExpression extends Expression
|
||||
{
|
||||
throw new \Exception("Function {$this->m_sVerb} requires 1 argument");
|
||||
}
|
||||
|
||||
// N°5985 - Since PHP 8.1+, a bug fix on \DateTimeInterval for a date anterior to "1937-05-23" now returns a different number of days. The workaround below aim at making the code work with PHP 7.4 => 8.2+
|
||||
//
|
||||
// $oDate = new DateTimeImmutable('2020-01-02');
|
||||
// $oZero = new DateTimeImmutable('1937-05-22');
|
||||
// $iRet = (int) $oDate->diff($oZero)->format('%a');
|
||||
// echo $iRet."\n"; // 30174 (PHP 8.0) vs 30175 (PHP 8.1+)
|
||||
//
|
||||
// $oDate = new DateTimeImmutable('2020-01-02');
|
||||
// $oZero = new DateTimeImmutable('1937-05-23');
|
||||
// $iRet = (int) $oDate->diff($oZero)->format('%a');
|
||||
// echo $iRet."\n"; // 30174 (PHP 8.0) vs 30174 (PHP 8.1+)
|
||||
//
|
||||
// To work around that we take 1970-01-01 as "zero date" and we offset it with the number of days between 1582-01-01 and 1970-01-01.
|
||||
// Note that as the "target" date could be between 1582-01-01 and 1970-01-01 we have to format the interval with the "-"/"+" sign in order to correct the number of days.
|
||||
|
||||
$oDate = new DateTime($this->m_aArgs[0]->Evaluate($aArgs));
|
||||
$oZero = new DateTime('1582-01-01');
|
||||
$iRet = (int) $oDate->diff($oZero)->format('%a') + 577815;
|
||||
$oZero = new DateTime('1970-01-01');
|
||||
$iDaysBetween19700101And15800101 = 141713;
|
||||
$iRet = (int) $oZero->diff($oDate)->format('%R%a') + 577815 + $iDaysBetween19700101And15800101;
|
||||
return $iRet;
|
||||
|
||||
case 'FROM_DAYS':
|
||||
|
||||
@@ -26,6 +26,37 @@
|
||||
|
||||
class OQLException extends CoreException
|
||||
{
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_MyIssue;
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_sInput;
|
||||
/**
|
||||
* @var int
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_iLine;
|
||||
/**
|
||||
* @var int
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_iCol;
|
||||
/**
|
||||
* @var string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_sUnexpected;
|
||||
/**
|
||||
* @var array|null string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
protected $m_aExpecting;
|
||||
|
||||
public function __construct($sIssue, $sInput, $iLine, $iCol, $sUnexpected, $aExpecting = null)
|
||||
{
|
||||
$this->m_MyIssue = $sIssue;
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
use Combodo\iTop\Service\EventData;
|
||||
use Combodo\iTop\Service\EventService;
|
||||
use Combodo\iTop\Service\Events\EventData;
|
||||
use Combodo\iTop\Service\Events\EventService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -219,7 +219,7 @@ class ormDocument
|
||||
'object' => $oObj,
|
||||
'document' => $oDocument,
|
||||
);
|
||||
EventService::FireEvent(new EventData(EVENT_SERVICE_DOWNLOAD_DOCUMENT, $sClass, $aEventData));
|
||||
EventService::FireEvent(new EventData(EVENT_DOWNLOAD_DOCUMENT, $sClass, $aEventData));
|
||||
$oPage->TrashUnexpectedOutput();
|
||||
$oPage->SetContentType($oDocument->GetMimeType());
|
||||
$oPage->SetContentDisposition($sContentDisposition,$oDocument->GetFileName());
|
||||
|
||||
@@ -847,11 +847,30 @@ class ormLinkSet implements iDBObjectSetIterator, Iterator, SeekableIterator
|
||||
}
|
||||
$oLinkSet = new DBObjectSet($oLinkSearch);
|
||||
$oLinkSet->SetShowObsoleteData($bShowObsolete);
|
||||
if ($this->HasDelta())
|
||||
{
|
||||
if ($this->HasDelta()) {
|
||||
$oLinkSet->AddObjectArray($this->aAdded);
|
||||
}
|
||||
|
||||
return $oLinkSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* GetValues.
|
||||
*
|
||||
* @return array of tag codes
|
||||
*/
|
||||
public function GetValues()
|
||||
{
|
||||
$aValues = array();
|
||||
foreach ($this->aPreserved as $sTagCode => $oTag) {
|
||||
$aValues[] = $sTagCode;
|
||||
}
|
||||
foreach ($this->aAdded as $sTagCode => $oTag) {
|
||||
$aValues[] = $sTagCode;
|
||||
}
|
||||
|
||||
sort($aValues);
|
||||
|
||||
return $aValues;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,9 +499,9 @@ final class ormTagSet extends ormSet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sTagCode
|
||||
* @param $sTagLabel
|
||||
*
|
||||
* @return DBObject tag
|
||||
* @return string Tag code
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \CoreException
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,19 @@ use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\MultiColumnUIBlockFactor
|
||||
*/
|
||||
class PDFBulkExport extends HTMLBulkExport
|
||||
{
|
||||
/**
|
||||
* @var string For sample purposes
|
||||
* @internal
|
||||
* @since 2.7.8
|
||||
*/
|
||||
const ENUM_OUTPUT_TYPE_SAMPLE = 'sample';
|
||||
/**
|
||||
* @var string For the real export
|
||||
* @internal
|
||||
* @since 2.7.8
|
||||
*/
|
||||
const ENUM_OUTPUT_TYPE_REAL = 'real';
|
||||
|
||||
public function DisplayUsage(Page $oP)
|
||||
{
|
||||
$oP->p(" * pdf format options:");
|
||||
@@ -197,6 +210,25 @@ EOF
|
||||
return $sPDF;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @since 2.7.8
|
||||
*/
|
||||
protected function GetSampleData($oObj, $sAttCode)
|
||||
{
|
||||
if ($sAttCode !== 'id')
|
||||
{
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
|
||||
|
||||
// As sample data will be displayed in the web browser, AttributeImage needs to be rendered with a regular HTML format, meaning its "src" looking like "data:image/png;base64,iVBORw0KGgoAAAANSUh..."
|
||||
// Whereas for the PDF generation it needs to be rendered with a TCPPDF-compatible format, meaning its "src" looking like "@iVBORw0KGgoAAAANSUh..."
|
||||
if ($oAttDef instanceof AttributeImage) {
|
||||
return $this->GetAttributeImageValue($oAttDef, $oObj->Get($sAttCode), static::ENUM_OUTPUT_TYPE_SAMPLE);
|
||||
}
|
||||
}
|
||||
return parent::GetSampleData($oObj, $sAttCode);
|
||||
}
|
||||
|
||||
protected function GetValue($oObj, $sAttCode)
|
||||
{
|
||||
switch($sAttCode)
|
||||
@@ -212,31 +244,7 @@ EOF
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($oObj), $sAttCode);
|
||||
if ($oAttDef instanceof AttributeImage)
|
||||
{
|
||||
// To limit the image size in the PDF output, we have to enforce the size as height/width because max-width/max-height have no effect
|
||||
//
|
||||
$iDefaultMaxWidthPx = 48;
|
||||
$iDefaultMaxHeightPx = 48;
|
||||
if ($value->IsEmpty())
|
||||
{
|
||||
$iNewWidth = $iDefaultMaxWidthPx;
|
||||
$iNewHeight = $iDefaultMaxHeightPx;
|
||||
|
||||
$sUrl = $oAttDef->Get('default_image');
|
||||
}
|
||||
else
|
||||
{
|
||||
list($iWidth, $iHeight) = utils::GetImageSize($value->GetData());
|
||||
$iMaxWidthPx = min($iDefaultMaxWidthPx, $oAttDef->Get('display_max_width'));
|
||||
$iMaxHeightPx = min($iDefaultMaxHeightPx, $oAttDef->Get('display_max_height'));
|
||||
|
||||
$fScale = min($iMaxWidthPx / $iWidth, $iMaxHeightPx / $iHeight);
|
||||
$iNewWidth = $iWidth * $fScale;
|
||||
$iNewHeight = $iHeight * $fScale;
|
||||
|
||||
$sUrl = 'data:'.$value->GetMimeType().';base64,'.base64_encode($value->GetData());
|
||||
}
|
||||
$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="width: '.$iNewWidth.'px; height: '.$iNewHeight.'px">' : '';
|
||||
$sRet = '<div class="ibo-input-image--image-view">'.$sRet.'</div>';
|
||||
$sRet = $this->GetAttributeImageValue($oAttDef, $value, static::ENUM_OUTPUT_TYPE_REAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -251,6 +259,55 @@ EOF
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \AttributeImage $oAttDef Instance of image attribute
|
||||
* @param \ormDocument $oValue Value of image attribute
|
||||
* @param string $sOutputType {@see \PDFBulkExport::ENUM_OUTPUT_TYPE_SAMPLE}, {@see \PDFBulkExport::ENUM_OUTPUT_TYPE_REAL}
|
||||
*
|
||||
* @return string Rendered value of $oAttDef / $oValue according to the desired $sOutputType
|
||||
* @since 2.7.8
|
||||
*/
|
||||
protected function GetAttributeImageValue(AttributeImage $oAttDef, ormDocument $oValue, string $sOutputType)
|
||||
{
|
||||
// To limit the image size in the PDF output, we have to enforce the size as height/width because max-width/max-height have no effect
|
||||
//
|
||||
$iDefaultMaxWidthPx = 48;
|
||||
$iDefaultMaxHeightPx = 48;
|
||||
if ($oValue->IsEmpty()) {
|
||||
$iNewWidth = $iDefaultMaxWidthPx;
|
||||
$iNewHeight = $iDefaultMaxHeightPx;
|
||||
|
||||
$sUrl = $oAttDef->Get('default_image');
|
||||
} else {
|
||||
list($iWidth, $iHeight) = utils::GetImageSize($oValue->GetData());
|
||||
$iMaxWidthPx = min($iDefaultMaxWidthPx, $oAttDef->Get('display_max_width'));
|
||||
$iMaxHeightPx = min($iDefaultMaxHeightPx, $oAttDef->Get('display_max_height'));
|
||||
|
||||
$fScale = min($iMaxWidthPx / $iWidth, $iMaxHeightPx / $iHeight);
|
||||
$iNewWidth = $iWidth * $fScale;
|
||||
$iNewHeight = $iHeight * $fScale;
|
||||
|
||||
$sValueAsBase64 = base64_encode($oValue->GetData());
|
||||
switch ($sOutputType) {
|
||||
case static::ENUM_OUTPUT_TYPE_SAMPLE:
|
||||
$sUrl = 'data:'.$oValue->GetMimeType().';base64,'.$sValueAsBase64;
|
||||
break;
|
||||
|
||||
case static::ENUM_OUTPUT_TYPE_REAL:
|
||||
default:
|
||||
// TCPDF requires base64-encoded images to be rendered without the usual "data:<MIMETYPE>;base64" header but with an "@"
|
||||
// @link https://tcpdf.org/examples/example_009/
|
||||
$sUrl = '@'.$sValueAsBase64;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$sRet = ($sUrl !== null) ? '<img src="'.$sUrl.'" style="width: '.$iNewWidth.'px; height: '.$iNewHeight.'px;">' : '';
|
||||
$sRet = '<div class="ibo-input-image--image-view">'.$sRet.'</div>';
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
public function GetSupportedFormats()
|
||||
{
|
||||
return array('pdf' => Dict::S('Core:BulkExport:PDFFormat'));
|
||||
|
||||
@@ -30,18 +30,40 @@
|
||||
/**
|
||||
* Element of the response formed by RestResultWithObjects
|
||||
*
|
||||
* @package REST Services
|
||||
* @package RESTAPI
|
||||
* @api
|
||||
*/
|
||||
class ObjectResult
|
||||
{
|
||||
/**
|
||||
* @var int
|
||||
* @api
|
||||
*/
|
||||
public $code;
|
||||
/**
|
||||
* @var string
|
||||
* @api
|
||||
*/
|
||||
public $message;
|
||||
/**
|
||||
* @var mixed|null
|
||||
* @api
|
||||
*/
|
||||
public $class;
|
||||
/**
|
||||
* @var mixed|null
|
||||
* @api
|
||||
*/
|
||||
public $key;
|
||||
/**
|
||||
* @var array
|
||||
* @api
|
||||
*/
|
||||
public $fields;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
* @api
|
||||
*/
|
||||
public function __construct($sClass = null, $iId = null)
|
||||
{
|
||||
@@ -54,11 +76,17 @@ class ObjectResult
|
||||
|
||||
/**
|
||||
* Helper to make an output value for a given attribute
|
||||
*
|
||||
*
|
||||
* @api
|
||||
* @param DBObject $oObject The object being reported
|
||||
* @param string $sAttCode The attribute code (must be valid)
|
||||
* @param boolean $bExtendedOutput Output all of the link set attributes ?
|
||||
*
|
||||
* @return string A scalar representation of the value
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
protected function MakeResultValue(DBObject $oObject, $sAttCode, $bExtendedOutput = false)
|
||||
{
|
||||
@@ -112,11 +140,17 @@ class ObjectResult
|
||||
|
||||
/**
|
||||
* Report the value for the given object attribute
|
||||
*
|
||||
*
|
||||
* @api
|
||||
* @param DBObject $oObject The object being reported
|
||||
* @param string $sAttCode The attribute code (must be valid)
|
||||
* @param boolean $bExtendedOutput Output all of the link set attributes ?
|
||||
*
|
||||
* @return void
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public function AddField(DBObject $oObject, $sAttCode, $bExtendedOutput = false)
|
||||
{
|
||||
@@ -129,8 +163,7 @@ class ObjectResult
|
||||
/**
|
||||
* REST response for services managing objects. Derive this structure to add information and/or constants
|
||||
*
|
||||
* @package Extensibility
|
||||
* @package REST Services
|
||||
* @package RESTAPI
|
||||
* @api
|
||||
*/
|
||||
class RestResultWithObjects extends RestResult
|
||||
@@ -140,13 +173,19 @@ class RestResultWithObjects extends RestResult
|
||||
|
||||
/**
|
||||
* Report the given object
|
||||
*
|
||||
* @param int An error code (RestResult::OK is no issue has been found)
|
||||
*
|
||||
* @api
|
||||
* @param int $iCode An error code (RestResult::OK is no issue has been found)
|
||||
* @param string $sMessage Description of the error if any, an empty string otherwise
|
||||
* @param DBObject $oObject The object being reported
|
||||
* @param array $aFieldSpec An array of class => attribute codes (Cf. RestUtils::GetFieldList). List of the attributes to be reported.
|
||||
* @param array|null $aFieldSpec An array of class => attribute codes (Cf. RestUtils::GetFieldList). List of the attributes to be reported.
|
||||
* @param boolean $bExtendedOutput Output all of the link set attributes ?
|
||||
*
|
||||
* @return void
|
||||
* @throws \ArchivedObjectException
|
||||
* @throws \CoreException
|
||||
* @throws \CoreUnexpectedValue
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public function AddObject($iCode, $sMessage, $oObject, $aFieldSpec = null, $bExtendedOutput = false)
|
||||
{
|
||||
@@ -184,16 +223,30 @@ class RestResultWithObjects extends RestResult
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @package RESTAPI
|
||||
* @api
|
||||
*/
|
||||
class RestResultWithRelations extends RestResultWithObjects
|
||||
{
|
||||
public $relations;
|
||||
|
||||
|
||||
/**
|
||||
* @api
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->relations = array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $sSrcKey
|
||||
* @param $sDestKey
|
||||
*
|
||||
* @return void
|
||||
* @api
|
||||
*/
|
||||
public function AddRelation($sSrcKey, $sDestKey)
|
||||
{
|
||||
if (!array_key_exists($sSrcKey, $this->relations))
|
||||
@@ -207,7 +260,7 @@ class RestResultWithRelations extends RestResultWithObjects
|
||||
/**
|
||||
* Deletion result codes for a target object (either deleted or updated)
|
||||
*
|
||||
* @package Extensibility
|
||||
* @package RESTAPI
|
||||
* @api
|
||||
* @since 2.0.1
|
||||
*/
|
||||
@@ -215,30 +268,37 @@ class RestDelete
|
||||
{
|
||||
/**
|
||||
* Result: Object deleted as per the initial request
|
||||
* @api
|
||||
*/
|
||||
const OK = 0;
|
||||
/**
|
||||
* Result: general issue (user rights or ... ?)
|
||||
* Result: general issue (user rights or ... ?)
|
||||
* @api
|
||||
*/
|
||||
const ISSUE = 1;
|
||||
/**
|
||||
* Result: Must be deleted to preserve database integrity
|
||||
* Result: Must be deleted to preserve database integrity
|
||||
* @api
|
||||
*/
|
||||
const AUTO_DELETE = 2;
|
||||
/**
|
||||
* Result: Must be deleted to preserve database integrity, but that is NOT possible
|
||||
* Result: Must be deleted to preserve database integrity, but that is NOT possible
|
||||
* @api
|
||||
*/
|
||||
const AUTO_DELETE_ISSUE = 3;
|
||||
/**
|
||||
* Result: Must be deleted to preserve database integrity, but this must be requested explicitely
|
||||
* Result: Must be deleted to preserve database integrity, but this must be requested explicitly
|
||||
* @api
|
||||
*/
|
||||
const REQUEST_EXPLICITELY = 4;
|
||||
/**
|
||||
* Result: Must be updated to preserve database integrity
|
||||
* @api
|
||||
*/
|
||||
const AUTO_UPDATE = 5;
|
||||
/**
|
||||
* Result: Must be updated to preserve database integrity, but that is NOT possible
|
||||
* @api
|
||||
*/
|
||||
const AUTO_UPDATE_ISSUE = 6;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class TemplateStringPlaceholder
|
||||
public function __construct($sToken)
|
||||
{
|
||||
$this->sToken = $sToken;
|
||||
$this->sAttcode = '';
|
||||
$this->sAttCode = '';
|
||||
$this->sFunction = '';
|
||||
$this->sParamName = '';
|
||||
$this->bIsValid = false; // Validity may be false in general, but it can work anyway (thanks to specialization) when rendering
|
||||
@@ -90,9 +90,9 @@ class TemplateString
|
||||
$oPlaceholder->sFunction = '';
|
||||
|
||||
$oPlaceholder->sParamName = $sParamName;
|
||||
$sAttcode = substr($sPlaceholder, strlen($sParamPrefix));
|
||||
$oPlaceholder->sAttcode = $sAttcode;
|
||||
$oPlaceholder->bIsValid = MetaModel::IsValidAttCode($sClass, $sAttcode, true /* extended */);
|
||||
$sAttCode = substr($sPlaceholder, strlen($sParamPrefix));
|
||||
$oPlaceholder->sAttCode = $sAttCode;
|
||||
$oPlaceholder->bIsValid = MetaModel::IsValidAttCode($sClass, $sAttCode, true /* extended */);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ class TemplateString
|
||||
$oRef = $aParamValues[$oPlaceholder->sParamName];
|
||||
try
|
||||
{
|
||||
$value = $oRef->Get($oPlaceholder->sAttcode);
|
||||
$value = $oRef->Get($oPlaceholder->sAttCode);
|
||||
$aSearch[] = '$'.$oPlaceholder->sToken.'$';
|
||||
$aReplace[] = $value;
|
||||
$oPlaceholder->bIsValid = true;
|
||||
|
||||
@@ -33,20 +33,22 @@ abstract class Trigger extends cmdbAbstractObject
|
||||
{
|
||||
$aParams = array
|
||||
(
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('description'),
|
||||
"db_table" => "priv_trigger",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "realclass",
|
||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-conflict.svg'),
|
||||
"category" => "grant_by_profile,core/cmdb",
|
||||
"key_type" => "autoincrement",
|
||||
"name_attcode" => "description",
|
||||
"complementary_name_attcode" => array('finalclass'),
|
||||
"state_attcode" => "",
|
||||
"reconc_keys" => array('description'),
|
||||
"db_table" => "priv_trigger",
|
||||
"db_key_field" => "id",
|
||||
"db_finalclass_field" => "realclass",
|
||||
'style' => new ormStyle(null, null, null, null, null, '../images/icons/icons8-conflict.svg'),
|
||||
);
|
||||
MetaModel::Init_Params($aParams);
|
||||
//MetaModel::Init_InheritAttributes();
|
||||
MetaModel::Init_AddAttribute(new AttributeString("description", array("allowed_values" => null, "sql" => "description", "default_value" => null, "is_null_allowed" => false, "depends_on" => array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list", array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeLinkedSetIndirect("action_list",
|
||||
array("linked_class" => "lnkTriggerAction", "ext_key_to_me" => "trigger_id", "ext_key_to_remote" => "action_id", "allowed_values" => null, "count_min" => 1, "count_max" => 0, "depends_on" => array(), "display_style" => 'property')));
|
||||
$aTags = ContextTag::GetTags();
|
||||
MetaModel::Init_AddAttribute( new AttributeEnumSet("context", array("allowed_values" => null, "possible_values" => new ValueSetEnumPadded($aTags), "sql" => "context", "depends_on" => array(), "is_null_allowed" => true, "max_items" => 12)));
|
||||
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@import "bulk/all";
|
||||
@import "display-block/all";
|
||||
@import "linked-set/all";
|
||||
@import "tabular-fields/all";
|
||||
6
css/backoffice/application/bulk/_all.scss
Normal file
6
css/backoffice/application/bulk/_all.scss
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@import "bulk-modify";
|
||||
14
css/backoffice/application/bulk/_bulk-modify.scss
Normal file
14
css/backoffice/application/bulk/_bulk-modify.scss
Normal file
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
.ibo-bulk--bulk-modify--incompatible-attribute {
|
||||
|
||||
&:before{
|
||||
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
|
||||
@extend %fa-solid-base;
|
||||
content: '\f05a';
|
||||
color: $ibo-color-information-500;
|
||||
}
|
||||
}
|
||||
6
css/backoffice/application/linked-set/_all.scss
Normal file
6
css/backoffice/application/linked-set/_all.scss
Normal file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@import "linked-set-selector";
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
.ibo-linked-set--bulk-tooltip-info {
|
||||
font-size: $ibo-font-size-100;
|
||||
&:before{
|
||||
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
|
||||
@extend %fa-solid-base;
|
||||
content: '\f05a';
|
||||
color: $ibo-color-information-500;
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,3 @@ select + label, label + select, label > select,
|
||||
input + label, label + input, label > input {
|
||||
margin-left: $ibo-input--spacing-left--with-label;
|
||||
}
|
||||
|
||||
.ibo-input-with-label--label {
|
||||
&.ibo-has-description {
|
||||
&::after {
|
||||
content: $ibo-field--label--description--content;
|
||||
padding-left: $ibo-field--label--description--padding-left;
|
||||
vertical-align: top;
|
||||
|
||||
cursor: pointer;
|
||||
color: $ibo-field--label--description--color;
|
||||
@extend %ibo-font-ral-bol-50;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -9,9 +9,6 @@ $ibo-alert--padding-x: 20px !default;
|
||||
$ibo-alert--min-height: 30px !default;
|
||||
$ibo-alert--border-radius: $ibo-border-radius-300 !default;
|
||||
|
||||
$ibo-alert--title--highlight--width: 4px !default;
|
||||
$ibo-alert--title--highlight--height: 100% !default;
|
||||
|
||||
$ibo-alert--body--margin-top: $ibo-spacing-200 !default;
|
||||
|
||||
$ibo-alert-minimized--padding-y: 5px !default;
|
||||
@@ -68,14 +65,7 @@ $ibo-alert-colors: (
|
||||
@extend %ibo-font-size-150;
|
||||
|
||||
&::before {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: '';
|
||||
|
||||
width: $ibo-alert--title--highlight--width;
|
||||
height: $ibo-alert--title--highlight--height;
|
||||
@include ibo-vertical-highlight;
|
||||
}
|
||||
|
||||
.ibo-alert--title {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
@import "prop";
|
||||
|
||||
@import "title";
|
||||
@import "datatable";
|
||||
@import "datatable/all";
|
||||
@import "form";
|
||||
@import "fieldset";
|
||||
@import "field";
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
/* SCSS variables */
|
||||
$ibo-field--value--color: $ibo-color-grey-800 !default;
|
||||
|
||||
$ibo-field--label--description--content: "?" !default;
|
||||
$ibo-field--label--description--padding-left: $ibo-spacing-200 !default;
|
||||
$ibo-field--label--description--color: $ibo-color-grey-600 !default;
|
||||
|
||||
$ibo-field--background-color--is-fullscreen: $ibo-color-white-100 !default;
|
||||
|
||||
$ibo-field--label--width--is-fullscreen: 100% !default;
|
||||
@@ -162,18 +158,6 @@ $ibo-field--enable-bulk--checkbox--margin-left: $ibo-spacing-300 !default;
|
||||
width: 30%;
|
||||
word-break: break-word; /* We want labels to wrap if it is very long if it has no spaces */
|
||||
@extend %ibo-font-weight-600;
|
||||
|
||||
> .ibo-has-description {
|
||||
&::after {
|
||||
content: $ibo-field--label--description--content;
|
||||
padding-left: $ibo-field--label--description--padding-left;
|
||||
vertical-align: top;
|
||||
|
||||
cursor: pointer;
|
||||
color: $ibo-field--label--description--color;
|
||||
@extend %ibo-font-ral-bol-50;
|
||||
}
|
||||
}
|
||||
}
|
||||
.ibo-field--label-small .ibo-field--label{
|
||||
width: 20em;
|
||||
|
||||
@@ -1,4 +1,48 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
*/
|
||||
|
||||
/* SCSS variables */
|
||||
$ibo-modal-option--do-not-show-again--margin-top: $ibo-spacing-500 !default;
|
||||
|
||||
$ibo-modal--is-informative--min-width: $ibo-size-700 !default;
|
||||
$ibo-modal--is-informative--min-height: $ibo-size-300 !default;
|
||||
$ibo-modal--is-informative--is-error--highlight--background-color: $ibo-color-red-600 !default;
|
||||
$ibo-modal--is-informative--is-warning--highlight--background-color: $ibo-color-orange-600 !default;
|
||||
$ibo-modal--is-informative--is-information--highlight--background-color: $ibo-color-blue-600 !default;
|
||||
$ibo-modal--is-informative--is-success--highlight--background-color: $ibo-color-green-600 !default;
|
||||
|
||||
// Modal Option - Do not show again
|
||||
.ibo-modal-option--do-not-show-again{
|
||||
margin-top: $ibo-modal-option--do-not-show-again--margin-top;
|
||||
|
||||
.ibo-modal-option--do-not-show-again--checkbox{
|
||||
height: auto;
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-modal.ibo-is-informative{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: $ibo-modal--is-informative--min-width;
|
||||
min-height: $ibo-modal--is-informative--min-height !important; // !important in order to overload jQueryUI CSS rule that's put directly on the element
|
||||
|
||||
&::before {
|
||||
@include ibo-vertical-highlight;
|
||||
}
|
||||
&.ibo-is-error::before {
|
||||
background-color: $ibo-modal--is-informative--is-error--highlight--background-color;
|
||||
}
|
||||
&.ibo-is-warning::before {
|
||||
background-color: $ibo-modal--is-informative--is-warning--highlight--background-color;
|
||||
}
|
||||
&.ibo-is-information::before {
|
||||
background-color: $ibo-modal--is-informative--is-information--highlight--background-color;
|
||||
}
|
||||
&.ibo-is-success::before {
|
||||
background-color: $ibo-modal--is-informative--is-success--highlight--background-color;
|
||||
}
|
||||
}
|
||||
@@ -86,28 +86,27 @@ $ibo-panel--collapsible-toggler--font-size: $ibo-font-size-250 !default;
|
||||
$ibo-panel--collapsible-toggler--color: $ibo-color-grey-700 !default;
|
||||
|
||||
/* Rules */
|
||||
|
||||
|
||||
.ibo-panel {
|
||||
--ibo-main-color: #{map-get($ibo-panel-colors, 'neutral')}; /* --ibo-main-color is to allow overload from custom dynamic value from the DM. The overload will be done through an additional CSS class of a particular DM class or DM attribute */
|
||||
|
||||
position: relative;
|
||||
|
||||
&.ibo-has-icon {
|
||||
.ibo-panel--titles {
|
||||
padding-left: $ibo-panel--icon--spacing;
|
||||
// Note: Direct child selector is mandatory, otherwise a panel within a panel could be affected too when it shouldn't (eg. dashboard in an object, n:n panel)
|
||||
> .ibo-panel--header {
|
||||
.ibo-panel--titles {
|
||||
padding-left: $ibo-panel--icon--spacing;
|
||||
}
|
||||
}
|
||||
|
||||
&.ibo-has-medallion-icon {
|
||||
.ibo-panel--header-left {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-left: $ibo-panel--icon--spacing--as-medallion;
|
||||
}
|
||||
|
||||
// Note: Direct child selector is mandatory, otherwise a panel within a panel could be affected too when it shouldn't (eg. dashboard in an object, n:n panel)
|
||||
> .ibo-panel--header {
|
||||
.ibo-panel--header-left {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-left: $ibo-panel--icon--spacing--as-medallion;
|
||||
|
||||
.ibo-panel--icon {
|
||||
position: absolute;
|
||||
bottom: $ibo-panel--icon--bottom--as-medallion;
|
||||
|
||||
7
css/backoffice/components/datatable/_all.scss
Normal file
7
css/backoffice/components/datatable/_all.scss
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@import "datatable";
|
||||
@import "datatableconfig";
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@@ -151,17 +151,3 @@ $ibo-fieldsorter--selected--background-color: $ibo-color-blue-200 !default;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#table-row-action-confirmation-dialog{
|
||||
|
||||
.ibo-row-action--confirmation--explanation{
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.ibo-row-action--confirmation--do-not-show-again--checkbox{
|
||||
height: auto;
|
||||
display: inline-block;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
}
|
||||
39
css/backoffice/components/datatable/_datatableconfig.scss
Normal file
39
css/backoffice/components/datatable/_datatableconfig.scss
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2022 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
$ibo-datatableconfig--attributes-panel--first-column--margin-x: $ibo-spacing-0 !default;
|
||||
$ibo-datatableconfig--attributes-panel--first-column--margin-y: $ibo-spacing-300 !default;
|
||||
$ibo-datatableconfig--attributes-panel--first-column--max-height: 150px !default;
|
||||
|
||||
$ibo-datatableconfig--attributes-panel--per-page--input--margin-x: $ibo-spacing-200 !default;
|
||||
$ibo-datatableconfig--attributes-panel--per-page--input--margin-y: $ibo-spacing-0 !default;
|
||||
|
||||
$ibo-datatableconfig--settings-panel--option--margin-right: $ibo-spacing-200 !default;
|
||||
|
||||
.ibo-datatableconfig--attributes-panel .ibo-panel--body{
|
||||
@extend %ibo-font-ral-nor-100;
|
||||
}
|
||||
.ibo-datatableconfig--attributes-panel .ibo-multi-column .ibo-column:first-child{
|
||||
margin: $ibo-datatableconfig--attributes-panel--first-column--margin-y $ibo-datatableconfig--attributes-panel--first-column--margin-x;
|
||||
max-height: $ibo-datatableconfig--attributes-panel--first-column--max-height;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.ibo-datatableconfig--attributes-panel--per-page--input{
|
||||
margin: $ibo-datatableconfig--attributes-panel--per-page--input--margin-y $ibo-datatableconfig--attributes-panel--per-page--input--margin-x;
|
||||
}
|
||||
|
||||
.ibo-datatableconfig--settings-panel .ibo-panel--body{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.ibo-datatableconfig--settings-panel--options-container{
|
||||
flex-grow: 1;
|
||||
}
|
||||
.ibo-datatableconfig--settings-panel--option{
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: first baseline;
|
||||
margin-right: $ibo-datatableconfig--settings-panel--option--margin-right;
|
||||
}
|
||||
@@ -4,18 +4,19 @@
|
||||
*/
|
||||
|
||||
$ibo-input-set--padding-x: $ibo-spacing-300 !default;
|
||||
$ibo-input-set--padding-y: 5px !default;
|
||||
$ibo-input-set--padding-y: $ibo-spacing-0 !default;
|
||||
|
||||
$ibo-input-set--input--height: auto !default;
|
||||
$ibo-input-set--input--min-height: $ibo-input--height !default;
|
||||
|
||||
$ibo-input-set--input--height: 100% !default;
|
||||
|
||||
$ibo-input-set--remove--padding-top: 0.15em !default;
|
||||
$ibo-input-set--remove--border-left: none !default;
|
||||
|
||||
$ibo-input-set--has-items--after--right: 8px !default;
|
||||
$ibo-input-set--has-items--after--top: 5px !default;
|
||||
|
||||
$ibo-input-set--item--siblings-spacing: 3px !default;
|
||||
$ibo-input-set--item--margin-y: $ibo-spacing-100 !default;
|
||||
$ibo-input-set--item--margin-y: 1px !default;
|
||||
$ibo-input-set--item--padding-x: 6px !default;
|
||||
$ibo-input-set--item--padding-y: $ibo-spacing-200 !default;
|
||||
$ibo-input-set--item--max-width: 120px !default;
|
||||
@@ -26,6 +27,10 @@ $ibo-input-set--item--box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgb
|
||||
|
||||
|
||||
.ibo-input-set {
|
||||
flex-wrap: wrap;
|
||||
height: $ibo-input-set--input--height;
|
||||
min-height: $ibo-input-set--input--min-height;
|
||||
|
||||
> input {
|
||||
height: $ibo-input-set--input--height;
|
||||
}
|
||||
@@ -36,17 +41,7 @@ $ibo-input-set--item--box-shadow: 0 1px 1px rgba(0, 0, 0, 0.15), 0 0 1px 1px rgb
|
||||
border-left: $ibo-input-set--remove--border-left;
|
||||
}
|
||||
|
||||
&.has-items::after {
|
||||
content: "\f067";
|
||||
font-family: "Font Awesome 5 Free";
|
||||
font-weight: 600;
|
||||
font-size: 10px;
|
||||
|
||||
position: absolute;
|
||||
|
||||
right: $ibo-input-set--has-items--after--right;
|
||||
top: $ibo-input-set--has-items--after--top;
|
||||
}
|
||||
}
|
||||
|
||||
/* CSS rules from the old style, retrieved almost as is. Do not change the classes names in the markup without second thought as they are used by the portal as well */
|
||||
|
||||
@@ -477,10 +477,13 @@ $ibo-navigation-menu--user-info--height--is-expanded: 100% !default;
|
||||
transition-duration: 0.1s;
|
||||
transition-timing-function: linear;
|
||||
|
||||
> .ibo-navigation-menu--menu-group-icon,
|
||||
> .ibo-navigation-menu--menu-group-title{
|
||||
> .ibo-navigation-menu--menu-group-icon{
|
||||
display: flex; /* To avoid end space due to display:inline-block */
|
||||
}
|
||||
.ibo-navigation-menu--menu-group-title{
|
||||
flex-grow: 1;
|
||||
/* Note that display property is not set to flex on purpose so its text has an ellipsis on overflow */
|
||||
}
|
||||
|
||||
&:not(:last-child){
|
||||
margin-bottom: $ibo-navigation-menu--middle-part--elements-spacing;
|
||||
@@ -661,8 +664,8 @@ $ibo-navigation-menu--user-info--height--is-expanded: 100% !default;
|
||||
.ibo-navigation-menu--menu-nodes-title{
|
||||
margin-top: $ibo-navigation-menu--menu-nodes-title--margin-top;
|
||||
margin-bottom: $ibo-navigation-menu--menu-nodes-title--margin-bottom;
|
||||
word-break: break-word; /* Ensure that long words wrap instead of being clipped */
|
||||
@extend %ibo-font-ral-nor-350;
|
||||
@extend %ibo-text-truncated-with-ellipsis;
|
||||
}
|
||||
/* - Menu node */
|
||||
.ibo-navigation-menu--menu-node-title{
|
||||
|
||||
@@ -35,6 +35,8 @@ $ibo-tab-container--extra-tab-toggler--text-color: $ibo-color-grey-700 !default;
|
||||
$ibo-tab-container--extra-tab-toggler--text-color--on-hover: $ibo-color-blue-800 !default;
|
||||
$ibo-tab-container--extra-tab-toggler--background-color--on-hover: $ibo-color-grey-200 !default;
|
||||
|
||||
$ibo-tab-container--extra-tab-toggler--tooltip-title--margin-bottom: $ibo-spacing-500 !default;
|
||||
|
||||
$ibo-tab-container--tab-container--label--text-color: $ibo-color-grey-600 !default;
|
||||
$ibo-tab-container--tab-container--label--spacing: 20px !default;
|
||||
$ibo-tab-container--tab-container--label--margin-bottom: 20px !default;
|
||||
@@ -148,19 +150,24 @@ $ibo-tab-container--tab-container--last--min-height: 60vh !default;
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-tab-container--extra-tab-toggler--tooltip-title {
|
||||
@extend %ibo-font-weight-600;
|
||||
margin-bottom: $ibo-tab-container--extra-tab-toggler--tooltip-title--margin-bottom;
|
||||
}
|
||||
|
||||
.ibo-tab-container--tab-container {
|
||||
padding: $ibo-tab-container--tab-container--padding-y $ibo-tab-container--tab-container--padding-x;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.ibo-tab-container--tab-container-list.ibo-is-scrollable {
|
||||
.ibo-tab-container--tab-container--label {
|
||||
.ibo-tab-container--tab-container:not(:first-child:nth-last-child(2)) .ibo-tab-container--tab-container--label {
|
||||
display: block;
|
||||
}
|
||||
.ibo-tab-container--tab-container {
|
||||
min-height: $ibo-tab-container--tab-container--min-height;
|
||||
}
|
||||
.ibo-tab-container--tab-container:last-child {
|
||||
.ibo-tab-container--tab-container:last-child:not(:only-child) {
|
||||
min-height: $ibo-tab-container--tab-container--last--min-height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,14 @@
|
||||
|
||||
@import "border-radius";
|
||||
@import "color";
|
||||
@import "class-icon";
|
||||
@import "depression";
|
||||
@import "elevation";
|
||||
@import "font-icon";
|
||||
@import "fullscreen";
|
||||
@import "sticky-header";
|
||||
@import "text-decoration";
|
||||
@import "text-position";
|
||||
@import "typography";
|
||||
@import "misc";
|
||||
@import "class-icon";
|
||||
@import "visibility";
|
||||
36
css/backoffice/utils/helpers/_fullscreen.scss
Normal file
36
css/backoffice/utils/helpers/_fullscreen.scss
Normal file
@@ -0,0 +1,36 @@
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/* Used on all ancestors when an element needs to be fullscreen (see .ibo-is-fullscreen) */
|
||||
html.ibo-has-fullscreen-descendant {
|
||||
position: fixed !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
body.ibo-has-fullscreen-descendant {
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.ibo-has-fullscreen-descendant {
|
||||
position: static !important;
|
||||
overflow: visible !important;
|
||||
z-index: 1050 !important;
|
||||
}
|
||||
|
||||
/* Used on a fullscreen element (see .ibo-has-fullscreen-descendant) */
|
||||
.ibo-is-fullscreen {
|
||||
position: absolute;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
z-index: 1050;
|
||||
}
|
||||
@@ -3,191 +3,9 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/* SCSS variables */
|
||||
$ibo-is-code--background-color: $ibo-color-white-200 !default;
|
||||
$ibo-is-code--padding: 1.25rem 1.5rem !default;
|
||||
|
||||
$ibo-sticky-sentinel--left: 0 !default;
|
||||
$ibo-sticky-sentinel--right: 0 !default;
|
||||
$ibo-sticky-sentinel--height: 0 !default;
|
||||
$ibo-sticky-sentinel-top--top: 0 !default;
|
||||
$ibo-sticky-sentinel-top--height: $ibo-sticky-sentinel--height !default;
|
||||
$ibo-sticky-sentinel-bottom--bottom: 0 !default;
|
||||
$ibo-sticky-sentinel-bottom--height: $ibo-sticky-sentinel--height !default;
|
||||
|
||||
/**************/
|
||||
/* Visibility */
|
||||
/**************/
|
||||
.ibo-is-visible {
|
||||
display: inherit !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
.ibo-is-hidden {
|
||||
display: none !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
|
||||
.ibo-is-transparent {
|
||||
opacity: 0 !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
|
||||
.ibo-is-opaque {
|
||||
opacity: 1 !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Disposition / alignement */
|
||||
/****************************/
|
||||
.ibo-is-fullwidth {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
%ibo-fully-centered-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
%ibo-vertically-centered-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Typically to align icons and text as it is a good practice to align them on the baseline and not the "middle" */
|
||||
%ibo-baseline-centered-content {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
/* Note: This might not be named correctly. The intention is to make an element occupy the full height of its parent and to be centered in it */
|
||||
%ibo-full-height-content {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
/**************/
|
||||
/* Fullscreen */
|
||||
/**************/
|
||||
/* Used on all ancestors when an element needs to be fullscreen (see .ibo-is-fullscreen) */
|
||||
html.ibo-has-fullscreen-descendant {
|
||||
position: fixed !important;
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
}
|
||||
|
||||
body.ibo-has-fullscreen-descendant {
|
||||
width: 0 !important;
|
||||
height: 0 !important;
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.ibo-has-fullscreen-descendant {
|
||||
position: static !important;
|
||||
overflow: visible !important;
|
||||
z-index: 1050 !important;
|
||||
}
|
||||
|
||||
/* Used on a fullscreen element (see .ibo-has-fullscreen-descendant) */
|
||||
.ibo-is-fullscreen {
|
||||
position: absolute;
|
||||
top: 0 !important;
|
||||
left: 0 !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
width: 100vw;
|
||||
height: 100vh;
|
||||
overflow: auto;
|
||||
z-index: 1050;
|
||||
}
|
||||
|
||||
/****************/
|
||||
/* Text helpers */
|
||||
/****************/
|
||||
%ibo-text-truncated-with-ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ibo-text-truncated-with-ellipsis {
|
||||
@extend %ibo-text-truncated-with-ellipsis;
|
||||
}
|
||||
|
||||
/* Use this when you want the hyperlink to be of the color of its container's text instead of the global hyperlink color */
|
||||
%ibo-hyperlink-inherited-colors {
|
||||
color: inherit;
|
||||
|
||||
&:hover,
|
||||
&:active {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-is-broken-hyperlink {
|
||||
text-decoration: line-through;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
.ibo-is-code {
|
||||
background-color: $ibo-is-code--background-color;
|
||||
padding: $ibo-is-code--padding;
|
||||
@extend %ibo-font-code-150;
|
||||
}
|
||||
|
||||
.ibo-add-margin-top-250{
|
||||
margin-top: $ibo-spacing-400;
|
||||
}
|
||||
/*
|
||||
* A single class to handle WYSIWYG generated content, where only HTML tags are available
|
||||
* See https://bulma.io/documentation/elements/content/
|
||||
*/
|
||||
.ibo-is-html-content {
|
||||
@extend .content;
|
||||
|
||||
/* Force user-generated tables to fit within the container as they often have an hard-coded width */
|
||||
table {
|
||||
width: unset !important;
|
||||
max-width: max-content;
|
||||
}
|
||||
|
||||
/* For table to render like in CKEditor, works with bulma lib. overload see:
|
||||
* - ../../vendors/_bulma-variables-overload.scss)
|
||||
* - ../../_shame.scss
|
||||
*/
|
||||
table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 2px;
|
||||
}
|
||||
|
||||
/* Preserve original text color in code blocks, except for the Highlight.js blocks which have their own colors */
|
||||
& > code,
|
||||
code:not(.hljs) {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
/* Sticky headers */
|
||||
/* */
|
||||
/* Used as a trigger to make an element stick to another during scroll */
|
||||
/***********************************************************************/
|
||||
|
||||
.ibo-sticky-sentinel {
|
||||
position: absolute;
|
||||
left: $ibo-sticky-sentinel--left;
|
||||
right: $ibo-sticky-sentinel--right;
|
||||
visibility: hidden;
|
||||
}
|
||||
.ibo-sticky-sentinel-top {
|
||||
top: $ibo-sticky-sentinel-top--top;
|
||||
height: $ibo-sticky-sentinel-top--height; /* To be overloaded by use cases */
|
||||
}
|
||||
.ibo-sticky-sentinel-bottom {
|
||||
bottom: $ibo-sticky-sentinel-bottom--bottom;
|
||||
height: $ibo-sticky-sentinel-bottom--height; /* To be overloaded by use cases */
|
||||
}
|
||||
|
||||
|
||||
%ibo-medallion {
|
||||
position: relative;
|
||||
|
||||
35
css/backoffice/utils/helpers/_sticky-header.scss
Normal file
35
css/backoffice/utils/helpers/_sticky-header.scss
Normal file
@@ -0,0 +1,35 @@
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/***********************************************************************/
|
||||
/* Sticky headers */
|
||||
/* */
|
||||
/* Used as a trigger to make an element stick to another during scroll */
|
||||
/***********************************************************************/
|
||||
|
||||
/* SCSS variables */
|
||||
$ibo-sticky-sentinel--left: 0 !default;
|
||||
$ibo-sticky-sentinel--right: 0 !default;
|
||||
$ibo-sticky-sentinel--height: 0 !default;
|
||||
$ibo-sticky-sentinel-top--top: 0 !default;
|
||||
$ibo-sticky-sentinel-top--height: $ibo-sticky-sentinel--height !default;
|
||||
$ibo-sticky-sentinel-bottom--bottom: 0 !default;
|
||||
$ibo-sticky-sentinel-bottom--height: $ibo-sticky-sentinel--height !default;
|
||||
|
||||
/* Rules */
|
||||
.ibo-sticky-sentinel {
|
||||
position: absolute;
|
||||
left: $ibo-sticky-sentinel--left;
|
||||
right: $ibo-sticky-sentinel--right;
|
||||
visibility: hidden;
|
||||
}
|
||||
.ibo-sticky-sentinel-top {
|
||||
top: $ibo-sticky-sentinel-top--top;
|
||||
height: $ibo-sticky-sentinel-top--height; /* To be overloaded by use cases */
|
||||
}
|
||||
.ibo-sticky-sentinel-bottom {
|
||||
bottom: $ibo-sticky-sentinel-bottom--bottom;
|
||||
height: $ibo-sticky-sentinel-bottom--height; /* To be overloaded by use cases */
|
||||
}
|
||||
90
css/backoffice/utils/helpers/_text-decoration.scss
Normal file
90
css/backoffice/utils/helpers/_text-decoration.scss
Normal file
@@ -0,0 +1,90 @@
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/* SCSS variables */
|
||||
$ibo-has-description--content: "?" !default;
|
||||
$ibo-has-description--padding-left: $ibo-spacing-200 !default;
|
||||
$ibo-has-description--color: $ibo-color-grey-600 !default;
|
||||
$ibo-has-description--font-size: 0.7em !default; /* Font size is em on purpose as we want it to be proportional to its context */
|
||||
|
||||
$ibo-is-code--background-color: $ibo-color-white-200 !default;
|
||||
$ibo-is-code--padding: 1.25rem 1.5rem !default;
|
||||
|
||||
/* Rules */
|
||||
%ibo-text-truncated-with-ellipsis {
|
||||
white-space: nowrap;
|
||||
overflow-x: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.ibo-text-truncated-with-ellipsis {
|
||||
@extend %ibo-text-truncated-with-ellipsis;
|
||||
}
|
||||
|
||||
/* Use this when you want the hyperlink to be of the color of its container's text instead of the global hyperlink color */
|
||||
%ibo-hyperlink-inherited-colors {
|
||||
color: inherit;
|
||||
|
||||
&:hover,
|
||||
&:active {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-is-broken-hyperlink {
|
||||
text-decoration: line-through;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
/* Class to display a hint on elements that have a tooltip for further description */
|
||||
.ibo-has-description {
|
||||
&::after {
|
||||
content: $ibo-has-description--content;
|
||||
padding-left: $ibo-has-description--padding-left;
|
||||
vertical-align: top;
|
||||
|
||||
cursor: pointer;
|
||||
color: $ibo-has-description--color;
|
||||
|
||||
/* We don't use a %ibo-font-ral-xxx-yyy as we need a specific size */
|
||||
@extend %ibo-font-weight-700;
|
||||
font-size: $ibo-has-description--font-size;
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-is-code {
|
||||
background-color: $ibo-is-code--background-color;
|
||||
padding: $ibo-is-code--padding;
|
||||
@extend %ibo-font-code-150;
|
||||
}
|
||||
|
||||
/*
|
||||
* A single class to handle WYSIWYG generated content, where only HTML tags are available
|
||||
* See https://bulma.io/documentation/elements/content/
|
||||
*/
|
||||
.ibo-is-html-content {
|
||||
@extend .content;
|
||||
|
||||
/* Force user-generated tables to fit within the container as they often have an hard-coded width */
|
||||
table {
|
||||
width: unset !important;
|
||||
max-width: max-content;
|
||||
}
|
||||
|
||||
/* For table to render like in CKEditor, works with bulma lib. overload see:
|
||||
* - ../../vendors/_bulma-variables-overload.scss)
|
||||
* - ../../_shame.scss
|
||||
*/
|
||||
table {
|
||||
border-collapse: separate;
|
||||
border-spacing: 2px;
|
||||
}
|
||||
|
||||
/* Preserve original text color in code blocks, except for the Highlight.js blocks which have their own colors */
|
||||
& > code,
|
||||
code:not(.hljs) {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
34
css/backoffice/utils/helpers/_text-position.scss
Normal file
34
css/backoffice/utils/helpers/_text-position.scss
Normal file
@@ -0,0 +1,34 @@
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
/****************************/
|
||||
/* Disposition / alignement */
|
||||
/****************************/
|
||||
.ibo-is-fullwidth {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
%ibo-fully-centered-content {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
%ibo-vertically-centered-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Typically to align icons and text as it is a good practice to align them on the baseline and not the "middle" */
|
||||
%ibo-baseline-centered-content {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
/* Note: This might not be named correctly. The intention is to make an element occupy the full height of its parent and to be centered in it */
|
||||
%ibo-full-height-content {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
}
|
||||
21
css/backoffice/utils/helpers/_visibility.scss
Normal file
21
css/backoffice/utils/helpers/_visibility.scss
Normal file
@@ -0,0 +1,21 @@
|
||||
/*!
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
.ibo-is-visible {
|
||||
display: inherit !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
visibility: visible !important;
|
||||
}
|
||||
|
||||
.ibo-is-hidden {
|
||||
display: none !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
|
||||
.ibo-is-transparent {
|
||||
opacity: 0 !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
|
||||
.ibo-is-opaque {
|
||||
opacity: 1 !important; /* Note: !important is necessary as it needs to overload any standard rules */
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2021 Combodo SARL
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
@import "highlight";
|
||||
17
css/backoffice/utils/mixins/_highlight.scss
Normal file
17
css/backoffice/utils/mixins/_highlight.scss
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
$ibo-vertical-highlight--width: $ibo-size-100;
|
||||
$ibo-vertical-highlight--height: 100%;
|
||||
|
||||
@mixin ibo-vertical-highlight {
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
content: "";
|
||||
width: $ibo-vertical-highlight--width;
|
||||
height: $ibo-vertical-highlight--height;
|
||||
}
|
||||
85
css/backoffice/vendors/_selectize.scss
vendored
85
css/backoffice/vendors/_selectize.scss
vendored
@@ -4,10 +4,95 @@
|
||||
*/
|
||||
|
||||
$ibo-vendors-selectize-input--color: $ibo-color-grey-900 !default;
|
||||
$ibo-vendors-selectize-control--plugin-add-button--add-option--right: $ibo-spacing-0 !default;
|
||||
$ibo-vendors-selectize-control--plugin-add-button--add-option--height: 100% !default;
|
||||
$ibo-vendors-selectize-control--plugin-add-button--add-option--width: $ibo-size-350 !default;
|
||||
$ibo-vendors-selectize-control--plugin-add-button--add-option--color: $ibo-color-grey-900 !default;
|
||||
|
||||
$ibo-vendors-selectize--item--icon--margin-right: $ibo-spacing-200 !default;
|
||||
|
||||
$ibo-vendors-selectize--item--add--background-color: $ibo-color-green-100 !default;
|
||||
$ibo-vendors-selectize--item--add--icon--color: $ibo-color-green-900 !default;
|
||||
|
||||
$ibo-vendors-selectize--item--remove--background-color: $ibo-color-red-100 !default;
|
||||
$ibo-vendors-selectize--item--remove--icon--color: $ibo-color-red-800 !default;
|
||||
|
||||
$ibo-vendors-selectize--item--ignore-partial--background-color: $ibo-color-grey-200 !default;
|
||||
|
||||
$ibo-vendors-selectize--input-error--border: 1px solid $ibo-color-red-600 !default;
|
||||
|
||||
.selectize-dropdown-content {
|
||||
max-height: unset; /* Overloaded as it will be handled by the _input-select.scss partial */
|
||||
}
|
||||
.selectize-input input{
|
||||
color: $ibo-vendors-selectize-input--color;
|
||||
}
|
||||
|
||||
|
||||
.selectize-control.plugin-combodo_add_button{
|
||||
display: flex;
|
||||
|
||||
.selectize-add-option {
|
||||
position: absolute;
|
||||
right: $ibo-vendors-selectize-control--plugin-add-button--add-option--right;
|
||||
display: inline-flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: $ibo-vendors-selectize-control--plugin-add-button--add-option--height;
|
||||
width: $ibo-vendors-selectize-control--plugin-add-button--add-option--width;
|
||||
z-index: 1;
|
||||
color: $ibo-vendors-selectize-control--plugin-add-button--add-option--color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Simple options renderer
|
||||
|
||||
.simple-option-renderer--container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.simple-option-renderer--container--icon {
|
||||
width: 25px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.simple-option-renderer--container--label {
|
||||
margin-left: 3px;
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.selectize-input{
|
||||
.attribute-set-item{
|
||||
>* {
|
||||
display: inline;
|
||||
}
|
||||
&.item-add::before,&.item-remove::before{
|
||||
@extend %fa-solid-base;
|
||||
margin-right: $ibo-vendors-selectize--item--icon--margin-right;
|
||||
}
|
||||
&.item-add{
|
||||
background-color: $ibo-vendors-selectize--item--add--background-color !important;
|
||||
&::before{
|
||||
color: $ibo-vendors-selectize--item--add--icon--color;
|
||||
content: '\f067';
|
||||
}
|
||||
}
|
||||
&.item-remove{
|
||||
background-color: $ibo-vendors-selectize--item--remove--background-color !important;
|
||||
&::before{
|
||||
color: $ibo-vendors-selectize--item--remove--icon--color;
|
||||
content: '\f1f8';
|
||||
}
|
||||
}
|
||||
&.item-ignore-partial{
|
||||
background-color: $ibo-vendors-selectize--item--ignore-partial--background-color !important;
|
||||
}
|
||||
}
|
||||
&.selectize-input-error{
|
||||
border: $ibo-vendors-selectize--input-error--border;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'CAS:Error:UserNotAllowed' => 'User not allowed~~',
|
||||
'CAS:Login:SignIn' => 'Sign in with CAS~~',
|
||||
'CAS:Login:SignInTooltip' => 'Click here to authenticate yourself with the CAS server~~',
|
||||
'CAS:Error:UserNotAllowed' => 'Nem engedélyezett felhasználó',
|
||||
'CAS:Login:SignIn' => 'Bejelentkezés CAS szerverrel',
|
||||
'CAS:Login:SignInTooltip' => 'Kattintson ide az azonosításhoz a CAS szerveren',
|
||||
));
|
||||
|
||||
@@ -20,26 +20,26 @@
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Class:UserLocal' => 'ITOP_APPLICATION_SHORT felhasználó',
|
||||
'Class:UserLocal' => ITOP_APPLICATION_SHORT.' felhasználó',
|
||||
'Class:UserLocal+' => '',
|
||||
'Class:UserLocal/Attribute:password' => 'Jelszó',
|
||||
'Class:UserLocal/Attribute:password+' => '',
|
||||
|
||||
'Class:UserLocal/Attribute:expiration' => 'Password expiration~~',
|
||||
'Class:UserLocal/Attribute:expiration+' => 'Password expiration status (requires an extension to have an effect)~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:can_expire' => 'Can expire~~',
|
||||
'Class:UserLocal/Attribute:expiration' => 'Jelszó lejárati ideje',
|
||||
'Class:UserLocal/Attribute:expiration+' => 'Jelszó lejárati státusz (bővítmény szükséges hozzá)',
|
||||
'Class:UserLocal/Attribute:expiration/Value:can_expire' => 'Lejár',
|
||||
'Class:UserLocal/Attribute:expiration/Value:can_expire+' => '~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:never_expire' => 'Never expire~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:never_expire' => 'Soha nem jár le',
|
||||
'Class:UserLocal/Attribute:expiration/Value:never_expire+' => '~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:force_expire' => 'Expired~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:force_expire' => 'Lejárt',
|
||||
'Class:UserLocal/Attribute:expiration/Value:force_expire+' => '~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:otp_expire' => 'One-time Password~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:otp_expire+' => 'Password cannot be changed by the user.~~',
|
||||
'Class:UserLocal/Attribute:password_renewed_date' => 'Password renewal~~',
|
||||
'Class:UserLocal/Attribute:password_renewed_date+' => 'When the password was last changed~~',
|
||||
'Class:UserLocal/Attribute:expiration/Value:otp_expire' => 'Egyszeri jelszó',
|
||||
'Class:UserLocal/Attribute:expiration/Value:otp_expire+' => 'A felhasználó nem változtathat jelszót.',
|
||||
'Class:UserLocal/Attribute:password_renewed_date' => 'Jelszó megújítás',
|
||||
'Class:UserLocal/Attribute:password_renewed_date+' => 'A jelszó legutóbbi módosításának időpontja',
|
||||
|
||||
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'Password must be at least 8 characters and include uppercase, lowercase, numeric and special characters.~~',
|
||||
'Error:UserLocalPasswordValidator:UserPasswordPolicyRegex:ValidationFailed' => 'A jelszónak legalább 8 karakterből kell állnia, és tartalmaznia kell nagybetűket, kisbetűket, numerikus és speciális karaktereket.',
|
||||
|
||||
'UserLocal:password:expiration' => 'The fields below require an extension~~',
|
||||
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'Setting password expiration to "One-time password" is not allowed for your own User~~',
|
||||
'UserLocal:password:expiration' => 'Az alábbi mezőkhöz egy bővítmény szükséges',
|
||||
'Class:UserLocal/Error:OneTimePasswordChangeIsNotAllowed' => 'A jelszó lejárati idejének beállítása "Egyszeri jelszóra" nem engedélyezett a saját Felhasználó számára.',
|
||||
));
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -21,6 +21,8 @@ use Combodo\iTop\Core\MetaModel\HierarchicalKey;
|
||||
|
||||
class DatabaseAnalyzer
|
||||
{
|
||||
const LIMIT = 100;
|
||||
|
||||
var $iTimeLimitPerOperation;
|
||||
|
||||
public function __construct($iTimeLimitPerOperation = null)
|
||||
@@ -45,7 +47,7 @@ class DatabaseAnalyzer
|
||||
set_time_limit(intval($this->iTimeLimitPerOperation));
|
||||
}
|
||||
|
||||
$aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs);
|
||||
$aWrongRecords = CMDBSource::QueryToArray($sSelWrongRecs.' limit '.self::LIMIT);
|
||||
if (count($aWrongRecords) > 0)
|
||||
{
|
||||
foreach($aWrongRecords as $aRes)
|
||||
|
||||
@@ -207,9 +207,13 @@ function DisplayErrorList($aResults)
|
||||
|
||||
foreach ($aResults as $sClass => $aErrorList) {
|
||||
foreach ($aErrorList as $sErrorLabel => $aError) {
|
||||
$iCount = $aError['count'];
|
||||
if ($iCount === DatabaseAnalyzer::LIMIT) {
|
||||
$iCount = "$iCount(+)";
|
||||
}
|
||||
$aRows[] = [
|
||||
'class' => MetaModel::GetName($sClass).' ('.$sClass.')',
|
||||
'count' => $aError['count'],
|
||||
'count' => $iCount,
|
||||
'error' => $sErrorLabel,
|
||||
];
|
||||
}
|
||||
@@ -227,10 +231,19 @@ function DisplayErrorDetails($aResults, $bVerbose)
|
||||
|
||||
foreach ($aResults as $sClass => $aErrorList) {
|
||||
foreach ($aErrorList as $sErrorLabel => $aError) {
|
||||
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $aError['count'], $sErrorLabel);
|
||||
$iCount = $aError['count'];
|
||||
if ($iCount === DatabaseAnalyzer::LIMIT) {
|
||||
$iCount = "$iCount(+)";
|
||||
}
|
||||
$sErrorTitle = Dict::Format('DBTools:DetailedErrorTitle', MetaModel::GetName($sClass).' ('.$sClass.')', $iCount, $sErrorLabel);
|
||||
$oCollapsible = CollapsibleSectionUIBlockFactory::MakeStandard($sErrorTitle);
|
||||
$oBlock->AddSubBlock($oCollapsible);
|
||||
|
||||
if ($aError['count'] === DatabaseAnalyzer::LIMIT) {
|
||||
$oHTML = new Combodo\iTop\Application\UI\Base\Component\Html\Html('<p>'.Dict::format('DBTools:DetailedErrorLimit', DatabaseAnalyzer::LIMIT).'</p>');
|
||||
$oCollapsible->AddSubBlock($oHTML);
|
||||
}
|
||||
|
||||
$oFieldSet = FieldSetUIBlockFactory::MakeStandard(Dict::S('DBTools:SQLquery'));
|
||||
$oCollapsible->AddSubBlock($oFieldSet);
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
|
||||
'DBTools:Inconsistencies' => 'Database inconsistencies',
|
||||
'DBTools:DetailedErrorTitle' => '%2$s error(s) in class %1$s: %3$s',
|
||||
'DBTools:DetailedErrorLimit' => 'List limited to %1$s errors',
|
||||
|
||||
'DBAnalyzer-Integrity-OrphanRecord' => 'Orphan record in `%1$s`, it should have its counterpart in table `%2$s`',
|
||||
'DBAnalyzer-Integrity-InvalidExtKey' => 'Invalid external key %1$s (column: `%2$s.%3$s`)',
|
||||
|
||||
@@ -44,6 +44,7 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
|
||||
'DBTools:Inconsistencies' => 'Incohérences de base de données',
|
||||
'DBTools:DetailedErrorTitle' => '%2$s erreur(s) dans la classe %1$s : %3$s',
|
||||
'DBTools:DetailedErrorLimit' => 'Liste limitée à %1$s erreurs',
|
||||
|
||||
'DBAnalyzer-Integrity-OrphanRecord' => 'Enregistrement orphelin dans `%1$s`, il devrait avoir son équivalent dans la table `%2$s`',
|
||||
'DBAnalyzer-Integrity-InvalidExtKey' => 'Clé externe invalide %1$s (colonne: `%2$s.%3$s`)',
|
||||
|
||||
@@ -23,72 +23,72 @@
|
||||
// Database inconsistencies
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
// Dictionary entries go here
|
||||
'Menu:DBToolsMenu' => 'DB Tools~~',
|
||||
'DBTools:Class' => 'Class~~',
|
||||
'DBTools:Title' => 'Database Maintenance Tools~~',
|
||||
'DBTools:ErrorsFound' => 'Errors Found~~',
|
||||
'DBTools:Indication' => 'Important: after fixing errors in the database you\'ll have to run the analysis again as new inconsistencies will be generated~~',
|
||||
'DBTools:Disclaimer' => 'DISCLAIMER: BACKUP YOUR DATABASE BEFORE RUNNING THE FIXES~~',
|
||||
'DBTools:Error' => 'Error~~',
|
||||
'DBTools:Count' => 'Count~~',
|
||||
'DBTools:SQLquery' => 'SQL query~~',
|
||||
'DBTools:FixitSQLquery' => 'SQL query To Fix it (indication)~~',
|
||||
'DBTools:SQLresult' => 'SQL result~~',
|
||||
'DBTools:NoError' => 'The database is OK~~',
|
||||
'DBTools:HideIds' => 'Error List~~',
|
||||
'DBTools:ShowIds' => 'Detailed view~~',
|
||||
'DBTools:ShowReport' => 'Report~~',
|
||||
'DBTools:IntegrityCheck' => 'Integrity check~~',
|
||||
'DBTools:FetchCheck' => 'Fetch Check (long)~~',
|
||||
'DBTools:SelectAnalysisType' => 'Select analysis type~~',
|
||||
'Menu:DBToolsMenu' => 'DB eszközök',
|
||||
'DBTools:Class' => 'Osztály',
|
||||
'DBTools:Title' => 'Adatbázis karbantartó eszközök',
|
||||
'DBTools:ErrorsFound' => 'Hibák vannak',
|
||||
'DBTools:Indication' => 'Fontos: az adatbázisban lévő hibák kijavítása után újra kell futtatni az elemzést, mivel új következetlenségek keletkeznek.',
|
||||
'DBTools:Disclaimer' => 'A JAVÍTÁSOK FUTTATÁSA ELŐTT MINDIG KÉSZÍTSEN BIZTONSÁGI MENTÉST AZ ADATBÁZISÁRÓL.',
|
||||
'DBTools:Error' => 'Hiba',
|
||||
'DBTools:Count' => 'Sorszám',
|
||||
'DBTools:SQLquery' => 'SQL lekérdezés',
|
||||
'DBTools:FixitSQLquery' => 'SQL lekérdezés To Fix it (indication)',
|
||||
'DBTools:SQLresult' => 'SQL eredmény',
|
||||
'DBTools:NoError' => 'Az adatbázis OK',
|
||||
'DBTools:HideIds' => 'Hibalista',
|
||||
'DBTools:ShowIds' => 'Részletes nézet',
|
||||
'DBTools:ShowReport' => 'Jelentés',
|
||||
'DBTools:IntegrityCheck' => 'Integritás ellenőrzés',
|
||||
'DBTools:FetchCheck' => 'Lehívás ellenőrzés (hosszú)',
|
||||
'DBTools:SelectAnalysisType' => 'Válasszon elemzés típust',
|
||||
|
||||
'DBTools:Analyze' => 'Analyze~~',
|
||||
'DBTools:Details' => 'Show Details~~',
|
||||
'DBTools:ShowAll' => 'Show All Errors~~',
|
||||
'DBTools:Analyze' => 'Elemzés',
|
||||
'DBTools:Details' => 'Részletek mutatása',
|
||||
'DBTools:ShowAll' => 'Minden hiba mutatása',
|
||||
|
||||
'DBTools:Inconsistencies' => 'Database inconsistencies~~',
|
||||
'DBTools:DetailedErrorTitle' => '%2$s error(s) in class %1$s: %3$s~~',
|
||||
'DBTools:Inconsistencies' => 'Adatbázis inkonzisztenciák',
|
||||
'DBTools:DetailedErrorTitle' => '%2$s hiba a %1$s osztályban: %3$s',
|
||||
|
||||
'DBAnalyzer-Integrity-OrphanRecord' => 'Orphan record in `%1$s`, it should have its counterpart in table `%2$s`~~',
|
||||
'DBAnalyzer-Integrity-InvalidExtKey' => 'Invalid external key %1$s (column: `%2$s.%3$s`)~~',
|
||||
'DBAnalyzer-Integrity-MissingExtKey' => 'Missing external key %1$s (column: `%2$s.%3$s`)~~',
|
||||
'DBAnalyzer-Integrity-InvalidValue' => 'Invalid value for %1$s (column: `%2$s.%3$s`)~~',
|
||||
'DBAnalyzer-Integrity-UsersWithoutProfile' => 'Some user accounts have no profile at all~~',
|
||||
'DBAnalyzer-Integrity-HKInvalid' => 'Broken hierarchical key `%1$s`~~',
|
||||
'DBAnalyzer-Fetch-Count-Error' => 'Fetch count error in `%1$s`, %2$d entries fetched / %3$d counted~~',
|
||||
'DBAnalyzer-Integrity-FinalClass' => 'Field `%2$s`.`%1$s` must have the same value as `%3$s`.`%1$s`~~',
|
||||
'DBAnalyzer-Integrity-RootFinalClass' => 'Field `%2$s`.`%1$s` must contains a valid class~~',
|
||||
'DBAnalyzer-Integrity-OrphanRecord' => 'Elárvult rekord a `%1$s` -ban, kell hogy legyen megfelelője a `%2$s` táblázatban',
|
||||
'DBAnalyzer-Integrity-InvalidExtKey' => 'Érvénytelen a %1$s külső kulcs (oszlop: `%2$s.%3$s`)',
|
||||
'DBAnalyzer-Integrity-MissingExtKey' => 'Hiányzik a %1$s külső külcs (oszlop: `%2$s.%3$s`)',
|
||||
'DBAnalyzer-Integrity-InvalidValue' => '%1$s értéke érvénytelen (oszlop: `%2$s.%3$s`)~~',
|
||||
'DBAnalyzer-Integrity-UsersWithoutProfile' => 'Néhány felhasználónak egyáltalán nincs fiókja',
|
||||
'DBAnalyzer-Integrity-HKInvalid' => 'Sérült a `%1$s` hierarchikus kulcs',
|
||||
'DBAnalyzer-Fetch-Count-Error' => 'Lekérési hiba a `%1$s` -nál, %2$d bejegyzés lekérve / %3$d megszámlálva',
|
||||
'DBAnalyzer-Integrity-FinalClass' => 'A `%2$s`.`%1$s` mezőnek ugyanolyan értékűnek kell lennie mint a `%3$s`.`%1$s`',
|
||||
'DBAnalyzer-Integrity-RootFinalClass' => '`%2$s`.`%1$s` mezőnek érvényes osztályt kell tartalmaznia',
|
||||
));
|
||||
|
||||
// Database Info
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'DBTools:DatabaseInfo' => 'Database Information~~',
|
||||
'DBTools:Base' => 'Base~~',
|
||||
'DBTools:Size' => 'Size~~',
|
||||
'DBTools:DatabaseInfo' => 'Adatbázis információ',
|
||||
'DBTools:Base' => 'Bázis',
|
||||
'DBTools:Size' => 'Méret',
|
||||
));
|
||||
|
||||
// Lost attachments
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'DBTools:LostAttachments' => 'Lost attachments~~',
|
||||
'DBTools:LostAttachments:Disclaimer' => 'Here you can search your database for lost or misplaced attachments. This is NOT a data recovery tool, is does not retrieve deleted data.~~',
|
||||
'DBTools:LostAttachments' => 'Elveszett mellékletek',
|
||||
'DBTools:LostAttachments:Disclaimer' => 'Itt kereshet az adatbázisban elveszett vagy elkeveredett mellékletek után. Ez NEM egy adat-visszaállítási eszköz, nem állítja vissza a törölt adatokat.',
|
||||
|
||||
'DBTools:LostAttachments:Button:Analyze' => 'Analyze~~',
|
||||
'DBTools:LostAttachments:Button:Restore' => 'Restore~~',
|
||||
'DBTools:LostAttachments:Button:Restore:Confirm' => 'This action cannot be undone, please confirm that you want to restore the selected files.~~',
|
||||
'DBTools:LostAttachments:Button:Busy' => 'Please wait...~~',
|
||||
'DBTools:LostAttachments:Button:Analyze' => 'Elemzés',
|
||||
'DBTools:LostAttachments:Button:Restore' => 'Visszaállítás',
|
||||
'DBTools:LostAttachments:Button:Restore:Confirm' => 'Ez a művelet nem vonható vissza, kérjük, erősítse meg, hogy vissza kívánja-e állítani a kiválasztott fájlokat.',
|
||||
'DBTools:LostAttachments:Button:Busy' => 'Kérem várjon...',
|
||||
|
||||
'DBTools:LostAttachments:Step:Analyze' => 'First, search for lost/misplaced attachments by analyzing the database.~~',
|
||||
'DBTools:LostAttachments:Step:Analyze' => 'Először az adatbázis elemzésével keresse meg az elveszett/áthelyezett mellékleteket.',
|
||||
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults' => 'Analyze results:~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:None' => 'Great! Every thing seems to be at the right place.~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Some' => 'Some attachments (%1$d) seem to be misplaced. Take a look at the following list and check the ones you would like to move.~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:Filename' => 'Filename~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:CurrentLocation' => 'Current location~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:TargetLocation' => 'Move to...~~',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults' => 'Elemzés eredménye:',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:None' => 'Nagyszerű! Úgy tűnik, minden a helyén van.',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Some' => 'Úgy tűnik, hogy néhány melléklet (%1$d) rossz helyen van. Nézze meg az alábbi listát, és ellenőrizze azokat, amelyeket szeretne áthelyezni.',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:Filename' => 'Fájlnév',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:CurrentLocation' => 'Jelenlegi helye',
|
||||
'DBTools:LostAttachments:Step:AnalyzeResults:Item:TargetLocation' => 'Áthelyezés...',
|
||||
|
||||
'DBTools:LostAttachments:Step:RestoreResults' => 'Restore results:~~',
|
||||
'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d attachments were restored.~~',
|
||||
'DBTools:LostAttachments:Step:RestoreResults' => 'Visszaállítás eredménye:',
|
||||
'DBTools:LostAttachments:Step:RestoreResults:Results' => '%1$d/%2$d melléklet lett visszaállítva.',
|
||||
|
||||
'DBTools:LostAttachments:StoredAsInlineImage' => 'Stored as inline image~~',
|
||||
'DBTools:LostAttachments:History' => 'Attachment "%1$s" restored with DB tools~~'
|
||||
'DBTools:LostAttachments:StoredAsInlineImage' => 'Soron belüli képként tárolva',
|
||||
'DBTools:LostAttachments:History' => 'A "%1$s" melléklet visszaállítva a DB eszközzel'
|
||||
));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
namespace Combodo\iTop\DBTools\Service;
|
||||
|
||||
use CoreException;
|
||||
use DatabaseAnalyzer;
|
||||
use Dict;
|
||||
use DictExceptionMissingString;
|
||||
use MetaModel;
|
||||
@@ -38,6 +39,9 @@ class DBAnalyzerUtils
|
||||
fwrite($fReport, "\r\n-- \r\n");
|
||||
fwrite($fReport, '-- Class: '.MetaModel::GetName($sClass).' ('.$sClass.")\r\n");
|
||||
$iCount = $aError['count'];
|
||||
if ($iCount === DatabaseAnalyzer::LIMIT) {
|
||||
$iCount = "$iCount(+)";
|
||||
}
|
||||
fwrite($fReport, '-- Count: '.$iCount."\r\n");
|
||||
fwrite($fReport, '-- Error: '.$sErrorLabel."\r\n");
|
||||
if (array_key_exists('query', $aError)) {
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
</class>
|
||||
</classes>
|
||||
<events>
|
||||
<event id="EVENT_SERVICE_ADD_ATTACHMENT_TO_OBJECT" _delta="define">
|
||||
<event id="EVENT_ADD_ATTACHMENT_TO_OBJECT" _delta="define">
|
||||
<description>An attachment has been added to an object</description>
|
||||
<replaces>Attachment::AfterUpdate</replaces>
|
||||
<sources>
|
||||
@@ -278,7 +278,7 @@
|
||||
</event_datum>
|
||||
</event_data>
|
||||
</event>
|
||||
<event id="EVENT_SERVICE_REMOVE_ATTACHMENT_FROM_OBJECT" _delta="define">
|
||||
<event id="EVENT_REMOVE_ATTACHMENT_FROM_OBJECT" _delta="define">
|
||||
<description>An attachment has been removed from an object</description>
|
||||
<replaces>Attachment::AfterUpdate</replaces>
|
||||
<sources>
|
||||
|
||||
@@ -21,26 +21,24 @@
|
||||
* along with iTop. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Attachments:TabTitle_Count' => 'Attachments (%1$d)~~',
|
||||
'Attachments:EmptyTabTitle' => 'Attachments~~',
|
||||
'Attachments:FieldsetTitle' => 'Attachments~~',
|
||||
'Attachments:DeleteBtn' => 'Delete~~',
|
||||
'Attachments:History_File_Added' => 'Attachment %1$s added.~~',
|
||||
'Attachments:History_File_Removed' => 'Attachment %1$s removed.~~',
|
||||
'Attachments:AddAttachment' => 'Add attachment: ~~',
|
||||
'Attachments:UploadNotAllowedOnThisSystem' => 'File upload in NOT allowed on this system.~~',
|
||||
'Attachment:Max_Go' => '(Maximum file size: %1$s Go)~~',
|
||||
'Attachment:Max_Mo' => '(Maximum file size: %1$s Mo)~~',
|
||||
'Attachment:Max_Ko' => '(Maximum file size: %1$s Ko)~~',
|
||||
'Attachments:NoAttachment' => 'No attachment. ~~',
|
||||
'Attachments:PreviewNotAvailable' => 'Preview not available for this type of attachment.~~',
|
||||
'Attachments:Error:FileTooLarge' => 'File is too large to be uploaded. %1$s~~',
|
||||
'Attachments:Error:UploadedFileEmpty' => 'The received file is empty and cannot be attached.
|
||||
Either you have pushed an empty file,
|
||||
or ask your iTop administrator if the iTop server disk is full.~~',
|
||||
'Attachments:Render:Icons' => 'Display as icons~~',
|
||||
'Attachments:Render:Table' => 'Display as list~~',
|
||||
'UI:Attachments:DropYourFileHint' => 'Drop files anywhere in this area~~',
|
||||
'Attachments:TabTitle_Count' => 'Mellékletek (%1$d)',
|
||||
'Attachments:EmptyTabTitle' => 'Mellékletek',
|
||||
'Attachments:FieldsetTitle' => 'Mellékletek',
|
||||
'Attachments:DeleteBtn' => 'Törlés',
|
||||
'Attachments:History_File_Added' => '%1$s melléklet hozzáadva',
|
||||
'Attachments:History_File_Removed' => '%1$s melléklet eltávolítva',
|
||||
'Attachments:AddAttachment' => 'Melléklet hozzáadása: ',
|
||||
'Attachments:UploadNotAllowedOnThisSystem' => 'A fájlfeltöltés nem engedélyezett ezen a rendszeren',
|
||||
'Attachment:Max_Go' => '(Maximum fájlméret: %1$s GB)',
|
||||
'Attachment:Max_Mo' => '(Maximum fájlméret: %1$s MB)',
|
||||
'Attachment:Max_Ko' => '(Maximum fájlméret: %1$s KB)',
|
||||
'Attachments:NoAttachment' => 'Nincs melléklet. ',
|
||||
'Attachments:PreviewNotAvailable' => 'Az előnézet nem érhető el ilyen típusú melléklethez',
|
||||
'Attachments:Error:FileTooLarge' => 'Túl nagy a fájl a feltöltéshez. %1$s',
|
||||
'Attachments:Error:UploadedFileEmpty' => 'A kapott fájl üres, ezért nem csatolható. Vagy egy üres fájlt tolt be, vagy kérdezze meg a rendszergazdát, hátha az iTop szerver lemeze telt meg.',
|
||||
'Attachments:Render:Icons' => 'Mutassa ikonként',
|
||||
'Attachments:Render:Table' => 'Mutassa listaként',
|
||||
'UI:Attachments:DropYourFileHint' => 'Húzza a fájlokat erre a területre',
|
||||
));
|
||||
|
||||
//
|
||||
@@ -48,40 +46,40 @@ or ask your iTop administrator if the iTop server disk is full.~~',
|
||||
//
|
||||
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Class:Attachment' => 'Attachment~~',
|
||||
'Class:Attachment' => 'Mellékletek',
|
||||
'Class:Attachment+' => '~~',
|
||||
'Class:Attachment/Attribute:expire' => 'Expire~~',
|
||||
'Class:Attachment/Attribute:expire' => 'Lejárat',
|
||||
'Class:Attachment/Attribute:expire+' => '~~',
|
||||
'Class:Attachment/Attribute:temp_id' => 'Temporary id~~',
|
||||
'Class:Attachment/Attribute:temp_id' => 'Átmeneti azonosító',
|
||||
'Class:Attachment/Attribute:temp_id+' => '~~',
|
||||
'Class:Attachment/Attribute:item_class' => 'Item class~~',
|
||||
'Class:Attachment/Attribute:item_class' => 'Elem osztály',
|
||||
'Class:Attachment/Attribute:item_class+' => '~~',
|
||||
'Class:Attachment/Attribute:item_id' => 'Item~~',
|
||||
'Class:Attachment/Attribute:item_id' => 'Elem',
|
||||
'Class:Attachment/Attribute:item_id+' => '~~',
|
||||
'Class:Attachment/Attribute:item_org_id' => 'Item organization~~',
|
||||
'Class:Attachment/Attribute:item_org_id' => 'Elem szervezet',
|
||||
'Class:Attachment/Attribute:item_org_id+' => '~~',
|
||||
'Class:Attachment/Attribute:contents' => 'Contents~~',
|
||||
'Class:Attachment/Attribute:contents' => 'Tartalomjegyzék',
|
||||
'Class:Attachment/Attribute:contents+' => '~~',
|
||||
));
|
||||
|
||||
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Attachments:File:Thumbnail' => 'Icon~~',
|
||||
'Attachments:File:Name' => 'File name~~',
|
||||
'Attachments:File:Date' => 'Upload date~~',
|
||||
'Attachments:File:Uploader' => 'Uploaded by~~',
|
||||
'Attachments:File:Size' => 'Size~~',
|
||||
'Attachments:File:MimeType' => 'Type~~',
|
||||
'Attachments:File:Thumbnail' => 'Ikon',
|
||||
'Attachments:File:Name' => 'Fájlnév',
|
||||
'Attachments:File:Date' => 'Feltöltés dátum',
|
||||
'Attachments:File:Uploader' => 'Feltöltötte ',
|
||||
'Attachments:File:Size' => 'Méret',
|
||||
'Attachments:File:MimeType' => 'Típus',
|
||||
));
|
||||
//
|
||||
// Class: Attachment
|
||||
//
|
||||
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
'Class:Attachment/Attribute:creation_date' => 'Creation date~~',
|
||||
'Class:Attachment/Attribute:creation_date' => 'Létrehozás dátum',
|
||||
'Class:Attachment/Attribute:creation_date+' => '~~',
|
||||
'Class:Attachment/Attribute:user_id' => 'User id~~',
|
||||
'Class:Attachment/Attribute:user_id' => 'Felhasználói azonosító',
|
||||
'Class:Attachment/Attribute:user_id+' => '~~',
|
||||
'Class:Attachment/Attribute:contact_id' => 'Contact id~~',
|
||||
'Class:Attachment/Attribute:contact_id' => 'Kapcsolattartó azonosító',
|
||||
'Class:Attachment/Attribute:contact_id+' => '~~',
|
||||
));
|
||||
|
||||
@@ -305,7 +305,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
|
||||
if (in_array($oAttachment->GetKey(), $aRemovedAttachmentIds))
|
||||
{
|
||||
$aData = ['target_object' => $oObject];
|
||||
$oAttachment->FireEvent(EVENT_SERVICE_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
|
||||
$oAttachment->FireEvent(EVENT_REMOVE_ATTACHMENT_FROM_OBJECT, $aData);
|
||||
$oAttachment->DBDelete();
|
||||
$aActions[] = self::GetActionChangeOp($oAttachment, false /* false => deletion */);
|
||||
}
|
||||
@@ -335,7 +335,7 @@ class AttachmentPlugIn implements iApplicationUIExtension, iApplicationObjectExt
|
||||
// temporary attachment confirmed, list it in the history
|
||||
$aActions[] = self::GetActionChangeOp($oAttachment, true /* true => creation */);
|
||||
$aData = ['target_object' => $oObject];
|
||||
$oAttachment->FireEvent(EVENT_SERVICE_ADD_ATTACHMENT_TO_OBJECT, $aData);
|
||||
$oAttachment->FireEvent(EVENT_ADD_ATTACHMENT_TO_OBJECT, $aData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ auth_pwd = admin
|
||||
# Full path or relative to current directory
|
||||
#
|
||||
# Formatting rules:
|
||||
# %Y-%m-%d => 2011-01-25... see PHP documentation of strftime()
|
||||
# %Y-%m-%d => 2011-01-25... see PHP documentation of strftime() (https://www.php.net/manual/fr/function.strftime.php)
|
||||
# Placeholders:
|
||||
# __HOST__ MySQL server
|
||||
# __DB__ Database name
|
||||
|
||||
@@ -69,7 +69,7 @@ function Usage($oP)
|
||||
$oP->p('auth_user: login, must be administrator');
|
||||
$oP->p('auth_pwd: ...');
|
||||
}
|
||||
$oP->p('backup_file [optional]: name of the file to store the backup into. Follows the PHP strftime format spec. The following placeholders are available: __HOST__, __DB__, __SUBNAME__');
|
||||
$oP->p('backup_file [optional]: name of the file to store the backup into. Follows the PHP strftime() format spec (https://www.php.net/manual/fr/function.strftime.php). The following placeholders are available: __HOST__, __DB__, __SUBNAME__');
|
||||
$oP->p('simulate [optional]: set to check the name of the file that would be created');
|
||||
$oP->p('mysql_bindir [optional]: specify the path for mysqldump');
|
||||
|
||||
|
||||
@@ -108,20 +108,9 @@ function MakeArchiveFileName($iRefTime = null)
|
||||
$sDefaultBackupFileName = sys_get_temp_dir().'/'."__DB__-%Y-%m-%d";
|
||||
$sBackupFile = utils::ReadParam('backup_file', $sDefaultBackupFileName, true, 'raw_data');
|
||||
|
||||
$oConfig = GetConfig();
|
||||
|
||||
$sBackupFile = str_replace('__HOST__', $oConfig->Get('db_host'), $sBackupFile);
|
||||
$sBackupFile = str_replace('__DB__', $oConfig->Get('db_name'), $sBackupFile);
|
||||
$sBackupFile = str_replace('__SUBNAME__', $oConfig->Get('db_subname'), $sBackupFile);
|
||||
|
||||
if (is_null($iRefTime))
|
||||
{
|
||||
$sBackupFile = strftime($sBackupFile);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sBackupFile = strftime($sBackupFile, $iRefTime);
|
||||
}
|
||||
$oBackup = new DBBackup();
|
||||
$oDateTime = $iRefTime !== null ? new DateTime($iRefTime) : new DateTime();
|
||||
$sBackupFile = $oBackup->MakeName($sBackupFile, $oDateTime);
|
||||
|
||||
return $sBackupFile;
|
||||
}
|
||||
|
||||
@@ -22,39 +22,39 @@
|
||||
*/
|
||||
Dict::Add('HU HU', 'Hungarian', 'Magyar', array(
|
||||
|
||||
'bkp-backup-running' => 'A backup is running. Please wait...~~',
|
||||
'bkp-restore-running' => 'A restore is running. Please wait...~~',
|
||||
'bkp-backup-running' => 'A backup fut. Kérem várjon...',
|
||||
'bkp-restore-running' => 'A visszaállítás fut. Kérem várjon...',
|
||||
|
||||
'Menu:BackupStatus' => 'Scheduled Backups~~',
|
||||
'bkp-status-title' => 'Scheduled Backups~~',
|
||||
'bkp-status-checks' => 'Settings and checks~~',
|
||||
'bkp-mysqldump-ok' => 'mysqldump is present: %1$s~~',
|
||||
'bkp-mysqldump-notfound' => 'mysqldump could not be found: %1$s - Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir.~~',
|
||||
'bkp-mysqldump-issue' => 'mysqldump could not be executed (retcode=%1$d): Please make sure it is installed and in the path, or edit the configuration file to tune mysql_bindir~~',
|
||||
'bkp-missing-dir' => 'The target directory <code>%1$s</code> could not be found~~',
|
||||
'bkp-free-disk-space' => '<b>%1$s free</b> in <code>%2$s</code>~~',
|
||||
'bkp-dir-not-writeable' => '%1$s is not writeable~~',
|
||||
'bkp-wrong-format-spec' => 'The current specification to format the file names is wrong (%1$s). A default specification will apply: %2$s~~',
|
||||
'bkp-name-sample' => 'Backup files are named depending on DB identifiers, date and time. Example: %1$s~~',
|
||||
'bkp-week-days' => 'Backups will occur <b>every %1$s at %2$s</b>~~',
|
||||
'bkp-retention' => 'At most <b>%1$d backup files will be kept</b> in the target directory.~~',
|
||||
'bkp-next-to-delete' => 'Will be deleted when the next backup occurs (see the setting "retention_count")~~',
|
||||
'bkp-table-file' => 'File~~',
|
||||
'bkp-table-file+' => 'Only files having the extension .zip are considered as being backup files~~',
|
||||
'bkp-table-size' => 'Size~~',
|
||||
'Menu:BackupStatus' => 'Ütemezett Backup',
|
||||
'bkp-status-title' => 'Ütemezett backup-ok',
|
||||
'bkp-status-checks' => 'Beállítás és ellenőrzés',
|
||||
'bkp-mysqldump-ok' => 'mysqldump megvan: %1$s',
|
||||
'bkp-mysqldump-notfound' => 'mysqldump nem található: %1$s - Győződjön meg róla, hogy telepítve van és szerepel az elérési útvonalban, vagy szerkessze a konfigurációs fájlt a mysql_bindir beállításához..',
|
||||
'bkp-mysqldump-issue' => 'mysqldump nem hajtható végre (retcode=%1$d): Győződjön meg róla, hogy telepítve van és szerepel az elérési útvonalban, vagy szerkessze a konfigurációs fájlt a mysql_bindir beállításához.',
|
||||
'bkp-missing-dir' => 'A <code>%1$s</code> célkönyvtár nem található',
|
||||
'bkp-free-disk-space' => '<b>%1$s szabad</b> a <code>%2$s</code> -ből',
|
||||
'bkp-dir-not-writeable' => '%1$s nem írható',
|
||||
'bkp-wrong-format-spec' => 'A fájlnevek formázására vonatkozó jelenlegi specifikáció helytelen (%1$s). Alapértelmezett specifikáció lesz érvényben: %2$s',
|
||||
'bkp-name-sample' => 'A backup fájlok neve a DB azonosítóktól, a dátumtól és az időponttól függ. Példa: %1$s',
|
||||
'bkp-week-days' => 'Backup lesz végrehajtva <b>minden %1$s %2$s -kor</b>',
|
||||
'bkp-retention' => 'Legfeljebb <b>%1$d backup fájl lesz megőrizve</b> a célkönyvtárban.',
|
||||
'bkp-next-to-delete' => 'Törölve lesz a következő backup alkalmával (lásd a "retention_count" beállítást)',
|
||||
'bkp-table-file' => 'Fájl',
|
||||
'bkp-table-file+' => 'Csak a .zip kiterjesztésű fájlokat tekintjük biztonsági mentésnek.',
|
||||
'bkp-table-size' => 'Méret',
|
||||
'bkp-table-size+' => '~~',
|
||||
'bkp-table-actions' => 'Actions~~',
|
||||
'bkp-table-actions' => 'Műveletek',
|
||||
'bkp-table-actions+' => '~~',
|
||||
'bkp-status-backups-auto' => 'Scheduled backups~~',
|
||||
'bkp-status-backups-manual' => 'Manual backups~~',
|
||||
'bkp-status-backups-none' => 'No backup yet~~',
|
||||
'bkp-next-backup' => 'The next backup will occur on <b>%1$s</b> (%2$s) at %3$s~~',
|
||||
'bkp-next-backup-unknown' => 'The next backup is <b>not scheduled</b> yet.~~',
|
||||
'bkp-button-backup-now' => 'Backup now!~~',
|
||||
'bkp-button-restore-now' => 'Restore!~~',
|
||||
'bkp-confirm-backup' => 'Please confirm that you do request the backup to occur right now.~~',
|
||||
'bkp-confirm-restore' => 'Please confirm that you do want to restore the backup %1$s.~~',
|
||||
'bkp-wait-backup' => 'Please wait for the backup to complete...~~',
|
||||
'bkp-wait-restore' => 'Please wait for the restore to complete...~~',
|
||||
'bkp-success-restore' => 'Restore successfully completed.~~',
|
||||
'bkp-status-backups-auto' => 'Ütemezett backup',
|
||||
'bkp-status-backups-manual' => 'Manuális backup',
|
||||
'bkp-status-backups-none' => 'Még nincs backup',
|
||||
'bkp-next-backup' => 'A következő backup <b>%1$s</b> (%2$s) fog lefutni at %3$s -kor',
|
||||
'bkp-next-backup-unknown' => 'A következő backup <b>nincs ütemezve</b> még.',
|
||||
'bkp-button-backup-now' => 'Backup most!',
|
||||
'bkp-button-restore-now' => 'Visszaállítás!',
|
||||
'bkp-confirm-backup' => 'Erősítse meg, hogy a biztonsági mentést most kéri.',
|
||||
'bkp-confirm-restore' => 'Kérjük, erősítse meg, hogy vissza szeretné állítani a %1$s backup-ot.',
|
||||
'bkp-wait-backup' => 'Várjon a backup befejezéséig...',
|
||||
'bkp-wait-restore' => 'Várjon a visszaállítás befejezéséig...',
|
||||
'bkp-success-restore' => 'A visszaállítás sikerült.',
|
||||
));
|
||||
|
||||
@@ -163,8 +163,7 @@ class BackupExec extends AbstractWeeklyScheduledProcess
|
||||
//
|
||||
$oBackup->SetMySQLBinDir(MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'mysql_bindir', ''));
|
||||
|
||||
$sBackupFileFormat = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'file_name_format',
|
||||
'__DB__-%Y-%m-%d_%H_%M');
|
||||
$sBackupFileFormat = MetaModel::GetConfig()->GetModuleSetting($this->GetModuleName(), 'file_name_format', '__DB__-%Y-%m-%d_%H_%M');
|
||||
$sName = $oBackup->MakeName($sBackupFileFormat);
|
||||
if ($sName == '')
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user