commit
61fc58e0c0
|
@ -497,7 +497,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
|
||||||
this.calendarProvider.submitEvent(this.eventId, data).then((result) => {
|
this.calendarProvider.submitEvent(this.eventId, data).then((result) => {
|
||||||
event = result.event;
|
event = result.event;
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.currentSite.getId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.currentSite.getId());
|
||||||
|
|
||||||
if (result.sent) {
|
if (result.sent) {
|
||||||
// Event created or edited, invalidate right days & months.
|
// Event created or edited, invalidate right days & months.
|
||||||
|
@ -561,7 +561,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
|
||||||
this.domUtils.showConfirm(this.translate.instant('core.areyousure')).then(() => {
|
this.domUtils.showConfirm(this.translate.instant('core.areyousure')).then(() => {
|
||||||
this.calendarOffline.deleteEvent(this.eventId).then(() => {
|
this.calendarOffline.deleteEvent(this.eventId).then(() => {
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
|
||||||
|
|
||||||
this.returnToList();
|
this.returnToList();
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
|
@ -584,7 +584,7 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy {
|
||||||
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.currentSite.getId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.currentSite.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,7 +71,7 @@ export class AddonModAssignEditFeedbackModalPage {
|
||||||
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,7 +92,7 @@ export class AddonModAssignEditFeedbackModalPage {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
// Close the modal, sending the input data.
|
// Close the modal, sending the input data.
|
||||||
this.forceLeave = true;
|
this.forceLeave = true;
|
||||||
|
|
|
@ -99,7 +99,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
|
||||||
// Nothing has changed or user confirmed to leave. Clear temporary data from plugins.
|
// Nothing has changed or user confirmed to leave. Clear temporary data from plugins.
|
||||||
this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, this.getInputData());
|
this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, this.getInputData());
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,7 +318,7 @@ export class AddonModAssignEditPage implements OnInit, OnDestroy {
|
||||||
await this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, inputData);
|
await this.assignHelper.clearSubmissionPluginTmpData(this.assign, this.userSubmission, inputData);
|
||||||
|
|
||||||
// Submission saved, trigger events.
|
// Submission saved, trigger events.
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
assignmentId: this.assign.id,
|
assignmentId: this.assign.id,
|
||||||
|
|
|
@ -114,7 +114,7 @@ export class AddonModDataEditPage {
|
||||||
const files = await this.dataHelper.getEditTmpFiles(inputData, this.fieldsArray, this.data.id, this.entry.contents);
|
const files = await this.dataHelper.getEditTmpFiles(inputData, this.fieldsArray, this.data.id, this.entry.contents);
|
||||||
this.fileUploaderProvider.clearTmpFiles(files);
|
this.fileUploaderProvider.clearTmpFiles(files);
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +215,7 @@ export class AddonModDataEditPage {
|
||||||
// This is done if entry is updated when editing or creating if not.
|
// This is done if entry is updated when editing or creating if not.
|
||||||
if ((this.entryId && result.updated) || (!this.entryId && result.newentryid)) {
|
if ((this.entryId && result.updated) || (!this.entryId && result.newentryid)) {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.siteId);
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
|
|
|
@ -187,9 +187,9 @@ export class AddonModDataSearchPage {
|
||||||
*/
|
*/
|
||||||
closeModal(data?: any): void {
|
closeModal(data?: any): void {
|
||||||
if (typeof data == 'undefined') {
|
if (typeof data == 'undefined') {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
} else {
|
} else {
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.viewCtrl.dismiss(data);
|
this.viewCtrl.dismiss(data);
|
||||||
|
|
|
@ -109,9 +109,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
* Detect changes on input properties.
|
* Detect changes on input properties.
|
||||||
*/
|
*/
|
||||||
ngOnChanges(changes: {[name: string]: SimpleChange}): void {
|
ngOnChanges(changes: {[name: string]: SimpleChange}): void {
|
||||||
if (changes.leavingPage && this.leavingPage && this.formElement) {
|
if (changes.leavingPage && this.leavingPage) {
|
||||||
// Download all courses is enabled now, initialize it.
|
// Download all courses is enabled now, initialize it.
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,7 +423,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
|
|
||||||
this.onPostChange.emit();
|
this.onPostChange.emit();
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
if (this.syncId) {
|
if (this.syncId) {
|
||||||
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
|
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
|
||||||
|
@ -443,7 +443,7 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges
|
||||||
// Reset data.
|
// Reset data.
|
||||||
this.setReplyFormData();
|
this.setReplyFormData();
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
if (this.syncId) {
|
if (this.syncId) {
|
||||||
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
|
this.syncProvider.unblockOperation(AddonModForumProvider.COMPONENT, this.syncId);
|
||||||
|
|
|
@ -120,9 +120,9 @@ export class AddonModForumEditPostPage {
|
||||||
*/
|
*/
|
||||||
closeModal(data: any, ): void {
|
closeModal(data: any, ): void {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
} else {
|
} else {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.viewCtrl.dismiss(data);
|
this.viewCtrl.dismiss(data);
|
||||||
|
|
|
@ -480,8 +480,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
|
||||||
this.domUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true);
|
this.domUtils.showErrorModalDefault(null, 'addon.mod_forum.errorposttoallgroups', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!discussionIds,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!discussionIds, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
this.returnToDiscussions(discussionIds, discTimecreated);
|
this.returnToDiscussions(discussionIds, discTimecreated);
|
||||||
}).catch((message) => {
|
}).catch((message) => {
|
||||||
|
@ -504,7 +503,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return Promise.all(promises).then(() => {
|
return Promise.all(promises).then(() => {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.returnToDiscussions();
|
this.returnToDiscussions();
|
||||||
});
|
});
|
||||||
|
@ -539,7 +538,7 @@ export class AddonModForumNewDiscussionPage implements OnDestroy {
|
||||||
this.uploaderProvider.clearTmpFiles(this.newDiscussion.files);
|
this.uploaderProvider.clearTmpFiles(this.newDiscussion.files);
|
||||||
|
|
||||||
if (this.formElement) {
|
if (this.formElement) {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ export class AddonModGlossaryEditPage implements OnInit {
|
||||||
// Delete the local files from the tmp folder.
|
// Delete the local files from the tmp folder.
|
||||||
this.uploaderProvider.clearTmpFiles(this.attachments);
|
this.uploaderProvider.clearTmpFiles(this.attachments);
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -253,8 +253,7 @@ export class AddonModGlossaryEditPage implements OnInit {
|
||||||
};
|
};
|
||||||
this.eventsProvider.trigger(AddonModGlossaryProvider.ADD_ENTRY_EVENT, data, this.sitesProvider.getCurrentSiteId());
|
this.eventsProvider.trigger(AddonModGlossaryProvider.ADD_ENTRY_EVENT, data, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!entryId,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!entryId, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
this.saved = true;
|
this.saved = true;
|
||||||
this.navCtrl.pop();
|
this.navCtrl.pop();
|
||||||
|
|
|
@ -586,7 +586,7 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
|
||||||
this.refreshIcon = 'refresh';
|
this.refreshIcon = 'refresh';
|
||||||
this.syncIcon = 'sync';
|
this.syncIcon = 'sync';
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.siteId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ export class AddonModLessonPasswordModalPage {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.viewCtrl.dismiss(password.value);
|
this.viewCtrl.dismiss(password.value);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ export class AddonModLessonPasswordModalPage {
|
||||||
* Close modal.
|
* Close modal.
|
||||||
*/
|
*/
|
||||||
closeModal(): void {
|
closeModal(): void {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -552,8 +552,7 @@ export class AddonModLessonPlayerPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
return this.callFunction(this.lessonProvider.processPage.bind(this.lessonProvider), args, 6, 8).then((result) => {
|
return this.callFunction(this.lessonProvider.processPage.bind(this.lessonProvider), args, 6, 8).then((result) => {
|
||||||
if (formSubmitted) {
|
if (formSubmitted) {
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, result.sent,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, result.sent, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.offline && !this.review && this.lessonProvider.isLessonOffline(this.lesson)) {
|
if (!this.offline && !this.review && this.lessonProvider.isLessonOffline(this.lesson)) {
|
||||||
|
|
|
@ -154,9 +154,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
await this.domUtils.showConfirm(this.translate.instant('addon.mod_quiz.confirmleavequizonerror'));
|
await this.domUtils.showConfirm(this.translate.instant('addon.mod_quiz.confirmleavequizonerror'));
|
||||||
|
|
||||||
if (this.formElement) {
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
|
||||||
}
|
|
||||||
} finally {
|
} finally {
|
||||||
modal.dismiss();
|
modal.dismiss();
|
||||||
}
|
}
|
||||||
|
@ -592,8 +590,7 @@ export class AddonModQuizPlayerPage implements OnInit, OnDestroy {
|
||||||
this.autoSave.hideAutoSaveError();
|
this.autoSave.hideAutoSaveError();
|
||||||
|
|
||||||
if (this.formElement) {
|
if (this.formElement) {
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !this.offline,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !this.offline, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,7 +120,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
|
||||||
this.domUtils.showErrorModal('core.errorinvalidform', true);
|
this.domUtils.showErrorModal('core.errorinvalidform', true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.siteId);
|
||||||
|
|
||||||
this.viewCtrl.dismiss(this.preflightForm.value);
|
this.viewCtrl.dismiss(this.preflightForm.value);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ export class AddonModQuizPreflightModalPage implements OnInit {
|
||||||
* Close modal.
|
* Close modal.
|
||||||
*/
|
*/
|
||||||
closeModal(): void {
|
closeModal(): void {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
|
||||||
|
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,7 +356,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
|
||||||
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -426,8 +426,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
|
||||||
// Edit existing page.
|
// Edit existing page.
|
||||||
promise = this.wikiProvider.editPage(this.pageId, text, this.section).then(() => {
|
promise = this.wikiProvider.editPage(this.pageId, text, this.section).then(() => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
// Invalidate page since it changed.
|
// Invalidate page since it changed.
|
||||||
return this.wikiProvider.invalidatePage(this.pageId).then(() => {
|
return this.wikiProvider.invalidatePage(this.pageId).then(() => {
|
||||||
|
@ -463,8 +462,7 @@ export class AddonModWikiEditPage implements OnInit, OnDestroy {
|
||||||
|
|
||||||
return this.wikiProvider.newPage(title, text, this.subwikiId, wikiId, this.userId, this.groupId).then((id) => {
|
return this.wikiProvider.newPage(title, text, this.subwikiId, wikiId, this.userId, this.groupId).then((id) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, id > 0,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, id > 0, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
// Page was created, get its data and go to the page.
|
// Page was created, get its data and go to the page.
|
||||||
|
|
|
@ -304,7 +304,7 @@ export class AddonModWorkshopAssessmentStrategyComponent implements OnInit {
|
||||||
assessmentData, false, allowOffline);
|
assessmentData, false, allowOffline);
|
||||||
}).then((grade) => {
|
}).then((grade) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!grade, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!grade, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
const promises = [];
|
const promises = [];
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
|
||||||
// Show confirmation if some data has been modified.
|
// Show confirmation if some data has been modified.
|
||||||
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -346,7 +346,7 @@ export class AddonModWorkshopAssessmentPage implements OnInit, OnDestroy {
|
||||||
return this.workshopProvider.evaluateAssessment(this.workshopId, this.assessmentId, this.courseId, inputData.text,
|
return this.workshopProvider.evaluateAssessment(this.workshopId, this.assessmentId, this.courseId, inputData.text,
|
||||||
inputData.weight, inputData.grade).then((result) => {
|
inputData.weight, inputData.grade).then((result) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
workshopId: this.workshopId,
|
workshopId: this.workshopId,
|
||||||
|
|
|
@ -128,7 +128,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
|
||||||
this.fileUploaderProvider.clearTmpFiles(this.submission.attachmentfiles);
|
this.fileUploaderProvider.clearTmpFiles(this.submission.attachmentfiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -374,7 +374,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy {
|
||||||
attachmentsId, undefined, submissionId, allowOffline);
|
attachmentsId, undefined, submissionId, allowOffline);
|
||||||
}).then((newSubmissionId) => {
|
}).then((newSubmissionId) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!newSubmissionId, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!newSubmissionId, this.siteId);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
workshopId: this.workshopId,
|
workshopId: this.workshopId,
|
||||||
|
|
|
@ -153,7 +153,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
|
||||||
// Show confirmation if some data has been modified.
|
// Show confirmation if some data has been modified.
|
||||||
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
await this.domUtils.showConfirm(this.translate.instant('core.confirmcanceledit'));
|
||||||
|
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.siteId);
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -449,7 +449,7 @@ export class AddonModWorkshopSubmissionPage implements OnInit, OnDestroy {
|
||||||
return this.workshopProvider.evaluateSubmission(this.workshopId, this.submissionId, this.courseId, inputData.text,
|
return this.workshopProvider.evaluateSubmission(this.workshopId, this.submissionId, this.courseId, inputData.text,
|
||||||
inputData.published, inputData.grade).then((result) => {
|
inputData.published, inputData.grade).then((result) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!result, this.siteId);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!result, this.siteId);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
workshopId: this.workshopId,
|
workshopId: this.workshopId,
|
||||||
|
|
|
@ -65,7 +65,7 @@ export class AddonNotesAddPage {
|
||||||
this.processing = true;
|
this.processing = true;
|
||||||
this.notesProvider.addNote(this.userId, this.courseId, this.type, this.text).then((sent) => {
|
this.notesProvider.addNote(this.userId, this.courseId, this.type, this.text).then((sent) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, sent, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, sent, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.viewCtrl.dismiss({type: this.type, sent: true}).finally(() => {
|
this.viewCtrl.dismiss({type: this.type, sent: true}).finally(() => {
|
||||||
this.domUtils.showToast(sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline', true, 3000);
|
this.domUtils.showToast(sent ? 'addon.notes.eventnotecreated' : 'core.datastoredoffline', true, 3000);
|
||||||
|
@ -82,7 +82,7 @@ export class AddonNotesAddPage {
|
||||||
* Close modal.
|
* Close modal.
|
||||||
*/
|
*/
|
||||||
closeModal(): void {
|
closeModal(): void {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.viewCtrl.dismiss({type: this.type});
|
this.viewCtrl.dismiss({type: this.type});
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ export class CoreLocalFileComponent implements OnInit {
|
||||||
if (newName == this.file.name) {
|
if (newName == this.file.name) {
|
||||||
// Name hasn't changed, stop.
|
// Name hasn't changed, stop.
|
||||||
this.editMode = false;
|
this.editMode = false;
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -160,8 +160,7 @@ export class CoreLocalFileComponent implements OnInit {
|
||||||
// File doesn't exist, move it.
|
// File doesn't exist, move it.
|
||||||
return this.fileProvider.moveFile(this.relativePath, newPath).then((fileEntry) => {
|
return this.fileProvider.moveFile(this.relativePath, newPath).then((fileEntry) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
this.editMode = false;
|
this.editMode = false;
|
||||||
this.file = fileEntry;
|
this.file = fileEntry;
|
||||||
|
|
|
@ -90,7 +90,7 @@ export class CoreSendMessageFormComponent implements OnInit {
|
||||||
|
|
||||||
this.message = ''; // Reset the form.
|
this.message = ''; // Reset the form.
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
value = this.textUtils.replaceNewLines(value, '<br>');
|
value = this.textUtils.replaceNewLines(value, '<br>');
|
||||||
this.onSubmit.emit(value);
|
this.onSubmit.emit(value);
|
||||||
|
|
|
@ -71,8 +71,7 @@ export class CoreCommentsAddPage {
|
||||||
this.commentsProvider.addComment(this.content, this.contextLevel, this.instanceId, this.componentName, this.itemId,
|
this.commentsProvider.addComment(this.content, this.contextLevel, this.instanceId, this.componentName, this.itemId,
|
||||||
this.area).then((commentsResponse) => {
|
this.area).then((commentsResponse) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, !!commentsResponse,
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, !!commentsResponse, this.sitesProvider.getCurrentSiteId());
|
||||||
this.sitesProvider.getCurrentSiteId());
|
|
||||||
|
|
||||||
this.viewCtrl.dismiss({comments: commentsResponse}).finally(() => {
|
this.viewCtrl.dismiss({comments: commentsResponse}).finally(() => {
|
||||||
this.domUtils.showToast(commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline', true,
|
this.domUtils.showToast(commentsResponse ? 'core.comments.eventcommentcreated' : 'core.datastoredoffline', true,
|
||||||
|
@ -90,7 +89,7 @@ export class CoreCommentsAddPage {
|
||||||
* Close modal.
|
* Close modal.
|
||||||
*/
|
*/
|
||||||
closeModal(): void {
|
closeModal(): void {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1258,7 +1258,7 @@ export class CoreCourseHelperProvider {
|
||||||
} else {
|
} else {
|
||||||
modal.dismiss();
|
modal.dismiss();
|
||||||
|
|
||||||
return this.getAndOpenCourse(undefined, courseId, params, siteId);
|
return this.getAndOpenCourse(navCtrl, courseId, params, siteId);
|
||||||
}
|
}
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
modal.dismiss();
|
modal.dismiss();
|
||||||
|
|
|
@ -39,7 +39,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
|
||||||
* Close help modal.
|
* Close help modal.
|
||||||
*/
|
*/
|
||||||
close(): void {
|
close(): void {
|
||||||
this.domUtils.triggerFormCancelledEvent(this.formElement.nativeElement, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormCancelledEvent(this.formElement, this.sitesProvider.getCurrentSiteId());
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ export class CoreCoursesSelfEnrolPasswordPage {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.viewCtrl.dismiss(password);
|
this.viewCtrl.dismiss(password);
|
||||||
}
|
}
|
||||||
|
|
|
@ -246,7 +246,7 @@ export class CoreLoginCredentialsPage {
|
||||||
}).finally(() => {
|
}).finally(() => {
|
||||||
modal.dismiss();
|
modal.dismiss();
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ export class CoreLoginEmailSignupPage {
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.signupFormElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.signupFormElement, true);
|
||||||
|
|
||||||
// Show alert and ho back.
|
// Show alert and ho back.
|
||||||
const message = this.translate.instant('core.login.emailconfirmsent', { $a: params.email });
|
const message = this.translate.instant('core.login.emailconfirmsent', { $a: params.email });
|
||||||
|
@ -349,7 +349,7 @@ export class CoreLoginEmailSignupPage {
|
||||||
|
|
||||||
this.wsProvider.callAjax('core_auth_is_minor', params, {siteUrl: this.siteUrl}).then((result) => {
|
this.wsProvider.callAjax('core_auth_is_minor', params, {siteUrl: this.siteUrl}).then((result) => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.ageFormElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.ageFormElement, true);
|
||||||
|
|
||||||
if (!result.status) {
|
if (!result.status) {
|
||||||
if (this.countryControl.value) {
|
if (this.countryControl.value) {
|
||||||
|
|
|
@ -82,7 +82,7 @@ export class CoreLoginForgottenPasswordPage {
|
||||||
this.domUtils.showErrorModal(response.notice);
|
this.domUtils.showErrorModal(response.notice);
|
||||||
} else {
|
} else {
|
||||||
// Success.
|
// Success.
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
|
||||||
|
|
||||||
this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
|
this.domUtils.showAlert(this.translate.instant('core.success'), response.notice);
|
||||||
this.navCtrl.pop();
|
this.navCtrl.pop();
|
||||||
|
|
|
@ -181,7 +181,7 @@ export class CoreLoginReconnectPage {
|
||||||
this.sitesProvider.getUserToken(siteUrl, username, password).then((data) => {
|
this.sitesProvider.getUserToken(siteUrl, username, password).then((data) => {
|
||||||
return this.sitesProvider.updateSiteToken(this.infoSiteUrl, username, data.token, data.privateToken).then(() => {
|
return this.sitesProvider.updateSiteToken(this.infoSiteUrl, username, data.token, data.privateToken).then(() => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
|
||||||
|
|
||||||
// Update site info too because functions might have changed (e.g. unisntall local_mobile).
|
// Update site info too because functions might have changed (e.g. unisntall local_mobile).
|
||||||
return this.sitesProvider.updateSiteInfoByUrl(this.infoSiteUrl, username).then(() => {
|
return this.sitesProvider.updateSiteInfoByUrl(this.infoSiteUrl, username).then(() => {
|
||||||
|
|
|
@ -107,7 +107,7 @@ export class CoreLoginSitePage {
|
||||||
this.sitesProvider.getUserToken(siteData.url, siteData.username, siteData.password).then((data) => {
|
this.sitesProvider.getUserToken(siteData.url, siteData.username, siteData.password).then((data) => {
|
||||||
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken).then(() => {
|
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken).then(() => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
|
||||||
|
|
||||||
return this.loginHelper.goToSiteInitialPage();
|
return this.loginHelper.goToSiteInitialPage();
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
|
@ -189,7 +189,7 @@ export class CoreLoginSitePage {
|
||||||
protected async login(response: CoreSiteCheckResponse): Promise<void> {
|
protected async login(response: CoreSiteCheckResponse): Promise<void> {
|
||||||
return this.sitesProvider.checkRequiredMinimumVersion(response.config).then(() => {
|
return this.sitesProvider.checkRequiredMinimumVersion(response.config).then(() => {
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, true);
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, true);
|
||||||
|
|
||||||
if (response.warning) {
|
if (response.warning) {
|
||||||
this.domUtils.showErrorModal(response.warning, true, 4000);
|
this.domUtils.showErrorModal(response.warning, true, 4000);
|
||||||
|
|
|
@ -98,7 +98,7 @@ export class CoreSearchBoxComponent implements OnInit {
|
||||||
this.saveSearchToHistory(this.searchText);
|
this.saveSearchToHistory(this.searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.domUtils.triggerFormSubmittedEvent(this.formElement.nativeElement, false, this.sitesProvider.getCurrentSiteId());
|
this.domUtils.triggerFormSubmittedEvent(this.formElement, false, this.sitesProvider.getCurrentSiteId());
|
||||||
|
|
||||||
this.searched = this.searchText;
|
this.searched = this.searchText;
|
||||||
this.onSubmit.emit(this.searchText);
|
this.onSubmit.emit(this.searchText);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
import { Injectable, SimpleChange } from '@angular/core';
|
import { Injectable, SimpleChange, ElementRef } from '@angular/core';
|
||||||
import {
|
import {
|
||||||
LoadingController, Loading, ToastController, Toast, AlertController, Alert, Platform, Content, PopoverController,
|
LoadingController, Loading, ToastController, Toast, AlertController, Alert, Platform, Content, PopoverController,
|
||||||
ModalController,
|
ModalController,
|
||||||
|
@ -1635,10 +1635,14 @@ export class CoreDomUtilsProvider {
|
||||||
* @param form Form element.
|
* @param form Form element.
|
||||||
* @param siteId The site affected. If not provided, no site affected.
|
* @param siteId The site affected. If not provided, no site affected.
|
||||||
*/
|
*/
|
||||||
triggerFormCancelledEvent(form: HTMLElement, siteId?: string): void {
|
triggerFormCancelledEvent(formRef: ElementRef, siteId?: string): void {
|
||||||
|
if (!formRef) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
|
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
|
||||||
action: 'cancel',
|
action: 'cancel',
|
||||||
form: form,
|
form: formRef.nativeElement,
|
||||||
}, siteId);
|
}, siteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,10 +1653,14 @@ export class CoreDomUtilsProvider {
|
||||||
* @param online Whether the action was done in offline or not.
|
* @param online Whether the action was done in offline or not.
|
||||||
* @param siteId The site affected. If not provided, no site affected.
|
* @param siteId The site affected. If not provided, no site affected.
|
||||||
*/
|
*/
|
||||||
triggerFormSubmittedEvent(form: HTMLElement, online?: boolean, siteId?: string): void {
|
triggerFormSubmittedEvent(formRef: ElementRef, online?: boolean, siteId?: string): void {
|
||||||
|
if (!formRef) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
|
this.eventsProvider.trigger(CoreEventsProvider.FORM_ACTION, {
|
||||||
action: 'submit',
|
action: 'submit',
|
||||||
form: form,
|
form: formRef.nativeElement,
|
||||||
online: !!online,
|
online: !!online,
|
||||||
}, siteId);
|
}, siteId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue