├── racks.png ├── pics └── racks.png ├── locales ├── cs_CZ.mo ├── de_DE.mo ├── en_GB.mo ├── es_AR.mo ├── es_ES.mo ├── fi_FI.mo ├── fr_FR.mo ├── pl_PL.mo ├── pt_BR.mo ├── ro_RO.mo ├── ru_RU.mo ├── tr_TR.mo └── glpi.pot ├── sql ├── update-1.4.2.sql ├── update-1.2.1.sql ├── update-1.3.0.sql ├── update-1.0.2.sql ├── update-1.4.1.sql ├── update-1.7.1.sql ├── update-1.3.2.sql ├── empty-1.0.0.sql ├── empty-1.0.2.sql ├── update-1.1.0.sql ├── empty-1.1.0.sql ├── empty-1.2.1.sql ├── empty-1.3.0.sql ├── empty-1.5.0.sql ├── empty-1.5.2.sql ├── empty-1.3.2.sql └── empty-1.7.1.sql ├── tools ├── extract_template.sh ├── update_mo.pl ├── update_po.pl └── move_to_po.php ├── ISSUE_TEMPLATE.md ├── racks.js ├── front ├── racktype.php ├── connection.php ├── othermodel.php ├── rackmodel.php ├── rackstate.php ├── racktype.form.php ├── roomlocation.php ├── connection.form.php ├── othermodel.form.php ├── rackmodel.form.php ├── rackstate.form.php ├── roomlocation.form.php ├── itemspecification.php ├── rack_item.form.php ├── rack.php ├── setup.templates.php ├── config.form.php ├── report.php ├── itemspecification.form.php └── rack.form.php ├── inc ├── rackmodel.class.php ├── othermodel.class.php ├── connection.class.php ├── other.class.php ├── rackstate.class.php ├── racktype.class.php ├── roomlocation.class.php ├── itemspecificationcentral.class.php ├── menu.class.php ├── config.class.php └── profile.class.php ├── README.md ├── racks.css ├── ajax ├── dropdownAllItems.php ├── synchronize_device.php └── dropdownValue.php ├── racks.xml └── setup.php /racks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/racks.png -------------------------------------------------------------------------------- /pics/racks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/pics/racks.png -------------------------------------------------------------------------------- /locales/cs_CZ.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/cs_CZ.mo -------------------------------------------------------------------------------- /locales/de_DE.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/de_DE.mo -------------------------------------------------------------------------------- /locales/en_GB.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/en_GB.mo -------------------------------------------------------------------------------- /locales/es_AR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/es_AR.mo -------------------------------------------------------------------------------- /locales/es_ES.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/es_ES.mo -------------------------------------------------------------------------------- /locales/fi_FI.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/fi_FI.mo -------------------------------------------------------------------------------- /locales/fr_FR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/fr_FR.mo -------------------------------------------------------------------------------- /locales/pl_PL.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/pl_PL.mo -------------------------------------------------------------------------------- /locales/pt_BR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/pt_BR.mo -------------------------------------------------------------------------------- /locales/ro_RO.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/ro_RO.mo -------------------------------------------------------------------------------- /locales/ru_RU.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/ru_RU.mo -------------------------------------------------------------------------------- /locales/tr_TR.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/InfotelGLPI/racks/master/locales/tr_TR.mo -------------------------------------------------------------------------------- /sql/update-1.4.2.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_profiles` 2 | ADD `open_ticket` char(1) collate utf8_unicode_ci default NULL; -------------------------------------------------------------------------------- /sql/update-1.2.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_racks` 2 | ADD `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL; -------------------------------------------------------------------------------- /sql/update-1.3.0.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_racks` 2 | CHANGE `groups_id` `groups_id_tech` int(11) NOT NULL DEFAULT '0', 3 | CHANGE `users_id` `users_id_tech` int(11) NOT NULL DEFAULT '0'; -------------------------------------------------------------------------------- /sql/update-1.0.2.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_rack_content` CHANGE `alim1` `first_powersupply` int(11) NOT NULL default '0'; 2 | ALTER TABLE `glpi_plugin_rack_content` CHANGE `alim2` `second_powersupply` int(11) NOT NULL default '0'; -------------------------------------------------------------------------------- /sql/update-1.4.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_racktypes` 2 | ADD `is_recursive` tinyint(1) NOT NULL default '0'; 3 | 4 | ALTER TABLE `glpi_plugin_racks_rackstates` 5 | ADD `is_recursive` tinyint(1) NOT NULL default '0'; -------------------------------------------------------------------------------- /sql/update-1.7.1.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_roomlocations` 2 | ADD `ancestors_cache` longtext collate utf8_unicode_ci; 3 | ALTER TABLE `glpi_plugin_racks_roomlocations` 4 | ADD `sons_cache` longtext collate utf8_unicode_ci; -------------------------------------------------------------------------------- /tools/extract_template.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Only strings with domain specified are extracted (use Xt args of keyword param to set number of args needed) 4 | 5 | xgettext *.php */*.php --copyright-holder='Racks Development Team' --package-name='GLPI - Racks plugin' --package-version='1.8.0' -o locales/glpi.pot -L PHP --add-comments=TRANS --from-code=UTF-8 --force-po \ 6 | --keyword=_n:1,2,4t --keyword=__s:1,2t --keyword=__:1,2t --keyword=_e:1,2t --keyword=_x:1c,2,3t \ 7 | --keyword=_ex:1c,2,3t --keyword=_nx:1c,2,3,5t --keyword=_sx:1c,2,3t 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Dear GLPi user. 2 | 3 | BEFORE SUBMITTING YOUR ISSUE, please make sure to read and follow these steps : 4 | 5 | * Verify that your question has not already been asked 6 | * Please use the below template. 7 | * Delete this text before submiting your issue. 8 | 9 | The Plugin team. 10 | 11 | ------------ 12 | * Version of the plugin : 13 | 14 | 15 | * Version of your GLPI : 16 | 17 | 18 | * Steps to reproduce (which actions have you made) : 19 | 20 | 21 | * Expected result : 22 | 23 | 24 | * Actual result : 25 | 26 | 27 | * URL of the page : 28 | 29 | 30 | * Screenshot of the problem (if pertinent) : 31 | 32 | -------------------------------------------------------------------------------- /tools/update_mo.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=0){ 5 | print "USAGE update_mo.pl\n\n"; 6 | 7 | exit(); 8 | } 9 | 10 | 11 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 12 | foreach (readdir(DIRHANDLE)){ 13 | if ($_ ne '..' && $_ ne '.'){ 14 | 15 | if(!(-l "$dir/$_")){ 16 | if (index($_,".po",0)==length($_)-3) { 17 | $lang=$_; 18 | $lang=~s/\.po//; 19 | 20 | `msgfmt locales/$_ -o locales/$lang.mo`; 21 | } 22 | } 23 | 24 | } 25 | } 26 | closedir DIRHANDLE; 27 | 28 | # 29 | # 30 | -------------------------------------------------------------------------------- /tools/update_po.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | #!/usr/bin/perl -w 3 | 4 | if (@ARGV!=2){ 5 | print "USAGE update_po.pl transifex_login transifex_password\n\n"; 6 | 7 | exit(); 8 | } 9 | $user = $ARGV[0]; 10 | $password = $ARGV[1]; 11 | 12 | opendir(DIRHANDLE,'locales')||die "ERROR: can not read current directory\n"; 13 | foreach (readdir(DIRHANDLE)){ 14 | if ($_ ne '..' && $_ ne '.'){ 15 | 16 | if(!(-l "$dir/$_")){ 17 | if (index($_,".po",0)==length($_)-3) { 18 | $lang=$_; 19 | $lang=~s/\.po//; 20 | 21 | `wget --user=$user --password=$password --output-document=locales/$_ http://www.transifex.com/api/2/project/GLPI_racks/resource/glpi/translation/$lang/?file=$_`; 22 | } 23 | } 24 | 25 | } 26 | } 27 | closedir DIRHANDLE; 28 | 29 | # 30 | # 31 | -------------------------------------------------------------------------------- /sql/update-1.3.2.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_racks_racks` 2 | ADD `plugin_racks_racktypes_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racktypes (id)', 3 | ADD `plugin_racks_rackstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackstates (id)'; 4 | 5 | CREATE TABLE `glpi_plugin_racks_racktypes` ( 6 | `id` int(11) NOT NULL auto_increment, 7 | `entities_id` int(11) NOT NULL default '0', 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `comment` text collate utf8_unicode_ci, 10 | PRIMARY KEY (`id`), 11 | KEY `name` (`name`) 12 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 13 | 14 | 15 | CREATE TABLE `glpi_plugin_racks_rackstates` ( 16 | `id` int(11) NOT NULL auto_increment, 17 | `entities_id` int(11) NOT NULL default '0', 18 | `name` varchar(255) collate utf8_unicode_ci default NULL, 19 | `comment` text collate utf8_unicode_ci, 20 | PRIMARY KEY (`id`), 21 | KEY `name` (`name`) 22 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -------------------------------------------------------------------------------- /racks.js: -------------------------------------------------------------------------------- 1 | function racks_initJs(root_doc) { 2 | this.root_doc = root_doc; 3 | } 4 | 5 | /** 6 | * 7 | * @param action 8 | * @param toobserve 9 | * @param toupdate 10 | */ 11 | this.racks_synchronize = function (options) { 12 | 13 | var object = this; 14 | var name = $('#' + options.name).val(); 15 | 16 | $.ajax({ 17 | url: object.root_doc + '/plugins/racks/ajax/synchronize_device.php', 18 | type: "POST", 19 | dataType: "json", 20 | data: 'action=racks_synchronize' + 21 | '&update_server=' + options.update_server + 22 | '&id=' + options.id + 23 | '&faces_id=' + options.faces_id + 24 | '&plugin_racks_itemspecifications_id=' + options.plugin_racks_itemspecifications_id + 25 | '&items_id=' + options.items_id + 26 | '&type=' + options.type + 27 | '&rack_size=' + options.rack_size + 28 | '&position=' + options.position + 29 | '&plugin_racks_racks_id=' + options.plugin_racks_racks_id + 30 | '&name=' + name, 31 | success: function (data) { 32 | window.location.reload(); 33 | } 34 | }); 35 | }; 36 | -------------------------------------------------------------------------------- /front/racktype.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackType(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/connection.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksConnection(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/othermodel.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksOtherModel(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/rackmodel.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackModel(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/rackstate.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackState(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/racktype.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackType(); 33 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 34 | -------------------------------------------------------------------------------- /front/roomlocation.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRoomLocation(); 33 | include (GLPI_ROOT . "/front/dropdown.common.php"); 34 | -------------------------------------------------------------------------------- /front/connection.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksConnection(); 33 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 34 | -------------------------------------------------------------------------------- /front/othermodel.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksOtherModel(); 33 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 34 | -------------------------------------------------------------------------------- /front/rackmodel.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackModel(); 33 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 34 | -------------------------------------------------------------------------------- /front/rackstate.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $dropdown = new PluginRacksRackState(); 33 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 34 | -------------------------------------------------------------------------------- /front/roomlocation.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | include ('../../../inc/includes.php'); 30 | 31 | $dropdown = new PluginRacksRoomLocation(); 32 | include (GLPI_ROOT . "/front/dropdown.common.form.php"); 33 | -------------------------------------------------------------------------------- /front/itemspecification.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | Html::header(PluginRacksRack::getTypeName(2), '', "assets", "pluginracksmenu", "specifications"); 33 | $central = new PluginRacksItemSpecificationCentral(); 34 | $central->display(); 35 | Html::footer(); 36 | -------------------------------------------------------------------------------- /front/rack_item.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | $PluginRacksRack_Item = new PluginRacksRack_Item; 33 | 34 | if (isset ($_POST["update"])) { 35 | if ($PluginRacksRack_Item->canCreate()) { 36 | $PluginRacksRack_Item->update($_POST); 37 | } 38 | Html::back(); 39 | } 40 | -------------------------------------------------------------------------------- /inc/rackmodel.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksRackModel extends CommonDropdown { 35 | 36 | static $rightname = "plugin_racks"; 37 | var $can_be_translated = true; 38 | 39 | static function getTypeName($nb = 0) { 40 | return _n('Model', 'Models', $nb); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /inc/othermodel.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksOtherModel extends CommonDropdown { 35 | 36 | static $rightname = "plugin_racks"; 37 | var $can_be_translated = true; 38 | 39 | static function getTypeName($nb = 0) { 40 | return __('Others equipments', 'racks'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /front/rack.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | Html::header(PluginRacksRack::getTypeName(2), '', "assets", 33 | "pluginracksmenu", "racks"); 34 | 35 | $PluginRacksRack=new PluginRacksRack(); 36 | if ($PluginRacksRack->canView() || Config::canCreate()) { 37 | Search::show("PluginRacksRack"); 38 | } else { 39 | Html::displayRightError(); 40 | } 41 | 42 | Html::footer(); 43 | -------------------------------------------------------------------------------- /inc/connection.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksConnection extends CommonDropdown { 35 | 36 | static $rightname = "plugin_racks"; 37 | var $can_be_translated = true; 38 | 39 | static function getTypeName($nb = 0) { 40 | return _n('Power supply connection', 'Power supply connections', $nb, 'racks'); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /front/setup.templates.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | Html::header(PluginRacksRack::getTypeName(2), '', 33 | "assets", "pluginracksmenu", "racks"); 34 | 35 | if (PluginRacksRack::canView() || Config::canCreate()) { 36 | PluginRacksRack::listTemplates('PluginRacksRack', 37 | PluginRacksRack::getFormURL(true), 38 | $_GET["add"]); 39 | } 40 | Html::footer(); 41 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # racks 2 | Plugin racks pour GLPI 3 | 4 | ******************* 5 | 6 | Plugin integré dans GLPI 9.3 7 | 8 | ******************* 9 | 10 | Plugin integrated into GLPI 9.3 11 | 12 | ******************* 13 | 14 | Ce plugin est sur Transifex - Aidez-nous à le traduire : 15 | https://www.transifex.com/tsmr/GLPI_racks/ 16 | 17 | This plugin is on Transifex - Help us to translate : 18 | https://www.transifex.com/tsmr/GLPI_racks/ 19 | 20 | Ce plugin vous permet de créer des baies. Gérer l'emplacement de vos matériels dans vos baies. Et ainsi connaitre l'espace disponible, ainsi que sa consommation électrique et sa dissipation calorifique. 21 | > * Détail d'une baie : hauteur - largeur - profondeur - poids - nombre de U. 22 | > * Gestion de l'avant et de l'arrière. 23 | > * Définition de modèles de matériel utilisable et spécifications (Courant consommé, nombre d'alimentations, dissipation calorifique, Débit d'air frais, taille (U), poids, longueur) 24 | > * GLPI > 0.84 : Utilisable avec le plugin "Cartographie":https://github.com/InfotelGLPI/positions 25 | > * GLPI > 0.84 : Utilisable avec le plugin "Arborescence":https://forge.glpi-project.org/projects/show/treeview 26 | 27 | This plugin allows you to create bays. Manage the placement of your materials in your bays. And so know the space and its power consumption and heat dissipation. 28 | > * Rack detail : height - width - depth - weight - number of U. 29 | > * Front and back management. 30 | > * Definition of model specifications and materials used (power consumption, numbre of power supply, calorific waste, flow Rate, size (U), weight, depth) 31 | > * GLPI > 0.84 : Can be used with "Positions":https://github.com/InfotelGLPI/positions 32 | > * GLPI > 0.84 : Can be used with "Tree View":https://forge.glpi-project.org/projects/show/treeview 33 | -------------------------------------------------------------------------------- /racks.css: -------------------------------------------------------------------------------- 1 | /* 2 | * @version $Id: HEADER 15930 2011-10-30 15:47:55Z tsmr $ 3 | ------------------------------------------------------------------------- 4 | Racks plugin for GLPI 5 | Copyright (C) 2003-2011 by the Racks Development Team. 6 | 7 | https://forge.indepnet.net/projects/racks 8 | ------------------------------------------------------------------------- 9 | 10 | LICENSE 11 | 12 | This file is part of Racks. 13 | 14 | Racks is free software; you can redistribute it and/or modify 15 | it under the terms of the GNU General Public License as published by 16 | the Free Software Foundation; either version 2 of the License, or 17 | (at your option) any later version. 18 | 19 | Racks is distributed in the hope that it will be useful, 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 | GNU General Public License for more details. 23 | 24 | You should have received a copy of the GNU General Public License 25 | along with Racks. If not, see . 26 | -------------------------------------------------------------------------- 27 | */ 28 | 29 | /* ######################## Fichier CSS ############################# */ 30 | /* ####################### general ############################# */ 31 | /* ####################################################################### */ 32 | 33 | 34 | /* Feuille de style Header GLPI Project - Version 1 nov. 2006 */ 35 | 36 | .plugin_racks_device_computers_color { 37 | background-color: #c5e693; 38 | } 39 | 40 | .plugin_racks_device_peripherals_color { 41 | background-color: #e6ffab; 42 | } 43 | 44 | .plugin_racks_device_networking_color { 45 | background-color: #cede99; 46 | } 47 | 48 | .plugin_racks_device_others_color { 49 | background-color: #e4e4e2; 50 | } 51 | -------------------------------------------------------------------------------- /front/config.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | Session::checkRight("config", UPDATE); 33 | 34 | $plugin = new Plugin(); 35 | if ($plugin->isActivated("racks")) { 36 | $config = new PluginRacksConfig(); 37 | if (isset($_POST["update"])) { 38 | $config->update($_POST); 39 | Html::back(); 40 | } else { 41 | Html::header(PluginRacksRack::getTypeName(2), '', "assets", "pluginracksmenu", "config"); 42 | $config->showForm(); 43 | Html::footer(); 44 | } 45 | } else { 46 | Html::header(__('Setup'), '', "config", "plugins"); 47 | echo "


"; 48 | echo "\"warning\"

"; 49 | echo "".__('Please activate the plugin', 'racks')."
"; 50 | } 51 | -------------------------------------------------------------------------------- /inc/other.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksOther extends CommonDBTM { 35 | 36 | static $rightname = "plugin_racks"; 37 | 38 | static function getTypeName($nb = 0) { 39 | return __('Others equipments', 'racks'); 40 | } 41 | 42 | function addOthers($ID) { 43 | $values["entities_id"] = $_SESSION["glpiactive_entity"]; 44 | $values["plugin_racks_othermodels_id"] = $ID; 45 | return $this->add($values); 46 | } 47 | 48 | function updateOthers($ID, $name) { 49 | $values["id"] = $ID; 50 | $values["name"] = $name; 51 | $this->update($values); 52 | } 53 | 54 | function deleteOthers($ID) { 55 | $values["id"] = $ID; 56 | $this->delete($values); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /inc/rackstate.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | // Class for a Dropdown 35 | class PluginRacksRackState extends CommonDropdown { 36 | 37 | static $rightname = "plugin_racks"; 38 | var $can_be_translated = true; 39 | 40 | static function getTypeName($nb = 0) { 41 | return _n('Status', 'Statuses', $nb); 42 | } 43 | 44 | static function transfer($ID, $entity) { 45 | global $DB; 46 | 47 | if ($ID > 0) { 48 | // Not already transfer 49 | // Search init item 50 | foreach ($DB->request("glpi_plugin_racks_rackstates", 51 | ['id' => $ID]) as $data) { 52 | $data = Toolbox::addslashes_deep($data); 53 | $input['name'] = $data['name']; 54 | $input['entities_id'] = $entity; 55 | $temp = new self(); 56 | $newID = $temp->getID($input); 57 | if ($newID < 0) { 58 | $newID = $temp->import($input); 59 | } 60 | return $newID; 61 | } 62 | } 63 | return 0; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /inc/racktype.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | // Class for a Dropdown 35 | class PluginRacksRackType extends CommonDropdown { 36 | 37 | static $rightname = "plugin_racks"; 38 | var $can_be_translated = true; 39 | 40 | static function getTypeName($nb = 0) { 41 | return _n('Type', 'Types', $nb); 42 | } 43 | 44 | static function transfer($ID, $entity) { 45 | global $DB; 46 | 47 | if ($ID > 0) { 48 | // Not already transfer 49 | // Search init item 50 | foreach ($DB->request('glpi_plugin_racks_racktypes', 51 | ['id' => $ID]) as $data) { 52 | $data = Toolbox::addslashes_deep($data); 53 | $input['name'] = $data['name']; 54 | $input['entities_id'] = $entity; 55 | $temp = new self(); 56 | $newID = $temp->getID($input); 57 | if ($newID < 0) { 58 | $newID = $temp->import($input); 59 | } 60 | return $newID; 61 | } 62 | } 63 | return 0; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /inc/roomlocation.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | // Class for a Dropdown 35 | class PluginRacksRoomLocation extends CommonTreeDropdown { 36 | 37 | static $rightname = "plugin_racks"; 38 | var $can_be_translated = true; 39 | 40 | static function getTypeName($nb = 0) { 41 | return _n('Place', 'Places', $nb, 'racks'); 42 | } 43 | 44 | static function getUsedNumber() { 45 | global $DB; 46 | 47 | $used = []; 48 | $query = "SELECT `plugin_racks_roomlocations_id` 49 | FROM `glpi_plugin_racks_racks` 50 | WHERE `plugin_racks_roomlocations_id` IS NOT NULL"; 51 | 52 | foreach ($DB->request($query) as $data) { 53 | $used[] = $data["plugin_racks_roomlocations_id"]; 54 | } 55 | return $used; 56 | } 57 | 58 | function dropdownRoomLocations($name, $value, $entity) { 59 | $used = self::getUsedNumber(); 60 | Dropdown::show('PluginRacksRoomLocation', 61 | ['name' => "plugin_racks_roomlocations_id", 62 | 'value' => $value, 63 | 'entity' => $entity, 64 | 'used' => $used]); 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /front/report.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | // Options for GLPI 0.71 and newer : need slave db to access the report 31 | $USEDBREPLICATE = 1; 32 | $DBCONNECTION_REQUIRED = 1; 33 | 34 | // Initialization of the variables 35 | include ('../../../inc/includes.php'); 36 | 37 | $output_type = Search::HTML_OUTPUT; 38 | 39 | if (isset($_REQUEST['list_limit'])) { 40 | $_SESSION['glpilist_limit'] = $_REQUEST['list_limit']; 41 | unset($_REQUEST['list_limit']); 42 | } 43 | if (!isset($_REQUEST['sort'])) { 44 | $_REQUEST['sort'] = "entity"; 45 | $_REQUEST['order'] = "ASC"; 46 | } 47 | 48 | $limit = $_SESSION['glpilist_limit']; 49 | 50 | if (isset($_REQUEST["display_type"])) { 51 | $output_type = $_REQUEST["display_type"]; 52 | if ($output_type < 0) { 53 | $output_type = - $output_type; 54 | $limit = 0; 55 | } 56 | } 57 | 58 | $pReport = new PluginRacksReport(); 59 | 60 | if ($output_type == Search::HTML_OUTPUT) { 61 | Html::header(__("Report - Bays management", "racks"), $_SERVER['PHP_SELF'], "utils", "report"); 62 | Report::title(); 63 | $pReport->showForm($_REQUEST); 64 | } 65 | 66 | if (isset($_REQUEST['result_search_reports'])) { 67 | $pReport->showResult($output_type, $limit, $_REQUEST); 68 | } 69 | 70 | if ($output_type == Search::HTML_OUTPUT) { 71 | Html::footer(); 72 | } 73 | -------------------------------------------------------------------------------- /front/itemspecification.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | if (!isset($_GET["id"])) { 33 | $_GET["id"] = ""; 34 | } 35 | 36 | $PluginRacksItemSpecification=new PluginRacksItemSpecification(); 37 | 38 | if (isset ($_POST["add"])) { 39 | if ($PluginRacksItemSpecification->canCreate()) { 40 | $newID = $PluginRacksItemSpecification->add($_POST); 41 | } 42 | Html::back(); 43 | 44 | } else if (isset ($_POST["update"])) { 45 | if ($PluginRacksItemSpecification->canCreate()) { 46 | $PluginRacksItemSpecification->UpdateItemSpecification($_POST); 47 | } 48 | Html::back(); 49 | 50 | } else if (isset ($_POST["delete"])) { 51 | if ($PluginRacksItemSpecification->canCreate()) { 52 | $PluginRacksItemSpecification->deleteItemSpecification($_POST["id"]); 53 | } 54 | Html::redirect(Toolbox::getItemTypeFormURL($_POST["itemtype"])."?id=".$_POST["model_id"]); 55 | 56 | } else if (isset ($_POST["deleteSpec"])) { 57 | foreach ($_POST["item"] as $key => $val) { 58 | $input = ['id' => $key]; 59 | if ($val == 1) { 60 | $PluginRacksItemSpecification->delete($input); 61 | } 62 | } 63 | Html::back(); 64 | } else { 65 | Html::header(PluginRacksRack::getTypeName(2), '', "assets", "pluginracksmenu", "specifications"); 66 | $PluginRacksItemSpecification->display($_GET); 67 | Html::footer(); 68 | } 69 | -------------------------------------------------------------------------------- /ajax/dropdownAllItems.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkLoginUser(); 36 | 37 | Plugin::load('racks', true); 38 | if (isset($_POST["modeltable"]) && !empty($_POST["modeltable"])) { 39 | $rand = mt_rand(); 40 | $itemtype = substr($_POST['modeltable'], 0, -5); 41 | $modelfield = getForeignKeyFieldForTable(getTableForItemType($_POST['modeltable'])); 42 | $table = getTableForItemType($itemtype); 43 | $params = ['searchText' => '__VALUE__', 44 | 'modeltable' => $_POST["modeltable"], 45 | 'modelfield' => $modelfield, 46 | 'itemtype' => $itemtype, 47 | 'rand' => $rand, 48 | 'width' => '500', 49 | 'myname' => $_POST["myname"]]; 50 | 51 | if (isset($_POST['value'])) { 52 | $params['value'] = $_POST['value']; 53 | $params['valuename'] = "-----"; 54 | } 55 | if (isset($_POST['entity_restrict'])) { 56 | $params['entity_restrict'] = $_POST['entity_restrict']; 57 | } 58 | $field_id = Html::cleanId($_POST['myname'].$rand); 59 | echo Html::jsAjaxDropdown($_POST["myname"], 60 | $field_id, 61 | $CFG_GLPI['root_doc']."/plugins/racks/ajax/dropdownValue.php", 62 | $params); 63 | } 64 | -------------------------------------------------------------------------------- /ajax/synchronize_device.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include ('../../../inc/includes.php'); 31 | 32 | header("Content-Type: text/html; charset=UTF-8"); 33 | Html::header_nocache(); 34 | 35 | Session::checkCentralAccess(); 36 | Session::checkLoginUser(); 37 | 38 | if (isset($_POST["update_server"])) { 39 | $PluginRacksRack = new PluginRacksRack(); 40 | $PluginRacksOther = new PluginRacksOther(); 41 | $PluginRacksRack_Item = new PluginRacksRack_Item(); 42 | if ($PluginRacksRack->canCreate()) { 43 | $vartype = "type"; 44 | $varspec = "plugin_racks_itemspecifications_id"; 45 | $varname = "name"; 46 | $varitems_id = "items_id"; 47 | if ($_POST[$vartype] == 'PluginRacksOtherModel') { 48 | $PluginRacksOther->updateOthers($_POST[$varitems_id], $_POST[$varname]); 49 | } 50 | $varpos = "position"; 51 | 52 | $space_left = $PluginRacksRack_Item->updateItem($_POST['id'], 53 | $_POST[$vartype], 54 | $_POST[$varspec], 55 | $_POST['plugin_racks_racks_id'], 56 | $_POST['rack_size'], 57 | $_POST['faces_id'], 58 | $_POST[$varitems_id], 59 | $_POST[$varpos]); 60 | } 61 | if ($space_left < 0) { 62 | Session::addMessageAfterRedirect(__('No more place for insertion', 'racks'), false, ERROR); 63 | } 64 | echo true; 65 | } 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /inc/itemspecificationcentral.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksItemSpecificationCentral extends CommonGLPI { 35 | 36 | static $rightname = "plugin_racks_model"; 37 | 38 | static function getTypeName($nb = 0) { 39 | return __('Equipments models specifications', 'racks'); 40 | } 41 | 42 | function defineTabs($options = []) { 43 | $ong = []; 44 | $this->addStandardTab(__CLASS__, $ong, $options); 45 | return $ong; 46 | } 47 | 48 | 49 | function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { 50 | if ($item->getType() == __CLASS__ 51 | && Session::haveRight('plugin_racks_model', READ)) { 52 | $tabs[1] = __('Servers', 'racks'); 53 | $tabs[2] = _n('Network equipment', 'Network equipments', 2, 'racks'); 54 | $tabs[3] = _n('Peripheral', 'Peripherals', 2, 'racks'); 55 | $tabs[4] = _n('Other equipment', 'Others equipments', 2, 'racks'); 56 | 57 | return $tabs; 58 | } 59 | return ''; 60 | } 61 | 62 | 63 | static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { 64 | $itemspecification = new PluginRacksItemSpecification(); 65 | if ($item->getType() == __CLASS__) { 66 | switch ($tabnum) { 67 | case 1 : 68 | $itemspecification->showList('ComputerModel'); 69 | break; 70 | 71 | case 2 : 72 | $itemspecification->showList('NetworkEquipmentModel'); 73 | break; 74 | 75 | case 3 : 76 | $itemspecification->showList('PeripheralModel'); 77 | break; 78 | 79 | case 4 : 80 | $itemspecification->showList('PluginRacksOtherModel'); 81 | break; 82 | } 83 | } 84 | return true; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /inc/menu.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | class PluginRacksMenu extends CommonGLPI { 31 | 32 | static $rightname = 'plugin_racks'; 33 | 34 | static function getMenuName($nb = 1) { 35 | return _n('Rack enclosure', 'Rack enclosures', 36 | $nb, 'racks'); 37 | } 38 | 39 | static function getMenuContent() { 40 | global $CFG_GLPI; 41 | 42 | $menu = []; 43 | //Menu entry in tools 44 | $menu['title'] = self::getMenuName(2); 45 | $menu['page'] = PluginRacksRack::getSearchURL(false); 46 | $menu['links']['search'] = PluginRacksRack::getSearchURL(false); 47 | 48 | $menu['options']['racks']['links']['search'] = PluginRacksRack::getSearchURL(false); 49 | $menu['options']['racks']['links']['config'] = PluginRacksConfig::getFormURL(false); 50 | 51 | $menu['options']['config']['title'] = __('Setup'); 52 | $menu['options']['config']['page'] = PluginRacksConfig::getFormURL(false); 53 | 54 | $menu['options']['specifications']['title'] = __('Specifications', 'racks'); 55 | $menu['options']['specifications']['page'] = PluginRacksItemSpecification::getSearchURL(false); 56 | $menu['options']['specifications']['links']['search'] = PluginRacksItemSpecification::getSearchURL(false); 57 | 58 | if (PluginRacksRack::canCreate()) { 59 | $menu['options']['racks']['links']['add'] = '/plugins/racks/front/setup.templates.php?add=1'; 60 | } 61 | 62 | if (PluginRacksRackModel::canView()) { 63 | $menu['options']['racks']['links']['template'] = '/plugins/racks/front/setup.templates.php?add=0'; 64 | $menu['options']['racks']['links']["\"".__('Equipments"] = PluginRacksItemSpecification::getSearchURL(false); 67 | } 68 | 69 | return $menu; 70 | } 71 | 72 | static function removeRightsFromSession() { 73 | if (isset($_SESSION['glpimenu']['assets']['types']['PluginRacksMenu'])) { 74 | unset($_SESSION['glpimenu']['assets']['types']['PluginRacksMenu']); 75 | } 76 | if (isset($_SESSION['glpimenu']['assets']['content']['pluginracksmenu'])) { 77 | unset($_SESSION['glpimenu']['assets']['content']['pluginracksmenu']); 78 | } 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /racks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Racks / Bays Management 4 | racks 5 | stable 6 | https://raw.githubusercontent.com/InfotelGLPI/racks/master/racks.png 7 | 8 | 9 | 10 | 11 | 12 | 13 | - Détail d'une baie : hauteur - largeur - profondeur - poids - nombre de U.
- Gestion de l'avant et de l'arrière.
- Définition de modèles de matériel utilisable et spécifications (Courant consommé, nombre d'alimentations, dissipation calorifique, Débit d'air frais, taille (U), poids, longueur)]]>
14 | - Bay detail : height - width - depth - weight - number of U.
- Front and back management.
- Definition of model specifications and materials used (power consumption, numbre of power supply, calorific waste, flow Rate, size (U), weight, depth)]]>
15 |
16 |
17 | https://github.com/InfotelGLPI/racks 18 | https://github.com/InfotelGLPI/racks/releases 19 | https://github.com/InfotelGLPI/racks/issues 20 | https://raw.githubusercontent.com/InfotelGLPI/racks/master/README.md 21 | 22 | Xavier Caillaud 23 | Infotel 24 | 25 | 26 | 27 | 1.8.0 28 | 9.2 29 | 30 | 31 | 1.7.0 32 | 9.1 33 | 34 | 35 | 1.6.1 36 | 0.90 37 | 38 | 39 | 1.6.0 40 | 0.90 41 | 42 | 43 | 1.5.0 44 | 0.85 45 | 46 | 47 | 1.4.1 48 | 0.84 49 | 50 | 51 | 1.4.0 52 | 0.84 53 | 54 | 55 | 1.3.2 56 | 0.83.3 57 | 58 | 59 | 1.3.1 60 | 0.83 61 | 62 | 63 | 1.3.0 64 | 0.83 65 | 66 | 67 | 1.2.0 68 | 0.80 69 | 70 | 71 | 1.1.0 72 | 0.78 73 | 74 | 75 | 1.0.3 76 | 0.72.1 77 | 78 | 79 | 1.0.2 80 | 0.72.1 81 | 82 | 83 | 1.0.1 84 | 0.72.1 85 | 86 | 87 | 1.0.0 88 | 0.72 89 | 90 | 91 | 92 | fr_FR 93 | en_GB 94 | de_DE 95 | es_ES 96 | es_AR 97 | cs_CZ 98 | fi_FI 99 | pl_PL 100 | pt_BR 101 | ro_RO 102 | ru_RU 103 | tr_TR 104 | 105 | 106 | 107 | 108 | Rack 109 | Baie 110 | Inventaire 111 | Gestion 112 | 113 | 114 | Rack 115 | Bay 116 | Inventory 117 | Management 118 | 119 | 120 |
121 | -------------------------------------------------------------------------------- /inc/config.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksConfig extends CommonDBTM { 35 | 36 | static $rightname = "plugin_racks"; 37 | 38 | //Metric unit, for more information see : 39 | //http://en.wikipedia.org/wiki/Metric_system 40 | const METRIC_UNIT = 1; 41 | //No metric unit 42 | const NON_METRIC_UNIT = 2; 43 | 44 | static function getTypeName($nb = 0) { 45 | return __('Setup'); 46 | } 47 | 48 | function showForm() { 49 | $this->getfromDB(1); 50 | $target = self::getFormURL(); 51 | echo "
"; 52 | echo ""; 54 | echo ""; 68 | echo ""; 69 | 70 | echo ""; 71 | echo ""; 74 | echo ""; 77 | echo ""; 78 | 79 | echo ""; 80 | echo ""; 83 | echo ""; 86 | echo ""; 87 | 88 | echo ""; 89 | echo "
"; 53 | echo self::getTypeName(0)."
".__('Configuration of units', 'racks').""; 55 | echo " "; 67 | echo "
"; 72 | echo __("Copy rack's location when adding a new asset in the rack", "racks"); 73 | echo ""; 75 | Dropdown::showYesNo('add_location_on_new_item', $this->fields['add_location_on_new_item']); 76 | echo "
"; 81 | echo __("Forward rack's location to linked assets on change", "racks"); 82 | echo ""; 84 | Dropdown::showYesNo('forward_location_on_change', $this->fields['forward_location_on_change']); 85 | echo "
"; 90 | echo Html::hidden('id', ['value' => 1]); 91 | echo Html::submit(_sx('button', 'Post'), ['name' => 'update']); 92 | echo "
"; 93 | Html::closeForm(); 94 | echo "
"; 95 | 96 | } 97 | 98 | function canForwardLocation() { 99 | return $this->fields['forward_location_on_change']; 100 | } 101 | 102 | function canAddLocationOnNewItem() { 103 | return $this->fields['add_location_on_new_item']; 104 | } 105 | 106 | function isMetricUnit() { 107 | return ($this->fields["unit"] == self::METRIC_UNIT); 108 | } 109 | 110 | //TODO : this method should return a value, that is diplayed in a form 111 | //it should not echo the value directly 112 | function getUnit($field) { 113 | $units[self::METRIC_UNIT] = ['weight' => __('kg', 'racks'), 114 | 'dissipation' => __('btu/h', 'racks'), 115 | 'rate' => __('m3/h', 'racks'), 116 | 'size' => __('mm', 'racks')]; 117 | 118 | $units[self::NON_METRIC_UNIT] = ['weight' => __('lbs', 'racks'), 119 | 'dissipation' => __('watts', 'racks'), 120 | 'rate' => __('CFM', 'racks'), 121 | 'size' => __('pouces', 'racks')]; 122 | 123 | $this->getFromDB(1); 124 | echo $units[$this->getField('unit')][$field]; 125 | } 126 | 127 | static function getConfig() { 128 | $config = new self(); 129 | $config->getFromDB(1); 130 | return $config; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | function plugin_init_racks() { 31 | global $PLUGIN_HOOKS, $CFG_GLPI; 32 | 33 | $PLUGIN_HOOKS['csrf_compliant']['racks'] = true; 34 | //load changeprofile function 35 | $PLUGIN_HOOKS['change_profile']['racks'] = ['PluginRacksProfile', 36 | 'initProfile']; 37 | $PLUGIN_HOOKS['javascript']['racks'][] = '/plugins/racks/racks.js'; 38 | 39 | $plugin = new Plugin(); 40 | if ($plugin->isInstalled('racks') && $plugin->isActivated('racks')) { 41 | 42 | //Ability to add a rack to a project 43 | $CFG_GLPI["project_asset_types"][] = 'PluginRacksRack'; 44 | 45 | $PLUGIN_HOOKS['assign_to_ticket']['racks'] = true; 46 | Plugin::registerClass('PluginRacksRack', 47 | ['document_types' => true, 48 | 'location_types' => true, 49 | 'unicity_types' => true, 50 | 'linkgroup_tech_types' => true, 51 | 'linkuser_tech_types' => true, 52 | 'infocom_types' => true, 53 | 'ticket_types' => true]); 54 | Plugin::registerClass('PluginRacksProfile', 55 | ['addtabon' => 'Profile']); 56 | 57 | $types = ['PluginAppliancesAppliance', 58 | 'PluginManufacturersimportsConfig', 59 | 'PluginTreeviewConfig', 60 | 'PluginPositionsPosition']; 61 | foreach ($types as $itemtype) { 62 | if (class_exists($itemtype)) { 63 | $itemtype::registerType('PluginRacksRack'); 64 | } 65 | } 66 | 67 | //If treeview plugin is installed, add rack as a type of item 68 | //that can be shown in the tree 69 | if (class_exists('PluginTreeviewConfig')) { 70 | $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png'; 71 | } 72 | 73 | if (Session::getLoginUserID()) { 74 | 75 | include_once (GLPI_ROOT."/plugins/racks/inc/rack.class.php"); 76 | 77 | if (PluginRacksRack::canView()) { 78 | //Display menu entry only if user has right to see it ! 79 | $PLUGIN_HOOKS["menu_toadd"]['racks'] = ['assets' => 'PluginRacksMenu']; 80 | $PLUGIN_HOOKS['use_massive_action']['racks'] = 1; 81 | } 82 | 83 | if (PluginRacksRack::canCreate() 84 | || Config::canUpdate()) { 85 | $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php'; 86 | } 87 | 88 | $PLUGIN_HOOKS['add_css']['racks'] = "racks.css"; 89 | $PLUGIN_HOOKS['post_init']['racks'] = 'plugin_racks_postinit'; 90 | 91 | $PLUGIN_HOOKS['reports']['racks'] = 92 | ['front/report.php' => __("Report - Bays management", "racks")]; 93 | } 94 | } 95 | } 96 | 97 | function plugin_version_racks() { 98 | return ['name' => _n('Rack enclosure management', 99 | 'Rack enclosures management', 100 | 2, 'racks'), 101 | 'version' => '1.8.0', 102 | 'oldname' => 'rack', 103 | 'license' => 'GPLv2+', 104 | 'author' => 'Philippe Béchu, Walid Nouh, Xavier Caillaud', 105 | 'homepage' => 'https://github.com/InfotelGLPI/racks', 106 | 'minGlpiVersion' => '9.2']; 107 | } 108 | 109 | // Optional : check prerequisites before install : may print errors or add to message after redirect 110 | function plugin_racks_check_prerequisites() { 111 | if (version_compare(GLPI_VERSION, '9.2', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) { 112 | echo __('This plugin requires GLPI >= 9.2'); 113 | return false; 114 | } 115 | return true; 116 | } 117 | 118 | // Uninstall process for plugin : need to return true if succeeded : may display messages or add to message after redirect 119 | function plugin_racks_check_config() { 120 | return true; 121 | } 122 | -------------------------------------------------------------------------------- /ajax/dropdownValue.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | // Direct access to file 31 | if (strpos($_SERVER['PHP_SELF'], "dropdownValue.php")) { 32 | $AJAX_INCLUDE=1; 33 | include ('../../../inc/includes.php'); 34 | header("Content-Type: text/html; charset=UTF-8"); 35 | Html::header_nocache(); 36 | } 37 | 38 | Session::checkCentralAccess(); 39 | Session::checkLoginUser(); 40 | 41 | $item = new $_REQUEST['itemtype']; 42 | $table = getTableForItemType($_REQUEST['itemtype']); 43 | 44 | // Security 45 | if (!$DB->tableExists($table)) { 46 | exit(); 47 | } 48 | 49 | $where = "WHERE 1=1"; 50 | 51 | if ($item->maybeDeleted()) { 52 | $where .= " AND `is_deleted` = '0' "; 53 | } 54 | if ($item->maybeTemplate()) { 55 | $where .= " AND `is_template` = '0' "; 56 | } 57 | 58 | $NBMAX = $CFG_GLPI["dropdown_max"]; 59 | $LIMIT = "LIMIT 0,$NBMAX"; 60 | if ($_REQUEST['searchText'] == $CFG_GLPI["ajax_wildcard"]) { 61 | $LIMIT = ""; 62 | } 63 | 64 | //why ? 65 | $PluginRacksRack_Item = new PluginRacksRack_Item(); 66 | if (in_array(get_class($item), PluginRacksRack::getTypes())) { 67 | if (isset($_REQUEST['value'])) { 68 | $where .= "AND `" .$table. "`.`id` <> '" . $_REQUEST['value'] . "' "; 69 | } 70 | if ($item->isEntityAssign()) { 71 | 72 | $multi = $item->maybeRecursive(); 73 | $field = "entities_id"; 74 | $add_order = " entities_id, "; 75 | if (isset($_REQUEST["entity_restrict"]) && !($_REQUEST["entity_restrict"]<0)) { 76 | $where .= getEntitiesRestrictRequest(" AND ", $table, $field, 77 | $_REQUEST["entity_restrict"]); 78 | if (is_array($_REQUEST["entity_restrict"]) 79 | && count($_REQUEST["entity_restrict"])>1) { 80 | $multi = true; 81 | } 82 | } else { 83 | $where .= getEntitiesRestrictRequest(" AND ", $table, $field); 84 | if (count($_SESSION['glpiactiveentities']) > 1) { 85 | $multi=true; 86 | } 87 | } 88 | } 89 | 90 | if ((strlen($_REQUEST['searchText']) > 0) 91 | && ($_REQUEST['searchText'] != $CFG_GLPI["ajax_wildcard"])) { 92 | $search = Search::makeTextSearch($_REQUEST['searchText']); 93 | 94 | $where .= " AND ($table.`name` ".$search." 95 | OR $table.`id` = '".$_REQUEST['searchText']."' 96 | OR $table.`serial` ".$search." 97 | OR $table.`otherserial` ".$search.")"; 98 | } 99 | 100 | $where .= " AND `" . $table . "`.`id` NOT IN (0"; 101 | $where .= $PluginRacksRack_Item->findItems($DB, $_REQUEST['modeltable']); 102 | $where .= ") "; 103 | $query = "SELECT `" . $table . "`.`name` AS name, 104 | `" . $table . "`.`serial` AS serial, 105 | `" . $table . "`.`otherserial` AS otherserial, 106 | `" . $table . "`.`entities_id` AS entities_id, 107 | `" . $table . "`.`id`, 108 | `glpi_plugin_racks_itemspecifications`.`id` AS spec 109 | FROM `glpi_plugin_racks_itemspecifications`,`" . $table . "` 110 | $where 111 | AND `glpi_plugin_racks_itemspecifications`.`model_id` = `" . $table . "`.`".$_REQUEST['modelfield']."` 112 | AND `glpi_plugin_racks_itemspecifications`.`itemtype` = '" . $_REQUEST['modeltable'] . "' 113 | ORDER BY $add_order `" . $table . "`.`name` 114 | $LIMIT"; 115 | $result = $DB->query($query); 116 | } else { 117 | $multi = false; 118 | $query = "SELECT `glpi_plugin_racks_othermodels`.`id`, 119 | `glpi_plugin_racks_othermodels`.`name`, 120 | `glpi_plugin_racks_othermodels`.`comment`, 121 | `glpi_plugin_racks_itemspecifications`.`id` AS spec 122 | FROM `glpi_plugin_racks_othermodels`, 123 | `glpi_plugin_racks_itemspecifications` 124 | WHERE `glpi_plugin_racks_itemspecifications`.`model_id` = `glpi_plugin_racks_othermodels`.`id` 125 | AND `glpi_plugin_racks_itemspecifications`.`itemtype` = '".$_REQUEST['modeltable']."' 126 | ORDER BY `glpi_plugin_racks_othermodels`.`name` $LIMIT"; 127 | $result = $DB->query($query); 128 | } 129 | 130 | $return = ['results' => [['id' => null, 'text' => '-----']]]; 131 | $results = &$return['results']; 132 | if ($count = $DB->numrows($result)) { 133 | $prev = -1; 134 | $tmp_results = []; 135 | while ($data=$DB->fetch_array($result)) { 136 | $entities_id = 0; 137 | if (isset($data["entities_id"])) { 138 | $entities_id = $data["entities_id"]; 139 | } 140 | $name = $data["name"]; 141 | if (isset($data['serial'])) { 142 | $name.= ' '.$data["serial"]; 143 | } 144 | if (isset($data['otherserial'])) { 145 | $name.= ' '.$data['otherserial']; 146 | } 147 | 148 | $tmp_results[$entities_id]['text']= Dropdown::getDropdownName("glpi_entities", $entities_id); 149 | $tmp_results[$entities_id]['children'][] = ['id' => $_REQUEST["modeltable"].";". 150 | $data['id'].";". 151 | $data['spec'], 152 | 'level' => 1, 153 | 'text' => Toolbox::substr($name, 0, 154 | 50)]; 155 | } 156 | 157 | foreach ($tmp_results as $tmp_result) { 158 | $results[] = $tmp_result; 159 | } 160 | } 161 | 162 | $return['count'] = $count; 163 | echo json_encode($return); 164 | -------------------------------------------------------------------------------- /front/rack.form.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | include('../../../inc/includes.php'); 31 | 32 | if (!isset($_GET["id"])) { 33 | $_GET["id"] = ""; 34 | } 35 | if (!isset ($_GET["withtemplate"])) { 36 | $_GET["withtemplate"] = ""; 37 | } 38 | 39 | $PluginRacksRack = new PluginRacksRack(); 40 | $PluginRacksOther = new PluginRacksOther(); 41 | $PluginRacksRack_Item = new PluginRacksRack_Item(); 42 | 43 | if (isset ($_POST["add"])) { 44 | $PluginRacksRack->check(-1, CREATE, $_POST); 45 | 46 | $newID = $PluginRacksRack->add($_POST); 47 | if ($_SESSION['glpibackcreated']) { 48 | Html::redirect($PluginRacksRack->getFormURL() . "?id=" . $newID); 49 | } 50 | Html::back(); 51 | 52 | } else if (isset ($_POST["delete"])) { 53 | 54 | $PluginRacksRack->check($_POST['id'], DELETE); 55 | $PluginRacksRack->delete($_POST); 56 | $PluginRacksRack->redirectToList(); 57 | 58 | } else if (isset ($_POST["restore"])) { 59 | 60 | $PluginRacksRack->check($_POST['id'], PURGE); 61 | $PluginRacksRack->restore($_POST); 62 | $PluginRacksRack->redirectToList(); 63 | 64 | } else if (isset ($_POST["purge"])) { 65 | 66 | $PluginRacksRack->check($_POST['id'], PURGE); 67 | $PluginRacksRack->delete($_POST, true); 68 | $PluginRacksRack->redirectToList(); 69 | 70 | } else if (isset ($_POST["update"])) { 71 | 72 | $PluginRacksRack->check($_POST['id'], UPDATE); 73 | $PluginRacksRack->update($_POST); 74 | Html::back(); 75 | 76 | } else if (isset ($_POST["addDevice"])) { 77 | if (!isset ($_POST['rack_size'])) { 78 | $PluginRacksRack->getFromDB($_POST['racks_id']); 79 | $_POST['rack_size'] = $PluginRacksRack->fields['rack_size']; 80 | } 81 | 82 | $test = explode(";", $_POST['itemtype']); 83 | 84 | $_POST['itemtype'] = $test[0]; 85 | $_POST['items_id'] = $test[1]; 86 | $_POST['plugin_racks_itemspecifications_id'] = $test[2]; 87 | 88 | if ($_POST['itemtype'] == 'PluginRacksOtherModel') { 89 | $newid = $PluginRacksOther->addOthers($_POST['items_id']); 90 | $_POST['items_id'] = $newid; 91 | } 92 | 93 | if (!empty($_POST['itemtype']) && $_POST['items_id'] > 0 && !empty ($_POST['pos'])) { 94 | if ($PluginRacksRack->canCreate()) { 95 | $space_left = $PluginRacksRack_Item->addItem($_POST['plugin_racks_racks_id'], 96 | $_POST['rack_size'], 97 | $_POST['faces_id'], 98 | $_POST['items_id'], 99 | $_POST['itemtype'], 100 | $_POST['plugin_racks_itemspecifications_id'], 101 | $_POST['pos']); 102 | if ($space_left < 0) { 103 | if ($_POST['itemtype'] == 'PluginRacksOtherModel') { 104 | $PluginRacksOther->deleteOthers($_POST['items_id']); 105 | } 106 | Session::addMessageAfterRedirect(__('No more place for insertion', 'racks'), 107 | false, ERROR); 108 | } 109 | } 110 | } 111 | Html::back(); 112 | 113 | } else if (isset ($_POST["deleteDevice"])) { 114 | 115 | if ($PluginRacksRack->canCreate() 116 | && isset($_POST["item"])) { 117 | foreach ($_POST["item"] as $key => $val) { 118 | $input = ['id' => $key]; 119 | if ($val == 1) { 120 | $PluginRacksRack_Item->delete($input); 121 | 122 | $vartype = "type" . $key; 123 | $varitems_id = "items_id" . $key; 124 | if ($_POST[$vartype] == 'PluginRacksOtherModel') { 125 | $PluginRacksOther->deleteOthers($_POST[$varitems_id]); 126 | } 127 | } 128 | } 129 | } 130 | Html::back(); 131 | } else if (isset ($_POST["deleteitem"])) { 132 | $input = ['id' => $_POST["id"]]; 133 | $PluginRacksRack_Item->check($_POST["id"], UPDATE); 134 | $PluginRacksRack_Item->delete($input); 135 | Html::back(); 136 | } else if (isset ($_POST["update_server"])) { 137 | if ($PluginRacksRack->canCreate()) { 138 | if ($_POST["updateDevice"]) { 139 | $key = $_POST["updateDevice"]; 140 | $vartype = "type"; 141 | $varspec = "plugin_racks_itemspecifications_id"; 142 | $varname = "name"; 143 | $varitems_id = "items_id"; 144 | if ($_POST[$vartype] == 'PluginRacksOtherModel') { 145 | $PluginRacksOther->updateOthers($_POST[$varitems_id], $_POST[$varname]); 146 | } 147 | $varpos = "position" . $key; 148 | 149 | $space_left = $PluginRacksRack_Item->updateItem($key, 150 | $_POST[$vartype], 151 | $_POST[$varspec], 152 | $_POST['plugin_racks_racks_id'], 153 | $_POST['rack_size'], 154 | $_POST['faces_id'], 155 | $_POST[$varitems_id], 156 | $_POST[$varpos]); 157 | } 158 | } 159 | if ($space_left < 0) { 160 | Session::addMessageAfterRedirect(__('No more place for insertion', 'racks'), false, ERROR); 161 | } 162 | Html::back(); 163 | } else { 164 | $PluginRacksRack->checkGlobal(READ); 165 | Html::header(PluginRacksRack::getTypeName(2), '', "assets", "pluginracksmenu", "racks"); 166 | $PluginRacksRack->display($_GET); 167 | Html::footer(); 168 | } 169 | -------------------------------------------------------------------------------- /sql/empty-1.0.0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_rack` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_rack`; 6 | CREATE TABLE `glpi_plugin_rack` ( 7 | `ID` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, 9 | `FK_location` int(11) NOT NULL, 10 | `room_location` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, 11 | `rack_size` int(11) NOT NULL, 12 | `FK_glpi_enterprise` smallint(6) NOT NULL, 13 | `deleted` smallint(6) NOT NULL default '0', 14 | `FK_entities` tinyint(4) NOT NULL default '0', 15 | `recursive` tinyint(11) NOT NULL default '0', 16 | `notes` LONGTEXT, 17 | `FK_groups` int(11) NOT NULL default '0', 18 | `tech_num` int(11) NOT NULL default '0', 19 | `weight` decimal(20,4) NOT NULL default '0.0000', 20 | `height` decimal(20,4) NOT NULL default '0.0000', 21 | `width` decimal(20,4) NOT NULL default '0.0000', 22 | `depth` decimal(20,4) NOT NULL default '0.0000', 23 | `is_template` int(1) NOT NULL default 0, 24 | `tplname` varchar(255) NULL, 25 | PRIMARY KEY (`ID`) 26 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; 27 | 28 | -- -------------------------------------------------------- 29 | 30 | -- 31 | -- Structure de la table `glpi_plugin_rack_content` 32 | -- 33 | 34 | DROP TABLE IF EXISTS `glpi_plugin_rack_content`; 35 | CREATE TABLE `glpi_plugin_rack_content` ( 36 | `ID` int(11) NOT NULL auto_increment, 37 | `FK_rack` int(11) NOT NULL default '0', 38 | `FK_face` int(11) NOT NULL default '0', 39 | `FK_spec` int(11) NOT NULL default '0', 40 | `FK_device` int(11) NOT NULL default '0', 41 | `device_type` int(11) NOT NULL default '0', 42 | `position` int(11) NOT NULL default '1', 43 | `alim1` tinyint(4) NOT NULL default '0', 44 | `alim2` tinyint(4) NOT NULL default '0', 45 | `amps` decimal(20,4) NOT NULL default '0.0000', 46 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 47 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 48 | `weight` decimal(20,4) NOT NULL default '0.0000', 49 | PRIMARY KEY (`ID`) 50 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; 51 | 52 | 53 | -- -------------------------------------------------------- 54 | 55 | -- 56 | -- Structure de la table `glpi_plugin_rack_device_spec` 57 | -- 58 | 59 | CREATE TABLE `glpi_plugin_rack_device_spec` ( 60 | `ID` int(11) NOT NULL auto_increment, 61 | `FK_model` int(11) NOT NULL default '0', 62 | `device_type` int(11) NOT NULL default '0', 63 | `nb_alim` int(11) NOT NULL default '0', 64 | `amps` decimal(20,4) NOT NULL default '0.0000', 65 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 66 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 67 | `size` int(255) NOT NULL default '1', 68 | `weight` decimal(20,4) NOT NULL default '0.0000', 69 | `length` smallint(6) NOT NULL default '0', 70 | PRIMARY KEY (`ID`) 71 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ; 72 | 73 | -- -------------------------------------------------------- 74 | -- 75 | -- Structure de la table `glpi_plugin_rack_profiles` 76 | -- 77 | 78 | DROP TABLE IF EXISTS `glpi_plugin_rack_profiles`; 79 | CREATE TABLE `glpi_plugin_rack_profiles` ( 80 | `ID` int(11) NOT NULL auto_increment, 81 | `name` varchar(255) collate utf8_unicode_ci NOT NULL default '', 82 | `rack` char(1) collate utf8_unicode_ci default NULL, 83 | `model` char(1) collate utf8_unicode_ci default NULL, 84 | PRIMARY KEY (`ID`), 85 | KEY `name` (`name`) 86 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 87 | 88 | -- -------------------------------------------------------- 89 | -- 90 | -- Structure de la table `glpi_plugin_rack_config` 91 | -- 92 | 93 | DROP TABLE IF EXISTS `glpi_plugin_rack_config`; 94 | CREATE TABLE `glpi_plugin_rack_config` ( 95 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , 96 | `unit` INT( 11 ) NOT NULL 97 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 98 | 99 | INSERT INTO `glpi_plugin_rack_config` (`ID`, `unit`) VALUES ('1', '1'); 100 | 101 | -- -------------------------------------------------------- 102 | -- 103 | -- Structure de la table `glpi_dropdown_plugin_rack_room_locations` 104 | -- 105 | 106 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_room_locations`; 107 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_room_locations` ( 108 | `ID` int(11) NOT NULL auto_increment, 109 | `FK_entities` int(11) NOT NULL default '0', 110 | `name` varchar(255) collate utf8_unicode_ci default NULL, 111 | `parentID` int(11) NOT NULL default '0', 112 | `completename` text collate utf8_unicode_ci, 113 | `comments` text collate utf8_unicode_ci, 114 | `level` int(11) NOT NULL default '0', 115 | PRIMARY KEY (`ID`), 116 | UNIQUE KEY `name` (`name`,`parentID`,`FK_entities`), 117 | KEY `parentID` (`parentID`), 118 | KEY `FK_entities` (`FK_entities`) 119 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 120 | 121 | -- -------------------------------------------------------- 122 | -- 123 | -- Structure de la table `glpi_dropdown_plugin_rack_ways` 124 | -- 125 | 126 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_ways`; 127 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_ways` ( 128 | `ID` int(11) NOT NULL auto_increment, 129 | `name` varchar(255) collate utf8_unicode_ci default NULL, 130 | `comments` text collate utf8_unicode_ci, 131 | PRIMARY KEY (`ID`), 132 | KEY `name` (`name`) 133 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 134 | 135 | -- -------------------------------------------------------- 136 | -- 137 | -- Structure de la table `glpi_plugin_rack_others` 138 | -- 139 | 140 | DROP TABLE IF EXISTS `glpi_plugin_rack_others`; 141 | CREATE TABLE IF NOT EXISTS `glpi_plugin_rack_others` ( 142 | `ID` int(11) NOT NULL auto_increment, 143 | `FK_entities` int(11) NOT NULL default '0', 144 | `name` varchar(255) collate utf8_unicode_ci default NULL, 145 | `model` int(11) NOT NULL default '0', 146 | PRIMARY KEY (`ID`), 147 | KEY `name` (`name`) 148 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 149 | 150 | -- -------------------------------------------------------- 151 | -- 152 | -- Structure de la table `glpi_dropdown_plugin_rack_others_type` 153 | -- 154 | 155 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_others_type`; 156 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_others_type` ( 157 | `ID` int(11) NOT NULL auto_increment, 158 | `name` varchar(255) collate utf8_unicode_ci default NULL, 159 | `comments` text collate utf8_unicode_ci, 160 | PRIMARY KEY (`ID`), 161 | KEY `name` (`name`) 162 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 163 | 164 | INSERT INTO glpi_display VALUES (NULL,'4450','2','2','0'); 165 | INSERT INTO glpi_display VALUES (NULL,'4450','3','3','0'); 166 | INSERT INTO glpi_display VALUES (NULL,'4450','4','4','0'); 167 | INSERT INTO glpi_display VALUES (NULL,'4450','5','5','0'); -------------------------------------------------------------------------------- /sql/empty-1.0.2.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_rack` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_rack`; 6 | CREATE TABLE `glpi_plugin_rack` ( 7 | `ID` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, 9 | `FK_location` int(11) NOT NULL, 10 | `room_location` varchar(255) character set utf8 collate utf8_unicode_ci NOT NULL, 11 | `rack_size` int(11) NOT NULL, 12 | `FK_glpi_enterprise` smallint(6) NOT NULL, 13 | `deleted` smallint(6) NOT NULL default '0', 14 | `FK_entities` tinyint(4) NOT NULL default '0', 15 | `recursive` tinyint(11) NOT NULL default '0', 16 | `notes` LONGTEXT, 17 | `FK_groups` int(11) NOT NULL default '0', 18 | `tech_num` int(11) NOT NULL default '0', 19 | `weight` decimal(20,4) NOT NULL default '0.0000', 20 | `height` decimal(20,4) NOT NULL default '0.0000', 21 | `width` decimal(20,4) NOT NULL default '0.0000', 22 | `depth` decimal(20,4) NOT NULL default '0.0000', 23 | `is_template` int(1) NOT NULL default 0, 24 | `tplname` varchar(255) NULL, 25 | PRIMARY KEY (`ID`) 26 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; 27 | 28 | -- -------------------------------------------------------- 29 | 30 | -- 31 | -- Structure de la table `glpi_plugin_rack_content` 32 | -- 33 | 34 | DROP TABLE IF EXISTS `glpi_plugin_rack_content`; 35 | CREATE TABLE `glpi_plugin_rack_content` ( 36 | `ID` int(11) NOT NULL auto_increment, 37 | `FK_rack` int(11) NOT NULL default '0', 38 | `FK_face` int(11) NOT NULL default '0', 39 | `FK_spec` int(11) NOT NULL default '0', 40 | `FK_device` int(11) NOT NULL default '0', 41 | `device_type` int(11) NOT NULL default '0', 42 | `position` int(11) NOT NULL default '1', 43 | `first_powersupply` int(11) NOT NULL default '0', 44 | `second_powersupply` int(11) NOT NULL default '0', 45 | `amps` decimal(20,4) NOT NULL default '0.0000', 46 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 47 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 48 | `weight` decimal(20,4) NOT NULL default '0.0000', 49 | PRIMARY KEY (`ID`) 50 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 ; 51 | 52 | 53 | -- -------------------------------------------------------- 54 | 55 | -- 56 | -- Structure de la table `glpi_plugin_rack_device_spec` 57 | -- 58 | 59 | CREATE TABLE `glpi_plugin_rack_device_spec` ( 60 | `ID` int(11) NOT NULL auto_increment, 61 | `FK_model` int(11) NOT NULL default '0', 62 | `device_type` int(11) NOT NULL default '0', 63 | `nb_alim` int(11) NOT NULL default '0', 64 | `amps` decimal(20,4) NOT NULL default '0.0000', 65 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 66 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 67 | `size` int(255) NOT NULL default '1', 68 | `weight` decimal(20,4) NOT NULL default '0.0000', 69 | `length` smallint(6) NOT NULL default '0', 70 | PRIMARY KEY (`ID`) 71 | ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci ; 72 | 73 | -- -------------------------------------------------------- 74 | -- 75 | -- Structure de la table `glpi_plugin_rack_profiles` 76 | -- 77 | 78 | DROP TABLE IF EXISTS `glpi_plugin_rack_profiles`; 79 | CREATE TABLE `glpi_plugin_rack_profiles` ( 80 | `ID` int(11) NOT NULL auto_increment, 81 | `name` varchar(255) collate utf8_unicode_ci NOT NULL default '', 82 | `rack` char(1) collate utf8_unicode_ci default NULL, 83 | `model` char(1) collate utf8_unicode_ci default NULL, 84 | PRIMARY KEY (`ID`), 85 | KEY `name` (`name`) 86 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 87 | 88 | -- -------------------------------------------------------- 89 | -- 90 | -- Structure de la table `glpi_plugin_rack_config` 91 | -- 92 | 93 | DROP TABLE IF EXISTS `glpi_plugin_rack_config`; 94 | CREATE TABLE `glpi_plugin_rack_config` ( 95 | `ID` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , 96 | `unit` INT( 11 ) NOT NULL 97 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 98 | 99 | INSERT INTO `glpi_plugin_rack_config` (`ID`, `unit`) VALUES ('1', '1'); 100 | 101 | -- -------------------------------------------------------- 102 | -- 103 | -- Structure de la table `glpi_dropdown_plugin_rack_room_locations` 104 | -- 105 | 106 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_room_locations`; 107 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_room_locations` ( 108 | `ID` int(11) NOT NULL auto_increment, 109 | `FK_entities` int(11) NOT NULL default '0', 110 | `name` varchar(255) collate utf8_unicode_ci default NULL, 111 | `parentID` int(11) NOT NULL default '0', 112 | `completename` text collate utf8_unicode_ci, 113 | `comments` text collate utf8_unicode_ci, 114 | `level` int(11) NOT NULL default '0', 115 | PRIMARY KEY (`ID`), 116 | UNIQUE KEY `name` (`name`,`parentID`,`FK_entities`), 117 | KEY `parentID` (`parentID`), 118 | KEY `FK_entities` (`FK_entities`) 119 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 120 | 121 | -- -------------------------------------------------------- 122 | -- 123 | -- Structure de la table `glpi_dropdown_plugin_rack_ways` 124 | -- 125 | 126 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_ways`; 127 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_ways` ( 128 | `ID` int(11) NOT NULL auto_increment, 129 | `name` varchar(255) collate utf8_unicode_ci default NULL, 130 | `comments` text collate utf8_unicode_ci, 131 | PRIMARY KEY (`ID`), 132 | KEY `name` (`name`) 133 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 134 | 135 | -- -------------------------------------------------------- 136 | -- 137 | -- Structure de la table `glpi_plugin_rack_others` 138 | -- 139 | 140 | DROP TABLE IF EXISTS `glpi_plugin_rack_others`; 141 | CREATE TABLE IF NOT EXISTS `glpi_plugin_rack_others` ( 142 | `ID` int(11) NOT NULL auto_increment, 143 | `FK_entities` int(11) NOT NULL default '0', 144 | `name` varchar(255) collate utf8_unicode_ci default NULL, 145 | `model` int(11) NOT NULL default '0', 146 | PRIMARY KEY (`ID`), 147 | KEY `name` (`name`) 148 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 149 | 150 | -- -------------------------------------------------------- 151 | -- 152 | -- Structure de la table `glpi_dropdown_plugin_rack_others_type` 153 | -- 154 | 155 | DROP TABLE IF EXISTS `glpi_dropdown_plugin_rack_others_type`; 156 | CREATE TABLE IF NOT EXISTS `glpi_dropdown_plugin_rack_others_type` ( 157 | `ID` int(11) NOT NULL auto_increment, 158 | `name` varchar(255) collate utf8_unicode_ci default NULL, 159 | `comments` text collate utf8_unicode_ci, 160 | PRIMARY KEY (`ID`), 161 | KEY `name` (`name`) 162 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ; 163 | 164 | INSERT INTO glpi_display VALUES (NULL,'4450','2','2','0'); 165 | INSERT INTO glpi_display VALUES (NULL,'4450','3','3','0'); 166 | INSERT INTO glpi_display VALUES (NULL,'4450','4','4','0'); 167 | INSERT INTO glpi_display VALUES (NULL,'4450','5','5','0'); -------------------------------------------------------------------------------- /sql/update-1.1.0.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `glpi_plugin_rack` RENAME `glpi_plugin_racks_racks`; 2 | ALTER TABLE `glpi_plugin_rack_content` RENAME `glpi_plugin_racks_racks_items`; 3 | ALTER TABLE `glpi_plugin_rack_device_spec` RENAME `glpi_plugin_racks_itemspecifications`; 4 | ALTER TABLE `glpi_plugin_rack_config` RENAME `glpi_plugin_racks_configs`; 5 | ALTER TABLE `glpi_dropdown_plugin_rack_room_locations` RENAME `glpi_plugin_racks_roomlocations`; 6 | ALTER TABLE `glpi_dropdown_plugin_rack_ways` RENAME `glpi_plugin_racks_connections`; 7 | ALTER TABLE `glpi_plugin_rack_others` RENAME `glpi_plugin_racks_others`; 8 | ALTER TABLE `glpi_dropdown_plugin_rack_others_type` RENAME `glpi_plugin_racks_othermodels`; 9 | ALTER TABLE `glpi_plugin_rack_profiles` RENAME `glpi_plugin_racks_profiles`; 10 | 11 | ALTER TABLE `glpi_plugin_racks_racks` 12 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 13 | CHANGE `name` `name` varchar(255) collate utf8_unicode_ci default NULL, 14 | CHANGE `FK_entities` `entities_id` int(11) NOT NULL default '0', 15 | CHANGE `recursive` `is_recursive` tinyint(1) NOT NULL default '0', 16 | ADD `serial` varchar(255) collate utf8_unicode_ci default NULL, 17 | ADD `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 18 | CHANGE `FK_location` `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 19 | CHANGE `room_location` `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 20 | CHANGE `rack_size` `rack_size` int(11) NOT NULL default '0', 21 | CHANGE `FK_glpi_enterprise` `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 22 | CHANGE `tech_num` `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 23 | CHANGE `FK_groups` `groups_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 24 | CHANGE `deleted` `is_deleted` tinyint(1) NOT NULL default '0', 25 | CHANGE `notes` `notepad` longtext collate utf8_unicode_ci, 26 | CHANGE `is_template` `is_template` tinyint(1) NOT NULL default '0', 27 | CHANGE `tplname` `template_name` varchar(255) collate utf8_unicode_ci default NULL, 28 | ADD `date_mod` datetime default NULL, 29 | ADD INDEX (`name`), 30 | ADD INDEX (`entities_id`), 31 | ADD INDEX (`plugin_racks_roomlocations_id`), 32 | ADD INDEX (`users_id`), 33 | ADD INDEX (`groups_id`), 34 | ADD INDEX (`manufacturers_id`), 35 | ADD INDEX (`locations_id`), 36 | ADD INDEX (`is_deleted`), 37 | ADD INDEX (`is_template`), 38 | ADD INDEX (`date_mod`); 39 | 40 | ALTER TABLE `glpi_plugin_racks_racks_items` 41 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 42 | CHANGE `FK_rack` `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 43 | CHANGE `FK_face` `faces_id` int(11) NOT NULL default '0', 44 | CHANGE `FK_spec` `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 45 | CHANGE `FK_device` `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 46 | CHANGE `device_type` `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 47 | ADD UNIQUE `unicity` (`plugin_racks_racks_id`,`itemtype`,`items_id`), 48 | ADD INDEX `FK_device` (`items_id`,`itemtype`), 49 | ADD INDEX `item` (`itemtype`,`items_id`), 50 | ADD INDEX (`plugin_racks_racks_id`), 51 | ADD INDEX (`faces_id`), 52 | ADD INDEX (`plugin_racks_itemspecifications_id`); 53 | 54 | ALTER TABLE `glpi_plugin_racks_itemspecifications` 55 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 56 | CHANGE `FK_model` `model_id` int(11) NOT NULL default '0', 57 | CHANGE `device_type` `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file'; 58 | 59 | ALTER TABLE `glpi_plugin_racks_profiles` 60 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 61 | ADD `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 62 | CHANGE `rack` `racks` char(1) collate utf8_unicode_ci default NULL, 63 | ADD INDEX (`profiles_id`); 64 | 65 | ALTER TABLE `glpi_plugin_racks_configs` 66 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 67 | CHANGE `unit` `unit` int(11) NOT NULL default '0'; 68 | 69 | ALTER TABLE `glpi_plugin_racks_roomlocations` 70 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 71 | CHANGE `FK_entities` `entities_id` int(11) NOT NULL default '0', 72 | CHANGE `name` `name` varchar(255) collate utf8_unicode_ci default NULL, 73 | CHANGE `parentID` `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 74 | CHANGE `comments` `comment` text collate utf8_unicode_ci, 75 | DROP INDEX `name`, 76 | DROP INDEX `parentID`, 77 | DROP INDEX `FK_entities`, 78 | ADD INDEX (`name`), 79 | ADD INDEX (`plugin_racks_roomlocations_id`), 80 | ADD INDEX (`entities_id`), 81 | ADD UNIQUE (`entities_id`,`plugin_racks_roomlocations_id`,`name`); 82 | 83 | ALTER TABLE `glpi_plugin_racks_connections` 84 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 85 | CHANGE `name` `name` varchar(255) collate utf8_unicode_ci default NULL, 86 | CHANGE `comments` `comment` text collate utf8_unicode_ci; 87 | 88 | ALTER TABLE `glpi_plugin_racks_others` 89 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 90 | CHANGE `FK_entities` `entities_id` int(11) NOT NULL default '0', 91 | CHANGE `name` `name` varchar(255) collate utf8_unicode_ci default NULL, 92 | CHANGE `model` `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 93 | ADD INDEX (`entities_id`), 94 | ADD INDEX (`plugin_racks_othermodels_id`); 95 | 96 | ALTER TABLE `glpi_plugin_racks_othermodels` 97 | CHANGE `ID` `id` int(11) NOT NULL auto_increment, 98 | CHANGE `name` `name` varchar(255) collate utf8_unicode_ci default NULL, 99 | CHANGE `comments` `comment` text collate utf8_unicode_ci; 100 | 101 | 102 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 103 | `id` int(11) NOT NULL auto_increment, 104 | `name` varchar(255) collate utf8_unicode_ci default NULL, 105 | `comment` text collate utf8_unicode_ci, 106 | PRIMARY KEY (`id`), 107 | KEY `name` (`name`) 108 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 109 | 110 | UPDATE `glpi_plugin_racks_itemspecifications` SET `itemtype` = 'ComputerModel' WHERE `itemtype` = 1; 111 | UPDATE `glpi_plugin_racks_itemspecifications` SET `itemtype` = 'NetworkEquipmentModel' WHERE `itemtype` = 2; 112 | UPDATE `glpi_plugin_racks_itemspecifications` SET `itemtype` = 'PeripheralModel' WHERE `itemtype` = 5; 113 | UPDATE `glpi_plugin_racks_itemspecifications` SET `itemtype` = 'PluginRacksOtherModel' WHERE `itemtype` = 4451; 114 | 115 | UPDATE `glpi_plugin_racks_racks_items` SET `itemtype` = 'ComputerModel' WHERE `itemtype` = 1; 116 | UPDATE `glpi_plugin_racks_racks_items` SET `itemtype` = 'NetworkEquipmentModel' WHERE `itemtype` = 2; 117 | UPDATE `glpi_plugin_racks_racks_items` SET `itemtype` = 'PeripheralModel' WHERE `itemtype` = 5; 118 | UPDATE `glpi_plugin_racks_racks_items` SET `itemtype` = 'PluginRacksOtherModel' WHERE `itemtype` = 4451; -------------------------------------------------------------------------------- /sql/empty-1.1.0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 16 | `groups_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 17 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 18 | `rack_size` int(11) NOT NULL default '0', 19 | `weight` decimal(20,4) NOT NULL default '0.0000', 20 | `height` decimal(20,4) NOT NULL default '0.0000', 21 | `width` decimal(20,4) NOT NULL default '0.0000', 22 | `depth` decimal(20,4) NOT NULL default '0.0000', 23 | `is_template` tinyint(1) NOT NULL default '0', 24 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 25 | `is_deleted` tinyint(1) NOT NULL default '0', 26 | `notepad` longtext collate utf8_unicode_ci, 27 | `date_mod` datetime default NULL, 28 | PRIMARY KEY (`id`), 29 | KEY `name` (`name`), 30 | KEY `entities_id` (`entities_id`), 31 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 32 | KEY `users_id` (`users_id`), 33 | KEY `groups_id` (`groups_id`), 34 | KEY `manufacturers_id` (`manufacturers_id`), 35 | KEY `locations_id` (`locations_id`), 36 | KEY `is_deleted` (`is_deleted`), 37 | KEY date_mod (date_mod), 38 | KEY `is_template` (`is_template`) 39 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 40 | 41 | -- -------------------------------------------------------- 42 | -- 43 | -- Structure de la table `glpi_plugin_rackmodels` 44 | -- 45 | 46 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 47 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 48 | `id` int(11) NOT NULL auto_increment, 49 | `name` varchar(255) collate utf8_unicode_ci default NULL, 50 | `comment` text collate utf8_unicode_ci, 51 | PRIMARY KEY (`id`), 52 | KEY `name` (`name`) 53 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 54 | 55 | -- -------------------------------------------------------- 56 | -- 57 | -- Structure de la table `glpi_plugin_racks_racks_items` 58 | -- 59 | 60 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 61 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 62 | `id` int(11) NOT NULL auto_increment, 63 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 64 | `faces_id` int(11) NOT NULL default '0', 65 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 66 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 67 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 68 | `position` int(11) NOT NULL default '1', 69 | `first_powersupply` int(11) NOT NULL default '0', 70 | `second_powersupply` int(11) NOT NULL default '0', 71 | `amps` decimal(20,4) NOT NULL default '0.0000', 72 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 73 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 74 | `weight` decimal(20,4) NOT NULL default '0.0000', 75 | PRIMARY KEY (`id`), 76 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 77 | KEY `FK_device` (`items_id`,`itemtype`), 78 | KEY `item` (`itemtype`,`items_id`), 79 | KEY `faces_id` (`faces_id`), 80 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 81 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 82 | 83 | 84 | -- -------------------------------------------------------- 85 | -- 86 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 87 | -- 88 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 89 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 90 | `id` int(11) NOT NULL auto_increment, 91 | `model_id` int(11) NOT NULL default '0', 92 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 93 | `nb_alim` int(11) NOT NULL default '0', 94 | `amps` decimal(20,4) NOT NULL default '0.0000', 95 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 96 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 97 | `size` int(255) NOT NULL default '1', 98 | `weight` decimal(20,4) NOT NULL default '0.0000', 99 | `length` smallint(6) NOT NULL default '0', 100 | PRIMARY KEY (`id`) 101 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 102 | 103 | -- -------------------------------------------------------- 104 | -- 105 | -- Structure de la table `glpi_plugin_racks_profiles` 106 | -- 107 | 108 | DROP TABLE IF EXISTS `glpi_plugin_racks_profiles`; 109 | CREATE TABLE `glpi_plugin_racks_profiles` ( 110 | `id` int(11) NOT NULL auto_increment, 111 | `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 112 | `racks` char(1) collate utf8_unicode_ci default NULL, 113 | `model` char(1) collate utf8_unicode_ci default NULL, 114 | PRIMARY KEY (`id`), 115 | KEY `profiles_id` (`profiles_id`) 116 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 117 | 118 | -- -------------------------------------------------------- 119 | -- 120 | -- Structure de la table `glpi_plugin_racks_configs` 121 | -- 122 | 123 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 124 | CREATE TABLE `glpi_plugin_racks_configs` ( 125 | `id` int(11) NOT NULL auto_increment, 126 | `unit` int(11) NOT NULL default '0', 127 | PRIMARY KEY (`id`) 128 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 129 | 130 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1'); 131 | 132 | -- -------------------------------------------------------- 133 | -- 134 | -- Structure de la table `glpi_plugin_racks_roomlocations` 135 | -- 136 | 137 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 138 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 139 | `id` int(11) NOT NULL auto_increment, 140 | `entities_id` int(11) NOT NULL default '0', 141 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 142 | `name` varchar(255) collate utf8_unicode_ci default NULL, 143 | `completename` text collate utf8_unicode_ci, 144 | `comment` text collate utf8_unicode_ci, 145 | `level` int(11) NOT NULL default '0', 146 | PRIMARY KEY (`id`), 147 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 148 | KEY `name` (`name`), 149 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 150 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 151 | 152 | -- -------------------------------------------------------- 153 | -- 154 | -- Structure de la table `glpi_plugin_racks_connections` 155 | -- 156 | 157 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 158 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 159 | `id` int(11) NOT NULL auto_increment, 160 | `name` varchar(255) collate utf8_unicode_ci default NULL, 161 | `comment` text collate utf8_unicode_ci, 162 | PRIMARY KEY (`id`), 163 | KEY `name` (`name`) 164 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 165 | 166 | -- -------------------------------------------------------- 167 | -- 168 | -- Structure de la table `glpi_plugin_rack_others` 169 | -- 170 | 171 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 172 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 173 | `id` int(11) NOT NULL auto_increment, 174 | `entities_id` int(11) NOT NULL default '0', 175 | `name` varchar(255) collate utf8_unicode_ci default NULL, 176 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 177 | PRIMARY KEY (`ID`), 178 | KEY `name` (`name`), 179 | KEY `entities_id` (`entities_id`), 180 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 181 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 182 | 183 | -- -------------------------------------------------------- 184 | -- 185 | -- Structure de la table `glpi_plugin_racks_othermodels` 186 | -- 187 | 188 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 189 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 190 | `id` int(11) NOT NULL auto_increment, 191 | `name` varchar(255) collate utf8_unicode_ci default NULL, 192 | `comment` text collate utf8_unicode_ci, 193 | PRIMARY KEY (`ID`), 194 | KEY `name` (`name`) 195 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 196 | 197 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 198 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 199 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 200 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); -------------------------------------------------------------------------------- /sql/empty-1.2.1.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `users_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 16 | `groups_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 17 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 18 | `rack_size` int(11) NOT NULL default '0', 19 | `weight` decimal(20,4) NOT NULL default '0.0000', 20 | `height` decimal(20,4) NOT NULL default '0.0000', 21 | `width` decimal(20,4) NOT NULL default '0.0000', 22 | `depth` decimal(20,4) NOT NULL default '0.0000', 23 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 24 | `is_template` tinyint(1) NOT NULL default '0', 25 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 26 | `is_deleted` tinyint(1) NOT NULL default '0', 27 | `notepad` longtext collate utf8_unicode_ci, 28 | `date_mod` datetime default NULL, 29 | PRIMARY KEY (`id`), 30 | KEY `name` (`name`), 31 | KEY `entities_id` (`entities_id`), 32 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 33 | KEY `users_id` (`users_id`), 34 | KEY `groups_id` (`groups_id`), 35 | KEY `manufacturers_id` (`manufacturers_id`), 36 | KEY `locations_id` (`locations_id`), 37 | KEY `is_deleted` (`is_deleted`), 38 | KEY date_mod (date_mod), 39 | KEY `is_template` (`is_template`) 40 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 41 | 42 | -- -------------------------------------------------------- 43 | -- 44 | -- Structure de la table `glpi_plugin_rackmodels` 45 | -- 46 | 47 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 48 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 49 | `id` int(11) NOT NULL auto_increment, 50 | `name` varchar(255) collate utf8_unicode_ci default NULL, 51 | `comment` text collate utf8_unicode_ci, 52 | PRIMARY KEY (`id`), 53 | KEY `name` (`name`) 54 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 55 | 56 | -- -------------------------------------------------------- 57 | -- 58 | -- Structure de la table `glpi_plugin_racks_racks_items` 59 | -- 60 | 61 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 62 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 63 | `id` int(11) NOT NULL auto_increment, 64 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 65 | `faces_id` int(11) NOT NULL default '0', 66 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 67 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 68 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 69 | `position` int(11) NOT NULL default '1', 70 | `first_powersupply` int(11) NOT NULL default '0', 71 | `second_powersupply` int(11) NOT NULL default '0', 72 | `amps` decimal(20,4) NOT NULL default '0.0000', 73 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 74 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 75 | `weight` decimal(20,4) NOT NULL default '0.0000', 76 | PRIMARY KEY (`id`), 77 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 78 | KEY `FK_device` (`items_id`,`itemtype`), 79 | KEY `item` (`itemtype`,`items_id`), 80 | KEY `faces_id` (`faces_id`), 81 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 82 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 83 | 84 | 85 | -- -------------------------------------------------------- 86 | -- 87 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 88 | -- 89 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 90 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 91 | `id` int(11) NOT NULL auto_increment, 92 | `model_id` int(11) NOT NULL default '0', 93 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 94 | `nb_alim` int(11) NOT NULL default '0', 95 | `amps` decimal(20,4) NOT NULL default '0.0000', 96 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 97 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 98 | `size` int(255) NOT NULL default '1', 99 | `weight` decimal(20,4) NOT NULL default '0.0000', 100 | `length` smallint(6) NOT NULL default '0', 101 | PRIMARY KEY (`id`) 102 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 103 | 104 | -- -------------------------------------------------------- 105 | -- 106 | -- Structure de la table `glpi_plugin_racks_profiles` 107 | -- 108 | 109 | DROP TABLE IF EXISTS `glpi_plugin_racks_profiles`; 110 | CREATE TABLE `glpi_plugin_racks_profiles` ( 111 | `id` int(11) NOT NULL auto_increment, 112 | `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 113 | `racks` char(1) collate utf8_unicode_ci default NULL, 114 | `model` char(1) collate utf8_unicode_ci default NULL, 115 | PRIMARY KEY (`id`), 116 | KEY `profiles_id` (`profiles_id`) 117 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 118 | 119 | -- -------------------------------------------------------- 120 | -- 121 | -- Structure de la table `glpi_plugin_racks_configs` 122 | -- 123 | 124 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 125 | CREATE TABLE `glpi_plugin_racks_configs` ( 126 | `id` int(11) NOT NULL auto_increment, 127 | `unit` int(11) NOT NULL default '0', 128 | PRIMARY KEY (`id`) 129 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 130 | 131 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1'); 132 | 133 | -- -------------------------------------------------------- 134 | -- 135 | -- Structure de la table `glpi_plugin_racks_roomlocations` 136 | -- 137 | 138 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 139 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 140 | `id` int(11) NOT NULL auto_increment, 141 | `entities_id` int(11) NOT NULL default '0', 142 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 143 | `name` varchar(255) collate utf8_unicode_ci default NULL, 144 | `completename` text collate utf8_unicode_ci, 145 | `comment` text collate utf8_unicode_ci, 146 | `level` int(11) NOT NULL default '0', 147 | PRIMARY KEY (`id`), 148 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 149 | KEY `name` (`name`), 150 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 151 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 152 | 153 | -- -------------------------------------------------------- 154 | -- 155 | -- Structure de la table `glpi_plugin_racks_connections` 156 | -- 157 | 158 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 159 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 160 | `id` int(11) NOT NULL auto_increment, 161 | `name` varchar(255) collate utf8_unicode_ci default NULL, 162 | `comment` text collate utf8_unicode_ci, 163 | PRIMARY KEY (`id`), 164 | KEY `name` (`name`) 165 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 166 | 167 | -- -------------------------------------------------------- 168 | -- 169 | -- Structure de la table `glpi_plugin_rack_others` 170 | -- 171 | 172 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 173 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 174 | `id` int(11) NOT NULL auto_increment, 175 | `entities_id` int(11) NOT NULL default '0', 176 | `name` varchar(255) collate utf8_unicode_ci default NULL, 177 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 178 | PRIMARY KEY (`ID`), 179 | KEY `name` (`name`), 180 | KEY `entities_id` (`entities_id`), 181 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 182 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 183 | 184 | -- -------------------------------------------------------- 185 | -- 186 | -- Structure de la table `glpi_plugin_racks_othermodels` 187 | -- 188 | 189 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 190 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 191 | `id` int(11) NOT NULL auto_increment, 192 | `name` varchar(255) collate utf8_unicode_ci default NULL, 193 | `comment` text collate utf8_unicode_ci, 194 | PRIMARY KEY (`ID`), 195 | KEY `name` (`name`) 196 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 197 | 198 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 199 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 200 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 201 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); -------------------------------------------------------------------------------- /sql/empty-1.3.0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `users_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 16 | `groups_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 17 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 18 | `rack_size` int(11) NOT NULL default '0', 19 | `weight` decimal(20,4) NOT NULL default '0.0000', 20 | `height` decimal(20,4) NOT NULL default '0.0000', 21 | `width` decimal(20,4) NOT NULL default '0.0000', 22 | `depth` decimal(20,4) NOT NULL default '0.0000', 23 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 24 | `is_template` tinyint(1) NOT NULL default '0', 25 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 26 | `is_deleted` tinyint(1) NOT NULL default '0', 27 | `notepad` longtext collate utf8_unicode_ci, 28 | `date_mod` datetime default NULL, 29 | PRIMARY KEY (`id`), 30 | KEY `name` (`name`), 31 | KEY `entities_id` (`entities_id`), 32 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 33 | KEY `users_id_tech` (`users_id_tech`), 34 | KEY `groups_id_tech` (`groups_id_tech`), 35 | KEY `manufacturers_id` (`manufacturers_id`), 36 | KEY `locations_id` (`locations_id`), 37 | KEY `is_deleted` (`is_deleted`), 38 | KEY date_mod (date_mod), 39 | KEY `is_template` (`is_template`) 40 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 41 | 42 | -- -------------------------------------------------------- 43 | -- 44 | -- Structure de la table `glpi_plugin_rackmodels` 45 | -- 46 | 47 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 48 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 49 | `id` int(11) NOT NULL auto_increment, 50 | `name` varchar(255) collate utf8_unicode_ci default NULL, 51 | `comment` text collate utf8_unicode_ci, 52 | PRIMARY KEY (`id`), 53 | KEY `name` (`name`) 54 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 55 | 56 | -- -------------------------------------------------------- 57 | -- 58 | -- Structure de la table `glpi_plugin_racks_racks_items` 59 | -- 60 | 61 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 62 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 63 | `id` int(11) NOT NULL auto_increment, 64 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 65 | `faces_id` int(11) NOT NULL default '0', 66 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 67 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 68 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 69 | `position` int(11) NOT NULL default '1', 70 | `first_powersupply` int(11) NOT NULL default '0', 71 | `second_powersupply` int(11) NOT NULL default '0', 72 | `amps` decimal(20,4) NOT NULL default '0.0000', 73 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 74 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 75 | `weight` decimal(20,4) NOT NULL default '0.0000', 76 | PRIMARY KEY (`id`), 77 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 78 | KEY `FK_device` (`items_id`,`itemtype`), 79 | KEY `item` (`itemtype`,`items_id`), 80 | KEY `faces_id` (`faces_id`), 81 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 82 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 83 | 84 | 85 | -- -------------------------------------------------------- 86 | -- 87 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 88 | -- 89 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 90 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 91 | `id` int(11) NOT NULL auto_increment, 92 | `model_id` int(11) NOT NULL default '0', 93 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 94 | `nb_alim` int(11) NOT NULL default '0', 95 | `amps` decimal(20,4) NOT NULL default '0.0000', 96 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 97 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 98 | `size` int(255) NOT NULL default '1', 99 | `weight` decimal(20,4) NOT NULL default '0.0000', 100 | `length` smallint(6) NOT NULL default '0', 101 | PRIMARY KEY (`id`) 102 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 103 | 104 | -- -------------------------------------------------------- 105 | -- 106 | -- Structure de la table `glpi_plugin_racks_profiles` 107 | -- 108 | 109 | DROP TABLE IF EXISTS `glpi_plugin_racks_profiles`; 110 | CREATE TABLE `glpi_plugin_racks_profiles` ( 111 | `id` int(11) NOT NULL auto_increment, 112 | `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 113 | `racks` char(1) collate utf8_unicode_ci default NULL, 114 | `model` char(1) collate utf8_unicode_ci default NULL, 115 | PRIMARY KEY (`id`), 116 | KEY `profiles_id` (`profiles_id`) 117 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 118 | 119 | -- -------------------------------------------------------- 120 | -- 121 | -- Structure de la table `glpi_plugin_racks_configs` 122 | -- 123 | 124 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 125 | CREATE TABLE `glpi_plugin_racks_configs` ( 126 | `id` int(11) NOT NULL auto_increment, 127 | `unit` int(11) NOT NULL default '0', 128 | PRIMARY KEY (`id`) 129 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 130 | 131 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1'); 132 | 133 | -- -------------------------------------------------------- 134 | -- 135 | -- Structure de la table `glpi_plugin_racks_roomlocations` 136 | -- 137 | 138 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 139 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 140 | `id` int(11) NOT NULL auto_increment, 141 | `entities_id` int(11) NOT NULL default '0', 142 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 143 | `name` varchar(255) collate utf8_unicode_ci default NULL, 144 | `completename` text collate utf8_unicode_ci, 145 | `comment` text collate utf8_unicode_ci, 146 | `level` int(11) NOT NULL default '0', 147 | PRIMARY KEY (`id`), 148 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 149 | KEY `name` (`name`), 150 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 151 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 152 | 153 | -- -------------------------------------------------------- 154 | -- 155 | -- Structure de la table `glpi_plugin_racks_connections` 156 | -- 157 | 158 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 159 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 160 | `id` int(11) NOT NULL auto_increment, 161 | `name` varchar(255) collate utf8_unicode_ci default NULL, 162 | `comment` text collate utf8_unicode_ci, 163 | PRIMARY KEY (`id`), 164 | KEY `name` (`name`) 165 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 166 | 167 | -- -------------------------------------------------------- 168 | -- 169 | -- Structure de la table `glpi_plugin_rack_others` 170 | -- 171 | 172 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 173 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 174 | `id` int(11) NOT NULL auto_increment, 175 | `entities_id` int(11) NOT NULL default '0', 176 | `name` varchar(255) collate utf8_unicode_ci default NULL, 177 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 178 | PRIMARY KEY (`ID`), 179 | KEY `name` (`name`), 180 | KEY `entities_id` (`entities_id`), 181 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 182 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 183 | 184 | -- -------------------------------------------------------- 185 | -- 186 | -- Structure de la table `glpi_plugin_racks_othermodels` 187 | -- 188 | 189 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 190 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 191 | `id` int(11) NOT NULL auto_increment, 192 | `name` varchar(255) collate utf8_unicode_ci default NULL, 193 | `comment` text collate utf8_unicode_ci, 194 | PRIMARY KEY (`ID`), 195 | KEY `name` (`name`) 196 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 197 | 198 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 199 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 200 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 201 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); -------------------------------------------------------------------------------- /locales/glpi.pot: -------------------------------------------------------------------------------- 1 | # SOME DESCRIPTIVE TITLE. 2 | # Copyright (C) YEAR Racks Development Team 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: GLPI - Racks plugin 1.8.0\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2017-10-19 09:33+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=CHARSET\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 20 | 21 | #: hook.php:278 inc/rack.class.php:75 inc/rack.class.php:285 22 | #: inc/rack_item.class.php:1165 inc/rack_item.class.php:1254 23 | #: inc/report.class.php:187 inc/report.class.php:243 24 | #: inc/roomlocation.class.php:41 25 | msgid "Place" 26 | msgid_plural "Places" 27 | msgstr[0] "" 28 | msgstr[1] "" 29 | 30 | #: hook.php:280 inc/connection.class.php:40 31 | msgid "Power supply connection" 32 | msgid_plural "Power supply connections" 33 | msgstr[0] "" 34 | msgstr[1] "" 35 | 36 | #: hook.php:281 inc/other.class.php:39 inc/othermodel.class.php:40 37 | msgid "Others equipments" 38 | msgstr "" 39 | 40 | #: hook.php:296 inc/menu.class.php:35 inc/profile.class.php:116 41 | #: inc/rack.class.php:48 42 | msgid "Rack enclosure" 43 | msgid_plural "Rack enclosures" 44 | msgstr[0] "" 45 | msgstr[1] "" 46 | 47 | #: setup.php:92 front/report.php:61 48 | msgid "Report - Bays management" 49 | msgstr "" 50 | 51 | #: setup.php:98 52 | msgid "Rack enclosure management" 53 | msgid_plural "Rack enclosures management" 54 | msgstr[0] "" 55 | msgstr[1] "" 56 | 57 | #: ajax/synchronize_device.php:62 front/rack.form.php:106 58 | #: front/rack.form.php:160 59 | msgid "No more place for insertion" 60 | msgstr "" 61 | 62 | #: front/config.form.php:49 63 | msgid "Please activate the plugin" 64 | msgstr "" 65 | 66 | #: inc/config.class.php:54 67 | msgid "Configuration of units" 68 | msgstr "" 69 | 70 | #: inc/config.class.php:60 71 | msgid "metric" 72 | msgstr "" 73 | 74 | #: inc/config.class.php:65 75 | msgid "English" 76 | msgstr "" 77 | 78 | #: inc/config.class.php:72 79 | msgid "Copy rack's location when adding a new asset in the rack" 80 | msgstr "" 81 | 82 | #: inc/config.class.php:81 83 | msgid "Forward rack's location to linked assets on change" 84 | msgstr "" 85 | 86 | #: inc/config.class.php:113 87 | msgid "kg" 88 | msgstr "" 89 | 90 | #: inc/config.class.php:114 91 | msgid "btu/h" 92 | msgstr "" 93 | 94 | #: inc/config.class.php:115 95 | msgid "m3/h" 96 | msgstr "" 97 | 98 | #: inc/config.class.php:116 99 | msgid "mm" 100 | msgstr "" 101 | 102 | #: inc/config.class.php:118 103 | msgid "lbs" 104 | msgstr "" 105 | 106 | #: inc/config.class.php:119 107 | msgid "watts" 108 | msgstr "" 109 | 110 | #: inc/config.class.php:120 111 | msgid "CFM" 112 | msgstr "" 113 | 114 | #: inc/config.class.php:121 115 | msgid "pouces" 116 | msgstr "" 117 | 118 | #: inc/itemspecificationcentral.class.php:39 119 | #: inc/itemspecification.class.php:39 inc/menu.class.php:65 120 | #: inc/menu.class.php:66 inc/profile.class.php:120 121 | msgid "Equipments models specifications" 122 | msgstr "" 123 | 124 | #: inc/itemspecificationcentral.class.php:52 125 | msgid "Servers" 126 | msgstr "" 127 | 128 | #: inc/itemspecificationcentral.class.php:53 129 | msgid "Network equipment" 130 | msgid_plural "Network equipments" 131 | msgstr[0] "" 132 | msgstr[1] "" 133 | 134 | #: inc/itemspecificationcentral.class.php:54 135 | msgid "Peripheral" 136 | msgid_plural "Peripherals" 137 | msgstr[0] "" 138 | msgstr[1] "" 139 | 140 | #: inc/itemspecificationcentral.class.php:55 141 | msgid "Other equipment" 142 | msgid_plural "Others equipments" 143 | msgstr[0] "" 144 | msgstr[1] "" 145 | 146 | #: inc/itemspecification.class.php:52 inc/menu.class.php:54 147 | #: inc/rack_item.class.php:172 148 | msgid "Specifications" 149 | msgstr "" 150 | 151 | #: inc/itemspecification.class.php:253 inc/itemspecification.class.php:347 152 | msgid "Full-depth item" 153 | msgstr "" 154 | 155 | #: inc/itemspecification.class.php:262 inc/itemspecification.class.php:336 156 | #: inc/rack.class.php:435 157 | msgid "Power supplies number" 158 | msgstr "" 159 | 160 | #: inc/itemspecification.class.php:270 inc/itemspecification.class.php:335 161 | #: inc/rack_item.class.php:643 162 | msgid "Total Current" 163 | msgstr "" 164 | 165 | #: inc/itemspecification.class.php:278 inc/itemspecification.class.php:337 166 | #: inc/rack.class.php:437 inc/rack_item.class.php:201 167 | #: inc/rack_item.class.php:644 168 | msgid "Calorific waste" 169 | msgstr "" 170 | 171 | #: inc/itemspecification.class.php:285 inc/itemspecification.class.php:340 172 | #: inc/rack_item.class.php:648 173 | msgid "Flow Rate" 174 | msgstr "" 175 | 176 | #: inc/itemspecification.class.php:295 inc/itemspecification.class.php:344 177 | #: inc/rack.class.php:143 inc/rack.class.php:337 inc/rack.class.php:439 178 | #: inc/rack_item.class.php:221 inc/rack_item.class.php:652 179 | msgid "Weight" 180 | msgstr "" 181 | 182 | #: inc/itemspecification.class.php:334 inc/rack_item.class.php:500 183 | msgid "Equipment" 184 | msgstr "" 185 | 186 | #: inc/itemspecification.class.php:335 inc/rack.class.php:456 187 | #: inc/rack_item.class.php:193 inc/rack_item.class.php:643 188 | #: inc/rack_item.class.php:912 inc/rack_item.class.php:913 189 | msgid "amps" 190 | msgstr "" 191 | 192 | #: inc/itemspecification.class.php:343 inc/rack.class.php:259 193 | #: inc/rack_item.class.php:882 inc/rack_item.class.php:894 194 | #: inc/rack_item.class.php:896 inc/rack_item.class.php:898 195 | #: inc/rack_item.class.php:900 inc/report.class.php:190 196 | #: inc/report.class.php:246 197 | msgid "U" 198 | msgstr "" 199 | 200 | #: inc/itemspecification.class.php:381 201 | msgid "Add specifications for servers models" 202 | msgstr "" 203 | 204 | #: inc/rack.class.php:104 inc/rack.class.php:321 205 | msgid "Height" 206 | msgstr "" 207 | 208 | #: inc/rack.class.php:109 inc/rack.class.php:304 209 | msgid "Width" 210 | msgstr "" 211 | 212 | #: inc/rack.class.php:114 inc/rack.class.php:355 213 | msgid "Depth" 214 | msgstr "" 215 | 216 | #: inc/rack.class.php:436 inc/rack_item.class.php:193 217 | msgid "Total current" 218 | msgstr "" 219 | 220 | #: inc/rack.class.php:438 inc/rack_item.class.php:211 221 | msgid "Flow rate" 222 | msgstr "" 223 | 224 | #: inc/rack_item.class.php:66 inc/rack_item.class.php:70 225 | #: inc/rack_item.class.php:1204 inc/rack_item.class.php:1266 226 | #: inc/report.class.php:193 inc/report.class.php:249 inc/report.class.php:361 227 | #: inc/report.class.php:474 inc/report.class.php:484 228 | msgid "Front" 229 | msgstr "" 230 | 231 | #: inc/rack_item.class.php:73 inc/rack_item.class.php:77 232 | #: inc/rack_item.class.php:1206 inc/rack_item.class.php:1268 233 | #: inc/report.class.php:193 inc/report.class.php:249 inc/report.class.php:363 234 | #: inc/report.class.php:474 inc/report.class.php:484 235 | msgctxt "Rack enclosure" 236 | msgid "Back" 237 | msgstr "" 238 | 239 | #: inc/rack_item.class.php:175 inc/rack_item.class.php:640 240 | msgid "Power supply 1" 241 | msgstr "" 242 | 243 | #: inc/rack_item.class.php:185 inc/rack_item.class.php:641 244 | msgid "Power supply 2" 245 | msgstr "" 246 | 247 | #: inc/rack_item.class.php:499 248 | msgid "Add equipment" 249 | msgstr "" 250 | 251 | #: inc/rack_item.class.php:502 252 | msgid "" 253 | "Thanks to setup equipments models specifications prior to associate them" 254 | msgstr "" 255 | 256 | #: inc/rack_item.class.php:506 inc/rack_item.class.php:636 257 | #: inc/rack_item.class.php:1163 inc/rack_item.class.php:1252 258 | msgid "Position" 259 | msgstr "" 260 | 261 | #: inc/rack_item.class.php:592 262 | msgid "Rack enclosure arrangement" 263 | msgstr "" 264 | 265 | #: inc/rack_item.class.php:642 266 | msgid "C13 Power Cord Quantity" 267 | msgstr "" 268 | 269 | #: inc/rack_item.class.php:894 270 | msgid "Total Servers" 271 | msgstr "" 272 | 273 | #: inc/rack_item.class.php:896 274 | msgid "Total Network equipements" 275 | msgstr "" 276 | 277 | #: inc/rack_item.class.php:898 278 | msgid "Total Peripherals" 279 | msgstr "" 280 | 281 | #: inc/rack_item.class.php:900 282 | msgid "Total Others" 283 | msgstr "" 284 | 285 | #: inc/rack_item.class.php:906 inc/rack_item.class.php:908 286 | msgid "U availables" 287 | msgstr "" 288 | 289 | #: inc/rack_item.class.php:911 290 | msgid "Total power Cords" 291 | msgstr "" 292 | 293 | #: inc/rack_item.class.php:912 294 | msgid "Amperage on power Cords" 295 | msgstr "" 296 | 297 | #: inc/rack_item.class.php:988 298 | msgid "Left rack enclosure" 299 | msgstr "" 300 | 301 | #: inc/rack_item.class.php:990 302 | msgid "No rack enclosure on the left" 303 | msgstr "" 304 | 305 | #: inc/rack_item.class.php:1011 306 | msgid "Right rack enclosure" 307 | msgstr "" 308 | 309 | #: inc/rack_item.class.php:1013 310 | msgid "No rack enclosure on the right" 311 | msgstr "" 312 | 313 | #: inc/rack_item.class.php:1162 inc/rack_item.class.php:1251 314 | msgid "Disposition" 315 | msgstr "" 316 | 317 | #: inc/rack_item.class.php:1249 318 | msgid "Associated rack enclosure" 319 | msgid_plural "Associated rack enclosures" 320 | msgstr[0] "" 321 | msgstr[1] "" 322 | 323 | #: inc/report.class.php:181 inc/report.class.php:237 inc/report.class.php:464 324 | msgid "Bay name" 325 | msgstr "" 326 | 327 | #: inc/report.class.php:198 inc/report.class.php:252 inc/report.class.php:495 328 | msgid "Object name" 329 | msgstr "" 330 | 331 | #: inc/report.class.php:205 inc/report.class.php:255 inc/report.class.php:501 332 | msgid "Object location" 333 | msgstr "" 334 | 335 | #: inc/report.class.php:461 336 | msgid "Search criteria" 337 | msgstr "" 338 | 339 | #: inc/report.class.php:488 340 | msgid "Field to export" 341 | msgstr "" 342 | 343 | #: inc/report.class.php:537 344 | msgid "Display options" 345 | msgstr "" 346 | 347 | #: inc/report.class.php:545 348 | msgid "Group by bay name" 349 | msgstr "" 350 | 351 | #: inc/report.class.php:1010 352 | msgid "Encoding" 353 | msgstr "" 354 | 355 | #: inc/report.class.php:1018 356 | msgid "Quotes" 357 | msgstr "" 358 | 359 | #: inc/report.class.php:1026 360 | msgid "End of line" 361 | msgstr "" 362 | -------------------------------------------------------------------------------- /sql/empty-1.5.0.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `plugin_racks_racktypes_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racktypes (id)', 16 | `plugin_racks_rackstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackstates (id)', 17 | `users_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 18 | `groups_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 19 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 20 | `rack_size` int(11) NOT NULL default '0', 21 | `weight` decimal(20,4) NOT NULL default '0.0000', 22 | `height` decimal(20,4) NOT NULL default '0.0000', 23 | `width` decimal(20,4) NOT NULL default '0.0000', 24 | `depth` decimal(20,4) NOT NULL default '0.0000', 25 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 26 | `is_template` tinyint(1) NOT NULL default '0', 27 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 28 | `is_deleted` tinyint(1) NOT NULL default '0', 29 | `date_mod` datetime default NULL, 30 | PRIMARY KEY (`id`), 31 | KEY `name` (`name`), 32 | KEY `entities_id` (`entities_id`), 33 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 34 | KEY `plugin_racks_racktypes_id` (`plugin_racks_racktypes_id`), 35 | KEY `plugin_racks_rackstates_id` (`plugin_racks_rackstates_id`), 36 | KEY `users_id_tech` (`users_id_tech`), 37 | KEY `groups_id_tech` (`groups_id_tech`), 38 | KEY `manufacturers_id` (`manufacturers_id`), 39 | KEY `locations_id` (`locations_id`), 40 | KEY `is_deleted` (`is_deleted`), 41 | KEY date_mod (date_mod), 42 | KEY `is_template` (`is_template`) 43 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 44 | 45 | -- -------------------------------------------------------- 46 | -- 47 | -- Structure de la table `glpi_plugin_rackmodels` 48 | -- 49 | 50 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 51 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 52 | `id` int(11) NOT NULL auto_increment, 53 | `name` varchar(255) collate utf8_unicode_ci default NULL, 54 | `comment` text collate utf8_unicode_ci, 55 | PRIMARY KEY (`id`), 56 | KEY `name` (`name`) 57 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 58 | 59 | -- -------------------------------------------------------- 60 | -- 61 | -- Structure de la table `glpi_plugin_racks_racks_items` 62 | -- 63 | 64 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 65 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 66 | `id` int(11) NOT NULL auto_increment, 67 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 68 | `faces_id` int(11) NOT NULL default '0', 69 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 70 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 71 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 72 | `position` int(11) NOT NULL default '1', 73 | `first_powersupply` int(11) NOT NULL default '0', 74 | `second_powersupply` int(11) NOT NULL default '0', 75 | `amps` decimal(20,4) NOT NULL default '0.0000', 76 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 77 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 78 | `weight` decimal(20,4) NOT NULL default '0.0000', 79 | PRIMARY KEY (`id`), 80 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 81 | KEY `FK_device` (`items_id`,`itemtype`), 82 | KEY `item` (`itemtype`,`items_id`), 83 | KEY `faces_id` (`faces_id`), 84 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 85 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 86 | 87 | 88 | -- -------------------------------------------------------- 89 | -- 90 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 91 | -- 92 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 93 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 94 | `id` int(11) NOT NULL auto_increment, 95 | `model_id` int(11) NOT NULL default '0', 96 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 97 | `nb_alim` int(11) NOT NULL default '0', 98 | `amps` decimal(20,4) NOT NULL default '0.0000', 99 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 100 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 101 | `size` int(255) NOT NULL default '1', 102 | `weight` decimal(20,4) NOT NULL default '0.0000', 103 | `length` smallint(6) NOT NULL default '0', 104 | PRIMARY KEY (`id`) 105 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 106 | 107 | 108 | -- -------------------------------------------------------- 109 | -- 110 | -- Structure de la table `glpi_plugin_racks_configs` 111 | -- 112 | 113 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 114 | CREATE TABLE `glpi_plugin_racks_configs` ( 115 | `id` int(11) NOT NULL auto_increment, 116 | `unit` int(11) NOT NULL default '0', 117 | PRIMARY KEY (`id`) 118 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 119 | 120 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1'); 121 | 122 | -- -------------------------------------------------------- 123 | -- 124 | -- Structure de la table `glpi_plugin_racks_roomlocations` 125 | -- 126 | 127 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 128 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 129 | `id` int(11) NOT NULL auto_increment, 130 | `entities_id` int(11) NOT NULL default '0', 131 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 132 | `name` varchar(255) collate utf8_unicode_ci default NULL, 133 | `completename` text collate utf8_unicode_ci, 134 | `comment` text collate utf8_unicode_ci, 135 | `level` int(11) NOT NULL default '0', 136 | PRIMARY KEY (`id`), 137 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 138 | KEY `name` (`name`), 139 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 140 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 141 | 142 | -- -------------------------------------------------------- 143 | -- 144 | -- Structure de la table `glpi_plugin_racks_connections` 145 | -- 146 | 147 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 148 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 149 | `id` int(11) NOT NULL auto_increment, 150 | `name` varchar(255) collate utf8_unicode_ci default NULL, 151 | `comment` text collate utf8_unicode_ci, 152 | PRIMARY KEY (`id`), 153 | KEY `name` (`name`) 154 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 155 | 156 | -- -------------------------------------------------------- 157 | -- 158 | -- Structure de la table `glpi_plugin_rack_others` 159 | -- 160 | 161 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 162 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 163 | `id` int(11) NOT NULL auto_increment, 164 | `entities_id` int(11) NOT NULL default '0', 165 | `name` varchar(255) collate utf8_unicode_ci default NULL, 166 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 167 | PRIMARY KEY (`ID`), 168 | KEY `name` (`name`), 169 | KEY `entities_id` (`entities_id`), 170 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 171 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 172 | 173 | -- -------------------------------------------------------- 174 | -- 175 | -- Structure de la table `glpi_plugin_racks_othermodels` 176 | -- 177 | 178 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 179 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 180 | `id` int(11) NOT NULL auto_increment, 181 | `name` varchar(255) collate utf8_unicode_ci default NULL, 182 | `comment` text collate utf8_unicode_ci, 183 | PRIMARY KEY (`ID`), 184 | KEY `name` (`name`) 185 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 186 | 187 | 188 | DROP TABLE IF EXISTS `glpi_plugin_racks_racktypes`; 189 | CREATE TABLE `glpi_plugin_racks_racktypes` ( 190 | `id` int(11) NOT NULL auto_increment, 191 | `entities_id` int(11) NOT NULL default '0', 192 | `is_recursive` tinyint(1) NOT NULL default '0', 193 | `name` varchar(255) collate utf8_unicode_ci default NULL, 194 | `comment` text collate utf8_unicode_ci, 195 | PRIMARY KEY (`id`), 196 | KEY `name` (`name`) 197 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 198 | 199 | 200 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackstates`; 201 | CREATE TABLE `glpi_plugin_racks_rackstates` ( 202 | `id` int(11) NOT NULL auto_increment, 203 | `entities_id` int(11) NOT NULL default '0', 204 | `is_recursive` tinyint(1) NOT NULL default '0', 205 | `name` varchar(255) collate utf8_unicode_ci default NULL, 206 | `comment` text collate utf8_unicode_ci, 207 | PRIMARY KEY (`id`), 208 | KEY `name` (`name`) 209 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 210 | 211 | 212 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 213 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 214 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 215 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); -------------------------------------------------------------------------------- /inc/profile.class.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | if (!defined('GLPI_ROOT')) { 31 | die("Sorry. You can't access directly to this file"); 32 | } 33 | 34 | class PluginRacksProfile extends Profile { 35 | 36 | static $rightname = "profile"; 37 | 38 | function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { 39 | 40 | if ($item->getType()=='Profile' 41 | && $item->getField('interface')!='helpdesk') { 42 | return PluginRacksRack::getTypeName(2); 43 | } 44 | return ''; 45 | } 46 | 47 | 48 | static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { 49 | global $CFG_GLPI; 50 | 51 | if ($item->getType() == 'Profile') { 52 | $prof = new self(); 53 | self::addDefaultProfileInfos($item->getField('id'), 54 | ['plugin_racks' => 0, 55 | 'plugin_racks_model' => 0, 56 | 'plugin_racks_open_ticket' => 0]); 57 | $prof->showForm($item->getField('id')); 58 | } 59 | return true; 60 | } 61 | 62 | 63 | /** 64 | * Show profile form 65 | * 66 | * @param $items_id integer id of the profile 67 | * @param $target value url of target 68 | * 69 | * @return nothing 70 | **/ 71 | function showForm($profiles_id = 0, $openform = true, $closeform = true) { 72 | 73 | echo "
"; 74 | if (($canedit = Session::haveRightsOr(self::$rightname, [CREATE, UPDATE, PURGE])) 75 | && $openform) { 76 | $profile = new Profile(); 77 | echo ""; 78 | } 79 | 80 | $profile = new Profile(); 81 | $profile->getFromDB($profiles_id); 82 | 83 | if ($profile->getField('interface') == 'central') { 84 | $rights = $this->getAllRights(); 85 | $profile->displayRightsChoiceMatrix($rights, ['canedit' => $canedit, 86 | 'default_class' => 'tab_bg_2', 87 | 'title' => __('General')]); 88 | } 89 | echo ""; 90 | echo "\n"; 91 | 92 | $effective_rights = ProfileRight::getProfileRights($profiles_id, ['plugin_racks_open_ticket']); 93 | echo ""; 94 | echo ""; 95 | echo "\n"; 99 | echo "
".__('Helpdesk')."
".__('Associable items to a ticket').""; 96 | Html::showCheckbox(['name' => '_plugin_racks_open_ticket', 97 | 'checked' => $effective_rights['plugin_racks_open_ticket']]); 98 | echo "
"; 100 | 101 | if ($canedit 102 | && $closeform) { 103 | echo "
"; 104 | echo Html::hidden('id', ['value' => $profiles_id]); 105 | echo Html::submit(_sx('button', 'Save'), ['name' => 'update']); 106 | echo "
\n"; 107 | Html::closeForm(); 108 | } 109 | echo "
"; 110 | 111 | } 112 | 113 | static function getAllRights($all = false) { 114 | $rights = [ 115 | ['itemtype' => 'PluginRacksRack', 116 | 'label' => _n('Rack enclosure', 'Rack enclosures', 2, 'racks'), 117 | 'field' => 'plugin_racks' 118 | ], 119 | ['itemtype' => 'PluginRacksItemSpecification', 120 | 'label' => __('Equipments models specifications', 'racks'), 121 | 'field' => 'plugin_racks_model' 122 | ], 123 | ]; 124 | 125 | if ($all) { 126 | $rights[] = ['itemtype' => 'PluginRacksRack', 127 | 'label' => __('Associable items to a ticket'), 128 | 'field' => 'plugin_racks_open_ticket']; 129 | } 130 | 131 | return $rights; 132 | } 133 | 134 | 135 | /** 136 | * Init profiles 137 | * 138 | **/ 139 | 140 | static function translateARight($old_right) { 141 | switch ($old_right) { 142 | case '': 143 | return 0; 144 | case 'r' : 145 | return READ; 146 | case 'w': 147 | return ALLSTANDARDRIGHT + READNOTE + UPDATENOTE; 148 | case '0': 149 | case '1': 150 | return $old_right; 151 | 152 | default : 153 | return 0; 154 | } 155 | } 156 | 157 | /** 158 | * @since 0.85 159 | * Migration rights from old system to the new one for one profile 160 | * @param $profiles_id the profile ID 161 | */ 162 | static function migrateOneProfile($profiles_id) { 163 | global $DB; 164 | //Cannot launch migration if there's nothing to migrate... 165 | if (!$DB->tableExists('glpi_plugin_racks_profiles')) { 166 | return true; 167 | } 168 | 169 | foreach ($DB->request('glpi_plugin_racks_profiles', 170 | "`profiles_id`='$profiles_id'") as $profile_data) { 171 | 172 | $matching = ['racks' => 'plugin_racks', 173 | 'model' => 'plugin_racks_model', 174 | 'open_ticket' => 'plugin_racks_open_ticket']; 175 | $current_rights = ProfileRight::getProfileRights($profiles_id, array_values($matching)); 176 | foreach ($matching as $old => $new) { 177 | if (!isset($current_rights[$old])) { 178 | $query = "UPDATE `glpi_profilerights` 179 | SET `rights`='".self::translateARight($profile_data[$old])."' 180 | WHERE `name`='$new' AND `profiles_id`='$profiles_id'"; 181 | $DB->query($query); 182 | } 183 | } 184 | } 185 | } 186 | 187 | 188 | /** 189 | * Initialize profiles, and migrate it necessary 190 | */ 191 | static function initProfile() { 192 | global $DB; 193 | $profile = new self(); 194 | $dbu = new DbUtils(); 195 | //Add new rights in glpi_profilerights table 196 | foreach ($profile->getAllRights(true) as $data) { 197 | if ($dbu->countElementsInTable("glpi_profilerights", 198 | "`name` = '".$data['field']."'") == 0) { 199 | ProfileRight::addProfileRights([$data['field']]); 200 | } 201 | } 202 | 203 | //Migration old rights in new ones 204 | foreach ($DB->request("SELECT `id` FROM `glpi_profiles`") as $prof) { 205 | self::migrateOneProfile($prof['id']); 206 | } 207 | foreach ($DB->request("SELECT * 208 | FROM `glpi_profilerights` 209 | WHERE `profiles_id`='".$_SESSION['glpiactiveprofile']['id']."' 210 | AND `name` LIKE '%plugin_racks%'") as $prof) { 211 | $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; 212 | } 213 | } 214 | 215 | static function createFirstAccess($profiles_id) { 216 | self::addDefaultProfileInfos($profiles_id, 217 | ['plugin_racks' => ALLSTANDARDRIGHT, 218 | 'plugin_racks_model' => ALLSTANDARDRIGHT, 219 | 'plugin_racks_open_ticket' => 1], true); 220 | 221 | } 222 | 223 | 224 | static function removeRightsFromSession() { 225 | foreach (self::getAllRights(true) as $right) { 226 | if (isset($_SESSION['glpiactiveprofile'][$right['field']])) { 227 | unset($_SESSION['glpiactiveprofile'][$right['field']]); 228 | } 229 | } 230 | } 231 | 232 | static function removeRightsFromDB() { 233 | $plugprof = new ProfileRight(); 234 | foreach (self::getAllRights(true) as $right) { 235 | $plugprof->deleteByCriteria(['name' => $right['field']]); 236 | } 237 | } 238 | 239 | /** 240 | * @param $profile 241 | **/ 242 | static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) { 243 | $dbu = new DbUtils(); 244 | $profileRight = new ProfileRight(); 245 | foreach ($rights as $right => $value) { 246 | if ($dbu->countElementsInTable('glpi_profilerights', 247 | "`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) { 248 | $profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]); 249 | } 250 | if (!$dbu->countElementsInTable('glpi_profilerights', 251 | "`profiles_id`='$profiles_id' AND `name`='$right'")) { 252 | $myright['profiles_id'] = $profiles_id; 253 | $myright['name'] = $right; 254 | $myright['rights'] = $value; 255 | $profileRight->add($myright); 256 | 257 | //Add right to the current session 258 | $_SESSION['glpiactiveprofile'][$right] = $value; 259 | } 260 | } 261 | } 262 | } 263 | -------------------------------------------------------------------------------- /sql/empty-1.5.2.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `plugin_racks_racktypes_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racktypes (id)', 16 | `plugin_racks_rackstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackstates (id)', 17 | `users_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 18 | `groups_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 19 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 20 | `rack_size` int(11) NOT NULL default '0', 21 | `weight` decimal(20,4) NOT NULL default '0.0000', 22 | `height` decimal(20,4) NOT NULL default '0.0000', 23 | `width` decimal(20,4) NOT NULL default '0.0000', 24 | `depth` decimal(20,4) NOT NULL default '0.0000', 25 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 26 | `is_template` tinyint(1) NOT NULL default '0', 27 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 28 | `is_deleted` tinyint(1) NOT NULL default '0', 29 | `date_mod` datetime default NULL, 30 | PRIMARY KEY (`id`), 31 | KEY `name` (`name`), 32 | KEY `entities_id` (`entities_id`), 33 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 34 | KEY `plugin_racks_racktypes_id` (`plugin_racks_racktypes_id`), 35 | KEY `plugin_racks_rackstates_id` (`plugin_racks_rackstates_id`), 36 | KEY `users_id_tech` (`users_id_tech`), 37 | KEY `groups_id_tech` (`groups_id_tech`), 38 | KEY `manufacturers_id` (`manufacturers_id`), 39 | KEY `locations_id` (`locations_id`), 40 | KEY `is_deleted` (`is_deleted`), 41 | KEY date_mod (date_mod), 42 | KEY `is_template` (`is_template`) 43 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 44 | 45 | -- -------------------------------------------------------- 46 | -- 47 | -- Structure de la table `glpi_plugin_rackmodels` 48 | -- 49 | 50 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 51 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 52 | `id` int(11) NOT NULL auto_increment, 53 | `name` varchar(255) collate utf8_unicode_ci default NULL, 54 | `comment` text collate utf8_unicode_ci, 55 | `entities_id` int(11) NOT NULL default '0', 56 | `is_recursive` tinyint(1) NOT NULL default '0', 57 | PRIMARY KEY (`id`), 58 | KEY `name` (`name`), 59 | KEY `entities_id` (`entities_id`), 60 | KEY `is_recursive` (`is_recursive`) 61 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 62 | 63 | -- -------------------------------------------------------- 64 | -- 65 | -- Structure de la table `glpi_plugin_racks_racks_items` 66 | -- 67 | 68 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 69 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 70 | `id` int(11) NOT NULL auto_increment, 71 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 72 | `faces_id` int(11) NOT NULL default '0', 73 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 74 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 75 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 76 | `position` int(11) NOT NULL default '1', 77 | `first_powersupply` int(11) NOT NULL default '0', 78 | `second_powersupply` int(11) NOT NULL default '0', 79 | `amps` decimal(20,4) NOT NULL default '0.0000', 80 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 81 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 82 | `weight` decimal(20,4) NOT NULL default '0.0000', 83 | PRIMARY KEY (`id`), 84 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 85 | KEY `FK_device` (`items_id`,`itemtype`), 86 | KEY `item` (`itemtype`,`items_id`), 87 | KEY `faces_id` (`faces_id`), 88 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 89 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 90 | 91 | 92 | -- -------------------------------------------------------- 93 | -- 94 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 95 | -- 96 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 97 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 98 | `id` int(11) NOT NULL auto_increment, 99 | `model_id` int(11) NOT NULL default '0', 100 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 101 | `nb_alim` int(11) NOT NULL default '0', 102 | `amps` decimal(20,4) NOT NULL default '0.0000', 103 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 104 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 105 | `size` int(255) NOT NULL default '1', 106 | `weight` decimal(20,4) NOT NULL default '0.0000', 107 | `length` smallint(6) NOT NULL default '0', 108 | PRIMARY KEY (`id`) 109 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 110 | 111 | 112 | -- -------------------------------------------------------- 113 | -- 114 | -- Structure de la table `glpi_plugin_racks_configs` 115 | -- 116 | 117 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 118 | CREATE TABLE `glpi_plugin_racks_configs` ( 119 | `id` int(11) NOT NULL auto_increment, 120 | `unit` int(11) NOT NULL default '0', 121 | `add_location_on_new_item` tinyint(1) NOT NULL DEFAULT '0', 122 | `forward_location_on_change` tinyint(1) NOT NULL DEFAULT '0', 123 | PRIMARY KEY (`id`), 124 | KEY `add_location_on_new_item` (`add_location_on_new_item`), 125 | KEY `forward_location_on_change` (`forward_location_on_change`) 126 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 127 | 128 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1','0', '0'); 129 | 130 | -- -------------------------------------------------------- 131 | -- 132 | -- Structure de la table `glpi_plugin_racks_roomlocations` 133 | -- 134 | 135 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 136 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 137 | `id` int(11) NOT NULL auto_increment, 138 | `entities_id` int(11) NOT NULL default '0', 139 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 140 | `name` varchar(255) collate utf8_unicode_ci default NULL, 141 | `completename` text collate utf8_unicode_ci, 142 | `comment` text collate utf8_unicode_ci, 143 | `level` int(11) NOT NULL default '0', 144 | PRIMARY KEY (`id`), 145 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 146 | KEY `name` (`name`), 147 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 148 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 149 | 150 | -- -------------------------------------------------------- 151 | -- 152 | -- Structure de la table `glpi_plugin_racks_connections` 153 | -- 154 | 155 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 156 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 157 | `id` int(11) NOT NULL auto_increment, 158 | `name` varchar(255) collate utf8_unicode_ci default NULL, 159 | `comment` text collate utf8_unicode_ci, 160 | PRIMARY KEY (`id`), 161 | KEY `name` (`name`) 162 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 163 | 164 | -- -------------------------------------------------------- 165 | -- 166 | -- Structure de la table `glpi_plugin_rack_others` 167 | -- 168 | 169 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 170 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 171 | `id` int(11) NOT NULL auto_increment, 172 | `entities_id` int(11) NOT NULL default '0', 173 | `name` varchar(255) collate utf8_unicode_ci default NULL, 174 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 175 | PRIMARY KEY (`ID`), 176 | KEY `name` (`name`), 177 | KEY `entities_id` (`entities_id`), 178 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 179 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 180 | 181 | -- -------------------------------------------------------- 182 | -- 183 | -- Structure de la table `glpi_plugin_racks_othermodels` 184 | -- 185 | 186 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 187 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 188 | `id` int(11) NOT NULL auto_increment, 189 | `name` varchar(255) collate utf8_unicode_ci default NULL, 190 | `comment` text collate utf8_unicode_ci, 191 | PRIMARY KEY (`ID`), 192 | KEY `name` (`name`) 193 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 194 | 195 | 196 | DROP TABLE IF EXISTS `glpi_plugin_racks_racktypes`; 197 | CREATE TABLE `glpi_plugin_racks_racktypes` ( 198 | `id` int(11) NOT NULL auto_increment, 199 | `entities_id` int(11) NOT NULL default '0', 200 | `is_recursive` tinyint(1) NOT NULL default '0', 201 | `name` varchar(255) collate utf8_unicode_ci default NULL, 202 | `comment` text collate utf8_unicode_ci, 203 | PRIMARY KEY (`id`), 204 | KEY `name` (`name`) 205 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 206 | 207 | 208 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackstates`; 209 | CREATE TABLE `glpi_plugin_racks_rackstates` ( 210 | `id` int(11) NOT NULL auto_increment, 211 | `entities_id` int(11) NOT NULL default '0', 212 | `is_recursive` tinyint(1) NOT NULL default '0', 213 | `name` varchar(255) collate utf8_unicode_ci default NULL, 214 | `comment` text collate utf8_unicode_ci, 215 | PRIMARY KEY (`id`), 216 | KEY `name` (`name`) 217 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 218 | 219 | 220 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 221 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 222 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 223 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); 224 | -------------------------------------------------------------------------------- /sql/empty-1.3.2.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `plugin_racks_racktypes_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racktypes (id)', 16 | `plugin_racks_rackstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackstates (id)', 17 | `users_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 18 | `groups_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 19 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 20 | `rack_size` int(11) NOT NULL default '0', 21 | `weight` decimal(20,4) NOT NULL default '0.0000', 22 | `height` decimal(20,4) NOT NULL default '0.0000', 23 | `width` decimal(20,4) NOT NULL default '0.0000', 24 | `depth` decimal(20,4) NOT NULL default '0.0000', 25 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 26 | `is_template` tinyint(1) NOT NULL default '0', 27 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 28 | `is_deleted` tinyint(1) NOT NULL default '0', 29 | `notepad` longtext collate utf8_unicode_ci, 30 | `date_mod` datetime default NULL, 31 | PRIMARY KEY (`id`), 32 | KEY `name` (`name`), 33 | KEY `entities_id` (`entities_id`), 34 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 35 | KEY `plugin_racks_racktypes_id` (`plugin_racks_racktypes_id`), 36 | KEY `plugin_racks_rackstates_id` (`plugin_racks_rackstates_id`), 37 | KEY `users_id_tech` (`users_id_tech`), 38 | KEY `groups_id_tech` (`groups_id_tech`), 39 | KEY `manufacturers_id` (`manufacturers_id`), 40 | KEY `locations_id` (`locations_id`), 41 | KEY `is_deleted` (`is_deleted`), 42 | KEY date_mod (date_mod), 43 | KEY `is_template` (`is_template`) 44 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 45 | 46 | -- -------------------------------------------------------- 47 | -- 48 | -- Structure de la table `glpi_plugin_rackmodels` 49 | -- 50 | 51 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 52 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 53 | `id` int(11) NOT NULL auto_increment, 54 | `name` varchar(255) collate utf8_unicode_ci default NULL, 55 | `comment` text collate utf8_unicode_ci, 56 | PRIMARY KEY (`id`), 57 | KEY `name` (`name`) 58 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 59 | 60 | -- -------------------------------------------------------- 61 | -- 62 | -- Structure de la table `glpi_plugin_racks_racks_items` 63 | -- 64 | 65 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 66 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 67 | `id` int(11) NOT NULL auto_increment, 68 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 69 | `faces_id` int(11) NOT NULL default '0', 70 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 71 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 72 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 73 | `position` int(11) NOT NULL default '1', 74 | `first_powersupply` int(11) NOT NULL default '0', 75 | `second_powersupply` int(11) NOT NULL default '0', 76 | `amps` decimal(20,4) NOT NULL default '0.0000', 77 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 78 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 79 | `weight` decimal(20,4) NOT NULL default '0.0000', 80 | PRIMARY KEY (`id`), 81 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 82 | KEY `FK_device` (`items_id`,`itemtype`), 83 | KEY `item` (`itemtype`,`items_id`), 84 | KEY `faces_id` (`faces_id`), 85 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 86 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 87 | 88 | 89 | -- -------------------------------------------------------- 90 | -- 91 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 92 | -- 93 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 94 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 95 | `id` int(11) NOT NULL auto_increment, 96 | `model_id` int(11) NOT NULL default '0', 97 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 98 | `nb_alim` int(11) NOT NULL default '0', 99 | `amps` decimal(20,4) NOT NULL default '0.0000', 100 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 101 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 102 | `size` int(255) NOT NULL default '1', 103 | `weight` decimal(20,4) NOT NULL default '0.0000', 104 | `length` smallint(6) NOT NULL default '0', 105 | PRIMARY KEY (`id`) 106 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 107 | 108 | -- -------------------------------------------------------- 109 | -- 110 | -- Structure de la table `glpi_plugin_racks_profiles` 111 | -- 112 | 113 | DROP TABLE IF EXISTS `glpi_plugin_racks_profiles`; 114 | CREATE TABLE `glpi_plugin_racks_profiles` ( 115 | `id` int(11) NOT NULL auto_increment, 116 | `profiles_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_profiles (id)', 117 | `racks` char(1) collate utf8_unicode_ci default NULL, 118 | `model` char(1) collate utf8_unicode_ci default NULL, 119 | PRIMARY KEY (`id`), 120 | KEY `profiles_id` (`profiles_id`) 121 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 122 | 123 | -- -------------------------------------------------------- 124 | -- 125 | -- Structure de la table `glpi_plugin_racks_configs` 126 | -- 127 | 128 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 129 | CREATE TABLE `glpi_plugin_racks_configs` ( 130 | `id` int(11) NOT NULL auto_increment, 131 | `unit` int(11) NOT NULL default '0', 132 | PRIMARY KEY (`id`) 133 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 134 | 135 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1'); 136 | 137 | -- -------------------------------------------------------- 138 | -- 139 | -- Structure de la table `glpi_plugin_racks_roomlocations` 140 | -- 141 | 142 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 143 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 144 | `id` int(11) NOT NULL auto_increment, 145 | `entities_id` int(11) NOT NULL default '0', 146 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 147 | `name` varchar(255) collate utf8_unicode_ci default NULL, 148 | `completename` text collate utf8_unicode_ci, 149 | `comment` text collate utf8_unicode_ci, 150 | `level` int(11) NOT NULL default '0', 151 | PRIMARY KEY (`id`), 152 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 153 | KEY `name` (`name`), 154 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 155 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 156 | 157 | -- -------------------------------------------------------- 158 | -- 159 | -- Structure de la table `glpi_plugin_racks_connections` 160 | -- 161 | 162 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 163 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 164 | `id` int(11) NOT NULL auto_increment, 165 | `name` varchar(255) collate utf8_unicode_ci default NULL, 166 | `comment` text collate utf8_unicode_ci, 167 | PRIMARY KEY (`id`), 168 | KEY `name` (`name`) 169 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 170 | 171 | -- -------------------------------------------------------- 172 | -- 173 | -- Structure de la table `glpi_plugin_rack_others` 174 | -- 175 | 176 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 177 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 178 | `id` int(11) NOT NULL auto_increment, 179 | `entities_id` int(11) NOT NULL default '0', 180 | `name` varchar(255) collate utf8_unicode_ci default NULL, 181 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 182 | PRIMARY KEY (`ID`), 183 | KEY `name` (`name`), 184 | KEY `entities_id` (`entities_id`), 185 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 186 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 187 | 188 | -- -------------------------------------------------------- 189 | -- 190 | -- Structure de la table `glpi_plugin_racks_othermodels` 191 | -- 192 | 193 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 194 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 195 | `id` int(11) NOT NULL auto_increment, 196 | `name` varchar(255) collate utf8_unicode_ci default NULL, 197 | `comment` text collate utf8_unicode_ci, 198 | PRIMARY KEY (`ID`), 199 | KEY `name` (`name`) 200 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 201 | 202 | 203 | DROP TABLE IF EXISTS `glpi_plugin_racks_racktypes`; 204 | CREATE TABLE `glpi_plugin_racks_racktypes` ( 205 | `id` int(11) NOT NULL auto_increment, 206 | `entities_id` int(11) NOT NULL default '0', 207 | `name` varchar(255) collate utf8_unicode_ci default NULL, 208 | `comment` text collate utf8_unicode_ci, 209 | PRIMARY KEY (`id`), 210 | KEY `name` (`name`) 211 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 212 | 213 | 214 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackstates`; 215 | CREATE TABLE `glpi_plugin_racks_rackstates` ( 216 | `id` int(11) NOT NULL auto_increment, 217 | `entities_id` int(11) NOT NULL default '0', 218 | `name` varchar(255) collate utf8_unicode_ci default NULL, 219 | `comment` text collate utf8_unicode_ci, 220 | PRIMARY KEY (`id`), 221 | KEY `name` (`name`) 222 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 223 | 224 | 225 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 226 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 227 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 228 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); -------------------------------------------------------------------------------- /sql/empty-1.7.1.sql: -------------------------------------------------------------------------------- 1 | -- 2 | -- Structure de la table `glpi_plugin_racks_racks` 3 | -- 4 | 5 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks`; 6 | CREATE TABLE `glpi_plugin_racks_racks` ( 7 | `id` int(11) NOT NULL auto_increment, 8 | `name` varchar(255) collate utf8_unicode_ci default NULL, 9 | `entities_id` int(11) NOT NULL default '0', 10 | `is_recursive` tinyint(1) NOT NULL default '0', 11 | `serial` varchar(255) collate utf8_unicode_ci default NULL, 12 | `plugin_racks_rackmodels_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackmodels (id)', 13 | `locations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_locations (id)', 14 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_roomlocations (id)', 15 | `plugin_racks_racktypes_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racktypes (id)', 16 | `plugin_racks_rackstates_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_rackstates (id)', 17 | `users_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_users (id)', 18 | `groups_id_tech` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_groups (id)', 19 | `manufacturers_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_manufacturers (id)', 20 | `rack_size` int(11) NOT NULL default '0', 21 | `weight` decimal(20,4) NOT NULL default '0.0000', 22 | `height` decimal(20,4) NOT NULL default '0.0000', 23 | `width` decimal(20,4) NOT NULL default '0.0000', 24 | `depth` decimal(20,4) NOT NULL default '0.0000', 25 | `otherserial` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, 26 | `is_template` tinyint(1) NOT NULL default '0', 27 | `template_name` varchar(255) collate utf8_unicode_ci default NULL, 28 | `is_deleted` tinyint(1) NOT NULL default '0', 29 | `date_mod` datetime default NULL, 30 | PRIMARY KEY (`id`), 31 | KEY `name` (`name`), 32 | KEY `entities_id` (`entities_id`), 33 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`), 34 | KEY `plugin_racks_racktypes_id` (`plugin_racks_racktypes_id`), 35 | KEY `plugin_racks_rackstates_id` (`plugin_racks_rackstates_id`), 36 | KEY `users_id_tech` (`users_id_tech`), 37 | KEY `groups_id_tech` (`groups_id_tech`), 38 | KEY `manufacturers_id` (`manufacturers_id`), 39 | KEY `locations_id` (`locations_id`), 40 | KEY `is_deleted` (`is_deleted`), 41 | KEY date_mod (date_mod), 42 | KEY `is_template` (`is_template`) 43 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 44 | 45 | -- -------------------------------------------------------- 46 | -- 47 | -- Structure de la table `glpi_plugin_rackmodels` 48 | -- 49 | 50 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackmodels`; 51 | CREATE TABLE `glpi_plugin_racks_rackmodels` ( 52 | `id` int(11) NOT NULL auto_increment, 53 | `name` varchar(255) collate utf8_unicode_ci default NULL, 54 | `comment` text collate utf8_unicode_ci, 55 | `entities_id` int(11) NOT NULL default '0', 56 | `is_recursive` tinyint(1) NOT NULL default '0', 57 | PRIMARY KEY (`id`), 58 | KEY `name` (`name`), 59 | KEY `entities_id` (`entities_id`), 60 | KEY `is_recursive` (`is_recursive`) 61 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 62 | 63 | -- -------------------------------------------------------- 64 | -- 65 | -- Structure de la table `glpi_plugin_racks_racks_items` 66 | -- 67 | 68 | DROP TABLE IF EXISTS `glpi_plugin_racks_racks_items`; 69 | CREATE TABLE `glpi_plugin_racks_racks_items` ( 70 | `id` int(11) NOT NULL auto_increment, 71 | `plugin_racks_racks_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_racks (id)', 72 | `faces_id` int(11) NOT NULL default '0', 73 | `plugin_racks_itemspecifications_id` int(11) NOT NULL default '0' COMMENT 'RELATION to glpi_plugin_racks_itemspecifications (id)', 74 | `items_id` int(11) NOT NULL default '0' COMMENT 'RELATION to various tables, according to itemtype (id)', 75 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 76 | `position` int(11) NOT NULL default '1', 77 | `first_powersupply` int(11) NOT NULL default '0', 78 | `second_powersupply` int(11) NOT NULL default '0', 79 | `amps` decimal(20,4) NOT NULL default '0.0000', 80 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 81 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 82 | `weight` decimal(20,4) NOT NULL default '0.0000', 83 | PRIMARY KEY (`id`), 84 | UNIQUE KEY `unicity` (`plugin_racks_racks_id`,`items_id`,`itemtype`), 85 | KEY `FK_device` (`items_id`,`itemtype`), 86 | KEY `item` (`itemtype`,`items_id`), 87 | KEY `faces_id` (`faces_id`), 88 | KEY `plugin_racks_itemspecifications_id` (`plugin_racks_itemspecifications_id`) 89 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 90 | 91 | 92 | -- -------------------------------------------------------- 93 | -- 94 | -- Structure de la table `glpi_plugin_racks_itemspecifications` 95 | -- 96 | DROP TABLE IF EXISTS `glpi_plugin_racks_itemspecifications`; 97 | CREATE TABLE `glpi_plugin_racks_itemspecifications` ( 98 | `id` int(11) NOT NULL auto_increment, 99 | `model_id` int(11) NOT NULL default '0', 100 | `itemtype` varchar(100) collate utf8_unicode_ci NOT NULL COMMENT 'see .class.php file', 101 | `nb_alim` int(11) NOT NULL default '0', 102 | `amps` decimal(20,4) NOT NULL default '0.0000', 103 | `flow_rate` decimal(20,4) NOT NULL default '0.0000', 104 | `dissipation` decimal(20,4) NOT NULL default '0.0000', 105 | `size` int(255) NOT NULL default '1', 106 | `weight` decimal(20,4) NOT NULL default '0.0000', 107 | `length` smallint(6) NOT NULL default '0', 108 | PRIMARY KEY (`id`) 109 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 110 | 111 | 112 | -- -------------------------------------------------------- 113 | -- 114 | -- Structure de la table `glpi_plugin_racks_configs` 115 | -- 116 | 117 | DROP TABLE IF EXISTS `glpi_plugin_racks_configs`; 118 | CREATE TABLE `glpi_plugin_racks_configs` ( 119 | `id` int(11) NOT NULL auto_increment, 120 | `unit` int(11) NOT NULL default '0', 121 | `add_location_on_new_item` tinyint(1) NOT NULL DEFAULT '0', 122 | `forward_location_on_change` tinyint(1) NOT NULL DEFAULT '0', 123 | PRIMARY KEY (`id`), 124 | KEY `add_location_on_new_item` (`add_location_on_new_item`), 125 | KEY `forward_location_on_change` (`forward_location_on_change`) 126 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 127 | 128 | INSERT INTO `glpi_plugin_racks_configs` VALUES ('1', '1','0', '0'); 129 | 130 | -- -------------------------------------------------------- 131 | -- 132 | -- Structure de la table `glpi_plugin_racks_roomlocations` 133 | -- 134 | 135 | DROP TABLE IF EXISTS `glpi_plugin_racks_roomlocations`; 136 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_roomlocations` ( 137 | `id` int(11) NOT NULL auto_increment, 138 | `entities_id` int(11) NOT NULL default '0', 139 | `plugin_racks_roomlocations_id` int(11) NOT NULL default '0', 140 | `name` varchar(255) collate utf8_unicode_ci default NULL, 141 | `completename` text collate utf8_unicode_ci, 142 | `comment` text collate utf8_unicode_ci, 143 | `level` int(11) NOT NULL default '0', 144 | `ancestors_cache` longtext COLLATE utf8_unicode_ci, 145 | `sons_cache` longtext COLLATE utf8_unicode_ci, 146 | PRIMARY KEY (`id`), 147 | UNIQUE KEY `unicity` (`entities_id`,`plugin_racks_roomlocations_id`,`name`), 148 | KEY `name` (`name`), 149 | KEY `plugin_racks_roomlocations_id` (`plugin_racks_roomlocations_id`) 150 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 151 | 152 | -- -------------------------------------------------------- 153 | -- 154 | -- Structure de la table `glpi_plugin_racks_connections` 155 | -- 156 | 157 | DROP TABLE IF EXISTS `glpi_plugin_racks_connections`; 158 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_connections` ( 159 | `id` int(11) NOT NULL auto_increment, 160 | `name` varchar(255) collate utf8_unicode_ci default NULL, 161 | `comment` text collate utf8_unicode_ci, 162 | PRIMARY KEY (`id`), 163 | KEY `name` (`name`) 164 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 165 | 166 | -- -------------------------------------------------------- 167 | -- 168 | -- Structure de la table `glpi_plugin_rack_others` 169 | -- 170 | 171 | DROP TABLE IF EXISTS `glpi_plugin_racks_others`; 172 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_others` ( 173 | `id` int(11) NOT NULL auto_increment, 174 | `entities_id` int(11) NOT NULL default '0', 175 | `name` varchar(255) collate utf8_unicode_ci default NULL, 176 | `plugin_racks_othermodels_id` int(11) NOT NULL default '0', 177 | PRIMARY KEY (`ID`), 178 | KEY `name` (`name`), 179 | KEY `entities_id` (`entities_id`), 180 | KEY `plugin_racks_othermodels_id` (`plugin_racks_othermodels_id`) 181 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 182 | 183 | -- -------------------------------------------------------- 184 | -- 185 | -- Structure de la table `glpi_plugin_racks_othermodels` 186 | -- 187 | 188 | DROP TABLE IF EXISTS `glpi_plugin_racks_othermodels`; 189 | CREATE TABLE IF NOT EXISTS `glpi_plugin_racks_othermodels` ( 190 | `id` int(11) NOT NULL auto_increment, 191 | `name` varchar(255) collate utf8_unicode_ci default NULL, 192 | `comment` text collate utf8_unicode_ci, 193 | PRIMARY KEY (`ID`), 194 | KEY `name` (`name`) 195 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 196 | 197 | 198 | DROP TABLE IF EXISTS `glpi_plugin_racks_racktypes`; 199 | CREATE TABLE `glpi_plugin_racks_racktypes` ( 200 | `id` int(11) NOT NULL auto_increment, 201 | `entities_id` int(11) NOT NULL default '0', 202 | `is_recursive` tinyint(1) NOT NULL default '0', 203 | `name` varchar(255) collate utf8_unicode_ci default NULL, 204 | `comment` text collate utf8_unicode_ci, 205 | PRIMARY KEY (`id`), 206 | KEY `name` (`name`) 207 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 208 | 209 | 210 | DROP TABLE IF EXISTS `glpi_plugin_racks_rackstates`; 211 | CREATE TABLE `glpi_plugin_racks_rackstates` ( 212 | `id` int(11) NOT NULL auto_increment, 213 | `entities_id` int(11) NOT NULL default '0', 214 | `is_recursive` tinyint(1) NOT NULL default '0', 215 | `name` varchar(255) collate utf8_unicode_ci default NULL, 216 | `comment` text collate utf8_unicode_ci, 217 | PRIMARY KEY (`id`), 218 | KEY `name` (`name`) 219 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 220 | 221 | 222 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','2','2','0'); 223 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','3','3','0'); 224 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','4','4','0'); 225 | INSERT INTO glpi_displaypreferences VALUES (NULL,'PluginRacksRack','5','5','0'); 226 | -------------------------------------------------------------------------------- /tools/move_to_po.php: -------------------------------------------------------------------------------- 1 | . 27 | -------------------------------------------------------------------------- 28 | */ 29 | 30 | // ---------------------------------------------------------------------- 31 | // Original Author of file: Julien Dombre 32 | // Purpose of file: 33 | // ---------------------------------------------------------------------- 34 | 35 | chdir(dirname($_SERVER["SCRIPT_FILENAME"])); 36 | 37 | if ($argv) { 38 | for ($i=1 ; $i'.$sing_trans.' '.$current_string_plural.'->'.$plural_trans."\n"; 158 | if (!strlen($sing_trans) || !strlen($plural_trans)) { 159 | // echo "clean\n"; 160 | $sing_trans = ''; 161 | $plural_trans = ''; 162 | } 163 | $content = "msgstr[0] \"$sing_trans\"\n"; 164 | $content .= "msgstr[1] \"$plural_trans\"\n"; 165 | } 166 | } else { 167 | $content=''; 168 | } 169 | } 170 | $context = ''; 171 | } 172 | // Standard replacement 173 | $content = preg_replace('/charset=CHARSET/','charset=UTF-8',$content); 174 | 175 | if (preg_match('/Plural-Forms/',$content)) { 176 | $content = "\"Plural-Forms: nplurals=2; plural=(n != 1)\\n\"\n"; 177 | } 178 | 179 | if (fwrite($po, $content) === FALSE) { 180 | echo "unable to write in po file"; 181 | exit; 182 | } 183 | 184 | } 185 | } 186 | fclose($pot); 187 | fclose($po); 188 | 189 | 190 | function search_in_dict($string, $context) { 191 | global $REFLANG, $LANG; 192 | 193 | if ($context) { 194 | $string = "$context/$string"; 195 | } 196 | 197 | $ponctmatch = "([\.: \(\)]*)"; 198 | $varmatch = "(%s)*"; 199 | 200 | if (preg_match("/$varmatch$ponctmatch(.*)$ponctmatch$varmatch$/U",$string,$reg)) { 201 | // print_r($reg); 202 | $left = $reg[1]; 203 | $left .= $reg[2]; 204 | $string = $reg[3]; 205 | $right = $reg[4]; 206 | if (isset($reg[5])) { 207 | $right .= $reg[5]; 208 | } 209 | } 210 | 211 | // echo $left.' <- '.$string.' -> '.$right."\n"; 212 | foreach ($REFLANG as $mod => $data) { 213 | 214 | foreach ($data as $key => $val) { 215 | 216 | if (!is_array($val)){ 217 | if (!isset($LANG[$mod][$key])) { 218 | continue; 219 | } 220 | 221 | // Search same case with punc 222 | if (strcmp($val,$left.$string.$right) === 0) { 223 | return $LANG[$mod][$key]; 224 | } 225 | // Search same case with punc 226 | if (strcasecmp($val,$left.$string.$right) === 0) { 227 | return $LANG[$mod][$key]; 228 | } 229 | 230 | // Search same case with left punc 231 | if (strcmp($val,$left.$string) === 0) { 232 | return $LANG[$mod][$key].$right; 233 | } 234 | // Search same case with left punc 235 | if (strcasecmp($val,$left.$string) === 0) { 236 | return $LANG[$mod][$key].$right; 237 | } 238 | 239 | // Search same case with right punc 240 | if (strcmp($val,$string.$right) === 0) { 241 | return $left.$LANG[$mod][$key]; 242 | } 243 | // Search same case with right punc 244 | if (strcasecmp($val,$string.$right) === 0) { 245 | return $left.$LANG[$mod][$key]; 246 | } 247 | 248 | // Search same case without punc 249 | if (strcmp($val,$string) === 0) { 250 | return $left.$LANG[$mod][$key].$right; 251 | } 252 | // Search non case sensitive 253 | if (strcasecmp($val,$string) === 0) { 254 | return $left.$LANG[$mod][$key].$right; 255 | } 256 | } else { 257 | //toolbox::logdebug($val); 258 | //toolbox::logdebug($key); 259 | //toolbox::logdebug($mod); 260 | foreach ($val as $k => $v) { 261 | if (!isset($LANG[$mod][$key][$k])) { 262 | continue; 263 | } 264 | 265 | // Search same case with punc 266 | if (strcmp($v,$left.$string.$right) === 0) { 267 | return $LANG[$mod][$key][$k]; 268 | } 269 | // Search same case with punc 270 | if (strcasecmp($v,$left.$string.$right) === 0) { 271 | return $LANG[$mod][$key][$k]; 272 | } 273 | 274 | // Search same case with left punc 275 | if (strcmp($v,$left.$string) === 0) { 276 | return $LANG[$mod][$key][$k].$right; 277 | } 278 | // Search same case with left punc 279 | if (strcasecmp($v,$left.$string) === 0) { 280 | return $LANG[$mod][$key][$k].$right; 281 | } 282 | 283 | // Search same case with right punc 284 | if (strcmp($v,$string.$right) === 0) { 285 | return $left.$LANG[$mod][$key][$k]; 286 | } 287 | // Search same case with right punc 288 | if (strcasecmp($v,$string.$right) === 0) { 289 | return $left.$LANG[$mod][$key][$k]; 290 | } 291 | 292 | // Search same case without punc 293 | if (strcmp($v,$string) === 0) { 294 | return $left.$LANG[$mod][$key][$k].$right; 295 | } 296 | // Search non case sensitive 297 | if (strcasecmp($v,$string) === 0) { 298 | return $left.$LANG[$mod][$key][$k].$right; 299 | } 300 | } 301 | } 302 | } 303 | } 304 | 305 | return ""; 306 | } 307 | ?> --------------------------------------------------------------------------------