diff --git a/css/itsm2.scss b/css/itsm2.scss index abb85e2019..25d2b212b0 100644 --- a/css/itsm2.scss +++ b/css/itsm2.scss @@ -37,7 +37,7 @@ div#searchbar { border-radius: 20px; background-color: white; padding: 2px 10px; - + input[type="search"] { height: 90%; outline: 0; @@ -158,14 +158,14 @@ main { div.menu-close + & { width: calc(100% - var(--nav-close-width)); margin-left: var(--nav-close-width); - + .menu-right & { margin-right: var(--nav-close-width); } } } - + #menu-border{ position: absolute; z-index: 10; @@ -193,7 +193,7 @@ main { right: 6px; bottom: auto; color: black; - + // >i { // position: static !important; // color: black !important; @@ -229,7 +229,7 @@ main { &.show >i{ rotate: 180deg; } - + >i { font-size: 1.5em; // rotate: 180deg; @@ -241,19 +241,19 @@ main { } .menu-top &, .menu-bubble & { - >i { + >i { rotate: 90deg; } &.show >i{ rotate: 270deg; } - } + } .menu-close & { display: none; } - i { + i { position: relative !important; } .menu-positions { @@ -329,7 +329,7 @@ main { height: var(--_size); width: var(--_size); border-radius: 50%; - + .menu-right & { right: auto; left: -1.2rem; @@ -345,7 +345,7 @@ main { position: relative; left: 5px; transition: transform .3s ease; - + .menu-right & { left: auto; right: 5px; @@ -355,7 +355,7 @@ main { .menu-close & { transform: rotate(180deg); } - + } } @@ -373,7 +373,7 @@ main { i { color: $favorite-color; } - + } #bubble { display: none; @@ -401,7 +401,7 @@ main { border-radius: var(--_border-radius); color: var(--_color); background: linear-gradient(90deg,var(--_background-color) 75%, transparent 75%); - + &::before{ position: relative; right: var(--_uncenter); @@ -437,7 +437,7 @@ main { display: flex; flex-direction: row; justify-content: center; - align-items: center; + align-items: center; } .bubble-icon { --_padding: 18px; @@ -449,7 +449,7 @@ main { background-size: 100000%; border-radius: 30px; } - + .submenu-icon { padding: 18px; color: white !important; @@ -521,7 +521,11 @@ main { } } } - + +.menu-top .nav-side-menu { + height: initial; +} + .nav-side-menu { height: calc(100vh - 3rem - var(--header-height)); position: relative; @@ -533,7 +537,7 @@ main { line-height: 1; overflow-y: hidden; // width: 100%; - + #menu-favorite.hidden{ display: none; } @@ -564,7 +568,7 @@ main { display: none; } } - + i.submenu-icon, i.bubble-icon { --_size: 1.5em; width: var(--_size); @@ -584,7 +588,7 @@ main { flex-direction: column; overflow-y: visible; } - + .menu-right & { justify-content: end; } @@ -626,7 +630,7 @@ main { flex-direction: column; align-items: normal; user-select: none; - + .menu-top &{ flex-direction: row; justify-content: space-evenly; @@ -667,8 +671,8 @@ main { padding: 5px; margin: 0; } - - + + > div { // width: 100%; padding: 5px 10px; @@ -684,7 +688,7 @@ main { background-color: $nav-hover-color; } } - + i { .menu-close & { margin-right: 0px; @@ -710,7 +714,7 @@ main { .menu-top &{ margin: 0; - padding: 5px 2px; + padding: 5px 2px; top: 2.5em; position: absolute; background-color: color-mix(in srgb, rgb(0, 0, 0) 30%, $nav-background-color 70%); @@ -733,7 +737,7 @@ main { border-radius: 5px; // pointer-events: auto; font-size: 12px; - + .menu-close & { padding: 1px 2px; margin: 0 !important; @@ -745,12 +749,12 @@ main { &.active, &:hover{ background-color: $nav-hover-color; } - + .menu-top &{ padding: 5px 2px; } a { - display: flex; + display: flex; align-items: center; // width: 100%; font-size: inherit !important; @@ -762,7 +766,7 @@ main { i { margin-right: 3px; color: $nav-text-color; - + .menu-close & { margin-right: 0px; } @@ -799,7 +803,7 @@ main { content: "\f005"; line-height: 1; } - .favorite-mode & { + .favorite-mode & { pointer-events: auto; &::before { display: inline-block; @@ -819,7 +823,7 @@ main { // } } - #submenu-favorite { + #submenu-favorite { >p{ display: inline; @@ -828,7 +832,7 @@ main { &:not(:only-child) { display: none; } - + } } @@ -854,7 +858,7 @@ main { .nav-side-menu ul ul a li p { font-weight: 400; } - + // .nav-side-menu p:hover { // background-color: transparent; // } @@ -882,7 +886,7 @@ main { border-bottom-left-radius: 20px; } } - + .menu-close & { #main-test:not(.menu-top, .menu-bubble) &{ >ul>:not(#menu-options){ @@ -927,8 +931,8 @@ main { &:hover { text-decoration: none !important; } - } - + } + span { margin: 0; @@ -979,8 +983,8 @@ main { // .copyright-message a { // color: white; // } - -.menu-close .copyright-message { + +.menu-close .copyright-message, .menu-top .copyright-message { display: none; } /* .nav-side-menu li a { @@ -1026,7 +1030,7 @@ main { .dropdown-menu.show { display: block; } - + .dropdown-menu { max-height: 50vh; overflow-x: hidden; @@ -1105,7 +1109,7 @@ div.chip>p { .search { height: 2rem; border-radius: 0; - + input { height: 100%; border: 1px solid $primary-color !important; @@ -1177,7 +1181,7 @@ div.chip>p { filter: invert(1) !important; & * { background-color: black !important; - color: white !important; + color: white !important; } } @@ -1261,4 +1265,4 @@ div.chip>p { #data-selection-widget-modal input[name="search"] { display: none; -} \ No newline at end of file +} diff --git a/inc/config.class.php b/inc/config.class.php index e0183cde60..ea81194b92 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -40,64 +40,64 @@ use Laminas\Cache\Storage\AvailableSpaceCapableInterface; if (!defined('GLPI_ROOT')) { - die("Sorry. You can't access this file directly"); + die("Sorry. You can't access this file directly"); } /** * Config class -**/ + **/ class Config extends CommonDBTM { - const DELETE_ALL = -1; - const KEEP_ALL = 0; + const DELETE_ALL = -1; + const KEEP_ALL = 0; - // From CommonGLPI - protected $displaylist = false; + // From CommonGLPI + protected $displaylist = false; - // From CommonDBTM - public $auto_message_on_action = false; - public $showdebug = true; + // From CommonDBTM + public $auto_message_on_action = false; + public $showdebug = true; - static $rightname = 'config'; + static $rightname = 'config'; - static $undisclosedFields = ['proxy_passwd', 'smtp_passwd']; - static $saferUndisclosedFields = ['admin_email', 'admin_reply']; + static $undisclosedFields = ['proxy_passwd', 'smtp_passwd']; + static $saferUndisclosedFields = ['admin_email', 'admin_reply']; - static function getTypeName($nb = 0) { - return __('Setup'); + static function getTypeName($nb = 0) { + return __('Setup'); } static function getMenuContent() { - $menu = []; - if (static::canView()) { - $menu['title'] = _x('setup', 'General'); - $menu['page'] = Config::getFormURL(false); - $menu['icon'] = Config::getIcon(); + $menu = []; + if (static::canView()) { + $menu['title'] = _x('setup', 'General'); + $menu['page'] = Config::getFormURL(false); + $menu['icon'] = Config::getIcon(); - $menu['options']['apiclient']['title'] = APIClient::getTypeName(Session::getPluralNumber()); - $menu['options']['apiclient']['page'] = Config::getFormURL(false) . '?forcetab=Config$8'; - $menu['options']['apiclient']['links']['search'] = Config::getFormURL(false) . '?forcetab=Config$8'; - $menu['options']['apiclient']['links']['add'] = '/front/apiclient.form.php'; + $menu['options']['apiclient']['title'] = APIClient::getTypeName(Session::getPluralNumber()); + $menu['options']['apiclient']['page'] = Config::getFormURL(false) . '?forcetab=Config$8'; + $menu['options']['apiclient']['links']['search'] = Config::getFormURL(false) . '?forcetab=Config$8'; + $menu['options']['apiclient']['links']['add'] = '/front/apiclient.form.php'; } if (count($menu)) { - return $menu; + return $menu; } return false; } static function canCreate() { - return false; + return false; } function canViewItem() { - if (isset($this->fields['context']) && - ($this->fields['context'] == 'core' || - Plugin::isPluginActive($this->fields['context']))) { - return true; + if (isset($this->fields['context']) && + ($this->fields['context'] == 'core' || + Plugin::isPluginActive($this->fields['context']))) { + return true; } return false; } @@ -105,37 +105,37 @@ function canViewItem() { function defineTabs($options = []) { - $ong = []; - $this->addStandardTab(__CLASS__, $ong, $options); - $this->addStandardTab('Log', $ong, $options); + $ong = []; + $this->addStandardTab(__CLASS__, $ong, $options); + $this->addStandardTab('Log', $ong, $options); - return $ong; + return $ong; } function prepareInputForUpdate($input) { - global $CFG_GLPI; + global $CFG_GLPI; - // Unset _no_history to not save it as a configuration value - unset($input['_no_history']); + // Unset _no_history to not save it as a configuration value + unset($input['_no_history']); - // Update only an item - if (isset($input['context'])) { - return $input; + // Update only an item + if (isset($input['context'])) { + return $input; } // Process configuration for plugins if (!empty($input['config_context'])) { - $config_context = $input['config_context']; - unset($input['id']); - unset($input['_glpi_csrf_token']); - unset($input['update']); - unset($input['config_context']); - if ((!empty($input['config_class'])) - && (class_exists($input['config_class'])) - && (method_exists ($input['config_class'], 'configUpdate'))) { - $config_method = $input['config_class'].'::configUpdate'; - unset($input['config_class']); - $input = call_user_func($config_method, $input); + $config_context = $input['config_context']; + unset($input['id']); + unset($input['_glpi_csrf_token']); + unset($input['update']); + unset($input['config_context']); + if ((!empty($input['config_class'])) + && (class_exists($input['config_class'])) + && (method_exists ($input['config_class'], 'configUpdate'))) { + $config_method = $input['config_class'].'::configUpdate'; + unset($input['config_class']); + $input = call_user_func($config_method, $input); } $this->setConfigurationValues($config_context, $input); return false; @@ -144,74 +144,74 @@ function prepareInputForUpdate($input) { // Trim automatically endig slash for url_base config as, for all existing occurences, // this URL will be prepended to something that starts with a slash. if (isset($input["url_base"]) && !empty($input["url_base"])) { - if (Toolbox::isValidWebUrl($input["url_base"])) { - $input["url_base"] = rtrim($input["url_base"], '/'); + if (Toolbox::isValidWebUrl($input["url_base"])) { + $input["url_base"] = rtrim($input["url_base"], '/'); } else { - Session::addMessageAfterRedirect(__('Invalid base URL!'), false, ERROR); - return false; + Session::addMessageAfterRedirect(__('Invalid base URL!'), false, ERROR); + return false; } } if (isset($input["url_base_api"]) && !empty($input["url_base_api"])) { - if (!Toolbox::isValidWebUrl($input["url_base_api"])) { - Session::addMessageAfterRedirect(__('Invalid API base URL!'), false, ERROR); - return false; + if (!Toolbox::isValidWebUrl($input["url_base_api"])) { + Session::addMessageAfterRedirect(__('Invalid API base URL!'), false, ERROR); + return false; } } if (isset($input['allow_search_view']) && !$input['allow_search_view']) { - // Global search need "view" - $input['allow_search_global'] = 0; + // Global search need "view" + $input['allow_search_global'] = 0; } if (isset($input["smtp_passwd"]) && empty($input["smtp_passwd"])) { - unset($input["smtp_passwd"]); + unset($input["smtp_passwd"]); } if (isset($input["_blank_smtp_passwd"]) && $input["_blank_smtp_passwd"]) { - $input['smtp_passwd'] = ''; + $input['smtp_passwd'] = ''; } if (isset($input["proxy_passwd"]) && empty($input["proxy_passwd"])) { - unset($input["proxy_passwd"]); + unset($input["proxy_passwd"]); } if (isset($input["_blank_proxy_passwd"]) && $input["_blank_proxy_passwd"]) { - $input['proxy_passwd'] = ''; + $input['proxy_passwd'] = ''; } // Manage DB Slave process if (isset($input['_dbslave_status'])) { - $already_active = DBConnection::isDBSlaveActive(); + $already_active = DBConnection::isDBSlaveActive(); - if ($input['_dbslave_status']) { - DBConnection::changeCronTaskStatus(true); + if ($input['_dbslave_status']) { + DBConnection::changeCronTaskStatus(true); - if (!$already_active) { - // Activate Slave from the "system" tab - DBConnection::createDBSlaveConfig(); + if (!$already_active) { + // Activate Slave from the "system" tab + DBConnection::createDBSlaveConfig(); } else if (isset($input["_dbreplicate_dbhost"])) { - // Change parameter from the "replicate" tab - DBConnection::saveDBSlaveConf($input["_dbreplicate_dbhost"], - $input["_dbreplicate_dbuser"], - $input["_dbreplicate_dbpassword"], - $input["_dbreplicate_dbdefault"]); + // Change parameter from the "replicate" tab + DBConnection::saveDBSlaveConf($input["_dbreplicate_dbhost"], + $input["_dbreplicate_dbuser"], + $input["_dbreplicate_dbpassword"], + $input["_dbreplicate_dbdefault"]); } } if (!$input['_dbslave_status'] && $already_active) { - DBConnection::deleteDBSlaveConfig(); - DBConnection::changeCronTaskStatus(false); + DBConnection::deleteDBSlaveConfig(); + DBConnection::changeCronTaskStatus(false); } } // Matrix for Impact / Urgence / Priority if (isset($input['_matrix'])) { - $tab = []; + $tab = []; - for ($urgency=1; $urgency<=5; $urgency++) { - for ($impact=1; $impact<=5; $impact++) { - $priority = $input["_matrix_{$urgency}_{$impact}"]; - $tab[$urgency][$impact] = $priority; + for ($urgency=1; $urgency<=5; $urgency++) { + for ($impact=1; $impact<=5; $impact++) { + $priority = $input["_matrix_{$urgency}_{$impact}"]; + $tab[$urgency][$impact] = $priority; } } @@ -220,30 +220,30 @@ function prepareInputForUpdate($input) { $input['impact_mask'] = 0; for ($i=1; $i<=5; $i++) { - if ($input["_urgency_{$i}"]) { - $input['urgency_mask'] += (1<<$i); + if ($input["_urgency_{$i}"]) { + $input['urgency_mask'] += (1<<$i); } if ($input["_impact_{$i}"]) { - $input['impact_mask'] += (1<<$i); + $input['impact_mask'] += (1<<$i); } } } if (isset($input['_update_devices_in_menu'])) { - $input['devices_in_menu'] = exportArrayToDB( - (isset($input['devices_in_menu']) ? $input['devices_in_menu'] : []) + $input['devices_in_menu'] = exportArrayToDB( + (isset($input['devices_in_menu']) ? $input['devices_in_menu'] : []) ); } // lock mechanism update if (isset( $input['lock_use_lock_item'])) { $input['lock_item_list'] = exportArrayToDB((isset($input['lock_item_list']) - ? $input['lock_item_list'] : [])); + ? $input['lock_item_list'] : [])); } if (isset($input[Impact::CONF_ENABLED])) { - $input[Impact::CONF_ENABLED] = exportArrayToDB($input[Impact::CONF_ENABLED]); + $input[Impact::CONF_ENABLED] = exportArrayToDB($input[Impact::CONF_ENABLED]); } // Beware : with new management system, we must update each value @@ -253,10 +253,10 @@ function prepareInputForUpdate($input) { // Add skipMaintenance if maintenance mode update if (isset($input['maintenance_mode']) && $input['maintenance_mode']) { - $_SESSION['glpiskipMaintenance'] = 1; - $url = $CFG_GLPI['root_doc']."/index.php?skipMaintenance=1"; - Session::addMessageAfterRedirect(sprintf(__('Maintenance mode activated. Backdoor using: %s'), - "$url"), + $_SESSION['glpiskipMaintenance'] = 1; + $url = $CFG_GLPI['root_doc']."/index.php?skipMaintenance=1"; + Session::addMessageAfterRedirect(sprintf(__('Maintenance mode activated. Backdoor using: %s'), + "$url"), false, WARNING); } @@ -266,12 +266,12 @@ function prepareInputForUpdate($input) { } static public function unsetUndisclosedFields(&$fields) { - if (isset($fields['context']) && isset($fields['name'])) { - if ($fields['context'] == 'core' - && in_array($fields['name'], self::$undisclosedFields)) { - unset($fields['value']); + if (isset($fields['context']) && isset($fields['name'])) { + if ($fields['context'] == 'core' + && in_array($fields['name'], self::$undisclosedFields)) { + unset($fields['value']); } else { - $fields = Plugin::doHookFunction('undiscloseConfigValue', $fields); + $fields = Plugin::doHookFunction('undiscloseConfigValue', $fields); } } } @@ -280,216 +280,216 @@ static public function unsetUndisclosedFields(&$fields) { * Print the config form for display * * @return void - **/ + **/ function showFormDisplay() { - global $CFG_GLPI; + global $CFG_GLPI; - if (!self::canView()) { - return; + if (!self::canView()) { + return; } $rand = mt_rand(); $canedit = Session::haveRight(self::$rightname, UPDATE); $form = [ - 'action' => $canedit ? Toolbox::getItemTypeFormURL('config') : '', - 'buttons' => $canedit ? [ - [ - 'type' => 'submit', - 'name' => 'update', - 'value' => __('Update'), - 'class' => 'btn btn-secondary' + 'action' => $canedit ? Toolbox::getItemTypeFormURL('config') : '', + 'buttons' => $canedit ? [ + [ + 'type' => 'submit', + 'name' => 'update', + 'value' => __('Update'), + 'class' => 'btn btn-secondary' ] ] : [], 'content' => [ - __('General setup') => [ - 'visible' => true, - 'inputs' => [ - __('URL of the application') => [ - 'name' => 'url_base', - 'type' => 'text', - 'value' => $CFG_GLPI["url_base"], - 'col_lg' => 12, - 'col_md' => 12, + __('General setup') => [ + 'visible' => true, + 'inputs' => [ + __('URL of the application') => [ + 'name' => 'url_base', + 'type' => 'text', + 'value' => $CFG_GLPI["url_base"], + 'col_lg' => 12, + 'col_md' => 12, ], __('Text in the login box') => [ - 'name' => 'text_login', - 'type' => 'textarea', - 'value' => $CFG_GLPI["text_login"], - 'col_lg' => 12, - 'col_md' => 12, + 'name' => 'text_login', + 'type' => 'textarea', + 'value' => $CFG_GLPI["text_login"], + 'col_lg' => 12, + 'col_md' => 12, ], __('Simplified interface help link') => [ - 'name' => 'helpdesk_doc_url', - 'type' => 'text', - 'value' => $CFG_GLPI["helpdesk_doc_url"], - 'col_lg' => 6, + 'name' => 'helpdesk_doc_url', + 'type' => 'text', + 'value' => $CFG_GLPI["helpdesk_doc_url"], + 'col_lg' => 6, ], __('Standard interface help link') => [ - 'name' => 'central_doc_url', - 'type' => 'text', - 'value' => $CFG_GLPI["central_doc_url"], - 'col_lg' => 6, + 'name' => 'central_doc_url', + 'type' => 'text', + 'value' => $CFG_GLPI["central_doc_url"], + 'col_lg' => 6, ], __('Allow FAQ anonymous access') => [ - 'name' => 'use_public_faq', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["use_public_faq"], - 'col_lg' => 6, + 'name' => 'use_public_faq', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["use_public_faq"], + 'col_lg' => 6, ], __('Default characters limit (summary text boxes)') => [ - 'name' => 'cut', - 'type' => 'number', - 'value' => $CFG_GLPI["cut"], - 'col_lg' => 6, + 'name' => 'cut', + 'type' => 'number', + 'value' => $CFG_GLPI["cut"], + 'col_lg' => 6, ], __('Default url length limit') => [ - 'name' => 'url_maxlength', - 'type' => 'number', - 'value' => $CFG_GLPI["url_maxlength"], - 'min' => 20, - 'max' => 80, - 'step' => 5, - 'col_lg' => 6, + 'name' => 'url_maxlength', + 'type' => 'number', + 'value' => $CFG_GLPI["url_maxlength"], + 'min' => 20, + 'max' => 80, + 'step' => 5, + 'col_lg' => 6, ], __('Default decimals limit') => [ - 'name' => 'decimal_number', - 'type' => 'number', - 'value' => $CFG_GLPI["decimal_number"], - 'min' => 1, - 'max' => 4, + 'name' => 'decimal_number', + 'type' => 'number', + 'value' => $CFG_GLPI["decimal_number"], + 'min' => 1, + 'max' => 4, ], __("Translation of dropdowns") => [ - 'name' => 'translate_dropdowns', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["translate_dropdowns"], + 'name' => 'translate_dropdowns', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["translate_dropdowns"], ], __("Knowledge base translation") => [ - 'name' => 'translate_kb', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["translate_kb"], + 'name' => 'translate_kb', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["translate_kb"], ], __("Translation of reminders") => [ - 'name' => 'translate_reminders', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["translate_reminders"], + 'name' => 'translate_reminders', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["translate_reminders"], ], ] ], __('Dynamic display') => [ - 'visible' => true, - 'inputs' => [ - __('Page size for dropdown (paging using scroll)') => [ - 'name' => 'dropdown_max', - 'type' => 'number', - 'value' => $CFG_GLPI["dropdown_max"], - 'min' => 1, - 'max' => 200, - 'col_lg' => 6, + 'visible' => true, + 'inputs' => [ + __('Page size for dropdown (paging using scroll)') => [ + 'name' => 'dropdown_max', + 'type' => 'number', + 'value' => $CFG_GLPI["dropdown_max"], + 'min' => 1, + 'max' => 200, + 'col_lg' => 6, ], __('Autocompletion of text fields') => [ - 'name' => 'use_ajax_autocompletion', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["use_ajax_autocompletion"], - 'col_lg' => 6, + 'name' => 'use_ajax_autocompletion', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["use_ajax_autocompletion"], + 'col_lg' => 6, ], __("Don't show search engine in dropdowns if the number of items is less than") => [ - 'name' => 'ajax_limit_count', - 'type' => 'number', - 'value' => $CFG_GLPI["ajax_limit_count"], - 'min' => 1, - 'max' => 200, - 'step' => 1, - 'after' => "0 => " . __('Never'), - 'col_lg' => 12, - 'col_mg' => 12, + 'name' => 'ajax_limit_count', + 'type' => 'number', + 'value' => $CFG_GLPI["ajax_limit_count"], + 'min' => 1, + 'max' => 200, + 'step' => 1, + 'after' => "0 => " . __('Never'), + 'col_lg' => 12, + 'col_mg' => 12, ], ] ], __('Search engine') => [ - 'visible' => true, - 'inputs' => [ - __('Items seen') => [ - 'name' => 'allow_search_view', - 'type' => 'select', - 'values' => [ - 0 => __('No'), - 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')), - 2 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('default criterion')) + 'visible' => true, + 'inputs' => [ + __('Items seen') => [ + 'name' => 'allow_search_view', + 'type' => 'select', + 'values' => [ + 0 => __('No'), + 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')), + 2 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('default criterion')) ], 'value' => $CFG_GLPI['allow_search_view'], ], __('Global search') => [ - 'name' => 'allow_search_global', - 'type' => 'select', - 'values' => [ - 0 => __('No'), - 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')) + 'name' => 'allow_search_global', + 'type' => 'select', + 'values' => [ + 0 => __('No'), + 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')) ], 'value' => $CFG_GLPI['allow_search_global'], ], __('All') => [ - 'name' => 'allow_search_all', - 'type' => 'select', - 'values' => [ - 0 => __('No'), - 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')) + 'name' => 'allow_search_all', + 'type' => 'select', + 'values' => [ + 0 => __('No'), + 1 => sprintf(__('%1$s (%2$s)'), __('Yes'), __('last criterion')) ], 'value' => $CFG_GLPI['allow_search_all'], ], ] ], __('Item locks') => [ - 'visible' => true, - 'inputs' => [ - __('Use locks') => [ - 'name' => 'lock_use_lock_item', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["lock_use_lock_item"], + 'visible' => true, + 'inputs' => [ + __('Use locks') => [ + 'name' => 'lock_use_lock_item', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["lock_use_lock_item"], ], __('Profile to be used when locking items') => ($CFG_GLPI["lock_use_lock_item"]) ? [ - 'name' => 'lock_lockprofile_id', - 'type' => 'select', - 'values' => getOptionForItems('Profile'), - 'value' => $CFG_GLPI["lock_lockprofile_id"], - 'action' => getItemActionButtons(['info'], 'Profile'), + 'name' => 'lock_lockprofile_id', + 'type' => 'select', + 'values' => getOptionForItems('Profile'), + 'value' => $CFG_GLPI["lock_lockprofile_id"], + 'action' => getItemActionButtons(['info'], 'Profile'), ] : [ - 'content' => Dropdown::getDropdownName(Profile::getTable(), $CFG_GLPI['lock_lockprofile_id']), + 'content' => Dropdown::getDropdownName(Profile::getTable(), $CFG_GLPI['lock_lockprofile_id']), ], __('List of items to lock') => [ - 'name' => 'lock_item_list', - 'type' => 'checklist', - 'options' => ObjectLock::getLockableObjects(), - 'values' => $CFG_GLPI['lock_item_list'], - !$CFG_GLPI["lock_use_lock_item"] ? 'disabled' : '', + 'name' => 'lock_item_list', + 'type' => 'checklist', + 'options' => ObjectLock::getLockableObjects(), + 'values' => $CFG_GLPI['lock_item_list'], + !$CFG_GLPI["lock_use_lock_item"] ? 'disabled' : '', ], ] ], __('Auto Login') => [ - 'visible' => true, - 'inputs' => [ - __('Time to allow "Remember Me"') => [ - 'name' => 'login_remember_time', - 'type' => 'select', - 'values' => array_merge([__('Disabled')], Timezone::GetTimeStamp([ - 'value' => $CFG_GLPI["login_remember_time"], - 'min' => 0, - 'max' => MONTH_TIMESTAMP * 2, - 'step' => DAY_TIMESTAMP, - 'toadd' => [HOUR_TIMESTAMP, HOUR_TIMESTAMP * 2, HOUR_TIMESTAMP * 6, HOUR_TIMESTAMP * 12], - 'rand' => $rand + 'visible' => true, + 'inputs' => [ + __('Time to allow "Remember Me"') => [ + 'name' => 'login_remember_time', + 'type' => 'select', + 'values' => array_merge([__('Disabled')], Timezone::GetTimeStamp([ + 'value' => $CFG_GLPI["login_remember_time"], + 'min' => 0, + 'max' => MONTH_TIMESTAMP * 2, + 'step' => DAY_TIMESTAMP, + 'toadd' => [HOUR_TIMESTAMP, HOUR_TIMESTAMP * 2, HOUR_TIMESTAMP * 6, HOUR_TIMESTAMP * 12], + 'rand' => $rand ])), 'value' => $CFG_GLPI["login_remember_time"], ], __("Default state of checkbox") => [ - 'name' => 'login_remember_default', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["login_remember_default"], + 'name' => 'login_remember_default', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["login_remember_default"], ], __('Display source dropdown on login page') => [ - 'name' => 'display_login_source', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["display_login_source"], + 'name' => 'display_login_source', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["display_login_source"], ], ] ], @@ -503,12 +503,12 @@ function showFormDisplay() { * Print the config form for restrictions * * @return void - **/ + **/ function showFormInventory() { - global $CFG_GLPI; + global $CFG_GLPI; - if (!self::canView()) { - return; + if (!self::canView()) { + return; } $rand = mt_rand(); @@ -516,202 +516,202 @@ function showFormInventory() { $item_devices_types = []; foreach ($CFG_GLPI['itemdevices'] as $key => $itemtype) { - if ($item = getItemForItemtype($itemtype)) { - $item_devices_types[$itemtype] = $item->getTypeName(); + if ($item = getItemForItemtype($itemtype)) { + $item_devices_types[$itemtype] = $item->getTypeName(); } else { - unset($CFG_GLPI['itemdevices'][$key]); + unset($CFG_GLPI['itemdevices'][$key]); } } $form = [ - 'action' => $canedit ? Toolbox::getItemTypeFormURL('config') : '', - 'buttons' => [ - $canedit ? [ - 'type' => 'submit', - 'name' => 'update', - 'value' => __('Update'), - 'class' => 'btn btn-secondary' + 'action' => $canedit ? Toolbox::getItemTypeFormURL('config') : '', + 'buttons' => [ + $canedit ? [ + 'type' => 'submit', + 'name' => 'update', + 'value' => __('Update'), + 'class' => 'btn btn-secondary' ] : [], ], 'content' => [ - __('Assets') => [ - 'visible' => true, - 'inputs' => [ - __('Enable the financial and administrative information by default') => [ - 'name' => 'auto_create_infocoms', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["auto_create_infocoms"], - 'col_lg' => 6, + __('Assets') => [ + 'visible' => true, + 'inputs' => [ + __('Enable the financial and administrative information by default') => [ + 'name' => 'auto_create_infocoms', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["auto_create_infocoms"], + 'col_lg' => 6, ], __('Software category deleted by the dictionary rules') => [ - 'name' => 'softwarecategories_id_ondelete', - 'type' => 'select', - 'values' => getOptionForItems('SoftwareCategory'), - 'value' => $CFG_GLPI["softwarecategories_id_ondelete"], - 'col_lg' => 6, + 'name' => 'softwarecategories_id_ondelete', + 'type' => 'select', + 'values' => getOptionForItems('SoftwareCategory'), + 'value' => $CFG_GLPI["softwarecategories_id_ondelete"], + 'col_lg' => 6, ], __('Restrict monitor management') => [ - 'name' => 'monitors_management_restrict', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["monitors_management_restrict"], - 'col_lg' => 6, + 'name' => 'monitors_management_restrict', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["monitors_management_restrict"], + 'col_lg' => 6, ], __('Restrict device management') => [ - 'name' => 'peripherals_management_restrict', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["peripherals_management_restrict"], - 'col_lg' => 6, + 'name' => 'peripherals_management_restrict', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["peripherals_management_restrict"], + 'col_lg' => 6, ], __('Restrict phone management') => [ - 'name' => 'phones_management_restrict', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["phones_management_restrict"], - 'col_lg' => 6, + 'name' => 'phones_management_restrict', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["phones_management_restrict"], + 'col_lg' => 6, ], __('Restrict printer management') => [ - 'name' => 'printers_management_restrict', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["printers_management_restrict"], - 'col_lg' => 6, + 'name' => 'printers_management_restrict', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["printers_management_restrict"], + 'col_lg' => 6, ], __('End of fiscal year') => [ - 'name' => 'date_tax', - 'type' => 'date', - 'value' => $CFG_GLPI["date_tax"], - 'rand' => $rand, - 'col_lg' => 6, - 'required' => true, + 'name' => 'date_tax', + 'type' => 'date', + 'value' => $CFG_GLPI["date_tax"], + 'rand' => $rand, + 'col_lg' => 6, + 'required' => true, ], __('Automatic fields (marked by *)') => [ - 'name' => 'use_autoname_by_entity', - 'type' => 'select', - 'values' => [ - 0 => __('Global'), - 1 => __('By entity') + 'name' => 'use_autoname_by_entity', + 'type' => 'select', + 'values' => [ + 0 => __('Global'), + 1 => __('By entity') ], 'value' => $CFG_GLPI["use_autoname_by_entity"], 'rand' => $rand, 'col_lg' => 6, ], __('Devices displayed in menu') => [ - 'type' => 'checklist', - 'name' => 'devices_in_menu', - 'options' => $item_devices_types, - 'values' => $CFG_GLPI['devices_in_menu'], + 'type' => 'checklist', + 'name' => 'devices_in_menu', + 'options' => $item_devices_types, + 'values' => $CFG_GLPI['devices_in_menu'], ], [ - 'name' => '_update_devices_in_menu', - 'type' => 'hidden', - 'value' => 1, + 'name' => '_update_devices_in_menu', + 'type' => 'hidden', + 'value' => 1, ], __('Automatic transfer of computers') => (Session::haveRightsOr("transfer", [CREATE, UPDATE]) - && Session::isMultiEntitiesMode()) ? [ - 'name' => 'transfers_id_auto', - 'type' => 'select', - 'values' => array_merge([__('No automatic transfer')], getOptionForItems('Transfer')), - 'value' => $CFG_GLPI["transfers_id_auto"], + && Session::isMultiEntitiesMode()) ? [ + 'name' => 'transfers_id_auto', + 'type' => 'select', + 'values' => array_merge([__('No automatic transfer')], getOptionForItems('Transfer')), + 'value' => $CFG_GLPI["transfers_id_auto"], ] : [], ] ], __('Automatically update of the elements related to the computers') . ' : ' . __('Unit management') => [ - 'visible' => true, - 'inputs' => [ - __('Alternate username') . '(' . __('When connecting or updating') . ')' => [ - 'name' => 'is_contact_autoupdate', - 'type' => 'select', - 'values' => [ - 0 => __('Do not copy'), - 1 => __('Copy'), + 'visible' => true, + 'inputs' => [ + __('Alternate username') . '(' . __('When connecting or updating') . ')' => [ + 'name' => 'is_contact_autoupdate', + 'type' => 'select', + 'values' => [ + 0 => __('Do not copy'), + 1 => __('Copy'), ], 'value' => $CFG_GLPI["is_contact_autoupdate"], 'col_lg' => 6, ], __('Alternate username') . '(' . __('When disconnecting') . ')' => [ - 'name' => 'is_contact_autoclean', - 'type' => 'select', - 'values' => [ - 0 => __('Do not delete'), - 1 => __('Clear'), + 'name' => 'is_contact_autoclean', + 'type' => 'select', + 'values' => [ + 0 => __('Do not delete'), + 1 => __('Clear'), ], 'value' => $CFG_GLPI["is_contact_autoclean"], 'col_lg' => 6, ], User::getTypeName(1) . '(' . __('When connecting or updating') . ')' => [ - 'name' => 'is_user_autoupdate', - 'type' => 'select', - 'values' => [ - 0 => __('Do not copy'), - 1 => __('Copy'), + 'name' => 'is_user_autoupdate', + 'type' => 'select', + 'values' => [ + 0 => __('Do not copy'), + 1 => __('Copy'), ], 'value' => $CFG_GLPI["is_user_autoupdate"], 'col_lg' => 6, ], User::getTypeName(1) . '(' . __('When disconnecting') . ')' => [ - 'name' => 'is_user_autoclean', - 'type' => 'select', - 'values' => [ - 0 => __('Do not delete'), - 1 => __('Clear'), + 'name' => 'is_user_autoclean', + 'type' => 'select', + 'values' => [ + 0 => __('Do not delete'), + 1 => __('Clear'), ], 'value' => $CFG_GLPI["is_user_autoclean"], 'col_lg' => 6, ], Group::getTypeName(1) . '(' . __('When connecting or updating') . ')' => [ - 'name' => 'is_group_autoupdate', - 'type' => 'select', - 'values' => [ - 0 => __('Do not copy'), - 1 => __('Copy'), + 'name' => 'is_group_autoupdate', + 'type' => 'select', + 'values' => [ + 0 => __('Do not copy'), + 1 => __('Copy'), ], 'value' => $CFG_GLPI["is_group_autoupdate"], 'col_lg' => 6, ], Group::getTypeName(1) . '(' . __('When disconnecting') . ')' => [ - 'name' => 'is_group_autoclean', - 'type' => 'select', - 'values' => [ - 0 => __('Do not delete'), - 1 => __('Clear'), + 'name' => 'is_group_autoclean', + 'type' => 'select', + 'values' => [ + 0 => __('Do not delete'), + 1 => __('Clear'), ], 'value' => $CFG_GLPI["is_group_autoclean"], 'col_lg' => 6, ], Location::getTypeName(1) . '(' . __('When connecting or updating') . ')' => [ - 'name' => 'is_location_autoupdate', - 'type' => 'select', - 'values' => [ - 0 => __('Do not copy'), - 1 => __('Copy'), + 'name' => 'is_location_autoupdate', + 'type' => 'select', + 'values' => [ + 0 => __('Do not copy'), + 1 => __('Copy'), ], 'value' => $CFG_GLPI["is_location_autoupdate"], 'col_lg' => 6, ], Location::getTypeName(1) . '(' . __('When disconnecting') . ')' => [ - 'name' => 'is_location_autoclean', - 'type' => 'select', - 'values' => [ - 0 => __('Do not delete'), - 1 => __('Clear'), + 'name' => 'is_location_autoclean', + 'type' => 'select', + 'values' => [ + 0 => __('Do not delete'), + 1 => __('Clear'), ], 'value' => $CFG_GLPI["is_location_autoclean"], 'col_lg' => 6, ], __('Status') . '(' . __('When connecting or updating') . ')' => [ - 'name' => 'state_autoupdate_mode', - 'type' => 'select', - 'values' => [ - 0 => __('Do not copy'), - 1 => __('Copy computer status'), + 'name' => 'state_autoupdate_mode', + 'type' => 'select', + 'values' => [ + 0 => __('Do not copy'), + 1 => __('Copy computer status'), ], 'value' => $CFG_GLPI["state_autoupdate_mode"], 'col_lg' => 6, ], __('Status') . '(' . __('When disconnecting') . ')' => [ - 'name' => 'state_autoclean_mode', - 'type' => 'select', - 'values' => [ - 0 => __('Do not delete'), - 1 => __('Clear status'), + 'name' => 'state_autoclean_mode', + 'type' => 'select', + 'values' => [ + 0 => __('Do not delete'), + 1 => __('Clear status'), ], 'value' => $CFG_GLPI["state_autoclean_mode"], 'col_lg' => 6, @@ -728,50 +728,50 @@ function showFormInventory() { * Print the config form for restrictions * * @return void - **/ + **/ function showFormAuthentication() { - global $CFG_GLPI; + global $CFG_GLPI; - if (!Config::canUpdate()) { - return; + if (!Config::canUpdate()) { + return; } $form = [ - 'action' => Toolbox::getItemTypeFormURL('config'), - 'buttons' => [ - [ - 'type' => 'submit', - 'name' => 'update_auth', - 'value' => _sx('button', 'Save'), - 'class' => 'btn btn-secondary', - ], + 'action' => Toolbox::getItemTypeFormURL('config'), + 'buttons' => [ + [ + 'type' => 'submit', + 'name' => 'update_auth', + 'value' => _sx('button', 'Save'), + 'class' => 'btn btn-secondary', + ], ], 'content' => [ - __('Authentication') => [ - 'visible' => true, - 'inputs' => [ - __('Automatically add users from an external authentication source') => [ - 'name' => 'is_users_auto_add', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["is_users_auto_add"], + __('Authentication') => [ + 'visible' => true, + 'inputs' => [ + __('Automatically add users from an external authentication source') => [ + 'name' => 'is_users_auto_add', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["is_users_auto_add"], ], __('Add a user without accreditation from a LDAP directory') => [ - 'name' => 'use_noright_users_add', - 'type' => 'checkbox', - 'value' => $CFG_GLPI["use_noright_users_add"], + 'name' => 'use_noright_users_add', + 'type' => 'checkbox', + 'value' => $CFG_GLPI["use_noright_users_add"], ], __('Action when a user is deleted from the LDAP directory') => [ - 'name' => 'user_deleted_ldap', - 'type' => 'select', - 'values' => AuthLDAP::getLdapDeletedUserActionOptions(), - 'value' => $CFG_GLPI["user_deleted_ldap"], + 'name' => 'user_deleted_ldap', + 'type' => 'select', + 'values' => AuthLDAP::getLdapDeletedUserActionOptions(), + 'value' => $CFG_GLPI["user_deleted_ldap"], ], __('ITSM-NG server time zone') => [ - 'name' => 'time_offset', - 'type' => 'select', - // 'values' => '' ?? Timezone::showGMT(), - 'values' => [], - 'value' => $CFG_GLPI["time_offset"], + 'name' => 'time_offset', + 'type' => 'select', + // 'values' => '' ?? Timezone::showGMT(), + 'values' => [], + 'value' => $CFG_GLPI["time_offset"], ], ], ], @@ -786,12 +786,12 @@ function showFormAuthentication() { * Print the config form for slave DB * * @return void - **/ + **/ function showFormDBSlave() { - global $DB, $CFG_GLPI, $DBslave; + global $DB, $CFG_GLPI, $DBslave; - if (!Config::canUpdate()) { - return; + if (!Config::canUpdate()) { + return; } echo "
HTML, diff --git a/inc/html.class.php b/inc/html.class.php index 5765f6e73a..9b54f52c3e 100755 --- a/inc/html.class.php +++ b/inc/html.class.php @@ -36,7 +36,7 @@ use ScssPhp\ScssPhp\Compiler; if (!defined('GLPI_ROOT')) { - die("Sorry. You can't access this file directly"); + die("Sorry. You can't access this file directly"); } /** @@ -45,54 +45,54 @@ **/ class Html { - static private $css = [ - 'vendor/wenzhixin/bootstrap-table/dist/bootstrap-table.min.css', - 'css/bootstrap-select.min.css', - 'node_modules/@jarstone/dselect/dist/css/dselect.min.css', - "node_modules/jquery-ui-dist/jquery-ui.min.css", - 'node_modules/@fortawesome/fontawesome-free/css/all.css', - 'css/jstree-glpi.css', + static private $css = [ + 'vendor/wenzhixin/bootstrap-table/dist/bootstrap-table.min.css', + 'css/bootstrap-select.min.css', + 'node_modules/@jarstone/dselect/dist/css/dselect.min.css', + "node_modules/jquery-ui-dist/jquery-ui.min.css", + 'node_modules/@fortawesome/fontawesome-free/css/all.css', + 'css/jstree-glpi.css', ]; - static private $scss = [ - 'css/styles', - 'css/itsm2.scss', + static private $scss = [ + 'css/styles', + 'css/itsm2.scss', ]; - static private $js = [ - "node_modules/jquery-ui-dist/jquery-ui.min.js", - "vendor/twbs/bootstrap/dist/js/bootstrap.bundle.min.js", - "node_modules/tableexport.jquery.plugin/tableExport.min.js", - "vendor/wenzhixin/bootstrap-table/dist/bootstrap-table.min.js", - "vendor/wenzhixin/bootstrap-table/src/extensions/export/bootstrap-table-export.js", - "node_modules/@jarstone/dselect/dist/js/dselect.min.js", - "src/ngFunctions.js", + static private $js = [ + "node_modules/jquery-ui-dist/jquery-ui.min.js", + "vendor/twbs/bootstrap/dist/js/bootstrap.bundle.min.js", + "node_modules/tableexport.jquery.plugin/tableExport.min.js", + "vendor/wenzhixin/bootstrap-table/dist/bootstrap-table.min.js", + "vendor/wenzhixin/bootstrap-table/src/extensions/export/bootstrap-table-export.js", + "node_modules/@jarstone/dselect/dist/js/dselect.min.js", + "src/ngFunctions.js", ]; - static private function getFilePath($file, $isScss = false) - { - global $CFG_GLPI; - return $CFG_GLPI['root_doc'] . ($isScss ? '/front/css.php?file=' : '/') . $file; + static private function getFilePath($file, $isScss = false) + { + global $CFG_GLPI; + return $CFG_GLPI['root_doc'] . ($isScss ? '/front/css.php?file=' : '/') . $file; } static public function getCss() { - $allCss = []; - foreach (self::$css as $file) { - $allCss[] = self::getFilePath($file); + $allCss = []; + foreach (self::$css as $file) { + $allCss[] = self::getFilePath($file); } foreach (self::$scss as $file) { - $allCss[] = self::getFilePath($file, true); + $allCss[] = self::getFilePath($file, true); } return $allCss; } static public function getJs() { - $allJs = []; - foreach (self::$js as $file) { - $allJs[] = self::getFilePath($file); + $allJs = []; + foreach (self::$js as $file) { + $allJs[] = self::getFilePath($file); } return $allJs; } @@ -109,39 +109,39 @@ static public function getJs() **/ static function clean($value, $striptags = true, $keep_bad = 2) { - $value = Html::entity_decode_deep($value); + $value = Html::entity_decode_deep($value); - // Change