User: Fix deleteUser icon visibility and batch action language - refs BT#22161

pull/5901/head
christianbeeznst 3 weeks ago
parent 5ee64f97c7
commit 68b417db59
  1. 10
      assets/js/legacy/app.js
  2. 8
      config/services.yaml
  3. 4
      public/main/admin/user_list.php
  4. 12
      public/main/inc/lib/api.lib.php
  5. 1
      public/main/inc/lib/display.lib.php
  6. 7
      public/main/inc/lib/sortable_table.class.php
  7. 5
      src/CoreBundle/Migrations/Schema/V200/Version20240806120000.php

@ -456,13 +456,13 @@ function setCheckbox(value, table_id) {
} }
function action_click(element, table_id) { function action_click(element, table_id) {
var d = $("#" + table_id) var d = $("#" + table_id);
if (!confirm("ConfirmYourChoice")) { var confirmMessage = $(element).attr("data-confirm") || "ConfirmYourChoice";
//if (!confirm('{{ "ConfirmYourChoice"|get_lang }}')) { if (!confirm(confirmMessage)) {
return false return false;
} else { } else {
var action = $(element).attr("data-action") var action = $(element).attr("data-action")
$("#" + table_id + ' input[name="action"] ').attr("value", action) $("#" + table_id + ' input[name="action"]').attr("value", action)
d.submit() d.submit()
return false return false

@ -6,6 +6,14 @@ parameters:
secret: '%env(APP_SECRET)%' secret: '%env(APP_SECRET)%'
locale: '%env(APP_LOCALE)%' locale: '%env(APP_LOCALE)%'
installed: '%env(APP_INSTALLED)%' installed: '%env(APP_INSTALLED)%'
db_manager_enabled: '%env(bool:DB_MANAGER_ENABLED)%'
software_name: '%env(SOFTWARE_NAME)%'
software_url: '%env(SOFTWARE_URL)%'
deny_delete_users: '%env(bool:DENY_DELETE_USERS)%'
hosting_total_size_limit: '%env(int:HOSTING_TOTAL_SIZE_LIMIT)%'
theme_fallback: '%env(THEME_FALLBACK)%'
packager: '%env(PACKAGER)%'
default_template: '%env(DEFAULT_TEMPLATE)%'
container.dumper.inline_factories: true container.dumper.inline_factories: true
twig: twig:
form: form:

@ -724,8 +724,8 @@ function modify_filter($user_id, $url_params, $row): string
); );
} }
$deleteAllowed = api_get_env_variable('DENY_DELETE_USERS', false); $denyDeleteUsers = api_get_env_variable('DENY_DELETE_USERS', false);
if ($deleteAllowed) { if (!$denyDeleteUsers) {
if ($user_id != $currentUserId && if ($user_id != $currentUserId &&
!$user_is_anonymous && !$user_is_anonymous &&
api_global_admin_can_edit_admin($user_id) api_global_admin_can_edit_admin($user_id)

@ -6858,20 +6858,12 @@ function get_hosting_limit(int $urlId, string $limitName): mixed
function api_get_env_variable(string $variable, mixed $default = null): mixed function api_get_env_variable(string $variable, mixed $default = null): mixed
{ {
if (Container::$container->hasParameter($variable)) { if (Container::$container->hasParameter($variable)) {
$value = Container::$container->getParameter($variable); return Container::$container->getParameter($variable);
if ($value === '0') {
return false;
}
if ($value === '1') {
return true;
}
return $value;
} }
return $default; return $default;
} }
/** /**
* Retreives and returns a value in a hierarchical configuration array * Retreives and returns a value in a hierarchical configuration array
* api_get_configuration_sub_value('a/b/c') returns api_get_configuration_value('a')['b']['c']. * api_get_configuration_sub_value('a/b/c') returns api_get_configuration_value('a')['b']['c'].

@ -1771,6 +1771,7 @@ class Display
'role' => 'menuitem', 'role' => 'menuitem',
'onclick' => $item['onclick'] ?? '', 'onclick' => $item['onclick'] ?? '',
'data-action' => $item['data-action'] ?? '', 'data-action' => $item['data-action'] ?? '',
'data-confirm' => $item['data-confirm'] ?? '',
] ]
); );
} }

@ -418,7 +418,7 @@ class SortableTable extends HTML_Table
} }
$html .= '<input type="hidden" name="action">'; $html .= '<input type="hidden" name="action">';
$html .= '<div class="flex q-card p-2 mb-4 sortable-buttons-actions">'; $html .= '<div class="flex q-card p-2 mb-4 sortable-buttons-actions">';
$html .= '<div class="flex w-1/2 flex-wrap items-center justify-between">'; $html .= '<div class="flex w-full items-center justify-between">';
if (count($this->actionButtons) > 0) { if (count($this->actionButtons) > 0) {
$html .= '<div class="btn-toolbar flex space-x-2">'; $html .= '<div class="btn-toolbar flex space-x-2">';
@ -447,9 +447,10 @@ class SortableTable extends HTML_Table
'onclick' => "javascript:action_click(this, '$table_id');", 'onclick' => "javascript:action_click(this, '$table_id');",
'title' => $label, 'title' => $label,
'data-action' => $action, 'data-action' => $action,
'data-confirm' => addslashes(api_htmlentities(get_lang("Please confirm your choice"))),
]; ];
} }
$html .= Display::groupButtonWithDropDown(get_lang('Detail'), $items); $html .= Display::groupButtonWithDropDown(get_lang('Action'), $items);
} else { } else {
$html .= $form; $html .= $form;
} }
@ -458,7 +459,7 @@ class SortableTable extends HTML_Table
// Pagination // Pagination
if ($this->get_total_number_of_items() > $this->default_items_per_page) { if ($this->get_total_number_of_items() > $this->default_items_per_page) {
$html .= '<div class="flex justify-end mt-4 w-1/2">'; $html .= '<div class="flex justify-end mt-4 w-full">';
$html .= '<div class="page-nav pb-2 pt-2">'.$nav.'</div>'; $html .= '<div class="page-nav pb-2 pt-2">'.$nav.'</div>';
$html .= '</div>'; $html .= '</div>';
} }

@ -37,6 +37,11 @@ final class Version20240806120000 extends AbstractMigrationChamilo
'SOFTWARE_URL' => $_configuration['software_url'] ?? '', 'SOFTWARE_URL' => $_configuration['software_url'] ?? '',
'DENY_DELETE_USERS' => !empty($_configuration['deny_delete_users']) ? '1' : '0', 'DENY_DELETE_USERS' => !empty($_configuration['deny_delete_users']) ? '1' : '0',
'HOSTING_TOTAL_SIZE_LIMIT' => $_configuration['hosting_total_size_limit'] ?? 0, 'HOSTING_TOTAL_SIZE_LIMIT' => $_configuration['hosting_total_size_limit'] ?? 0,
'THEME_FALLBACK' => $_configuration['theme_fallback'] ?? 'chamilo',
'PACKAGER' => $_configuration['packager'] ?? 'chamilo',
'DEFAULT_TEMPLATE' => $_configuration['default_template'] ?? 'default',
'ADMIN_CHAMILO_ANNOUNCEMENTS_DISABLE' => !empty($_configuration['admin_chamilo_announcements_disable']) ? '1' : '0',
'WEBSERVICE_ENABLE' => !empty($_configuration['webservice_enable']) ? '1' : '0',
]); ]);
// Ensure the hosting_limits.yml file exists // Ensure the hosting_limits.yml file exists

Loading…
Cancel
Save