Skip to content
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
19 changes: 13 additions & 6 deletions Pages/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,22 @@ protected function __construct($titleKey = '', $pageDepth = 0)
}
$this->smarty->assign('HomeUrl', $logoUrl);

$detect = new MobileDetect();
$this->IsMobile = $detect->isMobile();
$this->IsTablet = $detect->isTablet();
$loadMobileViews = Configuration::Instance()->GetSectionKey(ConfigSection::SCHEDULE, ConfigKeys::SCHEDULE_LOAD_MOBILE_VIEWS, new BooleanConverter()) ?? true;

if ($loadMobileViews) {
$detect = new MobileDetect();
$this->IsMobile = $detect->isMobile();
$this->IsTablet = $detect->isTablet();
}

$this->IsDesktop = !$this->IsMobile && !$this->IsTablet;
$this->Set('IsMobile', $this->IsMobile);
$this->Set('IsTablet', $this->IsTablet);
$this->Set('IsDesktop', $this->IsDesktop);
$this->Set('IsMobile', (bool)$this->IsMobile);
$this->Set('IsTablet', (bool)$this->IsTablet);
$this->Set('IsDesktop', (bool)$this->IsDesktop);
$this->Set('GoogleAnalyticsTrackingId', Configuration::Instance()->GetSectionKey(ConfigSection::GOOGLE_ANALYTICS, ConfigKeys::GOOGLE_ANALYTICS_TRACKING_ID));
$this->Set('ShowNewVersion', $this->ShouldShowNewVersion());

$this->Set('AutoScrollToday', Configuration::Instance()->GetSectionKey(ConfigSection::SCHEDULE, ConfigKeys::SCHEDULE_AUTO_SCROLL_TODAY, new BooleanConverter()) ?? true);
}

protected function SetTitle($title)
Expand Down
36 changes: 9 additions & 27 deletions Web/scripts/schedule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ function Schedule(opts, resourceGroups) {
const ScheduleWide = "1";
const ScheduleTall = "2";
const ScheduleCondensed = "3";
//Replaced by a global button
/* const elements = {
topButton: $('#reservationsToTop')
};*/

this.init = function () {
this.initUserDefaultSchedule();
Expand All @@ -25,11 +21,13 @@ function Schedule(opts, resourceGroups) {
this.initNavigation();
addNumericalIdsToRows();

var today = $(".today");
if (today && today.length > 0) {
$('html, body').animate({
scrollTop: today.offset().top - 50
}, 500);
if (scheduleOpts.autoScrollToday) {
var today = $(".today");
if (today && today.length > 0) {
$('html, body').animate({
scrollTop: today.offset().top - 50
}, 500);
}
}

$(window).on('resize', _.debounce(function () {
Expand All @@ -38,20 +36,6 @@ function Schedule(opts, resourceGroups) {
renderEvents(true);
}
}, 1000));
//Replaced by a global button
/*$(window).on('scroll', function () {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
elements.topButton[0].style.display = "block";
} else {
elements.topButton[0].style.display = "none";
}
});

elements.topButton.on('click', function () {
$('html, body').animate({
scrollTop: 0
}, 500);
});*/

setInterval(function () {
renderEvents(true);
Expand Down Expand Up @@ -862,12 +846,10 @@ function Schedule(opts, resourceGroups) {
var isInteger = /^[0-9]+$/.test(scheduleDisplay);

if (isInteger) {

// If is valid cerate a normal cookie
createCookie(opts.cookieName, parseInt(scheduleDisplay, 10), 30, opts.scriptUrl);
window.location.reload();
} else {

// Otherwise create a cookie with value 0
createCookie(opts.cookieName, 0, 30, opts.scriptUrl);
window.location.reload();
Expand Down Expand Up @@ -1035,12 +1017,12 @@ function Schedule(opts, resourceGroups) {
var ref = $(this).attr('ref');
reservations.find('td[ref="' + ref + '"]').addClass('hilite');
});

reservations.delegate('.clickres:not(.reserved)', 'mouseleave', function () {
if (selectingTds) {
return;
}

$(this).siblings('.resourcename').removeClass('hilite');
var ref = $(this).attr('ref');
reservations.find('td[ref="' + ref + '"]').removeClass('hilite');
Expand Down
2 changes: 2 additions & 0 deletions config/config.devel.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
$conf['settings']['schedule']['update.highlight.minutes'] = '0'; // if set, will show reservations as 'updated' for a certain amount of time
$conf['settings']['schedule']['show.week.numbers'] = 'false';
$conf['settings']['schedule']['fast.reservation.load'] = 'false'; // Experimental: Use new algorithm to load reservations faster in the schedule. Currently does not support concurrent reservations. With larger number of resources this can be 10x or 100x faster. Only runs with the StandardSchedule otherwise will fall back to legacy mode.
$conf['settings']['schedule']['load.mobile.views'] = 'true'; // if the mobile views should be loaded on mobile devices. If false, the desktop views will be loaded instead
$conf['settings']['schedule']['auto.scroll.today'] = 'true'; // if the schedule should automatically scroll to today when the page is loaded
/**
* ical integration configuration
*/
Expand Down
2 changes: 2 additions & 0 deletions config/config.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
$conf['settings']['schedule']['update.highlight.minutes'] = '0'; // if set, will show reservations as 'updated' for a certain amount of time
$conf['settings']['schedule']['show.week.numbers'] = 'false';
$conf['settings']['schedule']['fast.reservation.load'] = 'false'; // Experimental: Use new algorithm to load reservations faster in the schedule. Currently does not support concurrent reservations. With larger number of resources this can be 10x or 100x faster. Only runs with the StandardSchedule otherwise will fall back to legacy mode.
$conf['settings']['schedule']['load.mobile.views'] = 'true'; // if the mobile views should be loaded on mobile devices. If false, the desktop views will be loaded instead
$conf['settings']['schedule']['auto.scroll.today'] = 'true'; // if the schedule should automatically scroll to today when the page is loaded
/**
* ical integration configuration
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Config/ConfigKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class ConfigKeys
public const SCHEDULE_UPDATE_HIGHLIGHT_MINUTES = 'update.highlight.minutes';
public const SCHEDULE_SHOW_WEEK_NUMBERS = 'show.week.numbers';
public const SCHEDULE_FAST_RESERVATION_LOAD = 'fast.reservation.load';
public const SCHEDULE_LOAD_MOBILE_VIEWS = 'load.mobile.views';
public const SCHEDULE_AUTO_SCROLL_TODAY = 'auto.scroll.today';

public const DATABASE_TYPE = 'type';
public const DATABASE_USER = 'user';
Expand Down
1 change: 1 addition & 0 deletions tpl/Schedule/schedule.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@
autocompleteUrl: "{$Path}ajax/autocomplete.php?type={AutoCompleteType::User}",
fastReservationLoad: "{$FastReservationLoad}",
resourceMaxConcurrentReservations,
autoScrollToday: {$AutoScrollToday|@json_encode},
};

const resourceOrder = [];
Expand Down