From bd6c2bddb4d00f074751c4ac5db8e2c6e8e2c85c Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Mon, 23 Jan 2023 14:06:33 +0000 Subject: [PATCH] made the times / rooms section on the course details page more accessible, closes #1244 Closes #1244 Merge request studip/studip!840 --- app/views/course/details/index.php | 4 +- lib/dates.inc.php | 3 +- lib/raumzeit/SingleDate.class.php | 6 +-- .../javascripts/bootstrap/application.js | 13 ------ templates/dates/seminar_html_location.php | 44 +++++++------------ 5 files changed, 22 insertions(+), 48 deletions(-) diff --git a/app/views/course/details/index.php b/app/views/course/details/index.php index 2e3a1a9701d..d5081810cd8 100644 --- a/app/views/course/details/index.php +++ b/app/views/course/details/index.php @@ -310,12 +310,12 @@ <article class="studip"> <header> - <h1><?= _('Veranstaltungsort') ?> / <?= _('Veranstaltungszeiten')?></h1> + <h1><?= _('Räume und Zeiten') ?></h1> </header> <section> <?= $sem->getDatesTemplate( 'dates/seminar_html_location', - ['ort' => $course->ort, 'disable_list_shrinking' => true, 'show_room' => false] + ['ort' => $course->ort] ) ?> </section> </article> diff --git a/lib/dates.inc.php b/lib/dates.inc.php index e9f08415ab5..8538d2467cb 100644 --- a/lib/dates.inc.php +++ b/lib/dates.inc.php @@ -223,8 +223,7 @@ function shrink_dates($dates) { } if (empty($dates[$i]["conjuncted"]) || empty($dates[$i+1]["conjuncted"])) { - $return_string .= ' ' . strftime('%A', $dates[$i]['start_time']) .'.'; - $return_string .= date (" d.m.y", $dates[$i]["start_time"]); + $return_string .= strftime(' %A, %d.%m.%Y', $dates[$i]['start_time']); } if (!$conjuncted && !empty($dates[$i+1]["conjuncted"])) { diff --git a/lib/raumzeit/SingleDate.class.php b/lib/raumzeit/SingleDate.class.php index 6740731e1be..8909983a990 100644 --- a/lib/raumzeit/SingleDate.class.php +++ b/lib/raumzeit/SingleDate.class.php @@ -409,12 +409,10 @@ class SingleDate if (!$this->date) { return null; } elseif ((($end_hours - $start_hours) / 60 / 60) > 23) { - return sprintf('%s , %s (%s)',strftime('%a', $this->date), - strftime('%d.%m.%Y', $this->date), + return sprintf('%s (%s)', strftime('%A, %d.%m.%Y', $this->date), _('ganztägig')); } else { - return sprintf('%s., %s - %s',strftime('%a', $this->date), - strftime('%d.%m.%Y %H:%M', $this->date), + return sprintf('%s - %s', strftime('%A, %d.%m.%Y %H:%M', $this->date), strftime('%H:%M', $this->end_time)); } } diff --git a/resources/assets/javascripts/bootstrap/application.js b/resources/assets/javascripts/bootstrap/application.js index cafd07e8197..a7101fa9a90 100644 --- a/resources/assets/javascripts/bootstrap/application.js +++ b/resources/assets/javascripts/bootstrap/application.js @@ -171,19 +171,6 @@ STUDIP.domReady(function () { $('.more-dates').attr('title', $gettext('Blenden Sie die restlichen Termine ein')); } }); - - $(document).on('click', '.more-location-dates', function () { - $(this).closest('div').prev().toggle(); - $(this).prev().toggle(); - - if ($(this).closest('div').prev().is(':visible')) { - $(this).text('(weniger)'); - $(this).attr('title', $gettext('Blenden Sie die restlichen Termine aus')); - } else { - $(this).text('(mehr)'); - $(this).attr('title', $gettext('Blenden Sie die restlichen Termine ein')); - } - }); }(jQuery)); /* ------------------------------------------------------------------------ diff --git a/templates/dates/seminar_html_location.php b/templates/dates/seminar_html_location.php index 976edbf7dfd..1c744441e89 100644 --- a/templates/dates/seminar_html_location.php +++ b/templates/dates/seminar_html_location.php @@ -23,8 +23,9 @@ if (is_array($dates['regular']['turnus_data'])) foreach ($dates['regular']['turn if ($link) { $output[ '<a href="' . $room_obj->getActionLink('show') . '" data-dialog="1">' - . htmlReady($room_obj->name) . '</a>' - ][] = $cycle['tostring_short'] .' ('. $count .'x)'; + . htmlReady($room_obj->name) + . '</a>' + ][] = $cycle['tostring'] .' ('. $count .'x)'; } else { $output[htmlReady($room_obj->name)][] = $cycle['tostring_short'] .' ('. $count .'x)'; } @@ -37,7 +38,7 @@ if (is_array($dates['regular']['turnus_data'])) foreach ($dates['regular']['turn if($count) : $without_location .= '(' . $count . 'x)'; endif; - $output[_('k.A.')][] = $without_location; + $output[_('Keine Raumangabe')][] = $without_location; endif; endforeach; endforeach; @@ -51,7 +52,7 @@ if (isset($dates['irregular']) && is_array($dates['irregular'])) { elseif (!empty($date['raum'])) : $output_dates[$date['raum']][] = $date; else : - $output_dates[_('k.A.')][] = $date['tostring']; + $output_dates[_('Keine Raumangabe')][] = $date['tostring']; endif; endforeach; } @@ -63,7 +64,8 @@ foreach ($output_dates as $dates) : if ($link) { $output[ '<a href="' . $room_obj->getActionLink('show') . '" data-dialog="1">' - . htmlReady($room_obj->name) . '</a>' + . htmlReady($room_obj->name) + . '</a>' ][] = implode('<br>', shrink_dates($dates)); } else { $output[htmlReady($room_obj->name)][] = implode('<br>', shrink_dates($dates)); @@ -71,35 +73,23 @@ foreach ($output_dates as $dates) : elseif (isset($dates[0]['raum'])) : $output['(' . htmlReady($dates[0]['raum']) . ')'][] = implode('<br>', shrink_dates($dates)); else : - $output[_('k.A.')][] = implode('<br>', $dates); + $output[_('Keine Raumangabe')][] = implode('<br>', $dates); endif; endforeach; ?> <? if (count($output) === 0) : ?> - <?= htmlReady($ort) ?: _("nicht angegeben") ?> + <?= htmlReady($ort) ?: _('Keine Raumangabe') ?> <? else: ?> - <table class="default"> - <? foreach ($output as $room => $dates) : ?> - <tr> - <td style="vertical-align: top"><?= $room ?></td> - <td> - <? $dates = implode('<br>', $dates) ?> - - <? if (mb_strlen($dates) > 222 && !$disable_list_shrinking) : ?> - <?= mb_substr($dates, 0, 228) ?> - <div class="more-location-dates-infos" style="display:none"> - <?= $dates ?> - </div> - <div> - <span class='more-location-digits'>...</span> - <a class="more-location-dates" style="cursor: pointer; margin-left: 3px">(mehr)</a> - </div> - <? else : ?> - <?= $dates ?> - <? endif ?> - </td> + <dl> + <? foreach ($output as $room_html => $dates) : ?> + <dt><?= $room_html ?></dt> + <? foreach ($dates as $date) : ?> + <dd> + <?= $date ?> + </dd> <? endforeach ?> + <? endforeach ?> </table> <? endif ?> -- GitLab