diff --git a/.gitignore b/.gitignore index 9e3041ef..b110e937 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1,4 @@ -/config/config_db* -/config/config_path.php -/config/local_define.php -/tests/config_db* -/plugins/ -/files/ -/.buildpath -/.project -/.settings/ -/.vscode/ -/.idea/ -/tools/composer.lock -/tools/vendor/ -/tools/api/ -/tools/htmlcov/ -/vendor/ -phpunit.xml -/tests/code-coverage/ -/tests/files/ -/config/based_config.php -/config/config.php -/config/define.php -/nbproject -.composer.hash -/css/**/*.min.css -/css/compiled/ -!/css/tiny_mce/**/*.min.css -/js/*.min.js -# ignore incomplete locale, fallback to ru.js -# see https://github.com/glpi-project/glpi/issues/3788 -/lib/tiny_mce/langs/ru_RU.js +/vendor /file_upload -/fiche_eval_upload \ No newline at end of file +/fiche_eval_upload +/files diff --git a/css/chartists-glpi.min.css b/css/chartists-glpi.min.css new file mode 100644 index 00000000..8b18215c --- /dev/null +++ b/css/chartists-glpi.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- + */.chart{position:relative;text-align:center;margin-top:1em}.ct-series.ct-series-p{stroke:#C2F040}.ct-legend .ct-series-15:before{background-color:#C2F040;border-color:#C2F040}.ct-series.ct-series-q{stroke:#CA12D3}.ct-legend .ct-series-16:before{background-color:#CA12D3;border-color:#CA12D3}.ct-series.ct-series-r{stroke:#F75037}.ct-legend .ct-series-17:before{background-color:#F75037;border-color:#F75037}.ct-series.ct-series-s{stroke:#6224AF}.ct-legend .ct-series-18:before{background-color:#6224AF;border-color:#6224AF}.ct-series.ct-series-t{stroke:#854F95}.ct-legend .ct-series-19:before{background-color:#854F95;border-color:#854F95}.ct-series.ct-series-u{stroke:#FCFEFD}.ct-legend .ct-series-20:before{background-color:#FCFEFD;border-color:#FCFEFD}.ct-series.ct-series-v{stroke:#1739C0}.ct-legend .ct-series-21:before{background-color:#1739C0;border-color:#1739C0}.ct-series.ct-series-w{stroke:#F83DB1}.ct-legend .ct-series-22:before{background-color:#F83DB1;border-color:#F83DB1}.ct-series.ct-series-x{stroke:#A52AB5}.ct-legend .ct-series-23:before{background-color:#A52AB5;border-color:#A52AB5}.ct-series.ct-series-y{stroke:#1F8870}.ct-legend .ct-series-24:before{background-color:#1F8870;border-color:#1F8870}.ct-series.ct-series-z{stroke:#D7192E}.ct-legend .ct-series-25:before{background-color:#D7192E;border-color:#D7192E}.ct-legend{position:relative;z-index:10;list-style:none;text-align:center}.ct-legend li{position:relative;padding-left:23px;margin-right:10px;margin-bottom:3px;cursor:pointer;display:inline-block}.ct-legend li:before{width:12px;height:12px;position:absolute;left:0;content:'';border:3px solid transparent;border-radius:2px}.ct-legend li.inactive:before{background:transparent}.ct-legend .ct-series-0:before{background-color:#d70206;border-color:#d70206}.ct-legend .ct-series-1:before{background-color:#f05b4f;border-color:#f05b4f}.ct-legend .ct-series-2:before{background-color:#f4c63d;border-color:#f4c63d}.ct-legend .ct-series-3:before{background-color:#d17905;border-color:#d17905}.ct-legend .ct-series-4:before{background-color:#453d3f;border-color:#453d3f}.ct-legend .ct-series-5:before{background-color:#59922b;border-color:#59922b}.ct-legend .ct-series-6:before{background-color:#0544d3;border-color:#0544d3}.ct-legend .ct-series-7:before{background-color:#6b0392;border-color:#6b0392}.ct-legend .ct-series-8:before{background-color:#f05b4f;border-color:#f05b4f}.ct-legend .ct-series-9:before{background-color:#dda458;border-color:#dda458}.ct-legend .ct-series-10:before{background-color:#eacf7d;border-color:#eacf7d}.ct-legend .ct-series-11:before{background-color:#86797d;border-color:#86797d}.ct-legend .ct-series-12:before{background-color:#b2c326;border-color:#b2c326}.ct-legend .ct-series-13:before{background-color:#6188e2;border-color:#6188e2}.ct-legend .ct-series-14:before{background-color:#a748ca;border-color:#a748ca}.chartist-tooltip{z-index:11 !important} \ No newline at end of file diff --git a/css/jquery-glpi.min.css b/css/jquery-glpi.min.css new file mode 100644 index 00000000..46cabe70 --- /dev/null +++ b/css/jquery-glpi.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- + */.ui-state-default,.ui-widget-content .ui-state-default,.ui-widget-header .ui-state-default{border:1px solid #FFF;background-color:#e6e6e6;color:#555555}.ui-state-active,.ui-widget-content .ui-state-active,.ui-widget-header .ui-state-active{border:1px solid #FFF;background-color:#ffffff;color:#212121}.ui-state-active a,.ui-state-active a:link,.ui-state-active a:visited{color:#212121}.ui-dialog{z-index:1000 !important}.ui-widget-overlay.glpi_modal{z-index:2000 !important}.glpi_modal{z-index:5000 !important}.ui-widget-content span.vsubmit,a.vsubmit{color:#8f5a0a}.ui-datepicker{width:20em;z-index:10000 !important}.ui-timepicker-div .ui-widget-header{margin-bottom:8px}.ui-timepicker-div dl{text-align:left}.ui-timepicker-div dl dt{height:25px;margin-bottom:-25px}.ui-timepicker-div dl dd{margin:0 10px 10px 65px}.ui-timepicker-div td{font-size:90%}.ui-tpicker-grid-label{background:none;border:none;margin:0;padding:0}.ui-timepicker-rtl{direction:rtl}.ui-timepicker-rtl dl{text-align:right}.ui-timepicker-rtl dl dd{margin:0 65px 10px 10px}.hasDatepicker{margin-right:3px}.ui-tabs{width:98%;margin:auto}.ui-tabs-vertical{width:98%;border:0;vertical-align:top}.ui-tabs-vertical .ui-tabs-nav{padding:.2em .1em .2em .2em;float:left;width:180px;border:1px solid #cccccc}.ui-tabs-vertical .ui-tabs-nav li{clear:left;width:99%;border-bottom-width:1px !important;border-right-width:0 !important;margin:0 -1px .1em -1px}.ui-tabs-vertical .ui-tabs-nav li a{display:block;width:152px;text-align:left;text-overflow:ellipsis;-o-text-overflow:ellipsis;overflow:hidden}.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-active{padding-bottom:0;margin-bottom:1px;border-right-width:1px}.ui-tabs-vertical .ui-tabs-panel{padding:1em;margin-left:180px;float:center}.ui-progressbar .ui-progressbar-value{background-image:url('../pics/jquery/pbar-ani.gif')}.doaction_progress_text{float:left;color:black;text-align:center;width:100%;padding-top:3px;font-weight:bold}.ui-autocomplete{max-height:200px;font-size:11px;overflow-y:auto;overflow-x:hidden}.ui-autocomplete a{color:black}html .ui-autocomplete{max-height:100px}.ui-widget-content .error{-moz-border-radius:10px;-webkit-border-radius:10px;-o-border-radius:10px;border-radius:10px;max-width:350px;margin:auto;border-width:1px;border-style:solid;padding:.2em}.ui-widget-content .error{border-color:red}.select2-container .select2-selection--single{height:22px}.select2-container--default .select2-selection--single .select2-selection__rendered{line-height:22px;font-weight:normal;font-size:11px}.select2-container--default .select2-selection--single .select2-selection__arrow{height:18px}.select2-container--default .select2-selection--single{border:1px solid #D3D3D3;overflow:hidden}.select2-results__option{padding:3px 6px}.select2-rendered__match{text-decoration:underline}.select2-container--default .select2-selection--multiple .select2-selection__choice{padding:4px 8px}.select2-container--default .select2-search--inline .select2-search__field{border:0 !important}.select2-selection__choice > *{vertical-align:middle}.select2-container{max-width:500px;word-break:break-all;font-size:11px;margin-right:.5em}.select2-search--dropdown .select2-search__field{padding:0 4px}.select2-selection.select2-selection--single{min-width:72px;position:relative;text-overflow:clip;background-color:#FFF;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding-left:1em;max-width:270px}.select2-selection.select2-selection--single:before{content:'\02026';position:absolute;z-index:1;left:-1em;background-color:inherit;padding-left:1em;margin-left:.5em;background-color:inherit;line-height:26px;margin-top:-2px;padding-right:.1em}.select2-selection.select2-selection--single .select2-selection__rendered{min-width:100%;position:relative;display:inline-block;float:right;overflow:visible;text-indent:.5em;background-color:inherit;margin-right:0;padding-right:26px;box-sizing:border-box}.select2-selection.select2-selection--single .select2-selection__rendered:before{content:'';position:absolute;display:inline-block;width:1em;background-color:inherit;z-index:2;left:-.5em;height:26px;margin-top:-2px}.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button{font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:11px}.select2-results li{font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:11px}.select2-search input{font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:11px}.select2-container .select2-choice{height:22px;padding:0 0 0 8px;font-weight:normal;margin-top:0px;vertical-align:top}.select2-container .select2-choice span{margin-top:-2px}.select2-container .select2-choice div b{margin-top:-2px}#show_validator_field .select2-container{width:60%}.select2-results ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-results ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub ul.select2-result-sub > li .select2-result-label{padding-left:10px}.select2-actionable-menu{width:80%;margin:auto}input.submit{font-size:12px}.uploadbar{height:18px;text-align:center;font-weight:bold;background-image:url('../pics/jquery/pbar-ani.gif')}.fn-gantt{text-align:left;font-size:11px}.fn-gantt .ganttMilestone{background-color:#000000}.select2-container.select2-container-disabled .select2-choice,.select2-container.select2-container-disabled .select2-choice .select2-arrow{background-color:#f4f4f4 !important}.select2-container.select2-container-disabled .select2-choice{border:1px solid #ddd !important} \ No newline at end of file diff --git a/css/jstree-glpi.min.css b/css/jstree-glpi.min.css new file mode 100644 index 00000000..c32dbc7d --- /dev/null +++ b/css/jstree-glpi.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- + */.jstree-node,.jstree-children,.jstree-container-ul{display:block;margin:0;padding:0;list-style-type:none;list-style-image:none}.jstree-node{white-space:nowrap}.jstree-anchor{display:inline-block;color:black;white-space:nowrap;padding:0 4px 0 1px;margin:0;vertical-align:top}.jstree-anchor:focus{outline:0}.jstree-anchor,.jstree-anchor:link,.jstree-anchor:visited,.jstree-anchor:hover,.jstree-anchor:active{text-decoration:none;color:inherit}.jstree-icon{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-icon:empty{display:inline-block;text-decoration:none;margin:0;padding:0;vertical-align:top;text-align:center}.jstree-ocl{cursor:pointer}.jstree-leaf > .jstree-ocl{cursor:default}.jstree .jstree-open > .jstree-children{display:block}.jstree .jstree-closed > .jstree-children,.jstree .jstree-leaf > .jstree-children{display:none}.jstree-anchor > .jstree-themeicon{margin-right:2px}.jstree-no-icons .jstree-themeicon,.jstree-anchor > .jstree-themeicon-hidden{display:none}.jstree-hidden,.jstree-node.jstree-hidden{display:none}.jstree-rtl .jstree-anchor{padding:0 1px 0 4px}.jstree-rtl .jstree-anchor > .jstree-themeicon{margin-left:2px;margin-right:0}.jstree-rtl .jstree-node{margin-left:0}.jstree-rtl .jstree-container-ul > .jstree-node{margin-right:0}.jstree-wholerow-ul{position:relative;display:inline-block;min-width:100%}.jstree-wholerow-ul .jstree-leaf > .jstree-ocl{cursor:pointer}.jstree-wholerow-ul .jstree-anchor,.jstree-wholerow-ul .jstree-icon{position:relative}.jstree-wholerow-ul .jstree-wholerow{width:100%;cursor:pointer;position:absolute;left:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.jstree-contextmenu .jstree-anchor{-webkit-user-select:none;-webkit-touch-callout:none}.vakata-context{display:none}.vakata-context,.vakata-context ul{margin:0;padding:2px;position:absolute;background:#f5f5f5;border:1px solid #979797;box-shadow:2px 2px 2px #999999}.vakata-context ul{list-style:none;left:100%;margin-top:-2.7em;margin-left:-4px}.vakata-context .vakata-context-right ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context li{list-style:none}.vakata-context li > a{display:block;padding:0 2em 0 2em;text-decoration:none;width:auto;color:black;white-space:nowrap;line-height:2.4em;text-shadow:1px 1px 0 white;border-radius:1px}.vakata-context li > a:hover{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context li > a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAIORI4JlrqN1oMSnmmZDQUAOw==");background-position:right center;background-repeat:no-repeat}.vakata-context li > a:focus{outline:0}.vakata-context .vakata-context-hover > a{position:relative;background-color:#e8eff7;box-shadow:0 0 2px #0a6aa1}.vakata-context .vakata-context-separator > a,.vakata-context .vakata-context-separator > a:hover{background:white;border:0;border-top:1px solid #e2e3e3;height:1px;min-height:1px;max-height:1px;padding:0;margin:0 0 0 2.4em;border-left:1px solid #e0e0e0;text-shadow:0 0 0 transparent;box-shadow:0 0 0 transparent;border-radius:0}.vakata-context .vakata-contextmenu-disabled a,.vakata-context .vakata-contextmenu-disabled a:hover{color:silver;background-color:transparent;border:0;box-shadow:0 0 0}.vakata-context li > a > i{text-decoration:none;display:inline-block;width:2.4em;height:2.4em;background:transparent;margin:0 0 0 -2em;vertical-align:top;text-align:center;line-height:2.4em}.vakata-context li > a > i:empty{width:2.4em;line-height:2.4em}.vakata-context li > a .vakata-contextmenu-sep{display:inline-block;width:1px;height:2.4em;background:white;margin:0 0.5em 0 0;border-left:1px solid #e2e3e3}.vakata-context .vakata-contextmenu-shortcut{font-size:0.8em;color:silver;opacity:0.5;display:none}.vakata-context-rtl ul{left:auto;right:100%;margin-left:auto;margin-right:-4px}.vakata-context-rtl li > a.vakata-context-parent{background-image:url("data:image/gif;base64,R0lGODlhCwAHAIAAACgoKP///yH5BAEAAAEALAAAAAALAAcAAAINjI+AC7rWHIsPtmoxLAA7");background-position:left center;background-repeat:no-repeat}.vakata-context-rtl .vakata-context-separator > a{margin:0 2.4em 0 0;border-left:0;border-right:1px solid #e2e3e3}.vakata-context-rtl .vakata-context-left ul{right:auto;left:100%;margin-left:-4px;margin-right:auto}.vakata-context-rtl li > a > i{margin:0 -2em 0 0}.vakata-context-rtl li > a .vakata-contextmenu-sep{margin:0 0 0 0.5em;border-left-color:white;background:#e2e3e3}#jstree-marker{position:absolute;top:0;left:0;margin:-5px 0 0 0;padding:0;border-right:0;border-top:5px solid transparent;border-bottom:5px solid transparent;border-left:5px solid;width:0;height:0;font-size:0;line-height:0}#jstree-dnd{line-height:16px;margin:0;padding:4px}#jstree-dnd .jstree-icon,#jstree-dnd .jstree-copy{display:inline-block;text-decoration:none;margin:0 2px 0 0;padding:0;width:16px;height:16px}#jstree-dnd .jstree-ok{background:green}#jstree-dnd .jstree-er{background:red}#jstree-dnd .jstree-copy{margin:0 2px 0 2px}.jstree-glpi .jstree-node,.jstree-glpi .jstree-icon{background-repeat:no-repeat;background-color:transparent}.jstree-glpi .jstree-anchor,.jstree-glpi .jstree-animated,.jstree-glpi .jstree-wholerow{transition:background-color 0.15s, box-shadow 0.15s}.jstree-glpi .jstree-hovered{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-glpi .jstree-context{background:#e7f4f9;border-radius:2px;box-shadow:inset 0 0 1px #cccccc}.jstree-glpi .jstree-clicked{background:#beebff;border-radius:2px;box-shadow:inset 0 0 1px #999999}.jstree-glpi .jstree-no-icons .jstree-anchor > .jstree-themeicon{display:none}.jstree-glpi .jstree-disabled{background:transparent;color:#666666}.jstree-glpi .jstree-disabled.jstree-hovered{background:transparent;box-shadow:none}.jstree-glpi .jstree-disabled.jstree-clicked{background:#efefef}.jstree-glpi .jstree-disabled > .jstree-icon{opacity:0.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");-webkit-filter:grayscale(100%)}.jstree-glpi .jstree-search{font-style:italic;color:#8b0000;font-weight:bold}.jstree-glpi .jstree-no-checkboxes .jstree-checkbox{display:none !important}.jstree-glpi.jstree-checkbox-no-clicked .jstree-clicked{background:transparent;box-shadow:none}.jstree-glpi.jstree-checkbox-no-clicked .jstree-clicked.jstree-hovered{background:#e7f4f9}.jstree-glpi.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked{background:transparent}.jstree-glpi.jstree-checkbox-no-clicked > .jstree-wholerow-ul .jstree-wholerow-clicked.jstree-wholerow-hovered{background:#e7f4f9}.jstree-glpi > .jstree-striped{min-width:100%;display:inline-block;background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAkCAMAAAB/qqA+AAAABlBMVEUAAAAAAAClZ7nPAAAAAnRSTlMNAMM9s3UAAAAXSURBVHjajcEBAQAAAIKg/H/aCQZ70AUBjAATb6YPDgAAAABJRU5ErkJggg==") left top repeat}.jstree-glpi > .jstree-wholerow-ul .jstree-hovered,.jstree-glpi > .jstree-wholerow-ul .jstree-clicked{background:transparent;box-shadow:none;border-radius:0}.jstree-glpi .jstree-wholerow{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.jstree-glpi .jstree-wholerow-hovered{background:#e7f4f9}.jstree-glpi .jstree-wholerow-clicked{background:#beebff;background:-webkit-linear-gradient(top, #beebff 0%, #a8e4ff 100%);background:linear-gradient(to bottom, #beebff 0%, #a8e4ff 100%)}.jstree-glpi .jstree-node{min-height:24px;line-height:24px;margin-left:20px;min-width:20px}.jstree-glpi .jstree-anchor{line-height:24px;height:24px}.jstree-glpi .jstree-icon{width:20px;height:24px;line-height:24px}.jstree-glpi .jstree-icon:empty{width:20px;height:24px;line-height:24px}.jstree-glpi.jstree-rtl .jstree-node{margin-right:20px}.jstree-glpi .jstree-wholerow{height:24px}.jstree-glpi .jstree-node,.jstree-glpi .jstree-icon{background-image:url("../pics/jquery/jstree/32px.png")}.jstree-glpi .jstree-node{background-position:-292px -4px;background-repeat:repeat-y}.jstree-glpi .jstree-last{background:transparent}.jstree-glpi .jstree-open > .jstree-ocl{background-position:-132px -4px}.jstree-glpi .jstree-closed > .jstree-ocl{background-position:-100px -4px}.jstree-glpi .jstree-leaf > .jstree-ocl{background-position:-68px -4px}.jstree-glpi .jstree-themeicon{background-position:-260px -4px}.jstree-glpi > .jstree-no-dots .jstree-node,.jstree-glpi > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-36px -4px}.jstree-glpi > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:-4px -4px}.jstree-glpi .jstree-disabled{background:transparent}.jstree-glpi .jstree-disabled.jstree-hovered{background:transparent}.jstree-glpi .jstree-disabled.jstree-clicked{background:#efefef}.jstree-glpi .jstree-checkbox{background-position:-164px -4px}.jstree-glpi .jstree-checkbox:hover{background-position:-164px -36px}.jstree-glpi.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,.jstree-glpi .jstree-checked > .jstree-checkbox{background-position:-228px -4px}.jstree-glpi.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,.jstree-glpi .jstree-checked > .jstree-checkbox:hover{background-position:-228px -36px}.jstree-glpi .jstree-anchor > .jstree-undetermined{background-position:-196px -4px}.jstree-glpi .jstree-anchor > .jstree-undetermined:hover{background-position:-196px -36px}.jstree-glpi .jstree-checkbox-disabled{opacity:0.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");-webkit-filter:grayscale(100%)}.jstree-glpi > .jstree-striped{background-size:auto 48px}.jstree-glpi.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-glpi.jstree-rtl .jstree-last{background:transparent}.jstree-glpi.jstree-rtl .jstree-open > .jstree-ocl{background-position:-132px -36px}.jstree-glpi.jstree-rtl .jstree-closed > .jstree-ocl{background-position:-100px -36px}.jstree-glpi.jstree-rtl .jstree-leaf > .jstree-ocl{background-position:-68px -36px}.jstree-glpi.jstree-rtl > .jstree-no-dots .jstree-node,.jstree-glpi.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-36px -36px}.jstree-glpi.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:-4px -36px}.jstree-glpi .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-glpi > .jstree-container-ul .jstree-loading > .jstree-ocl{background:url("../pics/jquery/jstree/throbber.gif") center center no-repeat}.jstree-glpi .jstree-file{background:url("../pics/jquery/jstree/32px.png") -100px -68px no-repeat}.jstree-glpi .jstree-folder{background:url("../pics/jquery/jstree/32px.png") -260px -4px no-repeat}.jstree-glpi > .jstree-container-ul > .jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-glpi{line-height:24px;padding:0 4px}#jstree-dnd.jstree-glpi .jstree-ok,#jstree-dnd.jstree-glpi .jstree-er{background-image:url("../pics/jquery/jstree/32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-glpi i{background:transparent;width:20px;height:24px;line-height:24px}#jstree-dnd.jstree-glpi .jstree-ok{background-position:-4px -68px}#jstree-dnd.jstree-glpi .jstree-er{background-position:-36px -68px}.jstree-glpi .jstree-ellipsis{overflow:hidden}.jstree-glpi .jstree-ellipsis .jstree-anchor{width:calc(100% - 29px);text-overflow:ellipsis;overflow:hidden}.jstree-glpi .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-glpi.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==")}.jstree-glpi.jstree-rtl .jstree-last{background:transparent}.jstree-glpi-small .jstree-node{min-height:18px;line-height:18px;margin-left:18px;min-width:18px}.jstree-glpi-small .jstree-anchor{line-height:18px;height:18px}.jstree-glpi-small .jstree-icon{width:18px;height:18px;line-height:18px}.jstree-glpi-small .jstree-icon:empty{width:18px;height:18px;line-height:18px}.jstree-glpi-small.jstree-rtl .jstree-node{margin-right:18px}.jstree-glpi-small .jstree-wholerow{height:18px}.jstree-glpi-small .jstree-node,.jstree-glpi-small .jstree-icon{background-image:url("../pics/jquery/jstree/32px.png")}.jstree-glpi-small .jstree-node{background-position:-295px -7px;background-repeat:repeat-y}.jstree-glpi-small .jstree-last{background:transparent}.jstree-glpi-small .jstree-open > .jstree-ocl{background-position:-135px -7px}.jstree-glpi-small .jstree-closed > .jstree-ocl{background-position:-103px -7px}.jstree-glpi-small .jstree-leaf > .jstree-ocl{background-position:-71px -7px}.jstree-glpi-small .jstree-themeicon{background-position:-263px -7px}.jstree-glpi-small > .jstree-no-dots .jstree-node,.jstree-glpi-small > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-small > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-39px -7px}.jstree-glpi-small > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:-7px -7px}.jstree-glpi-small .jstree-disabled{background:transparent}.jstree-glpi-small .jstree-disabled.jstree-hovered{background:transparent}.jstree-glpi-small .jstree-disabled.jstree-clicked{background:#efefef}.jstree-glpi-small .jstree-checkbox{background-position:-167px -7px}.jstree-glpi-small .jstree-checkbox:hover{background-position:-167px -39px}.jstree-glpi-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,.jstree-glpi-small .jstree-checked > .jstree-checkbox{background-position:-231px -7px}.jstree-glpi-small.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,.jstree-glpi-small .jstree-checked > .jstree-checkbox:hover{background-position:-231px -39px}.jstree-glpi-small .jstree-anchor > .jstree-undetermined{background-position:-199px -7px}.jstree-glpi-small .jstree-anchor > .jstree-undetermined:hover{background-position:-199px -39px}.jstree-glpi-small .jstree-checkbox-disabled{opacity:0.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");-webkit-filter:grayscale(100%)}.jstree-glpi-small > .jstree-striped{background-size:auto 36px}.jstree-glpi-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-glpi-small.jstree-rtl .jstree-last{background:transparent}.jstree-glpi-small.jstree-rtl .jstree-open > .jstree-ocl{background-position:-135px -39px}.jstree-glpi-small.jstree-rtl .jstree-closed > .jstree-ocl{background-position:-103px -39px}.jstree-glpi-small.jstree-rtl .jstree-leaf > .jstree-ocl{background-position:-71px -39px}.jstree-glpi-small.jstree-rtl > .jstree-no-dots .jstree-node,.jstree-glpi-small.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-small.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-39px -39px}.jstree-glpi-small.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:-7px -39px}.jstree-glpi-small .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-glpi-small > .jstree-container-ul .jstree-loading > .jstree-ocl{background:url("../pics/jquery/jstree/throbber.gif") center center no-repeat}.jstree-glpi-small .jstree-file{background:url("../pics/jquery/jstree/32px.png") -103px -71px no-repeat}.jstree-glpi-small .jstree-folder{background:url("../pics/jquery/jstree/32px.png") -263px -7px no-repeat}.jstree-glpi-small > .jstree-container-ul > .jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-glpi-small{line-height:18px;padding:0 4px}#jstree-dnd.jstree-glpi-small .jstree-ok,#jstree-dnd.jstree-glpi-small .jstree-er{background-image:url("../pics/jquery/jstree/32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-glpi-small i{background:transparent;width:18px;height:18px;line-height:18px}#jstree-dnd.jstree-glpi-small .jstree-ok{background-position:-7px -71px}#jstree-dnd.jstree-glpi-small .jstree-er{background-position:-39px -71px}.jstree-glpi-small .jstree-ellipsis{overflow:hidden}.jstree-glpi-small .jstree-ellipsis .jstree-anchor{width:calc(100% - 23px);text-overflow:ellipsis;overflow:hidden}.jstree-glpi-small .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-glpi-small.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAACAQMAAABv1h6PAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMHBgAAiABBI4gz9AAAAABJRU5ErkJggg==")}.jstree-glpi-small.jstree-rtl .jstree-last{background:transparent}.jstree-glpi-large .jstree-node{min-height:32px;line-height:32px;margin-left:32px;min-width:32px}.jstree-glpi-large .jstree-anchor{line-height:32px;height:32px}.jstree-glpi-large .jstree-icon{width:32px;height:32px;line-height:32px}.jstree-glpi-large .jstree-icon:empty{width:32px;height:32px;line-height:32px}.jstree-glpi-large.jstree-rtl .jstree-node{margin-right:32px}.jstree-glpi-large .jstree-wholerow{height:32px}.jstree-glpi-large .jstree-node,.jstree-glpi-large .jstree-icon{background-image:url("../pics/jquery/jstree/32px.png")}.jstree-glpi-large .jstree-node{background-position:-288px 0px;background-repeat:repeat-y}.jstree-glpi-large .jstree-last{background:transparent}.jstree-glpi-large .jstree-open > .jstree-ocl{background-position:-128px 0px}.jstree-glpi-large .jstree-closed > .jstree-ocl{background-position:-96px 0px}.jstree-glpi-large .jstree-leaf > .jstree-ocl{background-position:-64px 0px}.jstree-glpi-large .jstree-themeicon{background-position:-256px 0px}.jstree-glpi-large > .jstree-no-dots .jstree-node,.jstree-glpi-large > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-large > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-32px 0px}.jstree-glpi-large > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:0px 0px}.jstree-glpi-large .jstree-disabled{background:transparent}.jstree-glpi-large .jstree-disabled.jstree-hovered{background:transparent}.jstree-glpi-large .jstree-disabled.jstree-clicked{background:#efefef}.jstree-glpi-large .jstree-checkbox{background-position:-160px 0px}.jstree-glpi-large .jstree-checkbox:hover{background-position:-160px -32px}.jstree-glpi-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,.jstree-glpi-large .jstree-checked > .jstree-checkbox{background-position:-224px 0px}.jstree-glpi-large.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,.jstree-glpi-large .jstree-checked > .jstree-checkbox:hover{background-position:-224px -32px}.jstree-glpi-large .jstree-anchor > .jstree-undetermined{background-position:-192px 0px}.jstree-glpi-large .jstree-anchor > .jstree-undetermined:hover{background-position:-192px -32px}.jstree-glpi-large .jstree-checkbox-disabled{opacity:0.8;filter:url("data:image/svg+xml;utf8,#jstree-grayscale");-webkit-filter:grayscale(100%)}.jstree-glpi-large > .jstree-striped{background-size:auto 64px}.jstree-glpi-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAACAQMAAAB49I5GAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjAAMOBgAAGAAJMwQHdQAAAABJRU5ErkJggg==");background-position:100% 1px;background-repeat:repeat-y}.jstree-glpi-large.jstree-rtl .jstree-last{background:transparent}.jstree-glpi-large.jstree-rtl .jstree-open > .jstree-ocl{background-position:-128px -32px}.jstree-glpi-large.jstree-rtl .jstree-closed > .jstree-ocl{background-position:-96px -32px}.jstree-glpi-large.jstree-rtl .jstree-leaf > .jstree-ocl{background-position:-64px -32px}.jstree-glpi-large.jstree-rtl > .jstree-no-dots .jstree-node,.jstree-glpi-large.jstree-rtl > .jstree-no-dots .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-large.jstree-rtl > .jstree-no-dots .jstree-open > .jstree-ocl{background-position:-32px -32px}.jstree-glpi-large.jstree-rtl > .jstree-no-dots .jstree-closed > .jstree-ocl{background-position:0px -32px}.jstree-glpi-large .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-glpi-large > .jstree-container-ul .jstree-loading > .jstree-ocl{background:url("../pics/jquery/jstree/throbber.gif") center center no-repeat}.jstree-glpi-large .jstree-file{background:url("../pics/jquery/jstree/32px.png") -96px -64px no-repeat}.jstree-glpi-large .jstree-folder{background:url("../pics/jquery/jstree/32px.png") -256px 0px no-repeat}.jstree-glpi-large > .jstree-container-ul > .jstree-node{margin-left:0;margin-right:0}#jstree-dnd.jstree-glpi-large{line-height:32px;padding:0 4px}#jstree-dnd.jstree-glpi-large .jstree-ok,#jstree-dnd.jstree-glpi-large .jstree-er{background-image:url("../pics/jquery/jstree/32px.png");background-repeat:no-repeat;background-color:transparent}#jstree-dnd.jstree-glpi-large i{background:transparent;width:32px;height:32px;line-height:32px}#jstree-dnd.jstree-glpi-large .jstree-ok{background-position:0px -64px}#jstree-dnd.jstree-glpi-large .jstree-er{background-position:-32px -64px}.jstree-glpi-large .jstree-ellipsis{overflow:hidden}.jstree-glpi-large .jstree-ellipsis .jstree-anchor{width:calc(100% - 37px);text-overflow:ellipsis;overflow:hidden}.jstree-glpi-large .jstree-ellipsis.jstree-no-icons .jstree-anchor{width:calc(100% - 5px)}.jstree-glpi-large.jstree-rtl .jstree-node{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAACAQMAAAAD0EyKAAAABlBMVEUAAAAdHRvEkCwcAAAAAXRSTlMAQObYZgAAAAxJREFUCNdjgIIGBgABCgCBvVLXcAAAAABJRU5ErkJggg==")}.jstree-glpi-large.jstree-rtl .jstree-last{background:transparent}@media (max-width: 768px){#jstree-dnd.jstree-dnd-responsive{line-height:40px;font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}#jstree-dnd.jstree-dnd-responsive > i{background:transparent;width:40px;height:40px}#jstree-dnd.jstree-dnd-responsive > .jstree-ok{background-image:url("../pics/jquery/jstree/40px.png");background-position:0 -200px;background-size:120px 240px}#jstree-dnd.jstree-dnd-responsive > .jstree-er{background-image:url("../pics/jquery/jstree/40px.png");background-position:-40px -200px;background-size:120px 240px}#jstree-marker.jstree-dnd-responsive{border-left-width:10px;border-top-width:10px;border-bottom-width:10px;margin-top:-10px}}@media (max-width: 768px){.jstree-glpi-responsive .jstree-icon{background-image:url("../pics/jquery/jstree/40px.png")}.jstree-glpi-responsive .jstree-node,.jstree-glpi-responsive .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-responsive .jstree-node{min-height:40px;line-height:40px;margin-left:40px;min-width:40px;white-space:nowrap}.jstree-glpi-responsive .jstree-anchor{line-height:40px;height:40px}.jstree-glpi-responsive .jstree-icon,.jstree-glpi-responsive .jstree-icon:empty{width:40px;height:40px;line-height:40px}.jstree-glpi-responsive > .jstree-container-ul > .jstree-node{margin-left:0}.jstree-glpi-responsive.jstree-rtl .jstree-node{margin-left:0;margin-right:40px;background:transparent}.jstree-glpi-responsive.jstree-rtl .jstree-container-ul > .jstree-node{margin-right:0}.jstree-glpi-responsive .jstree-ocl,.jstree-glpi-responsive .jstree-themeicon,.jstree-glpi-responsive .jstree-checkbox{background-size:120px 240px}.jstree-glpi-responsive .jstree-leaf > .jstree-ocl,.jstree-glpi-responsive.jstree-rtl .jstree-leaf > .jstree-ocl{background:transparent}.jstree-glpi-responsive .jstree-open > .jstree-ocl{background-position:0 0px !important}.jstree-glpi-responsive .jstree-closed > .jstree-ocl{background-position:0 -40px !important}.jstree-glpi-responsive.jstree-rtl .jstree-closed > .jstree-ocl{background-position:-40px 0px !important}.jstree-glpi-responsive .jstree-themeicon{background-position:-40px -40px}.jstree-glpi-responsive .jstree-checkbox,.jstree-glpi-responsive .jstree-checkbox:hover{background-position:-40px -80px}.jstree-glpi-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox,.jstree-glpi-responsive.jstree-checkbox-selection .jstree-clicked > .jstree-checkbox:hover,.jstree-glpi-responsive .jstree-checked > .jstree-checkbox,.jstree-glpi-responsive .jstree-checked > .jstree-checkbox:hover{background-position:0 -80px}.jstree-glpi-responsive .jstree-anchor > .jstree-undetermined,.jstree-glpi-responsive .jstree-anchor > .jstree-undetermined:hover{background-position:0 -120px}.jstree-glpi-responsive .jstree-anchor{font-weight:bold;font-size:1.1em;text-shadow:1px 1px white}.jstree-glpi-responsive > .jstree-striped{background:transparent}.jstree-glpi-responsive .jstree-wholerow{border-top:1px solid rgba(255, 255, 255, 0.7);border-bottom:1px solid rgba(64, 64, 64, 0.2);background:#ebebeb;height:40px}.jstree-glpi-responsive .jstree-wholerow-hovered{background:#e7f4f9}.jstree-glpi-responsive .jstree-wholerow-clicked{background:#beebff}.jstree-glpi-responsive .jstree-children .jstree-last > .jstree-wholerow{box-shadow:inset 0 -6px 3px -5px #666666}.jstree-glpi-responsive .jstree-children .jstree-open > .jstree-wholerow{box-shadow:inset 0 6px 3px -5px #666666;border-top:0}.jstree-glpi-responsive .jstree-children .jstree-open + .jstree-open{box-shadow:none}.jstree-glpi-responsive .jstree-node,.jstree-glpi-responsive .jstree-icon,.jstree-glpi-responsive .jstree-node > .jstree-ocl,.jstree-glpi-responsive .jstree-themeicon,.jstree-glpi-responsive .jstree-checkbox{background-image:url("../pics/jquery/jstree/40px.png");background-size:120px 240px}.jstree-glpi-responsive .jstree-node{background-position:-80px 0;background-repeat:repeat-y}.jstree-glpi-responsive .jstree-last{background:transparent}.jstree-glpi-responsive .jstree-leaf > .jstree-ocl{background-position:-40px -120px}.jstree-glpi-responsive .jstree-last > .jstree-ocl{background-position:-40px -160px}.jstree-glpi-responsive .jstree-themeicon-custom{background-color:transparent;background-image:none;background-position:0 0}.jstree-glpi-responsive .jstree-file{background:url("../pics/jquery/jstree/40px.png") 0 -160px no-repeat;background-size:120px 240px}.jstree-glpi-responsive .jstree-folder{background:url("../pics/jquery/jstree/40px.png") -40px -40px no-repeat;background-size:120px 240px}.jstree-glpi-responsive > .jstree-container-ul > .jstree-node{margin-left:0;margin-right:0}} \ No newline at end of file diff --git a/css/print.min.css b/css/print.min.css new file mode 100644 index 00000000..ce01897b --- /dev/null +++ b/css/print.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- +*/body{font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:12px;margin:0;padding:0;background:white}ul,li,dt,dl,dd,form,img,input{margin:0;padding:0}ul{list-style-type:none}span.invisible{visibility:hidden}div.sep{font-size:1px;height:1px;padding:0;margin:0;clear:both}img{border:0}small{font-family:verdana;font-size:10px}.b{font-weight:bold}.center{text-align:center}.left{text-align:left}.right{text-align:right}.center-h{margin:auto}.middle{vertical-align:middle}.bottom{vertical-align:bottom}.top{vertical-align:top}.relative{position:relative}.red{color:red}.blue{color:blue}.green{color:green}.deleted{background-color:#cf9b9b}.separ{clear:both;visibility:hidden}a,a:link{font-weight:bold;text-decoration:none;color:#3A5693;font-size:11px}a:hover{color:black}hr{border:1px solid #cccccc}.pointer{cursor:pointer}.alltab{font-size:14px;text-align:center;background-color:#CC9900;padding:5px;font-weight:bold}.ui-tabs{width:100%;box-shadow:none}.ui-tabs-nav,.stNavMain{display:none}.ui-tabs-panel{margin:0;padding:0}.ui-tabs-vertical .ui-tabs-panel{margin-left:0;padding:0}#page{margin:0 auto;text-align:center}#page form{font-size:12px;margin:0;margin-bottom:5px;padding:0}#BackToTop{display:none}.qtip,.invisible{display:none}option{border:1px solid #ccc;background-color:#ffffff}.submit,input.submit,span.vsubmit,a.vsubmit,.ui-datepicker-trigger,input[type=file],.select2-selection__arrow{display:none}input[type=checkbox]{display:none}.mceToolbar{display:none}.entity_select{border-left:1px solid #C0CAD4;border-right:1px solid#C0CAD4;padding:3px}.entity_select:hover{border-left:1px solid #C0CAD4;border-right:1px solid #C0CAD4;border-bottom:1px solid #C0CAD4;padding:3px}.tree{width:100%;border:0;border-bottom:1px solid #C0CAD4}.treeroot{width:100%;background:url("../pics/treeroot.png") 0 2px no-repeat;border:0;font-weight:bold}.tree:hover{background-color:#eeeeee}.treeroot:hover{background-color:#eeeeee}img[src*='add_dropdown.png'],img[src*='info-small.png'],img[src*='reset.png'],img[src*='delete.png'],img[src*='showselect.png'],img[src*='addme.png'],img[src*='calendar.png']{display:none}.select2-container input{display:none}table{font-size:11px;border:0}.tab_glpi{margin:0 auto}.tab_cadre{margin:0 auto;-moz-border-radius:4px;border:1px solid #cccccc;z-index:1;text-align:left;font-size:11px;background-color:#ffffff}.tab_cadre_central{margin:0 auto;-moz-border-radius:4px;border:1px solid #bbbbbb;z-index:1;text-align:left;font-size:11px;width:95%;background:url("../pics/fond-central.png") repeat-x top right}.tab_cadre_navigation{margin:0 auto;padding:4px;margin:1px;border:1px solid #aaaaaa;background-color:#ffffff;-moz-border-radius:5px;font-size:12px;font-weight:bold}.tab_cadre_fixe,.tab_cadre_fixehov{margin:0 auto;-moz-border-radius:4px;border:1px solid #cccccc;z-index:1;text-align:left;font-size:11px;width:95%}.tab_cadrehov{margin:0 auto;-moz-border-radius:4px;border:1px solid #cccccc;text-align:left;font-size:11px;width:95%;background-color:#ffffff}.tab_cadre th,.tab_cadre_fixe th,.tab_cadre_fixehov th,.tab_cadrehov th{font-size:11px;font-weight:bold;text-align:center}.tab_cadre td,.tab_cadre_fixe td,.tab_cadre_fixehov td,.tab_cadrehov td{padding-left:5px}.tab_cadrehov tr:hover,.tab_cadre_fixehov tr:hover{background-color:#FFF4DF}.tab_bg_1{background-color:#f2f2f2}.tab_bg_1_2{background-color:#cf9b9b}.tab_bg_2{background-color:#e4e4e2}.tab_bg_2_2{background-color:#cf9b9b}.tab_bg_3{background-color:#e7e7e2}.tab_bg_4{background-color:silver}.tab_bg_5{background-color:#f2f2f2}.tab_find{background-color:#ccccc7}.tab_find:hover{background-color:#FFF2C2;cursor:pointer}.tab_resa{border:1px dashed #cccccc;background-color:#d7d7d2;font-size:10px}.tab_resa:hover{background-color:#ffffff;border:1px dotted #000000}.navigationheader{display:none}ul.autocomp{list-style-type:none;margin:0;margin-left:3px;padding:3px;text-align:left}ul.autocomp li.selected{background-color:#FFF6CF}li.auto_comp{list-style-type:none;display:block;margin:0;padding:2px;height:16px}.showplan{font-weight:bold;text-decoration:none;color:#3A5693;cursor:pointer}.actor_title,.actor-bloc{display:table-cell;float:none;vertical-align:top}.actor-bloc{width:29%;float:left}#ui-datepicker-div,#planning_filter,#refresh_planning,.sp-hidden,.fc-time:before{display:none}#contenukb{height:100%;width:600px;margin:0 auto}#contenukb legend{font-weight:bold}#contenukb fieldset{background-color:#eeeeee;border:1px solid #FFC65D;-moz-border-radius:8px;padding-bottom:10px;width:600px}#contenukb textarea{width:550px}#kbanswer ul{padding-left:15px}.tdkb_result{vertical-align:top;text-align:left;width:33%;padding:3px 20px 3px 25px}.kb{text-align:left;padding-top:5px}.kb_resume{text-align:left;font-size:9px;line-height:10px;clear:both;padding:5px 0 10px 25px}.tdkb{text-align:left;font-size:10px;color:#aaaaaa}.baskb{position:relative;text-align:left;font-size:10px;color:#aaaaaa}.baskb_right{position:absolute;right:0;margin-right:5px}.code{width:95%;border:dotted 2px #ccc}a.knowbase{font-size:13px;margin-left:8px}a.pubfaq{font-size:13px;margin-left:8px;color:#c9993C}a.pubfaq:hover{color:black}a.icon_nav_move img{padding:4px;margin:1px;border:1px solid #aaaaaa;background-color:#ffffff;-moz-border-radius:5px}a.icon_nav_move:hover img{padding:4px;margin:1px;border:1px solid #999999;background-color:#e4e4e4;-moz-border-radius:5px}.planning{text-align:center;border:1px dashed #cccccc;background-color:#d7d7d2;font-size:9px}.planing:hover{border:1px solid #999999;background-color:white}div#menu_navigate{margin:0 auto;z-index:1;font-size:10px;width:950px}div#menu_navigate li{margin-left:2px;display:block;float:left;padding:2px}#barre_onglets{width:950px;margin-left:auto;margin-right:auto;margin-bottom:0;padding-bottom:0}#barre_onglets_percent{width:80%;margin-left:auto;margin-right:auto;margin-bottom:0;padding-bottom:0}ul#onglet{list-style-type:none;padding-bottom:24px;border-bottom:1px solid #ffffff;margin:0;padding-left:0}ul#onglet li{float:left;height:21px;background-color:#eeeeee;margin:2px 2px 0 1px;border:1px solid #CC9900;border-bottom:1px solid #fff;-moz-border-radius:4px;background:url("../pics/fond_onglet.png") repeat-x}ul#onglet li.actif{border-bottom:1px ridge #3A5693;background-color:#fff}ul#onglet li.invisible{border-bottom:1px solid #fff;border:1px solid #fff;background-color:#ffffff;width:15px;background:transparent}ul#onglet li.actif a{color:#000}#onglet a{float:left;display:block;color:#666;text-decoration:none;padding:3px;font-size:10px;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold}#onglet a:hover{color:#3A5693}ul#onglet span.fake{float:left;display:block;color:#666;text-decoration:none;padding:3px;font-size:10px;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;cursor:pointer}#onglet_plugins{display:none;position:absolute;top:21px;left:-20px;padding:5px;font-size:8px;width:100px;background:transparent url("../pics/fd_hoverlink.png") repeat;border:1px solid gray;-moz-border-radius:5px}#onglet_plugins dl{margin:0;padding:0;list-style-type:none;border:0}#onglet_plugins dt{text-align:center;padding:2px;background:none;border:0;width:100%;height:18px}#onglet_plugins dt a{font-size:10px;color:#000;text-decoration:none;display:block;border:0 none}#onglet_plugins dt a:hover{color:#000;background:#fccc6f}#onglet_plugins dt:hover{color:#000;background:#fccc6f}.box{margin:0 auto;width:700px;text-align:center}.box-tleft{background:transparent url(../pics/corners.gif) no-repeat 0 0;zoom:1}.box-tcenter{height:8px;background:transparent url(../pics/tb.gif) repeat-x 0 0;overflow:hidden}.box-tright{background:transparent url(../pics/corners.gif) no-repeat right -8px}.box-mleft{background:transparent url(../pics/l.gif) repeat-y 0;padding-left:4px;overflow:hidden;zoom:1}.box-mcenter{background:#eee url(../pics/tb.gif) repeat-x 0 -16px;padding:4px 10px;font-family:"Myriad Pro","Myriad Web","Tahoma","Helvetica","Arial",sans-serif;color:#393939;font-size:11px}.box-mcenter h3{font-size:11px;font-weight:bold;margin:0 0 4px 0;zoom:1}.box-mright{background:transparent url(../pics/r.gif) repeat-y right;padding-right:4px;overflow:hidden}.box-bleft{background:transparent url(../pics/corners.gif) no-repeat 0 -16px;zoom:1}.box-bcenter{background:transparent url(../pics/tb.gif) repeat-x 0 -8px;height:8px;overflow:hidden}.box-bright{background:transparent url(../pics/corners.gif) no-repeat right -24px}.box-tleft,.box-bleft{padding-left:8px;overflow:hidden}.box-tright,.box-bright{padding-right:8px;overflow:hidden}#contenulogin{height:266px;width:600px;margin-top:100px;margin-left:auto;margin-right:auto;background:url("../pics/login_glpi.png") no-repeat;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;color:#3A5693;font-weight:bold}#contenu-nullHeader{height:424px;width:739px;margin-top:50px;margin-left:auto;margin-right:auto;background:url("../pics/null-header.png") no-repeat}#text-nullHeader{float:left;height:300px;width:739px;margin-right:auto;margin-left:auto;margin-top:100px}#boxlogin{position:relative;background-color:transparent;padding-left:15px;padding-top:76px;height:190px;width:300px}#boxlogin p{text-align:center}.row{clear:both;padding-top:5px}.label{float:left;margin-left:10px;text-align:left}.formw{float:right;margin-right:10px;text-align:right}#boxlogin fieldset{background-color:transparent;border:2px solid #FFC65D;padding-bottom:22px}#boxlogin legend{font-family:"Trebuchet MS",Verdana,Geneva,Arial,Helvetica,sans-serif;font-size:15px;font-weight:700;background-color:transparent;color:#3A5693}#boxlogin input{border:1px solid #3A5693}#logo-login{font-size:11px;float:right;height:160px;width:230px;margin-right:10px;margin-left:0px;margin-top:80px;color:#000000;overflow:auto}#logo-login a:hover{color:#3A5693;text-decoration:underline}#box-faq{float:right;margin-right:10px}.sous_logo{font-family:arial;font-size:9px;color:#eeeeee;text-decoration:none}.error{color:red;margin-top:20px;text-align:center}#footer-login{text-align:right;position:fixed !important;left:0px;right:10px;bottom:0px !important;height:40px;font-size:10px;color:#757575;font-family:Verdana,Arial,Helvetica,sans-serif;font-weight:bold;margin-top:10px;margin:auto}div#header{display:none;background:url("../pics/fd_nav1.png") 0 0 repeat-x;margin-bottom:10px}div#c_preference{height:20px;text-align:right;margin-right:5px;position:relative;top:4px;font-size:0.9em;z-index:900}div#c_preference ul{list-style:none}div#c_preference ul li{float:right;margin:0 10px}div#c_preference ul li#deconnexion{margin-left:25px}div#c_preference a{color:#000;text-decoration:none;font-size:0.9em}div#c_preference a:hover{text-decoration:underline}div#c_recherche{height:21px;text-align:right;margin-right:25px;position:relative;top:5px;font-size:0.9em}div#c_recherche form{height:15px;position:relative;bottom:3px}div#c_recherche form div#champRecherche input{border:1px solid #000;height:14px;font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:11px}div#c_recherche form div#boutonRecherche{float:right;border:1px solid #000;height:14px;width:14px;overflow:hidden}div#c_recherche form div#boutonRecherche input{font-family:'Bitstream Vera Sans', arial, Tahoma, 'Sans serif';font-size:0.7em;width:15px;height:15px;border:none;position:relative;right:2px}div#c_menu{height:41px;position:absolute;top:0px;z-index:10;left:45px}div#c_menu ul#menu{position:relative;left:10px;top:23px;height:20px;list-style:none;float:left}ul#menu a.itemP,ul#menu a.itemP1{display:block;height:100%;width:100%;text-align:center;text-decoration:none;border-right:1px solid #9BA563;color:#000}ul#menu ul.ssmenu{position:relative;top:5px;width:108px;border:1px solid #CC9900;border-bottom:0px;-moz-border-radius:4px;background:url("../pics/fd_ssmenu.png") 0 0 repeat;display:none}ul#menu ul li{list-style:none;text-align:center;border-bottom:1px solid #CC9900;line-height:20px;font-size:0.9em}ul#menu ul li a{color:#000;text-decoration:none;display:block;width:100%;height:100%}ul#menu li#menu1{float:left;width:110px}ul#menu li#menu1 ul.ssmenu{position:relative;width:110px}ul#menu li#menu2{float:left;width:110px}ul#menu li#menu2 ul.ssmenu{position:relative;width:110px}ul#menu li#menu3{float:left;width:110px}ul#menu li#menu3 ul.ssmenu{position:relative;width:110px}ul#menu li#menu4{float:left;width:110px}ul#menu li#menu4 ul.ssmenu{position:relative;width:110px}ul#menu li#menu5{float:left;width:110px}ul#menu li#menu5 ul.ssmenu{position:relative;width:110px}ul#menu li#menu6{float:left;width:110px}ul#menu li#menu6 ul.ssmenu{position:relative;width:110px}ul#menu li#menu7{float:left;width:110px}ul#menu li#menu7 ul.ssmenu{position:relative;width:110px}div#header div#c_logo{position:absolute;z-index:1000;width:64px;height:41px;float:left;background:url("../pics/fd_logo.png") 0 0 repeat-x}div#header div#c_logo a{display:block;width:100%;height:100%;text-decoration:none}div#c_ssmenu1{height:24px;clear:both;font-size:0.8em}div#c_ssmenu1 ul{position:relative;top:4px;left:0px;list-style:none}div#c_ssmenu1 ul li{float:left;padding:0 10px}div#c_ssmenu1 ul li a{text-decoration:none;color:#666}div#c_ssmenu1 ul li a:hover{text-decoration:underline}div#c_ssmenu2{position:relative;z-index:5;background:url("../pics/fd_nav3.png") 0 0 repeat-x;height:28px;clear:both;font-size:0.9em}div#c_ssmenu2 ul{position:relative;top:5px;left:0px;list-style:none}div#c_ssmenu2 ul li{position:relative;float:left;padding:0 10px}div#c_ssmenu2 ul li a{text-decoration:none;color:#000}div#c_ssmenu2 a.here{font-size:14px}div#show_entities{display:none;position:absolute;top:20px;left:1px;border:1px solid #CC9900;background:url("../pics/fd_hoverlink.png") 0 0 repeat;-moz-border-radius:5px;padding:5px;font-size:11px;text-align:left;z-index:1000}div#show_entities_long{display:none;position:absolute;top:20px;left:1px;border:1px solid #CC9900;background:url("../pics/fd_hoverlink.png") 0 0 repeat;-moz-border-radius:5px;padding:5px;font-size:11px;text-align:left;z-index:1000;overflow:scroll;height:300px;width:300px}div#show_all_menu{display:none;position:absolute;top:20px;left:5px;border:1px solid #CC9900;background:url("../pics/fd_hoverlink.png") 0 0 repeat;-moz-border-radius:5px;padding:5px;font-size:11px;text-align:left;z-index:1000}#menu_navigate{display:none}#tabspanel{display:none}#footer{display:none;background:url("../pics/fd_footer.png") 0 0 repeat-x;font-size:9px;color:#757575;padding:3px;margin-top:200px;clear:both}.copyright{font-size:9px;color:#757575}#dbslave-float{top:0px;left:300px;position:absolute;z-index:100}#dbslave-float a{border-top:1px solid #cecece;border-bottom:2px solid #4a4a4a;border-left:1px solid #cecece;border-right:1px solid #cecece;text-decoration:none;text-align:center;margin:0;padding:1px .5em;font-family:helvetica,arial,sans-serif;font-size:10px;font-weight:bold;background-color:#fff;color:blue}#debug-float{top:0px;left:80px;position:absolute;z-index:100}#debug-float a{border-top:1px solid #cecece;border-bottom:2px solid #4a4a4a;border-left:1px solid #cecece;border-right:1px solid #cecece;text-decoration:none;text-align:center;margin:0;padding:1px .5em;font-family:helvetica,arial,sans-serif;font-size:10px;font-weight:bold;background-color:#fff;color:red}#debug-float a:hover{background-color:#fc3;border-bottom:2px solid #36f}#debug,#debug-float,.debug,.see_debug{display:none;background-color:#F0F0F0}#debugajax{display:none;margin:auto;text-align:center}#debug h1,#debugajax h1{font-size:14px;text-align:center;background-color:#efefe7;padding:5px}#debug h2,#debugajax h2{font-size:14px;padding-left:10px;border-left:4px solid #FFC65D;border-bottom:2px solid #FFC65D}#debug table,#debugajax table{margin:0}#backtotop{display:none !important}.racks_col{display:inline;padding:0 20px 0 0;margin-right:0}#switchview,.racks_view_controls,.rel-link,.rack_side_block .sub_action{display:none}#viewgraph{width:100%}.timeline_form,.filter_timeline,.timeline_history .h_content .edit_item{display:none}.timeline_history{border-top:none} \ No newline at end of file diff --git a/css/style_install.min.css b/css/style_install.min.css new file mode 100644 index 00000000..ddc17866 --- /dev/null +++ b/css/style_install.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- +*/body{background-color:#1B2F62;font-family:Verdana;color:#FFF}#principal{width:760px;font-family:Verdana;font-size:12px;text-align:center;margin:auto;padding:40px 40px 40px 40px}a{color:#FEC95C;font-weight:bold}#bloc{width:760px;margin:0 auto;text-align:left;position:relative;padding:10px;background:#3A5693}#logo_bloc{position:absolute;top:-25px;padding:0;margin:0;width:145px;height:80px;background:url(../pics/login_logo_glpi.png) no-repeat}p{padding-left:20px;padding-right:20px}.center{text-align:center}.left{text-align:left}.inline{display:inline}table{text-align:center;border:0;margin:20px;margin-left:auto;margin-right:auto;width:90%}th{font-size:12px;font-weight:bold;color:#FFA500;vertical-align:bottom}.tab_check{padding:10px;background-color:#FFF;color:#000}.tab_check th{font-size:14px;font-weight:bold}.tab_check td{font-size:11px;border-bottom:1px solid #bbbbbb}.tab_check td i.fas{font-size:12px;margin-right:3px}.tab_check td i.fa-check{color:#008e2c}.tab_check td i.fa-exclamation-triangle{color:#ffa500}.red{color:red}.migred{color:white;background-color:red}.green{color:green}h2{text-align:center;color:#FEC95C}h3{text-align:center}input{border:1px solid #ccc}fieldset{margin:40px;padding:20px;background:#FFF;border:none;font-size:12px;font-weight:200;position:relative}fieldset legend{color:#000;font-weight:bold;position:absolute;top:5px}.block{display:inline-block;width:300px;color:#000}fieldset label{text-align:right;margin-right:5px}.submit{text-align:center}input.submit,span.vsubmit,a.vsubmit{padding:5px;cursor:pointer;height:auto;font:bold 12px Arial, Helvetica;color:#8f5a0a;background-color:#FEC95C;border:0}input.submit:hover,a.vsubmit:hover{background-color:#fddb6f;-moz-box-shadow:0px 1px 1px #999;-webkit-box-shadow:0px 1px 1px #999;box-shadow:0px 1px 1px #999}#license{text-align:left;width:520px;margin:20px auto}.radio{display:inline-block;cursor:pointer;line-height:25px;font-weight:bold;margin-bottom:5px}.radio:hover .inner{-webkit-transform:scale(0.5);-ms-transform:scale(0.5);transform:scale(0.5);opacity:.5}.radio input[type=radio]{width:1px;height:1px;opacity:0}.radio input:checked + .outer .inner{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:1}.radio input:checked + .outer{border:3px solid #f08b3b}.radio input:focus + .outer .inner{-webkit-transform:scale(1);-ms-transform:scale(1);transform:scale(1);opacity:1;background-color:#FEC95C}.radio .outer{width:20px;height:20px;display:block;float:left;border:3px solid #1B2F62;border-radius:50%}.radio .inner{-webkit-transition:all 0.25s ease-in-out;transition:all 0.25s ease-in-out;width:16px;height:16px;-webkit-transform:scale(0);-ms-transform:scale(0);transform:scale(0);display:block;margin:2px;border-radius:50%;background-color:#FEC95C;opacity:0}.ui-widget{font-size:12px}.select2-container ul{color:#000} \ No newline at end of file diff --git a/css/swiper-bundle.min.css b/css/swiper-bundle.min.css new file mode 100644 index 00000000..14cf0494 --- /dev/null +++ b/css/swiper-bundle.min.css @@ -0,0 +1,13 @@ +/** + * Swiper 6.5.4 + * Most modern mobile touch slider and framework with hardware accelerated transitions + * https://swiperjs.com + * + * Copyright 2014-2021 Vladimir Kharlampidi + * + * Released under the MIT License + * + * Released on: April 5, 2021 + */ + +@font-face{font-family:swiper-icons;src:url('data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA') format('woff');font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff}.swiper-container{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1}.swiper-container-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;box-sizing:content-box}.swiper-container-android .swiper-slide,.swiper-wrapper{transform:translate3d(0px,0,0)}.swiper-container-multirow>.swiper-wrapper{flex-wrap:wrap}.swiper-container-multirow-column>.swiper-wrapper{flex-wrap:wrap;flex-direction:column}.swiper-container-free-mode>.swiper-wrapper{transition-timing-function:ease-out;margin:0 auto}.swiper-container-pointer-events{touch-action:pan-y}.swiper-container-pointer-events.swiper-container-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform}.swiper-slide-invisible-blank{visibility:hidden}.swiper-container-autoheight,.swiper-container-autoheight .swiper-slide{height:auto}.swiper-container-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform,height}.swiper-container-3d{perspective:1200px}.swiper-container-3d .swiper-cube-shadow,.swiper-container-3d .swiper-slide,.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top,.swiper-container-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-container-3d .swiper-slide-shadow-bottom,.swiper-container-3d .swiper-slide-shadow-left,.swiper-container-3d .swiper-slide-shadow-right,.swiper-container-3d .swiper-slide-shadow-top{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-container-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom,rgba(0,0,0,.5),rgba(0,0,0,0))}.swiper-container-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none}.swiper-container-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-container-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-container-horizontal.swiper-container-css-mode>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-container-vertical.swiper-container-css-mode>.swiper-wrapper{scroll-snap-type:y mandatory}:root{--swiper-navigation-size:44px}.swiper-button-next,.swiper-button-prev{position:absolute;top:50%;width:calc(var(--swiper-navigation-size)/ 44 * 27);height:var(--swiper-navigation-size);margin-top:calc(0px - (var(--swiper-navigation-size)/ 2));z-index:10;cursor:pointer;display:flex;align-items:center;justify-content:center;color:var(--swiper-navigation-color,var(--swiper-theme-color))}.swiper-button-next.swiper-button-disabled,.swiper-button-prev.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.swiper-button-next:after,.swiper-button-prev:after{font-family:swiper-icons;font-size:var(--swiper-navigation-size);text-transform:none!important;letter-spacing:0;text-transform:none;font-variant:initial;line-height:1}.swiper-button-prev,.swiper-container-rtl .swiper-button-next{left:10px;right:auto}.swiper-button-prev:after,.swiper-container-rtl .swiper-button-next:after{content:'prev'}.swiper-button-next,.swiper-container-rtl .swiper-button-prev{right:10px;left:auto}.swiper-button-next:after,.swiper-container-rtl .swiper-button-prev:after{content:'next'}.swiper-button-next.swiper-button-white,.swiper-button-prev.swiper-button-white{--swiper-navigation-color:#ffffff}.swiper-button-next.swiper-button-black,.swiper-button-prev.swiper-button-black{--swiper-navigation-color:#000000}.swiper-button-lock{display:none}.swiper-pagination{position:absolute;text-align:center;transition:.3s opacity;transform:translate3d(0,0,0);z-index:10}.swiper-pagination.swiper-pagination-hidden{opacity:0}.swiper-container-horizontal>.swiper-pagination-bullets,.swiper-pagination-custom,.swiper-pagination-fraction{bottom:10px;left:0;width:100%}.swiper-pagination-bullets-dynamic{overflow:hidden;font-size:0}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transform:scale(.33);position:relative}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-main{transform:scale(1)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-prev-prev{transform:scale(.33)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next{transform:scale(.66)}.swiper-pagination-bullets-dynamic .swiper-pagination-bullet-active-next-next{transform:scale(.33)}.swiper-pagination-bullet{width:8px;height:8px;display:inline-block;border-radius:50%;background:#000;opacity:.2}button.swiper-pagination-bullet{border:none;margin:0;padding:0;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none}.swiper-pagination-clickable .swiper-pagination-bullet{cursor:pointer}.swiper-pagination-bullet-active{opacity:1;background:var(--swiper-pagination-color,var(--swiper-theme-color))}.swiper-container-vertical>.swiper-pagination-bullets{right:10px;top:50%;transform:translate3d(0px,-50%,0)}.swiper-container-vertical>.swiper-pagination-bullets .swiper-pagination-bullet{margin:6px 0;display:block}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{top:50%;transform:translateY(-50%);width:8px}.swiper-container-vertical>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{display:inline-block;transition:.2s transform,.2s top}.swiper-container-horizontal>.swiper-pagination-bullets .swiper-pagination-bullet{margin:0 4px}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic{left:50%;transform:translateX(-50%);white-space:nowrap}.swiper-container-horizontal>.swiper-pagination-bullets.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s left}.swiper-container-horizontal.swiper-container-rtl>.swiper-pagination-bullets-dynamic .swiper-pagination-bullet{transition:.2s transform,.2s right}.swiper-pagination-progressbar{background:rgba(0,0,0,.25);position:absolute}.swiper-pagination-progressbar .swiper-pagination-progressbar-fill{background:var(--swiper-pagination-color,var(--swiper-theme-color));position:absolute;left:0;top:0;width:100%;height:100%;transform:scale(0);transform-origin:left top}.swiper-container-rtl .swiper-pagination-progressbar .swiper-pagination-progressbar-fill{transform-origin:right top}.swiper-container-horizontal>.swiper-pagination-progressbar,.swiper-container-vertical>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite{width:100%;height:4px;left:0;top:0}.swiper-container-horizontal>.swiper-pagination-progressbar.swiper-pagination-progressbar-opposite,.swiper-container-vertical>.swiper-pagination-progressbar{width:4px;height:100%;left:0;top:0}.swiper-pagination-white{--swiper-pagination-color:#ffffff}.swiper-pagination-black{--swiper-pagination-color:#000000}.swiper-pagination-lock{display:none}.swiper-scrollbar{border-radius:10px;position:relative;-ms-touch-action:none;background:rgba(0,0,0,.1)}.swiper-container-horizontal>.swiper-scrollbar{position:absolute;left:1%;bottom:3px;z-index:50;height:5px;width:98%}.swiper-container-vertical>.swiper-scrollbar{position:absolute;right:3px;top:1%;z-index:50;width:5px;height:98%}.swiper-scrollbar-drag{height:100%;width:100%;position:relative;background:rgba(0,0,0,.5);border-radius:10px;left:0;top:0}.swiper-scrollbar-cursor-drag{cursor:move}.swiper-scrollbar-lock{display:none}.swiper-zoom-container{width:100%;height:100%;display:flex;justify-content:center;align-items:center;text-align:center}.swiper-zoom-container>canvas,.swiper-zoom-container>img,.swiper-zoom-container>svg{max-width:100%;max-height:100%;object-fit:contain}.swiper-slide-zoomed{cursor:move}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;animation:swiper-preloader-spin 1s infinite linear;box-sizing:border-box;border:4px solid var(--swiper-preloader-color,var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{100%{transform:rotate(360deg)}}.swiper-container .swiper-notification{position:absolute;left:0;top:0;pointer-events:none;opacity:0;z-index:-1000}.swiper-container-fade.swiper-container-free-mode .swiper-slide{transition-timing-function:ease-out}.swiper-container-fade .swiper-slide{pointer-events:none;transition-property:opacity}.swiper-container-fade .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-fade .swiper-slide-active,.swiper-container-fade .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube{overflow:visible}.swiper-container-cube .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1;visibility:hidden;transform-origin:0 0;width:100%;height:100%}.swiper-container-cube .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-cube.swiper-container-rtl .swiper-slide{transform-origin:100% 0}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-cube .swiper-slide-active,.swiper-container-cube .swiper-slide-next,.swiper-container-cube .swiper-slide-next+.swiper-slide,.swiper-container-cube .swiper-slide-prev{pointer-events:auto;visibility:visible}.swiper-container-cube .swiper-slide-shadow-bottom,.swiper-container-cube .swiper-slide-shadow-left,.swiper-container-cube .swiper-slide-shadow-right,.swiper-container-cube .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden}.swiper-container-cube .swiper-cube-shadow{position:absolute;left:0;bottom:0px;width:100%;height:100%;opacity:.6;z-index:0}.swiper-container-cube .swiper-cube-shadow:before{content:'';background:#000;position:absolute;left:0;top:0;bottom:0;right:0;-webkit-filter:blur(50px);filter:blur(50px)}.swiper-container-flip{overflow:visible}.swiper-container-flip .swiper-slide{pointer-events:none;-webkit-backface-visibility:hidden;backface-visibility:hidden;z-index:1}.swiper-container-flip .swiper-slide .swiper-slide{pointer-events:none}.swiper-container-flip .swiper-slide-active,.swiper-container-flip .swiper-slide-active .swiper-slide-active{pointer-events:auto}.swiper-container-flip .swiper-slide-shadow-bottom,.swiper-container-flip .swiper-slide-shadow-left,.swiper-container-flip .swiper-slide-shadow-right,.swiper-container-flip .swiper-slide-shadow-top{z-index:0;-webkit-backface-visibility:hidden;backface-visibility:hidden} \ No newline at end of file diff --git a/css/tab-scroller-menu.min.css b/css/tab-scroller-menu.min.css new file mode 100644 index 00000000..a8a04fa5 --- /dev/null +++ b/css/tab-scroller-menu.min.css @@ -0,0 +1,30 @@ +/** + * --------------------------------------------------------------------- + * GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2015-2020 Teclib' and contributors. + * + * http://glpi-project.org + * + * based on GLPI - Gestionnaire Libre de Parc Informatique + * Copyright (C) 2003-2014 by the INDEPNET Development Team. + * + * --------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GLPI. + * + * GLPI is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * GLPI is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GLPI. If not, see . + * --------------------------------------------------------------------- + */.x-tab-scroller-right-over{background-position:-18px 0}.x-tab-tabmenu-right{background:transparent url(../pics/extrajs/tab-scroller-menu.gif) no-repeat 0 0;border-bottom:1px solid #8db2e3;width:18px;position:absolute;right:0;top:0;z-index:10;cursor:pointer}.x-tab-tabmenu-over{background-position:-18px 0}.x-tab-tabmenu-disabled{background-position:0 0;opacity:.5;-moz-opacity:.5;filter:alpha(opacity=50);cursor:default} \ No newline at end of file diff --git a/css/tiny_mce_custom.min.css b/css/tiny_mce_custom.min.css new file mode 100644 index 00000000..a8eec798 --- /dev/null +++ b/css/tiny_mce_custom.min.css @@ -0,0 +1 @@ +.mce-content-body{word-wrap:break-word} \ No newline at end of file diff --git a/js/chart.min.js b/js/chart.min.js new file mode 100644 index 00000000..090a9bde --- /dev/null +++ b/js/chart.min.js @@ -0,0 +1,14 @@ +/*! + * Chart.js + * http://chartjs.org/ + * Version: 2.5.0 + * + * Copyright 2017 Nick Downie + * Released under the MIT license + * https://github.com/chartjs/Chart.js/blob/master/LICENSE.md + */ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.Chart=t()}}(function(){return function t(e,a,i){function n(r,s){if(!a[r]){if(!e[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(o)return o(r,!0);var u=new Error("Cannot find module '"+r+"'");throw u.code="MODULE_NOT_FOUND",u}var d=a[r]={exports:{}};e[r][0].call(d.exports,function(t){var a=e[r][1][t];return n(a?a:t)},d,d.exports,t,e,a,i)}return a[r].exports}for(var o="function"==typeof require&&require,r=0;ra?(e+.05)/(a+.05):(a+.05)/(e+.05)},level:function(t){var e=this.contrast(t);return e>=7.1?"AAA":e>=4.5?"AA":""},dark:function(){var t=this.values.rgb,e=(299*t[0]+587*t[1]+114*t[2])/1e3;return e<128},light:function(){return!this.dark()},negate:function(){for(var t=[],e=0;e<3;e++)t[e]=255-this.values.rgb[e];return this.setValues("rgb",t),this},lighten:function(t){var e=this.values.hsl;return e[2]+=e[2]*t,this.setValues("hsl",e),this},darken:function(t){var e=this.values.hsl;return e[2]-=e[2]*t,this.setValues("hsl",e),this},saturate:function(t){var e=this.values.hsl;return e[1]+=e[1]*t,this.setValues("hsl",e),this},desaturate:function(t){var e=this.values.hsl;return e[1]-=e[1]*t,this.setValues("hsl",e),this},whiten:function(t){var e=this.values.hwb;return e[1]+=e[1]*t,this.setValues("hwb",e),this},blacken:function(t){var e=this.values.hwb;return e[2]+=e[2]*t,this.setValues("hwb",e),this},greyscale:function(){var t=this.values.rgb,e=.3*t[0]+.59*t[1]+.11*t[2];return this.setValues("rgb",[e,e,e]),this},clearer:function(t){var e=this.values.alpha;return this.setValues("alpha",e-e*t),this},opaquer:function(t){var e=this.values.alpha;return this.setValues("alpha",e+e*t),this},rotate:function(t){var e=this.values.hsl,a=(e[0]+t)%360;return e[0]=a<0?360+a:a,this.setValues("hsl",e),this},mix:function(t,e){var a=this,i=t,n=void 0===e?.5:e,o=2*n-1,r=a.alpha()-i.alpha(),s=((o*r===-1?o:(o+r)/(1+o*r))+1)/2,l=1-s;return this.rgb(s*a.red()+l*i.red(),s*a.green()+l*i.green(),s*a.blue()+l*i.blue()).alpha(a.alpha()*n+i.alpha()*(1-n))},toJSON:function(){return this.rgb()},clone:function(){var t,e,a=new o,i=this.values,n=a.values;for(var r in i)i.hasOwnProperty(r)&&(t=i[r],e={}.toString.call(t),"[object Array]"===e?n[r]=t.slice(0):"[object Number]"===e?n[r]=t:console.error("unexpected color value:",t));return a}},o.prototype.spaces={rgb:["red","green","blue"],hsl:["hue","saturation","lightness"],hsv:["hue","saturation","value"],hwb:["hue","whiteness","blackness"],cmyk:["cyan","magenta","yellow","black"]},o.prototype.maxes={rgb:[255,255,255],hsl:[360,100,100],hsv:[360,100,100],hwb:[360,100,100],cmyk:[100,100,100,100]},o.prototype.getValues=function(t){for(var e=this.values,a={},i=0;i.04045?Math.pow((e+.055)/1.055,2.4):e/12.92,a=a>.04045?Math.pow((a+.055)/1.055,2.4):a/12.92,i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92;var n=.4124*e+.3576*a+.1805*i,o=.2126*e+.7152*a+.0722*i,r=.0193*e+.1192*a+.9505*i;return[100*n,100*o,100*r]}function d(t){var e,a,i,n=u(t),o=n[0],r=n[1],s=n[2];return o/=95.047,r/=100,s/=108.883,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,s=s>.008856?Math.pow(s,1/3):7.787*s+16/116,e=116*r-16,a=500*(o-r),i=200*(r-s),[e,a,i]}function c(t){return z(d(t))}function h(t){var e,a,i,n,o,r=t[0]/360,s=t[1]/100,l=t[2]/100;if(0==s)return o=255*l,[o,o,o];a=l<.5?l*(1+s):l+s-l*s,e=2*l-a,n=[0,0,0];for(var u=0;u<3;u++)i=r+1/3*-(u-1),i<0&&i++,i>1&&i--,o=6*i<1?e+6*(a-e)*i:2*i<1?a:3*i<2?e+(a-e)*(2/3-i)*6:e,n[u]=255*o;return n}function f(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return 0===o?[0,0,0]:(o*=2,n*=o<=1?o:2-o,a=(o+n)/2,e=2*n/(o+n),[i,100*e,100*a])}function p(t){return o(h(t))}function m(t){return s(h(t))}function v(t){return l(h(t))}function x(t){var e=t[0]/60,a=t[1]/100,i=t[2]/100,n=Math.floor(e)%6,o=e-Math.floor(e),r=255*i*(1-a),s=255*i*(1-a*o),l=255*i*(1-a*(1-o)),i=255*i;switch(n){case 0:return[i,l,r];case 1:return[s,i,r];case 2:return[r,i,l];case 3:return[r,s,i];case 4:return[l,r,i];case 5:return[i,r,s]}}function y(t){var e,a,i=t[0],n=t[1]/100,o=t[2]/100;return a=(2-n)*o,e=n*o,e/=a<=1?a:2-a,e=e||0,a/=2,[i,100*e,100*a]}function k(t){return o(x(t))}function S(t){return s(x(t))}function M(t){return l(x(t))}function w(t){var e,a,i,n,o=t[0]/360,s=t[1]/100,l=t[2]/100,u=s+l;switch(u>1&&(s/=u,l/=u),e=Math.floor(6*o),a=1-l,i=6*o-e,0!=(1&e)&&(i=1-i),n=s+i*(a-s),e){default:case 6:case 0:r=a,g=n,b=s;break;case 1:r=n,g=a,b=s;break;case 2:r=s,g=a,b=n;break;case 3:r=s,g=n,b=a;break;case 4:r=n,g=s,b=a;break;case 5:r=a,g=s,b=n}return[255*r,255*g,255*b]}function C(t){return i(w(t))}function I(t){return n(w(t))}function D(t){return s(w(t))}function A(t){return l(w(t))}function T(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100,s=t[3]/100;return e=1-Math.min(1,n*(1-s)+s),a=1-Math.min(1,o*(1-s)+s),i=1-Math.min(1,r*(1-s)+s),[255*e,255*a,255*i]}function P(t){return i(T(t))}function _(t){return n(T(t))}function F(t){return o(T(t))}function V(t){return l(T(t))}function R(t){var e,a,i,n=t[0]/100,o=t[1]/100,r=t[2]/100;return e=3.2406*n+o*-1.5372+r*-.4986,a=n*-.9689+1.8758*o+.0415*r,i=.0557*n+o*-.204+1.057*r,e=e>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,a=a>.0031308?1.055*Math.pow(a,1/2.4)-.055:a*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,e=Math.min(Math.max(0,e),1),a=Math.min(Math.max(0,a),1),i=Math.min(Math.max(0,i),1),[255*e,255*a,255*i]}function O(t){var e,a,i,n=t[0],o=t[1],r=t[2];return n/=95.047,o/=100,r/=108.883,n=n>.008856?Math.pow(n,1/3):7.787*n+16/116,o=o>.008856?Math.pow(o,1/3):7.787*o+16/116,r=r>.008856?Math.pow(r,1/3):7.787*r+16/116,e=116*o-16,a=500*(n-o),i=200*(o-r),[e,a,i]}function L(t){return z(O(t))}function B(t){var e,a,i,n,o=t[0],r=t[1],s=t[2];return o<=8?(a=100*o/903.3,n=7.787*(a/100)+16/116):(a=100*Math.pow((o+16)/116,3),n=Math.pow(a/100,1/3)),e=e/95.047<=.008856?e=95.047*(r/500+n-16/116)/7.787:95.047*Math.pow(r/500+n,3),i=i/108.883<=.008859?i=108.883*(n-s/200-16/116)/7.787:108.883*Math.pow(n-s/200,3),[e,a,i]}function z(t){var e,a,i,n=t[0],o=t[1],r=t[2];return e=Math.atan2(r,o),a=360*e/2/Math.PI,a<0&&(a+=360),i=Math.sqrt(o*o+r*r),[n,i,a]}function W(t){return R(B(t))}function N(t){var e,a,i,n=t[0],o=t[1],r=t[2];return i=r/360*2*Math.PI,e=o*Math.cos(i),a=o*Math.sin(i),[n,e,a]}function E(t){return B(N(t))}function H(t){return W(N(t))}function j(t){return G[t]}function U(t){return i(j(t))}function q(t){return n(j(t))}function Y(t){return o(j(t))}function X(t){return s(j(t))}function K(t){return d(j(t))}function J(t){return u(j(t))}e.exports={rgb2hsl:i,rgb2hsv:n,rgb2hwb:o,rgb2cmyk:s,rgb2keyword:l,rgb2xyz:u,rgb2lab:d,rgb2lch:c,hsl2rgb:h,hsl2hsv:f,hsl2hwb:p,hsl2cmyk:m,hsl2keyword:v,hsv2rgb:x,hsv2hsl:y,hsv2hwb:k,hsv2cmyk:S,hsv2keyword:M,hwb2rgb:w,hwb2hsl:C,hwb2hsv:I,hwb2cmyk:D,hwb2keyword:A,cmyk2rgb:T,cmyk2hsl:P,cmyk2hsv:_,cmyk2hwb:F,cmyk2keyword:V,keyword2rgb:j,keyword2hsl:U,keyword2hsv:q,keyword2hwb:Y,keyword2cmyk:X,keyword2lab:K,keyword2xyz:J,xyz2rgb:R,xyz2lab:O,xyz2lch:L,lab2xyz:B,lab2rgb:W,lab2lch:z,lch2lab:N,lch2xyz:E,lch2rgb:H};var G={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Z={};for(var Q in G)Z[JSON.stringify(G[Q])]=Q},{}],5:[function(t,e,a){var i=t(4),n=function(){return new u};for(var o in i){n[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var r=/(\w+)2(\w+)/.exec(o),s=r[1],l=r[2];n[s]=n[s]||{},n[s][l]=n[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var a=i[t](e);if("string"==typeof a||void 0===a)return a;for(var n=0;n0&&(t[0].yLabel?a=t[0].yLabel:e.labels.length>0&&t[0].index');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o'),n[o]&&e.push(n[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s&&s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a=Math.PI?-1:g<-Math.PI?1:0);var p=g+f,m={x:Math.cos(g),y:Math.sin(g)},v={x:Math.cos(p),y:Math.sin(p)},b=g<=0&&0<=p||g<=2*Math.PI&&2*Math.PI<=p,x=g<=.5*Math.PI&&.5*Math.PI<=p||g<=2.5*Math.PI&&2.5*Math.PI<=p,y=g<=-Math.PI&&-Math.PI<=p||g<=Math.PI&&Math.PI<=p,k=g<=.5*-Math.PI&&.5*-Math.PI<=p||g<=1.5*Math.PI&&1.5*Math.PI<=p,S=h/100,M={x:y?-1:Math.min(m.x*(m.x<0?1:S),v.x*(v.x<0?1:S)),y:k?-1:Math.min(m.y*(m.y<0?1:S),v.y*(v.y<0?1:S))},w={x:b?1:Math.max(m.x*(m.x>0?1:S),v.x*(v.x>0?1:S)),y:x?1:Math.max(m.y*(m.y>0?1:S),v.y*(v.y>0?1:S))},C={width:.5*(w.x-M.x),height:.5*(w.y-M.y)};u=Math.min(s/C.width,l/C.height),d={x:(w.x+M.x)*-.5,y:(w.y+M.y)*-.5}}i.borderWidth=a.getMaxBorderWidth(c.data),i.outerRadius=Math.max((u-i.borderWidth)/2,0),i.innerRadius=Math.max(h?i.outerRadius/100*h:0,0),i.radiusLength=(i.outerRadius-i.innerRadius)/i.getVisibleDatasetCount(),i.offsetX=d.x*i.outerRadius,i.offsetY=d.y*i.outerRadius,c.total=a.calculateTotal(),a.outerRadius=i.outerRadius-i.radiusLength*a.getRingIndex(a.index),a.innerRadius=Math.max(a.outerRadius-i.radiusLength,0),e.each(c.data,function(e,i){a.updateElement(e,i,t)})},updateElement:function(t,a,i){var n=this,o=n.chart,r=o.chartArea,s=o.options,l=s.animation,u=(r.left+r.right)/2,d=(r.top+r.bottom)/2,c=s.rotation,h=s.rotation,f=n.getDataset(),g=i&&l.animateRotate?0:t.hidden?0:n.calculateCircumference(f.data[a])*(s.circumference/(2*Math.PI)),p=i&&l.animateScale?0:n.innerRadius,m=i&&l.animateScale?0:n.outerRadius,v=e.getValueAtIndexOrDefault;e.extend(t,{_datasetIndex:n.index,_index:a,_model:{x:u+o.offsetX,y:d+o.offsetY,startAngle:c,endAngle:h,circumference:g,outerRadius:m,innerRadius:p,label:v(f.label,a,o.data.labels[a])}});var b=t._model;this.removeHoverStyle(t),i&&l.animateRotate||(0===a?b.startAngle=s.rotation:b.startAngle=n.getMeta().data[a-1]._model.endAngle,b.endAngle=b.startAngle+b.circumference),t.pivot()},removeHoverStyle:function(e){t.DatasetController.prototype.removeHoverStyle.call(this,e,this.chart.options.elements.arc)},calculateTotal:function(){var t,a=this.getDataset(),i=this.getMeta(),n=0;return e.each(i.data,function(e,i){t=a.data[i],isNaN(t)||e.hidden||(n+=Math.abs(t))}),n},calculateCircumference:function(t){var e=this.getMeta().total;return e>0&&!isNaN(t)?2*Math.PI*(t/e):0},getMaxBorderWidth:function(t){for(var e,a,i=0,n=this.index,o=t.length,r=0;ri?e:i,i=a>i?a:i;return i}})}},{}],18:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return a.getValueOrDefault(t.showLine,e.showLines)}var a=t.helpers;t.defaults.line={showLines:!0,spanGaps:!1,hover:{mode:"label"},scales:{xAxes:[{type:"category",id:"x-axis-0"}],yAxes:[{type:"linear",id:"y-axis-0"}]}},t.controllers.line=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,update:function(t){var i,n,o,r=this,s=r.getMeta(),l=s.dataset,u=s.data||[],d=r.chart.options,c=d.elements.line,h=r.getScaleForId(s.yAxisID),f=r.getDataset(),g=e(f,d);for(g&&(o=l.custom||{},void 0!==f.tension&&void 0===f.lineTension&&(f.lineTension=f.tension),l._scale=h,l._datasetIndex=r.index,l._children=u,l._model={spanGaps:f.spanGaps?f.spanGaps:d.spanGaps,tension:o.tension?o.tension:a.getValueOrDefault(f.lineTension,c.tension),backgroundColor:o.backgroundColor?o.backgroundColor:f.backgroundColor||c.backgroundColor,borderWidth:o.borderWidth?o.borderWidth:f.borderWidth||c.borderWidth,borderColor:o.borderColor?o.borderColor:f.borderColor||c.borderColor,borderCapStyle:o.borderCapStyle?o.borderCapStyle:f.borderCapStyle||c.borderCapStyle,borderDash:o.borderDash?o.borderDash:f.borderDash||c.borderDash,borderDashOffset:o.borderDashOffset?o.borderDashOffset:f.borderDashOffset||c.borderDashOffset,borderJoinStyle:o.borderJoinStyle?o.borderJoinStyle:f.borderJoinStyle||c.borderJoinStyle,fill:o.fill?o.fill:void 0!==f.fill?f.fill:c.fill,steppedLine:o.steppedLine?o.steppedLine:a.getValueOrDefault(f.steppedLine,c.stepped),cubicInterpolationMode:o.cubicInterpolationMode?o.cubicInterpolationMode:a.getValueOrDefault(f.cubicInterpolationMode,c.cubicInterpolationMode),scaleTop:h.top,scaleBottom:h.bottom,scaleZero:h.getBasePixel()},l.pivot()),i=0,n=u.length;i');var a=t.data,i=a.datasets,n=a.labels;if(i.length)for(var o=0;o'),n[o]&&e.push(n[o]),e.push("");return e.push(""),e.join("")},legend:{labels:{generateLabels:function(t){var a=t.data;return a.labels.length&&a.datasets.length?a.labels.map(function(i,n){var o=t.getDatasetMeta(0),r=a.datasets[0],s=o.data[n],l=s.custom||{},u=e.getValueAtIndexOrDefault,d=t.options.elements.arc,c=l.backgroundColor?l.backgroundColor:u(r.backgroundColor,n,d.backgroundColor),h=l.borderColor?l.borderColor:u(r.borderColor,n,d.borderColor),f=l.borderWidth?l.borderWidth:u(r.borderWidth,n,d.borderWidth);return{text:i,fillStyle:c,strokeStyle:h,lineWidth:f,hidden:isNaN(r.data[n])||o.data[n].hidden,index:n}}):[]}},onClick:function(t,e){var a,i,n,o=e.index,r=this.chart;for(a=0,i=(r.data.datasets||[]).length;a0&&!isNaN(t)?2*Math.PI/e:0}})}},{}],20:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.radar={aspectRatio:1,scale:{type:"radialLinear"},elements:{line:{tension:0}}},t.controllers.radar=t.DatasetController.extend({datasetElementType:t.elements.Line,dataElementType:t.elements.Point,linkScales:e.noop,update:function(t){var a=this,i=a.getMeta(),n=i.dataset,o=i.data,r=n.custom||{},s=a.getDataset(),l=a.chart.options.elements.line,u=a.chart.scale;void 0!==s.tension&&void 0===s.lineTension&&(s.lineTension=s.tension),e.extend(i.dataset,{_datasetIndex:a.index,_children:o,_loop:!0,_model:{tension:r.tension?r.tension:e.getValueOrDefault(s.lineTension,l.tension),backgroundColor:r.backgroundColor?r.backgroundColor:s.backgroundColor||l.backgroundColor,borderWidth:r.borderWidth?r.borderWidth:s.borderWidth||l.borderWidth,borderColor:r.borderColor?r.borderColor:s.borderColor||l.borderColor,fill:r.fill?r.fill:void 0!==s.fill?s.fill:l.fill,borderCapStyle:r.borderCapStyle?r.borderCapStyle:s.borderCapStyle||l.borderCapStyle,borderDash:r.borderDash?r.borderDash:s.borderDash||l.borderDash,borderDashOffset:r.borderDashOffset?r.borderDashOffset:s.borderDashOffset||l.borderDashOffset,borderJoinStyle:r.borderJoinStyle?r.borderJoinStyle:s.borderJoinStyle||l.borderJoinStyle,scaleTop:u.top,scaleBottom:u.bottom,scaleZero:u.getBasePosition()}}),i.dataset.pivot(),e.each(o,function(e,i){a.updateElement(e,i,t)},a),a.updateBezierControlPoints()},updateElement:function(t,a,i){var n=this,o=t.custom||{},r=n.getDataset(),s=n.chart.scale,l=n.chart.options.elements.point,u=s.getPointPositionForValue(a,r.data[a]);e.extend(t,{_datasetIndex:n.index,_index:a,_scale:s,_model:{x:i?s.xCenter:u.x,y:i?s.yCenter:u.y,tension:o.tension?o.tension:e.getValueOrDefault(r.lineTension,n.chart.options.elements.line.tension),radius:o.radius?o.radius:e.getValueAtIndexOrDefault(r.pointRadius,a,l.radius),backgroundColor:o.backgroundColor?o.backgroundColor:e.getValueAtIndexOrDefault(r.pointBackgroundColor,a,l.backgroundColor),borderColor:o.borderColor?o.borderColor:e.getValueAtIndexOrDefault(r.pointBorderColor,a,l.borderColor),borderWidth:o.borderWidth?o.borderWidth:e.getValueAtIndexOrDefault(r.pointBorderWidth,a,l.borderWidth),pointStyle:o.pointStyle?o.pointStyle:e.getValueAtIndexOrDefault(r.pointStyle,a,l.pointStyle),hitRadius:o.hitRadius?o.hitRadius:e.getValueAtIndexOrDefault(r.hitRadius,a,l.hitRadius)}}),t._model.skip=o.skip?o.skip:isNaN(t._model.x)||isNaN(t._model.y)},updateBezierControlPoints:function(){var t=this.chart.chartArea,a=this.getMeta();e.each(a.data,function(i,n){var o=i._model,r=e.splineCurve(e.previousItem(a.data,n,!0)._model,o,e.nextItem(a.data,n,!0)._model,o.tension);o.controlPointPreviousX=Math.max(Math.min(r.previous.x,t.right),t.left),o.controlPointPreviousY=Math.max(Math.min(r.previous.y,t.bottom),t.top),o.controlPointNextX=Math.max(Math.min(r.next.x,t.right),t.left),o.controlPointNextY=Math.max(Math.min(r.next.y,t.bottom),t.top),i.pivot()})},draw:function(t){var a=this.getMeta(),i=t||1;e.each(a.data,function(t){t.transition(i)}),a.dataset.transition(i).draw(),e.each(a.data,function(t){t.draw()})},setHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model;o.radius=i.hoverRadius?i.hoverRadius:e.getValueAtIndexOrDefault(a.pointHoverRadius,n,this.chart.options.elements.point.hoverRadius),o.backgroundColor=i.hoverBackgroundColor?i.hoverBackgroundColor:e.getValueAtIndexOrDefault(a.pointHoverBackgroundColor,n,e.getHoverColor(o.backgroundColor)),o.borderColor=i.hoverBorderColor?i.hoverBorderColor:e.getValueAtIndexOrDefault(a.pointHoverBorderColor,n,e.getHoverColor(o.borderColor)),o.borderWidth=i.hoverBorderWidth?i.hoverBorderWidth:e.getValueAtIndexOrDefault(a.pointHoverBorderWidth,n,o.borderWidth)},removeHoverStyle:function(t){var a=this.chart.data.datasets[t._datasetIndex],i=t.custom||{},n=t._index,o=t._model,r=this.chart.options.elements.point;o.radius=i.radius?i.radius:e.getValueAtIndexOrDefault(a.radius,n,r.radius),o.backgroundColor=i.backgroundColor?i.backgroundColor:e.getValueAtIndexOrDefault(a.pointBackgroundColor,n,r.backgroundColor),o.borderColor=i.borderColor?i.borderColor:e.getValueAtIndexOrDefault(a.pointBorderColor,n,r.borderColor),o.borderWidth=i.borderWidth?i.borderWidth:e.getValueAtIndexOrDefault(a.pointBorderWidth,n,r.borderWidth)}})}},{}],21:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.animation={duration:1e3,easing:"easeOutQuart",onProgress:e.noop,onComplete:e.noop},t.Animation=t.Element.extend({currentStep:null,numSteps:60,easing:"",render:null,onAnimationProgress:null,onAnimationComplete:null}),t.animationService={frameDuration:17,animations:[],dropFrames:0,request:null,addAnimation:function(t,e,a,i){var n=this;i||(t.animating=!0);for(var o=0;o1&&(a=Math.floor(t.dropFrames),t.dropFrames=t.dropFrames%1);for(var i=0;it.animations[i].animationObject.numSteps&&(t.animations[i].animationObject.currentStep=t.animations[i].animationObject.numSteps),t.animations[i].animationObject.render(t.animations[i].chartInstance,t.animations[i].animationObject),t.animations[i].animationObject.onAnimationProgress&&t.animations[i].animationObject.onAnimationProgress.call&&t.animations[i].animationObject.onAnimationProgress.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].animationObject.currentStep===t.animations[i].animationObject.numSteps?(t.animations[i].animationObject.onAnimationComplete&&t.animations[i].animationObject.onAnimationComplete.call&&t.animations[i].animationObject.onAnimationComplete.call(t.animations[i].chartInstance,t.animations[i]),t.animations[i].chartInstance.animating=!1,t.animations.splice(i,1)):++i;var n=Date.now(),o=(n-e)/t.frameDuration;t.dropFrames+=o,t.animations.length>0&&t.requestAnimationFrame()}}}},{}],22:[function(t,e,a){"use strict";e.exports=function(t){var e=t.canvasHelpers={};e.drawPoint=function(e,a,i,n,o){var r,s,l,u,d,c;if("object"==typeof a&&(r=a.toString(),"[object HTMLImageElement]"===r||"[object HTMLCanvasElement]"===r))return void e.drawImage(a,n-a.width/2,o-a.height/2);if(!(isNaN(i)||i<=0)){switch(a){default:e.beginPath(),e.arc(n,o,i,0,2*Math.PI),e.closePath(),e.fill();break;case"triangle":e.beginPath(),s=3*i/Math.sqrt(3),d=s*Math.sqrt(3)/2,e.moveTo(n-s/2,o+d/3),e.lineTo(n+s/2,o+d/3),e.lineTo(n,o-2*d/3),e.closePath(),e.fill();break;case"rect":c=1/Math.SQRT2*i,e.beginPath(),e.fillRect(n-c,o-c,2*c,2*c),e.strokeRect(n-c,o-c,2*c,2*c);break;case"rectRounded":var h=i/Math.SQRT2,f=n-h,g=o-h,p=Math.SQRT2*i;t.helpers.drawRoundedRectangle(e,f,g,p,p,i/2),e.fill();break;case"rectRot":c=1/Math.SQRT2*i,e.beginPath(),e.moveTo(n-c,o),e.lineTo(n,o+c),e.lineTo(n+c,o),e.lineTo(n,o-c),e.closePath(),e.fill();break;case"cross":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"crossRot":e.beginPath(),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"star":e.beginPath(),e.moveTo(n,o+i),e.lineTo(n,o-i),e.moveTo(n-i,o),e.lineTo(n+i,o),l=Math.cos(Math.PI/4)*i,u=Math.sin(Math.PI/4)*i,e.moveTo(n-l,o-u),e.lineTo(n+l,o+u),e.moveTo(n-l,o+u),e.lineTo(n+l,o-u),e.closePath();break;case"line":e.beginPath(),e.moveTo(n-i,o),e.lineTo(n+i,o),e.closePath();break;case"dash":e.beginPath(),e.moveTo(n,o),e.lineTo(n+i,o),e.closePath()}e.stroke()}},e.clipArea=function(t,e){t.save(),t.beginPath(),t.rect(e.left,e.top,e.right-e.left,e.bottom-e.top),t.clip()},e.unclipArea=function(t){t.restore()}}},{}],23:[function(t,e,a){"use strict";e.exports=function(t){function e(e){e=e||{};var a=e.data=e.data||{};return a.datasets=a.datasets||[],a.labels=a.labels||[],e.options=i.configMerge(t.defaults.global,t.defaults[e.type],e.options||{}),e}function a(t){var e=t.options;e.scale?t.scale.options=e.scale:e.scales&&e.scales.xAxes.concat(e.scales.yAxes).forEach(function(e){t.scales[e.id].options=e}),t.tooltip._options=e.tooltips}var i=t.helpers,n=t.plugins,o=t.platform;t.types={},t.instances={},t.controllers={},t.Controller=function(a,n,r){var s=this;n=e(n);var l=o.acquireContext(a,n),u=l&&l.canvas,d=u&&u.height,c=u&&u.width;return r.ctx=l,r.canvas=u,r.config=n,r.width=c,r.height=d,r.aspectRatio=d?c/d:null,s.id=i.uid(),s.chart=r,s.config=n,s.options=n.options,s._bufferedRender=!1,t.instances[s.id]=s,Object.defineProperty(s,"data",{get:function(){return s.config.data}}),l&&u?(s.initialize(),s.update(),s):(console.error("Failed to create chart: can't acquire context from the given item"),s)},i.extend(t.Controller.prototype,{initialize:function(){var t=this;return n.notify(t,"beforeInit"),i.retinaScale(t.chart),t.bindEvents(),t.options.responsive&&t.resize(!0),t.ensureScalesHaveIDs(),t.buildScales(),t.initToolTip(),n.notify(t,"afterInit"),t},clear:function(){return i.clear(this.chart),this},stop:function(){return t.animationService.cancelAnimation(this),this},resize:function(t){var e=this,a=e.chart,o=e.options,r=a.canvas,s=o.maintainAspectRatio&&a.aspectRatio||null,l=Math.floor(i.getMaximumWidth(r)),u=Math.floor(s?l/s:i.getMaximumHeight(r));if((a.width!==l||a.height!==u)&&(r.width=a.width=l,r.height=a.height=u,r.style.width=l+"px",r.style.height=u+"px",i.retinaScale(a),!t)){var d={width:l,height:u};n.notify(e,"resize",[d]),e.options.onResize&&e.options.onResize(e,d),e.stop(),e.update(e.options.responsiveAnimationDuration)}},ensureScalesHaveIDs:function(){var t=this.options,e=t.scales||{},a=t.scale;i.each(e.xAxes,function(t,e){t.id=t.id||"x-axis-"+e}),i.each(e.yAxes,function(t,e){t.id=t.id||"y-axis-"+e}),a&&(a.id=a.id||"scale")},buildScales:function(){var e=this,a=e.options,n=e.scales={},o=[];a.scales&&(o=o.concat((a.scales.xAxes||[]).map(function(t){return{options:t,dtype:"category"}}),(a.scales.yAxes||[]).map(function(t){return{options:t,dtype:"linear"}}))),a.scale&&o.push({options:a.scale,dtype:"radialLinear",isDefault:!0}),i.each(o,function(a){var o=a.options,r=i.getValueOrDefault(o.type,a.dtype),s=t.scaleService.getScaleConstructor(r);if(s){var l=new s({id:o.id,options:o,ctx:e.chart.ctx,chart:e});n[l.id]=l,a.isDefault&&(e.scale=l)}}),t.scaleService.addScalesToLayout(this)},buildOrUpdateControllers:function(){var e=this,a=[],n=[];if(i.each(e.data.datasets,function(i,o){var r=e.getDatasetMeta(o);r.type||(r.type=i.type||e.config.type),a.push(r.type),r.controller?r.controller.updateIndex(o):(r.controller=new t.controllers[r.type](e,o),n.push(r.controller))},e),a.length>1)for(var o=1;o0||(n.forEach(function(e){delete t[e]}),delete t._chartjs)}}var i=t.helpers,n=["push","pop","shift","splice","unshift"];t.DatasetController=function(t,e){this.initialize(t,e)},i.extend(t.DatasetController.prototype,{datasetElementType:null,dataElementType:null,initialize:function(t,e){var a=this;a.chart=t,a.index=e,a.linkScales(),a.addElements()},updateIndex:function(t){this.index=t},linkScales:function(){var t=this,e=t.getMeta(),a=t.getDataset();null===e.xAxisID&&(e.xAxisID=a.xAxisID||t.chart.options.scales.xAxes[0].id),null===e.yAxisID&&(e.yAxisID=a.yAxisID||t.chart.options.scales.yAxes[0].id)},getDataset:function(){return this.chart.data.datasets[this.index]},getMeta:function(){return this.chart.getDatasetMeta(this.index)},getScaleForId:function(t){return this.chart.scales[t]},reset:function(){this.update(!0)},destroy:function(){this._data&&a(this._data,this)},createMetaDataset:function(){var t=this,e=t.datasetElementType;return e&&new e({_chart:t.chart.chart,_datasetIndex:t.index})},createMetaData:function(t){var e=this,a=e.dataElementType;return a&&new a({_chart:e.chart.chart,_datasetIndex:e.index,_index:t})},addElements:function(){var t,e,a=this,i=a.getMeta(),n=a.getDataset().data||[],o=i.data;for(t=0,e=n.length;ti&&t.insertElements(i,n-i)},insertElements:function(t,e){for(var a=0;a=0;n--)e.call(a,t[n],n);else for(n=0;n=i[a].length||!i[a][n].type?i[a].push(o.configMerge(s,e)):e.type&&e.type!==i[a][n].type?i[a][n]=o.configMerge(i[a][n],s,e):i[a][n]=o.configMerge(i[a][n],e)}):(i[a]=[],o.each(e,function(e){var n=o.getValueOrDefault(e.type,"xAxes"===a?"category":"linear");i[a].push(o.configMerge(t.scaleService.getScaleDefaults(n),e))})):i.hasOwnProperty(a)&&"object"==typeof i[a]&&null!==i[a]&&"object"==typeof e?i[a]=o.configMerge(i[a],e):i[a]=e}),i},o.getValueAtIndexOrDefault=function(t,e,a){return void 0===t||null===t?a:o.isArray(t)?e=0;i--){var n=t[i];if(e(n))return n}},o.inherits=function(t){var e=this,a=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return e.apply(this,arguments)},i=function(){this.constructor=a};return i.prototype=e.prototype,a.prototype=new i,a.extend=o.inherits,t&&o.extend(a.prototype,t),a.__super__=e.prototype,a},o.noop=function(){},o.uid=function(){var t=0;return function(){return t++}}(),o.isNumber=function(t){return!isNaN(parseFloat(t))&&isFinite(t)},o.almostEquals=function(t,e,a){return Math.abs(t-e)t},o.max=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.max(t,e)},Number.NEGATIVE_INFINITY)},o.min=function(t){return t.reduce(function(t,e){return isNaN(e)?t:Math.min(t,e)},Number.POSITIVE_INFINITY)},o.sign=Math.sign?function(t){return Math.sign(t)}:function(t){return t=+t,0===t||isNaN(t)?t:t>0?1:-1},o.log10=Math.log10?function(t){return Math.log10(t)}:function(t){return Math.log(t)/Math.LN10},o.toRadians=function(t){return t*(Math.PI/180)},o.toDegrees=function(t){return t*(180/Math.PI)},o.getAngleFromPoint=function(t,e){var a=e.x-t.x,i=e.y-t.y,n=Math.sqrt(a*a+i*i),o=Math.atan2(i,a);return o<-.5*Math.PI&&(o+=2*Math.PI),{angle:o,distance:n}},o.distanceBetweenPoints=function(t,e){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))},o.aliasPixel=function(t){return t%2===0?0:.5},o.splineCurve=function(t,e,a,i){var n=t.skip?e:t,o=e,r=a.skip?e:a,s=Math.sqrt(Math.pow(o.x-n.x,2)+Math.pow(o.y-n.y,2)),l=Math.sqrt(Math.pow(r.x-o.x,2)+Math.pow(r.y-o.y,2)),u=s/(s+l),d=l/(s+l);u=isNaN(u)?0:u,d=isNaN(d)?0:d;var c=i*u,h=i*d;return{previous:{x:o.x-c*(r.x-n.x),y:o.y-c*(r.y-n.y)},next:{x:o.x+h*(r.x-n.x),y:o.y+h*(r.y-n.y)}}},o.EPSILON=Number.EPSILON||1e-14,o.splineCurveMonotone=function(t){var e,a,i,n,r=(t||[]).map(function(t){return{model:t._model,deltaK:0,mK:0}}),s=r.length;for(e=0;e0?r[e-1]:null,n=e0?r[e-1]:null,n=e=t.length-1?t[0]:t[e+1]:e>=t.length-1?t[t.length-1]:t[e+1]},o.previousItem=function(t,e,a){return a?e<=0?t[t.length-1]:t[e-1]:e<=0?t[0]:t[e-1]},o.niceNum=function(t,e){var a,i=Math.floor(o.log10(t)),n=t/Math.pow(10,i);return a=e?n<1.5?1:n<3?2:n<7?5:10:n<=1?1:n<=2?2:n<=5?5:10,a*Math.pow(10,i)};var r=o.easingEffects={linear:function(t){return t},easeInQuad:function(t){return t*t},easeOutQuad:function(t){return-1*t*(t-2)},easeInOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},easeInCubic:function(t){return t*t*t},easeOutCubic:function(t){return 1*((t=t/1-1)*t*t+1)},easeInOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},easeInQuart:function(t){return t*t*t*t},easeOutQuart:function(t){return-1*((t=t/1-1)*t*t*t-1)},easeInOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},easeInQuint:function(t){return 1*(t/=1)*t*t*t*t},easeOutQuint:function(t){return 1*((t=t/1-1)*t*t*t*t+1)},easeInOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},easeInSine:function(t){return-1*Math.cos(t/1*(Math.PI/2))+1},easeOutSine:function(t){return 1*Math.sin(t/1*(Math.PI/2))},easeInOutSine:function(t){return-.5*(Math.cos(Math.PI*t/1)-1)},easeInExpo:function(t){return 0===t?1:1*Math.pow(2,10*(t/1-1))},easeOutExpo:function(t){return 1===t?1:1*(-Math.pow(2,-10*t/1)+1)},easeInOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},easeInCirc:function(t){return t>=1?t:-1*(Math.sqrt(1-(t/=1)*t)-1)},easeOutCirc:function(t){return 1*Math.sqrt(1-(t=t/1-1)*t)},easeInOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},easeInElastic:function(t){var e=1.70158,a=0,i=1;return 0===t?0:1===(t/=1)?1:(a||(a=.3),i0?(a=l[0].clientX,i=l[0].clientY):(a=n.clientX,i=n.clientY);var u=parseFloat(o.getStyle(r,"padding-left")),d=parseFloat(o.getStyle(r,"padding-top")),c=parseFloat(o.getStyle(r,"padding-right")),h=parseFloat(o.getStyle(r,"padding-bottom")),f=s.right-s.left-u-c,g=s.bottom-s.top-d-h;return a=Math.round((a-s.left-u)/f*r.width/e.currentDevicePixelRatio),i=Math.round((i-s.top-d)/g*r.height/e.currentDevicePixelRatio),{x:a,y:i}},o.addEvent=function(t,e,a){t.addEventListener?t.addEventListener(e,a):t.attachEvent?t.attachEvent("on"+e,a):t["on"+e]=a},o.removeEvent=function(t,e,a){t.removeEventListener?t.removeEventListener(e,a,!1):t.detachEvent?t.detachEvent("on"+e,a):t["on"+e]=o.noop},o.getConstraintWidth=function(t){return n(t,"max-width","clientWidth")},o.getConstraintHeight=function(t){return n(t,"max-height","clientHeight")},o.getMaximumWidth=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-left"),10),i=parseInt(o.getStyle(e,"padding-right"),10),n=e.clientWidth-a-i,r=o.getConstraintWidth(t);return isNaN(r)?n:Math.min(n,r)},o.getMaximumHeight=function(t){var e=t.parentNode,a=parseInt(o.getStyle(e,"padding-top"),10),i=parseInt(o.getStyle(e,"padding-bottom"),10),n=e.clientHeight-a-i,r=o.getConstraintHeight(t);return isNaN(r)?n:Math.min(n,r)},o.getStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:document.defaultView.getComputedStyle(t,null).getPropertyValue(e)},o.retinaScale=function(t){var e=t.currentDevicePixelRatio=window.devicePixelRatio||1;if(1!==e){var a=t.canvas,i=t.height,n=t.width;a.height=i*e,a.width=n*e,t.ctx.scale(e,e),a.style.height=i+"px",a.style.width=n+"px"}},o.clear=function(t){t.ctx.clearRect(0,0,t.width,t.height)},o.fontString=function(t,e,a){return e+" "+t+"px "+a},o.longestText=function(t,e,a,i){i=i||{};var n=i.data=i.data||{},r=i.garbageCollect=i.garbageCollect||[];i.font!==e&&(n=i.data={},r=i.garbageCollect=[],i.font=e),t.font=e;var s=0;o.each(a,function(e){void 0!==e&&null!==e&&o.isArray(e)!==!0?s=o.measureText(t,n,r,s,e):o.isArray(e)&&o.each(e,function(e){void 0===e||null===e||o.isArray(e)||(s=o.measureText(t,n,r,s,e))})});var l=r.length/2;if(l>a.length){for(var u=0;ui&&(i=o),i},o.numberOfLabelLines=function(t){var e=1;return o.each(t,function(t){o.isArray(t)&&t.length>e&&(e=t.length)}),e},o.drawRoundedRectangle=function(t,e,a,i,n,o){t.beginPath(),t.moveTo(e+o,a),t.lineTo(e+i-o,a),t.quadraticCurveTo(e+i,a,e+i,a+o),t.lineTo(e+i,a+n-o),t.quadraticCurveTo(e+i,a+n,e+i-o,a+n),t.lineTo(e+o,a+n),t.quadraticCurveTo(e,a+n,e,a+n-o),t.lineTo(e,a+o),t.quadraticCurveTo(e,a,e+o,a),t.closePath()},o.color=function(e){return i?i(e instanceof CanvasGradient?t.defaults.global.defaultColor:e):(console.error("Color.js not found!"),e)},o.isArray=Array.isArray?function(t){return Array.isArray(t)}:function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.arrayEquals=function(t,e){var a,i,n,r;if(!t||!e||t.length!==e.length)return!1;for(a=0,i=t.length;a0&&(s=t.getDatasetMeta(s[0]._datasetIndex).data),s},"x-axis":function(t,e){return o(t,e,!0)},point:function(t,a){var n=e(a,t.chart);return i(t,n)},nearest:function(t,a,i){var o=e(a,t.chart),r=n(t,o,i.intersect);return r.length>1&&r.sort(function(t,e){var a=t.getArea(),i=e.getArea(),n=a-i;return 0===n&&(n=t._datasetIndex-e._datasetIndex),n}),r.slice(0,1)},x:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inXRange(o.x)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r},y:function(t,i,n){var o=e(i,t.chart),r=[],s=!1;return a(t,function(t){t.inYRange(o.y)&&r.push(t),t.inRange(o.x,o.y)&&(s=!0)}),n.intersect&&!s&&(r=[]),r}}}}},{}],28:[function(t,e,a){"use strict";e.exports=function(){var t=function(e,a){return this.controller=new t.Controller(e,a,this),this.controller};return t.defaults={global:{responsive:!0,responsiveAnimationDuration:0,maintainAspectRatio:!0,events:["mousemove","mouseout","click","touchstart","touchmove"],hover:{onHover:null,mode:"nearest",intersect:!0,animationDuration:400},onClick:null,defaultColor:"rgba(0,0,0,0.1)",defaultFontColor:"#666",defaultFontFamily:"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",defaultFontSize:12,defaultFontStyle:"normal",showLines:!0,elements:{},legendCallback:function(t){var e=[];e.push('
    ');for(var a=0;a'),t.data.datasets[a].label&&e.push(t.data.datasets[a].label),e.push("");return e.push("
"),e.join("")}}},t.Chart=t,t}},{}],29:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.layoutService={defaults:{},addBox:function(t,e){t.boxes||(t.boxes=[]),t.boxes.push(e)},removeBox:function(t,e){t.boxes&&t.boxes.splice(t.boxes.indexOf(e),1)},update:function(t,a,i){function n(t){var e,a=t.isHorizontal();a?(e=t.update(t.options.fullWidth?x:C,w),I-=e.height):(e=t.update(M,S),C-=e.width),D.push({horizontal:a,minSize:e,box:t})}function o(t){var a=e.findNextWhere(D,function(e){return e.box===t});if(a)if(t.isHorizontal()){var i={left:Math.max(F,A),right:Math.max(V,T),top:0,bottom:0};t.update(t.options.fullWidth?x:C,y/2,i)}else t.update(a.minSize.width,I)}function r(t){var a=e.findNextWhere(D,function(e){return e.box===t}),i={left:0,right:0,top:R,bottom:O};a&&t.update(a.minSize.width,I,i)}function s(t){t.isHorizontal()?(t.left=t.options.fullWidth?d:F,t.right=t.options.fullWidth?a-c:F+C,t.top=E,t.bottom=E+t.height,E=t.bottom):(t.left=N,t.right=N+t.width,t.top=R,t.bottom=R+I,N=t.right)}if(t){var l=t.options.layout,u=l?l.padding:null,d=0,c=0,h=0,f=0;isNaN(u)?(d=u.left||0,c=u.right||0,h=u.top||0,f=u.bottom||0):(d=u,c=u,h=u,f=u);var g=e.where(t.boxes,function(t){return"left"===t.options.position}),p=e.where(t.boxes,function(t){return"right"===t.options.position}),m=e.where(t.boxes,function(t){return"top"===t.options.position}),v=e.where(t.boxes,function(t){return"bottom"===t.options.position}),b=e.where(t.boxes,function(t){return"chartArea"===t.options.position});m.sort(function(t,e){return(e.options.fullWidth?1:0)-(t.options.fullWidth?1:0)}),v.sort(function(t,e){return(t.options.fullWidth?1:0)-(e.options.fullWidth?1:0)});var x=a-d-c,y=i-h-f,k=x/2,S=y/2,M=(a-k)/(g.length+p.length),w=(i-S)/(m.length+v.length),C=x,I=y,D=[];e.each(g.concat(p,m,v),n);var A=0,T=0,P=0,_=0;e.each(m.concat(v),function(t){if(t.getPadding){var e=t.getPadding();A=Math.max(A,e.left),T=Math.max(T,e.right)}}),e.each(g.concat(p),function(t){if(t.getPadding){var e=t.getPadding();P=Math.max(P,e.top),_=Math.max(_,e.bottom)}});var F=d,V=c,R=h,O=f;e.each(g.concat(p),o),e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m.concat(v),o),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height}),e.each(g.concat(p),r),F=d,V=c,R=h,O=f,e.each(g,function(t){F+=t.width}),e.each(p,function(t){V+=t.width}),e.each(m,function(t){R+=t.height}),e.each(v,function(t){O+=t.height});var L=Math.max(A-F,0);F+=L,V+=Math.max(T-V,0);var B=Math.max(P-R,0);R+=B,O+=Math.max(_-O,0);var z=i-R-O,W=a-F-V;W===C&&z===I||(e.each(g,function(t){t.height=z}),e.each(p,function(t){t.height=z}),e.each(m,function(t){t.options.fullWidth||(t.width=W)}),e.each(v,function(t){t.options.fullWidth||(t.width=W)}),I=z,C=W);var N=d+L,E=h+B;e.each(g.concat(m),s),N+=C,E+=I,e.each(p,s),e.each(v,s),t.chartArea={left:F,top:R,right:F+C,bottom:R+I},e.each(b,function(e){e.left=t.chartArea.left,e.top=t.chartArea.top,e.right=t.chartArea.right,e.bottom=t.chartArea.bottom,e.update(C,I)})}}}}},{}],30:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){return t.usePointStyle?e*Math.SQRT2:t.boxWidth}function a(e,a){var i=new t.Legend({ctx:e.chart.ctx,options:a,chart:e});e.legend=i,t.layoutService.addBox(e,i)}var i=t.helpers,n=i.noop;t.defaults.global.legend={display:!0,position:"top",fullWidth:!0,reverse:!1,onClick:function(t,e){var a=e.datasetIndex,i=this.chart,n=i.getDatasetMeta(a);n.hidden=null===n.hidden?!i.data.datasets[a].hidden:null,i.update()},onHover:null,labels:{boxWidth:40,padding:10,generateLabels:function(t){var e=t.data;return i.isArray(e.datasets)?e.datasets.map(function(e,a){return{text:e.label,fillStyle:i.isArray(e.backgroundColor)?e.backgroundColor[0]:e.backgroundColor,hidden:!t.isDatasetVisible(a),lineCap:e.borderCapStyle,lineDash:e.borderDash,lineDashOffset:e.borderDashOffset,lineJoin:e.borderJoinStyle,lineWidth:e.borderWidth,strokeStyle:e.borderColor,pointStyle:e.pointStyle,datasetIndex:a}},this):[]}}},t.Legend=t.Element.extend({initialize:function(t){i.extend(this,t),this.legendHitBoxes=[],this.doughnutMode=!1},beforeUpdate:n,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:n,beforeSetDimensions:n,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:n,beforeBuildLabels:n,buildLabels:function(){var t=this,e=t.options.labels,a=e.generateLabels.call(t,t.chart);e.filter&&(a=a.filter(function(a){return e.filter(a,t.chart.data)})),t.options.reverse&&a.reverse(),t.legendItems=a},afterBuildLabels:n,beforeFit:n,fit:function(){var a=this,n=a.options,o=n.labels,r=n.display,s=a.ctx,l=t.defaults.global,u=i.getValueOrDefault,d=u(o.fontSize,l.defaultFontSize),c=u(o.fontStyle,l.defaultFontStyle),h=u(o.fontFamily,l.defaultFontFamily),f=i.fontString(d,c,h),g=a.legendHitBoxes=[],p=a.minSize,m=a.isHorizontal();if(m?(p.width=a.maxWidth,p.height=r?10:0):(p.width=r?10:0,p.height=a.maxHeight),r)if(s.font=f,m){var v=a.lineWidths=[0],b=a.legendItems.length?d+o.padding:0;s.textAlign="left",s.textBaseline="top",i.each(a.legendItems,function(t,i){var n=e(o,d),r=n+d/2+s.measureText(t.text).width;v[v.length-1]+r+o.padding>=a.width&&(b+=d+o.padding,v[v.length]=a.left),g[i]={left:0,top:0,width:r,height:d},v[v.length-1]+=r+o.padding}),p.height+=b}else{var x=o.padding,y=a.columnWidths=[],k=o.padding,S=0,M=0,w=d+x;i.each(a.legendItems,function(t,a){var i=e(o,d),n=i+d/2+s.measureText(t.text).width;M+w>p.height&&(k+=S+o.padding,y.push(S),S=0,M=0),S=Math.max(S,n),M+=w,g[a]={left:0,top:0,width:n,height:d}}),k+=S,y.push(S),p.width+=k}a.width=p.width,a.height=p.height},afterFit:n,isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},draw:function(){var a=this,n=a.options,o=n.labels,r=t.defaults.global,s=r.elements.line,l=a.width,u=a.lineWidths;if(n.display){var d,c=a.ctx,h=i.getValueOrDefault,f=h(o.fontColor,r.defaultFontColor),g=h(o.fontSize,r.defaultFontSize),p=h(o.fontStyle,r.defaultFontStyle),m=h(o.fontFamily,r.defaultFontFamily),v=i.fontString(g,p,m);c.textAlign="left",c.textBaseline="top",c.lineWidth=.5,c.strokeStyle=f,c.fillStyle=f,c.font=v;var b=e(o,g),x=a.legendHitBoxes,y=function(e,a,i){if(!(isNaN(b)||b<=0)){c.save(),c.fillStyle=h(i.fillStyle,r.defaultColor),c.lineCap=h(i.lineCap,s.borderCapStyle),c.lineDashOffset=h(i.lineDashOffset,s.borderDashOffset),c.lineJoin=h(i.lineJoin,s.borderJoinStyle),c.lineWidth=h(i.lineWidth,s.borderWidth),c.strokeStyle=h(i.strokeStyle,r.defaultColor);var o=0===h(i.lineWidth,s.borderWidth);if(c.setLineDash&&c.setLineDash(h(i.lineDash,s.borderDash)),n.labels&&n.labels.usePointStyle){var l=g*Math.SQRT2/2,u=l/Math.SQRT2,d=e+u,f=a+u;t.canvasHelpers.drawPoint(c,i.pointStyle,l,d,f)}else o||c.strokeRect(e,a,b,g),c.fillRect(e,a,b,g);c.restore()}},k=function(t,e,a,i){c.fillText(a.text,b+g/2+t,e),a.hidden&&(c.beginPath(),c.lineWidth=2,c.moveTo(b+g/2+t,e+g/2),c.lineTo(b+g/2+t+i,e+g/2),c.stroke())},S=a.isHorizontal();d=S?{x:a.left+(l-u[0])/2,y:a.top+o.padding,line:0}:{x:a.left+o.padding,y:a.top+o.padding,line:0};var M=g+o.padding;i.each(a.legendItems,function(t,e){var i=c.measureText(t.text).width,n=b+g/2+i,r=d.x,s=d.y;S?r+n>=l&&(s=d.y+=M,d.line++,r=d.x=a.left+(l-u[d.line])/2):s+M>a.bottom&&(r=d.x=r+a.columnWidths[d.line]+o.padding,s=d.y=a.top+o.padding,d.line++),y(r,s,t),x[e].left=r,x[e].top=s,k(r,s,t,i),S?d.x+=n+o.padding:d.y+=M})}},handleEvent:function(t){var e=this,a=e.options,i="mouseup"===t.type?"click":t.type,n=!1;if("mousemove"===i){if(!a.onHover)return}else{if("click"!==i)return;if(!a.onClick)return}var o=t.x,r=t.y;if(o>=e.left&&o<=e.right&&r>=e.top&&r<=e.bottom)for(var s=e.legendHitBoxes,l=0;l=u.left&&o<=u.left+u.width&&r>=u.top&&r<=u.top+u.height){if("click"===i){a.onClick.call(e,t.native,e.legendItems[l]),n=!0;break}if("mousemove"===i){a.onHover.call(e,t.native,e.legendItems[l]),n=!0;break}}}return n}}),t.plugins.register({beforeInit:function(t){var e=t.options.legend;e&&a(t,e)},beforeUpdate:function(e){var n=e.options.legend;n?(n=i.configMerge(t.defaults.global.legend,n),e.legend?e.legend.options=n:a(e,n)):(t.layoutService.removeBox(e,e.legend),delete e.legend)},afterEvent:function(t,e){var a=t.legend;a&&a.handleEvent(e)}})}},{}],31:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers;t.defaults.global.plugins={},t.plugins={_plugins:[],_cacheId:0,register:function(t){var e=this._plugins;[].concat(t).forEach(function(t){e.indexOf(t)===-1&&e.push(t)}),this._cacheId++},unregister:function(t){var e=this._plugins;[].concat(t).forEach(function(t){var a=e.indexOf(t);a!==-1&&e.splice(a,1)}),this._cacheId++},clear:function(){this._plugins=[],this._cacheId++},count:function(){return this._plugins.length; +},getAll:function(){return this._plugins},notify:function(t,e,a){var i,n,o,r,s,l=this.descriptors(t),u=l.length;for(i=0;ic&&rt.maxHeight){r--;break}r++,d=s*u}t.labelRotation=r},afterCalculateTickRotation:function(){i.callCallback(this.options.afterCalculateTickRotation,[this])},beforeFit:function(){i.callCallback(this.options.beforeFit,[this])},fit:function(){var t=this,n=t.minSize={width:0,height:0},o=t.options,r=o.ticks,s=o.scaleLabel,l=o.gridLines,u=o.display,d=t.isHorizontal(),c=a(r),h=1.5*a(s).size,f=o.gridLines.tickMarkLength;if(d?n.width=t.isFullWidth()?t.maxWidth-t.margins.left-t.margins.right:t.maxWidth:n.width=u&&l.drawTicks?f:0,d?n.height=u&&l.drawTicks?f:0:n.height=t.maxHeight,s.display&&u&&(d?n.height+=h:n.width+=h),r.display&&u){var g=i.longestText(t.ctx,c.font,t.ticks,t.longestTextCache),p=i.numberOfLabelLines(t.ticks),m=.5*c.size;if(d){t.longestLabelWidth=g;var v=i.toRadians(t.labelRotation),b=Math.cos(v),x=Math.sin(v),y=x*g+c.size*p+m*p;n.height=Math.min(t.maxHeight,n.height+y),t.ctx.font=c.font;var k=t.ticks[0],S=e(t.ctx,k,c.font),M=t.ticks[t.ticks.length-1],w=e(t.ctx,M,c.font);0!==t.labelRotation?(t.paddingLeft="bottom"===o.position?b*S+3:b*m+3,t.paddingRight="bottom"===o.position?b*m+3:b*w+3):(t.paddingLeft=S/2+3,t.paddingRight=w/2+3)}else r.mirror?g=0:g+=t.options.ticks.padding,n.width+=g,t.paddingTop=c.size/2,t.paddingBottom=c.size/2}t.handleMargins(),t.width=n.width,t.height=n.height},handleMargins:function(){var t=this;t.margins&&(t.paddingLeft=Math.max(t.paddingLeft-t.margins.left,0),t.paddingTop=Math.max(t.paddingTop-t.margins.top,0),t.paddingRight=Math.max(t.paddingRight-t.margins.right,0),t.paddingBottom=Math.max(t.paddingBottom-t.margins.bottom,0))},afterFit:function(){i.callCallback(this.options.afterFit,[this])},isHorizontal:function(){return"top"===this.options.position||"bottom"===this.options.position},isFullWidth:function(){return this.options.fullWidth},getRightValue:function(t){return null===t||"undefined"==typeof t?NaN:"number"!=typeof t||isFinite(t)?"object"==typeof t?t instanceof Date||t.isValid?t:this.getRightValue(this.isHorizontal()?t.x:t.y):t:NaN},getLabelForIndex:i.noop,getPixelForValue:i.noop,getValueForPixel:i.noop,getPixelForTick:function(t,e){var a=this;if(a.isHorizontal()){var i=a.width-(a.paddingLeft+a.paddingRight),n=i/Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),o=n*t+a.paddingLeft;e&&(o+=n/2);var r=a.left+Math.round(o);return r+=a.isFullWidth()?a.margins.left:0}var s=a.height-(a.paddingTop+a.paddingBottom);return a.top+t*(s/(a.ticks.length-1))},getPixelForDecimal:function(t){var e=this;if(e.isHorizontal()){var a=e.width-(e.paddingLeft+e.paddingRight),i=a*t+e.paddingLeft,n=e.left+Math.round(i);return n+=e.isFullWidth()?e.margins.left:0}return e.top+t*e.height},getBasePixel:function(){return this.getPixelForValue(this.getBaseValue())},getBaseValue:function(){var t=this,e=t.min,a=t.max;return t.beginAtZero?0:e<0&&a<0?a:e>0&&a>0?e:0},draw:function(e){var n=this,o=n.options;if(o.display){var r,s,l=n.ctx,u=t.defaults.global,d=o.ticks,c=o.gridLines,h=o.scaleLabel,f=0!==n.labelRotation,g=d.autoSkip,p=n.isHorizontal();d.maxTicksLimit&&(s=d.maxTicksLimit);var m=i.getValueOrDefault(d.fontColor,u.defaultFontColor),v=a(d),b=c.drawTicks?c.tickMarkLength:0,x=i.getValueOrDefault(c.borderDash,u.borderDash),y=i.getValueOrDefault(c.borderDashOffset,u.borderDashOffset),k=i.getValueOrDefault(h.fontColor,u.defaultFontColor),S=a(h),M=i.toRadians(n.labelRotation),w=Math.cos(M),C=n.longestLabelWidth*w;l.fillStyle=m;var I=[];if(p){if(r=!1,f&&(C/=2),(C+d.autoSkipPadding)*n.ticks.length>n.width-(n.paddingLeft+n.paddingRight)&&(r=1+Math.floor((C+d.autoSkipPadding)*n.ticks.length/(n.width-(n.paddingLeft+n.paddingRight)))),s&&n.ticks.length>s)for(;!r||n.ticks.length/(r||1)>s;)r||(r=1),r+=1;g||(r=!1)}var D="right"===o.position?n.left:n.right-b,A="right"===o.position?n.left+b:n.right,T="bottom"===o.position?n.top:n.bottom-b,P="bottom"===o.position?n.top+b:n.bottom;if(i.each(n.ticks,function(t,a){if(void 0!==t&&null!==t){var s=n.ticks.length===a+1,l=r>1&&a%r>0||a%r===0&&a+r>=n.ticks.length;if((!l||s)&&void 0!==t&&null!==t){var u,h;a===("undefined"!=typeof n.zeroLineIndex?n.zeroLineIndex:0)?(u=c.zeroLineWidth,h=c.zeroLineColor):(u=i.getValueAtIndexOrDefault(c.lineWidth,a),h=i.getValueAtIndexOrDefault(c.color,a));var g,m,v,k,S,w,C,_,F,V,R="middle",O="middle";if(p){"bottom"===o.position?(O=f?"middle":"top",R=f?"right":"center",V=n.top+b):(O=f?"middle":"bottom",R=f?"left":"center",V=n.bottom-b);var L=n.getPixelForTick(a)+i.aliasPixel(u);F=n.getPixelForTick(a,c.offsetGridLines)+d.labelOffset,g=v=S=C=L,m=T,k=P,w=e.top,_=e.bottom}else{var B,z="left"===o.position,W=d.padding;d.mirror?(R=z?"left":"right",B=W):(R=z?"right":"left",B=b+W),F=z?n.right-B:n.left+B;var N=n.getPixelForTick(a);N+=i.aliasPixel(u),V=n.getPixelForTick(a,c.offsetGridLines),g=D,v=A,S=e.left,C=e.right,m=k=w=_=N}I.push({tx1:g,ty1:m,tx2:v,ty2:k,x1:S,y1:w,x2:C,y2:_,labelX:F,labelY:V,glWidth:u,glColor:h,glBorderDash:x,glBorderDashOffset:y,rotation:-1*M,label:t,textBaseline:O,textAlign:R})}}}),i.each(I,function(t){if(c.display&&(l.save(),l.lineWidth=t.glWidth,l.strokeStyle=t.glColor,l.setLineDash&&(l.setLineDash(t.glBorderDash),l.lineDashOffset=t.glBorderDashOffset),l.beginPath(),c.drawTicks&&(l.moveTo(t.tx1,t.ty1),l.lineTo(t.tx2,t.ty2)),c.drawOnChartArea&&(l.moveTo(t.x1,t.y1),l.lineTo(t.x2,t.y2)),l.stroke(),l.restore()),d.display){l.save(),l.translate(t.labelX,t.labelY),l.rotate(t.rotation),l.font=v.font,l.textBaseline=t.textBaseline,l.textAlign=t.textAlign;var e=t.label;if(i.isArray(e))for(var a=0,n=0;a0)i=t.stepSize;else{var o=e.niceNum(a.max-a.min,!1);i=e.niceNum(o/(t.maxTicks-1),!0)}var r=Math.floor(a.min/i)*i,s=Math.ceil(a.max/i)*i;t.min&&t.max&&t.stepSize&&e.almostWhole((t.max-t.min)/t.stepSize,i/1e3)&&(r=t.min,s=t.max);var l=(s-r)/i;l=e.almostEquals(l,Math.round(l),i/1e3)?Math.round(l):Math.ceil(l),n.push(void 0!==t.min?t.min:r);for(var u=1;u3?i[2]-i[1]:i[1]-i[0];Math.abs(n)>1&&t!==Math.floor(t)&&(n=t-Math.floor(t));var o=e.log10(Math.abs(n)),r="";if(0!==t){var s=-1*Math.floor(o);s=Math.max(Math.min(s,20),0),r=t.toFixed(s)}else r="0";return r},logarithmic:function(t,a,i){var n=t/Math.pow(10,Math.floor(e.log10(t)));return 0===t?"0":1===n||2===n||5===n||0===a||a===i.length-1?t.toExponential():""}}}}},{}],35:[function(t,e,a){"use strict";e.exports=function(t){function e(e,a){var i=new t.Title({ctx:e.chart.ctx,options:a,chart:e});e.titleBlock=i,t.layoutService.addBox(e,i)}var a=t.helpers;t.defaults.global.title={display:!1,position:"top",fullWidth:!0,fontStyle:"bold",padding:10,text:""};var i=a.noop;t.Title=t.Element.extend({initialize:function(t){var e=this;a.extend(e,t),e.legendHitBoxes=[]},beforeUpdate:i,update:function(t,e,a){var i=this;return i.beforeUpdate(),i.maxWidth=t,i.maxHeight=e,i.margins=a,i.beforeSetDimensions(),i.setDimensions(),i.afterSetDimensions(),i.beforeBuildLabels(),i.buildLabels(),i.afterBuildLabels(),i.beforeFit(),i.fit(),i.afterFit(),i.afterUpdate(),i.minSize},afterUpdate:i,beforeSetDimensions:i,setDimensions:function(){var t=this;t.isHorizontal()?(t.width=t.maxWidth,t.left=0,t.right=t.width):(t.height=t.maxHeight,t.top=0,t.bottom=t.height),t.paddingLeft=0,t.paddingTop=0,t.paddingRight=0,t.paddingBottom=0,t.minSize={width:0,height:0}},afterSetDimensions:i,beforeBuildLabels:i,buildLabels:i,afterBuildLabels:i,beforeFit:i,fit:function(){var e=this,i=a.getValueOrDefault,n=e.options,o=t.defaults.global,r=n.display,s=i(n.fontSize,o.defaultFontSize),l=e.minSize;e.isHorizontal()?(l.width=e.maxWidth,l.height=r?s+2*n.padding:0):(l.width=r?s+2*n.padding:0,l.height=e.maxHeight),e.width=l.width,e.height=l.height},afterFit:i,isHorizontal:function(){var t=this.options.position;return"top"===t||"bottom"===t},draw:function(){var e=this,i=e.ctx,n=a.getValueOrDefault,o=e.options,r=t.defaults.global;if(o.display){var s,l,u,d=n(o.fontSize,r.defaultFontSize),c=n(o.fontStyle,r.defaultFontStyle),h=n(o.fontFamily,r.defaultFontFamily),f=a.fontString(d,c,h),g=0,p=e.top,m=e.left,v=e.bottom,b=e.right;i.fillStyle=n(o.fontColor,r.defaultFontColor),i.font=f,e.isHorizontal()?(s=m+(b-m)/2,l=p+(v-p)/2,u=b-m):(s="left"===o.position?m+d/2:b-d/2,l=p+(v-p)/2,u=v-p,g=Math.PI*("left"===o.position?-.5:.5)),i.save(),i.translate(s,l),i.rotate(g),i.textAlign="center",i.textBaseline="middle",i.fillText(o.text,0,0,u),i.restore()}}}),t.plugins.register({beforeInit:function(t){var a=t.options.title;a&&e(t,a)},beforeUpdate:function(i){var n=i.options.title;n?(n=a.configMerge(t.defaults.global.title,n),i.titleBlock?i.titleBlock.options=n:e(i,n)):(t.layoutService.removeBox(i,i.titleBlock),delete i.titleBlock)}})}},{}],36:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.color(t);return a.alpha(e*a.alpha()).rgbaString()}function a(t,e){return e&&(l.isArray(e)?Array.prototype.push.apply(t,e):t.push(e)),t}function i(t){var e=t._xScale,a=t._yScale||t._scale,i=t._index,n=t._datasetIndex;return{xLabel:e?e.getLabelForIndex(i,n):"",yLabel:a?a.getLabelForIndex(i,n):"",index:i,datasetIndex:n,x:t._model.x,y:t._model.y}}function n(e){var a=t.defaults.global,i=l.getValueOrDefault;return{xPadding:e.xPadding,yPadding:e.yPadding,xAlign:e.xAlign,yAlign:e.yAlign,bodyFontColor:e.bodyFontColor,_bodyFontFamily:i(e.bodyFontFamily,a.defaultFontFamily),_bodyFontStyle:i(e.bodyFontStyle,a.defaultFontStyle),_bodyAlign:e.bodyAlign,bodyFontSize:i(e.bodyFontSize,a.defaultFontSize),bodySpacing:e.bodySpacing,titleFontColor:e.titleFontColor,_titleFontFamily:i(e.titleFontFamily,a.defaultFontFamily),_titleFontStyle:i(e.titleFontStyle,a.defaultFontStyle),titleFontSize:i(e.titleFontSize,a.defaultFontSize),_titleAlign:e.titleAlign,titleSpacing:e.titleSpacing,titleMarginBottom:e.titleMarginBottom,footerFontColor:e.footerFontColor,_footerFontFamily:i(e.footerFontFamily,a.defaultFontFamily),_footerFontStyle:i(e.footerFontStyle,a.defaultFontStyle),footerFontSize:i(e.footerFontSize,a.defaultFontSize),_footerAlign:e.footerAlign,footerSpacing:e.footerSpacing,footerMarginTop:e.footerMarginTop,caretSize:e.caretSize,cornerRadius:e.cornerRadius,backgroundColor:e.backgroundColor,opacity:0,legendColorBackground:e.multiKeyBackground,displayColors:e.displayColors}}function o(t,e){var a=t._chart.ctx,i=2*e.yPadding,n=0,o=e.body,r=o.reduce(function(t,e){return t+e.before.length+e.lines.length+e.after.length},0);r+=e.beforeBody.length+e.afterBody.length;var s=e.title.length,u=e.footer.length,d=e.titleFontSize,c=e.bodyFontSize,h=e.footerFontSize;i+=s*d,i+=s?(s-1)*e.titleSpacing:0,i+=s?e.titleMarginBottom:0,i+=r*c,i+=r?(r-1)*e.bodySpacing:0,i+=u?e.footerMarginTop:0,i+=u*h,i+=u?(u-1)*e.footerSpacing:0;var f=0,g=function(t){n=Math.max(n,a.measureText(t).width+f)};return a.font=l.fontString(d,e._titleFontStyle,e._titleFontFamily),l.each(e.title,g),a.font=l.fontString(c,e._bodyFontStyle,e._bodyFontFamily),l.each(e.beforeBody.concat(e.afterBody),g),f=e.displayColors?c+2:0,l.each(o,function(t){l.each(t.before,g),l.each(t.lines,g),l.each(t.after,g)}),f=0,a.font=l.fontString(h,e._footerFontStyle,e._footerFontFamily),l.each(e.footer,g),n+=2*e.xPadding,{width:n,height:i}}function r(t,e){var a=t._model,i=t._chart,n=t._chartInstance.chartArea,o="center",r="center";a.yi.height-e.height&&(r="bottom");var s,l,u,d,c,h=(n.left+n.right)/2,f=(n.top+n.bottom)/2;"center"===r?(s=function(t){return t<=h},l=function(t){return t>h}):(s=function(t){return t<=e.width/2},l=function(t){return t>=i.width-e.width/2}),u=function(t){return t+e.width>i.width},d=function(t){return t-e.width<0},c=function(t){return t<=f?"top":"bottom"},s(a.x)?(o="left",u(a.x)&&(o="center",r=c(a.y))):l(a.x)&&(o="right",d(a.x)&&(o="center",r=c(a.y)));var g=t._options;return{xAlign:g.xAlign?g.xAlign:o,yAlign:g.yAlign?g.yAlign:r}}function s(t,e,a){var i=t.x,n=t.y,o=t.caretSize,r=t.caretPadding,s=t.cornerRadius,l=a.xAlign,u=a.yAlign,d=o+r,c=s+r;return"right"===l?i-=e.width:"center"===l&&(i-=e.width/2),"top"===u?n+=d:n-="bottom"===u?e.height+d:e.height/2,"center"===u?"left"===l?i+=d:"right"===l&&(i-=d):"left"===l?i-=c:"right"===l&&(i+=c),{x:i,y:n}}var l=t.helpers;t.defaults.global.tooltips={enabled:!0,custom:null,mode:"nearest",position:"average",intersect:!0,backgroundColor:"rgba(0,0,0,0.8)",titleFontStyle:"bold",titleSpacing:2,titleMarginBottom:6,titleFontColor:"#fff",titleAlign:"left",bodySpacing:2,bodyFontColor:"#fff",bodyAlign:"left",footerFontStyle:"bold",footerSpacing:2,footerMarginTop:6,footerFontColor:"#fff",footerAlign:"left",yPadding:6,xPadding:6,caretSize:5,cornerRadius:6,multiKeyBackground:"#fff",displayColors:!0,callbacks:{beforeTitle:l.noop,title:function(t,e){var a="",i=e.labels,n=i?i.length:0;if(t.length>0){var o=t[0];o.xLabel?a=o.xLabel:n>0&&o.indexl;)o-=2*Math.PI;for(;o=s&&o<=l,d=r>=i.innerRadius&&r<=i.outerRadius;return u&&d}return!1},getCenterPoint:function(){var t=this._view,e=(t.startAngle+t.endAngle)/2,a=(t.innerRadius+t.outerRadius)/2;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},getArea:function(){var t=this._view;return Math.PI*((t.endAngle-t.startAngle)/(2*Math.PI))*(Math.pow(t.outerRadius,2)-Math.pow(t.innerRadius,2))},tooltipPosition:function(){var t=this._view,e=t.startAngle+(t.endAngle-t.startAngle)/2,a=(t.outerRadius-t.innerRadius)/2+t.innerRadius;return{x:t.x+Math.cos(e)*a,y:t.y+Math.sin(e)*a}},draw:function(){var t=this._chart.ctx,e=this._view,a=e.startAngle,i=e.endAngle;t.beginPath(),t.arc(e.x,e.y,e.outerRadius,a,i),t.arc(e.x,e.y,e.innerRadius,i,a,!0),t.closePath(),t.strokeStyle=e.borderColor,t.lineWidth=e.borderWidth,t.fillStyle=e.backgroundColor,t.fill(),t.lineJoin="bevel",e.borderWidth&&t.stroke()}})}},{}],38:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=t.defaults.global;t.defaults.global.elements.line={tension:.4,backgroundColor:a.defaultColor,borderWidth:3,borderColor:a.defaultColor,borderCapStyle:"butt",borderDash:[],borderDashOffset:0,borderJoinStyle:"miter",capBezierPoints:!0,fill:!0},t.elements.Line=t.Element.extend({draw:function(){function t(t,e){var a=e._view;e._view.steppedLine===!0?(l.lineTo(a.x,t._view.y),l.lineTo(a.x,a.y)):0===e._view.tension?l.lineTo(a.x,a.y):l.bezierCurveTo(t._view.controlPointNextX,t._view.controlPointNextY,a.controlPointPreviousX,a.controlPointPreviousY,a.x,a.y)}var i=this,n=i._view,o=n.spanGaps,r=n.scaleZero,s=i._loop;s||("top"===n.fill?r=n.scaleTop:"bottom"===n.fill&&(r=n.scaleBottom));var l=i._chart.ctx;l.save();var u=i._children.slice(),d=-1;s&&u.length&&u.push(u[0]);var c,h,f,g;if(u.length&&n.fill){for(l.beginPath(),c=0;ce?1:-1,r=1,s=u.borderSkipped||"left"):(e=u.x-u.width/2,a=u.x+u.width/2,i=u.y,n=u.base,o=1,r=n>i?1:-1,s=u.borderSkipped||"bottom"),d){var c=Math.min(Math.abs(e-a),Math.abs(i-n));d=d>c?c:d;var h=d/2,f=e+("left"!==s?h*o:0),g=a+("right"!==s?-h*o:0),p=i+("top"!==s?h*r:0),m=n+("bottom"!==s?-h*r:0);f!==g&&(i=p,n=m),p!==m&&(e=f,a=g)}l.beginPath(),l.fillStyle=u.backgroundColor,l.strokeStyle=u.borderColor,l.lineWidth=d;var v=[[e,n],[e,i],[a,i],[a,n]],b=["bottom","left","top","right"],x=b.indexOf(s,0);x===-1&&(x=0);var y=t(0);l.moveTo(y[0],y[1]);for(var k=1;k<4;k++)y=t(k),l.lineTo(y[0],y[1]);l.fill(),d&&l.stroke()},height:function(){var t=this._view;return t.base-t.y},inRange:function(t,e){var i=!1;if(this._view){var n=a(this);i=t>=n.left&&t<=n.right&&e>=n.top&&e<=n.bottom}return i},inLabelRange:function(t,i){var n=this;if(!n._view)return!1;var o=!1,r=a(n);return o=e(n)?t>=r.left&&t<=r.right:i>=r.top&&i<=r.bottom},inXRange:function(t){var e=a(this);return t>=e.left&&t<=e.right},inYRange:function(t){var e=a(this);return t>=e.top&&t<=e.bottom},getCenterPoint:function(){var t,a,i=this._view;return e(this)?(t=i.x,a=(i.y+i.base)/2):(t=(i.x+i.base)/2,a=i.y),{x:t,y:a}},getArea:function(){var t=this._view;return t.width*Math.abs(t.y-t.base)},tooltipPosition:function(){var t=this._view;return{x:t.x,y:t.y}}})}},{}],41:[function(t,e,a){"use strict";e.exports=function(t){function e(t,e){var a=l.getStyle(t,e),i=a&&a.match(/(\d+)px/);return i?Number(i[1]):void 0}function a(t,a){var i=t.style,n=t.getAttribute("height"),o=t.getAttribute("width");if(t._chartjs={initial:{height:n,width:o,style:{display:i.display,height:i.height,width:i.width}}},i.display=i.display||"block",null===o||""===o){var r=e(t,"width");void 0!==r&&(t.width=r)}if(null===n||""===n)if(""===t.style.height)t.height=t.width/(a.options.aspectRatio||2);else{var s=e(t,"height");void 0!==r&&(t.height=s)}return t}function i(t,e,a,i,n){return{type:t,chart:e,native:n||null,x:void 0!==a?a:null,y:void 0!==i?i:null}}function n(t,e){ +var a=u[t.type]||t.type,n=l.getRelativePosition(t,e);return i(a,e,n.x,n.y,t)}function o(t){var e=document.createElement("iframe");return e.className="chartjs-hidden-iframe",e.style.cssText="display:block;overflow:hidden;border:0;margin:0;top:0;left:0;bottom:0;right:0;height:100%;width:100%;position:absolute;pointer-events:none;z-index:-1;",e.tabIndex=-1,l.addEvent(e,"load",function(){l.addEvent(e.contentWindow||e,"resize",t),t()}),e}function r(t,e,a){var n=t._chartjs={ticking:!1},r=function(){n.ticking||(n.ticking=!0,l.requestAnimFrame.call(window,function(){if(n.resizer)return n.ticking=!1,e(i("resize",a))}))};n.resizer=o(r),t.insertBefore(n.resizer,t.firstChild)}function s(t){if(t&&t._chartjs){var e=t._chartjs.resizer;e&&(e.parentNode.removeChild(e),t._chartjs.resizer=null),delete t._chartjs}}var l=t.helpers,u={touchstart:"mousedown",touchmove:"mousemove",touchend:"mouseup",pointerenter:"mouseenter",pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointerleave:"mouseout",pointerout:"mouseout"};return{acquireContext:function(t,e){if("string"==typeof t?t=document.getElementById(t):t.length&&(t=t[0]),t&&t.canvas&&(t=t.canvas),t instanceof HTMLCanvasElement){var i=t.getContext&&t.getContext("2d");if(i instanceof CanvasRenderingContext2D)return a(t,e),i}return null},releaseContext:function(t){var e=t.canvas;if(e._chartjs){var a=e._chartjs.initial;["height","width"].forEach(function(t){var i=a[t];void 0===i||null===i?e.removeAttribute(t):e.setAttribute(t,i)}),l.each(a.style||{},function(t,a){e.style[a]=t}),e.width=e.width,delete e._chartjs}},addEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void r(i.parentNode,a,t.chart);var o=a._chartjs||(a._chartjs={}),s=o.proxies||(o.proxies={}),u=s[t.id+"_"+e]=function(e){a(n(e,t.chart))};l.addEvent(i,e,u)},removeEventListener:function(t,e,a){var i=t.chart.canvas;if("resize"===e)return void s(i.parentNode,a);var n=a._chartjs||{},o=n.proxies||{},r=o[t.id+"_"+e];r&&l.removeEvent(i,e,r)}}}},{}],42:[function(t,e,a){"use strict";var i=t(41);e.exports=function(t){t.platform={acquireContext:function(){},releaseContext:function(){},addEventListener:function(){},removeEventListener:function(){}},t.helpers.extend(t.platform,i(t))}},{41:41}],43:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"bottom"},i=t.Scale.extend({getLabels:function(){var t=this.chart.data;return(this.isHorizontal()?t.xLabels:t.yLabels)||t.labels},determineDataLimits:function(){var t=this,a=t.getLabels();t.minIndex=0,t.maxIndex=a.length-1;var i;void 0!==t.options.ticks.min&&(i=e.indexOf(a,t.options.ticks.min),t.minIndex=i!==-1?i:t.minIndex),void 0!==t.options.ticks.max&&(i=e.indexOf(a,t.options.ticks.max),t.maxIndex=i!==-1?i:t.maxIndex),t.min=a[t.minIndex],t.max=a[t.maxIndex]},buildTicks:function(){var t=this,e=t.getLabels();t.ticks=0===t.minIndex&&t.maxIndex===e.length-1?e:e.slice(t.minIndex,t.maxIndex+1)},getLabelForIndex:function(t,e){var a=this,i=a.chart.data,n=a.isHorizontal();return i.yLabels&&!n?a.getRightValue(i.datasets[e].data[t]):a.ticks[t-a.minIndex]},getPixelForValue:function(t,e,a,i){var n=this,o=Math.max(n.maxIndex+1-n.minIndex-(n.options.gridLines.offsetGridLines?0:1),1);if(void 0!==t&&isNaN(e)){var r=n.getLabels(),s=r.indexOf(t);e=s!==-1?s:e}if(n.isHorizontal()){var l=n.width/o,u=l*(e-n.minIndex);return(n.options.gridLines.offsetGridLines&&i||n.maxIndex===n.minIndex&&i)&&(u+=l/2),n.left+Math.round(u)}var d=n.height/o,c=d*(e-n.minIndex);return n.options.gridLines.offsetGridLines&&i&&(c+=d/2),n.top+Math.round(c)},getPixelForTick:function(t,e){return this.getPixelForValue(this.ticks[t],t+this.minIndex,null,e)},getValueForPixel:function(t){var e,a=this,i=Math.max(a.ticks.length-(a.options.gridLines.offsetGridLines?0:1),1),n=a.isHorizontal(),o=(n?a.width:a.height)/i;return t-=n?a.left:a.top,a.options.gridLines.offsetGridLines&&(t-=o/2),e=t<=0?0:Math.round(t/o)},getBasePixel:function(){return this.bottom}});t.scaleService.registerScaleType("category",i,a)}},{}],44:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.linear}},i=t.LinearScaleBase.extend({determineDataLimits:function(){function t(t){return s?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=a.chart,o=n.data,r=o.datasets,s=a.isHorizontal();a.min=null,a.max=null;var l=i.stacked;if(void 0===l&&e.each(r,function(e,a){if(!l){var i=n.getDatasetMeta(a);n.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(l=!0)}}),i.stacked||l){var u={};e.each(r,function(o,r){var s=n.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");void 0===u[l]&&(u[l]={positiveValues:[],negativeValues:[]});var d=u[l].positiveValues,c=u[l].negativeValues;n.isDatasetVisible(r)&&t(s)&&e.each(o.data,function(t,e){var n=+a.getRightValue(t);isNaN(n)||s.data[e].hidden||(d[e]=d[e]||0,c[e]=c[e]||0,i.relativePoints?d[e]=100:n<0?c[e]+=n:d[e]+=n)})}),e.each(u,function(t){var i=t.positiveValues.concat(t.negativeValues),n=e.min(i),o=e.max(i);a.min=null===a.min?n:Math.min(a.min,n),a.max=null===a.max?o:Math.max(a.max,o)})}else e.each(r,function(i,o){var r=n.getDatasetMeta(o);n.isDatasetVisible(o)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:ia.max&&(a.max=i))})});this.handleTickRangeOptions()},getTickLimit:function(){var a,i=this,n=i.options.ticks;if(i.isHorizontal())a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.width/50));else{var o=e.getValueOrDefault(n.fontSize,t.defaults.global.defaultFontSize);a=Math.min(n.maxTicksLimit?n.maxTicksLimit:11,Math.ceil(i.height/(2*o)))}return a},handleDirectionalChanges:function(){this.isHorizontal()||this.ticks.reverse()},getLabelForIndex:function(t,e){return+this.getRightValue(this.chart.data.datasets[e].data[t])},getPixelForValue:function(t){var e,a=this,i=a.start,n=+a.getRightValue(t),o=a.end-i;return a.isHorizontal()?(e=a.left+a.width/o*(n-i),Math.round(e)):(e=a.bottom-a.height/o*(n-i),Math.round(e))},getValueForPixel:function(t){var e=this,a=e.isHorizontal(),i=a?e.width:e.height,n=(a?t-e.left:e.bottom-t)/i;return e.start+(e.end-e.start)*n},getPixelForTick:function(t){return this.getPixelForValue(this.ticksAsNumbers[t])}});t.scaleService.registerScaleType("linear",i,a)}},{}],45:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a=e.noop;t.LinearScaleBase=t.Scale.extend({handleTickRangeOptions:function(){var t=this,a=t.options,i=a.ticks;if(i.beginAtZero){var n=e.sign(t.min),o=e.sign(t.max);n<0&&o<0?t.max=0:n>0&&o>0&&(t.min=0)}void 0!==i.min?t.min=i.min:void 0!==i.suggestedMin&&(t.min=Math.min(t.min,i.suggestedMin)),void 0!==i.max?t.max=i.max:void 0!==i.suggestedMax&&(t.max=Math.max(t.max,i.suggestedMax)),t.min===t.max&&(t.max++,i.beginAtZero||t.min--)},getTickLimit:a,handleDirectionalChanges:a,buildTicks:function(){var a=this,i=a.options,n=i.ticks,o=a.getTickLimit();o=Math.max(2,o);var r={maxTicks:o,min:n.min,max:n.max,stepSize:e.getValueOrDefault(n.fixedStepSize,n.stepSize)},s=a.ticks=t.Ticks.generators.linear(r,a);a.handleDirectionalChanges(),a.max=e.max(s),a.min=e.min(s),n.reverse?(s.reverse(),a.start=a.max,a.end=a.min):(a.start=a.min,a.end=a.max)},convertTicksToLabels:function(){var e=this;e.ticksAsNumbers=e.ticks.slice(),e.zeroLineIndex=e.ticks.indexOf(0),t.Scale.prototype.convertTicksToLabels.call(e)}})}},{}],46:[function(t,e,a){"use strict";e.exports=function(t){var e=t.helpers,a={position:"left",ticks:{callback:t.Ticks.formatters.logarithmic}},i=t.Scale.extend({determineDataLimits:function(){function t(t){return u?t.xAxisID===a.id:t.yAxisID===a.id}var a=this,i=a.options,n=i.ticks,o=a.chart,r=o.data,s=r.datasets,l=e.getValueOrDefault,u=a.isHorizontal();a.min=null,a.max=null,a.minNotZero=null;var d=i.stacked;if(void 0===d&&e.each(s,function(e,a){if(!d){var i=o.getDatasetMeta(a);o.isDatasetVisible(a)&&t(i)&&void 0!==i.stack&&(d=!0)}}),i.stacked||d){var c={};e.each(s,function(n,r){var s=o.getDatasetMeta(r),l=[s.type,void 0===i.stacked&&void 0===s.stack?r:"",s.stack].join(".");o.isDatasetVisible(r)&&t(s)&&(void 0===c[l]&&(c[l]=[]),e.each(n.data,function(t,e){var n=c[l],o=+a.getRightValue(t);isNaN(o)||s.data[e].hidden||(n[e]=n[e]||0,i.relativePoints?n[e]=100:n[e]+=o)}))}),e.each(c,function(t){var i=e.min(t),n=e.max(t);a.min=null===a.min?i:Math.min(a.min,i),a.max=null===a.max?n:Math.max(a.max,n)})}else e.each(s,function(i,n){var r=o.getDatasetMeta(n);o.isDatasetVisible(n)&&t(r)&&e.each(i.data,function(t,e){var i=+a.getRightValue(t);isNaN(i)||r.data[e].hidden||(null===a.min?a.min=i:ia.max&&(a.max=i),0!==i&&(null===a.minNotZero||in?{start:e-a-5,end:e}:{start:e,end:e+a+5}}function o(t){var o,r,s,l=a(t),u=Math.min(t.height/2,t.width/2),d={l:t.width,r:0,t:t.height,b:0},c={};t.ctx.font=l.font,t._pointLabelSizes=[];var h=e(t);for(o=0;od.r&&(d.r=m.end,c.r=g),v.startd.b&&(d.b=v.end,c.b=g)}t.setReductions(u,d,c)}function r(t){var e=Math.min(t.height/2,t.width/2);t.drawingArea=Math.round(e),t.setCenterPoint(0,0,0,0)}function s(t){return 0===t||180===t?"center":t<180?"left":"right"}function l(t,e,a,i){if(f.isArray(e))for(var n=a.y,o=1.5*i,r=0;r270||t<90)&&(a.y-=e.h)}function d(t){var i=t.ctx,n=f.getValueOrDefault,o=t.options,r=o.angleLines,d=o.pointLabels;i.lineWidth=r.lineWidth,i.strokeStyle=r.color;var c=t.getDistanceFromCenterForValue(o.reverse?t.min:t.max),h=a(t);i.textBaseline="top";for(var p=e(t)-1;p>=0;p--){if(r.display){var m=t.getPointPosition(p,c);i.beginPath(),i.moveTo(t.xCenter,t.yCenter),i.lineTo(m.x,m.y),i.stroke(),i.closePath()}var v=t.getPointPosition(p,c+5),b=n(d.fontColor,g.defaultFontColor);i.font=h.font,i.fillStyle=b;var x=t.getIndexAngle(p),y=f.toDegrees(x);i.textAlign=s(y),u(y,t._pointLabelSizes[p],v),l(i,t.pointLabels[p]||"",v,h.size)}}function c(t,a,i,n){var o=t.ctx;if(o.strokeStyle=f.getValueAtIndexOrDefault(a.color,n-1),o.lineWidth=f.getValueAtIndexOrDefault(a.lineWidth,n-1),t.options.lineArc)o.beginPath(),o.arc(t.xCenter,t.yCenter,i,0,2*Math.PI),o.closePath(),o.stroke();else{var r=e(t);if(0===r)return;o.beginPath();var s=t.getPointPosition(0,i);o.moveTo(s.x,s.y);for(var l=1;l0&&a>0?e:0)},draw:function(){var t=this,e=t.options,a=e.gridLines,i=e.ticks,n=f.getValueOrDefault;if(e.display){var o=t.ctx,r=n(i.fontSize,g.defaultFontSize),s=n(i.fontStyle,g.defaultFontStyle),l=n(i.fontFamily,g.defaultFontFamily),u=f.fontString(r,s,l);f.each(t.ticks,function(s,l){if(l>0||e.reverse){var d=t.getDistanceFromCenterForValue(t.ticksAsNumbers[l]),h=t.yCenter-d;if(a.display&&0!==l&&c(t,a,d,l),i.display){var f=n(i.fontColor,g.defaultFontColor);if(o.font=u,i.showLabelBackdrop){var p=o.measureText(s).width;o.fillStyle=i.backdropColor,o.fillRect(t.xCenter-p/2-i.backdropPaddingX,h-r/2-i.backdropPaddingY,p+2*i.backdropPaddingX,r+2*i.backdropPaddingY)}o.textAlign="center",o.textBaseline="middle",o.fillStyle=f,o.fillText(s,t.xCenter,h)}}}),e.lineArc||d(t)}}});t.scaleService.registerScaleType("radialLinear",m,p)}},{}],48:[function(t,e,a){"use strict";var i=t(1);i="function"==typeof i?i:window.moment,e.exports=function(t){var e=t.helpers,a={units:[{name:"millisecond",steps:[1,2,5,10,20,50,100,250,500]},{name:"second",steps:[1,2,5,10,30]},{name:"minute",steps:[1,2,5,10,30]},{name:"hour",steps:[1,2,3,6,12]},{name:"day",steps:[1,2,5]},{name:"week",maxStep:4},{name:"month",maxStep:3},{name:"quarter",maxStep:4},{name:"year",maxStep:!1}]},n={position:"bottom",time:{parser:!1,format:!1,unit:!1,round:!1,displayFormat:!1,isoWeekday:!1,minUnit:"millisecond",displayFormats:{millisecond:"h:mm:ss.SSS a",second:"h:mm:ss a",minute:"h:mm:ss a",hour:"MMM D, hA",day:"ll",week:"ll",month:"MMM YYYY",quarter:"[Q]Q - YYYY",year:"YYYY"}},ticks:{autoSkip:!1}},o=t.Scale.extend({initialize:function(){if(!i)throw new Error("Chart.js - Moment.js could not be found! You must include it before Chart.js to use the time scale. Download at https://momentjs.com");t.Scale.prototype.initialize.call(this)},getLabelMoment:function(t,e){return null===t||null===e?null:"undefined"!=typeof this.labelMoments[t]?this.labelMoments[t][e]:null},getLabelDiff:function(t,e){var a=this;return null===t||null===e?null:(void 0===a.labelDiffs&&a.buildLabelDiffs(),"undefined"!=typeof a.labelDiffs[t]?a.labelDiffs[t][e]:null)},getMomentStartOf:function(t){var e=this;return"week"===e.options.time.unit&&e.options.time.isoWeekday!==!1?t.clone().startOf("isoWeek").isoWeekday(e.options.time.isoWeekday):t.clone().startOf(e.tickUnit)},determineDataLimits:function(){var t=this;t.labelMoments=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0?(e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i))},t),t.firstTick=i.min.call(t,a),t.lastTick=i.max.call(t,a)):(t.firstTick=null,t.lastTick=null),e.each(t.chart.data.datasets,function(n,o){var r=[],s=t.chart.isDatasetVisible(o);"object"==typeof n.data[0]&&null!==n.data[0]?e.each(n.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),r.push(a),s&&(t.firstTick=null!==t.firstTick?i.min(t.firstTick,a):a,t.lastTick=null!==t.lastTick?i.max(t.lastTick,a):a))},t):r=a,t.labelMoments.push(r)},t),t.options.time.min&&(t.firstTick=t.parseTime(t.options.time.min)),t.options.time.max&&(t.lastTick=t.parseTime(t.options.time.max)),t.firstTick=(t.firstTick||i()).clone(),t.lastTick=(t.lastTick||i()).clone()},buildLabelDiffs:function(){var t=this;t.labelDiffs=[];var a=[];t.chart.data.labels&&t.chart.data.labels.length>0&&e.each(t.chart.data.labels,function(e){var i=t.parseTime(e);i.isValid()&&(t.options.time.round&&i.startOf(t.options.time.round),a.push(i.diff(t.firstTick,t.tickUnit,!0)))},t),e.each(t.chart.data.datasets,function(i){var n=[];"object"==typeof i.data[0]&&null!==i.data[0]?e.each(i.data,function(e){var a=t.parseTime(t.getRightValue(e));a.isValid()&&(t.options.time.round&&a.startOf(t.options.time.round),n.push(a.diff(t.firstTick,t.tickUnit,!0)))},t):n=a,t.labelDiffs.push(n)},t)},buildTicks:function(){var i=this;i.ctx.save();var n=e.getValueOrDefault(i.options.ticks.fontSize,t.defaults.global.defaultFontSize),o=e.getValueOrDefault(i.options.ticks.fontStyle,t.defaults.global.defaultFontStyle),r=e.getValueOrDefault(i.options.ticks.fontFamily,t.defaults.global.defaultFontFamily),s=e.fontString(n,o,r);if(i.ctx.font=s,i.ticks=[],i.unitScale=1,i.scaleSizeInUnits=0,i.options.time.unit)i.tickUnit=i.options.time.unit||"day",i.displayFormat=i.options.time.displayFormats[i.tickUnit],i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,1);else{var l=i.isHorizontal()?i.width:i.height,u=i.tickFormatFunction(i.firstTick,0,[]),d=i.ctx.measureText(u).width,c=Math.cos(e.toRadians(i.options.ticks.maxRotation)),h=Math.sin(e.toRadians(i.options.ticks.maxRotation));d=d*c+n*h;var f=l/d;i.tickUnit=i.options.time.minUnit,i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0),i.displayFormat=i.options.time.displayFormats[i.tickUnit];for(var g=0,p=a.units[g];g=Math.ceil(i.scaleSizeInUnits/f)){i.unitScale=e.getValueOrDefault(i.options.time.unitStepSize,p.steps[m]);break}break}if(p.maxStep===!1||Math.ceil(i.scaleSizeInUnits/f)=0&&(i.lastTick=y),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0)}i.options.time.displayFormat&&(i.displayFormat=i.options.time.displayFormat),i.ticks.push(i.firstTick.clone());for(var S=i.unitScale;S<=i.scaleSizeInUnits;S+=i.unitScale){var M=x.clone().add(S,i.tickUnit);if(i.options.time.max&&M.diff(i.lastTick,i.tickUnit,!0)>=0)break;i.ticks.push(M)}var w=i.ticks[i.ticks.length-1].diff(i.lastTick,i.tickUnit);0===w&&0!==i.scaleSizeInUnits||(i.options.time.max?(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.ticks[0],i.tickUnit,!0)):(i.ticks.push(i.lastTick.clone()),i.scaleSizeInUnits=i.lastTick.diff(i.firstTick,i.tickUnit,!0))),i.ctx.restore(),i.labelDiffs=void 0},getLabelForIndex:function(t,e){var a=this,i=a.chart.data.labels&&tlastScrollTop&&e>navbarHeight){$("#header").removeClass("nav-down").addClass("nav-up")}else{if(e+$(window).height()<$(document).height()){$("#header").removeClass("nav-up").addClass("nav-down")}}lastScrollTop=e}}var langSwitch=function(e){var t=e.attr("href").replace(/front\/preference.+/,"ajax/switchlang.php");$.ajax({url:t,type:"GET",success:function(e){$("#language_link").html(e);$("#debugajax").remove()}})};$((function(){if($("html").hasClass("loginpage")){return}$("#menu.fullmenu li").on("mouseover",(function(){var e=$(this).data("id");menuAff("menu"+e,"menu")}));$("body").delegate("td","mouseover mouseleave",(function(e){var t=$(this).closest("tr").children().index($(this));var n=$(this).closest("tr");if(!$(this).closest("tr").hasClass("noHover")){if(e.type=="mouseover"){n.addClass("rowHover");if(n.has("td[rowspan]").length===0){n.prevAll("tr:has(td[rowspan]):first").find("td[rowspan]").addClass("rowHover")}$(this).closest("table").find("tr:not(.noHover) th:nth-child("+(t+1)+")").addClass("headHover")}else{n.removeClass("rowHover");n.removeClass("rowHover").prevAll("tr:has(td[rowspan]):first").find("td[rowspan]").removeClass("rowHover");$(this).closest("table").find("tr:not(.noHover) th:nth-child("+(t+1)+")").removeClass("headHover")}}}));$.ui.dialog.prototype._focusTabbable=function(){};$("#language_link > a").on("click",(function(e){e.preventDefault();langSwitch($(this))}));$(document).on("keydown","#page form textarea",(function(e){if(e.ctrlKey&&e.keyCode==13){submitparentForm($(this))}}));$.widget("ui.dialog",$.extend({},$.ui.dialog.prototype,{_title:function(e){if(!this.options.title){e.html(" ")}else{e.html(this.options.title)}}}))}));var submitparentForm=function(e){var t=$(e).closest("form");var n=t.find("[type=submit]").filter("[name=add], [name=update]");if(n.length==1){return n.trigger("click")!==false}return false};var isImage=function(e){var t=["image/gif","image/jpeg","image/jpg","image/png"];if($.inArray(e.type,t)<0){return false}else{return true}};var getExtIcon=function(e){var t=CFG_GLPI.root_doc+"/pics/icones/"+e+"-dist.png";if(!urlExists(t)){t=CFG_GLPI.root_doc+"/pics/icones/defaut-dist.png"}return''};var urlExists=function(e){var t=false;$.ajax({type:"HEAD",url:e,async:false,success:function(){t=true}});return t};var getSize=function(e){var t=["o","Kio","Mio","Gio","Tio"];var n="";t.some((function(t){if(e>1024){e=e/1024}else{n=t;return true}}));return Math.round(e*100,2)/100+n};var getBijectiveIndex=function(e){var t="";while(parseInt(e)>0){e--;t=String.fromCharCode("A".charCodeAt(0)+e%26)+t;e/=26}return t};var stopEvent=function(e){e.preventDefault();e.stopPropagation()};if($("#backtotop").length){var scrollTrigger=100,backToTop=function(){var e=$(window).scrollTop();if(e>scrollTrigger){$("#backtotop").show("slow");$("#see_debug").addClass("wbttop")}else{$("#backtotop").hide();$("#see_debug").removeClass("wbttop")}};backToTop();$(window).on("scroll",(function(){backToTop()}));$("#backtotop").on("click",(function(e){e.preventDefault();$("html,body").animate({scrollTop:0},700)}))}function _eltRealSize(e){var t=0;t+=e.outerHeight();t+=parseFloat(e.css("margin-top").replace("px",""));t+=parseFloat(e.css("margin-bottom").replace("px",""));t+=parseFloat(e.css("padding-top").replace("px",""));t+=parseFloat(e.css("padding-bottom").replace("px",""));return t}var initMap=function(e,t,n){t=typeof t!=="undefined"?t:"map";n=typeof n!=="undefined"?n:"200px";if(n=="full"){var a=$(window).height();var r=0;$("#header_top, #c_menu, #c_ssmenu2, #footer, .search_page").each((function(){r+=_eltRealSize($(this))}));r+=parseFloat($("#page").css("padding-top").replace("px",""));r+=parseFloat($("#page").css("padding-bottom").replace("px",""));r+=parseFloat($("#page").css("margin-top").replace("px",""));r+=parseFloat($("#page").css("margin-bottom").replace("px",""));var o=Math.floor(a-r);var i=300;if(o'));var l=L.map(t,{fullscreenControl:true}).setView([43.6112422,3.8767337],6);L.tileLayer("https://{s}.tile.osm.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap contributors"}).addTo(l);return l};var showMapForLocation=function(e){var t=$(e).data("fid");var n=$("#"+t).val();if(n==0){return}var a=$('
');a.appendTo("body").dialog({close:function(){$(this).dialog("destroy").remove()}});var r=initMap($("#location_map_dialog"),"location_map");r.spin(true);$.ajax({dataType:"json",method:"POST",url:CFG_GLPI.root_doc+"/ajax/getMapPoint.php",data:{itemtype:"Location",items_id:$("#"+t).val()}}).done((function(e){if(e.success===false){a.dialog("close");$("
"+e.message+"
").dialog({close:function(){$(this).dialog("destroy").remove()}})}else{var t=[];var n=L.marker([e.lat,e.lng]);t.push(n);var o=L.featureGroup(t).addTo(r);r.fitBounds(o.getBounds(),{padding:[50,50],maxZoom:10})}})).always((function(){r.spin(false)}))};var query={};function markMatch(e,t){var n=e.toUpperCase().indexOf(t.toUpperCase());var a=$("");if(n<0){a.append(escapeMarkupText(e));return a.html()}a.html(escapeMarkupText(e.substring(0,n)));var r=$("");r.html(escapeMarkupText(e.substring(n,n+t.length)));a.append(r);a.append(escapeMarkupText(e.substring(n+t.length)));return a.html()}var templateResult=function(e){var t=$("");t.attr("title",e.title);if(typeof query.term!=="undefined"&&typeof e.rendered_text!=="undefined"){t.html(e.rendered_text)}else{if(!e.text){return null}var n=e.text;if(!e.id){t.html(escapeMarkupText(n));return t}var a=query.term||"";var r=markMatch(n,a);if(e.level){var o="";var i=e.level;while(i>1){o=o+"   ";i=i-1}t.html(o+"»"+r)}else{t.html(r)}}return t};var typewatch=function(){var e=0;return function(t,n){clearTimeout(e);e=setTimeout(t,n)}}();var templateSelection=function(e){if(!("element"in e)){return e.text}if(Object.prototype.hasOwnProperty.call(e,"selection_text")){return e.selection_text}if(e.element.parentElement.nodeName=="OPTGROUP"){return e.element.parentElement.getAttribute("label")+" - "+e.text}return e.text};var getTextWithoutDiacriticalMarks=function(e){e=e.normalize("NFD");return e.replace(/[\u0300-\u036f]/g,"")};var escapeMarkupText=function(e){if(e.indexOf(">")!==-1||e.indexOf("<")!==-1){e=jQuery.fn.select2.defaults.defaults.escapeMarkup(e)}return e};function updateProgress(e){var t=$("progress#progress"+e).first();$("div[data-progressid='"+e+"']").each((function(e,n){var a=$(n);var r=a.find(".progress-fg").first();var o=t.attr("value")/t.attr("max")*100;r.width(o+"%");if(a.data("append-percent")===1){var i=a.prop("title").replace(new RegExp("\\d*%$"),t.attr("value")+"%").trim();t.prop("title",i);a.prop("title",i)}}))}function normalizeMultiDateAltField(e,t){var n=$(e).val().split(", ");var a=[];for(var r=0;r
').load(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"display_embed_form",dashboard:Dashboard.current_name},(function(){$(this).dialog({width:300,modal:true,open:function(){$(this).find("input").first().focus()}})}))}));$("#dashboard-"+e.rand+" .toolbar .edit-dashboard").click((function(){var a=!$(this).hasClass("active");Dashboard.setEditMode(a)}));var r="#dashboard-"+e.rand+" .toggle-fullscreen";$(r).click((function(){Dashboard.toggleFullscreenMode($(this))}));$(document).on("fullscreenchange webkitfullscreenchange mozfullscreenchange MSFullscreenChange",(function(){if(!document.webkitIsFullScreen&&!document.mozFullScreen&&!document.msFullscreenElement!==null){Dashboard.disableFullscreenMode()}}));$("#dashboard-"+e.rand+" .toolbar .night-mode").click((function(){$(this).toggleClass("active");Dashboard.element.toggleClass("nightmode")}));$("#dashboard-"+e.rand+" .toolbar .auto-refresh").click((function(){$(this).toggleClass("active");var a=$(this).hasClass("active");if(a){var e=parseInt(CFG_GLPI.refresh_ticket_list)*60||30;Dashboard.interval=setInterval((function(){Dashboard.refreshDashboard()}),e*1e3)}else{clearInterval(Dashboard.interval)}}));var d;$(window).on("resize",(function(a){if(a.target.constructor.name!=="Window"){return}window.clearTimeout(d);d=window.setTimeout((function(){Dashboard.generateCss();Dashboard.fitNumbers();Dashboard.animateNumbers()}),200)}));$(document).on("click",".display-rights-form .save_rights",(function(){$(".ui-dialog-content").dialog("close");var a=$(this);var e={};$.each(a.closest(".display-rights-form").serializeArray(),(function(){var a=this.value.split("-");var t=a[0];var r=a[1];if(!(t in e)){e[t]=[]}e[t].push(r)}));$.ajax({method:"POST",url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"save_rights",dashboard:Dashboard.current_name,rights:e}})}));$("#grid-stack-"+e.rand).on("dragstop",(function(){Dashboard.saveDashboard()}));$("#grid-stack-"+e.rand).on("gsresizestop",(function(a,e){Dashboard.saveDashboard();var t=$(e).find(".ct-chart");if(t.length>0){t[0].__chartist__.update()}Dashboard.fitNumbers($(e));Dashboard.animateNumbers($(e))}));$(document).on("click","#dashboard-"+e.rand+" .delete-item",(function(){var a=$(this);var e=a.closest(".grid-stack-item");Dashboard.grid.removeWidget(e);Dashboard.saveDashboard()}));$(document).on("click","#dashboard-"+e.rand+" .refresh-item",(function(){var a=$(this);var e=a.closest(".grid-stack-item");var t=e.data("gs-id");Dashboard.getCardsAjax("[data-gs-id="+t+"]")}));$(document).on("click","#dashboard-"+e.rand+" .edit-item",(function(){var a=$(this);var e=a.parent().parent(".grid-stack-item");var t=e.data("card-options");$(".ui-dialog-content").dialog("close");$('
').load(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"display_edit_widget",gridstack_id:e.data("gs-id"),card_id:t.card_id,x:e.data("gs-x"),y:e.data("gs-y"),width:e.data("gs-width"),height:e.data("gs-height"),card_options:t},(function(){$(this).dialog({width:"auto",modal:true,open:function(){$(this).find("input[type=submit]").first().focus()}})}))}));$(document).on("click","#dashboard-"+e.rand+" .cell-add",(function(){var a=$(this);$(".ui-dialog-content").dialog("close");$('
').load(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"display_add_widget",x:a.data("x"),y:a.data("y")},(function(){$(this).dialog({width:"auto",modal:true,open:function(){$(this).find("input[type=submit]").first().focus()}})}))}));$(document).on("submit",".display-widget-form ",(function(a){a.preventDefault();var e=$(this);var t=e.has(".edit-widget").length>0;Dashboard.setWidgetFromForm(e,t)}));$(document).on("click","#dashboard-"+e.rand+" .filters_toolbar .add-filter",(function(){$(".ui-dialog-content").dialog("close");var a=Dashboard.getFiltersFromStorage();var e=Object.keys(a);$('
').load(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"display_add_filter",used:e},(function(){$(this).dialog({width:"auto",modal:true,open:function(){$(this).find("input[type=submit]").first().focus()}})}))}));$(document).on("submit",".display-filter-form ",(function(a){a.preventDefault();var e=$(this);Dashboard.setFilterFromForm(e)}));$(document).on("click","#dashboard-"+e.rand+" .filters_toolbar .delete-filter",(function(){var a=$(this).closest(".filter");var e=a.data("filter-id");a.remove();var t=Dashboard.getFiltersFromStorage();delete t[e];Dashboard.setFiltersInStorage(t);Dashboard.refreshCardsImpactedByFilter(e)}));$(document).on("click",".save-dashboard-name ",(function(a){a.preventDefault();$(".dashboard_select option[value="+Dashboard.current_name+"]").text($(".dashboard-name").val());Dashboard.saveDashboard();$(".display-message").addClass("success").text(__("Saved")).show("fade").delay(2e3).hide("fade")}));$(document).on("select2:select",".display-widget-form select[name=card_id]",(function(a){var e=a.params.data;var t=e.id;var r=$(this).closest(".field").siblings(".widgettype_field");var d=Dashboard.all_cards[t].widgettype;var i=d.length===1;r.show().find("input[type=radio]").next("label").css("display","none").end().filter("[value='"+d.join("'],[value='")+"']").prop("checked",i).trigger("change").next("label").css("display","inline-block")}));$(document).on("change",".display-widget-form [name=widgettype]",(function(){var a=$(this);var e=a.val();var t=Dashboard.all_widgets[e];var r=t.gradient||false;var d=t.pointlbl||false;var i=t.limit||false;var o=t.width||2;var s=t.height||2;a.closest(".field").siblings(".gradient_field").hide().toggle(r).end().siblings(".pointlbl_field").hide().toggle(d).end().siblings(".limit_field").hide().toggle(i).end();var n=a.closest(".field").siblings('[name="width"]');var l=a.closest(".field").siblings('[name="height"]');if(n.val()==0){n.val(o)}if(l.val()==0){l.val(s)}}));$(document).on("input",".card.markdown textarea.markdown_content",(function(){Dashboard.saveMarkdown($(this))}))},saveMarkdown:function(a){var e=a.closest(".grid-stack-item");var t=a.val();var r=e.data("gs-id");e.addClass("dirty");Dashboard.markdown_contents[r]=t},setWidgetFromForm:function(a,e){e=e||false;$(".ui-dialog-content").dialog("close");var t={};$.each(a.serializeArray(),(function(){t[this.name]=this.value}));if(t.card_id==="0"){return false}t.card_options=t.card_options||{};if(typeof t.card_options==="string"){t.card_options=JSON.parse(t.card_options)}t.card_options.color=t.color||null;t.card_options.widgettype=t.widgettype||null;t.card_options.use_gradient=t.use_gradient||0;t.card_options.point_labels=t.point_labels||0;t.card_options.limit=t.limit||7;if(t.card_id==="markdown_editable"&&!("markdown_content"in t.card_options)){t.card_options.markdown_content=""}if(e===true){if(t.old_id==="0"){return false}var r=$(".grid-stack-item[data-gs-id="+t.old_id+"]");Dashboard.grid.removeWidget(r)}var d=getUuidV4();t.gridstack_id=t.card_id+"_"+d;t.card_options.card_id=t.card_id;t.card_options.gridstack_id=t.gridstack_id;var i=t.card_options;i.force=true;var o=Dashboard.addWidget(t);$.ajax({method:"GET",url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"get_card",dashboard:Dashboard.current_name,card_id:t.card_id,cache_key:Dashboard.cache_key,args:i}}).done((function(a){o.children(".grid-stack-item-content").append(a);Dashboard.fitNumbers(o);Dashboard.animateNumbers(o);Dashboard.saveDashboard()}))},addWidget:function(a){var e=a.gridstack_id;var t=a.x||-1;var r=a.y||-1;var d=a.width||2;var i=a.height||2;var o=a.card_options||{};var s='
';var n=Dashboard.grid.addWidget(s,t,r,d,i,t<0||r<0,undefined,undefined,undefined,undefined,e);n.data("card-options",o);return n},setFilterFromForm:function(a){$(".ui-dialog-content").dialog("close");var e={};$.each(a.serializeArray(),(function(){e[this.name]=this.value}));$.ajax({method:"GET",url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"get_filter",filter_id:e.filter_id}}).done((function(a){$(".filters").append(a);Dashboard.saveFilter(e.filter_id,[])}))},refreshDashboard:function(){var a=$(Dashboard.elem_id+" .grid-stack");Dashboard.grid.removeAll();$.get({url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{dashboard:Dashboard.current_name,action:"get_dashboard_items",embed:Dashboard.embed?1:0}}).done((function(e){a.prepend(e);a.find(".grid-stack-item").each((function(){Dashboard.grid.makeWidget($(this))}));if(Dashboard.ajax_cards){Dashboard.getCardsAjax()}}))},setLastDashboard:function(){$.ajax({method:"POST",url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{dashboard:Dashboard.current_name,page:(location.origin+location.pathname).replace(CFG_GLPI.url_base,""),action:"set_last_dashboard"}})},saveFilter:function(a,e){var t=Dashboard.getFiltersFromStorage();t[a]=e;Dashboard.setFiltersInStorage(t);Dashboard.refreshCardsImpactedByFilter(a)},refreshCardsImpactedByFilter:function(a){$(".dashboard .card.filter-"+a).each((function(){var a=$(this).closest(".grid-stack-item");var e=a.data("gs-id");Dashboard.getCardsAjax("[data-gs-id="+e+"]")}))},saveDashboard:function(a){a=a|false;var e=$.makeArray(Dashboard.element.find(".grid-stack-item:visible:not(.grid-stack-placeholder)")).map((function(a){var e=$(a).data("_gridstack_node");var t=$(a).data("card-options");if(_.keys(Dashboard.markdown_contents).length>0&&e.id in Dashboard.markdown_contents){t.markdown_content=Dashboard.markdown_contents[e.id]}return e?{gridstack_id:e.id,card_id:t.card_id,x:e.x,y:e.y,width:e.width,height:e.height,card_options:t}:null}));$.ajax({method:"POST",url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"save_items",dashboard:Dashboard.current_name,items:e,title:$(".dashboard-name").val()}}).done((function(){if(a){Dashboard.refreshDashboard()}}))},fitNumbers:function(a){a=a||$("body");var e=.96;if(this.dash_width<=700||this.grid.container.hasClass("grid-stack-one-column-mode")){e=1.8}a.find(".big-number").find(".formatted-number").fitText(e);a.find(".summary-numbers").find(".formatted-number").fitText(e-.65);a.find(".summary-numbers").find(".line .label").fitText(e-.2);a.find(".big-number").find(".label").fitText(e-.2)},animateNumbers:function(a){a=a||$("body");a.find(".multiple-numbers, .summary-numbers, .big-number").find(".formatted-number").each((function(){var a=$(this);var e=a.data("precision");var t=a.children(".number");var r=a.children(".suffix").text();jQuery({Counter:0}).animate({Counter:t.text()},{duration:800,easing:"swing",step:function(){t.text(this.Counter.toFixed(e))+r}})}))},setEditMode:function(a){Dashboard.edit_mode=typeof a=="undefined"?true:a;var e=$(Dashboard.elem_id+" .toolbar .fa-edit");e.toggleClass("active",a);Dashboard.element.toggleClass("edit-mode",a);Dashboard.grid.setStatic(!a);sortable(".filters",a?"enable":"disable");if(!Dashboard.edit_mode){var t=$(".grid-stack-item.dirty");if(t.length>0){Dashboard.saveDashboard(true)}}},toggleFullscreenMode:function(a){var e=!a.hasClass("active");Dashboard.element.toggleClass("fullscreen").find(".night-mode").toggle(e);a.toggleClass("active");if(e){Dashboard.setEditMode(false)}if(e){GoInFullscreen(Dashboard.elem_dom)}else{GoOutFullscreen()}},disableFullscreenMode:function(){Dashboard.element.removeClass("fullscreen").find(".night-mode").hide().end().find(".toggle-fullscreen").removeClass("active");GoOutFullscreen()},clone:function(){$.post({url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{dashboard:Dashboard.current_name,action:"clone_dashboard"},dataType:"json"}).done((function(a){Dashboard.addNewDashbardInSelect(a.title,a.key)}))},delete:function(){var a=__("Are you sure you want to delete the dashboard %s ?").replace("%s",Dashboard.current_name);if(window.confirm(a,__("Delete this dashboard"))){$.post({url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"delete_dashboard",dashboard:Dashboard.current_name}}).done((function(){$("#dashboard-"+Dashboard.rand+" .toolbar .dashboard_select").find("option[value='"+Dashboard.current_name+"']").remove().end().prop("selectedIndex",0).trigger("change")}))}},addForm:function(){$(".ui-dialog-content").dialog("close");$('
').load(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"add_new"},(function(){$(this).dialog({width:"auto",modal:true,open:function(){$(this).find("input").first().focus()}})}))},addNew:function(a){$.post({url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"save_new_dashboard",title:a.title,context:Dashboard.context}}).done((function(e){Dashboard.addNewDashbardInSelect(a.title,e);Dashboard.setEditMode(true)}))},addNewDashbardInSelect:function(a,e){var t=new Option(a,e,false,true);$("#dashboard-"+Dashboard.rand+" .toolbar .dashboard_select").append(t).trigger("change")},getCardsAjax:function(a){a=a||"";var e=[];$(".grid-stack-item:not(.lock-bottom)"+a).each((function(){var t=$(this);var r=t.data("card-options");var d=t.data("gs-id");var i=r.card_id||t.data("gs-id");r.gridstack_id=d;if("markdown_content"in r){Dashboard.markdown_contents[d]=r.markdown_content}var o=Dashboard.getFiltersFromStorage();r.apply_filters=o;e.push($.get(CFG_GLPI.root_doc+"/ajax/dashboard.php",{action:"get_card",dashboard:Dashboard.current_name,card_id:i,force:a.length>0?1:0,embed:Dashboard.embed?1:0,args:r,cache_key:Dashboard.cache_key}).then((function(a){t.children(".grid-stack-item-content").html(a);Dashboard.fitNumbers(t);Dashboard.animateNumbers(t)})).fail((function(){t.html("
")})))}));return e},easter:function(){var a=$(Dashboard.elem_id+" .grid-stack .grid-stack-item .card");setInterval((function(){var e="#"+((1<<24)*Math.random()|0).toString(16);var t=Math.floor(Math.random()*a.length)+1;var r=a[t];$(r).css("background-color",e)}),10)},generateCss:function(){var a=Math.floor(this.element.width());var e=a/this.cols;var t=e;var r=a/this.cols+this.cell_margin;var d=100/this.cols;var i=" "+this.elem_id+" .cell-add { width: "+e+"px; height: "+r+"px; } "+this.elem_id+" .grid-guide { background-size: "+e+"px "+r+"px; bottom: "+r+"px; }";for(var o=0;o .grid-stack-item[data-gs-x='"+o+"'] { left: "+s+"%; } "+this.elem_id+" .grid-stack > .grid-stack-item[data-gs-width='"+(o+1)+"'] { min-width: "+d+"%; width: "+n+"%; }"}$("#gs_inline_css_"+this.rand).remove();if(a>700){$("").prop("type","text/css").html(i).appendTo("head")}else{t=60}this.grid.cellHeight(t)},initFilters:function(){if($(".filters").length===0){return}var a=Dashboard.getFiltersFromStorage();$.each(a,(function(e,t){if(Array.isArray(t)&&t.length==0){a[e]=""}}));$.get({url:CFG_GLPI.root_doc+"/ajax/dashboard.php",data:{action:"get_dashboard_filters",filters:a}}).done((function(a){$(".filters").html(a);$(document).trigger("glpiDasbhoardInitFilter");sortable(".filters",{placeholderClass:"filter-placeholder"})[0].addEventListener("sortupdate",(function(a){var e=$(a.detail.destination.items).filter(".filter");var t=Dashboard.getFiltersFromStorage();var r={};$.each(e,(function(){var a=$(this).data("filter-id");r[a]=t[a]}));Dashboard.setFiltersInStorage(r)}));sortable(".filters","disable")}))},getFiltersFromStorage:function(a){a=a||false;var e=JSON.parse(localStorage.getItem("glpi_dashboard_filters"));var t=false;if(e==null){e={};t=true}if("current_name"in Dashboard&&Dashboard.current_name!=null&&!(Dashboard.current_name in e)){e[Dashboard.current_name]={};t=true}if(t){localStorage.setItem("glpi_dashboard_filters",JSON.stringify(e))}if(a){return e}return e[Dashboard.current_name]},setFiltersInStorage:function(a){var e=Dashboard.getFiltersFromStorage(true);if(Dashboard.current_name.length>0){e[Dashboard.current_name]=a}return localStorage.setItem("glpi_dashboard_filters",JSON.stringify(e))}}; \ No newline at end of file diff --git a/js/fileupload.min.js b/js/fileupload.min.js new file mode 100644 index 00000000..5d58d856 --- /dev/null +++ b/js/fileupload.min.js @@ -0,0 +1 @@ +function uploadFile(e,a,t){var n=false;var r=new FormData;r.append("filename[0]",e,e.name);r.append("name","filename");$.ajax({type:"POST",url:CFG_GLPI.root_doc+"/ajax/fileupload.php",data:r,processData:false,contentType:false,dataType:"JSON",async:false,success:function(r){$.each(r,(function(r,i){if(i[0].error===undefined){n="";var o=getFileTag(i);if(isImage(e)){n=o.tag}displayUploadedFile(i[0],o,a,t)}else{n=false;alert(i[0].error)}}))},error:function(e){if("responseText"in e&&e.responseText.length>0){alert(e.responseText)}else{alert(e.statusText)}}});return n}var getFileTag=function(e){var a="";$.ajax({type:"POST",url:CFG_GLPI.root_doc+"/ajax/getFileTag.php",data:{data:e},dataType:"JSON",async:false,success:function(e){a=e[0]},error:function(e){console.warn(e.responseText);a=false}});return a};var fileindex=0;var displayUploadedFile=function(e,a,t,n){n=typeof n==="undefined"||n==null?"filename":n;var r=$(t.targetElm);var i=0;var o;do{r=r.parent();o=r.find(".fileupload_info");i++}while(o.length<=0&&i<30);if(o.length){var l=e.name.split(".").pop();var s=$("

").attr("id",e.id).html(getExtIcon(l)+" "+""+e.display+""+" ("+getSize(e.size)+") ").appendTo(o);$("").attr("type","hidden").attr("name","_"+n+"["+fileindex+"]").attr("value",e.name).appendTo(s);$("").attr("type","hidden").attr("name","_prefix_"+n+"["+fileindex+"]").attr("value",e.prefix).appendTo(s);$("").attr("type","hidden").attr("name","_tag_"+n+"["+fileindex+"]").attr("value",a.name).appendTo(s);var d={0:e.id,1:e.id+"2"};$('').click((function(){deleteImagePasted(d,a.tag,t)})).appendTo(s);fileindex++}};var deleteImagePasted=function(e,a,t){$.each(e,(function(e,a){$("#"+a).remove()}));if(typeof t!=="undefined"&&typeof t.dom!=="undefined"){t.setContent(t.getContent().replace("

"+a+"

",""));var n=new RegExp("#","g");t.dom.remove(a.replace(n,""))}};var insertImgFromFile=function(e,a,t){var n=window.URL||window.webkitURL;var r=n.createObjectURL(a);var i=new RegExp("#","g");var o=$(tinyMCE.activeEditor.getContainer()).height()-60;var l=$(tinyMCE.activeEditor.getContainer()).width()-120;if(window.FileReader&&window.File&&window.FileList&&window.Blob){e.setProgressState(true);var s=new FileReader;s.onload=function(a){var n=new Image;n.src=a.target.result;n.onload=function(){var a=this.width;var n=this.height;var s=0;if(a>l){s=l/a;n=n*s;a=a*s}if(n>o){s=o/n;a=a*s;n=n*s}e.execCommand("mceInsertContent",false,"");e.setProgressState(false)}};s.readAsDataURL(a)}else{console.warn("thanks to update your browser to get preview of image")}};var dataURItoBlob=function(e){var a;if(e.split(",")[0].indexOf("base64")>=0){a=atob(e.split(",")[1])}else{a=unescape(e.split(",")[1])}var t=e.split(",")[0].split(":")[1].split(";")[0];var n=t.split("/")[1];var r=new Uint8Array(a.length);for(var i=0;i").append(e).find("img");if(a.length>0){return a.attr("src")}return""};var insertImageInTinyMCE=function(e,a){var t=$(e.targetElm).attr("name");var n=uploadFile(a,e,t);if(n!==false){insertImgFromFile(e,a,n)}return n};if(typeof tinyMCE!="undefined"){tinyMCE.PluginManager.add("glpi_upload_doc",(function(e){e.on("PastePreProcess",(function(a){if(isImageFromPaste(a.content)){stopEvent(a);var t=extractSrcFromImgTag(a.content);if(t.length){var n=dataURItoBlob(t);insertImageInTinyMCE(e,n)}}else if(isImageBlobFromPaste(a.content)){stopEvent(a);var r=extractSrcFromImgTag(a.content);var i=new XMLHttpRequest;i.open("GET",r,true);i.responseType="arraybuffer";i.onload=function(){if(this.status!==200){console.error("paste error");return}var a=new Uint8Array(this.response);fileType.fromBuffer(a).then((function(t){if(!t||!t.ext||!t.mime){console.error("paste error");return}var n=new Blob([a.buffer],{type:t.mime});n.name="image_paste"+Math.floor(Math.random()*1e7+1)+"."+t.ext;insertImageInTinyMCE(e,n)}))};i.send()}}))}))}$((function(){$(document).bind("dragover",(function(e){e.preventDefault();var a=$(".dropzone");var t;var n=window.dropZoneTimeout;if(!n){a.addClass("dragin")}else{clearTimeout(n)}var r=false;var i=e.target;do{if($(i).hasClass("draghoverable")){r=true;t=$(i);break}i=i.parentNode}while(i!==null);a.removeClass("dragin draghover");if(r){t.addClass("draghover")}}));$(document).bind("drop",(function(e){e.preventDefault();$(".draghoverable").removeClass("draghover");if(typeof e.originalEvent.dataTransfer.files!=="undefined"){$.each(e.originalEvent.dataTransfer.files,(function(a,t){var n=null;var r=$(e.target).find("input[type=file][name]");if(r.length){n=r.attr("name").replace("[]","")}uploadFile(t,{targetElm:$(e.target).find(".fileupload_info")},n)}))}}))})); \ No newline at end of file diff --git a/js/fuzzysearch.min.js b/js/fuzzysearch.min.js new file mode 100644 index 00000000..e6b06c6a --- /dev/null +++ b/js/fuzzysearch.min.js @@ -0,0 +1 @@ +$(document).ready((function(){var e=[];var t={pre:"",post:"",extract:function(e){return e.title}};$(document).bind("keyup","alt+ctrl+g",(function(){$.get(CFG_GLPI.root_doc+"/ajax/fuzzysearch.php",{action:"getHtml"},(function(t){$(document.body).append(t);$.getJSON(CFG_GLPI.root_doc+"/ajax/fuzzysearch.php",{action:"getList"},(function(t){e=t}));$(document).bind("keyup",(function(e){switch(e.key){case"Escape":r();break;case"ArrowUp":u();break;case"ArrowDown":n();break;case"Enter":var t=$("#fuzzysearch .results .selected a").attr("href");if(t==undefined){t=$("#fuzzysearch .results li:first a").attr("href")}if(t!=undefined){document.location=t}break}}));$("#fuzzysearch input").focus().bind("keyup",(function(e){if(e.key!="Escape"&&e.key!="ArrowUp"&&e.key!="ArrowDown"&&e.key!="Enter"){s()}}));$("#fuzzysearch .fa-times").click((function(){r()}));setTimeout((function(){if($("#fuzzysearch .results li").length==0){s()}}),100)}))}));var s=function(){var s=$("#fuzzysearch input").val();$("#fuzzysearch .results").empty();var r=fuzzy.filter(s,e,t);r.map((function(e){$("#fuzzysearch .results").append("
  • "+e.string+"
  • ")}));a()};var r=function(){$("#fuzzysearch, .fuzzymodal").remove()};var a=function(){$("#fuzzysearch .results li:first()").addClass("selected");l()};var c=function(){$("#fuzzysearch .results li:last()").addClass("selected");l()};var n=function(){if($("#fuzzysearch .results .selected").length==0){a()}else{$("#fuzzysearch .results .selected:not(:last-child)").removeClass("selected").next().addClass("selected");l()}};var u=function(){if($("#fuzzysearch .results .selected").length==0){c()}else{$("#fuzzysearch .results .selected:not(:first-child)").removeClass("selected").prev().addClass("selected");l()}};var l=function(){var e=$("#fuzzysearch .results");var t=e.find(".selected");e.scrollTop(e.scrollTop()+t.position().top-e.height()/2+t.height()/2)}})); \ No newline at end of file diff --git a/js/impact.min.js b/js/impact.min.js new file mode 100644 index 00000000..f0185490 --- /dev/null +++ b/js/impact.min.js @@ -0,0 +1 @@ +var cytoscape=window.cytoscape;var GLPIImpact={NODE:1,EDGE:2,DEFAULT:0,FORWARD:1,BACKWARD:2,BOTH:3,EDITION_DEFAULT:1,EDITION_ADD_NODE:2,EDITION_ADD_EDGE:3,EDITION_DELETE:4,EDITION_ADD_COMPOUND:5,EDITION_SETTINGS:6,NODE_ID_SEPERATOR:"::",EDGE_ID_SEPERATOR:"->",DELTA_ACTION_ADD:1,DELTA_ACTION_UPDATE:2,DELTA_ACTION_DELETE:3,ACTION_MOVE:1,ACTION_ADD_NODE:2,ACTION_ADD_EDGE:3,ACTION_ADD_COMPOUND:4,ACTION_ADD_GRAPH:5,ACTION_EDIT_COMPOUND:6,ACTION_REMOVE_FROM_COMPOUND:7,ACTION_DELETE:8,ACTION_EDIT_MAX_DEPTH:9,ACTION_EDIT_IMPACT_VISIBILITY:10,ACTION_EDIT_DEPENDS_VISIBILITY:11,ACTION_EDIT_DEPENDS_COLOR:12,ACTION_EDIT_IMPACT_COLOR:13,ACTION_EDIT_IMPACT_AND_DEPENDS_COLOR:14,DEFAULT_DEPTH:5,MAX_DEPTH:10,NO_DEPTH_LIMIT:1e4,initialState:null,directionVisibility:{},defaultColors:{},edgeColors:{},cy:null,impactContainer:null,editionMode:null,startNode:null,maxDepth:this.DEFAULT_DEPTH,readonly:true,fullscreen:false,selectedItemtype:"",addAssetPage:0,undoStack:[],redoStack:[],no_positions:[],badgesHitboxes:[],selectors:{ongoingDialog:"#ongoing_dialog",editCompoundDialog:"#edit_compound_dialog",compoundName:"input[name=compound_name]",compoundColor:"input[name=compound_color]",dependsColor:"input[name=depends_color]",impactColor:"input[name=impact_color]",impactAndDependsColor:"input[name=impact_and_depends_color]",toggleImpact:"#toggle_impact",toggleDepends:"#toggle_depends",maxDepth:"#max_depth",maxDepthView:"#max_depth_view",helpText:"#help_text",save:"#save_impact",addNode:"#add_node",addEdge:"#add_edge",addCompound:"#add_compound",deleteElement:"#delete_element",export:"#export_graph",expandToolbar:"#expand_toolbar",toggleFullscreen:"#toggle_fullscreen",impactSettings:"#impact_settings",sideToggle:".impact-side-toggle",sideToggleIcon:".impact-side-toggle i",undo:"#impact_undo",redo:"#impact_redo",side:".impact-side",sidePanel:".impact-side-panel",sideAddNode:".impact-side-add-node",sideSettings:".impact-side-settings",sideSearch:".impact-side-search",sideSearchSpinner:".impact-side-search-spinner",sideSearchNoResults:".impact-side-search-no-results",sideSearchMore:".impact-side-search-more",sideSearchResults:".impact-side-search-results",sideSearchSelectItemtype:".impact-side-select-itemtype",sideSearchFilterItemtype:"#impact-side-filter-itemtypes",sideFilterAssets:"#impact-side-filter-assets",sideFilterItem:".impact-side-filter-itemtypes-item",form:"form[name=form_impact_network]",dropPreview:".impact-drop-preview"},eventData:{addEdgeStart:null,tmpEles:null,lastClicktimestamp:null,lastClickTarget:null,boxSelected:[],grabNodeStart:null,boundingBox:null,showPointerForBadge:false,previousCursor:"default",ctrlDown:false},addToUndo:function(e,t){this.undoStack.push({code:e,data:t});$(this.selectors.undo).removeClass("impact-disabled");this.redoStack=[];$(this.selectors.redo).addClass("impact-disabled")},undo:function(){if(this.undoStack.length===0){return}var e=this.undoStack.pop();var t=e.data;this.redoStack.push(e);$(this.selectors.redo).removeClass("impact-disabled");switch(e.code){case this.ACTION_MOVE:this.cy.filter("node"+this.makeIDSelector(t.node)).position({x:t.oldPosition.x,y:t.oldPosition.y});if(t.newParent!==null){this.cy.filter("node"+this.makeIDSelector(t.node)).move({parent:null})}break;case this.ACTION_ADD_NODE:this.cy.getElementById(t.toAdd.data.id).remove();break;case this.ACTION_ADD_EDGE:this.cy.remove("edge"+this.makeIDSelector(t.id));this.updateFlags();break;case this.ACTION_ADD_COMPOUND:t.children.forEach((function(e){GLPIImpact.cy.filter("node"+GLPIImpact.makeIDSelector(e)).move({parent:null})}));this.cy.remove("node"+this.makeIDSelector(t.data.id));this.updateFlags();break;case this.ACTION_ADD_GRAPH:t.edges.forEach((function(e){GLPIImpact.cy.getElementById(e.id).remove()}));t.compounds.forEach((function(e){e.compoundChildren.forEach((function(e){GLPIImpact.cy.getElementById(e).move({parent:null})}));GLPIImpact.cy.getElementById(e.compoundData.id).remove()}));t.nodes.forEach((function(e){GLPIImpact.cy.getElementById(e.nodeData.id).remove()}));this.updateFlags();break;case this.ACTION_EDIT_COMPOUND:this.cy.filter("node"+this.makeIDSelector(t.id)).data({label:t.oldLabel,color:t.oldColor});GLPIImpact.cy.trigger("change");break;case this.ACTION_REMOVE_FROM_COMPOUND:if(t.children.length<=2){this.cy.add({group:"nodes",data:t.compoundData});t.children.forEach((function(e){GLPIImpact.cy.getElementById(e).move({parent:t.compoundData.id})}))}else{this.cy.getElementById(t.nodeData.id).move({parent:t.compoundData.id})}break;case this.ACTION_DELETE:t.nodes.forEach((function(e){var t=GLPIImpact.cy.add({group:"nodes",data:e.nodeData});t.position(e.nodePosition)}));t.compounds.forEach((function(e){GLPIImpact.cy.add({group:"nodes",data:e.compoundData});e.compoundChildren.forEach((function(t){GLPIImpact.cy.getElementById(t).move({parent:e.compoundData.id})}))}));t.edges.forEach((function(e){GLPIImpact.cy.add({group:"edges",data:e})}));this.updateFlags();break;case this.ACTION_EDIT_IMPACT_VISIBILITY:this.toggleVisibility(this.FORWARD);$(GLPIImpact.selectors.toggleImpact).prop("checked",!$(GLPIImpact.selectors.toggleImpact).prop("checked"));break;case this.ACTION_EDIT_DEPENDS_VISIBILITY:this.toggleVisibility(this.BACKWARD);$(GLPIImpact.selectors.toggleDepends).prop("checked",!$(GLPIImpact.selectors.toggleDepends).prop("checked"));break;case this.ACTION_EDIT_DEPENDS_COLOR:this.setEdgeColors({backward:t.oldColor});$(GLPIImpact.selectors.dependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BACKWARD]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_IMPACT_COLOR:this.setEdgeColors({forward:t.oldColor});$(GLPIImpact.selectors.impactColor).val(GLPIImpact.edgeColors[GLPIImpact.FORWARD]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_IMPACT_AND_DEPENDS_COLOR:this.setEdgeColors({both:t.oldColor});$(GLPIImpact.selectors.impactAndDependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BOTH]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_MAX_DEPTH:this.setDepth(t.oldDepth);$(GLPIImpact.selectors.maxDepth).val(t.oldDepth);break}if(this.undoStack.length===0){$(this.selectors.undo).addClass("impact-disabled")}},redo:function(){if(this.redoStack.length===0){return}var e=this.redoStack.pop();var t=e.data;this.undoStack.push(e);$(this.selectors.undo).removeClass("impact-disabled");switch(e.code){case this.ACTION_MOVE:this.cy.filter("node"+this.makeIDSelector(t.node)).position({x:t.newPosition.x,y:t.newPosition.y});if(t.newParent!==null){this.cy.filter("node"+this.makeIDSelector(t.node)).move({parent:t.newParent})}break;case this.ACTION_ADD_NODE:this.cy.add(t.toAdd);break;case this.ACTION_ADD_EDGE:this.cy.add({group:"edges",data:t});this.updateFlags();break;case this.ACTION_ADD_COMPOUND:this.cy.add({group:"nodes",data:t.data});t.children.forEach((function(e){GLPIImpact.cy.filter("node"+GLPIImpact.makeIDSelector(e)).move({parent:t.data.id})}));this.updateFlags();break;case this.ACTION_ADD_GRAPH:t.nodes.forEach((function(e){var t=GLPIImpact.cy.add({group:"nodes",data:e.nodeData});t.position(e.nodePosition)}));t.compounds.forEach((function(e){GLPIImpact.cy.add({group:"nodes",data:e.compoundData});e.compoundChildren.forEach((function(t){GLPIImpact.cy.getElementById(t).move({parent:e.compoundData.id})}))}));t.edges.forEach((function(e){GLPIImpact.cy.add({group:"edges",data:e})}));this.updateFlags();break;case this.ACTION_EDIT_COMPOUND:this.cy.filter("node"+this.makeIDSelector(t.id)).data({label:t.label,color:t.color});GLPIImpact.cy.trigger("change");break;case this.ACTION_REMOVE_FROM_COMPOUND:if(t.children.length<=2){t.children.forEach((function(e){GLPIImpact.cy.getElementById(e).move({parent:null})}));this.cy.getElementById(t.compoundData.id).remove()}else{this.cy.getElementById(t.nodeData.id).move({parent:null})}break;case this.ACTION_DELETE:t.edges.forEach((function(e){GLPIImpact.cy.getElementById(e.id).remove()}));t.compounds.forEach((function(e){e.compoundChildren.forEach((function(e){GLPIImpact.cy.getElementById(e).move({parent:null})}));GLPIImpact.cy.getElementById(e.compoundData.id).remove()}));t.nodes.forEach((function(e){GLPIImpact.cy.getElementById(e.id).remove()}));this.updateFlags();break;case this.ACTION_EDIT_IMPACT_VISIBILITY:this.toggleVisibility(this.FORWARD);$(GLPIImpact.selectors.toggleImpact).prop("checked",!$(GLPIImpact.selectors.toggleImpact).prop("checked"));break;case this.ACTION_EDIT_DEPENDS_VISIBILITY:this.toggleVisibility(this.BACKWARD);$(GLPIImpact.selectors.toggleDepends).prop("checked",!$(GLPIImpact.selectors.toggleDepends).prop("checked"));break;case this.ACTION_EDIT_DEPENDS_COLOR:this.setEdgeColors({backward:t.newColor});$(GLPIImpact.selectors.dependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BACKWARD]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_IMPACT_COLOR:this.setEdgeColors({forward:t.newColor});$(GLPIImpact.selectors.forwardColor).val("set",GLPIImpact.edgeColors[GLPIImpact.FORWARD]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_IMPACT_AND_DEPENDS_COLOR:this.setEdgeColors({both:t.newColor});$(GLPIImpact.selectors.impactAndDependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BOTH]);this.updateStyle();this.cy.trigger("change");break;case this.ACTION_EDIT_MAX_DEPTH:this.setDepth(t.newDepth);$(GLPIImpact.selectors.maxDepth).val(t.newDepth);break}if(this.redoStack.length===0){$(this.selectors.redo).addClass("impact-disabled")}},getHiddenSelector:function(){var e="[depth > "+this.maxDepth+"][depth !> "+Number.MAX_SAFE_INTEGER+"]";var t;var a=this.directionVisibility[this.FORWARD];var o=this.directionVisibility[this.BACKWARD];if(a&&o){t="[flag = -1]"}else if(a&&!o){t="[flag = "+this.BACKWARD+"]"}else if(!a&&o){t="[flag = "+this.FORWARD+"]"}else{t="[flag != 0]"}return t+", "+e},getNetworkStyle:function(){return[{selector:"core",style:{"selection-box-opacity":"0.2","selection-box-border-width":"0","selection-box-color":"#24acdf"}},{selector:"node:parent",style:{padding:"30px",shape:"roundrectangle","border-width":"1px","background-opacity":"0.5","font-size":"1.1em","background-color":"#d2d2d2","text-margin-y":"20px","text-opacity":.7}},{selector:"node:parent[label]",style:{label:"data(label)"}},{selector:"node:parent[color]",style:{"border-color":"data(color)","background-color":"data(color)"}},{selector:"node[image]",style:{label:"data(label)",shape:"rectangle","background-color":"#666","background-image":"data(image)","background-fit":"contain","background-opacity":"0","font-size":"1em","text-opacity":.7,"overlay-opacity":.01,"overlay-color":"white"}},{selector:"node[highlight=1]",style:{"font-weight":"bold"}},{selector:":selected",style:{"overlay-opacity":.2,"overlay-color":"gray"}},{selector:"[todelete=1]:selected",style:{"overlay-opacity":.2,"overlay-color":"red"}},{selector:GLPIImpact.getHiddenSelector(),style:{display:"none"}},{selector:'[id="tmp_node"]',style:{opacity:0}},{selector:"edge",style:{width:1,"line-color":this.edgeColors[0],"target-arrow-color":this.edgeColors[0],"target-arrow-shape":"triangle","arrow-scale":.7,"curve-style":"bezier","source-endpoint":"outside-to-node-or-label","target-endpoint":"outside-to-node-or-label","source-distance-from-node":"2px","target-distance-from-node":"2px"}},{selector:'edge[target="tmp_node"]',style:{"source-endpoint":"inside-to-node","target-endpoint":"inside-to-node","source-distance-from-node":"0px","target-distance-from-node":"0px"}},{selector:"[flag="+GLPIImpact.FORWARD+"]",style:{"line-color":this.edgeColors[GLPIImpact.FORWARD],"target-arrow-color":this.edgeColors[GLPIImpact.FORWARD]}},{selector:"[flag="+GLPIImpact.BACKWARD+"]",style:{"line-color":this.edgeColors[GLPIImpact.BACKWARD],"target-arrow-color":this.edgeColors[GLPIImpact.BACKWARD]}},{selector:"[flag="+GLPIImpact.BOTH+"]",style:{"line-color":this.edgeColors[GLPIImpact.BOTH],"target-arrow-color":this.edgeColors[GLPIImpact.BOTH]}}]},getPresetLayout:function(e){this.no_positions=[];return{name:"preset",positions:function(t){var a=0;var o=0;if(!t.isParent()&&e[t.data("id")]!==undefined){a=parseFloat(e[t.data("id")].x);o=parseFloat(e[t.data("id")].y)}return{x:a,y:o}}}},generateMissingPositions:function(){if(this.cy.filter("node:childless").length==this.no_positions.length){this.no_positions.pop()}var e=[];this.no_positions.forEach((function(t){e.push(t.data("id"))}));var t=[];var a=[];while(this.no_positions.length!==0){this.no_positions.forEach((function(o,i){var c=false;o.neighborhood().forEach((function(t){if(c){return}if(!t.isNode()){return}if(e.indexOf(t.data("id"))===-1||a.indexOf(t.data("id"))!==-1){c=true}}));if(c){a.push(o.data("id"));t.push(o);GLPIImpact.no_positions.splice(i,1)}}))}this.no_positions=t;this.no_positions.forEach((function(t){var a=null;t.neighborhood().forEach((function(o){if(a!==null){return}if(!o.isNode()){return}if(o.data("id")==t.data("id")){return}if(e.indexOf(o.data("id"))!==-1){return}a=o}));if(a===null){return}var o=null;var i=Number.MAX_SAFE_INTEGER;a.neighborhood().forEach((function(e){if(!e.isNode()){return}var t=GLPIImpact.getDistance(a.position(),e.position());if(td.x&&t.y1-20d.y){p=false}}));if(p){t.position(d);var l=e.indexOf(t.data("id"));e.splice(l,1);n=true;break}if(!I&&r!==0){r=r*-1;I=true}else{if(r<0){r=0-r;I=false}r+=15}}i+=30}}));this.no_positions=[]},getDagreLayout:function(){return{name:"dagre",rankDir:"LR",fit:false}},getCurrentState:function(){var e={edges:{},compounds:{},items:{}};GLPIImpact.cy.edges().forEach((function(t){e.edges[t.data("id")]={source:t.data("source"),target:t.data("target")}}));GLPIImpact.cy.filter("node:parent").forEach((function(t){e.compounds[t.data("id")]={name:t.data("label"),color:t.data("color")}}));GLPIImpact.cy.filter("node:childless").forEach((function(t){e.items[t.data("id")]={impactitem_id:t.data("impactitem_id"),parent:t.data("parent"),position:t.position()}}));return e},computeEdgeDelta:function(e){var t={};Object.keys(GLPIImpact.initialState.edges).forEach((function(a){var o=GLPIImpact.initialState.edges[a];if(Object.prototype.hasOwnProperty.call(e,a)){delete e[a]}else{var i=o.source.split(GLPIImpact.NODE_ID_SEPERATOR);var c=o.target.split(GLPIImpact.NODE_ID_SEPERATOR);t[a]={action:GLPIImpact.DELTA_ACTION_DELETE,itemtype_source:i[0],items_id_source:i[1],itemtype_impacted:c[0],items_id_impacted:c[1]}}}));Object.keys(e).forEach((function(a){var o=e[a];var i=o.source.split(GLPIImpact.NODE_ID_SEPERATOR);var c=o.target.split(GLPIImpact.NODE_ID_SEPERATOR);t[a]={action:GLPIImpact.DELTA_ACTION_ADD,itemtype_source:i[0],items_id_source:i[1],itemtype_impacted:c[0],items_id_impacted:c[1]}}));return t},computeCompoundsDelta:function(e){var t={};Object.keys(GLPIImpact.initialState.compounds).forEach((function(a){var o=GLPIImpact.initialState.compounds[a];if(Object.prototype.hasOwnProperty.call(e,a)){var i=e[a];if(o.name!=i.name||o.color!=i.color){t[a]={action:GLPIImpact.DELTA_ACTION_UPDATE,name:i.name,color:i.color}}delete e[a]}else{t[a]={action:GLPIImpact.DELTA_ACTION_DELETE}}}));Object.keys(e).forEach((function(a){t[a]={action:GLPIImpact.DELTA_ACTION_ADD,name:e[a].name,color:e[a].color}}));return t},computeContext:function(e){var t={};Object.keys(e).forEach((function(a){var o=e[a];t[a]={x:o.position.x,y:o.position.y}}));return{node_id:this.startNode,positions:JSON.stringify(t),zoom:GLPIImpact.cy.zoom(),pan_x:GLPIImpact.cy.pan().x,pan_y:GLPIImpact.cy.pan().y,impact_color:GLPIImpact.edgeColors[GLPIImpact.FORWARD],depends_color:GLPIImpact.edgeColors[GLPIImpact.BACKWARD],impact_and_depends_color:GLPIImpact.edgeColors[GLPIImpact.BOTH],show_depends:GLPIImpact.directionVisibility[GLPIImpact.BACKWARD],show_impact:GLPIImpact.directionVisibility[GLPIImpact.FORWARD],max_depth:GLPIImpact.maxDepth}},computeItemsDelta:function(e){var t={};Object.keys(e).forEach((function(a){var o=e[a];t[o.impactitem_id]={action:GLPIImpact.DELTA_ACTION_UPDATE,parent_id:o.parent};if(o.parent==undefined){o.parent=0}t[o.impactitem_id]={action:GLPIImpact.DELTA_ACTION_UPDATE,parent_id:o.parent}}));return t},computeDelta:function(){var e={};var t=this.getCurrentState();e.edges=this.computeEdgeDelta(t.edges);e.compounds=this.computeCompoundsDelta(t.compounds);e.items=this.computeItemsDelta(t.items);e.context=this.computeContext(t.items);return e},getContextMenuItems:function(){return[{id:"goTo",content:''+__("Go to"),tooltipText:__("Open this element in a new tab"),selector:"node[link]",onClickFunction:this.menuOnGoTo},{id:"showOngoing",content:''+__("Show ongoing tickets"),tooltipText:__("Show ongoing tickets for this item"),selector:"node[hasITILObjects=1]",onClickFunction:this.menuOnShowOngoing},{id:"editCompound",content:''+__("Group properties..."),tooltipText:__("Set name and/or color for this group"),selector:"node:parent",onClickFunction:this.menuOnEditCompound,show:!this.readonly},{id:"removeFromCompound",content:''+__("Remove from group"),tooltipText:__("Remove this asset from the group"),selector:"node:child",onClickFunction:this.menuOnRemoveFromCompound,show:!this.readonly},{id:"delete",content:''+__("Delete"),tooltipText:__("Delete element"),selector:"node, edge",onClickFunction:this.menuOnDelete,show:!this.readonly}]},addNode:function(e,t,a){var o={itemtype:t,items_id:e};var i=GLPIImpact.makeID(GLPIImpact.NODE,o.itemtype,o.items_id);if(GLPIImpact.cy.filter('node[id="'+i+'"]').length>0){alert(__("This asset already exists."));return}$.when(GLPIImpact.buildGraphFromNode(o)).done((function(e,t){GLPIImpact.insertGraph(e,t,{id:i,x:a.x,y:a.y});GLPIImpact.updateFlags()})).fail((function(){alert(__("Unexpected error."))}))},getOngoingDialog:function(){return{title:__("Ongoing tickets"),modal:true,position:{my:"center",at:"center",of:GLPIImpact.impactContainer},buttons:[]}},getEditCompoundDialog:function(e){var t=e.data("label");var a=e.data("color");$(GLPIImpact.selectors.compoundName).val(t);$(GLPIImpact.selectors.compoundColor).val(a);var o={text:__("Save"),click:function(){e.data("label",$(GLPIImpact.selectors.compoundName).val());e.data("color",$(GLPIImpact.selectors.compoundColor).val());$(this).dialog("close");GLPIImpact.cy.trigger("change");if(GLPIImpact.eventData.newCompound==null){GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_COMPOUND,{id:e.data("id"),label:e.data("label"),color:e.data("color"),oldLabel:t,oldColor:a})}}};return{title:__("Edit group"),modal:true,position:{my:"center",at:"center",of:GLPIImpact.impactContainer},buttons:[o],close:function(){var e=$(GLPIImpact.selectors.compoundName).val();var t=$(GLPIImpact.selectors.compoundColor).val();if(GLPIImpact.eventData.newCompound!=null){GLPIImpact.eventData.newCompound.data.label=e;GLPIImpact.eventData.newCompound.data.color=t;GLPIImpact.addToUndo(GLPIImpact.ACTION_ADD_COMPOUND,_.cloneDeep(GLPIImpact.eventData.newCompound));GLPIImpact.eventData.newCompound=null}}}},prepareNetwork:function(e,t,a){this.impactContainer=e;this.directionVisibility[GLPIImpact.FORWARD]=true;this.directionVisibility[GLPIImpact.BACKWARD]=true;this.defaultColors=t;this.setEdgeColors(t);this.startNode=a;this.initToolbar()},buildNetwork:function(e,t,a){var o;GLPIImpact.showDefaultWorkspaceStatus();if(t.impactcontexts_id!==undefined&&t.impactcontexts_id!==0){this.setEdgeColors({forward:t.impact_color,backward:t.depends_color,both:t.impact_and_depends_color});this.maxDepth=t.max_depth;o=this.getPresetLayout(JSON.parse(t.positions))}else{this.setEdgeColors(this.defaultColors);this.maxDepth=this.DEFAULT_DEPTH;o=this.getDagreLayout()}this.cy=cytoscape({container:this.impactContainer,elements:e,style:this.getNetworkStyle(),layout:o,wheelSensitivity:.25});this.generateMissingPositions();this.cy.minZoom(.5);this.initialState=this.getCurrentState();if(!a){this.enableGraphEdition()}this.cy.filter("node[start]").data({highlight:1,start_node:1});this.cy.contextMenus({menuItems:this.getContextMenuItems(),menuItemClasses:[],contextMenuClasses:[]});this.cy.gridGuide({gridStackOrder:0,snapToGridOnRelease:false,snapToGridDuringDrag:true,gridSpacing:12,drawGrid:true,panGrid:true});this.cy.boxSelectionEnabled(false);if(t.impactcontexts_id!==undefined&&t.impactcontexts_id!==0){if(!parseInt(t.show_depends)){$(GLPIImpact.selectors.toggleImpact).prop("checked",false)}if(!parseInt(t.show_impact)){$(GLPIImpact.selectors.toggleDepends).prop("checked",false)}this.updateFlags();if(t.zoom!="0"){this.cy.viewport({zoom:parseFloat(t.zoom),pan:{x:parseFloat(t.pan_x),y:parseFloat(t.pan_y)}});var i=GLPIImpact.cy.extent();var c=true;GLPIImpact.cy.nodes().forEach((function(e){if(e.position().x>i.x1&&e.position().xi.x1&&e.position().y2.3){this.cy.zoom(2.3);this.cy.center()}}}else{this.cy.fit();if(this.cy.zoom()>2.3){this.cy.zoom(2.3);this.cy.center()}}}else{this.cy.fit();if(this.cy.zoom()>2.3){this.cy.zoom(2.3);this.cy.center()}}this.cy.on("mousedown","node",this.nodeOnMousedown);this.cy.on("mouseup",this.onMouseUp);this.cy.on("mousemove",this.onMousemove);this.cy.on("mouseover",this.onMouseover);this.cy.on("mouseout",this.onMouseout);this.cy.on("click",this.onClick);this.cy.on("click","edge",this.edgeOnClick);this.cy.on("click","node",this.nodeOnClick);this.cy.on("box",this.onBox);this.cy.on("drag add remove change",this.onChange);this.cy.on("doubleClick",this.onDoubleClick);this.cy.on("remove",this.onRemove);this.cy.on("grabon",this.onGrabOn);this.cy.on("freeon",this.onFreeOn);this.initCanvasOverlay();$(document).keydown(this.onKeyDown);$(document).keyup(this.onKeyUp);this.setEditionMode(GLPIImpact.EDITION_DEFAULT);var s=GLPIImpact.maxDepth;if(GLPIImpact.maxDepth>=GLPIImpact.MAX_DEPTH){s="infinity"}$(GLPIImpact.selectors.maxDepthView).html(s);$(GLPIImpact.selectors.maxDepth).val(GLPIImpact.maxDepth);$(GLPIImpact.selectors.dependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BACKWARD]);$(GLPIImpact.selectors.impactColor).val(GLPIImpact.edgeColors[GLPIImpact.FORWARD]);$(GLPIImpact.selectors.impactAndDependsColor).val(GLPIImpact.edgeColors[GLPIImpact.BOTH])},enableGraphEdition:function(){$(this.selectors.save).show();$(this.selectors.addNode).show();$(this.selectors.addEdge).show();$(this.selectors.addCompound).show();$(this.selectors.deleteElement).show();$(this.selectors.impactSettings).show();$(this.selectors.sideToggle).show();this.readonly=false},makeID:function(e,t,a){switch(e){case GLPIImpact.NODE:return t+"::"+a;case GLPIImpact.EDGE:return t+"->"+a}return null},makeIDSelector:function(e){return"[id='"+e+"']"},updateStyle:function(){this.cy.style(this.getNetworkStyle());this.cy.edges().forEach((function(e){var t=GLPIImpact.cy.filter(GLPIImpact.makeIDSelector(e.data("source")));var a=GLPIImpact.cy.filter(GLPIImpact.makeIDSelector(e.data("target")));if(t.visible()&&a.visible()){e.data("depth",0)}else{e.data("depth",Number.MAX_VALUE)}}))},updateFlags:function(){this.cy.elements().forEach((function(e){e.data("flag",GLPIImpact.DEFAULT)}));var e=this.cy.elements().dijkstra(this.makeIDSelector(this.startNode),(function(){return 1}),true);this.cy.$("node:childless").forEach((function(t){var a=e.distanceTo(t);t.data("depth",a);if(a!==Infinity){t.data("flag",t.data("flag")|GLPIImpact.FORWARD)}}));this.cy.$("node:childless").forEach((function(e){if(e.data("id")==GLPIImpact.startNode){return}var t=GLPIImpact.cy.elements().dijkstra(e,(function(){return 1}),true);var a=t.distanceTo(GLPIImpact.makeIDSelector(GLPIImpact.startNode));if(e.data("depth")>a){e.data("depth",a)}if(a!==Infinity){e.data("flag",e.data("flag")|GLPIImpact.BACKWARD)}}));GLPIImpact.cy.$(GLPIImpact.makeIDSelector(GLPIImpact.startNode)).data("flag",this.BOTH);this.cy.filter("node:parent").forEach((function(e){var t=Infinity;var a=GLPIImpact.DEFAULT;e.children().forEach((function(e){var o=e.data("depth");if(o=GLPIImpact.MAX_DEPTH){e="infinity";GLPIImpact.maxDepth=GLPIImpact.NO_DEPTH_LIMIT}$(GLPIImpact.selectors.maxDepthView).html(e);GLPIImpact.updateStyle();GLPIImpact.cy.trigger("change")},buildGraphFromNode:function(e){e.action="load";var t=jQuery.Deferred();$.ajax({type:"GET",url:CFG_GLPI.root_doc+"/ajax/impact.php",dataType:"json",data:e,success:function(e){t.resolve(JSON.parse(e.graph),JSON.parse(e.params))},error:function(){t.reject()}});return t.promise()},getDistance:function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},insertGraph:function(e,t,a){var o=[];var i=this.cy.filter().boundingBox();var c;for(c=0;c0){continue}o.push(e[c]);if(e[c].group=="nodes"&&e[c].data.color===undefined){var n=e[c].data.id.split(GLPIImpact.NODE_ID_SEPERATOR);var r=n[0];var I=n[1];$("p[data-id="+I+"][data-type='"+r+"']").remove()}}if(o.length==1){o[0].position={x:a.x,y:a.y};this.cy.add(o);this.addToUndo(this.ACTION_ADD_NODE,{toAdd:o[0]});return}var d=this.cy.add(o);var p;if(t.positions===undefined){p=this.getDagreLayout()}else{p=this.getPresetLayout(JSON.parse(t.positions))}var l=d.layout(p);l.run();this.generateMissingPositions();var m=d.boundingBox();var u={x:(m.x1+m.x2)/2,y:(m.y1+m.y2)/2};var h=[a.x-u.x,a.y-u.y];d.nodes().forEach((function(e){if(!e.isParent()){e.position({x:e.position().x+h[0],y:e.position().y+h[1]})}}));m=d.boundingBox();if(!(i.x1>m.x2||m.x1>i.x2||i.y1>m.y2||m.y1>i.y2)){u={x:Math.round((m.x1+m.x2)/2),y:Math.round((m.y1+m.y2)/2)};var P=[[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]];var L=[{a:{x:Math.round(i.x1),y:Math.round(i.y1)},b:{x:Math.round(i.x2),y:Math.round(i.y1)}},{a:{x:Math.round(i.x2),y:Math.round(i.y1)},b:{x:Math.round(i.x1),y:Math.round(i.y2)}},{a:{x:Math.round(i.x1),y:Math.round(i.y2)},b:{x:Math.round(i.x2),y:Math.round(i.y2)}},{a:{x:Math.round(i.x2),y:Math.round(i.y2)},b:{x:Math.round(i.x1),y:Math.round(i.y1)}}];c=0;var G;while(c<5e4){P.forEach((function(e){if(G!==undefined){return}var t={x:u.x+e[0]*c,y:u.y+e[1]*c};L.forEach((function(e){if(G!==undefined){return}if(GLPIImpact.getDistance(t,e.a)+GLPIImpact.getDistance(t,e.b)==GLPIImpact.getDistance(e.a,e.b)){G={x:t.x,y:t.y}}}))}));c++;if(G!==undefined){break}}if(G!==undefined){u={x:(i.x1+i.x2)/2,y:(i.y1+i.y2)/2};var D=[{x:m.x1,y:m.y1},{x:m.x1,y:m.y2},{x:m.x2,y:m.y1},{x:m.x2,y:m.y2}];var g;var f;D.forEach((function(e){var t=GLPIImpact.getDistance(e,u);if(f==undefined||t");var i=$("#impact_download");switch(e){case"png":a="impact.png";o=this.cy.png({bg:t?"transparent":"white"});break;case"jpeg":a="impact.jpeg";o=this.cy.jpg();break}i.prop("download",a);i.prop("href",o);i[0].click();i.remove()},getNodeAt:function(e,t){var a=this.cy.nodes();for(var o=0;oe.x&&a[o].boundingBox().y1e.y){if(t(a[o])){return a[o]}}}return null},showCleanWorkspaceStatus:function(){$(GLPIImpact.selectors.save).removeClass("dirty");$(GLPIImpact.selectors.save).removeClass("clean");$(GLPIImpact.selectors.save).addClass("clean");$(GLPIImpact.selectors.save).find("i").removeClass("fas fa-exclamation-triangle");$(GLPIImpact.selectors.save).find("i").addClass("fas fa-check")},showDirtyWorkspaceStatus:function(){$(GLPIImpact.selectors.save).removeClass("clean");$(GLPIImpact.selectors.save).addClass("dirty");$(GLPIImpact.selectors.save).find("i").removeClass("fas fa-check");$(GLPIImpact.selectors.save).find("i").addClass("fas fa-exclamation-triangle")},showDefaultWorkspaceStatus:function(){$(GLPIImpact.selectors.save).removeClass("clean");$(GLPIImpact.selectors.save).removeClass("dirty")},buildOngoingDialogContent:function(e){return this.listElements(__("Requests"),e.requests,"ticket")+this.listElements(__("Incidents"),e.incidents,"ticket")+this.listElements(__("Changes"),e.changes,"change")+this.listElements(__("Problems"),e.problems,"problem")},listElements:function(e,t,a){var o="";if(t.length>0){o+="

    "+e+"

    ";o+="
      ";t.forEach((function(e){var t=CFG_GLPI.root_doc+"/front/"+a+".form.php?id="+e.id;o+='
    • '+e.name+"
    • "}));o+="
    "}return o},addCompoundFromSelection:_.debounce((function(){if(GLPIImpact.eventData.boxSelected.length<2){alert(__("You need to select at least 2 assets to make a group"))}else{var e=GLPIImpact.cy.add({group:"nodes",data:{color:"#dadada"}});GLPIImpact.eventData.newCompound={data:{id:e.data("id")},children:[]};GLPIImpact.eventData.boxSelected.forEach((function(t){t.move({parent:e.data("id")});GLPIImpact.eventData.newCompound.children.push(t.data("id"))}));$(GLPIImpact.selectors.editCompoundDialog).dialog(GLPIImpact.getEditCompoundDialog(e));GLPIImpact.setEditionMode(GLPIImpact.EDITION_DEFAULT)}GLPIImpact.eventData.boxSelected=[];GLPIImpact.cy.filter(":selected").unselect()}),100,false),deleteFromGraph:function(e){if(e.data("id")==GLPIImpact.startNode){alert("Can't remove starting node");return}var t={edges:[],nodes:[],compounds:[]};if(e.isEdge()){t.edges.push(_.clone(e.data()));e.remove()}else if(e.isParent()){t.compounds.push({compoundData:_.clone(e.data()),compoundChildren:e.children().map((function(e){return e.data("id")}))});e.children().move({parent:null});e.remove()}else{if(!e.isOrphan()&&e.parent().children().length<=2){var a=e.parent();t.compounds.push({compoundData:_.clone(a.data()),compoundChildren:a.children().map((function(e){return e.data("id")}))});a.children().move({parent:null});a.remove()}t.nodes.push({nodeData:_.clone(e.data()),nodePosition:_.clone(e.position())});t.edges=t.edges.concat(e.connectedEdges((function(e){var a=false;t.edges.forEach((function(t){if(t.id==e.data("id")){a=true}}));if(GLPIImpact.eventData.multipleDeletion!=null){GLPIImpact.eventData.multipleDeletion.edges.forEach((function(t){if(t.id==e.data("id")){a=true}}))}return!a})).map((function(e){return e.data()})));e.remove()}GLPIImpact.updateFlags();if(this.eventData.multipleDeletion!=null){this.eventData.multipleDeletion.edges=this.eventData.multipleDeletion.edges.concat(t.edges);this.eventData.multipleDeletion.nodes=this.eventData.multipleDeletion.nodes.concat(t.nodes);this.eventData.multipleDeletion.compounds=this.eventData.multipleDeletion.compounds.concat(t.compounds)}else{this.addToUndo(this.ACTION_DELETE,t)}},toggleFullscreen:function(){this.fullscreen=!this.fullscreen;$(this.selectors.toggleFullscreen).toggleClass("active");$(this.impactContainer).toggleClass("fullscreen");$(this.selectors.side).toggleClass("fullscreen");if(this.fullscreen){$(this.impactContainer).children("canvas:eq(0)").css({height:"100vh"});$("html, body").css("overflow","hidden")}else{$(this.impactContainer).children("canvas:eq(0)").css({height:"unset"});$("html, body").css("overflow","unset")}GLPIImpact.cy.resize()},checkBadgeHitboxes:function(e,t,a){var o=false;var i=5*GLPIImpact.cy.zoom();GLPIImpact.badgesHitboxes.forEach((function(c){if(o){return}var s=c.position;var n={x1:s.x-i,x2:s.x+i,y1:s.y-i,y2:s.y+i};if(n.x1e.x&&n.y1e.y){o=true;if(t){var r=c.target+"?is_deleted=0&as_map=0&search=Search&itemtype=Ticket";r+="&criteria[0][link]=AND&criteria[0][field]=13&criteria[0][searchtype]=contains&criteria[0][value]="+c.id;r+="&criteria[1][link]=AND&criteria[1][field]=131&criteria[1][searchtype]=equals&criteria[1][value]="+c.itemtype;r+="&criteria[2][link]=AND&criteria[2][field]=14&criteria[2][searchtype]=equals&criteria[2][value]=1";r+="&criteria[3][link]=AND&criteria[3][field]=12&criteria[3][searchtype]=equals&criteria[3][value]=notold";if(a){window.open(r)}else{window.location.href=r}}}}));return o},onClick:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:break}GLPIImpact.checkBadgeHitboxes(e.renderedPosition,true,GLPIImpact.eventData.ctrlDown)},edgeOnClick:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:GLPIImpact.deleteFromGraph(e.target);break}},nodeOnClick:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:if(GLPIImpact.eventData.lastClicktimestamp!=null){if(e.timeStamp-GLPIImpact.eventData.lastClicktimestamp<500&&e.target==GLPIImpact.eventData.lastClickTarget){e.target.trigger("doubleClick",e)}}GLPIImpact.eventData.lastClicktimestamp=e.timeStamp;GLPIImpact.eventData.lastClickTarget=e.target;break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:GLPIImpact.deleteFromGraph(e.target);break}},onBox:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:break;case GLPIImpact.EDITION_ADD_COMPOUND:var t=e.target;if(t.isNode()&&t.isOrphan()&&!t.isParent()){GLPIImpact.eventData.boxSelected.push(t)}GLPIImpact.addCompoundFromSelection();break}},onChange:function(){GLPIImpact.showDirtyWorkspaceStatus();GLPIImpact.cy.$("[highlight][!start_node]").data("highlight",0)},onDoubleClick:function(e){if(e.target.isParent()){$(GLPIImpact.selectors.editCompoundDialog).dialog(GLPIImpact.getEditCompoundDialog(e.target))}else if(e.target.isNode()){window.open(e.target.data("link"))}},onGrabOn:function(e){GLPIImpact.eventData.grabNodePosition={x:e.target.position().x,y:e.target.position().y};var t=null;if(e.target.parent()!==undefined){t=e.target.parent().data("id")}GLPIImpact.eventData.grabNodeParent=t},onFreeOn:function(e){var t=null;if(e.target.parent()!==undefined){t=e.target.parent().data("id")}var a=null;if(t!==GLPIImpact.eventData.grabNodeParent){a=t}if(GLPIImpact.eventData.grabNodePosition.x!==e.target.position().x||GLPIImpact.eventData.grabNodePosition.y!==e.target.position().y){GLPIImpact.addToUndo(GLPIImpact.ACTION_MOVE,{node:e.target.data("id"),oldPosition:GLPIImpact.eventData.grabNodePosition,newPosition:{x:e.target.position().x,y:e.target.position().y},newParent:a})}},onRemove:function(e){if(e.target.isNode()&&!e.target.isParent()){var t=e.target.data("id").split(GLPIImpact.NODE_ID_SEPERATOR)[0];if(t==GLPIImpact.selectedItemtype){$(GLPIImpact.selectors.sideSearchResults).html("");GLPIImpact.searchAssets(GLPIImpact.selectedItemtype,JSON.stringify(GLPIImpact.getUsedAssets()),$(GLPIImpact.selectors.sideFilterAssets).val(),0)}}},onKeyDown:function(e){if(e.target.nodeName=="INPUT"){return}switch(e.which){case 16:if(e.ctrlKey){if(GLPIImpact.editionMode!=GLPIImpact.EDITION_ADD_COMPOUND){if(GLPIImpact.eventData.previousEditionMode===undefined){GLPIImpact.eventData.previousEditionMode=GLPIImpact.editionMode}GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_COMPOUND)}}else{if(GLPIImpact.editionMode!=GLPIImpact.EDITION_ADD_EDGE){if(GLPIImpact.eventData.previousEditionMode===undefined){GLPIImpact.eventData.previousEditionMode=GLPIImpact.editionMode}GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_EDGE)}}break;case 17:GLPIImpact.eventData.ctrlDown=true;break;case 27:if(GLPIImpact.editionMode!=GLPIImpact.EDITION_DEFAULT){GLPIImpact.setEditionMode(GLPIImpact.EDITION_DEFAULT)}break;case 46:if(GLPIImpact.readonly){break}GLPIImpact.eventData.multipleDeletion={edges:[],nodes:[],compounds:[]};GLPIImpact.cy.filter(":selected").forEach((function(e){GLPIImpact.deleteFromGraph(e)}));GLPIImpact.addToUndo(GLPIImpact.ACTION_DELETE,GLPIImpact.eventData.multipleDeletion);GLPIImpact.eventData.multipleDeletion=null;break;case 89:if(!e.ctrlKey){break}GLPIImpact.redo();break;case 90:if(!e.ctrlKey){break}if(e.shiftKey){GLPIImpact.redo()}else{GLPIImpact.undo()}break}},onKeyUp:function(e){switch(e.which){case 16:if(GLPIImpact.eventData.previousEditionMode!==undefined&&(GLPIImpact.editionMode==GLPIImpact.EDITION_ADD_EDGE||GLPIImpact.editionMode==GLPIImpact.EDITION_ADD_COMPOUND)){GLPIImpact.setEditionMode(GLPIImpact.eventData.previousEditionMode);GLPIImpact.eventData.previousEditionMode=undefined}break;case 17:if(GLPIImpact.editionMode==GLPIImpact.EDITION_ADD_COMPOUND&&GLPIImpact.eventData.previousEditionMode!==undefined){GLPIImpact.setEditionMode(GLPIImpact.eventData.previousEditionMode);GLPIImpact.eventData.previousEditionMode=undefined}GLPIImpact.eventData.ctrlDown=false;break}},nodeOnMousedown:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:$(GLPIImpact.impactContainer).css("cursor","grabbing");if(e.target.isOrphan()&&!e.target.isParent()){GLPIImpact.eventData.grabNodeStart=e.target}break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:if(!e.target.isParent()){GLPIImpact.eventData.addEdgeStart=this.data("id")}break;case GLPIImpact.EDITION_DELETE:break;case GLPIImpact.EDITION_ADD_COMPOUND:break}},onMouseUp:function(e){if(e.target.data("id")!=undefined&&e.target.isNode()){GLPIImpact.nodeOnMouseup()}switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:if(GLPIImpact.eventData.addEdgeStart==null){return}var t=GLPIImpact.eventData.addEdgeStart;GLPIImpact.eventData.addEdgeStart=null;e.cy.remove(GLPIImpact.eventData.tmpEles);var a=GLPIImpact.eventData.tmpEles.data("id");GLPIImpact.eventData.tmpEles=null;if(a=="tmp_node"){return}var o=a.split(GLPIImpact.EDGE_ID_SEPERATOR);if(e.cy.filter('edge[id="'+a+'"]').length>0){return}if(t==o[1]){return}var i={id:a,source:t,target:o[1]};e.cy.add({group:"edges",data:i});GLPIImpact.addToUndo(GLPIImpact.ACTION_ADD_EDGE,_.clone(i));GLPIImpact.updateFlags();break;case GLPIImpact.EDITION_DELETE:break}},nodeOnMouseup:function(){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:$(GLPIImpact.impactContainer).css("cursor","grab");GLPIImpact.eventData.grabNodeStart=null;GLPIImpact.eventData.boundingBox=null;break;case GLPIImpact.EDITION_ADD_NODE:break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:break}},onMousemove:_.throttle((function(e){var t;if(GLPIImpact.checkBadgeHitboxes(e.renderedPosition,false,false)&&!GLPIImpact.eventData.showPointerForBadge){GLPIImpact.eventData.showPointerForBadge=true;GLPIImpact.eventData.previousCursor=$(GLPIImpact.impactContainer).css("cursor");$(GLPIImpact.impactContainer).css("cursor","pointer")}else if(GLPIImpact.eventData.showPointerForBadge&&!GLPIImpact.checkBadgeHitboxes(e.renderedPosition,false,false)){GLPIImpact.eventData.showPointerForBadge=false;$(GLPIImpact.impactContainer).css("cursor",GLPIImpact.eventData.previousCursor)}switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:case GLPIImpact.EDITION_ADD_NODE:if(GLPIImpact.eventData.grabNodeStart==null){return}t=GLPIImpact.getNodeAt(e.position,(function(e){return e.isParent()}));if(t){if(GLPIImpact.eventData.boundingBox!=null){if(GLPIImpact.eventData.boundingBox.x1>e.position.x||GLPIImpact.eventData.boundingBox.x2e.position.y||GLPIImpact.eventData.boundingBox.y20){return false}if(!GLPIImpact.cy.getElementById(t).visible()){return false}return true}));if(t!=null){t=t.data("id");GLPIImpact.eventData.tmpEles=e.cy.add([{group:"edges",data:{id:GLPIImpact.makeID(GLPIImpact.EDGE,GLPIImpact.eventData.addEdgeStart,t),source:GLPIImpact.eventData.addEdgeStart,target:t}}])}else{GLPIImpact.eventData.tmpEles=e.cy.add([{group:"nodes",data:{id:"tmp_node"},position:{x:e.position.x,y:e.position.y}},{group:"edges",data:{id:GLPIImpact.makeID(GLPIImpact.EDGE,GLPIImpact.eventData.addEdgeStart,"tmp_node"),source:GLPIImpact.eventData.addEdgeStart,target:"tmp_node"}}])}break;case GLPIImpact.EDITION_DELETE:break}}),25),onMouseover:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:if(e.target.data("id")==undefined){break}if(e.target.isNode()){if(!GLPIImpact.eventData.showPointerForBadge){$(GLPIImpact.impactContainer).css("cursor","grab")}}else if(e.target.isEdge()){GLPIImpact.cy.panningEnabled(false);if(!GLPIImpact.eventData.showPointerForBadge){$(GLPIImpact.impactContainer).css("cursor","default")}}break;case GLPIImpact.EDITION_ADD_NODE:if(e.target.data("id")==undefined){break}if(e.target.isNode()){$(GLPIImpact.impactContainer).css("cursor","grab")}else if(e.target.isEdge()){$(GLPIImpact.impactContainer).css("cursor","default");GLPIImpact.cy.panningEnabled(false)}break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:if(e.target.data("id")==undefined){break}$(GLPIImpact.impactContainer).css("cursor","default");var t=e.target.data("id");e.cy.filter().data("todelete",0);e.cy.filter().unselect();if(e.target.data("id")==GLPIImpact.startNode){$(GLPIImpact.impactContainer).css("cursor","not-allowed");break}e.target.data("todelete",1);e.target.select();if(e.target.isNode()){var a="edge[source='"+t+"']";var o="edge[target='"+t+"']";e.cy.filter(a+", "+o).data("todelete",1).select()}break}},onMouseout:function(e){switch(GLPIImpact.editionMode){case GLPIImpact.EDITION_DEFAULT:if(!GLPIImpact.eventData.showPointerForBadge){$(GLPIImpact.impactContainer).css("cursor","move")}GLPIImpact.cy.panningEnabled(true);break;case GLPIImpact.EDITION_ADD_NODE:if(!GLPIImpact.eventData.showPointerForBadge){$(GLPIImpact.impactContainer).css("cursor","move")}GLPIImpact.cy.panningEnabled(true);break;case GLPIImpact.EDITION_ADD_EDGE:break;case GLPIImpact.EDITION_DELETE:e.cy.filter().data("todelete",0);e.cy.filter().unselect();if(!GLPIImpact.eventData.showPointerForBadge){$(GLPIImpact.impactContainer).css("cursor","move")}break}},menuOnGoTo:function(e){window.open(e.target.data("link"))},menuOnShowOngoing:function(e){$(GLPIImpact.selectors.ongoingDialog).html(GLPIImpact.buildOngoingDialogContent(e.target.data("ITILObjects")));$(GLPIImpact.selectors.ongoingDialog).dialog(GLPIImpact.getOngoingDialog())},menuOnEditCompound:function(e){$(GLPIImpact.selectors.editCompoundDialog).dialog(GLPIImpact.getEditCompoundDialog(e.target))},menuOnRemoveFromCompound:function(e){var t=GLPIImpact.cy.getElementById(e.target.data("parent"));GLPIImpact.addToUndo(GLPIImpact.ACTION_REMOVE_FROM_COMPOUND,{nodeData:_.clone(e.target.data()),compoundData:_.clone(t.data()),children:t.children().map((function(e){return e.data("id")}))});e.target.move({parent:null});if(t.children().length<2){t.children().move({parent:null});GLPIImpact.cy.remove(t)}},menuOnDelete:function(e){GLPIImpact.deleteFromGraph(e.target)},searchAssets:function(e,t,a,o){var i=GLPIImpact.cy.nodes(GLPIImpact.getHiddenSelector()).filter((function(e){return!e.isParent()})).map((function(e){return e.data("id")}));$(GLPIImpact.selectors.sideSearchSpinner).show();$(GLPIImpact.selectors.sideSearchNoResults).hide();$.ajax({type:"GET",url:$(GLPIImpact.selectors.form).prop("action"),data:{action:"search",itemtype:e,used:t,filter:a,page:o},success:function(t){$.each(t.items,(function(t,a){var o=e+GLPIImpact.NODE_ID_SEPERATOR+a["id"];var c=i.indexOf(o)!==-1;var s="";if(c){s="impact-res-disabled"}var n='

    ';n+='';n+=a["name"];if(c){n+=''}n+="

    ";$(GLPIImpact.selectors.sideSearchResults).append(n)}));if(t.total<=(o+1)*20){$(GLPIImpact.selectors.sideSearchMore).hide()}else{$(GLPIImpact.selectors.sideSearchMore).show()}if(t.total==0&&o==0){$(GLPIImpact.selectors.sideSearchNoResults).show()}$(GLPIImpact.selectors.sideSearchSpinner).hide()},error:function(){alert("error")}})},getUsedAssets:function(){var e=[];GLPIImpact.cy.nodes().not(GLPIImpact.getHiddenSelector()).forEach((function(t){if(t.isParent()){return}var a=t.data("id").split(GLPIImpact.NODE_ID_SEPERATOR);if(a[0]==GLPIImpact.selectedItemtype){e.push(parseInt(a[1]))}}));return e},projectIntoViewport:function(e,t,a){var o=this.cy;var i=this.findContainerClientCoords();var c=i[0];var s=i[1];var n=i[4];var r=o.pan();var I=o.zoom();if(a){return{x:e-c,y:t-s}}else{return{x:((e-c)/n-r.x)/I,y:((t-s)/n-r.y)/I}}},findContainerClientCoords:function(){var e=this.impactContainer[0];var t=e.getBoundingClientRect();var a=window.getComputedStyle(e);var o=function e(t){return parseFloat(a.getPropertyValue(t))};var i={left:o("padding-left"),right:o("padding-right"),top:o("padding-top"),bottom:o("padding-bottom")};var c={left:o("border-left-width"),right:o("border-right-width"),top:o("border-top-width"),bottom:o("border-bottom-width")};var s=e.clientWidth;var n=e.clientHeight;var r=i.left+i.right;var I=i.top+i.bottom;var d=c.left+c.right;var p=t.width/(s+d);var l=s-r;var m=n-I;var u=t.left+i.left+c.left;var h=t.top+i.top+c.top;return[u,h,l,m,p]},initToolbar:function(){$(GLPIImpact.selectors.save).click((function(){GLPIImpact.showCleanWorkspaceStatus();$.ajax({type:"POST",url:$(GLPIImpact.selectors.form).prop("action"),data:{impacts:JSON.stringify(GLPIImpact.computeDelta())},success:function(){GLPIImpact.initialState=GLPIImpact.getCurrentState();$(document).trigger("impactUpdated")},error:function(){GLPIImpact.showDirtyWorkspaceStatus()}})}));$(GLPIImpact.selectors.addNode).click((function(){GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_NODE)}));$(GLPIImpact.selectors.addEdge).click((function(){GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_EDGE)}));$(GLPIImpact.selectors.addCompound).click((function(){GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_COMPOUND)}));$(GLPIImpact.selectors.deleteElement).click((function(){GLPIImpact.setEditionMode(GLPIImpact.EDITION_DELETE)}));$(GLPIImpact.selectors.export).click((function(){GLPIImpact.download("png",false)}));$(this.selectors.impactSettings).click((function(){if($(this).find("i.fa-chevron-right").length){GLPIImpact.setEditionMode(GLPIImpact.EDITION_DEFAULT)}else{GLPIImpact.setEditionMode(GLPIImpact.EDITION_SETTINGS)}}));$(GLPIImpact.selectors.undo).click((function(){GLPIImpact.undo()}));$(GLPIImpact.selectors.redo).click((function(){GLPIImpact.redo()}));$(this.selectors.sideToggle).click((function(){if($(this).find("i.fa-chevron-right").length){GLPIImpact.setEditionMode(GLPIImpact.EDITION_DEFAULT)}else{GLPIImpact.setEditionMode(GLPIImpact.EDITION_ADD_NODE)}}));$(GLPIImpact.selectors.toggleImpact).click((function(){GLPIImpact.toggleVisibility(GLPIImpact.FORWARD);GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_IMPACT_VISIBILITY,{})}));$(GLPIImpact.selectors.toggleDepends).click((function(){GLPIImpact.toggleVisibility(GLPIImpact.BACKWARD);GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_DEPENDS_VISIBILITY,{})}));$(GLPIImpact.selectors.maxDepth).on("input",(function(){var e=GLPIImpact.maxDepth;GLPIImpact.setDepth($(GLPIImpact.selectors.maxDepth).val());GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_MAX_DEPTH,{oldDepth:e,newDepth:GLPIImpact.maxDepth})}));$(GLPIImpact.selectors.toggleFullscreen).click((function(){GLPIImpact.toggleFullscreen()}));$(GLPIImpact.selectors.sideSearchFilterItemtype).on("input",(function(){var e=$(GLPIImpact.selectors.sideSearchFilterItemtype).val().toLowerCase();$(GLPIImpact.selectors.sideFilterItem+" img").each((function(){var t=$(this).attr("title").toLowerCase();if(e==""||t.indexOf(e)!=-1){$(this).parent().show()}else{$(this).parent().hide()}}))}));$(GLPIImpact.selectors.sideFilterItem).click((function(){var e=$(this).find("img").eq(0);GLPIImpact.selectedItemtype=$(e).attr("data-itemtype");$(GLPIImpact.selectors.sideSearch).show();$(GLPIImpact.selectors.sideSearch+" img").attr("title",$(e).attr("title"));$(GLPIImpact.selectors.sideSearch+" img").attr("src",$(e).attr("src"));$(GLPIImpact.selectors.sideSearch+" > h4 > span").html($(e).attr("title"));$(GLPIImpact.selectors.sideSearchSelectItemtype).hide();GLPIImpact.searchAssets(GLPIImpact.selectedItemtype,JSON.stringify(GLPIImpact.getUsedAssets()),$(GLPIImpact.selectors.sideFilterAssets).val(),0)}));$(GLPIImpact.selectors.sideSearch+" > h4 > i").click((function(){$(GLPIImpact.selectors.sideSearch).hide();$(GLPIImpact.selectors.sideSearchSelectItemtype).show();$(GLPIImpact.selectors.sideSearchResults).html("")}));$(GLPIImpact.selectors.sideFilterAssets).on("input",(function(){$(GLPIImpact.selectors.sideSearchResults).html("");$(GLPIImpact.selectors.sideSearchMore).hide();$(GLPIImpact.selectors.sideSearchSpinner).show();$(GLPIImpact.selectors.sideSearchNoResults).hide();searchAssetsDebounced(GLPIImpact.selectedItemtype,JSON.stringify(GLPIImpact.getUsedAssets()),$(GLPIImpact.selectors.sideFilterAssets).val(),0)}));$(GLPIImpact.selectors.sideSearchMore).on("click",(function(){GLPIImpact.searchAssets(GLPIImpact.selectedItemtype,JSON.stringify(GLPIImpact.getUsedAssets()),$(GLPIImpact.selectors.sideFilterAssets).val(),++GLPIImpact.addAssetPage)}));$(GLPIImpact.selectors.dependsColor).change((function(){var e=GLPIImpact.edgeColors[GLPIImpact.BACKWARD];GLPIImpact.setEdgeColors({backward:$(GLPIImpact.selectors.dependsColor).val()});GLPIImpact.updateStyle();GLPIImpact.cy.trigger("change");GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_DEPENDS_COLOR,{oldColor:e,newColor:GLPIImpact.edgeColors[GLPIImpact.BACKWARD]})}));$(GLPIImpact.selectors.impactColor).change((function(){var e=GLPIImpact.edgeColors[GLPIImpact.FORWARD];GLPIImpact.setEdgeColors({forward:$(GLPIImpact.selectors.impactColor).val()});GLPIImpact.updateStyle();GLPIImpact.cy.trigger("change");GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_IMPACT_COLOR,{oldColor:e,newColor:GLPIImpact.edgeColors[GLPIImpact.FORWARD]})}));$(GLPIImpact.selectors.impactAndDependsColor).change((function(){var e=GLPIImpact.edgeColors[GLPIImpact.BOTH];GLPIImpact.setEdgeColors({both:$(GLPIImpact.selectors.impactAndDependsColor).val()});GLPIImpact.updateStyle();GLPIImpact.cy.trigger("change");GLPIImpact.addToUndo(GLPIImpact.ACTION_EDIT_IMPACT_AND_DEPENDS_COLOR,{oldColor:e,newColor:GLPIImpact.edgeColors[GLPIImpact.BOTH]})}));$(document).on("mousedown",GLPIImpact.selectors.sideSearchResults+" p",(function(e){if(e.which!==1||$(e.target).hasClass("impact-res-disabled")||$(e.target).parent().hasClass("impact-res-disabled")){return}GLPIImpact.eventData.addNodeStart={id:$(this).attr("data-id"),type:$(this).attr("data-type")};$(GLPIImpact.selectors.dropPreview).css({left:e.clientX-24,top:e.clientY-24});$(GLPIImpact.selectors.dropPreview).attr("src",$(this).find("img").attr("src"));$(GLPIImpact.selectors.dropPreview).show();$("*").css({cursor:"grabbing"})}));$(document).on("mouseup",(function(e){if(event.which==2){GLPIImpact.checkBadgeHitboxes(GLPIImpact.projectIntoViewport(e.clientX,e.clientY,true),true,true)}if(GLPIImpact.eventData.addNodeStart===undefined){return}if(e.target.nodeName=="CANVAS"){GLPIImpact.addNode(GLPIImpact.eventData.addNodeStart.id,GLPIImpact.eventData.addNodeStart.type,GLPIImpact.projectIntoViewport(e.clientX,e.clientY,false))}$(GLPIImpact.selectors.dropPreview).hide();GLPIImpact.eventData.addNodeStart=undefined;$("*").css("cursor","")}));$(document).on("mousemove",(function(e){if(GLPIImpact.eventData.addNodeStart===undefined){return}$(GLPIImpact.selectors.dropPreview).css({left:e.clientX-24,top:e.clientY-24})}))},initCanvasOverlay:function(){var e=GLPIImpact.cy.cyCanvas();var t=e.getCanvas();var a=t.getContext("2d");GLPIImpact.cy.on("render cyCanvas.resize",(function(){e.resetTransform(a);e.clear(a);GLPIImpact.badgesHitboxes=[];GLPIImpact.cy.filter("node:childless:visible").forEach((function(e){if(!e.data("badge")){return}var t=hexToRgb(e.data("badge").color);while(contrast([255,255,255],[t.r,t.g,t.b])<1.8){t.r*=.95;t.g*=.95;t.b*=.95}var o=e.renderedBoundingBox({includeLabels:false,includeOverlays:false,includeNodes:true});var i={x:o.x2+GLPIImpact.cy.zoom(),y:o.y2+GLPIImpact.cy.zoom()};GLPIImpact.badgesHitboxes.push({position:i,target:e.data("badge").target,itemtype:e.data("id").split(GLPIImpact.NODE_ID_SEPERATOR)[0],id:e.data("id").split(GLPIImpact.NODE_ID_SEPERATOR)[1]});a.beginPath();a.arc(i.x,i.y,4*GLPIImpact.cy.zoom(),0,2*Math.PI,false);a.fillStyle="rgb("+t.r+", "+t.g+", "+t.b+")";a.fill();var c=(Math.round(t.r*299)+Math.round(t.g*587)+Math.round(t.b*114))/1e3;a.fillStyle=c>=138?"#4e4e4e":"white";a.font=6*GLPIImpact.cy.zoom()+"px sans-serif";a.fillText(e.data("badge").count,i.x-1.95*GLPIImpact.cy.zoom(),i.y+2.23*GLPIImpact.cy.zoom())}))}))}};var searchAssetsDebounced=_.debounce(GLPIImpact.searchAssets,400,false); \ No newline at end of file diff --git a/js/kanban.min.js b/js/kanban.min.js new file mode 100644 index 00000000..9a46ce1d --- /dev/null +++ b/js/kanban.min.js @@ -0,0 +1 @@ +(function(){window.GLPIKanban=function(){var e=this;this.element="";this.columns={};this.ajax_root=CFG_GLPI.root_doc+"/ajax/";this.max_team_images=3;this.team_image_size=24;this.item=null;this.supported_itemtypes={};this.allow_add_item=false;this.allow_create_column=false;this.allow_modify_view=false;this.limit_addcard_columns=[];this.allow_order_card=false;this.dark_theme=false;this.column_field={id:"",extra_fields:{}};this.show_toolbar=true;this.filters={_text:""};this.add_column_form="";this.create_column_form="";this.team_badge_cache={User:{},Group:{},Supplier:{},Contact:{}};this.background_refresh_interval=0;var a=null;this.user_state={is_dirty:false,state:{}};this.last_refresh=null;this.is_sorting_active=false;var n=function(a){var n=["element","max_team_images","team_image_size","item","supported_itemtypes","allow_add_item","allow_add_column","dark_theme","background_refresh_interval","column_field","allow_modify_view","limit_addcard_columns","allow_order_card","allow_create_column"];if(a.length===1){for(var t=0;t
    ").appendTo($(e.element));var n="";a.append(n);var t="";a.append(t);$("#kanban-overflow-dropdown li.dropdown-trigger").on("click",(function(e){$(this).toggleClass("active");$(this).find("ul").toggle();e.stopPropagation();e.preventDefault()}));var l=function(){if(Object.keys(e.user_state.state).length===0){D(true,true)}};e.refresh(l,null,null,true);if(e.allow_modify_view){I();if(e.allow_create_column){z()}}};var i=function(){var a=$("
    ").appendTo(e.element);$("").appendTo(a);var n=$("").appendTo(a);if(e.allow_modify_view){var t="";a.append(t)}n.on("input",(function(){var a=$(this).val();if(a===null){a=""}e.filters._text=a;e.filter()}))};var o=function(a){return"#column-"+e.column_field.id+"-"+a};var r=function(e){var a=[e];if(typeof e!=="string"){a=$(e).prop("id").split("-")}else{a=e.split("-")}return a[a.length-1]};var l=function(){e.temp_forms={};var a=$(e.element+" .kanban-column");$.each(a,(function(a,n){var t=$(n).find(".kanban-add-form");if(t.length>0){e.temp_forms[n.id]=[];$.each(t,(function(a,t){e.temp_forms[n.id].push($(t).clone())}))}}))};var s=function(){if(e.temp_forms!==undefined&&Object.keys(e.temp_forms).length>0){$.each(e.temp_forms,(function(e,a){var n=$("#"+e);if(n.length>0){var t=n.find(".kanban-body").first();$.each(a,(function(e,a){$(a).appendTo(t)}))}}));e.temp_forms={}}};var c=function(){e.temp_kanban_scroll={left:$(e.element+" .kanban-container").scrollLeft(),top:$(e.element+" .kanban-container").scrollTop()};e.temp_column_scrolls={};var a=$(e.element+" .kanban-column");$.each(a,(function(a,n){var t=$(n).find(".kanban-body");if(t.scrollTop()!==0){e.temp_column_scrolls[n.id]=t.scrollTop()}}))};var d=function(){if(e.temp_kanban_scroll!==null){$(e.element+" .kanban-container").scrollLeft(e.temp_kanban_scroll.left);$(e.element+" .kanban-container").scrollTop(e.temp_kanban_scroll.top)}if(e.temp_column_scrolls!==null){$.each(e.temp_column_scrolls,(function(e,a){$("#"+e+" .kanban-body").scrollTop(a)}))}e.temp_kanban_scroll={};e.temp_column_scrolls={}};var u=function(){c();l();$(e.element+" .kanban-column").remove()};var f=function(a){if(a===undefined){a=$(e.element+" .kanban-container .kanban-columns").first()}var n=[];$.each(e.user_state.state,(function(t,i){if(i["visible"]!==false&&i!=="false"){P(i["column"],e.columns[i["column"]],a)}n.push(i["column"])}));$.each(e.columns,(function(e,t){if(!n.includes(e)){if(t["id"]===undefined){P(e,t,a)}}}));s();d()};var m=function(){var a=$("#kanban-add-dropdown");var n=$("#kanban-overflow-dropdown");_();if(Object.keys(e.supported_itemtypes).length>0){$(e.element+" .kanban-container").on("click",".kanban-add",(function(e){var n=$(e.target);var t=$(a.data("trigger-button")).prop("id")!==n.prop("id");a.css({position:"fixed",left:n.offset().left,top:n.offset().top+n.outerHeight(true),display:a.css("display")==="none"||t?"inline":"none"});a.data("trigger-button",n)}))}$(window).on("click",(function(n){if(!$(n.target).hasClass("kanban-add")){a.css({display:"none"})}if(e.allow_modify_view){if(!$.contains($(e.add_column_form)[0],n.target)){$(e.add_column_form).css({display:"none"})}if(e.allow_create_column){if(!$.contains($(e.create_column_form)[0],n.target)&&!$.contains($(e.add_column_form)[0],n.target)){$(e.create_column_form).css({display:"none"})}}}}));if(Object.keys(e.supported_itemtypes).length>0){$(e.element+" .kanban-container").on("click",".kanban-overflow-actions",(function(e){var a=$(e.target);var t=$(n.data("trigger-button")).prop("id")!==a.prop("id");n.css({position:"fixed",left:a.offset().left,top:a.offset().top+a.outerHeight(true),display:n.css("display")==="none"||t?"inline":"none"});n.find("ul").css({display:"none"});n.find("li").removeClass("active");var i=$(e.target.closest(".kanban-column"));if(i.hasClass("kanban-protected")){n.find('li[data-forbid-protected="true"]').hide()}else{n.find('li[data-forbid-protected="true"]').show()}n.data("trigger-button",a)}))}$(window).on("click",(function(a){if(!$(a.target).hasClass("kanban-overflow-actions")){n.css({display:"none"})}if(e.allow_modify_view){if(!$.contains($(e.add_column_form)[0],a.target)){$(e.add_column_form).css({display:"none"})}if(e.allow_create_column){if(!$.contains($(e.create_column_form)[0],a.target)&&!$.contains($(e.add_column_form)[0],a.target)){$(e.create_column_form).css({display:"none"})}}}}));$(e.element+" .kanban-container").on("click",".kanban-remove",(function(e){var a=$(e.target.closest(".kanban-dropdown")).data("trigger-button").closest(".kanban-column");k(r(a))}));$(e.element+" .kanban-container").on("click",".kanban-collapse-column",(function(a){e.toggleCollapseColumn(a.target.closest(".kanban-column"))}));$(e.element).on("click",".kanban-add-column",(function(){p()}));$(e.add_column_form).on("input","input[name='column-name-filter']",(function(){var a=$(this);$(e.add_column_form+" li").hide();$(e.add_column_form+" li").filter((function(){return $(this).text().toLowerCase().includes(a.val().toLowerCase())})).show()}));$(e.add_column_form).on("change","input[type='checkbox']",(function(){var e=$(this).parent().data("list-id");if(e!==undefined){if($(this).is(":checked")){h(e)}else{k(e)}}}));$(e.add_column_form).on("submit","form",(function(e){e.preventDefault()}));$(e.add_column_form).on("click",".kanban-create-column",(function(){var a=$(e.element+" .kanban-toolbar");$(e.add_column_form).css({display:"none"});$(e.create_column_form).css({display:"block",position:"fixed",left:a.offset().left+a.outerWidth(true)-$(e.create_column_form).outerWidth(true),top:a.offset().top+a.outerHeight(true)})}));$(e.create_column_form).on("submit","form",(function(a){a.preventDefault();var n=$(e.element+" .kanban-toolbar");$(e.create_column_form).css({display:"none"});var t=$(e.create_column_form+" input[name='name']").val();$(e.create_column_form+" input[name='name']").val("");var i=$(e.create_column_form+" input[name='color']").val();M(t,{color:i},(function(){p();$(e.add_column_form).css({display:"block",position:"fixed",left:n.offset().left+n.outerWidth(true)-$(e.add_column_form).outerWidth(true),top:n.offset().top+n.outerHeight(true)})}))}));$("#kanban-add-dropdown li").on("click",(function(a){a.preventDefault();var n=$(a.target);var t=n.parent();var i=$($(t.data("trigger-button")).closest(".kanban-column"));var o=n.prop("id").split("-")[2];e.clearAddItemForms(i);e.showAddItemForm(i,o);E()}));$("#kanban-bulk-add-dropdown li").on("click",(function(a){a.preventDefault();var n=$(a.target);var t=n.closest(".kanban-dropdown");var i=$($(t.data("trigger-button")).closest(".kanban-column"));var o=n.prop("id").split("-")[3];t.css({display:"none"});e.clearAddItemForms(i);e.showBulkAddItemForm(i,o);E()}));var t=$("select[name='kanban-board-switcher']").first();$(e.element+" .kanban-toolbar").on("select2:select",t,(function(a){var n=a.params.data.id;$.ajax({type:"GET",url:e.ajax_root+"kanban.php",data:{action:"get_url",itemtype:e.item.itemtype,items_id:n},contentType:"application/json",success:function(e){window.location=e}})}));$(e.element).on("input",".kanban-add-form input, .kanban-add-form textarea",(function(){E()}));if(!e.allow_order_card){$(e.element).on("mouseenter",".kanban-column",(function(){if(e.is_sorting_active){return}$(this).find(".kanban-body > li").removeClass("temporarily-readonly");$(this).siblings().find(".kanban-body > li").addClass("temporarily-readonly")}));$(e.element).on("mouseleave",".kanban-column",(function(){if(e.is_sorting_active){return}$(e.element).find(".kanban-body > li").removeClass("temporarily-readonly")}))}$(e.element+" .kanban-container").on("submit",".kanban-add-form",(function(a){a.preventDefault();var n=$(a.target);var t={};t["inputs"]=n.serialize();t["itemtype"]=n.prop("id").split("_")[2];t["action"]="add_item";$.ajax({method:"POST",url:e.ajax_root+"kanban.php",data:t}).done((function(){e.refresh()}))}))};var p=function(){var a=[];$(e.element+" .kanban-columns .kanban-column").each((function(){var e=this.id.split("-");a.push(e[e.length-1])}));var n=$(e.add_column_form);var t=$(e.element+" .kanban-toolbar");$.ajax({method:"GET",url:e.ajax_root+"kanban.php",data:{action:"list_columns",itemtype:e.item.itemtype,column_field:e.column_field.id}}).done((function(i){var o=$(e.add_column_form+" .kanban-item-content");o.empty();o.append("");var r="
      ";$.each(i,(function(e,n){var t="
    • ";if(a.includes(e)){t+=""}else{t+=""}t+="";t+=n["name"]+"
    • ";r+=t}));r+="
    ";o.append(r);o.append();n.css({display:"block",position:"fixed",left:t.offset().left+t.outerWidth(true)-n.outerWidth(true),top:t.offset().top+t.outerHeight(true)})}))};var _=function(){var a=$(e.element+" .kanban-body");$.each(a,(function(e){var a=$(e);if(a.data("sortable")){a.sortable("destroy")}}));a.sortable({connectWith:".kanban-body",containment:".kanban-container",appendTo:".kanban-container",items:".kanban-item:not(.readonly):not(.temporarily-readonly)",placeholder:"sortable-placeholder",start:function(a,n){e.is_sorting_active=true;var t=n.item;var i=t.closest(".kanban-column").attr("id");t.data("source-col",i);t.data("source-pos",t.index())},update:function(a,n){if(this===n.item.parent()[0]){return e.onKanbanCardSort(n,this)}},change:function(a,n){var t=n.item;var i=t.data("source-col");var o=t.data("source-pos");var r=n.placeholder.closest(".kanban-column").attr("id");var l=$("#"+r+' ul.ui-sortable > li:not([id="'+t.attr("id")+'"])');var s=l.index(n.placeholder);t.data("current-pos",s);if(!e.allow_order_card){if(r===i){if(s!==o){n.placeholder.addClass("invalid-position")}else{n.placeholder.removeClass("invalid-position")}}else{if(!$(n.placeholder).is(":last-child")){n.placeholder.addClass("invalid-position")}else{n.placeholder.removeClass("invalid-position")}}}},stop:function(a,n){e.is_sorting_active=false;n.item.closest(".kanban-column").trigger("mouseenter")}});if(e.allow_modify_view){$(e.element+" .kanban-columns").sortable({connectWith:e.element+" .kanban-columns",appendTo:".kanban-container",items:".kanban-column:not(.kanban-protected)",placeholder:"sortable-placeholder",handle:".kanban-column-header",tolerance:"pointer",stop:function(e,a){var n=$(a.item[0]);y(r(a.item[0]),n.index())}});$(e.element+" .kanban-columns .kanban-column:not(.kanban-protected) .kanban-column-header").addClass("grab")}};var v=function(a){var n="";var t=parseInt(r(a["id"]));if(e.allow_add_item&&(e.limit_addcard_columns.length===0||e.limit_addcard_columns.includes(t))){n+="";n+=""}n+="";return n};this.hideEmpty=function(){var e=$(".kanban-body");e.each((function(e,a){if(a.childElementCount===0){a.parentElement.style.display="none"}}))};this.showEmpty=function(){var e=$(".kanban-column");e.each((function(e,a){a.style.display="block"}))};this.onKanbanCardSort=function(a,n){var t=n.parentElement;var i=$(a.sender);var o=$(a.item[0]);var r=o.attr("id").split("-");var l=$(t).attr("id").split("-");var s=l[l.length-1];if(r.length===2&&i!==null&&!(!e.allow_order_card&&i.length===0)){$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:"update",itemtype:r[0],items_id:r[1],column_field:e.column_field.id,column_value:s},contentType:"application/json",error:function(){$(n).sortable("cancel");return false},success:function(){var a=o.data("current-pos");if(!e.allow_order_card){o.appendTo($(t).find(".kanban-body").first());a=o.index()}e.updateColumnCount($(i).closest(".kanban-column"));e.updateColumnCount($(t).closest(".kanban-column"));o.removeData("source-col");b(o.attr("id"),t.id,a);return true}})}else{$(n).sortable("cancel");return false}};var b=function(a,n,t,i,o){if(typeof n==="string"&&n.lastIndexOf("column",0)===0){n=r(n)}$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:"move_item",card:a,column:n,position:t,kanban:e.item},contentType:"application/json",error:function(){if(i){i()}},success:function(){if(o){o()}}})};var h=function(a){$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:"show_column",column:a,kanban:e.item},contentType:"application/json",complete:function(){$.each(e.user_state.state,(function(n,t){if(parseInt(t["column"])===parseInt(a)){e.user_state.state[n]["visible"]=true;return false}}));U(a,false,true);$(e.element+" .kanban-add-column-form li[data-list-id='"+a+"']").prop("checked",true)}})};var k=function(a){$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:"hide_column",column:a,kanban:e.item},contentType:"application/json",complete:function(){$(o(a)).remove();$.each(e.user_state.state,(function(n,t){if(parseInt(t["column"])===parseInt(a)){e.user_state.state[n]["visible"]=false;return false}}));$(e.element+" .kanban-add-column-form li[data-list-id='"+a+"']").prop("checked",false)}})};var y=function(a,n){$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:"move_column",column:a,position:n,kanban:e.item},contentType:"application/json"})};var g=function(a){var n=a["itemtype"];var t=a["items_id"];if(e.team_badge_cache[n]===undefined||e.team_badge_cache[n][t]===undefined){if(n==="User"){var i=null;$.ajax({url:e.ajax_root+"getUserPicture.php",async:false,data:{users_id:[t],size:e.team_image_size},contentType:"application/json",dataType:"json"}).done((function(e){if(e[t]!==undefined){i=e[t]}else{i=null}}));if(i){e.team_badge_cache[n][t]=""+i+""}else{e.team_badge_cache[n][t]=T(a)}}else{switch(n){case"Group":e.team_badge_cache[n][t]=C(a,"fa-users");break;case"Supplier":e.team_badge_cache[n][t]=C(a,"fa-briefcase");break;case"Contact":e.team_badge_cache[n][t]=C(a,"fa-user");break;default:e.team_badge_cache[n][t]=C(a,"fa-user")}}}return e.team_badge_cache[n][t]};var w=function(a){var n=[];$.each(e.columns,(function(a,t){if(t["items"]!==undefined){$.each(t["items"],(function(a,t){if(t["_team"]!==undefined){Object.values(t["_team"]).slice(0,e.max_team_images).forEach((function(a){if(a["itemtype"]==="User"){if(e.team_badge_cache["User"][a["items_id"]]===undefined){n[a["items_id"]]=a}}}))}}))}}));if(n.length===0){return}$.ajax({url:e.ajax_root+"getUserPicture.php",async:false,data:{users_id:Object.keys(n),size:e.team_image_size},contentType:"application/json",dataType:"json"}).done((function(t){Object.keys(n).forEach((function(a){var i=n[a];if(t[a]!==undefined){e.team_badge_cache["User"][a]=""+t[a]+""}else{e.team_badge_cache["User"][a]=T(i)}}));if(a!==undefined&&a["trim_cache"]!==undefined){var i=JSON.parse(window.sessionStorage.getItem("badge_colors"));Object.keys(e.team_badge_cache["User"]).forEach((function(a){if(n[a]===undefined){delete e.team_badge_cache["User"][a];delete i["User"][a]}}));window.sessionStorage.setItem("badge_colors",JSON.stringify(i))}}))};var x=function(e,a,n){var t,i,o;if(a===0){t=i=o=n}else{var r=function e(a,n,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return a+(n-a)*6*t;if(t<1/2)return n;if(t<2/3)return a+(n-a)*(2/3-t)*6;return a};var l=n<.5?n*(1+a):n+a-n*a;var s=2*n-l;t=r(s,l,e+1/3);i=r(s,l,e);o=r(s,l,e-1/3)}t=("0"+(t*255).toString(16)).substr(-2);i=("0"+(i*255).toString(16)).substr(-2);o=("0"+(o*255).toString(16)).substr(-2);return"#"+t+i+o};var j=function(a){var n=JSON.parse(window.sessionStorage.getItem("badge_colors"));var t=a["itemtype"];var i=Math.random();var o=Math.random()*10+(e.dark_theme?25:70);var r=x(i,1,o/100);if(n!==null&&n[t]!==null&&n[t][a["id"]]){r=n[t][a["id"]]}else{if(n===null){n={User:{},Group:{},Supplier:{},Contact:{}}}n[t][a["id"]]=r;window.sessionStorage.setItem("badge_colors",JSON.stringify(n))}return r};var T=function(a){var n="";if(a["firstname"]){n+=a["firstname"][0]}if(a["realname"]){n+=a["realname"][0]}n=n.toUpperCase();if(n.length===0){return C(a,"fa-user")}var t=document.createElement("canvas");t.width=e.team_image_size;t.height=e.team_image_size;var i=t.getContext("2d");i.strokeStyle="#f1f1f1";i.fillStyle=j(a);i.beginPath();i.arc(e.team_image_size/2,e.team_image_size/2,e.team_image_size/2,0,2*Math.PI);i.fill();i.fillStyle=e.dark_theme?"white":"black";i.textAlign="center";i.font="bold "+e.team_image_size/2+"px sans-serif";i.textBaseline="middle";i.fillText(n,e.team_image_size/2,e.team_image_size/2);var o=t.toDataURL("image/png");return""};var C=function(a,n){var t=j(a);return" "};var S=function(a){var n=document.createElement("canvas");n.width=e.team_image_size;n.height=e.team_image_size;var t=n.getContext("2d");t.strokeStyle="#f1f1f1";var i=e.dark_theme?40:80;t.fillStyle="hsl(255, 0%,"+i+"%,1)";t.beginPath();t.arc(e.team_image_size/2,e.team_image_size/2,e.team_image_size/2,0,2*Math.PI);t.fill();t.fillStyle=e.dark_theme?"white":"black";t.textAlign="center";t.font="bold "+e.team_image_size/2+"px sans-serif";t.textBaseline="middle";t.fillText("+"+a,e.team_image_size/2,e.team_image_size/2);var o=n.toDataURL("image/png");return""};var O=function(e){var a=e.substring(1);var n=parseInt(a,16);var t=n>>16&255;var i=n>>8&255;var o=n>>0&255;var r=.2126*t+.7152*i+.0722*o;return r>110};this.updateColumnCount=function(e){if(!(e instanceof jQuery)){e=$(e)}var a=$(e).find(".kanban-body:first");var n=$(e).find(".kanban_nb:first");var t=a.find("li:not(.filtered-out)");n.text(t.length)};this.clearAddItemForms=function(e){if(!(e instanceof jQuery)){e=$(e)}e.find("form").remove()};this.showAddItemForm=function(a,n){if(!(a instanceof jQuery)){a=$(a)}var t=Math.floor(Math.random()*999999);var i="form_add_"+n+"_"+t;var o="
    ";var r="
    ";r+=""+e.supported_itemtypes[n]["name"]+"";r+="
    ";o+=r;o+="
    ";$.each(e.supported_itemtypes[n]["fields"],(function(e,a){var n=a["type"]!==undefined?a["type"]:"text";var t=a["value"]!==undefined?a["value"]:"";if(n.toLowerCase()==="textarea"){o+="";$.each(e.supported_itemtypes[n]["fields"],(function(e,a){var n=a["type"]!==undefined?a["type"]:"text";var t=a["value"]!==undefined?a["value"]:"";if(n==="hidden"){o+="";o+="";o+="";$(a.find(".kanban-body")[0]).append(o);$("#"+i).get(0).scrollIntoView(false);$("#"+i).on("submit",(function(a){a.preventDefault();var n=$(a.target);var t={};t["inputs"]=n.serialize();t["itemtype"]=n.prop("id").split("_")[2];t["action"]="bulk_add_item";$.ajax({method:"POST",url:e.ajax_root+"kanban.php",data:t}).done((function(){$("#"+i).remove();e.refresh()}))}))};var I=function(){var a=Math.floor(Math.random()*999999);var n="form_add_column_"+a;e.add_column_form="#"+n;var t="";$(e.element).prepend(t)};var z=function(){var a=Math.floor(Math.random()*999999);var n="form_create_column_"+a;e.create_column_form="#"+n;var t="";$(e.element).prepend(t)};var E=function(){window.setTimeout(a,1e4)};this.refresh=function(a,n,t,i){var o=function(){$.ajax({method:"GET",url:e.ajax_root+"kanban.php",data:{action:"refresh",itemtype:e.item.itemtype,items_id:e.item.items_id,column_field:e.column_field.id},contentType:"application/json",dataType:"json"}).done((function(n,t,i){w({trim_cache:true});u();e.columns=n;f();e.filter();if(a){a(n,t,i)}})).fail((function(e,a,t){if(n){n(e,a,t)}})).always((function(){if(t){t()}}))};if(i===undefined||i===true){o()}else{D(false,false,null,null,(function(){L(o)}))}};var P=function(a,n,t,i){if(t==null){t=$(e.element+" .kanban-container .kanban-columns").first()}i=i!==undefined?i:false;n["id"]="column-"+e.column_field.id+"-"+a;var o="";var r=-1;$.each(e.user_state.state,(function(e,n){if(parseInt(n["column"])===parseInt(a)){r=e;if(n["folded"]===true||n["folded"]==="true"){o="collapsed";return false}}}));var l=n["_protected"]?"kanban-protected":"";var s="kanban-column "+o+" "+l;var c=typeof n["header_color"]!=="undefined"?n["header_color"]:"transparent";var d="
    ";var u=null;if(r<0){u=$(d).appendTo(t)}else{var f=$(t).find(".kanban-column:nth-child("+r+")");if(f.length===1){u=$(d).insertAfter(f)}else{u=$(d).appendTo(t)}}var m=n["items"]!==undefined?n["items"]:[];var p=n["header_color"];var b=p?O(p):!e.dark_theme;var h=b?"kanban-text-dark":"kanban-text-light";var k=$("
    ");var y=$("
    ").appendTo(k);var g=n["items"]!==undefined?n["items"].length:0;var w=$("").appendTo(y);var x=$("").appendTo(y);if(e.allow_modify_view){$(w).append("")}$(w).append(""+n["name"]+"");$(x).append(""+g+"");$(x).append(v(n));$(u).prepend(k);$("
      ").appendTo(u);var j=[];$.each(e.user_state.state,(function(e,n){if(n["column"]===a){$.each(n["cards"],(function(e,a){$.each(m,(function(e,n){if(n["id"]===a){A(u,n);j.push(n["id"]);return false}}))}))}}));$.each(m,(function(e,a){if(j.indexOf(a["id"])<0){A(u,a,i)}}));_()};var A=function(a,n,t){if(t){var i=$("#"+n["id"]);if(i!==undefined){var o=i.closest(".kanban-column");i.remove();e.updateColumnCount(o)}}var r=$(a).find(".kanban-body").first();var l=n["_readonly"]!==undefined&&(n["_readonly"]===true||n["_readonly"]===1);var s="
    • ";s+="
      "+n["title"]+"
      ";s+="
      "+(n["content"]||"")+"
      ";s+="
      ";if(n["_team"]!==undefined&&Object.values(n["_team"]).length>0){$.each(Object.values(n["_team"]).slice(0,e.max_team_images),(function(e,a){s+=g(a)}));if(n["_team"].length>e.max_team_images){s+=S(n["_team"].length-e.max_team_images)}}s+="
      ";s+="
    • ";$(s).appendTo(r);e.updateColumnCount(a)};this.clearFiltered=function(){$(e.element+" .kanban-item").each((function(e,a){$(a).removeClass("filtered-out")}))};this.filter=function(){e.clearFiltered();$(e.element+" .kanban-item").each((function(a,n){var t=$(n).find(".kanban-item-header a").text();try{if(!t.match(new RegExp(e.filters._text,"i"))){$(n).addClass("filtered-out")}}catch(a){if(!t.toLowerCase().includes(e.filters._text.toLowerCase())){$(n).addClass("filtered-out")}}}));$(e.element+" .kanban-column").each((function(a,n){e.updateColumnCount(n)}))};this.toggleCollapseColumn=function(a){if(!(a instanceof jQuery)){a=$(a)}a.toggleClass("collapsed");var n=a.hasClass("collapsed")?"collapse_column":"expand_column";$.ajax({type:"POST",url:e.ajax_root+"kanban.php",data:{action:n,column:r(a),kanban:e.item},contentType:"application/json"})};var U=function(a,n,t,i){n=n!==undefined?n:false;var o=false;$.each(e.user_state.state,(function(e,n){if(parseInt(n["column"])===parseInt(a)){if(!n["visible"]){o=true}return false}}));if(o){if(i){i()}return}$.ajax({method:"GET",url:e.ajax_root+"kanban.php",contentType:"application/json",dataType:"json",async:false,data:{action:"get_column",itemtype:e.item.itemtype,items_id:e.item.items_id,column_field:e.column_field.id,column_id:a}}).done((function(n){if(n!==undefined){e.columns[a]=n[a];P(a,e.columns[a],null,t)}})).always((function(){if(i){i()}}))};var M=function(a,n,t){if(a===undefined||a.length===0){if(t){t()}return}$.ajax({method:"POST",url:e.ajax_root+"kanban.php",contentType:"application/json",dataType:"json",data:{action:"create_column",itemtype:e.item.itemtype,items_id:e.item.items_id,column_field:e.column_field.id,column_name:a,params:n}}).always((function(){if(t){t()}}))};var G=function(){var a={is_dirty:true,state:{}};$(e.element+" .kanban-column").each((function(n,t){var i=$(t);var o=i.prop("id").split("-");var r=o[o.length-1];if(e.user_state.state[n]===undefined||r!==e.user_state.state[n]["column"]||e.user_state.state[n]["folded"]!==i.hasClass("collapsed")){a.is_dirty=true}a.state[n]={column:r,folded:i.hasClass("collapsed"),cards:{}};$.each(i.find(".kanban-item"),(function(t,i){a.state[n]["cards"][t]=$(i).prop("id");if(e.user_state.state[n]!==undefined&&e.user_state.state[n]["cards"]!==undefined&&e.user_state.state[n]["cards"][t]!==undefined&&e.user_state.state[n]["cards"][t]!==a.state[n]["cards"][t]){a.is_dirty=true}}))}));e.user_state=a};var L=function(a){$.ajax({type:"GET",url:e.ajax_root+"kanban.php",data:{action:"load_column_state",itemtype:e.item.itemtype,items_id:e.item.items_id,last_load:e.last_refresh},contentType:"application/json"}).done((function(n){if(n["state"]===undefined||n["state"]===null||Object.keys(n["state"]).length===0){if(a){a(false)}return}e.user_state={is_dirty:false,state:n["state"]};var t=Object.keys(n["state"]);for(var i=0;i0){E();return}e.refresh(null,null,(function(){window.setTimeout(a,e.background_refresh_interval*60*1e3)}),false)};window.setTimeout(a,e.background_refresh_interval*60*1e3)};this.init=function(){L((function(){t();$(document).ready((function(){$.ajax({type:"GET",url:e.ajax_root+"kanban.php",data:{action:"get_switcher_dropdown",itemtype:e.item.itemtype,items_id:e.item.items_id},contentType:"application/json",success:function(a){var n=$(e.element+" .kanban-toolbar select[name='kanban-board-switcher']");n.replaceWith(a)}});m();F()}))}))};n(arguments)}})(); \ No newline at end of file diff --git a/js/log_filters.min.js b/js/log_filters.min.js new file mode 100644 index 00000000..22b0d3d1 --- /dev/null +++ b/js/log_filters.min.js @@ -0,0 +1 @@ +$((function(){var e=function(){$(".show_log_filters").on("click",i)};var i=function(e){e.preventDefault();reloadTab("filters[active]=1")};var t=function(){$(document).on("select2:unselecting",".log_history_filter_row .select2-hidden-accessible",(function(e){if(e.params.args.originalEvent){e.params.args.originalEvent.stopPropagation()}}));$('.log_history_filter_row [name^="filters\\["]').on("input",o);$('.log_history_filter_row select[name^="filters\\["]').on("change",o)};var o=function(){$(".log_history_filter_row .select2-hidden-accessible").select2("close");reloadTab($('[name^="filters\\["]').serialize())};$(".glpi_tabs").on("tabsload",(function(){e();t()}))})); \ No newline at end of file diff --git a/js/main.min.js b/js/main.min.js new file mode 100644 index 00000000..e69de29b diff --git a/js/marketplace.min.js b/js/marketplace.min.js new file mode 100644 index 00000000..cd4f6858 --- /dev/null +++ b/js/marketplace.min.js @@ -0,0 +1 @@ +var current_page=1;var ajax_url;var ajax_done=false;$(document).ready((function(){ajax_url=CFG_GLPI.root_doc+"/ajax/marketplace.php";$(document).on("click",".marketplace .modify_plugin",(function(){var a=$(this);var e=a.closest(".buttons");var t=a.closest("li.plugin");var n=a.children("i");var i=a.closest(".marketplace").hasClass("installed");var l=a.data("action");var s=t.data("key");n.removeClass().addClass("fas fa-spinner fa-spin");if(l==="download_plugin"||l==="update_plugin"){followDownloadProgress(a)}ajax_done=false;$.get(ajax_url,{action:l,key:s}).done((function(a){ajax_done=true;if(a.indexOf("cleaned")!==-1&&i){t.remove()}else{a=a.replace("cleaned","");e.html(a);displayAjaxMessageAfterRedirect();addTooltips()}}))}));$(document).on("select2:select",".marketplace .sort-control",(function(){filterPluginList()}));$(document).on("click",".marketplace .pagination li",(function(){var a=$(this);var e=a.data("page");if(a.hasClass("nav-disabled")||a.hasClass("current")||isNaN(e)){return}refreshPlugins(e)}));$(document).on("click",".marketplace .plugins-tags .tag",(function(){$(".marketplace:visible .plugins-tags .tag").removeClass("active");$(this).addClass("active");filterPluginList()}));jQuery.expr.filters.icontains=function(a,e,t){return(a.innerText||a.textContent||"").toLowerCase().indexOf(t[3].toLowerCase())>-1};var a;$(document).on("input",".marketplace .filter-list",(function(){clearTimeout(a);a=setTimeout((function(){filterPluginList()}),500)}));$(document).on("click",".marketplace .refresh-plugin-list",(function(){refreshPlugins(current_page,true)}))}));var filterPluginList=function(a,e){a=a||1;e=e||false;var t=$(".marketplace:visible");var n=t.find("ul.pagination");var i=t.find("ul.plugins");var l=t.find(".plugins-tags .tag.active");var s=l.length?l.data("tag"):"";var r=t.find(".filter-list").val();var o="sort-alpha-desc";if(t.find(".sort-control").length>0){o=t.find(".sort-control").select2("data")[0].element.value}i.append("
      ");n.find("li.current").removeClass("current");var c=$.get(ajax_url,{action:"refresh_plugin_list",tab:t.data("tab"),tag:s,filter:r,force:e?1:0,page:a,sort:o}).done((function(e){i.html(e);var t=c.getResponseHeader("X-GLPI-Marketplace-Total");$.get(ajax_url,{action:"getPagination",page:a,total:t}).done((function(a){n.html(a)}))}));return c};var refreshPlugins=function(a,e){e=e||false;var t=$(".marketplace:visible .refresh-plugin-list");t.removeClass("fa-sync-alt").addClass("fa-spinner fa-spin");$.when(filterPluginList(a,e)).then((function(){t.removeClass("fa-spinner fa-spin").addClass("fa-sync-alt");current_page=a;addTooltips()}))};var addTooltips=function(){$(".qtip").remove();$(".marketplace:visible").find("[data-action][title], .add_tooltip").qtip({position:{viewport:$(window),my:"center left",at:"center right",adjust:{x:2,method:"flip"}},style:{classes:"qtip-dark"},show:{solo:true},hide:{event:"click mouseleave"}})};var followDownloadProgress=function(a){var e=a.closest(".buttons");var t=a.closest("li.plugin");var n=t.data("key");var i=$('');e.html(i);function l(){setTimeout((function(){$.get(ajax_url,{action:"get_dl_progress",key:n}).done((function(a){i.attr("value",a);if(a<100){l()}else if(!ajax_done){e.html('');displayAjaxMessageAfterRedirect()}}))}),300)}l()}; \ No newline at end of file diff --git a/js/notifications_ajax.min.js b/js/notifications_ajax.min.js new file mode 100644 index 00000000..c0f42adc --- /dev/null +++ b/js/notifications_ajax.min.js @@ -0,0 +1 @@ +(function(i,t){function o(n){var e=this;var s=t("
      ");var a=t("
      ");this.options=t.extend({},o.default,n);this.showNotification=function(o,n,a,r){s.queue((function(){var s=this;setTimeout((function(){t(s).dequeue()}),100);var c=new Notification(n,{body:a,icon:e.options.icon});if(typeof r!="undefined"&&r!=null){c.url_item=CFG_GLPI.url_base+"/"+r;c.onclick=function(t){t.preventDefault();i.open(this.url_item,"_blank")}}t.ajax({url:CFG_GLPI.root_doc+"/ajax/notifications_ajax.php",method:"GET",data:{delete:o}})}))};this.playAudio=function(o){if(!o||!("Audio"in i)){return false}var n=new Audio;t(n).append(t("",{src:CFG_GLPI.root_doc+"/sound/"+o+".mp3",type:"audio/mpeg"}));t(n).append(t("",{src:CFG_GLPI.root_doc+"/sound/"+o+".ogg",type:"audio/ogg"}));a.queue((function(){var i=this;n.onended=function(){t(i).dequeue()};n.play()}))};this.checkNewNotifications=function(){if(!e.isSupported()){return false}var i=t.getJSON(CFG_GLPI.root_doc+"/ajax/notifications_ajax.php");i.done((function(i){if(i){for(var t=0;t
       ');if(e.resource._resource.extendedProps.itemtype=="Group_User"){e.el.style.backgroundColor="lightgray"}},eventRender:function(e){var n=e.event;var t=n.extendedProps;var a=$(e.el);var l=e.view;a.data("myevent",n);var o='';a.append(o);var s=t.content;var c=t.tooltip;if(l.type!=="dayGridMonth"&&l.type.indexOf("list")<0&&n.rendering!="background"&&!n.allDay){a.append('
      '+s+"
      ")}if("icon"in t){var d="";if("icon_alt"in t){d=t.icon_alt}a.find(".fc-title, .fc-list-item-title").append(" ")}var u="";if(typeof n.end!=="undefined"&&n.end!==null){var f=new Date;var p=n.end;u=p.getTime()f.getTime()?" event_future":"";u+=p.toDateString()===f.toDateString()?" event_today":""}if(t.state!=""){u+=t.state==0?" event_info":t.state==1?" event_todo":t.state==2?" event_done":""}if(u!=""){a.addClass(u)}if(!r){var g={target:"mouse",adjust:{mouse:false},viewport:$(window)};if(l.type.indexOf("list")>=0){g.target=a.find("a")}a.qtip({position:g,content:c,style:{classes:"qtip-shadow qtip-bootstrap"},show:{solo:true,delay:100},hide:{fixed:true,delay:100},events:{show:function(e){if(!i){e.preventDefault()}}}})}a.on("contextmenu",(function(e){e.preventDefault();var t=a.offset();$(".planning-context-menu").remove();var i=$('
      • '+__("Clone")+'
      • '+__("Delete")+"
      ");$("body").append(i);i.css({left:t.left+a.outerWidth()/4,top:t.top});var r=n.extendedProps;var l={};var o={};if(typeof n.getresources==="function"){l=n.getresources()}if(l.length===1){o={itemtype:l[0].extendedProps.itemtype||null,items_id:l[0].extendedProps.items_id||null}}$(".planning-context-menu .clone-event").click((function(){$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"clone_event",event:{old_itemtype:r.itemtype,old_items_id:r.items_id,actor:o,start:n.start.toISOString(),end:n.end.toISOString()}},success:function(){GLPIPlanning.refresh()}})}));$(".planning-context-menu .delete-event").click((function(){var e=function(e){e=e||false;$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"delete_event",event:{itemtype:r.itemtype,items_id:r.items_id,day:n.start.toISOString().substring(0,10),instance:e?1:0}},success:function(){GLPIPlanning.refresh()}})};if(!("is_recurrent"in r)||!r.is_recurrent){e()}else{$('
      ').html(__("Delete the whole serie of the recurrent event")+"
      "+__("or just add an exception by deleting this instance?")).dialog({resizable:false,height:"auto",width:"auto",modal:true,buttons:[{text:$("
      ").html(__("Serie")).text(),icon:"ui-icon-trash",click:function(){e(false);$(this).dialog("close")}},{text:$("
      ").html(__("Instance")).text(),icon:"ui-icon-trash",click:function(){e(true);$(this).dialog("close")}}]})}}))}))},datesRender:function(e){var n=e.view;if(a){GLPIPlanning.refresh()}else{a=true}$("#"+GLPIPlanning.dom_id+" .fc-toolbar .fc-center h2").after($('')).after($('
      '));if(n.type=="listFull"){if($("#planning_datepicker").length>0&&"_flatpickr"in $("#planning_datepicker")[0]){$("#planning_datepicker")[0]._flatpickr.destroy()}$("#planning_datepicker").hide();$("#planning .fc-left .fc-button-group").hide()}else{$("#planning_datepicker").show();GLPIPlanning.initFCDatePicker(new Date(n.currentStart));$("#planning .fc-left .fc-button-group").show()}GLPIPlanning.setEndofDays(e.view)},viewSkeletonRender:function(e){var n=e.view.type;GLPIPlanning.last_view=n;$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"view_changed",view:n}});GLPIPlanning.setEndofDays(e.view)},events:{url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",extraParams:function(){var e=GLPIPlanning.calendar?GLPIPlanning.calendar.state.viewType:n.default_view;var t=1;if(e.indexOf("list")>=0){t=0}return{action:"get_events",display_done_events:t,view_name:e}},success:function(e){if(!n.full_view&&e.length==0){GLPIPlanning.calendar.setOption("height",0)}},failure:function(e){console.error("there was an error while fetching events!",e)}},eventResize:function(e){var n=e.event;var t=n.extendedProps;var i=t.is_recurrent||false;if(i){$("
      ").dialog({modal:true,title:__("Recurring event resized"),width:"auto",height:"auto",buttons:[{text:__("Serie"),click:function(){$(this).remove();GLPIPlanning.editEventTimes(e)}},{text:__("Instance"),click:function(){$(this).remove();GLPIPlanning.editEventTimes(e,true)}}]}).text(__("The resized event is a recurring event. Do you want to change the serie or instance ?"))}else{GLPIPlanning.editEventTimes(e)}},eventResizeStart:function(){l=true;r=true},eventResizeStop:function(){setTimeout((function(){l=false;r=false}),300)},eventDragStart:function(){r=true},eventDrop:function(e){r=false;var n=e.event;var t=n.extendedProps;var i=t.is_recurrent||false;if(i){$("
      ").dialog({modal:true,title:__("Recurring event dragged"),width:"auto",height:"auto",buttons:[{text:__("Serie"),click:function(){$(this).remove();GLPIPlanning.editEventTimes(e)}},{text:__("Instance"),click:function(){$(this).remove();GLPIPlanning.editEventTimes(e,true)}}]}).text(__("The dragged event is a recurring event. Do you want to move the serie or instance ?"))}else{GLPIPlanning.editEventTimes(e)}},eventClick:function(e){var n=e.event;var t=n.start;var i=n.extendedProps.ajaxurl+"&start="+t.toISOString();var a=n.extendedProps._editable;if(i&&a&&!l){e.jsEvent.preventDefault();$("
      ").dialog({modal:true,width:"auto",height:"auto",close:function(){GLPIPlanning.refresh()}}).load(i,(function(){$(this).dialog("option","position",["center","center"])}))}},selectable:true,select:function(e){var n=((((e||{}).resource||{})._resource||{}).extendedProps||{}).itemtype||"";var t=((((e||{}).resource||{})._resource||{}).extendedProps||{}).items_id||0;if(n==="Group_User"){GLPIPlanning.calendar.unselect();return false}var i=e.start;var a=e.end;$("
      ").dialog({modal:true,width:"auto",height:"auto",open:function(){$(this).load(CFG_GLPI.root_doc+"/ajax/planning.php",{action:"add_event_fromselect",begin:i.toISOString(),end:a.toISOString(),res_itemtype:n,res_items_id:t},(function(){$(this).dialog("option","position",["center","center"])}))},close:function(){$(this).dialog("close");$(this).remove()},position:{my:"center",at:"top",viewport:$(window),of:$("#page")}});GLPIPlanning.calendar.unselect()}});var o=Object.keys(FullCalendarLocales);if(o.length===1){GLPIPlanning.calendar.setOption("locale",o[0])}$(".planning_on_central a").mousedown((function(){r=true;$(".qtip").hide()})).mouseup((function(){r=false}));window.onblur=function(){i=false};window.onfocus=function(){i=true};GLPIPlanning.calendar.render();$("#refresh_planning").click((function(){GLPIPlanning.refresh()}));GLPIPlanning.initFCDatePicker();$(window).focus();$(document).click((function(){$(".planning-context-menu").remove()}))},refresh:function(){if(typeof GLPIPlanning.calendar.refetchResources=="function"){GLPIPlanning.calendar.refetchResources()}GLPIPlanning.calendar.refetchEvents();GLPIPlanning.calendar.rerenderEvents();window.displayAjaxMessageAfterRedirect()},toggleResource:function(e,n){var t=GLPIPlanning.all_resources.findIndex((function(n){return n.id==e}));if(t!==-1){if(n&&GLPIPlanning.visible_res.indexOf(t.toString())===-1){GLPIPlanning.visible_res.push(t.toString())}else if(!n){GLPIPlanning.visible_res.splice(GLPIPlanning.visible_res.indexOf(t.toString()),1)}}},setEndofDays:function(e){if(e.constructor.name==="ResourceTimelineView"){var n=CFG_GLPI.planning_begin.split(":");var t=CFG_GLPI.planning_end.split(":");var i=parseInt(n[0])*60+parseInt(n[1]);var a=parseInt(t[0])*60+parseInt(t[1]);var r=a-i;var l=Math.ceil(r/60);$("#planning .fc-time-area.fc-widget-header table tr:nth-child(2) th").addClass("end-of-day");$("#planning .fc-time-area.fc-widget-header table tr:nth-child(3) th:nth-child("+l+"n)").addClass("end-of-day");$("#planning .fc-time-area.fc-widget-content table td:nth-child("+l+"n)").addClass("end-of-day")}},planningFilters:function(){$("#planning_filter a.planning_add_filter").on("click",(function(e){e.preventDefault();var n=$(this).attr("href");$("
      ").dialog({modal:true,open:function(){$(this).load(n)},position:{my:"top",at:"center",of:$("#planning_filter")}})}));$("#planning_filter .filter_option").on("click",(function(){$(this).children("ul").toggle()}));$(document).click((function(e){if($(e.target).closest("#planning_filter .filter_option").length===0){$("#planning_filter .filter_option ul").hide()}}));$("#planning_filter .delete_planning").on("click",(function(){var e=$(this);var n=e.closest("ul.filters > li");$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"delete_filter",filter:e.attr("value"),type:n.attr("event_type")},success:function(){n.remove();GLPIPlanning.refresh()}})}));var e=function(e,n){var t=e.parents("li");var i=null;if(t.parent("ul.group_listofusers").length==1){i=t.parent("ul.group_listofusers").parent("li").attr("event_name")}var a=t.attr("event_name");var r=t.attr("event_type");var l=e.is(":checked");return $.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"toggle_filter",name:a,type:r,parent:i,display:l},success:function(){GLPIPlanning.toggleResource(a,l);if(n){GLPIPlanning.refresh()}}})};$('#planning_filter li:not(li.group_users) input[type="checkbox"]').on("click",(function(){e($(this),true)}));$('#planning_filter li.group_users > span > input[type="checkbox"]').on("change",(function(){var n=$(this);var t=n.parents("li");var i=n.prop("checked");var a=t.attr("event_name");var r=n.parents("li.group_users").find('ul.group_listofusers input[type="checkbox"]');r.prop("checked",i);var l=[];r.each((function(){l.push(e($(this),false))}));GLPIPlanning.toggleResource(a,i);$.when.apply($,l).then((function(){GLPIPlanning.refresh()}))}));$("#planning_filter .color_input input").on("change",(function(){var e=$(this).parents("li");var n=null;if(e.length>=1){n=e.eq(1).attr("event_name");e=e.eq(0)}$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"color_filter",name:e.attr("event_name"),type:e.attr("event_type"),parent:n,color:$(this).val()},success:function(){GLPIPlanning.refresh()}})}));$("#planning_filter li.group_users .toggle").on("click",(function(){$(this).parent().toggleClass("expanded")}));$("#planning_filter_toggle > a.toggle").on("click",(function(){$("#planning_filter_content").animate({width:"toggle"},300,"swing",(function(){$("#planning_filter").toggleClass("folded");$("#planning_container").toggleClass("folded")}))}))},editEventTimes:function(e,n){n=n||false;var t=e.event;var i=e.revert;var a=t.extendedProps;var r=null;var l=null;var o=null;var s=null;if("newResource"in e&&e.newResource!==null){var c=e.newResource._resource.extendedProps;o=c.itemtype;s=c.items_id}if("oldResource"in e&&e.oldResource!==null){var d=e.oldResource._resource.extendedProps;r=d.itemtype;l=d.items_id}var u=t.start;var f=t.end;if(typeof f==="undefined"||f===null){f=new Date(u.getTime());if(t.allDay){f.setDate(f.getDate()+1)}else{f.setHours(f.getHours()+2)}}var p=e.oldEvent||{};var g=p.start||u;$.ajax({url:CFG_GLPI.root_doc+"/ajax/planning.php",type:"POST",data:{action:"update_event_times",start:u.toISOString(),end:f.toISOString(),itemtype:a.itemtype,items_id:a.items_id,move_instance:n,old_start:g.toISOString(),new_actor_itemtype:o,new_actor_items_id:s,old_actor_itemtype:r,old_actor_items_id:l},success:function(e){if(!e){i()}GLPIPlanning.refresh()},error:function(){i()}})},initFCDatePicker:function(e){$("#planning_datepicker").flatpickr({defaultDate:e,onChange:function(e){var n=new Date(Date.UTC(e[0].getFullYear(),e[0].getMonth(),e[0].getDate()));GLPIPlanning.calendar.gotoDate(n)}})},getHeight:function(){var e=$(window).height()-272;if($("#debugajax").length>0){e-=$("#debugajax").height()}if(CFG_GLPI.glpilayout=="vsplit"){e=$(".ui-tabs-panel").height()-30}var n=300;if(e`%${("0"+a.toString(16)).substr(-2)}`).join(""))}catch(e){}return{bytes:c,text:d}}function U(a,b){a=new V(a);let c=9>=b?0:26>=b?1:2;for(b={text:"",bytes:[],chunks:[],version:b};4<=a.available();){var d=a.readBits(4);if(d===t.Terminator)return b;if(d===t.ECI)0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(7)}): +0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(14)}):0===a.readBits(1)?b.chunks.push({type:r.ECI,assignmentNumber:a.readBits(21)}):b.chunks.push({type:r.ECI,assignmentNumber:-1});else if(d===t.Numeric){var e=a;d=[];for(var f="",g=e.readBits([10,12,14][c]);3<=g;){var h=e.readBits(10);if(1E3<=h)throw Error("Invalid numeric value above 999");var k=Math.floor(h/100),n=Math.floor(h/10)%10;h%=10;d.push(48+k,48+n,48+h);f+=k.toString()+n.toString()+h.toString();g-=3}if(2===g){g=e.readBits(7); +if(100<=g)throw Error("Invalid numeric value above 99");e=Math.floor(g/10);g%=10;d.push(48+e,48+g);f+=e.toString()+g.toString()}else if(1===g){e=e.readBits(4);if(10<=e)throw Error("Invalid numeric value above 9");d.push(48+e);f+=e.toString()}d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Numeric,text:d.text})}else if(d===t.Alphanumeric){e=a;d=[];f="";for(g=e.readBits([9,11,13][c]);2<=g;)n=e.readBits(11),k=Math.floor(n/45),n%=45,d.push(B[k].charCodeAt(0),B[n].charCodeAt(0)), +f+=B[k]+B[n],g-=2;1===g&&(e=e.readBits(6),d.push(B[e].charCodeAt(0)),f+=B[e]);d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Alphanumeric,text:d.text})}else if(d===t.Byte)d=T(a,c),b.text+=d.text,b.bytes.push(...d.bytes),b.chunks.push({type:r.Byte,bytes:d.bytes,text:d.text});else if(d===t.Kanji){f=a;d=[];e=f.readBits([8,10,12][c]);for(g=0;gk?k+33088:k+49472,d.push(k>>8,k&255);f=(new TextDecoder("shift-jis")).decode(Uint8Array.from(d)); +d={bytes:d,text:f};b.text+=d.text;b.bytes.push(...d.bytes);b.chunks.push({type:r.Kanji,bytes:d.bytes,text:d.text})}else d===t.StructuredAppend&&b.chunks.push({type:r.StructuredAppend,currentSequence:a.readBits(4),totalSequence:a.readBits(4),parity:a.readBits(8)})}if(0===a.available()||0===a.readBits(a.available()))return b}function J(a,b){return a^b}function W(a,b,c,d){b.degree()=d/2;){var g=b;let d=e;b=c;e=f;if(b.isZero())return null; +c=g;f=a.zero;g=b.getCoefficient(b.degree());for(g=a.inverse(g);c.degree()>=b.degree()&&!c.isZero();){let d=c.degree()-b.degree(),e=a.multiply(c.getCoefficient(c.degree()),g);f=f.addOrSubtract(a.buildMonomial(d,e));c=c.addOrSubtract(b.multiplyByMonomial(d,e))}f=f.multiplyPoly(e).addOrSubtract(d);if(c.degree()>=b.degree())return null}d=f.getCoefficient(0);if(0===d)return null;a=a.inverse(d);return[f.multiply(a),c.multiply(a)]}function X(a,b){let c=new Uint8ClampedArray(a.length);c.set(a);a=new Y(285, +256,0);var d=new w(a,c),e=new Uint8ClampedArray(b),f=!1;for(var g=0;gf)return null;c[f]^=d[e]}return c}function E(a,b){a^=b;for(b=0;a;)b++,a&=a-1;return b}function C(a,b){return b<<1|a}function Z(a,b,c){c=aa[c.dataMask];let d=a.height;var e=17+4*b.versionNumber,f=A.createEmpty(e,e);f.setRegion(0,0,9,9,!0);f.setRegion(e-8,0,8,9,!0);f.setRegion(0,e-8,9,8,!0);for(var g of b.alignmentPatternCenters)for(var h of b.alignmentPatternCenters)6=== +g&&6===h||6===g&&h===e-7||g===e-7&&6===h||f.setRegion(g-2,h-2,5,5,!0);f.setRegion(6,9,1,e-17,!0);f.setRegion(9,6,e-17,1,!0);6d;d++){let f=k-d;if(!b.get(f,m)){e++;let b=a.get(f,m);c({y:m,x:f})&&(b=!b);h=h<<1|b;8===e&&(g.push(h),h=e=0)}}}f=!f}return g}function ba(a){var b=a.height,c=Math.floor((b-17)/4);if(6>=c)return K[c- +1];c=0;for(var d=5;0<=d;d--)for(var e=b-9;e>=b-11;e--)c=C(a.get(e,d),c);d=0;for(e=5;0<=e;e--)for(let c=b-9;c>=b-11;c--)d=C(a.get(e,c),d);a=Infinity;let f;for(let e of K){if(e.infoBits===c||e.infoBits===d)return e;b=E(c,e.infoBits);b=a)return f}function ca(a){let b=0;for(var c=0;8>=c;c++)6!==c&&(b=C(a.get(c,8),b));for(c=7;0<=c;c--)6!==c&&(b=C(a.get(8,c),b));var d=a.height;c=0;for(var e=d-1;e>=d-7;e--)c=C(a.get(8,e),c);for(e=d-8;e=a?d:null}function ea(a,b,c){let d=b.errorCorrectionLevels[c],e=[],f=0;d.ecBlocks.forEach(a=>{for(let b=0;ba+b.numDataCodewords,0);c=new Uint8ClampedArray(c);a=0;for(let b of d){d=X(b.codewords,b.codewords.length-b.numDataCodewords);if(!d)return null;for(let e= +0;e{const c=g*a+n*b+p;return{x:(e*a+h*b+m)/c,y:(f*a+k*b+l)/c}};for(let e=0;ea+c)}function ia(a,b,c){let d=y(a,b),e=y(b,c),f=y(a,c),g,h,k;e>=d&&e>=f?[g,h,k]=[b,a,c]:f>=e&&f>=d?[g,h,k]=[a,b,c]:[g,h,k]=[a,c,b];0>(k.x-h.x)*(g.y-h.y)-(k.y-h.y)*(g.x-h.x)&&([g,k]=[k,g]);return{bottomLeft:g,topLeft:h,topRight:k}}function ja(a,b,c,d){d=(x(z(a,c,d,5))/7+x(z(a,b,d,5))/7+x(z(c,a,d,5))/7+x(z(b,a,d,5))/7)/4;if(1>d)throw Error("Invalid module size");b=Math.round(y(a,b)/d);a=Math.round(y(a,c)/d);a= +Math.floor((b+a)/2)+7;switch(a%4){case 0:a++;break;case 2:a--}return{dimension:a,moduleSize:d}}function N(a,b,c,d){let e=[{x:Math.floor(a.x),y:Math.floor(a.y)}];var f=Math.abs(b.y-a.y)>Math.abs(b.x-a.x);if(f){var g=Math.floor(a.y);var h=Math.floor(a.x);a=Math.floor(b.y);b=Math.floor(b.x)}else g=Math.floor(a.x),h=Math.floor(a.y),a=Math.floor(b.x),b=Math.floor(b.y);let k=Math.abs(a-g),n=Math.abs(b-h),m=Math.floor(-k/2),l=g{d+=Math.pow(a[f]-b*c,2)});return{averageSize:c,error:d}}function O(a,b,c){try{let d=z(a,{x:-1,y:a.y},c,b.length), +e=z(a,{x:a.x,y:-1},c,b.length),f=z(a,{x:Math.max(0,a.x-a.y)-1,y:Math.max(0,a.y-a.x)-1},c,b.length),g=z(a,{x:Math.min(c.width,a.x+a.y)+1,y:Math.min(c.height,a.y+a.x)+1},c,b.length),h=F(d,b),k=F(e,b),n=F(f,b),m=F(g,b),l=(h.averageSize+k.averageSize+n.averageSize+m.averageSize)/4;return Math.sqrt(h.error*h.error+k.error*k.error+n.error*n.error+m.error*m.error)+(Math.pow(h.averageSize-l,2)+Math.pow(k.averageSize-l,2)+Math.pow(n.averageSize-l,2)+Math.pow(m.averageSize-l,2))/l}catch(d){return Infinity}} +function H(a,b){for(var c=Math.round(b.x);a.get(c,Math.round(b.y));)c--;for(var d=Math.round(b.x);a.get(d,Math.round(b.y));)d++;c=(c+d)/2;for(d=Math.round(b.y);a.get(Math.round(c),d);)d--;for(b=Math.round(b.y);a.get(Math.round(c),b);)b++;return{x:c,y:(d+b)/2}}function ka(a){var b=[],c=[];let d=[];var e=[];for(let m=0;m<=a.height;m++){var f=0,g=!1;let l=[0,0,0,0,0];for(let b=-1;b<=a.width;b++){var h=a.get(b,m);if(h===g)f++;else{l=[l[1],l[2],l[3],l[4],f];f=1;g=h;var k=x(l)/7;k=Math.abs(l[0]-k)d>=b.bottom.startX&&d<=b.bottom.endX||a>=b.bottom.startX&&d<=b.bottom.endX||d<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5c>=b.bottom.startX&&c<=b.bottom.endX||a>=b.bottom.startX&&c<=b.bottom.endX||c<=b.bottom.startX&&a>=b.bottom.endX&&1.5>l[2]/(b.bottom.endX-b.bottom.startX)&&.5a.bottom.y!==m&&2<=a.bottom.y-a.top.y));c=c.filter(a=>a.bottom.y===m);d.push(...e.filter(a=>a.bottom.y!==m));e=e.filter(a=>a.bottom.y===m)}b.push(...c.filter(a=>2<=a.bottom.y-a.top.y));d.push(...e); +c=[];for(var m of b)2>m.bottom.y-m.top.y||(b=(m.top.startX+m.top.endX+m.bottom.startX+m.bottom.endX)/4,e=(m.top.y+m.bottom.y+1)/2,a.get(Math.round(b),Math.round(e))&&(f=[m.top.endX-m.top.startX,m.bottom.endX-m.bottom.startX,m.bottom.y-m.top.y+1],f=x(f)/f.length,g=O({x:Math.round(b),y:Math.round(e)},[1,1,3,1,1],a),c.push({score:g,x:b,y:e,size:f})));if(3>c.length)return null;c.sort((a,b)=>a.score-b.score);m=[];for(b=0;ba.score-b.score);m.push({points:[e,f[0],f[1]],score:e.score+f[0].score+f[1].score})}m.sort((a,b)=>a.score-b.score);let {topRight:p,topLeft:q,bottomLeft:v}=ia(...m[0].points);m=P(a,d,p,q,v);l=[];m&&l.push({alignmentPattern:{x:m.alignmentPattern.x,y:m.alignmentPattern.y},bottomLeft:{x:v.x,y:v.y},dimension:m.dimension,topLeft:{x:q.x,y:q.y},topRight:{x:p.x,y:p.y}});m=H(a,p);b=H(a,q);c=H(a,v);(a=P(a,d,m,b,c))&&l.push({alignmentPattern:{x:a.alignmentPattern.x, +y:a.alignmentPattern.y},bottomLeft:{x:c.x,y:c.y},topLeft:{x:b.x,y:b.y},topRight:{x:m.x,y:m.y},dimension:a.dimension});return 0===l.length?null:l}function P(a,b,c,d,e){let f,g;try{({dimension:f,moduleSize:g}=ja(d,c,e,a))}catch(m){return null}var h=c.x-d.x+e.x,k=c.y-d.y+e.y;c=(y(d,e)+y(d,c))/2/g;e=1-3/c;let n={x:d.x+e*(h-d.x),y:d.y+e*(k-d.y)};b=b.map(b=>{const c=(b.top.startX+b.top.endX+b.bottom.startX+b.bottom.endX)/4;b=(b.top.y+b.bottom.y+1)/2;if(a.get(Math.floor(c),Math.floor(b))){var d=O({x:Math.floor(c), +y:Math.floor(b)},[1,1,1],a)+y({x:c,y:b},n);return{x:c,y:b,score:d}}}).filter(a=>!!a).sort((a,b)=>a.score-b.score);return{alignmentPattern:15<=c&&b.length?b[0]:n,dimension:f}}function Q(a){var b=ka(a);if(!b)return null;for(let e of b){b=ha(a,e);var c=b.matrix;if(null==c)c=null;else{var d=L(c);if(d)c=d;else{for(d=0;d{a[c]=b[c]})}function I(a,b,c,d={}){let e=Object.create(null);R(e,la);R(e,d); +d="onlyInvert"===e.inversionAttempts||"invertFirst"===e.inversionAttempts;var f="attemptBoth"===e.inversionAttempts||d;var g=e.greyScaleWeights,h=e.canOverwriteImage,k=b*c;if(a.length!==4*k)throw Error("Malformed data passed to binarizer.");var n=0;if(h){var m=new Uint8ClampedArray(a.buffer,n,k);n+=k}m=new S(b,c,m);if(g.useIntegerApproximation)for(var l=0;l>8)}else for(l=0;lt;t++)for(let a=0;8>a;a++){let b=m.get(8*q+a,8*p+t);u=Math.min(u,b);r=Math.max(r,b)}t=(u+r)/2;t=Math.min(255,1.11*t);24>=r-u&&(t=u/2,0a?2:a>c?c:a;h=l-3;h=2>b?2:b>h?h:b;k=0;for(n=-2;2>=n;n++)for(u=-2;2>=u;u++)k+=v.get(c+n,h+u);c=k/25;for(h=0;8>h;h++)for(k=0;8>k;k++)n=8*a+h,u=8*b+k,r=m.get(n,u),p.set(n,u,r<=c),f&&q.set(n,u,!(r<=c))}f=f?{binarized:p,inverted:q}:{binarized:p};let {binarized:w,inverted:x}=f;(f=Q(d?x:w))||"attemptBoth"!==e.inversionAttempts&&"invertFirst"!==e.inversionAttempts|| +(f=Q(d?w:x));return f}class A{constructor(a,b){this.width=b;this.height=a.length/b;this.data=a}static createEmpty(a,b){return new A(new Uint8ClampedArray(a*b),a)}get(a,b){return 0>a||a>=this.width||0>b||b>=this.height?!1:!!this.data[b*this.width+a]}set(a,b,c){this.data[b*this.width+a]=c?1:0}setRegion(a,b,c,d,e){for(let f=b;fa||32this.available())throw Error("Cannot read "+a.toString()+" bits");var b=0;if(0>8-c<>b;a-=c;this.bitOffset+=c;8===this.bitOffset&&(this.bitOffset=0,this.byteOffset++)}if(0>c<>c,this.bitOffset+=a)}return b}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var r;(function(a){a.Numeric="numeric";a.Alphanumeric="alphanumeric";a.Byte="byte";a.Kanji="kanji";a.ECI="eci";a.StructuredAppend="structuredappend"})(r||(r={}));var t;(function(a){a[a.Terminator=0]="Terminator";a[a.Numeric=1]="Numeric";a[a.Alphanumeric=2]="Alphanumeric";a[a.Byte=4]="Byte";a[a.Kanji=8]="Kanji";a[a.ECI=7]="ECI";a[a.StructuredAppend= +3]="StructuredAppend"})(t||(t={}));let B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:".split("");class w{constructor(a,b){if(0===b.length)throw Error("No coefficients.");this.field=a;let c=b.length;if(1a.length&&([b,a]=[a,b]);let c=new Uint8ClampedArray(a.length),d=a.length-b.length;for(var e=0;ea)throw Error("Invalid degree less than 0");if(0===b)return this.field.zero; +let c=this.coefficients.length;a=new Uint8ClampedArray(c+a);for(let d=0;d{b^=a}),b;b=this.coefficients[0];for(let d=1;d=this.size&&(a=(a^this.primitive)&this.size-1);for(a=0;aa)throw Error("Invalid monomial degree less than 0");if(0===b)return this.zero;a=new Uint8ClampedArray(a+1);a[0]=b;return new w(this,a)}log(a){if(0===a)throw Error("Can't take log(0)");return this.logTable[a]}exp(a){return this.expTable[a]}}let K=[{infoBits:null,versionNumber:1,alignmentPatternCenters:[],errorCorrectionLevels:[{ecCodewordsPerBlock:7,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:13, +ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:13}]},{ecCodewordsPerBlock:17,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:2,alignmentPatternCenters:[6,18],errorCorrectionLevels:[{ecCodewordsPerBlock:10,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:34}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:28}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:16}]}]}, +{infoBits:null,versionNumber:3,alignmentPatternCenters:[6,22],errorCorrectionLevels:[{ecCodewordsPerBlock:15,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:55}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:13}]}]},{infoBits:null,versionNumber:4,alignmentPatternCenters:[6,26],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:1, +dataCodewordsPerBlock:80}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:32}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:9}]}]},{infoBits:null,versionNumber:5,alignmentPatternCenters:[6,30],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:43}]},{ecCodewordsPerBlock:18, +ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:11},{numBlocks:2,dataCodewordsPerBlock:12}]}]},{infoBits:null,versionNumber:6,alignmentPatternCenters:[6,34],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68}]},{ecCodewordsPerBlock:16,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:27}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:19}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:31892,versionNumber:7,alignmentPatternCenters:[6,22,38],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:78}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:31}]},{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:13}, +{numBlocks:1,dataCodewordsPerBlock:14}]}]},{infoBits:34236,versionNumber:8,alignmentPatternCenters:[6,24,42],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:97}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:38},{numBlocks:2,dataCodewordsPerBlock:39}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:18},{numBlocks:2,dataCodewordsPerBlock:19}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:14}, +{numBlocks:2,dataCodewordsPerBlock:15}]}]},{infoBits:39577,versionNumber:9,alignmentPatternCenters:[6,26,46],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:16},{numBlocks:4,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:12}, +{numBlocks:4,dataCodewordsPerBlock:13}]}]},{infoBits:42195,versionNumber:10,alignmentPatternCenters:[6,28,50],errorCorrectionLevels:[{ecCodewordsPerBlock:18,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:68},{numBlocks:2,dataCodewordsPerBlock:69}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:43},{numBlocks:1,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6, +dataCodewordsPerBlock:15},{numBlocks:2,dataCodewordsPerBlock:16}]}]},{infoBits:48118,versionNumber:11,alignmentPatternCenters:[6,30,54],errorCorrectionLevels:[{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:81}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:50},{numBlocks:4,dataCodewordsPerBlock:51}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:22},{numBlocks:4,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:3, +dataCodewordsPerBlock:12},{numBlocks:8,dataCodewordsPerBlock:13}]}]},{infoBits:51042,versionNumber:12,alignmentPatternCenters:[6,32,58],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:92},{numBlocks:2,dataCodewordsPerBlock:93}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:36},{numBlocks:2,dataCodewordsPerBlock:37}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:20},{numBlocks:6,dataCodewordsPerBlock:21}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:14},{numBlocks:4,dataCodewordsPerBlock:15}]}]},{infoBits:55367,versionNumber:13,alignmentPatternCenters:[6,34,62],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:37},{numBlocks:1,dataCodewordsPerBlock:38}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:20},{numBlocks:4,dataCodewordsPerBlock:21}]}, +{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:11},{numBlocks:4,dataCodewordsPerBlock:12}]}]},{infoBits:58893,versionNumber:14,alignmentPatternCenters:[6,26,46,66],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:115},{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:40},{numBlocks:5,dataCodewordsPerBlock:41}]},{ecCodewordsPerBlock:20,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:16}, +{numBlocks:5,dataCodewordsPerBlock:17}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:5,dataCodewordsPerBlock:13}]}]},{infoBits:63784,versionNumber:15,alignmentPatternCenters:[6,26,48,70],errorCorrectionLevels:[{ecCodewordsPerBlock:22,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:87},{numBlocks:1,dataCodewordsPerBlock:88}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:41},{numBlocks:5,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:12},{numBlocks:7,dataCodewordsPerBlock:13}]}]},{infoBits:68472,versionNumber:16,alignmentPatternCenters:[6,26,50,74],errorCorrectionLevels:[{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:98},{numBlocks:1,dataCodewordsPerBlock:99}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]}, +{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:19},{numBlocks:2,dataCodewordsPerBlock:20}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]},{infoBits:70749,versionNumber:17,alignmentPatternCenters:[6,30,54,78],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46}, +{numBlocks:1,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:22},{numBlocks:15,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:17,dataCodewordsPerBlock:15}]}]},{infoBits:76311,versionNumber:18,alignmentPatternCenters:[6,30,56,82],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:120},{numBlocks:1,dataCodewordsPerBlock:121}]},{ecCodewordsPerBlock:26, +ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:43},{numBlocks:4,dataCodewordsPerBlock:44}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:1,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:14},{numBlocks:19,dataCodewordsPerBlock:15}]}]},{infoBits:79154,versionNumber:19,alignmentPatternCenters:[6,30,58,86],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:113},{numBlocks:4, +dataCodewordsPerBlock:114}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:44},{numBlocks:11,dataCodewordsPerBlock:45}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:21},{numBlocks:4,dataCodewordsPerBlock:22}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:9,dataCodewordsPerBlock:13},{numBlocks:16,dataCodewordsPerBlock:14}]}]},{infoBits:84390,versionNumber:20,alignmentPatternCenters:[6,34,62,90],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3, +dataCodewordsPerBlock:107},{numBlocks:5,dataCodewordsPerBlock:108}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:41},{numBlocks:13,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:5,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:15},{numBlocks:10,dataCodewordsPerBlock:16}]}]},{infoBits:87683,versionNumber:21,alignmentPatternCenters:[6,28,50,72,94],errorCorrectionLevels:[{ecCodewordsPerBlock:28, +ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:116},{numBlocks:4,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:42}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:16},{numBlocks:6,dataCodewordsPerBlock:17}]}]},{infoBits:92361,versionNumber:22,alignmentPatternCenters:[6,26,50,74,98],errorCorrectionLevels:[{ecCodewordsPerBlock:28, +ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:111},{numBlocks:7,dataCodewordsPerBlock:112}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:24,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:13}]}]},{infoBits:96236,versionNumber:23,alignmentPatternCenters:[6,30,54,74,102],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4, +dataCodewordsPerBlock:121},{numBlocks:5,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:47},{numBlocks:14,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:16,dataCodewordsPerBlock:15},{numBlocks:14,dataCodewordsPerBlock:16}]}]},{infoBits:102084,versionNumber:24,alignmentPatternCenters:[6,28,54,80,106],errorCorrectionLevels:[{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:45},{numBlocks:14,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:24},{numBlocks:16,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:30,dataCodewordsPerBlock:16},{numBlocks:2,dataCodewordsPerBlock:17}]}]},{infoBits:102881,versionNumber:25,alignmentPatternCenters:[6, +32,58,84,110],errorCorrectionLevels:[{ecCodewordsPerBlock:26,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:106},{numBlocks:4,dataCodewordsPerBlock:107}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:47},{numBlocks:13,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:13,dataCodewordsPerBlock:16}]}]}, +{infoBits:110507,versionNumber:26,alignmentPatternCenters:[6,30,58,86,114],errorCorrectionLevels:[{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:114},{numBlocks:2,dataCodewordsPerBlock:115}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:46},{numBlocks:4,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:28,dataCodewordsPerBlock:22},{numBlocks:6,dataCodewordsPerBlock:23}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:33,dataCodewordsPerBlock:16}, +{numBlocks:4,dataCodewordsPerBlock:17}]}]},{infoBits:110734,versionNumber:27,alignmentPatternCenters:[6,34,62,90,118],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:45},{numBlocks:3,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:8,dataCodewordsPerBlock:23},{numBlocks:26,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:117786,versionNumber:28,alignmentPatternCenters:[6,26,50,74,98,122],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:117},{numBlocks:10,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:3,dataCodewordsPerBlock:45},{numBlocks:23,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:24},{numBlocks:31, +dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:31,dataCodewordsPerBlock:16}]}]},{infoBits:119615,versionNumber:29,alignmentPatternCenters:[6,30,54,78,102,126],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:7,dataCodewordsPerBlock:116},{numBlocks:7,dataCodewordsPerBlock:117}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:21,dataCodewordsPerBlock:45},{numBlocks:7,dataCodewordsPerBlock:46}]},{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:1,dataCodewordsPerBlock:23},{numBlocks:37,dataCodewordsPerBlock:24}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:26,dataCodewordsPerBlock:16}]}]},{infoBits:126325,versionNumber:30,alignmentPatternCenters:[6,26,52,78,104,130],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:5,dataCodewordsPerBlock:115},{numBlocks:10,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:47}, +{numBlocks:10,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:15,dataCodewordsPerBlock:24},{numBlocks:25,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:25,dataCodewordsPerBlock:16}]}]},{infoBits:127568,versionNumber:31,alignmentPatternCenters:[6,30,56,82,108,134],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:3,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28, +ecBlocks:[{numBlocks:2,dataCodewordsPerBlock:46},{numBlocks:29,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:24},{numBlocks:1,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:23,dataCodewordsPerBlock:15},{numBlocks:28,dataCodewordsPerBlock:16}]}]},{infoBits:133589,versionNumber:32,alignmentPatternCenters:[6,34,60,86,112,138],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}]}, +{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:24},{numBlocks:35,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:15},{numBlocks:35,dataCodewordsPerBlock:16}]}]},{infoBits:136944,versionNumber:33,alignmentPatternCenters:[6,30,58,86,114,142],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:115}, +{numBlocks:1,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:21,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:24},{numBlocks:19,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:11,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:141498,versionNumber:34,alignmentPatternCenters:[6,34,62,90,118,146],errorCorrectionLevels:[{ecCodewordsPerBlock:30, +ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:115},{numBlocks:6,dataCodewordsPerBlock:116}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:14,dataCodewordsPerBlock:46},{numBlocks:23,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:44,dataCodewordsPerBlock:24},{numBlocks:7,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:59,dataCodewordsPerBlock:16},{numBlocks:1,dataCodewordsPerBlock:17}]}]},{infoBits:145311,versionNumber:35,alignmentPatternCenters:[6, +30,54,78,102,126,150],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:121},{numBlocks:7,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:12,dataCodewordsPerBlock:47},{numBlocks:26,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:39,dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:22,dataCodewordsPerBlock:15},{numBlocks:41,dataCodewordsPerBlock:16}]}]}, +{infoBits:150283,versionNumber:36,alignmentPatternCenters:[6,24,50,76,102,128,154],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:121},{numBlocks:14,dataCodewordsPerBlock:122}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:6,dataCodewordsPerBlock:47},{numBlocks:34,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:46,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:2, +dataCodewordsPerBlock:15},{numBlocks:64,dataCodewordsPerBlock:16}]}]},{infoBits:152622,versionNumber:37,alignmentPatternCenters:[6,28,54,80,106,132,158],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:17,dataCodewordsPerBlock:122},{numBlocks:4,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:29,dataCodewordsPerBlock:46},{numBlocks:14,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:49,dataCodewordsPerBlock:24},{numBlocks:10,dataCodewordsPerBlock:25}]}, +{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:24,dataCodewordsPerBlock:15},{numBlocks:46,dataCodewordsPerBlock:16}]}]},{infoBits:158308,versionNumber:38,alignmentPatternCenters:[6,32,58,84,110,136,162],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:4,dataCodewordsPerBlock:122},{numBlocks:18,dataCodewordsPerBlock:123}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:13,dataCodewordsPerBlock:46},{numBlocks:32,dataCodewordsPerBlock:47}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:48, +dataCodewordsPerBlock:24},{numBlocks:14,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:42,dataCodewordsPerBlock:15},{numBlocks:32,dataCodewordsPerBlock:16}]}]},{infoBits:161089,versionNumber:39,alignmentPatternCenters:[6,26,54,82,110,138,166],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:117},{numBlocks:4,dataCodewordsPerBlock:118}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:40,dataCodewordsPerBlock:47},{numBlocks:7,dataCodewordsPerBlock:48}]}, +{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:43,dataCodewordsPerBlock:24},{numBlocks:22,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:10,dataCodewordsPerBlock:15},{numBlocks:67,dataCodewordsPerBlock:16}]}]},{infoBits:167017,versionNumber:40,alignmentPatternCenters:[6,30,58,86,114,142,170],errorCorrectionLevels:[{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:19,dataCodewordsPerBlock:118},{numBlocks:6,dataCodewordsPerBlock:119}]},{ecCodewordsPerBlock:28,ecBlocks:[{numBlocks:18, +dataCodewordsPerBlock:47},{numBlocks:31,dataCodewordsPerBlock:48}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:34,dataCodewordsPerBlock:24},{numBlocks:34,dataCodewordsPerBlock:25}]},{ecCodewordsPerBlock:30,ecBlocks:[{numBlocks:20,dataCodewordsPerBlock:15},{numBlocks:61,dataCodewordsPerBlock:16}]}]}],da=[{bits:21522,formatInfo:{errorCorrectionLevel:1,dataMask:0}},{bits:20773,formatInfo:{errorCorrectionLevel:1,dataMask:1}},{bits:24188,formatInfo:{errorCorrectionLevel:1,dataMask:2}},{bits:23371,formatInfo:{errorCorrectionLevel:1, +dataMask:3}},{bits:17913,formatInfo:{errorCorrectionLevel:1,dataMask:4}},{bits:16590,formatInfo:{errorCorrectionLevel:1,dataMask:5}},{bits:20375,formatInfo:{errorCorrectionLevel:1,dataMask:6}},{bits:19104,formatInfo:{errorCorrectionLevel:1,dataMask:7}},{bits:30660,formatInfo:{errorCorrectionLevel:0,dataMask:0}},{bits:29427,formatInfo:{errorCorrectionLevel:0,dataMask:1}},{bits:32170,formatInfo:{errorCorrectionLevel:0,dataMask:2}},{bits:30877,formatInfo:{errorCorrectionLevel:0,dataMask:3}},{bits:26159, +formatInfo:{errorCorrectionLevel:0,dataMask:4}},{bits:25368,formatInfo:{errorCorrectionLevel:0,dataMask:5}},{bits:27713,formatInfo:{errorCorrectionLevel:0,dataMask:6}},{bits:26998,formatInfo:{errorCorrectionLevel:0,dataMask:7}},{bits:5769,formatInfo:{errorCorrectionLevel:3,dataMask:0}},{bits:5054,formatInfo:{errorCorrectionLevel:3,dataMask:1}},{bits:7399,formatInfo:{errorCorrectionLevel:3,dataMask:2}},{bits:6608,formatInfo:{errorCorrectionLevel:3,dataMask:3}},{bits:1890,formatInfo:{errorCorrectionLevel:3, +dataMask:4}},{bits:597,formatInfo:{errorCorrectionLevel:3,dataMask:5}},{bits:3340,formatInfo:{errorCorrectionLevel:3,dataMask:6}},{bits:2107,formatInfo:{errorCorrectionLevel:3,dataMask:7}},{bits:13663,formatInfo:{errorCorrectionLevel:2,dataMask:0}},{bits:12392,formatInfo:{errorCorrectionLevel:2,dataMask:1}},{bits:16177,formatInfo:{errorCorrectionLevel:2,dataMask:2}},{bits:14854,formatInfo:{errorCorrectionLevel:2,dataMask:3}},{bits:9396,formatInfo:{errorCorrectionLevel:2,dataMask:4}},{bits:8579,formatInfo:{errorCorrectionLevel:2, +dataMask:5}},{bits:11994,formatInfo:{errorCorrectionLevel:2,dataMask:6}},{bits:11245,formatInfo:{errorCorrectionLevel:2,dataMask:7}}],aa=[a=>0===(a.y+a.x)%2,a=>0===a.y%2,a=>0===a.x%3,a=>0===(a.y+a.x)%3,a=>0===(Math.floor(a.y/2)+Math.floor(a.x/3))%2,a=>0===a.x*a.y%2+a.x*a.y%3,a=>0===(a.y*a.x%2+a.y*a.x%3)%2,a=>0===((a.y+a.x)%2+a.y*a.x%3)%2],y=(a,b)=>Math.sqrt(Math.pow(b.x-a.x,2)+Math.pow(b.y-a.y,2)),la={inversionAttempts:"attemptBoth",greyScaleWeights:{red:.2126,green:.7152,blue:.0722,useIntegerApproximation:!1}, +canOverwriteImage:!0};I.default=I;let G="dontInvert",D={red:77,green:150,blue:29,useIntegerApproximation:!0};self.onmessage=a=>{let b=a.data.data;switch(a.data.type){case "decode":a=I(b.data,b.width,b.height,{inversionAttempts:G,greyScaleWeights:D});self.postMessage({type:"qrResult",data:a?a.data:null});break;case "grayscaleWeights":D.red=b.red;D.green=b.green;D.blue=b.blue;D.useIntegerApproximation=b.useIntegerApproximation;break;case "inversionMode":switch(b){case "original":G="dontInvert";break; +case "invert":G="onlyInvert";break;case "both":G="attemptBoth";break;default:throw Error("Invalid inversion mode");}break;case "close":self.close()}}})() +//# sourceMappingURL=qr-scanner-worker.min.js.map \ No newline at end of file diff --git a/js/qr-scanner.min.js b/js/qr-scanner.min.js new file mode 100644 index 00000000..07e395de --- /dev/null +++ b/js/qr-scanner.min.js @@ -0,0 +1,20 @@ +class f{static hasCamera(){return f.listCameras(!1).then(a=>!!a.length).catch(()=>!1)}static listCameras(a=!1){if(!navigator.mediaDevices)return Promise.resolve([]);let b=null;return(a?navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(a=>b=a).catch(()=>{}):Promise.resolve()).then(()=>navigator.mediaDevices.enumerateDevices()).then(a=>a.filter(a=>"videoinput"===a.kind).map((a,b)=>({id:a.deviceId,label:a.label||(0===b?"Default Camera":`Camera ${b+1}`)}))).finally(()=>{if(b)for(let a of b.getTracks())a.stop(), +b.removeTrack(a)})}constructor(a,b,c=this._onDecodeError,d=this._calculateScanRegion,g="environment"){this.$video=a;this.$canvas=document.createElement("canvas");this._onDecode=b;this._legacyCanvasSize=f.DEFAULT_CANVAS_SIZE;this._preferredCamera=g;this._flashOn=this._paused=this._active=!1;"number"===typeof c?(this._legacyCanvasSize=c,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._onDecodeError=c;"number"===typeof d?(this._legacyCanvasSize= +d,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._calculateScanRegion=d;this._scanRegion=this._calculateScanRegion(a);this._onPlay=this._onPlay.bind(this);this._onLoadedMetaData=this._onLoadedMetaData.bind(this);this._onVisibilityChange=this._onVisibilityChange.bind(this);a.disablePictureInPicture=!0;a.playsInline=!0;a.muted=!0;let h=!1;a.hidden&&(a.hidden=!1,h=!0);document.body.contains(a)||(document.body.appendChild(a),h= +!0);requestAnimationFrame(()=>{let b=window.getComputedStyle(a);"none"===b.display&&(a.style.setProperty("display","block","important"),h=!0);"visible"!==b.visibility&&(a.style.setProperty("visibility","visible","important"),h=!0);h&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),a.style.opacity=0,a.style.width=0,a.style.height=0)});a.addEventListener("play",this._onPlay);a.addEventListener("loadedmetadata",this._onLoadedMetaData);document.addEventListener("visibilitychange", +this._onVisibilityChange);this._qrEnginePromise=f.createQrEngine()}hasFlash(){let a=null;return(this.$video.srcObject?Promise.resolve(this.$video.srcObject.getVideoTracks()[0]):this._getCameraStream().then(({stream:b})=>{console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream");a=b;return b.getVideoTracks()[0]})).then(a=>"torch"in a.getSettings()).catch(()=>!1).finally(()=>{if(a)for(let b of a.getTracks())b.stop(),a.removeTrack(b)})}isFlashOn(){return this._flashOn}toggleFlash(){return this._flashOn? +this.turnFlashOff():this.turnFlashOn()}turnFlashOn(){if(this._flashOn)return Promise.resolve();this._flashOn=!0;return!this._active||this._paused?Promise.resolve():this.hasFlash().then(a=>a?this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]}):Promise.reject("No flash available")).catch(()=>{this._flashOn=!1;throw e;})}turnFlashOff(){if(this._flashOn)return this._flashOn=!1,this._restartVideoStream()}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData); +this.$video.removeEventListener("play",this._onPlay);document.removeEventListener("visibilitychange",this._onVisibilityChange);this.stop();f._postWorkerMessage(this._qrEnginePromise,"close")}start(){if(this._active&&!this._paused)return Promise.resolve();"https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https.");this._active=!0;if(document.hidden)return Promise.resolve();this._paused=!1;return this.$video.srcObject?(this.$video.play(), +Promise.resolve()):this._getCameraStream().then(({stream:a,facingMode:b})=>{this.$video.srcObject=a;this.$video.play();this._setVideoMirror(b);this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{}))}).catch(a=>{this._active=!1;throw a;})}stop(){this.pause();this._active=!1}pause(a=!1){this._paused=!0;if(!this._active)return Promise.resolve(!0);this.$video.pause();let b=()=>{const a=this.$video.srcObject?this.$video.srcObject.getTracks():[];for(const b of a)b.stop(),this.$video.srcObject.removeTrack(b); +this.$video.srcObject=null};return a?(b(),Promise.resolve(!0)):(new Promise(a=>setTimeout(a,300))).then(()=>{if(!this._paused)return!1;b();return!0})}setCamera(a){if(a===this._preferredCamera)return Promise.resolve();this._preferredCamera=a;return this._restartVideoStream()}static scanImage(a,b=null,c=null,d=null,g=!1,h=!1){let k=c instanceof Worker,l=Promise.all([c||f.createQrEngine(),f._loadImage(a)]).then(([a,h])=>{c=a;let l;[d,l]=this._drawToCanvas(h,b,d,g);return c instanceof Worker?(k||c.postMessage({type:"inversionMode", +data:"both"}),new Promise((a,b)=>{let g,h,k;h=d=>{"qrResult"===d.data.type&&(c.removeEventListener("message",h),c.removeEventListener("error",k),clearTimeout(g),null!==d.data.data?a(d.data.data):b(f.NO_QR_CODE_FOUND))};k=a=>{c.removeEventListener("message",h);c.removeEventListener("error",k);clearTimeout(g);b("Scanner error: "+(a?a.message||a:"Unknown Error"))};c.addEventListener("message",h);c.addEventListener("error",k);g=setTimeout(()=>k("timeout"),1E4);let m=l.getImageData(0,0,d.width,d.height); +c.postMessage({type:"decode",data:m},[m.data.buffer])})):new Promise((a,b)=>{let g=setTimeout(()=>b("Scanner error: timeout"),1E4);c.detect(d).then(c=>{c.length?a(c[0].rawValue):b(f.NO_QR_CODE_FOUND)}).catch(a=>b("Scanner error: "+(a.message||a))).finally(()=>clearTimeout(g))})});b&&h&&(l=l.catch(()=>f.scanImage(a,null,c,d,g)));return l=l.finally(()=>{k||f._postWorkerMessage(c,"close")})}setGrayscaleWeights(a,b,c,d=!0){f._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,blue:c, +useIntegerApproximation:d})}setInversionMode(a){f._postWorkerMessage(this._qrEnginePromise,"inversionMode",a)}static createQrEngine(a=f.WORKER_PATH){return("BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats?BarcodeDetector.getSupportedFormats():Promise.resolve([])).then(b=>-1!==b.indexOf("qr_code")?new BarcodeDetector({formats:["qr_code"]}):new Worker(a))}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video)}_onVisibilityChange(){document.hidden? +this.pause():this._active&&this.start()}_calculateScanRegion(a){let b=Math.round(2/3*Math.min(a.videoWidth,a.videoHeight));return{x:Math.round((a.videoWidth-b)/2),y:Math.round((a.videoHeight-b)/2),width:b,height:b,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_scanFrame(){if(!this._active||this.$video.paused||this.$video.ended)return!1;requestAnimationFrame(()=>{1>=this.$video.readyState?this._scanFrame():this._qrEnginePromise.then(a=>f.scanImage(this.$video,this._scanRegion, +a,this.$canvas)).then(this._onDecode,a=>{this._active&&(-1!==(a.message||a).indexOf("service unavailable")&&(this._qrEnginePromise=f.createQrEngine()),this._onDecodeError(a))}).then(()=>this._scanFrame())})}_onDecodeError(a){a!==f.NO_QR_CODE_FOUND&&console.log(a)}_getCameraStream(){if(!navigator.mediaDevices)return Promise.reject("Camera not found.");let a="environment"===this._preferredCamera||"user"===this._preferredCamera?"facingMode":"deviceId",b=[{width:{min:1024}},{width:{min:768}},{}];return[...b.map(b=> +Object.assign({},b,{[a]:{exact:this._preferredCamera}})),...b].reduceRight((a,b)=>()=>navigator.mediaDevices.getUserMedia({video:b,audio:!1}).then(a=>({stream:a,facingMode:this._getFacingMode(a)||(b.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment")})).catch(a),()=>Promise.reject("Camera not found."))()}_restartVideoStream(){let a=this._paused;return this.pause(!0).then(b=>{if(b&&!a&&this._active)return this.start()})}_setVideoMirror(a){this.$video.style.transform= +"scaleX("+("user"===a?-1:1)+")"}_getFacingMode(a){return(a=a.getVideoTracks()[0])?/rear|back|environment/i.test(a.label)?"environment":/front|user|face/i.test(a.label)?"user":null:null}static _drawToCanvas(a,b=null,c=null,d=!1){c=c||document.createElement("canvas");let g=b&&b.x?b.x:0,h=b&&b.y?b.y:0,k=b&&b.width?b.width:a.width||a.videoWidth,l=b&&b.height?b.height:a.height||a.videoHeight;d||(d=b&&b.downScaledWidth?b.downScaledWidth:k,b=b&&b.downScaledHeight?b.downScaledHeight:l,c.width!==d&&(c.width= +d),c.height!==b&&(c.height=b));b=c.getContext("2d",{alpha:!1});b.imageSmoothingEnabled=!1;b.drawImage(a,g,h,k,l,0,0,c.width,c.height);return[c,b]}static _loadImage(a){if(a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||window.ImageBitmap&&a instanceof window.ImageBitmap||window.OffscreenCanvas&&a instanceof window.OffscreenCanvas)return Promise.resolve(a);if(a instanceof Image)return f._awaitImageLoad(a).then(()=>a);if(a instanceof File||a instanceof Blob||a instanceof URL||"string"=== +typeof a){let b=new Image;b.src=a instanceof File||a instanceof Blob?URL.createObjectURL(a):a;return f._awaitImageLoad(b).then(()=>{(a instanceof File||a instanceof Blob)&&URL.revokeObjectURL(b.src);return b})}return Promise.reject("Unsupported image type.")}static _awaitImageLoad(a){return new Promise((b,c)=>{if(a.complete&&0!==a.naturalWidth)b();else{let d,g;d=()=>{a.removeEventListener("load",d);a.removeEventListener("error",g);b()};g=()=>{a.removeEventListener("load",d);a.removeEventListener("error", +g);c("Image load error")};a.addEventListener("load",d);a.addEventListener("error",g)}})}static _postWorkerMessage(a,b,c){return Promise.resolve(a).then(a=>{a instanceof Worker&&a.postMessage({type:b,data:c})})}}f.DEFAULT_CANVAS_SIZE=400;f.NO_QR_CODE_FOUND="No QR code found";f.WORKER_PATH="qr-scanner-worker.min.js";export default f +//# sourceMappingURL=qr-scanner.min.js.map diff --git a/js/qr-scanner.umd.min.js b/js/qr-scanner.umd.min.js new file mode 100644 index 00000000..70d61f6f --- /dev/null +++ b/js/qr-scanner.umd.min.js @@ -0,0 +1,20 @@ +'use strict';(function(d,a){"object"===typeof exports&&"undefined"!==typeof module?module.exports=a():"function"===typeof define&&define.amd?define(a):(d=d||self,d.QrScanner=a())})(this,function(){class d{static hasCamera(){return d.listCameras(!1).then(a=>!!a.length).catch(()=>!1)}static listCameras(a=!1){if(!navigator.mediaDevices)return Promise.resolve([]);let b=null;return(a?navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then(a=>b=a).catch(()=>{}):Promise.resolve()).then(()=>navigator.mediaDevices.enumerateDevices()).then(a=> +a.filter(a=>"videoinput"===a.kind).map((a,b)=>({id:a.deviceId,label:a.label||(0===b?"Default Camera":`Camera ${b+1}`)}))).finally(()=>{if(b)for(let a of b.getTracks())a.stop(),b.removeTrack(a)})}constructor(a,b,c=this._onDecodeError,f=this._calculateScanRegion,k="environment"){this.$video=a;this.$canvas=document.createElement("canvas");this._onDecode=b;this._legacyCanvasSize=d.DEFAULT_CANVAS_SIZE;this._preferredCamera=k;this._flashOn=this._paused=this._active=!1;"number"===typeof c?(this._legacyCanvasSize= +c,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._onDecodeError=c;"number"===typeof f?(this._legacyCanvasSize=f,console.warn("You're using a deprecated version of the QrScanner constructor which will be removed in the future")):this._calculateScanRegion=f;this._scanRegion=this._calculateScanRegion(a);this._onPlay=this._onPlay.bind(this);this._onLoadedMetaData=this._onLoadedMetaData.bind(this);this._onVisibilityChange=this._onVisibilityChange.bind(this); +a.disablePictureInPicture=!0;a.playsInline=!0;a.muted=!0;let g=!1;a.hidden&&(a.hidden=!1,g=!0);document.body.contains(a)||(document.body.appendChild(a),g=!0);requestAnimationFrame(()=>{let b=window.getComputedStyle(a);"none"===b.display&&(a.style.setProperty("display","block","important"),g=!0);"visible"!==b.visibility&&(a.style.setProperty("visibility","visible","important"),g=!0);g&&(console.warn("QrScanner has overwritten the video hiding style to avoid Safari stopping the playback."),a.style.opacity= +0,a.style.width=0,a.style.height=0)});a.addEventListener("play",this._onPlay);a.addEventListener("loadedmetadata",this._onLoadedMetaData);document.addEventListener("visibilitychange",this._onVisibilityChange);this._qrEnginePromise=d.createQrEngine()}hasFlash(){let a=null;return(this.$video.srcObject?Promise.resolve(this.$video.srcObject.getVideoTracks()[0]):this._getCameraStream().then(({stream:b})=>{console.warn("Call hasFlash after successfully starting the scanner to avoid creating a temporary video stream"); +a=b;return b.getVideoTracks()[0]})).then(a=>"torch"in a.getSettings()).catch(()=>!1).finally(()=>{if(a)for(let b of a.getTracks())b.stop(),a.removeTrack(b)})}isFlashOn(){return this._flashOn}toggleFlash(){return this._flashOn?this.turnFlashOff():this.turnFlashOn()}turnFlashOn(){if(this._flashOn)return Promise.resolve();this._flashOn=!0;return!this._active||this._paused?Promise.resolve():this.hasFlash().then(a=>a?this.$video.srcObject.getVideoTracks()[0].applyConstraints({advanced:[{torch:!0}]}):Promise.reject("No flash available")).catch(()=> +{this._flashOn=!1;throw e;})}turnFlashOff(){if(this._flashOn)return this._flashOn=!1,this._restartVideoStream()}destroy(){this.$video.removeEventListener("loadedmetadata",this._onLoadedMetaData);this.$video.removeEventListener("play",this._onPlay);document.removeEventListener("visibilitychange",this._onVisibilityChange);this.stop();d._postWorkerMessage(this._qrEnginePromise,"close")}start(){if(this._active&&!this._paused)return Promise.resolve();"https:"!==window.location.protocol&&console.warn("The camera stream is only accessible if the page is transferred via https."); +this._active=!0;if(document.hidden)return Promise.resolve();this._paused=!1;return this.$video.srcObject?(this.$video.play(),Promise.resolve()):this._getCameraStream().then(({stream:a,facingMode:b})=>{this.$video.srcObject=a;this.$video.play();this._setVideoMirror(b);this._flashOn&&(this._flashOn=!1,this.turnFlashOn().catch(()=>{}))}).catch(a=>{this._active=!1;throw a;})}stop(){this.pause();this._active=!1}pause(a=!1){this._paused=!0;if(!this._active)return Promise.resolve(!0);this.$video.pause(); +let b=()=>{const a=this.$video.srcObject?this.$video.srcObject.getTracks():[];for(const b of a)b.stop(),this.$video.srcObject.removeTrack(b);this.$video.srcObject=null};return a?(b(),Promise.resolve(!0)):(new Promise(a=>setTimeout(a,300))).then(()=>{if(!this._paused)return!1;b();return!0})}setCamera(a){if(a===this._preferredCamera)return Promise.resolve();this._preferredCamera=a;return this._restartVideoStream()}static scanImage(a,b=null,c=null,f=null,k=!1,g=!1){let h=c instanceof Worker,l=Promise.all([c|| +d.createQrEngine(),d._loadImage(a)]).then(([a,g])=>{c=a;let l;[f,l]=this._drawToCanvas(g,b,f,k);return c instanceof Worker?(h||c.postMessage({type:"inversionMode",data:"both"}),new Promise((a,b)=>{let k,g,h;g=f=>{"qrResult"===f.data.type&&(c.removeEventListener("message",g),c.removeEventListener("error",h),clearTimeout(k),null!==f.data.data?a(f.data.data):b(d.NO_QR_CODE_FOUND))};h=a=>{c.removeEventListener("message",g);c.removeEventListener("error",h);clearTimeout(k);b("Scanner error: "+(a?a.message|| +a:"Unknown Error"))};c.addEventListener("message",g);c.addEventListener("error",h);k=setTimeout(()=>h("timeout"),1E4);let m=l.getImageData(0,0,f.width,f.height);c.postMessage({type:"decode",data:m},[m.data.buffer])})):new Promise((a,b)=>{let k=setTimeout(()=>b("Scanner error: timeout"),1E4);c.detect(f).then(c=>{c.length?a(c[0].rawValue):b(d.NO_QR_CODE_FOUND)}).catch(a=>b("Scanner error: "+(a.message||a))).finally(()=>clearTimeout(k))})});b&&g&&(l=l.catch(()=>d.scanImage(a,null,c,f,k)));return l=l.finally(()=> +{h||d._postWorkerMessage(c,"close")})}setGrayscaleWeights(a,b,c,f=!0){d._postWorkerMessage(this._qrEnginePromise,"grayscaleWeights",{red:a,green:b,blue:c,useIntegerApproximation:f})}setInversionMode(a){d._postWorkerMessage(this._qrEnginePromise,"inversionMode",a)}static createQrEngine(a=d.WORKER_PATH){return("BarcodeDetector"in window&&BarcodeDetector.getSupportedFormats?BarcodeDetector.getSupportedFormats():Promise.resolve([])).then(b=>-1!==b.indexOf("qr_code")?new BarcodeDetector({formats:["qr_code"]}): +new Worker(a))}_onPlay(){this._scanRegion=this._calculateScanRegion(this.$video);this._scanFrame()}_onLoadedMetaData(){this._scanRegion=this._calculateScanRegion(this.$video)}_onVisibilityChange(){document.hidden?this.pause():this._active&&this.start()}_calculateScanRegion(a){let b=Math.round(2/3*Math.min(a.videoWidth,a.videoHeight));return{x:Math.round((a.videoWidth-b)/2),y:Math.round((a.videoHeight-b)/2),width:b,height:b,downScaledWidth:this._legacyCanvasSize,downScaledHeight:this._legacyCanvasSize}}_scanFrame(){if(!this._active|| +this.$video.paused||this.$video.ended)return!1;requestAnimationFrame(()=>{1>=this.$video.readyState?this._scanFrame():this._qrEnginePromise.then(a=>d.scanImage(this.$video,this._scanRegion,a,this.$canvas)).then(this._onDecode,a=>{this._active&&(-1!==(a.message||a).indexOf("service unavailable")&&(this._qrEnginePromise=d.createQrEngine()),this._onDecodeError(a))}).then(()=>this._scanFrame())})}_onDecodeError(a){a!==d.NO_QR_CODE_FOUND&&console.log(a)}_getCameraStream(){if(!navigator.mediaDevices)return Promise.reject("Camera not found."); +let a="environment"===this._preferredCamera||"user"===this._preferredCamera?"facingMode":"deviceId",b=[{width:{min:1024}},{width:{min:768}},{}];return[...b.map(b=>Object.assign({},b,{[a]:{exact:this._preferredCamera}})),...b].reduceRight((a,b)=>()=>navigator.mediaDevices.getUserMedia({video:b,audio:!1}).then(a=>({stream:a,facingMode:this._getFacingMode(a)||(b.facingMode?this._preferredCamera:"environment"===this._preferredCamera?"user":"environment")})).catch(a),()=>Promise.reject("Camera not found."))()}_restartVideoStream(){let a= +this._paused;return this.pause(!0).then(b=>{if(b&&!a&&this._active)return this.start()})}_setVideoMirror(a){this.$video.style.transform="scaleX("+("user"===a?-1:1)+")"}_getFacingMode(a){return(a=a.getVideoTracks()[0])?/rear|back|environment/i.test(a.label)?"environment":/front|user|face/i.test(a.label)?"user":null:null}static _drawToCanvas(a,b=null,c=null,f=!1){c=c||document.createElement("canvas");let d=b&&b.x?b.x:0,g=b&&b.y?b.y:0,h=b&&b.width?b.width:a.width||a.videoWidth,l=b&&b.height?b.height: +a.height||a.videoHeight;f||(f=b&&b.downScaledWidth?b.downScaledWidth:h,b=b&&b.downScaledHeight?b.downScaledHeight:l,c.width!==f&&(c.width=f),c.height!==b&&(c.height=b));b=c.getContext("2d",{alpha:!1});b.imageSmoothingEnabled=!1;b.drawImage(a,d,g,h,l,0,0,c.width,c.height);return[c,b]}static _loadImage(a){if(a instanceof HTMLCanvasElement||a instanceof HTMLVideoElement||window.ImageBitmap&&a instanceof window.ImageBitmap||window.OffscreenCanvas&&a instanceof window.OffscreenCanvas)return Promise.resolve(a); +if(a instanceof Image)return d._awaitImageLoad(a).then(()=>a);if(a instanceof File||a instanceof Blob||a instanceof URL||"string"===typeof a){let b=new Image;b.src=a instanceof File||a instanceof Blob?URL.createObjectURL(a):a;return d._awaitImageLoad(b).then(()=>{(a instanceof File||a instanceof Blob)&&URL.revokeObjectURL(b.src);return b})}return Promise.reject("Unsupported image type.")}static _awaitImageLoad(a){return new Promise((b,c)=>{if(a.complete&&0!==a.naturalWidth)b();else{let f,d;f=()=> +{a.removeEventListener("load",f);a.removeEventListener("error",d);b()};d=()=>{a.removeEventListener("load",f);a.removeEventListener("error",d);c("Image load error")};a.addEventListener("load",f);a.addEventListener("error",d)}})}static _postWorkerMessage(a,b,c){return Promise.resolve(a).then(a=>{a instanceof Worker&&a.postMessage({type:b,data:c})})}}d.DEFAULT_CANVAS_SIZE=400;d.NO_QR_CODE_FOUND="No QR code found";d.WORKER_PATH="qr-scanner-worker.min.js";return d}) +//# sourceMappingURL=qr-scanner.umd.min.js.map diff --git a/js/rack.min.js b/js/rack.min.js new file mode 100644 index 00000000..1bca265d --- /dev/null +++ b/js/rack.min.js @@ -0,0 +1 @@ +var x_before_drag=0;var y_before_drag=0;var dirty=false;var initRack=function(){$(document).on("click","#sviewlist",(function(){$("#viewlist").show();$("#viewgraph").hide();$(this).addClass("selected");$("#sviewgraph").removeClass("selected")})).on("click","#sviewgraph",(function(){$("#viewlist").hide();$("#viewgraph").show();$(this).addClass("selected");$("#sviewlist").removeClass("selected")})).on("click","#toggle_images",(function(){$("#toggle_text").toggle();$(this).toggleClass("active");$("#viewgraph").toggleClass("clear_picture")})).on("click","#toggle_text",(function(){$(this).toggleClass("active");$("#viewgraph").toggleClass("clear_text")})).on("click",".cell_add",(function(){var t=grid_rack_units-$(this).index();var e=$(this).parents(".rack_side").hasClass("rack_front")?0:1;$.ajax({url:grid_link_url,data:{racks_id:grid_rack_id,orientation:e,position:t,ajax:true},success:function(t){$("#grid-dialog").html(t).dialog({modal:true,width:"auto"})}})}));$(".grid-stack").each((function(){$(this).gridstack({cellHeight:20,verticalMargin:1,float:true,disableOneColumnMode:true,animate:true,removeTimeout:100,disableResize:true,draggable:{handle:".grid-stack-item-content",appendTo:"body",containment:".grid-stack",cursor:"move",scroll:true}})}));$(".grid-stack").on("dragstart",(function(t){var e=$(t.target);var i=e.data("_gridstack_node");x_before_drag=Number(i.x);y_before_drag=Number(i.y);e.qtip("hide",true)})).on("click",(function(t){var e=$(t.target);var i=e.find(".itemrack_name").attr("href");if(i){window.location=i}}));$("#viewgraph .cell_add, #viewgraph .grid-stack-item").each((function(){var t=$(this).find(".tipcontent");if(t.length){$(this).qtip({position:{my:"left center",at:"right center"},content:{text:t},style:{classes:"qtip-shadow qtip-bootstrap rack_tipcontent"}})}}));for(var t=grid_rack_units;t>=1;t--){$(".indexes").append("
    • "+t+"
    • ");$(".racks_add").append('
      '+grid_rack_add_tip+"
      ")}$(".grid-stack").each((function(t,e){$(e).data("gridstack").locked(".grid-stack-item",true)}));$(".grid-stack .grid-stack-item").draggable("option","containment","parent")};var getHpos=function(t,e,i){if(!e){return 0}else if(t==0&&!i){return 1}else if(t==0&&i){return 2}else if(t==1&&i){return 1}else if(t==1&&!i){return 2}}; \ No newline at end of file diff --git a/js/swiper-bundle.min.js b/js/swiper-bundle.min.js new file mode 100644 index 00000000..e76a2acb --- /dev/null +++ b/js/swiper-bundle.min.js @@ -0,0 +1,14 @@ +/** + * Swiper 6.5.4 + * Most modern mobile touch slider and framework with hardware accelerated transitions + * https://swiperjs.com + * + * Copyright 2014-2021 Vladimir Kharlampidi + * + * Released under the MIT License + * + * Released on: April 5, 2021 + */ + +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Swiper=t()}(this,(function(){"use strict";function e(e,t){for(var a=0;a0&&i(e[s],t[s])}))}var s={body:{},addEventListener:function(){},removeEventListener:function(){},activeElement:{blur:function(){},nodeName:""},querySelector:function(){return null},querySelectorAll:function(){return[]},getElementById:function(){return null},createEvent:function(){return{initEvent:function(){}}},createElement:function(){return{children:[],childNodes:[],style:{},setAttribute:function(){},getElementsByTagName:function(){return[]}}},createElementNS:function(){return{}},importNode:function(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function r(){var e="undefined"!=typeof document?document:{};return i(e,s),e}var n={document:s,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState:function(){},pushState:function(){},go:function(){},back:function(){}},CustomEvent:function(){return this},addEventListener:function(){},removeEventListener:function(){},getComputedStyle:function(){return{getPropertyValue:function(){return""}}},Image:function(){},Date:function(){},screen:{},setTimeout:function(){},clearTimeout:function(){},matchMedia:function(){return{}},requestAnimationFrame:function(e){return"undefined"==typeof setTimeout?(e(),null):setTimeout(e,0)},cancelAnimationFrame:function(e){"undefined"!=typeof setTimeout&&clearTimeout(e)}};function o(){var e="undefined"!=typeof window?window:{};return i(e,n),e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function c(e,t,a){return(c=p()?Reflect.construct:function(e,t,a){var i=[null];i.push.apply(i,t);var s=new(Function.bind.apply(e,i));return a&&d(s,a.prototype),s}).apply(null,arguments)}function u(e){var t="function"==typeof Map?new Map:void 0;return(u=function(e){if(null===e||(a=e,-1===Function.toString.call(a).indexOf("[native code]")))return e;var a;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,i)}function i(){return c(e,arguments,l(this).constructor)}return i.prototype=Object.create(e.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),d(i,e)})(e)}var h=function(e){var t,a;function i(t){var a,i,s;return a=e.call.apply(e,[this].concat(t))||this,i=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(a),s=i.__proto__,Object.defineProperty(i,"__proto__",{get:function(){return s},set:function(e){s.__proto__=e}}),a}return a=e,(t=i).prototype=Object.create(a.prototype),t.prototype.constructor=t,t.__proto__=a,i}(u(Array));function v(e){void 0===e&&(e=[]);var t=[];return e.forEach((function(e){Array.isArray(e)?t.push.apply(t,v(e)):t.push(e)})),t}function f(e,t){return Array.prototype.filter.call(e,t)}function m(e,t){var a=o(),i=r(),s=[];if(!t&&e instanceof h)return e;if(!e)return new h(s);if("string"==typeof e){var n=e.trim();if(n.indexOf("<")>=0&&n.indexOf(">")>=0){var l="div";0===n.indexOf("0})).length>0},toggleClass:function(){for(var e=arguments.length,t=new Array(e),a=0;a=0;h-=1){var v=u[h];r&&v.listener===r||r&&v.listener&&v.listener.dom7proxy&&v.listener.dom7proxy===r?(c.removeEventListener(d,v.proxyListener,n),u.splice(h,1)):r||(c.removeEventListener(d,v.proxyListener,n),u.splice(h,1))}}return this},trigger:function(){for(var e=o(),t=arguments.length,a=new Array(t),i=0;i0})),p.dispatchEvent(c),p.dom7EventData=[],delete p.dom7EventData}}return this},transitionEnd:function(e){var t=this;return e&&t.on("transitionend",(function a(i){i.target===this&&(e.call(this,i),t.off("transitionend",a))})),this},outerWidth:function(e){if(this.length>0){if(e){var t=this.styles();return this[0].offsetWidth+parseFloat(t.getPropertyValue("margin-right"))+parseFloat(t.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},outerHeight:function(e){if(this.length>0){if(e){var t=this.styles();return this[0].offsetHeight+parseFloat(t.getPropertyValue("margin-top"))+parseFloat(t.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},styles:function(){var e=o();return this[0]?e.getComputedStyle(this[0],null):{}},offset:function(){if(this.length>0){var e=o(),t=r(),a=this[0],i=a.getBoundingClientRect(),s=t.body,n=a.clientTop||s.clientTop||0,l=a.clientLeft||s.clientLeft||0,d=a===e?e.scrollY:a.scrollTop,p=a===e?e.scrollX:a.scrollLeft;return{top:i.top+d-n,left:i.left+p-l}}return null},css:function(e,t){var a,i=o();if(1===arguments.length){if("string"!=typeof e){for(a=0;at-1)return m([]);if(e<0){var a=t+e;return m(a<0?[]:[this[a]])}return m([this[e]])},append:function(){for(var e,t=r(),a=0;a=0;a-=1)this[t].insertBefore(s.childNodes[a],this[t].childNodes[0])}else if(e instanceof h)for(a=0;a0?e?this[0].nextElementSibling&&m(this[0].nextElementSibling).is(e)?m([this[0].nextElementSibling]):m([]):this[0].nextElementSibling?m([this[0].nextElementSibling]):m([]):m([])},nextAll:function(e){var t=[],a=this[0];if(!a)return m([]);for(;a.nextElementSibling;){var i=a.nextElementSibling;e?m(i).is(e)&&t.push(i):t.push(i),a=i}return m(t)},prev:function(e){if(this.length>0){var t=this[0];return e?t.previousElementSibling&&m(t.previousElementSibling).is(e)?m([t.previousElementSibling]):m([]):t.previousElementSibling?m([t.previousElementSibling]):m([])}return m([])},prevAll:function(e){var t=[],a=this[0];if(!a)return m([]);for(;a.previousElementSibling;){var i=a.previousElementSibling;e?m(i).is(e)&&t.push(i):t.push(i),a=i}return m(t)},parent:function(e){for(var t=[],a=0;a6&&(i=i.split(", ").map((function(e){return e.replace(",",".")})).join(", ")),s=new r.WebKitCSSMatrix("none"===i?"":i)):a=(s=n.MozTransform||n.OTransform||n.MsTransform||n.msTransform||n.transform||n.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,")).toString().split(","),"x"===t&&(i=r.WebKitCSSMatrix?s.m41:16===a.length?parseFloat(a[12]):parseFloat(a[4])),"y"===t&&(i=r.WebKitCSSMatrix?s.m42:16===a.length?parseFloat(a[13]):parseFloat(a[5])),i||0}function S(e){return"object"==typeof e&&null!==e&&e.constructor&&"Object"===Object.prototype.toString.call(e).slice(8,-1)}function C(){for(var e=Object(arguments.length<=0?void 0:arguments[0]),t=["__proto__","constructor","prototype"],a=1;a=0,observer:"MutationObserver"in e||"WebkitMutationObserver"in e,passiveListener:function(){var t=!1;try{var a=Object.defineProperty({},"passive",{get:function(){t=!0}});e.addEventListener("testPassiveListener",null,a)}catch(e){}return t}(),gestures:"ongesturestart"in e}}()),g}function k(e){return void 0===e&&(e={}),b||(b=function(e){var t=(void 0===e?{}:e).userAgent,a=P(),i=o(),s=i.navigator.platform,r=t||i.navigator.userAgent,n={ios:!1,android:!1},l=i.screen.width,d=i.screen.height,p=r.match(/(Android);?[\s\/]+([\d.]+)?/),c=r.match(/(iPad).*OS\s([\d_]+)/),u=r.match(/(iPod)(.*OS\s([\d_]+))?/),h=!c&&r.match(/(iPhone\sOS|iOS)\s([\d_]+)/),v="Win32"===s,f="MacIntel"===s;return!c&&f&&a.touch&&["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"].indexOf(l+"x"+d)>=0&&((c=r.match(/(Version)\/([\d.]+)/))||(c=[0,1,"13_0_0"]),f=!1),p&&!v&&(n.os="android",n.android=!0),(c||h||u)&&(n.os="ios",n.ios=!0),n}(e)),b}function L(){return w||(w=function(){var e,t=o();return{isEdge:!!t.navigator.userAgent.match(/Edge/g),isSafari:(e=t.navigator.userAgent.toLowerCase(),e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0),isWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent)}}()),w}Object.keys(y).forEach((function(e){Object.defineProperty(m.fn,e,{value:y[e]})}));var $={name:"resize",create:function(){var e=this;C(e,{resize:{observer:null,createObserver:function(){e&&!e.destroyed&&e.initialized&&(e.resize.observer=new ResizeObserver((function(t){var a=e.width,i=e.height,s=a,r=i;t.forEach((function(t){var a=t.contentBoxSize,i=t.contentRect,n=t.target;n&&n!==e.el||(s=i?i.width:(a[0]||a).inlineSize,r=i?i.height:(a[0]||a).blockSize)})),s===a&&r===i||e.resize.resizeHandler()})),e.resize.observer.observe(e.el))},removeObserver:function(){e.resize.observer&&e.resize.observer.unobserve&&e.el&&(e.resize.observer.unobserve(e.el),e.resize.observer=null)},resizeHandler:function(){e&&!e.destroyed&&e.initialized&&(e.emit("beforeResize"),e.emit("resize"))},orientationChangeHandler:function(){e&&!e.destroyed&&e.initialized&&e.emit("orientationchange")}}})},on:{init:function(e){var t=o();e.params.resizeObserver&&void 0!==o().ResizeObserver?e.resize.createObserver():(t.addEventListener("resize",e.resize.resizeHandler),t.addEventListener("orientationchange",e.resize.orientationChangeHandler))},destroy:function(e){var t=o();e.resize.removeObserver(),t.removeEventListener("resize",e.resize.resizeHandler),t.removeEventListener("orientationchange",e.resize.orientationChangeHandler)}}},I={attach:function(e,t){void 0===t&&(t={});var a=o(),i=this,s=new(a.MutationObserver||a.WebkitMutationObserver)((function(e){if(1!==e.length){var t=function(){i.emit("observerUpdate",e[0])};a.requestAnimationFrame?a.requestAnimationFrame(t):a.setTimeout(t,0)}else i.emit("observerUpdate",e[0])}));s.observe(e,{attributes:void 0===t.attributes||t.attributes,childList:void 0===t.childList||t.childList,characterData:void 0===t.characterData||t.characterData}),i.observer.observers.push(s)},init:function(){var e=this;if(e.support.observer&&e.params.observer){if(e.params.observeParents)for(var t=e.$el.parents(),a=0;a0))if(!s.isTouched||!s.isMoved)if(!!n.noSwipingClass&&""!==n.noSwipingClass&&d.target&&d.target.shadowRoot&&e.path&&e.path[0]&&(p=m(e.path[0])),n.noSwiping&&p.closest(n.noSwipingSelector?n.noSwipingSelector:"."+n.noSwipingClass)[0])t.allowClick=!0;else if(!n.swipeHandler||p.closest(n.swipeHandler)[0]){l.currentX="touchstart"===d.type?d.targetTouches[0].pageX:d.pageX,l.currentY="touchstart"===d.type?d.targetTouches[0].pageY:d.pageY;var c=l.currentX,u=l.currentY,h=n.edgeSwipeDetection||n.iOSEdgeSwipeDetection,v=n.edgeSwipeThreshold||n.iOSEdgeSwipeThreshold;if(h&&(c<=v||c>=i.innerWidth-v)){if("prevent"!==h)return;e.preventDefault()}if(C(s,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),l.startX=c,l.startY=u,s.touchStartTime=x(),t.allowClick=!0,t.updateSize(),t.swipeDirection=void 0,n.threshold>0&&(s.allowThresholdMove=!1),"touchstart"!==d.type){var f=!0;p.is(s.formElements)&&(f=!1),a.activeElement&&m(a.activeElement).is(s.formElements)&&a.activeElement!==p[0]&&a.activeElement.blur();var g=f&&t.allowTouchMove&&n.touchStartPreventDefault;!n.touchStartForcePreventDefault&&!g||p[0].isContentEditable||d.preventDefault()}t.emit("touchStart",d)}}}function D(e){var t=r(),a=this,i=a.touchEventsData,s=a.params,n=a.touches,o=a.rtlTranslate,l=e;if(l.originalEvent&&(l=l.originalEvent),i.isTouched){if(!i.isTouchEvent||"touchmove"===l.type){var d="touchmove"===l.type&&l.targetTouches&&(l.targetTouches[0]||l.changedTouches[0]),p="touchmove"===l.type?d.pageX:l.pageX,c="touchmove"===l.type?d.pageY:l.pageY;if(l.preventedByNestedSwiper)return n.startX=p,void(n.startY=c);if(!a.allowTouchMove)return a.allowClick=!1,void(i.isTouched&&(C(n,{startX:p,startY:c,currentX:p,currentY:c}),i.touchStartTime=x()));if(i.isTouchEvent&&s.touchReleaseOnEdges&&!s.loop)if(a.isVertical()){if(cn.startY&&a.translate>=a.minTranslate())return i.isTouched=!1,void(i.isMoved=!1)}else if(pn.startX&&a.translate>=a.minTranslate())return;if(i.isTouchEvent&&t.activeElement&&l.target===t.activeElement&&m(l.target).is(i.formElements))return i.isMoved=!0,void(a.allowClick=!1);if(i.allowTouchCallbacks&&a.emit("touchMove",l),!(l.targetTouches&&l.targetTouches.length>1)){n.currentX=p,n.currentY=c;var u=n.currentX-n.startX,h=n.currentY-n.startY;if(!(a.params.threshold&&Math.sqrt(Math.pow(u,2)+Math.pow(h,2))=25&&(v=180*Math.atan2(Math.abs(h),Math.abs(u))/Math.PI,i.isScrolling=a.isHorizontal()?v>s.touchAngle:90-v>s.touchAngle);if(i.isScrolling&&a.emit("touchMoveOpposite",l),void 0===i.startMoving&&(n.currentX===n.startX&&n.currentY===n.startY||(i.startMoving=!0)),i.isScrolling)i.isTouched=!1;else if(i.startMoving){a.allowClick=!1,!s.cssMode&&l.cancelable&&l.preventDefault(),s.touchMoveStopPropagation&&!s.nested&&l.stopPropagation(),i.isMoved||(s.loop&&a.loopFix(),i.startTranslate=a.getTranslate(),a.setTransition(0),a.animating&&a.$wrapperEl.trigger("webkitTransitionEnd transitionend"),i.allowMomentumBounce=!1,!s.grabCursor||!0!==a.allowSlideNext&&!0!==a.allowSlidePrev||a.setGrabCursor(!0),a.emit("sliderFirstMove",l)),a.emit("sliderMove",l),i.isMoved=!0;var f=a.isHorizontal()?u:h;n.diff=f,f*=s.touchRatio,o&&(f=-f),a.swipeDirection=f>0?"prev":"next",i.currentTranslate=f+i.startTranslate;var g=!0,b=s.resistanceRatio;if(s.touchReleaseOnEdges&&(b=0),f>0&&i.currentTranslate>a.minTranslate()?(g=!1,s.resistance&&(i.currentTranslate=a.minTranslate()-1+Math.pow(-a.minTranslate()+i.startTranslate+f,b))):f<0&&i.currentTranslatei.startTranslate&&(i.currentTranslate=i.startTranslate),a.allowSlidePrev||a.allowSlideNext||(i.currentTranslate=i.startTranslate),s.threshold>0){if(!(Math.abs(f)>s.threshold||i.allowThresholdMove))return void(i.currentTranslate=i.startTranslate);if(!i.allowThresholdMove)return i.allowThresholdMove=!0,n.startX=n.currentX,n.startY=n.currentY,i.currentTranslate=i.startTranslate,void(n.diff=a.isHorizontal()?n.currentX-n.startX:n.currentY-n.startY)}s.followFinger&&!s.cssMode&&((s.freeMode||s.watchSlidesProgress||s.watchSlidesVisibility)&&(a.updateActiveIndex(),a.updateSlidesClasses()),s.freeMode&&(0===i.velocities.length&&i.velocities.push({position:n[a.isHorizontal()?"startX":"startY"],time:i.touchStartTime}),i.velocities.push({position:n[a.isHorizontal()?"currentX":"currentY"],time:x()})),a.updateProgress(i.currentTranslate),a.setTranslate(i.currentTranslate))}}}}}else i.startMoving&&i.isScrolling&&a.emit("touchMoveOpposite",l)}function N(e){var t=this,a=t.touchEventsData,i=t.params,s=t.touches,r=t.rtlTranslate,n=t.$wrapperEl,o=t.slidesGrid,l=t.snapGrid,d=e;if(d.originalEvent&&(d=d.originalEvent),a.allowTouchCallbacks&&t.emit("touchEnd",d),a.allowTouchCallbacks=!1,!a.isTouched)return a.isMoved&&i.grabCursor&&t.setGrabCursor(!1),a.isMoved=!1,void(a.startMoving=!1);i.grabCursor&&a.isMoved&&a.isTouched&&(!0===t.allowSlideNext||!0===t.allowSlidePrev)&&t.setGrabCursor(!1);var p,c=x(),u=c-a.touchStartTime;if(t.allowClick&&(t.updateClickedSlide(d),t.emit("tap click",d),u<300&&c-a.lastClickTime<300&&t.emit("doubleTap doubleClick",d)),a.lastClickTime=x(),E((function(){t.destroyed||(t.allowClick=!0)})),!a.isTouched||!a.isMoved||!t.swipeDirection||0===s.diff||a.currentTranslate===a.startTranslate)return a.isTouched=!1,a.isMoved=!1,void(a.startMoving=!1);if(a.isTouched=!1,a.isMoved=!1,a.startMoving=!1,p=i.followFinger?r?t.translate:-t.translate:-a.currentTranslate,!i.cssMode)if(i.freeMode){if(p<-t.minTranslate())return void t.slideTo(t.activeIndex);if(p>-t.maxTranslate())return void(t.slides.length1){var h=a.velocities.pop(),v=a.velocities.pop(),f=h.position-v.position,m=h.time-v.time;t.velocity=f/m,t.velocity/=2,Math.abs(t.velocity)150||x()-h.time>300)&&(t.velocity=0)}else t.velocity=0;t.velocity*=i.freeModeMomentumVelocityRatio,a.velocities.length=0;var g=1e3*i.freeModeMomentumRatio,b=t.velocity*g,w=t.translate+b;r&&(w=-w);var y,T,S=!1,C=20*Math.abs(t.velocity)*i.freeModeMomentumBounceRatio;if(wt.minTranslate())i.freeModeMomentumBounce?(w-t.minTranslate()>C&&(w=t.minTranslate()+C),y=t.minTranslate(),S=!0,a.allowMomentumBounce=!0):w=t.minTranslate(),i.loop&&i.centeredSlides&&(T=!0);else if(i.freeModeSticky){for(var M,z=0;z-w){M=z;break}w=-(w=Math.abs(l[M]-w)=i.longSwipesMs)&&(t.updateProgress(),t.updateActiveIndex(),t.updateSlidesClasses())}else{for(var L=0,$=t.slidesSizesGrid[0],I=0;I=o[I]&&p=o[I]&&(L=I,$=o[o.length-1]-o[o.length-2])}var A=(p-o[L])/$,D=Li.longSwipesMs){if(!i.longSwipes)return void t.slideTo(t.activeIndex);"next"===t.swipeDirection&&(A>=i.longSwipesRatio?t.slideTo(L+D):t.slideTo(L)),"prev"===t.swipeDirection&&(A>1-i.longSwipesRatio?t.slideTo(L+D):t.slideTo(L))}else{if(!i.shortSwipes)return void t.slideTo(t.activeIndex);t.navigation&&(d.target===t.navigation.nextEl||d.target===t.navigation.prevEl)?d.target===t.navigation.nextEl?t.slideTo(L+D):t.slideTo(L):("next"===t.swipeDirection&&t.slideTo(L+D),"prev"===t.swipeDirection&&t.slideTo(L))}}}function G(){var e=this,t=e.params,a=e.el;if(!a||0!==a.offsetWidth){t.breakpoints&&e.setBreakpoint();var i=e.allowSlideNext,s=e.allowSlidePrev,r=e.snapGrid;e.allowSlideNext=!0,e.allowSlidePrev=!0,e.updateSize(),e.updateSlides(),e.updateSlidesClasses(),("auto"===t.slidesPerView||t.slidesPerView>1)&&e.isEnd&&!e.isBeginning&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0),e.autoplay&&e.autoplay.running&&e.autoplay.paused&&e.autoplay.run(),e.allowSlidePrev=s,e.allowSlideNext=i,e.params.watchOverflow&&r!==e.snapGrid&&e.checkOverflow()}}function B(e){var t=this;t.allowClick||(t.params.preventClicks&&e.preventDefault(),t.params.preventClicksPropagation&&t.animating&&(e.stopPropagation(),e.stopImmediatePropagation()))}function H(){var e=this,t=e.wrapperEl,a=e.rtlTranslate;e.previousTranslate=e.translate,e.isHorizontal()?e.translate=a?t.scrollWidth-t.offsetWidth-t.scrollLeft:-t.scrollLeft:e.translate=-t.scrollTop,-0===e.translate&&(e.translate=0),e.updateActiveIndex(),e.updateSlidesClasses();var i=e.maxTranslate()-e.minTranslate();(0===i?0:(e.translate-e.minTranslate())/i)!==e.progress&&e.updateProgress(a?-e.translate:e.translate),e.emit("setTranslate",e.translate,!1)}var X=!1;function Y(){}var R={init:!0,direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!1,nested:!1,width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,freeModeMomentumVelocityRatio:1,freeModeSticky:!1,freeModeMinimumVelocity:.02,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,slidesPerGroupSkip:0,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!1,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:0,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,loopFillGroupWithBlank:!1,loopPreventsSlide:!0,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,containerModifierClass:"swiper-container-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-invisible-blank",slideActiveClass:"swiper-slide-active",slideDuplicateActiveClass:"swiper-slide-duplicate-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slideDuplicateNextClass:"swiper-slide-duplicate-next",slidePrevClass:"swiper-slide-prev",slideDuplicatePrevClass:"swiper-slide-duplicate-prev",wrapperClass:"swiper-wrapper",runCallbacksOnInit:!0,_emitClasses:!1},V={modular:{useParams:function(e){var t=this;t.modules&&Object.keys(t.modules).forEach((function(a){var i=t.modules[a];i.params&&C(e,i.params)}))},useModules:function(e){void 0===e&&(e={});var t=this;t.modules&&Object.keys(t.modules).forEach((function(a){var i=t.modules[a],s=e[a]||{};i.on&&t.on&&Object.keys(i.on).forEach((function(e){t.on(e,i.on[e])})),i.create&&i.create.bind(t)(s)}))}},eventsEmitter:{on:function(e,t,a){var i=this;if("function"!=typeof t)return i;var s=a?"unshift":"push";return e.split(" ").forEach((function(e){i.eventsListeners[e]||(i.eventsListeners[e]=[]),i.eventsListeners[e][s](t)})),i},once:function(e,t,a){var i=this;if("function"!=typeof t)return i;function s(){i.off(e,s),s.__emitterProxy&&delete s.__emitterProxy;for(var a=arguments.length,r=new Array(a),n=0;n=0&&t.eventsAnyListeners.splice(a,1),t},off:function(e,t){var a=this;return a.eventsListeners?(e.split(" ").forEach((function(e){void 0===t?a.eventsListeners[e]=[]:a.eventsListeners[e]&&a.eventsListeners[e].forEach((function(i,s){(i===t||i.__emitterProxy&&i.__emitterProxy===t)&&a.eventsListeners[e].splice(s,1)}))})),a):a},emit:function(){var e,t,a,i=this;if(!i.eventsListeners)return i;for(var s=arguments.length,r=new Array(s),n=0;n=0&&(w=parseFloat(w.replace("%",""))/100*r),e.virtualSize=-w,n?p.css({marginLeft:"",marginTop:""}):p.css({marginRight:"",marginBottom:""}),i.slidesPerColumn>1&&(T=Math.floor(c/i.slidesPerColumn)===c/e.params.slidesPerColumn?c:Math.ceil(c/i.slidesPerColumn)*i.slidesPerColumn,"auto"!==i.slidesPerView&&"row"===i.slidesPerColumnFill&&(T=Math.max(T,i.slidesPerView*i.slidesPerColumn)));for(var M,z,P,k=i.slidesPerColumn,L=T/k,$=Math.floor(c/i.slidesPerColumn),I=0;I1){var A=void 0,D=void 0,N=void 0;if("row"===i.slidesPerColumnFill&&i.slidesPerGroup>1){var G=Math.floor(I/(i.slidesPerGroup*i.slidesPerColumn)),B=I-i.slidesPerColumn*i.slidesPerGroup*G,H=0===G?i.slidesPerGroup:Math.min(Math.ceil((c-G*k*i.slidesPerGroup)/k),i.slidesPerGroup);A=(D=B-(N=Math.floor(B/H))*H+G*i.slidesPerGroup)+N*T/k,O.css({"-webkit-box-ordinal-group":A,"-moz-box-ordinal-group":A,"-ms-flex-order":A,"-webkit-order":A,order:A})}else"column"===i.slidesPerColumnFill?(N=I-(D=Math.floor(I/k))*k,(D>$||D===$&&N===k-1)&&(N+=1)>=k&&(N=0,D+=1)):D=I-(N=Math.floor(I/L))*L;O.css(t("margin-top"),0!==N&&i.spaceBetween&&i.spaceBetween+"px")}if("none"!==O.css("display")){if("auto"===i.slidesPerView){var X=getComputedStyle(O[0]),Y=O[0].style.transform,R=O[0].style.webkitTransform;if(Y&&(O[0].style.transform="none"),R&&(O[0].style.webkitTransform="none"),i.roundLengths)S=e.isHorizontal()?O.outerWidth(!0):O.outerHeight(!0);else{var V=a(X,"width"),W=a(X,"padding-left"),F=a(X,"padding-right"),_=a(X,"margin-left"),q=a(X,"margin-right"),j=X.getPropertyValue("box-sizing");if(j&&"border-box"===j)S=V+_+q;else{var U=O[0],K=U.clientWidth;S=V+W+F+_+q+(U.offsetWidth-K)}}Y&&(O[0].style.transform=Y),R&&(O[0].style.webkitTransform=R),i.roundLengths&&(S=Math.floor(S))}else S=(r-(i.slidesPerView-1)*w)/i.slidesPerView,i.roundLengths&&(S=Math.floor(S)),p[I]&&(p[I].style[t("width")]=S+"px");p[I]&&(p[I].swiperSlideSize=S),v.push(S),i.centeredSlides?(y=y+S/2+E/2+w,0===E&&0!==I&&(y=y-r/2-w),0===I&&(y=y-r/2-w),Math.abs(y)<.001&&(y=0),i.roundLengths&&(y=Math.floor(y)),x%i.slidesPerGroup==0&&u.push(y),h.push(y)):(i.roundLengths&&(y=Math.floor(y)),(x-Math.min(e.params.slidesPerGroupSkip,x))%e.params.slidesPerGroup==0&&u.push(y),h.push(y),y=y+S+w),e.virtualSize+=S+w,E=S,x+=1}}if(e.virtualSize=Math.max(e.virtualSize,r)+m,n&&o&&("slide"===i.effect||"coverflow"===i.effect)&&s.css({width:e.virtualSize+i.spaceBetween+"px"}),i.setWrapperSize)s.css(((z={})[t("width")]=e.virtualSize+i.spaceBetween+"px",z));if(i.slidesPerColumn>1)if(e.virtualSize=(S+i.spaceBetween)*T,e.virtualSize=Math.ceil(e.virtualSize/i.slidesPerColumn)-i.spaceBetween,s.css(((P={})[t("width")]=e.virtualSize+i.spaceBetween+"px",P)),i.centeredSlides){M=[];for(var Z=0;Z1&&u.push(e.virtualSize-r)}if(0===u.length&&(u=[0]),0!==i.spaceBetween){var te,ae=e.isHorizontal()&&n?"marginLeft":t("marginRight");p.filter((function(e,t){return!i.cssMode||t!==p.length-1})).css(((te={})[ae]=w+"px",te))}if(i.centeredSlides&&i.centeredSlidesBounds){var ie=0;v.forEach((function(e){ie+=e+(i.spaceBetween?i.spaceBetween:0)}));var se=(ie-=i.spaceBetween)-r;u=u.map((function(e){return e<0?-f:e>se?se+m:e}))}if(i.centerInsufficientSlides){var re=0;if(v.forEach((function(e){re+=e+(i.spaceBetween?i.spaceBetween:0)})),(re-=i.spaceBetween)1)if(a.params.centeredSlides)a.visibleSlides.each((function(e){i.push(e)}));else for(t=0;ta.slides.length)break;i.push(a.slides.eq(r)[0])}else i.push(a.slides.eq(a.activeIndex)[0]);for(t=0;ts?n:s}s&&a.$wrapperEl.css("height",s+"px")},updateSlidesOffset:function(){for(var e=this.slides,t=0;t=0&&d1&&p<=t.size||d<=0&&p>=t.size)&&(t.visibleSlides.push(o),t.visibleSlidesIndexes.push(n),i.eq(n).addClass(a.slideVisibleClass))}o.progress=s?-l:l}t.visibleSlides=m(t.visibleSlides)}},updateProgress:function(e){var t=this;if(void 0===e){var a=t.rtlTranslate?-1:1;e=t&&t.translate&&t.translate*a||0}var i=t.params,s=t.maxTranslate()-t.minTranslate(),r=t.progress,n=t.isBeginning,o=t.isEnd,l=n,d=o;0===s?(r=0,n=!0,o=!0):(n=(r=(e-t.minTranslate())/s)<=0,o=r>=1),C(t,{progress:r,isBeginning:n,isEnd:o}),(i.watchSlidesProgress||i.watchSlidesVisibility||i.centeredSlides&&i.autoHeight)&&t.updateSlidesProgress(e),n&&!l&&t.emit("reachBeginning toEdge"),o&&!d&&t.emit("reachEnd toEdge"),(l&&!n||d&&!o)&&t.emit("fromEdge"),t.emit("progress",r)},updateSlidesClasses:function(){var e,t=this,a=t.slides,i=t.params,s=t.$wrapperEl,r=t.activeIndex,n=t.realIndex,o=t.virtual&&i.virtual.enabled;a.removeClass(i.slideActiveClass+" "+i.slideNextClass+" "+i.slidePrevClass+" "+i.slideDuplicateActiveClass+" "+i.slideDuplicateNextClass+" "+i.slideDuplicatePrevClass),(e=o?t.$wrapperEl.find("."+i.slideClass+'[data-swiper-slide-index="'+r+'"]'):a.eq(r)).addClass(i.slideActiveClass),i.loop&&(e.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+n+'"]').addClass(i.slideDuplicateActiveClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+n+'"]').addClass(i.slideDuplicateActiveClass));var l=e.nextAll("."+i.slideClass).eq(0).addClass(i.slideNextClass);i.loop&&0===l.length&&(l=a.eq(0)).addClass(i.slideNextClass);var d=e.prevAll("."+i.slideClass).eq(0).addClass(i.slidePrevClass);i.loop&&0===d.length&&(d=a.eq(-1)).addClass(i.slidePrevClass),i.loop&&(l.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+l.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicateNextClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+l.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicateNextClass),d.hasClass(i.slideDuplicateClass)?s.children("."+i.slideClass+":not(."+i.slideDuplicateClass+')[data-swiper-slide-index="'+d.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicatePrevClass):s.children("."+i.slideClass+"."+i.slideDuplicateClass+'[data-swiper-slide-index="'+d.attr("data-swiper-slide-index")+'"]').addClass(i.slideDuplicatePrevClass)),t.emitSlidesClasses()},updateActiveIndex:function(e){var t,a=this,i=a.rtlTranslate?a.translate:-a.translate,s=a.slidesGrid,r=a.snapGrid,n=a.params,o=a.activeIndex,l=a.realIndex,d=a.snapIndex,p=e;if(void 0===p){for(var c=0;c=s[c]&&i=s[c]&&i=s[c]&&(p=c);n.normalizeSlideIndex&&(p<0||void 0===p)&&(p=0)}if(r.indexOf(i)>=0)t=r.indexOf(i);else{var u=Math.min(n.slidesPerGroupSkip,p);t=u+Math.floor((p-u)/n.slidesPerGroup)}if(t>=r.length&&(t=r.length-1),p!==o){var h=parseInt(a.slides.eq(p).attr("data-swiper-slide-index")||p,10);C(a,{snapIndex:t,realIndex:h,previousIndex:o,activeIndex:p}),a.emit("activeIndexChange"),a.emit("snapIndexChange"),l!==h&&a.emit("realIndexChange"),(a.initialized||a.params.runCallbacksOnInit)&&a.emit("slideChange")}else t!==d&&(a.snapIndex=t,a.emit("snapIndexChange"))},updateClickedSlide:function(e){var t,a=this,i=a.params,s=m(e.target).closest("."+i.slideClass)[0],r=!1;if(s)for(var n=0;nd?d:i&&er?"next":is?"next":i=l.length&&(f=l.length-1),(c||o.initialSlide||0)===(p||0)&&a&&r.emit("beforeSlideChangeStart");var m,g=-l[f];if(r.updateProgress(g),o.normalizeSlideIndex)for(var b=0;b=y&&w=y&&w=y&&(n=b)}if(r.initialized&&n!==c){if(!r.allowSlideNext&&gr.translate&&g>r.maxTranslate()&&(c||0)!==n)return!1}if(m=n>c?"next":n=e&&(h=e)})),void 0!==h&&(u=o.indexOf(h))<0&&(u=i.activeIndex-1),i.slideTo(u,e,t,a)},slideReset:function(e,t,a){return void 0===e&&(e=this.params.speed),void 0===t&&(t=!0),this.slideTo(this.activeIndex,e,t,a)},slideToClosest:function(e,t,a,i){void 0===e&&(e=this.params.speed),void 0===t&&(t=!0),void 0===i&&(i=.5);var s=this,r=s.activeIndex,n=Math.min(s.params.slidesPerGroupSkip,r),o=n+Math.floor((r-n)/s.params.slidesPerGroup),l=s.rtlTranslate?s.translate:-s.translate;if(l>=s.snapGrid[o]){var d=s.snapGrid[o];l-d>(s.snapGrid[o+1]-d)*i&&(r+=s.params.slidesPerGroup)}else{var p=s.snapGrid[o-1];l-p<=(s.snapGrid[o]-p)*i&&(r-=s.params.slidesPerGroup)}return r=Math.max(r,0),r=Math.min(r,s.slidesGrid.length-1),s.slideTo(r,e,t,a)},slideToClickedSlide:function(){var e,t=this,a=t.params,i=t.$wrapperEl,s="auto"===a.slidesPerView?t.slidesPerViewDynamic():a.slidesPerView,r=t.clickedIndex;if(a.loop){if(t.animating)return;e=parseInt(m(t.clickedSlide).attr("data-swiper-slide-index"),10),a.centeredSlides?rt.slides.length-t.loopedSlides+s/2?(t.loopFix(),r=i.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]:not(.'+a.slideDuplicateClass+")").eq(0).index(),E((function(){t.slideTo(r)}))):t.slideTo(r):r>t.slides.length-s?(t.loopFix(),r=i.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]:not(.'+a.slideDuplicateClass+")").eq(0).index(),E((function(){t.slideTo(r)}))):t.slideTo(r)}else t.slideTo(r)}},loop:{loopCreate:function(){var e=this,t=r(),a=e.params,i=e.$wrapperEl;i.children("."+a.slideClass+"."+a.slideDuplicateClass).remove();var s=i.children("."+a.slideClass);if(a.loopFillGroupWithBlank){var n=a.slidesPerGroup-s.length%a.slidesPerGroup;if(n!==a.slidesPerGroup){for(var o=0;os.length&&(e.loopedSlides=s.length);var d=[],p=[];s.each((function(t,a){var i=m(t);a=s.length-e.loopedSlides&&d.push(t),i.attr("data-swiper-slide-index",a)}));for(var c=0;c=0;u-=1)i.prepend(m(d[u].cloneNode(!0)).addClass(a.slideDuplicateClass))},loopFix:function(){var e=this;e.emit("beforeLoopFix");var t,a=e.activeIndex,i=e.slides,s=e.loopedSlides,r=e.allowSlidePrev,n=e.allowSlideNext,o=e.snapGrid,l=e.rtlTranslate;e.allowSlidePrev=!0,e.allowSlideNext=!0;var d=-o[a]-e.getTranslate();if(a=i.length-s){t=-i.length+a+s,t+=s,e.slideTo(t,0,!1,!0)&&0!==d&&e.setTranslate((l?-e.translate:e.translate)-d)}e.allowSlidePrev=r,e.allowSlideNext=n,e.emit("loopFix")},loopDestroy:function(){var e=this,t=e.$wrapperEl,a=e.params,i=e.slides;t.children("."+a.slideClass+"."+a.slideDuplicateClass+",."+a.slideClass+"."+a.slideBlankClass).remove(),i.removeAttr("data-swiper-slide-index")}},grabCursor:{setGrabCursor:function(e){var t=this;if(!(t.support.touch||!t.params.simulateTouch||t.params.watchOverflow&&t.isLocked||t.params.cssMode)){var a=t.el;a.style.cursor="move",a.style.cursor=e?"-webkit-grabbing":"-webkit-grab",a.style.cursor=e?"-moz-grabbin":"-moz-grab",a.style.cursor=e?"grabbing":"grab"}},unsetGrabCursor:function(){var e=this;e.support.touch||e.params.watchOverflow&&e.isLocked||e.params.cssMode||(e.el.style.cursor="")}},manipulation:{appendSlide:function(e){var t=this,a=t.$wrapperEl,i=t.params;if(i.loop&&t.loopDestroy(),"object"==typeof e&&"length"in e)for(var s=0;s=n)a.appendSlide(t);else{for(var o=r>e?r+1:r,l=[],d=n-1;d>=e;d-=1){var p=a.slides.eq(d);p.remove(),l.unshift(p)}if("object"==typeof t&&"length"in t){for(var c=0;ce?r+t.length:r}else i.append(t);for(var u=0;u1,u=p.slidesPerColumn>1;c&&!u?(n.removeClass(r.containerModifierClass+"multirow "+r.containerModifierClass+"multirow-column"),e.emitContainerClasses()):!c&&u&&(n.addClass(r.containerModifierClass+"multirow"),"column"===p.slidesPerColumnFill&&n.addClass(r.containerModifierClass+"multirow-column"),e.emitContainerClasses());var h=p.direction&&p.direction!==r.direction,v=r.loop&&(p.slidesPerView!==r.slidesPerView||h);h&&a&&e.changeDirection(),C(e.params,p),C(e,{allowTouchMove:e.params.allowTouchMove,allowSlideNext:e.params.allowSlideNext,allowSlidePrev:e.params.allowSlidePrev}),e.currentBreakpoint=l,e.emit("_beforeBreakpoint",p),v&&a&&(e.loopDestroy(),e.loopCreate(),e.updateSlides(),e.slideTo(t-s+e.loopedSlides,0,!1)),e.emit("breakpoint",p)}}},getBreakpoint:function(e,t,a){if(void 0===t&&(t="window"),e&&("container"!==t||a)){var i=!1,s=o(),r="window"===t?s.innerWidth:a.clientWidth,n="window"===t?s.innerHeight:a.clientHeight,l=Object.keys(e).map((function(e){if("string"==typeof e&&0===e.indexOf("@")){var t=parseFloat(e.substr(1));return{value:n*t,point:e}}return{value:e,point:e}}));l.sort((function(e,t){return parseInt(e.value,10)-parseInt(t.value,10)}));for(var d=0;d0&&t.slidesOffsetBefore+t.spaceBetween*(e.slides.length-1)+e.slides[0].offsetWidth*e.slides.length;t.slidesOffsetBefore&&t.slidesOffsetAfter&&i?e.isLocked=i<=e.size:e.isLocked=1===e.snapGrid.length,e.allowSlideNext=!e.isLocked,e.allowSlidePrev=!e.isLocked,a!==e.isLocked&&e.emit(e.isLocked?"lock":"unlock"),a&&a!==e.isLocked&&(e.isEnd=!1,e.navigation&&e.navigation.update())}},classes:{addClasses:function(){var e,t,a,i=this,s=i.classNames,r=i.params,n=i.rtl,o=i.$el,l=i.device,d=i.support,p=(e=["initialized",r.direction,{"pointer-events":d.pointerEvents&&!d.touch},{"free-mode":r.freeMode},{autoheight:r.autoHeight},{rtl:n},{multirow:r.slidesPerColumn>1},{"multirow-column":r.slidesPerColumn>1&&"column"===r.slidesPerColumnFill},{android:l.android},{ios:l.ios},{"css-mode":r.cssMode}],t=r.containerModifierClass,a=[],e.forEach((function(e){"object"==typeof e?Object.keys(e).forEach((function(i){e[i]&&a.push(t+i)})):"string"==typeof e&&a.push(t+e)})),a);s.push.apply(s,p),o.addClass([].concat(s).join(" ")),i.emitContainerClasses()},removeClasses:function(){var e=this,t=e.$el,a=e.classNames;t.removeClass(a.join(" ")),e.emitContainerClasses()}},images:{loadImage:function(e,t,a,i,s,r){var n,l=o();function d(){r&&r()}m(e).parent("picture")[0]||e.complete&&s?d():t?((n=new l.Image).onload=d,n.onerror=d,i&&(n.sizes=i),a&&(n.srcset=a),t&&(n.src=t)):d()},preloadImages:function(){var e=this;function t(){null!=e&&e&&!e.destroyed&&(void 0!==e.imagesLoaded&&(e.imagesLoaded+=1),e.imagesLoaded===e.imagesToLoad.length&&(e.params.updateOnImagesReady&&e.update(),e.emit("imagesReady")))}e.imagesToLoad=e.$el.find("img");for(var a=0;a1){var n=[];return m(a.el).each((function(e){var i=C({},a,{el:e});n.push(new t(i))})),n}var o=this;o.__swiper__=!0,o.support=P(),o.device=k({userAgent:a.userAgent}),o.browser=L(),o.eventsListeners={},o.eventsAnyListeners=[],void 0===o.modules&&(o.modules={}),Object.keys(o.modules).forEach((function(e){var t=o.modules[e];if(t.params){var i=Object.keys(t.params)[0],s=t.params[i];if("object"!=typeof s||null===s)return;if(!(i in a)||!("enabled"in s))return;!0===a[i]&&(a[i]={enabled:!0}),"object"!=typeof a[i]||"enabled"in a[i]||(a[i].enabled=!0),a[i]||(a[i]={enabled:!1})}}));var l,d,p=C({},R);return o.useParams(p),o.params=C({},p,W,a),o.originalParams=C({},o.params),o.passedParams=C({},a),o.params&&o.params.on&&Object.keys(o.params.on).forEach((function(e){o.on(e,o.params.on[e])})),o.params&&o.params.onAny&&o.onAny(o.params.onAny),o.$=m,C(o,{el:e,classNames:[],slides:m(),slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal:function(){return"horizontal"===o.params.direction},isVertical:function(){return"vertical"===o.params.direction},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,allowSlideNext:o.params.allowSlideNext,allowSlidePrev:o.params.allowSlidePrev,touchEvents:(l=["touchstart","touchmove","touchend","touchcancel"],d=["mousedown","mousemove","mouseup"],o.support.pointerEvents&&(d=["pointerdown","pointermove","pointerup"]),o.touchEventsTouch={start:l[0],move:l[1],end:l[2],cancel:l[3]},o.touchEventsDesktop={start:d[0],move:d[1],end:d[2]},o.support.touch||!o.params.simulateTouch?o.touchEventsTouch:o.touchEventsDesktop),touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,formElements:"input, select, option, textarea, button, video, label",lastClickTime:x(),clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,isTouchEvent:void 0,startMoving:void 0},allowClick:!0,allowTouchMove:o.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),o.useModules(),o.emit("_swiper"),o.params.init&&o.init(),o}var a,i,s,r=t.prototype;return r.emitContainerClasses=function(){var e=this;if(e.params._emitClasses&&e.el){var t=e.el.className.split(" ").filter((function(t){return 0===t.indexOf("swiper-container")||0===t.indexOf(e.params.containerModifierClass)}));e.emit("_containerClasses",t.join(" "))}},r.getSlideClasses=function(e){var t=this;return e.className.split(" ").filter((function(e){return 0===e.indexOf("swiper-slide")||0===e.indexOf(t.params.slideClass)})).join(" ")},r.emitSlidesClasses=function(){var e=this;if(e.params._emitClasses&&e.el){var t=[];e.slides.each((function(a){var i=e.getSlideClasses(a);t.push({slideEl:a,classNames:i}),e.emit("_slideClass",a,i)})),e.emit("_slideClasses",t)}},r.slidesPerViewDynamic=function(){var e=this,t=e.params,a=e.slides,i=e.slidesGrid,s=e.size,r=e.activeIndex,n=1;if(t.centeredSlides){for(var o,l=a[r].swiperSlideSize,d=r+1;ds&&(o=!0));for(var p=r-1;p>=0;p-=1)a[p]&&!o&&(n+=1,(l+=a[p].swiperSlideSize)>s&&(o=!0))}else for(var c=r+1;c1)&&e.isEnd&&!e.params.centeredSlides?e.slideTo(e.slides.length-1,0,!1,!0):e.slideTo(e.activeIndex,0,!1,!0))||i(),a.watchOverflow&&t!==e.snapGrid&&e.checkOverflow(),e.emit("update")}function i(){var t=e.rtlTranslate?-1*e.translate:e.translate,a=Math.min(Math.max(t,e.maxTranslate()),e.minTranslate());e.setTranslate(a),e.updateActiveIndex(),e.updateSlidesClasses()}},r.changeDirection=function(e,t){void 0===t&&(t=!0);var a=this,i=a.params.direction;return e||(e="horizontal"===i?"vertical":"horizontal"),e===i||"horizontal"!==e&&"vertical"!==e||(a.$el.removeClass(""+a.params.containerModifierClass+i).addClass(""+a.params.containerModifierClass+e),a.emitContainerClasses(),a.params.direction=e,a.slides.each((function(t){"vertical"===e?t.style.width="":t.style.height=""})),a.emit("changeDirection"),t&&a.update()),a},r.mount=function(e){var t=this;if(t.mounted)return!0;var a,i=m(e||t.params.el);return!!(e=i[0])&&(e.swiper=t,e&&e.shadowRoot&&e.shadowRoot.querySelector?(a=m(e.shadowRoot.querySelector("."+t.params.wrapperClass))).children=function(e){return i.children(e)}:a=i.children("."+t.params.wrapperClass),C(t,{$el:i,el:e,$wrapperEl:a,wrapperEl:a[0],mounted:!0,rtl:"rtl"===e.dir.toLowerCase()||"rtl"===i.css("direction"),rtlTranslate:"horizontal"===t.params.direction&&("rtl"===e.dir.toLowerCase()||"rtl"===i.css("direction")),wrongRTL:"-webkit-box"===a.css("display")}),!0)},r.init=function(e){var t=this;return t.initialized||!1===t.mount(e)||(t.emit("beforeInit"),t.params.breakpoints&&t.setBreakpoint(),t.addClasses(),t.params.loop&&t.loopCreate(),t.updateSize(),t.updateSlides(),t.params.watchOverflow&&t.checkOverflow(),t.params.grabCursor&&t.setGrabCursor(),t.params.preloadImages&&t.preloadImages(),t.params.loop?t.slideTo(t.params.initialSlide+t.loopedSlides,0,t.params.runCallbacksOnInit):t.slideTo(t.params.initialSlide,0,t.params.runCallbacksOnInit),t.attachEvents(),t.initialized=!0,t.emit("init"),t.emit("afterInit")),t},r.destroy=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0);var a,i=this,s=i.params,r=i.$el,n=i.$wrapperEl,o=i.slides;return void 0===i.params||i.destroyed||(i.emit("beforeDestroy"),i.initialized=!1,i.detachEvents(),s.loop&&i.loopDestroy(),t&&(i.removeClasses(),r.removeAttr("style"),n.removeAttr("style"),o&&o.length&&o.removeClass([s.slideVisibleClass,s.slideActiveClass,s.slideNextClass,s.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-slide-index")),i.emit("destroy"),Object.keys(i.eventsListeners).forEach((function(e){i.off(e)})),!1!==e&&(i.$el[0].swiper=null,a=i,Object.keys(a).forEach((function(e){try{a[e]=null}catch(e){}try{delete a[e]}catch(e){}}))),i.destroyed=!0),null},t.extendDefaults=function(e){C(W,e)},t.installModule=function(e){t.prototype.modules||(t.prototype.modules={});var a=e.name||Object.keys(t.prototype.modules).length+"_"+x();t.prototype.modules[a]=e},t.use=function(e){return Array.isArray(e)?(e.forEach((function(e){return t.installModule(e)})),t):(t.installModule(e),t)},a=t,s=[{key:"extendedDefaults",get:function(){return W}},{key:"defaults",get:function(){return R}}],(i=null)&&e(a.prototype,i),s&&e(a,s),t}();Object.keys(V).forEach((function(e){Object.keys(V[e]).forEach((function(t){F.prototype[t]=V[e][t]}))})),F.use([$,O]);var _={update:function(e){var t=this,a=t.params,i=a.slidesPerView,s=a.slidesPerGroup,r=a.centeredSlides,n=t.params.virtual,o=n.addSlidesBefore,l=n.addSlidesAfter,d=t.virtual,p=d.from,c=d.to,u=d.slides,h=d.slidesGrid,v=d.renderSlide,f=d.offset;t.updateActiveIndex();var m,g,b,w=t.activeIndex||0;m=t.rtlTranslate?"right":t.isHorizontal()?"left":"top",r?(g=Math.floor(i/2)+s+l,b=Math.floor(i/2)+s+o):(g=i+(s-1)+l,b=s+o);var y=Math.max((w||0)-b,0),E=Math.min((w||0)+g,u.length-1),x=(t.slidesGrid[y]||0)-(t.slidesGrid[0]||0);function T(){t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),t.lazy&&t.params.lazy.enabled&&t.lazy.load()}if(C(t.virtual,{from:y,to:E,offset:x,slidesGrid:t.slidesGrid}),p===y&&c===E&&!e)return t.slidesGrid!==h&&x!==f&&t.slides.css(m,x+"px"),void t.updateProgress();if(t.params.virtual.renderExternal)return t.params.virtual.renderExternal.call(t,{offset:x,from:y,to:E,slides:function(){for(var e=[],t=y;t<=E;t+=1)e.push(u[t]);return e}()}),void(t.params.virtual.renderExternalUpdate&&T());var S=[],M=[];if(e)t.$wrapperEl.find("."+t.params.slideClass).remove();else for(var z=p;z<=c;z+=1)(zE)&&t.$wrapperEl.find("."+t.params.slideClass+'[data-swiper-slide-index="'+z+'"]').remove();for(var P=0;P=y&&P<=E&&(void 0===c||e?M.push(P):(P>c&&M.push(P),P'+e+"
      ");return s.attr("data-swiper-slide-index")||s.attr("data-swiper-slide-index",t),i.cache&&(a.virtual.cache[t]=s),s},appendSlide:function(e){var t=this;if("object"==typeof e&&"length"in e)for(var a=0;a=0;i-=1)t.virtual.slides.splice(e[i],1),t.params.virtual.cache&&delete t.virtual.cache[e[i]],e[i]0&&0===t.$el.parents("."+t.params.slideActiveClass).length)return;var g=t.$el,b=g[0].clientWidth,w=g[0].clientHeight,y=a.innerWidth,E=a.innerHeight,x=t.$el.offset();s&&(x.left-=t.$el[0].scrollLeft);for(var T=[[x.left,x.top],[x.left+b,x.top],[x.left,x.top+w],[x.left+b,x.top+w]],S=0;S=0&&C[0]<=y&&C[1]>=0&&C[1]<=E){if(0===C[0]&&0===C[1])continue;m=!0}}if(!m)return}t.isHorizontal()?((p||c||u||h)&&(n.preventDefault?n.preventDefault():n.returnValue=!1),((c||h)&&!s||(p||u)&&s)&&t.slideNext(),((p||u)&&!s||(c||h)&&s)&&t.slidePrev()):((p||c||v||f)&&(n.preventDefault?n.preventDefault():n.returnValue=!1),(c||f)&&t.slideNext(),(p||v)&&t.slidePrev()),t.emit("keyPress",l)}},enable:function(){var e=this,t=r();e.keyboard.enabled||(m(t).on("keydown",e.keyboard.handle),e.keyboard.enabled=!0)},disable:function(){var e=this,t=r();e.keyboard.enabled&&(m(t).off("keydown",e.keyboard.handle),e.keyboard.enabled=!1)}},U={name:"keyboard",params:{keyboard:{enabled:!1,onlyInViewport:!0,pageUpDown:!0}},create:function(){M(this,{keyboard:t({enabled:!1},j)})},on:{init:function(e){e.params.keyboard.enabled&&e.keyboard.enable()},destroy:function(e){e.keyboard.enabled&&e.keyboard.disable()}}};var K={lastScrollTime:x(),lastEventBeforeSnap:void 0,recentWheelEvents:[],event:function(){return o().navigator.userAgent.indexOf("firefox")>-1?"DOMMouseScroll":function(){var e=r(),t="onwheel",a=t in e;if(!a){var i=e.createElement("div");i.setAttribute(t,"return;"),a="function"==typeof i.onwheel}return!a&&e.implementation&&e.implementation.hasFeature&&!0!==e.implementation.hasFeature("","")&&(a=e.implementation.hasFeature("Events.wheel","3.0")),a}()?"wheel":"mousewheel"},normalize:function(e){var t=0,a=0,i=0,s=0;return"detail"in e&&(a=e.detail),"wheelDelta"in e&&(a=-e.wheelDelta/120),"wheelDeltaY"in e&&(a=-e.wheelDeltaY/120),"wheelDeltaX"in e&&(t=-e.wheelDeltaX/120),"axis"in e&&e.axis===e.HORIZONTAL_AXIS&&(t=a,a=0),i=10*t,s=10*a,"deltaY"in e&&(s=e.deltaY),"deltaX"in e&&(i=e.deltaX),e.shiftKey&&!i&&(i=s,s=0),(i||s)&&e.deltaMode&&(1===e.deltaMode?(i*=40,s*=40):(i*=800,s*=800)),i&&!t&&(t=i<1?-1:1),s&&!a&&(a=s<1?-1:1),{spinX:t,spinY:a,pixelX:i,pixelY:s}},handleMouseEnter:function(){this.mouseEntered=!0},handleMouseLeave:function(){this.mouseEntered=!1},handle:function(e){var t=e,a=this,i=a.params.mousewheel;a.params.cssMode&&t.preventDefault();var s=a.$el;if("container"!==a.params.mousewheel.eventsTarget&&(s=m(a.params.mousewheel.eventsTarget)),!a.mouseEntered&&!s[0].contains(t.target)&&!i.releaseOnEdges)return!0;t.originalEvent&&(t=t.originalEvent);var r=0,n=a.rtlTranslate?-1:1,o=K.normalize(t);if(i.forceToAxis)if(a.isHorizontal()){if(!(Math.abs(o.pixelX)>Math.abs(o.pixelY)))return!0;r=-o.pixelX*n}else{if(!(Math.abs(o.pixelY)>Math.abs(o.pixelX)))return!0;r=-o.pixelY}else r=Math.abs(o.pixelX)>Math.abs(o.pixelY)?-o.pixelX*n:-o.pixelY;if(0===r)return!0;i.invert&&(r=-r);var l=a.getTranslate()+r*i.sensitivity;if(l>=a.minTranslate()&&(l=a.minTranslate()),l<=a.maxTranslate()&&(l=a.maxTranslate()),(!!a.params.loop||!(l===a.minTranslate()||l===a.maxTranslate()))&&a.params.nested&&t.stopPropagation(),a.params.freeMode){var d={time:x(),delta:Math.abs(r),direction:Math.sign(r)},p=a.mousewheel.lastEventBeforeSnap,c=p&&d.time=a.minTranslate()&&(u=a.minTranslate()),u<=a.maxTranslate()&&(u=a.maxTranslate()),a.setTransition(0),a.setTranslate(u),a.updateProgress(),a.updateActiveIndex(),a.updateSlidesClasses(),(!h&&a.isBeginning||!v&&a.isEnd)&&a.updateSlidesClasses(),a.params.freeModeSticky){clearTimeout(a.mousewheel.timeout),a.mousewheel.timeout=void 0;var f=a.mousewheel.recentWheelEvents;f.length>=15&&f.shift();var g=f.length?f[f.length-1]:void 0,b=f[0];if(f.push(d),g&&(d.delta>g.delta||d.direction!==g.direction))f.splice(0);else if(f.length>=15&&d.time-b.time<500&&b.delta-d.delta>=1&&d.delta<=6){var w=r>0?.8:.2;a.mousewheel.lastEventBeforeSnap=d,f.splice(0),a.mousewheel.timeout=E((function(){a.slideToClosest(a.params.speed,!0,void 0,w)}),0)}a.mousewheel.timeout||(a.mousewheel.timeout=E((function(){a.mousewheel.lastEventBeforeSnap=d,f.splice(0),a.slideToClosest(a.params.speed,!0,void 0,.5)}),500))}if(c||a.emit("scroll",t),a.params.autoplay&&a.params.autoplayDisableOnInteraction&&a.autoplay.stop(),u===a.minTranslate()||u===a.maxTranslate())return!0}}else{var y={time:x(),delta:Math.abs(r),direction:Math.sign(r),raw:e},T=a.mousewheel.recentWheelEvents;T.length>=2&&T.shift();var S=T.length?T[T.length-1]:void 0;if(T.push(y),S?(y.direction!==S.direction||y.delta>S.delta||y.time>S.time+150)&&a.mousewheel.animateSlider(y):a.mousewheel.animateSlider(y),a.mousewheel.releaseScroll(y))return!0}return t.preventDefault?t.preventDefault():t.returnValue=!1,!1},animateSlider:function(e){var t=this,a=o();return!(this.params.mousewheel.thresholdDelta&&e.delta=6&&x()-t.mousewheel.lastScrollTime<60||(e.direction<0?t.isEnd&&!t.params.loop||t.animating||(t.slideNext(),t.emit("scroll",e.raw)):t.isBeginning&&!t.params.loop||t.animating||(t.slidePrev(),t.emit("scroll",e.raw)),t.mousewheel.lastScrollTime=(new a.Date).getTime(),!1)))},releaseScroll:function(e){var t=this,a=t.params.mousewheel;if(e.direction<0){if(t.isEnd&&!t.params.loop&&a.releaseOnEdges)return!0}else if(t.isBeginning&&!t.params.loop&&a.releaseOnEdges)return!0;return!1},enable:function(){var e=this,t=K.event();if(e.params.cssMode)return e.wrapperEl.removeEventListener(t,e.mousewheel.handle),!0;if(!t)return!1;if(e.mousewheel.enabled)return!1;var a=e.$el;return"container"!==e.params.mousewheel.eventsTarget&&(a=m(e.params.mousewheel.eventsTarget)),a.on("mouseenter",e.mousewheel.handleMouseEnter),a.on("mouseleave",e.mousewheel.handleMouseLeave),a.on(t,e.mousewheel.handle),e.mousewheel.enabled=!0,!0},disable:function(){var e=this,t=K.event();if(e.params.cssMode)return e.wrapperEl.addEventListener(t,e.mousewheel.handle),!0;if(!t)return!1;if(!e.mousewheel.enabled)return!1;var a=e.$el;return"container"!==e.params.mousewheel.eventsTarget&&(a=m(e.params.mousewheel.eventsTarget)),a.off(t,e.mousewheel.handle),e.mousewheel.enabled=!1,!0}},Z={toggleEl:function(e,t){e[t?"addClass":"removeClass"](this.params.navigation.disabledClass),e[0]&&"BUTTON"===e[0].tagName&&(e[0].disabled=t)},update:function(){var e=this,t=e.params.navigation,a=e.navigation.toggleEl;if(!e.params.loop){var i=e.navigation,s=i.$nextEl,r=i.$prevEl;r&&r.length>0&&(e.isBeginning?a(r,!0):a(r,!1),r[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass)),s&&s.length>0&&(e.isEnd?a(s,!0):a(s,!1),s[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](t.lockClass))}},onPrevClick:function(e){var t=this;e.preventDefault(),t.isBeginning&&!t.params.loop||t.slidePrev()},onNextClick:function(e){var t=this;e.preventDefault(),t.isEnd&&!t.params.loop||t.slideNext()},init:function(){var e,t,a=this,i=a.params.navigation;(i.nextEl||i.prevEl)&&(i.nextEl&&(e=m(i.nextEl),a.params.uniqueNavElements&&"string"==typeof i.nextEl&&e.length>1&&1===a.$el.find(i.nextEl).length&&(e=a.$el.find(i.nextEl))),i.prevEl&&(t=m(i.prevEl),a.params.uniqueNavElements&&"string"==typeof i.prevEl&&t.length>1&&1===a.$el.find(i.prevEl).length&&(t=a.$el.find(i.prevEl))),e&&e.length>0&&e.on("click",a.navigation.onNextClick),t&&t.length>0&&t.on("click",a.navigation.onPrevClick),C(a.navigation,{$nextEl:e,nextEl:e&&e[0],$prevEl:t,prevEl:t&&t[0]}))},destroy:function(){var e=this,t=e.navigation,a=t.$nextEl,i=t.$prevEl;a&&a.length&&(a.off("click",e.navigation.onNextClick),a.removeClass(e.params.navigation.disabledClass)),i&&i.length&&(i.off("click",e.navigation.onPrevClick),i.removeClass(e.params.navigation.disabledClass))}},J={update:function(){var e=this,t=e.rtl,a=e.params.pagination;if(a.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var i,s=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,r=e.pagination.$el,n=e.params.loop?Math.ceil((s-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?((i=Math.ceil((e.activeIndex-e.loopedSlides)/e.params.slidesPerGroup))>s-1-2*e.loopedSlides&&(i-=s-2*e.loopedSlides),i>n-1&&(i-=n),i<0&&"bullets"!==e.params.paginationType&&(i=n+i)):i=void 0!==e.snapIndex?e.snapIndex:e.activeIndex||0,"bullets"===a.type&&e.pagination.bullets&&e.pagination.bullets.length>0){var o,l,d,p=e.pagination.bullets;if(a.dynamicBullets&&(e.pagination.bulletSize=p.eq(0)[e.isHorizontal()?"outerWidth":"outerHeight"](!0),r.css(e.isHorizontal()?"width":"height",e.pagination.bulletSize*(a.dynamicMainBullets+4)+"px"),a.dynamicMainBullets>1&&void 0!==e.previousIndex&&(e.pagination.dynamicBulletIndex+=i-e.previousIndex,e.pagination.dynamicBulletIndex>a.dynamicMainBullets-1?e.pagination.dynamicBulletIndex=a.dynamicMainBullets-1:e.pagination.dynamicBulletIndex<0&&(e.pagination.dynamicBulletIndex=0)),o=i-e.pagination.dynamicBulletIndex,d=((l=o+(Math.min(p.length,a.dynamicMainBullets)-1))+o)/2),p.removeClass(a.bulletActiveClass+" "+a.bulletActiveClass+"-next "+a.bulletActiveClass+"-next-next "+a.bulletActiveClass+"-prev "+a.bulletActiveClass+"-prev-prev "+a.bulletActiveClass+"-main"),r.length>1)p.each((function(e){var t=m(e),s=t.index();s===i&&t.addClass(a.bulletActiveClass),a.dynamicBullets&&(s>=o&&s<=l&&t.addClass(a.bulletActiveClass+"-main"),s===o&&t.prev().addClass(a.bulletActiveClass+"-prev").prev().addClass(a.bulletActiveClass+"-prev-prev"),s===l&&t.next().addClass(a.bulletActiveClass+"-next").next().addClass(a.bulletActiveClass+"-next-next"))}));else{var c=p.eq(i),u=c.index();if(c.addClass(a.bulletActiveClass),a.dynamicBullets){for(var h=p.eq(o),v=p.eq(l),f=o;f<=l;f+=1)p.eq(f).addClass(a.bulletActiveClass+"-main");if(e.params.loop)if(u>=p.length-a.dynamicMainBullets){for(var g=a.dynamicMainBullets;g>=0;g-=1)p.eq(p.length-g).addClass(a.bulletActiveClass+"-main");p.eq(p.length-a.dynamicMainBullets-1).addClass(a.bulletActiveClass+"-prev")}else h.prev().addClass(a.bulletActiveClass+"-prev").prev().addClass(a.bulletActiveClass+"-prev-prev"),v.next().addClass(a.bulletActiveClass+"-next").next().addClass(a.bulletActiveClass+"-next-next");else h.prev().addClass(a.bulletActiveClass+"-prev").prev().addClass(a.bulletActiveClass+"-prev-prev"),v.next().addClass(a.bulletActiveClass+"-next").next().addClass(a.bulletActiveClass+"-next-next")}}if(a.dynamicBullets){var b=Math.min(p.length,a.dynamicMainBullets+4),w=(e.pagination.bulletSize*b-e.pagination.bulletSize)/2-d*e.pagination.bulletSize,y=t?"right":"left";p.css(e.isHorizontal()?y:"top",w+"px")}}if("fraction"===a.type&&(r.find(z(a.currentClass)).text(a.formatFractionCurrent(i+1)),r.find(z(a.totalClass)).text(a.formatFractionTotal(n))),"progressbar"===a.type){var E;E=a.progressbarOpposite?e.isHorizontal()?"vertical":"horizontal":e.isHorizontal()?"horizontal":"vertical";var x=(i+1)/n,T=1,S=1;"horizontal"===E?T=x:S=x,r.find(z(a.progressbarFillClass)).transform("translate3d(0,0,0) scaleX("+T+") scaleY("+S+")").transition(e.params.speed)}"custom"===a.type&&a.renderCustom?(r.html(a.renderCustom(e,i+1,n)),e.emit("paginationRender",r[0])):e.emit("paginationUpdate",r[0]),r[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](a.lockClass)}},render:function(){var e=this,t=e.params.pagination;if(t.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var a=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,i=e.pagination.$el,s="";if("bullets"===t.type){var r=e.params.loop?Math.ceil((a-2*e.loopedSlides)/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&!e.params.loop&&r>a&&(r=a);for(var n=0;n";i.html(s),e.pagination.bullets=i.find(z(t.bulletClass))}"fraction"===t.type&&(s=t.renderFraction?t.renderFraction.call(e,t.currentClass,t.totalClass):' / ',i.html(s)),"progressbar"===t.type&&(s=t.renderProgressbar?t.renderProgressbar.call(e,t.progressbarFillClass):'',i.html(s)),"custom"!==t.type&&e.emit("paginationRender",e.pagination.$el[0])}},init:function(){var e=this,t=e.params.pagination;if(t.el){var a=m(t.el);0!==a.length&&(e.params.uniqueNavElements&&"string"==typeof t.el&&a.length>1&&(a=e.$el.find(t.el)),"bullets"===t.type&&t.clickable&&a.addClass(t.clickableClass),a.addClass(t.modifierClass+t.type),"bullets"===t.type&&t.dynamicBullets&&(a.addClass(""+t.modifierClass+t.type+"-dynamic"),e.pagination.dynamicBulletIndex=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),"progressbar"===t.type&&t.progressbarOpposite&&a.addClass(t.progressbarOppositeClass),t.clickable&&a.on("click",z(t.bulletClass),(function(t){t.preventDefault();var a=m(this).index()*e.params.slidesPerGroup;e.params.loop&&(a+=e.loopedSlides),e.slideTo(a)})),C(e.pagination,{$el:a,el:a[0]}))}},destroy:function(){var e=this,t=e.params.pagination;if(t.el&&e.pagination.el&&e.pagination.$el&&0!==e.pagination.$el.length){var a=e.pagination.$el;a.removeClass(t.hiddenClass),a.removeClass(t.modifierClass+t.type),e.pagination.bullets&&e.pagination.bullets.removeClass(t.bulletActiveClass),t.clickable&&a.off("click",z(t.bulletClass))}}},Q={setTranslate:function(){var e=this;if(e.params.scrollbar.el&&e.scrollbar.el){var t=e.scrollbar,a=e.rtlTranslate,i=e.progress,s=t.dragSize,r=t.trackSize,n=t.$dragEl,o=t.$el,l=e.params.scrollbar,d=s,p=(r-s)*i;a?(p=-p)>0?(d=s-p,p=0):-p+s>r&&(d=r+p):p<0?(d=s+p,p=0):p+s>r&&(d=r-p),e.isHorizontal()?(n.transform("translate3d("+p+"px, 0, 0)"),n[0].style.width=d+"px"):(n.transform("translate3d(0px, "+p+"px, 0)"),n[0].style.height=d+"px"),l.hide&&(clearTimeout(e.scrollbar.timeout),o[0].style.opacity=1,e.scrollbar.timeout=setTimeout((function(){o[0].style.opacity=0,o.transition(400)}),1e3))}},setTransition:function(e){var t=this;t.params.scrollbar.el&&t.scrollbar.el&&t.scrollbar.$dragEl.transition(e)},updateSize:function(){var e=this;if(e.params.scrollbar.el&&e.scrollbar.el){var t=e.scrollbar,a=t.$dragEl,i=t.$el;a[0].style.width="",a[0].style.height="";var s,r=e.isHorizontal()?i[0].offsetWidth:i[0].offsetHeight,n=e.size/e.virtualSize,o=n*(r/e.size);s="auto"===e.params.scrollbar.dragSize?r*n:parseInt(e.params.scrollbar.dragSize,10),e.isHorizontal()?a[0].style.width=s+"px":a[0].style.height=s+"px",i[0].style.display=n>=1?"none":"",e.params.scrollbar.hide&&(i[0].style.opacity=0),C(t,{trackSize:r,divider:n,moveDivider:o,dragSize:s}),t.$el[e.params.watchOverflow&&e.isLocked?"addClass":"removeClass"](e.params.scrollbar.lockClass)}},getPointerPosition:function(e){return this.isHorizontal()?"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].clientX:e.clientX:"touchstart"===e.type||"touchmove"===e.type?e.targetTouches[0].clientY:e.clientY},setDragPosition:function(e){var t,a=this,i=a.scrollbar,s=a.rtlTranslate,r=i.$el,n=i.dragSize,o=i.trackSize,l=i.dragStartPos;t=(i.getPointerPosition(e)-r.offset()[a.isHorizontal()?"left":"top"]-(null!==l?l:n/2))/(o-n),t=Math.max(Math.min(t,1),0),s&&(t=1-t);var d=a.minTranslate()+(a.maxTranslate()-a.minTranslate())*t;a.updateProgress(d),a.setTranslate(d),a.updateActiveIndex(),a.updateSlidesClasses()},onDragStart:function(e){var t=this,a=t.params.scrollbar,i=t.scrollbar,s=t.$wrapperEl,r=i.$el,n=i.$dragEl;t.scrollbar.isTouched=!0,t.scrollbar.dragStartPos=e.target===n[0]||e.target===n?i.getPointerPosition(e)-e.target.getBoundingClientRect()[t.isHorizontal()?"left":"top"]:null,e.preventDefault(),e.stopPropagation(),s.transition(100),n.transition(100),i.setDragPosition(e),clearTimeout(t.scrollbar.dragTimeout),r.transition(0),a.hide&&r.css("opacity",1),t.params.cssMode&&t.$wrapperEl.css("scroll-snap-type","none"),t.emit("scrollbarDragStart",e)},onDragMove:function(e){var t=this,a=t.scrollbar,i=t.$wrapperEl,s=a.$el,r=a.$dragEl;t.scrollbar.isTouched&&(e.preventDefault?e.preventDefault():e.returnValue=!1,a.setDragPosition(e),i.transition(0),s.transition(0),r.transition(0),t.emit("scrollbarDragMove",e))},onDragEnd:function(e){var t=this,a=t.params.scrollbar,i=t.scrollbar,s=t.$wrapperEl,r=i.$el;t.scrollbar.isTouched&&(t.scrollbar.isTouched=!1,t.params.cssMode&&(t.$wrapperEl.css("scroll-snap-type",""),s.transition("")),a.hide&&(clearTimeout(t.scrollbar.dragTimeout),t.scrollbar.dragTimeout=E((function(){r.css("opacity",0),r.transition(400)}),1e3)),t.emit("scrollbarDragEnd",e),a.snapOnRelease&&t.slideToClosest())},enableDraggable:function(){var e=this;if(e.params.scrollbar.el){var t=r(),a=e.scrollbar,i=e.touchEventsTouch,s=e.touchEventsDesktop,n=e.params,o=e.support,l=a.$el[0],d=!(!o.passiveListener||!n.passiveListeners)&&{passive:!1,capture:!1},p=!(!o.passiveListener||!n.passiveListeners)&&{passive:!0,capture:!1};l&&(o.touch?(l.addEventListener(i.start,e.scrollbar.onDragStart,d),l.addEventListener(i.move,e.scrollbar.onDragMove,d),l.addEventListener(i.end,e.scrollbar.onDragEnd,p)):(l.addEventListener(s.start,e.scrollbar.onDragStart,d),t.addEventListener(s.move,e.scrollbar.onDragMove,d),t.addEventListener(s.end,e.scrollbar.onDragEnd,p)))}},disableDraggable:function(){var e=this;if(e.params.scrollbar.el){var t=r(),a=e.scrollbar,i=e.touchEventsTouch,s=e.touchEventsDesktop,n=e.params,o=e.support,l=a.$el[0],d=!(!o.passiveListener||!n.passiveListeners)&&{passive:!1,capture:!1},p=!(!o.passiveListener||!n.passiveListeners)&&{passive:!0,capture:!1};l&&(o.touch?(l.removeEventListener(i.start,e.scrollbar.onDragStart,d),l.removeEventListener(i.move,e.scrollbar.onDragMove,d),l.removeEventListener(i.end,e.scrollbar.onDragEnd,p)):(l.removeEventListener(s.start,e.scrollbar.onDragStart,d),t.removeEventListener(s.move,e.scrollbar.onDragMove,d),t.removeEventListener(s.end,e.scrollbar.onDragEnd,p)))}},init:function(){var e=this;if(e.params.scrollbar.el){var t=e.scrollbar,a=e.$el,i=e.params.scrollbar,s=m(i.el);e.params.uniqueNavElements&&"string"==typeof i.el&&s.length>1&&1===a.find(i.el).length&&(s=a.find(i.el));var r=s.find("."+e.params.scrollbar.dragClass);0===r.length&&(r=m('
      '),s.append(r)),C(t,{$el:s,el:s[0],$dragEl:r,dragEl:r[0]}),i.draggable&&t.enableDraggable()}},destroy:function(){this.scrollbar.disableDraggable()}},ee={setTransform:function(e,t){var a=this.rtl,i=m(e),s=a?-1:1,r=i.attr("data-swiper-parallax")||"0",n=i.attr("data-swiper-parallax-x"),o=i.attr("data-swiper-parallax-y"),l=i.attr("data-swiper-parallax-scale"),d=i.attr("data-swiper-parallax-opacity");if(n||o?(n=n||"0",o=o||"0"):this.isHorizontal()?(n=r,o="0"):(o=r,n="0"),n=n.indexOf("%")>=0?parseInt(n,10)*t*s+"%":n*t*s+"px",o=o.indexOf("%")>=0?parseInt(o,10)*t+"%":o*t+"px",null!=d){var p=d-(d-1)*(1-Math.abs(t));i[0].style.opacity=p}if(null==l)i.transform("translate3d("+n+", "+o+", 0px)");else{var c=l-(l-1)*(1-Math.abs(t));i.transform("translate3d("+n+", "+o+", 0px) scale("+c+")")}},setTranslate:function(){var e=this,t=e.$el,a=e.slides,i=e.progress,s=e.snapGrid;t.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((function(t){e.parallax.setTransform(t,i)})),a.each((function(t,a){var r=t.progress;e.params.slidesPerGroup>1&&"auto"!==e.params.slidesPerView&&(r+=Math.ceil(a/2)-i*(s.length-1)),r=Math.min(Math.max(r,-1),1),m(t).find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((function(t){e.parallax.setTransform(t,r)}))}))},setTransition:function(e){void 0===e&&(e=this.params.speed);this.$el.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]").each((function(t){var a=m(t),i=parseInt(a.attr("data-swiper-parallax-duration"),10)||e;0===e&&(i=0),a.transition(i)}))}},te={getDistanceBetweenTouches:function(e){if(e.targetTouches.length<2)return 1;var t=e.targetTouches[0].pageX,a=e.targetTouches[0].pageY,i=e.targetTouches[1].pageX,s=e.targetTouches[1].pageY;return Math.sqrt(Math.pow(i-t,2)+Math.pow(s-a,2))},onGestureStart:function(e){var t=this,a=t.support,i=t.params.zoom,s=t.zoom,r=s.gesture;if(s.fakeGestureTouched=!1,s.fakeGestureMoved=!1,!a.gestures){if("touchstart"!==e.type||"touchstart"===e.type&&e.targetTouches.length<2)return;s.fakeGestureTouched=!0,r.scaleStart=te.getDistanceBetweenTouches(e)}r.$slideEl&&r.$slideEl.length||(r.$slideEl=m(e.target).closest("."+t.params.slideClass),0===r.$slideEl.length&&(r.$slideEl=t.slides.eq(t.activeIndex)),r.$imageEl=r.$slideEl.find("img, svg, canvas, picture, .swiper-zoom-target"),r.$imageWrapEl=r.$imageEl.parent("."+i.containerClass),r.maxRatio=r.$imageWrapEl.attr("data-swiper-zoom")||i.maxRatio,0!==r.$imageWrapEl.length)?(r.$imageEl&&r.$imageEl.transition(0),t.zoom.isScaling=!0):r.$imageEl=void 0},onGestureChange:function(e){var t=this,a=t.support,i=t.params.zoom,s=t.zoom,r=s.gesture;if(!a.gestures){if("touchmove"!==e.type||"touchmove"===e.type&&e.targetTouches.length<2)return;s.fakeGestureMoved=!0,r.scaleMove=te.getDistanceBetweenTouches(e)}r.$imageEl&&0!==r.$imageEl.length?(a.gestures?s.scale=e.scale*s.currentScale:s.scale=r.scaleMove/r.scaleStart*s.currentScale,s.scale>r.maxRatio&&(s.scale=r.maxRatio-1+Math.pow(s.scale-r.maxRatio+1,.5)),s.scales.touchesStart.x))return void(s.isTouched=!1);if(!t.isHorizontal()&&(Math.floor(s.minY)===Math.floor(s.startY)&&s.touchesCurrent.ys.touchesStart.y))return void(s.isTouched=!1)}e.cancelable&&e.preventDefault(),e.stopPropagation(),s.isMoved=!0,s.currentX=s.touchesCurrent.x-s.touchesStart.x+s.startX,s.currentY=s.touchesCurrent.y-s.touchesStart.y+s.startY,s.currentXs.maxX&&(s.currentX=s.maxX-1+Math.pow(s.currentX-s.maxX+1,.8)),s.currentYs.maxY&&(s.currentY=s.maxY-1+Math.pow(s.currentY-s.maxY+1,.8)),r.prevPositionX||(r.prevPositionX=s.touchesCurrent.x),r.prevPositionY||(r.prevPositionY=s.touchesCurrent.y),r.prevTime||(r.prevTime=Date.now()),r.x=(s.touchesCurrent.x-r.prevPositionX)/(Date.now()-r.prevTime)/2,r.y=(s.touchesCurrent.y-r.prevPositionY)/(Date.now()-r.prevTime)/2,Math.abs(s.touchesCurrent.x-r.prevPositionX)<2&&(r.x=0),Math.abs(s.touchesCurrent.y-r.prevPositionY)<2&&(r.y=0),r.prevPositionX=s.touchesCurrent.x,r.prevPositionY=s.touchesCurrent.y,r.prevTime=Date.now(),i.$imageWrapEl.transform("translate3d("+s.currentX+"px, "+s.currentY+"px,0)")}}},onTouchEnd:function(){var e=this.zoom,t=e.gesture,a=e.image,i=e.velocity;if(t.$imageEl&&0!==t.$imageEl.length){if(!a.isTouched||!a.isMoved)return a.isTouched=!1,void(a.isMoved=!1);a.isTouched=!1,a.isMoved=!1;var s=300,r=300,n=i.x*s,o=a.currentX+n,l=i.y*r,d=a.currentY+l;0!==i.x&&(s=Math.abs((o-a.currentX)/i.x)),0!==i.y&&(r=Math.abs((d-a.currentY)/i.y));var p=Math.max(s,r);a.currentX=o,a.currentY=d;var c=a.width*e.scale,u=a.height*e.scale;a.minX=Math.min(t.slideWidth/2-c/2,0),a.maxX=-a.minX,a.minY=Math.min(t.slideHeight/2-u/2,0),a.maxY=-a.minY,a.currentX=Math.max(Math.min(a.currentX,a.maxX),a.minX),a.currentY=Math.max(Math.min(a.currentY,a.maxY),a.minY),t.$imageWrapEl.transition(p).transform("translate3d("+a.currentX+"px, "+a.currentY+"px,0)")}},onTransitionEnd:function(){var e=this,t=e.zoom,a=t.gesture;a.$slideEl&&e.previousIndex!==e.activeIndex&&(a.$imageEl&&a.$imageEl.transform("translate3d(0,0,0) scale(1)"),a.$imageWrapEl&&a.$imageWrapEl.transform("translate3d(0,0,0)"),t.scale=1,t.currentScale=1,a.$slideEl=void 0,a.$imageEl=void 0,a.$imageWrapEl=void 0)},toggle:function(e){var t=this.zoom;t.scale&&1!==t.scale?t.out():t.in(e)},in:function(e){var t,a,i,s,r,n,l,d,p,c,u,h,v,f,m,g,b=this,w=o(),y=b.zoom,E=b.params.zoom,x=y.gesture,T=y.image;(x.$slideEl||(b.params.virtual&&b.params.virtual.enabled&&b.virtual?x.$slideEl=b.$wrapperEl.children("."+b.params.slideActiveClass):x.$slideEl=b.slides.eq(b.activeIndex),x.$imageEl=x.$slideEl.find("img, svg, canvas, picture, .swiper-zoom-target"),x.$imageWrapEl=x.$imageEl.parent("."+E.containerClass)),x.$imageEl&&0!==x.$imageEl.length)&&(x.$slideEl.addClass(""+E.zoomedSlideClass),void 0===T.touchesStart.x&&e?(t="touchend"===e.type?e.changedTouches[0].pageX:e.pageX,a="touchend"===e.type?e.changedTouches[0].pageY:e.pageY):(t=T.touchesStart.x,a=T.touchesStart.y),y.scale=x.$imageWrapEl.attr("data-swiper-zoom")||E.maxRatio,y.currentScale=x.$imageWrapEl.attr("data-swiper-zoom")||E.maxRatio,e?(m=x.$slideEl[0].offsetWidth,g=x.$slideEl[0].offsetHeight,i=x.$slideEl.offset().left+w.scrollX+m/2-t,s=x.$slideEl.offset().top+w.scrollY+g/2-a,l=x.$imageEl[0].offsetWidth,d=x.$imageEl[0].offsetHeight,p=l*y.scale,c=d*y.scale,v=-(u=Math.min(m/2-p/2,0)),f=-(h=Math.min(g/2-c/2,0)),(r=i*y.scale)v&&(r=v),(n=s*y.scale)f&&(n=f)):(r=0,n=0),x.$imageWrapEl.transition(300).transform("translate3d("+r+"px, "+n+"px,0)"),x.$imageEl.transition(300).transform("translate3d(0,0,0) scale("+y.scale+")"))},out:function(){var e=this,t=e.zoom,a=e.params.zoom,i=t.gesture;i.$slideEl||(e.params.virtual&&e.params.virtual.enabled&&e.virtual?i.$slideEl=e.$wrapperEl.children("."+e.params.slideActiveClass):i.$slideEl=e.slides.eq(e.activeIndex),i.$imageEl=i.$slideEl.find("img, svg, canvas, picture, .swiper-zoom-target"),i.$imageWrapEl=i.$imageEl.parent("."+a.containerClass)),i.$imageEl&&0!==i.$imageEl.length&&(t.scale=1,t.currentScale=1,i.$imageWrapEl.transition(300).transform("translate3d(0,0,0)"),i.$imageEl.transition(300).transform("translate3d(0,0,0) scale(1)"),i.$slideEl.removeClass(""+a.zoomedSlideClass),i.$slideEl=void 0)},toggleGestures:function(e){var t=this,a=t.zoom,i=a.slideSelector,s=a.passiveListener;t.$wrapperEl[e]("gesturestart",i,a.onGestureStart,s),t.$wrapperEl[e]("gesturechange",i,a.onGestureChange,s),t.$wrapperEl[e]("gestureend",i,a.onGestureEnd,s)},enableGestures:function(){this.zoom.gesturesEnabled||(this.zoom.gesturesEnabled=!0,this.zoom.toggleGestures("on"))},disableGestures:function(){this.zoom.gesturesEnabled&&(this.zoom.gesturesEnabled=!1,this.zoom.toggleGestures("off"))},enable:function(){var e=this,t=e.support,a=e.zoom;if(!a.enabled){a.enabled=!0;var i=!("touchstart"!==e.touchEvents.start||!t.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1},s=!t.passiveListener||{passive:!1,capture:!0},r="."+e.params.slideClass;e.zoom.passiveListener=i,e.zoom.slideSelector=r,t.gestures?(e.$wrapperEl.on(e.touchEvents.start,e.zoom.enableGestures,i),e.$wrapperEl.on(e.touchEvents.end,e.zoom.disableGestures,i)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.on(e.touchEvents.start,r,a.onGestureStart,i),e.$wrapperEl.on(e.touchEvents.move,r,a.onGestureChange,s),e.$wrapperEl.on(e.touchEvents.end,r,a.onGestureEnd,i),e.touchEvents.cancel&&e.$wrapperEl.on(e.touchEvents.cancel,r,a.onGestureEnd,i)),e.$wrapperEl.on(e.touchEvents.move,"."+e.params.zoom.containerClass,a.onTouchMove,s)}},disable:function(){var e=this,t=e.zoom;if(t.enabled){var a=e.support;e.zoom.enabled=!1;var i=!("touchstart"!==e.touchEvents.start||!a.passiveListener||!e.params.passiveListeners)&&{passive:!0,capture:!1},s=!a.passiveListener||{passive:!1,capture:!0},r="."+e.params.slideClass;a.gestures?(e.$wrapperEl.off(e.touchEvents.start,e.zoom.enableGestures,i),e.$wrapperEl.off(e.touchEvents.end,e.zoom.disableGestures,i)):"touchstart"===e.touchEvents.start&&(e.$wrapperEl.off(e.touchEvents.start,r,t.onGestureStart,i),e.$wrapperEl.off(e.touchEvents.move,r,t.onGestureChange,s),e.$wrapperEl.off(e.touchEvents.end,r,t.onGestureEnd,i),e.touchEvents.cancel&&e.$wrapperEl.off(e.touchEvents.cancel,r,t.onGestureEnd,i)),e.$wrapperEl.off(e.touchEvents.move,"."+e.params.zoom.containerClass,t.onTouchMove,s)}}},ae={loadInSlide:function(e,t){void 0===t&&(t=!0);var a=this,i=a.params.lazy;if(void 0!==e&&0!==a.slides.length){var s=a.virtual&&a.params.virtual.enabled?a.$wrapperEl.children("."+a.params.slideClass+'[data-swiper-slide-index="'+e+'"]'):a.slides.eq(e),r=s.find("."+i.elementClass+":not(."+i.loadedClass+"):not(."+i.loadingClass+")");!s.hasClass(i.elementClass)||s.hasClass(i.loadedClass)||s.hasClass(i.loadingClass)||r.push(s[0]),0!==r.length&&r.each((function(e){var r=m(e);r.addClass(i.loadingClass);var n=r.attr("data-background"),o=r.attr("data-src"),l=r.attr("data-srcset"),d=r.attr("data-sizes"),p=r.parent("picture");a.loadImage(r[0],o||n,l,d,!1,(function(){if(null!=a&&a&&(!a||a.params)&&!a.destroyed){if(n?(r.css("background-image",'url("'+n+'")'),r.removeAttr("data-background")):(l&&(r.attr("srcset",l),r.removeAttr("data-srcset")),d&&(r.attr("sizes",d),r.removeAttr("data-sizes")),p.length&&p.children("source").each((function(e){var t=m(e);t.attr("data-srcset")&&(t.attr("srcset",t.attr("data-srcset")),t.removeAttr("data-srcset"))})),o&&(r.attr("src",o),r.removeAttr("data-src"))),r.addClass(i.loadedClass).removeClass(i.loadingClass),s.find("."+i.preloaderClass).remove(),a.params.loop&&t){var e=s.attr("data-swiper-slide-index");if(s.hasClass(a.params.slideDuplicateClass)){var c=a.$wrapperEl.children('[data-swiper-slide-index="'+e+'"]:not(.'+a.params.slideDuplicateClass+")");a.lazy.loadInSlide(c.index(),!1)}else{var u=a.$wrapperEl.children("."+a.params.slideDuplicateClass+'[data-swiper-slide-index="'+e+'"]');a.lazy.loadInSlide(u.index(),!1)}}a.emit("lazyImageReady",s[0],r[0]),a.params.autoHeight&&a.updateAutoHeight()}})),a.emit("lazyImageLoad",s[0],r[0])}))}},load:function(){var e=this,t=e.$wrapperEl,a=e.params,i=e.slides,s=e.activeIndex,r=e.virtual&&a.virtual.enabled,n=a.lazy,o=a.slidesPerView;function l(e){if(r){if(t.children("."+a.slideClass+'[data-swiper-slide-index="'+e+'"]').length)return!0}else if(i[e])return!0;return!1}function d(e){return r?m(e).attr("data-swiper-slide-index"):m(e).index()}if("auto"===o&&(o=0),e.lazy.initialImageLoaded||(e.lazy.initialImageLoaded=!0),e.params.watchSlidesVisibility)t.children("."+a.slideVisibleClass).each((function(t){var a=r?m(t).attr("data-swiper-slide-index"):m(t).index();e.lazy.loadInSlide(a)}));else if(o>1)for(var p=s;p1||n.loadPrevNextAmount&&n.loadPrevNextAmount>1){for(var c=n.loadPrevNextAmount,u=o,h=Math.min(s+u+Math.max(c,u),i.length),v=Math.max(s-Math.max(u,c),0),f=s+o;f0&&e.lazy.loadInSlide(d(b));var w=t.children("."+a.slidePrevClass);w.length>0&&e.lazy.loadInSlide(d(w))}},checkInViewOnLoad:function(){var e=o(),t=this;if(t&&!t.destroyed){var a=t.params.lazy.scrollingElement?m(t.params.lazy.scrollingElement):m(e),i=a[0]===e,s=i?e.innerWidth:a[0].offsetWidth,r=i?e.innerHeight:a[0].offsetHeight,n=t.$el.offset(),l=!1;t.rtlTranslate&&(n.left-=t.$el[0].scrollLeft);for(var d=[[n.left,n.top],[n.left+t.width,n.top],[n.left,n.top+t.height],[n.left+t.width,n.top+t.height]],p=0;p=0&&c[0]<=s&&c[1]>=0&&c[1]<=r){if(0===c[0]&&0===c[1])continue;l=!0}}l?(t.lazy.load(),a.off("scroll",t.lazy.checkInViewOnLoad)):t.lazy.scrollHandlerAttached||(t.lazy.scrollHandlerAttached=!0,a.on("scroll",t.lazy.checkInViewOnLoad))}}},ie={LinearSpline:function(e,t){var a,i,s,r,n,o=function(e,t){for(i=-1,a=e.length;a-i>1;)e[s=a+i>>1]<=t?i=s:a=s;return a};return this.x=e,this.y=t,this.lastIndex=e.length-1,this.interpolate=function(e){return e?(n=o(this.x,e),r=n-1,(e-this.x[r])*(this.y[n]-this.y[r])/(this.x[n]-this.x[r])+this.y[r]):0},this},getInterpolateFunction:function(e){var t=this;t.controller.spline||(t.controller.spline=t.params.loop?new ie.LinearSpline(t.slidesGrid,e.slidesGrid):new ie.LinearSpline(t.snapGrid,e.snapGrid))},setTranslate:function(e,t){var a,i,s=this,r=s.controller.control,n=s.constructor;function o(e){var t=s.rtlTranslate?-s.translate:s.translate;"slide"===s.params.controller.by&&(s.controller.getInterpolateFunction(e),i=-s.controller.spline.interpolate(-t)),i&&"container"!==s.params.controller.by||(a=(e.maxTranslate()-e.minTranslate())/(s.maxTranslate()-s.minTranslate()),i=(t-s.minTranslate())*a+e.minTranslate()),s.params.controller.inverse&&(i=e.maxTranslate()-i),e.updateProgress(i),e.setTranslate(i,s),e.updateActiveIndex(),e.updateSlidesClasses()}if(Array.isArray(r))for(var l=0;l0&&(e.isBeginning?(e.a11y.disableEl(i),e.a11y.makeElNotFocusable(i)):(e.a11y.enableEl(i),e.a11y.makeElFocusable(i))),a&&a.length>0&&(e.isEnd?(e.a11y.disableEl(a),e.a11y.makeElNotFocusable(a)):(e.a11y.enableEl(a),e.a11y.makeElFocusable(a)))}},updatePagination:function(){var e=this,t=e.params.a11y;e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.bullets.each((function(a){var i=m(a);e.a11y.makeElFocusable(i),e.params.pagination.renderBullet||(e.a11y.addElRole(i,"button"),e.a11y.addElLabel(i,t.paginationBulletMessage.replace(/\{\{index\}\}/,i.index()+1)))}))},init:function(){var e=this,t=e.params.a11y;e.$el.append(e.a11y.liveRegion);var a=e.$el;t.containerRoleDescriptionMessage&&e.a11y.addElRoleDescription(a,t.containerRoleDescriptionMessage),t.containerMessage&&e.a11y.addElLabel(a,t.containerMessage);var i,s,r,n=e.$wrapperEl,o=n.attr("id")||"swiper-wrapper-"+e.a11y.getRandomNumber(16);e.a11y.addElId(n,o),i=e.params.autoplay&&e.params.autoplay.enabled?"off":"polite",e.a11y.addElLive(n,i),t.itemRoleDescriptionMessage&&e.a11y.addElRoleDescription(m(e.slides),t.itemRoleDescriptionMessage),e.a11y.addElRole(m(e.slides),"group"),e.slides.each((function(a){var i=m(a),s=t.slideLabelMessage.replace(/\{\{index\}\}/,i.index()+1).replace(/\{\{slidesLength\}\}/,e.slides.length);e.a11y.addElLabel(i,s)})),e.navigation&&e.navigation.$nextEl&&(s=e.navigation.$nextEl),e.navigation&&e.navigation.$prevEl&&(r=e.navigation.$prevEl),s&&s.length&&(e.a11y.makeElFocusable(s),"BUTTON"!==s[0].tagName&&(e.a11y.addElRole(s,"button"),s.on("keydown",e.a11y.onEnterOrSpaceKey)),e.a11y.addElLabel(s,t.nextSlideMessage),e.a11y.addElControls(s,o)),r&&r.length&&(e.a11y.makeElFocusable(r),"BUTTON"!==r[0].tagName&&(e.a11y.addElRole(r,"button"),r.on("keydown",e.a11y.onEnterOrSpaceKey)),e.a11y.addElLabel(r,t.prevSlideMessage),e.a11y.addElControls(r,o)),e.pagination&&e.params.pagination.clickable&&e.pagination.bullets&&e.pagination.bullets.length&&e.pagination.$el.on("keydown",z(e.params.pagination.bulletClass),e.a11y.onEnterOrSpaceKey)},destroy:function(){var e,t,a=this;a.a11y.liveRegion&&a.a11y.liveRegion.length>0&&a.a11y.liveRegion.remove(),a.navigation&&a.navigation.$nextEl&&(e=a.navigation.$nextEl),a.navigation&&a.navigation.$prevEl&&(t=a.navigation.$prevEl),e&&e.off("keydown",a.a11y.onEnterOrSpaceKey),t&&t.off("keydown",a.a11y.onEnterOrSpaceKey),a.pagination&&a.params.pagination.clickable&&a.pagination.bullets&&a.pagination.bullets.length&&a.pagination.$el.off("keydown",z(a.params.pagination.bulletClass),a.a11y.onEnterOrSpaceKey)}},re={init:function(){var e=this,t=o();if(e.params.history){if(!t.history||!t.history.pushState)return e.params.history.enabled=!1,void(e.params.hashNavigation.enabled=!0);var a=e.history;a.initialized=!0,a.paths=re.getPathValues(e.params.url),(a.paths.key||a.paths.value)&&(a.scrollToSlide(0,a.paths.value,e.params.runCallbacksOnInit),e.params.history.replaceState||t.addEventListener("popstate",e.history.setHistoryPopState))}},destroy:function(){var e=o();this.params.history.replaceState||e.removeEventListener("popstate",this.history.setHistoryPopState)},setHistoryPopState:function(){var e=this;e.history.paths=re.getPathValues(e.params.url),e.history.scrollToSlide(e.params.speed,e.history.paths.value,!1)},getPathValues:function(e){var t=o(),a=(e?new URL(e):t.location).pathname.slice(1).split("/").filter((function(e){return""!==e})),i=a.length;return{key:a[i-2],value:a[i-1]}},setHistory:function(e,t){var a=this,i=o();if(a.history.initialized&&a.params.history.enabled){var s;s=a.params.url?new URL(a.params.url):i.location;var r=a.slides.eq(t),n=re.slugify(r.attr("data-history"));s.pathname.includes(e)||(n=e+"/"+n);var l=i.history.state;l&&l.value===n||(a.params.history.replaceState?i.history.replaceState({value:n},null,n):i.history.pushState({value:n},null,n))}},slugify:function(e){return e.toString().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").replace(/^-+/,"").replace(/-+$/,"")},scrollToSlide:function(e,t,a){var i=this;if(t)for(var s=0,r=i.slides.length;s
      '),i.append(e)),e.css({height:r+"px"})):0===(e=a.find(".swiper-cube-shadow")).length&&(e=m('
      '),a.append(e)));for(var v=0;v-1&&(h=90*g+90*y,o&&(h=90*-g-90*y)),f.transform(S),p.slideShadows){var C=c?f.find(".swiper-slide-shadow-left"):f.find(".swiper-slide-shadow-top"),M=c?f.find(".swiper-slide-shadow-right"):f.find(".swiper-slide-shadow-bottom");0===C.length&&(C=m('
      '),f.append(C)),0===M.length&&(M=m('
      '),f.append(M)),C.length&&(C[0].style.opacity=Math.max(-y,0)),M.length&&(M[0].style.opacity=Math.max(y,0))}}if(i.css({"-webkit-transform-origin":"50% 50% -"+l/2+"px","-moz-transform-origin":"50% 50% -"+l/2+"px","-ms-transform-origin":"50% 50% -"+l/2+"px","transform-origin":"50% 50% -"+l/2+"px"}),p.shadow)if(c)e.transform("translate3d(0px, "+(r/2+p.shadowOffset)+"px, "+-r/2+"px) rotateX(90deg) rotateZ(0deg) scale("+p.shadowScale+")");else{var z=Math.abs(h)-90*Math.floor(Math.abs(h)/90),P=1.5-(Math.sin(2*z*Math.PI/360)/2+Math.cos(2*z*Math.PI/360)/2),k=p.shadowScale,L=p.shadowScale/P,$=p.shadowOffset;e.transform("scale3d("+k+", 1, "+L+") translate3d(0px, "+(n/2+$)+"px, "+-n/2/L+"px) rotateX(-90deg)")}var I=d.isSafari||d.isWebView?-l/2:0;i.transform("translate3d(0px,0,"+I+"px) rotateX("+(t.isHorizontal()?0:h)+"deg) rotateY("+(t.isHorizontal()?-h:0)+"deg)")},setTransition:function(e){var t=this,a=t.$el;t.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),t.params.cubeEffect.shadow&&!t.isHorizontal()&&a.find(".swiper-cube-shadow").transition(e)}},pe={setTranslate:function(){for(var e=this,t=e.slides,a=e.rtlTranslate,i=0;i
      '),s.append(p)),0===c.length&&(c=m('
      '),s.append(c)),p.length&&(p[0].style.opacity=Math.max(-r,0)),c.length&&(c[0].style.opacity=Math.max(r,0))}s.transform("translate3d("+l+"px, "+d+"px, 0px) rotateX("+o+"deg) rotateY("+n+"deg)")}},setTransition:function(e){var t=this,a=t.slides,i=t.activeIndex,s=t.$wrapperEl;if(a.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),t.params.virtualTranslate&&0!==e){var r=!1;a.eq(i).transitionEnd((function(){if(!r&&t&&!t.destroyed){r=!0,t.animating=!1;for(var e=["webkitTransitionEnd","transitionend"],a=0;a
      '),h.append(C)),0===M.length&&(M=m('
      '),h.append(M)),C.length&&(C[0].style.opacity=f>0?f:0),M.length&&(M[0].style.opacity=-f>0?-f:0)}}},setTransition:function(e){this.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}},ue={init:function(){var e=this,t=e.params.thumbs;if(e.thumbs.initialized)return!1;e.thumbs.initialized=!0;var a=e.constructor;return t.swiper instanceof a?(e.thumbs.swiper=t.swiper,C(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),C(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1})):S(t.swiper)&&(e.thumbs.swiper=new a(C({},t.swiper,{watchSlidesVisibility:!0,watchSlidesProgress:!0,slideToClickedSlide:!1})),e.thumbs.swiperCreated=!0),e.thumbs.swiper.$el.addClass(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",e.thumbs.onThumbClick),!0},onThumbClick:function(){var e=this,t=e.thumbs.swiper;if(t){var a=t.clickedIndex,i=t.clickedSlide;if(!(i&&m(i).hasClass(e.params.thumbs.slideThumbActiveClass)||null==a)){var s;if(s=t.params.loop?parseInt(m(t.clickedSlide).attr("data-swiper-slide-index"),10):a,e.params.loop){var r=e.activeIndex;e.slides.eq(r).hasClass(e.params.slideDuplicateClass)&&(e.loopFix(),e._clientLeft=e.$wrapperEl[0].clientLeft,r=e.activeIndex);var n=e.slides.eq(r).prevAll('[data-swiper-slide-index="'+s+'"]').eq(0).index(),o=e.slides.eq(r).nextAll('[data-swiper-slide-index="'+s+'"]').eq(0).index();s=void 0===n?o:void 0===o?n:o-rt.previousIndex?"next":"prev"}else o=(n=t.realIndex)>t.previousIndex?"next":"prev";r&&(n+="next"===o?s:-1*s),a.visibleSlidesIndexes&&a.visibleSlidesIndexes.indexOf(n)<0&&(a.params.centeredSlides?n=n>l?n-Math.floor(i/2)+1:n+Math.floor(i/2)-1:n>l&&(n=n-i+1),a.slideTo(n,e?0:void 0))}var c=1,u=t.params.thumbs.slideThumbActiveClass;if(t.params.slidesPerView>1&&!t.params.centeredSlides&&(c=t.params.slidesPerView),t.params.thumbs.multipleActiveThumbs||(c=1),c=Math.floor(c),a.slides.removeClass(u),a.params.loop||a.params.virtual&&a.params.virtual.enabled)for(var h=0;h0&&!m(a).hasClass(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&a===e.navigation.nextEl||e.navigation.prevEl&&a===e.navigation.prevEl))return;!0===e.pagination.$el.hasClass(e.params.pagination.hiddenClass)?e.emit("paginationShow"):e.emit("paginationHide"),e.pagination.$el.toggleClass(e.params.pagination.hiddenClass)}}}},{name:"scrollbar",params:{scrollbar:{el:null,dragSize:"auto",hide:!1,draggable:!1,snapOnRelease:!0,lockClass:"swiper-scrollbar-lock",dragClass:"swiper-scrollbar-drag"}},create:function(){M(this,{scrollbar:t({isTouched:!1,timeout:null,dragTimeout:null},Q)})},on:{init:function(e){e.scrollbar.init(),e.scrollbar.updateSize(),e.scrollbar.setTranslate()},update:function(e){e.scrollbar.updateSize()},resize:function(e){e.scrollbar.updateSize()},observerUpdate:function(e){e.scrollbar.updateSize()},setTranslate:function(e){e.scrollbar.setTranslate()},setTransition:function(e,t){e.scrollbar.setTransition(t)},destroy:function(e){e.scrollbar.destroy()}}},{name:"parallax",params:{parallax:{enabled:!1}},create:function(){M(this,{parallax:t({},ee)})},on:{beforeInit:function(e){e.params.parallax.enabled&&(e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0)},init:function(e){e.params.parallax.enabled&&e.parallax.setTranslate()},setTranslate:function(e){e.params.parallax.enabled&&e.parallax.setTranslate()},setTransition:function(e,t){e.params.parallax.enabled&&e.parallax.setTransition(t)}}},{name:"zoom",params:{zoom:{enabled:!1,maxRatio:3,minRatio:1,toggle:!0,containerClass:"swiper-zoom-container",zoomedSlideClass:"swiper-slide-zoomed"}},create:function(){var e=this;M(e,{zoom:t({enabled:!1,scale:1,currentScale:1,isScaling:!1,gesture:{$slideEl:void 0,slideWidth:void 0,slideHeight:void 0,$imageEl:void 0,$imageWrapEl:void 0,maxRatio:3},image:{isTouched:void 0,isMoved:void 0,currentX:void 0,currentY:void 0,minX:void 0,minY:void 0,maxX:void 0,maxY:void 0,width:void 0,height:void 0,startX:void 0,startY:void 0,touchesStart:{},touchesCurrent:{}},velocity:{x:void 0,y:void 0,prevPositionX:void 0,prevPositionY:void 0,prevTime:void 0}},te)});var a=1;Object.defineProperty(e.zoom,"scale",{get:function(){return a},set:function(t){if(a!==t){var i=e.zoom.gesture.$imageEl?e.zoom.gesture.$imageEl[0]:void 0,s=e.zoom.gesture.$slideEl?e.zoom.gesture.$slideEl[0]:void 0;e.emit("zoomChange",t,i,s)}a=t}})},on:{init:function(e){e.params.zoom.enabled&&e.zoom.enable()},destroy:function(e){e.zoom.disable()},touchStart:function(e,t){e.zoom.enabled&&e.zoom.onTouchStart(t)},touchEnd:function(e,t){e.zoom.enabled&&e.zoom.onTouchEnd(t)},doubleTap:function(e,t){!e.animating&&e.params.zoom.enabled&&e.zoom.enabled&&e.params.zoom.toggle&&e.zoom.toggle(t)},transitionEnd:function(e){e.zoom.enabled&&e.params.zoom.enabled&&e.zoom.onTransitionEnd()},slideChange:function(e){e.zoom.enabled&&e.params.zoom.enabled&&e.params.cssMode&&e.zoom.onTransitionEnd()}}},{name:"lazy",params:{lazy:{checkInView:!1,enabled:!1,loadPrevNext:!1,loadPrevNextAmount:1,loadOnTransitionStart:!1,scrollingElement:"",elementClass:"swiper-lazy",loadingClass:"swiper-lazy-loading",loadedClass:"swiper-lazy-loaded",preloaderClass:"swiper-lazy-preloader"}},create:function(){M(this,{lazy:t({initialImageLoaded:!1},ae)})},on:{beforeInit:function(e){e.params.lazy.enabled&&e.params.preloadImages&&(e.params.preloadImages=!1)},init:function(e){e.params.lazy.enabled&&!e.params.loop&&0===e.params.initialSlide&&(e.params.lazy.checkInView?e.lazy.checkInViewOnLoad():e.lazy.load())},scroll:function(e){e.params.freeMode&&!e.params.freeModeSticky&&e.lazy.load()},"scrollbarDragMove resize _freeModeNoMomentumRelease":function(e){e.params.lazy.enabled&&e.lazy.load()},transitionStart:function(e){e.params.lazy.enabled&&(e.params.lazy.loadOnTransitionStart||!e.params.lazy.loadOnTransitionStart&&!e.lazy.initialImageLoaded)&&e.lazy.load()},transitionEnd:function(e){e.params.lazy.enabled&&!e.params.lazy.loadOnTransitionStart&&e.lazy.load()},slideChange:function(e){e.params.lazy.enabled&&e.params.cssMode&&e.lazy.load()}}},{name:"controller",params:{controller:{control:void 0,inverse:!1,by:"slide"}},create:function(){M(this,{controller:t({control:this.params.controller.control},ie)})},on:{update:function(e){e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},resize:function(e){e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},observerUpdate:function(e){e.controller.control&&e.controller.spline&&(e.controller.spline=void 0,delete e.controller.spline)},setTranslate:function(e,t,a){e.controller.control&&e.controller.setTranslate(t,a)},setTransition:function(e,t,a){e.controller.control&&e.controller.setTransition(t,a)}}},{name:"a11y",params:{a11y:{enabled:!0,notificationClass:"swiper-notification",prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",paginationBulletMessage:"Go to slide {{index}}",slideLabelMessage:"{{index}} / {{slidesLength}}",containerMessage:null,containerRoleDescriptionMessage:null,itemRoleDescriptionMessage:null}},create:function(){M(this,{a11y:t({},se,{liveRegion:m('')})})},on:{afterInit:function(e){e.params.a11y.enabled&&(e.a11y.init(),e.a11y.updateNavigation())},toEdge:function(e){e.params.a11y.enabled&&e.a11y.updateNavigation()},fromEdge:function(e){e.params.a11y.enabled&&e.a11y.updateNavigation()},paginationUpdate:function(e){e.params.a11y.enabled&&e.a11y.updatePagination()},destroy:function(e){e.params.a11y.enabled&&e.a11y.destroy()}}},{name:"history",params:{history:{enabled:!1,replaceState:!1,key:"slides"}},create:function(){M(this,{history:t({},re)})},on:{init:function(e){e.params.history.enabled&&e.history.init()},destroy:function(e){e.params.history.enabled&&e.history.destroy()},transitionEnd:function(e){e.history.initialized&&e.history.setHistory(e.params.history.key,e.activeIndex)},slideChange:function(e){e.history.initialized&&e.params.cssMode&&e.history.setHistory(e.params.history.key,e.activeIndex)}}},{name:"hash-navigation",params:{hashNavigation:{enabled:!1,replaceState:!1,watchState:!1}},create:function(){M(this,{hashNavigation:t({initialized:!1},ne)})},on:{init:function(e){e.params.hashNavigation.enabled&&e.hashNavigation.init()},destroy:function(e){e.params.hashNavigation.enabled&&e.hashNavigation.destroy()},transitionEnd:function(e){e.hashNavigation.initialized&&e.hashNavigation.setHash()},slideChange:function(e){e.hashNavigation.initialized&&e.params.cssMode&&e.hashNavigation.setHash()}}},{name:"autoplay",params:{autoplay:{enabled:!1,delay:3e3,waitForTransition:!0,disableOnInteraction:!0,stopOnLastSlide:!1,reverseDirection:!1}},create:function(){M(this,{autoplay:t({},oe,{running:!1,paused:!1})})},on:{init:function(e){e.params.autoplay.enabled&&(e.autoplay.start(),r().addEventListener("visibilitychange",e.autoplay.onVisibilityChange))},beforeTransitionStart:function(e,t,a){e.autoplay.running&&(a||!e.params.autoplay.disableOnInteraction?e.autoplay.pause(t):e.autoplay.stop())},sliderFirstMove:function(e){e.autoplay.running&&(e.params.autoplay.disableOnInteraction?e.autoplay.stop():e.autoplay.pause())},touchEnd:function(e){e.params.cssMode&&e.autoplay.paused&&!e.params.autoplay.disableOnInteraction&&e.autoplay.run()},destroy:function(e){e.autoplay.running&&e.autoplay.stop(),r().removeEventListener("visibilitychange",e.autoplay.onVisibilityChange)}}},{name:"effect-fade",params:{fadeEffect:{crossFade:!1}},create:function(){M(this,{fadeEffect:t({},le)})},on:{beforeInit:function(e){if("fade"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"fade");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};C(e.params,t),C(e.originalParams,t)}},setTranslate:function(e){"fade"===e.params.effect&&e.fadeEffect.setTranslate()},setTransition:function(e,t){"fade"===e.params.effect&&e.fadeEffect.setTransition(t)}}},{name:"effect-cube",params:{cubeEffect:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94}},create:function(){M(this,{cubeEffect:t({},de)})},on:{beforeInit:function(e){if("cube"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"cube"),e.classNames.push(e.params.containerModifierClass+"3d");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,resistanceRatio:0,spaceBetween:0,centeredSlides:!1,virtualTranslate:!0};C(e.params,t),C(e.originalParams,t)}},setTranslate:function(e){"cube"===e.params.effect&&e.cubeEffect.setTranslate()},setTransition:function(e,t){"cube"===e.params.effect&&e.cubeEffect.setTransition(t)}}},{name:"effect-flip",params:{flipEffect:{slideShadows:!0,limitRotation:!0}},create:function(){M(this,{flipEffect:t({},pe)})},on:{beforeInit:function(e){if("flip"===e.params.effect){e.classNames.push(e.params.containerModifierClass+"flip"),e.classNames.push(e.params.containerModifierClass+"3d");var t={slidesPerView:1,slidesPerColumn:1,slidesPerGroup:1,watchSlidesProgress:!0,spaceBetween:0,virtualTranslate:!0};C(e.params,t),C(e.originalParams,t)}},setTranslate:function(e){"flip"===e.params.effect&&e.flipEffect.setTranslate()},setTransition:function(e,t){"flip"===e.params.effect&&e.flipEffect.setTransition(t)}}},{name:"effect-coverflow",params:{coverflowEffect:{rotate:50,stretch:0,depth:100,scale:1,modifier:1,slideShadows:!0}},create:function(){M(this,{coverflowEffect:t({},ce)})},on:{beforeInit:function(e){"coverflow"===e.params.effect&&(e.classNames.push(e.params.containerModifierClass+"coverflow"),e.classNames.push(e.params.containerModifierClass+"3d"),e.params.watchSlidesProgress=!0,e.originalParams.watchSlidesProgress=!0)},setTranslate:function(e){"coverflow"===e.params.effect&&e.coverflowEffect.setTranslate()},setTransition:function(e,t){"coverflow"===e.params.effect&&e.coverflowEffect.setTransition(t)}}},{name:"thumbs",params:{thumbs:{swiper:null,multipleActiveThumbs:!0,autoScrollOffset:0,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-container-thumbs"}},create:function(){M(this,{thumbs:t({swiper:null,initialized:!1},ue)})},on:{beforeInit:function(e){var t=e.params.thumbs;t&&t.swiper&&(e.thumbs.init(),e.thumbs.update(!0))},slideChange:function(e){e.thumbs.swiper&&e.thumbs.update()},update:function(e){e.thumbs.swiper&&e.thumbs.update()},resize:function(e){e.thumbs.swiper&&e.thumbs.update()},observerUpdate:function(e){e.thumbs.swiper&&e.thumbs.update()},setTransition:function(e,t){var a=e.thumbs.swiper;a&&a.setTransition(t)},beforeDestroy:function(e){var t=e.thumbs.swiper;t&&e.thumbs.swiperCreated&&t&&t.destroy()}}}];return F.use(he),F})); +//# sourceMappingURL=swiper-bundle.min.js.map \ No newline at end of file diff --git a/plugins/genericobject/.github/workflows/release.yml b/plugins/genericobject/.github/workflows/release.yml new file mode 100644 index 00000000..a8f5e15a --- /dev/null +++ b/plugins/genericobject/.github/workflows/release.yml @@ -0,0 +1,40 @@ +name: "Plugin release" + +on: + push: + tags: + - '*' + +jobs: + create-release: + name: "Create release" + runs-on: "ubuntu-latest" + steps: + - name: "Extract tag name" + run: | + echo "tag_name=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + - name: "Checkout" + uses: "actions/checkout@v2" + - name: "Build package" + id: "build-package" + uses: "glpi-project/tools/github-actions/build-package@0.1.15" + with: + plugin-version: ${{ env.tag_name }} + - name: "Create release" + id: "create-release" + uses: "actions/create-release@v1" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.tag_name }} + release_name: ${{ env.tag_name }} + draft: true + - name: "Attach package to release" + uses: "actions/upload-release-asset@v1" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-release.outputs.upload_url }} + asset_path: ${{ steps.build-package.outputs.package-path }} + asset_name: ${{ steps.build-package.outputs.package-basename }} + asset_content_type: " application/x-bzip2" diff --git a/plugins/genericobject/.gitignore b/plugins/genericobject/.gitignore new file mode 100644 index 00000000..c5a6bb23 --- /dev/null +++ b/plugins/genericobject/.gitignore @@ -0,0 +1,6 @@ +log_filter.settings.php +dist/ +vendor/ +.gh_token +*.min.* + diff --git a/plugins/genericobject/.tx/config b/plugins/genericobject/.tx/config new file mode 100644 index 00000000..0778e99b --- /dev/null +++ b/plugins/genericobject/.tx/config @@ -0,0 +1,8 @@ +[main] +host = https://www.transifex.com + +[glpi-project-plugin-genericobject.genericobject-pot] +file_filter = locales/.po +source_file = locales/genericobject.pot +source_lang = en +type = PO diff --git a/plugins/genericobject/AUTHORS.txt b/plugins/genericobject/AUTHORS.txt new file mode 100644 index 00000000..5a062bc5 --- /dev/null +++ b/plugins/genericobject/AUTHORS.txt @@ -0,0 +1,9 @@ +Plugin Genericobject developers : + +Walid Nouh, Teclib' +Alexandre Delaunay, Teclib' + +Occasional contributors : +François Legastelois, Teclib' +Jean-Max Reymond, CSK Solutions +Xavier Caillaud, Infotel \ No newline at end of file diff --git a/plugins/genericobject/LICENSE b/plugins/genericobject/LICENSE new file mode 100644 index 00000000..10926e87 --- /dev/null +++ b/plugins/genericobject/LICENSE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + diff --git a/plugins/genericobject/README.md b/plugins/genericobject/README.md new file mode 100644 index 00000000..bcee1018 --- /dev/null +++ b/plugins/genericobject/README.md @@ -0,0 +1,43 @@ +# Genericobject GLPI plugin + +[![License](https://img.shields.io/github/license/pluginsGLPI/genericobject.svg?&label=License)](https://github.com/pluginsGLPI/genericobject/blob/develop/LICENSE) +[![Follow twitter](https://img.shields.io/twitter/follow/Teclib.svg?style=social&label=Twitter&style=flat-square)](https://twitter.com/teclib) +[![Telegram Group](https://img.shields.io/badge/Telegram-Group-blue.svg)](https://t.me/glpien) +[![Project Status: Active](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) +[![GitHub release](https://img.shields.io/github/release/pluginsGLPI/genericobject.svg)](https://github.com/pluginsGLPI/genericobject/releases) +[![GitHub build](https://travis-ci.org/pluginsGLPI/genericobject.svg?)](https://travis-ci.org/pluginsGLPI/genericobject/) + +![Screenshot](./genericobject.gif "genericobject") + + +The genericobject plugin allows to extends GLPi to manage new types of objects. + + +## Documentation + +We maintain a detailed documentation here -> [Documentation](http://glpi-plugins.readthedocs.io/en/latest/genericobject/index.html) + +## Contact + +For notices about major changes and general discussion of genericobject, subscribe to the [/r/glpi](https://www.reddit.com/r/glpi/) subreddit. +You can also chat with us via [@glpi on Telegram](https://t.me/glpien). + +## Professional Services + +![GLPI Network](./glpi_network.png "GLPI network") + +The GLPI Network services are available through our [Partner's Network](http://www.teclib-edition.com/en/partners/). We provide special training, bug fixes with editor subscription, contributions for new features, and more. + +Obtain a personalized service experience, associated with benefits and opportunities. + +## Contributing + +* Open a ticket for each bug/feature so it can be discussed +* Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/latest/plugins/index.html) +* Refer to [GitFlow](http://git-flow.readthedocs.io/) process for branching +* Work on a new branch on your own fork +* Open a PR that will be reviewed by a developer + +## Copying + +* **Code**: you can redistribute it and/or modify diff --git a/plugins/genericobject/ajax/remove.txt b/plugins/genericobject/ajax/remove.txt new file mode 100644 index 00000000..97732142 --- /dev/null +++ b/plugins/genericobject/ajax/remove.txt @@ -0,0 +1,3 @@ +Vous pouvez effacer ce fichier sans dommages. + +You can safely remove this file. diff --git a/plugins/genericobject/composer.json b/plugins/genericobject/composer.json new file mode 100644 index 00000000..3638ad64 --- /dev/null +++ b/plugins/genericobject/composer.json @@ -0,0 +1,15 @@ +{ + "require": { + "php": "^7.2" + }, + "require-dev": { + "glpi-project/tools": "^0.4" + }, + "config": { + "optimize-autoloader": true, + "platform": { + "php": "7.2.0" + }, + "sort-packages": true + } +} diff --git a/plugins/genericobject/composer.lock b/plugins/genericobject/composer.lock new file mode 100644 index 00000000..e7a6c4e1 --- /dev/null +++ b/plugins/genericobject/composer.lock @@ -0,0 +1,538 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "8354308e8805d3f53d35251aac6a4525", + "packages": [], + "packages-dev": [ + { + "name": "glpi-project/tools", + "version": "0.4.2", + "source": { + "type": "git", + "url": "https://github.com/glpi-project/tools.git", + "reference": "34369dd85cc99c18c3b8cf441bba11ec32173f2d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/glpi-project/tools/zipball/34369dd85cc99c18c3b8cf441bba11ec32173f2d", + "reference": "34369dd85cc99c18c3b8cf441bba11ec32173f2d", + "shasum": "" + }, + "require": { + "symfony/console": "^4.4 || ^5.0" + }, + "bin": [ + "bin/extract-locales", + "bin/licence-headers-check", + "tools/extract_template.sh", + "tools/plugin-release" + ], + "type": "library", + "autoload": { + "psr-4": { + "Glpi\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-3.0-or-later" + ], + "authors": [ + { + "name": "Teclib'", + "email": "glpi@teclib.com", + "homepage": "http://teclib-group.com" + } + ], + "description": "Various tools for GLPI and its plugins", + "keywords": [ + "glpi", + "plugins", + "tools" + ], + "support": { + "issues": "https://github.com/glpi-project/tools/issues", + "source": "https://github.com/glpi-project/tools" + }, + "time": "2022-01-28T13:44:12+00:00" + }, + { + "name": "psr/container", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", + "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.1" + }, + "time": "2021-03-05T17:36:06+00:00" + }, + { + "name": "symfony/console", + "version": "v4.4.37", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/0259f01dbf9d77badddbbf4c2abb681f24c9cac6", + "reference": "0259f01dbf9d77badddbbf4c2abb681f24c9cac6", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php73": "^1.8", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2" + }, + "conflict": { + "psr/log": ">=3", + "symfony/dependency-injection": "<3.4", + "symfony/event-dispatcher": "<4.3|>=5", + "symfony/lock": "<4.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0|2.0" + }, + "require-dev": { + "psr/log": "^1|^2", + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/event-dispatcher": "^4.3", + "symfony/lock": "^4.4|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/var-dumper": "^4.3|^5.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/console/tree/v4.4.37" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-26T16:15:26+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", + "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-30T18:21:41+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/cc5db0e22b3cb4111010e48785a97f670b350ca5", + "reference": "cc5db0e22b3cb4111010e48785a97f670b350ca5", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-06-05T21:20:04+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.24.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", + "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-09-13T13:58:33+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v1.1.11", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/633df678bec3452e04a7b0337c9bcfe7354124b3", + "reference": "633df678bec3452e04a7b0337c9bcfe7354124b3", + "shasum": "" + }, + "require": { + "php": ">=7.1.3", + "psr/container": "^1.0" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.1-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v1.1.11" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-11-04T13:32:43+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.2" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.2.0" + }, + "plugin-api-version": "2.1.0" +} diff --git a/plugins/genericobject/css/styles.css b/plugins/genericobject/css/styles.css new file mode 100644 index 00000000..cd6b1efc --- /dev/null +++ b/plugins/genericobject/css/styles.css @@ -0,0 +1,91 @@ +/*! + * ------------------------------------------------------------------------- + * GenericObject plugin for GLPI + * ------------------------------------------------------------------------- + * + * LICENSE + * + * This file is part of GenericObject. + * + * GenericObject is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GenericObject is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GenericObject. If not, see . + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +/* + * Menu entry wrapper + */ +.genericobject_menu_wrapper { + display: block; + position: relative; + margin: 0; + padding: 0; +} + +/* + * Icon positionning + */ +.genericobject_menu_icon { + height: 16px; + width: 16px; + vertical-align: middle; + display: inline-block; +} +.icon_preview { + height: 32px; + width: 32px; +} + +.icon_preview > .genericobject_menu_icon { + display: block; + margin: 0 auto; + height: initial; + width: initial; + max-height: 32px; + max-width: 32px; +} + +.genericobject_menu_text { + padding-left: 5px; + margin: 0; + display: inline-block; +} + + +/* + * Fields Form + */ + +.genericobject_fields.add_new { + width: 80%; +} + +.genericobject_fields.add_new td.label { + width: 20%; +} + +.genericobject_fields.add_new td.dropdown { + width: 100%; +} + +/* + * Type's Profile tab : specific alignment + */ + +.genericobject_type_profiles tr > td { + width : 10%; +} diff --git a/plugins/genericobject/docs/CHANGELOG.txt b/plugins/genericobject/docs/CHANGELOG.txt new file mode 100644 index 00000000..a948c654 --- /dev/null +++ b/plugins/genericobject/docs/CHANGELOG.txt @@ -0,0 +1,103 @@ +/* + * @version $Id: setup.php,v 1.2 2006/04/02 14:45:27 moyo Exp $ + ---------------------------------------------------------------------- + GLPI - Gestionnaire Libre de Parc Informatique + Copyright (C) 2003-2008 by the INDEPNET Development Team. + + http://indepnet.net/ http://glpi-project.org/ + ---------------------------------------------------------------------- + + LICENSE + + This file is part of GLPI. + + GLPI is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GLPI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GLPI; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ------------------------------------------------------------------------ +*/ + +// ---------------------------------------------------------------------- +// Original Author of file: Walid NOUH +// Purpose of file: +// ---------------------------------------------------------------------- +Version 2.1.4 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=41 + +Version 2.1.3 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=42 + +Version 2.1.2 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=33 + +Version 2.1.1 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=26 + +Version 2.1.0 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=23 + +Version 2.0.3 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=34 + +Version 2.0.2 + see https://forge.indepnet.net/projects/genericobject/issues?query_id=20 + +Version 2.0.1 + #3215 Cannot activate other plugins integration + #3216 Add LICENSE file and change file headers + #3217 field, object and type must not be reserved + #3218 Wrong "contact" field definition + #3219 Display weblinks + +Version 2.0 RC2 + #3153 Missing file in the RC1 tarball + +Version 2.0 RC1 + #3118 (Bug) Respect search options indexes + +Version 2.0 Beta 2 + #2766 (Bug) Object without name + #2765 (Bug) Object which have the same name that an other object already created + #2764 (Bug) Object which begins by a number or a special type + #1976 (Bug) Dropdown import issue + #1729 (Feature) Manage transferts + +Version 2.0 Beta 1 + #3114 (Feature) Rewrite the whole plugin to work with GLPI 0.80 + #2119 (Bug) Table created without uft8 support + #2767 (Bug) Possibility to use the gabarits/templates + #2769 (Feature) Possibility to associate a contract with an object created with Generic Object + #1977 (Bug) Post-only to declare ticket for an object + #1757 (Bug) Impossible to acces model dropdown form + +Version 1.1.3 + #1762 SQL error with tplname field + +Version 1.1.2 + #1659 Integration with geniventorynumber plugin + #1734 Error with reservations + #1728 Global/unique management + +Version 1.1.1 + #1717 Cannot install plugin correctly + #1718 Check mappings + +Version 1.1.0 + #1690 Enable direct connexions & network ports + #1707 Purge not working + #1709 Delete infocom, contracts & reservations when an objet is deleted + #1712 Error when datainjection is not available + #1713 Remove spaces in object types + +Version 1.0 + * Initial version diff --git a/plugins/genericobject/docs/LISEZMOI.TXT b/plugins/genericobject/docs/LISEZMOI.TXT new file mode 100644 index 00000000..c3d88e51 --- /dev/null +++ b/plugins/genericobject/docs/LISEZMOI.TXT @@ -0,0 +1,40 @@ +/* + * @version $Id: setup.php,v 1.2 2006/04/02 14:45:27 moyo Exp $ + ---------------------------------------------------------------------- + GLPI - Gestionnaire Libre de Parc Informatique + Copyright (C) 2003-2008 by the INDEPNET Development Team. + + http://indepnet.net/ http://glpi-project.org/ + ---------------------------------------------------------------------- + + LICENSE + + This file is part of GLPI. + + GLPI is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GLPI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GLPI; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ------------------------------------------------------------------------ +*/ + +// ---------------------------------------------------------------------- +// Original Author of file: Walid NOUH +// Purpose of file: +// ---------------------------------------------------------------------- + +Author : Walid NOUH +Ce plugin vous permet d'ajouter de nouveaux types d'objets d'inventaire sans avoir à programmer.Il gère : +- La création du type +- Les champs disponibles +- L'intégration dans GLPI (Helpdesk, réservation, gabarits, etc.) +- L'intégration avec le plugin d'injection des données \ No newline at end of file diff --git a/plugins/genericobject/docs/README.txt b/plugins/genericobject/docs/README.txt new file mode 100644 index 00000000..1153744f --- /dev/null +++ b/plugins/genericobject/docs/README.txt @@ -0,0 +1,41 @@ +/* + * @version $Id: setup.php,v 1.2 2006/04/02 14:45:27 moyo Exp $ + ---------------------------------------------------------------------- + GLPI - Gestionnaire Libre de Parc Informatique + Copyright (C) 2003-2008 by the INDEPNET Development Team. + + http://indepnet.net/ http://glpi-project.org/ + ---------------------------------------------------------------------- + + LICENSE + + This file is part of GLPI. + + GLPI is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + GLPI is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GLPI; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + ------------------------------------------------------------------------ +*/ + +// ---------------------------------------------------------------------- +// Original Author of file: Walid NOUH +// Purpose of file: +// ---------------------------------------------------------------------- + +Author : Walid NOUH +This plugin allows you to add new inventory types without programmation. It manages : +- Type creation +- Available fields +- Framework integration (Helpdesk, loans, templates, etc.) +- Integration with the file injection plugin + diff --git a/plugins/genericobject/docs/examples/car.csv b/plugins/genericobject/docs/examples/car.csv new file mode 100644 index 00000000..2ddc0bcc --- /dev/null +++ b/plugins/genericobject/docs/examples/car.csv @@ -0,0 +1,4 @@ +"name"; "manufacturer"; "model"; "color"; "license plate" +"Renault Scénic - 1234"; "Renault"; "Scénic"; "bleu"; "1234" +"Peugeot 308 - 2345"; "Peugeot"; "308"; "bleu"; "2345" +"Ferrari 458 Italia - 45677"; "Ferrari"; "458 Italia"; "rouge"; "45677" diff --git a/plugins/genericobject/fields/field.constant.php b/plugins/genericobject/fields/field.constant.php new file mode 100644 index 00000000..a4e6f724 --- /dev/null +++ b/plugins/genericobject/fields/field.constant.php @@ -0,0 +1,206 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +global $GO_FIELDS; + +$GO_FIELDS['id']['name'] = __("ID"); +$GO_FIELDS['id']['input_type'] = 'text'; +$GO_FIELDS['id']['massiveaction'] = false; + +$GO_FIELDS['name']['name'] = __("Name"); +$GO_FIELDS['name']['field'] = 'name'; +$GO_FIELDS['name']['input_type'] = 'text'; +$GO_FIELDS['name']['autoname'] = true; + +$GO_FIELDS['serial']['name'] = __("Serial number"); +$GO_FIELDS['serial']['field'] = 'serial'; +$GO_FIELDS['serial']['input_type'] = 'text'; + +$GO_FIELDS['otherserial']['name'] = __("Licence SN"); +$GO_FIELDS['otherserial']['field'] = 'otherserial'; +$GO_FIELDS['otherserial']['input_type'] = 'text'; +$GO_FIELDS['otherserial']['autoname'] = true; + +$GO_FIELDS['comment']['name'] = __("Cause"); +$GO_FIELDS['comment']['field'] = 'comment'; +$GO_FIELDS['comment']['input_type'] = 'multitext'; + +$GO_FIELDS['other']['name'] = __("Others"); +$GO_FIELDS['other']['input_type'] = 'text'; + +$GO_FIELDS['creationdate']['name'] = __("Creation date"); +$GO_FIELDS['creationdate']['input_type'] = 'date'; + +$GO_FIELDS['expirationdate']['name'] = __("Expiration date"); +$GO_FIELDS['expirationdate']['input_type'] = 'date'; + +$GO_FIELDS['date_mod']['name'] = __("Last update"); +$GO_FIELDS['date_mod']['input_type'] = 'datetime'; + +$GO_FIELDS['date_creation']['name'] = __('Creation date'); +$GO_FIELDS['date_creation']['input_type'] = 'datetime'; + +$GO_FIELDS['url']['name'] = __("URL"); +$GO_FIELDS['url']['field'] = 'url'; +$GO_FIELDS['url']['input_type'] = 'text'; +$GO_FIELDS['url']['datatype'] = 'weblink'; + +$GO_FIELDS['types_id']['name'] = __("Type"); +$GO_FIELDS['types_id']['linkfield'] = 'type'; +$GO_FIELDS['types_id']['input_type'] = 'dropdown'; +// The 'isolated' dropdown type will create a isolated table for each type that will be assigned +// with this field. +$GO_FIELDS['types_id']['dropdown_type'] = 'isolated'; + +$GO_FIELDS['models_id']['name'] = __("Model"); +$GO_FIELDS['models_id']['input_type'] = 'dropdown'; +$GO_FIELDS['models_id']['dropdown_type'] = 'isolated'; + +$GO_FIELDS['categories_id']['name'] = __("Category"); +$GO_FIELDS['categories_id']['input_type'] = 'dropdown'; +$GO_FIELDS['categories_id']['dropdown_type'] = 'isolated'; + +$GO_FIELDS['entities_id']['name'] = __("Entity"); +$GO_FIELDS['entities_id']['input_type'] = 'dropdown'; +$GO_FIELDS['entities_id']['massiveaction'] = false; + +$GO_FIELDS['template_name']['name'] = __("Template name"); +$GO_FIELDS['template_name']['input_type'] = 'text'; +$GO_FIELDS['template_name']['massiveaction'] = false; + +$GO_FIELDS['notepad']['name'] = _n('Note', 'Notes', 2); +$GO_FIELDS['notepad']['input_type'] = 'multitext'; + +$GO_FIELDS['is_recursive']['name'] = __("Child entities"); +$GO_FIELDS['is_recursive']['input_type'] = 'bool'; + +$GO_FIELDS['is_deleted']['name'] = __("Item in the dustbin"); +$GO_FIELDS['is_deleted']['input_type'] = 'bool'; +$GO_FIELDS['is_deleted']['massiveaction'] = false; + +$GO_FIELDS['is_template']['name'] = __("Templates"); +$GO_FIELDS['is_template']['input_type'] = 'bool'; +$GO_FIELDS['is_template']['massiveaction'] = false; + +$GO_FIELDS['is_global']['name'] = __("Management type"); +$GO_FIELDS['is_global']['input_type'] = 'bool'; +$GO_FIELDS['is_global']['massiveaction'] = false; + +$GO_FIELDS['is_helpdesk_visible']['name'] = __("Associable to a ticket"); +$GO_FIELDS['is_helpdesk_visible']['input_type'] = 'bool'; + +$GO_FIELDS['locations_id']['name'] = __("Item location"); +$GO_FIELDS['locations_id']['input_type'] = 'dropdown'; + +$GO_FIELDS['machine_room']['name'] = __("Machine Room"); +$GO_FIELDS['machine_room']['input_type'] = 'text'; + +$GO_FIELDS['states_id']['name'] = __("Status"); +$GO_FIELDS['states_id']['input_type'] = 'dropdown'; + +$GO_FIELDS['back_up']['name'] = __("Backup"); +$GO_FIELDS['back_up']['input_type'] = 'text'; + +$GO_FIELDS['connect']['name'] = __("Connect"); +$GO_FIELDS['connect']['input_type'] = 'text'; + +$GO_FIELDS['users_id']['name'] = __("User"); +$GO_FIELDS['users_id']['input_type'] = 'dropdown'; + +$GO_FIELDS['groups_id']['name'] = __("Group"); +$GO_FIELDS['groups_id']['input_type'] = 'dropdown'; +$GO_FIELDS['groups_id']['condition'] = ['is_itemgroup' => 1]; + +$GO_FIELDS['manufacturers_id']['name'] = __("Fournisseur"); +$GO_FIELDS['manufacturers_id']['input_type'] = 'dropdown'; + +$GO_FIELDS['manufacturers_contact']['name'] = __("Fournisseur Contact"); +$GO_FIELDS['manufacturers_contact']['input_type'] = 'text'; + +$GO_FIELDS['cond_ification']['name'] = __("Codification"); +$GO_FIELDS['cond_ification']['input_type'] = 'text'; + +$GO_FIELDS['plc']['name'] = __("PLC"); +$GO_FIELDS['plc']['input_type'] = 'text'; + +$GO_FIELDS['plc_software']['name'] = __("PLC Software"); +$GO_FIELDS['plc_software']['input_type'] = 'text'; + +$GO_FIELDS['plc_ip_adr']['name'] = __("PLC IP Address"); +$GO_FIELDS['plc_ip_adr']['input_type'] = 'text'; + +$GO_FIELDS['hmi']['name'] = __("HMI"); +$GO_FIELDS['hmi']['input_type'] = 'text'; + +$GO_FIELDS['pc']['name'] = __("PC"); +$GO_FIELDS['pc']['input_type'] = 'text'; + +$GO_FIELDS['pc/hmi']['name'] = __("HMI/PC Software"); +$GO_FIELDS['pc/hmi']['input_type'] = 'text'; + +$GO_FIELDS['pc/hmi_software']['name'] = __("HMI Software"); +$GO_FIELDS['pc/hmi_software']['input_type'] = 'text'; + +$GO_FIELDS['pc/hmi_ip']['name'] = __("HMI IP Address"); +$GO_FIELDS['pc/hmi_ip']['input_type'] = 'text'; + +$GO_FIELDS['pc/hmi_ip_adr']['name'] = __("HMI/PC IP Address"); +$GO_FIELDS['pc/hmi_ip_adr']['input_type'] = 'text'; + +$GO_FIELDS['pc/reseau']['name'] = __("Réseau"); +$GO_FIELDS['pc/reseau']['input_type'] = 'text'; + +$GO_FIELDS['pc/machine']['name'] = __("Machine"); +$GO_FIELDS['pc/machine']['input_type'] = 'text'; + +$GO_FIELDS['control_system']['name'] = __("Control System"); +$GO_FIELDS['control_system']['input_type'] = 'text'; + +$GO_FIELDS['admin_session']['name'] = __("Admin Session"); +$GO_FIELDS['admin_session']['input_type'] = 'text'; + +$GO_FIELDS['password']['name'] = __("Password"); +$GO_FIELDS['password']['input_type'] = 'text'; + +$GO_FIELDS['users_id_tech']['name'] = __("Technician in charge of the hardware"); +$GO_FIELDS['users_id_tech']['input_type'] = 'dropdown'; + +$GO_FIELDS['domains_id']['name'] = __("Domain"); +$GO_FIELDS['domains_id']['input_type'] = 'dropdown'; + +$GO_FIELDS['contact']['name'] = __("Alternate username"); +$GO_FIELDS['contact']['input_type'] = 'text'; + +$GO_FIELDS['contact_num']['name'] = __("Alternate username number"); +$GO_FIELDS['contact_num']['input_type'] = 'text'; + +$GO_FIELDS['groups_id_tech']['name'] = __("Group in charge of the hardware"); +$GO_FIELDS['groups_id_tech']['input_type'] = 'dropdown'; +$GO_FIELDS['groups_id_tech']['condition'] = ['is_assign' => 1]; diff --git a/plugins/genericobject/front/commondropdown.form.php b/plugins/genericobject/front/commondropdown.form.php new file mode 100644 index 00000000..5dcf0375 --- /dev/null +++ b/plugins/genericobject/front/commondropdown.form.php @@ -0,0 +1,44 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (isset($_REQUEST['itemtype'])) { + $itemtype = $_REQUEST['itemtype']; + if (class_exists($itemtype)) { + $dropdown = new $itemtype(); + include (GLPI_ROOT . "/front/dropdown.common.form.php"); + } else { + Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject')); + } +} else { + + Html::displayErrorAndDie(__('Not Found!')); +} diff --git a/plugins/genericobject/front/commondropdown.php b/plugins/genericobject/front/commondropdown.php new file mode 100644 index 00000000..8bc1c6d7 --- /dev/null +++ b/plugins/genericobject/front/commondropdown.php @@ -0,0 +1,46 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (isset($_REQUEST['itemtype'])) { + $itemtype = $_REQUEST['itemtype']; + if (class_exists($itemtype)) { + $dropdown = new $itemtype(); + include (GLPI_ROOT . "/front/dropdown.common.php"); + } else { + Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject')); + } +} else { + + Html::displayErrorAndDie(__('Not Found!')); +} + + diff --git a/plugins/genericobject/front/commontreedropdown.form.php b/plugins/genericobject/front/commontreedropdown.form.php new file mode 100644 index 00000000..5dcf0375 --- /dev/null +++ b/plugins/genericobject/front/commontreedropdown.form.php @@ -0,0 +1,44 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (isset($_REQUEST['itemtype'])) { + $itemtype = $_REQUEST['itemtype']; + if (class_exists($itemtype)) { + $dropdown = new $itemtype(); + include (GLPI_ROOT . "/front/dropdown.common.form.php"); + } else { + Html::displayErrorAndDie(__('The requested dropdown does not exists', 'genericobject')); + } +} else { + + Html::displayErrorAndDie(__('Not Found!')); +} diff --git a/plugins/genericobject/front/commontreedropdown.php b/plugins/genericobject/front/commontreedropdown.php new file mode 100644 index 00000000..e7cea67f --- /dev/null +++ b/plugins/genericobject/front/commontreedropdown.php @@ -0,0 +1,32 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); +include ("./commondropdown.php"); diff --git a/plugins/genericobject/front/familylist.php b/plugins/genericobject/front/familylist.php new file mode 100644 index 00000000..495b12eb --- /dev/null +++ b/plugins/genericobject/front/familylist.php @@ -0,0 +1,60 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ('../../../inc/includes.php'); + +$family = new PluginGenericobjectTypeFamily(); + +if (!isset($_GET['id']) || !$family->getFromDB($_GET['id'])) { + Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "assets", + "genericobject"); + + echo ""; + echo ""; + echo "
      ".__("Empty family", "genericobject")."
      "; +} else { + $family->getFromDB($_GET['id']); + Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "assets", + $family->getName()); + + echo ""; + $types = PluginGenericobjectTypeFamily::getItemtypesByFamily($_GET['id']); + echo ""; + foreach ($types as $type) { + $itemtype = $type['itemtype']; + echo ""; + } + echo "
      ".Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $_GET['id'])."
      "; + echo ""; + echo $itemtype::getTypeName(); + echo "
      "; +} + +Html::footer(); diff --git a/plugins/genericobject/front/field.form.php b/plugins/genericobject/front/field.form.php new file mode 100644 index 00000000..6ecc6c76 --- /dev/null +++ b/plugins/genericobject/front/field.form.php @@ -0,0 +1,62 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); +if (isset ($_POST["delete"])) { + if (isset($_POST["fields"]) && count($_POST["fields"] > 0 )) { + $type = new PluginGenericobjectType(); + $type->getFromDB($_POST["id"]); + $itemtype = $type->fields['itemtype']; + PluginGenericobjectType::registerOneType($itemtype); + + foreach ($_POST["fields"] as $field => $value) { + if ($type->can($_POST["id"], PURGE) + && $value == 1 + && PluginGenericobjectField::checkNecessaryFieldsDelete($itemtype, $field)) { + PluginGenericobjectField::deleteField(getTableForItemType($itemtype), $field); + Session::addMessageAfterRedirect(__("Field(s) deleted successfully", "genericobject"), true, INFO); + } + } + } +} else if (isset ($_POST["add_field"])) { + $type = new PluginGenericobjectType(); + if ($_POST["new_field"] && $type->can($_POST["id"], UPDATE)) { + $itemtype = $type->fields['itemtype']; + PluginGenericobjectType::registerOneType($itemtype); + PluginGenericobjectField::addNewField(getTableForItemType($itemtype), $_POST["new_field"]); + Session::addMessageAfterRedirect(__("Field added successfully", "genericobject")); + } +} else if (isset($_POST['action'])) { + //Move field + PluginGenericobjectField::changeFieldOrder($_POST); +} + +Html::back(); + diff --git a/plugins/genericobject/front/object.form.php b/plugins/genericobject/front/object.form.php new file mode 100644 index 00000000..7462ed32 --- /dev/null +++ b/plugins/genericobject/front/object.form.php @@ -0,0 +1,112 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +$itemtype = null; + +if (isset($_REQUEST['itemtype'])) { + + $types = array_keys(PluginGenericobjectType::getTypes()); + + $requested_type = $_REQUEST['itemtype']; + $error = []; + + if (!in_array($requested_type, $types)) { + $error[] = __('The requested type has not been defined yet!'); + if (!PluginGenericobjectType::canCreate()) { + $error[] = __('Please ask your administrator to create this type of object'); + }; + } else if (!class_exists($requested_type)) { + $error[]= __('The generated files for the requested type of object are missing!'); + $error[]= __('You might need to regenerate the files under '.GENERICOBJECT_DOC_DIR.'.'); + } + + if (count($error) > 0) { + Html::header(__('Type not found!')); + Html::displayErrorAndDie(implode('
      ', $error)); + + } else { + $itemtype = $requested_type; + } +} + +if (!is_null($itemtype)) { + + if (!isset($_REQUEST['id'])) { + $id = -1; + } else { + $id = $_REQUEST['id']; + } + + if (!isset($_GET["withtemplate"])) { + $_GET["withtemplate"] = ""; + } + + $item = new $itemtype(); + + if (isset ($_POST["add"])) { + $item->check($id, CREATE); + $newID = $item->add($_POST); + + if ($_SESSION['glpibackcreated']) { + Html::redirect($itemtype::getFormURL()."&id=".$newID); + } else { + Html::back(); + } + } else if (isset ($_POST["update"])) { + $item->check($id, UPDATE); + $item->update($_POST); + Html::back(); + } else if (isset ($_POST["restore"])) { + $item->check($id, DELETE); + $item->restore($_POST); + Html::back(); + } else if (isset($_POST["purge"])) { + $item->check($id, PURGE); + $item->delete($_POST, 1); + $item->redirectToList(); + } else if (isset($_POST["delete"])) { + $item->check($id, DELETE); + $item->delete($_POST); + $item->redirectToList(); + } + $menu = PluginGenericobjectType::getFamilyNameByItemtype($_GET['itemtype']); + Html::header($itemtype::getTypeName(), $_SERVER['PHP_SELF'], + "assets", ($menu!==false?$menu:$itemtype), strtolower($itemtype)); + + $item->display($_GET, ['withtemplate' => $_GET["withtemplate"]]); + + Html::footer(); +} else { + Html::header(__('Access Denied!')); + Html::DisplayErrorAndDie(__("You can't access to this page directly!")); +} + diff --git a/plugins/genericobject/front/object.php b/plugins/genericobject/front/object.php new file mode 100644 index 00000000..926df5e0 --- /dev/null +++ b/plugins/genericobject/front/object.php @@ -0,0 +1,42 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (isset($_GET['itemtype'])) { + Session::checkRight(PluginGenericobjectProfile::getProfileNameForItemtype($_GET['itemtype']), READ); + $menu = PluginGenericobjectType::getFamilyNameByItemtype($_GET['itemtype']); + Html::header(__("Type of objects", "genericobject"), + $_SERVER['PHP_SELF'], "assets", ($menu!==false?$menu:strtolower($_GET['itemtype'])), strtolower($_GET['itemtype'])); + Search::Show($_GET['itemtype']); + +} + +Html::footer(); diff --git a/plugins/genericobject/front/profile.form.php b/plugins/genericobject/front/profile.form.php new file mode 100644 index 00000000..f4f44b54 --- /dev/null +++ b/plugins/genericobject/front/profile.form.php @@ -0,0 +1,54 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); +Session::checkRight("profile", UPDATE); + +_log($_POST); +$prof = new Profile(); + +/* save profile */ +if (isset($_POST['update_all_rights']) && isset($_POST['itemtype'])) { + $profiles = []; + foreach ($_POST as $key => $val) { + if (preg_match("/^profile_/", $key)) { + $id = preg_replace("/^profile_/", "", $key); + $profiles[$id] = [ + "id" => $id, + "_".PluginGenericobjectProfile::getProfileNameForItemtype($_POST['itemtype']) => $val + ]; + } + } + _log($profiles); + foreach ($profiles as $profile_id => $input) { + $prof->update($input); + } +} +Html::redirect($_SERVER['HTTP_REFERER']); diff --git a/plugins/genericobject/front/type.form.php b/plugins/genericobject/front/type.form.php new file mode 100644 index 00000000..7960eb21 --- /dev/null +++ b/plugins/genericobject/front/type.form.php @@ -0,0 +1,80 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (!isset ($_GET["id"])) { + $_GET["id"] = ''; +} +$type = new PluginGenericobjectType(); +$extraparams = []; +if (isset ($_POST["select"]) && $_POST["select"] == "all") { + $extraparams["selected"] = "checked"; +} + +//Change fields order +if (isset ($_GET["action"])) { + $type->getFromDB($_REQUEST["id"]); + PluginGenericobjectType::registerOneType($type); + PluginGenericobjectObject::changeFieldOrder($_GET["field"], $type->fields["itemtype"], + $_GET["action"]); + Html::back(); + +} else if (isset ($_POST["add"])) { + //Add a new itemtype + $new_id = $type->add($_POST); + Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType')."?id=$new_id"); + +} else if (isset ($_POST["update"])) { + //Update an existing itemtype + if (isset($_POST['itemtypes']) && is_array($_POST['itemtypes'])) { + $_POST['linked_itemtypes'] = json_encode($_POST['itemtypes']); + } + $type->update($_POST); + Html::back(); + +} else if (isset ($_POST["purge"])) { + //Delete an itemtype + $type->delete($_POST); + $type->redirectToList(); + +} else if (isset($_POST['regenerate'])) { + //Regenerate files for an itemtype + $type->getFromDB($_POST["id"]); + PluginGenericobjectType::checkClassAndFilesForOneItemType($type->fields['itemtype'], + $type->fields['name'], true); + Html::back(); +} + +Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "config", + "PluginGenericobjectType"); +$type->display($_GET); + +Html::footer(); diff --git a/plugins/genericobject/front/type.php b/plugins/genericobject/front/type.php new file mode 100644 index 00000000..4aa33354 --- /dev/null +++ b/plugins/genericobject/front/type.php @@ -0,0 +1,48 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +if (isset($_GET['itemtype']) + && !isset($_GET['search']) + && !isset($_GET['sort'])) { + $type = new PluginGenericobjectType(); + $type->getFromDBByType($_GET['itemtype']); + Html::redirect(Toolbox::getItemTypeFormURL('PluginGenericobjectType').'?id='.$type->getID()); + +} else if (Session::haveRightsOr('plugin_genericobject_types', [READ, CREATE, UPDATE, PURGE])) { + Html::header(__("Type of objects", "genericobject"), $_SERVER['PHP_SELF'], "config", + "PluginGenericobjectType"); + Search::Show('PluginGenericobjectType'); + Html::footer(); + +} else { + Html::redirect($CFG_GLPI['root_doc']."/front/central.php"); +} diff --git a/plugins/genericobject/front/typefamily.form.php b/plugins/genericobject/front/typefamily.form.php new file mode 100644 index 00000000..36c9a569 --- /dev/null +++ b/plugins/genericobject/front/typefamily.form.php @@ -0,0 +1,35 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +$dropdown = new PluginGenericobjectTypeFamily(); +include (GLPI_ROOT . "/front/dropdown.common.form.php"); + diff --git a/plugins/genericobject/front/typefamily.php b/plugins/genericobject/front/typefamily.php new file mode 100644 index 00000000..06fcd86d --- /dev/null +++ b/plugins/genericobject/front/typefamily.php @@ -0,0 +1,35 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +include ("../../../inc/includes.php"); + +$dropdown = new PluginGenericobjectTypeFamily(); +include (GLPI_ROOT . "/front/dropdown.common.php"); + diff --git a/plugins/genericobject/genericobject.gif b/plugins/genericobject/genericobject.gif new file mode 100644 index 00000000..bbd4ca15 Binary files /dev/null and b/plugins/genericobject/genericobject.gif differ diff --git a/plugins/genericobject/genericobject.png b/plugins/genericobject/genericobject.png new file mode 100644 index 00000000..eebdafae Binary files /dev/null and b/plugins/genericobject/genericobject.png differ diff --git a/plugins/genericobject/genericobject.xml b/plugins/genericobject/genericobject.xml new file mode 100644 index 00000000..f1d8070b --- /dev/null +++ b/plugins/genericobject/genericobject.xml @@ -0,0 +1,215 @@ + + + Generic Objects Management + genericobject + stable + https://raw.githubusercontent.com/pluginsGLPI/genericobject/master/genericobject.png + + + + + + + + + + + + + https://github.com/pluginsGLPI/genericobject + https://github.com/pluginsGLPI/genericobject/releases + https://github.com/pluginsGLPI/genericobject/issues + https://glpi-plugins.readthedocs.io/en/latest/genericobject/index.html + + Walid Nouh + + + + 2.12.0-rc3 + ~10.0.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.12.0-rc3/glpi-genericobject-2.12.0-rc3.tar.bz2 + + + 2.12.0-rc2 + ~10.0.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.12.0-rc2/glpi-genericobject-2.12.0-rc2.tar.bz2 + + + 2.12.0-rc1 + ~10.0.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.12.0-rc1/glpi-genericobject-2.12.0-rc1.tar.bz2 + + + 2.11.1 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.11.1/glpi-genericobject-2.11.1.tar.bz2 + + + 2.11.0 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.11.0/glpi-genericobject-2.11.0.tar.bz2 + + + 2.10.1 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.10.1/glpi-genericobject-2.10.1.tar.bz2 + + + 2.10.0 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.10.0/glpi-genericobject-2.10.0.tar.bz2 + + + 2.9.2 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.9.2/glpi-genericobject-2.9.2.tar.bz2 + + + 2.9.1 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.9.1/glpi-genericobject-2.9.1.tar.bz2 + + + 2.9.0 + ~9.5.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.9.0/glpi-genericobject-2.9.0.tar.bz2 + + + 2.8.0 + ~9.4.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.8.0/glpi-genericobject-2.8.0.tar.bz2 + + + 2.7.0 + ~9.4.0 + https://github.com/pluginsGLPI/genericobject/releases/download/2.7.0/glpi-genericobject-2.7.0.tar.bz2 + + + 2.6.2 + 9.3 + + + 2.6.1 + 9.3 + + + 2.6.0 + 9.3 + + + 2.5.2 + 9.2 + + + 2.5.1 + 9.2 + + + 2.5.0 + 9.2 + + + 2.4.0 + 0.85 + 0.90 + 9.1 + + + 0.85-1.1 + 0.85 + 0.90 + 9.1 + + + 0.85-1.0 + 0.85 + 0.90 + + + 2.3.2 + 0.84 + + + 2.3.1 + 0.84 + + + 2.3.0 + 0.84 + + + 2.1.3 + 0.83 + + + 2.1.2 + 0.83 + + + 2.1.1 + 0.83 + + + 2.1.0 + 0.83 + + + 2.0.2 + 0.80 + + + 2.0.1 + 0.80 + + + 2.0.0 + 0.80 + + + 1.1.2 + 0.72 + + + 1.1.1 + 0.72 + + + 1.0.0 + 0.72 + + + + cs_CZ + fr_FR + en_GB + es_AR + + + + + inventaire + objets + générique + helpdesk + réservations + + + inventory + objects + generic + helpdesk + loans + + + inventář + objekty + obecné + službapodpory + zápůjčky + + + + https://raw.githubusercontent.com/pluginsGLPI/genericobject/master/genericobject.gif + + GPL v2+ + diff --git a/plugins/genericobject/glpi_network.png b/plugins/genericobject/glpi_network.png new file mode 100644 index 00000000..ced8621e Binary files /dev/null and b/plugins/genericobject/glpi_network.png differ diff --git a/plugins/genericobject/hook.php b/plugins/genericobject/hook.php new file mode 100644 index 00000000..14f8870f --- /dev/null +++ b/plugins/genericobject/hook.php @@ -0,0 +1,215 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +function plugin_genericobject_AssignToTicket($types) { + foreach (PluginGenericobjectType::getTypes() as $tmp => $value) { + $itemtype = $value['itemtype']; + if ($value['use_tickets']) { + if (class_exists($itemtype)) { + $types[$itemtype] = $itemtype::getTypeName(); + } else { + $types[$itemtype] = $itemtype; + } + } + } + return $types; +} + +// Define Dropdown tables to be manage in GLPI : +function plugin_genericobject_getDropdown() { + + $dropdowns = ['PluginGenericobjectTypeFamily' => PluginGenericobjectTypeFamily::getTypeName(2)]; + + $plugin = new Plugin(); + if ($plugin->isActivated("genericobject")) { + foreach (PluginGenericobjectType::getTypes() as $type) { + //_log($idx, var_export($type, true)); + $itemtype = $type['itemtype']; + PluginGenericobjectType::registerOneType($itemtype); + foreach (PluginGenericobjectType::getDropdownForItemtype($itemtype) as $table) { + $dropdown_itemtype = getItemTypeForTable($table); + if (class_exists( $dropdown_itemtype)) { + $dropdowns[$dropdown_itemtype] = $dropdown_itemtype::getTypeName(); + } + } + } + } + return $dropdowns; +} + +// Define dropdown relations +function plugin_genericobject_getDatabaseRelations() { + $dropdowns = []; + + //TODO : purt here relations + /* + $plugin = new Plugin(); + if ($plugin->isActivated("genericobject")) { + foreach(getAllDatasFromTable(getTableForItemType('PluginGenericobjectType'), + "`is_active`='1'") as $itemtype) { + foreach(PluginGenericobjectType::getDropdownForItemtype($itemtype) as $table) { + $dropdowns[$table][] = [] + } + } + } + */ + return $dropdowns; +} + +function plugin_uninstall_addUninstallTypes($uninstal_types = []) { + foreach (PluginGenericobjectType::getTypes() as $tmp => $type) { + if ($type["use_plugin_uninstall"]) { + $uninstal_types[] = $type["itemtype"]; + } + } + return $uninstal_types; +} + +//----------------------- INSTALL / UNINSTALL FUNCTION -------------------------------// + +/** + * Plugin install process + * + * @return boolean + */ +function plugin_genericobject_install() { + global $DB; + + include_once(GENERICOBJECT_DIR."/inc/object.class.php"); + include_once(GENERICOBJECT_DIR."/inc/type.class.php"); + + $migration = new Migration(PLUGIN_GENERICOBJECT_VERSION); + + foreach ([ + 'PluginGenericobjectField', + 'PluginGenericobjectCommonDropdown', + 'PluginGenericobjectCommonTreeDropdown', + 'PluginGenericobjectProfile', + 'PluginGenericobjectType', + 'PluginGenericobjectTypeFamily' + ] as $itemtype) { + if ($plug=isPluginItemType($itemtype)) { + $plugname = strtolower($plug['plugin']); + $dir = Plugin::getPhpDir($plugname)."/inc/"; + $item = strtolower($plug['class']); + if (file_exists("$dir$item.class.php")) { + include_once ("$dir$item.class.php"); + if (method_exists($itemtype, 'install')) { + $itemtype::install($migration); + } + } + } + } + + if (!is_dir(GENERICOBJECT_CLASS_PATH)) { + @ mkdir(GENERICOBJECT_CLASS_PATH, 0755, true) + or die("Can't create folder " . GENERICOBJECT_CLASS_PATH); + } + + //Init plugin & types + plugin_init_genericobject(); + + //Init profiles + PluginGenericobjectProfile::changeProfile(); + return true; +} + +/** + * Plugin uninstall process + * + * @return boolean + */ +function plugin_genericobject_uninstall() { + global $DB; + + include_once(GENERICOBJECT_DIR."/inc/object.class.php"); + include_once(GENERICOBJECT_DIR."/inc/type.class.php"); + + //For each type + foreach (PluginGenericobjectType::getTypes(true) as $tmp => $value) { + $itemtype = $value['itemtype']; + if (class_exists($itemtype)) { + $itemtype::uninstall(); + } + } + + foreach ([ + 'PluginGenericobjectType', + 'PluginGenericobjectProfile', + 'PluginGenericobjectField', + 'PluginGenericobjectTypeFamily' + ] as $itemtype) { + if ($plug=isPluginItemType($itemtype)) { + $plugname = strtolower($plug['plugin']); + $dir = Plugin::getPhpDir($plugname)."/inc/"; + $item = strtolower($plug['class']); + if (file_exists("$dir$item.class.php")) { + include_once ("$dir$item.class.php"); + $itemtype::uninstall(); + } + } + } + + // Delete all models of datainjection about genericobject + $table_datainjection_model = 'glpi_plugin_datainjection_models'; + if ($DB->tableExists($table_datainjection_model)) { + $DB->query("DELETE FROM $table_datainjection_model WHERE itemtype LIKE 'PluginGenericobject%'"); + } + + // Invalidate menu data in current session + unset($_SESSION['glpimenu']); + + return true; +} + +function plugin_datainjection_populate_genericobject() { + global $INJECTABLE_TYPES; + $type = new PluginGenericobjectType(); + foreach ($type->find(['use_plugin_datainjection' => 1, 'is_active' => 1]) as $data) { + if (class_exists($data ['itemtype']."Injection")) { + $INJECTABLE_TYPES[$data ['itemtype']."Injection"] = 'genericobject'; + } + } +} + +function plugin_genericobject_MassiveActions($type) { + $types = PluginGenericobjectType::getTypes(); + if (isset($types[$type])) { + $objecttype = PluginGenericobjectType::getInstance($type); + if ($objecttype->isTransferable()) { + return ['PluginGenericobjectObject'. + MassiveAction::CLASS_ACTION_SEPARATOR.'plugin_genericobject_transfer' => __("Transfer")]; + } else { + return []; + } + } else { + return []; + } +} diff --git a/plugins/genericobject/inc/autoload.php b/plugins/genericobject/inc/autoload.php new file mode 100644 index 00000000..586fd69d --- /dev/null +++ b/plugins/genericobject/inc/autoload.php @@ -0,0 +1,95 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectAutoloader +{ + protected $paths = []; + + public function __construct($options = null) { + if (null !== $options) { + $this->setOptions($options); + } + } + + public function setOptions($options) { + if (!is_array($options) && !($options instanceof \Traversable)) { + throw new \InvalidArgumentException(); + } + + foreach ($options as $path) { + if (!in_array($path, $this->paths)) { + $this->paths[] = $path; + } + } + return $this; + } + + public function processClassname($classname) { + preg_match("/^Plugin([A-Z][a-z0-9]+)([A-Z]\w+)$/", $classname, $matches); + + if (count($matches) < 3) { + return false; + } else { + return $matches; + } + + } + + public function autoload($classname) { + $matches = $this->processClassname($classname); + + if ($matches !== false) { + $plugin_name = strtolower($matches[1]); + $class_name = strtolower($matches[2]); + + if ($plugin_name !== "genericobject") { + return false; + } + + $filename = implode(".", [ + $class_name, + "class", + "php" + ]); + + foreach ($this->paths as $path) { + $test = $path . DIRECTORY_SEPARATOR . $filename; + if (file_exists($test)) { + return include_once($test); + } + } + } + return false; + } + + public function register() { + spl_autoload_register([$this, 'autoload']); + } +} diff --git a/plugins/genericobject/inc/commondropdown.class.php b/plugins/genericobject/inc/commondropdown.class.php new file mode 100644 index 00000000..d908dab5 --- /dev/null +++ b/plugins/genericobject/inc/commondropdown.class.php @@ -0,0 +1,50 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectCommonDropdown extends CommonDropdown { + + //Get itemtype name + static function getTypeName($nb = 0) { + $class=get_called_class(); + return dropdown_getTypeName($class, $nb); + } + + static function getFormURL($full = true) { + return Toolbox::getItemTypeFormURL( get_parent_class(get_called_class()), $full) . + "?itemtype=".get_called_class(); + } + static function getSearchURL($full = true) { + return Toolbox::getItemTypeSearchURL( get_parent_class(get_called_class()), $full) . + "?itemtype=".get_called_class(); + + } + +} + diff --git a/plugins/genericobject/inc/commontreedropdown.class.php b/plugins/genericobject/inc/commontreedropdown.class.php new file mode 100644 index 00000000..489550f1 --- /dev/null +++ b/plugins/genericobject/inc/commontreedropdown.class.php @@ -0,0 +1,51 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectCommonTreeDropdown extends CommonTreeDropdown { + + //Get itemtype name + static function getTypeName($nb = 0) { + $class=get_called_class(); + return dropdown_getTypeName($class, $nb); + } + + static function getFormURL($full = true) { + _log("PluginGenericobjectCommonTreeDropdown::getFormURL", get_parent_class(get_called_class())); + return Toolbox::getItemTypeFormURL( get_parent_class(get_called_class()), $full) . + "?itemtype=".get_called_class(); + } + static function getSearchURL($full = true) { + _log("PluginGenericobjectCommonTreeDropdown::getSearchURL", get_parent_class(get_called_class())); + return Toolbox::getItemTypeSearchURL( get_parent_class(get_called_class()), $full) . + "?itemtype=".get_called_class(); + + } +} + diff --git a/plugins/genericobject/inc/field.class.php b/plugins/genericobject/inc/field.class.php new file mode 100644 index 00000000..a2261b83 --- /dev/null +++ b/plugins/genericobject/inc/field.class.php @@ -0,0 +1,538 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectField extends CommonDBTM { + + /** + * + * Displat all fields present in DB for an itemtype + * @param $id the itemtype's id + */ + public static function showObjectFieldsForm($id) { + global $DB, $GO_BLACKLIST_FIELDS, $GO_READONLY_FIELDS, $GO_FIELDS, $CFG_GLPI; + + $url = Toolbox::getItemTypeFormURL(__CLASS__); + $object_type = new PluginGenericobjectType(); + $object_type->getFromDB($id); + $itemtype = $object_type->fields['itemtype']; + $fields_in_db = PluginGenericobjectSingletonObjectField::getInstance($itemtype); + $used_fields = []; + + //Reset fields definition only to keep the itemtype ones + $GO_FIELDS = []; + plugin_genericobject_includeCommonFields(true); + + PluginGenericobjectType::includeLocales($object_type->fields['name']); + PluginGenericobjectType::includeConstants($object_type->fields['name'], true); + + self::addReadOnlyFields($object_type); + + foreach ($GO_BLACKLIST_FIELDS as $autofield) { + if (!in_array($autofield, $used_fields)) { + $used_fields[$autofield] = $autofield; + } + } + + echo "
      "; + echo "
      "; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + $total = count($fields_in_db); + $global_index = $index = 1; + $haveCheckbox = false; + + foreach ($fields_in_db as $field => $value) { + $readonly = in_array($field, $GO_READONLY_FIELDS); + $blacklist = in_array($field, $GO_BLACKLIST_FIELDS); + + self::displayFieldDefinition($url, $itemtype, $field, $index, ($global_index==$total)); + + //All backlisted fields cannot be moved, and are listed first + if (!$readonly) { + $index++; + } + + if (!$blacklist && !$readonly) { + $haveCheckbox = true; + } + + //$table = getTableNameForForeignKeyField($field); + $used_fields[$field] = $field; + $global_index++; + } + echo "
      "; + echo __("Fields associated with the object", "genericobject") . " : "; + echo $itemtype::getTypeName(); + echo "
      " . __("Label", "genericobject") . "" . __("Name in DB", "genericobject") . "
      "; + if ($haveCheckbox) { + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
      "; + echo "".__('Check all')."/"; + echo "".__('Uncheck all').""; + echo Html::submit(__("Delete permanently"), [ + 'name' => 'delete', + ]); + echo "
      "; + } + + $dropdownFields = self::dropdownFields("new_field", $itemtype, $used_fields); + + if ($dropdownFields) { + echo "
      "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
      " . __("Add new field", "genericobject") . ""; + echo ""; + echo "
      "; + } + + Html::closeForm(); + echo "
      "; + } + + /** + * Method to set fields as read only, when the depend on some features + * that are enabled + * @since 0.85+2.4.0 + */ + static function addReadOnlyFields(PluginGenericobjectType $type) { + global $GO_READONLY_FIELDS; + + if ($type->canBeReserved()) { + $GO_READONLY_FIELDS[] = 'users_id'; + $GO_READONLY_FIELDS[] = 'locations_id'; + } + + if ($type->canUseGlobalSearch()) { + $GO_READONLY_FIELDS[] = 'serial'; + $GO_READONLY_FIELDS[] = 'otherserial'; + $GO_READONLY_FIELDS[] = 'locations_id'; + $GO_READONLY_FIELDS[] = 'states_id'; + $GO_READONLY_FIELDS[] = 'users_id'; + $GO_READONLY_FIELDS[] = 'groups_id'; + $GO_READONLY_FIELDS[] = 'manufacturers_id'; + $GO_READONLY_FIELDS[] = 'users_id_tech'; + } + + if ($type->canUseItemDevice()) { + $GO_READONLY_FIELDS[] = 'locations_id'; + } + } + /** + * Get the name of the field, as defined in a constant file + * The name may be the same, or not depending if it's an isolated dropdown or not + */ + static function getFieldName($field, $itemtype, $options, $remove_prefix = false) { + global $DB; + $field_orig = $field; + $field_table = null; + $input_type = isset($options['input_type']) + ? $options['input_type'] + : null; + switch ($input_type) { + + case 'dropdown': + $dropdown_type = isset($options['dropdown_type']) + ? $options['dropdown_type'] + : null; + $fk = getForeignKeyFieldForTable(getTableForItemType($itemtype)); + + if ($dropdown_type == 'isolated') { + if (!$remove_prefix) { + $field = preg_replace("/s_id$/", $field, $fk); + } else { + $fk = preg_replace("/s_id$/", "", $fk); + $field = preg_replace("/".$fk."/", "", $field); + } + } + $field_table = getTableNameForForeignKeyField($field); + + //Prepend plugin's table prefix if this dropdown is not already handled by GLPI natively + if (substr($field, 0, strlen('plugin_genericobject')) !== 'plugin_genericobject' + and ( + substr($field_table, strlen('glpi_')) + === substr($field, 0, strlen($field) -strlen('_id')) + ) + and !$DB->tableExists($field_table) + ) { + if (!$remove_prefix) { + $field = 'plugin_genericobject_' . $field;} + } + break; + + } + return $field; + } + + /** + * + * Display a dropdown with all available fields for an itemtype + * @since + * @param $name the dropdown name + * @param $itemtype the itemtype + * @param $used an array which contains all fields already added + * + * @return the dropdown random ID + */ + static function dropdownFields($name, $itemtype, $used = []) { + global $GO_FIELDS; + + $dropdown_types = []; + foreach ($GO_FIELDS as $field => $values) { + $message = ""; + $field_options = []; + $field = self::getFieldName($field, $itemtype, $values, false); + if (!in_array($field, $used)) { + if (!isset($dropdown_types[$field])) { + //Global management : + //meaning that a dropdown can be useful in all types (for example type, model, etc.) + if (isset($values['input_type']) && $values['input_type'] == 'dropdown') { + if (isset($values['entities_id'])) { + $field_options[] = __("Entity")." : ".Dropdown::getYesNo($values['entities_id']); + if ($values['entities_id']) { + if (isset($values['is_recursive'])) { + $field_options[] = __("Child entities")." : ".Dropdown::getYesNo($values['is_recursive']); + } + } + } else { + $field_options[] = __("Entity")." : ".Dropdown::getYesNo(0); + } + if (isset($values['is_tree'])) { + $field_options[] = __("tree structure")." : ".Dropdown::getYesNo($values['is_tree']); + } else { + $field_options[] = __("tree structure")." : ".Dropdown::getYesNo(0); + } + //if (isset($values['isolated']) and $values['isolated']) { + // $field_options[] = __("Isolated") . " : ". Dropdown::getYesNo($values['isolated']); + //} else { + // $field_options[] = __("Isolated") . " : ". Dropdown::getYesNo(0); + //} + } + if (!empty($field_options)) { + $message = "(".trim( implode(", ", $field_options)).")"; + } + } + $dropdown_types[$field] = $values['name']." ".$message; + } + } + + // Don't show dropdown empty + if (empty($dropdown_types)) { + return ''; + } + + ksort($dropdown_types); + return Dropdown::showFromArray($name, $dropdown_types, ['display' => false]); + } + + /** + * + * Get field's options defined in constant files. + * If this field has not been defined, it means that this field has been defined globally and + * must be dynamically created. + * + * @param $field the current field + * @param $itemtype the itemtype + * @return an array which contains the full field definition + */ + static function getFieldOptions($field, $itemtype = "") { + global $GO_FIELDS; + + $options = []; + $cleaned_field = preg_replace("/^plugin_genericobject_/", '', $field); + if (!isset($GO_FIELDS[$cleaned_field]) && !empty($itemtype)) { + // This field has been dynamically defined because it's an isolated dropdown + $tmpfield = self::getFieldName( + $field, $itemtype, + [ + 'dropdown_type' => 'isolated', + 'input_type' => 'dropdown' + ], + true + ); + $options = $GO_FIELDS[$tmpfield]; + $options['realname'] = $tmpfield; + } else if (isset($GO_FIELDS[$cleaned_field])) { + $options = $GO_FIELDS[$cleaned_field]; + $options['realname'] = $cleaned_field; + } + return $options; + } + + public static function displayFieldDefinition($target, $itemtype, $field, $index, $last = false) { + global $GO_FIELDS, $CFG_GLPI, $GO_BLACKLIST_FIELDS, $GO_READONLY_FIELDS; + + $readonly = in_array($field, $GO_READONLY_FIELDS); + $blacklist = in_array($field, $GO_BLACKLIST_FIELDS); + $options = self::getFieldOptions($field, $itemtype); + + echo ""; + echo ""; + if (!$blacklist && !$readonly) { + echo ""; + } else { + echo ""; + } + echo ""; + echo "" . __($options['name'], 'genericobject') . ""; + echo "" . $field . ""; + + echo ""; + if ((!$blacklist || $readonly) && $index > 1) { + Html::showSimpleForm($target, $CFG_GLPI["root_doc"] . "/pics/deplier_up.png", 'up', + ['field' => $field, 'action' => 'up', 'itemtype' => $itemtype], + $CFG_GLPI["root_doc"] . "/pics/deplier_up.png"); + } + echo ""; + + echo ""; + if ((!$blacklist || $readonly) && !$last) { + Html::showSimpleForm($target, $CFG_GLPI["root_doc"] . "/pics/deplier_down.png", 'down', + ['field' => $field, 'action' => 'down', 'itemtype' => $itemtype], + $CFG_GLPI["root_doc"] . "/pics/deplier_down.png"); + } + echo ""; + + echo ""; + + } + + /** + * Add a new field in DB + * @param table the table + * @param field the field to delete + * @return nothing + */ + public static function addNewField($table, $field, $after = false) { + global $DB; + + _log("add", $field, "from", $table); + $itemtype = getItemTypeForTable($table); + if (!$DB->fieldExists($table, $field, false)) { + $options = self::getFieldOptions($field, $itemtype); + $query = "ALTER TABLE `$table` ADD `$field` "; + switch ($options['input_type']) { + case 'dropdown_yesno' : + case 'dropdown_global' : + case 'bool' : + $query .= "TINYINT (1) NOT NULL DEFAULT '0'"; + break; + case 'emptyspace' : + case 'text' : + $query .= "VARCHAR ( 255 ) collate utf8_unicode_ci NOT NULL DEFAULT ''"; + break; + case 'multitext' : + $query .= "TEXT NULL"; + break; + case 'dropdown' : + case 'integer' : + $query .= "INT ( 11 ) NOT NULL DEFAULT '0'"; + break; + case 'date': + $query.="DATE DEFAULT NULL"; + break; + case 'datetime': + $query.="TIMESTAMP NULL DEFAULT NULL"; + break; + case 'float' : + $query .= "FLOAT NOT NULL DEFAULT '0'"; + break; + case 'decimal' : + $query .= "DECIMAL(20,4) NOT NULL DEFAULT '0.0000'"; + break; + } + if ($after) { + $query.=" AFTER `$after`"; + } + $DB->query($query); + + //Reload list of fields for this itemtype in the singleton + + $recursive = $entity_assign = $tree = false; + + $table = getTableNameForForeignKeyField($field); + + if ($table != '' && !$DB->tableExists($table)) { + //Cannot use standard methods because class doesn't exists yet ! + $name = str_replace("glpi_plugin_genericobject_", "", $table); + $name = getSingular($name); + + $options['linked_itemtype'] = $itemtype; + + PluginGenericobjectType::addNewDropdown( + $name, 'PluginGenericobject'.ucfirst($name), $options + ); + } + // Invalidate menu data in current session + unset($_SESSION['glpimenu']); + + PluginGenericobjectSingletonObjectField::getInstance($itemtype, true); + } + } + + /** + * Delete a field in DB + * @param table the table + * @param field the field to delete + * @return nothing + */ + static function deleteField($table, $field) { + global $DB; + + //Remove field from displaypreferences + self::deleteDisplayPreferences($table, $field); + + //If field exists, drop it ! + if ($DB->fieldExists($table, $field)) { + $DB->query("ALTER TABLE `$table` DROP `$field`"); + } + + $table = getTableNameForForeignKeyField($field); + //If dropdown is managed by the plugin + if ($table != '' && preg_match('/plugin_genericobject_(.*)/', $table, $results)) { + //Delete dropdown table + $query = "DROP TABLE `$table`"; + $DB->query($query); + //Delete dropdown files & class + $name = getSingular($results[1]); + PluginGenericobjectType::deleteClassFile($name); + PluginGenericobjectType::deleteFormFile($name); + PluginGenericobjectType::deletesearchFile($name); + } + } + + static function deleteDisplayPreferences($table, $field) { + + $pref = new DisplayPreference(); + $itemtype = getItemTypeForTable($table); + $searchopt = Search::getCleanedOptions($itemtype); + foreach ($searchopt as $num => $option) { + if ((isset($option['field']) && ($option['field'] == $field)) + || (isset($option['field']) && $option['linkfield'] == $field)) { + $pref->deleteByCriteria([ + 'itemtype' => $itemtype, + 'num' => $num + ]); + break; + } + } + } + + /** + * Change field order in DB + * @params an array which contains the itemtype, the field to move and the action (up/down) + * @return nothing + */ + static function changeFieldOrder($params = []) { + global $DB; + $itemtype = $params['itemtype']; + $field = $params['field']; + $table = getTableForItemType($itemtype); + $fields = PluginGenericobjectSingletonObjectField::getInstance($params['itemtype']); + + //If action is down, reverse array first + if ($params['action'] == 'down') { + $fields = array_reverse($fields); + } + + //Get array keys + $keys = array_keys($fields); + //Index represents current position of $field + $index = 0; + foreach ($keys as $id => $key) { + if ($key == $field) { + $index = $id; + } + } + //Get 2 positions before and move field + if ($params['action'] == 'down') { + $previous = $index - 1; + } else { + $previous = $index - 2; + } + + if (isset($keys[$previous])) { + $parent = $fields[$keys[$previous]]; + $query = "ALTER TABLE `$table` MODIFY `$field` ".$fields[$field]['Type']; + $query .= " AFTER `".$fields[$keys[$previous]]['Field']."`"; + $DB->query($query) or die ($DB->error()); + } + } + + public static function checkNecessaryFieldsDelete($itemtype, $field) { + $type = new PluginGenericobjectType(); + $type->getFromDBByType($itemtype); + + if ($type->canUseNetworkPorts() && 'locations_id' == $field) { + return false; + } + /* + if ($type->fields['use_direct_connections']) { + foreach(['users_id','groups_id',' states_id','locations_id'] as $tmp_field) { + if ($tmp_field == $field) { + return false; + } + } + }*/ + return true; + } + + static function install(Migration $migration) { + } + + static function uninstall() { + } + +} + diff --git a/plugins/genericobject/inc/functions.php b/plugins/genericobject/inc/functions.php new file mode 100644 index 00000000..f41b0c42 --- /dev/null +++ b/plugins/genericobject/inc/functions.php @@ -0,0 +1,130 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +/* + * return the name of a dropdown type + * This shared by the following classes : + * - PluginGenericobjectCommonDropdown + * - PluginGenericobjectCommonTreeDropdown + */ +function dropdown_getTypeName($class, $nb = 0) { + global $GO_FIELDS; + $fk = getForeignKeyFieldForTable(getTableForItemType($class)); + $instance = new $class(); + $options = PluginGenericobjectField::getFieldOptions($fk, $instance->linked_itemtype); + $dropdown_type = isset($options['dropdown_type']) + ? $options['dropdown_type'] + : null; + $label = $options['name'] ?? "no-name"; + if (!is_null($dropdown_type) and $dropdown_type==='isolated') { + $linked_itemtype_object = new $instance->linked_itemtype(); + $label .= " (" . __($linked_itemtype_object::getTypeName(), 'genericobject') . ")"; + } + if ($label != '') { + return $label; + } else { + return $class; + } +} +global $LOG_FILTER; +$LOG_FILTER = []; +/* + * a simple logger function + * You can disable logging by using the global $LOG_FILTER + * in setup.php after including this file + */ +function _log() { + global $LOG_FILTER; + $trace = debug_backtrace(); + if (count($trace)>0) { + $glpi_root = str_replace( "\\", "/", GLPI_ROOT ); + $trace_file = str_replace( "\\", "/", $trace[0]['file'] ); + $filename = preg_replace("|^".$glpi_root."/".Plugin::getPhpDir('genericobject', false)."/|", "", $trace_file); + } + if (count($trace) > 1) { + $caller = $trace[1]; + } else { + $caller = null; + } + $msg = _format_trace($trace, func_get_args()); + $msg .= "\n"; + $show_log = false; + if (!is_null($caller) and + isset($caller['class']) and + in_array($caller['class'], $LOG_FILTER) + ) { + $callee = array_shift($trace); + $show_log = true; + } + if (in_array($filename, $LOG_FILTER)) { + $show_log = true; + } + if ($show_log) { + call_user_func_array("Toolbox::logInFile", ['generic-object', $msg, true]); + } +} + +function _format_trace($bt, $args) { + static $tps = 0; + $msg = ""; + $msg = "From \n"; + if (count($bt) > 0) { + foreach (array_reverse($bt) as $idx => $trace) { + $msg .= sprintf(" [%d] ", $idx); + if (isset($trace['class'])) { + $msg .= $trace['class'].'::'; + } + $msg .= $trace['function'].'()'; + if (isset($trace['file'])) { + $msg .= ' called in '. $trace['file'] . ', line ' . $trace['line']; + } + $msg .= "\n"; + } + } + + if ($tps && function_exists('memory_get_usage')) { + $msg .= ' ('.number_format(microtime(true)-$tps, 3).'", '. + number_format(memory_get_usage()/1024/1024, 2).'Mio)'; + } + $msg .= "\n "; + foreach ($args as $arg) { + if (is_array($arg) || is_object($arg)) { + $msg .= " ".str_replace("\n", "\n ", print_r($arg, true)); + } else if (is_null($arg)) { + $msg .= 'NULL '; + } else if (is_bool($arg)) { + $msg .= ($arg ? 'true' : 'false').' '; + } else { + $msg .= $arg . ' '; + } + } + $msg .= "\n"; + return $msg; +} diff --git a/plugins/genericobject/inc/object.class.php b/plugins/genericobject/inc/object.class.php new file mode 100644 index 00000000..239d722f --- /dev/null +++ b/plugins/genericobject/inc/object.class.php @@ -0,0 +1,1257 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectObject extends CommonDBTM { + use Glpi\Features\Clonable; + + protected $objecttype; + + //Internal field counter + private $cpt = 0; + + //Get itemtype name + static function getTypeName($nb = 0) { + global $LANG; + $class = get_called_class(); + //Datainjection : Don't understand why I need this trick : need to be investigated ! + if (preg_match("/Injection$/i", $class)) { + $class = str_replace("Injection", "", $class); + } + $item = new $class(); + //Itemtype name can be contained in a specific locale field : try to load it + PluginGenericobjectType::includeLocales($item->objecttype->fields['name']); + if (isset($LANG['genericobject'][$class][0])) { + $type_name = $LANG['genericobject'][$class][0]; + } else { + $type_name = $item->objecttype->fields['name']; + } + return ucwords($type_name); + } + + + public function __construct() { + $class = get_called_class(); + $this->table = getTableForItemType($class); + if (class_exists($class)) { + $this->objecttype = PluginGenericobjectType::getInstance($class); + } + $this->dohistory = $this->canUseHistory(); + + if (preg_match("/PluginGenericobject(.*)/", $class, $results)) { + if (preg_match("/^(.*)y$/i", $results[1], $end_results)) { + static::$rightname = 'plugin_genericobject_'.strtolower($end_results[1]).'ies'; + } else if (preg_match("/^(.*)ss$/i", $results[1])) { + static::$rightname = 'plugin_genericobject_'.strtolower($results[1]).'es'; + } else { + static::$rightname = 'plugin_genericobject_'.strtolower($results[1]).'s'; + } + } + + if ($this->canUseNotepad()) { + // For GLPI 0.85.x + $this->usenotepadrights = true; + // For GLPI 0.90.x + $this->usenotepad = true; + } + } + + public function getCloneRelations() :array { + return [ + Computer_Item::class, + Contract_Item::class, + Document_Item::class, + Infocom::class, + Item_devices::class, + NetworkPort::class, + ]; + } + + + /** + * Display information on treeview plugin + * + * @params itemtype, id, pic, url, name + * + * @return params + **/ + static function showGenericObjectTreeview($params) { + global $CFG_GLPI; + + if (array_key_exists($params['itemtype'], PluginGenericobjectType::getTypes())) { + $item = new $params['itemtype'](); + if ($item->getFromDB($params['id'])) { + $params['name'] = $item->fields["name"]; + $params['url'] = Plugin::getWebDir('genericobject')."/front/object.form.php". + "?itemtype=".$params['itemtype']."&id=".$params['id']; + } + } + return $params; + } + + /** + * Display node search url on treeview plugin + * + * @params itemtype, id, pic, url, name + * + * @return params + **/ + static function getParentNodeSearchUrl($params) { + + if (array_key_exists($params['itemtype'], PluginGenericobjectType::getTypes())) { + + $item = new $params['itemtype'](); + $search = $item->rawSearchOptions(); + //get searchoption id for location_id + foreach ($search as $key => $val) { + if (isset($val['table']) && $val['table'] === 'glpi_locations') { + $index= $key; + } + } + + $token = Session::getNewCSRFToken(); + + $params['searchurl'] = $params['itemtype']::getSearchURL()."&is_deleted=0&criteria[0][field]=".$index."&criteria[0]". + "[searchtype]=equals&criteria[0][value]=".$params['locations_id']."&search=Rechercher&start=0&_glpi_csrf_token=$token"; + return $params; + + } + + return $params; + } + + static function install() { + } + + static function uninstall() { + } + + static function registerType() { + global $DB, $PLUGIN_HOOKS, $UNINSTALL_TYPES, $ORDER_TYPES, $CFG_GLPI, + $GO_LINKED_TYPES, $GENINVENTORYNUMBER_TYPES; + + $class = get_called_class(); + $item = new $class(); + $fields = PluginGenericobjectSingletonObjectField::getInstance($class); + $plugin = new Plugin(); + + PluginGenericobjectType::includeLocales($item->getObjectTypeName()); + PluginGenericobjectType::includeConstants($item->getObjectTypeName()); + + Plugin::registerClass($class, [ + "document_types" => $item->canUseDocuments(), + "helpdesk_visible_types" => $item->canUseTickets(), + "linkgroup_types" => isset($fields["groups_id"]), + "linkuser_types" => isset($fields["users_id"]), + "linkgroup_tech_types" => isset($fields["groups_id_tech"]), + "linkuser_tech_types" => isset($fields["users_id_tech"]), + "ticket_types" => $item->canUseTickets(), + "infocom_types" => $item->canUseInfocoms(), + "networkport_types" => $item->canUseNetworkPorts(), + "reservation_types" => $item->canBeReserved(), + "contract_types" => $item->canUseContracts(), + "unicity_types" => $item->canUseUnicity(), + "location_types" => isset($fields['locations_id']), + "itemdevices_types" => $item->canUseItemDevice() + ]); + + if (plugin_genericobject_haveRight($class, READ)) { + //Change url for adding a new object, depending on template management activation + if ($item->canUseTemplate()) { + //Template management is active + $add_url = "/front/setup.templates.php?itemtype=$class&add=1"; + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['links']['template'] + = "/front/setup.templates.php?itemtype=$class&add=0"; + } else { + //Template management is not active + $add_url = Toolbox::getItemTypeFormURL($class, false); + } + //Menu management + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['title'] + = $class::getTypeName(); + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['page'] + = Toolbox::getItemTypeSearchURL($class, false); + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['links']['search'] + = Toolbox::getItemTypeSearchURL($class, false); + + if (plugin_genericobject_haveRight($class, UPDATE)) { + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['links']['add'] + = $add_url; + + } + + //Add configuration icon, if user has right + if (Session::haveRight('config', UPDATE)) { + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['links']['config'] + = Toolbox::getItemTypeSearchURL('PluginGenericobjectType', false)."?itemtype=$class"; + } + + if ($item->canUsePluginUninstall()) { + if (!in_array($class, $UNINSTALL_TYPES)) { + array_push($UNINSTALL_TYPES, $class); + } + } + if ($item->canUsePluginSimcard()) { + if ($plugin->isActivated('simcard') && $plugin->isActivated('simcard')) { + PluginSimcardSimcard_Item::registerItemtype($class); + } + } + if ($item->canUsePluginOrder()) { + if (!in_array($class, $ORDER_TYPES)) { + array_push($ORDER_TYPES, $class); + } + } + if ($item->canUseGlobalSearch()) { + if (!in_array($class, $CFG_GLPI['asset_types'])) { + array_push($CFG_GLPI['asset_types'], $class); + } + + if (!in_array($class, $CFG_GLPI['state_types'])) { + array_push($CFG_GLPI['state_types'], $class); + } + + if (!in_array($class, $CFG_GLPI['globalsearch_types'])) { + array_push($CFG_GLPI['globalsearch_types'], $class); + } + } + + if ($item->canUseDirectConnections()) { + if (!in_array($class, $GO_LINKED_TYPES)) { + array_push($GO_LINKED_TYPES, $class); + } + $items_class = $class."_Item"; + //if (class_exists($items_class)) { + $items_class::registerType(); + //} + } + + if ($item->canUseProjects()) { + if (!in_array($class, $CFG_GLPI['project_asset_types'])) { + array_push($CFG_GLPI['project_asset_types'], $class); + } + } + + $plugin_gen_path = Plugin::getPhpDir('geninventorynumber'); + if ($item->canUsePluginGeninventorynumber()) { + if (!in_array($class, $GENINVENTORYNUMBER_TYPES)) { + include_once ("$plugin_gen_path/inc/profile.class.php"); + PluginGeninventorynumberConfigField::registerNewItemType($class); + array_push($GENINVENTORYNUMBER_TYPES, $class); + } + } else if ($plugin->isActivated('geninventorynumber')) { + include_once ("$plugin_gen_path/inc/profile.class.php"); + PluginGeninventorynumberConfigField::unregisterNewItemType($class); + } + } + + foreach (PluginGenericobjectType::getDropdownForItemtype($class) as $table) { + $itemtype = getItemTypeForTable($table); + if (class_exists($itemtype)) { + $item = new $itemtype(); + //If entity dropdown, check rights to view & create + if ($itemtype::canView()) { + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$itemtype]['links']['search'] + = Toolbox::getItemTypeSearchURL($itemtype, false); + if ($itemtype::canCreate()) { + $PLUGIN_HOOKS['submenu_entry']['genericobject']['options'][$class]['links']['add'] + = Toolbox::getItemTypeFormURL($class, false); + } + } + } + } + } + + static function getMenuIcon($itemtype) { + global $CFG_GLPI; + $itemtype_table = getTableForItemType($itemtype); + $itemtype_shortname = preg_replace("/^glpi_plugin_genericobject_/", "", $itemtype_table); + $itemtype_icons = glob( + GENERICOBJECT_PICS_PATH . '/' . getSingular($itemtype_shortname) . ".*" + ); + $finfo = new finfo(FILEINFO_MIME); + $icon_found = null; + foreach ($itemtype_icons as $icon) { + if (preg_match("|^image/|", $finfo->file($icon))) { + $icon_found = preg_replace("|^".GLPI_ROOT."|", "", $icon); + } + } + if (!is_null($icon_found)) { + $icon_path = $CFG_GLPI['root_doc'] . $icon_found; + } else { + $icon_path = Plugin::getWebDir('genericobject') . "/pics/default-icon.png"; + } + return "". + ""; + } + + static function checkItemtypeRight($class, $right) { + if (!is_null($class) and class_exists($class)) { + $right_name = PluginGenericobjectProfile::getProfileNameForItemtype( + $class + ); + + return Session::haveRight($right_name, $right); + } + } + + static function canCreate() { + $class = get_called_class(); + //Datainjection : Don't understand why I need this trick : need to be investigated ! + if (preg_match("/Injection$/i", $class)) { + $class = str_replace("Injection", "", $class); + } + return static::checkItemtypeRight($class, CREATE); + } + + static function canView() { + $class = get_called_class(); + return static::checkItemtypeRight($class, READ); + } + + static function canUpdate() { + $class = get_called_class(); + return static::checkItemtypeRight($class, UPDATE); + } + + static function canDelete() { + $class = get_called_class(); + return static::checkItemtypeRight($class, DELETE); + } + + static function canPurge() { + $class = get_called_class(); + return static::checkItemtypeRight($class, PURGE); + } + + function defineTabs($options = []) { + $tabs = []; + + $this->addDefaultFormTab($tabs); + + if (!$this->isNewItem()) { + + if ($this->canUseNetworkPorts()) { + $this->addStandardTab('NetworkPort', $tabs, $options); + } + + if ($this->canUseItemDevice()) { + $this->addStandardTab('Item_Devices', $tabs, $options); + } + + if ($this->canUseInfocoms()) { + $this->addStandardTab('Infocom', $tabs, $options); + } + + if ($this->canUseContracts()) { + $this->addStandardTab('Contract_Item', $tabs, $options); + } + + if ($this->canUseDocuments()) { + $this->addStandardTab('Document_Item', $tabs, $options); + } + + if ($this->canUseTickets()) { + $this->addStandardTab('Ticket', $tabs, $options); + $this->addStandardTab('Item_Problem', $tabs, $options); + $this->addStandardTab('Change_Item', $tabs, $options); + } + + if ($this->canUseNotepad()) { + $this->addStandardTab('Notepad', $tabs, $options); + } + + if ($this->canBeReserved()) { + $this->addStandardTab('Reservation', $tabs, $options); + } + + if ($this->canUseHistory()) { + $this->addStandardTab('Log', $tabs, $options); + } + } + return $tabs; + } + + + //------------------------ CAN methods -------------------------------------// + + function getObjectTypeName() { + return $this->objecttype->getName(); + } + + function canUseInfocoms() { + return ($this->objecttype->canUseInfocoms() && Session::haveRight("infocom", READ)); + } + + function canUseContracts() { + return ($this->objecttype->canUseContracts() && Session::haveRight("contract", READ)); + } + + + function canUseTemplate() { + return $this->objecttype->canUseTemplate(); + } + + + function canUseNotepad() { + return $this->objecttype->canUseNotepad(); + } + + function canUseUnicity() { + // Disable unicity feature (for GLPI 0.85 onward) : see issue #16 + // Related code : search for #16 + // FIXME : The bug may be in GLPI itself + return ($this->objecttype->canUseUnicity() && Session::haveRight("config", READ)); + } + + + function canUseDocuments() { + return ($this->objecttype->canUseDocuments() && Session::haveRight("document", READ)); + } + + + function canUseTickets() { + return ($this->objecttype->canUseTickets()); + } + + + function canUseGlobalSearch() { + return ($this->objecttype->canUseGlobalSearch()); + } + + + function canBeReserved() { + return ( + $this->objecttype->canBeReserved() + and Session::haveRight(ReservationItem::$rightname, ReservationItem::RESERVEANITEM) + ); + } + + + function canUseHistory() { + return ($this->objecttype->canUseHistory()); + } + + + function canUsePluginDataInjection() { + return ($this->objecttype->canUsePluginDataInjection()); + } + + + function canUsePluginPDF() { + return ($this->objecttype->canUsePluginPDF()); + } + + + function canUsePluginOrder() { + return ($this->objecttype->canUsePluginOrder()); + } + + function canUsePluginGeninventorynumber() { + return ($this->objecttype->canUsePluginGeninventorynumber()); + } + + function canUseNetworkPorts() { + return ($this->objecttype->canUseNetworkPorts()); + } + + + function canUseDirectConnections() { + return ($this->objecttype->canUseDirectConnections()); + } + + function canUseProjects() { + return ($this->objecttype->canUseProjects()); + } + + + function canUsePluginUninstall() { + return ($this->objecttype->canUsePluginUninstall()); + } + + function canUsePluginSimcard() { + return ($this->objecttype->canUsePluginSimcard()); + } + + function getLinkedItemTypesAsArray() { + return $this->objecttype->getLinkedItemTypesAsArray(); + } + + function canUseItemDevice() { + return ($this->objecttype->canUseItemDevice()); + } + + function title() { + } + + + function showForm($id, $options = [], $previsualisation = false) { + global $DB; + + $display_date = (!method_exists('CommonDBTM', 'showDates')); + if ($previsualisation) { + $canedit = true; + $this->getEmpty(); + } else { + if ($id > 0) { + $this->check($id, READ); + } else { + // Create item + $this->check(-1, CREATE); + $this->getEmpty(); + } + + $canedit = $this->can($id, UPDATE); + } + + if (isset($options['withtemplate']) && $options['withtemplate'] == 2) { + $template = "newcomp"; + $date = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); + } else if (isset($options['withtemplate']) && $options['withtemplate'] == 1) { + $template = "newtemplate"; + $date = sprintf(__('Created on %s'), Html::convDateTime($_SESSION["glpi_currenttime"])); + } else { + $date = sprintf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); + $template = false; + } + + $this->fields['id'] = $id; + $this->initForm($id, $options); + $this->showFormHeader($options); + + if ($previsualisation) { + echo "".__("Object preview", "genericobject").": "; + $itemtype = $this->objecttype->fields['itemtype']; + echo $itemtype::getTypeName(); + echo ""; + } + + //Reset fields definition only to keep the itemtype ones + $GO_FIELDS = []; + plugin_genericobject_includeCommonFields(true); + PluginGenericobjectType::includeConstants($this->getObjectTypeName(), true); + + foreach (PluginGenericobjectSingletonObjectField::getInstance($this->objecttype->fields['itemtype']) + as $field => $description) { + if ($field == "is_helpdesk_visible" && $id <= 0) { + $this->displayField($canedit, $field, 1, $template, $description); + } else { + $this->displayField($canedit, $field, $this->fields[$field], $template, $description); + } + } + $this->closeColumn(); + + if ($display_date && !$this->isNewID($id)) { + echo ""; + echo "".$date; + if (!$template && !empty($this->fields['template_name'])) { + echo "(".__("Template name")." : ". + $this->fields['template_name'].")"; + } + echo ""; + } + + if (!$previsualisation) { + $this->showFormButtons($options); + } else { + echo ""; + Html::closeForm(); + } + } + + + static function getFieldsToHide() { + return ['id', 'is_recursive', 'is_template', 'template_name', 'is_deleted', + 'entities_id', 'notepad', 'date_mod', 'date_creation']; + } + + + function displayField($canedit, $name, $value, $template, $description = []) { + global $GO_BLACKLIST_FIELDS; + + $searchoption = PluginGenericobjectField::getFieldOptions($name, get_called_class()); + + if (!empty($searchoption) + && !in_array($name, self::getFieldsToHide())) { + + if (isset($searchoption['input_type']) && 'emptyspace' === $searchoption['input_type']) { + $searchoption['name'] = " "; + $description['Type'] = 'emptyspace'; + } + + $this->startColumn(); + echo $searchoption['name']; + if (isset($searchoption['autoname']) && $searchoption['autoname'] && $template) { + echo "* "; + } + $this->endColumn(); + $this->startColumn(); + + // Keep only main column type by removing anything that is preceded by a space (e.g. " unsigned") + // or a parenthesis (e.g. "(255)"). + $column_type = preg_replace('/[ (].+$/', '', $description['Type']); + switch ($column_type) { + case "int": + $fk_table = getTableNameForForeignKeyField($name); + if ($fk_table != '') { + $itemtype = getItemTypeForTable($fk_table); + $dropdown = new $itemtype(); + $parameters = ['name' => $name, 'value' => $value, 'comments' => true]; + if ($dropdown->isEntityAssign()) { + $parameters["entity"] = $this->fields['entities_id']; + } + if ($dropdown->maybeRecursive()) { + $parameters['entity_sons'] = true; + } + if (isset($searchoption['condition'])) { + $parameters['condition'] = $searchoption['condition']; + } + if ($dropdown instanceof User) { + $parameters['entity'] = $this->fields["entities_id"]; + $parameters['right'] = 'all'; + User::dropdown($parameters); + } else { + Dropdown::show($itemtype, $parameters); + } + } else { + $min = $max = $step = 0; + if (isset($searchoption['min'])) { + $min = $searchoption['min']; + } else { + $min = 0; + } + if (isset($searchoption['max'])) { + $max = $searchoption['max']; + } else { + $max = 100; + } + if (isset($searchoption['step'])) { + $step = $searchoption['step']; + } else { + $step = 1; + } + Dropdown::showNumber( + $name, [ + 'value' => $value, + 'min' => $min, + 'max' => $max, + 'step' => $step + ] + ); + } + break; + + case "tinyint": + Dropdown::showYesNo($name, $value); + break; + + case "varchar": + if (isset($searchoption['autoname']) && $searchoption['autoname']) { + $objectName = autoName($this->fields[$name], $name, ($template === "newcomp"), + $this->getType(), $this->fields["entities_id"]); + } else { + $objectName = $this->fields[$name]; + } + Html::autocompletionTextField($this, $name, ['value' => $objectName]); + break; + + case "longtext": + case "text": + echo ""; + break; + + case "emptyspace": + echo ' '; + break; + + case "date": + Html::showDateField( + $name, [ + 'value' => $value, + 'maybeempty' => true, + 'canedit' => true + ] + ); + break; + + case "datetime": + case "timestamp": + Html::showDateTimeField( + $name, [ + 'value' => $value, + 'timestep' => true, + 'maybeempty' => true + ] + ); + break; + + case "float": + case 'decimal': + echo ""; + break; + + default: + echo ""; + break; + + } + $this->endColumn(); + } + } + + + + /** + * Add a new column + **/ + function startColumn() { + if ($this->cpt == 0) { + echo ""; + } + + echo ""; + $this->cpt++; + } + + + + /** + * End a column + **/ + function endColumn() { + echo ""; + + if ($this->cpt == 4) { + echo ""; + $this->cpt = 0; + } + + } + + + + /** + * Close a column + **/ + function closeColumn() { + if ($this->cpt > 0) { + while ($this->cpt < 4) { + echo ""; + $this->cpt++; + } + echo ""; + } + } + + + function prepareInputForAdd($input) { + + //Template management + if (isset ($input["id"]) && $input["id"] > 0) { + $input["_oldID"] = $input["id"]; + } + unset ($input['id']); + unset ($input['withtemplate']); + + return $input; + } + + + function cleanDBonPurge() { + $parameters = ['items_id' => $this->getID(), 'itemtype' => get_called_class()]; + $types = ['Computer_Item', 'ReservationItem', 'Document_Item', 'Infocom', 'Contract_Item']; + foreach ($types as $type) { + $item = new $type(); + $item->deleteByCriteria($parameters); + } + + foreach (['NetworkPort', 'Computer_Item', 'ReservationItem', + 'ReservationItem', 'Document_Item', 'Infocom', 'Contract_Item', + 'Item_Problem', 'Change_Item', 'Item_Project'] as $itemtype) { + $ip = new $itemtype(); + $ip->cleanDBonItemDelete(get_called_class(), $this->getID()); + } + } + + /** + * Display object preview form + * @param type the object type + */ + static function showPrevisualisationForm(PluginGenericobjectType $type) { + $itemtype = $type->fields['itemtype']; + $item = new $itemtype(); + + $right_name = PluginGenericobjectProfile::getProfileNameForItemtype( + $itemtype + ); + + if (Session::haveRight($right_name, READ) && Session::haveRight($right_name, CREATE)) { + $item->showForm(-1, [], true); + } else { + echo "
      " . __("You must configure rights to enable the preview", + "genericobject") . "
      "; + } + } + + function rawSearchOptions() { + global $DB, $GO_FIELDS, $GO_BLACKLIST_FIELDS; + + $datainjection_blacklisted = ['id', 'date_mod', 'entities_id', 'date_creation']; + $index_exceptions = ['name' => 1, 'id' => 2, 'comment' => 16, 'date_mod' => 19, + 'entities_id' => 80, 'is_recursive' => 86, 'notepad' => 90, + 'date_creation' => 121]; + + // Don't use indexes blacklisted by other item types in plugin DataInjection. + $plugin = new Plugin(); + if ($plugin->isActivated("datainjection") + && class_exists('PluginDatainjectionCommonInjectionLib')) { + $blacklisted_indexes = PluginDatainjectionCommonInjectionLib::getBlacklistedOptions( + get_called_class() //A class that extends PluginGenericobjectObject + ); + } else { + $blacklisted_indexes = []; + } + + $index = 3; + + $options = []; + + $options[] = [ + 'id' => 'common', + 'name' => __('Characteristics'), + ]; + + $table = getTableForItemType(get_called_class()); + + // Prevent usage of reserved and blacklisted indexes + $taken_indexes = array_merge($index_exceptions, $blacklisted_indexes); + + foreach (PluginGenericobjectSingletonObjectField::getInstance(get_called_class()) + as $field => $values + ) { + $searchoption = PluginGenericobjectField::getFieldOptions( + $field, + $this->objecttype->fields['itemtype'] + ); + + if ($field == 'is_deleted') { + continue; + } + + //Some fields have fixed index values... + $currentindex = $index; + if (isset($index_exceptions[$field])) { + $currentindex = $index_exceptions[$field]; + } else { + //If this index is reserved, jump to next available one. + while (in_array($currentindex, $taken_indexes)) { + $currentindex++; + } + } + + $option = [ + 'id' => $currentindex, + ]; + $taken_indexes[] = $option['id']; + + $item = new $this->objecttype->fields['itemtype']; + + //Table definition + //We test if it ends with s_id, in order to be sure that this pattern + //was found in a field that doesn't represent a foreign key + //for exemple a field called : is_identification + if (preg_match("/(s_id$|s_id_)/", $field)) { + $tmp = getTableNameForForeignKeyField($field); + } else { + $tmp = ''; + } + + if (preg_match("/(s_id_)/", $field)) { + $option['linkfield'] = $field; + } + + if ($tmp != '') { + $itemtype = getItemTypeForTable($tmp); + $tmpobj = new $itemtype(); + + //Set table + $option['table'] = $tmp; + + //Set field + if ($tmpobj instanceof CommonTreeDropdown) { + $option['field'] = 'completename'; + } else { + $option['field'] = 'name'; + } + + } else { + $option['table'] = $table; + $option['field'] = $field; + + } + + $option['name'] = $searchoption['name']; + + //Massive action or not + if (isset($searchoption['massiveaction'])) { + $option['massiveaction'] = $searchoption['massiveaction']; + } + + //Datainjection option + if (!in_array($field, $datainjection_blacklisted)) { + $option['injectable'] = 1; + } else { + $option['injectable'] = 0; + } + + //Field type + switch ($values['Type']) { + default: + case "varchar(255)": + if ($field == 'name') { + $option['datatype'] = 'itemlink'; + $option['itemlink_type'] = get_called_class(); + $option['massiveaction'] = false; + // Enable autocomplete only for name, other fields may contains sensitive data + $option['autocomplete'] = true; + } else { + if (isset($searchoption['datatype']) && $searchoption['datatype'] == 'weblink') { + $option['datatype'] = 'weblink'; + } else { + $option['datatype'] = 'string'; + } + } + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['checktype'] = 'text'; + $option['displaytype'] = 'text'; + } + break; + case "tinyint(1)": + $option['datatype'] = 'bool'; + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['displaytype'] = 'bool'; + } + break; + case "text": + case "longtext": + $option['datatype'] = 'text'; + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['displaytype'] = 'multiline_text'; + } + break; + case "int(11)": + if ($tmp != '') { + $option['datatype'] = 'dropdown'; + } else { + $option['datatype'] = 'integer'; + } + + if ($item->canUsePluginDataInjection()) { + if ($tmp != '') { + $option['displaytype'] = 'dropdown'; + $option['checktype'] = 'text'; + } else { + //Datainjection specific + $option['displaytype'] = 'dropdown_integer'; + $option['checktype'] = 'integer'; + } + } + break; + case "float": + case "decimal": + $option['datatype'] = $values['Type']; + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['display'] = 'text'; + $option['checktype'] = $values['Type']; + } + break; + case "date": + $option['datatype'] = 'date'; + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['displaytype'] = 'date'; + $option['checktype'] = 'date'; + } + break; + case "datetime": + case "timestamp": + $option['datatype'] = 'datetime'; + if ($item->canUsePluginDataInjection()) { + //Datainjection specific + $option['displaytype'] = 'date'; + $option['checktype'] = 'date'; + } + if ($field == 'date_mod') { + $option['massiveaction'] = false; + } + break; + } + + $options[] = $option; + + $index = $currentindex + 1; + } + + usort( + $options, + function ($a, $b) { + return ($a['id'] < $b['id']) ? -1 : 1; + } + ); + + return $options; + } + + + + //Datainjection specific methods + function isPrimaryType() { + return true; + } + + + function connectedTo() { + return []; + } + + + + /** + * Standard method to add an object into glpi + * + * @param values fields to add into glpi + * @param options options used during creation + * @return an array of IDs of newly created objects : for example [Computer=>1, Networkport=>10] + * + **/ + function addOrUpdateObject($values = [], $options = []) { + + $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options); + $lib->processAddOrUpdate(); + return $lib->getInjectionResults(); + } + + + function getOptions($primary_type = '') { + return Search::getOptions($primary_type); + } + + + function transfer($new_entity) { + global $DB; + if ($this->fields['id'] > 0 && $this->fields['entities_id'] != $new_entity) { + //Update entity for this object + $tmp['id'] = $this->fields['id']; + $tmp['entities_id'] = $new_entity; + $this->update($tmp); + + $toupdate = ['id' => $this->fields['id']]; + foreach (PluginGenericobjectSingletonObjectField::getInstance(get_called_class()) as $field => $data) { + $table = getTableNameForForeignKeyField($field); + + //It is a dropdown table ! + if ($field != 'entities_id' + && $table != '' + && isset($this->fields[$field]) && $this->fields[$field] > 0) { + //Instanciate a new dropdown object + $dropdown_itemtype = getItemTypeForTable($table); + $dropdown = new $dropdown_itemtype(); + $dropdown->getFromDB($this->fields[$field]); + + //If dropdown is only accessible in the other entity + //do not go further + if (!$dropdown->isEntityAssign() + || in_array($new_entity, getAncestorsOf('glpi_entities', + $dropdown->getEntityID()))) { + continue; + } else { + $tmp = []; + $where = []; + if ($dropdown instanceof CommonTreeDropdown) { + $tmp['completename'] = $dropdown->fields['completename']; + $where['completename'] = Toolbox::addslashes_deep($tmp['completename']); + } else { + $tmp['name'] = $dropdown->fields['name']; + $where['name'] = Toolbox::addslashes_deep($tmp['name']); + } + $tmp['entities_id'] = $new_entity; + $where['entities_id'] = $tmp['entities_id']; + //There's a dropdown value in the target entity + if ($found = $dropdown->find($where)) { + $myfound = array_pop($found); + if ($myfound['id'] != $this->fields[$field]) { + $toupdate[$field] = $myfound['id']; + } + } else { + $clone = $dropdown->fields; + if ($dropdown instanceof CommonTreeDropdown) { + unset($clone['completename']); + } + unset($clone['id']); + $clone['entities_id'] = $new_entity; + $new_id = $dropdown->import($clone); + $toupdate[$field] = $new_id; + } + } + } + } + $this->update($toupdate); + } + return true; + } + + /** + * @since version 0.85 + * + * @see CommonDBTM::showMassiveActionsSubForm() + **/ + static function showMassiveActionsSubForm(MassiveAction $ma) { + global $GENINVENTORYNUMBER_TYPES; + + // KK TODO: check if MassiveAction itemtypes are concerned + //if (in_array ($options['itemtype'], $GENINVENTORYNUMBER_TYPES)) { + switch ($ma->action) { + case "plugin_genericobject_transfer" : + Dropdown::show('Entity', ['name' => 'new_entity']); + echo " "; + break; + default : + break; + } + //} + return true; + } + + function plugin_genericobject_MassiveActionsProcess($data) { + global $DB; + + switch ($data['action']) { + case 'plugin_genericobject_transfer': + $item = new $data['itemtype'](); + foreach ($data["item"] as $key => $val) { + if ($val == 1) { + $item->getFromDB($key); + $item->transfer($_POST['new_entity']); + } + } + break; + } + } + + static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, + array $ids) { + $results = [ + 'ok' => 0, + 'ko' => 0, + 'noright' => 0, + 'messages' => [] + ]; + + switch ($ma->action) { + case "plugin_genericobject_transfer" : + foreach ($ma->items as $itemtype => $val) { + foreach ($val as $key => $item_id) { + $item = new $itemtype; + $item->getFromDB($item_id); + $item->transfer($_POST['new_entity']); + $results['ok']++; + } + } + break; + + default : + break; + } + $ma->results=$results; + } + + static function getMenuContent() { + $types = PluginGenericobjectType::getTypes(); + foreach ($types as $type) { + + $itemtype = $type['itemtype']; + if (!class_exists($itemtype)) { + continue; + } + $item = new $itemtype(); + + $itemtype_rightname = PluginGenericobjectProfile::getProfileNameForItemtype($itemtype); + if (class_exists($itemtype) + && Session::haveRight($itemtype_rightname, READ)) { + + $links = []; + $links['search'] = $itemtype::getSearchUrl(false); + + if ($item->canUseTemplate()) { + $links['template'] = "/front/setup.templates.php?itemtype=$itemtype&add=0"; + if (Session::haveRight($itemtype_rightname, CREATE)) { + $links['add'] = "/front/setup.templates.php?itemtype=$itemtype&add=1"; + } + } else { + if (Session::haveRight($itemtype_rightname, CREATE)) { + $links['add'] = $itemtype::getFormUrl(false); + } + } + + if ($type['plugin_genericobject_typefamilies_id'] > 0 + && (!isset($_GET['itemtype']) + || !preg_match("/itemtype=".$_GET['itemtype']."/", $_GET['itemtype']))) { + $family_id = $type['plugin_genericobject_typefamilies_id']; + $name = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id, 0, false); + $str_name = strtolower($name); + $menu[$str_name]['title'] = Dropdown::getDropdownName("glpi_plugin_genericobject_typefamilies", $family_id); + $menu[$str_name]['page'] = '/'.Plugin::getWebDir('genericobject', false).'/front/familylist.php?id='.$family_id; + $menu[$str_name]['options'][strtolower($itemtype)] = [ + 'title' => $type['itemtype']::getMenuName(), + 'page' => $itemtype::getSearchUrl(false), + 'links' => $links + ]; + } else { + $menu[strtolower($itemtype)]= [ + 'title' => $type['itemtype']::getMenuName(), + 'page' => $itemtype::getSearchUrl(false), + 'links' => $links + ]; + } + } + } + + $menu['is_multi_entries']= true; + return $menu; + } + +} diff --git a/plugins/genericobject/inc/object_item.class.php b/plugins/genericobject/inc/object_item.class.php new file mode 100644 index 00000000..138c9666 --- /dev/null +++ b/plugins/genericobject/inc/object_item.class.php @@ -0,0 +1,128 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectObject_Item extends CommonDBChild { + + public $dohistory = true; + + // From CommonDBRelation + static public $itemtype_1 = "PluginGenericobjectObject"; + static public $items_id_1 = 'plugin_genericobject_objects_id'; + + static public $itemtype_2 = 'itemtype'; + static public $items_id_2 = 'items_id'; + + //Get itemtype name + static function getTypeName($nb = 0) { + global $LANG; + $class = get_called_class(); + //Datainjection : Don't understand why I need this trick : need to be investigated ! + if (preg_match("/Injection$/i", $class)) { + $class = str_replace("Injection", "", $class); + } + $item = new $class(); + //Itemtype name can be contained in a specific locale field : try to load it + PluginGenericobjectType::includeLocales($item->objecttype->fields['name']); + if (isset($LANG['genericobject'][$class][0])) { + return $LANG['genericobject'][$class][0]; + } else { + return $item->objecttype->fields['name']; + } + } + + static function canView() { + return Session::haveRight(self::$itemtype_1, READ); + } + + static function canCreate() { + return Session::haveRight(self::$itemtype_1, CREATE); + } + + /** + * + * Enter description here ... + * @since 2.2.0 + * @param CommonDBTM $item + */ + static function showItemsForSource(CommonDBTM $item) { + + } + + /** + * + * Enter description here ... + * @since 2.2.0 + * @param CommonDBTM $item + */ + static function showItemsForTarget(CommonDBTM $item) { + + } + + /** + * + * Enter description here ... + * @since 2.2.0 + */ + static function registerType() { + Plugin::registerClass(get_called_class(), ['addtabon' => self::getLinkedItemTypes()]); + } + + static function getLinkedItemTypes() { + $source_itemtype = self::getItemType1(); + $source_item = new $source_itemtype; + return $source_item->getLinkedItemTypesAsArray(); + } + + static function getItemType1() { + $classname = get_called_class(); + return $classname::$itemtype_1; + } + + function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { + if (!$withtemplate) { + $itemtypes = self::getLinkedItemTypes(); + if (in_array(get_class($item), $itemtypes) || get_class($item) == self::getItemType1()) { + return [1 => __("Objects management", "genericobject")]; + } + } + return ''; + } + + static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + $itemtypes = self::getLinkedItemTypes(); + if (get_class($item) == self::getItemType1()) { + self::showItemsForSource($item); + } else if (in_array(get_class($item), $itemtypes)) { + self::showItemsForTarget($item); + } + return true; + } + +} diff --git a/plugins/genericobject/inc/profile.class.php b/plugins/genericobject/inc/profile.class.php new file mode 100644 index 00000000..83375907 --- /dev/null +++ b/plugins/genericobject/inc/profile.class.php @@ -0,0 +1,450 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectProfile extends Profile { + + /* if profile deleted */ + function cleanProfiles($id) { + $this->deleteByCriteria(['id' => $id]); + } + + function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { + + switch ($item->getType()) { + case 'Profile': + return self::createTabEntry(__('Objects management', 'genericobject')); + break; + case 'PluginGenericobjectType': + return self::createTabEntry(_n('Profile', 'Profiles', 2)); + break; + } + } + + static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + switch ($item->getType()) { + case 'Profile': + $profile = new self(); + $profile->showForm($item->getID()); + break; + case 'PluginGenericobjectType': + _log($item); + self::showForItemtype($item); + break; + } + return true; + } + + static function showForItemtype($type) { + global $DB; + + if (!Session::haveRight("profile", READ)) { + return false; + } + self::installRights(); + $canedit = Session::haveRight("profile", UPDATE); + + echo ""; + echo ""; + $itemtype = $type->fields['itemtype']; + echo ""; + + echo ""; + echo ""; + + if ($canedit) { + echo ""; + echo ""; + } + + echo "
      "; + echo __("Rights assignment").": "; + echo $itemtype::getTypeName(); + echo "
      "; + foreach (getAllDataFromTable(getTableForItemtype("Profile")) as $profile) { + $prof = new Profile(); + $prof->getFromDB($profile['id']); + $rights = [ + [ + 'label' => $profile['name'], + 'itemtype' => $itemtype, + 'field' => self::getProfileNameForItemtype($itemtype), + 'html_field' => "profile_" . $profile['id'], + ] + ]; + $prof->displayRightsChoiceMatrix( + $rights + ); + } + + echo "
      "; + echo ""; + echo "
      "; + Html::closeForm(); + } + + static function getProfileNameForItemtype($itemtype) { + return preg_replace("/^glpi_/", "", getTableForItemType($itemtype)); + } + + + /* profiles modification */ + function showForm($profiles_id, $options = []) { + if (!Session::haveRight("profile", READ)) { + return false; + } + $canedit = Session::haveRight("profile", UPDATE); + //if ($id) { + // $this->getProfilesFromDB($id); + //} + + //Ensure rights are defined in database + self::installRights(); + + $profile = new Profile(); + $profile->getFromDB($profiles_id); + + echo ""; + echo ""; + + $general_rights = self::getGeneralRights(); + + $profile->displayRightsChoiceMatrix( + $general_rights, + [ + 'canedit' => $canedit, + 'default_class' => 'tab_bg_2', + 'title' => __('General', 'genericobject') + ] + ); + + $types_rights = self::getTypesRights(); + + $title = __('Objects', 'genericobject'); + if (count($types_rights) == 0) { + $title .= ' ' . __("(No types defined yet)", "genericobject"); + } + + $profile->displayRightsChoiceMatrix( + $types_rights, + [ + 'canedit' => $canedit, + 'default_class' => 'tab_bg_2', + 'title' => $title + ] + ); + $profile->showLegend(); + if ($canedit) { + echo "
      "; + echo Html::hidden('id', ['value' => $profiles_id]); + echo Html::submit(_sx('button', 'Save'), ['name' => 'update']); + echo "
      \n"; + Html::closeForm(); + } + echo ""; + + } + + static function getProfileforItemtype($profiles_id, $itemtype) { + $rights = ProfileRight::getProfileRights($profiles_id); + $itemtype_rightname = self::getProfileNameForItemtype($itemtype); + return isset($rights[$itemtype_rightname]) ? $rights[$itemtype_rightname] : 0; + } + + function getProfilesFromDB($id, $config = true) { + global $DB; + $prof_datas = []; + foreach (getAllDataFromTable(getTableForItemType(__CLASS__), + ['profiles_id' => $id]) as $prof) { + if ($prof['right'] != "" || $config) { + $prof_datas[$prof['itemtype']] = $prof['right']; + $prof_datas[$prof['itemtype'].'_open_ticket'] = $prof['open_ticket']; + $prof_datas['id'] = $prof['id']; + } + } + + if (empty($prof_datas) && !$config) { + return false; + } + + $prof_datas['profiles_id'] = $id; + $this->fields = $prof_datas; + + return true; + } + + function saveProfileToDB($params) { + global $DB; + + $types = PluginGenericobjectType::getTypes(true); + if (!empty ($types)) { + foreach ($types as $tmp => $profile) { + $query = "UPDATE `".getTableForItemType(__CLASS__)."` " . + "SET "; + + if (isset($params[$profile['itemtype']]) && $params[$profile['itemtype']] == 'NULL') { + $query.="`right`='' "; + } else { + if (isset($params[$profile['itemtype']])) { + $query.="`right`='".$params[$profile['itemtype']]."'"; + } else { + $query.="`right`=''"; + } + } + + if (isset($params[$profile['itemtype'].'_open_ticket'])) { + $query.=", `open_ticket`='".$params[$profile['itemtype'].'_open_ticket']."' "; + } + + $query.="WHERE `profiles_id`='".$params['profiles_id']."' " . + "AND `itemtype`='".$profile['itemtype']."'"; + $DB->query($query); + } + } + } + + + /** + * Create rights for the current profile + * @param profileID the profile ID + * @return nothing + */ + public static function createFirstAccess() { + if (!self::profileExists($_SESSION["glpiactiveprofile"]["id"], 'PluginGenericobjectType')) { + self::createAccess($_SESSION["glpiactiveprofile"]["id"], "PluginGenericobjectType", true); + } + } + + /** + * Check if rights for a profile still exists + * @param profiles_id the profile ID + * @param itemtype name of the type + * @return true if exists, no if not + */ + public static function profileExists($profiles_id, $itemtype = false) { + $profile = new Profile(); + $profile->getFromDB($profiles_id); + $rights = ProfileRight::getProfileRights($profiles_id); + $itemtype_rightname = self::getProfileNameForItemtype($itemtype); + if ($itemtype) { + _log( + "get rights on itemtype ".$itemtype." for profile ".$profile->fields['name'], ':', + isset($rights[$itemtype_rightname]) ? $rights[$itemtype_rightname] : "NONE" + ); + return (isset($rights[self::getProfileNameForItemtype($itemtype)])); + } + return true; + } + + /** + * Create rights for the profile if it doesn't exists + * @param profileID the profile ID + * @return nothing + */ + public static function createAccess($profiles_id, $itemtype, $first = false) { + + $rights = getAllDataFromTable('glpi_profiles'); + $profile_right = new ProfileRight(); + $itemtype_rightname = self::getProfileNameForItemtype($itemtype); + + foreach ($rights as $right) { + if ($right['id'] == $profiles_id) { + $r = ALLSTANDARDRIGHT | READNOTE | UPDATENOTE; + } else { + $r = 0; + } + $profile_right->updateProfileRights($right['id'], [$itemtype_rightname => $r]); + } + } + + public static function getGeneralRights() { + return [[ + 'itemtype' => 'PluginGenericobjectType', + 'label' => __("Type of objects", "genericobject"), + 'field' => self::getProfileNameForItemtype('PluginGenericobjectType'), + ]]; + } + + public static function getTypesRights() { + $rights = []; + + include_once(GENERICOBJECT_DIR."/inc/type.class.php"); + + $types = PluginGenericobjectType::getTypes(true); + if (count( $types) > 0) { + foreach ($types as $_ => $type) { + $itemtype = $type['itemtype']; + + if (!class_exists($itemtype)) { + continue; + } + + $field = self::getProfileNameForItemtype($itemtype); + $objecttype = new PluginGenericobjectType($itemtype); + $rights[] = [ + 'itemtype' => $itemtype, + 'label' => $itemtype::getTypeName(), + 'field' => self::getProfileNameForItemtype($itemtype) + ]; + } + } + + return $rights; + } + + public static function installRights($first = false) { + $missing_rights = []; + $installed_rights = ProfileRight::getAllPossibleRights(); + $right_names = []; + + // Add common plugin's rights + $right_names[] = self::getProfileNameForItemtype('PluginGenericobjectType'); + + // Add types' rights + $types = PluginGenericobjectType::getTypes(true); + foreach ($types as $_ => $type) { + $itemtype = $type['itemtype']; + $right_names[] = self::getProfileNameForItemtype($itemtype); + } + + // Check for already defined rights + foreach ($right_names as $right_name) { + _log($right_name, isset($installed_rights[$right_name])); + if (!isset($installed_rights[$right_name])) { + $missing_rights[] = $right_name; + } + } + + //Install missing rights in profile and update the object + if (count($missing_rights) > 0) { + ProfileRight::addProfileRights($missing_rights); + self::changeProfile(); + } + + } + + /** + * Delete type from the rights + * @param name the name of the type + * @return nothing + */ + public static function deleteTypeFromProfile($itemtype) { + $rights = [self::getProfileNameForItemtype($itemtype)]; + ProfileRight::deleteProfileRights($rights); + } + + public static function changeProfile() { + $general_rights = self::getGeneralRights(); + $type_rights = self::getTypesRights(); + $db_rights = ProfileRight::getProfileRights($_SESSION['glpiactiveprofile']['id']); + $rights = array_merge($general_rights, $type_rights); + + foreach ($rights as $right) { + $str_right = $right['field']; + if (preg_match("/plugin_genericobject_/", $str_right)) { + unset($_SESSION['glpiactiveprofile'][$str_right]); + if (!empty($db_rights) && isset($db_rights[$str_right])) { + $_SESSION['glpiactiveprofile'][$str_right] = $db_rights[$str_right]; + } + } + } + } + + static function install(Migration $migration) { + global $DB; + + $profileRight = new ProfileRight(); + $profile = new Profile(); + + //Update needed + if ($DB->tableExists('glpi_plugin_genericobject_profiles')) { + foreach (getAllDataFromTable('glpi_plugin_genericobject_profiles') as $right) { + if (preg_match("/PluginGenericobject(.*)/", $right['itemtype'], $results)) { + $newrightname = 'plugin_genericobject_'.strtolower($results[1]).'s'; + if (!countElementsInTable('glpi_profilerights', + ['profiles_id' => $right['profiles_id'], + 'name' => $newrightname])) { + switch ($right['right']) { + case null: + case '': + $rightvalue = 0; + break; + case 'r': + $rightvalue = READ; + break; + case 'w': + $rightvalue = ALLSTANDARDRIGHT; + break; + } + + $profileRight->add(['profiles_id' => $right['profiles_id'], + 'name' => $newrightname, + 'rights' => $rightvalue]); + + if (!countElementsInTable('glpi_profilerights', + ['profiles_id' => $right['profiles_id'], + 'name' => 'plugin_genericobject_types'])) { + $profileRight->add(['profiles_id' => $right['profiles_id'], + 'name' => 'plugin_genericobject_types', + 'rights' => 23]); + } + } + + if ($right['open_ticket']) { + $profile->getFromDB($right['profiles_id']); + $helpdesk_item_types = json_decode($profile->fields['helpdesk_item_type'], true); + if (is_array($helpdesk_item_types)) { + if (!in_array($right['itemtype'], $helpdesk_item_types)) { + $helpdesk_item_types[] = $right['itemtype']; + } + } else { + $helpdesk_item_types = [$right['itemtype']]; + } + + $tmp['id'] = $profile->getID(); + $tmp['helpdesk_item_type'] = json_encode($helpdesk_item_types); + $profile->update($tmp); + } + } + } + //$migration->dropTable('glpi_plugin_genericobject_profiles'); + } + if (!countElementsInTable('glpi_profilerights', ['name' => ['LIKE', '%genericobject%']])) { + self::createFirstAccess(); + } + } + + static function uninstall() { + global $DB; + $query = "DELETE FROM `glpi_profilerights` + WHERE `name` LIKE '%plugin_genericobject%'"; + $DB->query($query) or die($DB->error()); + } +} diff --git a/plugins/genericobject/inc/singletonobjectfield.class.php b/plugins/genericobject/inc/singletonobjectfield.class.php new file mode 100644 index 00000000..8ebe99ff --- /dev/null +++ b/plugins/genericobject/inc/singletonobjectfield.class.php @@ -0,0 +1,60 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +// ---------------------------------------------------------------------- +// Original Author of file: Walid Nouh +// Purpose of file: +// ---------------------------------------------------------------------- +if (!defined('GLPI_ROOT')) { + die("Sorry. You can't access directly to this file"); +} + +class PluginGenericobjectSingletonObjectField { + /// Items list + static $_dbfields = []; + + /** + * Singleton to store DB fields definition + * + * @since 2.1.0 + * @param itemtype itemtype to query + * @param reload reload db fields configuration from DB + * + * @return an array which contains DB fields definition + */ + public static function getInstance($itemtype, $reload = false) { + global $DB; + if (!isset(self::$_dbfields[$itemtype]) || $reload) { + self::$_dbfields[$itemtype] = $DB->listFields(getTableForItemType($itemtype)); + } + return self::$_dbfields[$itemtype]; + } +} + diff --git a/plugins/genericobject/inc/type.class.php b/plugins/genericobject/inc/type.class.php new file mode 100644 index 00000000..67787db2 --- /dev/null +++ b/plugins/genericobject/inc/type.class.php @@ -0,0 +1,2417 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +class PluginGenericobjectType extends CommonDBTM { + + const INACTIVE = 0; + const ACTIVE = 1; + + const DRAFT = 0; + const PUBLISHED = 1; + + const CLASS_TEMPLATE = "/objects/generic.class.tpl"; + const FORM_TEMPLATE = "/objects/generic.form.tpl"; + const CLASS_DROPDOWN_TEMPLATE = "/objects/generic.dropdown.class.tpl"; + const FRONTFORM_DROPDOWN_TEMPLATE = "/objects/front.form.tpl"; + const FRONT_DROPDOWN_TEMPLATE = "/objects/front.tpl"; + const SEARCH_TEMPLATE = "/objects/front.tpl"; + const AJAX_DROPDOWN_TEMPLATE = "/objects/dropdown.tabs.tpl"; + const AJAX_TEMPLATE = "/objects/ajax.tabs.tpl"; + const LOCALE_TEMPLATE = "/objects/locale.tpl"; + const OBJECTINJECTION_TEMPLATE = "/objects/objectinjection.class.tpl"; + const OBJECTITEM_TEMPLATE = "/objects/object_item.class.tpl"; + + const CAN_OPEN_TICKET = 1024; + + var $dohistory = true; + + static $rightname = 'plugin_genericobject_types'; + + + function __construct($itemtype = false) { + if ($itemtype) { + $this->getFromDBByType($itemtype); + } + } + + function isEntityAssign() { + return false; + } + + static function getTypeName($nb = 0) { + return __("Type of objects", "genericobject"); + } + + static function &getInstance($itemtype, $refresh = false) { + static $singleton = []; + if (!isset($singleton[$itemtype]) ||$refresh) { + $singleton[$itemtype] = new self($itemtype); + } + return $singleton[$itemtype]; + } + + + function getFromDBByType($itemtype) { + global $DB; + + $query = "SELECT * FROM `" . getTableForItemType(__CLASS__) . "` " . + "WHERE `itemtype`='$itemtype'"; + $result = $DB->query($query); + if ($DB->numrows($result) > 0) { + $this->fields = $DB->fetchArray($result); + } else { + $this->getEmpty(); + } + } + + + //------------------------------------ Tabs management ----------------------------------- + function defineTabs($options = []) { + $tabs = []; + $this->addStandardTab(__CLASS__, $tabs, $options); + return $tabs; + } + + function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { + if (!$withtemplate) { + switch ($item->getType()) { + case __CLASS__ : + // Number of fields in database + $itemtype = $item->fields['itemtype']; + $nb_fields = 0; + if (class_exists($itemtype)) { + $obj = new $itemtype(); + $obj->getEmpty(); + $nb_fields = count($obj->fields); + } + + $tabs = [ + 1 => __("Main"), + 3 => _n("Field", "Fields", 2), + 3 => self::createTabEntry(_n("Field", "Fields", Session::getPluralNumber()), $nb_fields), + 5 => __("Preview") + ]; + if ($item->canUseDirectConnections()) { + $tabs[7] = __("Associated element"); + } + return $tabs; + } + } + return ''; + + } + + static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + if ($item->getType() == __CLASS__) { + switch ($tabnum) { + case 1 : + $item->showBehaviorForm($item->getID()); + break; + + case 3: + PluginGenericobjectField::showObjectFieldsForm($item->getID()); + break; + + case 5: + PluginGenericobjectObject::showPrevisualisationForm($item); + break; + + case 6: + PluginGenericobjectProfile::showForItemtype($item); + break; + } + } + return true; + } + //------------------------------------- End tabs management ------------------------------ + + //------------------------------------- Framework hooks ---------------------------------- + function prepareInputForAdd($input) { + //Name must not be empty + if (isset($input['name']) && $input['name'] == '') { + Session::addMessageAfterRedirect(__("Type name is missing", "genericobject"), ERROR, true); + return []; + } + + // Name must be more than 1 char + if (isset($input['name']) && strlen($input['name']) < 2) { + Session::addMessageAfterRedirect(__("Type name must be longer", "genericobject"), ERROR, true); + return []; + } + + //Name must not match specific names + if (in_array($input['name'], ['field', 'object', 'type'])) { + Session::addMessageAfterRedirect(__("Types 'field', 'object' and 'type' are reserved. Please choose another one", + "genericobject"), ERROR, true); + return []; + } + + //Name must start with a letter + if (!preg_match("/^[a-zA-Z]+/i", $input['name'])) { + Session::addMessageAfterRedirect(__("Type must start with a letter", "genericobject"), ERROR, true); + return []; + } + $input['name'] = self::filterInput($input['name']); + + //Name must not be present in DB + if (countElementsInTable(getTableForItemType(__CLASS__), ['name' => $input['name']])) { + Session::addMessageAfterRedirect(__("A type already exists with the same name", "genericobject"), ERROR, true); + return []; + } else { + $input['itemtype'] = self::getClassByName($input['name']); + return $input; + } + } + + function post_addItem() { + self::addNewObject( + $this->input["name"], + $this->input["itemtype"], + ['add_table' => 1, 'create_default_profile' => 1, 'overwrite_locales' => true] + ); + return true; + } + + function prepareInputForUpdate($input) { + //If itemtype is active : register it ! + if (isset ($input["is_active"]) && $input["is_active"]) { + self::registerOneType($this->fields['itemtype']); + } + return $input; + } + + function post_updateItem($history = 1) { + //Check if some fields need to be added, because of GLPI framework + $this->checkNecessaryFieldsUpdate(); + } + + function pre_deleteItem() { + if ($this->getFromDB($this->fields["id"])) { + $name = $this->fields['name']; + $itemtype = $this->fields['itemtype']; + + //Delete all network ports + self::deleteNetworking($itemtype); + + //Drop all dropdowns associated with itemtype + self::deleteDropdownsForItemtype($itemtype); + + //Delete loans associated with this type + self::deleteLoans($itemtype); + + //Delete loans associated with this type + self::deleteUnicity($itemtype); + + //Delete reservations with this tyoe + self::deleteReservations($itemtype); + self::deleteReservationItems($itemtype); + + //Remove datainjection specific file + self::deleteInjectionFile($name); + + //Delete profile informations associated with this type + PluginGenericobjectProfile::deleteTypeFromProfile($itemtype); + + self::deleteTicketAssignation($itemtype); + + //Remove associations to simcards with this type + self::deleteSimcardAssignation($itemtype); + + //Remove existing datainjection models + self::removeDataInjectionModels($itemtype); + + //Delete specific locale directory + self::deleteLocales($name, $itemtype); + + self::deleteItemtypeReferencesInGLPI($itemtype); + + self::deleteItemTypeFilesAndClasses($name, $this->getTable(), $itemtype); + + //self::deleteNotepad($itemtype); + + if (preg_match("/PluginGenericobject(.*)/", $itemtype, $results)) { + $newrightname = 'plugin_genericobject_'.strtolower($results[1]).'s'; + ProfileRight::deleteProfileRights([$newrightname]); + } + + $prof = new Profile(); + $profiles = getAllDataFromTable('glpi_profiles'); + foreach ($profiles as $profile) { + $helpdesk_item_types = json_decode($profile['helpdesk_item_type'], true); + if ($helpdesk_item_types !== null) { + $index = array_search($itemtype, $helpdesk_item_types); + if ($index) { + unset($helpdesk_item_types[$index]); + $tmp['id'] = $profile['id']; + $tmp['helpdesk_item_type'] = json_encode($helpdesk_item_types); + $prof->update($tmp); + } + } + } + + return true; + } else { + return false; + } + + } + + public function post_deleteItem() { + + } + + function rawSearchOptions() { + $sopt = []; + + $sopt[] = [ + 'id' => 'common', + 'name' => __("Objects management", "genericobject"), + ]; + + $sopt[] = [ + 'id' => 1, + 'table' => $this->getTable(), + 'field' => 'name', + 'name' => __('Model'), + 'datatype' => 'itemlink', + 'autocomplete' => true, + ]; + + $sopt[] = [ + 'id' => 5, + 'table' => $this->getTable(), + 'field' => 'is_active', + 'name' => __('Active'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 6, + 'table' => $this->getTable(), + 'field' => 'use_tickets', + 'name' => __('Associable to a ticket'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 9, + 'table' => $this->getTable(), + 'field' => 'use_history', + 'name' => _sx('button', 'Use') . ' ' . __('Historical'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 13, + 'table' => $this->getTable(), + 'field' => 'use_infocoms', + 'name' => _sx('button', 'Use') . ' ' . __('Financial and administratives information'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 14, + 'table' => $this->getTable(), + 'field' => 'use_documents', + 'name' => _sx('button', 'Use') . ' ' . _n('Document', 'Documents', 2), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 15, + 'table' => $this->getTable(), + 'field' => 'use_loans', + 'name' => _sx('button', 'Use') . ' ' . _n('Reservation', 'Reservations', 2), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 16, + 'table' => $this->getTable(), + 'field' => 'use_contracts', + 'name' => _sx('button', 'Use') . ' ' . _n('Contract', 'Contracts', 2), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 17, + 'table' => $this->getTable(), + 'field' => 'use_unicity', + 'name' => _sx('button', 'Use') . ' ' . __('Fields unicity'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 18, + 'table' => $this->getTable(), + 'field' => 'use_global_search', + 'name' => __('Global search'), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 19, + 'table' => 'glpi_plugin_genericobject_typefamilies', + 'field' => 'name', + 'name' => __('Family of type of objects', 'genericobject'), + 'datatype' => 'dropdown', + ]; + + $sopt[] = [ + 'id' => 20, + 'table' => $this->getTable(), + 'field' => 'use_projects', + 'name' => _n('Project', 'Projects', 2), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 21, + 'table' => $this->getTable(), + 'field' => 'date_mod', + 'name' => __('Last update'), + 'datatype' => 'datetime', + 'massiveaction' => false, + ]; + + $sopt[] = [ + 'id' => 22, + 'table' => $this->getTable(), + 'field' => 'use_itemdevices', + 'name' => _sx('button', 'Use') . ' ' . _n('Component', 'Components', 2), + 'datatype' => 'bool', + ]; + + $sopt[] = [ + 'id' => 121, + 'table' => $this->getTable(), + 'field' => 'date_creation', + 'name' => __('Creation date'), + 'datatype' => 'datetime', + 'massiveaction' => false, + ]; + + return $sopt; + } + + /** + * Define name of type to display in menu + * + * @return type name + */ + static function getMenuName() { + return __('Objects management', 'genericobject'); + } + + //------------------------------------- End Framework hooks ----------------------------- + + //------------------------------------- Forms ------------------------------------------- + function showForm($ID, $options = []) { + + if ($ID > 0) { + $this->check($ID, READ); + } else { + // Create item + $this->check(-1, CREATE); + $this->getEmpty(); + } + + $this->initForm($ID); + + $item = new self(); + //I know this is REALLY ugly... + if ($ID == 0) { + $item->showBehaviorForm($ID); + } + + return true; + } + + function showBehaviorForm($ID, $options = []) { + if ($ID > 0) { + $this->check($ID, READ); + } else { + // Create item + $this->check($ID, CREATE); + $use_cache = false; + $this->getEmpty(); + } + + $this->fields['id'] = $ID; + + $right_name = PluginGenericobjectProfile::getProfileNameForItemtype( + __CLASS__ + ); + + $canedit = Session::haveRight($right_name, UPDATE); + + self::includeLocales($this->fields["name"]); + self::includeConstants($this->fields["name"]); + + $this->showFormHeader($options); + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + echo ""; + + echo ""; + echo ""; + echo ""; + + if (!$this->isNewID($ID)) { + $canedit = $this->can($ID, CREATE); + echo ""; + + $use = [ + "use_recursivity" => __("Child entities"), + "use_tickets" => __("Assistance"), + "use_deleted" => __("Item in the dustbin"), + "use_notepad" => _n('Note', 'Notes', 2), + "use_history" => __("Historical"), + "use_template" => __("Templates"), + "use_infocoms" => __("Financial and administratives information"), + "use_contracts" => _n("Contract", "Contracts", 2), + "use_documents" => _n("Document", "Documents", 2), + "use_loans" => _n("Reservation", "Reservations", 2), + // Disable unicity feature; see #16 + // Related code : search for #16 + "use_unicity" => __("Fields unicity"), + "use_global_search" => __("Global search"), + "use_projects" => _n("Project", "Projects", 2), + "use_network_ports" => __("Network connections", "genericobject"), + "use_itemdevices" => _n('Component', 'Components', 2), + ]; + + $plugins = [ + "use_plugin_datainjection" => __("injection file plugin", "genericobject"), + //"use_plugin_pdf" => __("PDF plugin", "genericobject"), + "use_plugin_geninventorynumber" => __("geninventorynumber plugin", "genericobject"), + "use_plugin_order" => __("order plugin", "genericobject"), + "use_plugin_uninstall" => __("item's uninstallation plugin", "genericobject"), + "use_plugin_simcard" => __("simcard plugin", "genericobject"), + "use_plugin_treeview" => __("treeview plugin", "genericobject"), + ]; + + $plugin = new Plugin(); + $odd = 0; + foreach ($use as $right => $label) { + if (!$odd) { + echo ""; + } + echo ""; + echo ""; + if ($odd == 1) { + $odd = 0; + echo ""; + } else { + $odd++; + } + } + if ($odd != 0) { + echo ""; + } + + echo ""; + $odd=0; + foreach ($plugins as $right => $label) { + if (!$odd) { + echo ""; + } + echo ""; + echo ""; + if ($odd == 1) { + $odd = 0; + echo ""; + } else { + $odd++; + } + } + if ($odd != 0) { + echo ""; + } + + } + + $this->showFormButtons($options); + } + + /** + * + * Show a form with a button to regenerate all files + * @since 2.2.0 + * @param $ID type ID + * @return nothing + */ + function showFilesForm() { + echo ""; + echo "
      "; + echo "
      " . __("Internal identifier", "genericobject") . ""; + if (!$ID) { + Html::autocompletionTextField($this, 'name', ['value' => $this->fields["name"]]); + } else { + echo ""; + echo $this->fields["name"]; + } + + echo "
      " . __("Label") . ""; + if ($ID) { + $itemtype = $this->fields["itemtype"]; + echo $itemtype::getTypeName(); + } + echo "".__("Comments")." :
      ".__("Active").""; + if (!$ID) { + echo __("No"); + } else { + Dropdown::showYesNo("is_active", $this->fields["is_active"]); + } + echo "
      ".__("Family of type of objects", 'genericobject').""; + PluginGenericobjectTypeFamily::dropdown([ + 'value' => $this->fields["plugin_genericobject_typefamilies_id"] + ]); + echo "
      "; + echo __("Behaviour", "genericobject"); + echo "
      " . _sx('button', 'Use') . " " . $label . ""; + + switch ($right) { + case 'use_deleted': + Html::showCheckbox(['name' => $right, + 'checked' => $this->canBeDeleted()]); + break; + + case 'use_recursivity': + Html::showCheckbox(['name' => $right, + 'value' => $this->canBeRecursive(), + 'checked' => $this->canBeRecursive()]); + break; + + case 'use_notes': + Html::showCheckbox(['name' => $right, + 'checked' => $this->canUseNotepad()]); + break; + + case 'use_template': + Html::showCheckbox(['name' => $right, + 'checked' => $this->canUseTemplate()]); + break; + + default : + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + break; + } + echo "
      "; + echo _n("Plugin", "Plugins", 2); + echo "
      " . _sx('button', 'Use') . " " . $label . ""; + switch ($right) { + case 'use_plugin_datainjection' : + if ($plugin->isActivated('datainjection')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + + case 'use_plugin_pdf' : + if ($plugin->isActivated('pdf')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + + case 'use_plugin_order' : + if ($plugin->isActivated('order')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + + case 'use_plugin_uninstall' : + if ($plugin->isActivated('uninstall')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + + case 'use_plugin_simcard' : + if ($plugin->isActivated('simcard')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + case 'use_plugin_treeview' : + if ($plugin->isActivated('treeview')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + + break; + case 'use_plugin_geninventorynumber' : + if ($plugin->isActivated('geninventorynumber')) { + Html::showCheckbox(['name' => $right, + 'checked' => $this->fields[$right]]); + } else { + echo Dropdown::EMPTY_VALUE; + echo "\n"; + } + break; + } + echo "
      "; + echo ""; + echo "
      "; + echo ""; + echo ""; + echo "
      "; + Html::closeForm(); + } + + function showLinkedTypesForm() { + global $GO_LINKED_TYPES; + + $this->showFormHeader(); + echo ""; + echo "
      "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + $this->showFormButtons(['candel' => false, 'canadd' => false]); + Html::closeForm(); + + } + //------------------------------------- End Forms -------------------------------------- + + /** + * Create an object, it's table, files and rights + * + * @since 2.1.5 + * @param name object short name + * @param itemtype object class name + * @param options create options : + * - add_table : add the object table (default is no) + * - create_default_profile : add default right (default is no) for current user profile + * - add_injection_file : add file to integrate itemtype into the datainjection plugin + * - add_language_file : create a default language for the itemtype + * @return none + */ + static function addNewObject($name, $itemtype, $options = []) { + $params['add_table'] = false; + $params['create_default_profile'] = false; + $params['add_injection_file'] = false; + $params['add_language_file'] = true; + $params['overwrite_locales'] = false; + + foreach ($options as $key => $value) { + $params[$key] = $value; + } + + if ($params['add_table']) { + self::addTable($itemtype); + } + + //Write object class on the filesystem + self::addClassFile($name, $itemtype); + + //Write the form on the filesystem + self::addFormFile($name, $itemtype); + self::addSearchFile($name, $itemtype); + + if ($params['overwrite_locales']) { + //Add language file + self::addLocales($name, $itemtype); + } + + //Add file needed by datainjectin plugin + if ($params['add_injection_file']) { + self::addDatainjectionFile($name); + } + PluginGenericobjectProfile::installRights(); + if ($params['create_default_profile']) { + //Create rights for this new object + PluginGenericobjectProfile::createAccess($_SESSION["glpiactiveprofile"]["id"], $itemtype, true); + //Reload profiles + PluginGenericobjectProfile::changeProfile(); + } + } + + /** + * + * Add a new dropdown :class & files + * @param string $name + * @param string $itemtype + * @param array $options + */ + static function addNewDropdown($name, $itemtype, $options = []) { + $params['entities_id'] = false; + $params['is_recursive'] = false; + $params['is_tree'] = false; + $params['linked_itemtype'] = false; + foreach ($options as $key => $value) { + $params[$key] = $value; + } + //Add files on the disk + self::addDropdownClassFile($name, $itemtype, $params); + self::addDropdownTable(getTableForItemType($itemtype), $params); + self::addDropdownFrontFile($name); + self::addDropdownFrontformFile($name); + + // Invalidate submenu data in current session + unset($_SESSION['glpimenu']); + } + + /** + * + * Add or delete, if needed some fields to make sure that the itemtype is compatible with + * GLPI framework + */ + function checkNecessaryFieldsUpdate() { + global $DB; + + $itemtype = $this->fields["itemtype"]; + $item = new $itemtype(); + $item->getEmpty(); + $table = getTableForItemType($itemtype); + + //Global search (inventory > status) + if (isset($this->input['use_global_search']) && $this->input['use_global_search']) { + PluginGenericobjectField::addNewField($table, 'serial', 'name'); + PluginGenericobjectField::addNewField($table, 'otherserial', 'serial'); + PluginGenericobjectField::addNewField($table, 'locations_id', 'otherserial'); + PluginGenericobjectField::addNewField($table, 'states_id', 'locations_id'); + PluginGenericobjectField::addNewField($table, 'users_id', 'states_id'); + PluginGenericobjectField::addNewField($table, 'groups_id', 'users_id'); + PluginGenericobjectField::addNewField($table, 'manufacturers_id', 'groups_id'); + PluginGenericobjectField::addNewField($table, 'users_id_tech', 'manufacturers_id'); + PluginGenericobjectField::addNewField($table, 'is_deleted', 'id'); + } + + if (isset($this->input['use_recursivity']) && $this->input['use_recursivity']) { + PluginGenericobjectField::addNewField($table, 'is_recursive', 'entities_id'); + } else { + PluginGenericobjectField::deleteField($table, 'is_recursive'); + } + + //Template + if (isset($this->input['use_template']) && $this->input['use_template']) { + PluginGenericobjectField::addNewField($table, 'is_template', 'id'); + PluginGenericobjectField::addNewField($table, 'template_name', 'is_template'); + } else { + PluginGenericobjectField::deleteField($table, 'is_template'); + PluginGenericobjectField::deleteField($table, 'template_name'); + } + + //Trash + if (isset($this->input['use_deleted']) && $this->input['use_deleted']) { + PluginGenericobjectField::addNewField($table, 'is_deleted', 'id'); + } else { + if (!$this->canBeReserved()) { + PluginGenericobjectField::deleteField($table, 'is_deleted'); + } else { + _log($DB->fieldExists($table, 'is_deleted')); + if ($DB->fieldExists($table, 'is_deleted')) { + Session::addMessageAfterRedirect( + __("Dustbin can't be removed since Reservations are used on this type."), + false, + WARNING + ); + } + } + } + + //Reservation needs is_deleted field ! + if ($this->canBeReserved()) { + PluginGenericobjectField::addNewField($table, 'is_deleted', 'id'); + PluginGenericobjectField::addNewField($table, 'locations_id'); + PluginGenericobjectField::addNewField($table, 'users_id'); + } + + //Helpdesk post-only + if ($this->canUseTickets()) { + //TODO rename is_helpdesk_visible into is_helpdeskvisible + PluginGenericobjectField::addNewField($table, 'is_helpdesk_visible', 'comment'); + } else { + PluginGenericobjectField::deleteField($table, 'is_helpdesk_visible'); + } + + //Notes + if (isset($this->input['use_notepad']) && $this->input['use_notepad']) { + PluginGenericobjectField::addNewField($table, 'notepad', 'id'); + } else { + PluginGenericobjectField::deleteField($table, 'notepad'); + } + + //Networkport + if ($this->canUseNetworkPorts()) { + PluginGenericobjectField::addNewField($table, 'locations_id'); + } + + if ($this->canUseDirectConnections()) { + self::addItemsTable($itemtype); + //self::addItemClassFile($this->fields['name'], $itemtype); + } else { + self::deleteItemsTable($itemtype); + self::deleteClassFile($this->fields['name']."_item"); + } + + if ($this->canUsePluginDataInjection() && + !file_exists(self::getCompleteInjectionFilename($this->fields['name']))) { + self::addDatainjectionFile($this->fields['name']); + } + + if (!$this->canUsePluginDataInjection() && + file_exists(self::getCompleteInjectionFilename($this->fields['name']))) { + self::deleteInjectionFile($this->fields['name']); + } + + //Device item needs locations_id field ! + if ($this->canUseItemDevice()) { + PluginGenericobjectField::addNewField($table, 'locations_id'); + } + } + + + /** + * Add object type table + entries in glpi_display + * @name object type's name + * @return nothing + */ + public static function addTable($itemtype) { + global $DB; + $query = "CREATE TABLE IF NOT EXISTS `".getTableForItemType($itemtype)."` ( + `id` INT( 11 ) NOT NULL AUTO_INCREMENT, + `entities_id` INT( 11 ) NOT NULL DEFAULT '0', + `name` VARCHAR( 255 ) collate utf8_unicode_ci NOT NULL DEFAULT '', + `comment` text COLLATE utf8_unicode_ci, + `notepad` text COLLATE utf8_unicode_ci, + `date_mod` TIMESTAMP NULL DEFAULT NULL, + `date_creation` TIMESTAMP NULL DEFAULT NULL, + PRIMARY KEY ( `id` ), + KEY `date_mod` (`date_mod`), + KEY `date_creation` (`date_creation`) + ) ENGINE = InnoDB COMMENT = '$itemtype' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $DB->query($query); + + $query = "INSERT INTO `glpi_displaypreferences` (`id`, `itemtype`, `num`, `rank`, `users_id`) " . + "VALUES (NULL, '$itemtype', '2', '1', '0');"; + $DB->query($query); + + } + + /** + * Add object_items table to connect an object to others + * @name object type's name + * @return nothing + */ + public static function addItemsTable($itemtype) { + global $DB; + $table = getTableForItemType($itemtype); + $fk = getForeignKeyFieldForTable($table); + $query = "CREATE TABLE IF NOT EXISTS `".getTableForItemType($itemtype)."_items` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `items_id` int(11) NOT NULL DEFAULT '0' COMMENT 'RELATION to various table, according to itemtype (ID)', + `date_mod` TIMESTAMP NULL DEFAULT NULL, + `date_creation` TIMESTAMP NULL DEFAULT NULL, + `$fk` int(11) NOT NULL DEFAULT '0', + `itemtype` varchar(100) COLLATE utf8_unicode_ci NOT NULL, + PRIMARY KEY (`id`), + KEY `$fk` (`$fk`), + KEY `date_mod` (`date_mod`), + KEY `date_creation` (`date_creation`), + KEY `item` (`itemtype`,`items_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $DB->query($query); + } + + + //-------------------------------- FILE CREATION / DELETION ----------------------------// + public static function deleteFile($filename) { + if (file_exists($filename)) { + unlink($filename); + } + } + + + static function getCompleteClassFilename($name) { + return GENERICOBJECT_CLASS_PATH . "/".self::getSystemName($name).".class.php"; + } + + + static function getCompleteItemClassFilename($name) { + return GENERICOBJECT_CLASS_PATH . "/".self::getSystemName($name)."_item.class.php"; + } + + + static function getCompleteFormFilename($name) { + return GENERICOBJECT_FRONT_PATH . "/".self::getSystemName($name).".form.php"; + } + + + static function getCompleteSearchFilename($name) { + return GENERICOBJECT_FRONT_PATH . "/".self::getSystemName($name).".php"; + } + + + static function getCompleteAjaxTabFilename($name) { + return GENERICOBJECT_AJAX_PATH . "/".self::getSystemName($name).".tabs.php"; + } + + + static function getCompleteInjectionFilename($name) { + return GENERICOBJECT_CLASS_PATH . "/".self::getSystemName($name).".injection.class.php"; + } + + + static function getCompleteConstantFilename($name) { + return GENERICOBJECT_FIELDS_PATH . "/".self::getSystemName($name).".constant.php"; + } + + + /** + * Delete an used form file + * @param name the name of the object type + * @return nothing + */ + public static function deleteFormFile($name) { + self::deleteFile(self::getCompleteFormFilename($name)); + } + + + public static function deleteSearchFile($name) { + self::deleteFile(self::getCompleteSearchFilename($name)); + } + + + public static function deleteAjaxFile($name) { + self::deleteFile(self::getCompleteAjaxTabFilename($name)); + } + + + /** + * Delete an used class file + * @param name the name of the object type + * @return nothing + */ + public static function deleteClassFile($name) { + self::deleteFile(self::getCompleteClassFilename($name)); + } + + + public static function deleteInjectionFile($name) { + self::deleteFile(self::getCompleteInjectionFilename($name)); + } + + + public static function addLocales($name, $itemtype) { + global $CFG_GLPI; + + $fsname = self::getSystemName($name); + + $locale_dir = GENERICOBJECT_LOCALES_PATH."/".$fsname; + if (!is_dir($locale_dir)) { + @ mkdir($locale_dir, 0755, true); + } + + $locale_files = [ + $fsname . '.' . $_SESSION['glpilanguage'], + ]; + if ($CFG_GLPI['language'] != $_SESSION['glpilanguage']) { + $locale_files[] = $fsname . '.' . $CFG_GLPI['language']; + } + + foreach ($locale_files as $locale_file) { + self::addFileFromTemplate( + [ + 'NAME' => $name, + 'CLASSNAME' => self::getClassByName($name), + ], + self::LOCALE_TEMPLATE, + $locale_dir, + $locale_file + ); + } + } + + + public static function deleteLocales($name, $itemtype) { + $locale_dir = GENERICOBJECT_LOCALES_PATH."/".self::getSystemName($name); + if (file_exists($locale_dir)) { + foreach (glob($locale_dir.'/*.php') as $file) { + @unlink($file); + } + @rmdir($locale_dir); + } + } + + + public static function addFileFromTemplate($mappings, $template, $directory, + $filename) { + if (!empty($mappings)) { + $file_read = @fopen(GENERICOBJECT_DIR.$template, "rt"); + if ($file_read) { + $template_file = fread($file_read, filesize(GENERICOBJECT_DIR.$template)); + foreach ($mappings as $name => $value) { + $template_file = str_replace("%%$name%%", $value, $template_file); + } + fclose($file_read); + $file_write = @fopen($directory . "/".$filename.".php", "w"); + if ($file_write) { + fwrite($file_write, $template_file); + fclose($file_write); + } + } + } + } + + + public static function addDatainjectionFile($name) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name), + 'INJECTIONCLASS' => self::getClassByName($name)."Injection"], + self::OBJECTINJECTION_TEMPLATE, GENERICOBJECT_CLASS_PATH, + self::getSystemName($name)."injection.class"); + } + + + public static function addDropdownFrontFile($name) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::FRONT_DROPDOWN_TEMPLATE, GENERICOBJECT_FRONT_PATH, + self::getSystemName($name)); + } + + + public static function addAjaxFile($name, $field) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::AJAX_TEMPLATE, GENERICOBJECT_AJAX_PATH, + self::getSystemName($name).".tabs"); + } + + + public static function addDropdownFrontformFile($name) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::FRONTFORM_DROPDOWN_TEMPLATE, GENERICOBJECT_FRONT_PATH, + self::getSystemName($name).".form"); + } + + + public static function addDropdownClassFile($name, $field, $options) { + $params['is_tree'] = false; + $params['realname'] = false; + $params['linked_itemtype'] = false; + foreach ($options as $key => $value) { + $params[$key] = $value; + } + self::addFileFromTemplate([ + 'CLASSNAME' => self::getClassByName($name), + 'EXTENDS' => + 'PluginGenericobject' . ($params['is_tree']?'CommonTree':'Common') . 'Dropdown', + 'FIELDNAME' => $params['realname'], + 'LINKED_ITEMTYPE' => $params['linked_itemtype'] + ], self::CLASS_DROPDOWN_TEMPLATE, GENERICOBJECT_CLASS_PATH, self::getSystemName($name).".class"); + } + + + /** + * Write on the the class file for the new object type + * @param name the name of the object type + * @param classname the name of the new object + * @param itemtype the object device type + * @return nothing + */ + public static function addClassFile($name, $classname) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::CLASS_TEMPLATE, GENERICOBJECT_CLASS_PATH, + self::getSystemName($name).".class"); + } + + /** + * Write on the the _Item class file for the new object type + * @param name the name of the object type + * @param classname the name of the new object + * @param itemtype the object device type + * @return nothing + */ + public static function addItemClassFile($name, $classname) { + $class = self::getClassByName($name)."_Item"; + self::addFileFromTemplate(['CLASSNAME' => $class, + 'FOREIGNKEY' => getForeignKeyFieldForItemType($classname), + 'SOURCEOBJECT' => $classname], + self::OBJECTITEM_TEMPLATE, GENERICOBJECT_CLASS_PATH, + self::getSystemName($name)."_item.class"); + } + + /** + * Write on the the form file for the new object type + * @param name the name of the object type + * @param classname the name of the new object + * @param itemtype the object device type + * @return nothing + */ + public static function addFormFile($name, $classname) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::FORM_TEMPLATE, GENERICOBJECT_FRONT_PATH, + self::getSystemName($name).".form"); + } + + + /** + * Write on the the form file for the new object type + * @param name the name of the object type + * @param classname the name of the new object + * @param itemtype the object device type + * @return nothing + */ + public static function addSearchFile($name, $classname) { + self::addFileFromTemplate(['CLASSNAME' => self::getClassByName($name)], + self::SEARCH_TEMPLATE, GENERICOBJECT_FRONT_PATH, + self::getSystemName($name)); + } + + + /** + * Create, if needed files for an itemtype and it's dropdown + * + * @since 2.2.0 + * + * @return void + */ + static function checkClassAndFilesForItemType() { + global $DB; + + foreach (self::getTypes(true) as $type) { + //ensure old files has been removed, + $fsname = self::getSystemName($type['name']); + if (file_exists(GENERICOBJECT_DIR . "/inc/{$fsname}.class.php")) { + unlink(GENERICOBJECT_DIR . "/inc/{$fsname}.class.php"); + } + if (file_exists(GENERICOBJECT_DIR . "/front/{$fsname}.form.php")) { + unlink(GENERICOBJECT_DIR . "/front/{$fsname}.form.php"); + } + if (file_exists(GENERICOBJECT_DIR . "/front/{$fsname}.php")) { + unlink(GENERICOBJECT_DIR . "/front/{$fsname}.form.php"); + } + if (file_exists(GENERICOBJECT_DIR . "/ajax/{$fsname}.tabs.php")) { + unlink(GENERICOBJECT_DIR . "/ajax/{$fsname}.tabs.php"); + } + if (file_exists(GENERICOBJECT_DIR . "/inc/{$fsname}.injection.class.php")) { + unlink(GENERICOBJECT_DIR . "/inc/{$fsname}.injection.class.php"); + } + + self::checkClassAndFilesForOneItemType($type['itemtype'], $type['name'], true, false); + } + } + + /** + * + * Create or overwrite files for an itemtype + * @since 2.2.0 + * @param $itemtype the itemtype to check + * @param $name type's short name + * @param $overwrite force to overwrite existing files + * @return nothing + */ + static function checkClassAndFilesForOneItemType($itemtype, $name, $overwrite = false, $overwrite_locales = true) { + global $DB; + $table = getTableForItemType($itemtype); + + //If class doesn't exist but table exists, create class + if ($DB->tableExists($table) && ($overwrite || !class_exists($itemtype))) { + self::addNewObject($name, $itemtype, ['add_table' => false, + 'create_default_profile' => false, + 'add_injection_file' => $overwrite, + 'add_language_file' => false, + 'overwrite_locales' => $overwrite_locales ]); + } + + foreach ($DB->listFields($table) as $field => $options) { + if (preg_match("/s_id$/", $field)) { + $dropdowntable = getTableNameForForeignKeyField($field); + $dropdownclass = getItemTypeForTable($dropdowntable); + + if ($DB->tableExists($dropdowntable) && ! class_exists($dropdownclass)) { + $name = str_replace("glpi_plugin_genericobject_", "", $dropdowntable); + $name = getSingular($name); + $params= PluginGenericobjectField::getFieldOptions($field, $dropdownclass); + if (isset($params['dropdown_type']) + and $params['dropdown_type'] === 'isolated' + ) { + $params['linked_itemtype'] = $itemtype; + } + self::addNewDropdown($name, self::getClassByName($name), $params); + } + } + } + } + + /** + * + * Delete all files and classes for an itemtype (including dropdowns) + * @since 2.2.0 + * @param unknown_type $name file name + */ + static function deleteItemTypeFilesAndClasses($name, $table, $itemtype) { + global $DB; + + _log("Delete Type", [ + "table"=>$table, + "name"=>$name, + "itemtype" => $itemtype, + + ]); + //Delete files related to dropdowns + foreach ($DB->listFields($table) as $field => $options) { + if (preg_match("/plugin_genericobject_(.*)_id/", $field, $results)) { + $table = getTableNameForForeignKeyField($field); + + if ($table != getTableForItemType("PluginGenericobjectTypeFamily")) { + self::deleteFilesAndClassesForOneItemtype(getSingular($results[1])); + $DB->query("DROP TABLE IF EXISTS `$table`"); + } + } + } + + //Delete reference in various GLPI core tables + self::deleteItemtypeReferencesInGLPI($itemtype); + + //Delete itemtype files + self::deleteFilesAndClassesForOneItemtype($name); + + //Drop itemtype table + self::deleteItemsTable($itemtype); + self::deleteTable($itemtype); + + } + + /** + * Delete all files for an itemtype + * + * @since 2.2.0 + * @param name class file name + */ + static function deleteFilesAndClassesForOneItemtype($name) { + global $DB; + + //This is for compatibility with older versions of GLPI + //(where ajax files were used for tabs display, which is not the case anymore with GLPI 0.83+) + self::deleteAjaxFile($name); + //Delete itemtype class + self::deleteClassFile($name); + //Delete forms + self::deleteSearchFile($name); + self::deleteFormFile($name); + //Delete datainjection compatiblity file + self::deleteInjectionFile($name); + } + + static function deleteItemtypeReferencesInGLPI($itemtype) { + //Delete references to PluginGenericobjectType in the following tables + $itemtypes = ["Contract_Item", "DisplayPreference", "Document_Item", "SavedSearch", "Log"]; + foreach ($itemtypes as $type) { + $item = new $type(); + $item->deleteByCriteria(['itemtype' => $itemtype]); + } + } + + //-------------------- ADD / DELETE TABLES ----------------------------------// + + /** + * Add a new dropdown table + * @param table the table name + * @param entity_assign can the dropdown be assigned to an entity + * @param recursive can the dropdown be recursive + * @param tree can the dropdown be a tree dropdown + * @return nothing + */ + public static function addDropdownTable($table, $options = []) { + global $DB; + $params['entities_id'] = false; + $params['is_recursive'] = false; + $params['is_tree'] = false; + foreach ($options as $key => $value) { + $params[$key] = $value; + } + + if (!$DB->tableExists($table)) { + $query = "CREATE TABLE IF NOT EXISTS `$table` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(255) collate utf8_unicode_ci default NULL, + `comment` text collate utf8_unicode_ci, + `date_mod` TIMESTAMP NULL DEFAULT NULL, + `date_creation` TIMESTAMP NOT NULL, + PRIMARY KEY (`id`), + KEY `date_mod` (`date_mod`), + KEY `date_creation` (`date_creation`), + KEY `name` (`name`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $DB->query($query); + } + if ($params['entities_id']) { + $query = "ALTER TABLE `$table` ADD `entities_id` INT(11) NOT NULL DEFAULT '0'"; + $DB->query($query); + if ($params['is_recursive']) { + $query = "ALTER TABLE `$table` " . + "ADD `is_recursive` TINYINT(1) NOT NULL DEFAULT '0' AFTER `entities_id`"; + $DB->query($query); + } + } + if ($params['is_tree']) { + $fk = getForeignKeyFieldForTable($table); + $query = "ALTER TABLE `$table` ADD `completename` text COLLATE utf8_unicode_ci, + ADD `$fk` int(11) NOT NULL DEFAULT '0', + ADD `level` int(11) NOT NULL DEFAULT '0', + ADD `ancestors_cache` longtext COLLATE utf8_unicode_ci, + ADD `sons_cache` longtext COLLATE utf8_unicode_ci"; + $DB->query($query); + } + } + + + /** + * Delete object type table + entries in glpi_display + * @name object type's name + * @return nothing + */ + public static function deleteTable($itemtype) { + global $DB; + _log($itemtype); + $preferences = new DisplayPreference(); + $preferences->deleteByCriteria(["itemtype" => $itemtype]); + $DB->query("DROP TABLE IF EXISTS `".getTableForItemType($itemtype)."`"); + } + + + /** + * Delete object _items table + * @name object type's name + * @return nothing + */ + public static function deleteItemsTable($itemtype) { + global $DB; + $DB->query("DROP TABLE IF EXISTS `".getTableForItemType($itemtype)."_items`"); + } + + /** + * Get object name by ID + * @param ID the internal ID + * @return the name associated with the ID + */ + static function getNameByID($itemtype) { + global $DB; + $query = "SELECT `name` FROM `".getTableForItemType(__CLASS__)."` " . + "WHERE `itemtype`='$itemtype'"; + $result = $DB->query($query); + if ($DB->numrows($result)) { + return $DB->result($result, 0, "name"); + } else { + return ""; + } + } + + + /** + * Delete all tickets for an itemtype + * @param the itemtype + * @return nothing + */ + public static function deleteTicketAssignation($itemtype) { + global $DB; + + $types = ['Item_Ticket', 'Item_Problem', 'Change_Item']; + foreach ($types as $type) { + $item = new $type(); + $item->deleteByCriteria(['itemtype' => $itemtype]); + } + } + + /** + * Delete all simcards for an itemtype + * @param the itemtype + * @return nothing + */ + public static function deleteSimcardAssignation($itemtype) { + global $DB; + + $plugin = new Plugin(); + if ($plugin->isActivated('simcard') && $plugin->isActivated('simcard')) { + $types = ['PluginSimcardSimcard_Item']; + foreach ($types as $type) { + $item = new $type(); + $item->deleteByCriteria([ + 'itemtype' => $itemtype + ]); + } + } + } + + /** + * Remove datainjection models for an itemtype + * @param the itemtype + * @return nothing + */ + public static function removeDataInjectionModels($itemtype) { + $plugin = new Plugin(); + //Delete if exists datainjection models + if ($plugin->isInstalled("datainjection") && $plugin->isActivated("datainjection")) { + $model = new PluginDatainjectionModel(); + foreach ($model->find(['itemtype' => $itemtype]) as $data) { + $model->delete($data); + } + } + } + + + /** + * Delete all loans associated with a itemtype + * @param the itemtype + * @return nothing + */ + public static function deleteLoans($itemtype) { + $reservation_item = new ReservationItem(); + foreach ($reservation_item->find(['itemtype' => $itemtype]) as $data) { + $reservation_item->delete($data); + } + } + + + /** + * Delete all loans associated with a itemtype + * @param the itemtype + * @return nothing + */ + public static function deleteUnicity($itemtype) { + $unicity = new FieldUnicity(); + $unicity->deleteByCriteria(['itemtype' => $itemtype]); + } + + + /** + * Delete all notes associated with a itemtype + * @param the itemtype + * @return nothing + */ + public static function deleteNotepad($itemtype) { + $notepad = new Notepad(); + $notepad->deleteByCriteria(['itemtype' => $itemtype]); + } + + + /** + * Delete network ports for an itemtype + * @param the itemtype + * @return nothing + */ + static function deleteNetworking($itemtype) { + $networkport = new NetworkPort(); + foreach ($networkport->find(['itemtype' => $itemtype]) as $port) { + $networkport->delete($port); + } + } + + /** + * Delete reservations for an itemtype + * @param $itemtype + * @return nothing + */ + static function deleteReservations($itemtype) { + global $DB; + + $reservation = new Reservation(); + $query = "DELETE FROM + `glpi_reservations` + WHERE `reservationitems_id` in ( + SELECT `id` from `glpi_reservationitems` WHERE `itemtype`='$itemtype' + )"; + $DB->query($query); + } + + /** + * Delete reservations for an itemtype + * @param $itemtype + * @return nothing + */ + static function deleteReservationItems($itemtype) { + $reservationItem = new ReservationItem(); + $reservationItem->deleteByCriteria(['itemtype' => $itemtype], true); + } + + /** + * Filter values inserted by users : remove accented chars + * @param value the value to be filtered + * @return the filtered value + */ + static function filterInput($value) { + $value = strtolower($value); + //Itemtype must always be singular, otherwise it breaks when using GLPI's framework + $value = getSingular($value); + + $search = explode(",", "ç,æ,œ,á,é,í,ó,ú,à,è,ì,ò,ù,ä,ë,ï,ö,ü,ÿ,â,ê,î,ô,û,å,e,i,ø,u"); + $replace = explode(",", "c,ae,oe,a,e,i,o,u,a,e,i,o,u,a,e,i,o,u,y,a,e,i,o,u,a,e,i,o,u"); + $value = str_replace($search, $replace, $value); + $value = preg_replace("/[^a-zA-Z0-9]/", '', $value); + + return str_replace($search, $replace, $value); + } + + + /** + * Get the object system name (for files and itemtype), by giving the name + * + * @param string $name + * + * @return string + */ + static function getSystemName($name) { + // Force filtering of name (will have no effect if already done). + $name = self::filterInput($name); + + // Replace numbers by letters + return str_replace( + ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'], + ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'], + $name + ); + } + + /** + * Get the object class, by giving the name + * @param name the object's internal identifier + * @return the class associated with the object + */ + static function getClassByName($name) { + return 'PluginGenericobject' . ucfirst(self::getSystemName($name)); + } + + + static function getFamilyNameByItemtype($itemtype) { + $types = getAllDataFromTable("glpi_plugin_genericobject_types", + ['itemtype' => $itemtype, 'is_active' => 1]); + if (empty($types)) { + return false; + } else { + $type = array_pop($types); + if ($type['plugin_genericobject_typefamilies_id'] > 0) { + $family = new PluginGenericobjectTypeFamily(); + $family->getFromDB($type['plugin_genericobject_typefamilies_id']); + return $family->getName(); + } else { + return false; + } + } + } + + /** + * Get all types of active&published objects + */ + static function getTypes($all = false) { + global $DB; + $table = getTableForItemType(__CLASS__); + if ($DB->tableExists($table)) { + $mytypes = []; + $all_types = getAllDataFromTable( + $table, + [ + 'WHERE' => !$all ? ['is_active' => self::ACTIVE] : [], + 'ORDER' => 'name', + ] + ); + foreach ($all_types as $data) { + //If class is not present on the filesystem, do not list itemtype + $mytypes[$data['itemtype']] = $data; + } + return $mytypes; + } else { + return []; + } + } + + /** + * Get all types of active&published objects + * order by family + */ + static function getTypesByFamily($all = false) { + global $DB; + $table = getTableForItemType(__CLASS__); + if ($DB->tableExists($table)) { + $mytypes = []; + foreach (getAllDataFromTable($table, (!$all ? ['is_active' => self::ACTIVE] : [])) as $data) { + //If class is not present on the filesystem, do not list itemtype + if (file_exists(self::getCompleteClassFilename($data['name']))) { + $mytypes[$data['plugin_genericobject_typefamilies_id']][$data['itemtype']] = $data; + } + } + return $mytypes; + } else { + return []; + } + } + + static function getTypesForFormcreator($param) { + $families = PluginGenericobjectTypeFamily::getFamilies(); + $familyFk = PluginGenericobjectTypeFamily::getForeignKeyField(); + foreach(self::getTypes() as $type => $typeData) { + $familyName = isset($families[$typeData[$familyFk]]) + ? $families[$typeData[$familyFk]] + : _n('Other', 'Others', Session::getPluralNumber(), 'genericobject'); + $param[$familyName][$type] = $typeData['name']; + } + return $param; + } + + /** + * Register all variables for a type + * @param type the type's attributes + * @return nothing + */ + static function registerOneType($itemtype) { + //If table doesn't exists, do not try to register ! + if (class_exists($itemtype)) { + $itemtype::registerType(); + } + } + + + /** + * Include locales for a specific type + * @name object type's name + * @return nothing + */ + static function includeLocales($name) { + global $CFG_GLPI,$LANG; + + $fsname = self::getSystemName($name); + + $prefix = GENERICOBJECT_LOCALES_PATH . "/$fsname/$fsname"; + //Dirty hack because the plugin doesn't support gettext... + $language= str_replace('.mo', '', $CFG_GLPI["languages"][$_SESSION["glpilanguage"]][1]); + if (isset ($_SESSION["glpilanguage"]) + && file_exists("$prefix.$language.php")) { + include_once ("$prefix.$language.php"); + + } else { + if (file_exists($prefix . ".en_GB.php")) { + include_once ($prefix . ".en_GB.php"); + } else { + if (file_exists($prefix . ".fr_FR.php")) { + include_once ($prefix . ".fr_FR.php"); + } else { + return false; + } + } + } + return true; + } + + + static function includeConstants($name, $force = false) { + + $file = self::getCompleteConstantFilename($name); + if (file_exists($file)) { + if (!$force) { + include_once($file); + } else { + include($file); + } + } + } + + + /** + * Get all dropdown fields associated with an itemtype + * @param itemtype the itemtype + * @return an array or fields that represents the dropdown tables + */ + static function getDropdownForItemtype($itemtype) { + global $DB; + $associated_tables = []; + if (class_exists($itemtype)) { + $source_table = getTableForItemType($itemtype); + foreach (PluginGenericobjectSingletonObjectField::getInstance($itemtype) as $field => $value) { + $table = getTableNameForForeignKeyField($field); + $options = PluginGenericobjectField::getFieldOptions($field, $itemtype); + if (isset($options['input_type']) + and $options['input_type'] === 'dropdown' + and preg_match('/^glpi_plugin_genericobject/', $table) + ) { + $associated_tables[] = $table; + } + } + } + return $associated_tables; + } + + + static function deleteDropdownsForItemtype($itemtype) { + global $DB; + //Foreach dropdown : drop table & remove files ! + foreach (self::getDropdownForItemtype($itemtype) as $table) { + $results = []; + if (preg_match("/glpi_plugin_genericobject_(.*)/i", getSingular($table), $results) + && isset($results[1])) { + $name = $results[1]; + $DB->query("DROP TABLE IF EXISTS `$table`"); + self::deleteFormFile($name); + self::deleteSearchFile($name); + self::deleteClassFile($name); + } + } + + // Invalidate submenu data in current session for minor cleanup + unset($_SESSION['glpimenu']); + } + //------------------------------- GETTERS -------------------------// + + function canUseTickets() { + return $this->fields['use_tickets']; + } + + function canBeLinked() { + return $this->fields['use_links']; + } + + function canUseTemplate() { + global $DB; + return $DB->fieldExists(getTableForItemType($this->fields['itemtype']), 'is_template'); + } + + + function canUseUnicity() { + return $this->fields['use_unicity']; + } + + + function canBeDeleted() { + global $DB; + return $DB->fieldExists(getTableForItemType($this->fields['itemtype']), 'is_deleted'); + } + + + function canBeEntityAssigned() { + global $DB; + return $DB->fieldExists(getTableForItemType($this->fields['itemtype']), 'entities_id'); + } + + + function canBeRecursive() { + global $DB; + return $DB->fieldExists(getTableForItemType($this->fields['itemtype']), 'is_recursive'); + } + + + function canBeReserved() { + return $this->fields['use_loans']; + } + + + function canUseNotepad() { + return $this->fields['use_notepad'] != 0; + } + + + function canUseHistory() { + return $this->fields['use_history']; + } + + + function canUseDocuments() { + return $this->fields['use_documents']; + } + + + function canUseInfocoms() { + return $this->fields['use_infocoms']; + } + + function canUseItemDevice() { + return $this->fields['use_itemdevices']; + } + + function canUseContracts() { + return $this->fields['use_contracts']; + } + + + function canUseGlobalSearch() { + return $this->fields['use_global_search']; + } + + + function canUseNetworkPorts() { + return $this->fields['use_network_ports']; + } + + + function canUseDirectConnections() { + return $this->fields['use_direct_connections']; + } + + function canUseProjects() { + return $this->fields['use_projects']; + } + + function canUsePluginDataInjection() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("datainjection") || !$plugin->isActivated("datainjection")) { + return false; + } + return $this->fields['use_plugin_datainjection']; + } + + + function canUsePluginOrder() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("order") || !$plugin->isActivated("order")) { + return false; + } + return $this->fields['use_plugin_order']; + } + + + function canUsePluginPDF() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("pdf") || !$plugin->isActivated("pdf")) { + return false; + } + return $this->fields['use_plugin_pdf']; + } + + + function canUsePluginUninstall() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("uninstall") || !$plugin->isActivated("uninstall")) { + return false; + } + return $this->fields['use_plugin_uninstall']; + } + + function canUsePluginSimcard() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("simcard") || !$plugin->isActivated("simcard")) { + return false; + } + return $this->fields['use_plugin_simcard']; + } + + function canUsePluginTreeview() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("treeview") || !$plugin->isActivated("treeview")) { + return false; + } + return $this->fields['use_plugin_treeview']; + } + + function canUsePluginGeninventoryNumber() { + $plugin = new Plugin(); + if (!$plugin->isInstalled("geninventorynumber") + || !$plugin->isActivated("geninventorynumber")) { + return false; + } + return $this->fields['use_plugin_geninventorynumber']; + } + + + function isTransferable() { + return Session::isMultiEntitiesMode(); + + } + + function getLinkedItemTypesAsArray() { + if (!empty($this->fields['linked_itemtypes'])) { + return json_decode($this->fields['linked_itemtypes'], true); + } else { + return []; + } + } + + static function canViewAtLeastOneType() { + $types = self::getTypes(); + $view = false; + foreach ($types as $ID => $value) { + if (Session::haveRight($value['itemtype'], READ)) { + $view = true; + break; + } + } + return $view; + } + + /** + * Display debug information for current object + **/ + function showDebug() { + $this->showFilesForm(); + //NotificationEvent::debugEvent($this); + } + //------------------------------- INSTALL / UNINSTALL METHODS -------------------------// + + + static function install(Migration $migration) { + global $DB; + + $table = getTableForItemType(__CLASS__); + if (!$DB->tableExists($table)) { + $query = "CREATE TABLE `$table` ( + `id` INT( 11 ) NOT NULL AUTO_INCREMENT, + `entities_id` INT( 11 ) NOT NULL DEFAULT 0, + `itemtype` varchar(255) collate utf8_unicode_ci default NULL, + `is_active` tinyint(1) NOT NULL default '0', + `name` varchar(255) collate utf8_unicode_ci default NULL, + `comment` text NULL, + `date_mod` TIMESTAMP NULL DEFAULT NULL, + `date_creation` TIMESTAMP NULL DEFAULT NULL, + `use_global_search` tinyint(1) NOT NULL default '0', + `use_unicity` tinyint(1) NOT NULL default '0', + `use_history` tinyint(1) NOT NULL default '0', + `use_infocoms` tinyint(1) NOT NULL default '0', + `use_contracts` tinyint(1) NOT NULL default '0', + `use_documents` tinyint(1) NOT NULL default '0', + `use_tickets` tinyint(1) NOT NULL default '0', + `use_links` tinyint(1) NOT NULL default '0', + `use_loans` tinyint(1) NOT NULL default '0', + `use_network_ports` tinyint(1) NOT NULL default '0', + `use_direct_connections` tinyint(1) NOT NULL default '0', + `use_plugin_datainjection` tinyint(1) NOT NULL default '0', + `use_plugin_pdf` tinyint(1) NOT NULL default '0', + `use_plugin_order` tinyint(1) NOT NULL default '0', + `use_plugin_uninstall` tinyint(1) NOT NULL default '0', + `use_plugin_geninventorynumber` tinyint(1) NOT NULL default '0', + `use_menu_entry` tinyint(1) NOT NULL default '0', + `use_projects` tinyint(1) NOT NULL default '0', + `linked_itemtypes` text NULL, + `plugin_genericobject_typefamilies_id` INT( 11 ) NOT NULL DEFAULT 0, + `use_itemdevices` tinyint(1) NOT NULL default '0', + PRIMARY KEY ( `id` ) + ) ENGINE = InnoDB COMMENT = 'Object types definition table' DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $DB->query($query) or die($DB->error()); + } + + $migration->addField($table, "use_network_ports", "bool"); + $migration->addField($table, "use_direct_connections", "bool"); + $migration->addField($table, "use_plugin_geninventorynumber", "bool"); + $migration->addField($table, "use_contracts", "bool"); + $migration->addField($table, "use_menu_entry", "bool"); + $migration->addField($table, "use_global_search", "bool"); + $migration->addField($table, "use_projects", "bool"); + $migration->addField($table, "use_notepad", "bool"); + $migration->addField($table, "comment", "text"); + if (!$migration->addField($table, "date_mod", "timestamp")) { + $migration->changeField($table, "date_mod", "date_mod", "timestamp"); + } + $migration->addField($table, "date_creation", "timestamp"); + $migration->addField($table, "linked_itemtypes", "text"); + $migration->addField($table, "plugin_genericobject_typefamilies_id", "integer"); + $migration->addField($table, "use_plugin_simcard", "bool"); + $migration->addField($table, "use_plugin_treeview", "bool"); + $migration->addField($table, "use_itemdevices", "bool"); + $migration->migrationOneTable($table); + + //Normalize names and itemtypes (prior to using them). + self::normalizeNamesAndItemtypes($migration); + + //If files are missing, recreate them! + self::checkClassAndFilesForItemType(); + + // Migrate notepad data + $allGenericObjectTypes = PluginGenericobjectType::getTypes(true); + + $notepad = new Notepad(); + foreach ($allGenericObjectTypes as $genericObjectType => $genericObjectData) { + $itemtype = $genericObjectData['itemtype']; + if (! class_exists($itemtype, true)) { + // TRANS: %1$s is itemtype name + $warning = sprintf(__('Unable to load the class %1$s.', 'genericobject'), $itemtype); + // TRANS: %1$s is itemtype name + $warning .= sprintf(__('You probably have garbage data in your database for this plugin and missing files in %1$s', 'genericobject'), GENERICOBJECT_DOC_DIR); + $migration->displayWarning($warning, true); + die(); + } + $genericObjectTypeInstance = new $genericObjectType(); + if ($DB->fieldExists($genericObjectTypeInstance->getTable(), "notepad")) { + $query = "INSERT INTO `" . $notepad->getTable() . "` + (`items_id`, + `itemtype`, + `date`, + `date_mod`, + `content` + ) + SELECT + `id` as `items_id`, + '" . $genericObjectType . "' as `itemtype`, + now() as `date`, + now() as `date_mod`, + `notepad` as `content` + FROM `" . $genericObjectTypeInstance->getTable() . "` + WHERE notepad IS NOT NULL + AND notepad <> ''"; + $DB->query($query) or die($DB->error()); + } + $query = "UPDATE`" . $notepad->getTable() . "`"; + $migration->dropField($genericObjectTypeInstance->getTable(), "notepad"); + $migration->migrationOneTable($genericObjectTypeInstance->getTable()); + } + + //Displayprefs + $prefs = [10 => 6, 9 => 5, 8 => 4, 7 => 3, 6 => 2, 2 => 1, 4 => 1, 11 => 7, 12 => 8, + 14 => 10, 15 => 11]; + foreach ($prefs as $num => $rank) { + if (!countElementsInTable("glpi_displaypreferences", + ['itemtype' => __CLASS__, 'num' => $num, 'users_id' => 0])) { + $preference = new DisplayPreference(); + $tmp['itemtype'] = __CLASS__; + $tmp['num'] = $num; + $tmp['rank'] = $rank; + $tmp['users_id'] = 0; + $preference->add($tmp); + } + } + } + + + static function uninstall() { + global $DB; + + //Delete references to PluginGenericobjectType in the following tables + self::deleteItemtypeReferencesInGLPI(__CLASS__); + + foreach ($DB->request("glpi_plugin_genericobject_types") as $type) { + //Delete references to PluginGenericobjectType in the following tables + self::deleteItemtypeReferencesInGLPI($type['itemtype']); + //Dropd files and classes + self::deleteItemTypeFilesAndClasses($type['name'], getTableForItemType($type['itemtype']), $type['itemtype']); + } + + //Delete table + $query = "DROP TABLE IF EXISTS `glpi_plugin_genericobject_types`"; + $DB->query($query) or die($DB->error()); + } + + + static function getIcon() { + return "fas fa-car"; + } + + /** + * Normalize itemtype and name for all types. + * This method will ensure that new normalization rules will be taken into account + * during migration from an old version without loosing existing data. + * + * @param Migration $migration + * @return void + */ + private static function normalizeNamesAndItemtypes(Migration $migration) { + global $DB; + $DB->disableTableCaching(); + + $types_iterator = $DB->request( + [ + 'FROM' => self::getTable(), + 'ORDER' => 'name', + ] + ); + + foreach ($types_iterator as $type) { + $old_name = $type['name']; + $new_name = self::filterInput($old_name); + $old_itemtype = $type['itemtype']; + $new_itemtype = self::getClassByName($new_name); + + if ($old_name == $new_name && $old_itemtype == $new_itemtype) { + continue; + } + + self::updateNameAndItemtype( + $migration, + $old_name, + $new_name, + $old_itemtype, + $new_itemtype + ); + + $DB->update( + self::getTable(), + [ + 'name' => $new_name, + 'itemtype' => $new_itemtype, + ], + ['id' => $type['id']] + ); + + $DB->update( + self::getTable(), + [ + 'linked_itemtypes' => new \QueryExpression( + 'REPLACE(' + . $DB->quoteName('linked_itemtypes') + . ',' + . $DB->quoteValue('"' . $old_itemtype .'"') // itemtype is surrounded by quotes + . ',' + . $DB->quoteValue('"' . $new_itemtype .'"') // itemtype is surrounded by quotes + . ')' + ), + ], + ['linked_itemtypes' => ['LIKE', '%"' . $old_itemtype . '"%']] + ); + + // Handle dropdowns related to itemtype + $table = getTableForItemType($new_itemtype); + $fields = $DB->listFields($table); + foreach ($fields as $field => $options) { + if (preg_match("/s_id$/", $field)) { + $dropdown_old_table = getTableNameForForeignKeyField($field); + + if (!preg_match('/^glpi_plugin_genericobject_/', $dropdown_old_table)) { + continue; + } + + $dropdown_old_name = getSingular( + str_replace( + "glpi_plugin_genericobject_", + "", + $dropdown_old_table + ) + ); + $dropdown_old_itemtype = 'PluginGenericobject' . ucfirst($dropdown_old_name); + $dropdown_new_name = self::filterInput($dropdown_old_name); + $dropdown_new_itemtype = self::getClassByName($dropdown_new_name); + + if ($dropdown_old_name == $dropdown_new_name + && $dropdown_old_itemtype == $dropdown_new_itemtype) { + continue; + } + + self::updateNameAndItemtype( + $migration, + $dropdown_old_name, + $dropdown_new_name, + $dropdown_old_itemtype, + $dropdown_new_itemtype + ); + } + } + } + + ProfileRight::cleanAllPossibleRights(); // Clean all possible rights are their name may have change + } + + /** + * Update itemtype and/or name for a given itemtype. + * + * @param Migration $migration + * @param string $old_name Current type name in database + * @param string $new_name New type name to use + * @param string $old_itemtype Current itemtype + * @param string $new_itemtype New itemtype to use + * + * @return void + */ + private static function updateNameAndItemtype(Migration $migration, $old_name, $new_name, + $old_itemtype, $new_itemtype) { + + global $DB; + + if ($old_itemtype != $new_itemtype) { + $migration->renameItemtype($old_itemtype, $new_itemtype); + $migration->executeMigration(); // Execute migration to flush updates on tables that may be renamed + } + + $destination_files = []; + + $old_systemname = $old_name; // Old system name was same as name in DB + $new_systemname = self::getSystemName($new_name); + $old_fkey = getForeignKeyFieldForItemType($old_itemtype); + $new_fkey = getForeignKeyFieldForItemType($new_itemtype); + $old_locale_dir = GENERICOBJECT_LOCALES_PATH . '/' . $old_systemname; + $new_locale_dir = GENERICOBJECT_LOCALES_PATH . '/' . $new_systemname; + + $destination_files = [ + self::getCompleteClassFilename($new_name), + self::getCompleteItemClassFilename($new_name), + self::getCompleteFormFilename($new_name), + self::getCompleteSearchFilename($new_name), + self::getCompleteAjaxTabFilename($new_name), + self::getCompleteInjectionFilename($new_name), + self::getCompleteConstantFilename($new_name), + ]; + + // Rename locale folder and map files + if (is_dir($old_locale_dir) && $old_locale_dir != $new_locale_dir) { + if (rename($old_locale_dir, $new_locale_dir)) { + // Add all locale files to destination files + foreach (glob($new_locale_dir . '/*.php') as $old_filename) { + $destination_files[] = preg_replace( + '/(.*\/)' . preg_quote($old_systemname, '/') . '([^\/]*)$/', + '$1' . $new_systemname . '$2', + $old_filename + ); + } + } else { + $migration->displayWarning( + sprintf('Unable to rename "%s" locale directory to "%s"', $old_locale_dir, $new_locale_dir), + true + ); + } + } + + // Handle *_item class table/itemtype + if ($DB->tableExists(getTableForItemType($old_itemtype . '_Item'))) { + $migration->renameItemtype($old_itemtype . '_Item', $new_itemtype . '_Item'); + $migration->executeMigration(); // Execute migration to flush updates on tables that may be renamed + } + + // Add all constant files as they may contains foreign keys to update + foreach (glob(GENERICOBJECT_FIELDS_PATH . '/*.php') as $constant_filename) { + $destination_files[] = $constant_filename; + } + + // Rename files (replace "/{$old name}*" by "/{$new_system_name}*") + $migration->displayMessage( + sprintf('Rename files related to "%s" itemtype and update their content', $old_itemtype), + true + ); + foreach ($destination_files as $new_filename) { + $old_filename = preg_replace( + '/(.*\/)' . preg_quote($new_systemname, '/') . '([^\/]*)$/', + '$1' . $old_systemname . '$2', + $new_filename + ); + + if (!file_exists($old_filename)) { + // Do nothing if old file does not exists + continue; + } + + if ($old_filename != $new_filename) { + if (!rename($old_filename, $new_filename)) { + $migration->displayWarning( + sprintf('Unable to rename "%s" file to "%s"', $old_filename, $new_filename), + true + ); + continue; + } + } else { + $migration->displayMessage( + sprintf('Update "%s" file content', $old_filename), + true + ); + } + + $file_contents = file_get_contents($new_filename); + if (!$file_contents) { + $migration->displayWarning( + sprintf('Unable to read "%s" file contents', $new_filename), + true + ); + continue; + } + + $replace_count = 0; + $old_fkey_truncated = preg_replace('/^plugin_genericobject_/', '', $old_fkey); + $new_fkey_truncated = preg_replace('/^plugin_genericobject_/', '', $new_fkey); + $file_contents = str_replace( + [$old_itemtype, $old_fkey, $old_fkey_truncated], + [$new_itemtype, $new_fkey, $new_fkey_truncated], + $file_contents, + $replace_count + ); + if ($replace_count > 0 && !file_put_contents($new_filename, $file_contents)) { + $migration->displayWarning( + sprintf('Unable to update "%s" file contents', $new_filename), + true + ); + } + } + + // Update profile rights + if ($old_itemtype != $new_itemtype) { + $migration->addPostQuery( + $DB->buildUpdate( + ProfileRight::getTable(), + ['name' => PluginGenericobjectProfile::getProfileNameForItemtype($new_itemtype)], + ['name' => PluginGenericobjectProfile::getProfileNameForItemtype($old_itemtype)] + ) + ); + } + } +} diff --git a/plugins/genericobject/inc/typefamily.class.php b/plugins/genericobject/inc/typefamily.class.php new file mode 100644 index 00000000..be9d91f4 --- /dev/null +++ b/plugins/genericobject/inc/typefamily.class.php @@ -0,0 +1,101 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +if (!defined('GLPI_ROOT')) { + die("Sorry. You can't access directly to this file"); +} + +class PluginGenericobjectTypeFamily extends CommonDropdown { + var $can_be_translated = true; + + static function getTypeName($nb = 0) { + return __('Family of type of objects', 'genericobject'); + } + + static function install(Migration $migration) { + global $DB; + + $table = getTableForItemType(__CLASS__); + if (!$DB->tableExists($table)) { + $query = "CREATE TABLE `$table` ( + `id` INT( 11 ) NOT NULL AUTO_INCREMENT, + `name` varchar(255) collate utf8_unicode_ci default NULL, + `comment` text NULL, + `date_mod` TIMESTAMP NULL DEFAULT NULL, + `date_creation` TIMESTAMP NULL DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `date_mod` (`date_mod`), + KEY `date_creation` (`date_creation`) + ) ENGINE = InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"; + $DB->query($query) or die($DB->error()); + } + } + + static function uninstall() { + global $DB; + + $table = getTableForItemType(__CLASS__); + if ($DB->tableExists($table)) { + $query = "DROP TABLE IF EXISTS `$table`"; + $DB->query($query) or die($DB->error()); + } + } + + static function getFamilies() { + global $DB; + + $query = "SELECT f.id as id, f.name as name, t.itemtype as itemtype + FROM glpi_plugin_genericobject_typefamilies as f + LEFT JOIN glpi_plugin_genericobject_types AS t + ON (f.id = t.plugin_genericobject_typefamilies_id) + WHERE t.id IN (SELECT DISTINCT `id` + FROM glpi_plugin_genericobject_types + WHERE is_active=1)"; + $families = []; + foreach ($DB->request($query) as $fam) { + $itemtype = $fam['itemtype']; + if ($itemtype::canCreate()) { + $families[$fam['id']] = $fam['name']; + } + } + return $families; + } + + + static function getItemtypesByFamily($families_id) { + return getAllDataFromTable( + 'glpi_plugin_genericobject_types', + [ + 'plugin_genericobject_typefamilies_id' => $families_id, + 'is_active' => 1 + ] + ); + } +} diff --git a/plugins/genericobject/index.php b/plugins/genericobject/index.php new file mode 100644 index 00000000..0991b52a --- /dev/null +++ b/plugins/genericobject/index.php @@ -0,0 +1,90 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +define('GLPI_ROOT', '../..'); +include (GLPI_ROOT . "/inc/includes.php"); + +if (isset($_GET['itemtypes_id']) && $_GET['itemtypes_id']!='') { + $type = new PluginGenericobjectType(); + $type->getFromDB($_GET['itemtypes_id']); + Html::redirect(Toolbox::getItemTypeSearchURL($type->fields['itemtype'])); +} else { + $types = PluginGenericobjectType::getTypesByFamily(); + foreach ($types as $family => $typeData) { + foreach ($typeData as $ID => $value) { + if (!Session::haveRight($value['itemtype'], READ)) { + unset($types[$family][$ID]); + } + } + } + + //There's only one family + if (count($types) == 1) { + //There's only one itemtype ? If yes, then automatically + //redirect to the search engine + if (key($types) == null) { + $mytypes = $types; + $tmp = array_pop($mytypes); + if (count($tmp) == 1) { + Html::redirect(Toolbox::getItemTypeSearchURL(key($tmp))); + } + } + } + + Html::header(__("Objects management", "genericobject"), $_SERVER['PHP_SELF'], "plugins", + "genericobject"); + + foreach ($types as $family => $typeData) { + + $PluginGenericobjectTypefamily = new PluginGenericobjectTypefamily(); + $PluginGenericobjectTypefamily->getFromDB($family); + + echo "
      ".__("Link to other objects", "genericobject")."
      "._n("Type", "Types", 2).""; + echo ""; + echo "
      "; + if ($family == 0) { + echo ""; + } else { + echo ""; + } + if (!count($types)) { + echo ""; + } else { + foreach ($typeData as $ID => $value) { + echo ""; + } + } + echo "
      ".__("Empty family", "genericobject")."
      ".$PluginGenericobjectTypefamily->getField("name")."
      ".__("No item to display")."
      "; + echo ""; + $itemtype = $value['itemtype']; + echo $itemtype::getTypeName(); + echo "
      "; + } + + Html::footer(); +} diff --git a/plugins/genericobject/locales/cs_CZ.mo b/plugins/genericobject/locales/cs_CZ.mo new file mode 100644 index 00000000..545c072e Binary files /dev/null and b/plugins/genericobject/locales/cs_CZ.mo differ diff --git a/plugins/genericobject/locales/cs_CZ.po b/plugins/genericobject/locales/cs_CZ.po new file mode 100644 index 00000000..e87ba2c7 --- /dev/null +++ b/plugins/genericobject/locales/cs_CZ.po @@ -0,0 +1,179 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Pavel Borecki , 2018-2019 +# Walid Nouh, 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Czech (Czech Republic) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/cs_CZ/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: cs_CZ\n" +"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Správa objektů" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Prázdná rodina" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Typ objektů" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Požadovaná rozbalovací nabídka neexistuje" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Kolonky úspěšně smazány" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Kolonka úspěšně přidána" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Rodina typu objektů" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Obecné" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objekty" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Doposud nebyly určené žádné typy)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Název typu chybí" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Je třeba, aby název typu byl delší" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Typy „field“ (kolonka), „object“ (objekt) a „type“ (typ) jsou vyhrazené (už je nemůžete použít). Zvolte jiný" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Je třeba, aby typ začínal písmenem" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Typ se stejným názvem už existuje" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Vnitřní identifikátor" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Chování" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Síťová připojení" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "zásuvný modul vkládání souborů" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "zásuvný modul vytváření inventárních čísel" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "zásuvný modul správa objednávek" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "zásuvný modul odinstalace položek" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "zásuvný modul sim karty" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "zásuvný modul stromového pohledu" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Znovu vytvořit soubory" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Propojit s ostatními objekty" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" +msgstr[3] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Nedaří se načíst třídu %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Nejspíš ve své databázi máte pro tento modul v nepořádku data a chybí soubory v %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Náhled objektu" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Pro zapnutí náhledu je třeba nastavit oprávnění" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Kolonky přiřazené k objektu" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Štítek" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Název v databázi" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Přidat novou kolonku" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Kolonka pouze pro čtení" diff --git a/plugins/genericobject/locales/en_GB.mo b/plugins/genericobject/locales/en_GB.mo new file mode 100644 index 00000000..c9e5471d Binary files /dev/null and b/plugins/genericobject/locales/en_GB.mo differ diff --git a/plugins/genericobject/locales/en_GB.po b/plugins/genericobject/locales/en_GB.po new file mode 100644 index 00000000..78d9a0de --- /dev/null +++ b/plugins/genericobject/locales/en_GB.po @@ -0,0 +1,178 @@ +# English translations for PACKAGE package. +# Copyright (C) 2021 THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# Automatically generated, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:21+0000\n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: en_GB\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=ASCII\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Objects management" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Empty family" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Type of objects" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "The requested dropdown does not exists" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Field(s) deleted successfully" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Field added successfully" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Family of type of objects" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "General" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objects" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(No types defined yet)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Type name is missing" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Type name must be longer" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Type must start with a letter" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "A type already exists with the same name" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Internal identifier" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Behaviour" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Network connections" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "injection file plugin" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber plugin" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "order plugin" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "item's uninstallation plugin" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "simcard plugin" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "treeview plugin" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Regenerate files" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Link to other objects" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "Other" +msgstr[1] "Others" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Unable to load the class %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Object preview" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "You must configure rights to enable the preview" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Fields associated with the object" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Label" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Name in DB" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Add new field" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Read-only field" diff --git a/plugins/genericobject/locales/es_AR.mo b/plugins/genericobject/locales/es_AR.mo new file mode 100644 index 00000000..01da59ff Binary files /dev/null and b/plugins/genericobject/locales/es_AR.mo differ diff --git a/plugins/genericobject/locales/es_AR.po b/plugins/genericobject/locales/es_AR.po new file mode 100644 index 00000000..f322ad24 --- /dev/null +++ b/plugins/genericobject/locales/es_AR.po @@ -0,0 +1,138 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-09-06 14:50+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: hook.php:152 +msgid "" +"Error: directories '/inc', '/front' and '/locales' of plugin must be " +"writable by the web server." +msgstr "Error: los directorios '/inc', '/front' and '/locales' del plugin se deben poder escribir en el servidor web." + +#: index.php:46 index.php:49 setup.php:118 front/type.form.php:73 +#: inc/object_item.class.php:110 inc/type.class.php:239 +msgid "Objects management" +msgstr "Administración de Objetos" + +#: setup.php:82 setup.php:83 +msgid "Go to objects list" +msgstr "Ir a la lista de objetos" + +#: front/field.form.php:40 +msgid "Field(s) deleted successfully" +msgstr "Campo(s) borrados completamente" + +#: front/field.form.php:50 +msgid "Field added successfully" +msgstr "Campo agregado completamente" + +#: front/type.php:37 inc/type.class.php:61 +msgid "Type of objects" +msgstr "Tipo de objetos" + +#: inc/field.class.php:66 +msgid "Fields associated with the object" +msgstr "Campos asociados con el objeto" + +#: inc/field.class.php:72 +msgid "Label" +msgstr "Etiqueta" + +#: inc/field.class.php:73 +msgid "Name in DB" +msgstr "Nombre en DB" + +#: inc/field.class.php:105 +msgid "Add new field" +msgstr "Agregar un campo nuevo" + +#: inc/object.class.php:346 +msgid "Object preview" +msgstr "Vista preliminar del Objeto" + +#: inc/object.class.php:633 +msgid "You must configure rights to enable the preview" +msgstr "Debe configurar derechos para ver vista previa" + +#: inc/profile.class.php:62 inc/profile.class.php:121 +msgid "Access object" +msgstr "Acceso a objeto" + +#: inc/profile.class.php:69 inc/profile.class.php:127 +msgid "Associate tickets to this object" +msgstr "Asociar tickets con este objeto" + +#: inc/profile.class.php:147 +msgid "No type defined" +msgstr "Tipo no definido" + +#: inc/type.class.php:150 +msgid "Type name is missing" +msgstr "Tipo de objeto no existe" + +#: inc/type.class.php:156 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Types 'field', 'object' and 'type' are reserved. Please choose another one" + +#: inc/type.class.php:163 +msgid "Type must start with a letter" +msgstr "El tipo de objeto debe comenzar con una letra" + +#: inc/type.class.php:170 +msgid "A type already exists with the same name" +msgstr "Ya existe un tipo de objeto con ese nombre" + +#: inc/type.class.php:339 +msgid "Internal identifier" +msgstr "Identificador interno" + +#: inc/type.class.php:383 +msgid "Behaviour" +msgstr "Comportamiento" + +#: inc/type.class.php:398 inc/type.class.php:513 +msgid "Link to other objects" +msgstr "" + +#: inc/type.class.php:399 +msgid "Network connections" +msgstr "Conexiones de red" + +#: inc/type.class.php:400 +msgid "injection file plugin" +msgstr "Plugin Inyección de archivo" + +#: inc/type.class.php:402 +msgid "order plugin" +msgstr "Plugin Orden de compras" + +#: inc/type.class.php:403 +msgid "item's uninstallation plugin" +msgstr "Plugins desinstalación de items" + +#: inc/type.class.php:500 +msgid "Regenerate files" +msgstr "" + +#: index.php:60 +msgid "Empty family" +msgstr "" + +#: inc/typefamily.class.php:35 +msgid "Family of type of objects" +msgstr "" \ No newline at end of file diff --git a/plugins/genericobject/locales/es_ES.mo b/plugins/genericobject/locales/es_ES.mo new file mode 100644 index 00000000..94190380 Binary files /dev/null and b/plugins/genericobject/locales/es_ES.mo differ diff --git a/plugins/genericobject/locales/es_ES.po b/plugins/genericobject/locales/es_ES.po new file mode 100644 index 00000000..c187c13a --- /dev/null +++ b/plugins/genericobject/locales/es_ES.po @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# cbc5204086c375034e77848ef6290ebe, 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Spanish (Spain) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/es_ES/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: es_ES\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gestión de objetos" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Familia vacía" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Tipo de objetos" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "La lista desplegable requerida no existe" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Campo(s) suprimido(s) correctamente" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "El campo fue añadido correctamente" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Familia de tipos de objetos" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "General" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objetos" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Nombre de tipo es obligatorio" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Los nombres de tipo 'field', 'object' y 'type' son reservados. Tiene que elegir otro nombre" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "El nombre de tipo tiene que empezar con una letra" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Un tipo de objeto ya existe con el mismo nombre" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identificador interno" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportamiento" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Conexiones de red" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "complemento Injection file" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "complemento Geninventorynumber" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "complemento Gestión de pedidos" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "complemento Item's uninstallation" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Generar de nuevo los ficheros" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Enlace con otros objetos" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Vista previa del objeto" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Tiene que configurar los permisos para acceder a la vista previa" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Campos asociados al objeto" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Término" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nombre en base de datos" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Añadir un campo nuevo" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/locales/fi_FI.mo b/plugins/genericobject/locales/fi_FI.mo new file mode 100644 index 00000000..d7eb92a4 Binary files /dev/null and b/plugins/genericobject/locales/fi_FI.mo differ diff --git a/plugins/genericobject/locales/fi_FI.po b/plugins/genericobject/locales/fi_FI.po new file mode 100644 index 00000000..4ef274a8 --- /dev/null +++ b/plugins/genericobject/locales/fi_FI.po @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Markku Vepsä, 2018 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Finnish (Finland) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/fi_FI/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fi_FI\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Kohteiden hallinta" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Tyhjä perhe" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Kohteiden tyyppi" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Pyydettyä alasvetovalikkoa ei ole olemassa" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Kenttä/kentät poistettu onnistuneesti" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Kenttä lisätty onnistuneesti" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Kohteiden tyypin perhe" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Yleinen" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Kohteet" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Tyyppejä ei ole vielä määritelty)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Tyyppinimi puuttuu" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Tyyppinimen on oltava pidempi" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Tyypit \"kenttä\", \"kohde\" ja \"tyyppi\" ovat varattuja. Valitse joku toinen" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Tyypin täytyy alkaa kirjaimella" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Samanniminen tyyppi on jo olemassa" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Sisäinen tunniste" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Käyttäytyminen" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Verkkoyhteydet" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Tiedoston tuonti -liitännäinen" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "Inventaarinumeron luonti liitännäinen" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Tilaus -liitännäinen" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Kohteen poisto -liitännäinen" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "SIM-kortti -liitännäinen" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Luo tiedostot uudelleen" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Linkki muihin kohteisiin" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Ei voida ladata luokkaa %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Tietokannassa on ongelma liittyen liitännäiseen ja puuttuvia tiedostoja %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Kohteen esikatselu" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Oikeudet on määritettävä, jotta esikatselu voidaan ottaa käyttöön" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Kohteeseen liittyvät kentät" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etiketti" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nimi tietokannassa" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Lisää uusi kenttä" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Vain luku kenttä" diff --git a/plugins/genericobject/locales/fr_CA.mo b/plugins/genericobject/locales/fr_CA.mo new file mode 100644 index 00000000..5d3001b0 Binary files /dev/null and b/plugins/genericobject/locales/fr_CA.mo differ diff --git a/plugins/genericobject/locales/fr_CA.po b/plugins/genericobject/locales/fr_CA.po new file mode 100644 index 00000000..f6a87cb4 --- /dev/null +++ b/plugins/genericobject/locales/fr_CA.po @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Tiago Graça, 2020 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: French (Canada) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/fr_CA/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr_CA\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gestion d'objets" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Famille vide" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Types d'objets" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "L'intitulé demandé n'existe pas" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Champ(s) supprimé(s) avec succès" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Champ ajouté avec succès" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Famille" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Général" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objets" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Aucun type déjà défini)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Nom du type manquant" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Le nom du type doit être plus long" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Les types 'field', 'object' et 'type' sont réservés. Veuillez en choisir un autre" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Le type doit commencer par une lettre" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Un type avec le même nom existe déjà" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identifiant interne" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportement" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Connexions réseaux" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Plugin injection de fichiers" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "Plugin génération des numéros d'inventaire" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Plugin gestion des commandes" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Plugin de désinstallation des éléments" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "Plugin carte SIM" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "plugin arborescence" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Regénérer les fichiers" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Liaison avec d'autres objets" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Impossible de charger la classe %1$s" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Vous avez probablement d'anciennes données dans votre base de données pour ce plugin et des fichiers sont manquants dans %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Prévisualisation d'un objet de ce type" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Vous devez configurer les droits sur cet objet pour voir la prévisualisation" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Champs associés à l'objet" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Libellé" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nom en base de données" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Ajout d'un nouveau champ" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Champ en lecture seule" diff --git a/plugins/genericobject/locales/fr_FR.mo b/plugins/genericobject/locales/fr_FR.mo new file mode 100644 index 00000000..5fc751ed Binary files /dev/null and b/plugins/genericobject/locales/fr_FR.mo differ diff --git a/plugins/genericobject/locales/fr_FR.po b/plugins/genericobject/locales/fr_FR.po new file mode 100644 index 00000000..373d9456 --- /dev/null +++ b/plugins/genericobject/locales/fr_FR.po @@ -0,0 +1,181 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# alexandre delaunay , 2017 +# Cédric Anne, 2018 +# Manu1400 , 2016 +# Johan Cwiklinski , 2016-2017 +# cbc5204086c375034e77848ef6290ebe, 2015 +# Walid Nouh, 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: French (France) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/fr_FR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr_FR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gestion d'objets" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Famille vide" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Types d'objets" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "L'intitulé demandé n'existe pas" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Champ(s) supprimé(s) avec succès" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Champ ajouté avec succès" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Famille" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Général" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objets" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Aucun type déjà défini)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Nom du type manquant" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Le nom du type doit être plus long" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Les types 'field', 'object' et 'type' sont réservés. Veuillez en choisir un autre" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Le type doit commencer par une lettre" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Un type avec le même nom existe déjà" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identifiant interne" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportement" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Connexions réseaux" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Plugin injection de fichiers" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "Plugin génération des numéros d'inventaire" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Plugin gestion des commandes" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Plugin de désinstallation des matériels" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "Plugin carte SIM" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Regénérer les fichiers" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Liaison avec d'autres objets" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Impossible de charger la classe %1$s" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Vous avez probablement d'anciennes données dans votre base pour ce plugin ou des fichiers manquants dans %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Prévisualisation d'un objet de ce type" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Vous devez configurer les droits sur cet objet pour voir la prévisualisation" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Champs associés à l'objet" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Libellé" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nom en base de données" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Ajout d'un nouveau champ" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Champ en lecture seule" diff --git a/plugins/genericobject/locales/genericobject.pot b/plugins/genericobject/locales/genericobject.pot new file mode 100644 index 00000000..490c9b95 --- /dev/null +++ b/plugins/genericobject/locales/genericobject.pot @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/locales/hr_HR.mo b/plugins/genericobject/locales/hr_HR.mo new file mode 100644 index 00000000..4f682a0a Binary files /dev/null and b/plugins/genericobject/locales/hr_HR.mo differ diff --git a/plugins/genericobject/locales/hr_HR.po b/plugins/genericobject/locales/hr_HR.po new file mode 100644 index 00000000..7c0e4c7e --- /dev/null +++ b/plugins/genericobject/locales/hr_HR.po @@ -0,0 +1,177 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# milotype , 2020 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Croatian (Croatia) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/hr_HR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: hr_HR\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Upravljanje objektima" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Prazna obitelji" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Vrste objekata" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Traženi padajući popis ne postoji" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Polja uspješno uklonjena" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Polje uspješno dodano" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Obitelj vrste objekata" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Opće" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objekti" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Vrste još nisu određene)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Ime vrste nedostaje" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Ime vrste mora biti duže" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "„Polje”, „objekt” i „vrsta” su rezervirane vrste. Odaberi neku drugu" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Vrsta mora početi slovom" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Jedna vrsta s istim imenom već postoji" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Interni identifikator" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Ponašanje" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Mrežne veze" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Dodatak za umetanje podataka" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "Dodatak za generiranje inventarskog broja" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Dodatak za naruđbe" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Dodatak za deinstaliranje predmeta" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "Dodatak za SIM kartice" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "Dodatak za stablasti prikaz" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Ponovo generiraj datoteke" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Poveži s drugim objektima" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Nije moguće učitati klasu %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "U bazi podataka vjerojatno imaš smeće za ovaj dodatak i nedostaju datoteke u %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Pregled objekta" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Za aktiviranje pregleda moraš konfigurirati prava" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Polja povezana s objektom" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Oznaka" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Ime u bazi podataka" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Dodaj novo polje" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Polje samo-za-čitanje" diff --git a/plugins/genericobject/locales/it_IT.mo b/plugins/genericobject/locales/it_IT.mo new file mode 100644 index 00000000..8cc7a56d Binary files /dev/null and b/plugins/genericobject/locales/it_IT.mo differ diff --git a/plugins/genericobject/locales/it_IT.po b/plugins/genericobject/locales/it_IT.po new file mode 100644 index 00000000..d7715b81 --- /dev/null +++ b/plugins/genericobject/locales/it_IT.po @@ -0,0 +1,178 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Pierfrancesco Passerini , 2018 +# Salvatore Russo , 2016 +# Davide , 2018 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Italian (Italy) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/it_IT/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: it_IT\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gestione degli Oggetti" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Famiglia vuota" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Tipo di oggetti" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Il menù a discesa richiesto non esiste" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Campi rimossi con successo" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Campo aggiunto con successo" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Famiglia" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Generale" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Oggetti" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Nessun tipo ancora definito)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Il nome del tipo non è presente" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Il nome della tipologia deve essere più lungo" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "I tipi 'field', 'object' e 'type' sono riservati. Sceglierne un altro" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Il nome del tipo deve iniziare con una lettera" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Un tipo con lo stesso nome esiste già" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identificatore interno" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportamento" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Connessioni di rete" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "injection file plugin" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber plugin" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "order plugin" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "item's uninstallation plugin" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "simcard plugin" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Rigenera file" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Collega ad altri oggetti" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Impossibile caricare la classe %1$s ." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Per questo plugin hai, probabilmente, dei dati inutili nel tuo database e file mancanti in %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Anteprima dell'oggetto" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Bisogna configurare i diritti per abilitare l'anteprima" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Campi associati con l'oggetto" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etichetta" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nome nel DataBase" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Aggiungi nuovo campo" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Campo in sola lettura" diff --git a/plugins/genericobject/locales/ko_KR.mo b/plugins/genericobject/locales/ko_KR.mo new file mode 100644 index 00000000..031803e4 Binary files /dev/null and b/plugins/genericobject/locales/ko_KR.mo differ diff --git a/plugins/genericobject/locales/ko_KR.po b/plugins/genericobject/locales/ko_KR.po new file mode 100644 index 00000000..14324676 --- /dev/null +++ b/plugins/genericobject/locales/ko_KR.po @@ -0,0 +1,175 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# SeongHyeon Cho , 2020 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Korean (Korea) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/ko_KR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ko_KR\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "객체 관리" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "빈 집단" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "객체 유형" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "요청된 드롭다운은 존재하지 않습니다" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "항목(들) 삭제됨" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "항목 추가됨" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "객체의 유형 집단" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "일반" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "객체" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(아직 정의된 유형 없음)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "유형 이름이 누락되었습니다" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "유형 이름은 더 길어야 합니다" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "유형 'field', 'object' 그리고 'type'은 금지되었습니다. 다른 것을 선택해 주세요" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "유형은 문자로 시작해야 합니다" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "유형이 이미 같은 이름으로 존재합니다" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "내부 식별자" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "동작" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "네트워크 연결" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "파일 플러그인 삽입" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber 플러그인" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "order 플러그인" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "품목 제거 플러그인" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "simcard 플러그인" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "treeview 플러그인" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "파일 재생성" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "다른 객체들과 연결" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "클래스 %1$s을 불러올 수 없습니다." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "이 플러그인에 대한 데이터베이스 내에 개비지 데이터가 있거나 %1$s내의 파일이 누락된 것 같습니다" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "객체 미리보기" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "미리보기 활성화에 대한 권한을 구성해야 합니다" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "객체에 연관된 항목" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "라벨" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "DB에서의 이름" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "새 항목 추가" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "읽기-전용 항목" diff --git a/plugins/genericobject/locales/pl_PL.mo b/plugins/genericobject/locales/pl_PL.mo new file mode 100644 index 00000000..b5481a88 Binary files /dev/null and b/plugins/genericobject/locales/pl_PL.mo differ diff --git a/plugins/genericobject/locales/pl_PL.po b/plugins/genericobject/locales/pl_PL.po new file mode 100644 index 00000000..7213e525 --- /dev/null +++ b/plugins/genericobject/locales/pl_PL.po @@ -0,0 +1,178 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# awiamo, 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Polish (Poland) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/pl_PL/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pl_PL\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Zarządzanie obiektami" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Rodzaj obiektów" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Żądana lista rozwijana nie istnieje" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Pole(a) zostały pomyślnie skasowane" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Pole dodane pomyślnie" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Typ musi zaczynać się od litery" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Istnieje już typ o takiej samej nazwie" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identyfikator wewnętrzny" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Zachowanie" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Połączenia sieciowe" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber plugin" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Link do innych obiektów" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" +msgstr[3] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Podgląd obiektu" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etykieta" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nazwa w DB" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Dodaj nowe pole" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/locales/pt_BR.mo b/plugins/genericobject/locales/pt_BR.mo new file mode 100644 index 00000000..63978a47 Binary files /dev/null and b/plugins/genericobject/locales/pt_BR.mo differ diff --git a/plugins/genericobject/locales/pt_BR.po b/plugins/genericobject/locales/pt_BR.po new file mode 100644 index 00000000..c4b2f1fe --- /dev/null +++ b/plugins/genericobject/locales/pt_BR.po @@ -0,0 +1,178 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Andrei Bernardo Simoni , 2017 +# Andrei Bernardo Simoni , 2017 +# Arthur Ramos Schaefer , 2017 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gerenciamento de objetos" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Família vazia" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Tipos de objetos" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "O menu suspenso solicitado não existe" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Campo(s) excluído(s) com sucesso" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Campo adicionado com sucesso" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Família de tipo de objetos" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Geral" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objetos" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Sem tipos definidos ainda)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "O nome do tipo está faltando" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Nome deve ser mais longo" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Tipos 'campo', 'objeto' e 'tipo' estão reservados. Por favor escolha outro" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "O tipo deve começar com uma letra" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Um tipo com o mesmo nome já existe " + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identificador interno" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportamento" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Conexões de rede" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "plugin datainjection" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "plugin getinventorynumber" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "plugin order" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "plugin item's uninstallation" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "plugin simcard" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Regenerar arquivos" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Conexão com outros objetos" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Não consegui carregar a classe %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Deve ter dados no lixo da tua base de dados porque estão a faltas ficheiros neste plugin %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Pré-visualização do objet" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Você deve configurar os direitos para habilitar pré-visualização" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Campos associados com o objeto" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etiqueta" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nome no banco de dados" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Adicionar novo campo" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Campo apenas de leitura" diff --git a/plugins/genericobject/locales/pt_PT.mo b/plugins/genericobject/locales/pt_PT.mo new file mode 100644 index 00000000..d09086c1 Binary files /dev/null and b/plugins/genericobject/locales/pt_PT.mo differ diff --git a/plugins/genericobject/locales/pt_PT.po b/plugins/genericobject/locales/pt_PT.po new file mode 100644 index 00000000..9dd12fdd --- /dev/null +++ b/plugins/genericobject/locales/pt_PT.po @@ -0,0 +1,175 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Portuguese (Portugal) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/pt_PT/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_PT\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Gerenciamento de objetos" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Família vazia" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Tipo de objetos" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "A lista suspensa solicitada não existe" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Campo (s) excluído com sucesso" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Campo adicionado com sucesso" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Família do tipo de objetos" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Geral" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Objetos" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Nenhum tipo definido ainda)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Um tipo de nome está ausente" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Um tipo de nome deve ser mais longo" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Os tipos ‘field’, ‘object’ e ‘type’ são reservados. Por favor, escolha outro" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Tipo deve começar com uma letra" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Já existe um tipo com o mesmo nome" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identificador interno" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportamento" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Ligações de rede" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "plugin de arquivo de injeção" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber plugin" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "outro plugin" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "plugin de desinstalação do item" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "simcard plugin" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Regenerar ficheiros" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Ligação para outro objeto" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Não é possível carregar a classe usando %1$s." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Provavelmente tem dados incorretos na sua base de dados para este plugin e arquivos ausentes em %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Pré-visualização de objetos" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Deve configurar os direitos para habilitar a visualização" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Campos associados ao objeto" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Rótulo" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nome na BD" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Adicionar um novo campo" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Campo somente de leitura" diff --git a/plugins/genericobject/locales/ro_RO.mo b/plugins/genericobject/locales/ro_RO.mo new file mode 100644 index 00000000..2e582d75 Binary files /dev/null and b/plugins/genericobject/locales/ro_RO.mo differ diff --git a/plugins/genericobject/locales/ro_RO.po b/plugins/genericobject/locales/ro_RO.po new file mode 100644 index 00000000..6808cd7a --- /dev/null +++ b/plugins/genericobject/locales/ro_RO.po @@ -0,0 +1,177 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Doru DEACONU , 2015 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Romanian (Romania) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/ro_RO/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ro_RO\n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Managementul obiectelor" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Familie vida" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Tipul obiectelor" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Dropdown-ul solicitat nu exista" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Campul(urile) sterse cu succes" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Camp adaugat cu succes" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Familia tipului de obiecte" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "General" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Obiecte" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Nume tip lipseste" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Tipurile 'camp', 'obiect', si 'tip' sunt rezervate.Va rugam alegeti altul" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Tipul trebuie sa inceapa cu o litera" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "UN tip cu acelasi nume exista deja" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Identificator intern" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Comportament" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Conexiuni retea" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Plugin injectare fisiere" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "geninventorynumber plugin" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Plugin gestiune comenzi" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Plugin dezinstalare elemente" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Fisiere regenerate" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Linck catre alte obiecte" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Previzualizeaza un obiect de acest tip" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Trebuie sa configurati drepturi pe acest obiect pentru a putea previzualiza" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Campuri asociate la obiect" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Eticheta" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Nume in DB" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Add camp nou" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/locales/ru_RU.mo b/plugins/genericobject/locales/ru_RU.mo new file mode 100644 index 00000000..fc515543 Binary files /dev/null and b/plugins/genericobject/locales/ru_RU.mo differ diff --git a/plugins/genericobject/locales/ru_RU.po b/plugins/genericobject/locales/ru_RU.po new file mode 100644 index 00000000..7188f4d0 --- /dev/null +++ b/plugins/genericobject/locales/ru_RU.po @@ -0,0 +1,179 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Alexey Petukhov , 2015 +# Mr.GreyWolf, 2016 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Russian (Russia) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/ru_RU/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru_RU\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Управление объектами" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Тип объектов" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Поле(я) удалены успешно" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Поле(я) добавлены успешно" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Объекты" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Типы 'field', 'object' и 'type' зарезервированы. Выберите другие." + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Тип должен начинаться с буквы" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Тип с таким именем уже есть" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Внутренний идентификатор" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Взаимодействия" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Сетевые соединения" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Связать с другим объектом" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" +msgstr[2] "" +msgstr[3] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Предпросмотр" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Вы должны настроить права для предпросмотра" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Поля связаны с объектом" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Наименование" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Имя в БД" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Добавить новое поле" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/locales/sv_SE.mo b/plugins/genericobject/locales/sv_SE.mo new file mode 100644 index 00000000..2cc40ef1 Binary files /dev/null and b/plugins/genericobject/locales/sv_SE.mo differ diff --git a/plugins/genericobject/locales/sv_SE.po b/plugins/genericobject/locales/sv_SE.po new file mode 100644 index 00000000..08c3c3fc --- /dev/null +++ b/plugins/genericobject/locales/sv_SE.po @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# jchan , 2018 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Swedish (Sweden) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/sv_SE/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: sv_SE\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Hantera tillgångar" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Tom familj" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Typ av tillgång" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "Den begärda rullmenyn saknas" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Fältet(en) raderades" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Attribut tillagt" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Ingår i typfamilj" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Allmänt" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Tillgångar" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Inga typer har skapats ännu)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Typnamn saknas" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Typnamnet måste vara längre" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "Typnamnen 'fält, 'objekt' och 'typ' är reserverade av systemet. Var vänlig välj ett annat namn." + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Typnamnet måste börja med en bokstav" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Typnamnet existerar redan" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "Internt namn" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Beteende" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Nätverksanslutningar" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "Injection file plug-in" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "Geninventorynumber plug-in" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "Order plug-in" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "Item's uninstallation plug-in" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "Simcard plug-in" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Skapa filer på nytt" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Länka till andra tillgångar" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "Kunde inte läsa in klass %1$s-" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Du har troligtvis skräpdata i databasen för denna plug-in och saknar filer i %1$s" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Förhandsgranska tillgång" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Du måste konfigurera rättigheter för att aktivera förhandsgranskning" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Fält kopplade till tillgången" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etikett" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Namn i DB" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Lägg till nytt fält" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Skrivskyddat fält" diff --git a/plugins/genericobject/locales/tr_TR.mo b/plugins/genericobject/locales/tr_TR.mo new file mode 100644 index 00000000..afbf52bc Binary files /dev/null and b/plugins/genericobject/locales/tr_TR.mo differ diff --git a/plugins/genericobject/locales/tr_TR.po b/plugins/genericobject/locales/tr_TR.po new file mode 100644 index 00000000..569e3ab6 --- /dev/null +++ b/plugins/genericobject/locales/tr_TR.po @@ -0,0 +1,176 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Kaya Zeren , 2015-2017,2019 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Turkish (Turkey) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/tr_TR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: tr_TR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "Nesne yönetimi" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "Aile boş" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "Nesne tipi" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "İstenen açılan kutu bulunamadı" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "Alanlar silindi" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "Alan eklendi" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "Nesnelerin aile tipi" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "Genel" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "Nesneler" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "(Henüz bir tür tanımlanmamış)" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "Tip adı eksik" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "Tür adı daha uzun olmalı" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "field', 'object' ve 'type' tipleri ayrılmış olduğundan kullanılamaz. Lütfen başka bir tip seçin" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "Tip bir harf ile başlamalıdır" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "Aynı adlı bir tip zaten var" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "İç belirteç" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "Davranış" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "Ağ bağlantıları" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "dosya gönderme uygulama eki" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "stoknumarasiolustur uygulama eki" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "sıralama uygulama eki" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "ögeyi kaldırma uygulama eki" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "sim kart uygulama eki" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "ağaç görünümü uygulama eki" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "Dosyaları yeniden oluştur" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "Diğer nesnelere bağlantı" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" +msgstr[1] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "%1$s sınıfı yüklenemedi." + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "Veritabanınızda bu uygulama eki ve %1$s içindeki eksik dosyalar için büyük olasılıkla çöp veriler var " + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "Nesne önizleme" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "Ön izlemeyi görüntüleyebilmek için izinleri yapılandırmalısınız" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "Nesne ile ilişkilendirilmiş alanlar" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "Etiket" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "Veritabanındaki Ad" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "Alan ekle" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "Salt okunur alan" diff --git a/plugins/genericobject/locales/zh_CN.mo b/plugins/genericobject/locales/zh_CN.mo new file mode 100644 index 00000000..51370d72 Binary files /dev/null and b/plugins/genericobject/locales/zh_CN.mo differ diff --git a/plugins/genericobject/locales/zh_CN.po b/plugins/genericobject/locales/zh_CN.po new file mode 100644 index 00000000..ee995257 --- /dev/null +++ b/plugins/genericobject/locales/zh_CN.po @@ -0,0 +1,175 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# liAnGjiA , 2018 +msgid "" +msgstr "" +"Project-Id-Version: GLPI Plugin - Genericobject\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-05-28 10:21+0000\n" +"PO-Revision-Date: 2021-05-28 10:22+0000\n" +"Last-Translator: Cédric Anne\n" +"Language-Team: Chinese (China) (http://www.transifex.com/teclib/glpi-project-plugin-genericobject/language/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: index.php:58 front/familylist.php:33 front/familylist.php:41 +#: front/type.form.php:73 inc/profile.class.php:39 inc/type.class.php:292 +#: inc/type.class.php:427 inc/object_item.class.php:109 setup.php:227 +msgid "Objects management" +msgstr "项目管理" + +#: index.php:68 front/familylist.php:37 +msgid "Empty family" +msgstr "" + +#: front/object.php:33 front/type.php:38 inc/profile.class.php:287 +#: inc/type.class.php:66 +msgid "Type of objects" +msgstr "项目类型" + +#: front/commontreedropdown.form.php:36 front/commondropdown.php:11 +#: front/commondropdown.form.php:36 +msgid "The requested dropdown does not exists" +msgstr "" + +#: front/field.form.php:41 +msgid "Field(s) deleted successfully" +msgstr "" + +#: front/field.form.php:51 +msgid "Field added successfully" +msgstr "" + +#: inc/typefamily.class.php:36 inc/type.class.php:380 inc/type.class.php:517 +msgid "Family of type of objects" +msgstr "" + +#: inc/profile.class.php:141 +msgid "General" +msgstr "常规" + +#: inc/profile.class.php:147 +msgid "Objects" +msgstr "项目" + +#: inc/profile.class.php:149 +msgid "(No types defined yet)" +msgstr "" + +#: inc/type.class.php:156 +msgid "Type name is missing" +msgstr "" + +#: inc/type.class.php:162 +msgid "Type name must be longer" +msgstr "" + +#: inc/type.class.php:168 +msgid "" +"Types 'field', 'object' and 'type' are reserved. Please choose another one" +msgstr "" + +#: inc/type.class.php:175 +msgid "Type must start with a letter" +msgstr "" + +#: inc/type.class.php:182 +msgid "A type already exists with the same name" +msgstr "" + +#: inc/type.class.php:478 +msgid "Internal identifier" +msgstr "" + +#: inc/type.class.php:532 +msgid "Behaviour" +msgstr "" + +#: inc/type.class.php:551 +msgid "Network connections" +msgstr "" + +#: inc/type.class.php:556 +msgid "injection file plugin" +msgstr "" + +#: inc/type.class.php:558 +msgid "geninventorynumber plugin" +msgstr "" + +#: inc/type.class.php:559 +msgid "order plugin" +msgstr "" + +#: inc/type.class.php:560 +msgid "item's uninstallation plugin" +msgstr "" + +#: inc/type.class.php:561 +msgid "simcard plugin" +msgstr "" + +#: inc/type.class.php:562 +msgid "treeview plugin" +msgstr "" + +#: inc/type.class.php:725 +msgid "Regenerate files" +msgstr "" + +#: inc/type.class.php:738 +msgid "Link to other objects" +msgstr "" + +#: inc/type.class.php:1734 +msgid "Other" +msgid_plural "Others" +msgstr[0] "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2101 +#, php-format +msgid "Unable to load the class %1$s." +msgstr "" + +#. TRANS: %1$s is itemtype name +#: inc/type.class.php:2103 +#, php-format +msgid "" +"You probably have garbage data in your database for this plugin and missing " +"files in %1$s" +msgstr "" + +#: inc/object.class.php:548 +msgid "Object preview" +msgstr "" + +#: inc/object.class.php:812 +msgid "You must configure rights to enable the preview" +msgstr "" + +#: inc/field.class.php:65 +msgid "Fields associated with the object" +msgstr "" + +#: inc/field.class.php:71 +msgid "Label" +msgstr "" + +#: inc/field.class.php:72 +msgid "Name in DB" +msgstr "" + +#: inc/field.class.php:127 +msgid "Add new field" +msgstr "" + +#: inc/field.class.php:322 +msgid "Read-only field" +msgstr "" diff --git a/plugins/genericobject/objects/front.form.tpl b/plugins/genericobject/objects/front.form.tpl new file mode 100644 index 00000000..d1d50e6c --- /dev/null +++ b/plugins/genericobject/objects/front.form.tpl @@ -0,0 +1,35 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +/** + * This file is automatically managed by genericobject plugin. Do not edit it ! + */ + +include ("../../../inc/includes.php"); + +$dropdown = new %%CLASSNAME%%(); +include (GLPI_ROOT . "/front/dropdown.common.form.php"); diff --git a/plugins/genericobject/objects/front.tpl b/plugins/genericobject/objects/front.tpl new file mode 100644 index 00000000..6a132b91 --- /dev/null +++ b/plugins/genericobject/objects/front.tpl @@ -0,0 +1,38 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ +include ("../../../inc/includes.php"); + +/** + * This file is automatically managed by genericobject plugin. Do not edit it ! + */ + +Html::header(%%CLASSNAME%%::getTypeName(), $_SERVER['PHP_SELF'], "plugins", "genericobject", + "%%CLASSNAME%%"); + +Search::show('%%CLASSNAME%%'); + +Html::footer(); diff --git a/plugins/genericobject/objects/generic.class.tpl b/plugins/genericobject/objects/generic.class.tpl new file mode 100644 index 00000000..b1276dcb --- /dev/null +++ b/plugins/genericobject/objects/generic.class.tpl @@ -0,0 +1,45 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +/** + * This class is automatically managed by genericobject plugin. Do not edit it ! + */ +class %%CLASSNAME%% extends PluginGenericobjectObject { + + static $rightname = ''; + + static function getFormURL($full=true) { + return Toolbox::getItemTypeFormURL( get_parent_class() , $full) . + "?itemtype=".get_called_class(); + } + static function getSearchURL($full=true) { + return Toolbox::getItemTypeSearchURL( get_parent_class() , $full) . + "?itemtype=".get_called_class(); + + } +} + diff --git a/plugins/genericobject/objects/generic.dropdown.class.tpl b/plugins/genericobject/objects/generic.dropdown.class.tpl new file mode 100644 index 00000000..5b355b8d --- /dev/null +++ b/plugins/genericobject/objects/generic.dropdown.class.tpl @@ -0,0 +1,33 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +/** + * This class is automatically managed by genericobject plugin. Do not modify it ! + */ +class %%CLASSNAME%% extends %%EXTENDS%% { + public $linked_itemtype = "%%LINKED_ITEMTYPE%%"; +} diff --git a/plugins/genericobject/objects/generic.form.tpl b/plugins/genericobject/objects/generic.form.tpl new file mode 100644 index 00000000..1daf17fb --- /dev/null +++ b/plugins/genericobject/objects/generic.form.tpl @@ -0,0 +1,35 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +/** + * This file is automatically managed by genericobject plugin. Do not edit it ! + */ + +include ("../../../inc/includes.php"); + +$item = new %%CLASSNAME%%(); +include (GENERICOBJECT_DIR."/front/object.form.php"); diff --git a/plugins/genericobject/objects/locale.tpl b/plugins/genericobject/objects/locale.tpl new file mode 100644 index 00000000..9c4c3daf --- /dev/null +++ b/plugins/genericobject/objects/locale.tpl @@ -0,0 +1,28 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +$LANG['genericobject']['%%CLASSNAME%%'][0]="%%NAME%%"; diff --git a/plugins/genericobject/objects/object_item.class.tpl b/plugins/genericobject/objects/object_item.class.tpl new file mode 100644 index 00000000..0131e4fd --- /dev/null +++ b/plugins/genericobject/objects/object_item.class.tpl @@ -0,0 +1,44 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +if (!defined('GLPI_ROOT')){ + die("Sorry. You can't access directly to this file"); +} + +class %%CLASSNAME%% extends PluginGenericobjectObject_Item { + + public $dohistory = true; + + // From CommonDBRelation + static public $itemtype_1 = '%%SOURCEOBJECT%%'; + static public $items_id_1 = '%%FOREIGNKEY%%'; + + static public $itemtype_2 = 'itemtype'; + static public $items_id_2 = 'items_id'; + static public $checkItem_2_Rights = self::HAVE_VIEW_RIGHT_ON_ITEM; +} + diff --git a/plugins/genericobject/objects/objectinjection.class.tpl b/plugins/genericobject/objects/objectinjection.class.tpl new file mode 100644 index 00000000..84571812 --- /dev/null +++ b/plugins/genericobject/objects/objectinjection.class.tpl @@ -0,0 +1,95 @@ +. + -------------------------------------------------------------------------- + @package genericobject + @author the genericobject plugin team + @copyright Copyright (c) 2010-2017 Genericobject plugin team + @license GPLv2+ + http://www.gnu.org/licenses/gpl.txt + @link https://github.com/pluginsGLPI/genericobject + @link http://www.glpi-project.org/ + @since 2009 + ---------------------------------------------------------------------- */ + +/** + * This file is automatically managed by genericobject plugin. Do not edit it ! + */ + +if (!defined('GLPI_ROOT')) { + die("Sorry. You can't access directly to this file"); +} + +class %%INJECTIONCLASS%% extends %%CLASSNAME%% + implements PluginDatainjectionInjectionInterface { + + function __construct() { + $this->table = getTableForItemType(get_parent_class($this)); + } + + static function getTable($classname = null) { + + $parenttype = get_parent_class(); + return $parenttype::getTable(); + + } + + function isPrimaryType() { + return true; + } + + function connectedTo() { + return []; + } + + /** + * Standard method to add an object into glpi + * + * @param values fields to add into glpi + * @param options options used during creation + * @return an array of IDs of newly created objects : for example [Computer=>1, Networkport=>10] + * + **/ + function addOrUpdateObject($values = [], $options = []) { + + $lib = new PluginDatainjectionCommonInjectionLib($this, $values, $options); + $lib->processAddOrUpdate(); + return $lib->getInjectionResults(); + } + + /** + * Get search options formatted for injection mapping usage in datainjection plugin. + * + * @return array + */ + function getOptions($primary_type = '') { + $plugin = new Plugin(); + if (!$plugin->isActivated('datainjection')) { + return []; + } + + return PluginDatainjectionCommonInjectionLib::addToSearchOptions( + Search::getOptions(get_parent_class($this)), + [ + 'ignore_fields' => PluginDatainjectionCommonInjectionLib::getBlacklistedOptions( + get_parent_class($this) + ), + ], + $this + ); + } + +} diff --git a/plugins/genericobject/pics/default-icon.png b/plugins/genericobject/pics/default-icon.png new file mode 100644 index 00000000..6942a782 Binary files /dev/null and b/plugins/genericobject/pics/default-icon.png differ diff --git a/plugins/genericobject/pics/default-icon.svg b/plugins/genericobject/pics/default-icon.svg new file mode 100644 index 00000000..b800cf81 --- /dev/null +++ b/plugins/genericobject/pics/default-icon.svg @@ -0,0 +1,223 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/genericobject/pics/default-icon16.png b/plugins/genericobject/pics/default-icon16.png new file mode 100644 index 00000000..8b7d6f6a Binary files /dev/null and b/plugins/genericobject/pics/default-icon16.png differ diff --git a/plugins/genericobject/pics/icon-examples/car.svg b/plugins/genericobject/pics/icon-examples/car.svg new file mode 100644 index 00000000..036a6998 --- /dev/null +++ b/plugins/genericobject/pics/icon-examples/car.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Simple side of car silhouette + 2014-01-11T08:53:56 + car outline in black and white + https://openclipart.org/detail/190006/simple-side-of-car-silhouette-by-z-190006 + + + Z + + + + + car + side + silhouette + simple + vehicle + + + + + + + + + + + diff --git a/plugins/genericobject/pics/icon-examples/cube.svg b/plugins/genericobject/pics/icon-examples/cube.svg new file mode 100644 index 00000000..49060baa --- /dev/null +++ b/plugins/genericobject/pics/icon-examples/cube.svg @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + icon_cube_red + 2008-05-26T15:29:22 + + https://openclipart.org/detail/17062/icon_cube_red-by-jean_victor_balin + + + jean_victor_balin + + + + + cube + icon + item + + + + + + + + + + + diff --git a/plugins/genericobject/setup.php b/plugins/genericobject/setup.php new file mode 100644 index 00000000..300003fe --- /dev/null +++ b/plugins/genericobject/setup.php @@ -0,0 +1,269 @@ +. + * ------------------------------------------------------------------------- + * @copyright Copyright (C) 2009-2022 by GenericObject plugin team. + * @license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html + * @link https://github.com/pluginsGLPI/genericobject + * ------------------------------------------------------------------------- + */ + +define ('PLUGIN_GENERICOBJECT_VERSION', '2.11.1'); + +// Minimal GLPI version, inclusive +define("PLUGIN_GENERICOBJECT_MIN_GLPI", "9.5"); +// Maximum GLPI version, exclusive +define("PLUGIN_GENERICOBJECT_MAX_GLPI", "9.6"); + +if (!defined("GENERICOBJECT_DIR")) { + define("GENERICOBJECT_DIR", Plugin::getPhpDir("genericobject")); +} + +if (!defined("GENERICOBJECT_DOC_DIR")) { + define("GENERICOBJECT_DOC_DIR", GLPI_PLUGIN_DOC_DIR . "/genericobject"); + if (!file_exists(GENERICOBJECT_DOC_DIR)) { + mkdir(GENERICOBJECT_DOC_DIR); + } +} +if (!defined("GENERICOBJECT_FRONT_PATH")) { + define("GENERICOBJECT_FRONT_PATH", GENERICOBJECT_DOC_DIR."/front"); + if (!file_exists(GENERICOBJECT_FRONT_PATH)) { + mkdir(GENERICOBJECT_FRONT_PATH); + } +} +if (!defined("GENERICOBJECT_AJAX_PATH")) { + define("GENERICOBJECT_AJAX_PATH", GENERICOBJECT_DOC_DIR . "/ajax"); + if (!file_exists(GENERICOBJECT_AJAX_PATH)) { + mkdir(GENERICOBJECT_AJAX_PATH); + } +} + +if (!defined("GENERICOBJECT_CLASS_PATH")) { + define("GENERICOBJECT_CLASS_PATH", GENERICOBJECT_DOC_DIR . "/inc"); + if (!file_exists(GENERICOBJECT_CLASS_PATH)) { + mkdir(GENERICOBJECT_CLASS_PATH); + } +} + +if (!defined("GENERICOBJECT_LOCALES_PATH")) { + define("GENERICOBJECT_LOCALES_PATH", GENERICOBJECT_DOC_DIR . "/locales"); + if (!file_exists(GENERICOBJECT_LOCALES_PATH)) { + mkdir(GENERICOBJECT_LOCALES_PATH); + } +} + +if (!defined("GENERICOBJECT_FIELDS_PATH")) { + define("GENERICOBJECT_FIELDS_PATH", GENERICOBJECT_DOC_DIR . "/fields"); + if (!file_exists(GENERICOBJECT_FIELDS_PATH)) { + mkdir(GENERICOBJECT_FIELDS_PATH); + } +} + +if (!defined("GENERICOBJECT_PICS_PATH")) { + define("GENERICOBJECT_PICS_PATH", GENERICOBJECT_DOC_DIR . "/pics"); + if (!file_exists(GENERICOBJECT_PICS_PATH)) { + mkdir(GENERICOBJECT_PICS_PATH); + } +} + +// Autoload class generated in files/_plugins/genericobject/inc/ +include_once( GENERICOBJECT_DIR . "/inc/autoload.php"); +include_once( GENERICOBJECT_DIR . "/inc/functions.php"); +if (file_exists(GENERICOBJECT_DIR . "/log_filter.settings.php")) { + include_once(GENERICOBJECT_DIR . "/log_filter.settings.php"); +} + +$go_autoloader = new PluginGenericobjectAutoloader([ + GENERICOBJECT_CLASS_PATH +]); +$go_autoloader->register(); + +/** + * Init hooks of the plugin. + * REQUIRED + * + * @return void + */ +function plugin_init_genericobject() { + global $PLUGIN_HOOKS, $GO_BLACKLIST_FIELDS, + $GENERICOBJECT_PDF_TYPES, $GO_LINKED_TYPES, $GO_READONLY_FIELDS; + + $GO_READONLY_FIELDS = ["is_helpdesk_visible", "comment"]; + + $GO_BLACKLIST_FIELDS = ["itemtype", "table", "is_deleted", "id", "entities_id", + "is_recursive", "is_template", "notepad", "template_name", + "date_mod", "name", "is_helpdesk_visible", "comment", + "date_creation"]; + + $GO_LINKED_TYPES = ['Computer', 'Phone', 'Peripheral', 'Software', 'Monitor', + 'Printer', 'NetworkEquipment']; + + $PLUGIN_HOOKS['csrf_compliant']['genericobject'] = true; + $GENERICOBJECT_PDF_TYPES = []; + $plugin = new Plugin(); + + if ($plugin->isInstalled("genericobject") + && $plugin->isActivated("genericobject") + && isset($_SESSION['glpiactiveprofile'])) { + + //if treeview is installed + if ($plugin->isInstalled("treeview") + && $plugin->isActivated("treeview") + && class_exists('PluginTreeviewConfig')) { + + //foreach type in genericobject + foreach (PluginGenericobjectType::getTypes() as $itemtype => $value) { + //check if location_id field exist + $fields_in_db = PluginGenericobjectSingletonObjectField::getInstance($itemtype); + $objecttype = PluginGenericobjectType::getInstance($itemtype); + if (isset($fields_in_db['locations_id']) && $objecttype->canUsePluginTreeview()) { + + //register class + PluginTreeviewConfig::registerType($itemtype); + $PLUGIN_HOOKS['treeview'][$itemtype] = Plugin::getWebDir('genericobject') . '/pics/default-icon16.png'; + + //add hook for overload item show form url + $PLUGIN_HOOKS['treeview_params']['genericobject'] = [ + 'PluginGenericobjectObject', + 'showGenericObjectTreeview' + ]; + + //add hook for overload search form url of itemtype + $PLUGIN_HOOKS['treeview_search_url_parent_node']['genericobject'] = [ + 'PluginGenericobjectObject', + 'getParentNodeSearchUrl' + ]; + } + } + } + + $PLUGIN_HOOKS['change_profile']['genericobject'] = [ + 'PluginGenericobjectProfile', + 'changeProfile' + ]; + + plugin_genericobject_includeCommonFields(); + $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; + + // add css styles + $PLUGIN_HOOKS['add_css']['genericobject'] = [ + "css/styles.css" + ]; + + // Display a menu entry ? + $PLUGIN_HOOKS['menu_toadd']['genericobject'] = [ + 'config' => 'PluginGenericobjectType', + 'assets' => 'PluginGenericobjectObject' + ]; + + // Config page + if (Session::haveRight('config', READ)) { + $PLUGIN_HOOKS['config_page']['genericobject'] = 'front/type.php'; + } + + $PLUGIN_HOOKS['assign_to_ticket']['genericobject'] = true; + $PLUGIN_HOOKS['use_massive_action']['genericobject'] = 1; + + $PLUGIN_HOOKS['post_init']['genericobject'] = 'plugin_post_init_genericobject'; + $PLUGIN_HOOKS['plugin_datainjection_populate']['genericobject'] = "plugin_datainjection_populate_genericobject"; + + $PLUGIN_HOOKS['formcreator_get_glpi_object_types']['genericobject'] = [ + PluginGenericobjectType::getType(), + 'getTypesForFormcreator' + ]; + } +} + +function plugin_post_init_genericobject() { + Plugin::registerClass( + 'PluginGenericobjectProfile', + ['addtabon' => ['Profile', 'PluginGenericobjectType']] + ); + + foreach (PluginGenericobjectType::getTypes() as $id => $objecttype) { + $itemtype = $objecttype['itemtype']; + if (class_exists($itemtype)) { + $itemtype::registerType(); + } + + } +} + +/** + * Get the name and the version of the plugin + * REQUIRED + * + * @return array + */ +function plugin_version_genericobject() { + return [ + 'name' => __("Objects management", "genericobject"), + 'version' => PLUGIN_GENERICOBJECT_VERSION, + 'author' => "Teclib' & siprossii", + 'homepage' => 'https://github.com/pluginsGLPI/genericobject', + 'license' => 'GPLv2+', + 'requirements' => [ + 'glpi' => [ + 'min' => PLUGIN_GENERICOBJECT_MIN_GLPI, + 'max' => PLUGIN_GENERICOBJECT_MAX_GLPI, + 'dev' => true, //Required to allow 9.2-dev + ] + ] + ]; +} + + +function plugin_genericobject_haveTypeRight($itemtype, $right) { + switch ($itemtype) { + case 'PluginGenericobjectType' : + return Session::haveRight("config", $right); + default : + return Session::haveRight($itemtype, $right); + } + +} + +function plugin_genericobject_includeCommonFields($force = false) { + //Load genericobject default constants + if (!$force) { + include_once (GENERICOBJECT_DIR."/fields/field.constant.php"); + } else { + include (GENERICOBJECT_DIR."/fields/field.constant.php"); + } + + //Include user constants, that must be accessible for all itemtypes + if (file_exists(GENERICOBJECT_FIELDS_PATH . "/field.constant.php")) { + if (!$force) { + include_once ( GENERICOBJECT_FIELDS_PATH . "/field.constant.php"); + } else { + include ( GENERICOBJECT_FIELDS_PATH . "/field.constant.php"); + } + } +} + +function plugin_genericobject_haveRight($class, $right) { + + $right_name = PluginGenericobjectProfile::getProfileNameForItemtype($class); + return Session::haveRight($right_name, $right); + +} diff --git a/plugins/genericobject/tools/HEADER b/plugins/genericobject/tools/HEADER new file mode 100644 index 00000000..5bca3359 --- /dev/null +++ b/plugins/genericobject/tools/HEADER @@ -0,0 +1,25 @@ +------------------------------------------------------------------------- +GenericObject plugin for GLPI +------------------------------------------------------------------------- + +LICENSE + +This file is part of GenericObject. + +GenericObject is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 3 of the License, or +(at your option) any later version. + +GenericObject is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GenericObject. If not, see . +------------------------------------------------------------------------- +@copyright Copyright (C) 2009-2022 by GenericObject plugin team. +@license GPLv3 https://www.gnu.org/licenses/gpl-3.0.html +@link https://github.com/pluginsGLPI/genericobject +------------------------------------------------------------------------- diff --git a/plugins/remove.txt b/plugins/remove.txt new file mode 100644 index 00000000..97732142 --- /dev/null +++ b/plugins/remove.txt @@ -0,0 +1,3 @@ +Vous pouvez effacer ce fichier sans dommages. + +You can safely remove this file.