Skip to content

Commit d421e42

Browse files
Course: Fix duplicate assignments when copying session-only content - refs BT#22588
1 parent ddd5aa4 commit d421e42

4 files changed

Lines changed: 522 additions & 329 deletions

File tree

public/main/session/session_list.php

Lines changed: 79 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@
5353
exit();
5454
case 'copy':
5555
$result = SessionManager::copy(
56-
(int) $idChecked,
57-
true,
58-
true,
59-
false,
60-
false,
61-
$copySessionContent
56+
(int) $idChecked,
57+
true,
58+
true,
59+
false,
60+
false,
61+
$copySessionContent
6262
);
6363
if ($result) {
6464
Display::addFlash(Display::return_message(get_lang('Item copied')));
@@ -138,6 +138,36 @@
138138
#session-table .ui-jqgrid {
139139
max-width: 100%;
140140
}
141+
#session-table.sessions-grid-wrap .ui-jqgrid tr.jqgrow,
142+
#session-table.sessions-grid-wrap .ui-jqgrid tr.jqgrow td {
143+
height: auto !important;
144+
}
145+
#session-table.sessions-grid-wrap .ui-jqgrid tr.jqgrow td {
146+
white-space: normal !important;
147+
line-height: 1.25 !important;
148+
padding-top: 6px !important;
149+
padding-bottom: 6px !important;
150+
vertical-align: top !important;
151+
overflow: visible !important;
152+
text-overflow: clip !important;
153+
word-break: break-word;
154+
overflow-wrap: anywhere;
155+
}
156+
#session-table.sessions-grid-wrap .ui-jqgrid-htable th div {
157+
white-space: normal !important;
158+
height: auto !important;
159+
line-height: 1.2 !important;
160+
}
161+
#session-table.sessions-grid-wrap .ui-jqgrid .ui-jqgrid-bdiv {
162+
overflow-x: auto !important;
163+
}
164+
#session-table #gbox_sessions,
165+
#session-table #gview_sessions,
166+
#session-table #gview_sessions .ui-jqgrid-hdiv,
167+
#session-table #gview_sessions .ui-jqgrid-bdiv,
168+
#session-table #gview_sessions .ui-jqgrid-pager {
169+
width: 100% !important;
170+
}
141171
.sessions-advanced-search-float {
142172
position: fixed !important;
143173
z-index: 3000 !important;
@@ -151,13 +181,6 @@
151181
.sessions-advanced-search-float .ui-jqgrid {
152182
font-size: 13px;
153183
}
154-
#session-table #gbox_sessions,
155-
#session-table #gview_sessions,
156-
#session-table #gview_sessions .ui-jqgrid-hdiv,
157-
#session-table #gview_sessions .ui-jqgrid-bdiv,
158-
#session-table #gview_sessions .ui-jqgrid-pager {
159-
width: 100% !important;
160-
}
161184
#sessions_pager .ui-pg-button.ui-state-hover .ch-tool-icon,
162185
#sessions_pager .ui-pg-button:hover .ch-tool-icon,
163186
#sessions_pager .ui-pg-button.ui-state-hover .mdi,
@@ -249,8 +272,8 @@
249272
$column_model = $result['column_model'];
250273
$extra_params['autowidth'] = 'true';
251274
$extra_params['height'] = 'auto';
252-
$extra_params['shrinkToFit'] = true;
253-
$extra_params['forceFit'] = true;
275+
$extra_params['shrinkToFit'] = false;
276+
$extra_params['forceFit'] = false;
254277

255278
switch ($listType) {
256279
case 'custom':
@@ -346,7 +369,7 @@ function show_cols(grid, added_cols) {
346369
$(elem).datetimepicker('setDate', next_month);
347370
}
348371

349-
//Great hack
372+
// Great hack
350373
register_second_select = function(elem) {
351374
second_filters[$(elem).val()] = $(elem);
352375
}
@@ -391,18 +414,55 @@ function show_cols(grid, added_cols) {
391414
setSearchSelect("status");
392415
var grid = $("#sessions");
393416

394-
// Re-apply width after each data render (jqGrid sometimes resets widths)
417+
function resizeSessionsGrid() {
418+
var container = document.getElementById("session-table");
419+
if (!container) {
420+
return;
421+
}
422+
423+
var rect = container.getBoundingClientRect();
424+
var newWidth = Math.floor(rect.width);
425+
426+
// Avoid applying invalid widths (e.g. while hidden inside a tab)
427+
if (!newWidth || newWidth < 200) {
428+
return;
429+
}
430+
431+
grid.jqGrid("setGridWidth", newWidth, true);
432+
}
433+
434+
function applySessionsTooltips() {
435+
// Add a tooltip with full text to each simple cell (skip action/icon cells).
436+
var $cells = grid.closest("#gbox_sessions").find("tr.jqgrow td");
437+
$cells.each(function() {
438+
var $td = $(this);
439+
if ($td.attr("title")) {
440+
return;
441+
}
442+
if ($td.find("a,button,svg,i").length) {
443+
return;
444+
}
445+
var text = $.trim($td.text());
446+
if (text) {
447+
$td.attr("title", text);
448+
}
449+
});
450+
}
451+
452+
// Re-apply width and tooltips after each data render
395453
grid.jqGrid("setGridParam", {
396454
gridComplete: function () {
397455
setTimeout(function () {
398456
resizeSessionsGrid();
457+
applySessionsTooltips();
399458
}, 0);
400459
}
401460
});
402461

403462
// Ensure width is correct after page load (fonts/tabs/layout final width)
404463
$(window).on("load", function () {
405464
resizeSessionsGrid();
465+
applySessionsTooltips();
406466
});
407467

408468
// If tabs affect layout, recalc when tab is shown (Bootstrap) + fallback click
@@ -470,23 +530,6 @@ function toggleAdvancedSearch() {
470530
grid.jqGrid("searchGrid", prmSearch);
471531
}
472532

473-
function resizeSessionsGrid() {
474-
var container = document.getElementById("session-table");
475-
if (!container) {
476-
return;
477-
}
478-
479-
var rect = container.getBoundingClientRect();
480-
var newWidth = Math.floor(rect.width);
481-
482-
// Avoid applying invalid widths (e.g. while hidden inside a tab)
483-
if (!newWidth || newWidth < 200) {
484-
return;
485-
}
486-
487-
grid.jqGrid("setGridWidth", newWidth, true);
488-
}
489-
490533
var prmSearch = {
491534
multipleSearch: true,
492535
overlay: false,
@@ -622,6 +665,7 @@ function resizeSessionsGrid() {
622665
// Initial paint adjustments
623666
setTimeout(function() {
624667
resizeSessionsGrid();
668+
applySessionsTooltips();
625669
}, 0);
626670
});
627671
</script>
@@ -667,7 +711,7 @@ function resizeSessionsGrid() {
667711

668712
echo Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]);
669713
echo SessionManager::getSessionListTabs($listType);
670-
echo '<div id="session-table" class="table-responsive">';
714+
echo '<div id="session-table" class="table-responsive sessions-grid-wrap">';
671715
echo Display::grid_html('sessions');
672716
echo '</div>';
673717

0 commit comments

Comments
 (0)