MOBILE-4616 wiki: Move wiki constants to a file
parent
df814d022c
commit
ba80f1ce05
|
@ -33,11 +33,9 @@ import { CorePath } from '@singletons/path';
|
|||
import { Subscription } from 'rxjs';
|
||||
import { Md5 } from 'ts-md5';
|
||||
import { AddonModWikiPageDBRecord } from '../../services/database/wiki';
|
||||
import { AddonModWikiModuleHandlerService } from '../../services/handlers/module';
|
||||
import {
|
||||
AddonModWiki,
|
||||
AddonModWikiPageContents,
|
||||
AddonModWikiProvider,
|
||||
AddonModWikiSubwiki,
|
||||
AddonModWikiSubwikiListData,
|
||||
AddonModWikiSubwikiListGrouping,
|
||||
|
@ -49,12 +47,18 @@ import { AddonModWikiOffline } from '../../services/wiki-offline';
|
|||
import {
|
||||
AddonModWikiAutoSyncData,
|
||||
AddonModWikiSync,
|
||||
AddonModWikiSyncProvider,
|
||||
AddonModWikiSyncWikiResult,
|
||||
AddonModWikiSyncWikiSubwiki,
|
||||
} from '../../services/wiki-sync';
|
||||
import { AddonModWikiMapModalComponent, AddonModWikiMapModalReturn } from '../map/map';
|
||||
import { AddonModWikiSubwikiPickerComponent } from '../subwiki-picker/subwiki-picker';
|
||||
import {
|
||||
ADDON_MOD_WIKI_AUTO_SYNCED,
|
||||
ADDON_MOD_WIKI_COMPONENT,
|
||||
ADDON_MOD_WIKI_MANUAL_SYNCED,
|
||||
ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
|
||||
ADDON_MOD_WIKI_PAGE_NAME,
|
||||
} from '../../constants';
|
||||
|
||||
/**
|
||||
* Component that displays a wiki entry page.
|
||||
|
@ -73,7 +77,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
@Input() userId?: number;
|
||||
@Input() groupId?: number;
|
||||
|
||||
component = AddonModWikiProvider.COMPONENT;
|
||||
component = ADDON_MOD_WIKI_COMPONENT;
|
||||
componentId?: number;
|
||||
pluginName = 'wiki';
|
||||
groupWiki = false;
|
||||
|
@ -99,7 +103,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
count: 0,
|
||||
};
|
||||
|
||||
protected syncEventName = AddonModWikiSyncProvider.AUTO_SYNCED;
|
||||
protected syncEventName = ADDON_MOD_WIKI_AUTO_SYNCED;
|
||||
protected currentSubwiki?: AddonModWikiSubwiki; // Current selected subwiki.
|
||||
protected currentPage?: number; // Current loaded page ID.
|
||||
protected subwikiPages?: (AddonModWikiSubwikiPage | AddonModWikiPageDBRecord)[]; // List of subwiki pages.
|
||||
|
@ -155,7 +159,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
*/
|
||||
protected listenEvents(): void {
|
||||
// Listen for manual sync events.
|
||||
this.manualSyncObserver = CoreEvents.on(AddonModWikiSyncProvider.MANUAL_SYNCED, (data) => {
|
||||
this.manualSyncObserver = CoreEvents.on(ADDON_MOD_WIKI_MANUAL_SYNCED, (data) => {
|
||||
if (!data || !this.wiki || data.wikiId != this.wiki.id) {
|
||||
return;
|
||||
}
|
||||
|
@ -313,7 +317,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
this.pageIsOffline = true;
|
||||
if (!this.newPageObserver) {
|
||||
// It's an offline page, listen for new pages event to detect if the user goes to Edit and submits the page.
|
||||
this.newPageObserver = CoreEvents.on(AddonModWikiProvider.PAGE_CREATED_EVENT, async (data) => {
|
||||
this.newPageObserver = CoreEvents.on(ADDON_MOD_WIKI_PAGE_CREATED_EVENT, async (data) => {
|
||||
if (data.subwikiId != this.currentSubwiki?.id || data.pageTitle != title) {
|
||||
return;
|
||||
}
|
||||
|
@ -528,7 +532,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
*/
|
||||
protected goToCreateFirstPage(): void {
|
||||
CoreNavigator.navigateToSitePath(
|
||||
`${AddonModWikiModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
{
|
||||
params: {
|
||||
pageTitle: this.wiki?.firstpagetitle ?? '',
|
||||
|
@ -566,7 +570,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
}
|
||||
|
||||
CoreNavigator.navigateToSitePath(
|
||||
`${AddonModWikiModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
{ params: pageParams },
|
||||
);
|
||||
} else if (this.currentSubwiki) {
|
||||
|
@ -596,7 +600,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
}
|
||||
|
||||
CoreNavigator.navigateToSitePath(
|
||||
`${AddonModWikiModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${this.courseId}/${this.module.id}/edit`,
|
||||
{ params: pageParams },
|
||||
);
|
||||
} else if (this.currentSubwiki) {
|
||||
|
@ -644,7 +648,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
}));
|
||||
|
||||
CoreNavigator.navigateToSitePath(
|
||||
`${AddonModWikiModuleHandlerService.PAGE_NAME}/${this.courseId}/${this.module.id}/page/${hash}`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${this.courseId}/${this.module.id}/page/${hash}`,
|
||||
{
|
||||
params: {
|
||||
module: this.module,
|
||||
|
@ -771,7 +775,7 @@ export class AddonModWikiIndexComponent extends CoreCourseModuleMainActivityComp
|
|||
if (result.updated && this.wiki) {
|
||||
// Trigger event.
|
||||
this.ignoreManualSyncEvent = true;
|
||||
CoreEvents.trigger(AddonModWikiSyncProvider.MANUAL_SYNCED, {
|
||||
CoreEvents.trigger(ADDON_MOD_WIKI_MANUAL_SYNCED, {
|
||||
...result,
|
||||
wikiId: this.wiki.id,
|
||||
});
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
// (C) Copyright 2015 Moodle Pty Ltd.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
export const ADDON_MOD_WIKI_COMPONENT = 'mmaModWiki';
|
||||
|
||||
export const ADDON_MOD_WIKI_PAGE_NAME = 'mod_wiki';
|
||||
|
||||
export const ADDON_MOD_WIKI_AUTO_SYNCED = 'addon_mod_wiki_autom_synced';
|
||||
export const ADDON_MOD_WIKI_MANUAL_SYNCED = 'addon_mod_wiki_manual_synced';
|
||||
|
||||
export const ADDON_MOD_WIKI_PAGE_CREATED_EVENT = 'addon_mod_wiki_page_created';
|
||||
export const ADDON_MOD_WIKI_RENEW_LOCK_TIME = 30000; // Milliseconds.
|
|
@ -27,10 +27,11 @@ import { CoreWSFile } from '@services/ws';
|
|||
import { Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { CoreForms } from '@singletons/form';
|
||||
import { AddonModWiki, AddonModWikiProvider } from '../../services/wiki';
|
||||
import { AddonModWiki } from '../../services/wiki';
|
||||
import { AddonModWikiOffline } from '../../services/wiki-offline';
|
||||
import { AddonModWikiSync } from '../../services/wiki-sync';
|
||||
import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics';
|
||||
import { ADDON_MOD_WIKI_COMPONENT, ADDON_MOD_WIKI_PAGE_CREATED_EVENT, ADDON_MOD_WIKI_RENEW_LOCK_TIME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Page that allows adding or editing a wiki page.
|
||||
|
@ -50,7 +51,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
contentControl: FormControl<string>; // The FormControl for the page content.
|
||||
canEditTitle = false; // Whether title can be edited.
|
||||
loaded = false; // Whether the data has been loaded.
|
||||
component = AddonModWikiProvider.COMPONENT; // Component to link the files to.
|
||||
component = ADDON_MOD_WIKI_COMPONENT; // Component to link the files to.
|
||||
wrongVersionLock = false; // Whether the page lock doesn't match the initial one.
|
||||
editorExtraParams: Record<string, unknown> = {};
|
||||
|
||||
|
@ -190,7 +191,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
// Renew the lock every certain time.
|
||||
this.renewLockInterval = window.setInterval(() => {
|
||||
this.renewLock();
|
||||
}, AddonModWikiProvider.RENEW_LOCK_TIME);
|
||||
}, ADDON_MOD_WIKI_RENEW_LOCK_TIME);
|
||||
}
|
||||
} else {
|
||||
const pageTitle = this.pageForm.controls.title.value;
|
||||
|
@ -442,7 +443,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy, CanLeave {
|
|||
await CoreUtils.ignoreErrors(Promise.all(promises));
|
||||
|
||||
// Notify page created.
|
||||
CoreEvents.trigger(AddonModWikiProvider.PAGE_CREATED_EVENT, {
|
||||
CoreEvents.trigger(ADDON_MOD_WIKI_PAGE_CREATED_EVENT, {
|
||||
pageId: this.pageId,
|
||||
subwikiId: this.subwikiId,
|
||||
pageTitle: title,
|
||||
|
|
|
@ -23,7 +23,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModWikiIndexPage } from '../../pages/index';
|
||||
import { AddonModWiki } from '../wiki';
|
||||
import { AddonModWikiModuleHandlerService } from './module';
|
||||
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to treat links to create a wiki page.
|
||||
|
@ -109,7 +109,7 @@ export class AddonModWikiCreateLinkHandlerService extends CoreContentLinksHandle
|
|||
}
|
||||
const subwikiId = parseInt(params.swid, 10);
|
||||
const wikiId = parseInt(params.wid, 10);
|
||||
let path = AddonModWikiModuleHandlerService.PAGE_NAME;
|
||||
let path = ADDON_MOD_WIKI_PAGE_NAME;
|
||||
|
||||
// Check if the link is inside the same wiki.
|
||||
const isSameWiki = await this.currentStateIsSameWiki(route, subwikiId, siteId);
|
||||
|
|
|
@ -21,7 +21,7 @@ import { CoreSitesReadingStrategy } from '@services/sites';
|
|||
import { CoreDomUtils } from '@services/utils/dom';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModWiki } from '../wiki';
|
||||
import { AddonModWikiModuleHandlerService } from './module';
|
||||
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to treat links to edit a wiki page.
|
||||
|
@ -63,7 +63,7 @@ export class AddonModWikiEditLinkHandlerService extends CoreContentLinksHandlerB
|
|||
}
|
||||
|
||||
await CoreNavigator.navigateToSitePath(
|
||||
AddonModWikiModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/edit`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${module.course}/${module.id}/edit`,
|
||||
{
|
||||
params: {
|
||||
section: section,
|
||||
|
|
|
@ -17,6 +17,7 @@ import { Injectable, Type } from '@angular/core';
|
|||
import { CoreModuleHandlerBase } from '@features/course/classes/module-base-handler';
|
||||
import { CoreCourseModuleHandler } from '@features/course/services/module-delegate';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to support wiki modules.
|
||||
|
@ -24,11 +25,9 @@ import { makeSingleton } from '@singletons';
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModWikiModuleHandlerService extends CoreModuleHandlerBase implements CoreCourseModuleHandler {
|
||||
|
||||
static readonly PAGE_NAME = 'mod_wiki';
|
||||
|
||||
name = 'AddonModWiki';
|
||||
modName = 'wiki';
|
||||
protected pageName = AddonModWikiModuleHandlerService.PAGE_NAME;
|
||||
protected pageName = ADDON_MOD_WIKI_PAGE_NAME;
|
||||
|
||||
supportedFeatures = {
|
||||
[CoreConstants.FEATURE_GROUPS]: true,
|
||||
|
|
|
@ -22,7 +22,7 @@ import { CoreDomUtils } from '@services/utils/dom';
|
|||
import { makeSingleton } from '@singletons';
|
||||
import { Md5 } from 'ts-md5';
|
||||
import { AddonModWiki } from '../wiki';
|
||||
import { AddonModWikiModuleHandlerService } from './module';
|
||||
import { ADDON_MOD_WIKI_PAGE_NAME } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to treat links to a wiki page or the wiki map.
|
||||
|
@ -68,7 +68,7 @@ export class AddonModWikiPageOrMapLinkHandlerService extends CoreContentLinksHan
|
|||
}));
|
||||
|
||||
await CoreNavigator.navigateToSitePath(
|
||||
AddonModWikiModuleHandlerService.PAGE_NAME + `/${module.course}/${module.id}/page/${hash}`,
|
||||
`${ADDON_MOD_WIKI_PAGE_NAME}/${module.course}/${module.id}/page/${hash}`,
|
||||
{
|
||||
params: {
|
||||
module,
|
||||
|
|
|
@ -22,8 +22,9 @@ import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@
|
|||
import { CoreUtils } from '@services/utils/utils';
|
||||
import { CoreWSFile } from '@services/ws';
|
||||
import { makeSingleton } from '@singletons';
|
||||
import { AddonModWiki, AddonModWikiProvider, AddonModWikiSubwikiPage } from '../wiki';
|
||||
import { AddonModWiki, AddonModWikiSubwikiPage } from '../wiki';
|
||||
import { AddonModWikiSync, AddonModWikiSyncWikiResult } from '../wiki-sync';
|
||||
import { ADDON_MOD_WIKI_COMPONENT } from '../../constants';
|
||||
|
||||
/**
|
||||
* Handler to prefetch wikis.
|
||||
|
@ -33,7 +34,7 @@ export class AddonModWikiPrefetchHandlerService extends CoreCourseActivityPrefet
|
|||
|
||||
name = 'AddonModWiki';
|
||||
modName = 'wiki';
|
||||
component = AddonModWikiProvider.COMPONENT;
|
||||
component = ADDON_MOD_WIKI_COMPONENT;
|
||||
updatesNames = /^.*files$|^pages$/;
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,9 @@ import { CoreUtils } from '@services/utils/utils';
|
|||
import { makeSingleton, Translate } from '@singletons';
|
||||
import { CoreEvents } from '@singletons/events';
|
||||
import { AddonModWikiPageDBRecord } from './database/wiki';
|
||||
import { AddonModWiki, AddonModWikiProvider } from './wiki';
|
||||
import { AddonModWiki } from './wiki';
|
||||
import { AddonModWikiOffline } from './wiki-offline';
|
||||
import { ADDON_MOD_WIKI_AUTO_SYNCED, ADDON_MOD_WIKI_COMPONENT } from '../constants';
|
||||
|
||||
/**
|
||||
* Service to sync wikis.
|
||||
|
@ -33,9 +34,6 @@ import { AddonModWikiOffline } from './wiki-offline';
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModWikiSyncProvider extends CoreSyncBaseProvider<AddonModWikiSyncSubwikiResult> {
|
||||
|
||||
static readonly AUTO_SYNCED = 'addon_mod_wiki_autom_synced';
|
||||
static readonly MANUAL_SYNCED = 'addon_mod_wiki_manual_synced';
|
||||
|
||||
protected componentTranslatableString = 'wiki';
|
||||
|
||||
constructor() {
|
||||
|
@ -106,7 +104,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider<AddonModWikiS
|
|||
|
||||
if (result?.updated) {
|
||||
// Sync successful, send event.
|
||||
CoreEvents.trigger(AddonModWikiSyncProvider.AUTO_SYNCED, {
|
||||
CoreEvents.trigger(ADDON_MOD_WIKI_AUTO_SYNCED, {
|
||||
siteId: siteId,
|
||||
subwikiId: page.subwikiid,
|
||||
wikiId: page.wikiid,
|
||||
|
@ -175,7 +173,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider<AddonModWikiS
|
|||
}
|
||||
|
||||
// Verify that subwiki isn't blocked.
|
||||
if (CoreSync.isBlocked(AddonModWikiProvider.COMPONENT, subwikiBlockId, siteId)) {
|
||||
if (CoreSync.isBlocked(ADDON_MOD_WIKI_COMPONENT, subwikiBlockId, siteId)) {
|
||||
this.logger.debug(`Cannot sync subwiki ${subwikiBlockId} because it is blocked.`);
|
||||
|
||||
throw new CoreSyncBlockedError(Translate.instant('core.errorsyncblocked', { $a: this.componentTranslate }));
|
||||
|
@ -290,7 +288,7 @@ export class AddonModWikiSyncProvider extends CoreSyncBaseProvider<AddonModWikiS
|
|||
siteId = siteId || CoreSites.getCurrentSiteId();
|
||||
|
||||
// Sync offline logs.
|
||||
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(AddonModWikiProvider.COMPONENT, wikiId, siteId));
|
||||
await CoreUtils.ignoreErrors(CoreCourseLogHelper.syncActivity(ADDON_MOD_WIKI_COMPONENT, wikiId, siteId));
|
||||
|
||||
// Sync is done at subwiki level, get all the subwikis.
|
||||
const subwikis = await AddonModWiki.getSubwikis(wikiId, { cmId, siteId });
|
||||
|
|
|
@ -27,10 +27,14 @@ import { makeSingleton, Translate } from '@singletons';
|
|||
import { CoreEvents } from '@singletons/events';
|
||||
import { AddonModWikiPageDBRecord } from './database/wiki';
|
||||
import { AddonModWikiOffline } from './wiki-offline';
|
||||
import { AddonModWikiAutoSyncData, AddonModWikiManualSyncData, AddonModWikiSyncProvider } from './wiki-sync';
|
||||
import { AddonModWikiAutoSyncData, AddonModWikiManualSyncData } from './wiki-sync';
|
||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
|
||||
|
||||
const ROOT_CACHE_KEY = 'mmaModWiki:';
|
||||
import {
|
||||
ADDON_MOD_WIKI_AUTO_SYNCED,
|
||||
ADDON_MOD_WIKI_COMPONENT,
|
||||
ADDON_MOD_WIKI_MANUAL_SYNCED,
|
||||
ADDON_MOD_WIKI_PAGE_CREATED_EVENT,
|
||||
} from '../constants';
|
||||
|
||||
/**
|
||||
* Service that provides some features for wikis.
|
||||
|
@ -38,9 +42,7 @@ const ROOT_CACHE_KEY = 'mmaModWiki:';
|
|||
@Injectable({ providedIn: 'root' })
|
||||
export class AddonModWikiProvider {
|
||||
|
||||
static readonly COMPONENT = 'mmaModWiki';
|
||||
static readonly PAGE_CREATED_EVENT = 'addon_mod_wiki_page_created';
|
||||
static readonly RENEW_LOCK_TIME = 30000; // Milliseconds.
|
||||
protected static readonly ROOT_CACHE_KEY = 'mmaModWiki:';
|
||||
|
||||
protected subwikiListsCache: {[wikiId: number]: AddonModWikiSubwikiListData} = {};
|
||||
protected wikiFirstViewedPage: Record<string, Record<number, string>> = {};
|
||||
|
@ -137,7 +139,7 @@ export class AddonModWikiProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getPageContentsCacheKey(pageId),
|
||||
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
||||
component: AddonModWikiProvider.COMPONENT,
|
||||
component: ADDON_MOD_WIKI_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
@ -154,7 +156,7 @@ export class AddonModWikiProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getPageContentsCacheKey(pageId: number): string {
|
||||
return ROOT_CACHE_KEY + 'page:' + pageId;
|
||||
return AddonModWikiProvider.ROOT_CACHE_KEY + 'page:' + pageId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,7 +212,7 @@ export class AddonModWikiProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getSubwikiFilesCacheKey(wikiId, groupId, userId),
|
||||
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
||||
component: AddonModWikiProvider.COMPONENT,
|
||||
component: ADDON_MOD_WIKI_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
@ -239,7 +241,7 @@ export class AddonModWikiProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getSubwikiFilesCacheKeyPrefix(wikiId: number): string {
|
||||
return ROOT_CACHE_KEY + 'subwikifiles:' + wikiId;
|
||||
return AddonModWikiProvider.ROOT_CACHE_KEY + 'subwikifiles:' + wikiId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -280,7 +282,7 @@ export class AddonModWikiProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getSubwikiPagesCacheKey(wikiId, groupId, userId),
|
||||
updateFrequency: CoreSite.FREQUENCY_SOMETIMES,
|
||||
component: AddonModWikiProvider.COMPONENT,
|
||||
component: ADDON_MOD_WIKI_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
@ -309,7 +311,7 @@ export class AddonModWikiProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getSubwikiPagesCacheKeyPrefix(wikiId: number): string {
|
||||
return ROOT_CACHE_KEY + 'subwikipages:' + wikiId;
|
||||
return AddonModWikiProvider.ROOT_CACHE_KEY + 'subwikipages:' + wikiId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -328,7 +330,7 @@ export class AddonModWikiProvider {
|
|||
const preSets = {
|
||||
cacheKey: this.getSubwikisCacheKey(wikiId),
|
||||
updateFrequency: CoreSite.FREQUENCY_RARELY,
|
||||
component: AddonModWikiProvider.COMPONENT,
|
||||
component: ADDON_MOD_WIKI_COMPONENT,
|
||||
componentId: options.cmId,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
@ -348,7 +350,7 @@ export class AddonModWikiProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getSubwikisCacheKey(wikiId: number): string {
|
||||
return ROOT_CACHE_KEY + 'subwikis:' + wikiId;
|
||||
return AddonModWikiProvider.ROOT_CACHE_KEY + 'subwikis:' + wikiId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -386,7 +388,7 @@ export class AddonModWikiProvider {
|
|||
const preSets: CoreSiteWSPreSets = {
|
||||
cacheKey: this.getWikiDataCacheKey(courseId),
|
||||
updateFrequency: CoreSite.FREQUENCY_RARELY,
|
||||
component: AddonModWikiProvider.COMPONENT,
|
||||
component: ADDON_MOD_WIKI_COMPONENT,
|
||||
...CoreSites.getReadingStrategyPreSets(options.readingStrategy), // Include reading strategy preSets.
|
||||
};
|
||||
|
||||
|
@ -419,7 +421,7 @@ export class AddonModWikiProvider {
|
|||
* @returns Cache key.
|
||||
*/
|
||||
protected getWikiDataCacheKey(courseId: number): string {
|
||||
return ROOT_CACHE_KEY + 'wiki:' + courseId;
|
||||
return AddonModWikiProvider.ROOT_CACHE_KEY + 'wiki:' + courseId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -633,7 +635,7 @@ export class AddonModWikiProvider {
|
|||
return CoreCourseLogHelper.log(
|
||||
'mod_wiki_view_page',
|
||||
params,
|
||||
AddonModWikiProvider.COMPONENT,
|
||||
ADDON_MOD_WIKI_COMPONENT,
|
||||
wikiId,
|
||||
siteId,
|
||||
);
|
||||
|
@ -654,7 +656,7 @@ export class AddonModWikiProvider {
|
|||
return CoreCourseLogHelper.log(
|
||||
'mod_wiki_view_wiki',
|
||||
params,
|
||||
AddonModWikiProvider.COMPONENT,
|
||||
ADDON_MOD_WIKI_COMPONENT,
|
||||
id,
|
||||
siteId,
|
||||
);
|
||||
|
@ -895,9 +897,9 @@ declare module '@singletons/events' {
|
|||
* @see https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation
|
||||
*/
|
||||
export interface CoreEventsData {
|
||||
[AddonModWikiProvider.PAGE_CREATED_EVENT]: AddonModWikiPageCreatedData;
|
||||
[AddonModWikiSyncProvider.AUTO_SYNCED]: AddonModWikiAutoSyncData;
|
||||
[AddonModWikiSyncProvider.MANUAL_SYNCED]: AddonModWikiManualSyncData;
|
||||
[ADDON_MOD_WIKI_PAGE_CREATED_EVENT]: AddonModWikiPageCreatedData;
|
||||
[ADDON_MOD_WIKI_AUTO_SYNCED]: AddonModWikiAutoSyncData;
|
||||
[ADDON_MOD_WIKI_MANUAL_SYNCED]: AddonModWikiManualSyncData;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -49,4 +49,4 @@ const routes: Routes = [
|
|||
AddonModWikiEditPage,
|
||||
],
|
||||
})
|
||||
export class AddonModWikiLazyModule {}
|
||||
export default class AddonModWikiLazyModule {}
|
||||
|
|
|
@ -27,17 +27,17 @@ import { AddonModWikiCreateLinkHandler } from './services/handlers/create-link';
|
|||
import { AddonModWikiEditLinkHandler } from './services/handlers/edit-link';
|
||||
import { AddonModWikiIndexLinkHandler } from './services/handlers/index-link';
|
||||
import { AddonModWikiListLinkHandler } from './services/handlers/list-link';
|
||||
import { AddonModWikiModuleHandler, AddonModWikiModuleHandlerService } from './services/handlers/module';
|
||||
import { AddonModWikiModuleHandler } from './services/handlers/module';
|
||||
import { AddonModWikiPageOrMapLinkHandler } from './services/handlers/page-or-map-link';
|
||||
import { AddonModWikiPrefetchHandler } from './services/handlers/prefetch';
|
||||
import { AddonModWikiSyncCronHandler } from './services/handlers/sync-cron';
|
||||
import { AddonModWikiTagAreaHandler } from './services/handlers/tag-area';
|
||||
import { AddonModWikiProvider } from './services/wiki';
|
||||
import { ADDON_MOD_WIKI_COMPONENT, ADDON_MOD_WIKI_PAGE_NAME } from './constants';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: AddonModWikiModuleHandlerService.PAGE_NAME,
|
||||
loadChildren: () => import('./wiki-lazy.module').then(m => m.AddonModWikiLazyModule),
|
||||
path: ADDON_MOD_WIKI_PAGE_NAME,
|
||||
loadChildren: () => import('./wiki-lazy.module'),
|
||||
},
|
||||
];
|
||||
|
||||
|
@ -65,7 +65,7 @@ const routes: Routes = [
|
|||
CoreContentLinksDelegate.registerHandler(AddonModWikiPageOrMapLinkHandler.instance);
|
||||
CoreTagAreaDelegate.registerHandler(AddonModWikiTagAreaHandler.instance);
|
||||
|
||||
CoreCourseHelper.registerModuleReminderClick(AddonModWikiProvider.COMPONENT);
|
||||
CoreCourseHelper.registerModuleReminderClick(ADDON_MOD_WIKI_COMPONENT);
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue