MOBILE-4653 chore: Migrate site plugins to standalone components
This commit is contained in:
		
							parent
							
								
									e04264b9e5
								
							
						
					
					
						commit
						d1cae1464d
					
				@ -18,7 +18,6 @@ import { CoreModuleHandlerBase } from '@features/course/classes/module-base-hand
 | 
			
		||||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
 | 
			
		||||
import { CoreCourseModuleHandler, CoreCourseModuleHandlerData } from '@features/course/services/module-delegate';
 | 
			
		||||
import { CoreSitePluginsModuleHandler } from '@features/siteplugins/classes/handlers/module-handler';
 | 
			
		||||
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { makeSingleton } from '@singletons';
 | 
			
		||||
import { AddonModBBBIndexComponent } from '../../components/index';
 | 
			
		||||
import { AddonModBBB } from '../bigbluebuttonbn';
 | 
			
		||||
@ -60,6 +59,8 @@ export class AddonModBBBModuleHandlerService extends CoreModuleHandlerBase imple
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins');
 | 
			
		||||
 | 
			
		||||
        // Native support not available in this site. Check if it's supported by site plugin.
 | 
			
		||||
        this.sitePluginHandler = CoreSitePlugins.getModuleHandlerInstance(this.modName);
 | 
			
		||||
        // Change the handler name to be able to retrieve the plugin data in component.
 | 
			
		||||
 | 
			
		||||
@ -103,7 +103,6 @@ import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
 | 
			
		||||
import { CoreCourseDirectivesModule } from '@features/course/directives/directives.module';
 | 
			
		||||
import { CoreCoursesComponentsModule } from '@features/courses/components/components.module';
 | 
			
		||||
import { CoreSitePluginsDirectivesModule } from '@features/siteplugins/directives/directives.module';
 | 
			
		||||
import { CoreUserComponentsModule } from '@features/user/components/components.module';
 | 
			
		||||
import { CoreQuestionComponentsModule } from '@features/question/components/components.module';
 | 
			
		||||
import { CoreBlockComponentsModule } from '@features/block/components/components.module';
 | 
			
		||||
@ -132,8 +131,11 @@ import { CorePromisedValue } from '@classes/promised-value';
 | 
			
		||||
import { CorePlatform } from '@services/platform';
 | 
			
		||||
 | 
			
		||||
import { CoreAutoLogoutService } from '@features/autologout/services/autologout';
 | 
			
		||||
import { CoreSitePluginsProvider } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { getSitePluginsExportedObjects } from '@features/siteplugins/siteplugins.module';
 | 
			
		||||
import {
 | 
			
		||||
    getSitePluginsDirectives,
 | 
			
		||||
    getSitePluginsExportedObjects,
 | 
			
		||||
    getSitePluginsServices,
 | 
			
		||||
} from '@features/siteplugins/siteplugins.module';
 | 
			
		||||
import { CoreError } from '@classes/errors/error';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -161,7 +163,6 @@ export class CoreCompileProvider {
 | 
			
		||||
        CoreBlockComponentsModule,
 | 
			
		||||
        CoreEditorComponentsModule,
 | 
			
		||||
        CoreSearchComponentsModule,
 | 
			
		||||
        CoreSitePluginsDirectivesModule,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    protected readonly LAZY_IMPORTS = [
 | 
			
		||||
@ -170,6 +171,7 @@ export class CoreCompileProvider {
 | 
			
		||||
        getModWorkshopComponentModules,
 | 
			
		||||
        getCoreStandaloneComponents,
 | 
			
		||||
        getCourseStandaloneComponents,
 | 
			
		||||
        getSitePluginsDirectives,
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    protected componentId = 0;
 | 
			
		||||
@ -399,6 +401,7 @@ export class CoreCompileProvider {
 | 
			
		||||
            getNotesServices(),
 | 
			
		||||
            getNotificationsServices(),
 | 
			
		||||
            getPrivateFilesServices(),
 | 
			
		||||
            getSitePluginsServices(),
 | 
			
		||||
        ]);
 | 
			
		||||
 | 
			
		||||
        const lazyLibraries = services.flat();
 | 
			
		||||
@ -406,7 +409,6 @@ export class CoreCompileProvider {
 | 
			
		||||
        return [
 | 
			
		||||
            ...lazyLibraries,
 | 
			
		||||
            CoreAutoLogoutService,
 | 
			
		||||
            CoreSitePluginsProvider,
 | 
			
		||||
            ...this.OTHER_SERVICES,
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -47,7 +47,6 @@ import { CoreCourseHelper, CoreCourseModuleData, CoreCourseModuleCompletionData
 | 
			
		||||
import { CoreCourseFormatDelegate } from './format-delegate';
 | 
			
		||||
import { CoreCronDelegate } from '@services/cron';
 | 
			
		||||
import { CoreCourseLogCronHandler } from './handlers/log-cron';
 | 
			
		||||
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreCourseAutoSyncData, CoreCourseSyncProvider } from './sync';
 | 
			
		||||
import { CoreTagItem } from '@features/tag/services/tag';
 | 
			
		||||
import { CoreNavigationOptions, CoreNavigator } from '@services/navigator';
 | 
			
		||||
@ -1437,6 +1436,8 @@ export class CoreCourseProvider {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins');
 | 
			
		||||
 | 
			
		||||
        const loading = await CoreLoadings.show();
 | 
			
		||||
 | 
			
		||||
        // Wait for site plugins to be fetched.
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ import {
 | 
			
		||||
    ONBOARDING_DONE,
 | 
			
		||||
} from '@features/login/constants';
 | 
			
		||||
import { CoreSettingsHelper } from '@features/settings/services/settings-helper';
 | 
			
		||||
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreUserTours } from '@features/usertours/services/user-tours';
 | 
			
		||||
import { CoreCacheManager } from '@services/cache-manager';
 | 
			
		||||
import { CoreConfig } from '@services/config';
 | 
			
		||||
@ -124,6 +123,7 @@ export class CoreSettingsDevPage implements OnInit {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        const { CoreSitePlugins } = await import('@features/siteplugins/services/siteplugins');
 | 
			
		||||
        this.sitePlugins = CoreSitePlugins.getCurrentSitePluginList().map((plugin) => ({
 | 
			
		||||
            addon: plugin.addon,
 | 
			
		||||
            component: plugin.component,
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,8 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission }
 | 
			
		||||
import { AddonModAssignFeedbackDelegate } from '@addons/mod/assign/services/feedback-delegate';
 | 
			
		||||
import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays an assign feedback plugin created using a site plugin.
 | 
			
		||||
@ -26,6 +28,11 @@ import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
    selector: 'core-site-plugins-assign-feedback',
 | 
			
		||||
    templateUrl: 'core-siteplugins-assign-feedback.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,8 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission }
 | 
			
		||||
import { AddonModAssignSubmissionDelegate } from '@addons/mod/assign/services/submission-delegate';
 | 
			
		||||
import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays an assign submission plugin created using a site plugin.
 | 
			
		||||
@ -26,6 +28,11 @@ import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
    selector: 'core-site-plugins-assign-submission',
 | 
			
		||||
    templateUrl: 'core-siteplugins-assign-submission.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,8 @@ import { CoreBlockBaseComponent } from '@features/block/classes/base-block-compo
 | 
			
		||||
import { CoreBlockDelegate } from '@features/block/services/block-delegate';
 | 
			
		||||
import { CoreSitePlugins, CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays the index of a course format site plugin.
 | 
			
		||||
@ -26,6 +28,12 @@ import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-
 | 
			
		||||
    selector: 'core-site-plugins-block',
 | 
			
		||||
    templateUrl: 'core-siteplugins-block.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsBlockComponent extends CoreBlockBaseComponent implements OnChanges {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,53 +16,13 @@ import { NgModule } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSitePluginsPluginContentComponent } from './plugin-content/plugin-content';
 | 
			
		||||
import { CoreSitePluginsModuleIndexComponent } from './module-index/module-index';
 | 
			
		||||
import { CoreSitePluginsCourseFormatComponent } from './course-format/course-format';
 | 
			
		||||
import { CoreSitePluginsUserProfileFieldComponent } from './user-profile-field/user-profile-field';
 | 
			
		||||
import { CoreSitePluginsQuestionComponent } from './question/question';
 | 
			
		||||
import { CoreSitePluginsQuestionBehaviourComponent } from './question-behaviour/question-behaviour';
 | 
			
		||||
import { CoreSitePluginsQuizAccessRuleComponent } from './quiz-access-rule/quiz-access-rule';
 | 
			
		||||
import { CoreSitePluginsAssignFeedbackComponent } from './assign-feedback/assign-feedback';
 | 
			
		||||
import { CoreSitePluginsAssignSubmissionComponent } from './assign-submission/assign-submission';
 | 
			
		||||
import { CoreSitePluginsWorkshopAssessmentStrategyComponent } from './workshop-assessment-strategy/workshop-assessment-strategy';
 | 
			
		||||
import { CoreSitePluginsBlockComponent } from './block/block';
 | 
			
		||||
import { CoreSitePluginsOnlyTitleBlockComponent } from './only-title-block/only-title-block';
 | 
			
		||||
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
 | 
			
		||||
 | 
			
		||||
@NgModule({
 | 
			
		||||
    declarations: [
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
        CoreSitePluginsModuleIndexComponent,
 | 
			
		||||
        CoreSitePluginsBlockComponent,
 | 
			
		||||
        CoreSitePluginsOnlyTitleBlockComponent,
 | 
			
		||||
        CoreSitePluginsCourseFormatComponent,
 | 
			
		||||
        CoreSitePluginsUserProfileFieldComponent,
 | 
			
		||||
        CoreSitePluginsQuestionComponent,
 | 
			
		||||
        CoreSitePluginsQuestionBehaviourComponent,
 | 
			
		||||
        CoreSitePluginsQuizAccessRuleComponent,
 | 
			
		||||
        CoreSitePluginsAssignFeedbackComponent,
 | 
			
		||||
        CoreSitePluginsAssignSubmissionComponent,
 | 
			
		||||
        CoreSitePluginsWorkshopAssessmentStrategyComponent,
 | 
			
		||||
    ],
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
        CoreCourseComponentsModule,
 | 
			
		||||
    ],
 | 
			
		||||
    exports: [
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
        CoreSitePluginsModuleIndexComponent,
 | 
			
		||||
        CoreSitePluginsBlockComponent,
 | 
			
		||||
        CoreSitePluginsOnlyTitleBlockComponent,
 | 
			
		||||
        CoreSitePluginsCourseFormatComponent,
 | 
			
		||||
        CoreSitePluginsUserProfileFieldComponent,
 | 
			
		||||
        CoreSitePluginsQuestionComponent,
 | 
			
		||||
        CoreSitePluginsQuestionBehaviourComponent,
 | 
			
		||||
        CoreSitePluginsQuizAccessRuleComponent,
 | 
			
		||||
        CoreSitePluginsAssignFeedbackComponent,
 | 
			
		||||
        CoreSitePluginsAssignSubmissionComponent,
 | 
			
		||||
        CoreSitePluginsWorkshopAssessmentStrategyComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsComponentsModule {}
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,8 @@ import { CoreCourseFormatDelegate } from '@features/course/services/format-deleg
 | 
			
		||||
import { CoreCourseAnyCourseData } from '@features/courses/services/courses';
 | 
			
		||||
import { CoreSitePlugins, CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-content';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays the index of a course format site plugin.
 | 
			
		||||
@ -28,6 +30,12 @@ import { CoreSitePluginsPluginContentComponent } from '../plugin-content/plugin-
 | 
			
		||||
    selector: 'core-site-plugins-course-format',
 | 
			
		||||
    templateUrl: 'core-siteplugins-course-format.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsCourseFormatComponent implements OnChanges {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -31,6 +31,9 @@ import {
 | 
			
		||||
import { CoreModals } from '@services/modals';
 | 
			
		||||
import { CoreUtils } from '@services/utils/utils';
 | 
			
		||||
import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoadedData } from '../plugin-content/plugin-content';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreCourseComponentsModule } from '@features/course/components/components.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays the index of a module site plugin.
 | 
			
		||||
@ -39,6 +42,13 @@ import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoad
 | 
			
		||||
    selector: 'core-site-plugins-module-index',
 | 
			
		||||
    templateUrl: 'core-siteplugins-module-index.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
        CoreCourseComponentsModule,
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, CoreCourseModuleMainComponent {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,7 @@ import { CoreBlockBaseComponent } from '@features/block/classes/base-block-compo
 | 
			
		||||
import { CoreBlockDelegate } from '@features/block/services/block-delegate';
 | 
			
		||||
import { CoreSitePlugins, CoreSitePluginsUserHandlerData } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component to render blocks with only a title and link.
 | 
			
		||||
@ -27,6 +28,8 @@ import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
    selector: 'core-siteplugins-only-title-block',
 | 
			
		||||
    templateUrl: 'core-siteplugins-only-title-block.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [CoreSharedModule],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsOnlyTitleBlockComponent extends CoreBlockBaseComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -35,6 +35,8 @@ import { CoreDomUtils } from '@services/utils/dom';
 | 
			
		||||
import { CoreEvents } from '@singletons/events';
 | 
			
		||||
import { CoreSites, CoreSitesReadingStrategy } from '@services/sites';
 | 
			
		||||
import { CORE_SITE_PLUGINS_UPDATE_COURSE_CONTENT } from '@features/siteplugins/constants';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component to render a site plugin content.
 | 
			
		||||
@ -43,6 +45,11 @@ import { CORE_SITE_PLUGINS_UPDATE_COURSE_CONTENT } from '@features/siteplugins/c
 | 
			
		||||
    selector: 'core-site-plugins-plugin-content',
 | 
			
		||||
    templateUrl: 'core-siteplugins-plugin-content.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,10 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
 | 
			
		||||
import { CoreQuestionBehaviourDelegate } from '@features/question/services/behaviour-delegate';
 | 
			
		||||
import { CoreQuestionBehaviourButton, CoreQuestionQuestion } from '@features/question/services/question-helper';
 | 
			
		||||
@ -27,6 +29,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
 | 
			
		||||
    selector: 'core-site-plugins-question-behaviour',
 | 
			
		||||
    templateUrl: 'core-siteplugins-question-behaviour.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsQuestionBehaviourComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,10 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
 | 
			
		||||
import { AddonModQuizQuestion } from '@features/question/classes/base-question-component';
 | 
			
		||||
import { CoreQuestionDelegate } from '@features/question/services/question-delegate';
 | 
			
		||||
@ -28,6 +30,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
 | 
			
		||||
    selector: 'core-site-plugins-question',
 | 
			
		||||
    templateUrl: 'core-siteplugins-question.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsQuestionComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,8 @@ import { AddonModQuizAccessRuleDelegate } from '@addons/mod/quiz/services/access
 | 
			
		||||
import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '@addons/mod/quiz/services/quiz';
 | 
			
		||||
import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Component that displays a quiz access rule created using a site plugin.
 | 
			
		||||
@ -27,6 +29,11 @@ import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
    selector: 'core-site-plugins-quiz-access-rule',
 | 
			
		||||
    templateUrl: 'core-siteplugins-quiz-access-rule.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsQuizAccessRuleComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,9 +13,11 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { Component, OnInit, Input } from '@angular/core';
 | 
			
		||||
import { FormGroup } from '@angular/forms';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
 | 
			
		||||
import { AuthEmailSignupProfileField } from '@features/login/services/login-helper';
 | 
			
		||||
import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component';
 | 
			
		||||
@ -29,6 +31,11 @@ import { CoreUserProfileFieldDelegate } from '@features/user/services/user-profi
 | 
			
		||||
    selector: 'core-site-plugins-user-profile-field',
 | 
			
		||||
    templateUrl: 'core-siteplugins-user-profile-field.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsUserProfileFieldComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,11 +12,13 @@
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { toBoolean } from '@/core/transforms/boolean';
 | 
			
		||||
import { AddonWorkshopAssessmentStrategyDelegate } from '@addons/mod/workshop/services/assessment-strategy-delegate';
 | 
			
		||||
import { AddonModWorkshopGetAssessmentFormFieldsParsedData } from '@addons/mod/workshop/services/workshop';
 | 
			
		||||
import { AddonModWorkshopSubmissionAssessmentWithFormData } from '@addons/mod/workshop/services/workshop-helper';
 | 
			
		||||
import { Component, OnInit, Input } from '@angular/core';
 | 
			
		||||
import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module';
 | 
			
		||||
import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/classes/compile-init-component';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@ -26,6 +28,11 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
 | 
			
		||||
    selector: 'core-siteplugins-workshop-assessment-strategy',
 | 
			
		||||
    templateUrl: 'core-siteplugins-workshop-assessment-strategy.html',
 | 
			
		||||
    styles: [':host { display: contents; }'],
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreCompileHtmlComponentModule,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsWorkshopAssessmentStrategyComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,5 @@
 | 
			
		||||
<ion-content>
 | 
			
		||||
    <ion-refresher slot="fixed" [disabled]="!ptrEnabled || !content || !content.dataLoaded"
 | 
			
		||||
        (ionRefresh)="refreshData($event.target)">
 | 
			
		||||
    <ion-refresher slot="fixed" [disabled]="!ptrEnabled || !content || !content.dataLoaded" (ionRefresh)="refreshData($event.target)">
 | 
			
		||||
        <ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}" />
 | 
			
		||||
    </ion-refresher>
 | 
			
		||||
    <core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args"
 | 
			
		||||
 | 
			
		||||
@ -18,6 +18,7 @@ import { CoreSitePluginsPluginContentComponent } from '@features/siteplugins/com
 | 
			
		||||
import { CoreSitePlugins, CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CoreUtils } from '@services/utils/utils';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page that displays the index of a course option site plugin.
 | 
			
		||||
@ -25,8 +26,13 @@ import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
@Component({
 | 
			
		||||
    selector: 'core-site-plugins-course-option',
 | 
			
		||||
    templateUrl: 'core-siteplugins-course-option.html',
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsCourseOptionPage implements OnInit {
 | 
			
		||||
export default class CoreSitePluginsCourseOptionPage implements OnInit {
 | 
			
		||||
 | 
			
		||||
    @ViewChild(CoreSitePluginsPluginContentComponent) content?: CoreSitePluginsPluginContentComponent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,7 +13,6 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnInit, ViewChild } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreCourseModuleData } from '@features/course/services/course-helper';
 | 
			
		||||
import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
@ -22,6 +21,7 @@ import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreFilterFormatTextOptions } from '@features/filter/services/filter';
 | 
			
		||||
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
 | 
			
		||||
import { ContextLevel } from '@/core/constants';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page to render the index page of a module site plugin.
 | 
			
		||||
@ -29,8 +29,13 @@ import { ContextLevel } from '@/core/constants';
 | 
			
		||||
@Component({
 | 
			
		||||
    selector: 'page-core-site-plugins-module-index',
 | 
			
		||||
    templateUrl: 'module-index.html',
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreSitePluginsModuleIndexComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsModuleIndexPage implements OnInit, CanLeave {
 | 
			
		||||
export default class CoreSitePluginsModuleIndexPage implements OnInit, CanLeave {
 | 
			
		||||
 | 
			
		||||
    @ViewChild(CoreSitePluginsModuleIndexComponent) content?: CoreSitePluginsModuleIndexComponent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -13,13 +13,13 @@
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { Component, OnInit, ViewChild } from '@angular/core';
 | 
			
		||||
 | 
			
		||||
import { CoreSiteWSPreSets } from '@classes/sites/authenticated-site';
 | 
			
		||||
import { CoreSitePluginsContent } from '@features/siteplugins/services/siteplugins';
 | 
			
		||||
import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreUtils } from '@services/utils/utils';
 | 
			
		||||
import { CoreSitePluginsPluginContentComponent } from '../../components/plugin-content/plugin-content';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Page to render a site plugin page.
 | 
			
		||||
@ -27,8 +27,13 @@ import { CoreSitePluginsPluginContentComponent } from '../../components/plugin-c
 | 
			
		||||
@Component({
 | 
			
		||||
    selector: 'page-core-site-plugins-plugin',
 | 
			
		||||
    templateUrl: 'plugin.html',
 | 
			
		||||
    standalone: true,
 | 
			
		||||
    imports: [
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
        CoreSitePluginsPluginContentComponent,
 | 
			
		||||
    ],
 | 
			
		||||
})
 | 
			
		||||
export class CoreSitePluginsPluginPage implements OnInit, CanLeave {
 | 
			
		||||
export default class CoreSitePluginsPluginPage implements OnInit, CanLeave {
 | 
			
		||||
 | 
			
		||||
    @ViewChild(CoreSitePluginsPluginContentComponent) content?: CoreSitePluginsPluginContentComponent;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ import { CORE_SITE_PLUGINS_COMPONENT } from '../constants';
 | 
			
		||||
@Injectable({ providedIn: 'root' })
 | 
			
		||||
export class CoreSitePluginsInitService {
 | 
			
		||||
 | 
			
		||||
    protected logger: CoreLogger;
 | 
			
		||||
    protected logger = CoreLogger.getInstance('CoreSitePluginsInit');
 | 
			
		||||
    protected courseRestrictHandlers: Record<string, {
 | 
			
		||||
        plugin: CoreSitePluginsPlugin;
 | 
			
		||||
        handlerName: string;
 | 
			
		||||
@ -112,10 +112,6 @@ export class CoreSitePluginsInitService {
 | 
			
		||||
 | 
			
		||||
    protected static readonly HANDLER_DISABLED = 'core_site_plugins_helper_handler_disabled';
 | 
			
		||||
 | 
			
		||||
    constructor() {
 | 
			
		||||
        this.logger = CoreLogger.getInstance('CoreSitePluginsInit');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Initialize.
 | 
			
		||||
     */
 | 
			
		||||
 | 
			
		||||
@ -12,22 +12,40 @@
 | 
			
		||||
// See the License for the specific language governing permissions and
 | 
			
		||||
// limitations under the License.
 | 
			
		||||
 | 
			
		||||
import { APP_INITIALIZER, NgModule } from '@angular/core';
 | 
			
		||||
import { APP_INITIALIZER, NgModule, Type } from '@angular/core';
 | 
			
		||||
import { Routes } from '@angular/router';
 | 
			
		||||
 | 
			
		||||
import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module';
 | 
			
		||||
import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module';
 | 
			
		||||
import { CoreMainMenuHomeRoutingModule } from '@features/mainmenu/mainmenu-home-routing.module';
 | 
			
		||||
import { CoreSitePreferencesRoutingModule } from '@features/settings/settings-site-routing.module';
 | 
			
		||||
import { CoreSitePluginsComponentsModule } from './components/components.module';
 | 
			
		||||
import { CoreSitePluginsInit } from './services/siteplugins-init';
 | 
			
		||||
import { CoreSharedModule } from '@/core/shared.module';
 | 
			
		||||
import { CoreSitePluginsPluginPage } from '@features/siteplugins/pages/plugin/plugin';
 | 
			
		||||
import { canLeaveGuard } from '@guards/can-leave';
 | 
			
		||||
import { CoreSitePluginsCourseOptionPage } from '@features/siteplugins/pages/course-option/course-option';
 | 
			
		||||
import { CoreSitePluginsModuleIndexPage } from '@features/siteplugins/pages/module-index/module-index';
 | 
			
		||||
import { CORE_SITE_PLUGINS_PATH } from './constants';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get site plugins directives modules.
 | 
			
		||||
 *
 | 
			
		||||
 * @returns Site plugins exported directives.
 | 
			
		||||
 */
 | 
			
		||||
export async function getSitePluginsDirectives(): Promise<unknown[]> {
 | 
			
		||||
    const { CoreSitePluginsDirectivesModule } = await import('./directives/directives.module');
 | 
			
		||||
 | 
			
		||||
    return [CoreSitePluginsDirectivesModule];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get shared files services.
 | 
			
		||||
 *
 | 
			
		||||
 * @returns Returns shared files services.
 | 
			
		||||
 */
 | 
			
		||||
export async function getSitePluginsServices(): Promise<Type<unknown>[]> {
 | 
			
		||||
    const { CoreSitePluginsProvider } = await import('@features/siteplugins/services/siteplugins');
 | 
			
		||||
 | 
			
		||||
    return [
 | 
			
		||||
        CoreSitePluginsProvider,
 | 
			
		||||
    ];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Get site plugins exported objects.
 | 
			
		||||
 *
 | 
			
		||||
@ -67,7 +85,7 @@ export async function getSitePluginsExportedObjects(): Promise<Record<string, un
 | 
			
		||||
const routes: Routes = [
 | 
			
		||||
    {
 | 
			
		||||
        path: `${CORE_SITE_PLUGINS_PATH}/content/:component/:method/:hash`,
 | 
			
		||||
        component: CoreSitePluginsPluginPage,
 | 
			
		||||
        loadComponent: () => import('@features/siteplugins/pages/plugin/plugin'),
 | 
			
		||||
        canDeactivate: [canLeaveGuard],
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
@ -75,7 +93,7 @@ const routes: Routes = [
 | 
			
		||||
const homeRoutes: Routes = [
 | 
			
		||||
    {
 | 
			
		||||
        path: `${CORE_SITE_PLUGINS_PATH}/homecontent/:component/:method`,
 | 
			
		||||
        component: CoreSitePluginsPluginPage,
 | 
			
		||||
        loadComponent: () => import('@features/siteplugins/pages/plugin/plugin'),
 | 
			
		||||
        canDeactivate: [canLeaveGuard],
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
@ -83,7 +101,7 @@ const homeRoutes: Routes = [
 | 
			
		||||
const courseIndexRoutes: Routes = [
 | 
			
		||||
    {
 | 
			
		||||
        path: `${CORE_SITE_PLUGINS_PATH}/:handlerUniqueName`,
 | 
			
		||||
        component: CoreSitePluginsCourseOptionPage,
 | 
			
		||||
        loadComponent: () => import('@features/siteplugins/pages/course-option/course-option'),
 | 
			
		||||
        canDeactivate: [canLeaveGuard],
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
@ -91,7 +109,7 @@ const courseIndexRoutes: Routes = [
 | 
			
		||||
const moduleRoutes: Routes = [
 | 
			
		||||
    {
 | 
			
		||||
        path: `${CORE_SITE_PLUGINS_PATH}/module/:courseId/:cmId`,
 | 
			
		||||
        component: CoreSitePluginsModuleIndexPage,
 | 
			
		||||
        loadComponent: () => import('@features/siteplugins/pages/module-index/module-index'),
 | 
			
		||||
        canDeactivate: [canLeaveGuard],
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
@ -102,19 +120,14 @@ const moduleRoutes: Routes = [
 | 
			
		||||
        CoreCourseIndexRoutingModule.forChild({ children: courseIndexRoutes }),
 | 
			
		||||
        CoreMainMenuHomeRoutingModule.forChild({ children: homeRoutes }),
 | 
			
		||||
        CoreSitePreferencesRoutingModule.forChild(routes),
 | 
			
		||||
        CoreSitePluginsComponentsModule,
 | 
			
		||||
        CoreSharedModule,
 | 
			
		||||
    ],
 | 
			
		||||
    declarations: [
 | 
			
		||||
        CoreSitePluginsPluginPage,
 | 
			
		||||
        CoreSitePluginsCourseOptionPage,
 | 
			
		||||
        CoreSitePluginsModuleIndexPage,
 | 
			
		||||
    ],
 | 
			
		||||
    providers: [
 | 
			
		||||
        {
 | 
			
		||||
            provide: APP_INITIALIZER,
 | 
			
		||||
            multi: true,
 | 
			
		||||
            useValue: () => {
 | 
			
		||||
            useValue: async () => {
 | 
			
		||||
                const { CoreSitePluginsInit } = await import('./services/siteplugins-init');
 | 
			
		||||
 | 
			
		||||
                CoreSitePluginsInit.init();
 | 
			
		||||
            },
 | 
			
		||||
        },
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user