Unverified Commit 0aec3964 authored by Cédric Anne's avatar Cédric Anne Committed by GitHub
Browse files

UI refurbish

parent f53299a3
......@@ -25,7 +25,7 @@
"GLPI_AJAX_DASHBOARD", "GLPI_ALLOW_IFRAME_IN_RICH_TEXT", "GLPI_CALDAV_IMPORT_STATE", "GLPI_CACHE_DIR",
"GLPI_MARKETPLACE_ALLOW_OVERRIDE", "GLPI_MARKETPLACE_MANUAL_DOWNLOADS",
"GLPI_CRON_DIR", "GLPI_CSRF_EXPIRES", "GLPI_CSRF_MAX_TOKENS", "GLPI_DEMO_MODE",
"GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE", "GLPI_DOC_DIR", "GLPI_DUMP_DIR", "GLPI_FORCE_EMPTY_SQL_MODE",
"GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE", "GLPI_DOC_DIR", "GLPI_DUMP_DIR",
"GLPI_GRAPH_DIR", "GLPI_IDOR_EXPIRES", "GLPI_INSTALL_MODE", "GLPI_INVENTORY_DIR", "GLPI_LOCAL_I18N_DIR",
"GLPI_LOCK_DIR", "GLPI_LOG_DIR", "GLPI_MARKETPLACE_DIR", "GLPI_MARKETPLACE_PLUGINS_API_URI",
"GLPI_MARKETPLACE_PRERELEASES", "GLPI_NETWORK_REGISTRATION_API_URL", "GLPI_NETWORK_MAIL",
......
......@@ -70,6 +70,12 @@
]
},
"overrides": [
{
"files": ["js/modules/**"],
"parserOptions": {
"sourceType": "module"
}
},
{
"files": ["webpack.config.js"],
"env": {
......
......@@ -22,5 +22,5 @@ vendor/bin/phpcs \
-p \
--extensions=php \
--standard=vendor/glpi-project/coding-standard/GlpiStandard/ \
--ignore="/.git/,^$ROOT_DIR/(config|files|lib|marketplace|node_modules|plugins|tests/config|vendor)/" \
--ignore="/.git/,^$ROOT_DIR/(config|files|lib|marketplace|node_modules|plugins|tests/config|tests/files|vendor)/" \
.
#!/bin/bash -e
echo "Check for syntax errors in templates"
bin/console tools:check_twig_templates_syntax
echo "Check for CS violations in templates"
vendor/bin/twigcs --ruleset=Glpi\\Tools\\GlpiTwigRuleset templates/
......@@ -80,6 +80,9 @@ jobs:
- name: "PHP lint"
run: |
docker-compose exec -T app .github/actions/lint_php-lint.sh
- name: "Twig lint"
run: |
docker-compose exec -T app .github/actions/lint_twig-lint.sh
- name: "JS lint"
run: |
docker-compose exec -T app .github/actions/lint_js-lint.sh
......
......@@ -32,6 +32,7 @@ phpunit.xml
/**/*.min.css
/css_compiled/
/css/compiled/
/css/lib/
/**/*.min.js
/node_modules/
.package.hash
......
......@@ -11,17 +11,21 @@ The present file will list all changes made to the project; according to the
### Changed
- APCu and WinCache are not anymore use by GLPI, use `php bin/console cache:configure` command to configure cache system.
- PDF export library has been changed from `TCPDF` to `mPDF`.
- The search engine and search results page now support sorting by multiple fields.
- The search result lists now refresh/update without triggering a full page reload.
### Deprecated
- Usage of XML-RPC API is deprecated.
### Removed
- Autocomplete feature on text fields.
- Usage of alternative DB connection encoding (`DB::$dbenc` property).
### API changes
#### Added
- Added `DBMysql::setSavepoint` to create savepoints within a transaction.
- Added `CommonDBTM::showForm` to have a generic showForm for asset (based on a twig template).
#### Changes
- Format of `Message-Id` header sent in Tickets notifications changed to match format used by other items.
......@@ -36,45 +40,81 @@ The present file will list all changes made to the project; according to the
- Field `date_creation` of PrinterLog has been renamed to `date`.
- Field `date` of ProjectTask has been renamed to `date_creation`.
- Table `glpi_netpoints` has been renamed to `glpi_sockets`.
- `DBMysql::rollBack` supports a `name` parameter for rolling back to a savepoint.
- `GLPI_FORCE_EMPTY_SQL_MODE` constant has been removed in favor of `GLPI_DISABLE_ONLY_FULL_GROUP_BY_SQL_MODE` usage.
- `CommonDBTM::clone()`, `CommonDBTM::prepareInputForClone()` and `CommonDBTM::post_clone()` has been removed. Clonable objects must now use `Glpi\Features\Clonable` trait.
- `CommonDBTM::notificationqueueonaction` property has been removed in favor of `CommonDBTM::deduplicate_queued_notifications` property.
- `CommonDropdown::displaySpecificTypeField()` has a new `$options` parameter.
- `DBMysql::rollBack` supports a `name` parameter for rolling back to a savepoint.
- `NetworkPortInstantiation::showNetpointField()` has been renamed to `NetworkPortInstantiation::showSocketField()`.
- `NotificationSettingConfig::showForm()` renamed to `NotificationSettingConfig::showConfigForm()`.
- `RuleMatchedLog::showForm()` renamed to `RuleMatchedLog::showItemForm()`.
- `Search::addOrderBy()` signature changed.
- `TicketSatisfaction::showForm()` renamed to `TicketSatisfaction::showSatisfactionForm()`.
- `Transfer::transferDropdownNetpoint()` has been renamed to `Transfer::transferDropdownSocket()`.
#### Deprecated
- Usage of `GLPI_FORCE_EMPTY_SQL_MODE` constant
- Usage of `CommonDBTM::notificationqueueonaction` property
- Usage of `NotificationTarget::html_tags` property
- `Netpoint` has been deprecated and replaced by `Socket`
- `DBmysql::getTableSchema()`
- `Calendar::duplicate()`
- `CommonDBTM::clone()`
- `CommonDBTM::prepareInputForClone()`
- `CommonDBTM::post_clone()`
- `Config::getCache()`
- `Html::clean()`
- `Html::setSimpleTextContent()`
- `Html::setRichTextContent()`
- `Html::weblink_extract()`
- `RuleImportComputer` class
- `RuleImportComputerCollection` class
- `Toolbox::clean_cross_side_scripting_deep()`
- `Toolbox::doubleEncodeEmails()`
- `Toolbox::getHtmlToDisplay()`
- `Toolbox::useCache()`
- `Toolbox::unclean_cross_side_scripting_deep()`
- `Toolbox::unclean_html_cross_side_scripting_deep()`
- `Toolbox::sanitize()`
#### Removed
- `Update::declareOldItems()`
- jQueryUI has been partially removed and remaining widgets will be removed in a near future.
- Usage of `$order` parameter in `getAllDataFromTable()` (`DbUtils::getAllDataFromTable()`)
- Usage of `table` parameter in requests made to `ajax/comments.php`
- Usage of `GLPI_FORCE_EMPTY_SQL_MODE` constant
- Support of `doc_types`, `helpdesk_types` and `netport_types` keys in `Plugin::registerClass()`
- `$CFG_GLPI['layout_excluded_pages']` entry
- `$CFG_GLPI['use_ajax_autocompletion']` entry
- `$LOADED_PLUGINS` global variable
- `Computer_SoftwareLicense` class
- `Computer_SoftwareVersion` class
- `CommonDBTM::notificationqueueonaction` property
- `NotificationTarget::html_tags` property
- `getAllDatasFromTable()`
- `getRealQueryForTreeItem()`
- `Ajax::createFixedModalWindow()`
- `Ajax::createSlidePanel()`
- `Calendar_Holiday::cloneCalendar()`
- `Calendar::duplicate()`
- `CalendarSegment::cloneCalendar()`
- `Change::getCommonLeftJoin()`
- `Change::getCommonSelect()`
- `Change::showAnalysisForm()`
- `Change::showPlanForm()`
- `CommonDBTM::clone()`
- `CommonDBTM::getRawName()`
- `CommonDBTM::prepareInputForClone()`
- `CommonDBTM::post_clone()`
- `CommonDBTM::showDates()`
- `CommonGLPI::isLayoutExcludedPage()`
- `CommonGLPI::isLayoutWithMain()`
- `CommonGLPI::showPrimaryForm()`
- `CommonITILObject::displayHiddenItemsIdInput()`
- `CommonITILObject::filterTimeline()`
- `CommonITILObject::getActorIcon()`
- `CommonITILObject::getSplittedSubmitButtonHtml()`
- `CommonITILObject::showActorsPartForm()`
- `CommonITILObject::showFormHeader()`
- `CommonITILObject::showGroupsAssociated()`
- `CommonITILObject::showSupplierAddFormOnCreate()`
- `CommonITILObject::showSuppliersAssociated()`
- `CommonITILObject::showTimeline()`
- `CommonITILObject::showTimelineForm()`
- `CommonITILObject::showTimelineHeader()`
- `CommonITILObject::showUsersAssociated()`
- `Computer_Item::cloneComputer()`
- `Computer_Item::cloneItem()`
- `Computer_SoftwareLicense` class
- `Computer_SoftwareVersion` class
- `ComputerAntivirus::cloneComputer()`
- `Contract::cloneItem()`
- `Contract_Item::cloneItem()`
- `ContractCost::cloneContract()`
- `Config::checkWriteAccessToDirs()`
- `Config::displayCheckExtensions()`
- `Config::getCache()`
- `DBMysql::affected_rows()`
- `DBMysql::data_seek()`
- `DBMysql::fetch_array()`
......@@ -83,30 +123,38 @@ The present file will list all changes made to the project; according to the
- `DBMysql::fetch_row()`
- `DBMysql::field_name()`
- `DBMysql::free_result()`
- `DBmysql::getTableSchema()`
- `DBMysql::insert_id()`
- `DBMysql::isMySQLStrictMode()`
- `DBMysql::list_fields()`
- `DBMysql::num_fields()`
- `DbUtils::getRealQueryForTreeItem()`
- `Dropdown::getDropdownNetpoint()`
- `Calendar_Holiday::cloneCalendar()`
- `CalendarSegment::cloneCalendar()`
- `Change::getCommonLeftJoin()`
- `Change::getCommonSelect()`
- `CommonDBTM::getRawName()`
- `Computer_Item::cloneComputer()`
- `Computer_Item::cloneItem()`
- `ComputerAntivirus::cloneComputer()`
- `Config::checkWriteAccessToDirs()`
- `Config::displayCheckExtensions()`
- `Contract::cloneItem()`
- `ContractCost::cloneContract()`
- `Contract_Item::cloneItem()`
- `DCBreadcrumb::showDcBreadcrumb()`
- `Document_Item::cloneItem()`
- `Entity::showSelector()`
- `Html::autocompletionTextField()`
- `Html::displayImpersonateBanner()`
- `Html::displayMainMenu()`
- `Html::displayMenuAll()`
- `Html::displayTopMenu()`
- `Html::fileForRichText()`
- `Html::generateImageName()`
- `Html::jsDisable()`
- `Html::jsEnable()`
- `Html::nl2br_deep()`
- `Html::resume_name()`
- `Html::setSimpleTextContent()`
- `Html::setRichTextContent()`
- `Html::showProfileSelecter()`
- `Html::weblink_extract()`
- `Infocom::cloneItem()`
- `Itil_Project::cloneItilProject()`
- `ITILFollowup::showApprobationForm()`
- `ITILTemplate::getBeginHiddenFieldText()`
- `ITILTemplate::getBeginHiddenFieldValue()`
- `ITILTemplate::getEndHiddenFieldText()`
- `ITILTemplate::getEndHiddenFieldValue()`
- `Item_Devices::cloneItem()`
- `Item_Disk::cloneItem()`
- `Item_OperatingSystem::cloneItem()`
......@@ -117,28 +165,43 @@ The present file will list all changes made to the project; according to the
- `Item_SoftwareVersion::showForComputer()`
- `Item_SoftwareVersion::updateDatasForComputer()`
- `KnowbaseItem_Item::cloneItem()`
- `LevelAgreement::showForTicket()`
- `NetworkPort::cloneItem()`
- `Notepad::cloneItem()`
- `NotificationTargetTicket::isAuthorMailingActivatedForHelpdesk()`
- `Plugin::setLoaded()`
- `Plugin::setUnloaded()`
- `Plugin::setUnloadedByName()`
- `Problem::getCommonLeftJoin()`
- `Problem::getCommonSelect()`
- `Problem::showAnalysisForm()`
- `ProjectCost::cloneProject()`
- `ProjectTeam::cloneProjectTask()`
- `ProjectTask::cloneProjectTeam()`
- `Reservation::displayReservationDay()`
- `Reservation::displayReservationsForAnItem()`
- `Search::isDeletedSwitch()`
- `Ticket::getCommonLeftJoin()`
- `Ticket::getCommonSelect()`
- `Ticket::getTicketTemplateToUse()`
- `Ticket::showDocumentAddButton()`
- `Ticket_Ticket::displayLinkedTicketsTo()`
- `TicketTemplate::getFromDBWithDatas()`
- `Toolbox::canUseImapPop()`
- `Toolbox::checkSELinux()`
- `Toolbox::convertImageToTag()`
- `Toolbox::decrypt()`
- `Toolbox::doubleEncodeEmails()`
- `Toolbox::encrypt()`
- `Toolbox::removeHtmlSpecialChars()`
- `Toolbox::sanitize()`
- `Toolbox::unclean_html_cross_side_scripting_deep()`
- `Toolbox::useCache()`
- `Toolbox::userErrorHandlerDebug()`
- `Toolbox::userErrorHandlerNormal()`
- `Transfer::transferComputerSoftwares()`
- `Reservation::displayReservationDay()`
- `Reservation::displayReservationsForAnItem()`
- `Update::declareOldItems()`
- `User::showPersonalInformation()`
## [9.5.6] unreleased
......
<?php
/**
* ---------------------------------------------------------------------
* GLPI - Gestionnaire Libre de Parc Informatique
* Copyright (C) 2015-2021 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 <http://www.gnu.org/licenses/>.
* ---------------------------------------------------------------------
*/
$AJAX_INCLUDE = 1;
include ('../inc/includes.php');
Session::checkLoginUser();
switch ($_REQUEST['action']) {
case "getActors":
header("Content-Type: application/json; charset=UTF-8");
Html::header_nocache();
session_write_close(); // don'l lock session to permits parallel calls
echo Dropdown::getDropdownActors($_POST);
break;
}
......@@ -30,65 +30,54 @@
* ---------------------------------------------------------------------
*/
// Include plugin if it is a plugin table
if (!strstr($_GET['itemtype'], "Plugin")) {
$AJAX_INCLUDE = 1;
}
$AJAX_INCLUDE = 1;
include ('../inc/includes.php');
header("Content-Type: application/json; charset=UTF-8");
// Send UTF8 Headers
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
Session::checkLoginUser();
// Security
if (!isset($_GET['itemtype']) || !($item = getItemForItemtype($_GET['itemtype']))) {
exit();
}
$item->getEmpty();
$table = $item->getTable();
// Security
if (!isset($item->fields[$_GET['field']]) || !$item->canView()) {
exit();
}
// Security : check whitelist
$field_so = $item->getSearchOptionByField('field', $_GET['field'], $item->getTable());
$can_autocomplete = array_key_exists('autocomplete', $field_so) && $field_so['autocomplete'];
if (!$can_autocomplete) {
exit();
if ((!isset($_REQUEST['params']['_idor_token']) || empty($_REQUEST['params']['_idor_token'])) || !isset($_REQUEST['itemtype'])
|| !isset($_REQUEST['widget'])) {
http_response_code(400);
die();
}
$entity = [];
if (isset($_GET['entity_restrict']) && $_GET['entity_restrict']>=0) {
if ($item->isEntityAssign()) {
$entity['entities_id'] = $_GET['entity_restrict'];
}
}
$idor = $_REQUEST['params']['_idor_token'];
unset($_REQUEST['params']['_idor_token']);
if (isset($_GET['user_restrict']) && $_GET['user_restrict']>0) {
$entity['users_id'] = $_GET['user_restrict'];
if (!Session::validateIDOR([
'itemtype' => $_REQUEST['itemtype'],
'_idor_token' => $idor
] + $_REQUEST['params'])) {
http_response_code(400);
die();
}
$iterator = $DB->request([
'SELECT' => $_GET['field'],
'DISTINCT' => true,
'FROM' => $table,
'WHERE' => [
[$_GET['field'] => ['LIKE', $_GET['term'] . '%']],
[$_GET['field'] => ['<>', $_GET['term']]]
] + $entity,
'ORDER' => $_GET['field']
]);
$values = [];
if (count($iterator)) {
while ($data = $iterator->next()) {
$values[] = Html::entity_decode_deep($data[$_GET['field']]);
}
}
$itemtype = $_REQUEST['itemtype'];
$params = $_REQUEST['params'];
if (count($values)) {
echo json_encode($values);
switch ($_REQUEST['widget']) {
case 'central_count':
if (method_exists($itemtype, 'showCentralCount')) {
$itemtype::showCentralCount($params['foruser'] ?? false);
}
break;
case 'central_list':
if (method_exists($itemtype, 'showCentralList')) {
if (is_subclass_of($itemtype, CommonITILObject::class)) {
$showgroupproblems = isset($params['showgroupproblems']) ? ($params['showgroupproblems'] !== 'false') : false;
$itemtype::showCentralList($params['start'], $params['status'] ?? 'process', $showgroupproblems);
}
} else if ($itemtype === RSSFeed::class) {
$personal = $params['personal'] !== 'false';
$itemtype::showListForCentral($personal);
} else if ($itemtype === Planning::class) {
$itemtype::showCentral($params['who']);
}
break;
default:
echo __('Invalid widget');
}
......@@ -39,13 +39,6 @@ Html::header_nocache();
Session::checkLoginUser();
// depreciation behavior
if (!isset($_POST["itemtype"]) && isset($_POST['table'])
&& $DB->tableExists($_POST['table'])) {
Toolbox::deprecated();
$_POST["itemtype"] = getItemTypeForTable($_POST['table']);
}
if (isset($_POST["itemtype"])
&& isset($_POST["value"])) {
// Security
......
......@@ -108,7 +108,7 @@ CommonGLPI::displayStandardTab($item, $_UGET['_glpi_tab'], $_GET["withtemplate"]
if (isset($_GET['full_page_tab'])) {
echo "<div class='center' id='debugajax'>";
echo "<a href='".htmlentities($_SERVER['REQUEST_URI'])."' class='vsubmit'>Reload</a>";
echo "<a href='".htmlentities($_SERVER['REQUEST_URI'])."' class='btn btn-primary'>Reload</a>";
echo "</div>";
// I think that we should display this warning, because tabs are not prepare
......
......@@ -58,5 +58,5 @@ if ($room->getFromDB($id)) {
]
);
} else {
echo __('No room found or selected');
echo "<div class='col-form-label'>".__('No room found or selected')."</div>";
}
......@@ -43,5 +43,5 @@ if ($_POST["actortype"] > 0) {
$rand = mt_rand();
$ticket->showActorAddForm($_POST["actortype"], $rand, $_SESSION['glpiactive_entity'], [],
true, false, false);
echo "&nbsp;<input type='submit' name='add_actor' class='submit' value=\""._sx('button', 'Add')."\">";
echo "&nbsp;<input type='submit' name='add_actor' class='btn btn-primary' value=\""._sx('button', 'Add')."\">";
}
......@@ -51,7 +51,7 @@ if (isset($_POST["validatortype"])) {
echo "<br><br>".__('Comments')." ";
echo "<textarea name='comment_submission' cols='50' rows='6'></textarea>&nbsp;";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='btn btn-primary'>";
break;
case 'group' :
......@@ -98,7 +98,7 @@ if (isset($_POST["validatortype"])) {
// Display all/none buttons to select all or no users in group
if (!empty($_POST['groups_id'])) {
echo "<a id='all_users' class='vsubmit'>".__('All')."</a>";
echo "<a id='all_users' class='btn btn-primary'>".__('All')."</a>";
$param_button = [
'validatortype' => 'group_user',
'users_id_validate' => '',
......@@ -111,7 +111,7 @@ if (isset($_POST["validatortype"])) {
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveActionAddValidator.php",
$param_button, ['click']);
echo "&nbsp;<a id='no_users' class='vsubmit'>".__('None')."</a>";
echo "&nbsp;<a id='no_users' class='btn btn-primary'>".__('None')."</a>";
$param_button['all_users'] = 0;
Ajax::updateItemOnEvent('no_users', 'show_groups_users',
$CFG_GLPI["root_doc"]."/ajax/dropdownMassiveActionAddValidator.php",
......@@ -121,7 +121,7 @@ if (isset($_POST["validatortype"])) {
echo "<br><br>".__('Comments')." ";
echo "<textarea name='comment_submission' cols='50' rows='6'></textarea>&nbsp;";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='btn btn-primary'>";
break;
}
......
......@@ -66,5 +66,5 @@ if ($_POST["authtype"] > 0) {
break;
}
echo "&nbsp;<input type='submit' name='$name' class='submit' value=\""._sx('button', 'Post')."\">";
echo "&nbsp;<input type='submit' name='$name' class='btn btn-primary' value=\""._sx('button', 'Post')."\">";
}
......@@ -102,12 +102,12 @@ if (isset($_POST["itemtype"])
echo "<input type='hidden' name='field' value='$fieldname'>";
echo "</td>";
if ($inline) {
echo "<td><input type='submit' name='massiveaction' class='submit' value='$submitname'></td>";
echo "<td><input type='submit' name='massiveaction' class='btn btn-primary' value='$submitname'></td>";
}
echo "</tr></table>";
if (!$inline) {
echo "<br><input type='submit' name='massiveaction' class='submit' value='$submitname'>";
echo "<br><input type='submit' name='massiveaction' class='btn btn-primary' value='$submitname'>";
}
}
......@@ -42,5 +42,5 @@ if (!isset($_POST["itemtype"]) || !($item = getItemForItemtype($_POST['itemtype'
}
$item::dropdown();
echo "<br/><input type='submit' name='update' value=\""._sx('button', 'Update')."\" class='submit'>";
echo "<br/><input type='submit' name='clone' value=\""._sx('button', 'Clone')."\" class='submit'>";
echo "<br/><input type='submit' name='update' value=\""._sx('button', 'Update')."\" class='btn btn-primary'>";
echo "<br/><input type='submit' name='clone' value=\""._sx('button', 'Clone')."\" class='btn btn-primary'>";
......@@ -65,9 +65,10 @@ if ($isValidItemtype) {
// Message for post-only
if (!isset($_POST["admin"]) || ($_POST["admin"] == 0)) {
echo "<br>".__('Enter the first letters (user, item name, serial or asset number)');
echo "<span class='text-muted'>".
__('Enter the first letters (user, item name, serial or asset number)')
."</span>";
}
echo "<br>";
$field_id = Html::cleanId("dropdown_".$_POST['myname'].$rand);
$p = [
'itemtype' => $itemtype,
......@@ -76,6 +77,7 @@ if ($isValidItemtype) {
'multiple' => $_POST["multiple"],
'myname' => $_POST["myname"],
'rand' => $_POST["rand"],
'width' => 'calc(100% - 25px)',
'_idor_token' => Session::getNewIDORToken($itemtype, [
'entity_restrict' => $_POST['entity_restrict'],
]),
......@@ -92,14 +94,22 @@ if ($isValidItemtype) {
$p["context"] = $context;
}
echo Html::jsAjaxDropdown($_POST['myname'], $field_id,
$CFG_GLPI['root_doc']."/ajax/getDropdownFindNum.php",
$p);
echo Html::jsAjaxDropdown(
$_POST['myname'],
$field_id,
$CFG_GLPI['root_doc']."/ajax/getDropdownFindNum.php",
$p
);
// Auto update summary of active or just solved tickets
$params = ['items_id' => '__VALUE__',
'itemtype' => $_POST['itemtype']];
Ajax::updateItemOnSelectEvent($field_id, "item_ticket_selection_information$rand",
$CFG_GLPI["root_doc"]."/ajax/ticketiteminformation.php",
$params);
echo "<span id='item_ticket_selection_information$rand' class='ms-1'></span>";
Ajax::updateItemOnSelectEvent(
$field_id,
"item_ticket_selection_information$rand",
$CFG_GLPI["root_doc"]."/ajax/ticketiteminformation.php",
[
'items_id' => '__VALUE__',
'itemtype' => $_POST['itemtype']
]
);
}
......@@ -43,24 +43,31 @@ Html::header_nocache();
if (isset($_POST["validatortype"])) {
switch ($_POST["validatortype"]) {
case 'user' :
case 'User' :
if (isset($_POST['users_id_validate']['groups_id'])) {
$_POST['users_id_validate'] = [];
}
$value = (isset($_POST['users_id_validate'][0]) ? $_POST['users_id_validate'][0] : 0);
User::dropdown(['name' => !empty($_POST['name']) ? $_POST['name'].'[]'
:'users_id_validate[]',
'entity' => $_POST['entity'],
'value' => $value,
'right' => $_POST['right']]);
User::dropdown([
'name' => !empty($_POST['name']) ? $_POST['name'].'[]' :'users_id_validate[]',
'entity' => $_POST['entity'],
'value' => $value,
'right' => $_POST['right'],
'width' => '100%',
]);
break;
case 'group' :
case 'Group' :
$name = !empty($_POST['name']) ? $_POST['name'].'[groups_id]':'groups_id';
$value = (isset($_POST['users_id_validate']['groups_id']) ? $_POST['users_id_validate']['groups_id'] : $_POST['groups_id']);