commit
ed2b17cf9b
|
@ -18,7 +18,7 @@ import { Route, RouterModule, ROUTES, Routes } from '@angular/router';
|
||||||
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
|
import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module';
|
||||||
|
|
||||||
export const AddonCalendarEditRoute: Route = {
|
export const AddonCalendarEditRoute: Route = {
|
||||||
path: 'edit',
|
path: 'edit/:eventId',
|
||||||
loadChildren: () =>
|
loadChildren: () =>
|
||||||
import('@/addons/calendar/pages/edit-event/edit-event.module').then(m => m.AddonCalendarEditEventPageModule),
|
import('@/addons/calendar/pages/edit-event/edit-event.module').then(m => m.AddonCalendarEditEventPageModule),
|
||||||
};
|
};
|
||||||
|
|
|
@ -553,10 +553,9 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
|
||||||
openEdit(eventId?: number): void {
|
openEdit(eventId?: number): void {
|
||||||
const params: Params = {};
|
const params: Params = {};
|
||||||
|
|
||||||
if (eventId) {
|
if (!eventId) {
|
||||||
params.eventId = eventId;
|
|
||||||
} else {
|
|
||||||
// It's a new event, set the time.
|
// It's a new event, set the time.
|
||||||
|
eventId = 0;
|
||||||
params.timestamp = moment().year(this.year).month(this.month - 1).date(this.day).unix() * 1000;
|
params.timestamp = moment().year(this.year).month(this.month - 1).date(this.day).unix() * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +563,7 @@ export class AddonCalendarDayPage implements OnInit, OnDestroy {
|
||||||
params.courseId = this.filter.courseId;
|
params.courseId = this.filter.courseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath('/calendar/edit', { params });
|
CoreNavigator.navigateToSitePath(`/calendar/edit/${eventId}`, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -132,7 +132,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave {
|
||||||
* Component being initialized.
|
* Component being initialized.
|
||||||
*/
|
*/
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.eventId = CoreNavigator.getRouteNumberParam('eventId');
|
this.eventId = CoreNavigator.getRouteNumberParam('eventId') || undefined;
|
||||||
this.courseId = CoreNavigator.getRouteNumberParam('courseId') || 0;
|
this.courseId = CoreNavigator.getRouteNumberParam('courseId') || 0;
|
||||||
this.title = this.eventId ? 'addon.calendar.editevent' : 'addon.calendar.newevent';
|
this.title = this.eventId ? 'addon.calendar.editevent' : 'addon.calendar.newevent';
|
||||||
|
|
||||||
|
|
|
@ -424,7 +424,7 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy {
|
||||||
* Open the page to edit the event.
|
* Open the page to edit the event.
|
||||||
*/
|
*/
|
||||||
openEdit(): void {
|
openEdit(): void {
|
||||||
CoreNavigator.navigateToSitePath('/calendar/edit', { params: { eventId: this.eventId } });
|
CoreNavigator.navigateToSitePath(`/calendar/edit/${this.eventId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -351,15 +351,13 @@ export class AddonCalendarIndexPage implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
openEdit(eventId?: number): void {
|
openEdit(eventId?: number): void {
|
||||||
const params: Params = {};
|
const params: Params = {};
|
||||||
|
eventId = eventId || 0;
|
||||||
|
|
||||||
if (eventId) {
|
|
||||||
params.eventId = eventId;
|
|
||||||
}
|
|
||||||
if (this.filter.courseId) {
|
if (this.filter.courseId) {
|
||||||
params.courseId = this.filter.courseId;
|
params.courseId = this.filter.courseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreNavigator.navigateToSitePath('/calendar/edit', { params });
|
CoreNavigator.navigateToSitePath(`/calendar/edit/${eventId}`, { params });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -20,78 +20,76 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<ion-content>
|
<ion-content>
|
||||||
<core-split-view>
|
<ion-refresher slot="fixed" [disabled]="!eventsLoaded" (ionRefresh)="doRefresh($event.target)">
|
||||||
<ion-refresher slot="fixed" [disabled]="!eventsLoaded" (ionRefresh)="doRefresh($event.target)">
|
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
</ion-refresher>
|
||||||
</ion-refresher>
|
<core-loading [hideUntil]="eventsLoaded">
|
||||||
<core-loading [hideUntil]="eventsLoaded">
|
<!-- There is data to be synchronized -->
|
||||||
<!-- There is data to be synchronized -->
|
<ion-card class="core-warning-card" *ngIf="hasOffline">
|
||||||
<ion-card class="core-warning-card" *ngIf="hasOffline">
|
<ion-item>
|
||||||
<ion-item>
|
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
|
||||||
<ion-icon name="fas-exclamation-triangle" slot="start" aria-hidden="true"></ion-icon>
|
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: 'addon.calendar.calendar' | translate} }}</ion-label>
|
||||||
<ion-label>{{ 'core.hasdatatosync' | translate:{$a: 'addon.calendar.calendar' | translate} }}</ion-label>
|
</ion-item>
|
||||||
|
</ion-card>
|
||||||
|
|
||||||
|
<core-empty-box *ngIf="!filteredEvents || !filteredEvents.length" icon="fas-calendar"
|
||||||
|
[message]="'addon.calendar.noevents' | translate">
|
||||||
|
</core-empty-box>
|
||||||
|
|
||||||
|
<ion-list *ngIf="filteredEvents && filteredEvents.length" class="ion-no-margin">
|
||||||
|
<ng-container *ngFor="let event of filteredEvents">
|
||||||
|
<ion-item-divider *ngIf="event.showDate">
|
||||||
|
<ion-label><p class="item-heading">{{ event.timestart * 1000 | coreFormatDate: "strftimedayshort" }}</p></ion-label>
|
||||||
|
</ion-item-divider>
|
||||||
|
<ion-item class="addon-calendar-event ion-text-wrap" [attr.aria-label]="event.name" (click)="gotoEvent(event.id)"
|
||||||
|
[attr.aria-current]="event.id == eventId ? 'page' : 'false'"
|
||||||
|
[ngClass]="['addon-calendar-eventtype-'+event.eventtype]" button detail="true">
|
||||||
|
<img *ngIf="event.moduleIcon" src="{{event.moduleIcon}}" slot="start" class="core-module-icon" alt=""
|
||||||
|
role="presentation">
|
||||||
|
<ion-icon *ngIf="event.eventIcon && !event.moduleIcon" [name]="event.eventIcon" slot="start"
|
||||||
|
aria-hidden="true">
|
||||||
|
</ion-icon>
|
||||||
|
<ion-label>
|
||||||
|
<p class="item-heading">
|
||||||
|
<!-- Add the icon title so accessibility tools read it. -->
|
||||||
|
<span class="sr-only">
|
||||||
|
{{ 'addon.calendar.type' + event.formattedType | translate }}
|
||||||
|
<span class="sr-only" *ngIf="event.moduleIcon && event.iconTitle">{{ event.iconTitle }}</span>
|
||||||
|
</span>
|
||||||
|
<core-format-text [text]="event.name" [contextLevel]="event.contextLevel"
|
||||||
|
[contextInstanceId]="event.contextInstanceId">
|
||||||
|
</core-format-text>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
{{ event.timestart * 1000 | coreFormatDate: "strftimetime" }}
|
||||||
|
<span *ngIf="event.timeduration && event.endsSameDay">
|
||||||
|
- {{ (event.timestart + event.timeduration) * 1000 | coreFormatDate: "strftimetime" }}
|
||||||
|
</span>
|
||||||
|
<span *ngIf="event.timeduration && !event.endsSameDay">
|
||||||
|
- {{ (event.timestart + event.timeduration) * 1000 | coreFormatDate: "strftimedatetimeshort" }}
|
||||||
|
</span>
|
||||||
|
</p>
|
||||||
|
</ion-label>
|
||||||
|
<ion-note *ngIf="event.offline && !event.deleted" slot="end">
|
||||||
|
<ion-icon name="fas-clock" aria-hidden="true"></ion-icon>
|
||||||
|
<span class="ion-text-wrap">{{ 'core.notsent' | translate }}</span>
|
||||||
|
</ion-note>
|
||||||
|
<ion-note *ngIf="event.deleted" slot="end">
|
||||||
|
<ion-icon name="fas-trash" aria-hidden="true"></ion-icon>
|
||||||
|
<span class="ion-text-wrap">{{ 'core.deletedoffline' | translate }}</span>
|
||||||
|
</ion-note>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ion-card>
|
</ng-container>
|
||||||
|
</ion-list>
|
||||||
|
|
||||||
<core-empty-box *ngIf="!filteredEvents || !filteredEvents.length" icon="fas-calendar"
|
<core-infinite-loading [enabled]="canLoadMore" (action)="loadMoreEvents($event)" [error]="loadMoreError">
|
||||||
[message]="'addon.calendar.noevents' | translate">
|
</core-infinite-loading>
|
||||||
</core-empty-box>
|
</core-loading>
|
||||||
|
|
||||||
<ion-list *ngIf="filteredEvents && filteredEvents.length" class="ion-no-margin">
|
<!-- Create a calendar event. -->
|
||||||
<ng-container *ngFor="let event of filteredEvents">
|
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canCreate">
|
||||||
<ion-item-divider *ngIf="event.showDate">
|
<ion-fab-button (click)="openEdit()" [attr.aria-label]="'addon.calendar.newevent' | translate">
|
||||||
<ion-label><p class="item-heading">{{ event.timestart * 1000 | coreFormatDate: "strftimedayshort" }}</p></ion-label>
|
<ion-icon name="fas-plus" aria-hidden="true"></ion-icon>
|
||||||
</ion-item-divider>
|
</ion-fab-button>
|
||||||
<ion-item class="addon-calendar-event ion-text-wrap" [attr.aria-label]="event.name" (click)="gotoEvent(event.id)"
|
</ion-fab>
|
||||||
[attr.aria-current]="event.id == eventId ? 'page' : 'false'"
|
|
||||||
[ngClass]="['addon-calendar-eventtype-'+event.eventtype]" button detail="true">
|
|
||||||
<img *ngIf="event.moduleIcon" src="{{event.moduleIcon}}" slot="start" class="core-module-icon" alt=""
|
|
||||||
role="presentation">
|
|
||||||
<ion-icon *ngIf="event.eventIcon && !event.moduleIcon" [name]="event.eventIcon" slot="start"
|
|
||||||
aria-hidden="true">
|
|
||||||
</ion-icon>
|
|
||||||
<ion-label>
|
|
||||||
<p class="item-heading">
|
|
||||||
<!-- Add the icon title so accessibility tools read it. -->
|
|
||||||
<span class="sr-only">
|
|
||||||
{{ 'addon.calendar.type' + event.formattedType | translate }}
|
|
||||||
<span class="sr-only" *ngIf="event.moduleIcon && event.iconTitle">{{ event.iconTitle }}</span>
|
|
||||||
</span>
|
|
||||||
<core-format-text [text]="event.name" [contextLevel]="event.contextLevel"
|
|
||||||
[contextInstanceId]="event.contextInstanceId">
|
|
||||||
</core-format-text>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{{ event.timestart * 1000 | coreFormatDate: "strftimetime" }}
|
|
||||||
<span *ngIf="event.timeduration && event.endsSameDay">
|
|
||||||
- {{ (event.timestart + event.timeduration) * 1000 | coreFormatDate: "strftimetime" }}
|
|
||||||
</span>
|
|
||||||
<span *ngIf="event.timeduration && !event.endsSameDay">
|
|
||||||
- {{ (event.timestart + event.timeduration) * 1000 | coreFormatDate: "strftimedatetimeshort" }}
|
|
||||||
</span>
|
|
||||||
</p>
|
|
||||||
</ion-label>
|
|
||||||
<ion-note *ngIf="event.offline && !event.deleted" slot="end">
|
|
||||||
<ion-icon name="fas-clock" aria-hidden="true"></ion-icon>
|
|
||||||
<span class="ion-text-wrap">{{ 'core.notsent' | translate }}</span>
|
|
||||||
</ion-note>
|
|
||||||
<ion-note *ngIf="event.deleted" slot="end">
|
|
||||||
<ion-icon name="fas-trash" aria-hidden="true"></ion-icon>
|
|
||||||
<span class="ion-text-wrap">{{ 'core.deletedoffline' | translate }}</span>
|
|
||||||
</ion-note>
|
|
||||||
</ion-item>
|
|
||||||
</ng-container>
|
|
||||||
</ion-list>
|
|
||||||
|
|
||||||
<core-infinite-loading [enabled]="canLoadMore" (action)="loadMoreEvents($event)" [error]="loadMoreError">
|
|
||||||
</core-infinite-loading>
|
|
||||||
</core-loading>
|
|
||||||
|
|
||||||
<!-- Create a calendar event. -->
|
|
||||||
<ion-fab slot="fixed" core-fab vertical="bottom" horizontal="end" *ngIf="canCreate">
|
|
||||||
<ion-fab-button (click)="openEdit()" [attr.aria-label]="'addon.calendar.newevent' | translate">
|
|
||||||
<ion-icon name="fas-plus" aria-hidden="true"></ion-icon>
|
|
||||||
</ion-fab-button>
|
|
||||||
</ion-fab>
|
|
||||||
</core-split-view>
|
|
||||||
</ion-content>
|
</ion-content>
|
||||||
|
|
|
@ -29,7 +29,6 @@ import { CoreSites } from '@services/sites';
|
||||||
import { CoreLocalNotifications } from '@services/local-notifications';
|
import { CoreLocalNotifications } from '@services/local-notifications';
|
||||||
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
import { CoreEventObserver, CoreEvents } from '@singletons/events';
|
||||||
import { CoreApp } from '@services/app';
|
import { CoreApp } from '@services/app';
|
||||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { CoreConstants } from '@/core/constants';
|
import { CoreConstants } from '@/core/constants';
|
||||||
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
import { AddonCalendarFilterPopoverComponent } from '../../components/filter/filter';
|
||||||
|
@ -51,7 +50,6 @@ import { CoreNavigator } from '@services/navigator';
|
||||||
export class AddonCalendarListPage implements OnInit, OnDestroy {
|
export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
@ViewChild(IonContent) content?: IonContent;
|
@ViewChild(IonContent) content?: IonContent;
|
||||||
@ViewChild(CoreSplitViewComponent) splitviewCtrl?: CoreSplitViewComponent;
|
|
||||||
|
|
||||||
protected initialTime = 0;
|
protected initialTime = 0;
|
||||||
protected daysLoaded = 0;
|
protected daysLoaded = 0;
|
||||||
|
@ -117,26 +115,12 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.newEventObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_EVENT, (data) => {
|
this.newEventObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_EVENT, (data) => {
|
||||||
if (data && data.eventId) {
|
if (data && data.eventId) {
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents(true, false).finally(() => {
|
this.refreshEvents(true, false);
|
||||||
|
|
||||||
// In tablet mode try to open the event (only if it's an online event).
|
|
||||||
if (this.splitviewCtrl?.outletActivated && data.eventId > 0) {
|
|
||||||
this.gotoEvent(data.eventId);
|
|
||||||
} else if (this.splitviewCtrl?.outletActivated) {
|
|
||||||
// Discussion added, clear details page.
|
|
||||||
this.emptySplitView();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, this.currentSiteId);
|
}, this.currentSiteId);
|
||||||
|
|
||||||
// Listen for new event discarded event. When it does, reload the data.
|
// Listen for new event discarded event. When it does, reload the data.
|
||||||
this.discardedObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_DISCARDED_EVENT, () => {
|
this.discardedObserver = CoreEvents.on(AddonCalendarProvider.NEW_EVENT_DISCARDED_EVENT, () => {
|
||||||
if (this.splitviewCtrl?.outletActivated) {
|
|
||||||
// Discussion added, clear details page.
|
|
||||||
this.emptySplitView();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents(true, false);
|
this.refreshEvents(true, false);
|
||||||
}, this.currentSiteId);
|
}, this.currentSiteId);
|
||||||
|
@ -150,15 +134,9 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
}, this.currentSiteId);
|
}, this.currentSiteId);
|
||||||
|
|
||||||
// Refresh data if calendar events are synchronized automatically.
|
// Refresh data if calendar events are synchronized automatically.
|
||||||
this.syncObserver = CoreEvents.on(AddonCalendarSyncProvider.AUTO_SYNCED, (data) => {
|
this.syncObserver = CoreEvents.on(AddonCalendarSyncProvider.AUTO_SYNCED, () => {
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents();
|
this.refreshEvents();
|
||||||
|
|
||||||
if (this.splitviewCtrl?.outletActivated &&
|
|
||||||
this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
|
||||||
// Current selected event was deleted. Clear details.
|
|
||||||
this.emptySplitView();
|
|
||||||
}
|
|
||||||
}, this.currentSiteId);
|
}, this.currentSiteId);
|
||||||
|
|
||||||
// Refresh data if calendar events are synchronized manually but not by this page.
|
// Refresh data if calendar events are synchronized manually but not by this page.
|
||||||
|
@ -167,12 +145,6 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents();
|
this.refreshEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.splitviewCtrl?.outletActivated &&
|
|
||||||
this.eventId && data && data.deleted && data.deleted.indexOf(this.eventId) != -1) {
|
|
||||||
// Current selected event was deleted. Clear details.
|
|
||||||
this.emptySplitView();
|
|
||||||
}
|
|
||||||
}, this.currentSiteId);
|
}, this.currentSiteId);
|
||||||
|
|
||||||
// Update the list when an event is deleted.
|
// Update the list when an event is deleted.
|
||||||
|
@ -185,11 +157,7 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.deletedEvents.push(data.eventId);
|
this.deletedEvents.push(data.eventId);
|
||||||
this.hasOffline = true;
|
this.hasOffline = true;
|
||||||
} else {
|
} else {
|
||||||
// Event deleted, clear the details if needed and refresh the view.
|
// Event deleted, refresh the view.
|
||||||
if (this.splitviewCtrl?.outletActivated) {
|
|
||||||
this.emptySplitView();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.eventsLoaded = false;
|
this.eventsLoaded = false;
|
||||||
this.refreshEvents();
|
this.refreshEvents();
|
||||||
}
|
}
|
||||||
|
@ -248,27 +216,6 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
this.syncIcon = CoreConstants.ICON_LOADING;
|
this.syncIcon = CoreConstants.ICON_LOADING;
|
||||||
|
|
||||||
await this.fetchData(false, true, false);
|
await this.fetchData(false, true, false);
|
||||||
|
|
||||||
if (!this.eventId && this.splitviewCtrl?.outletActivated && this.events.length > 0) {
|
|
||||||
// Take first online event and load it. If no online event, load the first offline.
|
|
||||||
if (this.onlineEvents[0]) {
|
|
||||||
this.gotoEvent(this.onlineEvents[0].id);
|
|
||||||
} else {
|
|
||||||
this.gotoEvent(this.offlineEvents[0].id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience function to clear detail view of the split view.
|
|
||||||
*/
|
|
||||||
protected emptySplitView(): void {
|
|
||||||
// Empty details.
|
|
||||||
const splitViewLoaded = CoreNavigator.isCurrentPathInTablet('**/calendar/list/event') ||
|
|
||||||
CoreNavigator.isCurrentPathInTablet('**/calendar/list/edit');
|
|
||||||
if (splitViewLoaded) {
|
|
||||||
CoreNavigator.navigate('../');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -633,20 +580,15 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
*/
|
*/
|
||||||
openEdit(eventId?: number): void {
|
openEdit(eventId?: number): void {
|
||||||
this.eventId = undefined;
|
this.eventId = undefined;
|
||||||
|
eventId = eventId || 0;
|
||||||
|
|
||||||
const params: Params = {};
|
const params: Params = {};
|
||||||
|
|
||||||
if (eventId) {
|
|
||||||
params.eventId = eventId;
|
|
||||||
}
|
|
||||||
if (this.filter.courseId) {
|
if (this.filter.courseId) {
|
||||||
params.courseId = this.filter.courseId;
|
params.courseId = this.filter.courseId;
|
||||||
}
|
}
|
||||||
|
|
||||||
const splitViewLoaded = CoreNavigator.isCurrentPathInTablet('**/calendar/list/event') ||
|
CoreNavigator.navigateToSitePath(`calendar/edit/${eventId}`, { params });
|
||||||
CoreNavigator.isCurrentPathInTablet('**/calendar/list/edit');
|
|
||||||
const path = (splitViewLoaded ? '../' : '') + 'edit';
|
|
||||||
CoreNavigator.navigate(path, { params });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -664,16 +606,11 @@ export class AddonCalendarListPage implements OnInit, OnDestroy {
|
||||||
gotoEvent(eventId: number): void {
|
gotoEvent(eventId: number): void {
|
||||||
this.eventId = eventId;
|
this.eventId = eventId;
|
||||||
|
|
||||||
if (eventId < 0) {
|
if (eventId <= 0) {
|
||||||
// It's an offline event, go to the edit page.
|
// It's an offline event, go to the edit page.
|
||||||
this.openEdit(eventId);
|
this.openEdit(eventId);
|
||||||
} else {
|
} else {
|
||||||
const splitViewLoaded = CoreNavigator.isCurrentPathInTablet('**/calendar/list/event') ||
|
CoreNavigator.navigateToSitePath(`/calendar/event/${eventId}`);
|
||||||
CoreNavigator.isCurrentPathInTablet('**/calendar/list/edit');
|
|
||||||
const path = (splitViewLoaded ? '../' : '') + 'event';
|
|
||||||
CoreNavigator.navigate(path, { params: {
|
|
||||||
id: eventId,
|
|
||||||
} });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -512,7 +512,7 @@ type NewEntryForm = { newEntry: true };
|
||||||
/**
|
/**
|
||||||
* Type of items that can be held by the entries manager.
|
* Type of items that can be held by the entries manager.
|
||||||
*/
|
*/
|
||||||
type EntryItem = AddonModGlossaryEntry | AddonModGlossaryOfflineEntry | NewEntryForm;
|
type EntryItem = AddonModGlossaryEntry | AddonModGlossaryOfflineEntry | NewEntryForm;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entries manager.
|
* Entries manager.
|
||||||
|
|
|
@ -362,16 +362,6 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Page will leave.
|
|
||||||
*/
|
|
||||||
ionViewWillLeave(): void {
|
|
||||||
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'scorm' });
|
|
||||||
|
|
||||||
// Empty src when leaving the state so unload event is triggered in the iframe.
|
|
||||||
this.src = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a SCO.
|
* Load a SCO.
|
||||||
*
|
*
|
||||||
|
@ -547,6 +537,10 @@ export class AddonModScormPlayerPage implements OnInit, OnDestroy {
|
||||||
* Component being destroyed.
|
* Component being destroyed.
|
||||||
*/
|
*/
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
|
// Empty src when leaving the state so unload event is triggered in the iframe.
|
||||||
|
this.src = '';
|
||||||
|
CoreEvents.trigger(CoreEvents.ACTIVITY_DATA_SENT, { module: 'scorm' });
|
||||||
|
|
||||||
// Stop listening for events.
|
// Stop listening for events.
|
||||||
this.tocObserver?.off();
|
this.tocObserver?.off();
|
||||||
this.launchNextObserver?.off();
|
this.launchNextObserver?.off();
|
||||||
|
|
|
@ -377,6 +377,7 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
|
|
||||||
// Calculate the height now.
|
// Calculate the height now.
|
||||||
this.calculateHeight();
|
this.calculateHeight();
|
||||||
|
setTimeout(() => this.calculateHeight(), 200); // Try again, sometimes the first calculation is wrong.
|
||||||
|
|
||||||
// Add magnifying glasses to images.
|
// Add magnifying glasses to images.
|
||||||
this.addMagnifyingGlasses();
|
this.addMagnifyingGlasses();
|
||||||
|
@ -388,6 +389,7 @@ export class CoreFormatTextDirective implements OnChanges {
|
||||||
if (data.loaded && CoreDomUtils.closest(this.element.parentElement, '#' + data.uniqueId)) {
|
if (data.loaded && CoreDomUtils.closest(this.element.parentElement, '#' + data.uniqueId)) {
|
||||||
// The format-text is inside the loading, re-calculate the height.
|
// The format-text is inside the loading, re-calculate the height.
|
||||||
this.calculateHeight();
|
this.calculateHeight();
|
||||||
|
setTimeout(() => this.calculateHeight(), 200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,11 +38,6 @@ export const CORE_COURSES_SERVICES: Type<unknown>[] = [
|
||||||
];
|
];
|
||||||
|
|
||||||
const mainMenuHomeChildrenRoutes: Routes = [
|
const mainMenuHomeChildrenRoutes: Routes = [
|
||||||
{
|
|
||||||
path: '',
|
|
||||||
pathMatch: 'full',
|
|
||||||
redirectTo: CoreDashboardHomeHandlerService.PAGE_NAME,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: CoreDashboardHomeHandlerService.PAGE_NAME,
|
path: CoreDashboardHomeHandlerService.PAGE_NAME,
|
||||||
loadChildren: () => import('./pages/dashboard/dashboard.module').then(m => m.CoreCoursesDashboardPageModule),
|
loadChildren: () => import('./pages/dashboard/dashboard.module').then(m => m.CoreCoursesDashboardPageModule),
|
||||||
|
|
|
@ -77,9 +77,6 @@ export class CoreSitePluginsProvider {
|
||||||
|
|
||||||
const lang = await CoreLang.getCurrentLanguage();
|
const lang = await CoreLang.getCurrentLanguage();
|
||||||
|
|
||||||
// Clone the object so the original one isn't modified.
|
|
||||||
// const argsToSend = CoreUtils.clone(args);
|
|
||||||
|
|
||||||
const defaultArgs: CoreSitePluginsDefaultArgs = {
|
const defaultArgs: CoreSitePluginsDefaultArgs = {
|
||||||
userid: <number> args.userid ?? site?.getUserId(),
|
userid: <number> args.userid ?? site?.getUserId(),
|
||||||
appid: CoreConstants.CONFIG.app_id,
|
appid: CoreConstants.CONFIG.app_id,
|
||||||
|
|
Loading…
Reference in New Issue