Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions assets/js/legacy/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,13 +456,13 @@ function setCheckbox(value, table_id) {
}

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

return false
Expand Down
8 changes: 8 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@ parameters:
secret: '%env(APP_SECRET)%'
locale: '%env(APP_LOCALE)%'
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
twig:
form:
Expand Down
4 changes: 2 additions & 2 deletions public/main/admin/user_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,8 @@ function modify_filter($user_id, $url_params, $row): string
);
}

$deleteAllowed = api_get_env_variable('DENY_DELETE_USERS', false);
if ($deleteAllowed) {
$denyDeleteUsers = api_get_env_variable('DENY_DELETE_USERS', false);
if (!$denyDeleteUsers) {
if ($user_id != $currentUserId &&
!$user_is_anonymous &&
api_global_admin_can_edit_admin($user_id)
Expand Down
13 changes: 3 additions & 10 deletions public/main/inc/lib/api.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6857,21 +6857,14 @@ function get_hosting_limit(int $urlId, string $limitName): mixed
*/
function api_get_env_variable(string $variable, mixed $default = null): mixed
{
$variable = strtolower($variable);
if (Container::$container->hasParameter($variable)) {
$value = Container::$container->getParameter($variable);

if ($value === '0') {
return false;
}
if ($value === '1') {
return true;
}

return $value;
return Container::$container->getParameter($variable);
}

return $default;
}

/**
* 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'].
Expand Down
1 change: 1 addition & 0 deletions public/main/inc/lib/display.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1771,6 +1771,7 @@ class=" dropdown-menu hidden origin-top-right absolute right-0 mt-2 w-56 rounded
'role' => 'menuitem',
'onclick' => $item['onclick'] ?? '',
'data-action' => $item['data-action'] ?? '',
'data-confirm' => $item['data-confirm'] ?? '',
]
);
}
Expand Down
7 changes: 4 additions & 3 deletions public/main/inc/lib/sortable_table.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class="form-search"
}
$html .= '<input type="hidden" name="action">';
$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) {
$html .= '<div class="btn-toolbar flex space-x-2">';
Expand Down Expand Up @@ -447,9 +447,10 @@ class="form-search"
'onclick' => "javascript:action_click(this, '$table_id');",
'title' => $label,
'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 {
$html .= $form;
}
Expand All @@ -458,7 +459,7 @@ class="form-search"

// Pagination
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>';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public function up(Schema $schema): void
'SOFTWARE_URL' => $_configuration['software_url'] ?? '',
'DENY_DELETE_USERS' => !empty($_configuration['deny_delete_users']) ? '1' : '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
Expand Down
Loading