";
+ TemplateRenderer::getInstance()->display(
+ '@databaseinventory/databaseparam_credential.html.twig',
+ [
+ 'item' => PluginDatabaseinventoryDatabaseParam::getById($ID),
+ 'credentiallist' => $listofcredentials,
+ 'credentialclass' => PluginDatabaseinventoryCredential::class,
+ 'credentialtypeclass' => PluginDatabaseinventoryDatabaseParam_Credential::class,
+ 'canread' => $databaseparams->can($ID, READ),
+ 'canedit' => $databaseparams->can($ID, UPDATE),
+ 'canadd' => $databaseparams->canAddItem('itemtype'),
+ 'used' => $used,
+ ]
+ );
+
return true;
}
diff --git a/inc/menu.class.php b/inc/menu.class.php
index 99d79f2..8330f23 100644
--- a/inc/menu.class.php
+++ b/inc/menu.class.php
@@ -37,49 +37,64 @@ public static function getMenuName()
public static function getMenuContent()
{
+ $links_class = [
+ PluginDatabaseinventoryComputerGroup::class,
+ PluginDatabaseinventoryDatabaseParam::class,
+ PluginDatabaseinventoryCredential::class
+ ];
+
+ $links = [];
+ foreach ($links_class as $link) {
+ $link_text =
+ "" . $link::getTypeName(Session::getPluralNumber()) . "";
+ $links["$link_text"] = $link::getSearchURL(false);
+ }
+
$menu = [
'title' => self::getMenuName(),
- 'page' => self::getSearchURL(false),
+ 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
'icon' => 'fas fa-database',
+ 'options' => [],
+ 'links' => $links,
];
- if (PluginDatabaseinventoryDatabaseParam::canView()) {
- $menu['options']['databaseparam'] = [
- 'title' => PluginDatabaseinventoryDatabaseParam::getTypeName(2),
- 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
- 'icon' => PluginDatabaseinventoryDatabaseParam::getIcon(),
- ];
+ $menu['options']['databaseparam'] = [
+ 'title' => PluginDatabaseinventoryDatabaseParam::getTypeName(2),
+ 'page' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
+ 'icon' => PluginDatabaseinventoryDatabaseParam::getIcon(),
+ 'links' => $links,
+ ];
+ if (true) {
$menu['options']['databaseparam']['links'] = [
'search' => PluginDatabaseinventoryDatabaseParam::getSearchURL(false),
'add' => PluginDatabaseinventoryDatabaseParam::getFormURL(false),
- ];
+ ] + $links;
}
+ $menu['options']['computergroup'] = [
+ 'title' => PluginDatabaseinventoryComputerGroup::getTypeName(2),
+ 'page' => PluginDatabaseinventoryComputerGroup::getSearchURL(false),
+ 'icon' => PluginDatabaseinventoryComputerGroup::getIcon(),
+ 'links' => $links,
+ ];
- if (PluginDatabaseinventoryComputerGroup::canView()) {
- $menu['options']['computergroup'] = [
- 'title' => PluginDatabaseinventoryComputerGroup::getTypeName(2),
- 'page' => PluginDatabaseinventoryComputerGroup::getSearchURL(false),
- 'icon' => PluginDatabaseinventoryComputerGroup::getIcon(),
- ];
-
+ if (true) {
$menu['options']['computergroup']['links'] = [
'search' => PluginDatabaseinventoryComputerGroup::getSearchURL(false),
'add' => PluginDatabaseinventoryComputerGroup::getFormURL(false),
- ];
+ ] + $links;
}
-
- if (PluginDatabaseinventoryCredential::canView()) {
- $menu['options']['credential'] = [
- 'title' => PluginDatabaseinventoryCredential::getTypeName(2),
- 'page' => PluginDatabaseinventoryCredential::getSearchURL(false),
- 'icon' => PluginDatabaseinventoryCredential::getIcon(),
- ];
-
+ $menu['options']['credential'] = [
+ 'title' => PluginDatabaseinventoryCredential::getTypeName(2),
+ 'page' => PluginDatabaseinventoryCredential::getSearchURL(false),
+ 'icon' => PluginDatabaseinventoryCredential::getIcon(),
+ 'links' => $links,
+ ];
+ if (true) {
$menu['options']['credential']['links'] = [
'search' => PluginDatabaseinventoryCredential::getSearchURL(false),
'add' => PluginDatabaseinventoryCredential::getFormURL(false),
- ];
+ ] + $links;
}
return $menu;
diff --git a/setup.php b/setup.php
index a5cf8f2..207b9c0 100644
--- a/setup.php
+++ b/setup.php
@@ -48,7 +48,7 @@ function plugin_init_databaseinventory()
$PLUGIN_HOOKS['csrf_compliant']['databaseinventory'] = true;
- $PLUGIN_HOOKS['config_page']['databaseinventory'] = 'front/menu.php';
+ $PLUGIN_HOOKS['config_page']['databaseinventory'] = 'front/databaseparam.php';
if (!Plugin::isPluginActive('databaseinventory')) {
return;
diff --git a/templates/computergroup.html.twig b/templates/computergroup.html.twig
new file mode 100644
index 0000000..106fb7d
--- /dev/null
+++ b/templates/computergroup.html.twig
@@ -0,0 +1,29 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% extends "generic_show_form.html.twig" %}
\ No newline at end of file
diff --git a/templates/computergroupstatic.html.twig b/templates/computergroupstatic.html.twig
new file mode 100644
index 0000000..db47e97
--- /dev/null
+++ b/templates/computergroupstatic.html.twig
@@ -0,0 +1,126 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% import "components/form/fields_macros.html.twig" as fields %}
+{% set rand = random() %}
+
+{% block more_fields %}
+ {% if canadd %}
+
+ {% endif %}
+ {% if canread %}
+ {% if computerslist is not empty %}
+
+ {% endif %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/templates/contactlog.html.twig b/templates/contactlog.html.twig
new file mode 100644
index 0000000..e3f154e
--- /dev/null
+++ b/templates/contactlog.html.twig
@@ -0,0 +1,62 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% import "components/form/fields_macros.html.twig" as fields %}
+
+{% block more_fields %}
+ {% if canread %}
+ {% if contactlogs is not empty %}
+ {% set tableheader %}
+
+
{{ __('Credentials') }}
+ {% if itemtype == 'Agent' %}
+
{{ __('DatabaseParam') }}
+ {% else %}
+
{{ __('Agents') }}
+ {% endif %}
+
{{ __('Date') }}
+
+ {% endset %}
+
+ {{ tableheader }}
+ {% for contactlog in contactlogs %}
+
+ {% endif %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/templates/credential.html.twig b/templates/credential.html.twig
new file mode 100644
index 0000000..be13da5
--- /dev/null
+++ b/templates/credential.html.twig
@@ -0,0 +1,62 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% extends "generic_show_form.html.twig" %}
+{% import "components/form/fields_macros.html.twig" as fields %}
+
+{% block more_fields %}
+
+ {{ fields.dropdownNumberField(
+ 'port',
+ item.fields['port'],
+ __('Port', 'databaseinventory'),
+ {'min' : 0, 'max' : 99999, 'step' : 1}
+ )}}
+
+ {{ fields.textField(
+ 'login',
+ item.fields['login'],
+ __('Login', 'databaseinventory'),
+ )
+ }}
+
+ {{ fields.passwordField(
+ 'password',
+ item.fields['password'],
+ __('Password', 'databaseinventory'),
+ {'clearable': false, 'is_disclosable' : true}
+ )
+ }}
+ {{ fields.textField(
+ 'socket',
+ item.fields['socket'],
+ __('Socket', 'databaseinventory'),
+ )
+ }}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/databaseparam.html.twig b/templates/databaseparam.html.twig
new file mode 100644
index 0000000..a6de483
--- /dev/null
+++ b/templates/databaseparam.html.twig
@@ -0,0 +1,48 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% extends "generic_show_form.html.twig" %}
+{% import "components/form/fields_macros.html.twig" as fields %}
+
+{% block more_fields %}
+
+ {{ fields.dropdownYesNo(
+ 'partial_inventory',
+ item.fields['partial_inventory'],
+ __('Execution frequency for partial inventory', 'databaseinventory'),
+ )
+ }}
+
+ {{ fields.dropdownNumberField(
+ 'execution_delay',
+ item.fields['execution_delay'],
+ __('Execution delay', 'databaseinventory'),
+ {'min' : 0, 'max' : 24, 'step' : 1, 'unit' : 'hour'}
+ )}}
+
+{% endblock %}
\ No newline at end of file
diff --git a/templates/databaseparam_computergroup.html.twig b/templates/databaseparam_computergroup.html.twig
new file mode 100644
index 0000000..4561596
--- /dev/null
+++ b/templates/databaseparam_computergroup.html.twig
@@ -0,0 +1,119 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% import "components/form/fields_macros.html.twig" as fields %}
+{% set rand = random() %}
+
+{% block more_fields %}
+ {% if canadd %}
+
+ {% endif %}
+ {% if canread %}
+ {% if compgrouplist is not empty %}
+
+ {% endif %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file
diff --git a/templates/databaseparam_credential.html.twig b/templates/databaseparam_credential.html.twig
new file mode 100644
index 0000000..9851095
--- /dev/null
+++ b/templates/databaseparam_credential.html.twig
@@ -0,0 +1,120 @@
+{#
+ # -------------------------------------------------------------------------
+ # DatabaseInventory plugin for GLPI
+ # -------------------------------------------------------------------------
+ #
+ # LICENSE
+ #
+ # This file is part of DatabaseInventory.
+ #
+ # DatabaseInventory is free software; you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation; either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # DatabaseInventory 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 General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with DatabaseInventory. If not, see .
+ # -------------------------------------------------------------------------
+ # @copyright Copyright (C) 2021-2023 by Teclib'.
+ # @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html
+ # @link https://services.glpi-network.com
+ # -------------------------------------------------------------------------
+ #}
+
+{% import "components/form/fields_macros.html.twig" as fields %}
+{% set rand = random() %}
+
+{% block more_fields %}
+ {% if canadd %}
+
+ {% endif %}
+ {% if canread %}
+ {% if credentiallist is not empty %}
+
+ {% endif %}
+ {% endif %}
+{% endblock %}
\ No newline at end of file